From 36af36bf3dfa1da4be0be8310e4237ea3c922861 Mon Sep 17 00:00:00 2001 From: cawtds <38510667+cawtds@users.noreply.github.com> Date: Sat, 2 Nov 2024 14:20:14 +0100 Subject: [PATCH] changes to debug --- Makefile | 3 +++ data/scripts/debug.inc | 3 --- src/battle_main.c | 8 ++---- src/debug.c | 3 --- src/field_control_avatar.c | 17 ++++++------ src/librfu_rfu.c | 2 +- src/pokemon_sprite_visualizer.c | 3 --- src/pokemon_summary_screen.c | 5 +--- src/start_menu.c | 47 ++++++++++++--------------------- 9 files changed, 32 insertions(+), 59 deletions(-) diff --git a/Makefile b/Makefile index e56455b8a..83c0daab0 100644 --- a/Makefile +++ b/Makefile @@ -464,6 +464,9 @@ $(ROM): $(ELF) $(OBJCOPY) -O binary $< $@ $(FIX) $@ -p --silent +firered: ; @$(MAKE) GAME_VERSION=FIRERED +leafgreen: ; @$(MAKE) GAME_VERSION=LEAFGREEN + # Symbol file (`make syms`) $(SYM): $(ELF) $(OBJDUMP) -t $< | sort -u | grep -E "^0[2389]" | $(PERL) -p -e 's/^(\w{8}) (\w).{6} \S+\t(\w{8}) (\S+)$$/\1 \2 \3 \4/g' > $@ diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index 002ab365e..90f2560f9 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -1,4 +1,3 @@ -.if DEBUG_OVERWORLD_MENU == TRUE Debug_MessageEnd: waitmessage waitbuttonpress @@ -418,5 +417,3 @@ Debug_EventScript_InflictStatus1_Text_Freeze: Debug_EventScript_InflictStatus1_Text_Frostbite: .string "Frostbite$" - -.endif diff --git a/src/battle_main.c b/src/battle_main.c index c54e88b47..a9fd14c37 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -536,9 +536,7 @@ static void CB2_InitBattleInternal(void) gBattle_BG3_X = 0; gBattle_BG3_Y = 0; -#if DEBUG_OVERWORLD_MENU == TRUE - if (!gIsDebugBattle) -#endif + if (!DEBUG_OVERWORLD_MENU || (DEBUG_OVERWORLD_MENU && !gIsDebugBattle)) { gBattleTerrain = BattleSetup_GetTerrainId(); } @@ -571,9 +569,7 @@ static void CB2_InitBattleInternal(void) else SetMainCallback2(CB2_HandleStartBattle); -#if DEBUG_OVERWORLD_MENU == TRUE - if (!gIsDebugBattle) -#endif + if (!DEBUG_OVERWORLD_MENU || (DEBUG_OVERWORLD_MENU && !gIsDebugBattle)) { if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED))) { diff --git a/src/debug.c b/src/debug.c index 79a3c238a..02e589b87 100644 --- a/src/debug.c +++ b/src/debug.c @@ -70,7 +70,6 @@ #include "constants/weather.h" #include "save.h" -#if DEBUG_OVERWORLD_MENU == TRUE // ******************************* enum DebugMenu { @@ -4449,5 +4448,3 @@ static void DebugAction_Party_ClearParty(u8 taskId) ScriptContext_Enable(); Debug_DestroyMenu_Full(taskId); } - -#endif //DEBUG_OVERWORLD_MENU == TRUE diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 362a583b3..d393dd015 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -155,14 +155,15 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys) input->dpadDirection = DIR_WEST; else if (heldKeys & DPAD_RIGHT) input->dpadDirection = DIR_EAST; - -#if DEBUG_OVERWORLD_MENU == TRUE && DEBUG_OVERWORLD_IN_MENU == FALSE - if ((heldKeys & DEBUG_OVERWORLD_HELD_KEYS) && input->DEBUG_OVERWORLD_TRIGGER_EVENT) + + if(DEBUG_OVERWORLD_MENU && !DEBUG_OVERWORLD_IN_MENU) { - input->input_field_1_2 = TRUE; - input->DEBUG_OVERWORLD_TRIGGER_EVENT = FALSE; + if ((heldKeys & DEBUG_OVERWORLD_HELD_KEYS) && input->DEBUG_OVERWORLD_TRIGGER_EVENT) + { + input->input_field_1_2 = TRUE; + input->DEBUG_OVERWORLD_TRIGGER_EVENT = FALSE; + } } -#endif } } @@ -307,15 +308,13 @@ int ProcessPlayerFieldInput(struct FieldInput *input) return TRUE; } -#if DEBUG_OVERWORLD_MENU == TRUE && DEBUG_OVERWORLD_IN_MENU == FALSE - if (input->input_field_1_2) + if(input->input_field_1_2 && DEBUG_OVERWORLD_MENU && !DEBUG_OVERWORLD_IN_MENU) { PlaySE(SE_WIN_OPEN); FreezeObjectEvents(); Debug_ShowMainMenu(); return TRUE; } -#endif return FALSE; } diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c index 9afdc3033..26e14539e 100644 --- a/src/librfu_rfu.c +++ b/src/librfu_rfu.c @@ -756,7 +756,7 @@ static void rfu_CB_pollConnectParent(u8 reqCommand, u16 reqResult) u16 id; u8 slot; u8 bm_slot_flag, i; - struct RfuTgtData *target_p; + struct RfuTgtData *target_p = NULL; struct RfuTgtData target_local; if (reqResult == 0) diff --git a/src/pokemon_sprite_visualizer.c b/src/pokemon_sprite_visualizer.c index 65e4cb98c..760c7f415 100644 --- a/src/pokemon_sprite_visualizer.c +++ b/src/pokemon_sprite_visualizer.c @@ -41,7 +41,6 @@ #include "constants/items.h" #include "constants/event_objects.h" -#if DEBUG_POKEMON_SPRITE_VISUALIZER == TRUE extern const struct BattleTerrain gBattleTerrainInfo[BATTLE_TERRAIN_COUNT]; extern const struct CompressedSpriteSheet gSpriteSheet_EnemyShadow; extern const struct SpriteTemplate gSpriteTemplate_EnemyShadow; @@ -1726,5 +1725,3 @@ static void Exit_PokemonSpriteVisualizer(u8 taskId) m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100); } } - -#endif diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 9c1f33a5b..9bd59d29a 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1267,16 +1267,13 @@ static void Task_InputHandler_Info(u8 taskId) { sMonSummaryScreen->state3270 = PSS_STATE3270_ATEXIT_FADEOUT; } -#if DEBUG_POKEMON_SPRITE_VISUALIZER == TRUE - else if (JOY_NEW(SELECT_BUTTON) && !gMain.inBattle) + else if (DEBUG_POKEMON_SPRITE_VISUALIZER && JOY_NEW(SELECT_BUTTON) && !gMain.inBattle) { sMonSummaryScreen->savedCallback = CB2_Pokemon_Sprite_Visualizer; // StopPokemonAnimations(); PlaySE(SE_SELECT); - // CloseSummaryScreen(taskId); sMonSummaryScreen->state3270 = PSS_STATE3270_ATEXIT_FADEOUT; } -#endif } break; case PSS_STATE3270_FLIPPAGES: diff --git a/src/start_menu.c b/src/start_menu.c index 1c9525dfd..dd77663e0 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -222,7 +222,7 @@ static void SetUpStartMenu(void) SetUpStartMenu_UnionRoom(); else if (GetSafariZoneFlag() == TRUE) SetUpStartMenu_SafariZone(); - else if (DEBUG_OVERWORLD_MENU == TRUE && DEBUG_OVERWORLD_IN_MENU == TRUE) + else if (DEBUG_OVERWORLD_MENU && DEBUG_OVERWORLD_IN_MENU) SetUpStartMenu_Debug(); else SetUpStartMenu_NormalField(); @@ -401,12 +401,8 @@ static s8 DoDrawStartMenu(void) break; case 6: sStartMenuCursorPos = InitMenuNormal(GetStartMenuWindowId(), FONT_NORMAL, 0, 0, 15, sNumStartMenuItems, sStartMenuCursorPos); - if (!MenuHelpers_IsLinkActive() && InUnionRoom() != TRUE && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_HELP) - { -#if DEBUG_OVERWORLD_MENU != TRUE + if (DEBUG_OVERWORLD_MENU != TRUE && !MenuHelpers_IsLinkActive() && InUnionRoom() != TRUE && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_HELP) DrawHelpMessageWindowWithText(sStartMenuDescPointers[sStartMenuOrder[sStartMenuCursorPos]]); -#endif - } CopyWindowToVram(GetStartMenuWindowId(), COPYWIN_MAP); return TRUE; } @@ -487,22 +483,16 @@ static bool8 StartCB_HandleInput(void) { PlaySE(SE_SELECT); sStartMenuCursorPos = Menu_MoveCursor(-1); - if (!MenuHelpers_IsLinkActive() && InUnionRoom() != TRUE && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_HELP) - { -#if DEBUG_OVERWORLD_MENU != TRUE + if (DEBUG_OVERWORLD_MENU != TRUE && !MenuHelpers_IsLinkActive() && InUnionRoom() != TRUE && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_HELP) PrintTextOnHelpMessageWindow(sStartMenuDescPointers[sStartMenuOrder[sStartMenuCursorPos]], 2); -#endif - } } if (JOY_NEW(DPAD_DOWN)) { PlaySE(SE_SELECT); sStartMenuCursorPos = Menu_MoveCursor(+1); - if (!MenuHelpers_IsLinkActive() && InUnionRoom() != TRUE && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_HELP) + if (DEBUG_OVERWORLD_MENU != TRUE && !MenuHelpers_IsLinkActive() && InUnionRoom() != TRUE && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_HELP) { -#if DEBUG_OVERWORLD_MENU != TRUE PrintTextOnHelpMessageWindow(sStartMenuDescPointers[sStartMenuOrder[sStartMenuCursorPos]], 2); -#endif } } if (JOY_NEW(A_BUTTON)) @@ -517,9 +507,8 @@ static bool8 StartCB_HandleInput(void) if (JOY_NEW(B_BUTTON | START_BUTTON)) { DestroySafariZoneStatsWindow(); -#if DEBUG_OVERWORLD_MENU != TRUE - DestroyHelpMessageWindow_(); -#endif + if (DEBUG_OVERWORLD_MENU != TRUE) + DestroyHelpMessageWindow_(); CloseStartMenu(); return TRUE; } @@ -621,9 +610,8 @@ static bool8 StartMenuOptionCallback(void) static bool8 StartMenuExitCallback(void) { DestroySafariZoneStatsWindow(); -#if DEBUG_OVERWORLD_MENU != TRUE - DestroyHelpMessageWindow_(); -#endif + if (DEBUG_OVERWORLD_MENU != TRUE) + DestroyHelpMessageWindow_(); CloseStartMenu(); return TRUE; } @@ -633,19 +621,19 @@ static bool8 StartMenuDebugCallback(void) DestroySafariZoneStatsWindow(); HideStartMenuDebug(); // Hide start menu without enabling movement -#if DEBUG_OVERWORLD_MENU == TRUE - FreezeObjectEvents(); - Debug_ShowMainMenu(); -#endif + if (DEBUG_OVERWORLD_MENU == TRUE) + { + FreezeObjectEvents(); + Debug_ShowMainMenu(); + } return TRUE; } static bool8 StartMenuSafariZoneRetireCallback(void) { DestroySafariZoneStatsWindow(); -#if DEBUG_OVERWORLD_MENU != TRUE - DestroyHelpMessageWindow_(); -#endif + if (DEBUG_OVERWORLD_MENU != TRUE) + DestroyHelpMessageWindow_(); CloseStartMenu(); SafariZoneRetirePrompt(); return TRUE; @@ -815,9 +803,8 @@ static u8 SaveDialogCB_PrintAskSaveText(void) { ClearStdWindowAndFrame(GetStartMenuWindowId(), FALSE); RemoveStartMenuWindow(); -#if DEBUG_OVERWORLD_MENU != TRUE - DestroyHelpMessageWindow(0); -#endif + if (DEBUG_OVERWORLD_MENU != TRUE) + DestroyHelpMessageWindow(0); PrintSaveStats(); PrintSaveTextWithFollowupFunc(gText_WouldYouLikeToSaveTheGame, SaveDialogCB_AskSavePrintYesNoMenu); return SAVECB_RETURN_CONTINUE;