123 lines
3.2 KiB
Nix
123 lines
3.2 KiB
Nix
|
|
{
|
||
|
|
stdenvNoCC,
|
||
|
|
lib,
|
||
|
|
requireFile,
|
||
|
|
unzip,
|
||
|
|
copyDesktopItems,
|
||
|
|
xxd,
|
||
|
|
makeWrapper,
|
||
|
|
SDL2,
|
||
|
|
mono,
|
||
|
|
makeDesktopItem,
|
||
|
|
libfmodstudio_fix,
|
||
|
|
libfmodstudio,
|
||
|
|
libfna3d,
|
||
|
|
libfmodsdl,
|
||
|
|
}:
|
||
|
|
stdenvNoCC.mkDerivation rec {
|
||
|
|
name = "celeste-game";
|
||
|
|
version = "1.4.0.0";
|
||
|
|
|
||
|
|
src = requireFile {
|
||
|
|
name = "celeste-linux.zip";
|
||
|
|
url = "https://maddymakesgamesinc.itch.io/celeste";
|
||
|
|
hash = "sha256-q4gniSgg00U3j5TZpvIZnSmqAyCHd/pOVAuQ3rDYEAs=";
|
||
|
|
};
|
||
|
|
sourceRoot = "."; # needed for multiple directories
|
||
|
|
|
||
|
|
nativeBuildInputs = [
|
||
|
|
unzip # for unzipping
|
||
|
|
copyDesktopItems # will help!
|
||
|
|
makeWrapper
|
||
|
|
xxd
|
||
|
|
];
|
||
|
|
|
||
|
|
buildInputs = [
|
||
|
|
libfmodstudio_fix
|
||
|
|
libfmodstudio
|
||
|
|
libfna3d
|
||
|
|
SDL2
|
||
|
|
libfmodsdl
|
||
|
|
|
||
|
|
mono
|
||
|
|
];
|
||
|
|
|
||
|
|
strictDeps = true;
|
||
|
|
dontConfigure = true;
|
||
|
|
|
||
|
|
patchPhase = ''
|
||
|
|
# patch celeste
|
||
|
|
runHook prePatch
|
||
|
|
# TODO: i don't know what this magic string does and it bothers me
|
||
|
|
# TODO: convert these to patch files?
|
||
|
|
xxd -p < Celeste.exe | tr -d '\n' | LC_ALL=C sed 's/03000616fe012a0013300200210000000a000011160a02145112012014100100/03000616fe012a0013300200210000000a000011160a02145112012006020200/g' | xxd -r -p > Celeste.exe.patched
|
||
|
|
mv Celeste.exe.patched Celeste.exe
|
||
|
|
|
||
|
|
# this cannot possibly be the best way of doing this
|
||
|
|
cat >Celeste.exe.config <<EOF
|
||
|
|
<?xml version="1.0" encoding="utf-8"?>
|
||
|
|
<configuration>
|
||
|
|
<dllmap dll="fmod" os="linux" target="libfmod.so.13"/>
|
||
|
|
<dllmap dll="fmodstudio" os="linux" target="libfmodstudio.so.13">
|
||
|
|
<dllentry dll="fmodstudio_fix.so" name="FMOD_Studio_EventInstance_SetParameterValue" target="_FMOD_Studio_EventInstance_SetParameterValue"/>
|
||
|
|
<dllentry dll="fmodstudio_fix.so" name="FMOD_Studio_System_Create" target="_FMOD_Studio_System_Create"/>
|
||
|
|
<dllentry dll="fmodstudio.so.13" name="FMOD_Studio_System_GetLowLevelSystem" target="FMOD_Studio_System_GetCoreSystem"/>
|
||
|
|
<dllentry dll="fmodstudio.so.13" name="FMOD_Studio_EventInstance_TriggerCue" target="FMOD_Studio_EventInstance_KeyOff"/>
|
||
|
|
</dllmap>
|
||
|
|
</configuration>
|
||
|
|
EOF
|
||
|
|
|
||
|
|
runHook postPatch
|
||
|
|
'';
|
||
|
|
|
||
|
|
dontBuild = true;
|
||
|
|
|
||
|
|
installPhase = ''
|
||
|
|
runHook preInstall # these get clobbered
|
||
|
|
|
||
|
|
mkdir -p $out/{bin,lib}
|
||
|
|
cp Celeste.exe Celeste.exe.config Celeste.pdb $out/lib
|
||
|
|
cp Celeste.Content.dll Celeste.Content.pdb $out/lib
|
||
|
|
cp FNA.dll FNA.dll.config FNA3D.dll $out/lib
|
||
|
|
cp -r Content/ $out/lib
|
||
|
|
cp -r Backups/ $out/lib
|
||
|
|
cp gamecontrollerdb.txt $out/lib
|
||
|
|
|
||
|
|
mkdir -p $out/share/icons/hicolor/512x512/apps
|
||
|
|
cp Celeste.png $out/share/icons/hicolor/512x512/apps
|
||
|
|
|
||
|
|
runHook postInstall
|
||
|
|
'';
|
||
|
|
|
||
|
|
postFixup = ''
|
||
|
|
makeWrapper "${mono}/bin/mono" "$out/bin/celeste-game" \
|
||
|
|
--add-flags "--debug $out/lib/Celeste.exe" \
|
||
|
|
--prefix LD_LIBRARY_PATH : ${
|
||
|
|
lib.makeLibraryPath [
|
||
|
|
"$out"
|
||
|
|
libfmodstudio_fix
|
||
|
|
libfmodstudio
|
||
|
|
libfna3d
|
||
|
|
SDL2
|
||
|
|
libfmodsdl
|
||
|
|
]
|
||
|
|
}
|
||
|
|
'';
|
||
|
|
|
||
|
|
desktopItems = [
|
||
|
|
(makeDesktopItem {
|
||
|
|
name = name;
|
||
|
|
exec = "celeste-game %U";
|
||
|
|
icon = "Celeste";
|
||
|
|
comment = "Just breathe. You can do this..."; # should be an actual description of Celeste
|
||
|
|
desktopName = "Celeste";
|
||
|
|
categories = [
|
||
|
|
"Game"
|
||
|
|
"Application"
|
||
|
|
];
|
||
|
|
})
|
||
|
|
];
|
||
|
|
|
||
|
|
meta = { };
|
||
|
|
}
|