Pidgeot / python-lnp

Cross-platform re-implementation of the Lazy Newb Pack launcher.
ISC License
64 stars 10 forks source link

Custom command for launching dwarf fortress itself? #178

Closed ThellraAK closed 2 years ago

ThellraAK commented 2 years ago

I'm trying to dedicate some specific resources to DF itself to try and give it it's own cache, and am trying to do that with systemd's/cgroup's slices.

I can't find anything in the documentation to control how the game itself is launched.

systemd-run --user --slice=my.slice [location of executable] -desktop

is how I'd like to launch dwarf fortress itself, so it can have it's own dedicated resources.

Sorry if this option already exists, but I can't find it.

Pidgeot commented 2 years ago

I'm assuming this is on Linux, given the use of systemd? There's one way if you use DFHack, and another if you don't.

Because DFHack requires a terminal window, it has to be launched specially, and Linux doesn't provide a unified way of doing that. So, although PyLNP tries to detect the right command, it can't possibly know the right one in all cases, so you can provide a custom command.

If you go to File > Configure terminal, you'll be able to put that in as your terminal command, using a $ as a placeholder for where the executable name will go. You'll need to tweak it to launch the terminal properly, rather than go directly to the DF executable; I'd suggest having a look at core/terminal.py to see how your terminal normally gets launched (generally it's nohup <terminal-executable>, but it varies depending on which terminal you use).

Alternatively, you should be able to make a shell script inside the DF folder that runs your desired command, make sure it's marked as executable, and start PyLNP with the command-line parameter --df-executable <name of script>. It does have to go through a shell script, I'm afraid, since that parameter only expects a single parameter, not a complete command-line, but this should work on any operating system, and with or without DFHack.

ThellraAK commented 2 years ago

That's awesome, that should get me going on it, thank you for your time.