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

Alternate game command lines and Steam refactor #4010

Merged

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Jan 31, 2024

Background

If you're a Steam user, you can add extra game instances to Steam using this menu item:

image

Motivations

  • @linuxgurugamer wants to be able to configure an alternate command line that runs the game with a debugger
  • @k0smonaut was surprised that launching the game through CKAN didn't make Steam count play time. This is because simply launching KSP_x64.exe or KSP2_x64.exe doesn't launch it through Steam. To count play time in Steam, you have to launch the game with Steam, which can be done either by clicking in Steam or with a steam://rungameid/ URL.

Changes

  • Now all of our disparate Steam handling code is refactored into a single SteamLibrary class that uses the newly referenced ValveKeyValue MIT-licensed library to retrieve Steam's full list of games from its data files
  • Now on the first run, instead of scanning each of your configured Steam library folders for one hard coded directory name per game, we check for each supported game in each Steam game folder, including non-Steam games, so if you have multiple game instances added as non-Steam games, they'll all be found
    • The instance names will be pulled from the names Steam uses for each game instead of "Auto KSP" or "Auto KSP2"
    • We now retrieve the library folders from config/libraryfolders.vdf instead of config/config.vdf because @Olympic1's additional folder was listed in the former but not the latter
    • Since this scan checks that the game is actually installed, it will make us somewhat more robust in the face of unusual situations like SteamApps/common/Kerbal Space Program existing but being empty, which would have caused problems under the old logic but would correctly be ignored now
    • There is also a new "Import from Steam" option in the "Add new game instance" dropdown that will perform the same scan and add any instances it finds that aren't already in your list, to make it easy to "catch up" in case users add non-Steam games to Steam after running CKAN
      image
  • Now IGame.DefaultCommandLine is replaced by IGame.DefaultCommandLines, which uses the SteamLibrary class to find the URL for each game when available in addition to the direct EXE file option
  • Now the command line setting is a list instead of a single value. When you first run a version of the CKAN client with these changes, your currently configured command line will be pulled forward into this setting, with the default command lines pulled in afterwards. A new "Reset to defaults" button is available in case you want to revert to the default command line settings.
    image
  • Now the Play button has a dropdown menu showing all of your configured command lines and some help text indicating whether each one will count play time in Steam if you have Steam, followed by an edit option to make it easier to find the command line settings
    image

Side fixes:

  • ckan update won't spam "Loading modules from downloaded default repository..." anymore
  • The GUI mod list will no longer preserve which row was selected when switching from one instance to another, because it's distracting to jump halfway down the list and not know why

Fixes #2706.
Fixes #4003 (in that it explicitly tells the user whether Steam will count play time and makes the steam:// URL option discoverable).

@HebaruSan HebaruSan added Enhancement New features or functionality GUI Issues affecting the interactive GUI Core (ckan.dll) Issues affecting the core part of CKAN labels Jan 31, 2024
@HebaruSan

This comment was marked as resolved.

@HebaruSan HebaruSan added the In progress We're still working on this label Jan 31, 2024
@HebaruSan HebaruSan force-pushed the feature/multi-cmdlines-and-steam branch from d945cd2 to f8d614c Compare January 31, 2024 17:14
@HebaruSan

This comment was marked as resolved.

@HebaruSan HebaruSan force-pushed the feature/multi-cmdlines-and-steam branch from f8d614c to 2f001f9 Compare January 31, 2024 19:22
@HebaruSan

This comment was marked as resolved.

@HebaruSan

This comment was marked as resolved.

@HebaruSan HebaruSan force-pushed the feature/multi-cmdlines-and-steam branch 3 times, most recently from f665200 to 3a21749 Compare January 31, 2024 22:33
@k0smonaut
Copy link

Super cool. Thank you for doing this!

@HebaruSan HebaruSan force-pushed the feature/multi-cmdlines-and-steam branch from 3a21749 to 6c28153 Compare January 31, 2024 23:40
@HebaruSan

This comment was marked as resolved.

@HebaruSan HebaruSan force-pushed the feature/multi-cmdlines-and-steam branch 3 times, most recently from 088b838 to 29088c0 Compare February 1, 2024 22:16
@HebaruSan HebaruSan force-pushed the feature/multi-cmdlines-and-steam branch from 29088c0 to 95f8e1c Compare February 1, 2024 22:36
@HebaruSan HebaruSan merged commit abce8c4 into KSP-CKAN:master Feb 1, 2024
8 checks passed
@HebaruSan HebaruSan deleted the feature/multi-cmdlines-and-steam branch February 1, 2024 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core (ckan.dll) Issues affecting the core part of CKAN Enhancement New features or functionality GUI Issues affecting the interactive GUI In progress We're still working on this
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CKAN KSP2 time not counting towards Steam playtime [Feature] Alternative game command line option
2 participants