[Backport release-26.05] shadps4: 0.13.0 -> 0.15.0, shadps4-qtlauncher: init at 224 (#524210)

This commit is contained in:
Gaétan Lepage
2026-07-21 20:03:15 +00:00
committed by GitHub
6 changed files with 250 additions and 40 deletions

View File

@@ -0,0 +1,104 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
pkg-config,
qt6,
fmt,
sdl3,
toml11,
shadps4,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "shadps4-qtlauncher";
version = "224";
src = fetchFromGitHub {
owner = "shadps4-emu";
repo = "shadps4-qtlauncher";
tag = "v${finalAttrs.version}";
hash = "sha256-lRZH9fokUKN/n3m/ZkTsRHwkwZZ04buvqBMXYLrqqLE=";
postCheckout = ''
cd "$out"
git rev-parse --short=8 HEAD > $out/COMMIT
date -u -d "@$(git log -1 --pretty=%ct)" "+%Y-%m-%dT%H:%M:%SZ" > $out/SOURCE_DATE_EPOCH
git -C externals submodule update --init --recursive \
volk \
json
'';
};
strictDeps = true;
__structuredAttrs = true;
patches = [
./qt-paths.patch
# https://github.com/shadps4-emu/shadps4-qtlauncher/pull/335
./version-directory.patch
];
postPatch = ''
substituteInPlace src/common/scm_rev.cpp.in \
--replace-fail @APP_VERSION@ ${finalAttrs.version} \
--replace-fail @GIT_REV@ $(cat COMMIT) \
--replace-fail @GIT_BRANCH@ ${finalAttrs.version} \
--replace-fail @GIT_DESC@ nixpkgs \
--replace-fail @BUILD_DATE@ $(cat SOURCE_DATE_EPOCH)
substituteInPlace src/common/versions.cpp \
--replace-fail "@shadps4-qt@" "$out"
substituteInPlace src/qt_gui/gui_settings.cpp \
--replace-fail "@shadps4-qt@" "$out"
substituteInPlace src/qt_gui/version_dialog.cpp \
--replace-fail "@shadps4-qt@" "$out"
'';
nativeBuildInputs = [
cmake
pkg-config
qt6.wrapQtAppsHook
];
buildInputs = [
fmt
sdl3
toml11
qt6.qtbase
qt6.qttools
qt6.qtmultimedia
];
cmakeFlags = [
(lib.cmakeBool "ENABLE_UPDATER" false)
(lib.cmakeBool "HIDE_VERSION_MANAGER" true)
];
postInstall = ''
substitute ${./versions.json} $out/share/versions.json \
--replace-fail @shadps4@ ${lib.getExe shadps4}
substitute ${./qt_ui.ini} $out/share/qt_ui.ini \
--replace-fail @shadps4@ ${lib.getExe shadps4}
'';
meta = {
inherit (shadps4.meta)
platforms
license
maintainers
;
description = shadps4.meta.description + " (Qt UI)";
homepage = "https://github.com/shadps4-emu/shadps4-qtlauncher";
mainProgram = "shadPS4QtLauncher";
};
})

View File

@@ -0,0 +1,50 @@
diff --git a/src/common/versions.cpp b/src/common/versions.cpp
index b935bb6..8625989 100644
--- a/src/common/versions.cpp
+++ b/src/common/versions.cpp
@@ -18,7 +18,7 @@ namespace VersionManager {
std::vector<Version> GetVersionList(std::filesystem::path const& path) {
std::filesystem::path cfg_path =
- path.empty() ? Common::FS::GetUserPath(Common::FS::PathType::LauncherDir) / "versions.json"
+ path.empty() ? "@shadps4-qt@/share/versions.json"
: path;
std::ifstream ifs{cfg_path};
@@ -76,7 +76,7 @@ std::vector<Version> GetVersionList(std::filesystem::path const& path) {
void SaveVersionList(std::vector<Version> const& versions, std::filesystem::path const& path) {
std::filesystem::path out_path =
- path.empty() ? Common::FS::GetUserPath(Common::FS::PathType::LauncherDir) / "versions.json"
+ path.empty() ? "@shadps4-qt@/share/versions.json"
: path;
json root = json::array();
diff --git a/src/qt_gui/gui_settings.cpp b/src/qt_gui/gui_settings.cpp
index 707131c..40e3f14 100644
--- a/src/qt_gui/gui_settings.cpp
+++ b/src/qt_gui/gui_settings.cpp
@@ -5,7 +5,9 @@
#include "gui_settings.h"
gui_settings::gui_settings(QObject* parent) : settings(parent) {
- m_settings = std::make_unique<QSettings>(ComputeSettingsDir() + "qt_ui.ini",
+ QString currentPath;
+ Common::FS::PathToQString(currentPath, "@shadps4-qt@/share/qt_ui.ini");
+ m_settings = std::make_unique<QSettings>(currentPath,
QSettings::Format::IniFormat, parent);
}
diff --git a/src/qt_gui/version_dialog.cpp b/src/qt_gui/version_dialog.cpp
index 2ed0418..13c6788 100644
--- a/src/qt_gui/version_dialog.cpp
+++ b/src/qt_gui/version_dialog.cpp
@@ -638,7 +638,7 @@ tr("First you need to choose a location to save the versions in\n'Path to save v
}
void VersionDialog::LoadInstalledList() {
- const auto path = Common::FS::GetUserPath(Common::FS::PathType::LauncherDir) / "versions.json";
+ const auto path = "@shadps4-qt@/share/versions.json";
auto versions = VersionManager::GetVersionList(path);
const auto& selected_version =
m_gui_settings->GetValue(gui::vm_versionSelected).toString().toStdString();

View File

@@ -0,0 +1,2 @@
[version_manager]
versionSelected=@shadps4@

View File

@@ -0,0 +1,37 @@
diff --git a/src/qt_gui/game_install_dialog.cpp b/src/qt_gui/game_install_dialog.cpp
index 8a9b94d..919d4a5 100644
--- a/src/qt_gui/game_install_dialog.cpp
+++ b/src/qt_gui/game_install_dialog.cpp
@@ -144,7 +144,9 @@ void GameInstallDialog::Save() {
// Check games directory.
auto gamesDirectory = m_gamesDirectory->text();
auto addonsDirectory = m_addonsDirectory->text();
+#ifndef HIDE_VERSION_MANAGER
auto versionDirectory = m_versionDirectory->text();
+#endif
if (gamesDirectory.isEmpty() || !QDir(gamesDirectory).exists() ||
!QDir::isAbsolutePath(gamesDirectory)) {
@@ -167,6 +169,7 @@ void GameInstallDialog::Save() {
}
}
+#ifndef HIDE_VERSION_MANAGER
if (versionDirectory.isEmpty() || !QDir::isAbsolutePath(versionDirectory)) {
QMessageBox::critical(this, tr("Error"),
"The value for location to install emulator versions is not valid.");
@@ -181,11 +184,14 @@ void GameInstallDialog::Save() {
return;
}
}
+#endif
// Save the directories
Config::addGameInstallDir(Common::FS::PathFromQString(gamesDirectory));
Config::setAddonInstallDir(Common::FS::PathFromQString(addonsDirectory));
+#ifndef HIDE_VERSION_MANAGER
m_gui_settings->SetValue(gui::vm_versionPath, versionDirectory);
+#endif
const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
Config::save(config_dir / "config.toml");

View File

@@ -0,0 +1,8 @@
[
{
"codename": "built-in",
"name": "built-in",
"path": "@shadps4@",
"type": 0
}
]

View File

@@ -1,28 +1,27 @@
{
lib,
gcc14Stdenv,
stdenv,
fetchFromGitHub,
makeWrapper,
nixosTests,
alsa-lib,
boost,
cli11,
cmake,
cryptopp,
game-music-emu,
glslang,
ffmpeg,
flac,
fluidsynth,
fmt,
half,
jack2,
libdecor,
libGL,
libpng,
libpulseaudio,
libunwind,
libusb1,
libvorbis,
libxmp,
magic-enum,
miniz,
nlohmann_json,
libgbm,
libx11,
libxcb,
@@ -32,14 +31,14 @@
libxrandr,
libxscrnsaver,
libxtst,
magic-enum,
mpg123,
pipewire,
pkg-config,
pugixml,
rapidjson,
renderdoc,
robin-map,
sdl3,
sdl3-mixer,
sndio,
stb,
toml11,
@@ -49,29 +48,38 @@
vulkan-memory-allocator,
xbyak,
xxhash,
zlib-ng,
zydis,
zlib,
nix-update-script,
}:
# relies on std::sinf & co, which was broken in GCC until GCC 14: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79700
gcc14Stdenv.mkDerivation (finalAttrs: {
stdenv.mkDerivation (finalAttrs: {
pname = "shadps4";
version = "0.13.0";
version = "0.15.0";
src = fetchFromGitHub {
owner = "shadps4-emu";
repo = "shadPS4";
tag = "v.${finalAttrs.version}";
hash = "sha256-zc3zhFTphty/vwioFEOfhgXttpD9MG2F7+YJYcW0H2w=";
fetchSubmodules = true;
hash = "sha256-76rbxOf4grDWPVILy8nF35wQ6/NcxHQkmiQOB0u4oJo=";
leaveDotGit = true;
postFetch = ''
postCheckout = ''
cd "$out"
git rev-parse --short=8 HEAD > $out/COMMIT
date -u -d "@$(git log -1 --pretty=%ct)" "+%Y-%m-%dT%H:%M:%SZ" > $out/SOURCE_DATE_EPOCH
find "$out" -name .git -print0 | xargs -0 rm -rf
git -C externals submodule update --init --recursive \
glslang \
zydis \
sirit \
tracy \
ext-libusb \
discord-rpc \
hwinfo \
openal-soft \
dear_imgui \
LibAtrac9 \
aacdec/fdk-aac
'';
};
@@ -82,27 +90,26 @@ gcc14Stdenv.mkDerivation (finalAttrs: {
--replace-fail @GIT_BRANCH@ ${finalAttrs.version} \
--replace-fail @GIT_DESC@ nixpkgs \
--replace-fail @BUILD_DATE@ $(cat SOURCE_DATE_EPOCH)
substituteInPlace src/core/libraries/np/trophy_ui.cpp \
--replace-fail "MIX_SetMasterGain" "MIX_SetMixerGain" \
--replace-fail "MIX_GetMasterGain" "MIX_GetMixerGain"
'';
buildInputs = [
alsa-lib
boost
cli11
cryptopp
game-music-emu
glslang
ffmpeg
flac
fluidsynth
fmt
half
jack2
libdecor
libGL
libpng
libpulseaudio
libunwind
libusb1
libvorbis
libxmp
libx11
libxcb
libxcursor
@@ -111,14 +118,17 @@ gcc14Stdenv.mkDerivation (finalAttrs: {
libxrandr
libxscrnsaver
libxtst
libgbm
magic-enum
mpg123
miniz
libgbm
nlohmann_json
pipewire
pugixml
rapidjson
renderdoc
robin-map
sdl3
sdl3-mixer
sndio
stb
toml11
@@ -128,13 +138,13 @@ gcc14Stdenv.mkDerivation (finalAttrs: {
vulkan-memory-allocator
xbyak
xxhash
zlib-ng
zydis
zlib
];
nativeBuildInputs = [
cmake
pkg-config
makeWrapper
];
cmakeFlags = [
@@ -145,15 +155,14 @@ gcc14Stdenv.mkDerivation (finalAttrs: {
cmakeBuildType = "RelWithDebugInfo";
dontStrip = true;
installPhase = ''
runHook preInstall
install -D -t $out/bin shadps4
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
postInstall = ''
wrapProgram $out/bin/shadps4 \
--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath [
libpulseaudio
pipewire
]
}
'';
runtimeDependencies = [