Commandline: Refactor getTitleFromID to be more reliable with Non-Steam Games#1011
Merged
Commandline: Refactor getTitleFromID to be more reliable with Non-Steam Games#1011
Conversation
7 tasks
b87469f to
d63e65a
Compare
Owner
Author
|
This seems to work fine. We will need to update usage of |
Owner
Author
|
Tested and this doesn't break displaying the game name on the Wait Requester/Main Menu, generating a fresh meta file also works for these games. Should be a safe merge. |
Owner
Author
|
Following this PR, fixed the mentioned functions above not pulling Non-Steam Game titles when using |
This was referenced Jan 27, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
I noticed an issue with a Non-Steam Game that I have launched with SteamTinkerLaunch before not returning the game title correctly with
getTitleFromID. I found this while working on #1007, where using it for Non-Steam Games sometimes had a blank name. I narrowed the cause down to the game having an STL meta file that was missing the title (since we don't have the title for Non-Steam Games). If we didn't find the title in the meta file, we weren't continuing to search, which was causing the issue since Non-Steam Games have a meta file but not a title, and so we were never continuing beyond this to search onshortcuts.vdf.This PR refactors
getTitleFromIDsignificantly, making it less nested and now checking on SteamTinkerLaunch meta file, then falling back to appmanifest, and then falling back toshortcuts.vdfto try and find the corresponding Title for a given AppID. Previously, we were checking only one of these. This meant if there was a meta file without a title (which is potentially the case for Non-Steam Games), we would not find the App Name.Implementation
The function has been refactored so that we use a variable to track the game title. We set this each time we search for the game title. If it is blank, we assume we can move onto the next search method. It works like this:
FOUNDGAMETITLEis blank.FOUNDGAMETITLE.FOUNDGAMETITLEis still blank after this, search the Steam AppManifest file for anamekey and store the result inFOUNDGAMETITLEagain.FOUNDGAMETITLEis once again still blank, and if we have Steam Shortcuts that we have enabled searching on (SEARCHSTEAMSHORTCUTS), then searchshortcuts.vdffor the Game Title. If we get a match, store the Game Title for this shortcut entry inFOUNDGAMETITLEFOUNDGAMETITLEis still empty, display that no game is found.To me, this is much more logical and also easier to read.
This PR needs a bit more testing before merging. We need to test that game names are still displayed correctly on the Game Menu, and ensure that any parts of the code that use
getTitleFromIDstill function correctly. I tested quickly withgetExeand it still works correctly.