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
354 stars 52 forks source link

Linux Support #171

Open APasz opened 4 years ago

APasz commented 4 years ago

It'd be nice. For the same reasons that it's nice on Windows. Specifically Ubuntu as it's the officially supported distro.

RevZero commented 4 years ago

Related to https://github.com/Gribbleshnibit8/xcom2-launcher/issues/6

As I am not familiar with Mono (and do not personally use Linux), that is not something I am likely to look into.

Xymanek commented 4 years ago

Mono runs also on windows, that could be the first step to implementing the compatibility

WaldoTheRanger commented 4 years ago

welp. has anyone had success using it with wine? Also, if you could get it running with wine, would/could the game itself still run as a linux app?

mirh commented 4 years ago

You just have to install winetricks -q dotnet472 for the launcher to work. The problem is that for some reason, it takes like 5 minutes in wine for the game window to get past the initial black screen.

WaldoTheRanger commented 4 years ago

You just have to install winetricks -q dotnet472 for the launcher to work. The problem is that for some reason, it takes like 5 minutes in wine for the game window to get past the initial black screen.

So, once the launcher opens, does xcom itself run as a native app?

mirh commented 4 years ago

Of course not, this is about using it in wine.

WaldoTheRanger commented 4 years ago

@mirh How do I get it to recognize my steam and xcom installations?

mirh commented 4 years ago

You run the thing inside the same wine prefix that will run the game, as I said.

amishtal commented 3 years ago

I've managed to get it working somehow. I honestly couldn't repeat all the steps, but I can give a rough outline in case it helps someone else.

  1. I have XCOM 2, its DLC, and WotC installed through Steam, but I have it forced to run through Proton 5.0-10 instead of natively.
  2. I downloaded the latest release of AML, which was v.1.4.1.
  3. I used protontricks to install dotnet472. This was a frustrating step for some reason. The installations kept failing for me and it would start cycling through trying to install several different versions of .NET instead. I have no clue what I eventually changed, but running the same command that I had tried several times before (protontricks 268500 dotnet472) suddenly worked.
  4. I had tried running AML using the appropriate prefix and Wine executable several times while fiddling around with installing .NET 4.7.2, but it kept crashing. Even after getting it installed it still crashed, though it did give a different error which I took to mean I had made some progress. I tried running the same command from a fresh terminal and it worked! The command for me looked like:

    WINEPREFIX=/home/SteamLibrary/steamapps/compatdata/268500/pfx /home/SteamLibrary/steamapps/common/Proton\ 5.0/dist/bin/wine64 XCOM2\ Launcher.exe

    This was run in the directory where I had extracted AML, and you'll obviously need to adapt the paths based on where your Steam library lives.

It seems to be working for me now. Your results may vary.

Edit: Spoke too soon... the game crashes when loading the first mission. I guess it still needs some work.

mirh commented 3 years ago

It's because .net installation is broken https://github.com/Linux74656/SpaceEngineersLinuxPatches#issue-11 https://bugs.winehq.org/show_bug.cgi?id=49897

shaygover commented 3 years ago

Tried today. Even when setting proton to 5.0 or 4, dot net 4.7.2 install fails.

mirh commented 3 years ago

Putting aside it's a complete mess with reproducibility, you have to use protontricks there

shaygover commented 3 years ago

@mirh I know. I used it.

mirh commented 3 years ago

Then try with vanilla wine.

WaldoTheRanger commented 2 years ago

I just discovered this guide: https://www.reddit.com/r/xcom2mods/comments/rhjeby/you_can_run_aml_on_linux_proton_howto_included/

Has worked flawlessly for me and several others so far considering how simple it is, and that currently xcom 2 linux native is borked anyways, I'm going to say this is the best solution

Lightsockie commented 1 year ago

So none of the above discussion is really on topic -- which is for AML to have Linux support. Helpful if someone wants to run XCOM2 via Proton (aka non-linux-native), and worth having here cuz it's where someone will ultimately end up on this search.


But for staying on the topic at hand: I think I've made some progress on the linux-native XCOM2 install front! (With HUGE help from robojumper in disc).

https://steamworks.github.io/installation/

When you build your application the following files must be copied into the output dir:

    All Platforms:
        steam_appid.txt - Required for testing your application outside of steam. Do not ship this to customers!
        Steamworks.NET.dll - Make sure it’s the correct version for the platform that you plan on shipping for! - When building for OSX or Linux the wrong Steamworks.NET.dll will be copied over by default, it is recommended that you create a post build script to copy the correct version.
    Windows:
        steam_api.dll
    Linux:
        libsteam_api.so

So from the newest release of Steamworks.NET, taking the Steamworks.NET.dll out of Steamworks.NET-Standalone_20.1.0/OSX-Linux-x64 and replacing the Steamworks.NET.dll in the AML directory, and then running this via "Add non-Steam game" in steam and Proton Experimental, I get the thing to open up! Oh, and you probably need to rename steam_api64.dll to steam_api.dll in the AML dir. (Come to think of it, wonder if the DLL replacement was really necessary. -- it wasn't)

Just run the dang thing in proton as-is and it'll work lol (this screenshot is from when I had the linux Steamworks swapped in, without it the UI fills in correctly with file sizes, paths, etcetc)

Without running via Steam (and thus having all the Steam-context stuff be automagically handled) you get this error, with or without the Steamworks.NET.dll replacement:

Now, right now AML crashes shortly after it finally gets open. My log is filled with errors like this. Which is prolly a local issue I'll try to trace down.

2023-01-10 15:20:45,348 [1] WARN  ModList:0    - Workshop request for WorkshopId=0 failed with result 'k_EResultFil
eNotFound'

I'm guessing there's going to be pathing issues, too. Since the linux install does a lot in .local/share/feral-interactive/XCOM\ 2\ WotC/VFS, but that's next steps to figure out as well (might all be symlink'd neat and tidy already).


Edit, okay so actually just using AML as-is with Steam's Proton Experimental (and like other vers) added as a "Non-Steam Game" kinda just works outta the box. Above is useful as steps towards a linux-native AML, maybe, but with as it is now AML already "works" besides with launching the game. Only thing remaining to do is figure out how to get it to point at the linux executable. Since we're in a windows context, it's very awkward to get it to handoff back to the Linux one with how it's setup. It's hardcoded to look for "Base path" + XCom2-WarOfTheChosen/Binaries\Win64/XCom2.exe. I'm not really sure of a good way to hand it off. https://github.com/X2CommunityCore/xcom2-launcher/blob/d23f80acfeb7f556c79d8853dda8ed311b8a43f0/xcom2-launcher/xcom2-launcher/Classes/XCOM/Xcom2Env.cs#L102 feral-interactive uses ./XCOM 2/XCOM2WotC/XCOM2WotC.sh as it's entry point afaict (which I think'll have some hints), which ultimately points to ./XCOM 2/XCOM2WotC/bin/XCOM2WotC with a handful of LD_PRELOAD & friends.

Making a symlink to ./XCOM 2/XCOM2WotC/bin/XCOM2WotC from ./<AML DIR (aka my "base path")>/XCom2-WarOfTheChosen/Binaries\Win64/XCom2.exe gets me some "error loading shared libraries" (libidn.so.11 specifically rn), which makes me feel like the hand-off is being automagically done and I just need those prefixes, but I'll try that another day as I'm itching to play some XCOM and the feral launcher does work more/less fine already :^)

ThisNekoGuy commented 1 year ago

It works with Proton 8.0-2 pretty much out of the box now; it only requires that you trick Steam into avoiding the 2K Launcher and the default launcher. This is what I did:

cd "<steamlibrary>/common/XCOM 2"
mv 2KLauncher 2KLauncher_bak
ln -s Launcher 2KLauncher
# extract the latest release into the launcher folder (latest release is 1.5.0 at the time of writing)
# overwrite everything, if prompted
cd Launcher
mv launcher.exe launcher.exe.bak
ln -s "XCOM2 Launcher.exe" launcher.exe
ln -s "XCOM2 Launcher.exe" LauncherPatcher.exe
# Launch the game from Steam!
## To fix the UI being too small on high resoluion displays, you'll need to use protontricks to run winecfg,
## the set the scaling factor to something higher than the default (192 looks fine at 4K, for reference)

Ideally, it'd be nice to have a native solution but... honestly, Linux ports by FeralInteractive tend to suck anyway; so, I wouldn't blame anyone for not caring much about this