From 387049370eb5e61e0629d2dd80975dba1a304a58 Mon Sep 17 00:00:00 2001 From: aszlig Date: Thu, 28 Jun 2018 03:31:48 +0200 Subject: games/gog: Add Thimbleweed Park This also supports the "Ransome Unbeeped" addon which should get rid of all the beeps from Ransome's voice tracks. I added this by default in the package, because in order to enable it you still either need to enable it every time you start the game or set "forceRansomeUnbeeped: 1" in "$XDG_DATA_HOME/Terrible Toybox/Thimbleweed Park/Prefs.json" to make it permanent. The packaging is pretty straightforward except a small preloader which changes the working directory to the shared data directory so the "ggpack" files can be found. From inspecting the binary this should also be doable by setting the THIMBLEENGINE_GAMEROOT environment variable, but I haven't tried yet. Signed-off-by: aszlig --- pkgs/games/gog/default.nix | 1 + pkgs/games/gog/thimbleweed-park.nix | 55 +++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 pkgs/games/gog/thimbleweed-park.nix (limited to 'pkgs/games/gog') diff --git a/pkgs/games/gog/default.nix b/pkgs/games/gog/default.nix index 73152880..7ed321f1 100644 --- a/pkgs/games/gog/default.nix +++ b/pkgs/games/gog/default.nix @@ -19,6 +19,7 @@ let stardew-valley-beta = lib.lowPrio (callPackage ./stardew-valley.nix { beta = true; }); + thimbleweed-park = callPackage ./thimbleweed-park.nix {}; wizard-of-legend = callPackage ./wizard-of-legend.nix {}; xeen = callPackage ./xeen.nix {}; }; diff --git a/pkgs/games/gog/thimbleweed-park.nix b/pkgs/games/gog/thimbleweed-park.nix new file mode 100644 index 00000000..a37074cc --- /dev/null +++ b/pkgs/games/gog/thimbleweed-park.nix @@ -0,0 +1,55 @@ +{ lib, buildGame, fetchGog, unzip, libGL, libudev + +, ransomeUnbeeped ? true +}: + +buildGame rec { + name = "thimbleweed-park-${version}"; + version = "1.0.958"; + + srcs = lib.singleton (fetchGog { + productId = 1325604411; + downloadName = "en3installer0"; + sha256 = "141263g749k9h4741q8dyv7149n20zx50rhl0ny8ly6p4yw1spv7"; + }) ++ lib.optional ransomeUnbeeped (fetchGog { + productId = 1858019230; + downloadName = "en3installer0"; + sha256 = "1cfll73qazm9nz40n963qvankqkznfjai9g88kgw6xcl40y8jrqn"; + }); + + unpackCmd = "${unzip}/bin/unzip -qq \"$curSrc\" 'data/noarch/game/*' || :"; + + buildInputs = [ libGL ]; + + runtimeDependencies = [ libudev ]; + + # A small preload wrapper which changes into the data directory during + # startup of the main binary. + buildPhase = '' + cc -Werror -Wall -std=c11 -shared -xc - -o preload.so -fPIC < + #include + + __attribute__((constructor)) static void chdirToData(void) { + if (chdir("$out/share/thimbleweed-park") == -1) { + perror("chdir $out/share/thimbleweed-park"); + _exit(1); + } + } + EOF + patchelf --add-needed "$out/libexec/thimbleweed-park/preload.so" \ + ThimbleweedPark + ''; + + installPhase = '' + install -vD ThimbleweedPark "$out/bin/thimbleweed-park" + install -vD preload.so "$out/libexec/thimbleweed-park/preload.so" + for i in *.ggpack[0-9]*; do + install -vD -m 0644 "$i" "$out/share/thimbleweed-park/$i" + done + ''; + + sandbox.paths.required = [ + "$XDG_DATA_HOME/Terrible Toybox/Thimbleweed Park" + ]; +} -- cgit 1.4.1