Skip to content

svdt: secure value data tweaks?

meladroit edited this page Sep 8, 2015 · 4 revisions

That's a terrible backronym. But that aside, even if we can't fetch the title ID, there are a few ways to go about this.

  • Require user to throw a secure value descriptor on the SD root. (So svdt can still get away with dumping sd:/svdt_inject wholesale, but could read from, say, sd:/svdt_sv_data for offsets and filenames.) This is prone to user error, and is best avoided.
  • For emergency injects, first execute an emergency dump as well, and then later if user can be prompted to select the correct target title, we can use associated offsets to rewrite files with proper save values. However, for games like ACNL and SSB, the user gets no such prompt because gfxInitDefault (apparently) fails miserably.
  • Use hackish disambiguation. This is actually possible, to a great extent. The below list should incorporate all games for which secure value data offsets are known:
  • ACNL is likely the only game with a file named garden.dat.
  • The Pokémon games both have a single file named main, but the secure value offsets are different. Luckily, the file sizes seem to be also different (ORAS offset is 0x75e00, but XY files aren't even big enough for that offset.)
  • Pokémon Rumble World is the only game (we hope) with 149 save files, specifically under /00slot00/. Thankfully only one of them matters for anti-savegame restore, it seems.
  • SSB has account_data.bin and system_data.bin. It's possible this is far from the only game with those two particular files, but I can't find anything about other games that do. Plus, since it crashes svdt at startup, and is one of the more popular games out there, we can let it take priority over other games that also have just account_data.bin and system_data.bin in save data, and require the user to specify a separate override configuration in sd:/svdt_sv_data if desired.
  • Pokémon Shuffle is almost certainly not the only game with a file named savedata.bin, but it does play nicely with svdt. Therefore, for now we can just disable secure value data tweaks for this game at startup, and enable them when the user selects this title.

So, quick summary (with thanks to this post for being a lovely central page for everything)

Game Product code Offset Files with SV Disambiguation without title info? (based on files present in save)
ACNL CTR-P-EGD* 0x00 garden.dat Probably, with low risk
SSB CTR-P-NXC* 0x10 account_data.bin, system_data.bin Probably, even if risky
Pokémon X CTR-P-EKJ* 0x65400 main Yes, between XY/ORAS
Pokémon Y CTR-P-EK2* 0x65400 main Yes, between XY/ORAS
Pokémon AS CTR-P-ECL* 0x75e00 main Yes, between XY/ORAS
Pokémon OR CTR-P-ECR* 0x75e00 main Yes, between XY/ORAS
Pokémon Shuffle CTR-N-KRXA 0x2c savedata.bin No, unless 42039 bytes is a unique file size
Pokémon Rumble World CTR-N-KCFA it's complicated /00slot00/00main.dat Almost certainly, yes

The secure value is always 8 bytes. For Pokémon Rumble World, we have more nonsense to tread through:

  • Save data is compressed with usual zlib compression, but has a 0x30-long header stuck in front. 0x28 is an isCompressed bit. Importantly, the compression level is 9, not the default 6.
  • Once save data is recompressed, most of the header data doesn't need to be updated, but the CRC32 checksum of uncompressed data does need to be updated, at 0x8 of compressed data.

However, since we have lovely 3DS portlibs, we can just use zlib built for 3DS!