-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Extra save space with three lines of code
Note: This has already been implemented in rhh-expansion as "Saveblock 3". Only follow this guide if you are not using that branch.
There are plenty of ways to get extra save space in Emerald, but that usually means you need to remove redundant data structures or even entire features from the game. While that is useful (and still recommended), there is also an additional way to score some extra save space, and is completely compatible with any other saveblock-editing changes you've made. The best part? It's only two lines of code.
- Open
save.h
and find these two lines:
#define SECTOR_DATA_SIZE 3968
#define SECTOR_FOOTER_SIZE 128
- Change those lines to this:
#define SECTOR_DATA_SIZE 4084
#define SECTOR_FOOTER_SIZE 12
- Scroll down to
struct SaveSector
and remove the line:u8 unused[SECTOR_FOOTER_SIZE - 12];
This gives you an extra 116 bytes in SaveBlock2
, an extra 464 bytes in SaveBlock1
, and an extra 1044 bytes in PokemonStorage
. Have fun!
The 128k save for Pokémon emerald is divided into 32 sectors, of 4 kilobytes each. Most of that sector contains the actual data of the save blocks, but the last 128 bytes is reserved for "footer" data, and game data is not written there. But if you look at the SaveSector
struct, only 12 of those bytes are actually being used.
All this two line fix is doing is taking the unused bytes from the footer and writing game data to it instead. 116 bytes is not a huge amount, but remember that these bytes are being saved in all 32 sectors, which adds up to a combined 3.6 kilobytes of extra space. Not too shabby!