Add Non-Steam Game: Implement Artwork Selection Paths #903
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.
Implements #738.
Salvages #576.
Overview
This PR adds the ability to select artwork (hero, logo, boxart, tenfoot) for a Non-Steam Game from the Add Non-Steam Game GUI. Thanks to #902 we properly generate and write out a Non-Steam Game AppID, so this feature request is now possible after over a year of investigation work!
I tested this with adding Bad Piggies with some grids I downloaded from SteamGrid, and it worked like a charm.
Implementation
Thanks to #902, we can now generate a correct AppID. This made implementation of this feature trivial, essentially moving over most of the work from #576 for the GUI portion (including the headings, etc).
The GUI was changed to allow users to select Non-Steam Game artwork. This opens a file selection dialogue where they can select their images. These are stored as paths. This UI portion was also essentially copied from the Set Game Artwork functionality from #757, the language strings were directly re-used and the variable names were made to match.
The
addNonSteamGameGui
function takes in all these parameters, and passes them toaddNonSteamGame
, which is a function also used for thesteamtinkerlaunch addnonsteamgame
command. The work done in this PR to allow Non-Steam Game artwork selection also applies to the commandline usage as a result! We simply calladdNonSteamGame
and pass it some extra flags now:-hr
,-lg
,-ba
,-tf
-- By design, identical to how we implemented Set Game Artwork, for consistency and easier maintenance.The
addNonSteamGame
function was updated to parse these new arguments, and uses them to callsetGameArt
. We basically just take in the paths from the user inaddNonSteamGameGui
, send them toaddNonSteamGame
, and this in turn sends them (with the generated AppID) tosetGameArtwork
. This function can manage whether the images exist or not, so we don't have to worry about vetting this here -- Woohoo, abstraction!This PR more or less brings the functionality of
setGameArtGui
and puts it intoaddNonSteamGameGui
, where each of these functions' respective commandline functions handles the rest.There were a couple of other minor tweaks and discoveries made along the way, like how we can pass a string
"--flag"
to functions and they'll parse this as a flag. This means we can get rid of some nastyif
blocks around the codebase (I think One-Time Run and Custom Command logic may benefit here, but setGameArt will benefit a lot too). This can all go in a separate PR, though 🙂In my testing, this PR is feature-complete, and only has a couple of things left: