remove explicit memcpy and add HEAP_SIZE constant

This commit is contained in:
camthesaxman 2018-01-06 00:35:48 -06:00
parent 462a0030ae
commit 601ec28721
4 changed files with 8 additions and 8 deletions

View file

@ -31,6 +31,8 @@ char* strcpy(char *dst0, const char *src0);
#define POKEMON_NAME_LENGTH 10 #define POKEMON_NAME_LENGTH 10
#define OT_NAME_LENGTH 7 #define OT_NAME_LENGTH 7
#define HEAP_SIZE 0x1C000
extern u8 gStringVar1[]; extern u8 gStringVar1[];
extern u8 gStringVar2[]; extern u8 gStringVar2[];
extern u8 gStringVar3[]; extern u8 gStringVar3[];

View file

@ -115,12 +115,12 @@ void MoveSaveBlocks_ResetHeap(void)
saveBlock2Copy->playerTrainerId[3]); saveBlock2Copy->playerTrainerId[3]);
// restore saveblock data since the pointers changed // restore saveblock data since the pointers changed
memcpy(gSaveBlock2Ptr, saveBlock2Copy, sizeof(*gSaveBlock2Ptr)); *gSaveBlock2Ptr = *saveBlock2Copy;
memcpy(gSaveBlock1Ptr, saveBlock1Copy, sizeof(*gSaveBlock1Ptr)); *gSaveBlock1Ptr = *saveBlock1Copy;
memcpy(gPokemonStoragePtr, pokemonStorageCopy, sizeof(*gPokemonStoragePtr)); *gPokemonStoragePtr = *pokemonStorageCopy;
// heap was destroyed in the copying process, so reset it // heap was destroyed in the copying process, so reset it
InitHeap(gHeap, 0x1C000); InitHeap(gHeap, HEAP_SIZE);
// restore interrupt functions // restore interrupt functions
gMain.hblankCallback = hblankCB; gMain.hblankCallback = hblankCB;

View file

@ -122,7 +122,7 @@ void AgbMain()
ClearDma3Requests(); ClearDma3Requests();
ResetBgs(); ResetBgs();
SetDefaultFontsPointer(); SetDefaultFontsPointer();
InitHeap(gHeap, 0x1C000); InitHeap(gHeap, HEAP_SIZE);
gSoftResetDisabled = FALSE; gSoftResetDisabled = FALSE;

View file

@ -23,10 +23,8 @@ void sub_81700F8(void)
ResetSaveCounters(); ResetSaveCounters();
sub_81534D0(0); sub_81534D0(0);
if (gSaveFileStatus == 0 || gSaveFileStatus == 2) if (gSaveFileStatus == 0 || gSaveFileStatus == 2)
{
Sav2_ClearSetDefault(); Sav2_ClearSetDefault();
}
SetPokemonCryStereo(gSaveBlock2Ptr->optionsSound); SetPokemonCryStereo(gSaveBlock2Ptr->optionsSound);
InitHeap(gHeap, 0x1c000); InitHeap(gHeap, HEAP_SIZE);
SetMainCallback2(sub_8086230); SetMainCallback2(sub_8086230);
} }