From 981b620c1eaad3992d9b62b6452f327e9934fc02 Mon Sep 17 00:00:00 2001 From: Eblo <7004497+Eblo@users.noreply.github.com> Date: Sun, 11 Jan 2026 15:07:47 -0500 Subject: [PATCH] Use warp_special(-8) --- src/port/console/DevConsole.cpp | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/src/port/console/DevConsole.cpp b/src/port/console/DevConsole.cpp index 215e46f4..c521b85f 100644 --- a/src/port/console/DevConsole.cpp +++ b/src/port/console/DevConsole.cpp @@ -14,31 +14,19 @@ Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console")) \ ->SendInfoMessage -#include "game/level_update.h" -#include "game/ingame_menu.h" -#include "engine/geo_layout.h" -// #include "game/area.h" -// #include "game/main.h" extern "C" { -void handle_nmi_request(void); -void thread5_game_loop(void); -void clear_areas(void); -extern s8 gResetTimer; // main.h -extern s16 gMenuOptSelectIndex; // area.h -extern struct Area* gCurrentArea; // area.h -extern s16 gMenuMode; // ingame_menu.c -extern u32 gGlobalTimer; // game_init.c +void warp_special(int32_t arg); +extern int16_t sCurrPlayMode; // level_update.h } static bool ResetHandler(std::shared_ptr Console, std::vector args, std::string* output) { - // FIXME: Consistently seems to crash at alloc_only_pool_alloc after 4 times of loading into a level and resetting - handle_nmi_request(); - gResetTimer = 0; - clear_areas(); - gHudDisplay.flags = HUD_DISPLAY_NONE; - gMenuMode = MENU_MODE_NONE; - thread5_game_loop(); - return 0; + // Do not reset unless currently playing a level + if (sCurrPlayMode == 0) { // PLAY_MODE_NORMAL + warp_special(-8); + return 0; + } + *output = "Cannot reset: sCurrPlayMode must be 0 but is " + std::to_string(sCurrPlayMode); + return 1; } void DevConsole_Init(void) {