From e375cde4583769715a7d0db8614a3ea95f7608fb Mon Sep 17 00:00:00 2001 From: shygoo Date: Tue, 18 Feb 2020 14:04:18 -0600 Subject: [PATCH] [Debugger] Add warning for recompiler --- .../Debugger/Debugger-Commands.cpp | 34 +++++++++++++++++++ .../Debugger/Debugger-Commands.h | 3 ++ 2 files changed, 37 insertions(+) diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp index fac75ff4e..3983aaa21 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp @@ -58,10 +58,13 @@ CDebugCommandsView::CDebugCommandsView(CDebuggerUI * debugger, SyncEvent &StepEv m_bEditing = false; m_CommandListRows = 39; m_RowHeight = 13; + + g_Settings->RegisterChangeCB(GameRunning_CPU_Running, this, (CSettings::SettingChangedFunc)GameCpuRunningChanged); } CDebugCommandsView::~CDebugCommandsView() { + g_Settings->UnregisterChangeCB(GameRunning_CPU_Running, this, (CSettings::SettingChangedFunc)GameCpuRunningChanged); } LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) @@ -143,9 +146,40 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA RedrawCommandsAndRegisters(); WindowCreated(); m_Attached = true; + + RecompilerCheck(); + return TRUE; } +void CDebugCommandsView::GameCpuRunningChanged(CDebugCommandsView* _this) +{ + _this->RecompilerCheck(); +} + +void CDebugCommandsView::RecompilerCheck(void) +{ + if (!g_Settings->LoadBool(GameRunning_CPU_Running)) + { + return; + } + + if (!_this->IsWindow()) + { + return; + } + + if (g_Settings->LoadBool(Debugger_Enabled) && + !g_Settings->LoadBool(Setting_ForceInterpreterCPU) && + (CPU_TYPE)g_Settings->LoadDword(Game_CpuType) != CPU_Interpreter) + { + MessageBox("Debugger support for the recompiler core is experimental.\n\n" + "For optimal experience, enable \"Always use interpreter core\" " + "in advanced settings and restart the emulator.", + "Warning", MB_ICONWARNING | MB_OK); + } +} + void CDebugCommandsView::OnExitSizeMove(void) { SaveWindowPos(true); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Commands.h b/Source/Project64/UserInterface/Debugger/Debugger-Commands.h index f52357bcc..473ecc581 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Commands.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-Commands.h @@ -166,6 +166,9 @@ private: static void StaticSteppingOpsChanged(CDebugCommandsView * __this) { __this->SteppingOpsChanged(); } static void StaticWaitingForStepChanged(CDebugCommandsView * __this) { __this->WaitingForStepChanged(); } + static void GameCpuRunningChanged(CDebugCommandsView* _this); + + void RecompilerCheck(void); LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);