diff --git a/Core/Debugger.cpp b/Core/Debugger.cpp index 47fc5284..0852d853 100644 --- a/Core/Debugger.cpp +++ b/Core/Debugger.cpp @@ -746,8 +746,9 @@ const char* Debugger::GetCode(uint32_t &length) { string previousCode = _disassemblerOutput; GenerateCodeOutput(); + bool forceRefresh = length == UINT32_MAX; length = (uint32_t)_disassemblerOutput.size(); - if(previousCode.compare(_disassemblerOutput) == 0) { + if(!forceRefresh && previousCode.compare(_disassemblerOutput) == 0) { //Return null pointer if the code is identical to last call //This avois the UTF8->UTF16 conversion that the UI needs to do //before comparing the strings diff --git a/GUI.NET/Debugger/frmDebugger.cs b/GUI.NET/Debugger/frmDebugger.cs index b6e67bfc..82ce62e6 100644 --- a/GUI.NET/Debugger/frmDebugger.cs +++ b/GUI.NET/Debugger/frmDebugger.cs @@ -322,7 +322,7 @@ namespace Mesen.GUI.Debugger UpdateDebuggerFlags(); UpdateVectorAddresses(); - string newCode = InteropEmu.DebugGetCode(); + string newCode = InteropEmu.DebugGetCode(_firstBreak); if(newCode != null) { ctrlDebuggerCode.Code = newCode; } diff --git a/GUI.NET/InteropEmu.cs b/GUI.NET/InteropEmu.cs index 89a3acc8..d6792d84 100644 --- a/GUI.NET/InteropEmu.cs +++ b/GUI.NET/InteropEmu.cs @@ -300,11 +300,11 @@ namespace Mesen.GUI } } - [DllImport(DLLPath, EntryPoint = "DebugGetCode")] private static extern IntPtr DebugGetCodeWrapper(out UInt32 length); - public static string DebugGetCode() + [DllImport(DLLPath, EntryPoint = "DebugGetCode")] private static extern IntPtr DebugGetCodeWrapper(ref UInt32 length); + public static string DebugGetCode(bool forceRefresh) { - UInt32 length; - IntPtr ptrCodeString = InteropEmu.DebugGetCodeWrapper(out length); + UInt32 length = forceRefresh ? UInt32.MaxValue : 0; + IntPtr ptrCodeString = InteropEmu.DebugGetCodeWrapper(ref length); if(ptrCodeString == IntPtr.Zero) { return null; } else {