Jump to content

3. Generation checksum calculation


virusscript24

Recommended Posts

Hi,

i've read so many threads about this now and i still dont understand it completely.

My plan was to create a Trading Programm for 3. gen, to trade Pokemon on the ti-nspire (a calculator) with friends.

The first problem was that my program swaps the first pokemon in the team in both savefiles, but both savefiles are ruined afterwards, because:

- the checksum of the whole section (1) was wrong, so i cant load the latest, but only the previous savefile in emulator)

- the checksum of each pokemon (only the swapped) was wrong -> bad egg (i looked it up in "A-Save", a 3. gen saveedit as i cant open the savefile in emulator)

edit: problem 2 solved now, i just shifted the whole pokemon section so things got messed up.

I've found some threads/websites about this topic:

- http://bulbapedia.bulbagarden.net/wiki/Save_data_structure_in_Generation_III#Checksum

- http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_data_structure_in_Generation_III

- http://furlocks-forest.net/wiki/?page=Pokemon_GBA_Save_Format (especially the comments of adam)

- http://projectpokemon.org/forums/showthread.php?1904-help-with-pokemon-checksum/

Can someone explain the checksum calculation in easy words with examples and maybe even pictures?

(expect me to be a 5 year old little child that knows how to google and use "goldfinger", "hexcmp2", "A-Save", "Vba Emulator" and some other pokemon/hexcode related tools)

Hopefully someone can help :smile:

edit: i also found the sourcecode of this program, but i dont understand what parameters i have to use for the Chksum() function:

https://dl.dropboxusercontent.com/u/12206225/PSavFixV2.zip

Edited by virusscript24
Link to comment
Share on other sites

wow ...

Didnt expect anyone to make something like this...

I'll try to make use of it as soon as possible :D

thanks man

However, can i just take both the header and the c file, include them and use built-in functions to load, modify and save the .sav file?

Link to comment
Share on other sites

sadly i dont know at all what i should do with the library as i cant make it run because every function is defined plenty of times but i see only one of them ...

/* Forget that shit please... was a typo in the first step that ruined everything...

However, how can i calculate the checksum... I get always wrong results...

Here's my savefile:

http://www.file-upload.net/download-9223985/Pokemon-Emerald-clean-save.sav.html

at offset 0x7ff4

i did it like this to calculate:

Sum of these:

FB2CFC2C (EDIT: its 2cfc2cfb anyway, second mistake here, but useless cuz typo)

509700D9

C7BFD1CE

D1C9FF00

00000202

CCBFBEFF

FFFFFF00

3BF50000

3DBBFCF5

37BBFCF5

AB44FCF5

ADBBFC09

57BBFCF5

ABBBFCF5

54BB79D4

544403CA

ABBBFC75

F6BB7DF5

DBBBFCF5

B2AFE2F5

= 9e9195ca5

now i cut off the highest bit to get 32 bits:

e9195ca5

adding the lower 16 and the higher 16 bits resulted in this:

e919 +

5ca5 =

145BE

truncated to 16 bits its 45 BE and sadly thats not DF 97 like in the savefile :(

Are these steps the right and i just made typo in the first step?

*/

Edited by virusscript24
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...