Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are 3 bytes that needs to be changed in the savefile after .wc6 injector #2

Closed
BernardoGiordano opened this issue Jul 16, 2016 · 2 comments

Comments

@BernardoGiordano
Copy link
Collaborator

After some researches, i found that, after succesfully injecting a .wc6 into an OR/AS' main, i need to change other 3 bytes, apparently in a way i can not figure out.
#1 : there's a byte that locates around 117700 and 118000 (apparently in a casual way) that is linked in some ways to the wondercard i want to inject
#2 #3 : bytes located at 483170 and 483171. I don't know what determines the change of those bytes.

If anyone has idea of how to work on it, he can explain to me or make a pull request continuing the code that already is in the repo.

@kwsch
Copy link

kwsch commented Jul 17, 2016

1: The 'received' flag for the wonder card. It's so that the game can prevent you from receiving the same card after you've discarded it. There's 0x100 bytes (8*256 bitflags).

2: Block checksum. Save files have integrity checks to check for corrupted data.

https://projectpokemon.org/wiki/Pok%C3%A9mon_ORAS_Save_File_Structure
https://github.com/gocario/PHBank/blob/a956ab39060148c8dafdb1f472c96632b22dcc65/source/save_manager.cpp#L1255-L1367

Basically you need to calculate the ccitt-16 checksum over the block (0x1CC00-0x1E690 for ORAS) and update the block checksum at the end of the file.

@BernardoGiordano
Copy link
Collaborator Author

BernardoGiordano commented Jul 17, 2016

hello! Thank you for the answer, this will save me lots of time. -----------If i understand well, i have to modify the rewriteSaveCHK function to have a blockcount of 2 and a csoff of 483170, to update the block checksum at the eof or those values are fixed? If this is correct, the same procedure can be made with the 0x1CC00-0x1E690 block-------: bullshits

Edit #2: i managed to obatin 'checksum are valid' on PKHeX

I have to see how to manage the received wondercard flag now

BernardoGiordano added a commit that referenced this issue Aug 12, 2016
BernardoGiordano pushed a commit that referenced this issue Sep 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants