diff --git a/pcsx2/RDebug/deci2.h b/pcsx2/RDebug/deci2.h index 43fc5b46b4..dfcef220bd 100644 --- a/pcsx2/RDebug/deci2.h +++ b/pcsx2/RDebug/deci2.h @@ -52,7 +52,6 @@ struct DECI2_DBGP_BRK{ extern DECI2_DBGP_BRK ebrk[32], ibrk[32]; extern s32 ebrk_count, ibrk_count; -extern volatile long runStatus; extern s32 runCode, runCount; extern Threading::Semaphore* runEvent; diff --git a/pcsx2/RDebug/deci2_dbgp.cpp b/pcsx2/RDebug/deci2_dbgp.cpp index 22690a3253..85e7ed744a 100644 --- a/pcsx2/RDebug/deci2_dbgp.cpp +++ b/pcsx2/RDebug/deci2_dbgp.cpp @@ -24,6 +24,8 @@ using namespace Threading; using namespace R5900; +std::atomic runStatus; + struct DECI2_DBGP_HEADER{ DECI2_HEADER h; //+00 u16 id; //+08 @@ -358,7 +360,7 @@ void D2_DBGP(const u8 *inbuffer, u8 *outbuffer, char *message, char *eepc, char if (in->h.destination=='I') ; else{ - out->result = ( pcsx2_InterlockedExchange(&runStatus, STOP)==STOP ? + out->result = ( runStatus.exchange(STOP)==STOP ? 0x20 : 0x21 ); out->code=0xFF; Sleep(50); @@ -371,7 +373,7 @@ void D2_DBGP(const u8 *inbuffer, u8 *outbuffer, char *message, char *eepc, char if (in->h.destination=='I') ; else{ - pcsx2_InterlockedExchange(&runStatus, STOP); + runStatus = STOP; Sleep(100);//first get the run thread to Wait state runCount=in->count; runCode=in->code; @@ -390,7 +392,7 @@ void D2_DBGP(const u8 *inbuffer, u8 *outbuffer, char *message, char *eepc, char for (i=0, s=0; i<(int)run->argc; i++, argv++) s+=argv[i]; memcpy(PSM(0), argv, s); // threads_array[0].argstring = 0; - pcsx2_InterlockedExchange((volatile long*)&runStatus, (u32)STOP); + runStatus = STOP; Sleep(1000);//first get the run thread to Wait state runCount=0; runCode=0xFF;