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

Commandline: Add support for Non-Steam Games to getCompatData #970

Merged
merged 2 commits into from Nov 8, 2023

Conversation

sonic2kk
Copy link
Owner

@sonic2kk sonic2kk commented Nov 8, 2023

Another piece for #960.

This PR adds support for Non-Steam Games with getCompatData. We already have partial support, if a game is launched with SteamTinkerLaunch, because we can get the game name and EXE already with existing functions, and we can get the compatdata with the symlink SteamTinkerLaunch creates.

However, for games not launched with SteamTinkerLaunch before, it fails. To resolve this, we can simply generate a default compatdata path. In testing, it looks like Non-Steam Games always have a compatdata created in the Steam Root library folder (i.e. ~/.local/share/Steam/steamapps/compatdata/<appid>). Since we can parse shortcuts.vdf now it's very easy to loop through all shortcuts and simply generate a path like above. As a safety, we check to make sure this actually exists before returning it. We build the return string using the information from shortcuts.vdf even if we have information from earlier in the function, in case the shortcut name has changed or something, just to make sure we have the most up-to-date information.

There is a possibility that the compatdata location assumption is not correct, and that Steam actually creates the compatdata at the "default" library folder. By default Steam does set this to the Steam Root library folder, but it is possible that if Steam uses some other location that this Steam root path will not have the compatdata, and so this command will not find the compatdata. I think that's a big "if" though, so for now, this works :-)


After a shellcheck and some more testing, I think this is good to merge.

@sonic2kk
Copy link
Owner Author

sonic2kk commented Nov 8, 2023

Shellcheck is green, doesn't seem to have broken anything, and Steam games still work. This is ready to merge.

@sonic2kk sonic2kk merged commit 0ef8ef6 into master Nov 8, 2023
@sonic2kk sonic2kk linked an issue Nov 8, 2023 that may be closed by this pull request
11 tasks
@sonic2kk sonic2kk deleted the nonsteam-getcompatdata-fix branch November 8, 2023 01:31
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.

[Feature Request] Non-Steam Game Improvements
1 participant