Skip to content

Commit bb59a63

Browse files
committed
shadps4-qt: init at 0-unstable-2025-12-31
1 parent 81c3ed9 commit bb59a63

File tree

6 files changed

+163
-21
lines changed

6 files changed

+163
-21
lines changed

pkgs/by-name/sh/shadps4/emulator.nix

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ stdenv.mkDerivation (finalAttrs: {
5555
owner = "shadps4-emu";
5656
repo = "shadPS4";
5757
tag = "v.${finalAttrs.version}";
58-
hash = "sha256-kHob03/ywR30AFXKuySf54yEuiYMoAb68QRtekomXH0=";
58+
hash = "sha256-yRQMk9STf9/bykWauoZVh6CY95A0VfgC5xuHi8a87g4=";
5959
fetchSubmodules = true;
6060

6161
leaveDotGit = true;
6262
postFetch = ''
6363
cd "$out"
64-
git rev-parse HEAD > $out/COMMIT
64+
git rev-parse --abbrev-ref HEAD > $out/BRANCH
65+
git rev-parse --short HEAD > $out/COMMIT
6566
date -u -d "@$(git log -1 --pretty=%ct)" "+%Y-%m-%dT%H:%M:%SZ" > $out/SOURCE_DATE_EPOCH
6667
find "$out" -name .git -print0 | xargs -0 rm -rf
6768
'';
@@ -71,8 +72,8 @@ stdenv.mkDerivation (finalAttrs: {
7172
substituteInPlace src/common/scm_rev.cpp.in \
7273
--replace-fail @APP_VERSION@ ${finalAttrs.version} \
7374
--replace-fail @GIT_REV@ $(cat COMMIT) \
74-
--replace-fail @GIT_BRANCH@ ${finalAttrs.version} \
75-
--replace-fail @GIT_DESC@ ${finalAttrs.version} \
75+
--replace-fail @GIT_BRANCH@ $(cat BRANCH) \
76+
--replace-fail @GIT_DESC@ $(cat COMMIT) \
7677
--replace-fail @BUILD_DATE@ $(cat SOURCE_DATE_EPOCH)
7778
'';
7879

@@ -155,4 +156,6 @@ stdenv.mkDerivation (finalAttrs: {
155156
];
156157
};
157158
};
159+
160+
meta.platforms = lib.intersectLists lib.platforms.linux lib.platforms.x86_64;
158161
})
Lines changed: 103 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,109 @@
11
{
22
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
replaceVars,
6+
7+
wrapQtAppsHook ? null,
8+
9+
qtbase ? null,
10+
qttools ? null,
11+
qtmultimedia ? null,
12+
13+
withGUI ? false,
314
callPackage,
15+
symlinkJoin,
416
}:
517

6-
callPackage ./emulator.nix { } // {
7-
meta = {
8-
description = "Early in development PS4 emulator";
9-
homepage = "https://github.com/shadps4-emu/shadPS4";
10-
license = lib.licenses.gpl2Plus;
11-
maintainers = with lib.maintainers; [
12-
ryand56
13-
liberodark
14-
];
15-
mainProgram = "shadps4";
16-
platforms = lib.intersectLists lib.platforms.linux lib.platforms.x86_64;
18+
let
19+
emulator = callPackage ./emulator.nix { };
20+
21+
shadps4 = symlinkJoin {
22+
name = "shadps4-wrapped";
23+
paths = [ emulator ];
24+
25+
postBuild = ''
26+
substitute ${./versions.json} $out/share/versions.json \
27+
--replace-fail @shadps4@ $out/bin/shadps4
28+
29+
substitute ${./qt_ui.ini} $out/share/qt_ui.ini \
30+
--replace-fail @shadps4@ $out/bin/shadps4
31+
'';
1732
};
18-
}
33+
in
34+
(
35+
if withGUI then
36+
stdenv.mkDerivation (finalAttrs: {
37+
pname = "shadps4-qt";
38+
version = "0-unstable-2025-12-31";
39+
40+
inherit (emulator)
41+
postPatch
42+
cmakeFlags
43+
cmakeBuildType
44+
dontStrip
45+
runtimeDependencies
46+
;
47+
48+
src = fetchFromGitHub {
49+
inherit (emulator.src) owner leaveDotGit postFetch;
50+
repo = "shadps4-qtlauncher";
51+
rev = "950f6264de2e4f1b53a82c759cd140a6d4c3a646";
52+
hash = "sha256-8WSCtPdarosIXsvzmTZJThY54nWSU08mNkjdwLztAcQ=";
53+
fetchSubmodules = true;
54+
};
55+
56+
patches = [
57+
(replaceVars ./qt-paths.patch {
58+
inherit shadps4;
59+
})
60+
];
61+
62+
nativeBuildInputs = (emulator.nativeBuildInputs or [ ]) ++ [
63+
wrapQtAppsHook
64+
];
65+
66+
buildInputs = (emulator.buildInputs or [ ]) ++ [
67+
qtbase
68+
qttools
69+
qtmultimedia
70+
];
71+
72+
installPhase = ''
73+
runHook preInstall
74+
75+
mkdir -p $out/bin
76+
ln -s ${shadps4}/bin/shadps4 $out/bin
77+
78+
install -Dm644 $src/.github/shadps4.png $out/share/icons/hicolor/512x512/apps/net.shadps4.shadPS4.png
79+
install -Dm644 -t $out/share/applications $src/dist/net.shadps4.shadps4-qtlauncher.desktop
80+
install -Dm644 -t $out/share/metainfo $src/dist/net.shadps4.shadps4-qtlauncher.metainfo.xml
81+
82+
install -Dm755 shadPS4QtLauncher $out/bin/shadps4-qt
83+
84+
runHook postInstall
85+
'';
86+
87+
meta = {
88+
inherit (emulator.meta) platforms;
89+
};
90+
})
91+
else
92+
emulator
93+
).overrideAttrs
94+
(oa: {
95+
meta = oa.meta // {
96+
description = "Early in development PS4 emulator";
97+
homepage =
98+
if withGUI then
99+
"https://github.com/shadps4-emu/shadps4-qtlauncher"
100+
else
101+
"https://github.com/shadps4-emu/shadPS4";
102+
license = lib.licenses.gpl2Plus;
103+
maintainers = with lib.maintainers; [
104+
ryand56
105+
liberodark
106+
];
107+
mainProgram = if withGUI then "shadps4-qt" else "shadps4";
108+
};
109+
})
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
diff --git a/src/common/versions.cpp b/src/common/versions.cpp
2+
index b935bb6..366d8ea 100644
3+
--- a/src/common/versions.cpp
4+
+++ b/src/common/versions.cpp
5+
@@ -5,6 +5,7 @@
6+
#include "path_util.h"
7+
#include "versions.h"
8+
9+
+#include <QCoreApplication>
10+
#include <algorithm>
11+
#include <filesystem>
12+
#include <fstream>
13+
@@ -18,7 +19,7 @@ namespace VersionManager {
14+
15+
std::vector<Version> GetVersionList(std::filesystem::path const& path) {
16+
std::filesystem::path cfg_path =
17+
- path.empty() ? Common::FS::GetUserPath(Common::FS::PathType::LauncherDir) / "versions.json"
18+
+ path.empty() ? "@shadps4@/share/versions.json"
19+
: path;
20+
21+
std::ifstream ifs{cfg_path};
22+
diff --git a/src/qt_gui/gui_settings.cpp b/src/qt_gui/gui_settings.cpp
23+
index 707131c..3077d39 100644
24+
--- a/src/qt_gui/gui_settings.cpp
25+
+++ b/src/qt_gui/gui_settings.cpp
26+
@@ -1,11 +1,12 @@
27+
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
28+
// SPDX-License-Identifier: GPL-2.0-or-later
29+
30+
+#include <QCoreApplication>
31+
#include "common/path_util.h"
32+
#include "gui_settings.h"
33+
34+
gui_settings::gui_settings(QObject* parent) : settings(parent) {
35+
- m_settings = std::make_unique<QSettings>(ComputeSettingsDir() + "qt_ui.ini",
36+
+ m_settings = std::make_unique<QSettings>(QString::fromStdString("@shadps4@/share/qt_ui.ini"),
37+
QSettings::Format::IniFormat, parent);
38+
}
39+

pkgs/by-name/sh/shadps4/qt_ui.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[version_manager]
2+
versionSelected=@shadps4@
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
{
3+
"codename": "built-in",
4+
"name": "built-in",
5+
"path": "@shadps4@",
6+
"type": 0
7+
}
8+
]

pkgs/top-level/all-packages.nix

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,11 +1316,6 @@ with pkgs;
13161316
withWayland = true;
13171317
};
13181318

1319-
shadps4 = callPackage ../by-name/sh/shadps4/package.nix {
1320-
# relies on std::sinf & co, which was broken in GCC until GCC 14: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79700
1321-
stdenv = gcc14Stdenv;
1322-
};
1323-
13241319
winetricks = callPackage ../applications/emulators/wine/winetricks.nix { };
13251320

13261321
zsnes = pkgsi686Linux.callPackage ../applications/emulators/zsnes { };
@@ -3721,6 +3716,10 @@ with pkgs;
37213716

37223717
seqdiag = with python3Packages; toPythonApplication seqdiag;
37233718

3719+
shadps4-qt = kdePackages.callPackage ../by-name/sh/shadps4/package.nix {
3720+
withGUI = true;
3721+
};
3722+
37243723
shellify = haskellPackages.shellify.bin;
37253724

37263725
shiv = with python3Packages; toPythonApplication shiv;

0 commit comments

Comments
 (0)