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

WIP: changine - change engine to official, proton, ge-proton, luxtorpeda, etc #993

Closed
wants to merge 7 commits into from

Conversation

Jpxe
Copy link
Contributor

@Jpxe Jpxe commented Sep 8, 2023

I'm looking into if it's possible to change the steam play compat tool from Luxtorpeda. Like mentioned in luxtorpeda-dev/luxtorpeda#236

If it's possible then the user could switch from Luxtorpedas engines to outside compat tools (like Proton, GE-Proton, Linux Runtime or even native) from inside the Luxtorpeda menu.

It would also be possible to set Luxtorpeda as the default for all of Steam.

There are several things that needs more work and reasearch.

New Engine Package Submissions

  • Have you followed the instructions in the build documentation?
  • Have you run the build locally and ensured the package allowed you to launch and play the Steam game?
  • Have you updated the packages.json file?
  • Have you ensured that there is not already a pull request or active engine package for the one you are adding?

Common Code Submissions

  • Have you verified that the changes are isolated to the features or fixes you are wanting to do?
  • Have you tested at least one of the engines to ensure that your changes do not break existing workflow?
  • Have you described what your changes are accomplishing?

@d10sfan
Copy link
Member

d10sfan commented Sep 9, 2023

Looks interesting, you should be able to get the app id of the currently launched game with the env variable SteamAppId.

Also, there could be some issues with the picking part, since the versions of ge and such change so often, along with the different versions of proton that are created.

I wonder if there's some way to get the list of compat tools, like protonup does? If not, maybe having a text field that people could enter instead of coding it in?

@Jpxe
Copy link
Contributor Author

Jpxe commented Sep 9, 2023

Looks interesting, you should be able to get the app id of the currently launched game with the env variable SteamAppId.

Nice, thanks.

Also, there could be some issues with the picking part, since the versions of ge and such change so often, along with the different versions of proton that are created.

I wonder if there's some way to get the list of compat tools, like protonup does? If not, maybe having a text field that people could enter instead of coding it in?

I'm looking into it. Some of them should always be the same: luxtorpeda, official, steamlinuxruntime, proton_8 and proton_experimental. So it's mostly GE-Proton and latest Proton stable that are changing.

@Jpxe
Copy link
Contributor Author

Jpxe commented Sep 9, 2023

@d10sfan I've looked into getting a list of compat tools, both internal and external, and it is possible. I've tried to write the code but I'm a bit stuck so if you want to help out with coding this part feel free 😄

Here's what I've learned so far from researching this:

The way to do it, and how ProtonUp-QT does it, is to read the information from Steam's VDF files (Valve Data Format). They are written in a hierarchical key-value format, some of them text-based and some binary, format: https://developer.valvesoftware.com/wiki/KeyValues. ProtonUp-QT uses these Python libraries to parse them: steampython and vdf:

import vdf
from steam.utils.appcache import parse_appinfo

There's also other parsers and libraries for other languages (at least two for Rust):
https://developer.valvesoftware.com/wiki/KeyValues#Other_implementation
https://github.com/SteamDatabase/SteamAppInfo

The files we need to look at:

  • config.vdf - Contains installed apps and CompatToolMapping: what AppId uses what compat tool. Text and human readable, so can use: vdf.load(open(<path>)).
  • libraryfolders.vdf - Contains installed apps and installation directory. Text and human readable.
  • compatibilitytool.vdf - contains tool info for user installed compat tools. like name and display_name. Human readable, so can use: vdf.load(open(<path>))
  • appinfo.vdf - Binary. Info about apps (like name 'proton_7' and from_oslist). Seems to be the only place to get the internal_name for Proton versions?

ProtonUp-QT gets installed apps (games and compat tools) from config.vdf using vdf.load(open(config_vdf_file)) and libraryfolders.vdf using vdf.load(open(libraryfolders_vdf_file)): with this code it stores the information with this code.

They get the compat tool name and other info, for Proton and other internal tools, from appinfo.vdf using parse_appinfo from steam.utils.appcache (since that VDF file is in binary) with this code

For user installed tools they use compatibilitytool.vdf which is human readable so they use vdf.load with this code.

@d10sfan
Copy link
Member

d10sfan commented Sep 9, 2023

Interesting, this parsing could be added to the client (it's built in rust). There's already some parsing of the libraries to get the app ids, done through a library. I'm not sure if there's a library already able to parse the compat tools. It's currently using this library to find steam games and where they are located: https://docs.rs/steamlocate/latest/steamlocate/

One thing that's interesting there, is it looks like they are able to parse what the current compat tool is: https://github.com/WilliamVenner/steamlocate-rs/blob/49826554e81fab76994ecbb843b3480173f611b5/src/steamcompat.rs#L33

So that may be a point towards figuring out how to parse the rest of the data. That library uses a package called https://docs.rs/crate/steamy-vdf/0.2.0, which can parse vdf files, so that may be a good direction.

So that may be a good place to put this is in the client, and then able to use it from there, either passing the details into this script, or having it entirely in the client, haven't figured out the best option there yet.

@Jpxe
Copy link
Contributor Author

Jpxe commented Sep 9, 2023

Interesting, this parsing could be added to the client (it's built in rust). There's already some parsing of the libraries to get the app ids, done through a library. I'm not sure if there's a library already able to parse the compat tools. It's currently using this library to find steam games and where they are located: https://docs.rs/steamlocate/latest/steamlocate/

Yeah might make more sense to have this functionality inside the client instead of as an engine.

One thing that's interesting there, is it looks like they are able to parse what the current compat tool is: https://github.com/WilliamVenner/steamlocate-rs/blob/49826554e81fab76994ecbb843b3480173f611b5/src/steamcompat.rs#L33

So that may be a point towards figuring out how to parse the rest of the data. That library uses a package called https://docs.rs/crate/steamy-vdf/0.2.0, which can parse vdf files, so that may be a good direction.

This might also be useful, it's for Rust VDF parsing: https://github.com/CosmicHorrorDev/vdf-rs

So that may be a good place to put this is in the client, and then able to use it from there, either passing the details into this script, or having it entirely in the client, haven't figured out the best option there yet.

We can easily pass it into the script with setting $engine_choice variable from the client.

            "command": "./run-changine.sh",
            "command_args": [
                "$engine_choice"
            ],
            "engine_name": "changine"

@d10sfan
Copy link
Member

d10sfan commented Sep 9, 2023

@d10sfan
Copy link
Member

d10sfan commented Sep 9, 2023

Im thinking this could be done for non-native (launch with proton), with an extra config parameter to enable the proton choice feature. This would make the choice menu show all the time for all games, and add metadata for all the compat tools that make sense there, then those could call a canned engine, which could be basically what you have in the packages repo.

@d10sfan
Copy link
Member

d10sfan commented Sep 11, 2023

Closing in favor of the client ticket (luxtorpeda-dev/luxtorpeda#236), would of course welcome some PRs for this repo if needed once we get there.

@d10sfan d10sfan closed this Sep 11, 2023
@Jpxe Jpxe deleted the changine branch September 18, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants