Store last game path; CVar updates & more

This commit is contained in:
Luke Street 2022-06-13 01:18:30 -04:00
parent 97357146f5
commit 5fb8b1237e
5 changed files with 121 additions and 69 deletions

View File

@ -221,6 +221,7 @@ public:
if (!m_projectInitialized && !m_deferredProject.empty()) { if (!m_projectInitialized && !m_deferredProject.empty()) {
if (CDvdFile::Initialize(m_deferredProject)) { if (CDvdFile::Initialize(m_deferredProject)) {
m_projectInitialized = true; m_projectInitialized = true;
m_cvarCommons.m_lastDiscPath->fromLiteral(m_deferredProject);
} else { } else {
Log.report(logvisor::Error, FMT_STRING("Failed to open disc image '{}'"), m_deferredProject); Log.report(logvisor::Error, FMT_STRING("Failed to open disc image '{}'"), m_deferredProject);
m_imGuiConsole.m_errorString = fmt::format(FMT_STRING("Failed to open disc image '{}'"), m_deferredProject); m_imGuiConsole.m_errorString = fmt::format(FMT_STRING("Failed to open disc image '{}'"), m_deferredProject);
@ -272,6 +273,7 @@ public:
g_mainMP1.reset(); g_mainMP1.reset();
CDvdFile::Shutdown(); CDvdFile::Shutdown();
m_projectInitialized = false; m_projectInitialized = false;
m_cvarCommons.m_lastDiscPath->fromLiteral(""sv);
} }
} }

View File

@ -19,8 +19,6 @@ CVarCommons::CVarCommons(CVarManager& manager) : m_mgr(manager) {
CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart); CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart);
m_variableDt = m_mgr.findOrMakeCVar("variableDt", "Enable variable delta time (experimental)", false, m_variableDt = m_mgr.findOrMakeCVar("variableDt", "Enable variable delta time (experimental)", false,
(CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart)); (CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart));
m_lazyCommitResources = m_mgr.findOrMakeCVar("lazyCommitResources"sv, "Enable lazy commiting resources to GPU", true,
(CVar::EFlags::System | CVar::EFlags::Archive));
m_debugOverlayPlayerInfo = m_mgr.findOrMakeCVar( m_debugOverlayPlayerInfo = m_mgr.findOrMakeCVar(
"debugOverlay.playerInfo"sv, "Displays information about the player, such as location and orientation"sv, false, "debugOverlay.playerInfo"sv, "Displays information about the player, such as location and orientation"sv, false,
@ -53,8 +51,14 @@ CVarCommons::CVarCommons(CVarManager& manager) : m_mgr(manager) {
m_debugOverlayShowRandomStats = m_debugOverlayShowRandomStats =
m_mgr.findOrMakeCVar("debugOverlay.showRandomStats", "Displays the current number of random calls per frame"sv, m_mgr.findOrMakeCVar("debugOverlay.showRandomStats", "Displays the current number of random calls per frame"sv,
false, CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); false, CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly);
m_debugOverlayShowInput = m_mgr.findOrMakeCVar("debugOverlay.showInput"sv, "Displays user input"sv, false, m_debugOverlayShowInput = m_mgr.findOrMakeCVar("debugOverlay.showInput"sv, "Displays controller input"sv, false,
CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly);
m_debugOverlayCorner =
m_mgr.findOrMakeCVar("debugOverlay.overlayCorner"sv, "ImGui debug overlay corner"sv, 2 /* bottom-left */,
CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::Hidden);
m_debugInputOverlayCorner =
m_mgr.findOrMakeCVar("debugOverlay.inputOverlayCorner"sv, "ImGui input overlay corner"sv, 3 /* bottom-right */,
CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::Hidden);
m_debugToolDrawAiPath = m_debugToolDrawAiPath =
m_mgr.findOrMakeCVar("debugTool.drawAiPath", "Draws the selected paths of any AI in the room"sv, false, m_mgr.findOrMakeCVar("debugTool.drawAiPath", "Draws the selected paths of any AI in the room"sv, false,
CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly);
@ -70,7 +74,8 @@ CVarCommons::CVarCommons(CVarManager& manager) : m_mgr(manager) {
CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly);
m_logFile = m_mgr.findOrMakeCVar("logFile"sv, "Any log prints will be stored to this file upon exit"sv, "app.log"sv, m_logFile = m_mgr.findOrMakeCVar("logFile"sv, "Any log prints will be stored to this file upon exit"sv, "app.log"sv,
CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart); CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart);
m_lastDiscPath = m_mgr.findOrMakeCVar("lastDiscPath"sv, "Most recently loaded disc image path"sv, ""sv,
CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::Hidden);
m_instance = this; m_instance = this;
} }

View File

@ -27,7 +27,6 @@ struct CVarCommons {
CVar* m_texAnisotropy = nullptr; CVar* m_texAnisotropy = nullptr;
CVar* m_deepColor = nullptr; CVar* m_deepColor = nullptr;
CVar* m_variableDt = nullptr; CVar* m_variableDt = nullptr;
CVar* m_lazyCommitResources = nullptr;
CVar* m_debugOverlayPlayerInfo = nullptr; CVar* m_debugOverlayPlayerInfo = nullptr;
CVar* m_debugOverlayWorldInfo = nullptr; CVar* m_debugOverlayWorldInfo = nullptr;
@ -40,12 +39,15 @@ struct CVarCommons {
CVar* m_debugOverlayShowRandomStats = nullptr; CVar* m_debugOverlayShowRandomStats = nullptr;
CVar* m_debugOverlayShowRoomTimer = nullptr; CVar* m_debugOverlayShowRoomTimer = nullptr;
CVar* m_debugOverlayShowInput = nullptr; CVar* m_debugOverlayShowInput = nullptr;
CVar* m_debugOverlayCorner = nullptr;
CVar* m_debugInputOverlayCorner = nullptr;
CVar* m_debugToolDrawAiPath = nullptr; CVar* m_debugToolDrawAiPath = nullptr;
CVar* m_debugToolDrawLighting = nullptr; CVar* m_debugToolDrawLighting = nullptr;
CVar* m_debugToolDrawCollisionActors = nullptr; CVar* m_debugToolDrawCollisionActors = nullptr;
CVar* m_debugToolDrawMazePath = nullptr; CVar* m_debugToolDrawMazePath = nullptr;
CVar* m_debugToolDrawPlatformCollision = nullptr; CVar* m_debugToolDrawPlatformCollision = nullptr;
CVar* m_logFile = nullptr; CVar* m_logFile = nullptr;
CVar* m_lastDiscPath = nullptr;
CVarCommons(CVarManager& manager); CVarCommons(CVarManager& manager);

View File

@ -149,7 +149,7 @@ void ImGuiConsole::ShowMenuGame() {
if (ImGui::MenuItem("Step Frame", "F6", &m_stepFrame, m_paused)) { if (ImGui::MenuItem("Step Frame", "F6", &m_stepFrame, m_paused)) {
g_Main->SetPaused(false); g_Main->SetPaused(false);
} }
if (ImGui::BeginMenu("Warp", g_StateManager != nullptr && g_ResFactory != nullptr && if (ImGui::BeginMenu("Warp", m_cheats && g_StateManager != nullptr && g_ResFactory != nullptr &&
g_ResFactory->GetResLoader() != nullptr)) { g_ResFactory->GetResLoader() != nullptr)) {
for (const auto& world : ListWorlds()) { for (const auto& world : ListWorlds()) {
if (ImGui::BeginMenu(world.first.c_str())) { if (ImGui::BeginMenu(world.first.c_str())) {
@ -676,9 +676,9 @@ void ImGuiConsole::ShowAboutWindow(bool preLaunch) {
if (ImGuiButtonCenter("Settings")) { if (ImGuiButtonCenter("Settings")) {
m_showPreLaunchSettingsWindow = true; m_showPreLaunchSettingsWindow = true;
} }
ImGui::Dummy(padding);
#ifdef NATIVEFILEDIALOG_SUPPORTED #ifdef NATIVEFILEDIALOG_SUPPORTED
if (ImGuiButtonCenter("Select Game Disc")) { ImGui::Dummy(padding);
if (ImGuiButtonCenter("Select Game")) {
nfdchar_t* outPath = nullptr; nfdchar_t* outPath = nullptr;
nfdresult_t nfdResult = NFD_OpenDialog(nullptr, nullptr, &outPath); nfdresult_t nfdResult = NFD_OpenDialog(nullptr, nullptr, &outPath);
if (nfdResult == NFD_OKAY) { if (nfdResult == NFD_OKAY) {
@ -688,8 +688,13 @@ void ImGuiConsole::ShowAboutWindow(bool preLaunch) {
Log.report(logvisor::Error, FMT_STRING("nativefiledialog error: {}"), NFD_GetError()); Log.report(logvisor::Error, FMT_STRING("nativefiledialog error: {}"), NFD_GetError());
} }
} }
ImGui::Dummy(padding);
#endif #endif
if (!m_lastDiscPath.empty()) {
if (ImGuiButtonCenter("Load Previous Game")) {
m_gameDiscSelected = m_lastDiscPath;
}
}
ImGui::Dummy(padding);
} }
if (m_errorString) { if (m_errorString) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4{0.77f, 0.12f, 0.23f, 1.f}); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4{0.77f, 0.12f, 0.23f, 1.f});
@ -794,8 +799,7 @@ void ImGuiConsole::ShowDebugOverlay() {
} }
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
ImGuiWindowFlags_NoNav;
if (m_debugOverlayCorner != -1) { if (m_debugOverlayCorner != -1) {
SetOverlayWindowLocation(m_debugOverlayCorner); SetOverlayWindowLocation(m_debugOverlayCorner);
windowFlags |= ImGuiWindowFlags_NoMove; windowFlags |= ImGuiWindowFlags_NoMove;
@ -946,7 +950,7 @@ void ImGuiConsole::ShowDebugOverlay() {
ImGuiStringViewText(fmt::format(FMT_STRING("Resource Objects: {}\n"), g_SimplePool->GetLiveObjects())); ImGuiStringViewText(fmt::format(FMT_STRING("Resource Objects: {}\n"), g_SimplePool->GetLiveObjects()));
} }
if (m_pipelineInfo) { if (m_pipelineInfo && m_developer) {
if (hasPrevious) { if (hasPrevious) {
ImGui::Separator(); ImGui::Separator();
} }
@ -966,7 +970,9 @@ void ImGuiConsole::ShowDebugOverlay() {
BytesToString(aurora::gfx::g_lastVertSize + aurora::gfx::g_lastUniformSize + BytesToString(aurora::gfx::g_lastVertSize + aurora::gfx::g_lastUniformSize +
aurora::gfx::g_lastIndexSize + aurora::gfx::g_lastStorageSize))); aurora::gfx::g_lastIndexSize + aurora::gfx::g_lastStorageSize)));
} }
ShowCornerContextMenu(m_debugOverlayCorner, m_inputOverlayCorner); if (ShowCornerContextMenu(m_debugOverlayCorner, m_inputOverlayCorner)) {
m_cvarCommons.m_debugOverlayCorner->fromInteger(m_debugOverlayCorner);
}
} }
ImGui::End(); ImGui::End();
} }
@ -995,8 +1001,7 @@ void ImGuiConsole::ShowInputViewer() {
// Code -stolen- borrowed from Practice Mod // Code -stolen- borrowed from Practice Mod
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
ImGuiWindowFlags_NoNav;
if (m_inputOverlayCorner != -1) { if (m_inputOverlayCorner != -1) {
SetOverlayWindowLocation(m_inputOverlayCorner); SetOverlayWindowLocation(m_inputOverlayCorner);
windowFlags |= ImGuiWindowFlags_NoMove; windowFlags |= ImGuiWindowFlags_NoMove;
@ -1134,30 +1139,39 @@ void ImGuiConsole::ShowInputViewer() {
} }
ImGui::Dummy(zeus::CVector2f(270, 130) * scale); ImGui::Dummy(zeus::CVector2f(270, 130) * scale);
ShowCornerContextMenu(m_inputOverlayCorner, m_debugOverlayCorner); if (ShowCornerContextMenu(m_inputOverlayCorner, m_debugOverlayCorner)) {
m_cvarCommons.m_debugInputOverlayCorner->fromInteger(m_inputOverlayCorner);
}
} }
ImGui::End(); ImGui::End();
} }
void ImGuiConsole::ShowCornerContextMenu(int& corner, int avoidCorner) const { bool ImGuiConsole::ShowCornerContextMenu(int& corner, int avoidCorner) const {
bool result = false;
if (ImGui::BeginPopupContextWindow()) { if (ImGui::BeginPopupContextWindow()) {
if (ImGui::MenuItem("Custom", nullptr, corner == -1)) { if (ImGui::MenuItem("Custom", nullptr, corner == -1)) {
corner = -1; corner = -1;
result = true;
} }
if (ImGui::MenuItem("Top-left", nullptr, corner == 0, avoidCorner != 0)) { if (ImGui::MenuItem("Top-left", nullptr, corner == 0, avoidCorner != 0)) {
corner = 0; corner = 0;
result = true;
} }
if (ImGui::MenuItem("Top-right", nullptr, corner == 1, avoidCorner != 1)) { if (ImGui::MenuItem("Top-right", nullptr, corner == 1, avoidCorner != 1)) {
corner = 1; corner = 1;
result = true;
} }
if (ImGui::MenuItem("Bottom-left", nullptr, corner == 2, avoidCorner != 2)) { if (ImGui::MenuItem("Bottom-left", nullptr, corner == 2, avoidCorner != 2)) {
corner = 2; corner = 2;
result = true;
} }
if (ImGui::MenuItem("Bottom-right", nullptr, corner == 3, avoidCorner != 3)) { if (ImGui::MenuItem("Bottom-right", nullptr, corner == 3, avoidCorner != 3)) {
corner = 3; corner = 3;
result = true;
} }
ImGui::EndPopup(); ImGui::EndPopup();
} }
return result;
} }
void ImGuiConsole::SetOverlayWindowLocation(int corner) const { void ImGuiConsole::SetOverlayWindowLocation(int corner) const {
@ -1174,6 +1188,21 @@ void ImGuiConsole::SetOverlayWindowLocation(int corner) const {
ImGui::SetNextWindowPos(windowPos, ImGuiCond_Always, windowPosPivot); ImGui::SetNextWindowPos(windowPos, ImGuiCond_Always, windowPosPivot);
} }
static void ImGuiCVarMenuItem(const char* name, CVar* cvar, bool& value) {
if (cvar == nullptr) {
return;
}
if (ImGui::MenuItem(name, nullptr, &value)) {
cvar->fromBoolean(value);
}
if (ImGui::IsItemHovered()) {
std::string tooltip{cvar->rawHelp()};
if (!tooltip.empty()) {
ImGui::SetTooltip("%s", tooltip.c_str());
}
}
}
void ImGuiConsole::ShowAppMainMenuBar(bool canInspect, bool preLaunch) { void ImGuiConsole::ShowAppMainMenuBar(bool canInspect, bool preLaunch) {
if (ImGui::BeginMainMenuBar()) { if (ImGui::BeginMainMenuBar()) {
if (ImGui::BeginMenu("Game")) { if (ImGui::BeginMenu("Game")) {
@ -1181,53 +1210,43 @@ void ImGuiConsole::ShowAppMainMenuBar(bool canInspect, bool preLaunch) {
ImGui::EndMenu(); ImGui::EndMenu();
} }
if (ImGui::BeginMenu("Tools")) { if (ImGui::BeginMenu("Tools")) {
ImGui::MenuItem("Player Transform", nullptr, &m_showPlayerTransformEditor, canInspect && m_developer);
ImGui::MenuItem("Inspect", nullptr, &m_showInspectWindow, canInspect && m_developer);
ImGui::MenuItem("Items", nullptr, &m_showItemsWindow, canInspect && m_developer && m_cheats);
ImGui::MenuItem("Layers", nullptr, &m_showLayersWindow, canInspect && m_developer);
ImGui::MenuItem("Console Variables", nullptr, &m_showConsoleVariablesWindow);
ImGui::MenuItem("Controller Config", nullptr, &m_controllerConfigVisible); ImGui::MenuItem("Controller Config", nullptr, &m_controllerConfigVisible);
ImGui::EndMenu(); ImGui::MenuItem("Items", nullptr, &m_showItemsWindow, canInspect && m_cheats);
} if (m_developer) {
if (ImGui::BeginMenu("Debug")) { ImGui::Separator();
if (ImGui::MenuItem("Frame Counter", nullptr, &m_frameCounter)) { ImGui::MenuItem("Console Variables", nullptr, &m_showConsoleVariablesWindow);
m_cvarCommons.m_debugOverlayShowFrameCounter->fromBoolean(m_frameCounter); ImGui::MenuItem("Inspect", nullptr, &m_showInspectWindow, canInspect);
} ImGui::MenuItem("Layers", nullptr, &m_showLayersWindow, canInspect);
if (ImGui::MenuItem("Frame Rate", nullptr, &m_frameRate)) { ImGui::MenuItem("Player Transform", nullptr, &m_showPlayerTransformEditor, canInspect && m_cheats);
m_cvarCommons.m_debugOverlayShowFramerate->fromBoolean(m_frameRate);
}
if (ImGui::MenuItem("In-Game Time", nullptr, &m_inGameTime)) {
m_cvarCommons.m_debugOverlayShowInGameTime->fromBoolean(m_inGameTime);
}
if (ImGui::MenuItem("Room Timer", nullptr, &m_roomTimer)) {
m_cvarCommons.m_debugOverlayShowRoomTimer->fromBoolean(m_roomTimer);
}
if (ImGui::MenuItem("Player Info", nullptr, &m_playerInfo)) {
m_cvarCommons.m_debugOverlayPlayerInfo->fromBoolean(m_playerInfo);
}
if (ImGui::MenuItem("World Info", nullptr, &m_worldInfo)) {
m_cvarCommons.m_debugOverlayWorldInfo->fromBoolean(m_worldInfo);
}
if (ImGui::MenuItem("Area Info", nullptr, &m_areaInfo)) {
m_cvarCommons.m_debugOverlayAreaInfo->fromBoolean(m_areaInfo);
}
if (ImGui::MenuItem("Layer Info", nullptr, &m_layerInfo)) {
m_cvarCommons.m_debugOverlayLayerInfo->fromBoolean(m_layerInfo);
}
if (ImGui::MenuItem("Random Stats", nullptr, &m_randomStats)) {
m_cvarCommons.m_debugOverlayShowRandomStats->fromBoolean(m_randomStats);
}
if (ImGui::MenuItem("Resource Stats", nullptr, &m_resourceStats)) {
m_cvarCommons.m_debugOverlayShowResourceStats->fromBoolean(m_resourceStats);
}
if (ImGui::MenuItem("Show Input", nullptr, &m_showInput)) {
m_cvarCommons.m_debugOverlayShowInput->fromBoolean(m_showInput);
} }
ImGui::EndMenu(); ImGui::EndMenu();
} }
ImGui::Spacing(); if (ImGui::BeginMenu("Overlays")) {
ImGuiCVarMenuItem("Frame Counter", m_cvarCommons.m_debugOverlayShowFrameCounter, m_frameCounter);
ImGuiCVarMenuItem("Frame Rate", m_cvarCommons.m_debugOverlayShowFramerate, m_frameRate);
ImGuiCVarMenuItem("In-Game Time", m_cvarCommons.m_debugOverlayShowInGameTime, m_inGameTime);
ImGuiCVarMenuItem("Room Timer", m_cvarCommons.m_debugOverlayShowRoomTimer, m_roomTimer);
ImGuiCVarMenuItem("Player Info", m_cvarCommons.m_debugOverlayPlayerInfo, m_playerInfo);
ImGuiCVarMenuItem("World Info", m_cvarCommons.m_debugOverlayWorldInfo, m_worldInfo);
ImGuiCVarMenuItem("Area Info", m_cvarCommons.m_debugOverlayAreaInfo, m_areaInfo);
ImGuiCVarMenuItem("Layer Info", m_cvarCommons.m_debugOverlayLayerInfo, m_layerInfo);
ImGuiCVarMenuItem("Random Stats", m_cvarCommons.m_debugOverlayShowRandomStats, m_randomStats);
ImGuiCVarMenuItem("Resource Stats", m_cvarCommons.m_debugOverlayShowResourceStats, m_resourceStats);
ImGuiCVarMenuItem("Show Input", m_cvarCommons.m_debugOverlayShowInput, m_showInput);
#if 0 // Currently unimplemented
ImGui::Separator();
ImGuiCVarMenuItem("Draw AI Paths", m_cvarCommons.m_debugToolDrawAiPath, m_drawAiPath);
ImGuiCVarMenuItem("Draw Lighting", m_cvarCommons.m_debugToolDrawLighting, m_drawLighting);
ImGuiCVarMenuItem("Draw Collision Actors", m_cvarCommons.m_debugToolDrawCollisionActors, m_drawCollisionActors);
ImGuiCVarMenuItem("Draw Maze Path", m_cvarCommons.m_debugToolDrawMazePath, m_drawMazePath);
ImGuiCVarMenuItem("Draw Platform Collision", m_cvarCommons.m_debugToolDrawPlatformCollision,
m_drawPlatformCollision);
#endif
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Help")) { if (ImGui::BeginMenu("Help")) {
ImGui::MenuItem("About", nullptr, &m_showAboutWindow, !preLaunch); ImGui::MenuItem("About", nullptr, &m_showAboutWindow, !preLaunch);
if (m_developer) {
ImGui::Separator(); ImGui::Separator();
if (ImGui::BeginMenu("ImGui")) { if (ImGui::BeginMenu("ImGui")) {
if (ImGui::MenuItem("Clear Settings")) { if (ImGui::MenuItem("Clear Settings")) {
@ -1238,6 +1257,7 @@ void ImGuiConsole::ShowAppMainMenuBar(bool canInspect, bool preLaunch) {
#endif #endif
ImGui::EndMenu(); ImGui::EndMenu();
} }
}
ImGui::EndMenu(); ImGui::EndMenu();
} }
ImGui::EndMainMenuBar(); ImGui::EndMainMenuBar();
@ -1260,6 +1280,16 @@ void ImGuiConsole::PreUpdate() {
m_cvarCommons.m_debugOverlayShowRandomStats->addListener([this](CVar* c) { m_randomStats = c->toBoolean(); }); m_cvarCommons.m_debugOverlayShowRandomStats->addListener([this](CVar* c) { m_randomStats = c->toBoolean(); });
m_cvarCommons.m_debugOverlayShowResourceStats->addListener([this](CVar* c) { m_resourceStats = c->toBoolean(); }); m_cvarCommons.m_debugOverlayShowResourceStats->addListener([this](CVar* c) { m_resourceStats = c->toBoolean(); });
m_cvarCommons.m_debugOverlayShowInput->addListener([this](CVar* c) { m_showInput = c->toBoolean(); }); m_cvarCommons.m_debugOverlayShowInput->addListener([this](CVar* c) { m_showInput = c->toBoolean(); });
m_cvarCommons.m_debugToolDrawAiPath->addListener([this](CVar* c) { m_drawAiPath = c->toBoolean(); });
m_cvarCommons.m_debugToolDrawCollisionActors->addListener(
[this](CVar* c) { m_drawCollisionActors = c->toBoolean(); });
m_cvarCommons.m_debugToolDrawPlatformCollision->addListener(
[this](CVar* c) { m_drawPlatformCollision = c->toBoolean(); });
m_cvarCommons.m_debugToolDrawMazePath->addListener([this](CVar* c) { m_drawMazePath = c->toBoolean(); });
m_cvarCommons.m_debugToolDrawLighting->addListener([this](CVar* c) { m_drawLighting = c->toBoolean(); });
m_cvarCommons.m_debugOverlayCorner->addListener([this](CVar* c) { m_debugOverlayCorner = c->toSigned(); });
m_cvarCommons.m_debugInputOverlayCorner->addListener([this](CVar* c) { m_inputOverlayCorner = c->toSigned(); });
m_cvarCommons.m_lastDiscPath->addListener([this](CVar* c) { m_lastDiscPath = c->toLiteral(); });
m_cvarMgr.findCVar("developer")->addListener([this](CVar* c) { m_developer = c->toBoolean(); }); m_cvarMgr.findCVar("developer")->addListener([this](CVar* c) { m_developer = c->toBoolean(); });
m_cvarMgr.findCVar("cheats")->addListener([this](CVar* c) { m_cheats = c->toBoolean(); }); m_cvarMgr.findCVar("cheats")->addListener([this](CVar* c) { m_cheats = c->toBoolean(); });
} }
@ -1808,6 +1838,11 @@ static void ImGuiCVarCheckbox(CVarManager& mgr, std::string_view cvarName, const
modified = ImGui::Checkbox(label, ptr); modified = ImGui::Checkbox(label, ptr);
value = *ptr; value = *ptr;
} }
// Kinda useless for these tbh
// std::string tooltip{cvar->rawHelp()};
// if (!tooltip.empty() && ImGui::IsItemHovered()) {
// ImGui::SetTooltip("%s", tooltip.c_str());
// }
if (modified) { if (modified) {
cvar->unlock(); cvar->unlock();
cvar->fromBoolean(value); cvar->fromBoolean(value);
@ -1845,8 +1880,10 @@ void ImGuiConsole::ShowPreLaunchSettingsWindow() {
} }
if (ImGui::BeginTabItem("Game")) { if (ImGui::BeginTabItem("Game")) {
ImGuiCVarCheckbox(m_cvarMgr, "tweak.game.SplashScreensDisabled", "Skip Splash Screens"); ImGuiCVarCheckbox(m_cvarMgr, "tweak.game.SplashScreensDisabled", "Skip Splash Screens");
ImGuiCVarCheckbox(m_cvarMgr, "developer", "Developer Mode", &m_developer);
ImGuiCVarCheckbox(m_cvarMgr, "cheats", "Enable Cheats", &m_cheats); ImGuiCVarCheckbox(m_cvarMgr, "cheats", "Enable Cheats", &m_cheats);
if (m_cheats) {
ImGuiCVarCheckbox(m_cvarMgr, "developer", "Developer Mode", &m_developer);
}
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if (ImGui::BeginTabItem("Experimental")) { if (ImGui::BeginTabItem("Experimental")) {

View File

@ -91,6 +91,7 @@ private:
std::string m_inspectFilterText; std::string m_inspectFilterText;
std::string m_layersFilterText; std::string m_layersFilterText;
std::string m_cvarFiltersText; std::string m_cvarFiltersText;
std::string m_lastDiscPath = m_cvarCommons.m_lastDiscPath->toLiteral();
// Debug overlays // Debug overlays
bool m_frameCounter = m_cvarCommons.m_debugOverlayShowFrameCounter->toBoolean(); bool m_frameCounter = m_cvarCommons.m_debugOverlayShowFrameCounter->toBoolean();
@ -108,6 +109,11 @@ private:
bool m_randomStats = m_cvarCommons.m_debugOverlayShowRandomStats->toBoolean(); bool m_randomStats = m_cvarCommons.m_debugOverlayShowRandomStats->toBoolean();
bool m_resourceStats = m_cvarCommons.m_debugOverlayShowResourceStats->toBoolean(); bool m_resourceStats = m_cvarCommons.m_debugOverlayShowResourceStats->toBoolean();
bool m_showInput = m_cvarCommons.m_debugOverlayShowInput->toBoolean(); bool m_showInput = m_cvarCommons.m_debugOverlayShowInput->toBoolean();
bool m_drawAiPath = m_cvarCommons.m_debugToolDrawAiPath->toBoolean();
bool m_drawCollisionActors = m_cvarCommons.m_debugToolDrawCollisionActors->toBoolean();
bool m_drawPlatformCollision = m_cvarCommons.m_debugToolDrawPlatformCollision->toBoolean();
bool m_drawMazePath = m_cvarCommons.m_debugToolDrawMazePath->toBoolean();
bool m_drawLighting = m_cvarCommons.m_debugToolDrawLighting->toBoolean();
#if TARGET_OS_IOS #if TARGET_OS_IOS
bool m_pipelineInfo = false; bool m_pipelineInfo = false;
#else #else
@ -118,8 +124,8 @@ private:
bool m_isInitialized = false; bool m_isInitialized = false;
bool m_isLaunchInitialized = false; bool m_isLaunchInitialized = false;
int m_debugOverlayCorner = 2; // bottom-left int m_debugOverlayCorner = m_cvarCommons.m_debugOverlayCorner->toSigned();
int m_inputOverlayCorner = 3; // bottom-right int m_inputOverlayCorner = m_cvarCommons.m_debugInputOverlayCorner->toSigned();
const void* m_currentRoom = nullptr; const void* m_currentRoom = nullptr;
double m_lastRoomTime = 0.f; double m_lastRoomTime = 0.f;
double m_currentRoomStart = 0.f; double m_currentRoomStart = 0.f;
@ -144,7 +150,7 @@ private:
void ShowToasts(); void ShowToasts();
void ShowInputViewer(); void ShowInputViewer();
void SetOverlayWindowLocation(int corner) const; void SetOverlayWindowLocation(int corner) const;
void ShowCornerContextMenu(int& corner, int avoidCorner) const; bool ShowCornerContextMenu(int& corner, int avoidCorner) const;
void ShowPlayerTransformEditor(); void ShowPlayerTransformEditor();
void ShowPipelineProgress(); void ShowPipelineProgress();
void ShowPreLaunchSettingsWindow(); void ShowPreLaunchSettingsWindow();