X2CommunityCore / xcom2-launcher

The Alternative Mod Launcher (AML) is a replacement for the default game launchers from XCOM 2 and XCOM Chimera Squad.
GNU General Public License v3.0
348 stars 51 forks source link

Add automated way/option to replace vanilla launcher #89

Open Xymanek opened 5 years ago

Xymanek commented 5 years ago

18 and #42 can be easily fixed, with the small caveat that the application must be launched from steam (which seems like a perquisite for steam to do its controller trickery). 3 things are required for that to work:

1) Copy the binaries over to Steam\steamapps\common\XCOM 2\Binaries\Win64\Launcher 2) Rename the exe to match the vanilla one (ModLauncherWPF.exe) image 3) Move the settings.json to C:\Steam\steamapps\common\XCOM 2 (since that's the working directory that steam uses)

Then when launching the "game" from steam, AML will be used with same configs as before. Furthermore, when launching the actual game from AML, the controller stuff will properly work (tested by me and Mr. Nice for many a month)

RevZero commented 5 years ago

This would be cool. Detecting/checking the folder and copying the files shouldn't be a problem, but there is obviously a bit more involved.

How this could be implemented:

  1. If AML is started from the XCOM launcher folder and is named ModLauncherWPF.exe, there is nothing to do.
  2. If AML is started from another folder (extracted somewhere from ZIP), it checks if AML also exists in the XCOM launcher folder
    1. Does not exist: Ask the user if he wants to replace the original launcher (never ask again option/setting). If user chooses yes, copy files (backup original launcher) and show result/info. Maybe close AML and re-start through steam.
    2. Exists and is same version: Inform the user, that he should start the launcher using Steam (potentially automatically do it?)
    3. Exists and is older version: Give user the option to copy the new version to the steam folder. If user chooses yes, copy files and show result/info. Maybe close AML and re-start through steam.

Did I forget something? Suggestions?

Other considerations:

Alternative: An alternative to all that would be to provide a customized installer. The installer could then provide choices to

This would probably be a much better experience for "normal" users. But that is out of my expertise, I don't have experience creating installers apart from the (pretty limited) visual studio installer project.

Dragon-32 commented 5 years ago

Does not exist: Ask the user if he wants to replace the original launcher (never ask again option/setting). If user chooses yes, copy files (backup original launcher) and show result/info. Maybe close AML and re-start through steam.

This is malware behaviour (replace legitimate executable with another) and is likely to be flagged as such by user's AV heuristics.

Maybe some notification?

RevZero commented 5 years ago

Its probably a valid point, but I am really not sure if that will be a problem. I suppose that would be something to assess during beta-testing. I expect the launcher to require admin privileges to have the required write permissions. What do yo mean with "Maybe some notification?"?

Dragon-32 commented 5 years ago

What do yo mean with "Maybe some notification?"?

Mention somewhere that AML is doing this. Otherwise I'd expect a deluge of "Is this a virus?" posts here, on Steam, on Reddit... I'm sure there will be anyway, but at least mentioning it somewhere beyond the change log means some people would read it.

RevZero commented 5 years ago

What do yo mean with "Maybe some notification?"?

Mention somewhere that AML is doing this. Otherwise I'd expect a deluge of "Is this a virus?" posts here, on Steam, on Reddit... I'm sure there will be anyway, but at least mentioning it somewhere beyond the change log means some people would read it.

Of course we should notify the user, but I already suggested to do that. You even quoted me on that part:

Ask the user if he wants to replace the original launcher (never ask again option/setting). If user chooses yes, copy files (backup original launcher) and show result/info.

Xymanek commented 4 years ago

Following the 21/05/2021 launcher update for xcom 2, this method still works, albeit done slightly differently:

Smitty2k1 commented 3 years ago

Following the 21/05/2021 launcher update for xcom 2, this method still works, albeit done slightly differently:

  • The directory for binaries is now Steam\steamapps\common\XCOM 2\Launcher
  • The exe name is now launcher.exe (+ .pdb + .exe.config)
  • The settings.json location is now in the same folder as the exe (previously it was in the game root)

Thanks for your help but I just tried this and it doesn't work, it still uses the 2k launcher. I think the 2k launcher was just updated again today 26/05/2021 and possibly now launches in the "2kLauncher" folder from "Launcher.json" so I'm not sure how to use this same logic to bypass it.