Add imgui option to restart in retail mode (#4404)

This commit is contained in:
Matt Dallmeyer
2026-09-04 06:28:21 -07:00
committed by GitHub
parent 9c86c86c74
commit 2796e0974b
5 changed files with 23 additions and 1 deletions
@@ -111,6 +111,9 @@ void OpenGlDebugGui::draw(const DmaStats& dma_stats) {
if (ImGui::MenuItem("Reboot In Debug Mode!")) {
want_reboot_in_debug = true;
}
if (ImGui::MenuItem("Reboot In Retail Mode!")) {
want_reboot_in_retail = true;
}
ImGui::EndMenu();
}
+2 -1
View File
@@ -67,6 +67,7 @@ class OpenGlDebugGui {
bool record_events = false;
int max_event_buffer_size = 65536;
bool want_reboot_in_debug = false;
bool want_reboot_in_retail = false;
bool screenshot_hotkey_enabled = true;
@@ -88,4 +89,4 @@ class OpenGlDebugGui {
namespace ImGui {
void applyFontStyle();
}
}
+4
View File
@@ -726,6 +726,10 @@ void GLDisplay::render() {
g_gfx_data->debug_gui.want_reboot_in_debug = false;
MasterExit = RuntimeExitStatus::RESTART_IN_DEBUG;
}
if (g_gfx_data->debug_gui.want_reboot_in_retail) {
g_gfx_data->debug_gui.want_reboot_in_retail = false;
MasterExit = RuntimeExitStatus::RESTART_IN_RETAIL;
}
{
auto p = scoped_prof("check-close-window");
+1
View File
@@ -14,6 +14,7 @@ enum class RuntimeExitStatus {
RESTART_RUNTIME = 1,
EXIT = 2,
RESTART_IN_DEBUG = 3,
RESTART_IN_RETAIL = 4,
};
enum class VideoMode {
+13
View File
@@ -242,6 +242,7 @@ int main(int argc, char** argv) {
}
bool force_debug_next_time = false;
bool force_retail_next_time = false;
// always start with an empty arg, as internally kmachine starts at `1` not `0`
std::vector<const char*> arg_ptrs = {""};
for (auto& str : game_args) {
@@ -261,6 +262,15 @@ int main(int argc, char** argv) {
arg_ptrs.push_back(str.data());
}
}
if (force_retail_next_time) {
force_retail_next_time = false;
arg_ptrs = {""}; // see above for rationale
for (auto& str : game_args) {
if (str != "-debug") {
arg_ptrs.push_back(str.data());
}
}
}
// run the runtime in a loop so we can reset the game and have it restart cleanly
lg::info("OpenGOAL Runtime {}.{}", versions::GOAL_VERSION_MAJOR, versions::GOAL_VERSION_MINOR);
@@ -276,6 +286,9 @@ int main(int argc, char** argv) {
case RuntimeExitStatus::RESTART_IN_DEBUG:
force_debug_next_time = true;
break;
case RuntimeExitStatus::RESTART_IN_RETAIL:
force_retail_next_time = true;
break;
}
} catch (std::exception& ex) {
lg::error("Unexpected exception occurred - {}", ex.what());