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

Support Windows KSP1 instances on Linux #4044

Merged

Conversation

HebaruSan
Copy link
Member

Background

Originally, CKAN looked for buildID.txt and buildID64.txt to identify KSP1 instances. For KSP2, no equivalent file exists (but luckily we won't need it anymore, see #4034), so we look for the game executable instead.

It was fairly common for confused KSP1 users to ask how to add an instance, because they didn't know what buildID.txt was and so clicking it was a non-obvious action. Meanwhile, nobody seemed the least bit confused by choosing the KSP2 executable. So in #3964 we changed the prompting for KSP1 to also use the executable, which seems to have succeeded in improving usability so far.

Later, a Linux user submitted #3984 to run the KSP2 Windows executable from Linux, which apparently can work thanks to Proton, which somehow can reach out from inside however Steam installs it to launch EXE files similar to how Mono does (I'm still not sure about the details of this).

Motivation

Some KSP1 users on Linux also prefer to run via Proton, because it performs better for them, or because DirectX makes some graphics-heavy mods like Parallax work better than they do on OpenGL. Currently such users have to create a KSP.x86_64 file to be able to add such an instance to CKAN, which is a very non-obvious workaround, and they also have to configure the command line manually.

Changes

Now CKAN will look for Windows KSP1 executables in addition to the Linux ones when running on Linux. This applies both to adding the instance and to launching the game. Whichever executable is present in the folder will be treated as the right one to run, as per #3964.

Fixes #4036.
Fixes #4038.
Fixes #4041.

@HebaruSan HebaruSan added Enhancement New features or functionality Easy This is easy to fix Core (ckan.dll) Issues affecting the core part of CKAN Linux Issues specific for Linux labels Feb 28, 2024
@HebaruSan HebaruSan merged commit 3b16d38 into KSP-CKAN:master Feb 28, 2024
8 checks passed
@HebaruSan HebaruSan deleted the feature/linux-windows-instances branch February 28, 2024 04:37
@OboTheHobo
Copy link

I downloaded the nightly build to try this and it didn't work perfectly, the game launched but it seemed to be using the default wine prefix on my computer rather than proton. The solution was to put the following in a bash script and get ckan to launch that (for some reason it didn't work if I just put this line in the CKAN start line):

STEAM_COMPAT_CLIENT_INSTALL_PATH=/path/to/steam/install/Steam/ STEAM_COMPAT_DATA_PATH=~/.proton/ /path/to/steamapps/common/Proton\ -\ Experimental/proton run ./KSP_x64.exe

Not sure if this can be easily implemented into the program given that the paths to all those are highly dependent on the system. Still, thought I'd add this here in case someone else wanted help getting ckan to work with proton.

@HebaruSan
Copy link
Member Author

HebaruSan commented Mar 30, 2024

Hi @OboTheHobo, thanks for that contribution. That explains my puzzlement about how simply running the KSP1 Windows executable could possibly connect up with Steam's Proton setup (i.e., it doesn't).

Would you mind putting that info somewhere on the CKAN wiki to make it more findable? Our pages about Linux are all distro-specific, so there may not be a perfect spot, but something would still be better than nothing, and we can always move it around later if needed.

(for some reason it didn't work if I just put this line in the CKAN start line)

Yes, setting environment variables wouldn't work because Mono's Process.Start call just starts the given executable without starting a shell first. You might have more success if you try bash -c "your command" to force it to start a shell within which those variables could be set.

Also, the dev build should have an option in the Play button's dropdown menu to launch via Steam:

image

I would guess that that option would use Proton without requiring extra custom setup.

@OboTheHobo
Copy link

That explains my puzzlement about how simply running the KSP1 Windows executable could possibly connect up with Steam's Proton setup (i.e., it doesn't).

I'm thinking it would if proton is the only version of wine installed, it might. For me it started with the default wineprefix from installing wine normally, but I imagine if proton is the only version there is then it could default for that.

Also, the dev build should have an option in the Play button's dropdown menu to launch via Steam:

I don't see this option on my end (is the dev build different from nightly?) but I would think this wouldn't work when having multiple instances of the game installed. Still, nice to have another option.

As for the wiki, do you think maybe I should just make a new page for proton? seems a little unnecessary for a relatively small workaround, but as you said the linux guides are all spread out across different pages for distros so it might be the best option to just make a new page.

@OboTheHobo
Copy link

Or, I could also add it to the troubleshooting page maybe, since the linux pages are more for installation than setup.

@HebaruSan
Copy link
Member Author

Also, the dev build should have an option in the Play button's dropdown menu to launch via Steam:

I don't see this option on my end (is the dev build different from nightly?) but I would think this wouldn't work when having multiple instances of the game installed. Still, nice to have another option.

Ahh yes, that would only appear for instances that are actually in Steam. If you made a copy of the game dir, then it would only show the executable option by default for that instance. You could try Steam's "non-Steam game" option, which the dev build should detect:

image

But I guess in that case you'd still have to tell Steam how to run the game...?

As for the wiki, do you think maybe I should just make a new page for proton?
Or, I could also add it to the troubleshooting page maybe, since the linux pages are more for installation than setup.

Either of those options sounds workable to me. Thanks for being willing to help out!

@OboTheHobo
Copy link

Alright, I added a section to the troubleshooting page, hopefully it's clear in what to do. Glad I could help!

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 Easy This is easy to fix Enhancement New features or functionality Linux Issues specific for Linux
Projects
None yet
2 participants