fangame-flake/games/anil.nix

70 lines
2.4 KiB
Nix

{ lib
, fetchFromDrive
, fetchurl
, mkWindowsApp
, wine
, wineArch
, unrar
, makeDesktopItem
, makeDesktopIcon
, copyDesktopItems
, copyDesktopIcons
}:
let uid = "pkmn-anil";
in mkWindowsApp rec {
pname = "Pokemon Anil";
version = "1.12";
meta.homepage = "https://pokemerald.com/pokemon-anil-download-completed-english-version/";
meta.description = "The Definitive Kanto Remake, presented in a timeless form using Pokémon BW2 graphics, updated narrative and many QoLs and options that brings infinite replayability";
# 013c:err:module:import_dll Library libglib-2.0-0.dll (which is needed by L"C:\\pkmn-anil\\fluidsynth.dll") not found
# 013c:err:module:import_dll Library libportaudio-2.dll (which is needed by L"C:\\pkmn-anil\\fluidsynth.dll") not found
# 013c:err:module:import_dll Library libreadline8.dll (which is needed by L"C:\\pkmn-anil\\fluidsynth.dll") not found
# 013c:err:module:import_dll Library libsndfile-1.dll (which is needed by L"C:\\pkmn-anil\\fluidsynth.dll") not found
meta.broken = true;
dontUnpack = true;
src = fetchFromDrive rec {
name = "POKEMON ANIL V${version} ENGLISH COMPLETE.rar";
url = "112KKuclpNSJ-JXDob2FhKiPKHTEViInq";
hash = "sha256-dg2cpXOISAX3dr10NBXA+Gwp+8vTeOxgtRkeM84JwSA=";
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
${unrar}/bin/unrar x ${src} "$WINEPREFIX/drive_c/"
mv -v "$WINEPREFIX/drive_c/POKEMON ANIL V${version} ENGLISH COMPLETE/Pokemon Anil V${version}/" "$WINEPREFIX/drive_c/${uid}"
mv -v "$WINEPREFIX/drive_c/POKEMON ANIL V${version} ENGLISH COMPLETE/"* "$WINEPREFIX/drive_c/${uid}/"
rmdir -v "$WINEPREFIX/drive_c/POKEMON ANIL V${version} ENGLISH COMPLETE"
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;
desktopName = pname;
categories = ["Game"];
})
];
}