{ lib , fetchFromMediafire , fetchurl , mkWindowsApp , wine , wineArch , unrar , makeDesktopItem , makeDesktopIcon , copyDesktopItems , copyDesktopIcons }: let uid = "pkmn-clockwork"; in mkWindowsApp rec { pname = "Pokemon Clockwork"; version = "1.9.0"; meta.homepage = "https://pokemonclockwork.wixsite.com/clockworkgame"; meta.description = "Discover the brand new world of Rosari, filled with adventure and mystery surrounding the Mythical Pokémon Celebi!"; dontUnpack = true; src = fetchFromMediafire rec { name = "Pokémon Clockwork.rar"; url = "https://www.mediafire.com/file/s2ggs3s5blrhu24/Pok%C3%A9mon+Clockwork.rar"; hash = "sha256-SH6j8FyPSZyhYYNWoF6sKfHWWVYMX+iEzEVZjTGEB5E="; 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 = '' ${unrar}/bin/unrar x ${src} "$WINEPREFIX/drive_c/" mv -v "$WINEPREFIX/drive_c/Pokémon Clockwork" "$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.wixstatic.com/media/e1c82c_1208b7119adb4ed1a26700a0d6a5a984~mv2.png/v1/crop/x_237,y_146,w_1445,h_788/fill/w_1394,h_756,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/TITLE.png"; hash = "sha256-ZWtb45gRuxG2LJBEb0cJspQgUkqUs+N66aXkGSsl8tc="; }; }; }