//This ensures that we stay in game binding, even if focused application changes! (Why does this work? Well, i dunno... ask Valve...)
//Only works with a console window
//Causes trouble as soon as there is more than the consoleWindow and the overlayWindow
//This is trying to avoid hooking Steam.exe
//----
//alternatively / additionaly, we can just hook steam and make our lives so much easier
//we inject and hook here to spare IPC and let the dll grab the steam appID of the launched process when the config switches (config switches w/ focus)
//we inject and hook here to spare IPC and let the dll grab the steam appID of the launched process when the config switches (config switches w/ focus)
if(focusSwitchNeeded)
if(hasJustLaunched)
{
{
if(bHookSteam)
if(bHookSteam)
hookBindings();//cleanup - unhooking / unloading of dll is managed by the GloSC gamelauncher rather than here
hookBindings();//cleanup - unhooking / unloading of dll is managed by the GloSC gamelauncher rather than here
hasJustLaunched=false;
focusSwitchNeeded=false;
if(!bUseDesktopConfig)
{
SetFocus(consoleHwnd);
sf::Clockclock;
while(!SetForegroundWindow(consoleHwnd)&&clock.getElapsedTime().asMilliseconds()<1000)//try to forcefully set foreground window
{
Sleep(1);
}
}
}
}
//Dirty hack to make the steamoverlay work properly and still keep Apps Controllerconfig when closing overlay.
//even if hooking steam, this ensures the overlay stays working