FlagBrew / PKSM

Gen I to GenVIII save manager.
GNU General Public License v3.0
1.76k stars 176 forks source link

Bug - backups are corrupting in Ultra Moon when injecting into the save file #1133

Closed PixelateVision closed 4 years ago

PixelateVision commented 4 years ago

Currently using PKSM 8.0.3, UM 1.2, New2DS

When using PKSM to edit save backups of Ultra Moon, upon hitting the "save" button on the main menu of the app it asks me if I'd like to write the changes to the cartridge (even though my copy of UM is digital). Also hitting B to back out of the editor does not auto-prompt the "would you like to save changes" message.

After hitting the bottom right save icon it then says that write was successful, but when I load the game I get the corrupted "this save is incompatible with this version of the game", even when I try injecting a previous, unedited, known-to-work backup.

I was eventually able to recover my save by backing up and overwriting the save in Checkpoint. Editing backups still seems to work, just not saving the changes to the actual game save.

piepie62 commented 4 years ago

Mhm, can confirm that is happening, even on the latest commits. I'll try to figure out what's going on

piepie62 commented 4 years ago

The B to back out not showing the changed message is actually intentional; it only pops up if you've made an edit

piepie62 commented 4 years ago

Does editing and saving directly from a game work?

PixelateVision commented 4 years ago

Nope, the first time it corrupted I started a brand new save and as soon as I tried editing it in PKSM it corrupted again.

piepie62 commented 4 years ago

Would you happen to have a cartridge that you could try editing?

PixelateVision commented 4 years ago

Only physical cartridge I own atm is HeartGold, the rest are digital. Would that work?

piepie62 commented 4 years ago

Probably not, but it's worth a test; at the very least, it'll help me narrow down where the issue is occurring

PixelateVision commented 4 years ago

I'll try and get to it tonight but if not I'll have the results to you by tomorrow afternoon. Hope that works.

SpiredMoth commented 4 years ago

Definitely not happening with all carts since I had no trouble while testing the "renew WC" scripts on my X cart recently

piepie62 commented 4 years ago

Hmm... wonder if I messed with something in G7 signing recently. I don't think I did, but let's see what happens if I try it with Moon

piepie62 commented 4 years ago

Hmmm... So, editing my Moon save seems to make Moon completely unable to boot; it looks like my 3DS restarts on trying to load it

SpiredMoth commented 4 years ago

Just tested editing a backup and injecting to my X cart (my script testing was only with the on-cart save) and it worked fine

piepie62 commented 4 years ago

Well, that's interesting. Loaded the edited save in PKHeX, which says that its checksums are valid

piepie62 commented 4 years ago

Okay, so it seems like the problem is coming from the actual save writing; I restored an edited save via Checkpoint and it worked properly. I'll check out what's different between Checkpoint and PKSM tomorrow

piepie62 commented 4 years ago

Never mind, that was actually a really simple fix. I'm quite surprised this didn't come up sooner, honestly; I never wiped the secure save data that's used for save rollback protection. About to fix that in the next commit

PixelateVision commented 4 years ago

Glad to hear it was simple! Thanks for your help.

piepie62 commented 4 years ago

No problem! Honestly surprised this ever worked lol