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

Add Non-Steam Game: Implement Artwork Selection Paths #903

Merged
merged 8 commits into from
Sep 15, 2023

Conversation

sonic2kk
Copy link
Owner

@sonic2kk sonic2kk commented Sep 15, 2023

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!

image

I tested this with adding Bad Piggies with some grids I downloaded from SteamGrid, and it worked like a charm.

image

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 to addNonSteamGame, which is a function also used for the steamtinkerlaunch 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 call addNonSteamGame 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 call setGameArt. We basically just take in the paths from the user in addNonSteamGameGui, send them to addNonSteamGame, and this in turn sends them (with the generated AppID) to setGameArtwork. 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 into addNonSteamGameGui, 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 nasty if 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:

  • Update addnonsteamgame help screen text
  • Minor UI text updates
  • Update langfiles
  • Version bump

@sonic2kk
Copy link
Owner Author

Version bumped, langfiles updated, code changes are ready, and shellcheck is good. Ready to merge!

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.

1 participant