From 9056fea501309aec1b2a5a8f273c6d68a4386642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 10 Nov 2024 19:00:13 +0100 Subject: [PATCH] Disable the ImGui debugger if RetroAchievements hardcore mode is enabled. --- Core/RetroAchievements.h | 3 +++ UI/ImDebugger/ImDebugger.cpp | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/Core/RetroAchievements.h b/Core/RetroAchievements.h index 3646b53236..2a09036828 100644 --- a/Core/RetroAchievements.h +++ b/Core/RetroAchievements.h @@ -54,6 +54,9 @@ bool IsBlockingExecution(); // // * Savestates // * Slowdown time (though hard to fully prevent, could use crazy post shaders or software rendering...) +// * Debugging +// * Cheats +// * and similar... bool HardcoreModeActive(); // Same as ChallengeModeActive but comes with a convenient user message. Don't use for every-frame checks or UI enablement, diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index c0d1be38e0..b9a3273499 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -2,6 +2,7 @@ #include "ext/imgui/imgui_internal.h" #include "Common/StringUtils.h" +#include "Core/RetroAchievements.h" #include "Core/Core.h" #include "Core/Debugger/DebugInterface.h" #include "Core/Debugger/DisassemblyManager.h" @@ -236,6 +237,14 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug) { // Snapshot the coreState to avoid inconsistency. const CoreState coreState = ::coreState; + if (Achievements::HardcoreModeActive()) { + ImGui::Begin("RetroAchievements hardcore mode"); + ImGui::Text("The debugger may not be used when the\nRetroAchievements hardcore mode is enabled."); + ImGui::Text("To use the debugger, go into Settings / Tools / RetroAchievements and disable them."); + ImGui::End(); + return; + } + if (ImGui::BeginMainMenuBar()) { if (ImGui::BeginMenu("Debug")) { if (coreState == CoreState::CORE_STEPPING) {