Savegames/es: Difference between revisions

Xerpi (talk | contribs)
Created page with "Esta página describe el formato, la des/encriptación, etc de las partidas guardadas de los cartuchos de los juegos de la 3DS. Puedes encontrar partidas guardadas de varios jueg..."
 
Pigeon (talk | contribs)
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Esta página describe el formato, la des/encriptación, etc de las partidas guardadas de los cartuchos de los juegos de la 3DS. Puedes encontrar partidas guardadas de varios juegos de la 3DS en la página de [[Games/es|Juegos]].
Esta página describe el formato, la des/encriptación, etc de las partidas guardadas de los cartuchos de los juegos de la 3DS. Puedes encontrar partidas guardadas de varios juegos de la 3DS en la página de [[Games|Juegos (Inglés)]].




Line 21: Line 21:
'''Más información:'''
'''Más información:'''
*Los juegos viejos aún usan el antiguo xorpad de 0x200 bytes.
*Los juegos viejos aún usan el antiguo xorpad de 0x200 bytes.
* New games saves can be backed-up and restored (same key is used from one save to another).
*Los juegos nuevos puedes ser copiados y restaurados (se usa la misma clava tanto una partida como para otra)
*Los juegos nuevos puedes ser copiados y restaurados (se usa la misma clava tanto una partida como para otra)
* El wearleveling sigue siendo el mismo.
* El wearleveling sigue siendo el mismo.
Line 27: Line 26:
*Se ha observado que el xorpad se repite cada 0x1000 bytes (podría ser la longitud máxima pero aún no se ha probado).
*Se ha observado que el xorpad se repite cada 0x1000 bytes (podría ser la longitud máxima pero aún no se ha probado).


=== Wear leveling ===
=== Nivel de desgaste ===


The 3DS employs a wear leveling scheme on the savegame FLASH chips. This is done through the usage of blockmaps and a journal. The blockmap is located at offset 0 of the flash chip, and is immediately followed by the journal. The initial state is dictated by the blockmap, and the journal is then applied to that.
La 3DS utiliza un esquema para prevenir el nivel de desgaste de los chips FLASH de las partidas. Eso lo consigue utilizando blockmaps i un journal. El blockmap se encuentra en el offset 0 del chip, y es seguido inmediatamente por el journal. El estado inicial es dictado por el blockmap, y el journal es entonces aplicado.


First, there are 8 bytes whose purposes are currently unknown. Then comes the actual blockmap.
Primero hay 8 bytes cuyos fines se desconocen aún. Luego viene el blockmap.
The blockmap structure is simple:
La estructura del blockmap es simple:
<pre>
<pre>
struct header_entry {
struct header_entry {
         uint8_t phys_sec; // when bit7 is set, block has checksums, otherwise checksums are all zero
         uint8_t phys_sec; // cuando se establece el sépitmo bit, el bloque tiene  checksums, de lo contrario los checksums son cero
         uint8_t alloc_cnt;
         uint8_t alloc_cnt;
         uint8_t chksums[8];
         uint8_t chksums[8];
Line 41: Line 40:
</pre>
</pre>


There's one entry per sector, counting from physical sector 1 (sector 0 contains the blockmap/journal).
Hay un journal por sector, contando desde el sector físico 1(el sector 0 contiene el blockmap/journal).
Los siguientes dos bytes que siguen al blockmap son el CRC16 (con 0xFFFF como valor inicial (como el modbus)) de los primeros 8 bytes del blockmap.


The 2 bytes that follow the blockmap are the CRC16 (with starting value 0xFFFF (like modbus)) of the first 8 bytes and the blockmap.
Entonces hay el journal.
 
La estructura del journal es:
Then comes the journal.
The journal structure is as follows:
<pre>
<pre>
struct sector_entry {
struct sector_entry {
         uint8_t virt_sec;      // Mapped to sector
         uint8_t virt_sec;      // Asignado al sector
         uint8_t prev_virt_sec;  // Physical sector previously mapped to
         uint8_t prev_virt_sec;  // Sector físico previamente asignado
         uint8_t phys_sec;      // Mapped from sector
         uint8_t phys_sec;      // Asignado desde el sector
         uint8_t prev_phys_sec;  // Virtual sector previously mapped to
         uint8_t prev_phys_sec;  // Sector virtual previamente asignado
         uint8_t phys_realloc_cnt;      // Amount of times physical sector has been remapped
         uint8_t phys_realloc_cnt;      // Cantidas de veces que el sector físico ha sido reasignado
         uint8_t virt_realloc_cnt;      // Amount of times virtual sector has been remapped
         uint8_t virt_realloc_cnt;      // Cantidas de veces que el sector virtual ha sido reasignado
         uint8_t chksums[8];
         uint8_t chksums[8];
} __attribute__((__packed__));
} __attribute__((__packed__));
Line 65: Line 63:
</pre>
</pre>


With magic being a constant 0x080d6ce0.
Con la constante mágica 0x080d6ce0.


The checksums in the blockmap/journal entries work as follows:
Los checksums de las entradas del blockmap/journal trabajan de la siguiente forma:
* each byte is the checksum of an encrypted 0x200 bytes large block
* cada byte es el checksum de un bloque de tamaño 0x200 bytes encriptado
* to calculate the checksum, a CRC16 of the block (with starting value 0xFFFF) is calculated, and the two bytes of the CRC16 are XORed together to produce the 8bit checksum
* para calcular el checksum, el CRC16 del bloque ( con el valor iniciar 0xFFFF) es calculado, y los dos bytes del CRC16 son XOReados juntos para producir un checksum de 8 bits.


=== Partitions ===
=== Particiones===


There can be multiple partitions on the chip.  
Puede haber múltiples particiones en el chip.  
The partitions are represented by tables of DIFI blobs inside a DISA structure.
Las particiones están representadas por tablas de manchas del DIFI dentro de la estructura DISA.
The order of the DIFI blobs is the order of the partitions in the chip.
El orden de las manchas del DIFI es el orden de las particiones del chip.


'''DISA'''
'''DISA'''
Line 84: Line 82:
{| class="wikitable"
{| class="wikitable"
|-
|-
! Start
! Principio
! Length
! Longitud
! Description
! Descripción
|-
|-
| 0x00
| 0x00
Line 94: Line 92:
| 0x04
| 0x04
| 4
| 4
| Unknown (maybe magic, the same in all the save files so far)
| Desconocido (puede ser mágico, puede ser el mismo que todas las partidas)
|-
|-
| 0x08
| 0x08
| 8
| 8
| Partition table size
| Tamaño de la tabla de particiones
|-
|-
| 0x10
| 0x10
| 8
| 8
| Offset to primary partition table in DISA
| Offset a la partición primaria de la tabla del DISA
|-
|-
| 0x18
| 0x18
| 8
| 8
| Offset to secondary partition table in DISA
| Offset a la partición secundaria de la tabla del DISA
|-
|-
| 0x20
| 0x20
| 8
| 8
| Partition table's length
| Longitud de la tabla de particiones
|-
|-
| 0x28
| 0x28
| 8
| 8
| SAVE Partition entry offset in the partition table
| Offset de la entrada de guardado en la tabla de particiones
|-
|-
| 0x30
| 0x30
| 8
| 8
| SAVE Partition entry length in the partition table
| Longitud de la entrada de guardado en la tabla de particiones
|-
|-
| 0x38
| 0x38
| 8
| 8
| DATA Partition entry offset in the partition table
| Offset de la entrada de datos en la tabla de particiones
|-
|-
| 0x40
| 0x40
| 8
| 8
| DATA Partition entry length in the partition table
| Longitud de la entrada de datos en la tabla de particiones
|-
|-
| 0x48
| 0x48
| 8
| 8
| SAVE Partition offset
| Offset de la partición de guardado
|-
|-
| 0x50
| 0x50
| 8
| 8
| SAVE Partition length
| Longitud de la partición de guardado
|-
|-
| 0x58
| 0x58
| 8
| 8
| DATA Partition offset
| Offset de la partición de datos
|-
|-
| 0x60
| 0x60
| 8
| 8
| DATA Partition length
| Longitud de la partición de datos
|-
|-
| 0x68
| 0x68
| 4
| 4
| Active table (and the offset to the filebase)
| Tabla activa (y el offset hacia la filebase)
|-
|-
| 0x6C
| 0x6C
| 0x20
| 0x20
| Hash from active table
| Hash desde la partición activa
|-
|-
| 0x8C
| 0x8C
| 4*29
| 4*29
| Unknown
| Desconocido
|}
|}


Line 171: Line 169:
Actually DIFI blobs are 0x12C large because the last 4 are not used and appear 0xFFFFFFFF at the encrypted image.
Actually DIFI blobs are 0x12C large because the last 4 are not used and appear 0xFFFFFFFF at the encrypted image.


For most games there's only 1 partition (The SAVE partition) and some (like Asphalt 3D, Steel Diver & Lego Star Wars III) has 2 partitions.
Para la mayoria de los juegos hay solo 1 division(La division SAVE) y algunos(como Asphalt 3D , Steel Diver & Lego Star Wars III) tienen 2 divisiones


* 2 Partitions means that the files inside the SAVE partition is on the other partition (we would call it DATA partition).
* 2 Divisiones significan que los archivos dentro de la division SAVE estan en otra division ( nosotro podriamos llamarla division DATA).


* No more than 2 partitions have been seen yet (and can't be becuase of the DISA known structure).
* No mas de 2 divisiones han sido vistas todavia (y no pueden ser debido a la estructura conocida DISA).


{| class="wikitable"
{| class="wikitable"
Line 554: Line 552:
[[File:Sfsave_drawing.png]]
[[File:Sfsave_drawing.png]]


=== Initialization ===
=== La Inicialización ===


When a save EEPROM contains all xFFFF blocks it's assumed uninitialized by the game cartridges and it initializes default data in place, without prompting the user.  
Cuando un EEPROM save contiene todos los bloques xFFFF se asume sin inicializar los cartuchos y lo inicializa los datos por defecto en su lugar, sin preguntar al usuario.  


I got a new game SplinterCell3D-Pal and I downloaded the save and it was 128KB of 0xFF, except the first 0x10 bytes which were the letter 'Z' (uppercase) --[[User:Elisherer|Elisherer]] 22:41, 15 October 2011 (CEST)
Tengo un juego nuevo SplinterCell3D-Pal y he descargado la partida guardada y era 128KB de 0xFF, excepto los primeros bytes 0x10, que fueron 'Z' (en mayúsculas) --[[User:Elisherer|Elisherer]] 22:41, 15 de octubre de 2011 (CEST)


=== Fun Facts ===
=== Fun Facts ===