diff --git a/.github/ISSUE_TEMPLATE/game-bug-report.yaml b/.github/ISSUE_TEMPLATE/game-bug-report.yaml
index 848877037..6047bed42 100644
--- a/.github/ISSUE_TEMPLATE/game-bug-report.yaml
+++ b/.github/ISSUE_TEMPLATE/game-bug-report.yaml
@@ -35,7 +35,7 @@ body:
required: true
- label: I have disabled all patches and cheats and the issue is still present.
required: true
- - label: I have all the required [system modules](https://github.com/shadps4-emu/shadPS4/wiki/I.-Quick-start-%5BUsers%5D#4-adding-modules) installed.
+ - label: I have all the required [system modules](https://github.com/shadps4-emu/shadPS4/wiki/I.-Quick-start-%5BUsers%5D#4-dumping-firmware-modules) installed.
required: true
- type: textarea
id: desc
diff --git a/.github/linux-appimage-qt.sh b/.github/linux-appimage-qt.sh
deleted file mode 100755
index 776eed61e..000000000
--- a/.github/linux-appimage-qt.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-# SPDX-FileCopyrightText: 2024 shadPS4 Emulator Project
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-#!/bin/bash
-
-if [[ -z $GITHUB_WORKSPACE ]]; then
- GITHUB_WORKSPACE="${PWD%/*}"
-fi
-
-export Qt6_DIR="/usr/lib/qt6"
-export PATH="$Qt6_DIR/bin:$PATH"
-export EXTRA_QT_PLUGINS="waylandcompositor"
-export EXTRA_PLATFORM_PLUGINS="libqwayland-egl.so;libqwayland-generic.so"
-
-# Prepare Tools for building the AppImage
-wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
-wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
-wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-checkrt/releases/download/continuous/linuxdeploy-plugin-checkrt-x86_64.sh
-
-chmod a+x linuxdeploy-x86_64.AppImage
-chmod a+x linuxdeploy-plugin-qt-x86_64.AppImage
-chmod a+x linuxdeploy-plugin-checkrt-x86_64.sh
-
-# Build AppImage
-./linuxdeploy-x86_64.AppImage --appdir AppDir
-./linuxdeploy-plugin-checkrt-x86_64.sh --appdir AppDir
-
-cp -a "$GITHUB_WORKSPACE/build/translations" AppDir/usr/bin
-
-./linuxdeploy-x86_64.AppImage --appdir AppDir -d "$GITHUB_WORKSPACE"/dist/net.shadps4.shadPS4.desktop -e "$GITHUB_WORKSPACE"/build/shadps4 -i "$GITHUB_WORKSPACE"/src/images/net.shadps4.shadPS4.svg --plugin qt
-rm AppDir/usr/plugins/multimedia/libgstreamermediaplugin.so
-./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage
-mv shadPS4-x86_64.AppImage Shadps4-qt.AppImage
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index be6a7ecdd..d1fab6354 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -17,14 +17,14 @@ jobs:
runs-on: ubuntu-24.04
continue-on-error: true
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- uses: fsfe/reuse-action@v5
clang-format:
runs-on: ubuntu-24.04
continue-on-error: true
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install
@@ -45,7 +45,7 @@ jobs:
shorthash: ${{ steps.vars.outputs.shorthash }}
fullhash: ${{ steps.vars.outputs.fullhash }}
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- name: Get date and git hash
id: vars
run: |
@@ -60,7 +60,7 @@ jobs:
runs-on: windows-2025
needs: get-info
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
with:
submodules: recursive
@@ -76,7 +76,7 @@ jobs:
${{ env.cache-name }}-
- name: Cache CMake Build
- uses: hendrikmuhs/ccache-action@v1.2.18
+ uses: hendrikmuhs/ccache-action@v1.2.19
env:
cache-name: ${{ runner.os }}-sdl-cache-cmake-build
with:
@@ -95,69 +95,11 @@ jobs:
name: shadps4-win64-sdl-${{ needs.get-info.outputs.date }}-${{ needs.get-info.outputs.shorthash }}
path: ${{github.workspace}}/build/shadPS4.exe
- windows-qt:
- runs-on: windows-2025
- needs: get-info
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: recursive
-
- - name: Setup Qt
- uses: jurplel/install-qt-action@v4
- with:
- version: 6.9.2
- host: windows
- target: desktop
- arch: win64_msvc2022_64
- archives: qtbase qttools
- modules: qtmultimedia
-
- - name: Cache CMake Configuration
- uses: actions/cache@v4
- env:
- cache-name: ${{ runner.os }}-qt-ninja-cache-cmake-configuration
- with:
- path: |
- ${{github.workspace}}/build
- key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- restore-keys: |
- ${{ env.cache-name }}-
-
- - name: Cache CMake Build
- uses: hendrikmuhs/ccache-action@v1.2.18
- env:
- cache-name: ${{ runner.os }}-qt-cache-cmake-build
- with:
- append-timestamp: false
- key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
-
- - name: Configure CMake
- run: cmake --fresh -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-
- - name: Build
- run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $env:NUMBER_OF_PROCESSORS
-
- - name: Deploy and Package
- run: |
- mkdir upload
- mkdir upload/qtplugins
- move build/shadPS4.exe upload
- cp dist/qt.conf upload/qt.conf
- windeployqt --plugindir upload/qtplugins --no-compiler-runtime --no-system-d3d-compiler --no-system-dxc-compiler --dir upload upload/shadPS4.exe
- Compress-Archive -Path upload/* -DestinationPath shadps4-win64-qt-${{ needs.get-info.outputs.date }}-${{ needs.get-info.outputs.shorthash }}.zip
-
- - name: Upload Windows Qt artifact
- uses: actions/upload-artifact@v4
- with:
- name: shadps4-win64-qt-${{ needs.get-info.outputs.date }}-${{ needs.get-info.outputs.shorthash }}
- path: upload/
-
macos-sdl:
runs-on: macos-15
needs: get-info
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
with:
submodules: recursive
@@ -178,7 +120,7 @@ jobs:
${{ env.cache-name }}-
- name: Cache CMake Build
- uses: hendrikmuhs/ccache-action@v1.2.18
+ uses: hendrikmuhs/ccache-action@v1.2.19
env:
cache-name: ${{runner.os}}-sdl-cache-cmake-build
with:
@@ -204,72 +146,11 @@ jobs:
name: shadps4-macos-sdl-${{ needs.get-info.outputs.date }}-${{ needs.get-info.outputs.shorthash }}
path: upload/
- macos-qt:
- runs-on: macos-15
- needs: get-info
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: recursive
-
- - name: Setup latest Xcode
- uses: maxim-lobanov/setup-xcode@v1
- with:
- xcode-version: latest
-
- - name: Setup Qt
- uses: jurplel/install-qt-action@v4
- with:
- version: 6.9.2
- host: mac
- target: desktop
- arch: clang_64
- archives: qtbase qttools
- modules: qtmultimedia
-
- - name: Cache CMake Configuration
- uses: actions/cache@v4
- env:
- cache-name: ${{ runner.os }}-qt-cache-cmake-configuration
- with:
- path: |
- ${{github.workspace}}/build
- key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- restore-keys: |
- ${{ env.cache-name }}-
-
- - name: Cache CMake Build
- uses: hendrikmuhs/ccache-action@v1.2.18
- env:
- cache-name: ${{runner.os}}-qt-cache-cmake-build
- with:
- append-timestamp: false
- create-symlink: true
- key: ${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- variant: sccache
-
- - name: Configure CMake
- run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_OSX_ARCHITECTURES=x86_64 -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-
- - name: Build
- run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(sysctl -n hw.ncpu)
-
- - name: Package and Upload macOS Qt artifact
- run: |
- mkdir upload
- mv ${{github.workspace}}/build/shadps4.app upload
- macdeployqt upload/shadps4.app
- tar cf shadps4-macos-qt.tar.gz -C upload .
- - uses: actions/upload-artifact@v4
- with:
- name: shadps4-macos-qt-${{ needs.get-info.outputs.date }}-${{ needs.get-info.outputs.shorthash }}
- path: shadps4-macos-qt.tar.gz
-
linux-sdl:
runs-on: ubuntu-24.04
needs: get-info
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
with:
submodules: recursive
@@ -293,7 +174,7 @@ jobs:
${{ env.cache-name }}-
- name: Cache CMake Build
- uses: hendrikmuhs/ccache-action@v1.2.18
+ uses: hendrikmuhs/ccache-action@v1.2.19
env:
cache-name: ${{ runner.os }}-sdl-cache-cmake-build
with:
@@ -326,63 +207,11 @@ jobs:
name: shadps4-linux-sdl-${{ needs.get-info.outputs.date }}-${{ needs.get-info.outputs.shorthash }}
path: Shadps4-sdl.AppImage
- linux-qt:
- runs-on: ubuntu-24.04
- needs: get-info
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: recursive
-
- - name: Add LLVM repository
- run: |
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo add-apt-repository 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main'
-
- - name: Install dependencies
- run: sudo apt-get update && sudo apt install -y libx11-dev libxext-dev libwayland-dev libdecor-0-dev libxkbcommon-dev libglfw3-dev libgles2-mesa-dev libfuse2 clang-19 mold build-essential qt6-base-dev qt6-tools-dev qt6-multimedia-dev libasound2-dev libpulse-dev libopenal-dev libudev-dev
-
- - name: Cache CMake Configuration
- uses: actions/cache@v4
- env:
- cache-name: ${{ runner.os }}-qt-cache-cmake-configuration
- with:
- path: |
- ${{github.workspace}}/build
- key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- restore-keys: |
- ${{ env.cache-name }}-
-
- - name: Cache CMake Build
- uses: hendrikmuhs/ccache-action@v1.2.18
- env:
- cache-name: ${{ runner.os }}-qt-cache-cmake-build
- with:
- append-timestamp: false
- key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
-
- - name: Configure CMake
- run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=mold" -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=mold" -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-
- - name: Build
- run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(nproc)
-
- - name: Run AppImage packaging script
- run: ./.github/linux-appimage-qt.sh
-
- - name: Package and Upload Linux Qt artifact
- run: |
- tar cf shadps4-linux-qt.tar.gz -C ${{github.workspace}}/build shadps4
- - uses: actions/upload-artifact@v4
- with:
- name: shadps4-linux-qt-${{ needs.get-info.outputs.date }}-${{ needs.get-info.outputs.shorthash }}
- path: Shadps4-qt.AppImage
-
linux-sdl-gcc:
runs-on: ubuntu-24.04
needs: get-info
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
with:
submodules: recursive
@@ -401,7 +230,7 @@ jobs:
${{ env.cache-name }}-
- name: Cache CMake Build
- uses: hendrikmuhs/ccache-action@v1.2.18
+ uses: hendrikmuhs/ccache-action@v1.2.19
env:
cache-name: ${{ runner.os }}-sdl-gcc-cache-cmake-build
with:
@@ -414,51 +243,20 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(nproc)
- linux-qt-gcc:
- runs-on: ubuntu-24.04
- needs: get-info
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: recursive
-
- - name: Install dependencies
- run: sudo apt-get update && sudo apt install -y libx11-dev libxext-dev libwayland-dev libdecor-0-dev libxkbcommon-dev libglfw3-dev libgles2-mesa-dev libfuse2 gcc-14 mold build-essential qt6-base-dev qt6-tools-dev qt6-multimedia-dev libasound2-dev libpulse-dev libopenal-dev libudev-dev
-
- - name: Cache CMake Configuration
- uses: actions/cache@v4
- env:
- cache-name: ${{ runner.os }}-qt-gcc-cache-cmake-configuration
- with:
- path: |
- ${{github.workspace}}/build
- key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- restore-keys: |
- ${{ env.cache-name }}-
-
- - name: Cache CMake Build
- uses: hendrikmuhs/ccache-action@v1.2.18
- env:
- cache-name: ${{ runner.os }}-qt-gcc-cache-cmake-build
- with:
- append-timestamp: false
- key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
-
- - name: Configure CMake
- run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=mold" -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=mold" -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-
- - name: Build
- run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(nproc)
-
pre-release:
if: github.ref == 'refs/heads/main' && github.repository == 'shadps4-emu/shadPS4' && github.event_name == 'push'
- needs: [get-info, windows-sdl, windows-qt, macos-sdl, macos-qt, linux-sdl, linux-qt]
+ needs: [get-info, windows-sdl, macos-sdl, linux-sdl]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
- uses: actions/download-artifact@v4
+ uses: actions/download-artifact@v5
with:
path: ./artifacts
+
+ - name: Make SDL artifacts executable
+ run: |
+ chmod -R a+x ./artifacts/shadps4-linux-sdl-*
+ chmod -R a+x ./artifacts/shadps4-macos-sdl-*
- name: Compress individual directories (without parent directory)
run: |
diff --git a/.github/workflows/scripts/update_translation.sh b/.github/workflows/scripts/update_translation.sh
deleted file mode 100755
index 6b8c76d22..000000000
--- a/.github/workflows/scripts/update_translation.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-set -e
-
-sudo apt-get -y install qt6-l10n-tools python3
-
-SCRIPT_PATH="src/qt_gui/translations/update_translation.sh"
-
-chmod +x "$SCRIPT_PATH"
-
-PATH=/usr/lib/qt6/bin:$PATH "$SCRIPT_PATH"
\ No newline at end of file
diff --git a/.github/workflows/update_translation.yml b/.github/workflows/update_translation.yml
deleted file mode 100644
index 6eb9db87a..000000000
--- a/.github/workflows/update_translation.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-name: Update Translation
-
-on:
- schedule:
- - cron: "0 0 * * *" # Every day at 12am UTC.
- workflow_dispatch: # As well as manually.
-
-jobs:
- update:
- if: github.repository == 'shadps4-emu/shadPS4'
- name: "Update Translation"
- runs-on: ubuntu-22.04
- steps:
- - uses: actions/checkout@v4
-
- - name: Set execution permissions for the script
- run: chmod +x ./.github/workflows/scripts/update_translation.sh
-
- - name: Update Base Translation
- run: ./.github/workflows/scripts/update_translation.sh
-
- - name: Create Pull Request
- uses: peter-evans/create-pull-request@v7
- with:
- token: ${{ secrets.SHADPS4_TOKEN_REPO }}
- title: "Qt GUI: Update Translation"
- commit-message: "[ci skip] Qt GUI: Update Translation."
- body: "Daily update of translation sources."
- branch: update-translation
- delete-branch: true
diff --git a/.gitmodules b/.gitmodules
index 940c0417d..38aed89a0 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -91,18 +91,6 @@
path = externals/libpng
url = https://github.com/pnggroup/libpng
shallow = true
-[submodule "externals/MoltenVK/SPIRV-Cross"]
- path = externals/MoltenVK/SPIRV-Cross
- url = https://github.com/KhronosGroup/SPIRV-Cross
- shallow = true
-[submodule "externals/MoltenVK/MoltenVK"]
- path = externals/MoltenVK/MoltenVK
- url = https://github.com/KhronosGroup/MoltenVK
- shallow = true
-[submodule "externals/MoltenVK/cereal"]
- path = externals/MoltenVK/cereal
- url = https://github.com/USCiLab/cereal
- shallow = true
[submodule "externals/ext-libusb"]
path = externals/ext-libusb
url = https://github.com/shadps4-emu/ext-libusb.git
@@ -113,3 +101,15 @@
path = externals/hwinfo
url = https://github.com/shadps4-emu/ext-hwinfo
shallow = true
+[submodule "externals/ext-wepoll"]
+ path = externals/ext-wepoll
+ url = https://github.com/shadps4-emu/ext-wepoll.git
+ shallow = true
+ branch = dist
+[submodule "externals/MoltenVK"]
+ path = externals/MoltenVK
+ url = https://github.com/KhronosGroup/MoltenVK.git
+ shallow = true
+[submodule "externals/json"]
+ path = externals/json
+ url = https://github.com/nlohmann/json.git
diff --git a/CMakeDarwinPresets.json b/CMakeDarwinPresets.json
new file mode 100644
index 000000000..10824a66c
--- /dev/null
+++ b/CMakeDarwinPresets.json
@@ -0,0 +1,22 @@
+{
+ "version": 9,
+ "cmakeMinimumRequired": {
+ "major": 3,
+ "minor": 30,
+ "patch": 0
+ },
+ "configurePresets": [
+ {
+ "name": "x64-Clang-Base",
+ "hidden": true,
+ "generator": "Ninja",
+ "binaryDir": "${sourceDir}/Build/${presetName}",
+ "cacheVariables": {
+ "CMAKE_C_COMPILER": "clang",
+ "CMAKE_CXX_COMPILER": "clang++",
+ "CMAKE_INSTALL_PREFIX": "${sourceDir}/Build/${presetName}",
+ "CMAKE_OSX_ARCHITECTURES": "x86_64"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e6400542c..83d209cdf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,7 +31,6 @@ if(UNIX AND NOT APPLE)
endif()
endif()
-option(ENABLE_QT_GUI "Enable the Qt GUI. If not selected then the emulator uses a minimal SDL-based UI instead" OFF)
option(ENABLE_DISCORD_RPC "Enable the Discord RPC integration" ON)
option(ENABLE_UPDATER "Enables the options to updater" ON)
@@ -203,27 +202,23 @@ execute_process(
# Set Version
set(EMULATOR_VERSION_MAJOR "0")
-set(EMULATOR_VERSION_MINOR "11")
-set(EMULATOR_VERSION_PATCH "0")
+set(EMULATOR_VERSION_MINOR "12")
+set(EMULATOR_VERSION_PATCH "1")
set_source_files_properties(src/shadps4.rc PROPERTIES COMPILE_DEFINITIONS "EMULATOR_VERSION_MAJOR=${EMULATOR_VERSION_MAJOR};EMULATOR_VERSION_MINOR=${EMULATOR_VERSION_MINOR};EMULATOR_VERSION_PATCH=${EMULATOR_VERSION_PATCH}")
-set(APP_VERSION "${EMULATOR_VERSION_MAJOR}.${EMULATOR_VERSION_MINOR}.${EMULATOR_VERSION_PATCH}")
-set(APP_IS_RELEASE true)
+set(APP_VERSION "${EMULATOR_VERSION_MAJOR}.${EMULATOR_VERSION_MINOR}.${EMULATOR_VERSION_PATCH} WIP")
+set(APP_IS_RELEASE false)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/common/scm_rev.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/src/common/scm_rev.cpp" @ONLY)
message("-- end git things, remote: ${GIT_REMOTE_NAME}, branch: ${GIT_BRANCH}, link: ${GIT_REMOTE_URL}")
string(TOLOWER "${GIT_REMOTE_URL}" GIT_REMOTE_URL_LOWER)
-if(NOT GIT_REMOTE_URL_LOWER MATCHES "shadps4-emu/shadps4" OR NOT GIT_BRANCH STREQUAL "main")
+if(NOT (GIT_REMOTE_URL_LOWER MATCHES "shadps4-emu/shadps4" AND (GIT_BRANCH STREQUAL "main" OR "$ENV{GITHUB_REF}" MATCHES "refs/tags/")))
message(STATUS "not main, disabling auto update")
set(ENABLE_UPDATER OFF)
endif()
-if(WIN32 AND ENABLE_QT_GUI AND NOT CMAKE_PREFIX_PATH)
- include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/DetectQtInstallation.cmake")
-endif ()
-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(Boost 1.84.0 CONFIG)
find_package(FFmpeg 5.1.2 MODULE)
@@ -237,7 +232,7 @@ find_package(SDL3 3.1.2 CONFIG)
find_package(stb MODULE)
find_package(toml11 4.2.0 CONFIG)
find_package(tsl-robin-map 1.3.0 CONFIG)
-find_package(VulkanHeaders 1.4.324 CONFIG)
+find_package(VulkanHeaders 1.4.329 CONFIG)
find_package(VulkanMemoryAllocator 3.1.0 CONFIG)
find_package(xbyak 7.07 CONFIG)
find_package(xxHash 0.8.2 MODULE)
@@ -262,30 +257,6 @@ endif()
add_subdirectory(externals)
include_directories(src)
-if(ENABLE_QT_GUI)
- find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent LinguistTools Network Multimedia)
- qt_standard_project_setup()
- set(CMAKE_AUTORCC ON)
- set(CMAKE_AUTOMOC ON)
- set(CMAKE_AUTOUIC ON)
-
- set(QT_TRANSLATIONS "${PROJECT_SOURCE_DIR}/src/qt_gui/translations")
- file(GLOB_RECURSE TRANSLATIONS_TS ${QT_TRANSLATIONS}/*.ts)
-
- set_source_files_properties(${TRANSLATIONS_TS} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/translations")
- qt_add_translation(TRANSLATIONS_QM ${TRANSLATIONS_TS})
-
- set(TRANSLATIONS_QRC ${CMAKE_CURRENT_BINARY_DIR}/translations/translations.qrc)
- file(WRITE ${TRANSLATIONS_QRC} "\n")
- foreach (QM ${TRANSLATIONS_QM})
- get_filename_component(QM_FILE ${QM} NAME)
- file(APPEND ${TRANSLATIONS_QRC} "${QM_FILE}\n")
- endforeach (QM)
- file(APPEND ${TRANSLATIONS_QRC} "")
-
- qt_add_resources(TRANSLATIONS ${TRANSLATIONS_QRC})
-endif()
-
set(AJM_LIB src/core/libraries/ajm/ajm.cpp
src/core/libraries/ajm/ajm.h
src/core/libraries/ajm/ajm_at9.cpp
@@ -380,6 +351,10 @@ set(NETWORK_LIBS src/core/libraries/network/http.cpp
src/core/libraries/network/net_ctl_codes.h
src/core/libraries/network/net_util.cpp
src/core/libraries/network/net_util.h
+ src/core/libraries/network/net_epoll.cpp
+ src/core/libraries/network/net_epoll.h
+ src/core/libraries/network/net_resolver.cpp
+ src/core/libraries/network/net_resolver.h
src/core/libraries/network/net_error.h
src/core/libraries/network/net.h
src/core/libraries/network/ssl.cpp
@@ -557,6 +532,9 @@ set(RANDOM_LIB src/core/libraries/random/random.cpp
set(USBD_LIB src/core/libraries/usbd/usbd.cpp
src/core/libraries/usbd/usbd.h
+ src/core/libraries/usbd/usb_backend.h
+ src/core/libraries/usbd/emulated/skylander.cpp
+ src/core/libraries/usbd/emulated/skylander.h
)
set(FIBER_LIB src/core/libraries/fiber/fiber_context.s
@@ -596,6 +574,8 @@ set(NP_LIBS src/core/libraries/np/np_error.h
src/core/libraries/np/np_auth.h
src/core/libraries/np/np_profile_dialog.cpp
src/core/libraries/np/np_profile_dialog.h
+ src/core/libraries/np/np_sns_facebook_dialog.cpp
+ src/core/libraries/np/np_sns_facebook_dialog.h
)
set(ZLIB_LIB src/core/libraries/zlib/zlib.cpp
@@ -637,6 +617,7 @@ set(COMPANION_LIBS src/core/libraries/companion/companion_httpd.cpp
)
set(DEV_TOOLS src/core/devtools/layer.cpp
src/core/devtools/layer.h
+ src/core/devtools/layer_extra.cpp
src/core/devtools/options.cpp
src/core/devtools/options.h
src/core/devtools/gcn/gcn_context_regs.cpp
@@ -844,6 +825,8 @@ set(CORE src/core/aerolib/stubs.cpp
${DEV_TOOLS}
src/core/debug_state.cpp
src/core/debug_state.h
+ src/core/debugger.cpp
+ src/core/debugger.h
src/core/linker.cpp
src/core/linker.h
src/core/memory.cpp
@@ -865,10 +848,10 @@ if (ARCHITECTURE STREQUAL "x86_64")
src/core/cpu_patches.h)
endif()
-set(SHADER_RECOMPILER src/shader_recompiler/exception.h
- src/shader_recompiler/profile.h
+set(SHADER_RECOMPILER src/shader_recompiler/profile.h
src/shader_recompiler/recompiler.cpp
src/shader_recompiler/recompiler.h
+ src/shader_recompiler/resource.h
src/shader_recompiler/info.h
src/shader_recompiler/params.h
src/shader_recompiler/runtime_info.h
@@ -966,17 +949,24 @@ set(SHADER_RECOMPILER src/shader_recompiler/exception.h
src/shader_recompiler/ir/value.h
)
-set(VIDEO_CORE src/video_core/amdgpu/liverpool.cpp
+set(VIDEO_CORE src/video_core/amdgpu/cb_db_extent.h
+ src/video_core/amdgpu/liverpool.cpp
src/video_core/amdgpu/liverpool.h
src/video_core/amdgpu/pixel_format.cpp
src/video_core/amdgpu/pixel_format.h
src/video_core/amdgpu/pm4_cmds.h
src/video_core/amdgpu/pm4_opcodes.h
+ src/video_core/amdgpu/regs_color.h
+ src/video_core/amdgpu/regs_depth.h
+ src/video_core/amdgpu/regs.cpp
+ src/video_core/amdgpu/regs.h
+ src/video_core/amdgpu/regs_primitive.h
+ src/video_core/amdgpu/regs_shader.h
+ src/video_core/amdgpu/regs_texture.h
+ src/video_core/amdgpu/regs_vertex.h
src/video_core/amdgpu/resource.h
src/video_core/amdgpu/tiling.cpp
src/video_core/amdgpu/tiling.h
- src/video_core/amdgpu/types.h
- src/video_core/amdgpu/default_context.cpp
src/video_core/buffer_cache/buffer.cpp
src/video_core/buffer_cache/buffer.h
src/video_core/buffer_cache/buffer_cache.cpp
@@ -1073,116 +1063,28 @@ set(EMULATOR src/emulator.cpp
src/sdl_window.cpp
)
-# The above is shared in SDL and Qt version (TODO share them all)
-
-if(ENABLE_QT_GUI)
-qt_add_resources(RESOURCE_FILES src/shadps4.qrc)
-
-if (ENABLE_UPDATER)
- set(UPDATER src/qt_gui/check_update.cpp
- src/qt_gui/check_update.h
- )
-endif()
-
-set(QT_GUI src/qt_gui/about_dialog.cpp
- src/qt_gui/about_dialog.h
- src/qt_gui/about_dialog.ui
- src/qt_gui/background_music_player.cpp
- src/qt_gui/background_music_player.h
- src/qt_gui/cheats_patches.cpp
- src/qt_gui/cheats_patches.h
- src/qt_gui/compatibility_info.cpp
- src/qt_gui/compatibility_info.h
- src/qt_gui/control_settings.cpp
- src/qt_gui/control_settings.h
- src/qt_gui/control_settings.ui
- src/qt_gui/kbm_gui.cpp
- src/qt_gui/kbm_gui.h
- src/qt_gui/kbm_gui.ui
- src/qt_gui/main_window_ui.h
- src/qt_gui/main_window.cpp
- src/qt_gui/main_window.h
- src/qt_gui/gui_context_menus.h
- src/qt_gui/game_list_utils.h
- src/qt_gui/game_info.cpp
- src/qt_gui/game_info.h
- src/qt_gui/game_list_frame.cpp
- src/qt_gui/game_list_frame.h
- src/qt_gui/game_grid_frame.cpp
- src/qt_gui/game_grid_frame.h
- src/qt_gui/game_install_dialog.cpp
- src/qt_gui/game_install_dialog.h
- src/qt_gui/trophy_viewer.cpp
- src/qt_gui/trophy_viewer.h
- src/qt_gui/elf_viewer.cpp
- src/qt_gui/elf_viewer.h
- src/qt_gui/kbm_config_dialog.cpp
- src/qt_gui/kbm_config_dialog.h
- src/qt_gui/kbm_help_dialog.cpp
- src/qt_gui/kbm_help_dialog.h
- src/qt_gui/main_window_themes.cpp
- src/qt_gui/main_window_themes.h
- src/qt_gui/log_presets_dialog.cpp
- src/qt_gui/log_presets_dialog.h
- src/qt_gui/settings_dialog.cpp
- src/qt_gui/settings_dialog.h
- src/qt_gui/settings_dialog.ui
- src/qt_gui/main.cpp
- src/qt_gui/gui_settings.cpp
- src/qt_gui/gui_settings.h
- src/qt_gui/settings.cpp
- src/qt_gui/settings.h
- src/qt_gui/sdl_event_wrapper.cpp
- src/qt_gui/sdl_event_wrapper.h
- src/qt_gui/hotkeys.h
- src/qt_gui/hotkeys.cpp
- src/qt_gui/hotkeys.ui
- ${EMULATOR}
- ${RESOURCE_FILES}
- ${TRANSLATIONS}
- ${UPDATER}
+add_executable(shadps4
+ ${AUDIO_CORE}
+ ${IMGUI}
+ ${INPUT}
+ ${COMMON}
+ ${CORE}
+ ${SHADER_RECOMPILER}
+ ${VIDEO_CORE}
+ ${EMULATOR}
+ ${QUASIFS}
+ ${HOSTIO}
+ src/main.cpp
+ src/emulator.cpp
+ src/emulator.h
+ src/sdl_window.h
+ src/sdl_window.cpp
)
-endif()
-
-if (ENABLE_QT_GUI)
- qt_add_executable(shadps4
- ${AUDIO_CORE}
- ${IMGUI}
- ${INPUT}
- ${QT_GUI}
- ${COMMON}
- ${CORE}
- ${SHADER_RECOMPILER}
- ${VIDEO_CORE}
- ${EMULATOR}
- ${QUASIFS}
- ${HOSTIO}
- src/images/shadPS4.icns
- )
-else()
- add_executable(shadps4
- ${AUDIO_CORE}
- ${IMGUI}
- ${INPUT}
- ${COMMON}
- ${CORE}
- ${SHADER_RECOMPILER}
- ${VIDEO_CORE}
- ${EMULATOR}
- ${QUASIFS}
- ${HOSTIO}
- src/main.cpp
- src/emulator.cpp
- src/emulator.h
- src/sdl_window.h
- src/sdl_window.cpp
- )
-endif()
create_target_directory_groups(shadps4)
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg Dear_ImGui gcn half::half ZLIB::ZLIB PNG::PNG)
-target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator LibAtrac9 sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::glslang SDL3::SDL3 pugixml::pugixml stb::headers libusb::usb lfreist-hwinfo::hwinfo)
+target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator LibAtrac9 sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::glslang SDL3::SDL3 pugixml::pugixml stb::headers libusb::usb lfreist-hwinfo::hwinfo nlohmann_json::nlohmann_json)
target_compile_definitions(shadps4 PRIVATE IMGUI_USER_CONFIG="imgui/imgui_config.h")
target_compile_definitions(Dear_ImGui PRIVATE IMGUI_USER_CONFIG="${PROJECT_SOURCE_DIR}/src/imgui/imgui_config.h")
@@ -1202,22 +1104,11 @@ endif()
if (APPLE)
# Include MoltenVK, along with an ICD file so it can be found by the system Vulkan loader if used for loading layers.
- if (ENABLE_QT_GUI)
- set(MVK_BUNDLE_PATH "Resources/vulkan/icd.d")
- set_property(TARGET shadps4 APPEND PROPERTY BUILD_RPATH "@executable_path/../${MVK_BUNDLE_PATH}")
- set(MVK_DST ${CMAKE_CURRENT_BINARY_DIR}/shadps4.app/Contents/${MVK_BUNDLE_PATH})
-
- add_custom_command(
- OUTPUT ${MVK_DST}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${MVK_DST})
- else()
- set_property(TARGET shadps4 APPEND PROPERTY BUILD_RPATH "@executable_path")
- set(MVK_DST ${CMAKE_CURRENT_BINARY_DIR})
- endif()
-
- set(MVK_DYLIB_SRC ${CMAKE_CURRENT_BINARY_DIR}/externals/MoltenVK/libMoltenVK.dylib)
+ set_property(TARGET shadps4 APPEND PROPERTY BUILD_RPATH "@executable_path")
+ set(MVK_DST ${CMAKE_CURRENT_BINARY_DIR})
+ set(MVK_DYLIB_SRC ${CMAKE_CURRENT_BINARY_DIR}/externals/MoltenVK/MoltenVK/libMoltenVK.dylib)
set(MVK_DYLIB_DST ${MVK_DST}/libMoltenVK.dylib)
- set(MVK_ICD_SRC ${CMAKE_CURRENT_SOURCE_DIR}/externals/MoltenVK/MoltenVK/MoltenVK/icd/MoltenVK_icd.json)
+ set(MVK_ICD_SRC ${CMAKE_CURRENT_SOURCE_DIR}/externals/MoltenVK/MoltenVK/icd/MoltenVK_icd.json)
set(MVK_ICD_DST ${MVK_DST}/MoltenVK_icd.json)
add_custom_command(
@@ -1234,23 +1125,15 @@ if (APPLE)
if (ARCHITECTURE STREQUAL "x86_64")
# Reserve system-managed memory space.
- target_link_options(shadps4 PRIVATE -Wl,-ld_classic,-no_pie,-no_fixup_chains,-no_huge,-pagezero_size,0x4000,-segaddr,TCB_SPACE,0x4000,-segaddr,SYSTEM_MANAGED,0x400000,-segaddr,SYSTEM_RESERVED,0x7FFFFC000,-image_base,0x20000000000)
+ target_link_options(shadps4 PRIVATE -Wl,-ld_classic,-no_pie,-no_fixup_chains,-no_huge,-pagezero_size,0x4000,-segaddr,TCB_SPACE,0x4000,-segaddr,SYSTEM_MANAGED,0x400000,-segaddr,SYSTEM_RESERVED,0x7FFFFC000,-segaddr,USER_AREA,0x7000000000,-image_base,0x700000000000)
endif()
# Replacement for std::chrono::time_zone
target_link_libraries(shadps4 PRIVATE date::date-tz epoll-shim)
endif()
-if (ENABLE_QT_GUI)
- target_link_libraries(shadps4 PRIVATE Qt6::Widgets Qt6::Concurrent Qt6::Network Qt6::Multimedia)
- add_definitions(-DENABLE_QT_GUI)
- if (ENABLE_UPDATER)
- add_definitions(-DENABLE_UPDATER)
- endif()
-endif()
-
if (WIN32)
- target_link_libraries(shadps4 PRIVATE mincore)
+ target_link_libraries(shadps4 PRIVATE mincore wepoll)
if (MSVC)
# MSVC likes putting opinions on what people can use, disable:
@@ -1284,6 +1167,13 @@ if (WIN32)
else()
target_link_options(shadps4 PRIVATE -Wl,--stack,2097152)
endif()
+
+ # Change base image address
+ if (MSVC)
+ target_link_options(shadps4 PRIVATE /BASE:0x700000000000)
+ else()
+ target_link_options(shadps4 PRIVATE -Wl,--image-base=0x700000000000)
+ endif()
endif()
if (WIN32)
@@ -1319,25 +1209,6 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/imgui/renderer)
add_dependencies(shadps4 ImGui_Resources)
target_include_directories(shadps4 PRIVATE ${IMGUI_RESOURCES_INCLUDE})
-if (ENABLE_QT_GUI)
- set_target_properties(shadps4 PROPERTIES
-# WIN32_EXECUTABLE ON
- MACOSX_BUNDLE ON
- MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/dist/MacOSBundleInfo.plist.in"
- MACOSX_BUNDLE_ICON_FILE "shadPS4.icns"
- MACOSX_BUNDLE_SHORT_VERSION_STRING "${APP_VERSION}"
- )
-
- set_source_files_properties(src/images/shadPS4.icns PROPERTIES
- MACOSX_PACKAGE_LOCATION Resources)
-endif()
-
-if (UNIX AND NOT APPLE)
- if (ENABLE_QT_GUI)
- find_package(OpenSSL REQUIRED)
- target_link_libraries(shadps4 PRIVATE ${OPENSSL_LIBRARIES})
- endif()
-endif()
# Discord RPC
if (ENABLE_DISCORD_RPC)
@@ -1346,10 +1217,3 @@ endif()
# Install rules
install(TARGETS shadps4 BUNDLE DESTINATION .)
-
-if (ENABLE_QT_GUI AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
- install(FILES "dist/net.shadps4.shadPS4.desktop" DESTINATION "share/applications")
- install(FILES "dist/net.shadps4.shadPS4.metainfo.xml" DESTINATION "share/metainfo")
- install(FILES ".github/shadps4.png" DESTINATION "share/icons/hicolor/512x512/apps" RENAME "net.shadps4.shadPS4.png")
- install(FILES "src/images/net.shadps4.shadPS4.svg" DESTINATION "share/icons/hicolor/scalable/apps")
-endif()
diff --git a/CMakePresets.json b/CMakePresets.json
index bd1aba36e..c34007a34 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -15,15 +15,6 @@
"CMAKE_BUILD_TYPE": "Debug"
}
},
- {
- "name": "x64-Clang-Debug-Qt",
- "displayName": "Clang x64 Debug with Qt",
- "inherits": ["x64-Clang-Base"],
- "cacheVariables": {
- "CMAKE_BUILD_TYPE": "Debug",
- "ENABLE_QT_GUI": "ON"
- }
- },
{
"name": "x64-Clang-Release",
"displayName": "Clang x64 Release",
@@ -32,15 +23,6 @@
"CMAKE_BUILD_TYPE": "Release"
}
},
- {
- "name": "x64-Clang-Release-Qt",
- "displayName": "Clang x64 Release with Qt",
- "inherits": ["x64-Clang-Base"],
- "cacheVariables": {
- "CMAKE_BUILD_TYPE": "Release",
- "ENABLE_QT_GUI": "ON"
- }
- },
{
"name": "x64-Clang-RelWithDebInfo",
"displayName": "Clang x64 RelWithDebInfo",
@@ -48,15 +30,6 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
- },
- {
- "name": "x64-Clang-RelWithDebInfo-Qt",
- "displayName": "Clang x64 RelWithDebInfo with Qt",
- "inherits": ["x64-Clang-Base"],
- "cacheVariables": {
- "CMAKE_BUILD_TYPE": "RelWithDebInfo",
- "ENABLE_QT_GUI": "ON"
- }
}
]
}
\ No newline at end of file
diff --git a/CMakeSettings.json b/CMakeSettings.json
index e1ed36887..bb522fcfc 100644
--- a/CMakeSettings.json
+++ b/CMakeSettings.json
@@ -12,18 +12,6 @@
"inheritEnvironments": [ "clang_cl_x64_x64" ],
"intelliSenseMode": "windows-clang-x64"
},
- {
- "name": "x64-Clang-Release-Qt",
- "generator": "Ninja",
- "configurationType": "Release",
- "buildRoot": "${projectDir}\\Build\\${name}",
- "installRoot": "${projectDir}\\Install\\${name}",
- "cmakeCommandArgs": "-DENABLE_QT_GUI=ON",
- "buildCommandArgs": "",
- "ctestCommandArgs": "",
- "inheritEnvironments": [ "clang_cl_x64_x64" ],
- "intelliSenseMode": "windows-clang-x64"
- },
{
"name": "x64-Clang-Debug",
"generator": "Ninja",
@@ -36,18 +24,6 @@
"inheritEnvironments": [ "clang_cl_x64_x64" ],
"intelliSenseMode": "windows-clang-x64"
},
- {
- "name": "x64-Clang-Debug-Qt",
- "generator": "Ninja",
- "configurationType": "Debug",
- "buildRoot": "${projectDir}\\Build\\${name}",
- "installRoot": "${projectDir}\\Install\\${name}",
- "cmakeCommandArgs": "-DENABLE_QT_GUI=ON",
- "buildCommandArgs": "",
- "ctestCommandArgs": "",
- "inheritEnvironments": [ "clang_cl_x64_x64" ],
- "intelliSenseMode": "windows-clang-x64"
- },
{
"name": "x64-Clang-RelWithDebInfo",
"generator": "Ninja",
@@ -59,18 +35,6 @@
"ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64_x64" ],
"intelliSenseMode": "windows-clang-x64"
- },
- {
- "name": "x64-Clang-RelWithDebInfo-Qt",
- "generator": "Ninja",
- "configurationType": "RelWithDebInfo",
- "buildRoot": "${projectDir}\\Build\\${name}",
- "installRoot": "${projectDir}\\Install\\${name}",
- "cmakeCommandArgs": "-DENABLE_QT_GUI=ON",
- "buildCommandArgs": "",
- "ctestCommandArgs": "",
- "inheritEnvironments": [ "clang_cl_x64_x64" ],
- "intelliSenseMode": "windows-clang-x64"
}
]
}
\ No newline at end of file
diff --git a/README.md b/README.md
index e08b47a55..dbb890f87 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,9 @@ SPDX-License-Identifier: GPL-2.0-or-later
**shadPS4** is an early **PlayStation 4** emulator for **Windows**, **Linux** and **macOS** written in C++.
+> [!IMPORTANT]
+> This is the emulator core, which does not include a GUI. If you just want to use the emulator as an end user, download the [**QtLauncher**](https://github.com/shadps4-emu/shadps4-qtlauncher/releases) instead.
+
If you encounter problems or have doubts, do not hesitate to look at the [**Quickstart**](https://github.com/shadps4-emu/shadPS4/wiki/I.-Quick-start-%5BUsers%5D).\
To verify that a game works, you can look at [**shadPS4 Game Compatibility**](https://github.com/shadps4-compatibility/shadps4-game-compatibility).\
To discuss shadPS4 development, suggest ideas or to ask for help, join our [**Discord server**](https://discord.gg/bFJxfftGW6).\
@@ -55,9 +58,6 @@ This project began for fun. Given our limited free time, it may take some time b
# Building
-> [!IMPORTANT]
-> If you want to use shadPS4 to play your games, you don't have to follow the build instructions, you can simply download the emulator from either the [**release tab**](https://github.com/shadps4-emu/shadPS4/releases) or the [**action tab**](https://github.com/shadps4-emu/shadPS4/actions).
-
## Windows
Check the build instructions for [**Windows**](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-windows.md).
@@ -73,6 +73,22 @@ Check the build instructions for [**macOS**](https://github.com/shadps4-emu/shad
> [!IMPORTANT]
> macOS users need at least macOS 15.4 to run shadPS4. Due to GPU issues there are currently heavy bugs on Intel Macs.
+# Usage examples
+
+> [!IMPORTANT]
+> For a user-friendly GUI, download the [**QtLauncher**](https://github.com/shadps4-emu/shadps4-qtlauncher/releases).
+
+To get the list of all available commands and also a more detailed description of what each command does, please refer to the `--help` flag's output.
+
+Below is a list of commonly used command patterns:
+```sh
+shadPS4 CUSA00001 # Searches for a game folder called CUSA00001 in the list of game install folders, and boots it.
+shadPS4 --fullscreen true --config-clean CUSA00001 # the game argument is always the last one,
+shadPS4 -g CUSA00001 --fullscreen true --config-clean # ...unless manually specified otherwise.
+shadPS4 /path/to/game.elf # Boots a PS4 ELF file directly. Useful if you want to boot an executable that is not named eboot.bin.
+shadPS4 CUSA00001 -- -flag1 -flag2 # Passes '-flag1' and '-flag2' to the game executable in argv.
+```
+
# Debugging and reporting issues
For more information on how to test, debug and report issues with the emulator or games, read the [**Debugging documentation**](https://github.com/shadps4-emu/shadPS4/blob/main/documents/Debugging/Debugging.md).
@@ -160,15 +176,6 @@ Logo is done by [**Xphalnos**](https://github.com/Xphalnos)
If you want to contribute, please read the [**CONTRIBUTING.md**](https://github.com/shadps4-emu/shadPS4/blob/main/CONTRIBUTING.md) file.\
Open a PR and we'll check it :)
-# Translations
-
-If you want to translate shadPS4 to your language we use [**Crowdin**](https://crowdin.com/project/shadps4-emulator).
-# Contributors
-
-
-
-
-
# Special Thanks
diff --git a/REUSE.toml b/REUSE.toml
index a94827b3b..18200ab28 100644
--- a/REUSE.toml
+++ b/REUSE.toml
@@ -5,13 +5,12 @@ path = [
"REUSE.toml",
"crowdin.yml",
"CMakeSettings.json",
+ "CMakeDarwinPresets.json",
"CMakeLinuxPresets.json",
"CMakeWindowsPresets.json",
"CMakePresets.json",
".github/FUNDING.yml",
".github/shadps4.png",
- ".github/workflows/scripts/update_translation.sh",
- ".github/workflows/update_translation.yml",
".gitmodules",
"dist/MacOSBundleInfo.plist.in",
"dist/net.shadps4.shadPS4.desktop",
@@ -75,9 +74,7 @@ path = [
"src/images/trophy.wav",
"src/images/hotkey.png",
"src/images/game_settings.png",
- "src/shadps4.qrc",
"src/shadps4.rc",
- "src/qt_gui/translations/update_translation.sh",
]
precedence = "aggregate"
SPDX-FileCopyrightText = "shadPS4 Emulator Project"
@@ -132,9 +129,4 @@ SPDX-License-Identifier = "MIT"
[[annotations]]
path = "src/video_core/host_shaders/fsr/*"
SPDX-FileCopyrightText = "Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved."
-SPDX-License-Identifier = "MIT"
-
-[[annotations]]
-path = "dist/qt.conf"
-SPDX-FileCopyrightText = "shadPS4 Emulator Project"
-SPDX-License-Identifier = "GPL-2.0-or-later"
+SPDX-License-Identifier = "MIT"
\ No newline at end of file
diff --git a/cmake/DetectQtInstallation.cmake b/cmake/DetectQtInstallation.cmake
deleted file mode 100644
index 650cc9745..000000000
--- a/cmake/DetectQtInstallation.cmake
+++ /dev/null
@@ -1,28 +0,0 @@
-# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-set(highest_version "0")
-set(CANDIDATE_DRIVES A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
-
-foreach(drive ${CANDIDATE_DRIVES})
- file(GLOB kits LIST_DIRECTORIES true CONFIGURE_DEPENDS "${drive}:/Qt/*/msvc*_64")
- foreach(kit IN LISTS kits)
- get_filename_component(version_dir "${kit}" DIRECTORY)
- get_filename_component(kit_version "${version_dir}" NAME)
-
- message(STATUS "DetectQtInstallation.cmake: Detected Qt: ${kit}")
-
- if (kit_version VERSION_GREATER highest_version)
- set(highest_version "${kit_version}")
- set(QT_PREFIX "${kit}")
-
- endif()
- endforeach()
-endforeach()
-
-if(QT_PREFIX)
- set(CMAKE_PREFIX_PATH "${QT_PREFIX}" CACHE PATH "Qt prefix auto‑detected" FORCE)
- message(STATUS "DetectQtInstallation.cmake: Choose newest Qt: ${QT_PREFIX}")
-else()
- message(STATUS "DetectQtInstallation.cmake: No Qt‑Directory found in :/Qt – please set CMAKE_PREFIX_PATH manually")
-endif()
diff --git a/crowdin.yml b/crowdin.yml
deleted file mode 100644
index 64363f02a..000000000
--- a/crowdin.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-files:
- - source: /src/qt_gui/translations/en_US.ts
- translation: /%original_path%/%locale_with_underscore%.ts
diff --git a/dist/net.shadps4.shadPS4.metainfo.xml b/dist/net.shadps4.shadPS4.metainfo.xml
index 2ad80f27a..ae07e79d8 100644
--- a/dist/net.shadps4.shadPS4.metainfo.xml
+++ b/dist/net.shadps4.shadPS4.metainfo.xml
@@ -37,6 +37,9 @@
Game
+
+ https://github.com/shadps4-emu/shadPS4/releases/tag/v.0.12.0
+
https://github.com/shadps4-emu/shadPS4/releases/tag/v.0.11.0
diff --git a/dist/qt.conf b/dist/qt.conf
deleted file mode 100644
index 0bb15d2e0..000000000
--- a/dist/qt.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[Paths]
-plugins = "./qtplugins"
\ No newline at end of file
diff --git a/documents/Debugging/Debugging.md b/documents/Debugging/Debugging.md
index d2eda61b7..8bb4b8fbd 100644
--- a/documents/Debugging/Debugging.md
+++ b/documents/Debugging/Debugging.md
@@ -11,6 +11,13 @@ This document covers information about debugging, troubleshooting and reporting
This section will guide you through setting up tools for debugging the emulator. This list will likely expand as more tools and platforms receive consistent setups.
+
+Linux
+
+RenderDoc doesn't work with Wayland, so to use it you have to run the emulator with `SDL_VIDEODRIVER=x11` set.
+
+
+
Windows and Visual Studio
diff --git a/documents/building-linux.md b/documents/building-linux.md
index 00d73280e..49aacdfc9 100644
--- a/documents/building-linux.md
+++ b/documents/building-linux.md
@@ -17,8 +17,7 @@ First and foremost, Clang 18 is the **recommended compiler** as it is used for o
sudo apt install build-essential clang git cmake libasound2-dev \
libpulse-dev libopenal-dev libssl-dev zlib1g-dev libedit-dev \
libudev-dev libevdev-dev libsdl2-dev libjack-dev libsndio-dev \
- qt6-base-dev qt6-tools-dev qt6-multimedia-dev libvulkan-dev \
- vulkan-validationlayers libpng-dev
+ libvulkan-dev vulkan-validationlayers libpng-dev
```
#### Fedora
@@ -27,8 +26,6 @@ sudo apt install build-essential clang git cmake libasound2-dev \
sudo dnf install clang git cmake libatomic alsa-lib-devel \
pipewire-jack-audio-connection-kit-devel openal-soft-devel \
openssl-devel libevdev-devel libudev-devel libXext-devel \
- qt6-qtbase-devel qt6-qtbase-private-devel \
- qt6-qtmultimedia-devel qt6-qtsvg-devel qt6-qttools-devel \
vulkan-devel vulkan-validation-layers libpng-devel libuuid-devel
```
@@ -36,8 +33,7 @@ sudo dnf install clang git cmake libatomic alsa-lib-devel \
```bash
sudo pacman -S base-devel clang git cmake sndio jack2 openal \
- qt6-base qt6-declarative qt6-multimedia qt6-tools sdl2 \
- vulkan-validation-layers libpng
+ sdl2 vulkan-validation-layers libpng
```
**Note**: The `shadps4-git` AUR package is not maintained by any of the developers, and it uses the default compiler, which is often set to GCC. Use at your own discretion.
@@ -48,9 +44,7 @@ sudo pacman -S base-devel clang git cmake sndio jack2 openal \
sudo zypper install clang git cmake libasound2 libpulse-devel \
libsndio7 libjack-devel openal-soft-devel libopenssl-devel \
zlib-devel libedit-devel systemd-devel libevdev-devel \
- qt6-base-devel qt6-multimedia-devel qt6-svg-devel \
- qt6-linguist-devel qt6-gui-private-devel vulkan-devel \
- vulkan-validationlayers libpng-devel
+ vulkan-devel vulkan-validationlayers libpng-devel
```
#### NixOS
@@ -90,12 +84,12 @@ There are 3 options you can choose from. Option 1 is **highly recommended**.
1. Generate the build directory in the shadPS4 directory.
```bash
-cmake -S . -B build/ -DENABLE_QT_GUI=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
+cmake -S . -B build/ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
```
-To disable the Qt GUI, remove the `-DENABLE_QT_GUI=ON` flag. To change the build type (for debugging), add `-DCMAKE_BUILD_TYPE=Debug`.
+To change the build type (for debugging), add `-DCMAKE_BUILD_TYPE=Debug`.
-2. Use CMake to build the project:
+1. Use CMake to build the project:
```bash
cmake --build ./build --parallel$(nproc)
@@ -103,18 +97,12 @@ cmake --build ./build --parallel$(nproc)
If your computer freezes during this step, this could be caused by excessive system resource usage. In that case, remove `--parallel$(nproc)`.
-Now run the emulator. If Qt was enabled at configure time:
+Now run the emulator to get the list of options:
```bash
./build/shadps4
```
-Otherwise, specify the path to your game's boot file:
-
-```bash
-./build/shadps4 /"PATH"/"TO"/"GAME"/"FOLDER"/eboot.bin
-```
-
You can also specify the Game ID as an argument for which game to boot, as long as the folder containing the games is specified in config.toml (example: Bloodborne (US) is CUSA00900).
#### Option 2: Configuring with cmake-gui
@@ -142,10 +130,6 @@ Go to Settings, filter by `@ext:ms-vscode.cmake-tools configure` and disable thi

-If you wish to build with the Qt GUI, add `-DENABLE_QT_GUI=ON` to the configure arguments:
-
-
-
On the CMake tab, change the options as you wish, but make sure that it looks similar to or exactly like this:

diff --git a/documents/building-macos.md b/documents/building-macos.md
index 9a1a021ee..6189356f0 100644
--- a/documents/building-macos.md
+++ b/documents/building-macos.md
@@ -24,21 +24,6 @@ eval $(/opt/homebrew/bin/brew shellenv)
brew install clang-format cmake
```
-Next, install x86_64 Qt. You can skip these steps and move on to **Cloning and compiling** if you do not intend to build the Qt GUI.
-
-**If you are on an ARM Mac:**
-```
-# Installs x86_64 Homebrew to /usr/local
-arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-# Installs libraries.
-arch -x86_64 /usr/local/bin/brew install qt@6
-```
-
-**If you are on an x86_64 Mac:**
-```
-brew install qt@6
-```
-
### Cloning and compiling:
Clone the repository recursively:
@@ -52,8 +37,6 @@ Generate the build directory in the shadPS4 directory:
cmake -S . -B build/ -DCMAKE_OSX_ARCHITECTURES=x86_64
```
-If you want to build the Qt GUI, add `-DENABLE_QT_GUI=ON` to the end of this command as well.
-
Enter the directory:
```
cd build/
diff --git a/documents/building-windows.md b/documents/building-windows.md
index dadb8bffb..aa7213abc 100644
--- a/documents/building-windows.md
+++ b/documents/building-windows.md
@@ -1,12 +1,14 @@
# Build shadPS4 for Windows
This tutorial reads as if you have none of the prerequisites already installed. If you do, just ignore the steps regarding installation.
-If you are building to contribute to the project, please omit `--depth 1` from the git invocations.
+> [!WARNING]
+> If you are trying to compile older builds for testing, do not provide the `--depth 1` flag in `git clone`.
+> This flag omits the commit history from your clone, saving storage space while preventing you from testing older commits.
Note: **ARM64 is not supported!** As of writing, it will not build nor run. The instructions with respect to ARM64 are for developers only.
@@ -20,23 +22,6 @@ Once you are within the installer:
2. Go to "Individual Components" tab then search and select both `C++ Clang Compiler for Windows` and `MSBuild support for LLVM`
3. Continue the installation
-### (Prerequisite) Download [**Qt**](https://doc.qt.io/qt-6/get-and-install-qt.html)
-
-Beware, this requires you to create a Qt account. If you do not want to do this, please follow the MSYS2/MinGW compilation method instead.
-
-1. Under the current, non beta version of Qt, select the option `MSVC 2022 64-bit` or similar, as well as `QT Multimedia`.
- If you are on Windows on ARM / Qualcomm Snapdragon Elite X, select `MSVC 2022 ARM64` instead.
-
- Go through the installation normally. If you know what you are doing, you may unselect individual components that eat up too much disk space.
-
-2. Download and install [Qt Visual Studio Tools](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.QtVisualStudioTools2022)
-
-Once you are finished, you will have to configure Qt within Visual Studio:
-
-1. Tools -> Options -> Qt -> Versions
-2. Add a new Qt version and navigate it to the correct folder. Should look like so: `C:\Qt\\msvc2022_64`
-3. Enable the default checkmark on the new version you just created.
-
### (Prerequisite) Download [**Git for Windows**](https://git-scm.com/download/win)
Go through the Git for Windows installation as normal
@@ -77,13 +62,10 @@ Normal x86-based computers, follow:
1. Open "MSYS2 MINGW64" from your new applications
2. Run `pacman -Syu`, let it complete;
3. Run `pacman -S --needed git mingw-w64-x86_64-binutils mingw-w64-x86_64-clang mingw-w64-x86_64-cmake mingw-w64-x86_64-rapidjson mingw-w64-x86_64-ninja mingw-w64-x86_64-ffmpeg`
- 1. Optional (Qt only): run `pacman -S --needed mingw-w64-x86_64-qt6-base mingw-w64-x86_64-qt6-tools mingw-w64-x86_64-qt6-multimedia`
4. Run `git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4`
5. Run `cd shadPS4`
6. Run `cmake -S . -B build -DCMAKE_C_COMPILER="clang.exe" -DCMAKE_CXX_COMPILER="clang++.exe" -DCMAKE_CXX_FLAGS="-O2 -march=native"`
- 1. Optional (Qt only): add `-DENABLE_QT_GUI=ON`
7. Run `cmake --build build`
- 1. Optional (Qt only): run `windeployqt6 build/shadps4.exe`
8. To run the finished product, run `./build/shadPS4.exe`
ARM64-based computers, follow:
@@ -95,9 +77,7 @@ ARM64-based computers, follow:
4. Run `git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4`
5. Run `cd shadPS4`
6. Run `cmake -S . -B build -DCMAKE_C_COMPILER="clang.exe" -DCMAKE_CXX_COMPILER="clang++.exe" -DCMAKE_CXX_FLAGS="-O2 -march=native"`
- 1. Optional (Qt only): add `-DENABLE_QT_GUI=ON`
7. Run `cmake --build build`
- 1. Optional (Qt only): run `windeployqt6 build/shadps4.exe`
8. To run the finished product, run `./build/shadPS4.exe`
## Note on MSYS2 builds
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt
index 1fc206259..a26f58d69 100644
--- a/externals/CMakeLists.txt
+++ b/externals/CMakeLists.txt
@@ -231,6 +231,8 @@ if (APPLE)
# MoltenVK
if (NOT TARGET MoltenVK)
+ set(MVK_EXCLUDE_SPIRV_TOOLS ON)
+ set(MVK_USE_METAL_PRIVATE_API ON)
add_subdirectory(MoltenVK)
endif()
@@ -238,3 +240,12 @@ if (APPLE)
add_subdirectory(epoll-shim)
endif()
endif()
+
+#windows only
+if (WIN32)
+add_subdirectory(ext-wepoll)
+endif()
+
+#nlohmann json
+set(JSON_BuildTests OFF CACHE INTERNAL "")
+add_subdirectory(json)
diff --git a/externals/MoltenVK b/externals/MoltenVK
new file mode 160000
index 000000000..b23d42534
--- /dev/null
+++ b/externals/MoltenVK
@@ -0,0 +1 @@
+Subproject commit b23d42534622cd9926fe526fec1b7f8795a2853c
diff --git a/externals/MoltenVK/CMakeLists.txt b/externals/MoltenVK/CMakeLists.txt
deleted file mode 100644
index 908c2847c..000000000
--- a/externals/MoltenVK/CMakeLists.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-# Prepare MoltenVK Git revision
-find_package(Git)
-if(GIT_FOUND)
- execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
- OUTPUT_VARIABLE MVK_GIT_REV
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-endif()
-set(MVK_GENERATED_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/Generated)
-file(WRITE ${MVK_GENERATED_INCLUDES}/mvkGitRevDerived.h "static const char* mvkRevString = \"${MVK_GIT_REV}\";")
-message(STATUS "MoltenVK revision: ${MVK_GIT_REV}")
-
-# Prepare MoltenVK version
-file(READ ${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK/MoltenVK/MoltenVK/API/mvk_private_api.h MVK_PRIVATE_API)
-string(REGEX MATCH "#define MVK_VERSION_MAJOR [0-9]+" MVK_VERSION_MAJOR_LINE "${MVK_PRIVATE_API}")
-string(REGEX MATCH "[0-9]+" MVK_VERSION_MAJOR "${MVK_VERSION_MAJOR_LINE}")
-string(REGEX MATCH "#define MVK_VERSION_MINOR [0-9]+" MVK_VERSION_MINOR_LINE "${MVK_PRIVATE_API}")
-string(REGEX MATCH "[0-9]+" MVK_VERSION_MINOR "${MVK_VERSION_MINOR_LINE}")
-string(REGEX MATCH "#define MVK_VERSION_PATCH [0-9]+" MVK_VERSION_PATCH_LINE "${MVK_PRIVATE_API}")
-string(REGEX MATCH "[0-9]+" MVK_VERSION_PATCH "${MVK_VERSION_PATCH_LINE}")
-set(MVK_VERSION "${MVK_VERSION_MAJOR}.${MVK_VERSION_MINOR}.${MVK_VERSION_PATCH}")
-message(STATUS "MoltenVK version: ${MVK_VERSION}")
-
-# Find required system libraries
-find_library(APPKIT_LIBRARY AppKit REQUIRED)
-find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
-find_library(IOKIT_LIBRARY IOKit REQUIRED)
-find_library(IOSURFACE_LIBRARY IOSurface REQUIRED)
-find_library(METAL_LIBRARY Metal REQUIRED)
-find_library(QUARTZCORE_LIBRARY QuartzCore REQUIRED)
-
-# cereal
-option(SKIP_PORTABILITY_TEST "" ON)
-option(BUILD_DOC "" OFF)
-option(BUILD_SANDBOX "" OFF)
-option(SKIP_PERFORMANCE_COMPARISON "" ON)
-option(SPIRV_CROSS_SKIP_INSTALL "" ON)
-add_subdirectory(cereal)
-
-# SPIRV-Cross
-option(SPIRV_CROSS_CLI "" OFF)
-option(SPIRV_CROSS_ENABLE_TESTS "" OFF)
-option(SPIRV_CROSS_ENABLE_HLSL "" OFF)
-option(SPIRV_CROSS_ENABLE_CPP "" OFF)
-option(SPIRV_CROSS_SKIP_INSTALL "" ON)
-add_subdirectory(SPIRV-Cross)
-
-# Common
-set(MVK_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK/Common)
-file(GLOB_RECURSE MVK_COMMON_SOURCES CONFIGURE_DEPENDS
- ${MVK_COMMON_DIR}/*.cpp
- ${MVK_COMMON_DIR}/*.m
- ${MVK_COMMON_DIR}/*.mm)
-set(MVK_COMMON_INCLUDES ${MVK_COMMON_DIR})
-
-add_library(MoltenVKCommon STATIC ${MVK_COMMON_SOURCES})
-target_include_directories(MoltenVKCommon PUBLIC ${MVK_COMMON_INCLUDES})
-target_compile_options(MoltenVKCommon PRIVATE -w)
-
-# MoltenVKShaderConverter
-set(MVK_SHADER_CONVERTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK/MoltenVKShaderConverter)
-file(GLOB_RECURSE MVK_SHADER_CONVERTER_SOURCES CONFIGURE_DEPENDS
- ${MVK_SHADER_CONVERTER_DIR}/MoltenVKShaderConverter/*.cpp
- ${MVK_SHADER_CONVERTER_DIR}/MoltenVKShaderConverter/*.m
- ${MVK_SHADER_CONVERTER_DIR}/MoltenVKShaderConverter/*.mm)
-set(MVK_SHADER_CONVERTER_INCLUDES ${MVK_SHADER_CONVERTER_DIR} ${MVK_SHADER_CONVERTER_DIR}/include)
-
-add_library(MoltenVKShaderConverter STATIC ${MVK_SHADER_CONVERTER_SOURCES})
-target_include_directories(MoltenVKShaderConverter PUBLIC ${MVK_SHADER_CONVERTER_INCLUDES})
-target_compile_options(MoltenVKShaderConverter PRIVATE -w)
-target_link_libraries(MoltenVKShaderConverter PRIVATE spirv-cross-msl spirv-cross-reflect MoltenVKCommon)
-target_compile_definitions(MoltenVKShaderConverter PRIVATE MVK_EXCLUDE_SPIRV_TOOLS=1)
-
-# MoltenVK
-set(MVK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK/MoltenVK)
-file(GLOB_RECURSE MVK_SOURCES CONFIGURE_DEPENDS
- ${MVK_DIR}/MoltenVK/*.cpp
- ${MVK_DIR}/MoltenVK/*.m
- ${MVK_DIR}/MoltenVK/*.mm)
-file(GLOB MVK_SRC_INCLUDES LIST_DIRECTORIES ON ${MVK_DIR}/MoltenVK/*)
-set(MVK_INCLUDES ${MVK_SRC_INCLUDES} ${MVK_GENERATED_INCLUDES} ${MVK_DIR}/include)
-
-add_library(MoltenVK SHARED ${MVK_SOURCES})
-target_include_directories(MoltenVK PRIVATE ${MVK_INCLUDES})
-target_compile_options(MoltenVK PRIVATE -w)
-target_link_libraries(MoltenVK PRIVATE
- ${APPKIT_LIBRARY} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY} ${IOSURFACE_LIBRARY} ${METAL_LIBRARY} ${QUARTZCORE_LIBRARY}
- Vulkan::Headers cereal::cereal spirv-cross-msl MoltenVKCommon MoltenVKShaderConverter)
-target_compile_definitions(MoltenVK PRIVATE MVK_FRAMEWORK_VERSION=${MVK_VERSION} MVK_USE_METAL_PRIVATE_API=1)
diff --git a/externals/MoltenVK/MoltenVK b/externals/MoltenVK/MoltenVK
deleted file mode 160000
index 712fbb808..000000000
--- a/externals/MoltenVK/MoltenVK
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 712fbb808ddb81c9369fa3870c41e4c36add311c
diff --git a/externals/MoltenVK/SPIRV-Cross b/externals/MoltenVK/SPIRV-Cross
deleted file mode 160000
index 0a88b2d5c..000000000
--- a/externals/MoltenVK/SPIRV-Cross
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 0a88b2d5c08708d45692b7096a0a84e7bfae366c
diff --git a/externals/MoltenVK/cereal b/externals/MoltenVK/cereal
deleted file mode 160000
index a56bad8bb..000000000
--- a/externals/MoltenVK/cereal
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit a56bad8bbb770ee266e930c95d37fff2a5be7fea
diff --git a/externals/json b/externals/json
new file mode 160000
index 000000000..55f93686c
--- /dev/null
+++ b/externals/json
@@ -0,0 +1 @@
+Subproject commit 55f93686c01528224f448c19128836e7df245f72
diff --git a/shell.nix b/shell.nix
index 4eee9fdea..50336d1b2 100644
--- a/shell.nix
+++ b/shell.nix
@@ -17,7 +17,6 @@ pkgs.mkShell {
pkgs.alsa-lib
pkgs.libpulseaudio
pkgs.openal
- pkgs.openssl
pkgs.zlib
pkgs.libedit
pkgs.udev
@@ -25,9 +24,6 @@ pkgs.mkShell {
pkgs.SDL2
pkgs.jack2
pkgs.sndio
- pkgs.qt6.qtbase
- pkgs.qt6.qttools
- pkgs.qt6.qtmultimedia
pkgs.vulkan-headers
pkgs.vulkan-utility-libraries
@@ -44,16 +40,12 @@ pkgs.mkShell {
pkgs.xorg.xcbutilwm
pkgs.sdl3
pkgs.stb
- pkgs.qt6.qtwayland
pkgs.wayland-protocols
pkgs.libpng
];
shellHook = ''
echo "Entering shadPS4 dev shell"
- export QT_QPA_PLATFORM="wayland"
- export QT_PLUGIN_PATH="${pkgs.qt6.qtwayland}/lib/qt-6/plugins:${pkgs.qt6.qtbase}/lib/qt-6/plugins"
- export QML2_IMPORT_PATH="${pkgs.qt6.qtbase}/lib/qt-6/qml"
export CMAKE_PREFIX_PATH="${pkgs.vulkan-headers}:$CMAKE_PREFIX_PATH"
# OpenGL
diff --git a/src/common/config.cpp b/src/common/config.cpp
index 4e2298d2a..4d3e1d877 100644
--- a/src/common/config.cpp
+++ b/src/common/config.cpp
@@ -8,6 +8,7 @@
#include // for wstring support
#include
+#include "common/assert.h"
#include "common/config.h"
#include "common/logging/formatter.h"
#include "common/path_util.h"
@@ -74,18 +75,34 @@ std::optional get_optional(const toml::value& v, const std::string& key) {
namespace Config {
+ConfigMode config_mode = ConfigMode::Default;
+
+void setConfigMode(ConfigMode mode) {
+ config_mode = mode;
+}
+
template
class ConfigEntry {
public:
+ const T default_value;
T base_value;
optional game_specific_value;
- ConfigEntry(const T& t = T()) : base_value(t), game_specific_value(nullopt) {}
+ ConfigEntry(const T& t = T()) : default_value(t), base_value(t), game_specific_value(nullopt) {}
ConfigEntry operator=(const T& t) {
base_value = t;
return *this;
}
const T get() const {
- return game_specific_value.has_value() ? *game_specific_value : base_value;
+ switch (config_mode) {
+ case ConfigMode::Default:
+ return game_specific_value.value_or(base_value);
+ case ConfigMode::Global:
+ return base_value;
+ case ConfigMode::Clean:
+ return default_value;
+ default:
+ UNREACHABLE();
+ }
}
void setFromToml(const toml::value& v, const std::string& key, bool is_game_specific = false) {
if (is_game_specific) {
@@ -115,19 +132,18 @@ public:
static ConfigEntry volumeSlider(100);
static ConfigEntry isNeo(false);
static ConfigEntry isDevKit(false);
+static ConfigEntry extraDmemInMbytes(0);
static ConfigEntry isPSNSignedIn(false);
static ConfigEntry isTrophyPopupDisabled(false);
static ConfigEntry trophyNotificationDuration(6.0);
static ConfigEntry logFilter("");
static ConfigEntry logType("sync");
static ConfigEntry userName("shadPS4");
-static ConfigEntry chooseHomeTab("General");
static ConfigEntry isShowSplash(false);
static ConfigEntry isSideTrophy("right");
static ConfigEntry isConnectedToNetwork(false);
static bool enableDiscordRPC = false;
-static bool checkCompatibilityOnStartup = false;
-static bool compatibilityData = false;
+static std::filesystem::path sys_modules_path = {};
// Input
static ConfigEntry cursorState(HideCursorState::Idle);
@@ -168,6 +184,7 @@ static ConfigEntry rcasAttenuation(250);
// Vulkan
static ConfigEntry gpuId(-1);
static ConfigEntry vkValidation(false);
+static ConfigEntry vkValidationCore(true);
static ConfigEntry vkValidationSync(false);
static ConfigEntry vkValidationGpu(false);
static ConfigEntry vkCrashDiagnostic(false);
@@ -183,7 +200,6 @@ static ConfigEntry isFpsColor(true);
static ConfigEntry logEnabled(true);
// GUI
-static bool load_game_size = true;
static std::vector settings_install_dirs = {};
std::vector install_dirs_enabled = {};
std::filesystem::path settings_addon_install_dir = {};
@@ -192,15 +208,39 @@ std::filesystem::path save_data_path = {};
// Settings
ConfigEntry m_language(1); // english
+// USB Device
+static ConfigEntry usbDeviceBackend(UsbBackendType::Real);
+
// Keys
static string trophyKey = "";
// Config version, used to determine if a user's config file is outdated.
static string config_version = Common::g_scm_rev;
-// These two entries aren't stored in the config
+// These entries aren't stored in the config
static bool overrideControllerColor = false;
static int controllerCustomColorRGB[3] = {0, 0, 255};
+static bool isGameRunning = false;
+static bool load_auto_patches = true;
+
+bool getGameRunning() {
+ return isGameRunning;
+}
+
+void setGameRunning(bool running) {
+ isGameRunning = running;
+}
+
+std::filesystem::path getSysModulesPath() {
+ if (sys_modules_path.empty()) {
+ return Common::FS::GetUserPath(Common::FS::PathType::SysModuleDir);
+ }
+ return sys_modules_path;
+}
+
+void setSysModulesPath(const std::filesystem::path& path) {
+ sys_modules_path = path;
+}
int getVolumeSlider() {
return volumeSlider.get();
@@ -247,10 +287,6 @@ void setTrophyKey(string key) {
trophyKey = key;
}
-bool GetLoadGameSizeEnabled() {
- return load_game_size;
-}
-
std::filesystem::path GetSaveDataPath() {
if (save_data_path.empty()) {
return Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "savedata";
@@ -262,10 +298,6 @@ void setVolumeSlider(int volumeValue, bool is_game_specific) {
volumeSlider.set(volumeValue, is_game_specific);
}
-void setLoadGameSizeEnabled(bool enable) {
- load_game_size = enable;
-}
-
bool isNeoModeConsole() {
return isNeo.get();
}
@@ -274,6 +306,16 @@ bool isDevKitConsole() {
return isDevKit.get();
}
+int getExtraDmemInMbytes() {
+ return extraDmemInMbytes.get();
+}
+
+void setExtraDmemInMbytes(int value, bool is_game_specific) {
+ // Disable setting in global config
+ is_game_specific ? extraDmemInMbytes.game_specific_value = value
+ : extraDmemInMbytes.base_value = 0;
+}
+
bool getIsFullscreen() {
return isFullscreen.get();
}
@@ -350,10 +392,6 @@ string getUserName() {
return userName.get();
}
-string getChooseHomeTab() {
- return chooseHomeTab.get();
-}
-
bool getUseSpecialPad() {
return useSpecialPad.get();
}
@@ -433,6 +471,10 @@ bool vkValidationEnabled() {
return vkValidation.get();
}
+bool vkValidationCoreEnabled() {
+ return vkValidationCore.get();
+}
+
bool vkValidationSyncEnabled() {
return vkValidationSync.get();
}
@@ -465,14 +507,6 @@ void setVkGuestMarkersEnabled(bool enable, bool is_game_specific) {
vkGuestMarkers.set(enable, is_game_specific);
}
-bool getCompatibilityEnabled() {
- return compatibilityData;
-}
-
-bool getCheckCompatibilityOnStartup() {
- return checkCompatibilityOnStartup;
-}
-
bool getIsConnectedToNetwork() {
return isConnectedToNetwork.get();
}
@@ -557,6 +591,14 @@ void setVkSyncValidation(bool enable, bool is_game_specific) {
vkValidationSync.set(enable, is_game_specific);
}
+void setVkCoreValidation(bool enable, bool is_game_specific) {
+ vkValidationCore.set(enable, is_game_specific);
+}
+
+void setVkGpuValidation(bool enable, bool is_game_specific) {
+ vkValidationGpu.set(enable, is_game_specific);
+}
+
void setRdocEnabled(bool enable, bool is_game_specific) {
rdocEnable.set(enable, is_game_specific);
}
@@ -637,10 +679,6 @@ void setUserName(const string& name, bool is_game_specific) {
userName.set(name, is_game_specific);
}
-void setChooseHomeTab(const string& type, bool is_game_specific) {
- chooseHomeTab.set(type, is_game_specific);
-}
-
void setUseSpecialPad(bool use) {
useSpecialPad.base_value = use;
}
@@ -653,14 +691,6 @@ void setIsMotionControlsEnabled(bool use, bool is_game_specific) {
isMotionControlsEnabled.set(use, is_game_specific);
}
-void setCompatibilityEnabled(bool use) {
- compatibilityData = use;
-}
-
-void setCheckCompatibilityOnStartup(bool use) {
- checkCompatibilityOnStartup = use;
-}
-
bool addGameInstallDir(const std::filesystem::path& dir, bool enabled) {
for (const auto& install_dir : settings_install_dirs) {
if (install_dir.path == dir) {
@@ -790,6 +820,21 @@ void setRcasAttenuation(int value, bool is_game_specific) {
rcasAttenuation.set(value, is_game_specific);
}
+int getUsbDeviceBackend() {
+ return usbDeviceBackend.get();
+}
+
+void setUsbDeviceBackend(int value, bool is_game_specific) {
+ usbDeviceBackend.set(value, is_game_specific);
+}
+
+bool getLoadAutoPatches() {
+ return load_auto_patches;
+}
+void setLoadAutoPatches(bool enable) {
+ load_auto_patches = enable;
+}
+
void load(const std::filesystem::path& path, bool is_game_specific) {
// If the configuration file does not exist, create it and return, unless it is game specific
std::error_code error;
@@ -818,6 +863,9 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
volumeSlider.setFromToml(general, "volumeSlider", is_game_specific);
isNeo.setFromToml(general, "isPS4Pro", is_game_specific);
isDevKit.setFromToml(general, "isDevKit", is_game_specific);
+ if (is_game_specific) { // do not get this value from the base config
+ extraDmemInMbytes.setFromToml(general, "extraDmemInMbytes", is_game_specific);
+ }
isPSNSignedIn.setFromToml(general, "isPSNSignedIn", is_game_specific);
isTrophyPopupDisabled.setFromToml(general, "isTrophyPopupDisabled", is_game_specific);
trophyNotificationDuration.setFromToml(general, "trophyNotificationDuration",
@@ -828,13 +876,10 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
userName.setFromToml(general, "userName", is_game_specific);
isShowSplash.setFromToml(general, "showSplash", is_game_specific);
isSideTrophy.setFromToml(general, "sideTrophy", is_game_specific);
- compatibilityData = toml::find_or(general, "compatibilityEnabled", compatibilityData);
- checkCompatibilityOnStartup = toml::find_or(general, "checkCompatibilityOnStartup",
- checkCompatibilityOnStartup);
isConnectedToNetwork.setFromToml(general, "isConnectedToNetwork", is_game_specific);
- chooseHomeTab.setFromToml(general, "chooseHomeTab", is_game_specific);
defaultControllerID.setFromToml(general, "defaultControllerID", is_game_specific);
+ sys_modules_path = toml::find_fs_path_or(general, "sysModulesPath", sys_modules_path);
}
if (data.contains("Input")) {
@@ -847,6 +892,7 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
isMotionControlsEnabled.setFromToml(input, "isMotionControlsEnabled", is_game_specific);
useUnifiedInputConfig.setFromToml(input, "useUnifiedInputConfig", is_game_specific);
backgroundControllerInput.setFromToml(input, "backgroundControllerInput", is_game_specific);
+ usbDeviceBackend.setFromToml(input, "usbDeviceBackend", is_game_specific);
}
if (data.contains("Audio")) {
@@ -886,6 +932,7 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
gpuId.setFromToml(vk, "gpuId", is_game_specific);
vkValidation.setFromToml(vk, "validation", is_game_specific);
+ vkValidationCore.setFromToml(vk, "validation_core", is_game_specific);
vkValidationSync.setFromToml(vk, "validation_sync", is_game_specific);
vkValidationGpu.setFromToml(vk, "validation_gpu", is_game_specific);
vkCrashDiagnostic.setFromToml(vk, "crashDiagnostic", is_game_specific);
@@ -909,8 +956,6 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
if (data.contains("GUI")) {
const toml::value& gui = data.at("GUI");
- load_game_size = toml::find_or(gui, "loadGameSizeEnabled", load_game_size);
-
const auto install_dir_array =
toml::find_or>(gui, "installDirs", {});
@@ -955,8 +1000,8 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
void sortTomlSections(toml::ordered_value& data) {
toml::ordered_value ordered_data;
- std::vector section_order = {"General", "Input", "GPU", "Vulkan",
- "Debug", "Keys", "GUI", "Settings"};
+ std::vector section_order = {"General", "Input", "Audio", "GPU", "Vulkan",
+ "Debug", "Keys", "GUI", "Settings"};
for (const auto& section : section_order) {
if (data.contains(section)) {
@@ -1014,11 +1059,13 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
logFilter.setTomlValue(data, "General", "logFilter", is_game_specific);
logType.setTomlValue(data, "General", "logType", is_game_specific);
userName.setTomlValue(data, "General", "userName", is_game_specific);
- chooseHomeTab.setTomlValue(data, "General", "chooseHomeTab", is_game_specific);
isShowSplash.setTomlValue(data, "General", "showSplash", is_game_specific);
isSideTrophy.setTomlValue(data, "General", "sideTrophy", is_game_specific);
isNeo.setTomlValue(data, "General", "isPS4Pro", is_game_specific);
isDevKit.setTomlValue(data, "General", "isDevKit", is_game_specific);
+ if (is_game_specific) {
+ extraDmemInMbytes.setTomlValue(data, "General", "extraDmemInMbytes", is_game_specific);
+ }
isPSNSignedIn.setTomlValue(data, "General", "isPSNSignedIn", is_game_specific);
isConnectedToNetwork.setTomlValue(data, "General", "isConnectedToNetwork", is_game_specific);
@@ -1028,6 +1075,7 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
is_game_specific);
backgroundControllerInput.setTomlValue(data, "Input", "backgroundControllerInput",
is_game_specific);
+ usbDeviceBackend.setTomlValue(data, "Input", "usbDeviceBackend", is_game_specific);
micDevice.setTomlValue(data, "Audio", "micDevice", is_game_specific);
mainOutputDevice.setTomlValue(data, "Audio", "mainOutputDevice", is_game_specific);
@@ -1053,6 +1101,8 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
gpuId.setTomlValue(data, "Vulkan", "gpuId", is_game_specific);
vkValidation.setTomlValue(data, "Vulkan", "validation", is_game_specific);
vkValidationSync.setTomlValue(data, "Vulkan", "validation_sync", is_game_specific);
+ vkValidationCore.setTomlValue(data, "Vulkan", "validation_core", is_game_specific);
+ vkValidationGpu.setTomlValue(data, "Vulkan", "validation_gpu", is_game_specific);
vkCrashDiagnostic.setTomlValue(data, "Vulkan", "crashDiagnostic", is_game_specific);
vkHostMarkers.setTomlValue(data, "Vulkan", "hostMarkers", is_game_specific);
vkGuestMarkers.setTomlValue(data, "Vulkan", "guestMarkers", is_game_specific);
@@ -1098,12 +1148,10 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
// Non game-specific entries
data["General"]["enableDiscordRPC"] = enableDiscordRPC;
- data["General"]["compatibilityEnabled"] = compatibilityData;
- data["General"]["checkCompatibilityOnStartup"] = checkCompatibilityOnStartup;
+ data["General"]["sysModulesPath"] = string{fmt::UTF(sys_modules_path.u8string()).data};
data["GUI"]["installDirs"] = install_dirs;
data["GUI"]["installDirsEnabled"] = install_dirs_enabled;
data["GUI"]["saveDataPath"] = string{fmt::UTF(save_data_path.u8string()).data};
- data["GUI"]["loadGameSizeEnabled"] = load_game_size;
data["GUI"]["addonInstallDir"] =
string{fmt::UTF(settings_addon_install_dir.u8string()).data};
data["Debug"]["ConfigVersion"] = config_version;
@@ -1117,7 +1165,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
data["GPU"]["internalScreenWidth"] = internalScreenWidth.base_value;
data["GPU"]["internalScreenHeight"] = internalScreenHeight.base_value;
data["GPU"]["patchShaders"] = shouldPatchShaders.base_value;
- data["Vulkan"]["validation_gpu"] = vkValidationGpu.base_value;
data["Debug"]["FPSColor"] = isFpsColor.base_value;
}
@@ -1141,6 +1188,7 @@ void setDefaultValues(bool is_game_specific) {
isPSNSignedIn.set(false, is_game_specific);
isConnectedToNetwork.set(false, is_game_specific);
directMemoryAccessEnabled.set(false, is_game_specific);
+ extraDmemInMbytes.set(0, is_game_specific);
}
// Entries with game-specific settings that are in both the game-specific and global GUI
@@ -1151,7 +1199,6 @@ void setDefaultValues(bool is_game_specific) {
logFilter.set("", is_game_specific);
logType.set("sync", is_game_specific);
userName.set("shadPS4", is_game_specific);
- chooseHomeTab.set("General", is_game_specific);
isShowSplash.set(false, is_game_specific);
isSideTrophy.set("right", is_game_specific);
@@ -1160,6 +1207,7 @@ void setDefaultValues(bool is_game_specific) {
cursorHideTimeout.set(5, is_game_specific);
isMotionControlsEnabled.set(true, is_game_specific);
backgroundControllerInput.set(false, is_game_specific);
+ usbDeviceBackend.set(UsbBackendType::Real, is_game_specific);
// GS - Audio
micDevice.set("Default Device", is_game_specific);
@@ -1182,6 +1230,7 @@ void setDefaultValues(bool is_game_specific) {
// GS - Vulkan
gpuId.set(-1, is_game_specific);
vkValidation.set(false, is_game_specific);
+ vkValidationCore.set(true, is_game_specific);
vkValidationSync.set(false, is_game_specific);
vkValidationGpu.set(false, is_game_specific);
vkCrashDiagnostic.set(false, is_game_specific);
@@ -1203,8 +1252,6 @@ void setDefaultValues(bool is_game_specific) {
// General
enableDiscordRPC = false;
- compatibilityData = false;
- checkCompatibilityOnStartup = false;
// Input
useSpecialPad.base_value = false;
@@ -1223,9 +1270,6 @@ void setDefaultValues(bool is_game_specific) {
internalScreenWidth.base_value = 1280;
internalScreenHeight.base_value = 720;
- // GUI
- load_game_size = true;
-
// Debug
isFpsColor.base_value = true;
}
diff --git a/src/common/config.h b/src/common/config.h
index c4c35560f..5c9f89ae6 100644
--- a/src/common/config.h
+++ b/src/common/config.h
@@ -9,6 +9,13 @@
namespace Config {
+enum class ConfigMode {
+ Default,
+ Global,
+ Clean,
+};
+void setConfigMode(ConfigMode mode);
+
struct GameInstallDir {
std::filesystem::path path;
bool enabled;
@@ -20,6 +27,8 @@ void load(const std::filesystem::path& path, bool is_game_specific = false);
void save(const std::filesystem::path& path, bool is_game_specific = false);
void resetGameSpecificValue(std::string entry);
+bool getGameRunning();
+void setGameRunning(bool running);
int getVolumeSlider();
void setVolumeSlider(int volumeValue, bool is_game_specific = false);
std::string getTrophyKey();
@@ -72,6 +81,10 @@ bool vkValidationEnabled();
void setVkValidation(bool enable, bool is_game_specific = false);
bool vkValidationSyncEnabled();
void setVkSyncValidation(bool enable, bool is_game_specific = false);
+bool vkValidationGpuEnabled();
+void setVkGpuValidation(bool enable, bool is_game_specific = false);
+bool vkValidationCoreEnabled();
+void setVkCoreValidation(bool enable, bool is_game_specific = false);
bool getVkCrashDiagnosticEnabled();
void setVkCrashDiagnosticEnabled(bool enable, bool is_game_specific = false);
bool getVkHostMarkersEnabled();
@@ -90,11 +103,10 @@ double getTrophyNotificationDuration();
void setTrophyNotificationDuration(double newTrophyNotificationDuration,
bool is_game_specific = false);
int getCursorHideTimeout();
-void setCursorHideTimeout(int newcursorHideTimeout);
std::string getMainOutputDevice();
-void setMainOutputDevice(std::string device);
+void setMainOutputDevice(std::string device, bool is_game_specific = false);
std::string getPadSpkOutputDevice();
-void setPadSpkOutputDevice(std::string device);
+void setPadSpkOutputDevice(std::string device, bool is_game_specific = false);
std::string getMicDevice();
void setCursorHideTimeout(int newcursorHideTimeout, bool is_game_specific = false);
void setMicDevice(std::string device, bool is_game_specific = false);
@@ -115,7 +127,8 @@ void setNeoMode(bool enable, bool is_game_specific = false);
bool isDevKitConsole();
void setDevKitConsole(bool enable, bool is_game_specific = false);
-bool vkValidationGpuEnabled(); // no set
+int getExtraDmemInMbytes();
+void setExtraDmemInMbytes(int value, bool is_game_specific = false);
bool getIsMotionControlsEnabled();
void setIsMotionControlsEnabled(bool use, bool is_game_specific = false);
std::string getDefaultControllerID();
@@ -133,16 +146,18 @@ void setRcasAttenuation(int value, bool is_game_specific = false);
bool getIsConnectedToNetwork();
void setConnectedToNetwork(bool enable, bool is_game_specific = false);
void setUserName(const std::string& name, bool is_game_specific = false);
-void setChooseHomeTab(const std::string& type, bool is_game_specific = false);
+std::filesystem::path getSysModulesPath();
+void setSysModulesPath(const std::filesystem::path& path);
+bool getLoadAutoPatches();
+void setLoadAutoPatches(bool enable);
+
+enum UsbBackendType : int { Real, SkylandersPortal, InfinityBase, DimensionsToypad };
+int getUsbDeviceBackend();
+void setUsbDeviceBackend(int value, bool is_game_specific = false);
// TODO
-bool GetLoadGameSizeEnabled();
std::filesystem::path GetSaveDataPath();
-void setLoadGameSizeEnabled(bool enable);
-bool getCompatibilityEnabled();
-bool getCheckCompatibilityOnStartup();
std::string getUserName();
-std::string getChooseHomeTab();
bool GetUseUnifiedInputConfig();
void SetUseUnifiedInputConfig(bool use);
bool GetOverrideControllerColor();
@@ -152,8 +167,6 @@ void SetControllerCustomColor(int r, int b, int g);
void setGameInstallDirs(const std::vector& dirs_config);
void setAllGameInstallDirs(const std::vector& dirs_config);
void setSaveDataPath(const std::filesystem::path& path);
-void setCompatibilityEnabled(bool use);
-void setCheckCompatibilityOnStartup(bool use);
// Gui
bool addGameInstallDir(const std::filesystem::path& dir, bool enabled = true);
void removeGameInstallDir(const std::filesystem::path& dir);
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index 2bb4c6a4a..ce9386853 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -61,8 +61,9 @@ private:
*/
class FileBackend {
public:
- explicit FileBackend(const std::filesystem::path& filename)
- : file{filename, FS::FileAccessMode::Write, FS::FileType::TextFile} {}
+ explicit FileBackend(const std::filesystem::path& filename, bool should_append = false)
+ : file{filename, should_append ? FS::FileAccessMode::Append : FS::FileAccessMode::Write,
+ FS::FileType::TextFile} {}
~FileBackend() = default;
@@ -145,6 +146,11 @@ public:
initialization_in_progress_suppress_logging = false;
}
+ static void ResetInstance() {
+ initialization_in_progress_suppress_logging = true;
+ instance.reset();
+ }
+
static bool IsActive() {
return instance != nullptr;
}
@@ -157,6 +163,10 @@ public:
instance->StopBackendThread();
}
+ static void SetAppend() {
+ should_append = true;
+ }
+
Impl(const Impl&) = delete;
Impl& operator=(const Impl&) = delete;
@@ -218,7 +228,7 @@ public:
private:
Impl(const std::filesystem::path& file_backend_filename, const Filter& filter_)
- : filter{filter_}, file_backend{file_backend_filename} {}
+ : filter{filter_}, file_backend{file_backend_filename, should_append} {}
~Impl() = default;
@@ -264,6 +274,7 @@ private:
}
static inline std::unique_ptr instance{nullptr, Deleter};
+ static inline bool should_append{false};
Filter filter;
DebuggerBackend debugger_backend{};
@@ -292,6 +303,11 @@ void Stop() {
Impl::Stop();
}
+void Denitializer() {
+ Impl::Stop();
+ Impl::ResetInstance();
+}
+
void SetGlobalFilter(const Filter& filter) {
Impl::Instance().SetGlobalFilter(filter);
}
@@ -300,6 +316,10 @@ void SetColorConsoleBackendEnabled(bool enabled) {
Impl::Instance().SetColorConsoleBackendEnabled(enabled);
}
+void SetAppend() {
+ Impl::SetAppend();
+}
+
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
unsigned int line_num, const char* function, const char* format,
const fmt::format_args& args) {
diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h
index a1ad66369..3003d1eae 100644
--- a/src/common/logging/backend.h
+++ b/src/common/logging/backend.h
@@ -21,9 +21,14 @@ void Start();
/// Explictily stops the logger thread and flushes the buffers
void Stop();
+/// Closes log files and stops the logger
+void Denitializer();
+
/// The global filter will prevent any messages from even being processed if they are filtered.
void SetGlobalFilter(const Filter& filter);
void SetColorConsoleBackendEnabled(bool enabled);
+void SetAppend();
+
} // namespace Common::Log
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp
index 49c1b401a..2f98f07a0 100644
--- a/src/common/logging/filter.cpp
+++ b/src/common/logging/filter.cpp
@@ -109,6 +109,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
SUB(Lib, NpTrophy) \
SUB(Lib, NpWebApi) \
SUB(Lib, NpProfileDialog) \
+ SUB(Lib, NpSnsFacebookDialog) \
SUB(Lib, Screenshot) \
SUB(Lib, LibCInternal) \
SUB(Lib, AppContent) \
diff --git a/src/common/logging/types.h b/src/common/logging/types.h
index e173dc67f..eee9d4ca2 100644
--- a/src/common/logging/types.h
+++ b/src/common/logging/types.h
@@ -29,99 +29,100 @@ enum class Level : u8 {
* filter.cpp.
*/
enum class Class : u8 {
- Log, ///< Messages about the log system itself
- Common, ///< Library routines
- Common_Filesystem, ///< Filesystem interface library
- Common_Memory, ///< Memory mapping and management functions
- Core, ///< LLE emulation core
- Core_Linker, ///< The module linker
- Core_Devices, ///< Devices emulation
- Config, ///< Emulator configuration (including commandline)
- Debug, ///< Debugging tools
- Kernel, ///< The HLE implementation of the PS4 kernel.
- Kernel_Pthread, ///< The pthread implementation of the kernel.
- Kernel_Fs, ///< The filesystem implementation of the kernel.
- Kernel_Vmm, ///< The virtual memory implementation of the kernel.
- Kernel_Event, ///< The event management implementation of the kernel.
- Kernel_Sce, ///< The sony specific interfaces provided by the kernel.
- Lib, ///< HLE implementation of system library. Each major library
- ///< should have its own subclass.
- Lib_LibC, ///< The LibC implementation.
- Lib_LibcInternal, ///< The LibcInternal implementation.
- Lib_Kernel, ///< The LibKernel implementation.
- Lib_Pad, ///< The LibScePad implementation.
- Lib_SystemGesture, ///< The LibSceSystemGesture implementation.
- Lib_GnmDriver, ///< The LibSceGnmDriver implementation.
- Lib_SystemService, ///< The LibSceSystemService implementation.
- Lib_UserService, ///< The LibSceUserService implementation.
- Lib_VideoOut, ///< The LibSceVideoOut implementation.
- Lib_CommonDlg, ///< The LibSceCommonDialog implementation.
- Lib_MsgDlg, ///< The LibSceMsgDialog implementation.
- Lib_AudioOut, ///< The LibSceAudioOut implementation.
- Lib_AudioIn, ///< The LibSceAudioIn implementation.
- Lib_Move, ///< The LibSceMove implementation.
- Lib_Net, ///< The LibSceNet implementation.
- Lib_NetCtl, ///< The LibSceNetCtl implementation.
- Lib_SaveData, ///< The LibSceSaveData implementation.
- Lib_SaveDataDialog, ///< The LibSceSaveDataDialog implementation.
- Lib_Ssl, ///< The LibSceSsl implementation.
- Lib_Ssl2, ///< The LibSceSsl2 implementation.
- Lib_Http, ///< The LibSceHttp implementation.
- Lib_Http2, ///< The LibSceHttp2 implementation.
- Lib_SysModule, ///< The LibSceSysModule implementation
- Lib_NpCommon, ///< The LibSceNpCommon implementation
- Lib_NpAuth, ///< The LibSceNpAuth implementation
- Lib_NpManager, ///< The LibSceNpManager implementation
- Lib_NpScore, ///< The LibSceNpScore implementation
- Lib_NpTrophy, ///< The LibSceNpTrophy implementation
- Lib_NpWebApi, ///< The LibSceWebApi implementation
- Lib_NpProfileDialog, ///< The LibSceNpProfileDialog implementation
- Lib_Screenshot, ///< The LibSceScreenshot implementation
- Lib_LibCInternal, ///< The LibCInternal implementation.
- Lib_AppContent, ///< The LibSceAppContent implementation.
- Lib_Rtc, ///< The LibSceRtc implementation.
- Lib_DiscMap, ///< The LibSceDiscMap implementation.
- Lib_Png, ///< The LibScePng implementation.
- Lib_Jpeg, ///< The LibSceJpeg implementation.
- Lib_PlayGo, ///< The LibScePlayGo implementation.
- Lib_PlayGoDialog, ///< The LibScePlayGoDialog implementation.
- Lib_Random, ///< The LibSceRandom implementation.
- Lib_Usbd, ///< The LibSceUsbd implementation.
- Lib_Ajm, ///< The LibSceAjm implementation.
- Lib_ErrorDialog, ///< The LibSceErrorDialog implementation.
- Lib_ImeDialog, ///< The LibSceImeDialog implementation.
- Lib_AvPlayer, ///< The LibSceAvPlayer implementation.
- Lib_Ngs2, ///< The LibSceNgs2 implementation.
- Lib_Audio3d, ///< The LibSceAudio3d implementation.
- Lib_Ime, ///< The LibSceIme implementation
- Lib_GameLiveStreaming, ///< The LibSceGameLiveStreaming implementation
- Lib_Remoteplay, ///< The LibSceRemotePlay implementation
- Lib_SharePlay, ///< The LibSceSharePlay implemenation
- Lib_Fiber, ///< The LibSceFiber implementation.
- Lib_Vdec2, ///< The LibSceVideodec2 implementation.
- Lib_Videodec, ///< The LibSceVideodec implementation.
- Lib_Voice, ///< The LibSceVoice implementation.
- Lib_RazorCpu, ///< The LibRazorCpu implementation.
- Lib_Mouse, ///< The LibSceMouse implementation
- Lib_WebBrowserDialog, ///< The LibSceWebBrowserDialog implementation
- Lib_NpParty, ///< The LibSceNpParty implementation
- Lib_Zlib, ///< The LibSceZlib implementation.
- Lib_Hmd, ///< The LibSceHmd implementation.
- Lib_HmdSetupDialog, ///< The LibSceHmdSetupDialog implementation.
- Lib_SigninDialog, ///< The LibSigninDialog implementation.
- Lib_Camera, ///< The LibCamera implementation.
- Lib_CompanionHttpd, ///< The LibCompanionHttpd implementation.
- Lib_CompanionUtil, ///< The LibCompanionUtil implementation.
- Lib_VrTracker, ///< The LibSceVrTracker implementation.
- Frontend, ///< Emulator UI
- Render, ///< Video Core
- Render_Vulkan, ///< Vulkan backend
- Render_Recompiler, ///< Shader recompiler
- ImGui, ///< ImGui
- Loader, ///< ROM loader
- Input, ///< Input emulation
- Tty, ///< Debug output from emu
- Count ///< Total number of logging classes
+ Log, ///< Messages about the log system itself
+ Common, ///< Library routines
+ Common_Filesystem, ///< Filesystem interface library
+ Common_Memory, ///< Memory mapping and management functions
+ Core, ///< LLE emulation core
+ Core_Linker, ///< The module linker
+ Core_Devices, ///< Devices emulation
+ Config, ///< Emulator configuration (including commandline)
+ Debug, ///< Debugging tools
+ Kernel, ///< The HLE implementation of the PS4 kernel.
+ Kernel_Pthread, ///< The pthread implementation of the kernel.
+ Kernel_Fs, ///< The filesystem implementation of the kernel.
+ Kernel_Vmm, ///< The virtual memory implementation of the kernel.
+ Kernel_Event, ///< The event management implementation of the kernel.
+ Kernel_Sce, ///< The sony specific interfaces provided by the kernel.
+ Lib, ///< HLE implementation of system library. Each major library
+ ///< should have its own subclass.
+ Lib_LibC, ///< The LibC implementation.
+ Lib_LibcInternal, ///< The LibcInternal implementation.
+ Lib_Kernel, ///< The LibKernel implementation.
+ Lib_Pad, ///< The LibScePad implementation.
+ Lib_SystemGesture, ///< The LibSceSystemGesture implementation.
+ Lib_GnmDriver, ///< The LibSceGnmDriver implementation.
+ Lib_SystemService, ///< The LibSceSystemService implementation.
+ Lib_UserService, ///< The LibSceUserService implementation.
+ Lib_VideoOut, ///< The LibSceVideoOut implementation.
+ Lib_CommonDlg, ///< The LibSceCommonDialog implementation.
+ Lib_MsgDlg, ///< The LibSceMsgDialog implementation.
+ Lib_AudioOut, ///< The LibSceAudioOut implementation.
+ Lib_AudioIn, ///< The LibSceAudioIn implementation.
+ Lib_Move, ///< The LibSceMove implementation.
+ Lib_Net, ///< The LibSceNet implementation.
+ Lib_NetCtl, ///< The LibSceNetCtl implementation.
+ Lib_SaveData, ///< The LibSceSaveData implementation.
+ Lib_SaveDataDialog, ///< The LibSceSaveDataDialog implementation.
+ Lib_Ssl, ///< The LibSceSsl implementation.
+ Lib_Ssl2, ///< The LibSceSsl2 implementation.
+ Lib_Http, ///< The LibSceHttp implementation.
+ Lib_Http2, ///< The LibSceHttp2 implementation.
+ Lib_SysModule, ///< The LibSceSysModule implementation
+ Lib_NpCommon, ///< The LibSceNpCommon implementation
+ Lib_NpAuth, ///< The LibSceNpAuth implementation
+ Lib_NpManager, ///< The LibSceNpManager implementation
+ Lib_NpScore, ///< The LibSceNpScore implementation
+ Lib_NpTrophy, ///< The LibSceNpTrophy implementation
+ Lib_NpWebApi, ///< The LibSceWebApi implementation
+ Lib_NpProfileDialog, ///< The LibSceNpProfileDialog implementation
+ Lib_NpSnsFacebookDialog, ///< The LibSceNpSnsFacebookDialog implementation
+ Lib_Screenshot, ///< The LibSceScreenshot implementation
+ Lib_LibCInternal, ///< The LibCInternal implementation.
+ Lib_AppContent, ///< The LibSceAppContent implementation.
+ Lib_Rtc, ///< The LibSceRtc implementation.
+ Lib_DiscMap, ///< The LibSceDiscMap implementation.
+ Lib_Png, ///< The LibScePng implementation.
+ Lib_Jpeg, ///< The LibSceJpeg implementation.
+ Lib_PlayGo, ///< The LibScePlayGo implementation.
+ Lib_PlayGoDialog, ///< The LibScePlayGoDialog implementation.
+ Lib_Random, ///< The LibSceRandom implementation.
+ Lib_Usbd, ///< The LibSceUsbd implementation.
+ Lib_Ajm, ///< The LibSceAjm implementation.
+ Lib_ErrorDialog, ///< The LibSceErrorDialog implementation.
+ Lib_ImeDialog, ///< The LibSceImeDialog implementation.
+ Lib_AvPlayer, ///< The LibSceAvPlayer implementation.
+ Lib_Ngs2, ///< The LibSceNgs2 implementation.
+ Lib_Audio3d, ///< The LibSceAudio3d implementation.
+ Lib_Ime, ///< The LibSceIme implementation
+ Lib_GameLiveStreaming, ///< The LibSceGameLiveStreaming implementation
+ Lib_Remoteplay, ///< The LibSceRemotePlay implementation
+ Lib_SharePlay, ///< The LibSceSharePlay implemenation
+ Lib_Fiber, ///< The LibSceFiber implementation.
+ Lib_Vdec2, ///< The LibSceVideodec2 implementation.
+ Lib_Videodec, ///< The LibSceVideodec implementation.
+ Lib_Voice, ///< The LibSceVoice implementation.
+ Lib_RazorCpu, ///< The LibRazorCpu implementation.
+ Lib_Mouse, ///< The LibSceMouse implementation
+ Lib_WebBrowserDialog, ///< The LibSceWebBrowserDialog implementation
+ Lib_NpParty, ///< The LibSceNpParty implementation
+ Lib_Zlib, ///< The LibSceZlib implementation.
+ Lib_Hmd, ///< The LibSceHmd implementation.
+ Lib_HmdSetupDialog, ///< The LibSceHmdSetupDialog implementation.
+ Lib_SigninDialog, ///< The LibSigninDialog implementation.
+ Lib_Camera, ///< The LibCamera implementation.
+ Lib_CompanionHttpd, ///< The LibCompanionHttpd implementation.
+ Lib_CompanionUtil, ///< The LibCompanionUtil implementation.
+ Lib_VrTracker, ///< The LibSceVrTracker implementation.
+ Frontend, ///< Emulator UI
+ Render, ///< Video Core
+ Render_Vulkan, ///< Vulkan backend
+ Render_Recompiler, ///< Shader recompiler
+ ImGui, ///< ImGui
+ Loader, ///< ROM loader
+ Input, ///< Input emulation
+ Tty, ///< Debug output from emu
+ Count ///< Total number of logging classes
};
} // namespace Common::Log
diff --git a/src/common/memory_patcher.cpp b/src/common/memory_patcher.cpp
index 123fcdc9c..045a530cb 100644
--- a/src/common/memory_patcher.cpp
+++ b/src/common/memory_patcher.cpp
@@ -3,20 +3,12 @@
#include
#include
+#include
#include
#include
+#include
#include
-#ifdef ENABLE_QT_GUI
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#endif
+#include "common/config.h"
#include "common/elf_info.h"
#include "common/logging/log.h"
#include "common/path_util.h"
@@ -28,7 +20,7 @@ namespace MemoryPatcher {
EXPORT uintptr_t g_eboot_address;
uint64_t g_eboot_image_size;
std::string g_game_serial;
-std::string patchFile;
+std::string patch_file;
bool patches_applied = false;
std::vector pending_patches;
@@ -122,256 +114,104 @@ std::string convertValueToHex(const std::string type, const std::string valueStr
void ApplyPendingPatches();
-void OnGameLoaded() {
- if (!patchFile.empty()) {
- std::filesystem::path patchDir = Common::FS::GetUserPath(Common::FS::PathType::PatchesDir);
+void ApplyPatchesFromXML(std::filesystem::path path) {
+ pugi::xml_document doc;
+ pugi::xml_parse_result result = doc.load_file(path.c_str());
- auto filePath = (patchDir / patchFile).native();
+ auto* param_sfo = Common::Singleton::Instance();
+ auto app_version = param_sfo->GetString("APP_VER").value_or("Unknown version");
- pugi::xml_document doc;
- pugi::xml_parse_result result = doc.load_file(filePath.c_str());
+ if (result) {
+ auto patchXML = doc.child("Patch");
+ for (pugi::xml_node_iterator it = patchXML.children().begin();
+ it != patchXML.children().end(); ++it) {
- auto* param_sfo = Common::Singleton::Instance();
- auto app_version = param_sfo->GetString("APP_VER").value_or("Unknown version");
+ if (std::string(it->name()) == "Metadata") {
+ if (std::string(it->attribute("isEnabled").value()) == "true") {
+ std::string currentPatchName = it->attribute("Name").value();
+ std::string metadataAppVer = it->attribute("AppVer").value();
+ bool versionMatches = metadataAppVer == app_version;
- if (result) {
- auto patchXML = doc.child("Patch");
- for (pugi::xml_node_iterator it = patchXML.children().begin();
- it != patchXML.children().end(); ++it) {
+ auto patchList = it->first_child();
+ for (pugi::xml_node_iterator patchLineIt = patchList.children().begin();
+ patchLineIt != patchList.children().end(); ++patchLineIt) {
- if (std::string(it->name()) == "Metadata") {
- if (std::string(it->attribute("isEnabled").value()) == "true") {
- std::string currentPatchName = it->attribute("Name").value();
- std::string metadataAppVer = it->attribute("AppVer").value();
- bool versionMatches = metadataAppVer == app_version;
+ std::string type = patchLineIt->attribute("Type").value();
+ if (!versionMatches && type != "mask" && type != "mask_jump32")
+ continue;
- auto patchList = it->first_child();
- for (pugi::xml_node_iterator patchLineIt = patchList.children().begin();
- patchLineIt != patchList.children().end(); ++patchLineIt) {
-
- std::string type = patchLineIt->attribute("Type").value();
- if (!versionMatches && type != "mask" && type != "mask_jump32")
- continue;
-
- std::string currentPatchName = it->attribute("Name").value();
-
- for (pugi::xml_node_iterator patchLineIt = patchList.children().begin();
- patchLineIt != patchList.children().end(); ++patchLineIt) {
-
- std::string type = patchLineIt->attribute("Type").value();
- std::string address = patchLineIt->attribute("Address").value();
- std::string patchValue = patchLineIt->attribute("Value").value();
- std::string maskOffsetStr =
- patchLineIt->attribute("Offset").value();
- std::string targetStr = "";
- std::string sizeStr = "";
- if (type == "mask_jump32") {
- targetStr = patchLineIt->attribute("Target").value();
- sizeStr = patchLineIt->attribute("Size").value();
- } else {
- patchValue = convertValueToHex(type, patchValue);
- }
-
- bool littleEndian = false;
-
- if (type == "bytes16" || type == "bytes32" || type == "bytes64") {
- littleEndian = true;
- }
-
- MemoryPatcher::PatchMask patchMask = MemoryPatcher::PatchMask::None;
- int maskOffsetValue = 0;
-
- if (type == "mask")
- patchMask = MemoryPatcher::PatchMask::Mask;
-
- if (type == "mask_jump32")
- patchMask = MemoryPatcher::PatchMask::Mask_Jump32;
-
- if ((type == "mask" || type == "mask_jump32") &&
- !maskOffsetStr.empty()) {
- maskOffsetValue = std::stoi(maskOffsetStr, 0, 10);
- }
-
- MemoryPatcher::PatchMemory(currentPatchName, address, patchValue,
- targetStr, sizeStr, false, littleEndian,
- patchMask, maskOffsetValue);
- }
+ std::string address = patchLineIt->attribute("Address").value();
+ std::string patchValue = patchLineIt->attribute("Value").value();
+ std::string maskOffsetStr = patchLineIt->attribute("Offset").value();
+ std::string targetStr = "";
+ std::string sizeStr = "";
+ if (type == "mask_jump32") {
+ targetStr = patchLineIt->attribute("Target").value();
+ sizeStr = patchLineIt->attribute("Size").value();
+ } else {
+ patchValue = convertValueToHex(type, patchValue);
}
+
+ bool littleEndian = false;
+ if (type == "bytes16" || type == "bytes32" || type == "bytes64") {
+ littleEndian = true;
+ }
+
+ MemoryPatcher::PatchMask patchMask = MemoryPatcher::PatchMask::None;
+ int maskOffsetValue = 0;
+
+ if (type == "mask")
+ patchMask = MemoryPatcher::PatchMask::Mask;
+
+ if (type == "mask_jump32")
+ patchMask = MemoryPatcher::PatchMask::Mask_Jump32;
+
+ if ((type == "mask" || type == "mask_jump32") && !maskOffsetStr.empty()) {
+ maskOffsetValue = std::stoi(maskOffsetStr, 0, 10);
+ }
+
+ MemoryPatcher::PatchMemory(currentPatchName, address, patchValue, targetStr,
+ sizeStr, false, littleEndian, patchMask,
+ maskOffsetValue);
}
}
}
+ }
+ } else {
+ LOG_ERROR(Loader, "Could not parse patch XML: {}", result.description());
+ }
+}
+
+void OnGameLoaded() {
+ std::filesystem::path patch_dir = Common::FS::GetUserPath(Common::FS::PathType::PatchesDir);
+ if (!patch_file.empty()) {
+
+ auto file_path = (patch_dir / patch_file).native();
+ if (std::filesystem::exists(patch_file)) {
+ ApplyPatchesFromXML(patch_file);
} else {
- LOG_ERROR(Loader, "couldnt patch parse xml : {}", result.description());
+ ApplyPatchesFromXML(file_path);
+ }
+ } else if (Config::getLoadAutoPatches()) {
+ for (auto const& repo : std::filesystem::directory_iterator(patch_dir)) {
+ if (!repo.is_directory()) {
+ continue;
+ }
+ std::ifstream json_file{repo.path() / "files.json"};
+ nlohmann::json available_patches = nlohmann::json::parse(json_file);
+ std::filesystem::path game_patch_file;
+ for (auto const& [filename, serials] : available_patches.items()) {
+ if (std::find(serials.begin(), serials.end(), g_game_serial) != serials.end()) {
+ game_patch_file = repo.path() / filename;
+ break;
+ }
+ }
+ if (std::filesystem::exists(game_patch_file)) {
+ ApplyPatchesFromXML(game_patch_file);
+ }
}
}
ApplyPendingPatches();
-
-#ifdef ENABLE_QT_GUI
- // We use the QT headers for the xml and json parsing, this define is only true on QT builds
- QString patchDir;
- Common::FS::PathToQString(patchDir, Common::FS::GetUserPath(Common::FS::PathType::PatchesDir));
- QDir dir(patchDir);
- QStringList folders = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
-
- for (const QString& folder : folders) {
- QString filesJsonPath = patchDir + "/" + folder + "/files.json";
-
- QFile jsonFile(filesJsonPath);
- if (!jsonFile.open(QIODevice::ReadOnly)) {
- LOG_ERROR(Loader, "Unable to open files.json for reading in repository {}",
- folder.toStdString());
- continue;
- }
-
- QByteArray jsonData = jsonFile.readAll();
- jsonFile.close();
-
- QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
- QJsonObject jsonObject = jsonDoc.object();
-
- QString selectedFileName;
- QString serial = QString::fromStdString(g_game_serial);
-
- for (auto it = jsonObject.constBegin(); it != jsonObject.constEnd(); ++it) {
- QString filePath = it.key();
- QJsonArray idsArray = it.value().toArray();
-
- if (idsArray.contains(QJsonValue(serial))) {
- selectedFileName = filePath;
- break;
- }
- }
-
- if (selectedFileName.isEmpty()) {
- LOG_ERROR(Loader, "No patch file found for the current serial in repository {}",
- folder.toStdString());
- continue;
- }
-
- QString filePath = patchDir + "/" + folder + "/" + selectedFileName;
- QFile file(filePath);
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- LOG_ERROR(Loader, "Unable to open the file for reading.");
- continue;
- }
-
- QByteArray xmlData = file.readAll();
- file.close();
-
- QString newXmlData;
-
- QXmlStreamReader xmlReader(xmlData);
-
- bool isEnabled = false;
- std::string currentPatchName;
-
- auto* param_sfo = Common::Singleton::Instance();
- auto app_version = param_sfo->GetString("APP_VER").value_or("Unknown version");
- bool versionMatches = true;
-
- while (!xmlReader.atEnd()) {
- xmlReader.readNext();
-
- if (xmlReader.isStartElement()) {
- QJsonArray patchLines;
- if (xmlReader.name() == QStringLiteral("Metadata")) {
- QString name = xmlReader.attributes().value("Name").toString();
- currentPatchName = name.toStdString();
-
- QString appVer = xmlReader.attributes().value("AppVer").toString();
-
- // Check and update the isEnabled attribute
- isEnabled = false;
- for (const QXmlStreamAttribute& attr : xmlReader.attributes()) {
- if (attr.name() == QStringLiteral("isEnabled")) {
- isEnabled = (attr.value().toString() == "true");
- }
- }
- versionMatches = (appVer.toStdString() == app_version);
-
- } else if (xmlReader.name() == QStringLiteral("PatchList")) {
- QJsonArray linesArray;
- while (!xmlReader.atEnd() &&
- !(xmlReader.tokenType() == QXmlStreamReader::EndElement &&
- xmlReader.name() == QStringLiteral("PatchList"))) {
- xmlReader.readNext();
- if (xmlReader.tokenType() == QXmlStreamReader::StartElement &&
- xmlReader.name() == QStringLiteral("Line")) {
- QXmlStreamAttributes attributes = xmlReader.attributes();
- QJsonObject lineObject;
- lineObject["Type"] = attributes.value("Type").toString();
- lineObject["Address"] = attributes.value("Address").toString();
- lineObject["Value"] = attributes.value("Value").toString();
- lineObject["Offset"] = attributes.value("Offset").toString();
- if (lineObject["Type"].toString() == "mask_jump32") {
- lineObject["Target"] = attributes.value("Target").toString();
- lineObject["Size"] = attributes.value("Size").toString();
- }
- linesArray.append(lineObject);
- }
- }
-
- patchLines = linesArray;
- if (isEnabled) {
- foreach (const QJsonValue& value, patchLines) {
- QJsonObject lineObject = value.toObject();
- QString type = lineObject["Type"].toString();
-
- if ((type != "mask" && type != "mask_jump32") && !versionMatches)
- continue;
-
- QString address = lineObject["Address"].toString();
- QString patchValue = lineObject["Value"].toString();
- QString maskOffsetStr = lineObject["Offset"].toString();
-
- QString targetStr;
- QString sizeStr;
-
- if (type == "mask_jump32") {
- targetStr = lineObject["Target"].toString();
- sizeStr = lineObject["Size"].toString();
- } else {
- patchValue = QString::fromStdString(convertValueToHex(
- type.toStdString(), patchValue.toStdString()));
- }
-
- bool littleEndian = false;
-
- if (type == "bytes16" || type == "bytes32" || type == "bytes64")
- littleEndian = true;
-
- MemoryPatcher::PatchMask patchMask = MemoryPatcher::PatchMask::None;
- int maskOffsetValue = 0;
-
- if (type == "mask")
- patchMask = MemoryPatcher::PatchMask::Mask;
-
- if (type == "mask_jump32")
- patchMask = MemoryPatcher::PatchMask::Mask_Jump32;
-
- if ((type == "mask" || type == "mask_jump32") &&
- !maskOffsetStr.toStdString().empty()) {
- maskOffsetValue = std::stoi(maskOffsetStr.toStdString(), 0, 10);
- }
-
- MemoryPatcher::PatchMemory(
- currentPatchName, address.toStdString(), patchValue.toStdString(),
- targetStr.toStdString(), sizeStr.toStdString(), false, littleEndian,
- patchMask, maskOffsetValue);
- }
- }
- }
- }
- }
-
- if (xmlReader.hasError()) {
- LOG_ERROR(Loader, "Failed to parse XML for {}", g_game_serial);
- } else {
- LOG_INFO(Loader, "Patches loaded successfully, repository: {}", folder.toStdString());
- }
- ApplyPendingPatches();
- }
-#endif
}
void AddPatchToQueue(patchInfo patchToAdd) {
diff --git a/src/common/memory_patcher.h b/src/common/memory_patcher.h
index 93306f540..5a67beec5 100644
--- a/src/common/memory_patcher.h
+++ b/src/common/memory_patcher.h
@@ -17,7 +17,7 @@ namespace MemoryPatcher {
extern EXPORT uintptr_t g_eboot_address;
extern uint64_t g_eboot_image_size;
extern std::string g_game_serial;
-extern std::string patchFile;
+extern std::string patch_file;
enum PatchMask : uint8_t {
None,
diff --git a/src/common/number_utils.cpp b/src/common/number_utils.cpp
index 660f539f9..121437a23 100644
--- a/src/common/number_utils.cpp
+++ b/src/common/number_utils.cpp
@@ -1,20 +1,14 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include
#include
-
#include "common/number_utils.h"
-#include "video_core/amdgpu/pixel_format.h"
-#include "video_core/amdgpu/types.h"
-#define UF11_EXPONENT_SHIFT 6
-#define UF10_EXPONENT_SHIFT 5
-
-#define RGB9E5_MANTISSA_BITS 9
-#define RGB9E5_EXP_BIAS 1
-
-#define F32_INFINITY 0x7f800000
+constexpr u32 UF11_EXPONENT_SHIFT = 6;
+constexpr u32 UF10_EXPONENT_SHIFT = 5;
+constexpr u32 RGB9E5_MANTISSA_BITS = 9;
+constexpr u32 RGB9E5_EXP_BIAS = 1;
+constexpr u32 F32_INFINITY = 0x7f800000;
namespace NumberUtils {
diff --git a/src/common/path_util.cpp b/src/common/path_util.cpp
index f368980bf..bd0aff040 100644
--- a/src/common/path_util.cpp
+++ b/src/common/path_util.cpp
@@ -25,10 +25,6 @@
#endif
#endif
-#ifdef ENABLE_QT_GUI
-#include
-#endif
-
namespace Common::FS {
namespace fs = std::filesystem;
@@ -88,13 +84,6 @@ static std::optional GetBundleParentDirectory() {
#endif
static auto UserPaths = [] {
-#if defined(__APPLE__) && defined(ENABLE_QT_GUI)
- // Set the current path to the directory containing the app bundle.
- if (const auto bundle_dir = GetBundleParentDirectory()) {
- std::filesystem::current_path(*bundle_dir);
- }
-#endif
-
// Try the portable user directory first.
auto user_dir = std::filesystem::current_path() / PORTABLE_DIR;
if (!std::filesystem::exists(user_dir)) {
@@ -229,22 +218,4 @@ std::optional FindGameByID(const fs::path& dir, const std::string& gam
return std::nullopt;
}
-#ifdef ENABLE_QT_GUI
-void PathToQString(QString& result, const std::filesystem::path& path) {
-#ifdef _WIN32
- result = QString::fromStdWString(path.wstring());
-#else
- result = QString::fromStdString(path.string());
-#endif
-}
-
-std::filesystem::path PathFromQString(const QString& path) {
-#ifdef _WIN32
- return std::filesystem::path(path.toStdWString());
-#else
- return std::filesystem::path(path.toStdString());
-#endif
-}
-#endif
-
} // namespace Common::FS
diff --git a/src/common/path_util.h b/src/common/path_util.h
index af40b3974..0a0234eba 100644
--- a/src/common/path_util.h
+++ b/src/common/path_util.h
@@ -7,10 +7,6 @@
#include
#include
-#ifdef ENABLE_QT_GUI
-class QString; // to avoid including in this header
-#endif
-
namespace Common::FS {
enum class PathType {
@@ -99,25 +95,6 @@ constexpr auto LOG_FILE = "shad_log.txt";
*/
void SetUserPath(PathType user_path, const std::filesystem::path& new_path);
-#ifdef ENABLE_QT_GUI
-/**
- * Converts an std::filesystem::path to a QString.
- * The native underlying string of a path is wstring on Windows and string on POSIX.
- *
- * @param result The resulting QString
- * @param path The path to convert
- */
-void PathToQString(QString& result, const std::filesystem::path& path);
-
-/**
- * Converts a QString to an std::filesystem::path.
- * The native underlying string of a path is wstring on Windows and string on POSIX.
- *
- * @param path The path to convert
- */
-[[nodiscard]] std::filesystem::path PathFromQString(const QString& path);
-#endif
-
/**
* Recursively searches for a game directory by its ID.
* Limits search depth to prevent excessive filesystem traversal.
diff --git a/src/core/address_space.cpp b/src/core/address_space.cpp
index 846bb5eb4..3f2d94cbf 100644
--- a/src/core/address_space.cpp
+++ b/src/core/address_space.cpp
@@ -2,10 +2,10 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include