1
0
mirror of synced 2024-11-14 23:07:36 +01:00

Move code to global init

This commit is contained in:
Aaron M 2021-09-21 13:28:08 +12:00
parent 4b18dff656
commit 8ad8f368e5

View File

@ -20,7 +20,6 @@ static bool DisableGhosting;
static bool EnableSuspend;
static bool PausePressed;
static bool ResumeSuspend;
static bool SuspendInit;
static bool SuspendPressedOn;
static char SuspendBuf[MAX_PATH];
static char PauseKeyChar[256];
@ -173,18 +172,6 @@ DWORD WINAPI GlobalGameThread(__in LPVOID lpParameter)
{
while (true)
{
if (!SuspendInit)
{
SuspendInit = true;
GetModuleFileNameA(NULL, SuspendBuf, MAX_PATH);
std::string ExeName = getFileName(SuspendBuf);
std::basic_string<TCHAR> converted(ExeName.begin(), ExeName.end());
const TCHAR* tchar = converted.c_str();
ProcessID = MyGetProcessId(tchar);
}
if (GetAsyncKeyState(ExitKeyValue))
{
#ifdef _DEBUG
@ -494,6 +481,15 @@ static InitFunction globalFunc([]()
if (ExitKeyStr.find('0x') != std::string::npos)
ExitKeyValue = stoi(ExitKeyStr, 0, 16);
SuspendInit = true;
GetModuleFileNameA(NULL, SuspendBuf, MAX_PATH);
std::string ExeName = getFileName(SuspendBuf);
std::basic_string<TCHAR> converted(ExeName.begin(), ExeName.end());
const TCHAR* tchar = converted.c_str();
ProcessID = MyGetProcessId(tchar);
CreateThread(NULL, 0, GlobalGameThread, NULL, 0, NULL);
if (ToBool(config["General"]["Enable Outputs"]))