diff --git a/src/Common/CxbxDebugger.cpp b/src/Common/CxbxDebugger.cpp index 32eda7c01..978ad46fd 100644 --- a/src/Common/CxbxDebugger.cpp +++ b/src/Common/CxbxDebugger.cpp @@ -55,9 +55,10 @@ namespace CxbxDebugger bool IsAttached() { - // TODO: Avoid clashing with VS when child process debugging is enabled for all processes - // TODO: Check the PID of the debugger? Ensure the PID is linked to CxbxDebugger.exe? - return IsDebuggerPresent() == TRUE; + bool IsDebugging; + g_EmuShared->GetDebuggingFlag(&IsDebugging); + + return IsDebugging && IsDebuggerPresent() == TRUE; } class ReportHelper @@ -124,8 +125,11 @@ namespace CxbxDebugger { switch (ExceptionCode) { - case Internal::FILE_OPENED: + case Internal::HLECACHE_FILE: case Internal::KERNEL_PATCH: + case Internal::FILE_OPENED: + case Internal::FILE_READ: + case Internal::FILE_CLOSED: return true; } diff --git a/src/Common/Win32/EmuShared.cpp b/src/Common/Win32/EmuShared.cpp index 56f33c474..a9692ef8d 100644 --- a/src/Common/Win32/EmuShared.cpp +++ b/src/Common/Win32/EmuShared.cpp @@ -138,6 +138,7 @@ EmuShared::EmuShared() { Load(); m_bMultiXbe = false; + m_bDebugging = false; m_LaunchDataPAddress = NULL; } diff --git a/src/Cxbx/WndMain.cpp b/src/Cxbx/WndMain.cpp index 9835f5a89..e40fc7cc3 100644 --- a/src/Cxbx/WndMain.cpp +++ b/src/Cxbx/WndMain.cpp @@ -1933,6 +1933,8 @@ void WndMain::StartEmulation(HWND hwndParent, bool WithLocalDebugger /*= false*/ char szArgsBuffer[4096]; snprintf(szArgsBuffer, 4096, "/load \"%s\" %d %d \"%s\"", m_XbeFilename, (int)hwndParent, (int)m_KrnlDebug, m_KrnlDebugFilename); + g_EmuShared->SetDebuggingFlag(&WithLocalDebugger); + if (WithLocalDebugger) { // TODO: Set a configuration variable for this. For now it will be within the same folder as Cxbx.exe diff --git a/src/CxbxKrnl/EmuShared.h b/src/CxbxKrnl/EmuShared.h index 2bc5a34d9..76e19eaf8 100644 --- a/src/CxbxKrnl/EmuShared.h +++ b/src/CxbxKrnl/EmuShared.h @@ -124,6 +124,12 @@ class EmuShared : public Mutex void GetMultiXbeFlag(bool *value) { Lock(); *value = m_bMultiXbe; Unlock(); } void SetMultiXbeFlag(bool *value) { Lock(); m_bMultiXbe = *value; Unlock(); } + // ****************************************************************** + // * Debugging flag Accessors + // ****************************************************************** + void GetDebuggingFlag(bool *value) { Lock(); *value = m_bDebugging; Unlock(); } + void SetDebuggingFlag(bool *value) { Lock(); m_bDebugging = *value; Unlock(); } + // ****************************************************************** // * Launch data physical address Accessors // ****************************************************************** @@ -150,6 +156,7 @@ class EmuShared : public Mutex float m_MSpF; float m_FPS; bool m_bMultiXbe; + bool m_bDebugging; PAddr m_LaunchDataPAddress; };