Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Linux launch support #116

Closed
wants to merge 12 commits into from
Closed

feat: Linux launch support #116

wants to merge 12 commits into from

Conversation

0neGal
Copy link
Owner

@0neGal 0neGal commented Apr 20, 2022

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

  • Localizations
    • German (de.json)
    • French (fr.json)
    • Spanish (es.json)
  • Find Proton executable (find.proton())
  • Find Wine Prefix (find.prefix().path)
  • Find Origin executable (find.prefix().origin)
  • Button updates (Launch -> Running)
  • Verified still working on Windows (GeckoEidechse confirmed this)
  • Ability to click launch
    • Northstar
      • Needs more testing, should work, but I need more people to be able to verify this.
    • Vanilla
      • This should work flawlessly, but please do test anyway

This only has GUI elements, and slight changes to the utils.launch()
function, but none that would result in anything working yet.
extras/findgame.js is now extras/find.js, as it now also is able to find
the prefix of your Steam install and the path to Origin. Generally
speaking you can technically launch the game right now, both Vanilla and
Northstar (from what I can tell), albeit Wine is being weird for me
currently and leads to the game freezing while it's loading, or simply
never running because Origin is technically already running in the
background.

Maybe I should add a "kill" function to the launch screen. Besides that
some status text would also be nice i.e change "Launch" to "Launching",
to make sure the user doesn't think Viper isn't doing anything.

On the Windows side of things I also made the NS Launch use
"Titanfall2.exe -northstar" instead of "NorthstarLauncher.exe" to
prevent some authentication issues, I haven't tested it yet, and will do
later, we unfortunately can't do that on Linux as "-northstar" never
gets passed, hence why we manually have to launch Origin and everything.

Overall needs more testing, and not complete. As I'm still missing a way
to find Proton, which would in the end lead to a hassle free experience.
Overall we should now be able to find the latest version of Proton, the
Prefix, and everything a like, all automatically.

Albeit launching is sort of iffy, and seems to work, but with some
issues that seem to be caused mostly by my system.
When the game is running the buttons will go from saying "Launch" to
"Running" and the buttons will also disable, so you can't run the game
multiple times, avoiding a lot of issues.
@0neGal 0neGal added the enhancement New feature or request label Apr 20, 2022
@0neGal 0neGal self-assigned this Apr 20, 2022
@0neGal 0neGal linked an issue Apr 20, 2022 that may be closed by this pull request
@0neGal
Copy link
Owner Author

0neGal commented Apr 22, 2022

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...

@XNovaDelta XNovaDelta mentioned this pull request Apr 26, 2022
XNovaDelta and others added 3 commits April 26, 2022 17:19
Added linux related strings with their respective translations and some corrections.
@Jan200101
Copy link
Contributor

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

Its better to invoke steam directly for that.

@0neGal
Copy link
Owner Author

0neGal commented Jan 29, 2023

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.

Steam's library list may be outdated, or a drive may not be mounted
currently, however we would still attempt to read the folder that
doesn't currently exist, causing an error.
@0neGal
Copy link
Owner Author

0neGal commented Jan 29, 2023

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
Copy link
Contributor

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 (#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
Copy link
Owner Author

0neGal commented Jan 29, 2023

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
Copy link
Contributor

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
Copy link
Contributor

DxsSucuk commented Feb 2, 2023

Is a german translation needed or?

@0neGal
Copy link
Owner Author

0neGal commented Feb 2, 2023

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
Copy link

begin-theadventure commented Feb 7, 2023

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
Copy link
Owner Author

0neGal commented Feb 7, 2023

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
Copy link

begin-theadventure commented Feb 8, 2023

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

Different prefixes and names in Lutris for both.

@0neGal
Copy link
Owner Author

0neGal commented Feb 8, 2023

I'm referring to doing all that automatically.

@begin-theadventure
Copy link

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
Copy link
Contributor

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
Copy link
Contributor

Any updates to this?

@0neGal
Copy link
Owner Author

0neGal commented Jul 24, 2023

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
Copy link
Contributor

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

@0neGal
Copy link
Owner Author

0neGal commented Jul 24, 2023

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
Copy link

Any updates to this?

@0neGal
Copy link
Owner Author

0neGal commented Feb 6, 2024

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
Copy link
Owner Author

0neGal commented Apr 29, 2024

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

@0neGal 0neGal closed this Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Linux "Launch" support
7 participants