Boot sequence adjustments (#6119)
This commit is contained in:
@@ -9,18 +9,14 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#include "z64.h"
|
#include "z64.h"
|
||||||
#include "overlays/gamestates/ovl_file_choose/file_choose.h"
|
#include "overlays/gamestates/ovl_file_choose/file_choose.h"
|
||||||
|
#include "soh/Enhancements/enhancementTypes.h"
|
||||||
void Sram_InitDebugSave(void);
|
void Sram_InitDebugSave(void);
|
||||||
void Select_LoadGame(SelectContext* selectContext, s32 entranceIndex);
|
void Select_LoadGame(SelectContext* selectContext, s32 entranceIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr int32_t CVAR_DEBUG_ENABLED_DEFAULT = 0;
|
#define CVAR_BOOTSEQUENCE_NAME CVAR_SETTING("BootSequence")
|
||||||
#define CVAR_DEBUG_ENABLED_NAME CVAR_DEVELOPER_TOOLS("DebugEnabled")
|
#define CVAR_BOOTSEQUENCE_DEFAULT BOOTSEQUENCE_DEFAULT
|
||||||
#define CVAR_DEBUG_ENABLED_VALUE CVarGetInteger(CVAR_DEBUG_ENABLED_NAME, CVAR_DEBUG_ENABLED_DEFAULT)
|
#define CVAR_BOOTSEQUENCE_VALUE CVarGetInteger(CVAR_BOOTSEQUENCE_NAME, CVAR_BOOTSEQUENCE_DEFAULT)
|
||||||
|
|
||||||
static constexpr int32_t CVAR_BOOT_TO_DEBUG_WARP_SCREEN_DEFAULT = 0;
|
|
||||||
#define CVAR_BOOT_TO_DEBUG_WARP_SCREEN_NAME CVAR_DEVELOPER_TOOLS("BootToDebugWarpScreen")
|
|
||||||
#define CVAR_BOOT_TO_DEBUG_WARP_SCREEN_VALUE \
|
|
||||||
CVarGetInteger(CVAR_BOOT_TO_DEBUG_WARP_SCREEN_NAME, CVAR_BOOT_TO_DEBUG_WARP_SCREEN_DEFAULT)
|
|
||||||
|
|
||||||
typedef struct WarpPoint {
|
typedef struct WarpPoint {
|
||||||
s32 entranceId;
|
s32 entranceId;
|
||||||
@@ -49,15 +45,21 @@ void SaveConfig() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Warp(WarpPoint& warpPoint) {
|
void Warp(WarpPoint& warpPoint) {
|
||||||
SPDLOG_INFO("PLAYSTATE IS NULL: {}", gPlayState == NULL);
|
|
||||||
if (gPlayState == NULL) {
|
if (gPlayState == NULL) {
|
||||||
// If gPlayState is NULL, it means the the user opted into BootToWarpPoint and the game is starting up.
|
// If gPlayState is NULL, it means the the user opted into BootToWarpPoint and the game is starting up.
|
||||||
gSaveContext.gameMode = GAMEMODE_NORMAL;
|
gSaveContext.gameMode = GAMEMODE_NORMAL;
|
||||||
gSaveContext.fileNum = 0xFE; // temporary file so that this will respect debug save file option
|
gSaveContext.fileNum = 0xFE; // temporary file so that this will respect debug save file option
|
||||||
Sram_InitDebugSave();
|
Sram_InitDebugSave();
|
||||||
|
gSaveContext.magicFillTarget = gSaveContext.magic;
|
||||||
|
gSaveContext.magic = 0;
|
||||||
|
gSaveContext.magicCapacity = 0;
|
||||||
|
gSaveContext.magicLevel = gSaveContext.magic;
|
||||||
gSaveContext.fileNum = 0xFF;
|
gSaveContext.fileNum = 0xFF;
|
||||||
gSaveContext.sceneSetupIndex = 0;
|
gSaveContext.sceneSetupIndex = 0;
|
||||||
gSaveContext.cutsceneIndex = 0;
|
gSaveContext.cutsceneIndex = 0;
|
||||||
|
gSaveContext.linkAge = 0;
|
||||||
|
gSaveContext.nightFlag = 0;
|
||||||
|
gSaveContext.skyboxTime = gSaveContext.dayTime = 0x8000;
|
||||||
|
|
||||||
// Copied from Select_LoadGame
|
// Copied from Select_LoadGame
|
||||||
for (int buttonIndex = 0; buttonIndex < ARRAY_COUNT(gSaveContext.buttonStatus); buttonIndex++) {
|
for (int buttonIndex = 0; buttonIndex < ARRAY_COUNT(gSaveContext.buttonStatus); buttonIndex++) {
|
||||||
@@ -182,26 +184,33 @@ void RegisterWarping() {
|
|||||||
loadedConfig = true;
|
loadedConfig = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
COND_HOOK(OnZTitleUpdate, CVAR_DEBUG_ENABLED_VALUE && CVAR_BOOT_TO_DEBUG_WARP_SCREEN_VALUE == 1,
|
COND_HOOK(OnZTitleUpdate, CVAR_BOOTSEQUENCE_VALUE == BOOTSEQUENCE_DEBUGWARPSCREEN, [](void* gameState) {
|
||||||
[](void* gameState) {
|
TitleContext* titleContext = (TitleContext*)gameState;
|
||||||
TitleContext* titleContext = (TitleContext*)gameState;
|
|
||||||
|
|
||||||
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
||||||
gSaveContext.natureAmbienceId = 0xFF;
|
gSaveContext.natureAmbienceId = 0xFF;
|
||||||
gSaveContext.gameMode = GAMEMODE_NORMAL;
|
gSaveContext.gameMode = GAMEMODE_NORMAL;
|
||||||
titleContext->state.running = false;
|
titleContext->state.running = false;
|
||||||
SET_NEXT_GAMESTATE(&titleContext->state, Select_Init, SelectContext);
|
SET_NEXT_GAMESTATE(&titleContext->state, Select_Init, SelectContext);
|
||||||
});
|
});
|
||||||
|
|
||||||
COND_HOOK(OnZTitleUpdate, CVAR_DEBUG_ENABLED_VALUE && CVAR_BOOT_TO_DEBUG_WARP_SCREEN_VALUE == 2,
|
COND_HOOK(OnZTitleUpdate, CVAR_BOOTSEQUENCE_VALUE == BOOTSEQUENCE_WARPPOINT, [](void* gameState) {
|
||||||
[](void* gameState) {
|
for (auto& wp : warpPoints) {
|
||||||
for (auto& wp : warpPoints) {
|
if (wp.second.bootToPoint) {
|
||||||
if (wp.second.bootToPoint) {
|
Warp(wp.second);
|
||||||
Warp(wp.second);
|
return;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
// Fallback to Debug Warp Screen if no warp point is set to boot to
|
||||||
|
TitleContext* titleContext = (TitleContext*)gameState;
|
||||||
|
|
||||||
|
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
||||||
|
gSaveContext.natureAmbienceId = 0xFF;
|
||||||
|
gSaveContext.gameMode = GAMEMODE_NORMAL;
|
||||||
|
titleContext->state.running = false;
|
||||||
|
SET_NEXT_GAMESTATE(&titleContext->state, Select_Init, SelectContext);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static RegisterShipInitFunc initFunc(RegisterWarping, { CVAR_DEBUG_ENABLED_NAME, CVAR_BOOT_TO_DEBUG_WARP_SCREEN_NAME });
|
static RegisterShipInitFunc initFunc(RegisterWarping, { CVAR_BOOTSEQUENCE_NAME });
|
||||||
|
|||||||
@@ -213,15 +213,10 @@ void OnZTitleUpdateSkipToFileSelect(void* gameState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RegisterCustomLogoTitleBootsequence() {
|
void RegisterCustomLogoTitleBootsequence() {
|
||||||
COND_HOOK(OnZTitleUpdate,
|
COND_HOOK(OnZTitleUpdate, CVAR_BOOTSEQUENCE_VALUE == BOOTSEQUENCE_FILESELECT, OnZTitleUpdateSkipToFileSelect);
|
||||||
CVAR_BOOTSEQUENCE_VALUE == BOOTSEQUENCE_FILESELECT &&
|
|
||||||
CVarGetInteger(CVAR_DEVELOPER_TOOLS("BootToDebugWarpScreen"), 0) == 0,
|
|
||||||
OnZTitleUpdateSkipToFileSelect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static RegisterShipInitFunc registerTitleBootSequence(RegisterCustomLogoTitleBootsequence,
|
static RegisterShipInitFunc registerTitleBootSequence(RegisterCustomLogoTitleBootsequence, { CVAR_BOOTSEQUENCE_NAME });
|
||||||
{ CVAR_BOOTSEQUENCE_NAME,
|
|
||||||
CVAR_DEVELOPER_TOOLS("BootToDebugWarpScreen") });
|
|
||||||
|
|
||||||
// // // // // //
|
// // // // // //
|
||||||
// Let it Snow
|
// Let it Snow
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ typedef enum {
|
|||||||
BOOTSEQUENCE_DEFAULT,
|
BOOTSEQUENCE_DEFAULT,
|
||||||
BOOTSEQUENCE_AUTHENTIC,
|
BOOTSEQUENCE_AUTHENTIC,
|
||||||
BOOTSEQUENCE_FILESELECT,
|
BOOTSEQUENCE_FILESELECT,
|
||||||
|
BOOTSEQUENCE_DEBUGWARPSCREEN,
|
||||||
|
BOOTSEQUENCE_WARPPOINT,
|
||||||
} BootSequenceType;
|
} BootSequenceType;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ typedef enum {
|
|||||||
DISABLE_FOR_FRAME_ADVANCE_OFF,
|
DISABLE_FOR_FRAME_ADVANCE_OFF,
|
||||||
DISABLE_FOR_ADVANCED_RESOLUTION_OFF,
|
DISABLE_FOR_ADVANCED_RESOLUTION_OFF,
|
||||||
DISABLE_FOR_VERTICAL_RESOLUTION_OFF,
|
DISABLE_FOR_VERTICAL_RESOLUTION_OFF,
|
||||||
DISABLE_FOR_BOOT_TO_DEBUG_WARP_SCREEN_ON,
|
|
||||||
} DisableOption;
|
} DisableOption;
|
||||||
|
|
||||||
struct WidgetInfo;
|
struct WidgetInfo;
|
||||||
|
|||||||
@@ -154,12 +154,6 @@ void SohMenu::InitElement() {
|
|||||||
return !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", 0);
|
return !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", 0);
|
||||||
},
|
},
|
||||||
"Vertical Resolution Toggle is Off" } },
|
"Vertical Resolution Toggle is Off" } },
|
||||||
{ DISABLE_FOR_BOOT_TO_DEBUG_WARP_SCREEN_ON,
|
|
||||||
{ [](disabledInfo& info) -> bool {
|
|
||||||
return CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) &&
|
|
||||||
CVarGetInteger(CVAR_DEVELOPER_TOOLS("BootToDebugWarpScreen"), 0);
|
|
||||||
},
|
|
||||||
"\"Boot To Debug Warp Screen\" Enabled (see Dev Tools -> General)" } },
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,6 @@ static const std::map<int32_t, const char*> logLevels = {
|
|||||||
{ DEBUG_LOG_WARN, "Warn" }, { DEBUG_LOG_ERROR, "Error" }, { DEBUG_LOG_CRITICAL, "Critical" },
|
{ DEBUG_LOG_WARN, "Warn" }, { DEBUG_LOG_ERROR, "Error" }, { DEBUG_LOG_CRITICAL, "Critical" },
|
||||||
{ DEBUG_LOG_OFF, "Off" },
|
{ DEBUG_LOG_OFF, "Off" },
|
||||||
};
|
};
|
||||||
static std::map<int32_t, const char*> bootToOptions = {
|
|
||||||
{ 0, "Disabled" },
|
|
||||||
{ 1, "Debug Warp Screen" },
|
|
||||||
{ 2, "Warp Point" },
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugLogOption defaultLogLevel = DEBUG_LOG_TRACE;
|
DebugLogOption defaultLogLevel = DEBUG_LOG_TRACE;
|
||||||
@@ -64,7 +59,8 @@ void SohMenu::AddMenuDevTools() {
|
|||||||
"- Off: The debug save file will be a normal savefile.\n"
|
"- Off: The debug save file will be a normal savefile.\n"
|
||||||
"- Vanilla: The debug save file will be the debug save file from the original game.\n"
|
"- Vanilla: The debug save file will be the debug save file from the original game.\n"
|
||||||
"- Maxed: The debug save file will be a save file with all of the items & upgrades.")
|
"- Maxed: The debug save file will be a save file with all of the items & upgrades.")
|
||||||
.ComboMap(debugSaveFileModes));
|
.ComboMap(debugSaveFileModes)
|
||||||
|
.DefaultIndex(1));
|
||||||
AddWidget(path, "OoT Skulltula Debug", WIDGET_CVAR_CHECKBOX)
|
AddWidget(path, "OoT Skulltula Debug", WIDGET_CVAR_CHECKBOX)
|
||||||
.CVar(CVAR_DEVELOPER_TOOLS("SkulltulaDebugEnabled"))
|
.CVar(CVAR_DEVELOPER_TOOLS("SkulltulaDebugEnabled"))
|
||||||
.PreFunc([](WidgetInfo& info) { info.isHidden = !CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0); })
|
.PreFunc([](WidgetInfo& info) { info.isHidden = !CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0); })
|
||||||
@@ -122,33 +118,17 @@ void SohMenu::AddMenuDevTools() {
|
|||||||
.PreFunc([](WidgetInfo& info) { info.isHidden = mSohMenu->disabledMap.at(DISABLE_FOR_DEBUG_MODE_OFF).active; });
|
.PreFunc([](WidgetInfo& info) { info.isHidden = mSohMenu->disabledMap.at(DISABLE_FOR_DEBUG_MODE_OFF).active; });
|
||||||
|
|
||||||
path.column = SECTION_COLUMN_2;
|
path.column = SECTION_COLUMN_2;
|
||||||
AddWidget(path, "Warping", WIDGET_SEPARATOR_TEXT).PreFunc([](WidgetInfo& info) {
|
AddWidget(path, "Warping", WIDGET_SEPARATOR_TEXT);
|
||||||
info.isHidden = !CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0);
|
|
||||||
});
|
|
||||||
AddWidget(path, "Better Debug Warp Screen", WIDGET_CVAR_CHECKBOX)
|
AddWidget(path, "Better Debug Warp Screen", WIDGET_CVAR_CHECKBOX)
|
||||||
.CVar(CVAR_DEVELOPER_TOOLS("BetterDebugWarpScreen"))
|
.CVar(CVAR_DEVELOPER_TOOLS("BetterDebugWarpScreen"))
|
||||||
.PreFunc([](WidgetInfo& info) { info.isHidden = !CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0); })
|
|
||||||
.Options(CheckboxOptions()
|
.Options(CheckboxOptions()
|
||||||
.Tooltip("Optimized Debug Warp Screen, with the added ability to chose entrances and time of day.")
|
.Tooltip("Optimized Debug Warp Screen, with the added ability to chose entrances and time of day.")
|
||||||
.DefaultValue(true));
|
.DefaultValue(true));
|
||||||
AddWidget(path, "Debug Warp Screen Translation", WIDGET_CVAR_CHECKBOX)
|
AddWidget(path, "Debug Warp Screen Translation", WIDGET_CVAR_CHECKBOX)
|
||||||
.CVar(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"))
|
.CVar(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"))
|
||||||
.PreFunc([](WidgetInfo& info) { info.isHidden = !CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0); })
|
|
||||||
.Options(CheckboxOptions()
|
.Options(CheckboxOptions()
|
||||||
.Tooltip("Translate the Debug Warp Screen based on the game language.")
|
.Tooltip("Translate the Debug Warp Screen based on the game language.")
|
||||||
.DefaultValue(true));
|
.DefaultValue(true));
|
||||||
AddWidget(path, "Boot To:", WIDGET_CVAR_COMBOBOX)
|
|
||||||
.CVar(CVAR_DEVELOPER_TOOLS("BootToDebugWarpScreen"))
|
|
||||||
.PreFunc([](WidgetInfo& info) { info.isHidden = !CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0); })
|
|
||||||
.Options(ComboboxOptions()
|
|
||||||
.DefaultIndex(0)
|
|
||||||
.ComponentAlignment(ComponentAlignments::Right)
|
|
||||||
.LabelPosition(LabelPositions::Far)
|
|
||||||
.Color(THEME_COLOR)
|
|
||||||
.ComboMap(bootToOptions)
|
|
||||||
.Tooltip("Automatically boots to Debug Warp Screen or custom Warp Point when starting or "
|
|
||||||
"resetting the game.\n"
|
|
||||||
"This option takes precedence over \"Boot Sequence\" option."));
|
|
||||||
AddWidget(path, "Warp Points", WIDGET_CUSTOM).CustomFunction(WarpPointsWidget).HideInSearch(true);
|
AddWidget(path, "Warp Points", WIDGET_CUSTOM).CustomFunction(WarpPointsWidget).HideInSearch(true);
|
||||||
|
|
||||||
// Stats
|
// Stats
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ static const std::map<int32_t, const char*> notificationPosition = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const std::map<int32_t, const char*> bootSequenceLabels = {
|
static const std::map<int32_t, const char*> bootSequenceLabels = {
|
||||||
{ BOOTSEQUENCE_DEFAULT, "Default" },
|
{ BOOTSEQUENCE_DEFAULT, "Default" }, { BOOTSEQUENCE_AUTHENTIC, "Authentic" },
|
||||||
{ BOOTSEQUENCE_AUTHENTIC, "Authentic" },
|
{ BOOTSEQUENCE_FILESELECT, "File Select" }, { BOOTSEQUENCE_DEBUGWARPSCREEN, "Debug Warp Screen" },
|
||||||
{ BOOTSEQUENCE_FILESELECT, "File Select" },
|
{ BOOTSEQUENCE_WARPPOINT, "Warp Point" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* GetGameVersionString(uint32_t index) {
|
const char* GetGameVersionString(uint32_t index) {
|
||||||
@@ -125,7 +125,7 @@ void SohMenu::UpdateLanguageMap(std::map<int32_t, const char*>& languageMap) {
|
|||||||
void SohMenu::AddMenuSettings() {
|
void SohMenu::AddMenuSettings() {
|
||||||
// Add Settings Menu
|
// Add Settings Menu
|
||||||
AddMenuEntry("Settings", CVAR_SETTING("Menu.SettingsSidebarSection"));
|
AddMenuEntry("Settings", CVAR_SETTING("Menu.SettingsSidebarSection"));
|
||||||
AddSidebarEntry("Settings", "General", 3);
|
AddSidebarEntry("Settings", "General", 2);
|
||||||
WidgetPath path = { "Settings", "General", SECTION_COLUMN_1 };
|
WidgetPath path = { "Settings", "General", SECTION_COLUMN_1 };
|
||||||
|
|
||||||
// General - Settings
|
// General - Settings
|
||||||
@@ -190,10 +190,6 @@ void SohMenu::AddMenuSettings() {
|
|||||||
AddWidget(path, "Boot Sequence", WIDGET_CVAR_COMBOBOX)
|
AddWidget(path, "Boot Sequence", WIDGET_CVAR_COMBOBOX)
|
||||||
.CVar(CVAR_SETTING("BootSequence"))
|
.CVar(CVAR_SETTING("BootSequence"))
|
||||||
.RaceDisable(false)
|
.RaceDisable(false)
|
||||||
.PreFunc([](WidgetInfo& info) {
|
|
||||||
if (mSohMenu->disabledMap.at(DISABLE_FOR_BOOT_TO_DEBUG_WARP_SCREEN_ON).active)
|
|
||||||
info.activeDisables.push_back(DISABLE_FOR_BOOT_TO_DEBUG_WARP_SCREEN_ON);
|
|
||||||
})
|
|
||||||
.Options(ComboboxOptions()
|
.Options(ComboboxOptions()
|
||||||
.DefaultIndex(BOOTSEQUENCE_DEFAULT)
|
.DefaultIndex(BOOTSEQUENCE_DEFAULT)
|
||||||
.LabelPosition(LabelPositions::Far)
|
.LabelPosition(LabelPositions::Far)
|
||||||
@@ -202,7 +198,9 @@ void SohMenu::AddMenuSettings() {
|
|||||||
.Tooltip("Configure what happens when starting or resetting the game.\n\n"
|
.Tooltip("Configure what happens when starting or resetting the game.\n\n"
|
||||||
"Default: LUS logo -> N64 logo\n"
|
"Default: LUS logo -> N64 logo\n"
|
||||||
"Authentic: N64 logo only\n"
|
"Authentic: N64 logo only\n"
|
||||||
"File Select: Skip to file select menu"));
|
"File Select: Skip to file select menu\n"
|
||||||
|
"Debug Warp Screen: Skip to the debug warp screen\n"
|
||||||
|
"Warp Point: Skip to active warp point (if set), see Dev Tools -> General"));
|
||||||
|
|
||||||
AddWidget(path, "Languages", WIDGET_SEPARATOR_TEXT);
|
AddWidget(path, "Languages", WIDGET_SEPARATOR_TEXT);
|
||||||
AddWidget(path, "Translate Title Screen", WIDGET_CVAR_CHECKBOX)
|
AddWidget(path, "Translate Title Screen", WIDGET_CVAR_CHECKBOX)
|
||||||
|
|||||||
Reference in New Issue
Block a user