diff --git a/pkgs/games/openrw/default.nix b/pkgs/games/openrw/default.nix index 6af74f264a12..061d053e34ec 100644 --- a/pkgs/games/openrw/default.nix +++ b/pkgs/games/openrw/default.nix @@ -2,6 +2,7 @@ , stdenv , fetchFromGitHub , cmake +, ninja , sfml , libGLU , libGL @@ -11,31 +12,37 @@ , openal , SDL2 , boost -, ffmpeg_4 +, ffmpeg_6 , Cocoa , OpenAL }: stdenv.mkDerivation { - version = "unstable-2021-10-14"; + version = "0-unstable-2024-04-20"; pname = "openrw"; src = fetchFromGitHub { owner = "rwengine"; repo = "openrw"; - rev = "0f83c16f6518c427a4f156497c3edc843610c402"; - sha256 = "0i6nx9g0xb8sziak5swi8636fszcjjx8n2jwgz570izw2fl698ff"; + rev = "f10a5a8f7abc79a0728847e9a10ee104a1216047"; + hash = "sha256-4ydwPh/pCzuZNNOyZuEEeX4wzI+dqTtAxUyXOXz76zk="; fetchSubmodules = true; }; + patches = [ + # SoundSource.cpp: return AVERROR_EOF when buffer is empty + # https://github.com/rwengine/openrw/pull/747 + ./fix-ffmpeg-6.patch + ]; + postPatch = lib.optional (stdenv.cc.isClang && (lib.versionAtLeast stdenv.cc.version "9"))'' substituteInPlace cmake_configure.cmake \ --replace 'target_link_libraries(rw_interface INTERFACE "stdc++fs")' "" ''; - nativeBuildInputs = [ cmake ]; + nativeBuildInputs = [ cmake ninja ]; buildInputs = [ - sfml libGLU libGL bullet glm libmad openal SDL2 boost ffmpeg_4 + sfml libGLU libGL bullet glm libmad openal SDL2 boost ffmpeg_6 ] ++ lib.optionals stdenv.isDarwin [ OpenAL Cocoa ]; meta = with lib; { diff --git a/pkgs/games/openrw/fix-ffmpeg-6.patch b/pkgs/games/openrw/fix-ffmpeg-6.patch new file mode 100644 index 000000000000..a9d68a2bd294 --- /dev/null +++ b/pkgs/games/openrw/fix-ffmpeg-6.patch @@ -0,0 +1,22 @@ +From ad7be040894661b708f9c861696499640ac7f9dc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tomi=20L=C3=A4hteenm=C3=A4ki?= +Date: Fri, 1 Dec 2023 16:01:59 +0200 +Subject: [PATCH] SoundSource.cpp: return AVERROR_EOF when buffer is empty + +--- + rwengine/src/audio/SoundSource.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/rwengine/src/audio/SoundSource.cpp b/rwengine/src/audio/SoundSource.cpp +index c93376e73..d355cab74 100644 +--- a/rwengine/src/audio/SoundSource.cpp ++++ b/rwengine/src/audio/SoundSource.cpp +@@ -55,7 +55,7 @@ int read_packet(void* opaque, uint8_t* buf, int buf_size) { + memcpy(buf, input->ptr, buf_size); + input->ptr += buf_size; + input->size -= buf_size; +- return buf_size; ++ return buf_size <= 0 ? AVERROR_EOF : buf_size; + } + } // namespace +