Jump to content

Pokemon Emerald save Hex Edit


Jack Black

Recommended Posts

Hello good Afternoon, im trying to learn how to Hex editing using my Pokemon Emerald save, and i cant find specific values sutch as money amount and others.

im using HxD for this, and even i know the basics about Hexadecimal (hard times when i study it at school), its being dificult to me undestand this now on practice...

thanks for the help :D

Link to comment
Share on other sites

Since you're trying to learn how to find specific values in a save file and you're using HxD you 100% know that nothing is labelled in the file.  So to find a particular thing in the save you will have to compare before and after saves to find the differences between them.  In your case you are you're looking for where money is stored in the save so I'll run through an example how to find that value.

1) Go to the Poke Mart and save the game in front of the store clerk.

2) Make a backup of the save.

3) Purchase an item from the clerk and save the game.

4) Make a backup of the save.  (Now you'll have two save files with one before buying an item and one after buying an item.)

5) I recommend copying either one of the save files to make a third save file to do the edits on.

6) Now compare the first two saves and the only differences that should be between them is play time, item quantities, and money.

7) Since you should know what money you started with and what money you ended with you should be able to identify which values correspond with your money total.

8 ) On the third save file try and edit those values to something else and then save the the save file in HxD.

9) Open the third save file in PKHeX and then save it with PKHeX.  (This will update the checksum of the save so that when you load the save you won't get the "Save file is corrupt" error message.)

10) If the money amount did not change go back to step 5 and try a different value that is different between the two saves.

Note 1: When ever you do any editing always make backups of your save in case you mess up.  More save backups the better.

Note 2: If I remember correctly any money value greater than 255 or FF in hex is stored in the save in the reverse order.  For example the 256 would be saved as 00 01 and not 01 00.

If you follow these steps you should be able to find any value or flag in any save as long as you make a before and after save.

  • Amazed 1
Link to comment
Share on other sites

A few things I gotta add on:

1. Save block data has already been identified and recorded here: https://bulbapedia.bulbagarden.net/wiki/Save_data_structure_in_Generation_III#Save_index

2. There are 2 saves in the save file (Game Save A and Game Save B).

3. GBA save blocks are shuffled. (as in the save block won't always be in the same position)
They are easy to identify once you know how to identify which block you're looking at, though.
[Section ID and Save Index in the page I linked]

4. Even after modifying the slot you found, you also need to know how to correct the checksums.

  • Amazed 1
Link to comment
Share on other sites

9 hours ago, Poke J said:

Since you're trying to learn how to find specific values in a save file and you're using HxD you 100% know that nothing is labelled in the file.  So to find a particular thing in the save you will have to compare before and after saves to find the differences between them.  In your case you are you're looking for where money is stored in the save so I'll run through an example how to find that value.

1) Go to the Poke Mart and save the game in front of the store clerk.

2) Make a backup of the save.

3) Purchase an item from the clerk and save the game.

4) Make a backup of the save.  (Now you'll have two save files with one before buying an item and one after buying an item.)

5) I recommend copying either one of the save files to make a third save file to do the edits on.

6) Now compare the first two saves and the only differences that should be between them is play time, item quantities, and money.

7) Since you should know what money you started with and what money you ended with you should be able to identify which values correspond with your money total.

8 ) On the third save file try and edit those values to something else and then save the the save file in HxD.

9) Open the third save file in PKHeX and then save it with PKHeX.  (This will update the checksum of the save so that when you load the save you won't get the "Save file is corrupt" error message.)

10) If the money amount did not change go back to step 5 and try a different value that is different between the two saves.

Note 1: When ever you do any editing always make backups of your save in case you mess up.  More save backups the better.

Note 2: If I remember correctly any money value greater than 255 or FF in hex is stored in the save in the reverse order.  For example the 256 would be saved as 00 01 and not 01 00.

If you follow these steps you should be able to find any value or flag in any save as long as you make a before and after save.

But how do i locate this values??

I read on https://bulbapedia.bulbagarden.net/wiki/Save_data_structure_in_Generation_III#Security_key that this values have a protection??

how do i pass throw it??

 

 

9 hours ago, theSLAYER said:

A few things I gotta add on:

1. Save block data has already been identified and recorded here: https://bulbapedia.bulbagarden.net/wiki/Save_data_structure_in_Generation_III#Save_index

2. There are 2 saves in the save file (Game Save A and Game Save B).

3. GBA save blocks are shuffled. (as in the save block won't always be in the same position)
They are easy to identify once you know how to identify which block you're looking at, though.
[Section ID and Save Index in the page I linked]

4. Even after modifying the slot you found, you also need to know how to correct the checksums.

According to this info, i think that i flag the SGB A, that goes throw block 0-DFFF, and descovery the "highlighter" for the SGB B whitch starts on E000 with FF FF FF FF FF...

but now...

What block can i Mixup and how can i  rewrite the checksum??

 

What is "data"??

im i able to update anything in here??

Link to comment
Share on other sites

I merged your posts. Please do not make multiple posts in succession.
If no one replied you, edit the new information/question into your latest unreplied post.

 

29 minutes ago, Jack Black said:

But how do i locate this values??

For known values, they're in the save structure recorded by Bulbapedia..

For unknown values, compare the save files using HxD.  (note: you gotta align the blocks in correct order first)
If comparison impossible, do trial and error.
See which half of the save actually has the change, then keep doing halves and halves until you can narrow down which block has the value. Finally, compare that block for before and after, to see which offset(s) has been changed

29 minutes ago, Jack Black said:

I read on https://bulbapedia.bulbagarden.net/wiki/Save_data_structure_in_Generation_III#Security_key that this values have a protection??

how do i pass throw it??

I feel as though the bulbapedia page explained it sufficiently

Quote

Used to encrypt sensitive data, such as money or item quantities. Applied to data via a simple exclusive or operation.

 

29 minutes ago, Jack Black said:

According to this info, i think that i flag the SGB A, that goes throw block 0-DFFF, and descovery the "highlighter" for the SGB B whitch starts on E000 with FF FF FF FF FF...

I don't understand what you are trying to say. What "highlighter"?

In regards to your save B consisting of nothing but 0xFF, I'm assuming you only saved in game once or something?

29 minutes ago, Jack Black said:

What block can i Mixup and how can i  rewrite the checksum??

To be completely honest, I nowadays use PKHeX to fix checksums.

Once again, the checksum fixing is in the bulbapedia page:

Quote

Checksum

Used to validate the integrity of saved data.

A 16-bit checksum generated by adding up bytes from the section. The algorithm is as follows:

  • Initialize a 32-bit checksum variable to zero.
  • Read 4 bytes at a time as 32-bit word (little-endian) and add it to the variable. The number of bytes to process in this manner is determined by Section ID.
  • Take the upper 16 bits of the result, and add them to the lower 16 bits of the result.
  • This new 16-bit value is the checksum.

 

29 minutes ago, Jack Black said:

What is "data"??

im i able to update anything in here??

erm..
image.png

It basically means it's an area that has the data you're looking for.
Whatever the data is, that's the area that has data in it.
 


In any case, I don't understand why you're doing this. PKHeX probably is able to edit whatever value you seek.
If it is for practice, sure go ahead, won't stop you.

Rather than ask so many questions, you probably should take this one step at a time.
Figure out for sure how to do one thing, then move on to the next point. I suggest:
1. Learn how to identify which save is the more recent save (because the game loads that one. Whether Save A or Save B is the more recent save, isn't fixed)
2. Learn how to identify the blocks.
3. For starters, locate the block for money (based on bulbapedia's guide)
4. Locate the offset for money (based on bulbapedia's guide)
5. Fix the checksum for money's block
6. Fix the checksum for the overall save.

If you cannot get past these, you probably won't be able to make any other edit.

As it was said that Ruby/Sapphire's Money isn't XOR'd against the Security Key, I recommend you try to edit a RS save first.

  • Hahaha 1
Link to comment
Share on other sites

Hello again guys,

im having a bad time undestanding the table on Section Format...

I now, all the info in front of my face and i cant find it :/.

Here says that eatch sector haves 3968 bytes of lentgh, but on the table it says that, for ex, ID sec have 2 lentgh??

Once more sorry for my Dummyness XD,

Anotação 2019-08-15 115647.png

Link to comment
Share on other sites

For example, let's look at the first section in my save:

image.png

Section ID: 0x000C
Checksum: 0x0000 (had no data in that block, so nothing to checksum I presume)
Save Index: 0x00000002

Now look at the next section:
image.png

Section ID: 0x000D (makes sense that it ascends)
Checksum: 0xF131
Save Index: 0x00000002

Makes sense to you now? :3

  • Like 1
Link to comment
Share on other sites

On 8/15/2019 at 2:18 PM, theSLAYER said:

For example, let's look at the first section in my save:

image.png

Section ID: 0x000C
Checksum: 0x0000 (had no data in that block, so nothing to checksum I presume)
Save Index: 0x00000002

Now look at the next section:
image.png

Section ID: 0x000D (makes sense that it ascends)
Checksum: 0xF131
Save Index: 0x00000002

Makes sense to you now? :3

Man you save my!!!

Link to comment
Share on other sites

(SORRY MANS, i cant post this few last days because my laptop`s charger brokedown, and i spend this days fixing it...)

After more then a week searching about it, and after doing a LOT of experiments in allmost all of the possible Ways, I have only one thing to say...

"Ladies and gentlemen, WE GOT IT"

 

I found the Money Amount Location...

181166764_Anotao2019-08-20173720.png.9c432b911a122080ae17e2b73eec193e.png

As well as the Security Key...

1243465436_Anotao2019-08-20173825.png.8e7ed8cf00eb13f34e4b18faad054775.png

TRY TRY TRY and then remenber that the Hex values are "twisted", finaly find out how to REVEAL THE MONEY, (sutch as other things, i can now MOD almost anything  related with Trainers data, Pokemon Party and so on...)

695985131_Anotao2019-08-20174356.png.fea20ef254ae69ccad77fcf15c7a7b54.png1224480653_Anotao2019-08-20174422.png.25cc11201bffd13b2a99745c790697d7.png

After that i compare with values in the Save Editer...

503437321_Anotao2019-08-20174642.png.7117ae0dcf41cc077f281b44afa3c352.png

Im trying to figure out how to transform the value i want to Hex...

but Thats it...

finaly understood how game save file is ordened:

Gamesave A: 13 SECTIONS(data), EATCH ON WITH == FOOTER, then SECID/CHECKSUM/SAVEINDEX

Gamesave B: EXACTLY the same

Hall of Fame

Mystery Gift

Recorder battle

 

BUT I HAVE A QUESTION....

1st - WHY IN THE WORLD is SEC00 in LAST PLACE on gamesave B, and Simply doesnt exists at all on gamesave A;

2st - I dont understend allready the Pokedex Indexes so... HELP

And thats it...

Now i can reveal my secret Plan to DOMINATE THE WOR, i mean help and evo POKE.COM...

My plan is to Build an Website that brings back to life ALL the EMOTION of play old pokemon Gens...

A site wen you can upload you save, compare yours stats whit your friends, change items with eatch other AND

BELEVE OR NOT....

TRADE YOUR POKEMON WITH PEOPLE ALL ARROUND THE WORLD, AND BATTLE JUST LIKE WE DO WEN WE ARE KINDS!!!!!!(unfortunly i didnt have GBA wen i was young, i only got it wen nintendo GameBoy was descontinued, so... WERE IS MY CHILDHOOD ;-;)

Also this Project of mine will by used as Final Project in school so, LETS END IT WITH GOLDEN KEY!!!

And thats all, Thank you for all your effort and patince, and lets move out 😉

 

Link to comment
Share on other sites

36 minutes ago, Jack Black said:

Im trying to figure out how to transform the value i want to Hex...

36 minutes ago, Jack Black said:

My plan is to Build an Website

Erm, do you know how to build a website? Have you got a functioning website up yet?

Also, regarding how to "transform the value into hex", most programming languages (including whatever language your site uses) should have simple to hex and to dec operations, though if you're modifying a value, it isn't necessary to transform a value to hex,
because hex and decimal is basically just different ways to represent the same value.

All you gotta do is to write the value as byte (or however it is expressed in the programming language you're using)

 

39 minutes ago, Jack Black said:

finaly understood how game save file is ordened:

Gamesave A: 13 SECTIONS(data), EATCH ON WITH == FOOTER, then SECID/CHECKSUM/SAVEINDEX

Gamesave B: EXACTLY the same

Hall of Fame

Mystery Gift

Recorder battle

Congratulations, I see you understood what the documented data on bulbapedia mean.

 

40 minutes ago, Jack Black said:

WHY IN THE WORLD is SEC00 in LAST PLACE on gamesave B, and Simply doesnt exists at all on gamesave A;

What is this "SEC00" you speak of?

 

41 minutes ago, Jack Black said:

I dont understend allready the Pokedex Indexes so... HELP

As in you don't understand how they're stored, or don't understand how to find it in the save?

If it's how they're stored (if I'm not mistaken):

Think of the hex 0xFF, in binary it's: 11111111
Now look at 0xFE: 11111110
and 0xFD: 11111101

Each 1 or 0 represents whether a Pokémon is seen/caught (depending you're at seen or caught offset).

For each byte->binary, the furthest right is the smallest value, starting from 0, and ascends up for everything Pokémon seen/caught.
 

  • Like 1
Link to comment
Share on other sites

15 minutes ago, theSLAYER said:

do you know how to build a website?

As i sad in my final words, this project i have in mind is ALSO to my final school Project, and yes, in my couse i lern C#, database conn(will lern this year), PHP/HTML/AJAX/JAVASCRIPT, and yes, in my last intership i build a actual funcional site to them, sutch as in school,(im working in a little webapp too!!! For Helping on PK Rom translate :D).

2046430509_CapturadeEcr(6)_LI.thumb.jpg.f8172a06122d96befdb8c906cb4fb46d.jpg

In actual fase you can allready put data in it, and will be translated, but is FAR FAR way of being completed XD

28 minutes ago, theSLAYER said:

What is this "SEC00" you speak of?

Section 0, related to Trainers info, this sector dosnt exist in GameSave A, and is in last place on B

Link to comment
Share on other sites

Great, at least you know how to get a very basic site up.

Before we jump too far into the rabbit hole, I think you should make your site is able to "recognize" which sections each part of any given save is, before we continue any further.

After all, the save blocks shuffle. So that probably is the most basic functionality you'll need to program in. I recommend you get that done, before worrying about other steps.

As for why Trainers values doesn't exist, did you save twice in-game? Is your save one that is recently started (has 0 progress in it)? It should be there, since the save B is meant to be backup in case save A corrupts. No reason why it wouldn't be there.

Link to comment
Share on other sites

Before we go into editing saves, probably should get your site to display various features of whatever save is uploaded onto it.

If your site can't recognize stuff, then editing saves is impossible.

And the only way to test and know for sure if your site is recognizing the correct data.. is to get your site to display the data ><

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...