Exit key wont work if debug build and x32dbg or x64dbg is open
This commit is contained in:
parent
95a17599ec
commit
4b18dff656
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#pragma optimize("", off)
|
#pragma optimize("", off)
|
||||||
|
|
||||||
|
static DWORD xdbg;
|
||||||
|
static HWND g_HWND = NULL;
|
||||||
static DWORD ProcessID;
|
static DWORD ProcessID;
|
||||||
static bool DisableGhosting;
|
static bool DisableGhosting;
|
||||||
static bool EnableSuspend;
|
static bool EnableSuspend;
|
||||||
@ -155,13 +157,22 @@ static std::string getFileName(std::string path)
|
|||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL CALLBACK EnumWindowsProcMy(HWND hwnd, LPARAM lParam)
|
||||||
|
{
|
||||||
|
DWORD lpdwProcessId;
|
||||||
|
GetWindowThreadProcessId(hwnd, &lpdwProcessId);
|
||||||
|
if (lpdwProcessId == lParam)
|
||||||
|
{
|
||||||
|
g_HWND = hwnd;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
DWORD WINAPI GlobalGameThread(__in LPVOID lpParameter)
|
DWORD WINAPI GlobalGameThread(__in LPVOID lpParameter)
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (GetAsyncKeyState(ExitKeyValue))
|
|
||||||
QuitGame();
|
|
||||||
|
|
||||||
if (!SuspendInit)
|
if (!SuspendInit)
|
||||||
{
|
{
|
||||||
SuspendInit = true;
|
SuspendInit = true;
|
||||||
@ -174,6 +185,22 @@ DWORD WINAPI GlobalGameThread(__in LPVOID lpParameter)
|
|||||||
ProcessID = MyGetProcessId(tchar);
|
ProcessID = MyGetProcessId(tchar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GetAsyncKeyState(ExitKeyValue))
|
||||||
|
{
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#if _M_IX86
|
||||||
|
xdbg = MyGetProcessId(L"x32dbg.exe");
|
||||||
|
#else
|
||||||
|
xdbg = MyGetProcessId(L"x64dbg.exe");
|
||||||
|
#endif
|
||||||
|
EnumWindows(EnumWindowsProcMy, xdbg);
|
||||||
|
#endif
|
||||||
|
if (g_HWND == NULL)
|
||||||
|
QuitGame();
|
||||||
|
else
|
||||||
|
g_HWND = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetAsyncKeyState(PauseKeyValue))
|
if (GetAsyncKeyState(PauseKeyValue))
|
||||||
{
|
{
|
||||||
if (!SuspendPressedOn)
|
if (!SuspendPressedOn)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user