jojobear13 / shinpokered

Mostly-vanilla hack of Pokémon Red/Blue focused on bugfixes and trainer ai
209 stars 42 forks source link

Trade Error between ShinPokeRed / Perfect Crystal rom hacks #268

Closed DiabloStorm closed 1 year ago

DiabloStorm commented 1 year ago

So, again this may not be something you can do much about, but here's another trade issue since the last time we talked about this, manifesting in a different way this time. The trade completed, but with data loss (no I didn't screw up bgb this time like with yellow) Instead of the "An abnormality was detected, trade cancelled" (paraphrasing)

Using my old save from a previous patch (v1.23.11m) with ShinRed trading shinred horsea with perfect crystal (current github version) pikachu

Shin pov: image

Perf crystal pov: Name, stats and ID corruption

bgb00168 bgb00169

Horsea also corrupted:

bgb00170

Save states before trade: Save States.zip

Out of curiosity I tried trading the mons I had issues with originally, no "abnormality" error message, but they transfer with data corruption now.

jojobear13 commented 1 year ago

Revisited this issue, starting again fresh, after being stumped for a while. I think I discovered the root of the problem.

According to Perfect Crystal's github page: https://github.com/Superegz/Pokemon-Perfect-Crystal/tree/master#the-attached-ips-works-with-pokemon---crystal-version-ue-v11-c-and-the-patched-rom-should-have-a-checksum-of-c448 Perfect crystal needs to be patched onto a Crystal Version USA/EU V1.1 rom. This vanilla rom has a CRC checksum of 3358e30a.

When I took the attached perfect crystal save state and loaded up the perfect crystal rom, BGB said that the hash of the save state's rom did not match the loaded rom.

Out of curiosity, I re-patched Perfect Crystal onto a Crystal Version USA V1.0 rom having CRC checksum ee6f5188. The checksum this time DID match with the attached save state.

TLDR, Perfect Crystal was patched using the wrong version of the base crystal rom. This can cause unforeseen errors, and particularly so with the trade center considering the changes between V1.0 and V1.1 of crystal.

NOTE: This is why ips patches (what perfect crystal uses) can be tricky. They have no verification that the rom they are patching is the rom they were built from. Newer patch formats like xdelta and bps run a hash check to prevent this kind of thing from happening.

DiabloStorm commented 1 year ago

You're a heck of a detective. I didn't realize I could even patch it incorrectly.