Filesystem services: Difference between revisions
TimmSkiller (talk | contribs) |
TimmSkiller (talk | contribs) Move anti savegame restore here |
||
Line 1,512: | Line 1,512: | ||
| See above. Not validated by FS-module. | | See above. Not validated by FS-module. | ||
|} | |} | ||
=Anti Savegame Restore= | |||
Anti Savegame Restore, internally referred to as ''Save Data Rollback Prevention'', is a feature originally implemented in the FS module with [[4.0.0-7]], which prevents the user from restoring previous versions of a savegame image. This feature is not used (in practice) for gamecard games. When an old version of the save is detected, the application will display an error regarding old savegame version, then delete and recreate the save data (similar to when it is corrupted). | |||
==Implementation== | |||
When creating the savedata, the application generates a secure value (a 64 bit unsigned integer), then stores it in either the [[DISA_and_DIFF#DISA_header|DISA save image header]] or the [[Filesystem_services#Anti_Savegame_Restore_Save_Data|Anti Savegame Restore Save Data]]. The application then uses the anti-savegame-restore commands ([[FS:SetSaveDataSecureValue]], [[FS:GetSaveDataSecureValue]], [[FS:SetOtherSaveDataSecureValue]], [[FS:GetOtherSaveDataSecureValue]], [[FS:SetThisSaveDataSecureValue]], [[FS:GetThisSaveDataSecureValue]], [[FS:SetSaveArchiveSecureValue]] and [[FS:GetSaveArchiveSecureValue]]) to verify the value known to the game for comparison with the value returned by FS, and to update the value in the corresponding storage location. | |||
Each time the application writes to the savegame, the value should be updated by both the application and through FS. Usually, applications update this value by incrementing it. However, generating a new random-number or other methods of updating it can be used as well. | |||
==Anti Savegame Restore Save Data== | |||
The save data used for this feature is stored in [[System_SaveData|System Save Data]] ID 0x00010011 and contains only one file, named <code>DB</code>: | |||
===SecureValueKey=== | |||
Depending on which command is used, secure value keys can be interpreted as: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset !! Size !! Description | |||
|- | |||
| 0x0 || 0x8 || u64, Title ID | |||
|} | |||
or: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset !! Size !! Description | |||
|- | |||
| 0x0 || 0x4 || u32, [[Filesystem_services#SecureValueSlot|Secure Value Slot]] | |||
|- | |||
| 0x4 || 0x4 || u32, Unique ID | |||
|} | |||
===Main Structure=== | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset !! Size !! Description | |||
|- | |||
| 0x0 || 0x1000 || Header | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset !! Size !! Description | |||
|- | |||
| 0x0 || 0x1 || u8, version (usually 0) | |||
|- | |||
| 0x1 || 0x3 || padding | |||
|- | |||
| 0x4 || 0x4 || u32, number of secure value entries | |||
|- | |||
| 0x8 || 0xFF8 || completely unused, padding | |||
|} | |||
|- | |||
| 0x1000 || 0x1C000 (8 * 14336) || [[Filesystem_services#SecureValueKey|Secure value keys]] | |||
|- | |||
| 0x1D000 || 0x1C000 (8 * 14336) || u64s, Secure values | |||
|} | |||
==Applications using this feature== | |||
* Animal Crossing: New Leaf | |||
* Pokemon X & Y | |||
* Pokemon Omega Ruby & Alpha Sapphire | |||
* Pokemon Omega Ruby & Alpha Sapphire Demo | |||
* Pokemon Shuffle | |||
* Super Smash Bros | |||
* Pokemon Red,Blue and Yellow (GB(C) VC) | |||
* Rusty's Real Deal Baseball | |||
* Megami Meguri | |||
=SEEDDB= | =SEEDDB= |