Debugger: Fixed issue that sometimes caused an empty code window when opening debugger after opening other debugger tools

This commit is contained in:
Sour 2017-12-26 16:11:28 -05:00
parent 589ad612d1
commit c0cfea6d6e
3 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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 {