Skip to content

Commit

Permalink
EnableLevelSelect: replaces mainmenu with debug lvl select
Browse files Browse the repository at this point in the history
  • Loading branch information
emoose committed Dec 8, 2024
1 parent 57679aa commit 712240d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
4 changes: 4 additions & 0 deletions OutRun2006Tweaks.ini
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ SkipIntroLogos = false
# Can also be enabled via -OuttaTime launch parameter.
DisableCountdownTimer = false

# Replaces the main menu with a debug level select, can be useful for quickly testing levels
# Can also be enabled via -LevelSelect launch parameter.
EnableLevelSelect = false

# Clarissa in O2SP arcade mode uses a different model in non-JP versions, this allows restoring the original JP model
RestoreJPClarissa = false

Expand Down
2 changes: 2 additions & 0 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ namespace Settings
spdlog::info(" - EnableHollyCourse2: {}", EnableHollyCourse2);
spdlog::info(" - SkipIntroLogos: {}", SkipIntroLogos);
spdlog::info(" - DisableCountdownTimer: {}", DisableCountdownTimer);
spdlog::info(" - EnableLevelSelect: {}", EnableLevelSelect);
spdlog::info(" - HudToggleKey: {}", HudToggleKey);
spdlog::info(" - RestoreJPClarissa: {}", RestoreJPClarissa);
spdlog::info(" - ShowOutRunMilesOnMenu: {}", ShowOutRunMilesOnMenu);
Expand Down Expand Up @@ -241,6 +242,7 @@ namespace Settings
EnableHollyCourse2 = ini.Get("Misc", "EnableHollyCourse2", std::move(EnableHollyCourse2));
SkipIntroLogos = ini.Get("Misc", "SkipIntroLogos", std::move(SkipIntroLogos));
DisableCountdownTimer = ini.Get("Misc", "DisableCountdownTimer", std::move(DisableCountdownTimer));
EnableLevelSelect = ini.Get("Misc", "EnableLevelSelect", std::move(EnableLevelSelect));
RestoreJPClarissa = ini.Get("Misc", "RestoreJPClarissa", std::move(RestoreJPClarissa));
ShowOutRunMilesOnMenu = ini.Get("Misc", "ShowOutRunMilesOnMenu", std::move(ShowOutRunMilesOnMenu));
AllowCharacterSelection = ini.Get("Misc", "AllowCharacterSelection", std::move(AllowCharacterSelection));
Expand Down
34 changes: 33 additions & 1 deletion src/hooks_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,12 @@ class CommandLineArguments : public Hook
spdlog::info("CommandLineArguments: DisableCountdownTimer = true");
Settings::DisableCountdownTimer = true;
}
else if (!wcsicmp(argv[i], L"-LevelSelect"))
{
spdlog::info("CommandLineArguments: EnableLevelSelect = true");
Settings::EnableLevelSelect = true;
Settings::SkipIntroLogos = true;
}
}
catch (...) {}
}
Expand Down Expand Up @@ -768,4 +774,30 @@ class GameDefaultConfigOverride : public Hook

static GameDefaultConfigOverride instance;
};
GameDefaultConfigOverride GameDefaultConfigOverride::instance;
GameDefaultConfigOverride GameDefaultConfigOverride::instance;

class EnableLevelSelect : public Hook
{
public:
std::string_view description() override
{
return "EnableLevelSelect";
}

bool validate() override
{
return Settings::EnableLevelSelect;
}

bool apply() override
{
// Change the param for "GetMenuForId" call from 0 to 0x1B
constexpr int SumoFrontEnd__eventStep1_GetMenuForIdCall_Param = 0x45756 + 1;
Memory::VP::Patch(Module::exe_ptr(SumoFrontEnd__eventStep1_GetMenuForIdCall_Param), uint8_t(0x1B));

return true;
}

static EnableLevelSelect instance;
};
EnableLevelSelect EnableLevelSelect::instance;
1 change: 1 addition & 0 deletions src/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ namespace Settings
inline int EnableHollyCourse2 = 1;
inline bool SkipIntroLogos = false;
inline bool DisableCountdownTimer = false;
inline bool EnableLevelSelect = false;
inline bool RestoreJPClarissa = false;
inline bool ShowOutRunMilesOnMenu = true;
inline bool AllowCharacterSelection = false;
Expand Down

0 comments on commit 712240d

Please sign in to comment.