diff --git a/src/battle_main.c b/src/battle_main.c index ad5ccac4ba..cd76bc827b 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3002,7 +3002,10 @@ static void ClearSetBScriptingStruct(void) memset(&gBattleScripting, 0, sizeof(gBattleScripting)); gBattleScripting.windowsType = temp; - gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle; + if (TESTING) + gBattleScripting.battleStyle = OPTIONS_BATTLE_STYLE_SET; + else + gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle; gBattleScripting.expOnCatch = (B_EXP_CATCH >= GEN_6); gBattleScripting.specialTrainerBattleType = specialBattleType; } diff --git a/test/test_runner.c b/test/test_runner.c index 450283ab58..ac4b20cd2c 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -1,4 +1,5 @@ #include +#include "fake_rtc.h" #include "global.h" #include "gpu_regs.h" #include "load_save.h" @@ -184,6 +185,13 @@ void TestRunner_CheckMemory(void) } } +static void ClearSaveBlocks(void) +{ + ClearSav1(); + ClearSav2(); + ClearSav3(); +} + void CB2_TestRunner(void) { top: @@ -201,17 +209,13 @@ top: gTestRunnerState.filterMode = DetectFilterMode(gTestRunnerArgv); MoveSaveBlocks_ResetHeap(); - ClearSav1(); - ClearSav2(); - ClearSav3(); gIntrTable[7] = Intr_Timer2; - gSaveBlock2Ptr->optionsBattleStyle = OPTIONS_BATTLE_STYLE_SET; - // The current test restarted the ROM (e.g. by jumping to NULL). if (gPersistentTestRunnerState.address != 0) { + ClearSaveBlocks(); gTestRunnerState.test = __start_tests; while ((uintptr_t)gTestRunnerState.test != gPersistentTestRunnerState.address) { @@ -255,6 +259,7 @@ top: break; case STATE_ASSIGN_TEST: + ClearSaveBlocks(); while (1) { if (gTestRunnerState.test == __stop_tests)