From 383458facb33d6a84b9465488ff17dad8fcf974b Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sun, 8 Dec 2024 16:37:41 +0100 Subject: [PATCH] shadps4: 0.4.0 -> 0.4.0-unstable-2024-12-08 --- .../0001-Disable-update-checking.patch | 30 ----------------- .../by-name/sh/shadps4/av_err2str_macro.patch | 28 ---------------- pkgs/by-name/sh/shadps4/bloodborne.patch | 19 ----------- pkgs/by-name/sh/shadps4/laptop-controls.patch | 22 ++++++++++--- pkgs/by-name/sh/shadps4/package.nix | 32 ++++++++----------- pkgs/top-level/all-packages.nix | 5 +++ 6 files changed, 35 insertions(+), 101 deletions(-) delete mode 100644 pkgs/by-name/sh/shadps4/0001-Disable-update-checking.patch delete mode 100644 pkgs/by-name/sh/shadps4/av_err2str_macro.patch delete mode 100644 pkgs/by-name/sh/shadps4/bloodborne.patch diff --git a/pkgs/by-name/sh/shadps4/0001-Disable-update-checking.patch b/pkgs/by-name/sh/shadps4/0001-Disable-update-checking.patch deleted file mode 100644 index 874f20ef493a..000000000000 --- a/pkgs/by-name/sh/shadps4/0001-Disable-update-checking.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 266a090882133e30df20899bbf8a5b66b28e02cd Mon Sep 17 00:00:00 2001 -From: OPNA2608 -Date: Mon, 14 Oct 2024 00:31:01 +0200 -Subject: [PATCH] Disable update checking - -Downloading an AppImage and trying to run it just won't work. ---- - src/qt_gui/check_update.cpp | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/qt_gui/check_update.cpp b/src/qt_gui/check_update.cpp -index ca6009ca..e3b14d5d 100644 ---- a/src/qt_gui/check_update.cpp -+++ b/src/qt_gui/check_update.cpp -@@ -201,6 +201,12 @@ void CheckUpdate::setupUI(const QString& downloadUrl, const QString& latestDate, - noButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); - bottomLayout->addWidget(autoUpdateCheckBox); - -+ yesButton->setVisible(false); -+ yesButton->setEnabled(false); -+ QString updateDisabledText = QStringLiteral("[Nix] Auto-updating has been disabled in this package."); -+ QLabel* updateDisabledLabel = new QLabel(updateDisabledText, this); -+ layout->addWidget(updateDisabledLabel); -+ - QSpacerItem* spacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - bottomLayout->addItem(spacer); - --- -2.44.1 - diff --git a/pkgs/by-name/sh/shadps4/av_err2str_macro.patch b/pkgs/by-name/sh/shadps4/av_err2str_macro.patch deleted file mode 100644 index cb4507b6a35c..000000000000 --- a/pkgs/by-name/sh/shadps4/av_err2str_macro.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/src/core/libraries/videodec/videodec2_impl.cpp b/src/core/libraries/videodec/videodec2_impl.cpp -index 021965e..31eb537 100644 ---- a/src/core/libraries/videodec/videodec2_impl.cpp -+++ b/src/core/libraries/videodec/videodec2_impl.cpp -@@ -8,6 +8,16 @@ - #include "common/logging/log.h" - #include "core/libraries/error_codes.h" - -+#ifdef av_err2str -+#undef av_err2str -+#include -+av_always_inline std::string av_err2string(int errnum) { -+ char errbuf[AV_ERROR_MAX_STRING_SIZE]; -+ return av_make_error_string(errbuf, AV_ERROR_MAX_STRING_SIZE, errnum); -+} -+#define av_err2str(err) av_err2string(err).c_str() -+#endif // av_err2str -+ - namespace Libraries::Vdec2 { - - std::vector gPictureInfos; -@@ -225,4 +235,4 @@ AVFrame* VdecDecoder::ConvertNV12Frame(AVFrame& frame) { - return nv12_frame; - } - --} // namespace Libraries::Vdec2 -\ No newline at end of file -+} // namespace Libraries::Vdec2 diff --git a/pkgs/by-name/sh/shadps4/bloodborne.patch b/pkgs/by-name/sh/shadps4/bloodborne.patch deleted file mode 100644 index 63eb722eb494..000000000000 --- a/pkgs/by-name/sh/shadps4/bloodborne.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/src/core/libraries/kernel/thread_management.cpp -+++ b/src/core/libraries/kernel/thread_management.cpp -@@ -1065,7 +1065,16 @@ ScePthread PThreadPool::Create() { - } - } - -+#ifdef _WIN64 - auto* ret = new PthreadInternal{}; -+#else -+ // TODO: Linux specific hack -+ static u8* hint_address = reinterpret_cast(0x7FFFFC000ULL); -+ auto* ret = reinterpret_cast( -+ mmap(hint_address, sizeof(PthreadInternal), PROT_READ | PROT_WRITE, -+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0)); -+ hint_address += Common::AlignUp(sizeof(PthreadInternal), 4_KB); -+#endif - ret->is_free = false; - ret->is_detached = false; - ret->is_almost_done = false; diff --git a/pkgs/by-name/sh/shadps4/laptop-controls.patch b/pkgs/by-name/sh/shadps4/laptop-controls.patch index e221cc71dd40..c0459d959d89 100644 --- a/pkgs/by-name/sh/shadps4/laptop-controls.patch +++ b/pkgs/by-name/sh/shadps4/laptop-controls.patch @@ -1,11 +1,20 @@ +From 0a93bc8850b4b1608d77b123cdb1875f60635e6d Mon Sep 17 00:00:00 2001 +From: OPNA2608 +Date: Sat, 7 Dec 2024 10:47:29 +0100 +Subject: [PATCH] Support keypad-less keyboards everywhere + +--- + src/sdl_window.cpp | 7 ------- + 1 file changed, 7 deletions(-) + diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp -index bd2cc39d..13438149 100644 +index d95e8d63..ac8c5c72 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp -@@ -127,19 +127,12 @@ void WindowSDL::onResize() { - void WindowSDL::onKeyPress(const SDL_Event* event) { - using Libraries::Pad::OrbisPadButtonDataOffset; +@@ -174,19 +174,12 @@ void WindowSDL::OnResize() { + } + void WindowSDL::OnKeyPress(const SDL_Event* event) { -#ifdef __APPLE__ // Use keys that are more friendly for keyboards without a keypad. // Once there are key binding options this won't be necessary. @@ -20,5 +29,8 @@ index bd2cc39d..13438149 100644 - constexpr SDL_Keycode TriangleKey = SDLK_KP_8; -#endif - u32 button = 0; + auto button = OrbisPadButtonDataOffset::None; Input::Axis axis = Input::Axis::AxisMax; +-- +2.47.0 + diff --git a/pkgs/by-name/sh/shadps4/package.nix b/pkgs/by-name/sh/shadps4/package.nix index 5484724d886e..51db92df6105 100644 --- a/pkgs/by-name/sh/shadps4/package.nix +++ b/pkgs/by-name/sh/shadps4/package.nix @@ -2,7 +2,6 @@ lib, stdenv, fetchFromGitHub, - fetchpatch, alsa-lib, boost184, cmake, @@ -10,6 +9,7 @@ glslang, ffmpeg, fmt, + half, jack2, libdecor, libpulseaudio, @@ -22,8 +22,9 @@ qt6, rapidjson, renderdoc, + robin-map, sndio, - toml11, + stb, vulkan-headers, vulkan-loader, vulkan-memory-allocator, @@ -35,29 +36,19 @@ stdenv.mkDerivation (finalAttrs: { pname = "shadps4"; - version = "0.4.0"; + version = "0.4.0-unstable-2024-12-08"; src = fetchFromGitHub { owner = "shadps4-emu"; repo = "shadPS4"; - rev = "refs/tags/v.${finalAttrs.version}"; - hash = "sha256-dAhm9XMFnpNmbgi/TGktNHMdFDYPOWj31pZkBoUfQhA="; + rev = "4fb2247196d4626bab8f2c28710b0c34cad053fe"; + hash = "sha256-bRURBUhIVQLrBxJFaJirw3n1n7xviRoAZGLZ+rV/UeM="; fetchSubmodules = true; }; patches = [ - # https://github.com/shadps4-emu/shadPS4/issues/758 - ./bloodborne.patch # Fix controls without a numpad ./laptop-controls.patch - - # Disable auto-updating, as - # downloading an AppImage and trying to run it just won't work. - # https://github.com/shadps4-emu/shadPS4/issues/1368 - ./0001-Disable-update-checking.patch - - # https://github.com/shadps4-emu/shadPS4/issues/1457 - ./av_err2str_macro.patch ]; buildInputs = [ @@ -67,6 +58,7 @@ stdenv.mkDerivation (finalAttrs: { glslang ffmpeg fmt + half jack2 libdecor libpulseaudio @@ -84,8 +76,9 @@ stdenv.mkDerivation (finalAttrs: { qt6.qtwayland rapidjson renderdoc + robin-map sndio - toml11 + stb vulkan-headers vulkan-loader vulkan-memory-allocator @@ -101,6 +94,7 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ (lib.cmakeBool "ENABLE_QT_GUI" true) + (lib.cmakeBool "ENABLE_UPDATER" false) ]; # Still in development, help with debugging @@ -111,8 +105,9 @@ stdenv.mkDerivation (finalAttrs: { runHook preInstall install -D -t $out/bin shadps4 - install -Dm644 -t $out/share/icons/hicolor/512x512/apps $src/.github/shadps4.png - install -Dm644 -t $out/share/applications $src/.github/shadps4.desktop + install -Dm644 $src/.github/shadps4.png $out/share/icons/hicolor/512x512/apps/net.shadps4.shadPS4.png + install -Dm644 -t $out/share/applications $src/dist/net.shadps4.shadPS4.desktop + install -Dm644 -t $out/share/metainfo $src/dist/net.shadps4.shadPS4.metainfo.xml runHook postInstall ''; @@ -135,7 +130,6 @@ stdenv.mkDerivation (finalAttrs: { meta = { description = "Early in development PS4 emulator"; homepage = "https://github.com/shadps4-emu/shadPS4"; - changelog = "https://github.com/shadps4-emu/shadPS4/releases/tag/v.${finalAttrs.version}"; license = lib.licenses.gpl2Plus; maintainers = with lib.maintainers; [ ryand56 ]; mainProgram = "shadps4"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eab95fa0321c..733e71bf95ea 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1429,6 +1429,11 @@ with pkgs; withWayland = true; }; + shadps4 = callPackage ../by-name/sh/shadps4/package.nix { + # relies on std::sinf & co, which was broken in GCC until GCC 14: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79700 + stdenv = gcc14Stdenv; + }; + snes9x-gtk = snes9x.override { withGtk = true; };