fangame-flake/games/infinite-fusion.nix

90 lines
2.5 KiB
Nix
Raw Normal View History

2023-06-15 21:26:19 +02:00
{ lib
, fetchFromMega
, fetchFromMediafire
, fetchurl
, mkWindowsApp
, wine
2023-06-15 22:41:31 +02:00
, wineArch
2023-06-15 21:26:19 +02:00
, unzip
, makeDesktopItem
, makeDesktopIcon
, copyDesktopItems
, copyDesktopIcons
2023-06-15 22:41:31 +02:00
, legacy-version ? false
2023-06-15 21:26:19 +02:00
}:
let uid = "pkmn-infinite-fusion";
in mkWindowsApp rec {
pname = "Pokemon Infinite Fusion";
2023-06-15 22:41:31 +02:00
version = if legacy-version
then "4.9.2"
else "5.2.1";
2023-06-15 21:26:19 +02:00
meta.homepage = "https://www.pokecommunity.com/showthread.php?t=347883";
meta.description = "This game re-introduces the DNA Splicers from Black and White 2... Except this time, you can use it on EVERY Pokémon!";
dontUnpack = true;
2023-06-15 22:41:31 +02:00
src = if legacy-version
then fetchFromMega rec {
name = "infinitefusion_${version}-full.zip";
url = "https://mega.nz/file/kg9UxbAI#G-bG8rv1HkOqTkza4R1TCcNFihc0C9ir21GtcMD6FPo";
hash = "sha256-YTEVoQ6Dml5XBb9jSkzKHCWs4MAtdULSsnkJHp7uUCY=";
assert_exists = [ name ];
}
else fetchFromMediafire rec {
2023-06-15 21:26:19 +02:00
name = "infinitefusion_preloaded_${version}_full.zip";
url = "https://www.mediafire.com/file/2eqpi1qq74yl1gb/infinitefusion_preloaded_5.2.1_full.zip/file";
hash = "sha256-JyalBh2ikwAbNm1SUg2oYXnLKbg2jG0ZmBUjoFOhGuk=";
assert_exists = [ name ];
};
2023-06-15 22:41:31 +02:00
inherit wine wineArch;
2023-06-15 21:26:19 +02:00
nativeBuildInputs = [ copyDesktopItems copyDesktopIcons ];
installPhase = ''
runHook preInstall
ln -s $out/bin/.launcher $out/bin/${lib.escapeShellArg pname}
runHook postInstall
'';
winAppInstall = ''
${unzip}/bin/unzip ${src} -d "$WINEPREFIX/drive_c/${uid}"
2023-06-15 22:41:31 +02:00
'' + lib.optionalString legacy-version ''
mkdir -vp "$WINEPREFIX/drive_c/windows/fonts"
cp -v "$WINEPREFIX/drive_c/${uid}/Fonts/"* "$WINEPREFIX/drive_c/windows/fonts/"
2023-06-15 21:26:19 +02:00
'';
2023-06-15 22:41:31 +02:00
# v5+
2023-06-15 21:26:19 +02:00
fileMap."$HOME/.local/share/${uid}/AppData/infinitefusion"
= "drive_c/users/$USER/AppData/Roaming/infinitefusion";
2023-06-15 22:41:31 +02:00
# legacy
fileMap."$HOME/.local/share/${uid}/Saved Games"
= "drive_c/users/$USER/Saved Games";
2023-06-15 21:26:19 +02:00
2023-06-15 22:41:31 +02:00
winAppRun = if legacy-version
then ''
$WINE start /unix "$WINEPREFIX"/drive_c/${uid}/Game.exe "$ARGS"
''
else ''
2023-06-15 21:26:19 +02:00
$WINE start /unix "$WINEPREFIX"/drive_c/${uid}/"Pokemon Infinite Fusion".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/infinitefusion/images/e/e6/Site-logo.png";
hash = "sha256-TupD2OHsJnH/SntZUqvjoBvIZziRN+Wv8S0nMLQ7UQE=";
};
};
}