fangame-flake/games/infinity.nix

75 lines
1.9 KiB
Nix

{ lib
, fetchFromMediafire
, fetchurl
, mkWindowsApp
, wine
, wineArch
, unzip
, makeDesktopItem
, makeDesktopIcon
, copyDesktopItems
, copyDesktopIcons
}:
let uid = "pkmn-infinity";
in mkWindowsApp rec {
pname = "Pokemon Infinity";
version = "2.3.6";
meta.homepage = "https://reliccastle.com/infinity/";
meta.description = "You wake up in the middle of a forest in the Egho region, with no recollection of who you are.";
# fmod error
meta.broken = true;
dontUnpack = true;
src = fetchFromMediafire rec {
name = "Pokemon Infinity ${version}.zip";
url = "https://www.mediafire.com/file/dlssk830cxdvo5y/Pokemon_Infinity_2.3.6.zip/file";
hash = "sha256-ggKqd/3g3kcfs85pFULHfHmSoWHTzCFsRRdmlm7/wHs=";
assert_exists = [ name ];
};
inherit wine wineArch;
nativeBuildInputs = [ copyDesktopItems copyDesktopIcons ];
installPhase = ''
runHook preInstall
ln -s $out/bin/.launcher $out/bin/${lib.escapeShellArg pname}
runHook postInstall
'';
winAppInstall = ''
#winetricks -q directplay directmusic #dsound dmsynth devenum quartz d3dx9_36
${unzip}/bin/unzip ${src} -d "$WINEPREFIX/drive_c/"
mv -v "$WINEPREFIX/drive_c/Pokemon Infinity ${version}" "$WINEPREFIX/drive_c/${uid}"
mkdir -vp "$WINEPREFIX/drive_c/windows/fonts"
cp -v "$WINEPREFIX/drive_c/${uid}/Fonts/"* "$WINEPREFIX/drive_c/windows/fonts/"
'';
fileMap."$HOME/.local/share/${uid}/Saved Games"
= "drive_c/users/$USER/Saved Games";
winAppRun = ''
$WINE start /unix "$WINEPREFIX"/drive_c/${uid}/Game.exe "$ARGS"
'';
desktopItems = [
(makeDesktopItem {
name = pname;
exec = pname;
icon = uid;
desktopName = pname;
categories = ["Game"];
})
];
desktopIcon = makeDesktopIcon {
name = uid;
icoIndex = 0;
src = fetchurl {
url = "https://static.wikia.nocookie.net/p-infinity/images/e/e6/Site-logo.png";
hash = "sha256-wKQgEb/TguZQcjBRmn0f3H4N2ZU49sFfU2Z4c+Cq/Zw=";
};
};
}