From 9ecf28bbd89ea3af4992390d07b8968ff5192f5b Mon Sep 17 00:00:00 2001 From: starburst Date: Thu, 19 May 2022 10:24:32 -0500 Subject: [PATCH] Adds an option in debug menu to load directly into your save rather than waiting through the opening. --- libultraship/libultraship/SohImGuiImpl.cpp | 7 ++- .../overlays/gamestates/ovl_title/z_title.c | 61 +++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 31f14a073..8635e01de 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -680,7 +680,7 @@ namespace SohImGui { EnhancementCheckbox("MM Bunny Hood", "gMMBunnyHood"); Tooltip("Wearing the Bunny Hood grants a speed increase like in Majora's Mask"); EnhancementCheckbox("Load Save Entrance", "gSaveEntrance"); - Tooltip("Instead of going to Link's House or the Temple of Time when you load your save, go to where you saved your game."); + Tooltip("Instead of going to Link's House or The Temple of Time when you load your save, go to where you saved your game."); ImGui::EndMenu(); } @@ -778,6 +778,11 @@ namespace SohImGui { { EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled"); Tooltip("Enables Debug Mode, allowing you to select maps with L + R + Z, noclip with L + D-pad Right,\nand open the debug menu with L on the pause screen"); + EnhancementCheckbox("Fast File Select", "gSkipLogoTitle"); + Tooltip("Directly load the game to selected slot bellow\nUse slot number 4 to load directly in Zelda Map Select\n(Do not require debug menu but you will be unable to save there)\n(you can also load Zelda map select with Debug mod + slot 0)."); + if (CVar_GetS32("gSkipLogoTitle", 0)) { + EnhancementSliderInt("Save file to load: %d", "##SaveFileID", "gSaveFileID", 1, 4, ""); + } ImGui::Separator(); EnhancementCheckbox("Stats", "gStatsEnabled"); Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on"); diff --git a/soh/src/overlays/gamestates/ovl_title/z_title.c b/soh/src/overlays/gamestates/ovl_title/z_title.c index 18996f15e..e9b6a0fd0 100644 --- a/soh/src/overlays/gamestates/ovl_title/z_title.c +++ b/soh/src/overlays/gamestates/ovl_title/z_title.c @@ -222,6 +222,67 @@ void Title_Draw(TitleContext* this) { void Title_Main(GameState* thisx) { TitleContext* this = (TitleContext*)thisx; + if (CVar_GetS32("gSkipLogoTitle", 0) != 0) { + Sram_InitSram(&this->state, &this->sramCtx); + s16 selectedfile = CVar_GetS32("gSaveFileID", 0); + if (selectedfile == 4) { + selectedfile = 0xFF; + } else { + selectedfile--; + if (selectedfile < 0) { + selectedfile = 0xFF; + } + } + if (selectedfile == 0 && CVar_GetS32("gDebugEnabled", 0) || selectedfile == 0xFF) { + gSaveContext.fileNum = selectedfile; + Sram_OpenSave(&this->sramCtx); + gSaveContext.gameMode = 0; + this->state.running = false; + SET_NEXT_GAMESTATE(&this->state, Select_Init, SelectContext); + } else { + gSaveContext.fileNum = selectedfile; + Sram_OpenSave(&this->sramCtx); + gSaveContext.gameMode = 0; + this->state.running = false; + SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext); + } + gSaveContext.respawn[0].entranceIndex = -1; + gSaveContext.respawnFlag = 0; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.natureAmbienceId = 0xFF; + gSaveContext.showTitleCard = true; + gSaveContext.dogParams = 0; + gSaveContext.timer1State = 0; + gSaveContext.timer2State = 0; + gSaveContext.eventInf[0] = 0; + gSaveContext.eventInf[1] = 0; + gSaveContext.eventInf[2] = 0; + gSaveContext.eventInf[3] = 0; + gSaveContext.unk_13EE = 0x32; + gSaveContext.nayrusLoveTimer = 0; + gSaveContext.healthAccumulator = 0; + gSaveContext.unk_13F0 = 0; + gSaveContext.unk_13F2 = 0; + gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; + gSaveContext.skyboxTime = 0; + gSaveContext.nextTransition = 0xFF; + gSaveContext.nextCutsceneIndex = 0xFFEF; + gSaveContext.cutsceneTrigger = 0; + gSaveContext.chamberCutsceneNum = 0; + gSaveContext.nextDayTime = 0xFFFF; + gSaveContext.unk_13C3 = 0; + gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = + gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED; + gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = + gSaveContext.unk_13F4 = 0; + gSaveContext.unk_13F6 = gSaveContext.magic; + gSaveContext.magic = 0; + gSaveContext.magicLevel = gSaveContext.magic; + gSaveContext.naviTimer = 0; + // Properly exit the function to avoid issues with OPEN_DISP etc. + return; + } + OPEN_DISPS(this->state.gfxCtx, "../z_title.c", 494); gSPSegment(POLY_OPA_DISP++, 0, NULL);