-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Saveblock Size
judicornadamsfoster edited this page Jun 29, 2026
·
1 revision
original source: Lunos' saveFileSpaceStats
-- this code does a similar thing to tx_debug's
SaveBlockSpace
Setup: pull from Lunos' branch or manually input using the guide below
git remote add lunos https://github.com/LOuroboros/pokeemerald.git
git pull lunos saveFileSpaceStats
To use: set EventScript_CheckSavefileSizes as an object script.
add to end of file:
EventScript_CheckSavefileSizes::
special CheckSaveBlock1Size
msgbox CheckSavefileSizes_Text_SaveBlock1, MSGBOX_NPC
special CheckSaveBlock2Size
msgbox CheckSavefileSizes_Text_SaveBlock2, MSGBOX_NPC
special CheckPokemonStorageSize
msgbox CheckSavefileSizes_Text_PokemonStorage, MSGBOX_NPC
end
CheckSavefileSizes_Text_SaveBlock1::
.string "SaveBlock1 size: {STR_VAR_1}/{STR_VAR_2}$"
CheckSavefileSizes_Text_SaveBlock2::
.string "SaveBlock2 size: {STR_VAR_1}/{STR_VAR_2}$"
CheckSavefileSizes_Text_PokemonStorage::
.string "{PKMN}Storage size: {STR_VAR_1}/{STR_VAR_2}$"
add to end of file:
def_special CheckSaveBlock1Size
def_special CheckSaveBlock2Size
def_special CheckPokemonStorageSize
add to end of file:
#include "save.h" // <-- SECTOR_DATA_SIZE is defined there.
void CheckSaveBlock1Size(void)
{
u32 currSb1Size = (sizeof(struct SaveBlock1));
u32 maxSb1Size = (SECTOR_DATA_SIZE * 4);
ConvertIntToDecimalStringN(gStringVar1, currSb1Size, STR_CONV_MODE_LEFT_ALIGN, 6);
ConvertIntToDecimalStringN(gStringVar2, maxSb1Size, STR_CONV_MODE_LEFT_ALIGN, 6);
}
void CheckSaveBlock2Size(void)
{
u32 currSb2Size = (sizeof(struct SaveBlock2));
u32 maxSb2Size = SECTOR_DATA_SIZE;
ConvertIntToDecimalStringN(gStringVar1, currSb2Size, STR_CONV_MODE_LEFT_ALIGN, 6);
ConvertIntToDecimalStringN(gStringVar2, maxSb2Size, STR_CONV_MODE_LEFT_ALIGN, 6);
}
void CheckPokemonStorageSize(void)
{
u32 currPkmnStorageSize = (sizeof(struct PokemonStorage));
u32 maxPkmnStorageSize = (SECTOR_DATA_SIZE * 9);
ConvertIntToDecimalStringN(gStringVar1, currPkmnStorageSize, STR_CONV_MODE_LEFT_ALIGN, 6);
ConvertIntToDecimalStringN(gStringVar2, maxPkmnStorageSize, STR_CONV_MODE_LEFT_ALIGN, 6);
}