0neGal / viper

Launcher+Updater for TF|2 Northstar
https://0negal.github.io/viper
GNU General Public License v3.0
152 stars 21 forks source link

feat: Linux launch support #116

Closed 0neGal closed 6 months ago

0neGal commented 2 years ago

This PR when merged should ideally completely add support for Linux users being able to click "Launch", with little to no effort, (if the user install the game through Steam), a few things are missing, but generally everything works.

Notably I need everything verified to be working, not only the Linux side of things, but also Windows, as I made some slight changes to the launch code, some to make Linux launching possible, but others because I switched away from running NorthstarLauncher.exe and instead Titanfall.exe -northstar, it should work just fine, but I can't test this.

As for Linux testing, I can't easily test this, as I don't currently have a hard disk on hand to install the game onto (however I will attempt to jerry rig something if nobody is able to test it, I'll probably end up doing that anyway), and I use very low storage SSD's, so I don't have the space to install the game again.

And then there's the localizations... Found below (@Alystrasz, @AA-Delta)

"gui.settings.wineprefix.title": "Wine Prefix",
"gui.settings.wineprefix.desc": "The prefix which Wine/Proton will use, if left empty, it'll try to find your Steam prefix automatically.",
"gui.settings.winebin.title": "Wine Executable",
"gui.settings.winebin.desc": "The version of Wine/Proton to use to run the game, if set to \"/usr/bin/wine64\", Viper will try to find the latest installed version of Proton automatically, if it can't find anything it'll fallback to wine64",

"gui.running": "Running",

"wine.invalidprefix": "The selected Wine prefix doesn't exist, and is therefore invalid.",
"wine.originnotfound": "Origin can't be found in the selected Wine prefix.",
"wine.cantfindprefix": "Viper was unable to automatically find and set your Wine prefix.",

I took the liberty of adding gui.settings.title.linux myself to all the localizations, however feel free to edit it if "Linux" is spelt differently in your language, I doubted that, which was why I added it.

I've created Pre-Release which I'll update when new commits are added here, so you don't have to build Viper manually when testing.

TODO

0neGal commented 2 years ago

Currently the Vanilla game should launch just fine, however there seems to be some weird issues with Origin stopping NS from launching correctly, I'll make an update when this should be fixed...

Jan200101 commented 1 year ago

Something to note: Invoking Proton outside of Steam is not supported.

Its better to invoke steam directly for that.

0neGal commented 1 year ago

Its better to invoke steam directly for that.

Requiring invocation of Steam, and removing the ability of launching Northstar from a user set or auto detected prefix, with a user or auto detected version of Proton, would also make it far more trivial to get it to work outside of Steam installs.

One thing is having the option to launch by invoking Steam, another is enforcing it. Besides this, Viper should be as automagic as possible, a user in a perfect world should install Titanfall somehow, install Viper and then in as few clicks as possible launch the game. Hence auto detecting Steam installs, and setting paths through it, attempting to find the prefix, and Proton build as well, and letting the user know to set it manually if not found.

Ideally the only user who would ever have to set it manually is someone who understands what that means. A user who decides to use Lutris or other means of installing the game should still have it as easy as possible, and not be treated like second class citizens, and with all that reasoning I am unlikely to merge your PR (#170), but I'm not going to close it yet, as this really is a discussion.

Something to note: Invoking Proton outside of Steam is not supported.

It may not be, but Proton is Wine with Valve's patches, it may operate slightly different but Steam only wraps around it, and it's really, logically speaking no less supported than running your local executable of Wine.

The only real difference here is that we may use the wrong Proton version, but that's not realistically, a problem. Or we may be missing some environment variables and so forth, that the user may have set inside Steam. Again, not much of an issue, mostly because we can add options for these.

I cannot overstate that I am not against invoking Steam as well, but for reasons stated above, we can't remove the ability to run Proton and the prefix directly. This PR itself is currently outdated and needs to pull from upstream and correct conflicts soon, and I've intended on finishing Linux launch support for a bit, I simply have not had the motivation or time to actually get it done. Feel free to give me your feedback on all this!

TL;DR: I won't remove the ability to launch Proton and prefixes directly.

0neGal commented 1 year ago

This PR itself is currently outdated and needs to pull from upstream and correct conflicts soon

This is no longer the case as I've just gotten it up to date.

Jan200101 commented 1 year ago

Its better to invoke steam directly for that.

Requiring invocation of Steam, and removing the ability of launching Northstar from a user set or auto detected prefix, with a user or auto detected version of Proton, would also make it far more trivial to get it to work outside of Steam installs.

One thing is having the option to launch by invoking Steam, another is enforcing it. Besides this, Viper should be as automagic as possible, a user in a perfect world should install Titanfall somehow, install Viper and then in as few clicks as possible launch the game. Hence auto detecting Steam installs, and setting paths through it, attempting to find the prefix, and Proton build as well, and letting the user know to set it manually if not found.

The thought was not to force Steam but to not use invoke Proton. If you think you must do that at least use invoke Steam to do it for you.

Ideally the only user who would ever have to set it manually is someone who understands what that means. A user who decides to use Lutris or other means of installing the game should still have it as easy as possible, and not be treated like second class citizens, and with all that reasoning I am unlikely to merge your PR (https://github.com/0neGal/viper/pull/170), but I'm not going to close it yet, as this really is a discussion.

Okay? Lutris users would arguably have it worse. Their wine builds tend to be build against the Lutris runtime, with specific builds made just for it. At best things wil work just fine but chances are something will break along the way and the user will not have a clear understanding of why it works in Lutris but not in Viper.

The idea behind #170 is to, instead of manually running wine and praying nothing breaks because of environment, implement support for wherever Titanfall was installed and invoke that instead.

No need to bother with runtimes or broken wine versions. No need to configure things (further than launch flags) since that is handled by the respective client. No headaches caused by us

Something to note: Invoking Proton outside of Steam is not supported.

It may not be, but Proton is Wine with Valve's patches, it may operate slightly different but Steam only wraps around it, and it's really, logically speaking no less supported than running your local executable of Wine.

No To quote GloriousEggroll (developer behind Proton-GE)

proton runs in a container, which uses a runtime environment and libraries specifically built for use within that container. Not running it as intended results in the container and therefore its runtime not being used, and severely breaks library compatibility. It causes wine to search for libraries on your system instead of those it was built with/intended for within proton. It may work, if enough libraries match, but it is not correct and not supportable due to library differences across distros.

It may work but its not supported and known to break due to different/missing dependencies and other shenanings.

One solution to that would be to implement a proper Proton wrapper, but that would require the Steam Runtime.

I cannot overstate that I am not against invoking Steam as well, but for reasons stated above, we can't remove the ability to run Proton and the prefix directly. This PR itself is currently outdated and needs to pull from upstream and correct conflicts soon, and I've intended on finishing Linux launch support for a bit, I simply have not had the motivation or time to actually get it done. Feel free to give me your feedback on all this!

The idea is not to cut out wine prefixes at all. In #170 its part of the list of other launch methods that could be implemented. But reusing existing infrastructure from Steam or Lutris will only create headaches

Instead Viper would need to create and manage its own wine prefix.

TL;DR: I won't remove the ability to launch Proton and prefixes directly.

Never asked you to. I ask you to not use Proton builds or re-use the Steam prefix.

0neGal commented 1 year ago

Because you opened a PR that abolishes all the code in this PR, and only supports invoking Steam, I incorrectly so, assumed that you didn't want any manual Wine and prefix options. And I will admit that I still don't quite understand why you made an entirely new PR instead of working upon the code already in this one.

I do not intend to remove the code for detecting and using Steam installed Proton builds, nor it's prefixes. Missing dependencies will be an issue no matter what, unless we vendor all of them, which I don't feel is a good option whatsoever. Instead detecting that dependencies are missing would be a better idea.

As I've said in other discussions before, I would like to avoid packaging and downloading external builds and tools just to use Viper.

Out of curiosity, what headaches do you anticipate we would face, not counting issues with dependencies or the only Proton/Wine builds being found being ones that are outdated or similar. If the user has Steam installed, chances are Viper would find a Proton build that's recent enough, the idea would also be to allow the user to select through them, in case they want to use a specific build.

Again, I personally think the best option is to invoke Steam and or Lutris if possible and then falling back to searching and using Proton builds and prefixes manually.

Jan200101 commented 1 year ago

Because you opened a PR that abolishes all the code in this PR, and only supports invoking Steam, I incorrectly so, assumed that you didn't want any manual Wine and prefix options. And I will admit that I still don't quite understand why you made an entirely new PR instead of working upon the code already in this one.

... I've managed to completely miss this PR multiple times and wasn't aware it exist until I had already written that code.

I do not intend to remove the code for detecting and using Steam installed Proton builds, nor it's prefixes. Missing dependencies will be an issue no matter what, unless we vendor all of them, which I don't feel is a good option whatsoever. Instead detecting that dependencies are missing would be a better idea.

Sure, you do you. I cannot guarantee that it'll even work because there are known problems with Stock Proton and Northstar. And since most if not all issues happen at runtime I'd say it won't be easy to programatically find out what went wrong.

As I've said in other discussions before, I would like to avoid packaging and downloading external builds and tools just to use Viper.

You can't have it both ways. Either you are hands off or you manage it (like libthermite does)

Out of curiosity, what headaches do you anticipate we would face, not counting issues with dependencies or the only Proton/Wine builds being found being ones that are outdated or similar. If the user has Steam installed, chances are Viper would find a Proton build that's recent enough, the idea would also be to allow the user to select through them, in case they want to use a specific build.

It depends I guess.

The Proton wrapper tends to do a lot of setup for e.g. DXVK, Nvidia Drivers, dll's, fonts, etc. and the way the modify the environment to make it more predictable e.g. setting the userename to steamuser to have a reliable user path. All of that would be missing here

Prefix management too. Proton does not re-use the simplistic wine prefix versioning and instead employs their own, giving them more control and insight on what is happening where.

Again, I personally think the best option is to invoke Steam and or Lutris if possible and then falling back to searching and using Proton builds and prefixes manually.

You do you.

DxsSucuk commented 1 year ago

Is a german translation needed or?

0neGal commented 1 year ago

Yes and no, the language strings will likely change and have some added by the time it's actually ready to be merged.

I think when this PR was originally opened there was no German localization? maybe? I've added it to the list, but localizing it now may be a little dumb.

I'll ping when it's needed :)

begin-theadventure commented 1 year ago

I have an idea for Lutris. It can create desktop and menu shortcuts, so if a user wants to run Northstar or Titanfall 2 with Viper+Lutris, you could give them the option to select such a shortcut, so that Viper would run it.

0neGal commented 1 year ago

As briefly discussed in #38 the plan is now the following:

The solution I'll end up at is likely giving the user these options:

  1. Invoke steam
  2. Run a script/executable/command
  3. Give a prefix and wine executable

Option 2 would essentially be equivalent to your suggestion, however we could add an option to launch desktop files, and show the ones that are automatically found in ~/.local/share/applications and ~/Desktop

The only issue with this is differing between launching vanilla and Northstar...

begin-theadventure commented 1 year ago

The only issue with this is differing between launching vanilla and Northstar...

Different prefixes and names in Lutris for both.

0neGal commented 1 year ago

I'm referring to doing all that automatically.

begin-theadventure commented 1 year ago

I'm referring to doing all that automatically.

I don't think it can be done automatically, because there's no single rungameid like on Steam. It seems to me that it would be best to simply give the user the option to choose a shortcut.

Jan200101 commented 1 year ago

I don't think it can be done automatically, because there's no single rungameid like on Steam. It seems to me that it would be best to simply give the user the option to choose a shortcut.

Not entirely, no. But you can still find out what Instances exist and let the user choose which one they want to use or even inspect the check what Instance could be used for Titanfall.

Jan200101 commented 1 year ago

Any updates to this?

0neGal commented 1 year ago

Any updates to this?

Currently, no. The plan is to close this PR and open a new one, as this one is nearly 50 commits behind the main branch. And it'd frankly be more work to resolve the conflicts than to simply make a new one.

On top of this, I intend to simply add support for launching it through Steam directly, and then on top of that, options for setting a prefix, a Wine binary and launch with that, like this PR achieves. Whether those arrive in the same release and or PR I don't know quite yet.

The plan is still to get Linux launch support added sooner or later. I just have not had the time to look into it myself, and in the past my setup for the game was quite unorthodox and it therefore made it hard to make something that worked on other's setups.

Jan200101 commented 1 year ago

How about adopting the behavior I previously proposed, where the user can choose the launch method in the settings?

0neGal commented 1 year ago

The intention would be to add such an option, but it'd obviously only have a use if both methods of launching are implemented. But yes, when both are implemented, such an option would be added.

KyleGospo commented 9 months ago

Any updates to this?

0neGal commented 9 months ago

The plan is still the same, open a new PR at some point, and redo the implementation, having support for launching with Steam and being able to choose a custom command to launch the game with (2 separate options for base game and with Northstar)

As for an ETA, soon'ish? Maybe? I have had the time and motivation to work on Viper a lot more recently. I've also finally moved my game over to being installed through Steam, instead of manually with weird Wine prefixes, which makes things easier.

I would also point out that I no longer have the intention of making it possible for a user to select a Wine prefix + Wine/Proton executable and then run that way, at least for now, unless there's a good reason to add it, as you'd be able to achieve the same thing quite easily with the custom launch command.

Hope that clarifies things!

0neGal commented 6 months ago

Closing this, as a new PR has been opened to add Linux launch support: #229