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

Save and load game version for fake KSP2 instances #3986

Merged
merged 1 commit into from
Dec 31, 2023

Conversation

HebaruSan
Copy link
Member

Problems

Two problems came up during KSP-CKAN/KSP2-NetKAN#125:

  • The meta tester always fails to install KSP2 mods that aren't compatible with the latest game version
  • ckan show --with-versions lists multiple copies of the same version of a mod when the meta tester runs it

Initially I thought the former was caused by how the meta tester's Python code handles game version build numbers, but KSP-CKAN/xKAN-meta_testing#97 didn't fix it.

Causes

  • Currently a fake KSP2 instance is always treated as the current game version, because the game version isn't saved in a way that KerbalSpaceProgram2.DetectVersion can retrieve. That function uses FileVersionInfo.GetVersionInfo(path).ProductVersion to examine the game's executable, and we can't generate an executable on the fly. The game version we pass on the command line is saved to a readme.txt file but otherwise ignored.
  • With the recent repo refactor, when a mod version exists in multiple repos (which is how the meta tester works), both copies are returned by Registry.AvailableByIdentifier

Changes

  • Now when we create a fake KSP2 instance, instead of creating KSP_x64.exe as an empty file, we save the game version in it
  • Now if we fail to get the KSP2 game version from FileVersionInfo.GetVersionInfo(path).ProductVersion, we fall back to loading the text of the file as per the above point
  • Now Registry.AvailableByIdentifier filters out duplicates

@HebaruSan HebaruSan added Bug Something is not working as intended Enhancement New features or functionality Easy This is easy to fix Core (ckan.dll) Issues affecting the core part of CKAN labels Dec 31, 2023
@HebaruSan HebaruSan merged commit 563f16c into KSP-CKAN:master Dec 31, 2023
8 checks passed
@HebaruSan HebaruSan deleted the fix/fake-ksp2-version branch December 31, 2023 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended Core (ckan.dll) Issues affecting the core part of CKAN Easy This is easy to fix Enhancement New features or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant