BrianLima / UWPHook

🔗 Add your Windows Store or UWP games to Steam
https://brianlima.github.io/UWPHook/
MIT License
1.5k stars 116 forks source link

MSFS 2020 Infinite loop #93

Closed stevealexandre closed 1 year ago

stevealexandre commented 1 year ago

Hello dude,

Unfortunately, the game created on steam does not working with MSFS2020. When I create the game via UWPHook, he try to start the exe "gamelaunchhelper.exe" from the MSFS content directory where the exe of MSFS is. My steam is displayed at "playing on Microsoft Flight Simulator" but the game is not starting. When look into the process manager, I can see the gamelaunchhelper process is created every second with a new PID and the only way to stop and being not show playing anymore on steam it is to close the windows/restart the computer.

See below more details on images :

Any fix would be really great to let my friends now I'm playing on it while they are playing on their side via the steam game version.

Thank you for your time.

novemberdobby commented 1 year ago

I've noticed this too on games that used to work (e.g. FAR: Changing Tides). May be the same root cause as #92.

You can break the loop by running: taskkill /F /IM gamelaunchhelper.exe

Running UWPHook from Visual Studio works, but not from Steam. I tried a workaround where UWPHook runs GameLaunchHelper.exe directly, or the app exe itself, but neither would actually open the game. 🤔

stevealexandre commented 1 year ago

I have found the way to stop the loop process by launching the game as usual via his own icon. I've seen #92 and tried with admin permissions etc... but nothing was working. As I understand, not all games are launched via gamelaunchhelper and it's a pain. Maybe it's a "protection" from microsoft to deny apps like uwphook.

novemberdobby commented 1 year ago

We could get around this in UWPHook by launching: explorer shell:appsFolder\CoffeeStainStudios.DeepRockGalactic_496a1srhmar9w!AppDeepRockGalacticShipping

This breaks the tracking, which could maybe be fixed by checking for the existence of FSD-WinGDK-Shipping.exe (for the example above) in the process list.

stevealexandre commented 1 year ago

I'm currently working on a fix. Being able to start MFS 2020 and have my playing status with the game launched successfully. I'm doing some crosschecking of my fix because instead of checking parent/children pid, I'm looking at the executable name by getting it from parsing the argument.

Microsoft.FlightSimulator_8wekyb3d8bbwe!App => Parse to have "FlightSimulator" => look for "FlightSimulator.exe" in process list => yes => return running true so display as running on steam.

I have parse the argument with substring to truncate the left of "." and right of "_" BUT because it will not be fun anyway, for example forza have not the same string base 😒 (Microsoft.624F8B84B80_8wekyb3d8bbwe!Forzahorizon5) so parsing will not give the correct value and will not being able to detect the process (got 624F8B84B80.exe). For Myst game for example it could be work with the same logic of MFS because the aumid is "CyanWorldsInc.Myst_9msjs5e8t6mxt!AppMystShipping" so the substring work too. I'm looking for a better implementation which will work with every process but guys, we are closed to a fix. ✌

Will do a PR when ready and I suggest of course at mid time to refactor my code and doing something better at the end because I'm not a dev, just an integrator in my job so it's look more like a hack. 😅

novemberdobby commented 1 year ago

GetAUMIDScript.ps1 could be modified to provide the install path ($app.InstallLocation)

Then install_path\MicrosoftGame.config contains the correct exe name (at xpath /Game/ExecutableList/Executable/@Name)

This works for Far: Changing Tides (FarChangingTides.exe) and Deep Rock Galactic (FSD\Binaries\WinGDK\FSD-WinGDK-Shipping.exe), is it the same for Forza?

stevealexandre commented 1 year ago

GetAUMIDScript.ps1 could be modified to provide the install path ($app.InstallLocation)

Then install_path\MicrosoftGame.config contains the correct exe name (at xpath /Game/ExecutableList/Executable/@Name)

This works for Far: Changing Tides (FarChangingTides.exe) and Deep Rock Galactic (FSD\Binaries\WinGDK\FSD-WinGDK-Shipping.exe), is it the same for Forza?

Thanks for the tips. Could be the trick. I'm working on it to do the PR asap if possible tonight. Working for Forza5 but found a game which have a different way again to start => Halo Master Chief Collection. It start mcclauncher.exe with the argument "MCC\Binaries\Win64\MCCWinStore-Win64-Shipping.exe" which will be the end exe to be running. Will have to parse it too and imho, there is few games which will need some exception to catch them running.

stevealexandre commented 1 year ago

Logic is implemented. Doing some cross testing with differents games to confirm most of game are detected.

stevealexandre commented 1 year ago

Results of the cross tests :

Should be able to have the final fix for tomorrow to handle MCC launcher like usecases. 🤞

Update :

stevealexandre commented 1 year ago

PR is created since the fix is now working on all game above listed so should be work on every games. Waiting now the merge and the final build of the release to let you enjoy running game through steam and being displayed as playing ✌

BrianLima commented 1 year ago

Great, thanks for the contribution, i'll be reviewing it tomorrow, ok?

stevealexandre commented 1 year ago

No problem :). I hope it will be ok and if you need more improvement on other thing, let me know. It was fun to debug and start finally working on repos of others :)

stevealexandre commented 1 year ago

Closing the issue following the PR merged.