Fix mutex and dedi guid

This commit is contained in:
momo5502 2015-12-27 20:16:01 +01:00
parent 55c9ddb63b
commit 9adca57b1a
2 changed files with 5 additions and 5 deletions

View File

@ -13,7 +13,7 @@ namespace Components
{ {
if (Dedicated::IsDedicated()) return; if (Dedicated::IsDedicated()) return;
Singleton::FirstInstance = !(CreateMutex(NULL, FALSE, "iw4x_mutex") && GetLastError() == ERROR_ALREADY_EXISTS); Singleton::FirstInstance = (CreateMutex(NULL, FALSE, "iw4x_mutex") && GetLastError() != ERROR_ALREADY_EXISTS);
if (!Singleton::FirstInstance && MessageBoxA(0, "Do you want to start a second instance?", "Game already running", MB_ICONEXCLAMATION | MB_YESNO) == IDNO) if (!Singleton::FirstInstance && MessageBoxA(0, "Do you want to start a second instance?", "Game already running", MB_ICONEXCLAMATION | MB_YESNO) == IDNO)
{ {

View File

@ -20,11 +20,11 @@ namespace Steam
if (!subId) if (!subId)
{ {
if (Components::Dedicated::IsDedicated()) if (Components::Dedicated::IsDedicated()) // Dedi guid
{ {
subId = 0xDED1CADE; subId = -0xDED1CADE;
} }
else if (Components::Singleton::IsFirstInstance()) else if (Components::Singleton::IsFirstInstance()) // Hardware guid
{ {
DATA_BLOB Data[2]; DATA_BLOB Data[2];
Data[0].pbData = (BYTE *)"AAAAAAAAAA"; Data[0].pbData = (BYTE *)"AAAAAAAAAA";
@ -34,7 +34,7 @@ namespace Steam
subId = ::Utils::OneAtATime((char*)Data[1].pbData, 52); subId = ::Utils::OneAtATime((char*)Data[1].pbData, 52);
} }
else else // Random guid
{ {
subId = (Game::Com_Milliseconds() + timeGetTime()); subId = (Game::Com_Milliseconds() + timeGetTime());
} }