Scummvm custom executable

Hello, I’m trying to use a custom executable for scummvm but I have a problem with the option passed to that executable by lutris:

Running /home/tony/src/scummvm/scummvm --extrapath=/home/tony/src/share/scummvm --themepath=/home/tony/src/share/scummvm --aspect-ratio --no-fullscreen --gfx-mode=3x --path=~/Games/GK2 ITA gk2
Initial process has started with pid 80178
Game is considered started.
scummvm: Non-existent extra path '/home/tony/src/share/scummvm'
Usage: scummvm [OPTIONS]... [GAME]

Try 'scummvm --help' for more options.

I don’t understand how lutris choose the paths for --extrapath and --themepath (they are wrong) and I can’t find an option to specify them.
If I try to run scummvm from a terminal everything is fine because extrapath and themepath are set in my ~/.config/scummvm/scummvm.ini but when running scummvm via lutris they are superseded by the wrong command line options lutris use.

Here is the code where Lutris decides the paths for Scummvm: https://github.com/lutris/lutris/blob/master/lutris/runners/scummvm.py#L103-L112

To summarize, it looks at the scummvm binary, goes up a directory, then goes to share/scummvm. That only works if it’s organized into bin/ and share/ directories, which is how it is if you use the system-installed scummvm. A quick and dirty solution would be to organize your copy of scummvm that way. Probably the runner should allow you to pick the right directory.

1 Like

I submitted a PR that exposes a new data directory option for scummvm: https://github.com/lutris/lutris/pull/2911

Does it work for you? I’ve included the patch below. Save it to a file called something like scummvm-custom-data-dir.patch, then run:

cd /usr/lib/python3/dist-packages/lutris/
sudo patch -p1 < ~/scummvm-custom-data-dir.patch

If it doesn’t work and you want to revert it, then run:

sudo apt install --reinstall lutris

diff --git a/lutris/runners/scummvm.py b/lutris/runners/scummvm.py
index b231c683..9fdbd489 100644
--- a/lutris/runners/scummvm.py
+++ b/lutris/runners/scummvm.py
@@ -89,6 +89,13 @@ class scummvm(Runner):
             ("The algorithm used to scale up the game's base "
              "resolution, resulting in different visual styles. "),
         },
+        {
+            "option": "datadir",
+            "label": "Data directory",
+            "type": "directory_chooser",
+            "help": "Defaults to share/scummvm if unspecified.",
+            "advanced": True,
+        },
     ]
 
     @property
@@ -108,8 +115,13 @@ class scummvm(Runner):
         ]
 
     def get_scummvm_data_dir(self):
-        root_dir = os.path.dirname(os.path.dirname(self.get_executable()))
-        return os.path.join(root_dir, "share/scummvm")
+        data_dir = self.runner_config.get("datadir")
+
+        if data_dir is None:
+            root_dir = os.path.dirname(os.path.dirname(self.get_executable()))
+            data_dir = os.path.join(root_dir, "share/scummvm")
+
+        return data_dir
 
     def get_run_data(self):
         env = {"LD_LIBRARY_PATH": "%s;$LD_LIBRARY_PATH" % self.libs_dir}
diff --git a/tests/test_scummvm.py b/tests/test_scummvm.py
new file mode 100644
index 00000000..c5edf8d6
--- /dev/null
+++ b/tests/test_scummvm.py
@@ -0,0 +1,14 @@
+from unittest import TestCase
+
+from lutris.config import LutrisConfig
+from lutris.runners.scummvm import scummvm
+
+
+class TestScummvm(TestCase):
+    def test_custom_data_dir(self):
+        scummvm_runner = scummvm()
+        scummvm_runner.config = LutrisConfig()
+        scummvm_runner.config.runner_config["datadir"] = "~/custom/scummvm"
+
+        self.assertEqual(scummvm_runner.get_scummvm_data_dir(), "~/custom/scummvm")
+        self.assertEqual(scummvm_runner.get_command()[1], "--extrapath=~/custom/scummvm")

Thank you, as you said I should just install scummvm into the usual /usr(/local) path. Maybe a configuration option for these extras and themes path could still make sense? Maybe I’ll try to implement that. Thanks again.

EDIT: oh wow, you are fast! :slight_smile: checking the changes, will get back to you soon

It’s working fine, thank you! :slight_smile:

1 Like