Aufbau der µSD:
0x0000000 DiskWriter ROM-Informationen bis 0xF8.
0x0000100 String "ROMs"
0x0000108 Filler mit "FF" bis 0x1BD
0x00001BE Anfang? Der FAT32-Partition.
0x0100000 Card1 Spielstände im Abstand von 0x100000 bis 0x2000000. Max 31 Spielstände möglich.
0x2000000 Beginn der ersten ROM. Dies ist Sektor Nr. 0x10000
Cubic Ninja.3ds hat einen Null-byte-Bereich bei 0x57A8E00 ~87MB mit einer Länge von 0x28571F0 ~40MB (Auffüllunng von Bytes bis zu einer Größe von 2^x)
====================
DiskWriter Startsektor und Größe in Sektoren:
A B
0x850000 0x800000
Wert A ist der Sektor in hex., in dem die ROM anfängt.
Um die Speicheradresse zu ermitteln diesen Wert mit Faktor 200 nehmen.
Wert B ist die Größe der ROM in Sektoren. Um den Wert in Bytes zu ermitteln, Wert B nach Dez umrechnen und mit Faktor 512 nehmen.
Abgelegt werden die Informationen auf der SD am Anfang der Image (0x0), aber Byte-Swapped.
Aus:
00008500 00008000
wird also:
00000085 0000 |0080
Wert A |WertB
Die ersten 6 unswapped Bytes ist die Sektornummer zur ROM; das letzte Byte bestimmt die ROM-Größe. Byte 7 ist ein Filler mit 00(?)
====================
Manipulierter Header:
An Stelle 0x15FE in der ROM, sind die letzten 2 Bytes der Schlüssel! Der Save muss mit identischen Bytes in der template.txt abschließen!
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
43 54 52 2D 50 2D 41 56 32 50 00 00 00 00 00 00 CTR-P-AV2P......
.
.
.
00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D FB
Man braucht nur die Headerinformationen mit der Länge 0x200 und einen Pointer auf diesen Header, um die Sky3DS zum Absturz zu bringen.
====================
Pointer für die Headerinformationen anlegen:
Unregistered ROMs funktionieren nicht bei µSD <4GB bzw. wenn zu wenig Speicherplatz vorhanden ist.(nicht verifiziert)
Den Manipulierten Header an 0xMaxSektor-0x1600 kopieren und am Anfang der SD-Image die DiskWriter-Informationen schreiben:
Schema:
XXXX XXXX XXXX YYYY
bei einer 4GB µSD ist folgender Eintrag zu tätigen:
[Adresse: 0xE8BFEA00/0x200=0x745FF5]
0000 7400 F55F 0200
(ByteSwapped: 0000 0074 5FF5 0002)
bei einer 8GB µSD:
[Adresse: 0x1D23FEA00/0x200=0xE91FF5]
0000 E900 F51F 0200
bei einer 32GB µSD:
[Adresse: 0x76E47EA00/0x200=0x3B723F5]
0000 B703 F523 0200
====================
Die card1-Saves liegen ab Adresse 0x100000 (1MB) im Abstand von 0x100000 (1MB) voneinander.
D.h. es können maximal 31 card1 Saves abgelegt werden.
Der erste Sektor mit ROM-Daten liegt immer bei Adresse 0x2000000.
Die Reihenfolge der Spielstände entspricht der Reihenfolge im DiskWriter. Der Spielstand vom Spiel ganz oben in der Liste
hat also die Adresse 0x100000. Ändert sich die Reihenfolge der Spiele, dann ändert sich auch die Reihenfolge der Spielstände.
DiskWriter hat aber einige Bugs beim Sichern der Spielstände. Einige Gamesaves werden doppelt angelegt. (Muss näher untersucht werden)
Jedenfalls lassen sich die Spielstände nur dann restaurieren, wenn der Header, mit dem das Spiel zuletzt gespeichert wurde, identisch ist.
Leider ändert sich dies mit der Zeit bei Updates der template.txt. Aus dem Grund, sollte der injected Header mitgesichert werden.
Der Header wird von DiskWriter direkt in die ROM geschrieben.
Er beginnt in der ROM bei Adresse 0x1400, hat eine Länge von 0x200 (512 Bytes) und endet bei 0x15FF
Sobald diese Bedingungen erfüllt sind, muss Sky3DS den Spielstand neu einlesen. Das geht, in dem man den roten Taster betätigt
und die ROM nochmal lädt (nicht verifiziert) oder die µSD Karten 2x wechselt (verifiziert).
====================
Encryptete Card2-Spielstände:
Normalerweise wird der Save innerhalb der Image angelegt. Auf einer 4GB µSD hab
ich folgendes Verhalten an der CubicNinja ROM festgestellt:
Für Offset 0x2000000 mit der Länge 0x7FFFFFF (128MB) beginnen Daten außerhalb der ROM:
bei 0x79280000 und enden bei 0x7928045B (Länge 0x45C) (beginnt bei 1938MB)
bei 0x79281000 und enden bei 0x79281107 (Länge 0x108)
bei 0x79282000 und enden bei 0x79286FFF (Länge 0x5000)
bei 0x79301000 und enden bei 0x7930DFFF (Länge 0xD000)
Ende
Ein Vergleich mit 2 CubicNinja Saves zeigt Veränderungen:
bei 0x79280000
bei 0x79282000
bei 0x79301000