[Proxy] Correctly reset steam's active user if it crashed
This commit is contained in:
parent
a88afc078f
commit
fb328e0b38
@ -365,11 +365,10 @@ namespace Steam
|
|||||||
|
|
||||||
Components::Toast::ShowNative(templ);
|
Components::Toast::ShowNative(templ);
|
||||||
|
|
||||||
uint32_t user = Proxy::GetActiveUser();
|
// If steam has crashed, the user is not null, so we reset it to be able to check if steam started
|
||||||
ShellExecuteA(nullptr, nullptr, steamExe.data(), "-silent", nullptr, 1);
|
if (Proxy::GetActiveUser()) Proxy::ResetActiveUser();
|
||||||
|
|
||||||
// If steam has crashed, the user is not null, therefore we can't check if login is done, so we wait 3 seconds so steam can reset it
|
ShellExecuteA(nullptr, nullptr, steamExe.data(), "-silent", nullptr, 1);
|
||||||
if (user) std::this_thread::sleep_for(3ms);
|
|
||||||
|
|
||||||
::Utils::Time::Interval interval;
|
::Utils::Time::Interval interval;
|
||||||
while (!interval.elapsed(15s) && !Proxy::GetActiveUser()) std::this_thread::sleep_for(10ms);
|
while (!interval.elapsed(15s) && !Proxy::GetActiveUser()) std::this_thread::sleep_for(10ms);
|
||||||
@ -487,6 +486,18 @@ namespace Steam
|
|||||||
return activeUser;
|
return activeUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Proxy::ResetActiveUser()
|
||||||
|
{
|
||||||
|
HKEY hRegKey;
|
||||||
|
uint32_t activeUser = 0;
|
||||||
|
|
||||||
|
if (RegOpenKeyExA(HKEY_CURRENT_USER, STEAM_REGISTRY_PROCESS_PATH, 0, KEY_ALL_ACCESS, &hRegKey) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
RegSetValueExA(hRegKey, "ActiveUser", 0, REG_DWORD, reinterpret_cast<BYTE*>(&activeUser), sizeof(activeUser));
|
||||||
|
RegCloseKey(hRegKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Proxy::SetOverlayNotificationPosition(uint32_t eNotificationPosition)
|
void Proxy::SetOverlayNotificationPosition(uint32_t eNotificationPosition)
|
||||||
{
|
{
|
||||||
if (Proxy::Overlay.valid())
|
if (Proxy::Overlay.valid())
|
||||||
|
@ -318,6 +318,7 @@ namespace Steam
|
|||||||
static void UnregisterCalls();
|
static void UnregisterCalls();
|
||||||
static void StartSteamIfNecessary();
|
static void StartSteamIfNecessary();
|
||||||
|
|
||||||
|
static void ResetActiveUser();
|
||||||
static uint32_t GetActiveUser();
|
static uint32_t GetActiveUser();
|
||||||
static std::string GetSteamDirectory();
|
static std::string GetSteamDirectory();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user