diff --git a/CMakeLists.txt b/CMakeLists.txt index e5c16bd1b..78e3c7997 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,7 +120,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.303 CONFIG) +find_package(VulkanHeaders 1.4.305 CONFIG) find_package(VulkanMemoryAllocator 3.1.0 CONFIG) find_package(xbyak 7.07 CONFIG) find_package(xxHash 0.8.2 MODULE) @@ -344,6 +344,8 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp src/core/libraries/razor_cpu/razor_cpu.h src/core/libraries/mouse/mouse.cpp src/core/libraries/mouse/mouse.h + src/core/libraries/web_browser_dialog/webbrowserdialog.cpp + src/core/libraries/web_browser_dialog/webbrowserdialog.h ) set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h @@ -434,6 +436,13 @@ set(NP_LIBS src/core/libraries/np_common/np_common.cpp src/core/libraries/np_trophy/np_trophy_error.h src/core/libraries/np_web_api/np_web_api.cpp src/core/libraries/np_web_api/np_web_api.h + src/core/libraries/np_party/np_party.cpp + src/core/libraries/np_party/np_party.h +) + +set(ZLIB_LIB src/core/libraries/zlib/zlib.cpp + src/core/libraries/zlib/zlib_sce.h + src/core/libraries/zlib/zlib_error.h ) set(MISC_LIBS src/core/libraries/screenshot/screenshot.cpp @@ -557,16 +566,16 @@ set(CORE src/core/aerolib/stubs.cpp src/core/devices/logger.cpp src/core/devices/logger.h src/core/devices/nop_device.h - src/core/devices/dev_console.cpp - src/core/devices/dev_console.h - src/core/devices/deci_tty6.cpp - src/core/devices/deci_tty6.h - src/core/devices/random.cpp - src/core/devices/random.h - src/core/devices/urandom.cpp - src/core/devices/urandom.h - src/core/devices/srandom.cpp - src/core/devices/srandom.h + src/core/devices/console_device.cpp + src/core/devices/console_device.h + src/core/devices/deci_tty6_device.cpp + src/core/devices/deci_tty6_device.h + src/core/devices/random_device.cpp + src/core/devices/random_device.h + src/core/devices/urandom_device.cpp + src/core/devices/urandom_device.h + src/core/devices/srandom_device.cpp + src/core/devices/srandom_device.h src/core/file_format/pfs.h src/core/file_format/pkg.cpp src/core/file_format/pkg.h @@ -608,6 +617,7 @@ set(CORE src/core/aerolib/stubs.cpp ${PLAYGO_LIB} ${RANDOM_LIB} ${USBD_LIB} + ${ZLIB_LIB} ${MISC_LIBS} ${IME_LIB} ${FIBER_LIB} @@ -751,8 +761,6 @@ set(VIDEO_CORE src/video_core/amdgpu/liverpool.cpp src/video_core/renderer_vulkan/vk_common.h src/video_core/renderer_vulkan/vk_compute_pipeline.cpp src/video_core/renderer_vulkan/vk_compute_pipeline.h - src/video_core/renderer_vulkan/vk_descriptor_update_queue.cpp - src/video_core/renderer_vulkan/vk_descriptor_update_queue.h src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp src/video_core/renderer_vulkan/vk_graphics_pipeline.h src/video_core/renderer_vulkan/vk_instance.cpp diff --git a/REUSE.toml b/REUSE.toml index 55d76673d..a62974bcd 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -14,6 +14,7 @@ path = [ "documents/changelog.md", "documents/Quickstart/2.png", "documents/Screenshots/*", + "documents/Screenshots/Linux/*", "externals/MoltenVK/MoltenVK_icd.json", "scripts/ps4_names.txt", "src/images/about_icon.png", diff --git a/documents/Quickstart/Quickstart.md b/documents/Quickstart/Quickstart.md index b2931e51e..2f2751887 100644 --- a/documents/Quickstart/Quickstart.md +++ b/documents/Quickstart/Quickstart.md @@ -22,7 +22,10 @@ SPDX-License-Identifier: GPL-2.0-or-later - A processor with at least 4 cores and 6 threads - Above 2.5 GHz frequency -- required support AVX2 extension or Rosetta 2 on ARM +- A CPU supporting the following instruction sets: MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, F16C, CLMUL, AES, BMI1, MOVBE, XSAVE, ABM + - **Intel**: Haswell generation or newer + - **AMD**: Jaguar generation or newer + - **Apple**: Rosetta 2 on macOS 15 or newer ### GPU diff --git a/documents/Screenshots/Linux/1.png b/documents/Screenshots/Linux/1.png new file mode 100644 index 000000000..3dd5ef92b Binary files /dev/null and b/documents/Screenshots/Linux/1.png differ diff --git a/documents/Screenshots/Linux/2.png b/documents/Screenshots/Linux/2.png new file mode 100644 index 000000000..fc5ff3b53 Binary files /dev/null and b/documents/Screenshots/Linux/2.png differ diff --git a/documents/Screenshots/Linux/3.png b/documents/Screenshots/Linux/3.png new file mode 100644 index 000000000..c1c6d42de Binary files /dev/null and b/documents/Screenshots/Linux/3.png differ diff --git a/documents/Screenshots/Linux/4.png b/documents/Screenshots/Linux/4.png new file mode 100644 index 000000000..6e8a3b6c1 Binary files /dev/null and b/documents/Screenshots/Linux/4.png differ diff --git a/documents/Screenshots/Linux/5.png b/documents/Screenshots/Linux/5.png new file mode 100644 index 000000000..737674606 Binary files /dev/null and b/documents/Screenshots/Linux/5.png differ diff --git a/documents/building-linux.md b/documents/building-linux.md index 989669f4f..4aa66aac6 100644 --- a/documents/building-linux.md +++ b/documents/building-linux.md @@ -3,59 +3,134 @@ SPDX-FileCopyrightText: 2024 shadPS4 Emulator Project SPDX-License-Identifier: GPL-2.0-or-later --> -## Build shadPS4 for Linux +## Build shadPS4 for Linux -### Install the necessary tools to build shadPS4: +First and foremost, Clang 18 is the **recommended compiler** as it is used for official builds and CI. If you build with GCC, you might encounter issues — please report any you find. Additionally, if you choose to use GCC, please build shadPS4 with Clang at least once before creating an `[APP BUG]` issue or submitting a pull request. + +## Preparatory steps + +### Installing dependencies #### Debian & Ubuntu + ``` 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 ``` #### Fedora + ``` sudo dnf install clang git cmake libatomic alsa-lib-devel pipewire-jack-audio-connection-kit-devel openal-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 ``` #### Arch Linux + ``` sudo pacman -S base-devel clang git cmake sndio jack2 openal qt6-base qt6-declarative qt6-multimedia sdl2 vulkan-validation-layers ``` +**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. + #### OpenSUSE + ``` 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 ``` -### Cloning and compiling: -Clone the repository recursively: +#### Other Linux distributions + +You can try one of two methods: + +- Search the packages by name and install them with your package manager, or +- Install [distrobox](https://distrobox.it/), create a container using any of the distributions cited above as a base, for Arch Linux you'd do: + +``` +distrobox create --name archlinux --init --image archlinux:latest +``` + +and install the dependencies on that container as cited above. +This option is **highly recommended** for NixOS and distributions with immutable/atomic filesystems (example: Fedora Kinoite, SteamOS). + +### Cloning + ``` git clone --recursive https://github.com/shadps4-emu/shadPS4.git cd shadPS4 ``` -Generate the build directory in the shadPS4 directory. To disable the QT GUI, remove the ```-DENABLE_QT_GUI=ON``` flag: +## Building + +There are 3 options you can choose from. Option 1 is **highly recommended**. + +#### Option 1: Terminal-only + +1. Generate the build directory in the shadPS4 directory. -**Note**: Clang is the compiler used for official builds and CI. If you build with GCC, you might encounter issues—please report any you find. If you choose to use GCC, we recommend building with Clang at least once before submitting a pull request. ``` cmake -S . -B build/ -DENABLE_QT_GUI=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ``` -Enter the directory: +To disable the Qt GUI, remove the `-DENABLE_QT_GUI=ON` flag. To change the build type (for debugging), add `-DCMAKE_BUILD_TYPE=Debug`. + +2. Use CMake to build the project: + ``` -cd build/ +cmake --build ./build --parallel$(nproc) ``` -Use make to build the project: +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: + ``` -cmake --build . --parallel$(nproc) +./build/shadps4 ``` -Now run the emulator. If QT is enabled: -``` -./shadps4 -``` Otherwise, specify the path to your PKG's boot file: + ``` -./shadps4 /"PATH"/"TO"/"GAME"/"FOLDER"/eboot.bin +./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 + +`cmake-gui` should be installed by default alongside `cmake`, if not search for the package in your package manager and install it. + +Open `cmake-gui` and specify the source code and build directories. If you cloned the source code to your Home directory, it would be `/home/user/shadPS4` and `/home/user/shadPS4/build`. + +Click on Configure, select "Unix Makefiles", select "Specify native compilers", click Next and choose `clang` and `clang++` as the C and CXX compilers. Usually they are located in `/bin/clang` and `/bin/clang++`. Click on Finish and let it configure the project. + +Now every option should be displayed in red. Change anything you want, then click on Generate to make the changes permanent, then open a terminal window and do step 2 of Option 1. + +#### Option 3: Visual Studio Code + +This option is pretty convoluted and should only be used if you have VSCode as your default IDE, or just prefer building and debugging projects through it. This also assumes that you're using an Arch Linux environment, as the naming for some options might differ from other distros. + +[Download Visual Studio Code for your platform](https://code.visualstudio.com/download), or use [Code - OSS](https://github.com/microsoft/vscode) if you'd like. Code - OSS is available on most Linux distributions' package repositories (on Arch Linux it is simply named `code`). + +Once set up, go to Extensions and install "CMake Tools": + +![image](https://raw.githubusercontent.com/shadps4-emu/shadPS4/refs/heads/main/documents/Screenshots/Linux/3.png) + +You can also install other CMake and Clang related extensions if you'd like, but this one is what enables you to configure and build CMake projects directly within VSCode. + +Go to Settings, filter by `@ext:ms-vscode.cmake-tools configure` and disable this option: + +![image](https://raw.githubusercontent.com/shadps4-emu/shadPS4/refs/heads/main/documents/Screenshots/Linux/1.png) + +If you wish to build with the Qt GUI, add `-DENABLE_QT_GUI=ON` to the configure arguments: + +![image](https://raw.githubusercontent.com/shadps4-emu/shadPS4/refs/heads/main/documents/Screenshots/Linux/2.png) + +On the CMake tab, change the options as you wish, but make sure that it looks similar to or exactly like this: + +![image](https://raw.githubusercontent.com/shadps4-emu/shadPS4/refs/heads/main/documents/Screenshots/Linux/4.png) + +When hovering over Project Status > Configure, there should be an icon titled "Configure". Click on it and let it configure the project, then do the same for Project Status > Build. + +If you want to debug it, change the build type under Project Status > Configure to Debug (it should be the default) and compile it, then click on the icon in Project Status > Debug. If you simply want to launch the shadPS4 executable from within VSCode, click on the icon in Project Status > Launch. + +Don't forget to change the launch target for both options to the shadPS4 executable inside shadPS4/build: + +![image](https://raw.githubusercontent.com/shadps4-emu/shadPS4/refs/heads/main/documents/Screenshots/Linux/5.png) diff --git a/externals/MoltenVK/MoltenVK b/externals/MoltenVK/MoltenVK index 9f0b616d9..aba997657 160000 --- a/externals/MoltenVK/MoltenVK +++ b/externals/MoltenVK/MoltenVK @@ -1 +1 @@ -Subproject commit 9f0b616d9e2c39464d2a859b79dbc655c4a30e7e +Subproject commit aba997657b94d6de1794ebad36ce5634341252c7 diff --git a/externals/MoltenVK/SPIRV-Cross b/externals/MoltenVK/SPIRV-Cross index 6173e24b3..1a7b7ef6d 160000 --- a/externals/MoltenVK/SPIRV-Cross +++ b/externals/MoltenVK/SPIRV-Cross @@ -1 +1 @@ -Subproject commit 6173e24b31f09a0c3217103a130e74c4ddec14a6 +Subproject commit 1a7b7ef6de02cf6767e42b10ddad217c45e90d47 diff --git a/externals/sdl3 b/externals/sdl3 index 22422f774..a336b62d8 160000 --- a/externals/sdl3 +++ b/externals/sdl3 @@ -1 +1 @@ -Subproject commit 22422f7748d5128135995ed34c8f8012861c7332 +Subproject commit a336b62d8b0b97b09214e053203e442e2b6e2be5 diff --git a/externals/sirit b/externals/sirit index 26ad5a9d0..d6f3c0d99 160000 --- a/externals/sirit +++ b/externals/sirit @@ -1 +1 @@ -Subproject commit 26ad5a9d0fe13260b0d7d6c64419d01a196b2e32 +Subproject commit d6f3c0d99862ab2ff8f95e9ac221560f1f97e29a diff --git a/externals/vulkan-headers b/externals/vulkan-headers index 6a74a7d65..a03d2f6d5 160000 --- a/externals/vulkan-headers +++ b/externals/vulkan-headers @@ -1 +1 @@ -Subproject commit 6a74a7d65cafa19e38ec116651436cce6efd5b2e +Subproject commit a03d2f6d5753b365d704d58161825890baad0755 diff --git a/src/common/config.cpp b/src/common/config.cpp index ed9af5a72..a57b6d35c 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -45,6 +45,7 @@ static std::string logFilter; static std::string logType = "async"; static std::string userName = "shadPS4"; static std::string updateChannel; +static std::string chooseHomeTab; static u16 deadZoneLeft = 2.0; static u16 deadZoneRight = 2.0; static std::string backButtonBehavior = "left"; @@ -78,6 +79,7 @@ static std::string trophyKey; static bool load_game_size = true; std::vector settings_install_dirs = {}; std::filesystem::path settings_addon_install_dir = {}; +std::filesystem::path save_data_path = {}; u32 main_window_geometry_x = 400; u32 main_window_geometry_y = 400; u32 main_window_geometry_w = 1280; @@ -110,6 +112,13 @@ bool GetLoadGameSizeEnabled() { return load_game_size; } +std::filesystem::path GetSaveDataPath() { + if (save_data_path.empty()) { + return Common::FS::GetUserPath(Common::FS::PathType::SaveDataDir); + } + return save_data_path; +} + void setLoadGameSizeEnabled(bool enable) { load_game_size = enable; } @@ -186,6 +195,10 @@ std::string getUpdateChannel() { return updateChannel; } +std::string getChooseHomeTab() { + return chooseHomeTab; +} + std::string getBackButtonBehavior() { return backButtonBehavior; } @@ -391,6 +404,9 @@ void setUserName(const std::string& type) { void setUpdateChannel(const std::string& type) { updateChannel = type; } +void setChooseHomeTab(const std::string& type) { + chooseHomeTab = type; +} void setBackButtonBehavior(const std::string& type) { backButtonBehavior = type; @@ -502,6 +518,10 @@ void setGameInstallDirs(const std::vector& settings_insta settings_install_dirs = settings_install_dirs_config; } +void setSaveDataPath(const std::filesystem::path& path) { + save_data_path = path; +} + u32 getMainWindowGeometryX() { return main_window_geometry_x; } @@ -625,6 +645,7 @@ void load(const std::filesystem::path& path) { compatibilityData = toml::find_or(general, "compatibilityEnabled", false); checkCompatibilityOnStartup = toml::find_or(general, "checkCompatibilityOnStartup", false); + chooseHomeTab = toml::find_or(general, "chooseHomeTab", "Release"); } if (data.contains("Input")) { @@ -690,6 +711,8 @@ void load(const std::filesystem::path& path) { addGameInstallDir(std::filesystem::path{dir}); } + save_data_path = toml::find_fs_path_or(gui, "saveDataPath", {}); + settings_addon_install_dir = toml::find_fs_path_or(gui, "addonInstallDir", {}); main_window_geometry_x = toml::find_or(gui, "geometry_x", 0); main_window_geometry_y = toml::find_or(gui, "geometry_y", 0); @@ -746,6 +769,7 @@ void save(const std::filesystem::path& path) { data["General"]["logType"] = logType; data["General"]["userName"] = userName; data["General"]["updateChannel"] = updateChannel; + data["General"]["chooseHomeTab"] = chooseHomeTab; data["General"]["showSplash"] = isShowSplash; data["General"]["autoUpdate"] = isAutoUpdate; data["General"]["separateUpdateEnabled"] = separateupdatefolder; @@ -784,6 +808,7 @@ void save(const std::filesystem::path& path) { install_dirs.emplace_back(std::string{fmt::UTF(dirString.u8string()).data}); } data["GUI"]["installDirs"] = install_dirs; + data["GUI"]["saveDataPath"] = std::string{fmt::UTF(save_data_path.u8string()).data}; data["GUI"]["loadGameSizeEnabled"] = load_game_size; data["GUI"]["addonInstallDir"] = @@ -856,6 +881,7 @@ void setDefaultValues() { } else { updateChannel = "Nightly"; } + chooseHomeTab = "General"; cursorState = HideCursorState::Idle; cursorHideTimeout = 5; backButtonBehavior = "left"; @@ -883,4 +909,4 @@ void setDefaultValues() { checkCompatibilityOnStartup = false; } -} // namespace Config +} // namespace Config \ No newline at end of file diff --git a/src/common/config.h b/src/common/config.h index cb56f99c7..15937606e 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -18,6 +18,7 @@ void saveMainWindow(const std::filesystem::path& path); std::string getTrophyKey(); void setTrophyKey(std::string key); bool GetLoadGameSizeEnabled(); +std::filesystem::path GetSaveDataPath(); void setLoadGameSizeEnabled(bool enable); bool getIsFullscreen(); std::string getFullscreenMode(); @@ -34,6 +35,7 @@ std::string getLogFilter(); std::string getLogType(); std::string getUserName(); std::string getUpdateChannel(); +std::string getChooseHomeTab(); u16 leftDeadZone(); u16 rightDeadZone(); @@ -80,8 +82,10 @@ void setLanguage(u32 language); void setNeoMode(bool enable); void setUserName(const std::string& type); void setUpdateChannel(const std::string& type); +void setChooseHomeTab(const std::string& type); void setSeparateUpdateEnabled(bool use); void setGameInstallDirs(const std::vector& settings_install_dirs_config); +void setSaveDataPath(const std::filesystem::path& path); void setCompatibilityEnabled(bool use); void setCheckCompatibilityOnStartup(bool use); diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp index 168d03948..dd708c528 100644 --- a/src/common/logging/filter.cpp +++ b/src/common/logging/filter.cpp @@ -131,6 +131,9 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) { SUB(Lib, Videodec) \ SUB(Lib, RazorCpu) \ SUB(Lib, Mouse) \ + SUB(Lib, WebBrowserDialog) \ + SUB(Lib, NpParty) \ + SUB(Lib, Zlib) \ CLS(Frontend) \ CLS(Render) \ SUB(Render, Vulkan) \ diff --git a/src/common/logging/types.h b/src/common/logging/types.h index 4ca88e1be..54f8cdd0b 100644 --- a/src/common/logging/types.h +++ b/src/common/logging/types.h @@ -98,6 +98,9 @@ enum class Class : u8 { Lib_Videodec, ///< The LibSceVideodec 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. Frontend, ///< Emulator UI Render, ///< Video Core Render_Vulkan, ///< Vulkan backend diff --git a/src/common/memory_patcher.cpp b/src/common/memory_patcher.cpp index 6b79edb9f..f81a0ed83 100644 --- a/src/common/memory_patcher.cpp +++ b/src/common/memory_patcher.cpp @@ -7,6 +7,7 @@ #include #include #ifdef ENABLE_QT_GUI +#include #include #include #include @@ -189,14 +190,16 @@ void OnGameLoaded() { // 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)); - QString repositories[] = {"GoldHEN", "shadPS4"}; + QDir dir(patchDir); + QStringList folders = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); - for (const QString& repository : repositories) { - QString filesJsonPath = patchDir + "/" + repository + "/files.json"; + 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."); + LOG_ERROR(Loader, "Unable to open files.json for reading in repository {}", + folder.toStdString()); continue; } @@ -220,11 +223,12 @@ void OnGameLoaded() { } if (selectedFileName.isEmpty()) { - LOG_ERROR(Loader, "No patch file found for the current serial."); + LOG_ERROR(Loader, "No patch file found for the current serial in repository {}", + folder.toStdString()); continue; } - QString filePath = patchDir + "/" + repository + "/" + selectedFileName; + 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."); diff --git a/src/core/address_space.cpp b/src/core/address_space.cpp index 2b7331cbd..e9fb8cfbc 100644 --- a/src/core/address_space.cpp +++ b/src/core/address_space.cpp @@ -67,28 +67,25 @@ struct AddressSpace::Impl { static constexpr size_t ReductionOnFail = 1_GB; static constexpr size_t MaxReductions = 10; - size_t reduction = 0; size_t virtual_size = SystemManagedSize + SystemReservedSize + UserSize; for (u32 i = 0; i < MaxReductions; i++) { - virtual_base = static_cast(VirtualAlloc2(process, NULL, virtual_size - reduction, + virtual_base = static_cast(VirtualAlloc2(process, NULL, virtual_size, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, PAGE_NOACCESS, ¶m, 1)); if (virtual_base) { break; } - reduction += ReductionOnFail; + virtual_size -= ReductionOnFail; } ASSERT_MSG(virtual_base, "Unable to reserve virtual address space: {}", Common::GetLastErrorMsg()); - // Take the reduction off of the system managed area, and leave the others unchanged. - reduction = size_t(virtual_base - SYSTEM_MANAGED_MIN); - system_managed_base = virtual_base; - system_managed_size = SystemManagedSize - reduction; system_reserved_base = reinterpret_cast(SYSTEM_RESERVED_MIN); system_reserved_size = SystemReservedSize; + system_managed_base = virtual_base; + system_managed_size = system_reserved_base - virtual_base; user_base = reinterpret_cast(USER_MIN); - user_size = UserSize; + user_size = virtual_base + virtual_size - user_base; LOG_INFO(Kernel_Vmm, "System managed virtual memory region: {} - {}", fmt::ptr(system_managed_base), @@ -101,10 +98,8 @@ struct AddressSpace::Impl { // Initializer placeholder tracker const uintptr_t system_managed_addr = reinterpret_cast(system_managed_base); - const uintptr_t system_reserved_addr = reinterpret_cast(system_reserved_base); - const uintptr_t user_addr = reinterpret_cast(user_base); regions.emplace(system_managed_addr, - MemoryRegion{system_managed_addr, virtual_size - reduction, false}); + MemoryRegion{system_managed_addr, virtual_size, false}); // Allocate backing file that represents the total physical memory. backing_handle = diff --git a/src/core/debug_state.cpp b/src/core/debug_state.cpp index 6508a9875..23ebcbb9b 100644 --- a/src/core/debug_state.cpp +++ b/src/core/debug_state.cpp @@ -17,6 +17,8 @@ using namespace DebugStateType; DebugStateImpl& DebugState = *Common::Singleton::Instance(); +bool DebugStateType::showing_debug_menu_bar = false; + static ThreadID ThisThreadID() { #ifdef _WIN32 return GetCurrentThreadId(); diff --git a/src/core/debug_state.h b/src/core/debug_state.h index a9e6f48b7..217efd1a9 100644 --- a/src/core/debug_state.h +++ b/src/core/debug_state.h @@ -35,6 +35,8 @@ class ShaderList; namespace DebugStateType { +extern bool showing_debug_menu_bar; + enum class QueueType { dcb = 0, ccb = 1, @@ -131,8 +133,6 @@ class DebugStateImpl { friend class Core::Devtools::Widget::FrameGraph; friend class Core::Devtools::Widget::ShaderList; - bool showing_debug_menu_bar = false; - std::queue debug_message_popup; std::mutex guest_threads_mutex{}; diff --git a/src/core/devices/base_device.cpp b/src/core/devices/base_device.cpp index 4f91c81c7..fc2a98a29 100644 --- a/src/core/devices/base_device.cpp +++ b/src/core/devices/base_device.cpp @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #include "base_device.h" diff --git a/src/core/devices/base_device.h b/src/core/devices/base_device.h index 351af82b4..36614b8f4 100644 --- a/src/core/devices/base_device.h +++ b/src/core/devices/base_device.h @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #pragma once diff --git a/src/core/devices/dev_console.cpp b/src/core/devices/console_device.cpp similarity index 92% rename from src/core/devices/dev_console.cpp rename to src/core/devices/console_device.cpp index 0ddcfd040..f109cadb9 100644 --- a/src/core/devices/dev_console.cpp +++ b/src/core/devices/console_device.cpp @@ -1,34 +1,41 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #include "common/logging/log.h" -#include "dev_console.h" +#include "console_device.h" namespace Core::Devices { + std::shared_ptr ConsoleDevice::Create(u32 handle, const char*, int, u16) { return std::shared_ptr( reinterpret_cast(new ConsoleDevice(handle))); } + int ConsoleDevice::ioctl(u64 cmd, Common::VaCtx* args) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 ConsoleDevice::write(const void* buf, size_t nbytes) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + size_t ConsoleDevice::writev(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + size_t ConsoleDevice::readv(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 ConsoleDevice::preadv(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt, u64 offset) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 ConsoleDevice::lseek(s64 offset, int whence) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; diff --git a/src/core/devices/dev_console.h b/src/core/devices/console_device.h similarity index 90% rename from src/core/devices/dev_console.h rename to src/core/devices/console_device.h index f280200e2..d4b590ba0 100644 --- a/src/core/devices/dev_console.h +++ b/src/core/devices/console_device.h @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include diff --git a/src/core/devices/deci_tty6.cpp b/src/core/devices/deci_tty6_device.cpp similarity index 92% rename from src/core/devices/deci_tty6.cpp rename to src/core/devices/deci_tty6_device.cpp index 20423de61..e7a5fd4fc 100644 --- a/src/core/devices/deci_tty6.cpp +++ b/src/core/devices/deci_tty6_device.cpp @@ -1,34 +1,41 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #include "common/logging/log.h" -#include "deci_tty6.h" +#include "deci_tty6_device.h" namespace Core::Devices { + std::shared_ptr DeciTty6Device::Create(u32 handle, const char*, int, u16) { return std::shared_ptr( reinterpret_cast(new DeciTty6Device(handle))); } + int DeciTty6Device::ioctl(u64 cmd, Common::VaCtx* args) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 DeciTty6Device::write(const void* buf, size_t nbytes) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + size_t DeciTty6Device::writev(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + size_t DeciTty6Device::readv(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 DeciTty6Device::preadv(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt, u64 offset) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 DeciTty6Device::lseek(s64 offset, int whence) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; @@ -63,4 +70,5 @@ s64 DeciTty6Device::pwrite(const void* buf, size_t nbytes, u64 offset) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + } // namespace Core::Devices \ No newline at end of file diff --git a/src/core/devices/deci_tty6.h b/src/core/devices/deci_tty6_device.h similarity index 90% rename from src/core/devices/deci_tty6.h rename to src/core/devices/deci_tty6_device.h index 71cbfba6b..b8bd48556 100644 --- a/src/core/devices/deci_tty6.h +++ b/src/core/devices/deci_tty6_device.h @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include diff --git a/src/core/devices/ioccom.h b/src/core/devices/ioccom.h index 671ee33d4..2ded90bd8 100644 --- a/src/core/devices/ioccom.h +++ b/src/core/devices/ioccom.h @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #pragma once diff --git a/src/core/devices/logger.cpp b/src/core/devices/logger.cpp index 6f104509c..8dcb24a3b 100644 --- a/src/core/devices/logger.cpp +++ b/src/core/devices/logger.cpp @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #include "common/logging/log.h" #include "core/libraries/kernel/file_system.h" @@ -17,10 +17,12 @@ s64 Logger::write(const void* buf, size_t nbytes) { } size_t Logger::writev(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) { + size_t total_written = 0; for (int i = 0; i < iovcnt; i++) { log(static_cast(iov[i].iov_base), iov[i].iov_len); + total_written += iov[i].iov_len; } - return iovcnt; + return total_written; } s64 Logger::pwrite(const void* buf, size_t nbytes, u64 offset) { diff --git a/src/core/devices/logger.h b/src/core/devices/logger.h index bfb07f337..eef17bc4b 100644 --- a/src/core/devices/logger.h +++ b/src/core/devices/logger.h @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #pragma once diff --git a/src/core/devices/nop_device.h b/src/core/devices/nop_device.h index a75b92f1b..da9a3fc82 100644 --- a/src/core/devices/nop_device.h +++ b/src/core/devices/nop_device.h @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include "base_device.h" @@ -17,36 +17,47 @@ public: int ioctl(u64 cmd, Common::VaCtx* args) override { return 0; } + s64 write(const void* buf, size_t nbytes) override { return 0; } + size_t readv(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) override { return 0; } + size_t writev(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) override { return 0; } + s64 preadv(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt, u64 offset) override { return 0; } + s64 lseek(s64 offset, int whence) override { return 0; } + s64 read(void* buf, size_t nbytes) override { return 0; } + int fstat(Libraries::Kernel::OrbisKernelStat* sb) override { return 0; } + s32 fsync() override { return 0; } + int ftruncate(s64 length) override { return 0; } + int getdents(void* buf, u32 nbytes, s64* basep) override { return 0; } + s64 pwrite(const void* buf, size_t nbytes, u64 offset) override { return 0; } diff --git a/src/core/devices/random.cpp b/src/core/devices/random_device.cpp similarity index 90% rename from src/core/devices/random.cpp rename to src/core/devices/random_device.cpp index 705449423..50934e3b8 100644 --- a/src/core/devices/random.cpp +++ b/src/core/devices/random_device.cpp @@ -1,43 +1,52 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + #include #include "common/logging/log.h" -#include "random.h" +#include "random_device.h" namespace Core::Devices { + std::shared_ptr RandomDevice::Create(u32 handle, const char*, int, u16) { std::srand(std::time(nullptr)); return std::shared_ptr( reinterpret_cast(new RandomDevice(handle))); } + int RandomDevice::ioctl(u64 cmd, Common::VaCtx* args) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 RandomDevice::write(const void* buf, size_t nbytes) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + size_t RandomDevice::writev(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + size_t RandomDevice::readv(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 RandomDevice::preadv(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt, u64 offset) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 RandomDevice::lseek(s64 offset, int whence) { return 0; } s64 RandomDevice::read(void* buf, size_t nbytes) { auto rbuf = static_cast(buf); - for (size_t i = 0; i < nbytes; i++) + for (size_t i = 0; i < nbytes; i++) { rbuf[i] = std::rand() & 0xFF; + } return nbytes; } @@ -65,4 +74,5 @@ s64 RandomDevice::pwrite(const void* buf, size_t nbytes, u64 offset) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + } // namespace Core::Devices \ No newline at end of file diff --git a/src/core/devices/random.h b/src/core/devices/random_device.h similarity index 90% rename from src/core/devices/random.h rename to src/core/devices/random_device.h index 3bbed1ca2..a5c8e9845 100644 --- a/src/core/devices/random.h +++ b/src/core/devices/random_device.h @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include diff --git a/src/core/devices/srandom.cpp b/src/core/devices/srandom_device.cpp similarity index 90% rename from src/core/devices/srandom.cpp rename to src/core/devices/srandom_device.cpp index ff80adeaf..ab78ddbe2 100644 --- a/src/core/devices/srandom.cpp +++ b/src/core/devices/srandom_device.cpp @@ -1,35 +1,43 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + #include #include "common/logging/log.h" -#include "srandom.h" +#include "srandom_device.h" namespace Core::Devices { + std::shared_ptr SRandomDevice::Create(u32 handle, const char*, int, u16) { std::srand(std::time(nullptr)); return std::shared_ptr( reinterpret_cast(new SRandomDevice(handle))); } + int SRandomDevice::ioctl(u64 cmd, Common::VaCtx* args) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 SRandomDevice::write(const void* buf, size_t nbytes) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + size_t SRandomDevice::writev(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + size_t SRandomDevice::readv(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 SRandomDevice::preadv(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt, u64 offset) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 SRandomDevice::lseek(s64 offset, int whence) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; @@ -37,8 +45,9 @@ s64 SRandomDevice::lseek(s64 offset, int whence) { s64 SRandomDevice::read(void* buf, size_t nbytes) { auto rbuf = static_cast(buf); - for (size_t i = 0; i < nbytes; i++) + for (size_t i = 0; i < nbytes; i++) { rbuf[i] = std::rand(); + } return nbytes; } @@ -66,4 +75,5 @@ s64 SRandomDevice::pwrite(const void* buf, size_t nbytes, u64 offset) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + } // namespace Core::Devices \ No newline at end of file diff --git a/src/core/devices/srandom.h b/src/core/devices/srandom_device.h similarity index 90% rename from src/core/devices/srandom.h rename to src/core/devices/srandom_device.h index 3a3b02571..cd32f7289 100644 --- a/src/core/devices/srandom.h +++ b/src/core/devices/srandom_device.h @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include diff --git a/src/core/devices/urandom.cpp b/src/core/devices/urandom_device.cpp similarity index 90% rename from src/core/devices/urandom.cpp rename to src/core/devices/urandom_device.cpp index 8917caea5..c001aab83 100644 --- a/src/core/devices/urandom.cpp +++ b/src/core/devices/urandom_device.cpp @@ -1,8 +1,9 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + #include #include "common/logging/log.h" -#include "urandom.h" +#include "urandom_device.h" namespace Core::Devices { @@ -16,22 +17,27 @@ int URandomDevice::ioctl(u64 cmd, Common::VaCtx* args) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 URandomDevice::write(const void* buf, size_t nbytes) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + size_t URandomDevice::writev(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + size_t URandomDevice::readv(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 URandomDevice::preadv(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt, u64 offset) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + s64 URandomDevice::lseek(s64 offset, int whence) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; @@ -39,8 +45,9 @@ s64 URandomDevice::lseek(s64 offset, int whence) { s64 URandomDevice::read(void* buf, size_t nbytes) { auto rbuf = static_cast(buf); - for (size_t i = 0; i < nbytes; i++) + for (size_t i = 0; i < nbytes; i++) { rbuf[i] = std::rand() & 0xFF; + } return nbytes; } @@ -68,4 +75,5 @@ s64 URandomDevice::pwrite(const void* buf, size_t nbytes, u64 offset) { LOG_ERROR(Kernel_Pthread, "(STUBBED) called"); return 0; } + } // namespace Core::Devices \ No newline at end of file diff --git a/src/core/devices/urandom.h b/src/core/devices/urandom_device.h similarity index 90% rename from src/core/devices/urandom.h rename to src/core/devices/urandom_device.h index 9370017d5..b8a854cc0 100644 --- a/src/core/devices/urandom.h +++ b/src/core/devices/urandom_device.h @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include diff --git a/src/core/devtools/widget/shader_list.cpp b/src/core/devtools/widget/shader_list.cpp index 97d01896d..0285db5a5 100644 --- a/src/core/devtools/widget/shader_list.cpp +++ b/src/core/devtools/widget/shader_list.cpp @@ -24,16 +24,33 @@ using namespace ImGui; namespace Core::Devtools::Widget { -ShaderList::Selection::Selection(int index) : index(index) { - isa_editor.SetPalette(TextEditor::GetDarkPalette()); - isa_editor.SetReadOnly(true); - glsl_editor.SetPalette(TextEditor::GetDarkPalette()); - glsl_editor.SetLanguageDefinition(TextEditor::LanguageDefinition::GLSL()); +ShaderList::Selection::Selection(int index) + : index(index), isa_editor(std::make_unique()), + glsl_editor(std::make_unique()) { + isa_editor->SetPalette(TextEditor::GetDarkPalette()); + isa_editor->SetReadOnly(true); + glsl_editor->SetPalette(TextEditor::GetDarkPalette()); + glsl_editor->SetLanguageDefinition(TextEditor::LanguageDefinition::GLSL()); presenter->GetWindow().RequestKeyboard(); } ShaderList::Selection::~Selection() { - presenter->GetWindow().ReleaseKeyboard(); + if (index >= 0) { + presenter->GetWindow().ReleaseKeyboard(); + } +} + +ShaderList::Selection::Selection(Selection&& other) noexcept + : index{other.index}, isa_editor{std::move(other.isa_editor)}, + glsl_editor{std::move(other.glsl_editor)}, open{other.open}, showing_bin{other.showing_bin}, + patch_path{std::move(other.patch_path)}, patch_bin_path{std::move(other.patch_bin_path)} { + other.index = -1; +} + +ShaderList::Selection& ShaderList::Selection::operator=(Selection other) { + using std::swap; + swap(*this, other); + return *this; } void ShaderList::Selection::ReloadShader(DebugStateType::ShaderDump& value) { @@ -72,13 +89,13 @@ bool ShaderList::Selection::DrawShader(DebugStateType::ShaderDump& value) { value.is_patched = !value.patch_spv.empty(); if (!value.is_patched) { // No patch - isa_editor.SetText(value.cache_isa_disasm); - glsl_editor.SetText(value.cache_spv_disasm); + isa_editor->SetText(value.cache_isa_disasm); + glsl_editor->SetText(value.cache_spv_disasm); } else { - isa_editor.SetText(value.cache_patch_disasm); - isa_editor.SetLanguageDefinition(TextEditor::LanguageDefinition::SPIRV()); - glsl_editor.SetText(value.patch_source); - glsl_editor.SetReadOnly(false); + isa_editor->SetText(value.cache_patch_disasm); + isa_editor->SetLanguageDefinition(TextEditor::LanguageDefinition::SPIRV()); + glsl_editor->SetText(value.patch_source); + glsl_editor->SetReadOnly(false); } } @@ -97,18 +114,18 @@ bool ShaderList::Selection::DrawShader(DebugStateType::ShaderDump& value) { if (value.patch_source.empty()) { value.patch_source = value.cache_spv_disasm; } - isa_editor.SetText(value.cache_patch_disasm); - isa_editor.SetLanguageDefinition(TextEditor::LanguageDefinition::SPIRV()); - glsl_editor.SetText(value.patch_source); - glsl_editor.SetReadOnly(false); + isa_editor->SetText(value.cache_patch_disasm); + isa_editor->SetLanguageDefinition(TextEditor::LanguageDefinition::SPIRV()); + glsl_editor->SetText(value.patch_source); + glsl_editor->SetReadOnly(false); if (!value.patch_spv.empty()) { ReloadShader(value); } } else { - isa_editor.SetText(value.cache_isa_disasm); - isa_editor.SetLanguageDefinition(TextEditor::LanguageDefinition()); - glsl_editor.SetText(value.cache_spv_disasm); - glsl_editor.SetReadOnly(true); + isa_editor->SetText(value.cache_isa_disasm); + isa_editor->SetLanguageDefinition(TextEditor::LanguageDefinition()); + glsl_editor->SetText(value.cache_spv_disasm); + glsl_editor->SetReadOnly(true); ReloadShader(value); } } @@ -154,7 +171,7 @@ bool ShaderList::Selection::DrawShader(DebugStateType::ShaderDump& value) { compile = true; } if (save) { - value.patch_source = glsl_editor.GetText(); + value.patch_source = glsl_editor->GetText(); std::ofstream file{patch_path, std::ios::binary | std::ios::trunc}; file << value.patch_source; std::string msg = "Patch saved to "; @@ -192,7 +209,7 @@ bool ShaderList::Selection::DrawShader(DebugStateType::ShaderDump& value) { DebugState.ShowDebugMessage("Decompilation failed (Compile was ok):\n" + res); } else { - isa_editor.SetText(value.cache_patch_disasm); + isa_editor->SetText(value.cache_patch_disasm); ReloadShader(value); } } @@ -201,9 +218,9 @@ bool ShaderList::Selection::DrawShader(DebugStateType::ShaderDump& value) { } if (showing_bin) { - isa_editor.Render(value.is_patched ? "SPIRV" : "ISA", GetContentRegionAvail()); + isa_editor->Render(value.is_patched ? "SPIRV" : "ISA", GetContentRegionAvail()); } else { - glsl_editor.Render("GLSL", GetContentRegionAvail()); + glsl_editor->Render("GLSL", GetContentRegionAvail()); } End(); diff --git a/src/core/devtools/widget/shader_list.h b/src/core/devtools/widget/shader_list.h index fbb8d2070..c882b0964 100644 --- a/src/core/devtools/widget/shader_list.h +++ b/src/core/devtools/widget/shader_list.h @@ -14,14 +14,17 @@ class ShaderList { struct Selection { explicit Selection(int index); ~Selection(); + Selection(const Selection& other) = delete; + Selection(Selection&& other) noexcept; + Selection& operator=(Selection other); void ReloadShader(DebugStateType::ShaderDump& value); bool DrawShader(DebugStateType::ShaderDump& value); - int index; - TextEditor isa_editor{}; - TextEditor glsl_editor{}; + int index{-1}; + std::unique_ptr isa_editor{}; + std::unique_ptr glsl_editor{}; bool open = true; bool showing_bin = false; diff --git a/src/core/file_sys/fs.cpp b/src/core/file_sys/fs.cpp index 7d456780b..ec940503f 100644 --- a/src/core/file_sys/fs.cpp +++ b/src/core/file_sys/fs.cpp @@ -233,7 +233,7 @@ void HandleTable::CreateStdHandles() { std::shared_ptr{reinterpret_cast(device)}; }; // order matters - setup("/dev/stdin", new Devices::NopDevice(0)); // stdin + setup("/dev/stdin", new Devices::Logger("stdin", false)); // stdin setup("/dev/stdout", new Devices::Logger("stdout", false)); // stdout setup("/dev/stderr", new Devices::Logger("stderr", true)); // stderr } diff --git a/src/core/libraries/app_content/app_content.cpp b/src/core/libraries/app_content/app_content.cpp index 1d23e7f44..1223022c5 100644 --- a/src/core/libraries/app_content/app_content.cpp +++ b/src/core/libraries/app_content/app_content.cpp @@ -12,6 +12,7 @@ #include "core/file_sys/fs.h" #include "core/libraries/app_content/app_content_error.h" #include "core/libraries/libs.h" +#include "core/libraries/system/systemservice.h" namespace Libraries::AppContent { @@ -262,6 +263,15 @@ int PS4_SYSV_ABI sceAppContentInitialize(const OrbisAppContentInitParam* initPar entitlement_label.copy(info.entitlement_label, sizeof(info.entitlement_label)); } } + + if (addcont_count > 0) { + SystemService::OrbisSystemServiceEvent event{}; + event.event_type = SystemService::OrbisSystemServiceEventType::EntitlementUpdate; + event.service_entitlement_update.user_id = 0; + event.service_entitlement_update.np_service_label = 0; + SystemService::PushSystemServiceEvent(event); + } + return ORBIS_OK; } diff --git a/src/core/libraries/fiber/fiber.cpp b/src/core/libraries/fiber/fiber.cpp index b77b5b5b6..345f0834d 100644 --- a/src/core/libraries/fiber/fiber.cpp +++ b/src/core/libraries/fiber/fiber.cpp @@ -37,8 +37,9 @@ extern "C" void PS4_SYSV_ABI _sceFiberForceQuit(u64 ret) { void PS4_SYSV_ABI _sceFiberCheckStackOverflow(OrbisFiberContext* ctx) { u64* stack_base = reinterpret_cast(ctx->current_fiber->addr_context); + u64 stack_size = ctx->current_fiber->size_context; if (stack_base && *stack_base != kFiberStackSignature) { - UNREACHABLE_MSG("Stack overflow detected in fiber."); + UNREACHABLE_MSG("Stack overflow detected in fiber with size = 0x{:x}", stack_size); } } diff --git a/src/core/libraries/gnmdriver/gnmdriver.cpp b/src/core/libraries/gnmdriver/gnmdriver.cpp index fdc3a1acd..06124167c 100644 --- a/src/core/libraries/gnmdriver/gnmdriver.cpp +++ b/src/core/libraries/gnmdriver/gnmdriver.cpp @@ -1366,7 +1366,7 @@ s32 PS4_SYSV_ABI sceGnmSetEmbeddedPsShader(u32* cmdbuf, u32 size, u32 shader_id, // pointer to a stack memory, so the check will likely fail. To workaround it we will // repeat set shader functionality here as it is trivial. cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 8u, ps_regs[0], - 0u); // SPI_SHADER_PGM_LO_PS/SPI_SHADER_PGM_HI_PS + ps_regs[1]); // SPI_SHADER_PGM_LO_PS/SPI_SHADER_PGM_HI_PS cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 10u, ps_regs[2], ps_regs[3]); // SPI_SHADER_PGM_RSRC1_PS/SPI_SHADER_PGM_RSRC2_PS cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x1c4u, ps_regs[4], diff --git a/src/core/libraries/kernel/file_system.cpp b/src/core/libraries/kernel/file_system.cpp index ce91fe192..0150c11f5 100644 --- a/src/core/libraries/kernel/file_system.cpp +++ b/src/core/libraries/kernel/file_system.cpp @@ -8,13 +8,13 @@ #include "common/logging/log.h" #include "common/scope_exit.h" #include "common/singleton.h" -#include "core/devices/deci_tty6.h" -#include "core/devices/dev_console.h" +#include "core/devices/console_device.h" +#include "core/devices/deci_tty6_device.h" #include "core/devices/logger.h" #include "core/devices/nop_device.h" -#include "core/devices/random.h" -#include "core/devices/srandom.h" -#include "core/devices/urandom.h" +#include "core/devices/random_device.h" +#include "core/devices/srandom_device.h" +#include "core/devices/urandom_device.h" #include "core/file_sys/fs.h" #include "core/libraries/kernel/file_system.h" #include "core/libraries/kernel/orbis_error.h" @@ -270,13 +270,6 @@ size_t PS4_SYSV_ABI _readv(int d, const SceKernelIovec* iov, int iovcnt) { } size_t PS4_SYSV_ABI _writev(int fd, const SceKernelIovec* iov, int iovcn) { - if (fd == 1) { - size_t total_written = 0; - for (int i = 0; i < iovcn; i++) { - total_written += ::fwrite(iov[i].iov_base, 1, iov[i].iov_len, stdout); - } - return total_written; - } auto* h = Common::Singleton::Instance(); auto* file = h->GetFile(fd); if (file == nullptr) { diff --git a/src/core/libraries/libs.cpp b/src/core/libraries/libs.cpp index 6dc455028..8cf286d13 100644 --- a/src/core/libraries/libs.cpp +++ b/src/core/libraries/libs.cpp @@ -28,6 +28,7 @@ #include "core/libraries/network/ssl2.h" #include "core/libraries/np_common/np_common.h" #include "core/libraries/np_manager/np_manager.h" +#include "core/libraries/np_party/np_party.h" #include "core/libraries/np_score/np_score.h" #include "core/libraries/np_trophy/np_trophy.h" #include "core/libraries/np_web_api/np_web_api.h" @@ -52,6 +53,8 @@ #include "core/libraries/videodec/videodec.h" #include "core/libraries/videodec/videodec2.h" #include "core/libraries/videoout/video_out.h" +#include "core/libraries/web_browser_dialog/webbrowserdialog.h" +#include "core/libraries/zlib/zlib_sce.h" #include "fiber/fiber.h" #include "jpeg/jpegenc.h" @@ -107,6 +110,9 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) { Libraries::Fiber::RegisterlibSceFiber(sym); Libraries::JpegEnc::RegisterlibSceJpegEnc(sym); Libraries::Mouse::RegisterlibSceMouse(sym); + Libraries::WebBrowserDialog::RegisterlibSceWebBrowserDialog(sym); + Libraries::NpParty::RegisterlibSceNpParty(sym); + Libraries::Zlib::RegisterlibSceZlib(sym); } } // namespace Libraries diff --git a/src/core/libraries/np_manager/np_manager.cpp b/src/core/libraries/np_manager/np_manager.cpp index e26c5a830..a60dcd86f 100644 --- a/src/core/libraries/np_manager/np_manager.cpp +++ b/src/core/libraries/np_manager/np_manager.cpp @@ -5,6 +5,7 @@ #include "core/libraries/error_codes.h" #include "core/libraries/libs.h" #include "core/libraries/np_manager/np_manager.h" +#include "core/libraries/np_manager/np_manager_error.h" #include "core/tls.h" namespace Libraries::NpManager { @@ -935,14 +936,22 @@ int PS4_SYSV_ABI sceNpGetAccountDateOfBirthA() { return ORBIS_OK; } -int PS4_SYSV_ABI sceNpGetAccountId() { - LOG_ERROR(Lib_NpManager, "(STUBBED) called"); - return ORBIS_OK; +int PS4_SYSV_ABI sceNpGetAccountId(OrbisNpOnlineId* online_id, u64* account_id) { + LOG_DEBUG(Lib_NpManager, "called"); + if (online_id == nullptr || account_id == nullptr) { + return ORBIS_NP_ERROR_INVALID_ARGUMENT; + } + *account_id = 0; + return ORBIS_NP_ERROR_SIGNED_OUT; } -int PS4_SYSV_ABI sceNpGetAccountIdA() { - LOG_ERROR(Lib_NpManager, "(STUBBED) called"); - return ORBIS_OK; +int PS4_SYSV_ABI sceNpGetAccountIdA(OrbisUserServiceUserId user_id, u64* account_id) { + LOG_DEBUG(Lib_NpManager, "user_id {}", user_id); + if (account_id == nullptr) { + return ORBIS_NP_ERROR_INVALID_ARGUMENT; + } + *account_id = 0; + return ORBIS_NP_ERROR_SIGNED_OUT; } int PS4_SYSV_ABI sceNpGetAccountLanguage() { @@ -972,6 +981,9 @@ int PS4_SYSV_ABI sceNpGetGamePresenceStatusA() { int PS4_SYSV_ABI sceNpGetNpId(OrbisUserServiceUserId user_id, OrbisNpId* np_id) { LOG_DEBUG(Lib_NpManager, "user_id {}", user_id); + if (np_id == nullptr) { + return ORBIS_NP_ERROR_INVALID_ARGUMENT; + } return ORBIS_NP_ERROR_SIGNED_OUT; } @@ -980,8 +992,11 @@ int PS4_SYSV_ABI sceNpGetNpReachabilityState() { return ORBIS_OK; } -int PS4_SYSV_ABI sceNpGetOnlineId(s32 user_id, OrbisNpOnlineId* online_id) { +int PS4_SYSV_ABI sceNpGetOnlineId(OrbisUserServiceUserId user_id, OrbisNpOnlineId* online_id) { LOG_DEBUG(Lib_NpManager, "user_id {}", user_id); + if (online_id == nullptr) { + return ORBIS_NP_ERROR_INVALID_ARGUMENT; + } return ORBIS_NP_ERROR_SIGNED_OUT; } @@ -995,7 +1010,10 @@ int PS4_SYSV_ABI sceNpGetParentalControlInfoA() { return ORBIS_OK; } -int PS4_SYSV_ABI sceNpGetState(s32 userId, OrbisNpState* state) { +int PS4_SYSV_ABI sceNpGetState(OrbisUserServiceUserId user_id, OrbisNpState* state) { + if (state == nullptr) { + return ORBIS_NP_ERROR_INVALID_ARGUMENT; + } *state = OrbisNpState::SignedOut; LOG_DEBUG(Lib_NpManager, "Signed out"); return ORBIS_OK; @@ -1011,8 +1029,12 @@ int PS4_SYSV_ABI sceNpGetUserIdByOnlineId() { return ORBIS_OK; } -int PS4_SYSV_ABI sceNpHasSignedUp() { - LOG_ERROR(Lib_NpManager, "(STUBBED) called"); +int PS4_SYSV_ABI sceNpHasSignedUp(OrbisUserServiceUserId user_id, bool* has_signed_up) { + LOG_DEBUG(Lib_NpManager, "called"); + if (has_signed_up == nullptr) { + return ORBIS_NP_ERROR_INVALID_ARGUMENT; + } + *has_signed_up = false; return ORBIS_OK; } diff --git a/src/core/libraries/np_manager/np_manager.h b/src/core/libraries/np_manager/np_manager.h index 6ba588e5e..02a1a32f6 100644 --- a/src/core/libraries/np_manager/np_manager.h +++ b/src/core/libraries/np_manager/np_manager.h @@ -11,8 +11,6 @@ class SymbolsResolver; namespace Libraries::NpManager { -constexpr int ORBIS_NP_ERROR_SIGNED_OUT = 0x80550006; - enum class OrbisNpState : u32 { Unknown = 0, SignedOut, SignedIn }; using OrbisNpStateCallbackForNpToolkit = PS4_SYSV_ABI void (*)(s32 userId, OrbisNpState state, @@ -220,22 +218,22 @@ int PS4_SYSV_ABI sceNpGetAccountCountry(); int PS4_SYSV_ABI sceNpGetAccountCountryA(); int PS4_SYSV_ABI sceNpGetAccountDateOfBirth(); int PS4_SYSV_ABI sceNpGetAccountDateOfBirthA(); -int PS4_SYSV_ABI sceNpGetAccountId(); -int PS4_SYSV_ABI sceNpGetAccountIdA(); +int PS4_SYSV_ABI sceNpGetAccountId(OrbisNpOnlineId* online_id, u64* account_id); +int PS4_SYSV_ABI sceNpGetAccountIdA(OrbisUserServiceUserId user_id, u64* account_id); int PS4_SYSV_ABI sceNpGetAccountLanguage(); int PS4_SYSV_ABI sceNpGetAccountLanguage2(); int PS4_SYSV_ABI sceNpGetAccountLanguageA(); int PS4_SYSV_ABI sceNpGetGamePresenceStatus(); int PS4_SYSV_ABI sceNpGetGamePresenceStatusA(); -int PS4_SYSV_ABI sceNpGetNpId(OrbisUserServiceUserId userId, OrbisNpId* npId); +int PS4_SYSV_ABI sceNpGetNpId(OrbisUserServiceUserId user_id, OrbisNpId* np_id); int PS4_SYSV_ABI sceNpGetNpReachabilityState(); -int PS4_SYSV_ABI sceNpGetOnlineId(s32 userId, OrbisNpOnlineId* onlineId); +int PS4_SYSV_ABI sceNpGetOnlineId(OrbisUserServiceUserId user_id, OrbisNpOnlineId* online_id); int PS4_SYSV_ABI sceNpGetParentalControlInfo(); int PS4_SYSV_ABI sceNpGetParentalControlInfoA(); -int PS4_SYSV_ABI sceNpGetState(s32 userId, OrbisNpState* state); +int PS4_SYSV_ABI sceNpGetState(OrbisUserServiceUserId user_id, OrbisNpState* state); int PS4_SYSV_ABI sceNpGetUserIdByAccountId(); int PS4_SYSV_ABI sceNpGetUserIdByOnlineId(); -int PS4_SYSV_ABI sceNpHasSignedUp(); +int PS4_SYSV_ABI sceNpHasSignedUp(OrbisUserServiceUserId user_id, bool* has_signed_up); int PS4_SYSV_ABI sceNpIdMapperAbortRequest(); int PS4_SYSV_ABI sceNpIdMapperAccountIdToNpId(); int PS4_SYSV_ABI sceNpIdMapperAccountIdToOnlineId(); diff --git a/src/core/libraries/np_manager/np_manager_error.h b/src/core/libraries/np_manager/np_manager_error.h new file mode 100644 index 000000000..4af0d08ef --- /dev/null +++ b/src/core/libraries/np_manager/np_manager_error.h @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +constexpr int ORBIS_NP_ERROR_INVALID_ARGUMENT = 0x80550003; +constexpr int ORBIS_NP_ERROR_SIGNED_OUT = 0x80550006; \ No newline at end of file diff --git a/src/core/libraries/np_party/np_party.cpp b/src/core/libraries/np_party/np_party.cpp new file mode 100644 index 000000000..8a66ccb22 --- /dev/null +++ b/src/core/libraries/np_party/np_party.cpp @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" +#include "core/libraries/libs.h" +#include "core/libraries/np_party/np_party.h" + +namespace Libraries::NpParty { + +s32 PS4_SYSV_ABI sceNpPartyCheckCallback() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyCreate() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyCreateA() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyGetId() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyGetMemberInfo() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyGetMemberInfoA() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyGetMembers() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyGetMembersA() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyGetMemberSessionInfo() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyGetMemberVoiceInfo() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyGetState() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyGetStateAsUser() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyGetStateAsUserA() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyGetVoiceChatPriority() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyInitialize() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyJoin() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyLeave() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyRegisterHandler() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyRegisterHandlerA() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyRegisterPrivateHandler() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartySendBinaryMessage() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartySetVoiceChatPriority() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyShowInvitationList() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyShowInvitationListA() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyTerminate() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNpPartyUnregisterPrivateHandler() { + LOG_ERROR(Lib_NpParty, "(STUBBED) called"); + return ORBIS_OK; +} + +void RegisterlibSceNpParty(Core::Loader::SymbolsResolver* sym) { + LIB_FUNCTION("3e4k2mzLkmc", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyCheckCallback); + LIB_FUNCTION("nOZRy-slBoA", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyCreate); + LIB_FUNCTION("XQSUbbnpPBA", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyCreateA); + LIB_FUNCTION("DRA3ay-1DFQ", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyGetId); + LIB_FUNCTION("F1P+-wpxQow", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyGetMemberInfo); + LIB_FUNCTION("v2RYVGrJDkM", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartyGetMemberInfoA); + LIB_FUNCTION("T2UOKf00ZN0", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyGetMembers); + LIB_FUNCTION("TaNw7W25QJw", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyGetMembersA); + LIB_FUNCTION("4gOMfNYzllw", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartyGetMemberSessionInfo); + LIB_FUNCTION("EKi1jx59SP4", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartyGetMemberVoiceInfo); + LIB_FUNCTION("aEzKdJzATZ0", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyGetState); + LIB_FUNCTION("o7grRhiGHYI", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartyGetStateAsUser); + LIB_FUNCTION("EjyAI+QNgFw", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartyGetStateAsUserA); + LIB_FUNCTION("-lc6XZnQXvM", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartyGetVoiceChatPriority); + LIB_FUNCTION("lhYCTQmBkds", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyInitialize); + LIB_FUNCTION("RXNCDw2GDEg", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyJoin); + LIB_FUNCTION("J8jAi-tfJHc", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyLeave); + LIB_FUNCTION("kA88gbv71ao", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartyRegisterHandler); + LIB_FUNCTION("+v4fVHMwFWc", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartyRegisterHandlerA); + LIB_FUNCTION("zo4G5WWYpKg", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartyRegisterPrivateHandler); + LIB_FUNCTION("U6VdUe-PNAY", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartySendBinaryMessage); + LIB_FUNCTION("nazKyHygHhY", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartySetVoiceChatPriority); + LIB_FUNCTION("-MFiL7hEnPE", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartyShowInvitationList); + LIB_FUNCTION("yARHEYLajs0", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartyShowInvitationListA); + LIB_FUNCTION("oLYkibiHqRA", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyTerminate); + LIB_FUNCTION("zQ7gIvt11Pc", "libSceNpParty", 1, "libSceNpParty", 1, 1, + sceNpPartyUnregisterPrivateHandler); + LIB_FUNCTION("nOZRy-slBoA", "libSceNpPartyCompat", 1, "libSceNpParty", 1, 1, sceNpPartyCreate); + LIB_FUNCTION("F1P+-wpxQow", "libSceNpPartyCompat", 1, "libSceNpParty", 1, 1, + sceNpPartyGetMemberInfo); + LIB_FUNCTION("T2UOKf00ZN0", "libSceNpPartyCompat", 1, "libSceNpParty", 1, 1, + sceNpPartyGetMembers); + LIB_FUNCTION("o7grRhiGHYI", "libSceNpPartyCompat", 1, "libSceNpParty", 1, 1, + sceNpPartyGetStateAsUser); + LIB_FUNCTION("kA88gbv71ao", "libSceNpPartyCompat", 1, "libSceNpParty", 1, 1, + sceNpPartyRegisterHandler); + LIB_FUNCTION("-MFiL7hEnPE", "libSceNpPartyCompat", 1, "libSceNpParty", 1, 1, + sceNpPartyShowInvitationList); +}; + +} // namespace Libraries::NpParty \ No newline at end of file diff --git a/src/core/libraries/np_party/np_party.h b/src/core/libraries/np_party/np_party.h new file mode 100644 index 000000000..d5f20e4f8 --- /dev/null +++ b/src/core/libraries/np_party/np_party.h @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/types.h" + +namespace Core::Loader { +class SymbolsResolver; +} + +namespace Libraries::NpParty { + +s32 PS4_SYSV_ABI sceNpPartyCheckCallback(); +s32 PS4_SYSV_ABI sceNpPartyCreate(); +s32 PS4_SYSV_ABI sceNpPartyCreateA(); +s32 PS4_SYSV_ABI sceNpPartyGetId(); +s32 PS4_SYSV_ABI sceNpPartyGetMemberInfo(); +s32 PS4_SYSV_ABI sceNpPartyGetMemberInfoA(); +s32 PS4_SYSV_ABI sceNpPartyGetMembers(); +s32 PS4_SYSV_ABI sceNpPartyGetMembersA(); +s32 PS4_SYSV_ABI sceNpPartyGetMemberSessionInfo(); +s32 PS4_SYSV_ABI sceNpPartyGetMemberVoiceInfo(); +s32 PS4_SYSV_ABI sceNpPartyGetState(); +s32 PS4_SYSV_ABI sceNpPartyGetStateAsUser(); +s32 PS4_SYSV_ABI sceNpPartyGetStateAsUserA(); +s32 PS4_SYSV_ABI sceNpPartyGetVoiceChatPriority(); +s32 PS4_SYSV_ABI sceNpPartyInitialize(); +s32 PS4_SYSV_ABI sceNpPartyJoin(); +s32 PS4_SYSV_ABI sceNpPartyLeave(); +s32 PS4_SYSV_ABI sceNpPartyRegisterHandler(); +s32 PS4_SYSV_ABI sceNpPartyRegisterHandlerA(); +s32 PS4_SYSV_ABI sceNpPartyRegisterPrivateHandler(); +s32 PS4_SYSV_ABI sceNpPartySendBinaryMessage(); +s32 PS4_SYSV_ABI sceNpPartySetVoiceChatPriority(); +s32 PS4_SYSV_ABI sceNpPartyShowInvitationList(); +s32 PS4_SYSV_ABI sceNpPartyShowInvitationListA(); +s32 PS4_SYSV_ABI sceNpPartyTerminate(); +s32 PS4_SYSV_ABI sceNpPartyUnregisterPrivateHandler(); +s32 PS4_SYSV_ABI module_start(); +s32 PS4_SYSV_ABI module_stop(); + +void RegisterlibSceNpParty(Core::Loader::SymbolsResolver* sym); +} // namespace Libraries::NpParty \ No newline at end of file diff --git a/src/core/libraries/pad/pad.cpp b/src/core/libraries/pad/pad.cpp index f2b81fbe0..18709bcb2 100644 --- a/src/core/libraries/pad/pad.cpp +++ b/src/core/libraries/pad/pad.cpp @@ -473,8 +473,8 @@ int PS4_SYSV_ABI scePadSetForceIntercepted() { int PS4_SYSV_ABI scePadSetLightBar(s32 handle, const OrbisPadLightBarParam* pParam) { if (pParam != nullptr) { - LOG_INFO(Lib_Pad, "scePadSetLightBar called handle = {} rgb = {} {} {}", handle, pParam->r, - pParam->g, pParam->b); + LOG_DEBUG(Lib_Pad, "called handle = {} rgb = {} {} {}", handle, pParam->r, pParam->g, + pParam->b); if (pParam->r < 0xD && pParam->g < 0xD && pParam->b < 0xD) { LOG_INFO(Lib_Pad, "Invalid lightbar setting"); diff --git a/src/core/libraries/save_data/save_instance.cpp b/src/core/libraries/save_data/save_instance.cpp index 99daf83cc..c2b7dca3c 100644 --- a/src/core/libraries/save_data/save_instance.cpp +++ b/src/core/libraries/save_data/save_instance.cpp @@ -47,15 +47,13 @@ namespace Libraries::SaveData { std::filesystem::path SaveInstance::MakeTitleSavePath(OrbisUserServiceUserId user_id, std::string_view game_serial) { - return Common::FS::GetUserPath(Common::FS::PathType::SaveDataDir) / std::to_string(user_id) / - game_serial; + return Config::GetSaveDataPath() / std::to_string(user_id) / game_serial; } std::filesystem::path SaveInstance::MakeDirSavePath(OrbisUserServiceUserId user_id, std::string_view game_serial, std::string_view dir_name) { - return Common::FS::GetUserPath(Common::FS::PathType::SaveDataDir) / std::to_string(user_id) / - game_serial / dir_name; + return Config::GetSaveDataPath() / std::to_string(user_id) / game_serial / dir_name; } uint64_t SaveInstance::GetMaxBlockFromSFO(const PSF& psf) { diff --git a/src/core/libraries/system/systemservice.cpp b/src/core/libraries/system/systemservice.cpp index ebb9f4392..a67b9a2fc 100644 --- a/src/core/libraries/system/systemservice.cpp +++ b/src/core/libraries/system/systemservice.cpp @@ -10,6 +10,8 @@ namespace Libraries::SystemService { bool g_splash_status{true}; +std::queue g_event_queue; +std::mutex g_event_queue_mutex; bool IsSplashVisible() { return Config::showSplash() && g_splash_status; @@ -1772,7 +1774,9 @@ s32 PS4_SYSV_ABI sceSystemServiceGetStatus(OrbisSystemServiceStatus* status) { LOG_ERROR(Lib_SystemService, "OrbisSystemServiceStatus is null"); return ORBIS_SYSTEM_SERVICE_ERROR_PARAMETER; } - status->event_num = 0; + + std::lock_guard lock(g_event_queue_mutex); + status->event_num = static_cast(g_event_queue.size()); status->is_system_ui_overlaid = false; status->is_in_background_execution = false; status->is_cpu_mode7_cpu_normal = true; @@ -1940,11 +1944,19 @@ int PS4_SYSV_ABI sceSystemServiceRaiseExceptionLocalProcess() { } s32 PS4_SYSV_ABI sceSystemServiceReceiveEvent(OrbisSystemServiceEvent* event) { - LOG_ERROR(Lib_SystemService, "(STUBBED) called"); + LOG_TRACE(Lib_SystemService, "called"); if (event == nullptr) { return ORBIS_SYSTEM_SERVICE_ERROR_PARAMETER; } - return ORBIS_SYSTEM_SERVICE_ERROR_NO_EVENT; + + std::lock_guard lock(g_event_queue_mutex); + if (g_event_queue.empty()) { + return ORBIS_SYSTEM_SERVICE_ERROR_NO_EVENT; + } + + *event = g_event_queue.front(); + g_event_queue.pop(); + return ORBIS_OK; } int PS4_SYSV_ABI sceSystemServiceReenableMusicPlayer() { @@ -2412,6 +2424,11 @@ int PS4_SYSV_ABI Func_CB5E885E225F69F0() { return ORBIS_OK; } +void PushSystemServiceEvent(const OrbisSystemServiceEvent& event) { + std::lock_guard lock(g_event_queue_mutex); + g_event_queue.push(event); +} + void RegisterlibSceSystemService(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("alZfRdr2RP8", "libSceAppMessaging", 1, "libSceSystemService", 1, 1, sceAppMessagingClearEventFlag); diff --git a/src/core/libraries/system/systemservice.h b/src/core/libraries/system/systemservice.h index cdd3c15e8..c22ccc88f 100644 --- a/src/core/libraries/system/systemservice.h +++ b/src/core/libraries/system/systemservice.h @@ -4,6 +4,8 @@ // https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain/blob/master/include/orbis/_types/sys_service.h #pragma once +#include +#include #include "common/types.h" namespace Core::Loader { @@ -603,5 +605,7 @@ int PS4_SYSV_ABI sceSystemServiceReenableVoiceRecognition(); int PS4_SYSV_ABI Func_6B1CDB955F0EBD65(); int PS4_SYSV_ABI Func_CB5E885E225F69F0(); +void PushSystemServiceEvent(const OrbisSystemServiceEvent& event); + void RegisterlibSceSystemService(Core::Loader::SymbolsResolver* sym); } // namespace Libraries::SystemService diff --git a/src/core/libraries/videodec/videodec.cpp b/src/core/libraries/videodec/videodec.cpp index 6c9a9b8c0..02ea61509 100644 --- a/src/core/libraries/videodec/videodec.cpp +++ b/src/core/libraries/videodec/videodec.cpp @@ -9,7 +9,7 @@ namespace Libraries::Videodec { -static constexpr u64 kMinimumMemorySize = 32_MB; ///> Fake minimum memory size for querying +static constexpr u64 kMinimumMemorySize = 16_MB; ///> Fake minimum memory size for querying int PS4_SYSV_ABI sceVideodecCreateDecoder(const OrbisVideodecConfigInfo* pCfgInfoIn, const OrbisVideodecResourceInfo* pRsrcInfoIn, diff --git a/src/core/libraries/videodec/videodec2.cpp b/src/core/libraries/videodec/videodec2.cpp index 07f7a274b..a7e520b41 100644 --- a/src/core/libraries/videodec/videodec2.cpp +++ b/src/core/libraries/videodec/videodec2.cpp @@ -10,7 +10,7 @@ namespace Libraries::Vdec2 { -static constexpr u64 kMinimumMemorySize = 32_MB; ///> Fake minimum memory size for querying +static constexpr u64 kMinimumMemorySize = 16_MB; ///> Fake minimum memory size for querying s32 PS4_SYSV_ABI sceVideodec2QueryComputeMemoryInfo(OrbisVideodec2ComputeMemoryInfo* computeMemInfo) { diff --git a/src/core/libraries/web_browser_dialog/webbrowserdialog.cpp b/src/core/libraries/web_browser_dialog/webbrowserdialog.cpp new file mode 100644 index 000000000..ee434f96a --- /dev/null +++ b/src/core/libraries/web_browser_dialog/webbrowserdialog.cpp @@ -0,0 +1,112 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" +#include "core/libraries/libs.h" +#include "core/libraries/web_browser_dialog/webbrowserdialog.h" + +namespace Libraries::WebBrowserDialog { + +s32 PS4_SYSV_ABI sceWebBrowserDialogClose() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceWebBrowserDialogGetEvent() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceWebBrowserDialogGetResult() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceWebBrowserDialogGetStatus() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceWebBrowserDialogInitialize() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceWebBrowserDialogNavigate() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceWebBrowserDialogOpen() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceWebBrowserDialogOpenForPredeterminedContent() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceWebBrowserDialogResetCookie() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceWebBrowserDialogSetCookie() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceWebBrowserDialogSetZoom() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceWebBrowserDialogTerminate() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceWebBrowserDialogUpdateStatus() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI Func_F2BE042771625F8C() { + LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +void RegisterlibSceWebBrowserDialog(Core::Loader::SymbolsResolver* sym) { + LIB_FUNCTION("PSK+Eik919Q", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogClose); + LIB_FUNCTION("Wit4LjeoeX4", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogGetEvent); + LIB_FUNCTION("vCaW0fgVQmc", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogGetResult); + LIB_FUNCTION("CFTG6a8TjOU", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogGetStatus); + LIB_FUNCTION("jqb7HntFQFc", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogInitialize); + LIB_FUNCTION("uYELOMVnmNQ", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogNavigate); + LIB_FUNCTION("FraP7debcdg", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogOpen); + LIB_FUNCTION("O7dIZQrwVFY", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogOpenForPredeterminedContent); + LIB_FUNCTION("Cya+jvTtPqg", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogResetCookie); + LIB_FUNCTION("TZnDVkP91Rg", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogSetCookie); + LIB_FUNCTION("RLhKBOoNyXY", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogSetZoom); + LIB_FUNCTION("ocHtyBwHfys", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogTerminate); + LIB_FUNCTION("h1dR-t5ISgg", "libSceWebBrowserDialog", 1, "libSceWebBrowserDialog", 1, 1, + sceWebBrowserDialogUpdateStatus); + LIB_FUNCTION("8r4EJ3FiX4w", "libSceWebBrowserDialogLimited", 1, "libSceWebBrowserDialog", 1, 1, + Func_F2BE042771625F8C); +}; + +} // namespace Libraries::WebBrowserDialog \ No newline at end of file diff --git a/src/core/libraries/web_browser_dialog/webbrowserdialog.h b/src/core/libraries/web_browser_dialog/webbrowserdialog.h new file mode 100644 index 000000000..aa118fe45 --- /dev/null +++ b/src/core/libraries/web_browser_dialog/webbrowserdialog.h @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/types.h" + +namespace Core::Loader { +class SymbolsResolver; +} + +namespace Libraries::WebBrowserDialog { + +s32 PS4_SYSV_ABI sceWebBrowserDialogClose(); +s32 PS4_SYSV_ABI sceWebBrowserDialogGetEvent(); +s32 PS4_SYSV_ABI sceWebBrowserDialogGetResult(); +s32 PS4_SYSV_ABI sceWebBrowserDialogGetStatus(); +s32 PS4_SYSV_ABI sceWebBrowserDialogInitialize(); +s32 PS4_SYSV_ABI sceWebBrowserDialogNavigate(); +s32 PS4_SYSV_ABI sceWebBrowserDialogOpen(); +s32 PS4_SYSV_ABI sceWebBrowserDialogOpenForPredeterminedContent(); +s32 PS4_SYSV_ABI sceWebBrowserDialogResetCookie(); +s32 PS4_SYSV_ABI sceWebBrowserDialogSetCookie(); +s32 PS4_SYSV_ABI sceWebBrowserDialogSetZoom(); +s32 PS4_SYSV_ABI sceWebBrowserDialogTerminate(); +s32 PS4_SYSV_ABI sceWebBrowserDialogUpdateStatus(); +s32 PS4_SYSV_ABI Func_F2BE042771625F8C(); + +void RegisterlibSceWebBrowserDialog(Core::Loader::SymbolsResolver* sym); +} // namespace Libraries::WebBrowserDialog \ No newline at end of file diff --git a/src/core/libraries/zlib/zlib.cpp b/src/core/libraries/zlib/zlib.cpp new file mode 100644 index 000000000..899cb5bf6 --- /dev/null +++ b/src/core/libraries/zlib/zlib.cpp @@ -0,0 +1,183 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include +#include +#include +#include +#include +#include + +#include "common/logging/log.h" +#include "common/thread.h" +#include "core/libraries/kernel/threads.h" +#include "core/libraries/libs.h" +#include "core/libraries/zlib/zlib_error.h" +#include "core/libraries/zlib/zlib_sce.h" + +namespace Libraries::Zlib { + +struct InflateTask { + u64 request_id; + const void* src; + u32 src_length; + void* dst; + u32 dst_length; +}; + +struct InflateResult { + u32 length; + s32 status; +}; + +static Kernel::Thread task_thread; + +static std::mutex mutex; +static std::queue task_queue; +static std::condition_variable_any task_queue_cv; +static std::queue done_queue; +static std::condition_variable_any done_queue_cv; +static std::unordered_map results; +static u64 next_request_id; + +void ZlibTaskThread(const std::stop_token& stop) { + Common::SetCurrentThreadName("shadPS4:ZlibTaskThread"); + + while (!stop.stop_requested()) { + InflateTask task; + { + // Lock and pop from the task queue, unless stop has been requested. + std::unique_lock lock(mutex); + if (!task_queue_cv.wait(lock, stop, [&] { return !task_queue.empty(); })) { + break; + } + task = task_queue.back(); + task_queue.pop(); + } + + uLongf decompressed_length = task.dst_length; + const auto ret = uncompress(static_cast(task.dst), &decompressed_length, + static_cast(task.src), task.src_length); + + { + // Lock, insert the new result, and push the finished request ID to the done queue. + std::unique_lock lock(mutex); + results[task.request_id] = InflateResult{ + .length = static_cast(decompressed_length), + .status = ret == Z_BUF_ERROR ? ORBIS_ZLIB_ERROR_NOSPACE + : ret == Z_OK ? ORBIS_OK + : ORBIS_ZLIB_ERROR_FATAL, + }; + done_queue.push(task.request_id); + } + done_queue_cv.notify_one(); + } +} + +s32 PS4_SYSV_ABI sceZlibInitialize(const void* buffer, u32 length) { + LOG_INFO(Lib_Zlib, "called"); + if (task_thread.Joinable()) { + return ORBIS_ZLIB_ERROR_ALREADY_INITIALIZED; + } + + // Initialize with empty task data + task_queue = std::queue(); + done_queue = std::queue(); + results.clear(); + next_request_id = 1; + + task_thread.Run([](const std::stop_token& stop) { ZlibTaskThread(stop); }); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceZlibInflate(const void* src, u32 src_len, void* dst, u32 dst_len, + u64* request_id) { + LOG_DEBUG(Lib_Zlib, "(STUBBED) called"); + if (!task_thread.Joinable()) { + return ORBIS_ZLIB_ERROR_NOT_INITIALIZED; + } + if (!src || !src_len || !dst || !dst_len || !request_id || dst_len > 64_KB || + dst_len % 2_KB != 0) { + return ORBIS_ZLIB_ERROR_INVALID; + } + + { + std::unique_lock lock(mutex); + *request_id = next_request_id++; + task_queue.emplace(InflateTask{ + .request_id = *request_id, + .src = src, + .src_length = src_len, + .dst = dst, + .dst_length = dst_len, + }); + task_queue_cv.notify_one(); + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceZlibWaitForDone(u64* request_id, const u32* timeout) { + LOG_DEBUG(Lib_Zlib, "(STUBBED) called"); + if (!task_thread.Joinable()) { + return ORBIS_ZLIB_ERROR_NOT_INITIALIZED; + } + if (!request_id) { + return ORBIS_ZLIB_ERROR_INVALID; + } + + { + // Pop from the done queue, unless the timeout is reached. + std::unique_lock lock(mutex); + const auto pred = [] { return !done_queue.empty(); }; + if (timeout) { + if (!done_queue_cv.wait_for(lock, std::chrono::milliseconds(*timeout), pred)) { + return ORBIS_ZLIB_ERROR_TIMEDOUT; + } + } else { + done_queue_cv.wait(lock, pred); + } + *request_id = done_queue.back(); + done_queue.pop(); + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceZlibGetResult(const u64 request_id, u32* dst_length, s32* status) { + LOG_DEBUG(Lib_Zlib, "(STUBBED) called"); + if (!task_thread.Joinable()) { + return ORBIS_ZLIB_ERROR_NOT_INITIALIZED; + } + if (!dst_length || !status) { + return ORBIS_ZLIB_ERROR_INVALID; + } + + { + std::unique_lock lock(mutex); + if (!results.contains(request_id)) { + return ORBIS_ZLIB_ERROR_NOT_FOUND; + } + const auto result = results[request_id]; + *dst_length = result.length; + *status = result.status; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceZlibFinalize() { + LOG_INFO(Lib_Zlib, "called"); + if (!task_thread.Joinable()) { + return ORBIS_ZLIB_ERROR_NOT_INITIALIZED; + } + task_thread.Stop(); + return ORBIS_OK; +} + +void RegisterlibSceZlib(Core::Loader::SymbolsResolver* sym) { + LIB_FUNCTION("m1YErdIXCp4", "libSceZlib", 1, "libSceZlib", 1, 1, sceZlibInitialize); + LIB_FUNCTION("6na+Sa-B83w", "libSceZlib", 1, "libSceZlib", 1, 1, sceZlibFinalize); + LIB_FUNCTION("TLar1HULv1Q", "libSceZlib", 1, "libSceZlib", 1, 1, sceZlibInflate); + LIB_FUNCTION("uB8VlDD4e0s", "libSceZlib", 1, "libSceZlib", 1, 1, sceZlibWaitForDone); + LIB_FUNCTION("2eDcGHC0YaM", "libSceZlib", 1, "libSceZlib", 1, 1, sceZlibGetResult); +}; + +} // namespace Libraries::Zlib diff --git a/src/core/libraries/zlib/zlib_error.h b/src/core/libraries/zlib/zlib_error.h new file mode 100644 index 000000000..59574f0b2 --- /dev/null +++ b/src/core/libraries/zlib/zlib_error.h @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// Zlib library +constexpr int ORBIS_ZLIB_ERROR_NOT_FOUND = 0x81120002; +constexpr int ORBIS_ZLIB_ERROR_BUSY = 0x8112000B; +constexpr int ORBIS_ZLIB_ERROR_FAULT = 0x8112000E; +constexpr int ORBIS_ZLIB_ERROR_INVALID = 0x81120016; +constexpr int ORBIS_ZLIB_ERROR_NOSPACE = 0x8112001C; +constexpr int ORBIS_ZLIB_ERROR_NOT_SUPPORTED = 0x81120025; +constexpr int ORBIS_ZLIB_ERROR_TIMEDOUT = 0x81120027; +constexpr int ORBIS_ZLIB_ERROR_NOT_INITIALIZED = 0x81120032; +constexpr int ORBIS_ZLIB_ERROR_ALREADY_INITIALIZED = 0x81120033; +constexpr int ORBIS_ZLIB_ERROR_FATAL = 0x811200FF; diff --git a/src/core/libraries/zlib/zlib_sce.h b/src/core/libraries/zlib/zlib_sce.h new file mode 100644 index 000000000..6f8cf9468 --- /dev/null +++ b/src/core/libraries/zlib/zlib_sce.h @@ -0,0 +1,21 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/types.h" + +namespace Core::Loader { +class SymbolsResolver; +} +namespace Libraries::Zlib { + +s32 PS4_SYSV_ABI sceZlibInitialize(const void* buffer, u32 length); +s32 PS4_SYSV_ABI sceZlibInflate(const void* src, u32 src_len, void* dst, u32 dst_len, + u64* request_id); +s32 PS4_SYSV_ABI sceZlibWaitForDone(u64* request_id, const u32* timeout); +s32 PS4_SYSV_ABI sceZlibGetResult(u64 request_id, u32* dst_length, s32* status); +s32 PS4_SYSV_ABI sceZlibFinalize(); + +void RegisterlibSceZlib(Core::Loader::SymbolsResolver* sym); +} // namespace Libraries::Zlib \ No newline at end of file diff --git a/src/core/linker.h b/src/core/linker.h index 00da3a08c..357b39664 100644 --- a/src/core/linker.h +++ b/src/core/linker.h @@ -109,10 +109,13 @@ public: void RelocateAnyImports(Module* m) { Relocate(m); - for (auto& module : m_modules) { - const auto imports = module->GetImportModules(); - if (std::ranges::contains(imports, m->name, &ModuleInfo::name)) { - Relocate(module.get()); + const auto exports = m->GetExportModules(); + for (auto& export_mod : exports) { + for (auto& module : m_modules) { + const auto imports = module->GetImportModules(); + if (std::ranges::contains(imports, export_mod.name, &ModuleInfo::name)) { + Relocate(module.get()); + } } } } diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 619941000..271092eaf 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -389,47 +389,57 @@ s32 MemoryManager::UnmapMemory(VAddr virtual_addr, size_t size) { return UnmapMemoryImpl(virtual_addr, size); } -s32 MemoryManager::UnmapMemoryImpl(VAddr virtual_addr, size_t size) { - const auto it = FindVMA(virtual_addr); - const auto& vma_base = it->second; - ASSERT_MSG(vma_base.Contains(virtual_addr, size), - "Existing mapping does not contain requested unmap range"); - - const auto type = vma_base.type; - if (type == VMAType::Free) { - return ORBIS_OK; - } - +u64 MemoryManager::UnmapBytesFromEntry(VAddr virtual_addr, VirtualMemoryArea vma_base, u64 size) { const auto vma_base_addr = vma_base.base; const auto vma_base_size = vma_base.size; + const auto type = vma_base.type; const auto phys_base = vma_base.phys_base; const bool is_exec = vma_base.is_exec; const auto start_in_vma = virtual_addr - vma_base_addr; + const auto adjusted_size = + vma_base_size - start_in_vma < size ? vma_base_size - start_in_vma : size; const bool has_backing = type == VMAType::Direct || type == VMAType::File; + + if (type == VMAType::Free) { + return adjusted_size; + } if (type == VMAType::Direct || type == VMAType::Pooled) { - rasterizer->UnmapMemory(virtual_addr, size); + rasterizer->UnmapMemory(virtual_addr, adjusted_size); } if (type == VMAType::Flexible) { - flexible_usage -= size; + flexible_usage -= adjusted_size; } // Mark region as free and attempt to coalesce it with neighbours. - const auto new_it = CarveVMA(virtual_addr, size); + const auto new_it = CarveVMA(virtual_addr, adjusted_size); auto& vma = new_it->second; vma.type = VMAType::Free; vma.prot = MemoryProt::NoAccess; vma.phys_base = 0; vma.disallow_merge = false; vma.name = ""; - MergeAdjacent(vma_map, new_it); - bool readonly_file = vma.prot == MemoryProt::CpuRead && type == VMAType::File; - + const auto post_merge_it = MergeAdjacent(vma_map, new_it); + auto& post_merge_vma = post_merge_it->second; + bool readonly_file = post_merge_vma.prot == MemoryProt::CpuRead && type == VMAType::File; if (type != VMAType::Reserved && type != VMAType::PoolReserved) { // Unmap the memory region. - impl.Unmap(vma_base_addr, vma_base_size, start_in_vma, start_in_vma + size, phys_base, - is_exec, has_backing, readonly_file); + impl.Unmap(vma_base_addr, vma_base_size, start_in_vma, start_in_vma + adjusted_size, + phys_base, is_exec, has_backing, readonly_file); TRACK_FREE(virtual_addr, "VMEM"); } + return adjusted_size; +} + +s32 MemoryManager::UnmapMemoryImpl(VAddr virtual_addr, u64 size) { + u64 unmapped_bytes = 0; + do { + auto it = FindVMA(virtual_addr + unmapped_bytes); + auto& vma_base = it->second; + auto unmapped = + UnmapBytesFromEntry(virtual_addr + unmapped_bytes, vma_base, size - unmapped_bytes); + ASSERT_MSG(unmapped > 0, "Failed to unmap memory, progress is impossible"); + unmapped_bytes += unmapped; + } while (unmapped_bytes < size); return ORBIS_OK; } @@ -529,8 +539,8 @@ int MemoryManager::VirtualQuery(VAddr addr, int flags, info->is_flexible.Assign(vma.type == VMAType::Flexible); info->is_direct.Assign(vma.type == VMAType::Direct); info->is_stack.Assign(vma.type == VMAType::Stack); - info->is_pooled.Assign(vma.type == VMAType::PoolReserved); - info->is_committed.Assign(vma.type == VMAType::Pooled); + info->is_pooled.Assign(vma.type == VMAType::PoolReserved || vma.type == VMAType::Pooled); + info->is_committed.Assign(vma.IsMapped()); vma.name.copy(info->name.data(), std::min(info->name.size(), vma.name.size())); if (vma.type == VMAType::Direct) { const auto dmem_it = FindDmemArea(vma.phys_base); @@ -651,6 +661,12 @@ MemoryManager::VMAHandle MemoryManager::CarveVMA(VAddr virtual_addr, size_t size const VAddr start_in_vma = virtual_addr - vma.base; const VAddr end_in_vma = start_in_vma + size; + + if (start_in_vma == 0 && size == vma.size) { + // if requsting the whole VMA, return it + return vma_handle; + } + ASSERT_MSG(end_in_vma <= vma.size, "Mapping cannot fit inside free region"); if (end_in_vma != vma.size) { diff --git a/src/core/memory.h b/src/core/memory.h index 615ecc3eb..59e48b248 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -252,7 +252,9 @@ private: DMemHandle Split(DMemHandle dmem_handle, size_t offset_in_area); - s32 UnmapMemoryImpl(VAddr virtual_addr, size_t size); + u64 UnmapBytesFromEntry(VAddr virtual_addr, VirtualMemoryArea vma_base, u64 size); + + s32 UnmapMemoryImpl(VAddr virtual_addr, u64 size); private: AddressSpace impl; diff --git a/src/emulator.cpp b/src/emulator.cpp index e77c2b87f..97215c06f 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -100,9 +100,21 @@ Emulator::~Emulator() { } void Emulator::Run(const std::filesystem::path& file, const std::vector args) { + const auto eboot_name = file.filename().string(); + auto game_folder = file.parent_path(); + if (const auto game_folder_name = game_folder.filename().string(); + game_folder_name.ends_with("-UPDATE")) { + // If an executable was launched from a separate update directory, + // use the base game directory as the game folder. + const auto base_name = game_folder_name.substr(0, game_folder_name.size() - 7); + const auto base_path = game_folder.parent_path() / base_name; + if (std::filesystem::is_directory(base_path)) { + game_folder = base_path; + } + } + // Applications expect to be run from /app0 so mount the file's parent path as app0. auto* mnt = Common::Singleton::Instance(); - const auto game_folder = file.parent_path(); mnt->Mount(game_folder, "/app0"); // Certain games may use /hostapp as well such as CUSA001100 mnt->Mount(game_folder, "/hostapp"); @@ -223,7 +235,7 @@ void Emulator::Run(const std::filesystem::path& file, const std::vectorGetHLESymbols()); // Load the module with the linker - const auto eboot_path = mnt->GetHostPath("/app0/" + file.filename().string()); + const auto eboot_path = mnt->GetHostPath("/app0/" + eboot_name); linker->LoadModule(eboot_path); // check if we have system modules to load diff --git a/src/qt_gui/check_update.cpp b/src/qt_gui/check_update.cpp index e3e019144..0c1cce5da 100644 --- a/src/qt_gui/check_update.cpp +++ b/src/qt_gui/check_update.cpp @@ -146,14 +146,14 @@ void CheckUpdate::CheckForUpdates(const bool showMessage) { } QString currentRev = (updateChannel == "Nightly") - ? QString::fromStdString(Common::g_scm_rev).left(7) + ? QString::fromStdString(Common::g_scm_rev) : "v." + QString::fromStdString(Common::VERSION); QString currentDate = Common::g_scm_date; QDateTime dateTime = QDateTime::fromString(latestDate, Qt::ISODate); latestDate = dateTime.isValid() ? dateTime.toString("yyyy-MM-dd HH:mm:ss") : "Unknown date"; - if (latestRev == currentRev) { + if (latestRev == currentRev.left(7)) { if (showMessage) { QMessageBox::information(this, tr("Auto Updater"), tr("Your version is already up to date!")); @@ -190,7 +190,7 @@ void CheckUpdate::setupUI(const QString& downloadUrl, const QString& latestDate, QString("


" + tr("Update Channel") + ":
" + updateChannel + "
" + tr("Current Version") + ": %1 (%2)
" + tr("Latest Version") + ": %3 (%4)

" + tr("Do you want to update?") + "

") - .arg(currentRev, currentDate, latestRev, latestDate); + .arg(currentRev.left(7), currentDate, latestRev, latestDate); QLabel* updateLabel = new QLabel(updateText, this); layout->addWidget(updateLabel); diff --git a/src/qt_gui/game_grid_frame.cpp b/src/qt_gui/game_grid_frame.cpp index 2ebb09e5d..d719ac878 100644 --- a/src/qt_gui/game_grid_frame.cpp +++ b/src/qt_gui/game_grid_frame.cpp @@ -38,17 +38,18 @@ GameGridFrame::GameGridFrame(std::shared_ptr game_info_get, void GameGridFrame::onCurrentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) { - cellClicked = true; crtRow = currentRow; crtColumn = currentColumn; columnCnt = this->columnCount(); auto itemID = (crtRow * columnCnt) + currentColumn; if (itemID > m_game_info->m_games.count() - 1) { + cellClicked = false; validCellSelected = false; BackgroundMusicPlayer::getInstance().stopMusic(); return; } + cellClicked = true; validCellSelected = true; SetGridBackgroundImage(crtRow, crtColumn); auto snd0Path = QString::fromStdString(m_game_info->m_games[itemID].snd0_path.string()); diff --git a/src/qt_gui/gui_context_menus.h b/src/qt_gui/gui_context_menus.h index 0e8675c0c..bdc2aec0c 100644 --- a/src/qt_gui/gui_context_menus.h +++ b/src/qt_gui/gui_context_menus.h @@ -41,8 +41,8 @@ public: itemID = widget->currentRow() * widget->columnCount() + widget->currentColumn(); } - // Do not show the menu if an item is selected - if (itemID == -1) { + // Do not show the menu if no item is selected + if (itemID < 0 || itemID >= m_games.size()) { return; } @@ -52,10 +52,12 @@ public: // "Open Folder..." submenu QMenu* openFolderMenu = new QMenu(tr("Open Folder..."), widget); QAction* openGameFolder = new QAction(tr("Open Game Folder"), widget); + QAction* openUpdateFolder = new QAction(tr("Open Update Folder"), widget); QAction* openSaveDataFolder = new QAction(tr("Open Save Data Folder"), widget); QAction* openLogFolder = new QAction(tr("Open Log Folder"), widget); openFolderMenu->addAction(openGameFolder); + openFolderMenu->addAction(openUpdateFolder); openFolderMenu->addAction(openSaveDataFolder); openFolderMenu->addAction(openLogFolder); @@ -87,10 +89,12 @@ public: QMenu* deleteMenu = new QMenu(tr("Delete..."), widget); QAction* deleteGame = new QAction(tr("Delete Game"), widget); QAction* deleteUpdate = new QAction(tr("Delete Update"), widget); + QAction* deleteSaveData = new QAction(tr("Delete Save Data"), widget); QAction* deleteDLC = new QAction(tr("Delete DLC"), widget); deleteMenu->addAction(deleteGame); deleteMenu->addAction(deleteUpdate); + deleteMenu->addAction(deleteSaveData); deleteMenu->addAction(deleteDLC); menu.addMenu(deleteMenu); @@ -122,6 +126,18 @@ public: QDesktopServices::openUrl(QUrl::fromLocalFile(folderPath)); } + if (selected == openUpdateFolder) { + QString open_update_path; + Common::FS::PathToQString(open_update_path, m_games[itemID].path); + open_update_path += "-UPDATE"; + if (!std::filesystem::exists(Common::FS::PathFromQString(open_update_path))) { + QMessageBox::critical(nullptr, tr("Error"), + QString(tr("This game has no update folder to open!"))); + } else { + QDesktopServices::openUrl(QUrl::fromLocalFile(open_update_path)); + } + } + if (selected == openSaveDataFolder) { QString userPath; Common::FS::PathToQString(userPath, @@ -143,7 +159,7 @@ public: PSF psf; std::filesystem::path game_folder_path = m_games[itemID].path; std::filesystem::path game_update_path = game_folder_path; - game_update_path += "UPDATE"; + game_update_path += "-UPDATE"; if (std::filesystem::exists(game_update_path)) { game_folder_path = game_update_path; } @@ -238,6 +254,11 @@ public: QString trophyPath, gameTrpPath; Common::FS::PathToQString(trophyPath, m_games[itemID].serial); Common::FS::PathToQString(gameTrpPath, m_games[itemID].path); + auto game_update_path = Common::FS::PathFromQString(gameTrpPath); + game_update_path += "-UPDATE"; + if (std::filesystem::exists(game_update_path)) { + Common::FS::PathToQString(gameTrpPath, game_update_path); + } TrophyViewer* trophyViewer = new TrophyViewer(trophyPath, gameTrpPath); trophyViewer->show(); connect(widget->parent(), &QWidget::destroyed, trophyViewer, @@ -335,14 +356,18 @@ public: clipboard->setText(combinedText); } - if (selected == deleteGame || selected == deleteUpdate || selected == deleteDLC) { + if (selected == deleteGame || selected == deleteUpdate || selected == deleteDLC || + selected == deleteSaveData) { bool error = false; - QString folder_path, game_update_path, dlc_path; + QString folder_path, game_update_path, dlc_path, save_data_path; Common::FS::PathToQString(folder_path, m_games[itemID].path); game_update_path = folder_path + "-UPDATE"; Common::FS::PathToQString( dlc_path, Config::getAddonInstallDir() / Common::FS::PathFromQString(folder_path).parent_path().filename()); + Common::FS::PathToQString(save_data_path, + Common::FS::GetUserPath(Common::FS::PathType::UserDir) / + "savedata/1" / m_games[itemID].serial); QString message_type = tr("Game"); if (selected == deleteUpdate) { @@ -363,6 +388,15 @@ public: folder_path = dlc_path; message_type = tr("DLC"); } + } else if (selected == deleteSaveData) { + if (!std::filesystem::exists(Common::FS::PathFromQString(save_data_path))) { + QMessageBox::critical(nullptr, tr("Error"), + QString(tr("This game has no save data to delete!"))); + error = true; + } else { + folder_path = save_data_path; + message_type = tr("Save Data"); + } } if (!error) { QString gameName = QString::fromStdString(m_games[itemID].name); @@ -374,7 +408,10 @@ public: QMessageBox::Yes | QMessageBox::No); if (reply == QMessageBox::Yes) { dir.removeRecursively(); - widget->removeRow(itemID); + if (selected == deleteGame) { + widget->removeRow(itemID); + m_games.removeAt(itemID); + } } } } diff --git a/src/qt_gui/install_dir_select.cpp b/src/qt_gui/install_dir_select.cpp index e0951b123..e90a10ee6 100644 --- a/src/qt_gui/install_dir_select.cpp +++ b/src/qt_gui/install_dir_select.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include #include #include #include @@ -15,10 +16,11 @@ #include "install_dir_select.h" InstallDirSelect::InstallDirSelect() : selected_dir() { - selected_dir = Config::getGameInstallDirs().empty() ? "" : Config::getGameInstallDirs().front(); + auto install_dirs = Config::getGameInstallDirs(); + selected_dir = install_dirs.empty() ? "" : install_dirs.front(); - if (!Config::getGameInstallDirs().empty() && Config::getGameInstallDirs().size() == 1) { - reject(); + if (!install_dirs.empty() && install_dirs.size() == 1) { + accept(); } auto layout = new QVBoxLayout(this); @@ -53,6 +55,14 @@ QWidget* InstallDirSelect::SetupInstallDirList() { vlayout->addWidget(m_path_list); + auto checkbox = new QCheckBox(tr("Install All Queued to Selected Folder")); + connect(checkbox, &QCheckBox::toggled, this, &InstallDirSelect::setUseForAllQueued); + vlayout->addWidget(checkbox); + + auto checkbox2 = new QCheckBox(tr("Delete PKG File on Install")); + connect(checkbox2, &QCheckBox::toggled, this, &InstallDirSelect::setDeleteFileOnInstall); + vlayout->addWidget(checkbox2); + group->setLayout(vlayout); return group; } @@ -66,6 +76,14 @@ void InstallDirSelect::setSelectedDirectory(QListWidgetItem* item) { } } +void InstallDirSelect::setUseForAllQueued(bool enabled) { + use_for_all_queued = enabled; +} + +void InstallDirSelect::setDeleteFileOnInstall(bool enabled) { + delete_file_on_install = enabled; +} + QWidget* InstallDirSelect::SetupDialogActions() { auto actions = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); diff --git a/src/qt_gui/install_dir_select.h b/src/qt_gui/install_dir_select.h index e3e81575a..e11cbf381 100644 --- a/src/qt_gui/install_dir_select.h +++ b/src/qt_gui/install_dir_select.h @@ -22,9 +22,21 @@ public: return selected_dir; } + bool useForAllQueued() { + return use_for_all_queued; + } + + bool deleteFileOnInstall() { + return delete_file_on_install; + } + private: QWidget* SetupInstallDirList(); QWidget* SetupDialogActions(); void setSelectedDirectory(QListWidgetItem* item); + void setDeleteFileOnInstall(bool enabled); + void setUseForAllQueued(bool enabled); std::filesystem::path selected_dir; + bool delete_file_on_install = false; + bool use_for_all_queued = false; }; diff --git a/src/qt_gui/main_window.cpp b/src/qt_gui/main_window.cpp index 3ee392613..3678b3a82 100644 --- a/src/qt_gui/main_window.cpp +++ b/src/qt_gui/main_window.cpp @@ -725,9 +725,20 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int return; } auto category = psf.GetString("CATEGORY"); - InstallDirSelect ids; - ids.exec(); - auto game_install_dir = ids.getSelectedDirectory(); + + if (!use_for_all_queued || pkgNum == 1) { + InstallDirSelect ids; + const auto selected = ids.exec(); + if (selected == QDialog::Rejected) { + return; + } + + last_install_dir = ids.getSelectedDirectory(); + delete_file_on_install = ids.deleteFileOnInstall(); + use_for_all_queued = ids.useForAllQueued(); + } + std::filesystem::path game_install_dir = last_install_dir; + auto game_folder_path = game_install_dir / pkg.GetTitleID(); QString pkgType = QString::fromStdString(pkg.GetPkgFlags()); bool use_game_update = pkgType.contains("PATCH") && Config::getSeparateUpdateEnabled(); @@ -879,8 +890,14 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int if (pkgNum == nPkg) { QString path; Common::FS::PathToQString(path, game_install_dir); + QIcon windowIcon( + Common::FS::PathToUTF8String(game_folder_path / "sce_sys/icon0.png") + .c_str()); QMessageBox extractMsgBox(this); extractMsgBox.setWindowTitle(tr("Extraction Finished")); + if (!windowIcon.isNull()) { + extractMsgBox.setWindowIcon(windowIcon); + } extractMsgBox.setText( QString(tr("Game successfully installed at %1")).arg(path)); extractMsgBox.addButton(QMessageBox::Ok); @@ -894,6 +911,9 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int }); extractMsgBox.exec(); } + if (delete_file_on_install) { + std::filesystem::remove(file); + } }); connect(&dialog, &QProgressDialog::canceled, [&]() { futureWatcher.cancel(); }); connect(&futureWatcher, &QFutureWatcher::progressValueChanged, &dialog, diff --git a/src/qt_gui/main_window.h b/src/qt_gui/main_window.h index f4163defa..5ac56e44c 100644 --- a/src/qt_gui/main_window.h +++ b/src/qt_gui/main_window.h @@ -123,4 +123,8 @@ protected: } void resizeEvent(QResizeEvent* event) override; + + std::filesystem::path last_install_dir = ""; + bool delete_file_on_install = false; + bool use_for_all_queued = false; }; diff --git a/src/qt_gui/settings_dialog.cpp b/src/qt_gui/settings_dialog.cpp index 175c8c51d..b41fde745 100644 --- a/src/qt_gui/settings_dialog.cpp +++ b/src/qt_gui/settings_dialog.cpp @@ -65,6 +65,7 @@ SettingsDialog::SettingsDialog(std::span physical_devices, : QDialog(parent), ui(new Ui::SettingsDialog) { ui->setupUi(this); ui->tabWidgetSettings->setUsesScrollButtons(false); + initialHeight = this->height(); const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir); @@ -150,7 +151,6 @@ SettingsDialog::SettingsDialog(std::span physical_devices, }); #else ui->updaterGroupBox->setVisible(false); - ui->GUIgroupBox->setMaximumSize(265, 16777215); #endif connect(ui->updateCompatibilityButton, &QPushButton::clicked, this, [this, parent, m_compat_info]() { @@ -169,6 +169,11 @@ SettingsDialog::SettingsDialog(std::span physical_devices, }); } + // Gui TAB + { + connect(ui->chooseHomeTabComboBox, &QComboBox::currentTextChanged, this, + [](const QString& hometab) { Config::setChooseHomeTab(hometab.toStdString()); }); + } // Input TAB { connect(ui->hideCursorComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, @@ -202,6 +207,21 @@ SettingsDialog::SettingsDialog(std::span physical_devices, delete selected_item; } }); + + connect(ui->browseButton, &QPushButton::clicked, this, [this]() { + const auto save_data_path = Config::GetSaveDataPath(); + QString initial_path; + Common::FS::PathToQString(initial_path, save_data_path); + + QString save_data_path_string = + QFileDialog::getExistingDirectory(this, tr("Directory to save data"), initial_path); + + auto file_path = Common::FS::PathFromQString(save_data_path_string); + if (!file_path.empty()) { + Config::setSaveDataPath(file_path); + ui->currentSaveDataPath->setText(save_data_path_string); + } + }); } // DEBUG TAB @@ -231,7 +251,7 @@ SettingsDialog::SettingsDialog(std::span physical_devices, #ifdef ENABLE_UPDATER ui->updaterGroupBox->installEventFilter(this); #endif - ui->GUIgroupBox->installEventFilter(this); + ui->GUIMusicGroupBox->installEventFilter(this); ui->disableTrophycheckBox->installEventFilter(this); ui->enableCompatibilityCheckBox->installEventFilter(this); ui->checkCompatibilityOnStartupCheckBox->installEventFilter(this); @@ -256,6 +276,10 @@ SettingsDialog::SettingsDialog(std::span physical_devices, ui->addFolderButton->installEventFilter(this); ui->removeFolderButton->installEventFilter(this); + ui->saveDataGroupBox->installEventFilter(this); + ui->currentSaveDataPath->installEventFilter(this); + ui->browseButton->installEventFilter(this); + // Debug ui->debugDump->installEventFilter(this); ui->vkValidationCheckBox->installEventFilter(this); @@ -286,6 +310,11 @@ void SettingsDialog::LoadValuesFromConfig() { const QVector languageIndexes = {21, 23, 14, 6, 18, 1, 12, 22, 2, 4, 25, 24, 29, 5, 0, 9, 15, 16, 17, 7, 26, 8, 11, 20, 3, 13, 27, 10, 19, 30, 28}; + const auto save_data_path = Config::GetSaveDataPath(); + QString save_data_path_string; + Common::FS::PathToQString(save_data_path_string, save_data_path); + ui->currentSaveDataPath->setText(save_data_path_string); + ui->consoleLanguageComboBox->setCurrentIndex( std::distance(languageIndexes.begin(), std::find(languageIndexes.begin(), languageIndexes.end(), @@ -349,6 +378,15 @@ void SettingsDialog::LoadValuesFromConfig() { ui->updateComboBox->setCurrentText(QString::fromStdString(updateChannel)); #endif + std::string chooseHomeTab = toml::find_or(data, "General", "chooseHomeTab", ""); + ui->chooseHomeTabComboBox->setCurrentText(QString::fromStdString(chooseHomeTab)); + QStringList tabNames = {tr("General"), tr("Gui"), tr("Graphics"), tr("User"), + tr("Input"), tr("Paths"), tr("Debug")}; + QString chooseHomeTabQString = QString::fromStdString(chooseHomeTab); + int indexTab = tabNames.indexOf(chooseHomeTabQString); + indexTab = (indexTab == -1) ? 0 : indexTab; + ui->tabWidgetSettings->setCurrentIndex(indexTab); + QString backButtonBehavior = QString::fromStdString( toml::find_or(data, "Input", "backButtonBehavior", "left")); int index = ui->backButtonBehaviorComboBox->findData(backButtonBehavior); @@ -452,8 +490,8 @@ void SettingsDialog::updateNoteTextEdit(const QString& elementName) { } else if (elementName == "updaterGroupBox") { text = tr("updaterGroupBox"); #endif - } else if (elementName == "GUIgroupBox") { - text = tr("GUIgroupBox"); + } else if (elementName == "GUIMusicGroupBox") { + text = tr("GUIMusicGroupBox"); } else if (elementName == "disableTrophycheckBox") { text = tr("disableTrophycheckBox"); } else if (elementName == "enableCompatibilityCheckBox") { @@ -497,6 +535,13 @@ void SettingsDialog::updateNoteTextEdit(const QString& elementName) { text = tr("removeFolderButton"); } + // Save Data + if (elementName == "saveDataGroupBox" || elementName == "currentSaveDataPath") { + text = tr("saveDataBox"); + } else if (elementName == "browseButton") { + text = tr("browseButton"); + } + // Debug if (elementName == "debugDump") { text = tr("debugDump"); @@ -561,6 +606,7 @@ void SettingsDialog::UpdateSettings() { Config::setRdocEnabled(ui->rdocCheckBox->isChecked()); Config::setAutoUpdate(ui->updateCheckBox->isChecked()); Config::setUpdateChannel(ui->updateComboBox->currentText().toStdString()); + Config::setChooseHomeTab(ui->chooseHomeTabComboBox->currentText().toStdString()); Config::setCompatibilityEnabled(ui->enableCompatibilityCheckBox->isChecked()); Config::setCheckCompatibilityOnStartup(ui->checkCompatibilityOnStartupCheckBox->isChecked()); @@ -603,4 +649,4 @@ void SettingsDialog::ResetInstallFolders() { } Config::setGameInstallDirs(settings_install_dirs_config); } -} +} \ No newline at end of file diff --git a/src/qt_gui/settings_dialog.ui b/src/qt_gui/settings_dialog.ui index c084d4849..5da6a8198 100644 --- a/src/qt_gui/settings_dialog.ui +++ b/src/qt_gui/settings_dialog.ui @@ -12,11 +12,11 @@ 0 0 970 - 820 + 600 - + 0 0 @@ -52,6 +52,12 @@ 0 + + + 0 + 0 + + 0 @@ -68,7 +74,7 @@ 0 0 946 - 611 + 386 @@ -77,14 +83,56 @@ 0 - + + 6 + + + + 0 + + + 0 + + + 0 + + + + 0 + 0 + + Emulator - + + Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft + + + false + + + false + + + + 6 + + + 9 + + + 9 + + + 9 + + + 9 + @@ -106,7 +154,7 @@ - + 0 0 @@ -149,215 +197,40 @@ - - - - 6 - - - 0 - - - - - - - Username - - - - - - - - - - - - - - + + + + 6 + + + 0 + - + - + 0 0 - + 0 0 - - GUI Settings - - - - 1 - - - 11 - - - - - Show Game Size In List - - - - - - - - 0 - 0 - - - - Play title music - - - - - - - 1 - - - 0 - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Volume - - - - - - - Set the volume of the background music. - - - 100 - - - 10 - - - 20 - - - 50 - - - Qt::Orientation::Horizontal - - - false - - - false - - - QSlider::TickPosition::NoTicks - - - 10 - - - - - - - - - 6 - - - 0 - - - 50 - - - - - - - Trophy - - - - - - Disable Trophy Pop-ups - - - - - - - Trophy Key - - - - - - - - 0 - 0 - - - - - 10 - false - - - - - - - - - - - - - - - - - - - - System + + 70 + @@ -387,6 +260,45 @@ + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + @@ -432,16 +344,16 @@ - 10 + 6 - 1 + 9 - 11 + 9 - 190 + 80 @@ -508,7 +420,7 @@ - + 0 0 @@ -554,8 +466,255 @@ - + + + + + + + + true + + + Gui + + + + + 0 + 0 + 946 + 386 + + + + + + + 0 + + + 0 + + + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + GUI Settings + + + + 9 + + + 9 + + + + + Default tab when opening settings + + + + + + + 0 + 0 + + + + + General + + + + + Gui + + + + + Graphics + + + + + User + + + + + Input + + + + + Paths + + + + + Debug + + + + + + + + + + + Show Game Size In List + + + + + + + + 0 + 0 + + + + + 11 + false + true + + + + false + + + + + + false + + + + + 10 + 80 + 416 + 29 + + + + + 0 + 0 + + + + Set the volume of the background music. + + + 100 + + + 10 + + + 20 + + + 50 + + + Qt::Orientation::Horizontal + + + false + + + false + + + QSlider::TickPosition::NoTicks + + + 10 + + + + + + 10 + 22 + 416 + 26 + + + + + 0 + 0 + + + + Play title music + + + + + + 10 + 54 + 416 + 20 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Volume + + + + + + + + + + + + 6 + + + 210 + @@ -570,6 +729,12 @@ 0 + + + 0 + 0 + + Game Compatibility @@ -578,10 +743,10 @@ 10 - 1 + 9 - 11 + 9 @@ -632,6 +797,394 @@ + + + true + + + Graphics + + + + + 0 + 0 + 946 + 386 + + + + + + + + + + + Graphics Device + + + + + + + + + Enable NULL GPU + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + 6 + + + 0 + + + + + + + Width + + + + + + true + + + QAbstractSpinBox::CorrectionMode::CorrectToNearestValue + + + false + + + 0 + + + 9999 + + + 1280 + + + + + + + + + + Height + + + + + + true + + + true + + + QAbstractSpinBox::CorrectionMode::CorrectToNearestValue + + + false + + + 0 + + + 9999 + + + 720 + + + + + + + + + + Vblank Divider + + + + + + true + + + true + + + QAbstractSpinBox::CorrectionMode::CorrectToNearestValue + + + false + + + 1 + + + 9999 + + + 1 + + + + + + + + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + + + + + 12 + + + 12 + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + + + + + true + + + User + + + + + 0 + 0 + 946 + 386 + + + + + + + 0 + + + 0 + + + + + + + Username + + + + + + + + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 40 + + + + + + + + + + 6 + + + 0 + + + 50 + + + + + + + Trophy + + + + + + Disable Trophy Pop-ups + + + + + + + Trophy Key + + + + + + + + 0 + 0 + + + + + 10 + false + + + + + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Qt::Orientation::Vertical + + + QSizePolicy::Policy::MinimumExpanding + + + + 0 + 0 + + + + + + + true @@ -645,7 +1198,7 @@ 0 0 946 - 605 + 386 @@ -916,260 +1469,6 @@ - - - true - - - Graphics - - - - - 0 - 0 - 946 - 605 - - - - - - - - - - - Graphics Device - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - - - 6 - - - 0 - - - - - - - Width - - - - - - true - - - QAbstractSpinBox::CorrectionMode::CorrectToNearestValue - - - false - - - 0 - - - 9999 - - - 1280 - - - - - - - - - - Height - - - - - - true - - - true - - - QAbstractSpinBox::CorrectionMode::CorrectToNearestValue - - - false - - - 0 - - - 9999 - - - 720 - - - - - - - - - - - - - - 6 - - - 0 - - - - - - - Vblank Divider - - - - - - true - - - true - - - QAbstractSpinBox::CorrectionMode::CorrectToNearestValue - - - false - - - 1 - - - 9999 - - - 1 - - - - - - - - - - - - - - - - 12 - - - 12 - - - - - true - - - Advanced - - - Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop - - - - - - Enable Shaders Dumping - - - - - - - Enable NULL GPU - - - - - - - - - - Qt::Orientation::Vertical - - - - 20 - 40 - - - - - - - - - - - - Qt::Orientation::Vertical - - - - 20 - 40 - - - - - - - true @@ -1183,46 +1482,79 @@ 0 0 946 - 605 + 386 - + - - - - - Game Folders - - + + + Game Folders + + + + - - - 0 + + + Add... - - - - Add... - - - - - - - Remove - - - - + - + + + Remove + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + - - - + + + + + + + + + + + Save Data Path + + + + + + + + true + + + + + + + Browse + + + + + + + @@ -1240,12 +1572,12 @@ 0 0 946 - 586 + 386 - + 0 @@ -1266,6 +1598,13 @@ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop + + + + Enable Shaders Dumping + + + diff --git a/src/qt_gui/translations/ar.ts b/src/qt_gui/translations/ar.ts index 47bd673b2..f7b93028a 100644 --- a/src/qt_gui/translations/ar.ts +++ b/src/qt_gui/translations/ar.ts @@ -540,10 +540,18 @@ Enable Fullscreen تمكين ملء الشاشة + + Fullscreen Mode + وضع ملء الشاشة + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + علامة التبويب الافتراضية عند فتح الإعدادات + Show Game Size In List عرض حجم اللعبة في القائمة @@ -620,6 +628,14 @@ Graphics الرسومات + + Gui + واجهة + + + User + مستخدم + Graphics Device جهاز الرسومات @@ -805,7 +821,7 @@ تحديث: Release: إصدارات رسمية تصدر شهريًا، قد تكون قديمة بعض الشيء، لكنها أكثر استقرارًا واختبارًا. Nightly: إصدارات تطوير تحتوي على أحدث الميزات والإصلاحات، لكنها قد تحتوي على أخطاء وأقل استقرارًا. - GUIgroupBox + GUIMusicGroupBox تشغيل موسيقى العنوان:\nإذا كانت اللعبة تدعم ذلك، قم بتمكين تشغيل موسيقى خاصة عند اختيار اللعبة في واجهة المستخدم. diff --git a/src/qt_gui/translations/da_DK.ts b/src/qt_gui/translations/da_DK.ts index 91a98abd4..61d2f68bf 100644 --- a/src/qt_gui/translations/da_DK.ts +++ b/src/qt_gui/translations/da_DK.ts @@ -540,10 +540,18 @@ Enable Fullscreen Enable Fullscreen + + Fullscreen Mode + Fuldskærmstilstand + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + Standardfaneblad ved åbning af indstillinger + Show Game Size In List Vis vis spilstørrelse i listen @@ -620,6 +628,14 @@ Graphics Graphics + + Gui + Interface + + + User + Bruger + Graphics Device Graphics Device @@ -805,7 +821,7 @@ Opdatering:\nRelease: Officielle builds, der frigives månedligt, som kan være meget ældre, men mere stabile og testet.\nNightly: Udviklerbuilds med de nyeste funktioner og rettelser, men som kan indeholde fejl og være mindre stabile. - GUIgroupBox + GUIMusicGroupBox Titelsmusikafspilning:\nHvis spillet understøtter det, aktiver speciel musik, når spillet vælges i brugergrænsefladen. diff --git a/src/qt_gui/translations/de.ts b/src/qt_gui/translations/de.ts index b1e1d2664..9d99a7048 100644 --- a/src/qt_gui/translations/de.ts +++ b/src/qt_gui/translations/de.ts @@ -540,10 +540,18 @@ Enable Fullscreen Vollbild aktivieren + + Fullscreen Mode + Vollbildmodus + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + Standardregisterkarte beim Öffnen der Einstellungen + Show Game Size In List Zeigen Sie die Spielgröße in der Liste @@ -620,6 +628,14 @@ Graphics Grafik + + Gui + Benutzeroberfläche + + + User + Benutzer + Graphics Device Grafikgerät @@ -805,7 +821,7 @@ Update:\nRelease: Offizielle Builds, die monatlich veröffentlicht werden, können viel älter sein, aber stabiler und getestet.\nNightly: Entwickler-Builds, die die neuesten Funktionen und Fehlerbehebungen enthalten, aber Fehler enthalten und weniger stabil sein können. - GUIgroupBox + GUIMusicGroupBox Wiedergabe der Titelmusik:\nWenn das Spiel dies unterstützt, wird beim Auswählen des Spiels in der Benutzeroberfläche spezielle Musik abgespielt. diff --git a/src/qt_gui/translations/el.ts b/src/qt_gui/translations/el.ts index ecda0ede0..66c3c07cd 100644 --- a/src/qt_gui/translations/el.ts +++ b/src/qt_gui/translations/el.ts @@ -540,10 +540,18 @@ Enable Fullscreen Enable Fullscreen + + Fullscreen Mode + Λειτουργία Πλήρους Οθόνης + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + Προεπιλεγμένη καρτέλα κατά την ανοίγμα των ρυθμίσεων + Show Game Size In List Εμφάνιση Μεγέθους Παιχνιδιού στη Λίστα @@ -620,6 +628,14 @@ Graphics Graphics + + Gui + Διεπαφή + + + User + Χρήστης + Graphics Device Graphics Device @@ -805,7 +821,7 @@ Ενημερώσεις:\nRelease: Επίσημες εκδόσεις που κυκλοφορούν μηνιαίως, είναι παλαιότερες αλλά πιο σταθερές και δοκιμασμένες.\nNightly: Εκδόσεις προγραμματιστών με νέες δυνατότητες και διορθώσεις, αλλά μπορεί να περιέχουν σφάλματα και να είναι λιγότερο σταθερές. - GUIgroupBox + GUIMusicGroupBox Αναπαραγωγή Μουσικής Τίτλων:\nΕάν το παιχνίδι το υποστηρίζει, ενεργοποιεί ειδική μουσική κατά την επιλογή του παιχνιδιού από τη διεπαφή χρήστη. diff --git a/src/qt_gui/translations/en.ts b/src/qt_gui/translations/en.ts index 9127df7e3..8b6c3c69f 100644 --- a/src/qt_gui/translations/en.ts +++ b/src/qt_gui/translations/en.ts @@ -540,10 +540,18 @@ Enable Fullscreen Enable Fullscreen + + Fullscreen Mode + Fullscreen Mode + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + Default tab when opening settings + Show Game Size In List Show Game Size In List @@ -620,6 +628,14 @@ Graphics Graphics + + Gui + Gui + + + User + User + Graphics Device Graphics Device @@ -805,7 +821,7 @@ Update:\nRelease: Official versions released every month that may be very outdated, but are more reliable and tested.\nNightly: Development versions that have all the latest features and fixes, but may contain bugs and are less stable. - GUIgroupBox + GUIMusicGroupBox Play Title Music:\nIf a game supports it, enable playing special music when selecting the game in the GUI. @@ -912,6 +928,14 @@ rdocCheckBox Enable RenderDoc Debugging:\nIf enabled, the emulator will provide compatibility with Renderdoc to allow capture and analysis of the currently rendered frame. + + saveDataBox + Save Data Path:\nThe folder where game save data will be saved. + + + browseButton + Browse:\nBrowse for a folder to set as the save data path. + CheatsPatches diff --git a/src/qt_gui/translations/es_ES.ts b/src/qt_gui/translations/es_ES.ts index a47f7c577..8f7a09b5d 100644 --- a/src/qt_gui/translations/es_ES.ts +++ b/src/qt_gui/translations/es_ES.ts @@ -540,10 +540,18 @@ Enable Fullscreen Habilitar pantalla completa + + Fullscreen Mode + Modo de Pantalla Completa + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + Pestaña predeterminada al abrir la configuración + Show Game Size In List Mostrar Tamaño del Juego en la Lista @@ -620,6 +628,14 @@ Graphics Gráficos + + Gui + Interfaz + + + User + Usuario + Graphics Device Dispositivo gráfico @@ -805,7 +821,7 @@ Actualización:\nRelease: Versiones oficiales lanzadas cada mes que pueden estar muy desactualizadas, pero son más confiables y están probadas.\nNightly: Versiones de desarrollo que tienen todas las últimas funciones y correcciones, pero pueden contener errores y son menos estables. - GUIgroupBox + GUIMusicGroupBox Reproducir Música del Título:\nSi un juego lo admite, habilita la reproducción de música especial al seleccionar el juego en la interfaz gráfica. diff --git a/src/qt_gui/translations/fa_IR.ts b/src/qt_gui/translations/fa_IR.ts index 976e7614e..043d782c2 100644 --- a/src/qt_gui/translations/fa_IR.ts +++ b/src/qt_gui/translations/fa_IR.ts @@ -540,10 +540,18 @@ Enable Fullscreen تمام صفحه + + Fullscreen Mode + حالت تمام صفحه + Enable Separate Update Folder فعال‌سازی پوشه جداگانه برای به‌روزرسانی + + Default tab when opening settings + زبان پیش‌فرض هنگام باز کردن تنظیمات + Show Game Size In List نمایش اندازه بازی در لیست @@ -620,6 +628,14 @@ Graphics گرافیک + + Gui + رابط کاربری + + + User + کاربر + Graphics Device کارت گرافیک مورداستفاده @@ -805,7 +821,7 @@ به‌روزرسانی:\nانتشار: نسخه‌های رسمی که هر ماه منتشر می‌شوند و ممکن است بسیار قدیمی باشند، اما پایدارتر و تست‌ شده‌تر هستند.\nشبانه: نسخه‌های توسعه‌ای که شامل جدیدترین ویژگی‌ها و اصلاحات هستند، اما ممکن است دارای اشکال باشند و کمتر پایدار باشند. - GUIgroupBox + GUIMusicGroupBox پخش موسیقی عنوان:\nIدر صورتی که بازی از آن پشتیبانی کند، پخش موسیقی ویژه هنگام انتخاب بازی در رابط کاربری را فعال می‌کند. diff --git a/src/qt_gui/translations/fi.ts b/src/qt_gui/translations/fi.ts index abc091b7e..86f6a6d3c 100644 --- a/src/qt_gui/translations/fi.ts +++ b/src/qt_gui/translations/fi.ts @@ -540,10 +540,18 @@ Enable Fullscreen Ota Käyttöön Koko Ruudun Tila + + Fullscreen Mode + Koko näytön tila + Enable Separate Update Folder Ota Käyttöön Erillinen Päivityshakemisto + + Default tab when opening settings + Oletusvälilehti avattaessa asetuksia + Show Game Size In List Näytä pelin koko luettelossa @@ -620,6 +628,14 @@ Graphics Grafiikka + + Gui + Rajapinta + + + User + Käyttäjä + Graphics Device Näytönohjain @@ -805,7 +821,7 @@ Päivitys:\nRelease: Viralliset versiot, jotka julkaistaan kuukausittain ja saattavat olla hyvin vanhoja, mutta ovat luotettavampia ja testatumpia.\nNightly: Kehitysversiot, joissa on kaikki uusimmat ominaisuudet ja korjaukset, mutta ne saattavat sisältää virheitä ja ovat vähemmän vakaita. - GUIgroupBox + GUIMusicGroupBox Soita Otsikkomusiikkia:\nJos peli tukee sitä, ota käyttöön erityisen musiikin soittaminen pelin valinnan yhteydessä käyttöliittymässä. diff --git a/src/qt_gui/translations/fr.ts b/src/qt_gui/translations/fr.ts index d2a1c5307..0f87b087b 100644 --- a/src/qt_gui/translations/fr.ts +++ b/src/qt_gui/translations/fr.ts @@ -146,19 +146,19 @@ Compatibility... - Compatibility... + Compatibilité... Update database - Update database + Mettre à jour la base de données View report - View report + Voir rapport Submit a report - Submit a report + Soumettre un rapport Shortcut creation @@ -186,7 +186,7 @@ requiresEnableSeparateUpdateFolder_MSG - This feature requires the 'Enable Separate Update Folder' config option to work. If you want to use this feature, please enable it. + Cette fonctionnalité nécessite l'option 'Dossier séparé pour les mises à jour' pour fonctionner. Si vous voulez utiliser cette fonctionnalité, veuillez l'activer. This game has no update to delete! @@ -540,9 +540,17 @@ Enable Fullscreen Plein écran + + Fullscreen Mode + Mode Plein Écran + Enable Separate Update Folder - Dossier séparé pour les mises à jours + Dossier séparé pour les mises à jour + + + Default tab when opening settings + Onglet par défaut lors de l'ouverture des paramètres Show Game Size In List @@ -566,11 +574,11 @@ Trophy Key - Trophy Key + Clé de trophée Trophy - Trophy + Trophée Logger @@ -578,11 +586,11 @@ Log Type - Type + Type de journal Log Filter - Filtre + Filtre du journal Open Log Location @@ -620,6 +628,14 @@ Graphics Graphismes + + Gui + Interface + + + User + Utilisateur + Graphics Device Carte graphique @@ -706,7 +722,7 @@ Disable Trophy Pop-ups - Disable Trophy Pop-ups + Désactiver les notifications de trophées Play title music @@ -714,19 +730,19 @@ Update Compatibility Database On Startup - Update Compatibility Database On Startup + Mettre à jour la base de données de compatibilité au lancement Game Compatibility - Game Compatibility + Compatibilité du jeu Display Compatibility Data - Display Compatibility Data + Afficher les données de compatibilité Update Compatibility Database - Update Compatibility Database + Mettre à jour la base de données de compatibilité Volume @@ -734,7 +750,7 @@ Audio Backend - Audio Backend + Back-end audio Save @@ -770,7 +786,7 @@ separateUpdatesCheckBox - Dossier séparé pour les mises à jours:\nInstalle les mises à jours des jeux dans un dossier séparé pour une gestion plus facile. + Dossier séparé pour les mises à jour:\nInstalle les mises à jours des jeux dans un dossier séparé pour une gestion plus facile. showSplashCheckBox @@ -790,7 +806,7 @@ TrophyKey - Trophy Key:\nKey used to decrypt trophies. Must be obtained from your jailbroken console.\nMust contain only hex characters. + Clé de trophées:\nClé utilisée pour décrypter les trophées. Doit être obtenu à partir de votre console jailbreakée.\nDoit contenir des caractères hexadécimaux uniquement. logTypeGroupBox @@ -805,12 +821,12 @@ Mise à jour:\nRelease: versions officielles publiées chaque mois qui peuvent être très anciennes, mais plus fiables et testées.\nNightly: versions de développement avec toutes les dernières fonctionnalités et correctifs, mais pouvant avoir des bogues et être moins stables. - GUIgroupBox + GUIMusicGroupBox Jouer de la musique de titre:\nSi le jeu le prend en charge, cela active la musique spéciale lorsque vous sélectionnez le jeu dans l'interface utilisateur. disableTrophycheckBox - Disable Trophy Pop-ups:\nDisable in-game trophy notifications. Trophy progress can still be tracked using the Trophy Viewer (right-click the game in the main window). + Désactiver les notifications de trophées:\nDésactive les notifications de trophées en jeu. La progression des trophées peut toujours être suivie à l'aide de la Visionneuse de trophées (clique droit sur le jeu sur la fenêtre principale). hideCursorGroupBox @@ -826,15 +842,15 @@ enableCompatibilityCheckBox - Display Compatibility Data:\nDisplays game compatibility information in table view. Enable "Update Compatibility On Startup" to get up-to-date information. + Afficher les données de compatibilité:\nAffiche les informations de compatibilité des jeux dans une colonne dédiée. Activez "Mettre à jour la compatibilité au démarrage" pour avoir des informations à jour. checkCompatibilityOnStartupCheckBox - Update Compatibility On Startup:\nAutomatically update the compatibility database when shadPS4 starts. + Mettre à jour la compatibilité au démarrage:\nMettre à jour automatiquement la base de données de compatibilité au démarrage de shadPS4. updateCompatibilityButton - Update Compatibility Database:\nImmediately update the compatibility database. + Mettre à jour la compatibilité au démarrage:\nMet à jour immédiatement la base de données de compatibilité. Never @@ -1077,7 +1093,7 @@ DownloadComplete_MSG - Patchs téléchargés avec succès ! Tous les patches disponibles pour tous les jeux ont été téléchargés, il n'est pas nécessaire de les télécharger individuellement pour chaque jeu comme c'est le cas pour les Cheats. Si le correctif n'apparaît pas, il se peut qu'il n'existe pas pour le numéro de série et la version spécifiques du jeu. + Patchs téléchargés avec succès ! Tous les patches disponibles pour tous les jeux ont été téléchargés, il n'est pas nécessaire de les télécharger individuellement pour chaque jeu comme c'est le cas pour les Cheats. Si le correctif n'apparaît pas, il se peut qu'il n'existe pas pour la série et la version spécifiques du jeu. Failed to parse JSON data from HTML. @@ -1097,7 +1113,7 @@ You may need to update your game. - Vous devrez peut-être mettre à jour votre jeu. + Vous devriez peut-être mettre à jour votre jeu. Incompatibility Notice @@ -1121,7 +1137,7 @@ Directory does not exist: - Répertoire n'existe pas: + Le répertoire n'existe pas: Failed to open files.json for reading. @@ -1133,7 +1149,7 @@ Can't apply cheats before the game is started - Impossible d'appliquer les Cheats avant que le jeu ne commence. + Impossible d'appliquer les cheats avant que le jeu ne soit lancé @@ -1152,7 +1168,7 @@ Compatibility - Compatibility + Compatibilité Region @@ -1196,27 +1212,27 @@ Compatibility is untested - Compatibility is untested + La compatibilité n'a pas été testé Game does not initialize properly / crashes the emulator - Game does not initialize properly / crashes the emulator + Le jeu ne se lance pas correctement / crash l'émulateur Game boots, but only displays a blank screen - Game boots, but only displays a blank screen + Le jeu démarre, mais n'affiche qu'un écran noir Game displays an image but does not go past the menu - Game displays an image but does not go past the menu + Le jeu affiche une image mais ne dépasse pas le menu Game has game-breaking glitches or unplayable performance - Game has game-breaking glitches or unplayable performance + Le jeu a des problèmes majeurs ou des performances qui le rendent injouable Game can be completed with playable performance and no major glitches - Game can be completed with playable performance and no major glitches + Le jeu peut être terminé avec des performances acceptables et sans problèmes majeurs diff --git a/src/qt_gui/translations/hu_HU.ts b/src/qt_gui/translations/hu_HU.ts index dff6a3a18..fe71e8120 100644 --- a/src/qt_gui/translations/hu_HU.ts +++ b/src/qt_gui/translations/hu_HU.ts @@ -540,10 +540,18 @@ Enable Fullscreen Teljes Képernyő Engedélyezése + + Fullscreen Mode + Teljes képernyős mód + Enable Separate Update Folder Külön Frissítési Mappa Engedélyezése + + Default tab when opening settings + Alapértelmezett fül a beállítások megnyitásakor + Show Game Size In List Játékméret megjelenítése a listában @@ -620,6 +628,14 @@ Graphics Grafika + + Gui + Felület + + + User + Felhasználó + Graphics Device Grafikai Eszköz @@ -805,7 +821,7 @@ Frissítés:\nRelease: Hivatalos verziók, amelyeket havonta adnak ki, és amelyek nagyon elavultak lehetnek, de megbízhatóbbak és teszteltek.\nNightly: Fejlesztési verziók, amelyek az összes legújabb funkciót és javítást tartalmazzák, de hibákat tartalmazhatnak és kevésbé stabilak. - GUIgroupBox + GUIMusicGroupBox Játék címzene lejátszása:\nHa a játék támogatja, engedélyezze egy speciális zene lejátszását, amikor a játékot kiválasztja a GUI-ban. diff --git a/src/qt_gui/translations/id.ts b/src/qt_gui/translations/id.ts index e6fb8b5aa..acfde43a7 100644 --- a/src/qt_gui/translations/id.ts +++ b/src/qt_gui/translations/id.ts @@ -540,10 +540,18 @@ Enable Fullscreen Enable Fullscreen + + Fullscreen Mode + Mode Layar Penuh + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + Tab default saat membuka pengaturan + Show Game Size In List Tampilkan Ukuran Game di Daftar @@ -620,6 +628,14 @@ Graphics Graphics + + Gui + Antarmuka + + + User + Pengguna + Graphics Device Graphics Device @@ -805,7 +821,7 @@ Pembaruan:\nRelease: Versi resmi yang dirilis setiap bulan yang mungkin sangat ketinggalan zaman, tetapi lebih dapat diandalkan dan teruji.\nNightly: Versi pengembangan yang memiliki semua fitur dan perbaikan terbaru, tetapi mungkin mengandung bug dan kurang stabil. - GUIgroupBox + GUIMusicGroupBox Putar Musik Judul Permainan:\nJika permainan mendukungnya, aktifkan pemutaran musik khusus saat memilih permainan di GUI. diff --git a/src/qt_gui/translations/it.ts b/src/qt_gui/translations/it.ts index 73dbdc603..93c6233a6 100644 --- a/src/qt_gui/translations/it.ts +++ b/src/qt_gui/translations/it.ts @@ -540,10 +540,18 @@ Enable Fullscreen Abilita Schermo Intero + + Fullscreen Mode + Modalità Schermo Intero + Enable Separate Update Folder Abilita Cartella Aggiornamenti Separata + + Default tab when opening settings + Scheda predefinita all'apertura delle impostazioni + Show Game Size In List Mostra la dimensione del gioco nell'elenco @@ -620,6 +628,14 @@ Graphics Grafica + + Gui + Interfaccia + + + User + Utente + Graphics Device Scheda Grafica @@ -805,7 +821,7 @@ Aggiornamento:\nRelease: Versioni ufficiali rilasciate ogni mese che potrebbero essere molto datate, ma sono più affidabili e testate.\nNightly: Versioni di sviluppo che hanno tutte le ultime funzionalità e correzioni, ma potrebbero contenere bug e sono meno stabili. - GUIgroupBox + GUIMusicGroupBox Riproduci Musica del Titolo:\nSe un gioco lo supporta, attiva la riproduzione di musica speciale quando selezioni il gioco nell'interfaccia grafica. diff --git a/src/qt_gui/translations/ja_JP.ts b/src/qt_gui/translations/ja_JP.ts index e07d4eb25..921af52bb 100644 --- a/src/qt_gui/translations/ja_JP.ts +++ b/src/qt_gui/translations/ja_JP.ts @@ -19,7 +19,7 @@ This software should not be used to play games you have not legally obtained. - このソフトウェアは、合法的に入手していないゲームをプレイするために使用するものではありません。 + 非正規、非合法のゲームをプレイするためにこのソフトウェアを使用しないでください。 @@ -33,7 +33,7 @@ GameInfoClass Loading game list, please wait :3 - ゲームリストを読み込み中です。お待ちください :3 + ゲームリストを読み込み中です。しばらくお待ちください :3 Cancel @@ -52,7 +52,7 @@ Select which directory you want to install to. - Select which directory you want to install to. + インストール先のディレクトリを選択してください。 @@ -75,7 +75,7 @@ The value for location to install games is not valid. - ゲームをインストールする場所が無効です。 + ゲームのインストール場所が無効です。 @@ -130,35 +130,35 @@ Delete... - Delete... + 削除... Delete Game - Delete Game + ゲームを削除 Delete Update - Delete Update + アップデートを削除 Delete DLC - Delete DLC + DLCを削除 Compatibility... - Compatibility... + 互換性... Update database - Update database + データベースを更新 View report - View report + レポートを表示 Submit a report - Submit a report + レポートを送信 Shortcut creation @@ -182,23 +182,23 @@ Game - Game + ゲーム requiresEnableSeparateUpdateFolder_MSG - This feature requires the 'Enable Separate Update Folder' config option to work. If you want to use this feature, please enable it. + この機能を利用するには、 'アップデートフォルダの分離を有効化' を有効化する必要があります。 This game has no update to delete! - This game has no update to delete! + このゲームにはアップデートがないため削除することができません! Update - Update + アップデート This game has no DLC to delete! - This game has no DLC to delete! + このゲームにはDLCがないため削除することができません! DLC @@ -206,11 +206,11 @@ Delete %1 - Delete %1 + %1 を削除 Are you sure you want to delete %1's %2 directory? - Are you sure you want to delete %1's %2 directory? + %1 の %2 ディレクトリを本当に削除しますか? @@ -241,15 +241,15 @@ Install application from a .pkg file - .pkgファイルからアプリケーションをインストールする + .pkgファイルからアプリケーションをインストール Recent Games - 最近のゲーム + 最近プレイしたゲーム Open shadPS4 Folder - Open shadPS4 Folder + shadPS4フォルダを開く Exit @@ -273,7 +273,7 @@ Tiny - 極小 + 最小 Small @@ -297,7 +297,7 @@ Elf Viewer - Elfビュワー + Elfビューアー Game Install Directory @@ -397,11 +397,11 @@ You have downloaded cheats for all the games you have installed. - インストールしたすべてのゲームのチートをダウンロードしました。 + インストールされているすべてのゲームのチートをダウンロードしました。 Patches Downloaded Successfully! - パッチが正常にダウンロードされました! + パッチが正常にダウンロードされました! All Patches available for all games have been downloaded. @@ -425,11 +425,11 @@ Only one file can be selected! - 1つのファイルしか選択できません! + 1つのファイルしか選択できません! PKG Extraction - PKG抽出 + PKGの抽出 Patch detected! @@ -473,7 +473,7 @@ PKG is a patch, please install the game first! - PKGはパッチです。ゲームを先にインストールしてください! + PKGはパッチです。ゲームを先にインストールしてください! PKG ERROR @@ -526,11 +526,11 @@ Console Language - コンソール言語 + コンソールの言語 Emulator Language - エミュレーター言語 + エミュレーターの言語 Emulator @@ -540,9 +540,17 @@ Enable Fullscreen フルスクリーンを有効にする + + Fullscreen Mode + 全画面モード + Enable Separate Update Folder - Enable Separate Update Folder + アップデートフォルダの分離を有効化 + + + Default tab when opening settings + 設定を開くときのデフォルトタブ Show Game Size In List @@ -550,7 +558,7 @@ Show Splash - スプラッシュを表示する + スプラッシュ画面を表示する Is PS4 Pro @@ -566,11 +574,11 @@ Trophy Key - Trophy Key + トロフィーキー Trophy - Trophy + トロフィー Logger @@ -602,7 +610,7 @@ Hide Cursor Idle Timeout - カーソル非アクティブタイムアウト + カーソルを隠すまでの非アクティブ期間 s @@ -620,6 +628,14 @@ Graphics グラフィックス + + Gui + インターフェース + + + User + ユーザー + Graphics Device グラフィックスデバイス @@ -706,7 +722,7 @@ Disable Trophy Pop-ups - Disable Trophy Pop-ups + トロフィーのポップアップを無効化 Play title music @@ -714,19 +730,19 @@ Update Compatibility Database On Startup - Update Compatibility Database On Startup + 起動時に互換性データベースを更新する Game Compatibility - Game Compatibility + ゲームの互換性 Display Compatibility Data - Display Compatibility Data + 互換性に関するデータを表示 Update Compatibility Database - Update Compatibility Database + 互換性データベースを更新 Volume @@ -734,7 +750,7 @@ Audio Backend - Audio Backend + オーディオ バックエンド Save @@ -754,15 +770,15 @@ Point your mouse at an option to display its description. - オプションにマウスをポイントすると、その説明が表示されます。 + 設定項目にマウスをホバーすると、説明が表示されます。 consoleLanguageGroupBox - コンソール言語:\nPS4ゲームが使用する言語を設定します。\nこれはゲームがサポートする言語に設定することをお勧めしますが、地域によって異なる場合があります。 + コンソールの言語:\nPS4ゲームが使用する言語を設定します。\nゲームでサポートされている言語に設定することをお勧めしますが、地域によって異なる場合があります。 emulatorLanguageGroupBox - エミュレーター言語:\nエミュレーターのユーザーインターフェースの言語を設定します。 + エミュレーターの言語:\nエミュレーターのユーザーインターフェースの言語を設定します。 fullscreenCheckBox @@ -770,7 +786,7 @@ separateUpdatesCheckBox - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management. + Enable Separate Update Folder:\nゲームのアップデートを別のフォルダにインストールすることで、管理が容易になります。 showSplashCheckBox @@ -778,7 +794,7 @@ ps4proCheckBox - PS4 Proです:\nエミュレーターがPS4 PROとして動作するようにし、これをサポートするゲームで特別な機能を有効にする場合があります。 + PS4 Pro モード:\nエミュレーターがPS4 PROとして動作するようになり、PS4 PROをサポートする一部のゲームで特別な機能が有効化される場合があります。 discordRPCCheckbox @@ -790,7 +806,7 @@ TrophyKey - Trophy Key:\nKey used to decrypt trophies. Must be obtained from your jailbroken console.\nMust contain only hex characters. + トロフィーキー:\nトロフィーの復号に使用されるキーです。脱獄済みのコンソールから取得することができます。\n16進数のみを受け入れます。 logTypeGroupBox @@ -798,27 +814,27 @@ logFilter - ログフィルター:\n特定の情報のみを印刷するようにログをフィルタリングします。\n例: "Core:Trace" "Lib.Pad:Debug Common.Filesystem:Error" "*:Critical" レベル: Trace, Debug, Info, Warning, Error, Critical - この順序で、特定のレベルはリスト内のすべての前のレベルをサイレンスし、その後のすべてのレベルをログに記録します。 + ログフィルター:\n特定の情報のみを印刷するようにログをフィルタリングします。\n例: "Core:Trace" "Lib.Pad:Debug Common.Filesystem:Error" "*:Critical" \nレベル: Trace, Debug, Info, Warning, Error, Critical - レベルはこの並び通りに処理され、指定されたレベルより前のレベル ログを抑制し、それ以外のすべてのレベルをログに記録します。 updaterGroupBox - 更新:\nRelease: 非常に古いかもしれないが、より信頼性が高くテスト済みの公式バージョンを毎月リリースします。\nNightly: 最新の機能と修正がすべて含まれていますが、バグが含まれている可能性があり、安定性は低いです。 + 更新:\nRelease: 最新の機能を利用できない可能性がありますが、より信頼性が高くテストされた公式バージョンが毎月リリースされます。\nNightly: 最新の機能と修正がすべて含まれていますが、バグが含まれている可能性があり、安定性は低いです。 - GUIgroupBox - タイトルミュージックを再生:\nゲームがそれをサポートしている場合、GUIでゲームを選択したときに特別な音楽を再生することを有効にします。 + GUIMusicGroupBox + タイトルミュージックを再生:\nゲームでサポートされている場合に、GUIでゲームを選択したときに特別な音楽を再生する機能を有効にします。 disableTrophycheckBox - Disable Trophy Pop-ups:\nDisable in-game trophy notifications. Trophy progress can still be tracked using the Trophy Viewer (right-click the game in the main window). + トロフィーのポップアップを無効化:\nゲーム内でのトロフィー通知を無効化します。 トロフィーの進行状況は、トロフィービューアーを使用して確認できます。(メインウィンドウでゲームを右クリック) hideCursorGroupBox - カーソルを隠す:\nカーソルが消えるタイミングを選択してください:\n決して: いつでもマウスが見えます。\nアイドル: アイダルの後に消えるまでの時間を設定します。\n常に: マウスは決して見えません。 + カーソルを隠す:\nカーソルが消えるタイミングを選択してください:\n無効: 常にカーソルが表示されます。\n非アクティブ時: カーソルの非アクティブ期間が指定した時間を超えた場合にカーソルを隠します。\n常に: カーソルは常に隠れた状態になります。 idleTimeoutGroupBox - アイドル後にマウスが消えるまでの時間を設定します。 + カーソルが非アクティブになってから隠すまでの時間を設定します。 backButtonBehaviorGroupBox @@ -826,23 +842,23 @@ enableCompatibilityCheckBox - Display Compatibility Data:\nDisplays game compatibility information in table view. Enable "Update Compatibility On Startup" to get up-to-date information. + 互換性に関するデータを表示:\nゲームの互換性に関する情報を表として表示します。常に最新情報を取得したい場合、"起動時に互換性データベースを更新する" を有効化してください。 checkCompatibilityOnStartupCheckBox - Update Compatibility On Startup:\nAutomatically update the compatibility database when shadPS4 starts. + 起動時に互換性データベースを更新する:\nshadPS4の起動時に自動で互換性データベースを更新します。 updateCompatibilityButton - Update Compatibility Database:\nImmediately update the compatibility database. + 互換性データベースを更新する:\n今すぐ互換性データベースを更新します。 Never - 決して + 無効 Idle - アイドル + 非アクティブ時 Always @@ -850,11 +866,11 @@ Touchpad Left - タッチパッド左 + 左タッチパッド Touchpad Right - タッチパッド右 + 右タッチパッド Touchpad Center @@ -866,15 +882,15 @@ graphicsAdapterGroupBox - グラフィックデバイス:\n複数のGPUシステムで、ドロップダウンリストからエミュレーターで使用するGPUを選択するか、\n「自動選択」を選択して自動的に決定します。 + グラフィックデバイス:\nシステムに複数のGPUが搭載されている場合、ドロップダウンリストからエミュレーターで使用するGPUを選択するか、\n「自動選択」を選択して自動的に決定します。 resolutionLayout - 幅/高さ:\n起動時にエミュレーターウィンドウのサイズを設定します。ゲーム中にサイズ変更できます。\nこれはゲーム内の解像度とは異なります。 + 幅/高さ:\n起動時にエミュレーターウィンドウのサイズを設定します。ゲーム中でもサイズを変更することができます。\nこれはゲーム内の解像度とは異なります。 heightDivider - Vblankディバイダー:\nエミュレーターが更新されるフレームレートにこの数を掛けます。これを変更すると、ゲームの速度が上がったり、想定外の変更がある場合、ゲームの重要な機能が壊れる可能性があります! + Vblankディバイダー:\nエミュレーターが更新されるフレームレートにこの数を掛けます。これを変更すると、ゲームの速度が上がったり、想定外の変更がある場合、ゲームの重要な機能が壊れる可能性があります! dumpShadersCheckBox @@ -917,11 +933,11 @@ CheatsPatches Cheats / Patches for - Cheats / Patches for + のチート/パッチ defaultTextEdit_MSG - チート/パッチは実験的です。\n使用には注意してください。\n\nリポジトリを選択し、ダウンロードボタンをクリックしてチートを個別にダウンロードします。\n「Patches」タブでは、すべてのパッチを一度にダウンロードし、使用したいものを選択して選択を保存できます。\n\nチート/パッチを開発していないため、\n問題があればチートの作者に報告してください。\n\n新しいチートを作成しましたか?\nhttps://github.com/shadps4-emu/ps4_cheats を訪問してください。 + チート/パッチは実験的です。\n使用には注意してください。\n\nリポジトリを選択し、ダウンロードボタンをクリックしてチートを個別にダウンロードします。\n「Patches」タブでは、すべてのパッチを一度にダウンロードし、使用したいものを選択して選択を保存できます。\n\nチート/パッチは開発を行っていないため、\n問題があればチートの作者に報告してください。\n\n新しいチートを作成しましたか?\nhttps://github.com/shadps4-emu/ps4_cheats を訪問してください。 No Image Available @@ -997,7 +1013,7 @@ Unable to open files.json for reading. - files.jsonを読み込み用に開けません。 + files.jsonを読み取りのために開く事が出来ませんでした。 No patch file found for the current serial. @@ -1005,11 +1021,11 @@ Unable to open the file for reading. - ファイルを読み込み用に開けません。 + ファイルを読み取りのために開く事が出来ませんでした。 Unable to open the file for writing. - ファイルを記録用に開けません。 + ファイルをを書き込みのために開く事が出来ませんでした。 Failed to parse XML: @@ -1029,7 +1045,7 @@ The selected source is invalid. - 選択したソースは無効です。 + 選択されたソースは無効です。 File Exists @@ -1113,7 +1129,7 @@ Failed to open files.json for writing - files.jsonを記録用に開けません + files.jsonを読み取りのために開く事が出来ませんでした。 Author: @@ -1125,7 +1141,7 @@ Failed to open files.json for reading. - files.jsonを読み込み用に開けません。 + files.jsonを読み取りのために開く事が出来ませんでした。 Name: @@ -1180,43 +1196,43 @@ Never Played - Never Played + 未プレイ h - h + 時間 m - m + s - s + Compatibility is untested - Compatibility is untested + 互換性は未検証です Game does not initialize properly / crashes the emulator - Game does not initialize properly / crashes the emulator + ゲームが正常に初期化されない/エミュレーターがクラッシュする Game boots, but only displays a blank screen - Game boots, but only displays a blank screen + ゲームは起動しますが、空のスクリーンが表示されます Game displays an image but does not go past the menu - Game displays an image but does not go past the menu + 正常にゲーム画面が表示されますが、メニューから先に進むことができません Game has game-breaking glitches or unplayable performance - Game has game-breaking glitches or unplayable performance + ゲームを壊すような不具合や、プレイが不可能なほどのパフォーマンスの問題があります Game can be completed with playable performance and no major glitches - Game can be completed with playable performance and no major glitches + パフォーマンスに問題はなく、大きな不具合なしでゲームをプレイすることができます diff --git a/src/qt_gui/translations/ko_KR.ts b/src/qt_gui/translations/ko_KR.ts index 560b58340..2491959a6 100644 --- a/src/qt_gui/translations/ko_KR.ts +++ b/src/qt_gui/translations/ko_KR.ts @@ -540,10 +540,18 @@ Enable Fullscreen Enable Fullscreen + + Fullscreen Mode + 전체 화면 모드 + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + 설정 열기 시 기본 탭 + Show Game Size In List 게임 크기를 목록에 표시 @@ -620,6 +628,14 @@ Graphics Graphics + + Gui + 인터페이스 + + + User + 사용자 + Graphics Device Graphics Device @@ -805,7 +821,7 @@ Update:\nRelease: Official versions released every month that may be very outdated, but are more reliable and tested.\nNightly: Development versions that have all the latest features and fixes, but may contain bugs and are less stable. - GUIgroupBox + GUIMusicGroupBox Play Title Music:\nIf a game supports it, enable playing special music when selecting the game in the GUI. diff --git a/src/qt_gui/translations/lt_LT.ts b/src/qt_gui/translations/lt_LT.ts index e2ec1e5c3..23a52e948 100644 --- a/src/qt_gui/translations/lt_LT.ts +++ b/src/qt_gui/translations/lt_LT.ts @@ -540,10 +540,18 @@ Enable Fullscreen Enable Fullscreen + + Fullscreen Mode + Viso ekranas + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + Numatytoji kortelė atidarius nustatymus + Show Game Size In List Rodyti žaidimo dydį sąraše @@ -620,6 +628,14 @@ Graphics Graphics + + Gui + Interfeisa + + + User + Naudotojas + Graphics Device Graphics Device @@ -805,7 +821,7 @@ Atnaujinti:\nRelease: Oficialios versijos, išleidžiamos kiekvieną mėnesį, kurios gali būti labai pasenusios, tačiau yra patikimos ir išbandytos.\nNightly: Vystymo versijos, kuriose yra visos naujausios funkcijos ir taisymai, tačiau gali turėti klaidų ir būti mažiau stabilios. - GUIgroupBox + GUIMusicGroupBox Groti antraščių muziką:\nJei žaidimas tai palaiko, įjungia specialios muzikos grojimą, kai pasirinkite žaidimą GUI. diff --git a/src/qt_gui/translations/nb.ts b/src/qt_gui/translations/nb.ts index b94d29b23..0b7d2699a 100644 --- a/src/qt_gui/translations/nb.ts +++ b/src/qt_gui/translations/nb.ts @@ -98,7 +98,7 @@ Open Folder... - Åpne mappen... + Åpne mappe... Open Game Folder @@ -126,7 +126,7 @@ Copy All - Kopier alle + Kopier alt Delete... @@ -146,19 +146,19 @@ Compatibility... - Compatibility... + Kompatibilitet... Update database - Update database + Oppdater database View report - View report + Vis rapport Submit a report - Submit a report + Send inn en rapport Shortcut creation @@ -540,10 +540,18 @@ Enable Fullscreen Aktiver fullskjerm + + Fullscreen Mode + Fullskjermmodus + Enable Separate Update Folder Aktiver seperat oppdateringsmappe + + Default tab when opening settings + Standardfanen når innstillingene åpnes + Show Game Size In List Vis spillstørrelse i listen @@ -566,11 +574,11 @@ Trophy Key - Trophy Key + Trofénøkkel Trophy - Trophy + Trofé Logger @@ -620,6 +628,14 @@ Graphics Grafikk + + Gui + Grensesnitt + + + User + Bruker + Graphics Device Grafikkenhet @@ -642,7 +658,7 @@ Enable Shaders Dumping - Aktiver dumping av skyggelegger + Aktiver skyggeleggerdumping Enable NULL GPU @@ -650,7 +666,7 @@ Paths - Stier + Mapper Game Folders @@ -670,7 +686,7 @@ Enable Debug Dumping - Aktiver dumping av feilretting + Aktiver feilrettingsdumping Enable Vulkan Validation Layers @@ -702,7 +718,7 @@ GUI Settings - GUI-innstillinger + Grensesnitt-innstillinger Disable Trophy Pop-ups @@ -714,7 +730,7 @@ Update Compatibility Database On Startup - Oppdater kompatibilitets-database ved oppstart + Oppdater database ved oppstart Game Compatibility @@ -734,7 +750,7 @@ Audio Backend - Audio Backend + Lydsystem Save @@ -790,7 +806,7 @@ TrophyKey - Trophy Key:\nKey used to decrypt trophies. Must be obtained from your jailbroken console.\nMust contain only hex characters. + Trofénøkkel:\nNøkkel brukes til å dekryptere trofeer. Må hentes fra din konsoll (jailbroken).\nMå bare inneholde sekskantede tegn. logTypeGroupBox @@ -805,7 +821,7 @@ Oppdatering:\nRelease: Offisielle versjoner utgitt hver måned som kan være veldig utdaterte, men er mer pålitelige og testet.\nNightly: Utviklingsversjoner som har alle de nyeste funksjonene og feilrettingene, men som kan inneholde feil og er mindre stabile. - GUIgroupBox + GUIMusicGroupBox Spille tittelmusikk:\nHvis et spill støtter det, så aktiveres det spesiell musikk når du velger spillet i menyen. @@ -830,7 +846,7 @@ checkCompatibilityOnStartupCheckBox - Oppdater kompatibilitets-data ved oppstart:\nOppdaterer kompatibilitets-databasen automatisk når shadPS4 starter. + Oppdater database ved oppstart:\nOppdaterer kompatibilitets-databasen automatisk når shadPS4 starter. updateCompatibilityButton @@ -878,7 +894,7 @@ dumpShadersCheckBox - Aktiver dumping av skyggelegger:\nFor teknisk feilsøking lagrer skyggeleggerne fra spillet i en mappe mens de gjengis. + Aktiver skyggeleggerdumping:\nFor teknisk feilsøking lagrer skyggeleggerne fra spillet i en mappe mens de gjengis. nullGpuCheckBox @@ -898,7 +914,7 @@ debugDump - Aktiver dumping av feilsøking:\nLagrer import- og eksport-symbolene og filoverskriftsinformasjonen til det nåværende kjørende PS4-programmet i en katalog. + Aktiver feilrettingsdumping:\nLagrer import- og eksport-symbolene og filoverskriftsinformasjonen til det nåværende kjørende PS4-programmet i en katalog. vkValidationCheckBox @@ -1172,7 +1188,7 @@ Path - Sti + Adresse Play Time @@ -1216,7 +1232,7 @@ Game can be completed with playable performance and no major glitches - Spillet kan fullføres med spillbar ytelse og ingen store feil + Spillet kan fullføres med spillbar ytelse og uten store feil @@ -1345,4 +1361,4 @@ TB - \ No newline at end of file + diff --git a/src/qt_gui/translations/nl.ts b/src/qt_gui/translations/nl.ts index add27500f..1dabda8b4 100644 --- a/src/qt_gui/translations/nl.ts +++ b/src/qt_gui/translations/nl.ts @@ -540,10 +540,18 @@ Enable Fullscreen Enable Fullscreen + + Fullscreen Mode + Volledig schermmodus + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + Standaardtabblad bij het openen van instellingen + Show Game Size In List Toon grootte van het spel in de lijst @@ -620,6 +628,14 @@ Graphics Graphics + + Gui + Interface + + + User + Gebruiker + Graphics Device Graphics Device @@ -805,7 +821,7 @@ Updateren:\nRelease: Officiële versies die elke maand worden uitgebracht, die zeer verouderd kunnen zijn, maar betrouwbaar en getest zijn.\nNightly: Ontwikkelingsversies die alle nieuwste functies en bugfixes bevatten, maar mogelijk bugs bevatten en minder stabiel zijn. - GUIgroupBox + GUIMusicGroupBox Speel titelsong:\nAls een game dit ondersteunt, wordt speciale muziek afgespeeld wanneer je het spel in de GUI selecteert. diff --git a/src/qt_gui/translations/pl_PL.ts b/src/qt_gui/translations/pl_PL.ts index 3280beea7..85eb63bfb 100644 --- a/src/qt_gui/translations/pl_PL.ts +++ b/src/qt_gui/translations/pl_PL.ts @@ -52,7 +52,7 @@ Select which directory you want to install to. - Select which directory you want to install to. + Wybierz katalog, do którego chcesz zainstalować. @@ -130,35 +130,35 @@ Delete... - Delete... + Usuń... Delete Game - Delete Game + Usuń Grę Delete Update - Delete Update + Usuń Aktualizację Delete DLC - Delete DLC + Usuń DLC Compatibility... - Compatibility... + kompatybilność... Update database - Update database + Zaktualizuj bazę danych View report - View report + Wyświetl zgłoszenie Submit a report - Submit a report + Wyślij zgłoszenie Shortcut creation @@ -182,23 +182,23 @@ Game - Game + Gra requiresEnableSeparateUpdateFolder_MSG - This feature requires the 'Enable Separate Update Folder' config option to work. If you want to use this feature, please enable it. + Ta funkcja wymaga do działania opcji „Włącz oddzielny folder aktualizacji”. Jeśli chcesz korzystać z tej funkcji, włącz ją. This game has no update to delete! - This game has no update to delete! + Ta gra nie ma aktualizacji do usunięcia! Update - Update + Aktualizacja This game has no DLC to delete! - This game has no DLC to delete! + Ta gra nie ma DLC do usunięcia! DLC @@ -206,11 +206,11 @@ Delete %1 - Delete %1 + Usuń %1 Are you sure you want to delete %1's %2 directory? - Are you sure you want to delete %1's %2 directory? + Czy na pewno chcesz usunąć katalog %1 z %2? @@ -249,7 +249,7 @@ Open shadPS4 Folder - Open shadPS4 Folder + Otwórz folder shadPS4 Exit @@ -540,9 +540,17 @@ Enable Fullscreen Włącz pełny ekran + + Fullscreen Mode + Tryb Pełnoekranowy + Enable Separate Update Folder - Enable Separate Update Folder + Włącz oddzielny folder aktualizacji + + + Default tab when opening settings + Domyślna zakładka podczas otwierania ustawień Show Game Size In List @@ -566,11 +574,11 @@ Trophy Key - Trophy Key + Klucz trofeów Trophy - Trophy + Trofeum Logger @@ -620,6 +628,14 @@ Graphics Grafika + + Gui + Interfejs + + + User + Użytkownik + Graphics Device Karta graficzna @@ -706,7 +722,7 @@ Disable Trophy Pop-ups - Disable Trophy Pop-ups + Wyłącz wyskakujące okienka trofeów Play title music @@ -714,19 +730,19 @@ Update Compatibility Database On Startup - Update Compatibility Database On Startup + Aktualizuj bazę danych zgodności podczas uruchamiania Game Compatibility - Game Compatibility + Kompatybilność gier Display Compatibility Data - Display Compatibility Data + Wyświetl dane zgodności Update Compatibility Database - Update Compatibility Database + Aktualizuj bazę danych zgodności Volume @@ -734,7 +750,7 @@ Audio Backend - Audio Backend + Zaplecze audio Save @@ -770,7 +786,7 @@ separateUpdatesCheckBox - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management. + Włącz oddzielny folder aktualizacji:\nUmożliwia instalowanie aktualizacji gier w oddzielnym folderze w celu łatwego zarządzania. showSplashCheckBox @@ -782,7 +798,7 @@ discordRPCCheckbox - Włącz Discord Rich Presence:\nWyświetla ikonę emuladora i odpowiednie informacje na twoim profilu Discord. + Włącz Discord Rich Presence:\nWyświetla ikonę emulatora i odpowiednie informacje na twoim profilu Discord. userName @@ -790,7 +806,7 @@ TrophyKey - Trophy Key:\nKey used to decrypt trophies. Must be obtained from your jailbroken console.\nMust contain only hex characters. + Klucz trofeów:\nKlucz używany do odszyfrowywania trofeów. Musi być uzyskany z konsoli po jailbreaku. Musi zawierać tylko znaki w kodzie szesnastkowym. logTypeGroupBox @@ -805,12 +821,12 @@ Aktualizator:\nRelease: Oficjalne wersje wydawane co miesiąc, które mogą być bardzo przestarzałe, ale są niezawodne i przetestowane.\nNightly: Wersje rozwojowe, które zawierają wszystkie najnowsze funkcje i poprawki błędów, ale mogą mieć błędy i być mniej stabilne. - GUIgroupBox + GUIMusicGroupBox Odtwórz muzykę tytułową:\nJeśli gra to obsługuje, aktywuje odtwarzanie specjalnej muzyki podczas wybierania gry w GUI. disableTrophycheckBox - Disable Trophy Pop-ups:\nDisable in-game trophy notifications. Trophy progress can still be tracked using the Trophy Viewer (right-click the game in the main window). + Wyłącz wyskakujące okienka trofeów:\nWyłącz powiadomienia o trofeach w grze. Postępy w zdobywaniu trofeów można nadal śledzić za pomocą przeglądarki trofeów (kliknij prawym przyciskiem myszy grę w oknie głównym). hideCursorGroupBox @@ -826,15 +842,15 @@ enableCompatibilityCheckBox - Display Compatibility Data:\nDisplays game compatibility information in table view. Enable "Update Compatibility On Startup" to get up-to-date information. + Wyświetl dane zgodności:\nWyświetla informacje o kompatybilności gry w widoku tabeli. Włącz opcję „Aktualizuj zgodność przy uruchomieniu”, aby uzyskać aktualne informacje. checkCompatibilityOnStartupCheckBox - Update Compatibility On Startup:\nAutomatically update the compatibility database when shadPS4 starts. + Aktualizuj zgodność przy uruchomieniu:\nAutomatycznie aktualizuj bazę danych kompatybilności podczas uruchamiania shadPS4. updateCompatibilityButton - Update Compatibility Database:\nImmediately update the compatibility database. + Zaktualizuj bazę danych zgodności:\nNatychmiast zaktualizuj bazę danych zgodności. Never @@ -917,7 +933,7 @@ CheatsPatches Cheats / Patches for - Cheats / Patches for + Kody / Łatki dla defaultTextEdit_MSG @@ -1129,7 +1145,7 @@ Failed to parse JSON: - Nie udało się przeanlizować JSON: + Nie udało się przeanalizować JSON: Can't apply cheats before the game is started @@ -1152,7 +1168,7 @@ Compatibility - Compatibility + Zgodność Region @@ -1180,7 +1196,7 @@ Never Played - Never Played + Nigdy nie grane h @@ -1196,27 +1212,27 @@ Compatibility is untested - Compatibility is untested + Kompatybilność nie została przetestowana Game does not initialize properly / crashes the emulator - Game does not initialize properly / crashes the emulator + Gra nie inicjuje się poprawnie / zawiesza się emulator Game boots, but only displays a blank screen - Game boots, but only displays a blank screen + Gra uruchamia się, ale wyświetla tylko pusty ekran Game displays an image but does not go past the menu - Game displays an image but does not go past the menu + Gra wyświetla obraz, ale nie przechodzi do menu Game has game-breaking glitches or unplayable performance - Game has game-breaking glitches or unplayable performance + Gra ma usterki przerywające rozgrywkę lub niegrywalną wydajność Game can be completed with playable performance and no major glitches - Game can be completed with playable performance and no major glitches + Grę można ukończyć z grywalną wydajnością i bez większych usterek diff --git a/src/qt_gui/translations/pt_BR.ts b/src/qt_gui/translations/pt_BR.ts index b9d889519..fde1d3b63 100644 --- a/src/qt_gui/translations/pt_BR.ts +++ b/src/qt_gui/translations/pt_BR.ts @@ -540,10 +540,18 @@ Enable Fullscreen Ativar Tela Cheia + + Fullscreen Mode + Modo de Tela Cheia + Enable Separate Update Folder Habilitar pasta de atualização separada + + Default tab when opening settings + Aba padrão ao abrir as configurações + Show Game Size In List Mostrar Tamanho do Jogo na Lista @@ -620,6 +628,14 @@ Graphics Gráficos + + Gui + Interface + + + User + Usuário + Graphics Device Placa de Vídeo @@ -766,7 +782,7 @@ fullscreenCheckBox - Ativar Tela Cheia:\nMove automaticamente a janela do jogo para o modo tela cheia.\nIsso pode ser alterado pressionando a tecla F11. + Ativar Tela Cheia:\nAltera a janela do jogo para o modo tela cheia.\nIsso pode ser alterado pressionando a tecla F11. separateUpdatesCheckBox @@ -805,7 +821,11 @@ Atualizações:\nRelease: Versões oficiais que são lançadas todo mês e podem ser bastante antigas, mas são mais confiáveis e testadas.\nNightly: Versões de desenvolvimento que têm todos os novos recursos e correções, mas podem ter bugs e ser instáveis. - GUIgroupBox + chooseHomeTabGroupBox + do menu. + + + GUIMusicGroupBox Reproduzir música de abertura:\nSe o jogo suportar, ativa a reprodução de uma música especial ao selecionar o jogo na interface do menu. diff --git a/src/qt_gui/translations/ro_RO.ts b/src/qt_gui/translations/ro_RO.ts index 00a9eb179..9791a7682 100644 --- a/src/qt_gui/translations/ro_RO.ts +++ b/src/qt_gui/translations/ro_RO.ts @@ -540,10 +540,18 @@ Enable Fullscreen Enable Fullscreen + + Fullscreen Mode + Mod Ecran Complet + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + Tab-ul implicit la deschiderea setărilor + Show Game Size In List Afișează dimensiunea jocului în listă @@ -620,6 +628,14 @@ Graphics Graphics + + Gui + Interfață + + + User + Utilizator + Graphics Device Graphics Device @@ -805,7 +821,7 @@ Actualizare:\nRelease: Versiuni oficiale lansate în fiecare lună, care pot fi foarte învechite, dar sunt mai fiabile și testate.\nNightly: Versiuni de dezvoltare care conțin toate cele mai recente funcții și corecții, dar pot conține erori și sunt mai puțin stabile. - GUIgroupBox + GUIMusicGroupBox Redă muzica titlului:\nDacă un joc o suportă, activează redarea muzicii speciale când selectezi jocul în GUI. diff --git a/src/qt_gui/translations/ru_RU.ts b/src/qt_gui/translations/ru_RU.ts index 4c90450dd..0fddb1e7f 100644 --- a/src/qt_gui/translations/ru_RU.ts +++ b/src/qt_gui/translations/ru_RU.ts @@ -126,11 +126,11 @@ Copy All - Копировать все + Копировать всё Delete... - Удаление... + Удалить... Delete Game @@ -158,7 +158,7 @@ Submit a report - Отправить отчет + Отправить отчёт Shortcut creation @@ -297,7 +297,7 @@ Elf Viewer - Elf + Исполняемый файл Game Install Directory @@ -540,10 +540,18 @@ Enable Fullscreen Полноэкранный режим + + Fullscreen Mode + Тип полноэкранного режима + Enable Separate Update Folder Отдельная папка обновлений + + Default tab when opening settings + Вкладка по умолчанию при открытии настроек + Show Game Size In List Показать размер игры в списке @@ -566,11 +574,11 @@ Trophy Key - Trophy Key + Ключ трофеев Trophy - Trophy + Трофеи Logger @@ -620,6 +628,14 @@ Graphics Графика + + Gui + Интерфейс + + + User + Пользователь + Graphics Device Графическое устройство @@ -734,7 +750,7 @@ Audio Backend - Звуковая Подсистема + Звуковая подсистема Save @@ -805,12 +821,12 @@ Обновление:\nRelease: Официальные версии, которые выпускаются каждый месяц и могут быть очень старыми, но они более надежные и проверенные.\nNightly: Версии разработки, которые содержат все последние функции и исправления, но могут содержать ошибки и менее стабильны. - GUIgroupBox + GUIMusicGroupBox Играть заглавную музыку:\nВключает воспроизведение специальной музыки при выборе игры в списке, если она это поддерживает. disableTrophycheckBox - Отключить уведомления о трофеях:\nОтключает внутриигровые уведомления о трофеях. Прогресс трофеев по прежнему можно отслеживать в меню Просмотр трофеев (правая кнопка мыши по игре в главном окне). + Отключить уведомления о трофеях:\nОтключает внутриигровые уведомления о трофеях. Прогресс трофеев по прежнему можно отслеживать в меню просмотра трофеев (правая кнопка мыши по игре в главном окне). hideCursorGroupBox @@ -1176,11 +1192,11 @@ Play Time - Времени в игре + Время в игре Never Played - Вы не играли + Нет h @@ -1345,4 +1361,4 @@ ТБ - \ No newline at end of file + diff --git a/src/qt_gui/translations/sq.ts b/src/qt_gui/translations/sq.ts index 768db1e75..15c18d2f6 100644 --- a/src/qt_gui/translations/sq.ts +++ b/src/qt_gui/translations/sq.ts @@ -249,7 +249,7 @@ Open shadPS4 Folder - Open shadPS4 Folder + Hap dosjen e shadPS4 Exit @@ -540,10 +540,18 @@ Enable Fullscreen Aktivizo Ekranin e plotë + + Fullscreen Mode + Mënyra me ekran të plotë + Enable Separate Update Folder Aktivizo dosjen e ndarë të përditësimit + + Default tab when opening settings + Skeda e parazgjedhur kur hapen cilësimet + Show Game Size In List Shfaq madhësinë e lojës në listë @@ -586,7 +594,7 @@ Open Log Location - Hap vendndodhjen e regjistrit + Hap vendndodhjen e Ditarit Input @@ -620,6 +628,14 @@ Graphics Grafika + + Gui + Ndërfaqja + + + User + Përdoruesi + Graphics Device Pajisja e Grafikës @@ -805,8 +821,8 @@ Përditësimi:\nRelease: Versionet zyrtare të lëshuara çdo muaj që mund të jenë shumë të vjetra, por janë më të besueshme dhe të provuara.\nNightly: Versionet e zhvillimit që kanë të gjitha veçoritë dhe rregullimet më të fundit, por mund të përmbajnë gabime dhe janë më pak të qëndrueshme. - GUIgroupBox - Luaj muzikën e titullit:\nNëse një lojë e mbështet, aktivizohet luajtja e muzikës të veçantë kur të zgjidhësh lojën në GUI. + GUIMusicGroupBox + Luaj muzikën e titullit:\nNëse një lojë e mbështet, aktivizohet luajtja e muzikës të veçantë kur të zgjidhësh lojën në ndërfaqe. disableTrophycheckBox diff --git a/src/qt_gui/translations/sv.ts b/src/qt_gui/translations/sv.ts index 3781ba45c..e17944f12 100644 --- a/src/qt_gui/translations/sv.ts +++ b/src/qt_gui/translations/sv.ts @@ -1032,10 +1032,18 @@ Enable Fullscreen Aktivera helskärm + + Fullscreen Mode + Helskärmsläge + Enable Separate Update Folder Aktivera separat uppdateringsmapp + + Default tab when opening settings + Standardflik när inställningar öppnas + Show Game Size In List Visa spelstorlek i listan @@ -1108,6 +1116,14 @@ Graphics Grafik + + Gui + Gränssnitt + + + User + Användare + Graphics Device Grafikenhet @@ -1285,7 +1301,7 @@ updaterGroupBox - GUIgroupBox + GUIMusicGroupBox Spela upp titelmusik:\nOm ett spel har stöd för det kan speciell musik spelas upp från spelet i gränssnittet diff --git a/src/qt_gui/translations/tr_TR.ts b/src/qt_gui/translations/tr_TR.ts index 5e8499073..a2368bfee 100644 --- a/src/qt_gui/translations/tr_TR.ts +++ b/src/qt_gui/translations/tr_TR.ts @@ -540,13 +540,21 @@ Enable Fullscreen Tam Ekranı Etkinleştir + + Fullscreen Mode + Tam Ekran Modu + Enable Separate Update Folder - Enable Separate Update Folder + Ayrı Güncelleme Klasörünü Etkinleştir + + + Default tab when opening settings + Ayarlar açıldığında varsayılan sekme Show Game Size In List - Göster oyun boyutunu listede + Oyun Boyutunu Listede Göster Show Splash @@ -566,11 +574,11 @@ Trophy Key - Trophy Key + Kupa Anahtarı Trophy - Trophy + Kupa Logger @@ -620,6 +628,14 @@ Graphics Grafikler + + Gui + Arayüz + + + User + Kullanıcı + Graphics Device Grafik Cihazı @@ -706,7 +722,7 @@ Disable Trophy Pop-ups - Disable Trophy Pop-ups + Kupa Açılır Pencerelerini Devre Dışı Bırak Play title music @@ -714,23 +730,23 @@ Update Compatibility Database On Startup - Update Compatibility Database On Startup + Başlangıçta Uyumluluk Veritabanını Güncelle Game Compatibility - Game Compatibility + Oyun Uyumluluğu Display Compatibility Data - Display Compatibility Data + Uyumluluk Verilerini Göster Update Compatibility Database - Update Compatibility Database + Uyumluluk Veritabanını Güncelle Volume - Ses seviyesi + Ses Seviyesi Audio Backend @@ -805,7 +821,7 @@ Güncelleme:\nRelease: Her ay yayınlanan resmi sürümler; çok eski olabilirler, ancak daha güvenilirdir ve test edilmiştir.\nNightly: Tüm en son özellikler ve düzeltmeler ile birlikte geliştirme sürümleri; hatalar içerebilir ve daha az kararlıdırlar. - GUIgroupBox + GUIMusicGroupBox Başlık Müziklerini Çal:\nEğer bir oyun bunu destekliyorsa, GUI'de oyunu seçtiğinizde özel müziklerin çalmasını etkinleştirir. @@ -1089,11 +1105,11 @@ The game is in version: %1 - Oyun sürümde: %1 + Oyun sürümü: %1 The downloaded patch only works on version: %1 - İndirilen yamanın sadece sürümde çalışıyor: %1 + İndirilen yama sadece şu sürümde çalışıyor: %1 You may need to update your game. @@ -1152,7 +1168,7 @@ Compatibility - Compatibility + Uyumluluk Region @@ -1180,35 +1196,35 @@ Never Played - Never Played + Hiç Oynanmadı h - h + sa m - m + dk s - s + sn Compatibility is untested - Compatibility is untested + Uyumluluk test edilmemiş Game does not initialize properly / crashes the emulator - Game does not initialize properly / crashes the emulator + Oyun düzgün bir şekilde başlatılamıyor / emülatörü çökertiyor Game boots, but only displays a blank screen - Game boots, but only displays a blank screen + Oyun başlatılabiliyor ancak yalnızca boş bir ekran gösteriyor Game displays an image but does not go past the menu - Game displays an image but does not go past the menu + Oyun bir resim gösteriyor ancak menüleri geçemiyor Game has game-breaking glitches or unplayable performance @@ -1216,7 +1232,7 @@ Game can be completed with playable performance and no major glitches - Game can be completed with playable performance and no major glitches + Oyun, oynanabilir performansla tamamlanabilir ve büyük aksaklık yok @@ -1251,7 +1267,7 @@ Your version is already up to date! - Versiyonunuz zaten güncel! + Sürümünüz zaten güncel! Update Available @@ -1263,11 +1279,11 @@ Current Version - Mevcut Versiyon + Mevcut Sürüm Latest Version - Son Versiyon + Son Sürüm Do you want to update? @@ -1319,7 +1335,7 @@ Failed to create the update script file - Güncelleme betiği dosyası oluşturulamadı + Güncelleme komut dosyası oluşturulamadı @@ -1345,4 +1361,4 @@ TB - \ No newline at end of file + diff --git a/src/qt_gui/translations/uk_UA.ts b/src/qt_gui/translations/uk_UA.ts index a1c7e97e0..720ad5b99 100644 --- a/src/qt_gui/translations/uk_UA.ts +++ b/src/qt_gui/translations/uk_UA.ts @@ -540,10 +540,18 @@ Enable Fullscreen Увімкнути повноекранний режим + + Fullscreen Mode + Режим Повноекранний + Enable Separate Update Folder Увімкнути окрему папку оновлень + + Default tab when opening settings + Вкладка за замовчуванням при відкритті налаштувань + Show Game Size In List Показати розмір гри в списку @@ -620,6 +628,14 @@ Graphics Графіка + + Gui + Інтерфейс + + + User + Користувач + Graphics Device Графічний пристрій @@ -805,7 +821,7 @@ Оновлення:\nRelease: Офіційні версії, які випускаються щомісяця і можуть бути дуже старими, але вони більш надійні та перевірені.\nNightly: Версії для розробників, які мають усі найновіші функції та виправлення, але можуть містити помилки та є менш стабільними. - GUIgroupBox + GUIMusicGroupBox Грати заголовну музику:\nВмикає відтворення спеціальної музики під час вибору гри в списку, якщо вона це підтримує. diff --git a/src/qt_gui/translations/vi_VN.ts b/src/qt_gui/translations/vi_VN.ts index a579a1983..a81630fad 100644 --- a/src/qt_gui/translations/vi_VN.ts +++ b/src/qt_gui/translations/vi_VN.ts @@ -540,10 +540,18 @@ Enable Fullscreen Enable Fullscreen + + Fullscreen Mode + Chế độ Toàn màn hình + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + Tab mặc định khi mở cài đặt + Show Game Size In List Hiển thị Kích thước Game trong Danh sách @@ -620,6 +628,14 @@ Graphics Graphics + + Gui + Giao diện + + + User + Người dùng + Graphics Device Graphics Device @@ -805,7 +821,7 @@ Cập nhật:\nRelease: Các phiên bản chính thức được phát hành hàng tháng; có thể khá cũ nhưng đáng tin cậy hơn và đã được thử nghiệm.\nNightly: Các phiên bản phát triển có tất cả các tính năng và sửa lỗi mới nhất; có thể có lỗi và ít ổn định hơn. - GUIgroupBox + GUIMusicGroupBox Phát nhạc tiêu đề trò chơi:\nNếu một trò chơi hỗ trợ điều này, hãy kích hoạt phát nhạc đặc biệt khi bạn chọn trò chơi trong GUI. diff --git a/src/qt_gui/translations/zh_CN.ts b/src/qt_gui/translations/zh_CN.ts index 5450f3dfd..16ae03f94 100644 --- a/src/qt_gui/translations/zh_CN.ts +++ b/src/qt_gui/translations/zh_CN.ts @@ -540,11 +540,19 @@ Enable Fullscreen 启用全屏 + + Fullscreen Mode + 全屏模式 + Enable Separate Update Folder 启用单独的更新目录 - + + Default tab when opening settings + 打开设置时的默认选项卡 + + Show Game Size In List 显示游戏大小在列表中 @@ -620,6 +628,14 @@ Graphics 图像 + + Gui + 界面 + + + User + 用户 + Graphics Device 图形设备 @@ -805,7 +821,7 @@ 更新:\nRelease:每月发布的官方版本可能非常过时,但更可靠且经过测试。\nNightly:包含所有最新功能和修复的开发版本,但可能包含错误且稳定性较低。 - GUIgroupBox + GUIMusicGroupBox 播放标题音乐:\n如果游戏支持,在图形界面选择游戏时播放特殊音乐。 @@ -814,7 +830,7 @@ hideCursorGroupBox - 隐藏光标:\n选择光标何时消失:\n从不: 始终显示光标。\闲置: 光标在闲置若干秒后消失。\n始终: 始终显示光标。 + 隐藏光标:\n选择光标何时消失:\n从不: 从不隐藏光标。\n闲置:光标在闲置若干秒后消失。\n始终:始终隐藏光标。 idleTimeoutGroupBox @@ -912,6 +928,14 @@ rdocCheckBox 启用 RenderDoc 调试:\n启用后模拟器将提供与 Renderdoc 的兼容性,允许在渲染过程中捕获和分析当前渲染的帧。 + + saveDataBox + 存档数据路径:\n保存游戏存档数据的目录。 + + + browseButton + 浏览:\n选择一个目录保存游戏存档数据。 + CheatsPatches diff --git a/src/qt_gui/translations/zh_TW.ts b/src/qt_gui/translations/zh_TW.ts index 0ce0b4d69..9f6758797 100644 --- a/src/qt_gui/translations/zh_TW.ts +++ b/src/qt_gui/translations/zh_TW.ts @@ -540,10 +540,18 @@ Enable Fullscreen Enable Fullscreen + + Fullscreen Mode + 全螢幕模式 + Enable Separate Update Folder Enable Separate Update Folder + + Default tab when opening settings + 打開設置時的默認選項卡 + Show Game Size In List 顯示遊戲大小在列表中 @@ -620,6 +628,14 @@ Graphics Graphics + + Gui + 介面 + + + User + 使用者 + Graphics Device Graphics Device @@ -805,7 +821,7 @@ 更新:\nRelease: 每月發布的官方版本,可能非常舊,但更可靠且經過測試。\nNightly: 開發版本,擁有所有最新的功能和修復,但可能包含錯誤,穩定性較差。 - GUIgroupBox + GUIMusicGroupBox 播放標題音樂:\n如果遊戲支持,啟用在GUI中選擇遊戲時播放特殊音樂。 diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_bitwise_conversion.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_bitwise_conversion.cpp index 02ac74e19..539c6cb81 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_bitwise_conversion.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_bitwise_conversion.cpp @@ -58,4 +58,48 @@ Id EmitUnpackHalf2x16(EmitContext& ctx, Id value) { return ctx.OpUnpackHalf2x16(ctx.F32[2], value); } +Id EmitPackUnorm2x16(EmitContext& ctx, Id value) { + return ctx.OpPackUnorm2x16(ctx.U32[1], value); +} + +Id EmitUnpackUnorm2x16(EmitContext& ctx, Id value) { + return ctx.OpUnpackUnorm2x16(ctx.F32[2], value); +} + +Id EmitPackSnorm2x16(EmitContext& ctx, Id value) { + return ctx.OpPackSnorm2x16(ctx.U32[1], value); +} + +Id EmitUnpackSnorm2x16(EmitContext& ctx, Id value) { + return ctx.OpUnpackSnorm2x16(ctx.F32[2], value); +} + +Id EmitPackUint2x16(EmitContext& ctx, Id value) { + // No SPIR-V instruction for this, do it manually. + const auto x{ctx.OpCompositeExtract(ctx.U32[1], value, 0)}; + const auto y{ctx.OpCompositeExtract(ctx.U32[1], value, 1)}; + return ctx.OpBitFieldInsert(ctx.U32[1], x, y, ctx.ConstU32(16U), ctx.ConstU32(16U)); +} + +Id EmitUnpackUint2x16(EmitContext& ctx, Id value) { + // No SPIR-V instruction for this, do it manually. + const auto x{ctx.OpBitFieldUExtract(ctx.U32[1], value, ctx.ConstU32(0U), ctx.ConstU32(16U))}; + const auto y{ctx.OpBitFieldUExtract(ctx.U32[1], value, ctx.ConstU32(16U), ctx.ConstU32(16U))}; + return ctx.OpCompositeConstruct(ctx.U32[2], x, y); +} + +Id EmitPackSint2x16(EmitContext& ctx, Id value) { + // No SPIR-V instruction for this, do it manually. + const auto x{ctx.OpCompositeExtract(ctx.U32[1], value, 0)}; + const auto y{ctx.OpCompositeExtract(ctx.U32[1], value, 1)}; + return ctx.OpBitFieldInsert(ctx.U32[1], x, y, ctx.ConstU32(16U), ctx.ConstU32(16U)); +} + +Id EmitUnpackSint2x16(EmitContext& ctx, Id value) { + // No SPIR-V instruction for this, do it manually. + const auto x{ctx.OpBitFieldSExtract(ctx.U32[1], value, ctx.ConstU32(0U), ctx.ConstU32(16U))}; + const auto y{ctx.OpBitFieldSExtract(ctx.U32[1], value, ctx.ConstU32(16U), ctx.ConstU32(16U))}; + return ctx.OpCompositeConstruct(ctx.U32[2], x, y); +} + } // namespace Shader::Backend::SPIRV diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h b/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h index f0bb9fd7e..842b13207 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h +++ b/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h @@ -197,6 +197,14 @@ Id EmitPackFloat2x16(EmitContext& ctx, Id value); Id EmitUnpackFloat2x16(EmitContext& ctx, Id value); Id EmitPackHalf2x16(EmitContext& ctx, Id value); Id EmitUnpackHalf2x16(EmitContext& ctx, Id value); +Id EmitPackUnorm2x16(EmitContext& ctx, Id value); +Id EmitUnpackUnorm2x16(EmitContext& ctx, Id value); +Id EmitPackSnorm2x16(EmitContext& ctx, Id value); +Id EmitUnpackSnorm2x16(EmitContext& ctx, Id value); +Id EmitPackUint2x16(EmitContext& ctx, Id value); +Id EmitUnpackUint2x16(EmitContext& ctx, Id value); +Id EmitPackSint2x16(EmitContext& ctx, Id value); +Id EmitUnpackSint2x16(EmitContext& ctx, Id value); Id EmitFPAbs16(EmitContext& ctx, Id value); Id EmitFPAbs32(EmitContext& ctx, Id value); Id EmitFPAbs64(EmitContext& ctx, Id value); @@ -348,7 +356,8 @@ Id EmitSLessThanEqual(EmitContext& ctx, Id lhs, Id rhs); Id EmitULessThanEqual(EmitContext& ctx, Id lhs, Id rhs); Id EmitSGreaterThan(EmitContext& ctx, Id lhs, Id rhs); Id EmitUGreaterThan(EmitContext& ctx, Id lhs, Id rhs); -Id EmitINotEqual(EmitContext& ctx, Id lhs, Id rhs); +Id EmitINotEqual32(EmitContext& ctx, Id lhs, Id rhs); +Id EmitINotEqual64(EmitContext& ctx, Id lhs, Id rhs); Id EmitSGreaterThanEqual(EmitContext& ctx, Id lhs, Id rhs); Id EmitUGreaterThanEqual(EmitContext& ctx, Id lhs, Id rhs); Id EmitLogicalOr(EmitContext& ctx, Id a, Id b); diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp index 70411ecec..e2d702389 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp @@ -324,7 +324,11 @@ Id EmitUGreaterThan(EmitContext& ctx, Id lhs, Id rhs) { return ctx.OpUGreaterThan(ctx.U1[1], lhs, rhs); } -Id EmitINotEqual(EmitContext& ctx, Id lhs, Id rhs) { +Id EmitINotEqual32(EmitContext& ctx, Id lhs, Id rhs) { + return ctx.OpINotEqual(ctx.U1[1], lhs, rhs); +} + +Id EmitINotEqual64(EmitContext& ctx, Id lhs, Id rhs) { return ctx.OpINotEqual(ctx.U1[1], lhs, rhs); } diff --git a/src/shader_recompiler/frontend/format.cpp b/src/shader_recompiler/frontend/format.cpp index 9677be3e5..2fcac7c10 100644 --- a/src/shader_recompiler/frontend/format.cpp +++ b/src/shader_recompiler/frontend/format.cpp @@ -3420,8 +3420,8 @@ constexpr std::array InstructionFormatMIMG = {{ {InstClass::VectorMemImgUt, InstCategory::VectorMemory, 4, 1, ScalarType::Uint32, ScalarType::Uint32}, // 15 = IMAGE_ATOMIC_SWAP - {InstClass::VectorMemImgNoSmp, InstCategory::VectorMemory, 4, 1, ScalarType::Undefined, - ScalarType::Undefined}, + {InstClass::VectorMemImgNoSmp, InstCategory::VectorMemory, 4, 1, ScalarType::Uint32, + ScalarType::Uint32}, // 16 = IMAGE_ATOMIC_CMPSWAP {InstClass::VectorMemImgNoSmp, InstCategory::VectorMemory, 4, 1, ScalarType::Undefined, ScalarType::Undefined}, diff --git a/src/shader_recompiler/frontend/translate/export.cpp b/src/shader_recompiler/frontend/translate/export.cpp index 38ff9ae14..84c2ee658 100644 --- a/src/shader_recompiler/frontend/translate/export.cpp +++ b/src/shader_recompiler/frontend/translate/export.cpp @@ -7,6 +7,125 @@ namespace Shader::Gcn { +u32 SwizzleMrtComponent(const FragmentRuntimeInfo::PsColorBuffer& color_buffer, u32 comp) { + const auto [r, g, b, a] = color_buffer.swizzle; + const std::array swizzle_array = {r, g, b, a}; + const auto swizzled_comp_type = static_cast(swizzle_array[comp]); + constexpr auto min_comp_type = static_cast(AmdGpu::CompSwizzle::Red); + return swizzled_comp_type >= min_comp_type ? swizzled_comp_type - min_comp_type : comp; +} + +void Translator::ExportMrtValue(IR::Attribute attribute, u32 comp, const IR::F32& value, + const FragmentRuntimeInfo::PsColorBuffer& color_buffer) { + const auto converted = ApplyWriteNumberConversion(ir, value, color_buffer.num_conversion); + ir.SetAttribute(attribute, converted, comp); +} + +void Translator::ExportMrtCompressed(IR::Attribute attribute, u32 idx, const IR::U32& value) { + const u32 color_buffer_idx = + static_cast(attribute) - static_cast(IR::Attribute::RenderTarget0); + const auto color_buffer = runtime_info.fs_info.color_buffers[color_buffer_idx]; + + IR::Value unpacked_value; + bool is_integer = false; + switch (color_buffer.export_format) { + case AmdGpu::Liverpool::ShaderExportFormat::Zero: + // No export + return; + case AmdGpu::Liverpool::ShaderExportFormat::ABGR_FP16: + unpacked_value = ir.UnpackHalf2x16(value); + break; + case AmdGpu::Liverpool::ShaderExportFormat::ABGR_UNORM16: + unpacked_value = ir.UnpackUnorm2x16(value); + break; + case AmdGpu::Liverpool::ShaderExportFormat::ABGR_SNORM16: + unpacked_value = ir.UnpackSnorm2x16(value); + break; + case AmdGpu::Liverpool::ShaderExportFormat::ABGR_UINT16: + unpacked_value = ir.UnpackUint2x16(value); + is_integer = true; + break; + case AmdGpu::Liverpool::ShaderExportFormat::ABGR_SINT16: + unpacked_value = ir.UnpackSint2x16(value); + is_integer = true; + break; + default: + UNREACHABLE_MSG("Unimplemented compressed MRT export format {}", + static_cast(color_buffer.export_format)); + break; + } + + const auto r = ir.CompositeExtract(unpacked_value, 0); + const auto g = ir.CompositeExtract(unpacked_value, 1); + const IR::F32 float_r = is_integer ? ir.BitCast(IR::U32{r}) : IR::F32{r}; + const IR::F32 float_g = is_integer ? ir.BitCast(IR::U32{g}) : IR::F32{g}; + + const auto swizzled_r = SwizzleMrtComponent(color_buffer, idx * 2); + const auto swizzled_g = SwizzleMrtComponent(color_buffer, idx * 2 + 1); + + ExportMrtValue(attribute, swizzled_r, float_r, color_buffer); + ExportMrtValue(attribute, swizzled_g, float_g, color_buffer); +} + +void Translator::ExportMrtUncompressed(IR::Attribute attribute, u32 comp, const IR::F32& value) { + const u32 color_buffer_idx = + static_cast(attribute) - static_cast(IR::Attribute::RenderTarget0); + const auto color_buffer = runtime_info.fs_info.color_buffers[color_buffer_idx]; + const auto swizzled_comp = SwizzleMrtComponent(color_buffer, comp); + + switch (color_buffer.export_format) { + case AmdGpu::Liverpool::ShaderExportFormat::Zero: + // No export + return; + case AmdGpu::Liverpool::ShaderExportFormat::R_32: + // Red only + if (swizzled_comp != 0) { + return; + } + break; + case AmdGpu::Liverpool::ShaderExportFormat::GR_32: + // Red and Green only + if (swizzled_comp != 0 && swizzled_comp != 1) { + return; + } + break; + case AmdGpu::Liverpool::ShaderExportFormat::AR_32: + // Red and Alpha only + if (swizzled_comp != 0 && swizzled_comp != 3) { + return; + } + break; + case AmdGpu::Liverpool::ShaderExportFormat::ABGR_32: + // All components + break; + default: + UNREACHABLE_MSG("Unimplemented uncompressed MRT export format {}", + static_cast(color_buffer.export_format)); + break; + } + ExportMrtValue(attribute, swizzled_comp, value, color_buffer); +} + +void Translator::ExportCompressed(IR::Attribute attribute, u32 idx, const IR::U32& value) { + if (IsMrt(attribute)) { + ExportMrtCompressed(attribute, idx, value); + return; + } + const IR::Value unpacked_value = ir.UnpackHalf2x16(value); + const IR::F32 r = IR::F32{ir.CompositeExtract(unpacked_value, 0)}; + const IR::F32 g = IR::F32{ir.CompositeExtract(unpacked_value, 1)}; + ir.SetAttribute(attribute, r, idx * 2); + ir.SetAttribute(attribute, g, idx * 2 + 1); +} + +void Translator::ExportUncompressed(IR::Attribute attribute, u32 comp, const IR::F32& value) { + if (IsMrt(attribute)) { + ExportMrtUncompressed(attribute, comp, value); + return; + } + ir.SetAttribute(attribute, value, comp); +} + void Translator::EmitExport(const GcnInst& inst) { if (ir.block->has_multiple_predecessors && info.stage == Stage::Fragment) { ir.Discard(ir.LogicalNot(ir.GetExec())); @@ -26,41 +145,15 @@ void Translator::EmitExport(const GcnInst& inst) { IR::VectorReg(inst.src[3].code), }; - const auto set_attribute = [&](u32 comp, IR::F32 value) { - if (!IR::IsMrt(attrib)) { - ir.SetAttribute(attrib, value, comp); - return; - } - const u32 index = u32(attrib) - u32(IR::Attribute::RenderTarget0); - const auto col_buf = runtime_info.fs_info.color_buffers[index]; - const auto converted = IR::ApplyWriteNumberConversion(ir, value, col_buf.num_conversion); - const auto [r, g, b, a] = col_buf.swizzle; - const std::array swizzle_array = {r, g, b, a}; - const auto swizzled_comp = swizzle_array[comp]; - if (u32(swizzled_comp) < u32(AmdGpu::CompSwizzle::Red)) { - ir.SetAttribute(attrib, converted, comp); - return; - } - ir.SetAttribute(attrib, converted, u32(swizzled_comp) - u32(AmdGpu::CompSwizzle::Red)); - }; - - const auto unpack = [&](u32 idx) { - const IR::Value value = ir.UnpackHalf2x16(ir.GetVectorReg(vsrc[idx])); - const IR::F32 r = IR::F32{ir.CompositeExtract(value, 0)}; - const IR::F32 g = IR::F32{ir.CompositeExtract(value, 1)}; - set_attribute(idx * 2, r); - set_attribute(idx * 2 + 1, g); - }; - // Components are float16 packed into a VGPR if (exp.compr) { // Export R, G if (exp.en & 1) { - unpack(0); + ExportCompressed(attrib, 0, ir.GetVectorReg(vsrc[0])); } // Export B, A if ((exp.en >> 2) & 1) { - unpack(1); + ExportCompressed(attrib, 1, ir.GetVectorReg(vsrc[1])); } } else { // Components are float32 into separate VGPRS @@ -69,8 +162,7 @@ void Translator::EmitExport(const GcnInst& inst) { if ((mask & 1) == 0) { continue; } - const IR::F32 comp = ir.GetVectorReg(vsrc[i]); - set_attribute(i, comp); + ExportUncompressed(attrib, i, ir.GetVectorReg(vsrc[i])); } } if (IR::IsMrt(attrib)) { diff --git a/src/shader_recompiler/frontend/translate/scalar_alu.cpp b/src/shader_recompiler/frontend/translate/scalar_alu.cpp index 7f34126f5..b1b260fde 100644 --- a/src/shader_recompiler/frontend/translate/scalar_alu.cpp +++ b/src/shader_recompiler/frontend/translate/scalar_alu.cpp @@ -72,10 +72,14 @@ void Translator::EmitScalarAlu(const GcnInst& inst) { return S_OR_B64(NegateMode::Result, true, inst); case Opcode::S_LSHL_B32: return S_LSHL_B32(inst); + case Opcode::S_LSHL_B64: + return S_LSHL_B64(inst); case Opcode::S_LSHR_B32: return S_LSHR_B32(inst); case Opcode::S_ASHR_I32: return S_ASHR_I32(inst); + case Opcode::S_ASHR_I64: + return S_ASHR_I64(inst); case Opcode::S_BFM_B32: return S_BFM_B32(inst); case Opcode::S_MUL_I32: @@ -420,6 +424,14 @@ void Translator::S_LSHL_B32(const GcnInst& inst) { ir.SetScc(ir.INotEqual(result, ir.Imm32(0))); } +void Translator::S_LSHL_B64(const GcnInst& inst) { + const IR::U64 src0{GetSrc64(inst.src[0])}; + const IR::U64 src1{GetSrc64(inst.src[1])}; + const IR::U64 result = ir.ShiftLeftLogical(src0, ir.BitwiseAnd(src1, ir.Imm64(u64(0x3F)))); + SetDst64(inst.dst[0], result); + ir.SetScc(ir.INotEqual(result, ir.Imm64(u64(0)))); +} + void Translator::S_LSHR_B32(const GcnInst& inst) { const IR::U32 src0{GetSrc(inst.src[0])}; const IR::U32 src1{GetSrc(inst.src[1])}; @@ -431,11 +443,19 @@ void Translator::S_LSHR_B32(const GcnInst& inst) { void Translator::S_ASHR_I32(const GcnInst& inst) { const IR::U32 src0{GetSrc(inst.src[0])}; const IR::U32 src1{GetSrc(inst.src[1])}; - const IR::U32 result{ir.ShiftRightArithmetic(src0, src1)}; + const IR::U32 result{ir.ShiftRightArithmetic(src0, ir.BitwiseAnd(src1, ir.Imm32(0x1F)))}; SetDst(inst.dst[0], result); ir.SetScc(ir.INotEqual(result, ir.Imm32(0))); } +void Translator::S_ASHR_I64(const GcnInst& inst) { + const IR::U64 src0{GetSrc64(inst.src[0])}; + const IR::U64 src1{GetSrc64(inst.src[1])}; + const IR::U64 result{ir.ShiftRightArithmetic(src0, ir.BitwiseAnd(src1, ir.Imm64(u64(0x3F))))}; + SetDst64(inst.dst[0], result); + ir.SetScc(ir.INotEqual(result, ir.Imm64(u64(0)))); +} + void Translator::S_BFM_B32(const GcnInst& inst) { const IR::U32 src0{ir.BitwiseAnd(GetSrc(inst.src[0]), ir.Imm32(0x1F))}; const IR::U32 src1{ir.BitwiseAnd(GetSrc(inst.src[1]), ir.Imm32(0x1F))}; diff --git a/src/shader_recompiler/frontend/translate/translate.h b/src/shader_recompiler/frontend/translate/translate.h index bef61f997..287885854 100644 --- a/src/shader_recompiler/frontend/translate/translate.h +++ b/src/shader_recompiler/frontend/translate/translate.h @@ -90,8 +90,10 @@ public: void S_OR_B64(NegateMode negate, bool is_xor, const GcnInst& inst); void S_XOR_B32(const GcnInst& inst); void S_LSHL_B32(const GcnInst& inst); + void S_LSHL_B64(const GcnInst& inst); void S_LSHR_B32(const GcnInst& inst); void S_ASHR_I32(const GcnInst& inst); + void S_ASHR_I64(const GcnInst& inst); void S_BFM_B32(const GcnInst& inst); void S_MUL_I32(const GcnInst& inst); void S_BFE(const GcnInst& inst, bool is_signed); @@ -168,6 +170,7 @@ public: void V_SUBBREV_U32(const GcnInst& inst); void V_LDEXP_F32(const GcnInst& inst); void V_CVT_PKNORM_U16_F32(const GcnInst& inst); + void V_CVT_PKNORM_I16_F32(const GcnInst& inst); void V_CVT_PKRTZ_F16_F32(const GcnInst& inst); // VOP1 @@ -242,6 +245,7 @@ public: void V_SAD(const GcnInst& inst); void V_SAD_U32(const GcnInst& inst); void V_CVT_PK_U16_U32(const GcnInst& inst); + void V_CVT_PK_I16_I32(const GcnInst& inst); void V_CVT_PK_U8_F32(const GcnInst& inst); void V_LSHL_B64(const GcnInst& inst); void V_MUL_F64(const GcnInst& inst); @@ -304,6 +308,13 @@ private: IR::F32 SelectCubeResult(const IR::F32& x, const IR::F32& y, const IR::F32& z, const IR::F32& x_res, const IR::F32& y_res, const IR::F32& z_res); + void ExportMrtValue(IR::Attribute attribute, u32 comp, const IR::F32& value, + const FragmentRuntimeInfo::PsColorBuffer& color_buffer); + void ExportMrtCompressed(IR::Attribute attribute, u32 idx, const IR::U32& value); + void ExportMrtUncompressed(IR::Attribute attribute, u32 comp, const IR::F32& value); + void ExportCompressed(IR::Attribute attribute, u32 idx, const IR::U32& value); + void ExportUncompressed(IR::Attribute attribute, u32 comp, const IR::F32& value); + void LogMissingOpcode(const GcnInst& inst); private: diff --git a/src/shader_recompiler/frontend/translate/vector_alu.cpp b/src/shader_recompiler/frontend/translate/vector_alu.cpp index b2863f6a8..f73618dbe 100644 --- a/src/shader_recompiler/frontend/translate/vector_alu.cpp +++ b/src/shader_recompiler/frontend/translate/vector_alu.cpp @@ -96,6 +96,8 @@ void Translator::EmitVectorAlu(const GcnInst& inst) { return V_LDEXP_F32(inst); case Opcode::V_CVT_PKNORM_U16_F32: return V_CVT_PKNORM_U16_F32(inst); + case Opcode::V_CVT_PKNORM_I16_F32: + return V_CVT_PKNORM_I16_F32(inst); case Opcode::V_CVT_PKRTZ_F16_F32: return V_CVT_PKRTZ_F16_F32(inst); @@ -376,6 +378,8 @@ void Translator::EmitVectorAlu(const GcnInst& inst) { return V_SAD_U32(inst); case Opcode::V_CVT_PK_U16_U32: return V_CVT_PK_U16_U32(inst); + case Opcode::V_CVT_PK_I16_I32: + return V_CVT_PK_I16_I32(inst); case Opcode::V_CVT_PK_U8_F32: return V_CVT_PK_U8_F32(inst); case Opcode::V_LSHL_B64: @@ -645,12 +649,15 @@ void Translator::V_LDEXP_F32(const GcnInst& inst) { } void Translator::V_CVT_PKNORM_U16_F32(const GcnInst& inst) { - const IR::F32 src0{GetSrc(inst.src[0])}; - const IR::F32 src1{GetSrc(inst.src[1])}; - const IR::U32 dst0 = ir.ConvertFToU(32, ir.FPMul(src0, ir.Imm32(65535.f))); - const IR::U32 dst1 = ir.ConvertFToU(32, ir.FPMul(src1, ir.Imm32(65535.f))); - const IR::VectorReg dst_reg{inst.dst[0].code}; - ir.SetVectorReg(dst_reg, ir.BitFieldInsert(dst0, dst1, ir.Imm32(16), ir.Imm32(16))); + const IR::Value vec_f32 = + ir.CompositeConstruct(GetSrc(inst.src[0]), GetSrc(inst.src[1])); + SetDst(inst.dst[0], ir.PackUnorm2x16(vec_f32)); +} + +void Translator::V_CVT_PKNORM_I16_F32(const GcnInst& inst) { + const IR::Value vec_f32 = + ir.CompositeConstruct(GetSrc(inst.src[0]), GetSrc(inst.src[1])); + SetDst(inst.dst[0], ir.PackSnorm2x16(vec_f32)); } void Translator::V_CVT_PKRTZ_F16_F32(const GcnInst& inst) { @@ -1237,11 +1244,15 @@ void Translator::V_SAD_U32(const GcnInst& inst) { } void Translator::V_CVT_PK_U16_U32(const GcnInst& inst) { - const IR::U32 src0{GetSrc(inst.src[0])}; - const IR::U32 src1{GetSrc(inst.src[1])}; - const IR::U32 lo = ir.IMin(src0, ir.Imm32(0xFFFF), false); - const IR::U32 hi = ir.IMin(src1, ir.Imm32(0xFFFF), false); - SetDst(inst.dst[0], ir.BitFieldInsert(lo, hi, ir.Imm32(16), ir.Imm32(16))); + const IR::Value vec_u32 = + ir.CompositeConstruct(GetSrc(inst.src[0]), GetSrc(inst.src[1])); + SetDst(inst.dst[0], ir.PackUint2x16(vec_u32)); +} + +void Translator::V_CVT_PK_I16_I32(const GcnInst& inst) { + const IR::Value vec_u32 = + ir.CompositeConstruct(GetSrc(inst.src[0]), GetSrc(inst.src[1])); + SetDst(inst.dst[0], ir.PackSint2x16(vec_u32)); } void Translator::V_CVT_PK_U8_F32(const GcnInst& inst) { @@ -1257,24 +1268,7 @@ void Translator::V_CVT_PK_U8_F32(const GcnInst& inst) { void Translator::V_LSHL_B64(const GcnInst& inst) { const IR::U64 src0{GetSrc64(inst.src[0])}; const IR::U64 src1{GetSrc64(inst.src[1])}; - const IR::VectorReg dst_reg{inst.dst[0].code}; - if (src0.IsImmediate()) { - if (src0.U64() == -1) { - // If src0 is a fixed -1, the result will always be -1. - ir.SetVectorReg(dst_reg, ir.Imm32(0xFFFFFFFF)); - ir.SetVectorReg(dst_reg + 1, ir.Imm32(0xFFFFFFFF)); - return; - } - if (src1.IsImmediate()) { - // If both src0 and src1 are immediates, we can calculate the result now. - // Note that according to the manual, only bits 4:0 are used from src1. - const u64 result = src0.U64() << (src1.U64() & 0x1F); - ir.SetVectorReg(dst_reg, ir.Imm32(static_cast(result))); - ir.SetVectorReg(dst_reg + 1, ir.Imm32(static_cast(result >> 32))); - return; - } - } - UNREACHABLE_MSG("Unimplemented V_LSHL_B64 arguments"); + SetDst64(inst.dst[0], ir.ShiftLeftLogical(src0, ir.BitwiseAnd(src1, ir.Imm64(u64(0x3F))))); } void Translator::V_MUL_F64(const GcnInst& inst) { diff --git a/src/shader_recompiler/frontend/translate/vector_memory.cpp b/src/shader_recompiler/frontend/translate/vector_memory.cpp index 8fa0f3f87..685785af1 100644 --- a/src/shader_recompiler/frontend/translate/vector_memory.cpp +++ b/src/shader_recompiler/frontend/translate/vector_memory.cpp @@ -107,6 +107,8 @@ void Translator::EmitVectorMemory(const GcnInst& inst) { return IMAGE_GET_RESINFO(inst); // Image atomic operations + case Opcode::IMAGE_ATOMIC_SWAP: + return IMAGE_ATOMIC(AtomicOp::Swap, inst); case Opcode::IMAGE_ATOMIC_ADD: return IMAGE_ATOMIC(AtomicOp::Add, inst); case Opcode::IMAGE_ATOMIC_SMIN: diff --git a/src/shader_recompiler/ir/ir_emitter.cpp b/src/shader_recompiler/ir/ir_emitter.cpp index 5ac08e7dc..ecbe1f838 100644 --- a/src/shader_recompiler/ir/ir_emitter.cpp +++ b/src/shader_recompiler/ir/ir_emitter.cpp @@ -795,6 +795,38 @@ Value IREmitter::UnpackHalf2x16(const U32& value) { return Inst(Opcode::UnpackHalf2x16, value); } +U32 IREmitter::PackUnorm2x16(const Value& vector) { + return Inst(Opcode::PackUnorm2x16, vector); +} + +Value IREmitter::UnpackUnorm2x16(const U32& value) { + return Inst(Opcode::UnpackUnorm2x16, value); +} + +U32 IREmitter::PackSnorm2x16(const Value& vector) { + return Inst(Opcode::PackSnorm2x16, vector); +} + +Value IREmitter::UnpackSnorm2x16(const U32& value) { + return Inst(Opcode::UnpackSnorm2x16, value); +} + +U32 IREmitter::PackUint2x16(const Value& value) { + return Inst(Opcode::PackUint2x16, value); +} + +Value IREmitter::UnpackUint2x16(const U32& value) { + return Inst(Opcode::UnpackUint2x16, value); +} + +U32 IREmitter::PackSint2x16(const Value& value) { + return Inst(Opcode::PackSint2x16, value); +} + +Value IREmitter::UnpackSint2x16(const U32& value) { + return Inst(Opcode::UnpackSint2x16, value); +} + F32F64 IREmitter::FPMul(const F32F64& a, const F32F64& b) { if (a.Type() != b.Type()) { UNREACHABLE_MSG("Mismatching types {} and {}", a.Type(), b.Type()); @@ -1461,8 +1493,18 @@ U1 IREmitter::IGreaterThan(const U32& lhs, const U32& rhs, bool is_signed) { return Inst(is_signed ? Opcode::SGreaterThan : Opcode::UGreaterThan, lhs, rhs); } -U1 IREmitter::INotEqual(const U32& lhs, const U32& rhs) { - return Inst(Opcode::INotEqual, lhs, rhs); +U1 IREmitter::INotEqual(const U32U64& lhs, const U32U64& rhs) { + if (lhs.Type() != rhs.Type()) { + UNREACHABLE_MSG("Mismatching types {} and {}", lhs.Type(), rhs.Type()); + } + switch (lhs.Type()) { + case Type::U32: + return Inst(Opcode::INotEqual32, lhs, rhs); + case Type::U64: + return Inst(Opcode::INotEqual64, lhs, rhs); + default: + ThrowInvalidType(lhs.Type()); + } } U1 IREmitter::IGreaterThanEqual(const U32& lhs, const U32& rhs, bool is_signed) { diff --git a/src/shader_recompiler/ir/ir_emitter.h b/src/shader_recompiler/ir/ir_emitter.h index d1dc44d74..97b94187a 100644 --- a/src/shader_recompiler/ir/ir_emitter.h +++ b/src/shader_recompiler/ir/ir_emitter.h @@ -175,6 +175,14 @@ public: [[nodiscard]] U32 PackHalf2x16(const Value& vector); [[nodiscard]] Value UnpackHalf2x16(const U32& value); + [[nodiscard]] U32 PackUnorm2x16(const Value& vector); + [[nodiscard]] Value UnpackUnorm2x16(const U32& value); + [[nodiscard]] U32 PackSnorm2x16(const Value& vector); + [[nodiscard]] Value UnpackSnorm2x16(const U32& value); + [[nodiscard]] U32 PackUint2x16(const Value& value); + [[nodiscard]] Value UnpackUint2x16(const U32& value); + [[nodiscard]] U32 PackSint2x16(const Value& value); + [[nodiscard]] Value UnpackSint2x16(const U32& value); [[nodiscard]] F32F64 FPAdd(const F32F64& a, const F32F64& b); [[nodiscard]] F32F64 FPSub(const F32F64& a, const F32F64& b); @@ -258,7 +266,7 @@ public: [[nodiscard]] U1 IEqual(const U32U64& lhs, const U32U64& rhs); [[nodiscard]] U1 ILessThanEqual(const U32& lhs, const U32& rhs, bool is_signed); [[nodiscard]] U1 IGreaterThan(const U32& lhs, const U32& rhs, bool is_signed); - [[nodiscard]] U1 INotEqual(const U32& lhs, const U32& rhs); + [[nodiscard]] U1 INotEqual(const U32U64& lhs, const U32U64& rhs); [[nodiscard]] U1 IGreaterThanEqual(const U32& lhs, const U32& rhs, bool is_signed); [[nodiscard]] U1 LogicalOr(const U1& a, const U1& b); diff --git a/src/shader_recompiler/ir/opcodes.inc b/src/shader_recompiler/ir/opcodes.inc index b45151dba..6750be5a6 100644 --- a/src/shader_recompiler/ir/opcodes.inc +++ b/src/shader_recompiler/ir/opcodes.inc @@ -187,6 +187,14 @@ OPCODE(PackFloat2x16, U32, F16x OPCODE(UnpackFloat2x16, F16x2, U32, ) OPCODE(PackHalf2x16, U32, F32x2, ) OPCODE(UnpackHalf2x16, F32x2, U32, ) +OPCODE(PackUnorm2x16, U32, F32x2, ) +OPCODE(UnpackUnorm2x16, F32x2, U32, ) +OPCODE(PackSnorm2x16, U32, F32x2, ) +OPCODE(UnpackSnorm2x16, F32x2, U32, ) +OPCODE(PackUint2x16, U32, U32x2, ) +OPCODE(UnpackUint2x16, U32x2, U32, ) +OPCODE(PackSint2x16, U32, U32x2, ) +OPCODE(UnpackSint2x16, U32x2, U32, ) // Floating-point operations OPCODE(FPAbs32, F32, F32, ) @@ -321,7 +329,8 @@ OPCODE(SLessThanEqual, U1, U32, OPCODE(ULessThanEqual, U1, U32, U32, ) OPCODE(SGreaterThan, U1, U32, U32, ) OPCODE(UGreaterThan, U1, U32, U32, ) -OPCODE(INotEqual, U1, U32, U32, ) +OPCODE(INotEqual32, U1, U32, U32, ) +OPCODE(INotEqual64, U1, U64, U64, ) OPCODE(SGreaterThanEqual, U1, U32, U32, ) OPCODE(UGreaterThanEqual, U1, U32, U32, ) diff --git a/src/shader_recompiler/ir/passes/constant_propagation_pass.cpp b/src/shader_recompiler/ir/passes/constant_propagation_pass.cpp index 26d819d8e..c72b9e835 100644 --- a/src/shader_recompiler/ir/passes/constant_propagation_pass.cpp +++ b/src/shader_recompiler/ir/passes/constant_propagation_pass.cpp @@ -348,6 +348,22 @@ void ConstantPropagation(IR::Block& block, IR::Inst& inst) { return FoldInverseFunc(inst, IR::Opcode::UnpackFloat2x16); case IR::Opcode::UnpackFloat2x16: return FoldInverseFunc(inst, IR::Opcode::PackFloat2x16); + case IR::Opcode::PackUnorm2x16: + return FoldInverseFunc(inst, IR::Opcode::UnpackUnorm2x16); + case IR::Opcode::UnpackUnorm2x16: + return FoldInverseFunc(inst, IR::Opcode::PackUnorm2x16); + case IR::Opcode::PackSnorm2x16: + return FoldInverseFunc(inst, IR::Opcode::UnpackSnorm2x16); + case IR::Opcode::UnpackSnorm2x16: + return FoldInverseFunc(inst, IR::Opcode::PackSnorm2x16); + case IR::Opcode::PackUint2x16: + return FoldInverseFunc(inst, IR::Opcode::UnpackUint2x16); + case IR::Opcode::UnpackUint2x16: + return FoldInverseFunc(inst, IR::Opcode::PackUint2x16); + case IR::Opcode::PackSint2x16: + return FoldInverseFunc(inst, IR::Opcode::UnpackSint2x16); + case IR::Opcode::UnpackSint2x16: + return FoldInverseFunc(inst, IR::Opcode::PackSint2x16); case IR::Opcode::SelectU1: case IR::Opcode::SelectU8: case IR::Opcode::SelectU16: @@ -403,9 +419,12 @@ void ConstantPropagation(IR::Block& block, IR::Inst& inst) { case IR::Opcode::IEqual64: FoldWhenAllImmediates(inst, [](u64 a, u64 b) { return a == b; }); return; - case IR::Opcode::INotEqual: + case IR::Opcode::INotEqual32: FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a != b; }); return; + case IR::Opcode::INotEqual64: + FoldWhenAllImmediates(inst, [](u64 a, u64 b) { return a != b; }); + return; case IR::Opcode::BitwiseAnd32: FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a & b; }); return; diff --git a/src/shader_recompiler/ir/passes/resource_tracking_pass.cpp b/src/shader_recompiler/ir/passes/resource_tracking_pass.cpp index d94c5223a..43d125bf0 100644 --- a/src/shader_recompiler/ir/passes/resource_tracking_pass.cpp +++ b/src/shader_recompiler/ir/passes/resource_tracking_pass.cpp @@ -569,7 +569,7 @@ void PatchTextureBufferArgs(IR::Block& block, IR::Inst& inst, Info& info) { inst.SetArg(1, CalculateBufferAddress(ir, inst, info, buffer, 1U)); if (inst.GetOpcode() == IR::Opcode::StoreBufferFormatF32) { - const auto swizzled = ApplySwizzle(ir, inst.Arg(2), buffer.DstSelect()); + const auto swizzled = ApplySwizzle(ir, inst.Arg(2), buffer.DstSelect().Inverse()); const auto converted = ApplyWriteNumberConversionVec4(ir, swizzled, buffer.GetNumberConversion()); inst.SetArg(2, converted); @@ -829,7 +829,7 @@ void PatchImageArgs(IR::Block& block, IR::Inst& inst, Info& info) { auto texel = inst.Arg(4); if (is_storage) { // Storage image requires shader swizzle. - texel = ApplySwizzle(ir, texel, image.DstSelect()); + texel = ApplySwizzle(ir, texel, image.DstSelect().Inverse()); } const auto converted = ApplyWriteNumberConversionVec4(ir, texel, image.GetNumberConversion()); diff --git a/src/shader_recompiler/recompiler.cpp b/src/shader_recompiler/recompiler.cpp index bb027a11e..01518ab8f 100644 --- a/src/shader_recompiler/recompiler.cpp +++ b/src/shader_recompiler/recompiler.cpp @@ -90,6 +90,7 @@ IR::Program TranslateProgram(std::span code, Pools& pools, Info& info Shader::Optimization::ResourceTrackingPass(program); Shader::Optimization::IdentityRemovalPass(program.blocks); Shader::Optimization::DeadCodeEliminationPass(program); + Shader::Optimization::ConstantPropagationPass(program.post_order_blocks); Shader::Optimization::CollectShaderInfoPass(program); Shader::Optimization::SharedMemoryBarrierPass(program, profile); diff --git a/src/shader_recompiler/runtime_info.h b/src/shader_recompiler/runtime_info.h index 2bf5e3f0a..103c1faa8 100644 --- a/src/shader_recompiler/runtime_info.h +++ b/src/shader_recompiler/runtime_info.h @@ -184,6 +184,7 @@ struct FragmentRuntimeInfo { AmdGpu::NumberFormat num_format; AmdGpu::NumberConversion num_conversion; AmdGpu::CompMapping swizzle; + AmdGpu::Liverpool::ShaderExportFormat export_format; auto operator<=>(const PsColorBuffer&) const noexcept = default; }; diff --git a/src/video_core/amdgpu/liverpool.cpp b/src/video_core/amdgpu/liverpool.cpp index 8355dd1e6..2f40d4136 100644 --- a/src/video_core/amdgpu/liverpool.cpp +++ b/src/video_core/amdgpu/liverpool.cpp @@ -636,6 +636,18 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::span(header); + if (mem_semaphore->IsSignaling()) { + mem_semaphore->Signal(); + } else { + while (!mem_semaphore->Signaled()) { + YIELD_GFX(); + } + mem_semaphore->Decrement(); + } + break; + } case PM4ItOpcode::AcquireMem: { // const auto* acquire_mem = reinterpret_cast(header); break; @@ -848,6 +860,18 @@ Liverpool::Task Liverpool::ProcessCompute(std::span acb, u32 vqid) { } break; } + case PM4ItOpcode::MemSemaphore: { + const auto* mem_semaphore = reinterpret_cast(header); + if (mem_semaphore->IsSignaling()) { + mem_semaphore->Signal(); + } else { + while (!mem_semaphore->Signaled()) { + YIELD_ASC(vqid); + } + mem_semaphore->Decrement(); + } + break; + } case PM4ItOpcode::WaitRegMem: { const auto* wait_reg_mem = reinterpret_cast(header); ASSERT(wait_reg_mem->engine.Value() == PM4CmdWaitRegMem::Engine::Me); diff --git a/src/video_core/amdgpu/liverpool.h b/src/video_core/amdgpu/liverpool.h index a29bde4ce..67821b0f2 100644 --- a/src/video_core/amdgpu/liverpool.h +++ b/src/video_core/amdgpu/liverpool.h @@ -266,6 +266,10 @@ struct Liverpool { BitField<20, 4, ShaderExportFormat> col5; BitField<24, 4, ShaderExportFormat> col6; BitField<28, 4, ShaderExportFormat> col7; + + [[nodiscard]] ShaderExportFormat GetFormat(const u32 buf_idx) const { + return static_cast((raw >> (buf_idx * 4)) & 0xfu); + } }; union VsOutputControl { @@ -904,7 +908,7 @@ struct Liverpool { } bool IsTiled() const { - return !info.linear_general; + return GetTilingMode() != TilingMode::Display_Linear; } [[nodiscard]] DataFormat GetDataFmt() const { diff --git a/src/video_core/amdgpu/pm4_cmds.h b/src/video_core/amdgpu/pm4_cmds.h index 311f4d4d0..e92ba17fa 100644 --- a/src/video_core/amdgpu/pm4_cmds.h +++ b/src/video_core/amdgpu/pm4_cmds.h @@ -884,4 +884,65 @@ struct PM4CmdDrawIndexIndirectMulti { u32 draw_initiator; ///< Draw Initiator Register }; +struct PM4CmdMemSemaphore { + enum class ClientCode : u32 { + CommandProcessor = 0u, + CommandBuffer = 1u, + DataBuffer = 2u, + }; + enum class Select : u32 { + SignalSemaphore = 6u, + WaitSemaphore = 7u, + }; + enum class SignalType : u32 { + Increment = 0u, + Write = 1u, + }; + + PM4Type3Header header; ///< header + union { + u32 dw1; + BitField<3, 29, u32> addr_lo; ///< Semaphore address bits [31:3] + }; + union { + u32 dw2; + BitField<0, 8, u32> addr_hi; ///< Semaphore address bits [39:32] + BitField<16, 1, u32> use_mailbox; ///< Enables waiting until mailbox is written to + BitField<20, 1, SignalType> signal_type; ///< Indicates the type of signal sent + BitField<24, 2, ClientCode> client_code; + BitField<29, 3, Select> sem_sel; ///< Indicates whether to do a signal or wait operation + }; + + template + [[nodiscard]] T Address() const { + return std::bit_cast(u64(addr_lo) << 3 | (u64(addr_hi) << 32)); + } + + [[nodiscard]] bool IsSignaling() const { + return sem_sel == Select::SignalSemaphore; + } + + [[nodiscard]] bool Signaled() const { + return *Address() > 0; + } + + void Decrement() const { + *Address() -= 1; + } + + void Signal() const { + auto* ptr = Address(); + switch (signal_type) { + case SignalType::Increment: + *ptr += 1; + break; + case SignalType::Write: + *ptr = 1; + break; + default: + UNREACHABLE_MSG("Unknown signal type {}", static_cast(signal_type.Value())); + } + } +}; + } // namespace AmdGpu diff --git a/src/video_core/amdgpu/types.h b/src/video_core/amdgpu/types.h index 57f97418a..b442b2f1e 100644 --- a/src/video_core/amdgpu/types.h +++ b/src/video_core/amdgpu/types.h @@ -200,10 +200,10 @@ enum class NumberConversion : u32 { }; struct CompMapping { - CompSwizzle r : 3; - CompSwizzle g : 3; - CompSwizzle b : 3; - CompSwizzle a : 3; + CompSwizzle r; + CompSwizzle g; + CompSwizzle b; + CompSwizzle a; auto operator<=>(const CompMapping& other) const = default; @@ -217,6 +217,15 @@ struct CompMapping { }; } + [[nodiscard]] CompMapping Inverse() const { + CompMapping result{}; + InverseSingle(result.r, CompSwizzle::Red); + InverseSingle(result.g, CompSwizzle::Green); + InverseSingle(result.b, CompSwizzle::Blue); + InverseSingle(result.a, CompSwizzle::Alpha); + return result; + } + private: template T ApplySingle(const std::array& data, const CompSwizzle swizzle) const { @@ -237,6 +246,20 @@ private: UNREACHABLE(); } } + + void InverseSingle(CompSwizzle& dst, const CompSwizzle target) const { + if (r == target) { + dst = CompSwizzle::Red; + } else if (g == target) { + dst = CompSwizzle::Green; + } else if (b == target) { + dst = CompSwizzle::Blue; + } else if (a == target) { + dst = CompSwizzle::Alpha; + } else { + dst = CompSwizzle::Zero; + } + } }; inline DataFormat RemapDataFormat(const DataFormat format) { @@ -283,8 +306,7 @@ inline CompMapping RemapSwizzle(const DataFormat format, const CompMapping swizz result.a = swizzle.a; return result; } - case DataFormat::Format10_10_10_2: - case DataFormat::Format5_5_5_1: { + case DataFormat::Format10_10_10_2: { CompMapping result; result.r = swizzle.a; result.g = swizzle.b; @@ -292,6 +314,14 @@ inline CompMapping RemapSwizzle(const DataFormat format, const CompMapping swizz result.a = swizzle.r; return result; } + case DataFormat::Format1_5_5_5: { + CompMapping result; + result.r = swizzle.b; + result.g = swizzle.g; + result.b = swizzle.r; + result.a = swizzle.a; + return result; + } default: return swizzle; } diff --git a/src/video_core/buffer_cache/buffer_cache.cpp b/src/video_core/buffer_cache/buffer_cache.cpp index 487544a21..11ad0e96f 100644 --- a/src/video_core/buffer_cache/buffer_cache.cpp +++ b/src/video_core/buffer_cache/buffer_cache.cpp @@ -210,7 +210,6 @@ void BufferCache::InlineData(VAddr address, const void* value, u32 num_bytes, bo return; } scheduler.EndRendering(); - const auto cmdbuf = scheduler.CommandBuffer(); const Buffer* buffer = [&] { if (is_gds) { return &gds_buffer; @@ -218,6 +217,7 @@ void BufferCache::InlineData(VAddr address, const void* value, u32 num_bytes, bo const BufferId buffer_id = FindBuffer(address, num_bytes); return &slot_buffers[buffer_id]; }(); + const auto cmdbuf = scheduler.CommandBuffer(); const vk::BufferMemoryBarrier2 pre_barrier = { .srcStageMask = vk::PipelineStageFlagBits2::eAllCommands, .srcAccessMask = vk::AccessFlagBits2::eMemoryRead, diff --git a/src/video_core/renderer_vulkan/liverpool_to_vk.cpp b/src/video_core/renderer_vulkan/liverpool_to_vk.cpp index 4ac8d5cc8..f2fbc6530 100644 --- a/src/video_core/renderer_vulkan/liverpool_to_vk.cpp +++ b/src/video_core/renderer_vulkan/liverpool_to_vk.cpp @@ -612,11 +612,13 @@ std::span SurfaceFormats() { vk::Format::eB5G6R5UnormPack16), // 1_5_5_5 CreateSurfaceFormatInfo(AmdGpu::DataFormat::Format1_5_5_5, AmdGpu::NumberFormat::Unorm, - vk::Format::eA1B5G5R5UnormPack16), - // 5_5_5_1 - Remapped to 1_5_5_5. + vk::Format::eA1R5G5B5UnormPack16), + // 5_5_5_1 + CreateSurfaceFormatInfo(AmdGpu::DataFormat::Format5_5_5_1, AmdGpu::NumberFormat::Unorm, + vk::Format::eR5G5B5A1UnormPack16), // 4_4_4_4 CreateSurfaceFormatInfo(AmdGpu::DataFormat::Format4_4_4_4, AmdGpu::NumberFormat::Unorm, - vk::Format::eR4G4B4A4UnormPack16), + vk::Format::eA4B4G4R4UnormPack16), // 8_24 // 24_8 // X24_8_32 diff --git a/src/video_core/renderer_vulkan/vk_descriptor_update_queue.cpp b/src/video_core/renderer_vulkan/vk_descriptor_update_queue.cpp deleted file mode 100644 index 7699bea9d..000000000 --- a/src/video_core/renderer_vulkan/vk_descriptor_update_queue.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "video_core/renderer_vulkan/vk_descriptor_update_queue.h" -#include "video_core/renderer_vulkan/vk_instance.h" - -namespace Vulkan { - -DescriptorUpdateQueue::DescriptorUpdateQueue(const Instance& instance, u32 descriptor_write_max_) - : device{instance.GetDevice()}, descriptor_write_max{descriptor_write_max_} { - descriptor_infos = std::make_unique(descriptor_write_max); - descriptor_writes = std::make_unique(descriptor_write_max); -} - -void DescriptorUpdateQueue::Flush() { - if (descriptor_write_end == 0) { - return; - } - device.updateDescriptorSets({std::span(descriptor_writes.get(), descriptor_write_end)}, {}); - descriptor_write_end = 0; -} - -void DescriptorUpdateQueue::AddStorageImage(vk::DescriptorSet target, u8 binding, - vk::ImageView image_view, - vk::ImageLayout image_layout) { - if (descriptor_write_end >= descriptor_write_max) [[unlikely]] { - Flush(); - } - - auto& image_info = descriptor_infos[descriptor_write_end].image_info; - image_info.sampler = VK_NULL_HANDLE; - image_info.imageView = image_view; - image_info.imageLayout = image_layout; - - descriptor_writes[descriptor_write_end++] = vk::WriteDescriptorSet{ - .dstSet = target, - .dstBinding = binding, - .dstArrayElement = 0, - .descriptorCount = 1, - .descriptorType = vk::DescriptorType::eStorageImage, - .pImageInfo = &image_info, - }; -} - -void DescriptorUpdateQueue::AddImageSampler(vk::DescriptorSet target, u8 binding, u8 array_index, - vk::ImageView image_view, vk::Sampler sampler, - vk::ImageLayout image_layout) { - if (descriptor_write_end >= descriptor_write_max) [[unlikely]] { - Flush(); - } - - auto& image_info = descriptor_infos[descriptor_write_end].image_info; - image_info.sampler = sampler; - image_info.imageView = image_view; - image_info.imageLayout = image_layout; - - descriptor_writes[descriptor_write_end++] = vk::WriteDescriptorSet{ - .dstSet = target, - .dstBinding = binding, - .dstArrayElement = array_index, - .descriptorCount = 1, - .descriptorType = - sampler ? vk::DescriptorType::eCombinedImageSampler : vk::DescriptorType::eSampledImage, - .pImageInfo = &image_info, - }; -} - -void DescriptorUpdateQueue::AddBuffer(vk::DescriptorSet target, u8 binding, vk::Buffer buffer, - vk::DeviceSize offset, vk::DeviceSize size, - vk::DescriptorType type) { - if (descriptor_write_end >= descriptor_write_max) [[unlikely]] { - Flush(); - } - - auto& buffer_info = descriptor_infos[descriptor_write_end].buffer_info; - buffer_info.buffer = buffer; - buffer_info.offset = offset; - buffer_info.range = size; - - descriptor_writes[descriptor_write_end++] = vk::WriteDescriptorSet{ - .dstSet = target, - .dstBinding = binding, - .dstArrayElement = 0, - .descriptorCount = 1, - .descriptorType = type, - .pBufferInfo = &buffer_info, - }; -} - -void DescriptorUpdateQueue::AddTexelBuffer(vk::DescriptorSet target, u8 binding, - vk::BufferView buffer_view) { - if (descriptor_write_end >= descriptor_write_max) [[unlikely]] { - Flush(); - } - - auto& buffer_info = descriptor_infos[descriptor_write_end].buffer_view; - buffer_info = buffer_view; - descriptor_writes[descriptor_write_end++] = vk::WriteDescriptorSet{ - .dstSet = target, - .dstBinding = binding, - .dstArrayElement = 0, - .descriptorCount = 1, - .descriptorType = vk::DescriptorType::eUniformTexelBuffer, - .pTexelBufferView = &buffer_info, - }; -} - -} // namespace Vulkan diff --git a/src/video_core/renderer_vulkan/vk_descriptor_update_queue.h b/src/video_core/renderer_vulkan/vk_descriptor_update_queue.h deleted file mode 100644 index 9e864db6e..000000000 --- a/src/video_core/renderer_vulkan/vk_descriptor_update_queue.h +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include - -#include "common/types.h" -#include "video_core/renderer_vulkan/vk_common.h" - -namespace Vulkan { - -class Instance; - -struct DescriptorInfoUnion { - DescriptorInfoUnion() {} - - union { - vk::DescriptorImageInfo image_info; - vk::DescriptorBufferInfo buffer_info; - vk::BufferView buffer_view; - }; -}; - -class DescriptorUpdateQueue { -public: - explicit DescriptorUpdateQueue(const Instance& instance, u32 descriptor_write_max = 2048); - ~DescriptorUpdateQueue() = default; - - void Flush(); - - void AddStorageImage(vk::DescriptorSet target, u8 binding, vk::ImageView image_view, - vk::ImageLayout image_layout = vk::ImageLayout::eGeneral); - - void AddImageSampler(vk::DescriptorSet target, u8 binding, u8 array_index, - vk::ImageView image_view, vk::Sampler sampler, - vk::ImageLayout imageLayout = vk::ImageLayout::eGeneral); - - void AddBuffer(vk::DescriptorSet target, u8 binding, vk::Buffer buffer, vk::DeviceSize offset, - vk::DeviceSize size = VK_WHOLE_SIZE, - vk::DescriptorType type = vk::DescriptorType::eUniformBufferDynamic); - - void AddTexelBuffer(vk::DescriptorSet target, u8 binding, vk::BufferView buffer_view); - -private: - const vk::Device device; - const u32 descriptor_write_max; - std::unique_ptr descriptor_infos; - std::unique_ptr descriptor_writes; - u32 descriptor_write_end = 0; -}; - -} // namespace Vulkan diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h index 9a20f94c1..8c5cb1f3b 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h @@ -35,9 +35,8 @@ struct GraphicsPipelineKey { std::array stage_hashes; u32 num_color_attachments; std::array color_formats; - std::array color_num_formats; - std::array color_num_conversions; - std::array color_swizzles; + std::array + color_buffers; vk::Format depth_format; vk::Format stencil_format; diff --git a/src/video_core/renderer_vulkan/vk_instance.cpp b/src/video_core/renderer_vulkan/vk_instance.cpp index 5efdf4127..a722b5322 100644 --- a/src/video_core/renderer_vulkan/vk_instance.cpp +++ b/src/video_core/renderer_vulkan/vk_instance.cpp @@ -232,7 +232,7 @@ bool Instance::CreateDevice() { return false; } - boost::container::static_vector enabled_extensions; + boost::container::static_vector enabled_extensions; const auto add_extension = [&](std::string_view extension) -> bool { const auto result = std::find_if(available_extensions.begin(), available_extensions.end(), @@ -283,6 +283,7 @@ bool Instance::CreateDevice() { add_extension(VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_EXTENSION_NAME); add_extension(VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME); add_extension(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME); + add_extension(VK_EXT_4444_FORMATS_EXTENSION_NAME); #ifdef __APPLE__ // Required by Vulkan spec if supported. diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index c6a56745d..3728a55fb 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -167,11 +167,7 @@ const Shader::RuntimeInfo& PipelineCache::BuildRuntimeInfo(Stage stage, LogicalS }; } for (u32 i = 0; i < Shader::MaxColorBuffers; i++) { - info.fs_info.color_buffers[i] = { - .num_format = graphics_key.color_num_formats[i], - .num_conversion = graphics_key.color_num_conversions[i], - .swizzle = graphics_key.color_swizzles[i], - }; + info.fs_info.color_buffers[i] = graphics_key.color_buffers[i]; } break; } @@ -309,11 +305,9 @@ bool PipelineCache::RefreshGraphicsKey() { // order. We need to do some arrays compaction at this stage key.num_color_attachments = 0; key.color_formats.fill(vk::Format::eUndefined); - key.color_num_formats.fill(AmdGpu::NumberFormat::Unorm); - key.color_num_conversions.fill(AmdGpu::NumberConversion::None); + key.color_buffers.fill({}); key.blend_controls.fill({}); key.write_masks.fill({}); - key.color_swizzles.fill({}); key.vertex_buffer_formats.fill(vk::Format::eUndefined); key.patch_control_points = 0; @@ -338,9 +332,12 @@ bool PipelineCache::RefreshGraphicsKey() { key.color_formats[remapped_cb] = LiverpoolToVK::SurfaceFormat(col_buf.GetDataFmt(), col_buf.GetNumberFmt()); - key.color_num_formats[remapped_cb] = col_buf.GetNumberFmt(); - key.color_num_conversions[remapped_cb] = col_buf.GetNumberConversion(); - key.color_swizzles[remapped_cb] = col_buf.Swizzle(); + key.color_buffers[remapped_cb] = { + .num_format = col_buf.GetNumberFmt(), + .num_conversion = col_buf.GetNumberConversion(), + .swizzle = col_buf.Swizzle(), + .export_format = regs.color_export_format.GetFormat(cb), + }; } fetch_shader = std::nullopt; @@ -456,7 +453,7 @@ bool PipelineCache::RefreshGraphicsKey() { // of the latter we need to change format to undefined, and either way we need to // increment the index for the null attachment binding. key.color_formats[remapped_cb] = vk::Format::eUndefined; - key.color_swizzles[remapped_cb] = {}; + key.color_buffers[remapped_cb] = {}; ++remapped_cb; continue; } diff --git a/src/video_core/renderer_vulkan/vk_platform.cpp b/src/video_core/renderer_vulkan/vk_platform.cpp index fdd590e9d..07ebfbda6 100644 --- a/src/video_core/renderer_vulkan/vk_platform.cpp +++ b/src/video_core/renderer_vulkan/vk_platform.cpp @@ -28,19 +28,19 @@ static const char* const VALIDATION_LAYER_NAME = "VK_LAYER_KHRONOS_validation"; static const char* const CRASH_DIAGNOSTIC_LAYER_NAME = "VK_LAYER_LUNARG_crash_diagnostic"; static VKAPI_ATTR VkBool32 VKAPI_CALL DebugUtilsCallback( - VkDebugUtilsMessageSeverityFlagBitsEXT severity, VkDebugUtilsMessageTypeFlagsEXT type, - const VkDebugUtilsMessengerCallbackDataEXT* callback_data, void* user_data) { + vk::DebugUtilsMessageSeverityFlagBitsEXT severity, vk::DebugUtilsMessageTypeFlagsEXT type, + const vk::DebugUtilsMessengerCallbackDataEXT* callback_data, void* user_data) { Common::Log::Level level{}; switch (severity) { - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT: + case vk::DebugUtilsMessageSeverityFlagBitsEXT::eError: level = Common::Log::Level::Error; break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT: + case vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning: level = Common::Log::Level::Info; break; - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT: - case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT: + case vk::DebugUtilsMessageSeverityFlagBitsEXT::eInfo: + case vk::DebugUtilsMessageSeverityFlagBitsEXT::eVerbose: level = Common::Log::Level::Debug; break; default: diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 88b510eca..7c77f2519 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -1155,10 +1155,7 @@ void Rasterizer::UpdateViewportScissorState(const GraphicsPipeline& pipeline) { const auto& vp_ctl = regs.viewport_control; const float reduce_z = - instance.IsDepthClipControlSupported() && - regs.clipper_control.clip_space == AmdGpu::Liverpool::ClipSpace::MinusWToW - ? 1.0f - : 0.0f; + regs.clipper_control.clip_space == AmdGpu::Liverpool::ClipSpace::MinusWToW ? 1.0f : 0.0f; if (regs.polygon_control.enable_window_offset) { LOG_ERROR(Render_Vulkan, @@ -1172,6 +1169,8 @@ void Rasterizer::UpdateViewportScissorState(const GraphicsPipeline& pipeline) { continue; } + const auto zoffset = vp_ctl.zoffset_enable ? vp.zoffset : 0.f; + const auto zscale = vp_ctl.zscale_enable ? vp.zscale : 1.f; if (pipeline.IsClipDisabled()) { // In case if clipping is disabled we patch the shader to convert vertex position // from screen space coordinates to NDC by defining a render space as full hardware @@ -1181,16 +1180,14 @@ void Rasterizer::UpdateViewportScissorState(const GraphicsPipeline& pipeline) { .y = 0.f, .width = float(std::min(instance.GetMaxViewportWidth(), 16_KB)), .height = float(std::min(instance.GetMaxViewportHeight(), 16_KB)), - .minDepth = 0.0, - .maxDepth = 1.0, + .minDepth = zoffset - zscale * reduce_z, + .maxDepth = zscale + zoffset, }); } else { const auto xoffset = vp_ctl.xoffset_enable ? vp.xoffset : 0.f; const auto xscale = vp_ctl.xscale_enable ? vp.xscale : 1.f; const auto yoffset = vp_ctl.yoffset_enable ? vp.yoffset : 0.f; const auto yscale = vp_ctl.yscale_enable ? vp.yscale : 1.f; - const auto zoffset = vp_ctl.zoffset_enable ? vp.zoffset : 0.f; - const auto zscale = vp_ctl.zscale_enable ? vp.zscale : 1.f; viewports.push_back({ .x = xoffset - xscale, .y = yoffset - yscale, diff --git a/src/video_core/texture_cache/image_info.cpp b/src/video_core/texture_cache/image_info.cpp index 8068aae2f..dd89be8aa 100644 --- a/src/video_core/texture_cache/image_info.cpp +++ b/src/video_core/texture_cache/image_info.cpp @@ -178,7 +178,6 @@ void ImageInfo::UpdateSize() { case AmdGpu::TilingMode::Display_Linear: { std::tie(mip_info.pitch, mip_info.size) = ImageSizeLinearAligned(mip_w, mip_h, bpp, num_samples); - mip_info.height = mip_h; break; } case AmdGpu::TilingMode::Texture_Volume: @@ -188,12 +187,7 @@ void ImageInfo::UpdateSize() { case AmdGpu::TilingMode::Display_MicroTiled: case AmdGpu::TilingMode::Texture_MicroTiled: { std::tie(mip_info.pitch, mip_info.size) = - ImageSizeMicroTiled(mip_w, mip_h, bpp, thickness, num_samples); - mip_info.height = std::max(mip_h, 8u); - if (props.is_block) { - mip_info.pitch = std::max(mip_info.pitch * 4, 32u); - mip_info.height = std::max(mip_info.height * 4, 32u); - } + ImageSizeMicroTiled(mip_w, mip_h, thickness, bpp, num_samples); break; } case AmdGpu::TilingMode::Display_MacroTiled: @@ -208,6 +202,11 @@ void ImageInfo::UpdateSize() { UNREACHABLE(); } } + mip_info.height = mip_h; + if (props.is_block) { + mip_info.pitch = std::max(mip_info.pitch * 4, 32u); + mip_info.height = std::max(mip_info.height * 4, 32u); + } mip_info.size *= mip_d; mip_info.offset = guest_size; mips_layout.emplace_back(mip_info); diff --git a/src/video_core/texture_cache/texture_cache.cpp b/src/video_core/texture_cache/texture_cache.cpp index a281b89c9..e995b10b2 100644 --- a/src/video_core/texture_cache/texture_cache.cpp +++ b/src/video_core/texture_cache/texture_cache.cpp @@ -60,15 +60,13 @@ void TextureCache::MarkAsMaybeDirty(ImageId image_id, Image& image) { void TextureCache::InvalidateMemory(VAddr addr, size_t size) { std::scoped_lock lock{mutex}; - const auto end = addr + size; const auto pages_start = PageManager::GetPageAddr(addr); const auto pages_end = PageManager::GetNextPageAddr(addr + size - 1); ForEachImageInRegion(pages_start, pages_end - pages_start, [&](ImageId image_id, Image& image) { const auto image_begin = image.info.guest_address; const auto image_end = image.info.guest_address + image.info.guest_size; - if (image_begin < end && addr < image_end) { - // Start or end of the modified region is in the image, or the image is entirely within - // the modified region, so the image was definitely accessed by this page fault. + if (image.Overlaps(addr, size)) { + // Modified region overlaps image, so the image was definitely accessed by this fault. // Untrack the image, so that the range is unprotected and the guest can write freely. image.flags |= ImageFlagBits::CpuDirty; UntrackImage(image_id); @@ -347,8 +345,13 @@ ImageId TextureCache::FindImage(BaseDesc& desc, FindFlags flags) { view_slice = -1; const auto& merged_info = image_id ? slot_images[image_id].info : info; - std::tie(image_id, view_mip, view_slice) = + auto [overlap_image_id, overlap_view_mip, overlap_view_slice] = ResolveOverlap(merged_info, desc.type, cache_id, image_id); + if (overlap_image_id) { + image_id = overlap_image_id; + view_mip = overlap_view_mip; + view_slice = overlap_view_slice; + } } } @@ -545,12 +548,12 @@ void TextureCache::RefreshImage(Image& image, Vulkan::Scheduler* custom_schedule auto* sched_ptr = custom_scheduler ? custom_scheduler : &scheduler; sched_ptr->EndRendering(); - const auto cmdbuf = sched_ptr->CommandBuffer(); const VAddr image_addr = image.info.guest_address; const size_t image_size = image.info.guest_size; const auto [vk_buffer, buf_offset] = buffer_cache.ObtainViewBuffer(image_addr, image_size, is_gpu_dirty); + const auto cmdbuf = sched_ptr->CommandBuffer(); // The obtained buffer may be written by a shader so we need to emit a barrier to prevent RAW // hazard if (auto barrier = vk_buffer->GetBarrier(vk::AccessFlagBits2::eTransferRead, @@ -643,6 +646,9 @@ void TextureCache::UnregisterImage(ImageId image_id) { void TextureCache::TrackImage(ImageId image_id) { auto& image = slot_images[image_id]; + if (!(image.flags & ImageFlagBits::Registered)) { + return; + } const auto image_begin = image.info.guest_address; const auto image_end = image.info.guest_address + image.info.guest_size; if (image_begin == image.track_addr && image_end == image.track_addr_end) { @@ -666,6 +672,9 @@ void TextureCache::TrackImage(ImageId image_id) { void TextureCache::TrackImageHead(ImageId image_id) { auto& image = slot_images[image_id]; + if (!(image.flags & ImageFlagBits::Registered)) { + return; + } const auto image_begin = image.info.guest_address; if (image_begin == image.track_addr) { return; @@ -678,6 +687,9 @@ void TextureCache::TrackImageHead(ImageId image_id) { void TextureCache::TrackImageTail(ImageId image_id) { auto& image = slot_images[image_id]; + if (!(image.flags & ImageFlagBits::Registered)) { + return; + } const auto image_end = image.info.guest_address + image.info.guest_size; if (image_end == image.track_addr_end) { return; diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 343a510e6..f262768ea 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -118,6 +118,7 @@ public: /// Updates image contents if it was modified by CPU. void UpdateImage(ImageId image_id, Vulkan::Scheduler* custom_scheduler = nullptr) { + std::scoped_lock lock{mutex}; Image& image = slot_images[image_id]; TrackImage(image_id); RefreshImage(image, custom_scheduler); diff --git a/src/video_core/texture_cache/tile.h b/src/video_core/texture_cache/tile.h index c111e6aca..54938b801 100644 --- a/src/video_core/texture_cache/tile.h +++ b/src/video_core/texture_cache/tile.h @@ -313,8 +313,8 @@ constexpr std::pair ImageSizeMicroTiled(u32 pitch, u32 height, u32 const auto& [pitch_align, height_align] = micro_tile_extent; auto pitch_aligned = (pitch + pitch_align - 1) & ~(pitch_align - 1); const auto height_aligned = (height + height_align - 1) & ~(height_align - 1); - size_t log_sz = (pitch_aligned * height_aligned * bpp * num_samples * thickness + 7) / 8; - while (log_sz % 256) { + size_t log_sz = (pitch_aligned * height_aligned * bpp * num_samples + 7) / 8; + while ((log_sz * thickness) % 256) { pitch_aligned += pitch_align; log_sz = (pitch_aligned * height_aligned * bpp * num_samples + 7) / 8; }