diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp index 244e1a394..21919c3cd 100644 --- a/libultraship/libultraship/GameSettings.cpp +++ b/libultraship/libultraship/GameSettings.cpp @@ -83,6 +83,9 @@ namespace Game { Settings.enhancements.newdrops = stob(Conf[EnhancementSection]["newdrops"]); CVar_SetS32("gNewDrops", Settings.enhancements.newdrops); + + Settings.enhancements.save_entrance = stob(Conf[EnhancementSection]["save_entrance"]); + CVar_SetS32("gSaveEntrance", Settings.enhancements.save_entrance); // Audio Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]); diff --git a/libultraship/libultraship/GameSettings.cpp.rej b/libultraship/libultraship/GameSettings.cpp.rej new file mode 100644 index 000000000..2ed36fe9d --- /dev/null +++ b/libultraship/libultraship/GameSettings.cpp.rej @@ -0,0 +1,9 @@ +diff a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp (rejected hunks) +@@ -184,6 +187,7 @@ namespace Game { + Conf[EnhancementSection]["newdrops"] = std::to_string(Settings.enhancements.newdrops); + Conf[EnhancementSection]["visualagony"] = std::to_string(Settings.enhancements.visualagony); + Conf[EnhancementSection]["mm_bunny_hood"] = std::to_string(Settings.enhancements.mm_bunny_hood); ++ Conf[EnhancementSection]["save_entrance"] = std::to_string(Settings.enhancements.save_entrance); + + + // Controllers diff --git a/libultraship/libultraship/GameSettings.h.rej b/libultraship/libultraship/GameSettings.h.rej new file mode 100644 index 000000000..b2ef7aa8d --- /dev/null +++ b/libultraship/libultraship/GameSettings.h.rej @@ -0,0 +1,9 @@ +diff a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h (rejected hunks) +@@ -29,6 +29,7 @@ struct SoHConfigType { + bool newdrops = false; + bool visualagony = false; + bool mm_bunny_hood = false; ++ bool save_entrance = true; + + } enhancements; + diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 83ff7ef0e..671988896 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -508,6 +508,11 @@ namespace SohImGui { needs_save = true; } + if (ImGui::Checkbox("Save Last Entrance", &Game::Settings.enhancements.save_entrance)) { + CVar_SetS32("gSaveEntrance", Game::Settings.enhancements.save_entrance); + needs_save = true; + } + ImGui::Text("Graphics"); ImGui::Separator(); diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index a774636f7..f8beff730 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -362,14 +362,22 @@ void Sram_OpenSave(SramContext* sramCtx) { case SCENE_GANON_DEMO: gSaveContext.entranceIndex = 0x41B; break; - - default: + case SCENE_KAKUSIANA: if (gSaveContext.savedSceneNum != SCENE_LINK_HOME) { gSaveContext.entranceIndex = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? 0xBB : 0x5F4; } else { gSaveContext.entranceIndex = 0xBB; } break; + default: + if (!CVar_GetS32("gSaveEntrance", 0)) { + if (gSaveContext.savedSceneNum != SCENE_LINK_HOME) { + gSaveContext.entranceIndex = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? 0xBB : 0x5F4; + } else { + gSaveContext.entranceIndex = 0xBB; + } + break; + } } osSyncPrintf("scene_no = %d\n", gSaveContext.entranceIndex);