anatarist / spacehaven-modloader

An *unofficial* mod loader and modding tool for Space Haven by Bugbyte
13 stars 13 forks source link

Launching under Linux #2

Open dewitpj opened 5 years ago

dewitpj commented 5 years ago

Hey,

After patching the .jar you need to launch the game using the wrapper, just "spacehaven", in the same directory as the .jar :)

TBleader commented 4 years ago

Some stuff you can do to help it run on linux: Some paths for you to try. If you wish to support automagically searching steam libraries, going to the Steam/steamapps/ folder there is a file called 'libraryfolders.vdf' that contains the path to all steam libraries, excluding the steam install path. You could add a function to search those as well, as the path would be [librarypath]/steamapps/common/SpaceHaven/. I only have 1 library, but its a text file and it should be pretty easy to parse. I'd suggest also including the default steam install locations in the paths already, I added it for linux but I have no idea what it is for macos or windows (probably one of the program files folders).

    "../SpaceHaven/spacehaven",
    "../../SpaceHaven/spacehaven",
    "~/Games/SpaceHaven/spacehaven",
    ".local/share/Steam/steamapps/common/SpaceHaven/spacehaven",

in locateSpaceHaven:

            self.gamePath = path
            self.jarPath = os.path.join(os.path.dirname(path), "spacehaven.jar")
            self.modPath = os.path.join(os.path.dirname(path), "mods")

right after the path.endswith('.exe')

then changing browseForSpacehaven to include an all files will allow linux users to properly search for the executable, as it has no file extension, and using the jar excludes the option of having steam recognize it.

        self.locateSpacehaven(
            filedialog.askopenfilename(
                parent=self.master,
                title="Locate spacehaven",
                filetypes=[
                    ('spacehaven.exe', '*.exe'),
                    ('spacehaven.app', '*.app'),
                    ('spacehaven.jar', '*.jar'),
                    ('all files', '*'),
                ]
            )
        )

I didn't need to change any of the code for actually launching it, the subprocess.call is perfect, and if the path is the spacehaven executable file as it should be, provided the user has placed a steam_appid.txt. I notified the devs that they should add this file, so this might not be needed in the future either, but without it the game does launch fine it's just steam doesn't recognize it.

As for wrapping this up as a single executable, Pyinstaller supports linux. Then you could use StaticX to create a completely static file, such that the user doesn't need to download or install any libraries (this might not be required, I don't have a way to test if it is currently).

Hope this helps, let me know if you have any issues or questions! :)

ronnocnave commented 3 years ago

Adding my +1 to request a Linux version. Just shoot for Ubuntu (that's what Steam does). The community will take care of the rest. Thank you.

Beanzilla commented 2 years ago

Is a Linux version coming?

That is, is a Linux version of the mod loader coming? (Just to clarify)

RandomLegend commented 2 years ago

Can someone help me out here? I have absolutely no clue on how to use this on linux at all.

I dont have a .jar file in the release download at all. And when i open the directory in the terminal and try to execute either the modloader.py or setup.py it gives me some error for not finding some files.