diff --git a/.gitmodules b/.gitmodules index 3d0d21c5b..98fba2098 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,15 +1,3 @@ -[submodule "externals/cryptopp-cmake"] - path = externals/cryptopp-cmake - url = https://github.com/shadps4-emu/ext-cryptopp-cmake.git - shallow = true -[submodule "externals/cryptopp"] - path = externals/cryptopp - url = https://github.com/shadps4-emu/ext-cryptopp.git - shallow = true -[submodule "externals/cryptoppwin"] - path = externals/cryptoppwin - url = https://github.com/shadps4-emu/ext-cryptoppwin.git - shallow = true [submodule "externals/zlib-ng"] path = externals/zlib-ng url = https://github.com/shadps4-emu/ext-zlib-ng.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 668eab902..36613a6ab 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,8 +37,10 @@ option(ENABLE_UPDATER "Enables the options to updater" ON) # First, determine whether to use CMAKE_OSX_ARCHITECTURES or CMAKE_SYSTEM_PROCESSOR. if (APPLE AND CMAKE_OSX_ARCHITECTURES) set(BASE_ARCHITECTURE "${CMAKE_OSX_ARCHITECTURES}") -else() +elseif (CMAKE_SYSTEM_PROCESSOR) set(BASE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}") +else() + set(BASE_ARCHITECTURE "${CMAKE_HOST_SYSTEM_PROCESSOR}") endif() # Next, match common architecture strings down to a known common value. @@ -50,7 +52,12 @@ else() message(FATAL_ERROR "Unsupported CPU architecture: ${BASE_ARCHITECTURE}") endif() -if (APPLE AND ARCHITECTURE STREQUAL "x86_64" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") +if (ARCHITECTURE STREQUAL "x86_64") + # Set x86_64 target level to Sandy Bridge to generally match what is supported for PS4 guest code with CPU patches. + add_compile_options(-march=sandybridge) +endif() + +if (APPLE AND ARCHITECTURE STREQUAL "x86_64" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64") # Exclude ARM homebrew path to avoid conflicts when cross compiling. list(APPEND CMAKE_IGNORE_PREFIX_PATH "/opt/homebrew") @@ -106,28 +113,74 @@ git_describe(GIT_DESC --always --long --dirty) git_branch_name(GIT_BRANCH) string(TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S") +message("start git things") + # Try to get the upstream remote and branch +message("check for remote and branch") execute_process( COMMAND git rev-parse --abbrev-ref --symbolic-full-name @{u} OUTPUT_VARIABLE GIT_REMOTE_NAME - RESULT_VARIABLE GIT_BRANCH_RESULT + RESULT_VARIABLE GIT_REMOTE_RESULT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) # If there's no upstream set or the command failed, check remote.pushDefault -if (GIT_BRANCH_RESULT OR GIT_REMOTE_NAME STREQUAL "") +if (GIT_REMOTE_RESULT OR GIT_REMOTE_NAME STREQUAL "") + message("check default push") execute_process( COMMAND git config --get remote.pushDefault OUTPUT_VARIABLE GIT_REMOTE_NAME - RESULT_VARIABLE GIT_PUSH_DEFAULT_RESULT + RESULT_VARIABLE GIT_REMOTE_RESULT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) - - # If remote.pushDefault is not set or fails, default to origin - if (GIT_PUSH_DEFAULT_RESULT OR GIT_REMOTE_NAME STREQUAL "") - set(GIT_REMOTE_NAME "origin") +endif() + +# If running in GitHub Actions and the above fails +if (GIT_REMOTE_RESULT OR GIT_REMOTE_NAME STREQUAL "") + message("check github") + set(GIT_REMOTE_NAME "origin") + + # Retrieve environment variables + if (DEFINED ENV{GITHUB_HEAD_REF} AND NOT "$ENV{GITHUB_HEAD_REF}" STREQUAL "") + message("github head ref: $ENV{GITHUB_HEAD_REF}") + set(GITHUB_HEAD_REF "$ENV{GITHUB_HEAD_REF}") + else() + set(GITHUB_HEAD_REF "") + endif() + + if (DEFINED ENV{GITHUB_REF} AND NOT "$ENV{GITHUB_REF}" STREQUAL "") + message("github ref: $ENV{GITHUB_REF}") + string(REGEX REPLACE "^refs/[^/]*/" "" GITHUB_BRANCH "$ENV{GITHUB_REF}") + string(REGEX MATCH "refs/pull/([0-9]+)/merge" MATCHED_REF "$ENV{GITHUB_REF}") + if (MATCHED_REF) + set(PR_NUMBER "${CMAKE_MATCH_1}") + set(GITHUB_BRANCH "") + message("PR number: ${PR_NUMBER}") + else() + set(PR_NUMBER "") + endif() + else() + set(GITHUB_BRANCH "") + set(PR_NUMBER "") + endif() + + if (NOT "${PR_NUMBER}" STREQUAL "" AND NOT "${GITHUB_HEAD_REF}" STREQUAL "") + set(GIT_BRANCH "pr-${PR_NUMBER}-${GITHUB_HEAD_REF}") + elseif (NOT "${PR_NUMBER}" STREQUAL "" AND NOT "${GITHUB_BRANCH}" STREQUAL "") + set(GIT_BRANCH "pr-${PR_NUMBER}-${GITHUB_BRANCH}") + elseif (NOT "${PR_NUMBER}" STREQUAL "") + set(GIT_BRANCH "pr-${PR_NUMBER}") + elseif ("${PR_NUMBER}" STREQUAL "" AND NOT "${GITHUB_HEAD_REF}" STREQUAL "") + set(GIT_BRANCH "${GITHUB_HEAD_REF}") + elseif ("${PR_NUMBER}" STREQUAL "" AND NOT "${GITHUB_BRANCH}" STREQUAL "") + set(GIT_BRANCH "${GITHUB_BRANCH}") + elseif ("${PR_NUMBER}" STREQUAL "" AND NOT "${GITHUB_REF}" STREQUAL "") + set(GIT_BRANCH "${GITHUB_REF}") + else() + message("couldn't find branch") + set(GIT_BRANCH "detached-head") endif() else() # Extract remote name if the output contains a remote/branch format @@ -141,6 +194,7 @@ else() endif() # Get remote link +message("getting remote link") execute_process( COMMAND git config --get remote.${GIT_REMOTE_NAME}.url OUTPUT_VARIABLE GIT_REMOTE_URL @@ -149,6 +203,8 @@ execute_process( configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/common/scm_rev.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/src/common/scm_rev.cpp" @ONLY) +message("end git things, remote: ${GIT_REMOTE_NAME}, branch: ${GIT_BRANCH}") + find_package(Boost 1.84.0 CONFIG) find_package(FFmpeg 5.1.2 MODULE) find_package(fmt 10.2.0 CONFIG) @@ -278,6 +334,8 @@ set(KERNEL_LIB src/core/libraries/kernel/sync/mutex.cpp src/core/libraries/kernel/threads/thread_state.h src/core/libraries/kernel/process.cpp src/core/libraries/kernel/process.h + src/core/libraries/kernel/debug.cpp + src/core/libraries/kernel/debug.h src/core/libraries/kernel/equeue.cpp src/core/libraries/kernel/equeue.h src/core/libraries/kernel/file_system.cpp @@ -371,6 +429,24 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp src/core/libraries/ngs2/ngs2_error.h src/core/libraries/ngs2/ngs2_impl.cpp src/core/libraries/ngs2/ngs2_impl.h + src/core/libraries/ngs2/ngs2_custom.cpp + src/core/libraries/ngs2/ngs2_custom.h + src/core/libraries/ngs2/ngs2_reverb.cpp + src/core/libraries/ngs2/ngs2_reverb.h + src/core/libraries/ngs2/ngs2_geom.cpp + src/core/libraries/ngs2/ngs2_geom.h + src/core/libraries/ngs2/ngs2_pan.cpp + src/core/libraries/ngs2/ngs2_pan.h + src/core/libraries/ngs2/ngs2_report.cpp + src/core/libraries/ngs2/ngs2_report.h + src/core/libraries/ngs2/ngs2_eq.cpp + src/core/libraries/ngs2/ngs2_eq.h + src/core/libraries/ngs2/ngs2_mastering.cpp + src/core/libraries/ngs2/ngs2_mastering.h + src/core/libraries/ngs2/ngs2_sampler.cpp + src/core/libraries/ngs2/ngs2_sampler.h + src/core/libraries/ngs2/ngs2_submixer.cpp + src/core/libraries/ngs2/ngs2_submixer.h src/core/libraries/ajm/ajm_error.h src/core/libraries/audio3d/audio3d.cpp src/core/libraries/audio3d/audio3d.h @@ -550,6 +626,7 @@ set(COMMON src/common/logging/backend.cpp src/common/logging/text_formatter.cpp src/common/logging/text_formatter.h src/common/logging/types.h + src/common/aes.h src/common/alignment.h src/common/arch.h src/common/assert.cpp @@ -581,6 +658,7 @@ set(COMMON src/common/logging/backend.cpp src/common/polyfill_thread.h src/common/rdtsc.cpp src/common/rdtsc.h + src/common/sha1.h src/common/signal_context.h src/common/signal_context.cpp src/common/singleton.h @@ -620,9 +698,6 @@ set(CORE src/core/aerolib/stubs.cpp src/core/aerolib/aerolib.h src/core/address_space.cpp src/core/address_space.h - src/core/crypto/crypto.cpp - src/core/crypto/crypto.h - src/core/crypto/keys.h src/core/devices/base_device.cpp src/core/devices/base_device.h src/core/devices/ioccom.h @@ -640,10 +715,6 @@ set(CORE src/core/aerolib/stubs.cpp 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 - src/core/file_format/pkg_type.cpp - src/core/file_format/pkg_type.h src/core/file_format/psf.cpp src/core/file_format/psf.h src/core/file_format/playgo_chunk.cpp @@ -652,8 +723,6 @@ set(CORE src/core/aerolib/stubs.cpp src/core/file_format/trp.h src/core/file_sys/fs.cpp src/core/file_sys/fs.h - src/core/loader.cpp - src/core/loader.h src/core/loader/dwarf.cpp src/core/loader/dwarf.h src/core/loader/elf.cpp @@ -770,6 +839,7 @@ set(SHADER_RECOMPILER src/shader_recompiler/exception.h src/shader_recompiler/ir/passes/identity_removal_pass.cpp src/shader_recompiler/ir/passes/ir_passes.h src/shader_recompiler/ir/passes/lower_buffer_format_to_raw.cpp + src/shader_recompiler/ir/passes/readlane_elimination_pass.cpp src/shader_recompiler/ir/passes/resource_tracking_pass.cpp src/shader_recompiler/ir/passes/ring_access_elimination.cpp src/shader_recompiler/ir/passes/shader_info_collection_pass.cpp @@ -942,10 +1012,6 @@ set(QT_GUI src/qt_gui/about_dialog.cpp src/qt_gui/game_grid_frame.h src/qt_gui/game_install_dialog.cpp src/qt_gui/game_install_dialog.h - src/qt_gui/install_dir_select.cpp - src/qt_gui/install_dir_select.h - src/qt_gui/pkg_viewer.cpp - src/qt_gui/pkg_viewer.h src/qt_gui/trophy_viewer.cpp src/qt_gui/trophy_viewer.h src/qt_gui/elf_viewer.cpp @@ -1050,12 +1116,6 @@ if (NOT ENABLE_QT_GUI) target_link_libraries(shadps4 PRIVATE SDL3::SDL3) endif() -if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND MSVC) - target_link_libraries(shadps4 PRIVATE cryptoppwin) -else() - target_link_libraries(shadps4 PRIVATE cryptopp::cryptopp) -endif() - if (ENABLE_QT_GUI) target_link_libraries(shadps4 PRIVATE Qt6::Widgets Qt6::Concurrent Qt6::Network Qt6::Multimedia) add_definitions(-DENABLE_QT_GUI) @@ -1126,7 +1186,6 @@ cmrc_add_resource_library(embedded-resources src/images/gold.png src/images/platinum.png src/images/silver.png) - target_link_libraries(shadps4 PRIVATE res::embedded) # ImGui resources diff --git a/REUSE.toml b/REUSE.toml index d9b307d39..ad2bc3678 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -30,6 +30,7 @@ path = [ "src/images/dump_icon.png", "src/images/exit_icon.png", "src/images/file_icon.png", + "src/images/trophy_icon.png", "src/images/flag_china.png", "src/images/flag_eu.png", "src/images/flag_jp.png", @@ -48,8 +49,10 @@ path = [ "src/images/pause_icon.png", "src/images/play_icon.png", "src/images/ps4_controller.png", - "src/images/refresh_icon.png", + "src/images/restart_game_icon.png", + "src/images/refreshlist_icon.png", "src/images/settings_icon.png", + "src/images/fullscreen_icon.png", "src/images/stop_icon.png", "src/images/utils_icon.png", "src/images/shadPS4.icns", diff --git a/dist/net.shadps4.shadPS4.metainfo.xml b/dist/net.shadps4.shadPS4.metainfo.xml index c8c9d5c23..99f9e070d 100644 --- a/dist/net.shadps4.shadPS4.metainfo.xml +++ b/dist/net.shadps4.shadPS4.metainfo.xml @@ -37,6 +37,9 @@ Game + + https://github.com/shadps4-emu/shadPS4/releases/tag/v.0.7.0 + https://github.com/shadps4-emu/shadPS4/releases/tag/v.0.6.0 diff --git a/documents/Quickstart/2.png b/documents/Quickstart/2.png deleted file mode 100644 index 7e5bdfb15..000000000 Binary files a/documents/Quickstart/2.png and /dev/null differ diff --git a/documents/Quickstart/Quickstart.md b/documents/Quickstart/Quickstart.md index 2f2751887..9c6bc5a6f 100644 --- a/documents/Quickstart/Quickstart.md +++ b/documents/Quickstart/Quickstart.md @@ -13,7 +13,6 @@ SPDX-License-Identifier: GPL-2.0-or-later - [**RAM**](#ram) - [**OS**](#os) - [**Have the latest WIP version**](#how-to-run-the-latest-work-in-progress-builds-of-shadps4) -- [**Install PKG files (Games and Updates)**](#install-pkg-files) - [**Configure the emulator**](#configure-the-emulator) ## Minimum PC requirements @@ -48,13 +47,7 @@ SPDX-License-Identifier: GPL-2.0-or-later 2. Once downloaded, extract to its own folder, and run shadPS4's executable from the extracted folder. -3. Upon first launch, shadPS4 will prompt you to select a folder to store your installed games in. Select "Browse" and then select a folder that shadPS4 can use to install your PKG files to. - -## Install PKG files - -To install PKG files (game and updates), you will need the Qt application (with UI). You will have to go to "File" then to "Install Packages (PKG)", a window will open then you will have to select the files. You can install multiple PKG files at once. Once finished, the game should appear in the application. - - +3. Upon first launch, shadPS4 will prompt you to select a folder to store your installed games in. Select "Browse" and then select a folder that contains your dumped games. ## Configure the emulator diff --git a/documents/building-linux.md b/documents/building-linux.md index 18ddab0c6..cdc8ba12f 100644 --- a/documents/building-linux.md +++ b/documents/building-linux.md @@ -108,7 +108,7 @@ Now run the emulator. If Qt was enabled at configure time: ./build/shadps4 ``` -Otherwise, specify the path to your PKG's boot file: +Otherwise, specify the path to your game's boot file: ```bash ./build/shadps4 /"PATH"/"TO"/"GAME"/"FOLDER"/eboot.bin diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index bb434677d..d6bdda023 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -26,24 +26,7 @@ if (NOT TARGET fmt::fmt) add_subdirectory(fmt) endif() -if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND MSVC) - # If it is clang and MSVC we will add a static lib - # CryptoPP - add_subdirectory(cryptoppwin) - target_include_directories(cryptoppwin INTERFACE cryptoppwin/include) -else() - # CryptoPP - if (NOT TARGET cryptopp::cryptopp) - set(CRYPTOPP_INSTALL OFF) - set(CRYPTOPP_BUILD_TESTING OFF) - set(CRYPTOPP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp) - add_subdirectory(cryptopp-cmake) - file(COPY cryptopp DESTINATION cryptopp FILES_MATCHING PATTERN "*.h") - # remove externals/cryptopp from include directories because it contains a conflicting zlib.h file - set_target_properties(cryptopp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/cryptopp") - endif() -endif() - +# FFmpeg if (NOT TARGET FFmpeg::ffmpeg) add_subdirectory(ffmpeg-core) add_library(FFmpeg::ffmpeg ALIAS ffmpeg) diff --git a/externals/cryptopp b/externals/cryptopp deleted file mode 160000 index 60f81a77e..000000000 --- a/externals/cryptopp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 60f81a77e0c9a0e7ffc1ca1bc438ddfa2e43b78e diff --git a/externals/cryptopp-cmake b/externals/cryptopp-cmake deleted file mode 160000 index 2c384c282..000000000 --- a/externals/cryptopp-cmake +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2c384c28265a93358a2455e610e76393358794df diff --git a/externals/cryptoppwin b/externals/cryptoppwin deleted file mode 160000 index bc3441dd2..000000000 --- a/externals/cryptoppwin +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bc3441dd2d6a9728e747dc0180bc8b9065a2923c diff --git a/src/common/aes.h b/src/common/aes.h new file mode 100644 index 000000000..5ca0096bd --- /dev/null +++ b/src/common/aes.h @@ -0,0 +1,1195 @@ +// SPDX-FileCopyrightText: 2015 kkAyataka +// SPDX-License-Identifier: BSL-1.0 + +#pragma once + +#include +#include +#include +#include +#include +#include + +/** AES cipher APIs */ +namespace aes { +namespace detail { + +const int kWordSize = 4; +typedef unsigned int Word; + +const int kBlockSize = 4; +/** @private */ +struct State { + Word w[4]; + Word& operator[](const int index) { + return w[index]; + } + const Word& operator[](const int index) const { + return w[index]; + } +}; + +const int kStateSize = 16; // Word * BlockSize +typedef State RoundKey; +typedef std::vector RoundKeys; + +inline void add_round_key(const RoundKey& key, State& state) { + for (int i = 0; i < kBlockSize; ++i) { + state[i] ^= key[i]; + } +} + +const unsigned char kSbox[] = { + 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, + 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, + 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, + 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, + 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, + 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, + 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, + 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, + 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, + 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, + 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16}; + +const unsigned char kInvSbox[] = { + 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, + 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, + 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, + 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, + 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, + 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, + 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, + 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, + 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, + 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, + 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, + 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, + 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, + 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, + 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, + 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d}; + +inline Word sub_word(const Word w) { + return kSbox[(w >> 0) & 0xFF] << 0 | kSbox[(w >> 8) & 0xFF] << 8 | + kSbox[(w >> 16) & 0xFF] << 16 | kSbox[(w >> 24) & 0xFF] << 24; +} + +inline Word inv_sub_word(const Word w) { + return kInvSbox[(w >> 0) & 0xFF] << 0 | kInvSbox[(w >> 8) & 0xFF] << 8 | + kInvSbox[(w >> 16) & 0xFF] << 16 | kInvSbox[(w >> 24) & 0xFF] << 24; +} + +inline void sub_bytes(State& state) { + for (int i = 0; i < kBlockSize; ++i) { + state[i] = sub_word(state[i]); + } +} + +inline void inv_sub_bytes(State& state) { + for (int i = 0; i < kBlockSize; ++i) { + state[i] = inv_sub_word(state[i]); + } +} + +inline void shift_rows(State& state) { + const State ori = {state[0], state[1], state[2], state[3]}; + for (int r = 1; r < kWordSize; ++r) { + const Word m2 = 0xFF << (r * 8); + const Word m1 = ~m2; + for (int c = 0; c < kBlockSize; ++c) { + state[c] = (state[c] & m1) | (ori[(c + r) % kBlockSize] & m2); + } + } +} + +inline void inv_shift_rows(State& state) { + const State ori = {state[0], state[1], state[2], state[3]}; + for (int r = 1; r < kWordSize; ++r) { + const Word m2 = 0xFF << (r * 8); + const Word m1 = ~m2; + for (int c = 0; c < kBlockSize; ++c) { + state[c] = (state[c] & m1) | (ori[(c + kBlockSize - r) % kWordSize] & m2); + } + } +} + +inline unsigned char mul2(const unsigned char b) { + unsigned char m2 = b << 1; + if (b & 0x80) { + m2 ^= 0x011B; + } + + return m2; +} + +inline unsigned char mul(const unsigned char b, const unsigned char m) { + unsigned char v = 0; + unsigned char t = b; + for (int i = 0; i < 8; ++i) { // 8-bits + if ((m >> i) & 0x01) { + v ^= t; + } + + t = mul2(t); + } + + return v; +} + +inline void mix_columns(State& state) { + for (int i = 0; i < kBlockSize; ++i) { + const unsigned char v0_1 = (state[i] >> 0) & 0xFF; + const unsigned char v1_1 = (state[i] >> 8) & 0xFF; + const unsigned char v2_1 = (state[i] >> 16) & 0xFF; + const unsigned char v3_1 = (state[i] >> 24) & 0xFF; + + const unsigned char v0_2 = mul2(v0_1); + const unsigned char v1_2 = mul2(v1_1); + const unsigned char v2_2 = mul2(v2_1); + const unsigned char v3_2 = mul2(v3_1); + + const unsigned char v0_3 = v0_2 ^ v0_1; + const unsigned char v1_3 = v1_2 ^ v1_1; + const unsigned char v2_3 = v2_2 ^ v2_1; + const unsigned char v3_3 = v3_2 ^ v3_1; + + state[i] = (v0_2 ^ v1_3 ^ v2_1 ^ v3_1) << 0 | (v0_1 ^ v1_2 ^ v2_3 ^ v3_1) << 8 | + (v0_1 ^ v1_1 ^ v2_2 ^ v3_3) << 16 | (v0_3 ^ v1_1 ^ v2_1 ^ v3_2) << 24; + } +} + +inline void inv_mix_columns(State& state) { + for (int i = 0; i < kBlockSize; ++i) { + const unsigned char v0 = (state[i] >> 0) & 0xFF; + const unsigned char v1 = (state[i] >> 8) & 0xFF; + const unsigned char v2 = (state[i] >> 16) & 0xFF; + const unsigned char v3 = (state[i] >> 24) & 0xFF; + + state[i] = (mul(v0, 0x0E) ^ mul(v1, 0x0B) ^ mul(v2, 0x0D) ^ mul(v3, 0x09)) << 0 | + (mul(v0, 0x09) ^ mul(v1, 0x0E) ^ mul(v2, 0x0B) ^ mul(v3, 0x0D)) << 8 | + (mul(v0, 0x0D) ^ mul(v1, 0x09) ^ mul(v2, 0x0E) ^ mul(v3, 0x0B)) << 16 | + (mul(v0, 0x0B) ^ mul(v1, 0x0D) ^ mul(v2, 0x09) ^ mul(v3, 0x0E)) << 24; + } +} + +inline Word rot_word(const Word v) { + return ((v >> 8) & 0x00FFFFFF) | ((v & 0xFF) << 24); +} + +/** + * @private + * @throws std::invalid_argument + */ +inline unsigned int get_round_count(const int key_size) { + switch (key_size) { + case 16: + return 10; + case 24: + return 12; + case 32: + return 14; + default: + throw std::invalid_argument("Invalid key size"); + } +} + +/** + * @private + * @throws std::invalid_argument + */ +inline RoundKeys expand_key(const unsigned char* key, const int key_size) { + if (key_size != 16 && key_size != 24 && key_size != 32) { + throw std::invalid_argument("Invalid key size"); + } + + const Word rcon[] = {0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36}; + + const int nb = kBlockSize; + const int nk = key_size / nb; + const int nr = get_round_count(key_size); + + std::vector w(nb * (nr + 1)); + for (int i = 0; i < nk; ++i) { + memcpy(&w[i], key + (i * kWordSize), kWordSize); + } + + for (int i = nk; i < nb * (nr + 1); ++i) { + Word t = w[i - 1]; + if (i % nk == 0) { + t = sub_word(rot_word(t)) ^ rcon[i / nk]; + } else if (nk > 6 && i % nk == 4) { + t = sub_word(t); + } + + w[i] = t ^ w[i - nk]; + } + + RoundKeys keys(nr + 1); + memcpy(&keys[0], &w[0], w.size() * kWordSize); + + return keys; +} + +inline void copy_bytes_to_state(const unsigned char data[16], State& state) { + memcpy(&state[0], data + 0, kWordSize); + memcpy(&state[1], data + 4, kWordSize); + memcpy(&state[2], data + 8, kWordSize); + memcpy(&state[3], data + 12, kWordSize); +} + +inline void copy_state_to_bytes(const State& state, unsigned char buf[16]) { + memcpy(buf + 0, &state[0], kWordSize); + memcpy(buf + 4, &state[1], kWordSize); + memcpy(buf + 8, &state[2], kWordSize); + memcpy(buf + 12, &state[3], kWordSize); +} + +inline void xor_data(unsigned char data[kStateSize], const unsigned char v[kStateSize]) { + for (int i = 0; i < kStateSize; ++i) { + data[i] ^= v[i]; + } +} + +/** increment counter (128-bit int) by 1 */ +inline void incr_counter(unsigned char counter[kStateSize]) { + unsigned n = kStateSize, c = 1; + do { + --n; + c += counter[n]; + counter[n] = c; + c >>= 8; + } while (n); +} + +inline void encrypt_state(const RoundKeys& rkeys, const unsigned char data[16], + unsigned char encrypted[16]) { + State s; + copy_bytes_to_state(data, s); + + add_round_key(rkeys[0], s); + + for (unsigned int i = 1; i < rkeys.size() - 1; ++i) { + sub_bytes(s); + shift_rows(s); + mix_columns(s); + add_round_key(rkeys[i], s); + } + + sub_bytes(s); + shift_rows(s); + add_round_key(rkeys.back(), s); + + copy_state_to_bytes(s, encrypted); +} + +inline void decrypt_state(const RoundKeys& rkeys, const unsigned char data[16], + unsigned char decrypted[16]) { + State s; + copy_bytes_to_state(data, s); + + add_round_key(rkeys.back(), s); + inv_shift_rows(s); + inv_sub_bytes(s); + + for (std::size_t i = rkeys.size() - 2; i > 0; --i) { + add_round_key(rkeys[i], s); + inv_mix_columns(s); + inv_shift_rows(s); + inv_sub_bytes(s); + } + + add_round_key(rkeys[0], s); + + copy_state_to_bytes(s, decrypted); +} + +template +std::vector key_from_string(const char (*key_str)[KeyLen]) { + std::vector key(KeyLen - 1); + memcpy(&key[0], *key_str, KeyLen - 1); + return key; +} + +inline bool is_valid_key_size(const std::size_t key_size) { + if (key_size != 16 && key_size != 24 && key_size != 32) { + return false; + } else { + return true; + } +} + +namespace gcm { + +const int kBlockBitSize = 128; +const int kBlockByteSize = kBlockBitSize / 8; + +/** + * @private + * GCM operation unit as bit. + * This library handles 128 bit little endian bit array. + * e.g. 0^127 || 1 == "000...0001" (bit string) == 1 + */ +typedef std::bitset bitset128; + +/** + * @private + * GCM operation unit. + * Little endian byte array + * + * If bitset128 is 1: 0^127 || 1 == "000...0001" (bit string) == 1 + * byte array is 0x00, 0x00, 0x00 ... 0x01 (low -> high). + * Byte array is NOT 0x01, 0x00 ... 0x00. + * + * This library handles GCM bit string in two ways. + * One is an array of bitset, which is a little endian 128-bit array's array. + * + * <- first byte + * bitset128 || bitset128 || bitset128... + * + * The other one is a byte array. + * <- first byte + * byte || byte || byte... + */ +class Block { +public: + Block() { + init_v(0, 0); + } + + Block(const unsigned char* bytes, const unsigned long bytes_size) { + init_v(bytes, bytes_size); + } + + Block(const std::vector& bytes) { + init_v(&bytes[0], bytes.size()); + } + + Block(const std::bitset<128>& bits); // implementation below + + inline unsigned char* data() { + return v_; + } + + inline const unsigned char* data() const { + return v_; + } + + inline std::bitset<128> to_bits() const { + std::bitset<128> bits; + for (int i = 0; i < 16; ++i) { + bits <<= 8; + bits |= v_[i]; + } + + return bits; + } + + inline Block operator^(const Block& b) const { + Block r; + for (int i = 0; i < 16; ++i) { + r.data()[i] = data()[i] ^ b.data()[i]; + } + return r; + } + +private: + unsigned char v_[16]; + + inline void init_v(const unsigned char* bytes, const std::size_t bytes_size) { + memset(v_, 0, sizeof(v_)); + + const std::size_t cs = (std::min)(bytes_size, static_cast(16)); + for (std::size_t i = 0; i < cs; ++i) { + v_[i] = bytes[i]; + } + } +}; + +// Workaround for clang optimization in 32-bit build via Visual Studio producing incorrect results +// (https://github.com/kkAyataka/plusaes/issues/43) +#if defined(__clang__) && defined(_WIN32) && !defined(_WIN64) +#pragma optimize("", off) +#endif +inline Block::Block(const std::bitset<128>& bits) { + init_v(0, 0); + const std::bitset<128> mask(0xFF); // 1 byte mask + for (std::size_t i = 0; i < 16; ++i) { + v_[15 - i] = static_cast(((bits >> (i * 8)) & mask).to_ulong()); + } +} +#if defined(__clang__) && defined(_WIN32) && !defined(_WIN64) +#pragma optimize("", on) +#endif + +template +unsigned long ceil(const T v) { + return static_cast(std::ceil(v) + 0.5); +} + +template +std::bitset operator||(const std::bitset& v1, const std::bitset& v2) { + std::bitset ret(v1.to_string() + v2.to_string()); + return ret; +} + +template +std::bitset lsb(const std::bitset& X) { + std::bitset r; + for (std::size_t i = 0; i < S; ++i) { + r[i] = X[i]; + } + return r; +} + +template +std::bitset msb(const std::bitset& X) { + std::bitset r; + for (std::size_t i = 0; i < S; ++i) { + r[S - 1 - i] = X[X.size() - 1 - i]; + } + return r; +} + +template +std::bitset inc32(const std::bitset X) { + const std::size_t S = 32; + + const auto a = msb(X); + const std::bitset b( + (lsb(X).to_ulong() + 1)); // % (2^32); + // lsb<32> is low 32-bit value + // Spec.'s "mod 2^S" is not necessary when S is 32 (inc32). + // ...and 2^32 is over 32-bit integer. + + return a || b; +} + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wself-assign" +#endif // __clang__ + +/** Algorithm 1 @private */ +inline Block mul_blocks(const Block X, const Block Y) { + const bitset128 R = (std::bitset<8>("11100001") || std::bitset<120>()); + + bitset128 X_bits = X.to_bits(); + bitset128 Z; + bitset128 V = Y.to_bits(); + for (int i = 127; i >= 0; --i) { + // Z + if (X_bits[i] == false) { + Z = Z; + } else { + Z = Z ^ V; + } + + // V + if (V[0] == false) { + V = V >> 1; + } else { + V = (V >> 1) ^ R; + } + } + + return Z; +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif // __clang__ + +/** Algorithm 2 @private */ +inline Block ghash(const Block& H, const std::vector& X) { + const std::size_t m = X.size() / kBlockByteSize; + Block Ym; + for (std::size_t i = 0; i < m; ++i) { + const Block Xi(&X[i * kBlockByteSize], kBlockByteSize); + Ym = mul_blocks((Ym ^ Xi), H); + } + + return Ym; +} + +template +std::bitset make_bitset(const unsigned char* bytes, const std::size_t bytes_size) { + std::bitset bits; + for (auto i = 0u; i < bytes_size; ++i) { + bits <<= 8; + bits |= bytes[i]; + } + return bits; +} + +/** Algorithm 3 @private */ +inline std::vector gctr(const detail::RoundKeys& rkeys, const Block& ICB, + const unsigned char* X, const std::size_t X_size) { + if (!X || X_size == 0) { + return std::vector(); + } else { + const unsigned long n = ceil(X_size * 8.0 / kBlockBitSize); + std::vector Y(X_size); + + Block CB; + for (std::size_t i = 0; i < n; ++i) { + // CB + if (i == 0) { // first + CB = ICB; + } else { + CB = inc32(CB.to_bits()); + } + + // CIPH + Block eCB; + encrypt_state(rkeys, CB.data(), eCB.data()); + + // Y + int op_size = 0; + if (i < n - 1) { + op_size = kBlockByteSize; + } else { // last + op_size = (X_size % kBlockByteSize) ? (X_size % kBlockByteSize) : kBlockByteSize; + } + const Block Yi = Block(X + i * kBlockBitSize / 8, op_size) ^ eCB; + memcpy(&Y[i * kBlockByteSize], Yi.data(), op_size); + } + + return Y; + } +} + +inline void push_back(std::vector& bytes, const unsigned char* data, + const std::size_t data_size) { + bytes.insert(bytes.end(), data, data + data_size); +} + +inline void push_back(std::vector& bytes, const std::bitset<64>& bits) { + const std::bitset<64> mask(0xFF); // 1 byte mask + for (std::size_t i = 0; i < 8; ++i) { + bytes.push_back(static_cast(((bits >> ((7 - i) * 8)) & mask).to_ulong())); + } +} + +inline void push_back_zero_bits(std::vector& bytes, + const std::size_t zero_bits_size) { + const std::vector zero_bytes(zero_bits_size / 8); + bytes.insert(bytes.end(), zero_bytes.begin(), zero_bytes.end()); +} + +inline Block calc_H(const RoundKeys& rkeys) { + std::vector H_raw(gcm::kBlockByteSize); + encrypt_state(rkeys, &H_raw[0], &H_raw[0]); + return gcm::Block(H_raw); +} + +inline Block calc_J0(const Block& H, const unsigned char* iv, const std::size_t iv_size) { + if (iv_size == 12) { + const std::bitset<96> iv_bits = gcm::make_bitset<96>(iv, iv_size); + return iv_bits || std::bitset<31>() || std::bitset<1>(1); + } else { + const auto len_iv = iv_size * 8; + const auto s = 128 * gcm::ceil(len_iv / 128.0) - len_iv; + std::vector ghash_in; + gcm::push_back(ghash_in, iv, iv_size); + gcm::push_back_zero_bits(ghash_in, s + 64); + gcm::push_back(ghash_in, std::bitset<64>(len_iv)); + + return gcm::ghash(H, ghash_in); + } +} + +inline void calc_gcm_tag(const unsigned char* data, const std::size_t data_size, + const unsigned char* aadata, const std::size_t aadata_size, + const unsigned char* key, const std::size_t key_size, + const unsigned char* iv, const std::size_t iv_size, unsigned char* tag, + const std::size_t tag_size) { + const detail::RoundKeys rkeys = detail::expand_key(key, static_cast(key_size)); + const gcm::Block H = gcm::calc_H(rkeys); + const gcm::Block J0 = gcm::calc_J0(H, iv, iv_size); + + const auto lenC = data_size * 8; + const auto lenA = aadata_size * 8; + const std::size_t u = 128 * gcm::ceil(lenC / 128.0) - lenC; + const std::size_t v = 128 * gcm::ceil(lenA / 128.0) - lenA; + + std::vector ghash_in; + ghash_in.reserve((aadata_size + v / 8) + (data_size + u / 8) + 8 + 8); + gcm::push_back(ghash_in, aadata, aadata_size); + gcm::push_back_zero_bits(ghash_in, v); + gcm::push_back(ghash_in, data, data_size); + gcm::push_back_zero_bits(ghash_in, u); + gcm::push_back(ghash_in, std::bitset<64>(lenA)); + gcm::push_back(ghash_in, std::bitset<64>(lenC)); + const gcm::Block S = gcm::ghash(H, ghash_in); + const std::vector T = gcm::gctr(rkeys, J0, S.data(), gcm::kBlockByteSize); + + // return + memcpy(tag, &T[0], (std::min)(tag_size, static_cast(16))); +} + +/** Algorithm 4 and 5 @private */ +inline void crypt_gcm(const unsigned char* data, const std::size_t data_size, + const unsigned char* key, const std::size_t key_size, const unsigned char* iv, + const std::size_t iv_size, unsigned char* crypted) { + const detail::RoundKeys rkeys = detail::expand_key(key, static_cast(key_size)); + const gcm::Block H = gcm::calc_H(rkeys); + const gcm::Block J0 = gcm::calc_J0(H, iv, iv_size); + + const std::vector C = + gcm::gctr(rkeys, gcm::inc32(J0.to_bits()), data, data_size); + + if (crypted) { + memcpy(crypted, &C[0], data_size); + } +} + +} // namespace gcm + +} // namespace detail + +/** @defgroup Base Base + * Base definitions and convenient functions + * @{ */ + +/** Create 128-bit key from string. */ +inline std::vector key_from_string(const char (*key_str)[17]) { + return detail::key_from_string<17>(key_str); +} + +/** Create 192-bit key from string. */ +inline std::vector key_from_string(const char (*key_str)[25]) { + return detail::key_from_string<25>(key_str); +} + +/** Create 256-bit key from string. */ +inline std::vector key_from_string(const char (*key_str)[33]) { + return detail::key_from_string<33>(key_str); +} + +/** Calculates encrypted data size when padding is enabled. */ +inline unsigned long get_padded_encrypted_size(const unsigned long data_size) { + return data_size + detail::kStateSize - (data_size % detail::kStateSize); +} + +/** Error code */ +typedef enum { + kErrorOk = 0, + kErrorInvalidDataSize = 1, + kErrorInvalidKeySize, + kErrorInvalidBufferSize, + kErrorInvalidKey, + kErrorDeprecated, // kErrorInvalidNonceSize + kErrorInvalidIvSize, + kErrorInvalidTagSize, + kErrorInvalidTag +} Error; + +/** @} */ + +namespace detail { + +inline Error check_encrypt_cond(const unsigned long data_size, const unsigned long key_size, + const unsigned long encrypted_size, const bool pads) { + // check data size + if (!pads && (data_size % kStateSize != 0)) { + return kErrorInvalidDataSize; + } + + // check key size + if (!detail::is_valid_key_size(key_size)) { + return kErrorInvalidKeySize; + } + + // check encrypted buffer size + if (pads) { + const unsigned long required_size = get_padded_encrypted_size(data_size); + if (encrypted_size < required_size) { + return kErrorInvalidBufferSize; + } + } else { + if (encrypted_size < data_size) { + return kErrorInvalidBufferSize; + } + } + return kErrorOk; +} + +inline Error check_decrypt_cond(const unsigned long data_size, const unsigned long key_size, + const unsigned long decrypted_size, + const unsigned long* padded_size) { + // check data size + if (data_size % 16 != 0) { + return kErrorInvalidDataSize; + } + + // check key size + if (!detail::is_valid_key_size(key_size)) { + return kErrorInvalidKeySize; + } + + // check decrypted buffer size + if (!padded_size) { + if (decrypted_size < data_size) { + return kErrorInvalidBufferSize; + } + } else { + if (decrypted_size < (data_size - kStateSize)) { + return kErrorInvalidBufferSize; + } + } + + return kErrorOk; +} + +inline bool check_padding(const unsigned long padding, const unsigned char data[kStateSize]) { + if (padding > kStateSize) { + return false; + } + + for (unsigned long i = 0; i < padding; ++i) { + if (data[kStateSize - 1 - i] != padding) { + return false; + } + } + + return true; +} + +inline Error check_gcm_cond(const std::size_t key_size, const std::size_t iv_size, + const std::size_t tag_size) { + // check key size + if (!detail::is_valid_key_size(key_size)) { + return kErrorInvalidKeySize; + } + + if (iv_size < 1) { + return kErrorInvalidIvSize; + } + + // check tag size + if ((tag_size < 12 || 16 < tag_size) && (tag_size != 8) && (tag_size != 4)) { + return kErrorInvalidTagSize; + } + + return kErrorOk; +} + +} // namespace detail + +/** @defgroup ECB ECB + * ECB mode functions + * @{ */ + +/** + * Encrypts data with ECB mode. + * @param [in] data Data. + * @param [in] data_size Data size. + * If the pads is false, data size must be multiple of 16. + * @param [in] key key bytes. The key length must be 16 (128-bit), 24 (192-bit) or 32 (256-bit). + * @param [in] key_size key size. + * @param [out] encrypted Encrypted data buffer. + * @param [in] encrypted_size Encrypted data buffer size. + * @param [in] pads If this value is true, encrypted data is padded by PKCS. + * Encrypted data size must be multiple of 16. + * If the pads is true, encrypted data is padded with PKCS. + * So the data is multiple of 16, encrypted data size needs additonal 16 bytes. + * @since 1.0.0 + */ +inline Error encrypt_ecb(const unsigned char* data, const unsigned long data_size, + const unsigned char* key, const unsigned long key_size, + unsigned char* encrypted, const unsigned long encrypted_size, + const bool pads) { + const Error e = detail::check_encrypt_cond(data_size, key_size, encrypted_size, pads); + if (e != kErrorOk) { + return e; + } + + const detail::RoundKeys rkeys = detail::expand_key(key, static_cast(key_size)); + + const unsigned long bc = data_size / detail::kStateSize; + for (unsigned long i = 0; i < bc; ++i) { + detail::encrypt_state(rkeys, data + (i * detail::kStateSize), + encrypted + (i * detail::kStateSize)); + } + + if (pads) { + const int rem = data_size % detail::kStateSize; + const char pad_v = detail::kStateSize - rem; + + std::vector ib(detail::kStateSize, pad_v), ob(detail::kStateSize); + memcpy(&ib[0], data + data_size - rem, rem); + + detail::encrypt_state(rkeys, &ib[0], &ob[0]); + memcpy(encrypted + (data_size - rem), &ob[0], detail::kStateSize); + } + + return kErrorOk; +} + +/** + * Decrypts data with ECB mode. + * @param [in] data Data bytes. + * @param [in] data_size Data size. + * @param [in] key Key bytes. + * @param [in] key_size Key size. + * @param [out] decrypted Decrypted data buffer. + * @param [in] decrypted_size Decrypted data buffer size. + * @param [out] padded_size If this value is NULL, this function does not remove padding. + * If this value is not NULL, this function removes padding by PKCS + * and returns padded size using padded_size. + * @since 1.0.0 + */ +inline Error decrypt_ecb(const unsigned char* data, const unsigned long data_size, + const unsigned char* key, const unsigned long key_size, + unsigned char* decrypted, const unsigned long decrypted_size, + unsigned long* padded_size) { + const Error e = detail::check_decrypt_cond(data_size, key_size, decrypted_size, padded_size); + if (e != kErrorOk) { + return e; + } + + const detail::RoundKeys rkeys = detail::expand_key(key, static_cast(key_size)); + + const unsigned long bc = data_size / detail::kStateSize - 1; + for (unsigned long i = 0; i < bc; ++i) { + detail::decrypt_state(rkeys, data + (i * detail::kStateSize), + decrypted + (i * detail::kStateSize)); + } + + unsigned char last[detail::kStateSize] = {}; + detail::decrypt_state(rkeys, data + (bc * detail::kStateSize), last); + + if (padded_size) { + *padded_size = last[detail::kStateSize - 1]; + const unsigned long cs = detail::kStateSize - *padded_size; + + if (!detail::check_padding(*padded_size, last)) { + return kErrorInvalidKey; + } else if (decrypted_size >= (bc * detail::kStateSize) + cs) { + memcpy(decrypted + (bc * detail::kStateSize), last, cs); + } else { + return kErrorInvalidBufferSize; + } + } else { + memcpy(decrypted + (bc * detail::kStateSize), last, sizeof(last)); + } + + return kErrorOk; +} + +/** @} */ + +/** @defgroup CBC CBC + * CBC mode functions + * @{ */ + +/** + * Encrypt data with CBC mode. + * @param [in] data Data. + * @param [in] data_size Data size. + * If the pads is false, data size must be multiple of 16. + * @param [in] key key bytes. The key length must be 16 (128-bit), 24 (192-bit) or 32 (256-bit). + * @param [in] key_size key size. + * @param [in] iv Initialize vector. + * @param [out] encrypted Encrypted data buffer. + * @param [in] encrypted_size Encrypted data buffer size. + * @param [in] pads If this value is true, encrypted data is padded by PKCS. + * Encrypted data size must be multiple of 16. + * If the pads is true, encrypted data is padded with PKCS. + * So the data is multiple of 16, encrypted data size needs additonal 16 bytes. + * @since 1.0.0 + */ +inline Error encrypt_cbc(const unsigned char* data, const unsigned long data_size, + const unsigned char* key, const unsigned long key_size, + const unsigned char iv[16], unsigned char* encrypted, + const unsigned long encrypted_size, const bool pads) { + const Error e = detail::check_encrypt_cond(data_size, key_size, encrypted_size, pads); + if (e != kErrorOk) { + return e; + } + + const detail::RoundKeys rkeys = detail::expand_key(key, static_cast(key_size)); + + unsigned char s[detail::kStateSize] = {}; // encrypting data + + // calculate padding value + const bool ge16 = (data_size >= detail::kStateSize); + const int rem = data_size % detail::kStateSize; + const unsigned char pad_v = detail::kStateSize - rem; + + // encrypt 1st state + if (ge16) { + memcpy(s, data, detail::kStateSize); + } else { + memset(s, pad_v, detail::kStateSize); + memcpy(s, data, data_size); + } + if (iv) { + detail::xor_data(s, iv); + } + detail::encrypt_state(rkeys, s, encrypted); + + // encrypt mid + const unsigned long bc = data_size / detail::kStateSize; + for (unsigned long i = 1; i < bc; ++i) { + const long offset = i * detail::kStateSize; + memcpy(s, data + offset, detail::kStateSize); + detail::xor_data(s, encrypted + offset - detail::kStateSize); + + detail::encrypt_state(rkeys, s, encrypted + offset); + } + + // enctypt last + if (pads && ge16) { + std::vector ib(detail::kStateSize, pad_v), ob(detail::kStateSize); + memcpy(&ib[0], data + data_size - rem, rem); + + detail::xor_data(&ib[0], encrypted + (bc - 1) * detail::kStateSize); + + detail::encrypt_state(rkeys, &ib[0], &ob[0]); + memcpy(encrypted + (data_size - rem), &ob[0], detail::kStateSize); + } + + return kErrorOk; +} + +/** + * Decrypt data with CBC mode. + * @param [in] data Data bytes. + * @param [in] data_size Data size. + * @param [in] key Key bytes. + * @param [in] key_size Key size. + * @param [in] iv Initialize vector. + * @param [out] decrypted Decrypted data buffer. + * @param [in] decrypted_size Decrypted data buffer size. + * @param [out] padded_size If this value is NULL, this function does not remove padding. + * If this value is not NULL, this function removes padding by PKCS + * and returns padded size using padded_size. + * @since 1.0.0 + */ +inline Error decrypt_cbc(const unsigned char* data, const unsigned long data_size, + const unsigned char* key, const unsigned long key_size, + const unsigned char iv[16], unsigned char* decrypted, + const unsigned long decrypted_size, unsigned long* padded_size) { + const Error e = detail::check_decrypt_cond(data_size, key_size, decrypted_size, padded_size); + if (e != kErrorOk) { + return e; + } + + const detail::RoundKeys rkeys = detail::expand_key(key, static_cast(key_size)); + + // decrypt 1st state + detail::decrypt_state(rkeys, data, decrypted); + if (iv) { + detail::xor_data(decrypted, iv); + } + + // decrypt mid + const unsigned long bc = data_size / detail::kStateSize - 1; + for (unsigned long i = 1; i < bc; ++i) { + const long offset = i * detail::kStateSize; + detail::decrypt_state(rkeys, data + offset, decrypted + offset); + detail::xor_data(decrypted + offset, data + offset - detail::kStateSize); + } + + // decrypt last + unsigned char last[detail::kStateSize] = {}; + if (data_size > detail::kStateSize) { + detail::decrypt_state(rkeys, data + (bc * detail::kStateSize), last); + detail::xor_data(last, data + (bc * detail::kStateSize - detail::kStateSize)); + } else { + memcpy(last, decrypted, data_size); + memset(decrypted, 0, decrypted_size); + } + + if (padded_size) { + *padded_size = last[detail::kStateSize - 1]; + const unsigned long cs = detail::kStateSize - *padded_size; + + if (!detail::check_padding(*padded_size, last)) { + return kErrorInvalidKey; + } else if (decrypted_size >= (bc * detail::kStateSize) + cs) { + memcpy(decrypted + (bc * detail::kStateSize), last, cs); + } else { + return kErrorInvalidBufferSize; + } + } else { + memcpy(decrypted + (bc * detail::kStateSize), last, sizeof(last)); + } + + return kErrorOk; +} + +/** @} */ + +/** @defgroup GCM GCM + * GCM mode functions + * @{ */ + +/** + * Encrypts data with GCM mode and gets an authentication tag. + * + * You can specify iv size and tag size. + * But usually you should use the other overloaded function whose iv and tag size is fixed. + * + * @returns kErrorOk + * @returns kErrorInvalidKeySize + * @returns kErrorInvalidIvSize + * @returns kErrorInvalidTagSize + */ +inline Error encrypt_gcm(unsigned char* data, const std::size_t data_size, + const unsigned char* aadata, const std::size_t aadata_size, + const unsigned char* key, const std::size_t key_size, + const unsigned char* iv, const std::size_t iv_size, unsigned char* tag, + const std::size_t tag_size) { + const Error err = detail::check_gcm_cond(key_size, iv_size, tag_size); + if (err != kErrorOk) { + return err; + } + + detail::gcm::crypt_gcm(data, data_size, key, key_size, iv, iv_size, data); + detail::gcm::calc_gcm_tag(data, data_size, aadata, aadata_size, key, key_size, iv, iv_size, tag, + tag_size); + + return kErrorOk; +} + +/** + * Encrypts data with GCM mode and gets an authentication tag. + * + * @param [in,out] data Input data and output buffer. + * This buffer is replaced with encrypted data. + * @param [in] data_size data size + * @param [in] aadata Additional Authenticated data + * @param [in] aadata_size aadata size + * @param [in] key Cipher key + * @param [in] key_size Cipher key size. This value must be 16 (128-bit), 24 (192-bit), or 32 + * (256-bit). + * @param [in] iv Initialization vector + * @param [out] tag Calculated authentication tag data + * + * @returns kErrorOk + * @returns kErrorInvalidKeySize + */ +inline Error encrypt_gcm(unsigned char* data, const std::size_t data_size, + const unsigned char* aadata, const std::size_t aadata_size, + const unsigned char* key, const std::size_t key_size, + const unsigned char (*iv)[12], unsigned char (*tag)[16]) { + return encrypt_gcm(data, data_size, aadata, aadata_size, key, key_size, *iv, 12, *tag, 16); +} + +/** + * Decrypts data with GCM mode and checks an authentication tag. + * + * You can specify iv size and tag size. + * But usually you should use the other overloaded function whose iv and tag size is fixed. + * + * @returns kErrorOk + * @returns kErrorInvalidKeySize + * @returns kErrorInvalidIvSize + * @returns kErrorInvalidTagSize + * @returns kErrorInvalidTag + */ +inline Error decrypt_gcm(unsigned char* data, const std::size_t data_size, + const unsigned char* aadata, const std::size_t aadata_size, + const unsigned char* key, const std::size_t key_size, + const unsigned char* iv, const std::size_t iv_size, + const unsigned char* tag, const std::size_t tag_size) { + const Error err = detail::check_gcm_cond(key_size, iv_size, tag_size); + if (err != kErrorOk) { + return err; + } + + unsigned char* C = data; + const auto C_size = data_size; + unsigned char tagd[16] = {}; + detail::gcm::calc_gcm_tag(C, C_size, aadata, aadata_size, key, key_size, iv, iv_size, tagd, 16); + + if (memcmp(tag, tagd, tag_size) != 0) { + return kErrorInvalidTag; + } else { + detail::gcm::crypt_gcm(C, C_size, key, key_size, iv, iv_size, C); + + return kErrorOk; + } +} + +/** + * Decrypts data with GCM mode and checks an authentication tag. + * + * @param [in,out] data Input data and output buffer. + * This buffer is replaced with decrypted data. + * @param [in] data_size data size + * @param [in] aadata Additional Authenticated data + * @param [in] aadata_size aadata size + * @param [in] key Cipher key + * @param [in] key_size Cipher key size. This value must be 16 (128-bit), 24 (192-bit), or 32 + * (256-bit). + * @param [in] iv Initialization vector + * @param [in] tag Authentication tag data + * + * @returns kErrorOk + * @returns kErrorInvalidKeySize + * @returns kErrorInvalidTag + */ +inline Error decrypt_gcm(unsigned char* data, const std::size_t data_size, + const unsigned char* aadata, const std::size_t aadata_size, + const unsigned char* key, const std::size_t key_size, + const unsigned char (*iv)[12], const unsigned char (*tag)[16]) { + return decrypt_gcm(data, data_size, aadata, aadata_size, key, key_size, *iv, 12, *tag, 16); +} + +/** @} */ + +/** @defgroup CTR CTR + * CTR mode function + * @{ */ + +/** + * Encrypts or decrypt data in-place with CTR mode. + * + * @param [in,out] data Input data and output buffer. + * This buffer is replaced with encrypted / decrypted data. + * @param [in] data_size Data size. + * @param [in] key Cipher key + * @param [in] key_size Cipher key size. This value must be 16 (128-bit), 24 (192-bit), or 32 + * (256-bit). + * @param [in] nonce Nonce of the counter initialization. + * + * @returns kErrorOk + * @returns kErrorInvalidKeySize + * @since 1.0.0 + */ +inline Error crypt_ctr(unsigned char* data, const std::size_t data_size, const unsigned char* key, + const std::size_t key_size, const unsigned char (*nonce)[16]) { + if (!detail::is_valid_key_size(key_size)) + return kErrorInvalidKeySize; + const detail::RoundKeys rkeys = detail::expand_key(key, static_cast(key_size)); + + unsigned long pos = 0; + unsigned long blkpos = detail::kStateSize; + unsigned char blk[detail::kStateSize] = {}; + unsigned char counter[detail::kStateSize] = {}; + memcpy(counter, nonce, 16); + + while (pos < data_size) { + if (blkpos == detail::kStateSize) { + detail::encrypt_state(rkeys, counter, blk); + detail::incr_counter(counter); + blkpos = 0; + } + data[pos++] ^= blk[blkpos++]; + } + + return kErrorOk; +} + +/** @} */ + +} // namespace aes diff --git a/src/common/config.cpp b/src/common/config.cpp index 514024c30..2657cd12a 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -32,6 +32,7 @@ std::filesystem::path find_fs_path_or(const basic_value& v, const K& ky, namespace Config { static bool isNeo = false; +static bool isDevKit = false; static bool playBGM = false; static bool isTrophyPopupDisabled = false; static int BGMvolume = 50; @@ -40,7 +41,7 @@ static u32 screenWidth = 1280; static u32 screenHeight = 720; static s32 gpuId = -1; // Vulkan physical device index. Set to negative for auto select static std::string logFilter; -static std::string logType = "async"; +static std::string logType = "sync"; static std::string userName = "shadPS4"; static std::string updateChannel; static std::string chooseHomeTab; @@ -74,14 +75,14 @@ static double trophyNotificationDuration = 6.0; static bool useUnifiedInputConfig = true; static bool overrideControllerColor = false; static int controllerCustomColorRGB[3] = {0, 0, 255}; -static bool separateupdatefolder = false; static bool compatibilityData = false; static bool checkCompatibilityOnStartup = false; static std::string trophyKey; // Gui static bool load_game_size = true; -std::vector settings_install_dirs = {}; +static std::vector settings_install_dirs = {}; +std::vector install_dirs_enabled = {}; std::filesystem::path settings_addon_install_dir = {}; std::filesystem::path save_data_path = {}; u32 main_window_geometry_x = 400; @@ -96,7 +97,6 @@ u32 m_slider_pos_grid = 0; u32 m_table_mode = 0; u32 m_window_size_W = 1280; u32 m_window_size_H = 720; -std::vector m_pkg_viewer; std::vector m_elf_viewer; std::vector m_recent_files; std::string emulator_language = "en_US"; @@ -105,6 +105,7 @@ static bool showBackgroundImage = true; static bool isFullscreen = false; static std::string fullscreenMode = "Windowed"; static bool isHDRAllowed = false; +static bool showLabelsUnderIcons = true; // Language u32 m_language = 1; // english @@ -166,10 +167,22 @@ bool isNeoModeConsole() { return isNeo; } +bool isDevKitConsole() { + return isDevKit; +} + bool getIsFullscreen() { return isFullscreen; } +bool getShowLabelsUnderIcons() { + return showLabelsUnderIcons; +} + +bool setShowLabelsUnderIcons() { + return false; +} + std::string getFullscreenMode() { return fullscreenMode; } @@ -338,10 +351,6 @@ void setVkGuestMarkersEnabled(bool enable) { vkGuestMarkers = enable; } -bool getSeparateUpdateEnabled() { - return separateupdatefolder; -} - bool getCompatibilityEnabled() { return compatibilityData; } @@ -421,6 +430,9 @@ void setVblankDiv(u32 value) { void setIsFullscreen(bool enable) { isFullscreen = enable; } +static void setShowLabelsUnderIcons(bool enable) { + showLabelsUnderIcons = enable; +} void setFullscreenMode(std::string mode) { fullscreenMode = mode; @@ -500,10 +512,6 @@ void setIsMotionControlsEnabled(bool use) { isMotionControlsEnabled = use; } -void setSeparateUpdateEnabled(bool use) { - separateupdatefolder = use; -} - void setCompatibilityEnabled(bool use) { compatibilityData = use; } @@ -519,22 +527,34 @@ void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h) { main_window_geometry_h = h; } -bool addGameInstallDir(const std::filesystem::path& dir) { - if (std::find(settings_install_dirs.begin(), settings_install_dirs.end(), dir) == - settings_install_dirs.end()) { - settings_install_dirs.push_back(dir); - return true; +bool addGameInstallDir(const std::filesystem::path& dir, bool enabled) { + for (const auto& install_dir : settings_install_dirs) { + if (install_dir.path == dir) { + return false; + } } - return false; + settings_install_dirs.push_back({dir, enabled}); + return true; } void removeGameInstallDir(const std::filesystem::path& dir) { - auto iterator = std::find(settings_install_dirs.begin(), settings_install_dirs.end(), dir); + auto iterator = + std::find_if(settings_install_dirs.begin(), settings_install_dirs.end(), + [&dir](const GameInstallDir& install_dir) { return install_dir.path == dir; }); if (iterator != settings_install_dirs.end()) { settings_install_dirs.erase(iterator); } } +void setGameInstallDirEnabled(const std::filesystem::path& dir, bool enabled) { + auto iterator = + std::find_if(settings_install_dirs.begin(), settings_install_dirs.end(), + [&dir](const GameInstallDir& install_dir) { return install_dir.path == dir; }); + if (iterator != settings_install_dirs.end()) { + iterator->enabled = enabled; + } +} + void setAddonInstallDir(const std::filesystem::path& dir) { settings_addon_install_dir = dir; } @@ -571,11 +591,6 @@ void setMainWindowHeight(u32 height) { m_window_size_H = height; } -void setPkgViewer(const std::vector& pkgList) { - m_pkg_viewer.resize(pkgList.size()); - m_pkg_viewer = pkgList; -} - void setElfViewer(const std::vector& elfList) { m_elf_viewer.resize(elfList.size()); m_elf_viewer = elfList; @@ -590,8 +605,15 @@ void setEmulatorLanguage(std::string language) { emulator_language = language; } -void setGameInstallDirs(const std::vector& settings_install_dirs_config) { - settings_install_dirs = settings_install_dirs_config; +void setGameInstallDirs(const std::vector& dirs_config) { + settings_install_dirs.clear(); + for (const auto& dir : dirs_config) { + settings_install_dirs.push_back({dir, true}); + } +} + +void setAllGameInstallDirs(const std::vector& dirs_config) { + settings_install_dirs = dirs_config; } void setSaveDataPath(const std::filesystem::path& path) { @@ -614,8 +636,22 @@ u32 getMainWindowGeometryH() { return main_window_geometry_h; } -const std::vector& getGameInstallDirs() { - return settings_install_dirs; +const std::vector getGameInstallDirs() { + std::vector enabled_dirs; + for (const auto& dir : settings_install_dirs) { + if (dir.enabled) { + enabled_dirs.push_back(dir.path); + } + } + return enabled_dirs; +} + +const std::vector getGameInstallDirsEnabled() { + std::vector enabled_dirs; + for (const auto& dir : settings_install_dirs) { + enabled_dirs.push_back(dir.enabled); + } + return enabled_dirs; } std::filesystem::path getAddonInstallDir() { @@ -658,10 +694,6 @@ u32 getMainWindowHeight() { return m_window_size_H; } -std::vector getPkgViewer() { - return m_pkg_viewer; -} - std::vector getElfViewer() { return m_elf_viewer; } @@ -721,6 +753,7 @@ void load(const std::filesystem::path& path) { const toml::value& general = data.at("General"); isNeo = toml::find_or(general, "isPS4Pro", false); + isDevKit = toml::find_or(general, "isDevKit", false); playBGM = toml::find_or(general, "playBGM", false); isTrophyPopupDisabled = toml::find_or(general, "isTrophyPopupDisabled", false); trophyNotificationDuration = @@ -739,7 +772,6 @@ void load(const std::filesystem::path& path) { isAutoUpdate = toml::find_or(general, "autoUpdate", false); isAlwaysShowChangelog = toml::find_or(general, "alwaysShowChangelog", false); isSideTrophy = toml::find_or(general, "sideTrophy", "right"); - separateupdatefolder = toml::find_or(general, "separateUpdateEnabled", false); compatibilityData = toml::find_or(general, "compatibilityEnabled", false); checkCompatibilityOnStartup = toml::find_or(general, "checkCompatibilityOnStartup", false); @@ -808,9 +840,23 @@ void load(const std::filesystem::path& path) { m_window_size_H = toml::find_or(gui, "mw_height", 0); const auto install_dir_array = - toml::find_or>(gui, "installDirs", {}); - for (const auto& dir : install_dir_array) { - addGameInstallDir(std::filesystem::path{dir}); + toml::find_or>(gui, "installDirs", {}); + + try { + install_dirs_enabled = toml::find>(gui, "installDirsEnabled"); + } catch (...) { + // If it does not exist, assume that all are enabled. + install_dirs_enabled.resize(install_dir_array.size(), true); + } + + if (install_dirs_enabled.size() < install_dir_array.size()) { + install_dirs_enabled.resize(install_dir_array.size(), true); + } + + settings_install_dirs.clear(); + for (size_t i = 0; i < install_dir_array.size(); i++) { + settings_install_dirs.push_back( + {std::filesystem::path{install_dir_array[i]}, install_dirs_enabled[i]}); } save_data_path = toml::find_fs_path_or(gui, "saveDataPath", {}); @@ -820,7 +866,6 @@ void load(const std::filesystem::path& path) { main_window_geometry_y = toml::find_or(gui, "geometry_y", 0); main_window_geometry_w = toml::find_or(gui, "geometry_w", 0); main_window_geometry_h = toml::find_or(gui, "geometry_h", 0); - m_pkg_viewer = toml::find_or>(gui, "pkgDirs", {}); m_elf_viewer = toml::find_or>(gui, "elfDirs", {}); m_recent_files = toml::find_or>(gui, "recentFiles", {}); m_table_mode = toml::find_or(gui, "gameTableMode", 0); @@ -853,6 +898,37 @@ void load(const std::filesystem::path& path) { } } +void sortTomlSections(toml::ordered_value& data) { + toml::ordered_value ordered_data; + std::vector section_order = {"General", "Input", "GPU", "Vulkan", + "Debug", "Keys", "GUI", "Settings"}; + + for (const auto& section : section_order) { + if (data.contains(section)) { + std::vector keys; + for (const auto& item : data.at(section).as_table()) { + keys.push_back(item.first); + } + + std::sort(keys.begin(), keys.end(), [](const std::string& a, const std::string& b) { + return std::lexicographical_compare( + a.begin(), a.end(), b.begin(), b.end(), [](char a_char, char b_char) { + return std::tolower(a_char) < std::tolower(b_char); + }); + }); + + toml::ordered_value ordered_section; + for (const auto& key : keys) { + ordered_section[key] = data.at(section).at(key); + } + + ordered_data[section] = ordered_section; + } + } + + data = ordered_data; +} + void save(const std::filesystem::path& path) { toml::ordered_value data; @@ -876,6 +952,7 @@ void save(const std::filesystem::path& path) { } data["General"]["isPS4Pro"] = isNeo; + data["General"]["isDevKit"] = isDevKit; data["General"]["isTrophyPopupDisabled"] = isTrophyPopupDisabled; data["General"]["trophyNotificationDuration"] = trophyNotificationDuration; data["General"]["playBGM"] = playBGM; @@ -890,7 +967,6 @@ void save(const std::filesystem::path& path) { data["General"]["autoUpdate"] = isAutoUpdate; data["General"]["alwaysShowChangelog"] = isAlwaysShowChangelog; data["General"]["sideTrophy"] = isSideTrophy; - data["General"]["separateUpdateEnabled"] = separateupdatefolder; data["General"]["compatibilityEnabled"] = compatibilityData; data["General"]["checkCompatibilityOnStartup"] = checkCompatibilityOnStartup; data["Input"]["cursorState"] = cursorState; @@ -922,14 +998,37 @@ void save(const std::filesystem::path& path) { data["Debug"]["CollectShader"] = isShaderDebug; data["Debug"]["isSeparateLogFilesEnabled"] = isSeparateLogFilesEnabled; data["Debug"]["FPSColor"] = isFpsColor; - data["Keys"]["TrophyKey"] = trophyKey; std::vector install_dirs; - for (const auto& dirString : settings_install_dirs) { - install_dirs.emplace_back(std::string{fmt::UTF(dirString.u8string()).data}); + std::vector install_dirs_enabled; + + // temporary structure for ordering + struct DirEntry { + std::string path_str; + bool enabled; + }; + + std::vector sorted_dirs; + for (const auto& dirInfo : settings_install_dirs) { + sorted_dirs.push_back( + {std::string{fmt::UTF(dirInfo.path.u8string()).data}, dirInfo.enabled}); } + + // Sort directories alphabetically + std::sort(sorted_dirs.begin(), sorted_dirs.end(), [](const DirEntry& a, const DirEntry& b) { + return std::lexicographical_compare( + a.path_str.begin(), a.path_str.end(), b.path_str.begin(), b.path_str.end(), + [](char a_char, char b_char) { return std::tolower(a_char) < std::tolower(b_char); }); + }); + + for (const auto& entry : sorted_dirs) { + install_dirs.push_back(entry.path_str); + install_dirs_enabled.push_back(entry.enabled); + } + data["GUI"]["installDirs"] = install_dirs; + data["GUI"]["installDirsEnabled"] = install_dirs_enabled; data["GUI"]["saveDataPath"] = std::string{fmt::UTF(save_data_path.u8string()).data}; data["GUI"]["loadGameSizeEnabled"] = load_game_size; @@ -940,9 +1039,13 @@ void save(const std::filesystem::path& path) { data["GUI"]["showBackgroundImage"] = showBackgroundImage; data["Settings"]["consoleLanguage"] = m_language; + // Sorting of TOML sections + sortTomlSections(data); + std::ofstream file(path, std::ios::binary); file << data; file.close(); + saveMainWindow(path); } @@ -980,10 +1083,12 @@ void saveMainWindow(const std::filesystem::path& path) { data["GUI"]["geometry_y"] = main_window_geometry_y; data["GUI"]["geometry_w"] = main_window_geometry_w; data["GUI"]["geometry_h"] = main_window_geometry_h; - data["GUI"]["pkgDirs"] = m_pkg_viewer; data["GUI"]["elfDirs"] = m_elf_viewer; data["GUI"]["recentFiles"] = m_recent_files; + // Sorting of TOML sections + sortTomlSections(data); + std::ofstream file(path, std::ios::binary); file << data; file.close(); @@ -992,6 +1097,7 @@ void saveMainWindow(const std::filesystem::path& path) { void setDefaultValues() { isHDRAllowed = false; isNeo = false; + isDevKit = false; isFullscreen = false; isTrophyPopupDisabled = false; playBGM = false; @@ -1000,7 +1106,7 @@ void setDefaultValues() { screenWidth = 1280; screenHeight = 720; logFilter = ""; - logType = "async"; + logType = "sync"; userName = "shadPS4"; if (Common::isRelease) { updateChannel = "Release"; @@ -1033,7 +1139,6 @@ void setDefaultValues() { emulator_language = "en_US"; m_language = 1; gpuId = -1; - separateupdatefolder = false; compatibilityData = false; checkCompatibilityOnStartup = false; backgroundImageOpacity = 50; diff --git a/src/common/config.h b/src/common/config.h index 82d65d30e..aba23621c 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -9,6 +9,11 @@ namespace Config { +struct GameInstallDir { + std::filesystem::path path; + bool enabled; +}; + enum HideCursorState : s16 { Never, Idle, Always }; void load(const std::filesystem::path& path); @@ -21,13 +26,15 @@ bool GetLoadGameSizeEnabled(); std::filesystem::path GetSaveDataPath(); void setLoadGameSizeEnabled(bool enable); bool getIsFullscreen(); +bool getShowLabelsUnderIcons(); +bool setShowLabelsUnderIcons(); std::string getFullscreenMode(); bool isNeoModeConsole(); +bool isDevKitConsole(); bool getPlayBGM(); int getBGMvolume(); bool getisTrophyPopupDisabled(); bool getEnableDiscordRPC(); -bool getSeparateUpdateEnabled(); bool getCompatibilityEnabled(); bool getCheckCompatibilityOnStartup(); int getBackgroundImageOpacity(); @@ -97,8 +104,8 @@ 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 setGameInstallDirs(const std::vector& dirs_config); +void setAllGameInstallDirs(const std::vector& dirs_config); void setSaveDataPath(const std::filesystem::path& path); void setCompatibilityEnabled(bool use); void setCheckCompatibilityOnStartup(bool use); @@ -133,8 +140,9 @@ void setVkGuestMarkersEnabled(bool enable); // Gui void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h); -bool addGameInstallDir(const std::filesystem::path& dir); +bool addGameInstallDir(const std::filesystem::path& dir, bool enabled = true); void removeGameInstallDir(const std::filesystem::path& dir); +void setGameInstallDirEnabled(const std::filesystem::path& dir, bool enabled); void setAddonInstallDir(const std::filesystem::path& dir); void setMainWindowTheme(u32 theme); void setIconSize(u32 size); @@ -144,7 +152,6 @@ void setSliderPositionGrid(u32 pos); void setTableMode(u32 mode); void setMainWindowWidth(u32 width); void setMainWindowHeight(u32 height); -void setPkgViewer(const std::vector& pkgList); void setElfViewer(const std::vector& elfList); void setRecentFiles(const std::vector& recentFiles); void setEmulatorLanguage(std::string language); @@ -153,7 +160,8 @@ u32 getMainWindowGeometryX(); u32 getMainWindowGeometryY(); u32 getMainWindowGeometryW(); u32 getMainWindowGeometryH(); -const std::vector& getGameInstallDirs(); +const std::vector getGameInstallDirs(); +const std::vector getGameInstallDirsEnabled(); std::filesystem::path getAddonInstallDir(); u32 getMainWindowTheme(); u32 getIconSize(); @@ -163,7 +171,6 @@ u32 getSliderPositionGrid(); u32 getTableMode(); u32 getMainWindowWidth(); u32 getMainWindowHeight(); -std::vector getPkgViewer(); std::vector getElfViewer(); std::vector getRecentFiles(); std::string getEmulatorLanguage(); diff --git a/src/common/io_file.cpp b/src/common/io_file.cpp index 067010a26..3efadc6ea 100644 --- a/src/common/io_file.cpp +++ b/src/common/io_file.cpp @@ -125,12 +125,15 @@ namespace { [[nodiscard]] constexpr int ToSeekOrigin(SeekOrigin origin) { switch (origin) { case SeekOrigin::SetOrigin: - default: return SEEK_SET; case SeekOrigin::CurrentPosition: return SEEK_CUR; case SeekOrigin::End: return SEEK_END; + default: + LOG_ERROR(Common_Filesystem, "Unsupported origin {}, defaulting to SEEK_SET", + static_cast(origin)); + return SEEK_SET; } } @@ -377,20 +380,6 @@ bool IOFile::Seek(s64 offset, SeekOrigin origin) const { return false; } - if (False(file_access_mode & (FileAccessMode::Write | FileAccessMode::Append))) { - u64 size = GetSize(); - if (origin == SeekOrigin::CurrentPosition && Tell() + offset > size) { - LOG_ERROR(Common_Filesystem, "Seeking past the end of the file"); - return false; - } else if (origin == SeekOrigin::SetOrigin && (u64)offset > size) { - LOG_ERROR(Common_Filesystem, "Seeking past the end of the file"); - return false; - } else if (origin == SeekOrigin::End && offset > 0) { - LOG_ERROR(Common_Filesystem, "Seeking past the end of the file"); - return false; - } - } - errno = 0; const auto seek_result = fseeko(file, offset, ToSeekOrigin(origin)) == 0; diff --git a/src/common/io_file.h b/src/common/io_file.h index 45787a092..fb20a2bc5 100644 --- a/src/common/io_file.h +++ b/src/common/io_file.h @@ -61,6 +61,8 @@ enum class SeekOrigin : u32 { SetOrigin, // Seeks from the start of the file. CurrentPosition, // Seeks from the current file pointer position. End, // Seeks from the end of the file. + SeekHole, // Seeks from the start of the next hole in the file. + SeekData, // Seeks from the start of the next non-hole region in the file. }; class IOFile final { diff --git a/src/common/sha1.h b/src/common/sha1.h new file mode 100644 index 000000000..fad849dcc --- /dev/null +++ b/src/common/sha1.h @@ -0,0 +1,180 @@ +// SPDX-FileCopyrightText: 2012 SAURAV MOHAPATRA +// SPDX-License-Identifier: MIT + +#pragma once + +#include +#include +#include + +namespace sha1 { +class SHA1 { +public: + typedef uint32_t digest32_t[5]; + typedef uint8_t digest8_t[20]; + inline static uint32_t LeftRotate(uint32_t value, size_t count) { + return (value << count) ^ (value >> (32 - count)); + } + SHA1() { + reset(); + } + virtual ~SHA1() {} + SHA1(const SHA1& s) { + *this = s; + } + const SHA1& operator=(const SHA1& s) { + memcpy(m_digest, s.m_digest, 5 * sizeof(uint32_t)); + memcpy(m_block, s.m_block, 64); + m_blockByteIndex = s.m_blockByteIndex; + m_byteCount = s.m_byteCount; + return *this; + } + SHA1& reset() { + m_digest[0] = 0x67452301; + m_digest[1] = 0xEFCDAB89; + m_digest[2] = 0x98BADCFE; + m_digest[3] = 0x10325476; + m_digest[4] = 0xC3D2E1F0; + m_blockByteIndex = 0; + m_byteCount = 0; + return *this; + } + SHA1& processByte(uint8_t octet) { + this->m_block[this->m_blockByteIndex++] = octet; + ++this->m_byteCount; + if (m_blockByteIndex == 64) { + this->m_blockByteIndex = 0; + processBlock(); + } + return *this; + } + SHA1& processBlock(const void* const start, const void* const end) { + const uint8_t* begin = static_cast(start); + const uint8_t* finish = static_cast(end); + while (begin != finish) { + processByte(*begin); + begin++; + } + return *this; + } + SHA1& processBytes(const void* const data, size_t len) { + const uint8_t* block = static_cast(data); + processBlock(block, block + len); + return *this; + } + const uint32_t* getDigest(digest32_t digest) { + size_t bitCount = this->m_byteCount * 8; + processByte(0x80); + if (this->m_blockByteIndex > 56) { + while (m_blockByteIndex != 0) { + processByte(0); + } + while (m_blockByteIndex < 56) { + processByte(0); + } + } else { + while (m_blockByteIndex < 56) { + processByte(0); + } + } + processByte(0); + processByte(0); + processByte(0); + processByte(0); + processByte(static_cast((bitCount >> 24) & 0xFF)); + processByte(static_cast((bitCount >> 16) & 0xFF)); + processByte(static_cast((bitCount >> 8) & 0xFF)); + processByte(static_cast((bitCount) & 0xFF)); + + memcpy(digest, m_digest, 5 * sizeof(uint32_t)); + return digest; + } + const uint8_t* getDigestBytes(digest8_t digest) { + digest32_t d32; + getDigest(d32); + size_t di = 0; + digest[di++] = ((d32[0] >> 24) & 0xFF); + digest[di++] = ((d32[0] >> 16) & 0xFF); + digest[di++] = ((d32[0] >> 8) & 0xFF); + digest[di++] = ((d32[0]) & 0xFF); + + digest[di++] = ((d32[1] >> 24) & 0xFF); + digest[di++] = ((d32[1] >> 16) & 0xFF); + digest[di++] = ((d32[1] >> 8) & 0xFF); + digest[di++] = ((d32[1]) & 0xFF); + + digest[di++] = ((d32[2] >> 24) & 0xFF); + digest[di++] = ((d32[2] >> 16) & 0xFF); + digest[di++] = ((d32[2] >> 8) & 0xFF); + digest[di++] = ((d32[2]) & 0xFF); + + digest[di++] = ((d32[3] >> 24) & 0xFF); + digest[di++] = ((d32[3] >> 16) & 0xFF); + digest[di++] = ((d32[3] >> 8) & 0xFF); + digest[di++] = ((d32[3]) & 0xFF); + + digest[di++] = ((d32[4] >> 24) & 0xFF); + digest[di++] = ((d32[4] >> 16) & 0xFF); + digest[di++] = ((d32[4] >> 8) & 0xFF); + digest[di++] = ((d32[4]) & 0xFF); + return digest; + } + +protected: + void processBlock() { + uint32_t w[80]; + for (size_t i = 0; i < 16; i++) { + w[i] = (m_block[i * 4 + 0] << 24); + w[i] |= (m_block[i * 4 + 1] << 16); + w[i] |= (m_block[i * 4 + 2] << 8); + w[i] |= (m_block[i * 4 + 3]); + } + for (size_t i = 16; i < 80; i++) { + w[i] = LeftRotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]), 1); + } + + uint32_t a = m_digest[0]; + uint32_t b = m_digest[1]; + uint32_t c = m_digest[2]; + uint32_t d = m_digest[3]; + uint32_t e = m_digest[4]; + + for (std::size_t i = 0; i < 80; ++i) { + uint32_t f = 0; + uint32_t k = 0; + + if (i < 20) { + f = (b & c) | (~b & d); + k = 0x5A827999; + } else if (i < 40) { + f = b ^ c ^ d; + k = 0x6ED9EBA1; + } else if (i < 60) { + f = (b & c) | (b & d) | (c & d); + k = 0x8F1BBCDC; + } else { + f = b ^ c ^ d; + k = 0xCA62C1D6; + } + uint32_t temp = LeftRotate(a, 5) + f + e + k + w[i]; + e = d; + d = c; + c = LeftRotate(b, 30); + b = a; + a = temp; + } + + m_digest[0] += a; + m_digest[1] += b; + m_digest[2] += c; + m_digest[3] += d; + m_digest[4] += e; + } + +private: + digest32_t m_digest; + uint8_t m_block[64]; + size_t m_blockByteIndex; + size_t m_byteCount; +}; +} // namespace sha1 diff --git a/src/common/version.h b/src/common/version.h index e7f6cc817..652f36e6d 100644 --- a/src/common/version.h +++ b/src/common/version.h @@ -8,7 +8,7 @@ namespace Common { -constexpr char VERSION[] = "0.6.1 WIP"; +constexpr char VERSION[] = "0.7.1 WIP"; constexpr bool isRelease = false; } // namespace Common diff --git a/src/core/crypto/crypto.cpp b/src/core/crypto/crypto.cpp deleted file mode 100644 index 4020edfd8..000000000 --- a/src/core/crypto/crypto.cpp +++ /dev/null @@ -1,215 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include - -#include "crypto.h" - -CryptoPP::RSA::PrivateKey Crypto::key_pkg_derived_key3_keyset_init() { - CryptoPP::InvertibleRSAFunction params; - params.SetPrime1(CryptoPP::Integer(PkgDerivedKey3Keyset::Prime1, 0x80)); - params.SetPrime2(CryptoPP::Integer(PkgDerivedKey3Keyset::Prime2, 0x80)); - - params.SetPublicExponent(CryptoPP::Integer(PkgDerivedKey3Keyset::PublicExponent, 4)); - params.SetPrivateExponent(CryptoPP::Integer(PkgDerivedKey3Keyset::PrivateExponent, 0x100)); - - params.SetModPrime1PrivateExponent(CryptoPP::Integer(PkgDerivedKey3Keyset::Exponent1, 0x80)); - params.SetModPrime2PrivateExponent(CryptoPP::Integer(PkgDerivedKey3Keyset::Exponent2, 0x80)); - - params.SetModulus(CryptoPP::Integer(PkgDerivedKey3Keyset::Modulus, 0x100)); - params.SetMultiplicativeInverseOfPrime2ModPrime1( - CryptoPP::Integer(PkgDerivedKey3Keyset::Coefficient, 0x80)); - - CryptoPP::RSA::PrivateKey privateKey(params); - - return privateKey; -} - -CryptoPP::RSA::PrivateKey Crypto::FakeKeyset_keyset_init() { - CryptoPP::InvertibleRSAFunction params; - params.SetPrime1(CryptoPP::Integer(FakeKeyset::Prime1, 0x80)); - params.SetPrime2(CryptoPP::Integer(FakeKeyset::Prime2, 0x80)); - - params.SetPublicExponent(CryptoPP::Integer(FakeKeyset::PublicExponent, 4)); - params.SetPrivateExponent(CryptoPP::Integer(FakeKeyset::PrivateExponent, 0x100)); - - params.SetModPrime1PrivateExponent(CryptoPP::Integer(FakeKeyset::Exponent1, 0x80)); - params.SetModPrime2PrivateExponent(CryptoPP::Integer(FakeKeyset::Exponent2, 0x80)); - - params.SetModulus(CryptoPP::Integer(FakeKeyset::Modulus, 0x100)); - params.SetMultiplicativeInverseOfPrime2ModPrime1( - CryptoPP::Integer(FakeKeyset::Coefficient, 0x80)); - - CryptoPP::RSA::PrivateKey privateKey(params); - - return privateKey; -} - -CryptoPP::RSA::PrivateKey Crypto::DebugRifKeyset_init() { - CryptoPP::InvertibleRSAFunction params; - params.SetPrime1(CryptoPP::Integer(DebugRifKeyset::Prime1, sizeof(DebugRifKeyset::Prime1))); - params.SetPrime2(CryptoPP::Integer(DebugRifKeyset::Prime2, sizeof(DebugRifKeyset::Prime2))); - - params.SetPublicExponent( - CryptoPP::Integer(DebugRifKeyset::PublicExponent, sizeof(DebugRifKeyset::PublicExponent))); - params.SetPrivateExponent(CryptoPP::Integer(DebugRifKeyset::PrivateExponent, - sizeof(DebugRifKeyset::PrivateExponent))); - - params.SetModPrime1PrivateExponent( - CryptoPP::Integer(DebugRifKeyset::Exponent1, sizeof(DebugRifKeyset::Exponent1))); - params.SetModPrime2PrivateExponent( - CryptoPP::Integer(DebugRifKeyset::Exponent2, sizeof(DebugRifKeyset::Exponent2))); - - params.SetModulus(CryptoPP::Integer(DebugRifKeyset::Modulus, sizeof(DebugRifKeyset::Modulus))); - params.SetMultiplicativeInverseOfPrime2ModPrime1( - CryptoPP::Integer(DebugRifKeyset::Coefficient, sizeof(DebugRifKeyset::Coefficient))); - - CryptoPP::RSA::PrivateKey privateKey(params); - - return privateKey; -} - -void Crypto::RSA2048Decrypt(std::span dec_key, - std::span ciphertext, - bool is_dk3) { // RSAES_PKCS1v15_ - // Create an RSA decryptor - CryptoPP::RSA::PrivateKey privateKey; - if (is_dk3) { - privateKey = key_pkg_derived_key3_keyset_init(); - } else { - privateKey = FakeKeyset_keyset_init(); - } - - CryptoPP::RSAES_PKCS1v15_Decryptor rsaDecryptor(privateKey); - - // Allocate memory for the decrypted data - std::array decrypted; - - // Perform the decryption - CryptoPP::AutoSeededRandomPool rng; - CryptoPP::DecodingResult result = - rsaDecryptor.Decrypt(rng, ciphertext.data(), decrypted.size(), decrypted.data()); - std::copy(decrypted.begin(), decrypted.begin() + dec_key.size(), dec_key.begin()); -} - -void Crypto::ivKeyHASH256(std::span cipher_input, - std::span ivkey_result) { - CryptoPP::SHA256 sha256; - std::array hashResult; - auto array_sink = new CryptoPP::ArraySink(hashResult.data(), CryptoPP::SHA256::DIGESTSIZE); - auto filter = new CryptoPP::HashFilter(sha256, array_sink); - CryptoPP::ArraySource r(cipher_input.data(), cipher_input.size(), true, filter); - std::copy(hashResult.begin(), hashResult.begin() + ivkey_result.size(), ivkey_result.begin()); -} - -void Crypto::aesCbcCfb128Decrypt(std::span ivkey, - std::span ciphertext, - std::span decrypted) { - std::array key; - std::array iv; - - std::copy(ivkey.begin() + 16, ivkey.begin() + 16 + key.size(), key.begin()); - std::copy(ivkey.begin(), ivkey.begin() + iv.size(), iv.begin()); - - CryptoPP::AES::Decryption aesDecryption(key.data(), CryptoPP::AES::DEFAULT_KEYLENGTH); - CryptoPP::CBC_Mode_ExternalCipher::Decryption cbcDecryption(aesDecryption, iv.data()); - - for (size_t i = 0; i < decrypted.size(); i += CryptoPP::AES::BLOCKSIZE) { - cbcDecryption.ProcessData(decrypted.data() + i, ciphertext.data() + i, - CryptoPP::AES::BLOCKSIZE); - } -} - -void Crypto::aesCbcCfb128DecryptEntry(std::span ivkey, - std::span ciphertext, - std::span decrypted) { - std::array key; - std::array iv; - - std::copy(ivkey.begin() + 16, ivkey.begin() + 16 + key.size(), key.begin()); - std::copy(ivkey.begin(), ivkey.begin() + iv.size(), iv.begin()); - - CryptoPP::AES::Decryption aesDecryption(key.data(), CryptoPP::AES::DEFAULT_KEYLENGTH); - CryptoPP::CBC_Mode_ExternalCipher::Decryption cbcDecryption(aesDecryption, iv.data()); - - for (size_t i = 0; i < decrypted.size(); i += CryptoPP::AES::BLOCKSIZE) { - cbcDecryption.ProcessData(decrypted.data() + i, ciphertext.data() + i, - CryptoPP::AES::BLOCKSIZE); - } -} - -void Crypto::decryptEFSM(std::span trophyKey, - std::span NPcommID, - std::span efsmIv, std::span ciphertext, - std::span decrypted) { - - // step 1: Encrypt NPcommID - CryptoPP::CBC_Mode::Encryption encrypt; - - std::vector trophyIv(16, 0); - std::vector trpKey(16); - - encrypt.SetKeyWithIV(trophyKey.data(), trophyKey.size(), trophyIv.data()); - encrypt.ProcessData(trpKey.data(), NPcommID.data(), 16); - - // step 2: decrypt efsm. - CryptoPP::CBC_Mode::Decryption decrypt; - decrypt.SetKeyWithIV(trpKey.data(), trpKey.size(), efsmIv.data()); - - for (size_t i = 0; i < decrypted.size(); i += CryptoPP::AES::BLOCKSIZE) { - decrypt.ProcessData(decrypted.data() + i, ciphertext.data() + i, CryptoPP::AES::BLOCKSIZE); - } -} - -void Crypto::PfsGenCryptoKey(std::span ekpfs, - std::span seed, - std::span dataKey, - std::span tweakKey) { - CryptoPP::HMAC hmac(ekpfs.data(), ekpfs.size()); - - CryptoPP::SecByteBlock d(20); // Use Crypto++ SecByteBlock for better memory management - - // Copy the bytes of 'index' to the 'd' array - uint32_t index = 1; - std::memcpy(d, &index, sizeof(uint32_t)); - - // Copy the bytes of 'seed' to the 'd' array starting from index 4 - std::memcpy(d + sizeof(uint32_t), seed.data(), seed.size()); - - // Allocate memory for 'u64' using new - std::vector data_tweak_key(hmac.DigestSize()); - - // Calculate the HMAC - hmac.CalculateDigest(data_tweak_key.data(), d, d.size()); - std::copy(data_tweak_key.begin(), data_tweak_key.begin() + dataKey.size(), tweakKey.begin()); - std::copy(data_tweak_key.begin() + tweakKey.size(), - data_tweak_key.begin() + tweakKey.size() + dataKey.size(), dataKey.begin()); -} - -void Crypto::decryptPFS(std::span dataKey, - std::span tweakKey, std::span src_image, - std::span dst_image, u64 sector) { - // Start at 0x10000 to keep the header when decrypting the whole pfs_image. - for (int i = 0; i < src_image.size(); i += 0x1000) { - const u64 current_sector = sector + (i / 0x1000); - CryptoPP::ECB_Mode::Encryption encrypt(tweakKey.data(), tweakKey.size()); - CryptoPP::ECB_Mode::Decryption decrypt(dataKey.data(), dataKey.size()); - - std::array tweak{}; - std::array encryptedTweak; - std::array xorBuffer; - std::memcpy(tweak.data(), ¤t_sector, sizeof(u64)); - - // Encrypt the tweak for each sector. - encrypt.ProcessData(encryptedTweak.data(), tweak.data(), 16); - - for (int plaintextOffset = 0; plaintextOffset < 0x1000; plaintextOffset += 16) { - xtsXorBlock(xorBuffer.data(), src_image.data() + i + plaintextOffset, - encryptedTweak.data()); // x, c, t - decrypt.ProcessData(xorBuffer.data(), xorBuffer.data(), 16); // x, x - xtsXorBlock(dst_image.data() + i + plaintextOffset, xorBuffer.data(), - encryptedTweak.data()); //(p) c, x , t - xtsMult(encryptedTweak); - } - } -} diff --git a/src/core/crypto/crypto.h b/src/core/crypto/crypto.h deleted file mode 100644 index b5d8104b5..000000000 --- a/src/core/crypto/crypto.h +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "common/types.h" -#include "keys.h" - -class Crypto { -public: - CryptoPP::RSA::PrivateKey key_pkg_derived_key3_keyset_init(); - CryptoPP::RSA::PrivateKey FakeKeyset_keyset_init(); - CryptoPP::RSA::PrivateKey DebugRifKeyset_init(); - - void RSA2048Decrypt(std::span dk3, - std::span ciphertext, - bool is_dk3); // RSAES_PKCS1v15_ - void ivKeyHASH256(std::span cipher_input, - std::span ivkey_result); - void aesCbcCfb128Decrypt(std::span ivkey, - std::span ciphertext, - std::span decrypted); - void aesCbcCfb128DecryptEntry(std::span ivkey, - std::span ciphertext, - std::span decrypted); - void decryptEFSM(std::span trophyKey, - std::span NPcommID, std::span efsmIv, - std::span ciphertext, std::span decrypted); - void PfsGenCryptoKey(std::span ekpfs, - std::span seed, - std::span dataKey, - std::span tweakKey); - void decryptPFS(std::span dataKey, - std::span tweakKey, std::span src_image, - std::span dst_image, u64 sector); - - void xtsXorBlock(CryptoPP::byte* x, const CryptoPP::byte* a, const CryptoPP::byte* b) { - for (int i = 0; i < 16; i++) { - x[i] = a[i] ^ b[i]; - } - } - - void xtsMult(std::span encryptedTweak) { - int feedback = 0; - for (int k = 0; k < encryptedTweak.size(); k++) { - const auto tmp = (encryptedTweak[k] >> 7) & 1; - encryptedTweak[k] = ((encryptedTweak[k] << 1) + feedback) & 0xFF; - feedback = tmp; - } - if (feedback != 0) { - encryptedTweak[0] ^= 0x87; - } - } -}; diff --git a/src/core/crypto/keys.h b/src/core/crypto/keys.h deleted file mode 100644 index 441082481..000000000 --- a/src/core/crypto/keys.h +++ /dev/null @@ -1,305 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once -#include - -class FakeKeyset { -public: - // Constructor - static constexpr CryptoPP::byte Exponent1[] = { - 0x6D, 0x48, 0xE0, 0x54, 0x40, 0x25, 0xC8, 0x41, 0x29, 0x52, 0x42, 0x27, 0xEB, 0xD2, 0xC7, - 0xAB, 0x6B, 0x9C, 0x27, 0x0A, 0xB4, 0x1F, 0x94, 0x4E, 0xFA, 0x42, 0x1D, 0xB7, 0xBC, 0xB9, - 0xAE, 0xBC, 0x04, 0x6F, 0x75, 0x8F, 0x10, 0x5F, 0x89, 0xAC, 0xAB, 0x9C, 0xD2, 0xFA, 0xE6, - 0xA4, 0x13, 0x83, 0x68, 0xD4, 0x56, 0x38, 0xFE, 0xE5, 0x2B, 0x78, 0x44, 0x9C, 0x34, 0xE6, - 0x5A, 0xA0, 0xBE, 0x05, 0x70, 0xAD, 0x15, 0xC3, 0x2D, 0x31, 0xAC, 0x97, 0x5D, 0x88, 0xFC, - 0xC1, 0x62, 0x3D, 0xE2, 0xED, 0x11, 0xDB, 0xB6, 0x9E, 0xFC, 0x5A, 0x5A, 0x03, 0xF6, 0xCF, - 0x08, 0xD4, 0x5D, 0x90, 0xC9, 0x2A, 0xB9, 0x9B, 0xCF, 0xC8, 0x1A, 0x65, 0xF3, 0x5B, 0xE8, - 0x7F, 0xCF, 0xA5, 0xA6, 0x4C, 0x5C, 0x2A, 0x12, 0x0F, 0x92, 0xA5, 0xE3, 0xF0, 0x17, 0x1E, - 0x9A, 0x97, 0x45, 0x86, 0xFD, 0xDB, 0x54, 0x25}; - // exponent2 = d mod (q - 1) - static constexpr CryptoPP::byte Exponent2[] = { - 0x2A, 0x51, 0xCE, 0x02, 0x44, 0x28, 0x50, 0xE8, 0x30, 0x20, 0x7C, 0x9C, 0x55, 0xBF, 0x60, - 0x39, 0xBC, 0xD1, 0xF0, 0xE7, 0x68, 0xF8, 0x08, 0x5B, 0x61, 0x1F, 0xA7, 0xBF, 0xD0, 0xE8, - 0x8B, 0xB5, 0xB1, 0xD5, 0xD9, 0x16, 0xAC, 0x75, 0x0C, 0x6D, 0xF2, 0xE0, 0xB5, 0x97, 0x75, - 0xD2, 0x68, 0x16, 0x1F, 0x00, 0x7D, 0x8B, 0x17, 0xE8, 0x78, 0x48, 0x41, 0x71, 0x2B, 0x18, - 0x96, 0x80, 0x11, 0xDB, 0x68, 0x39, 0x9C, 0xD6, 0xE0, 0x72, 0x42, 0x86, 0xF0, 0x1B, 0x16, - 0x0D, 0x3E, 0x12, 0x94, 0x3D, 0x25, 0xA8, 0xA9, 0x30, 0x9E, 0x54, 0x5A, 0xD6, 0x36, 0x6C, - 0xD6, 0x8C, 0x20, 0x62, 0x8F, 0xA1, 0x6B, 0x1F, 0x7C, 0x6D, 0xB2, 0xB1, 0xC1, 0x2E, 0xAD, - 0x36, 0x02, 0x9C, 0x3A, 0xCA, 0x2F, 0x09, 0xD2, 0x45, 0x9E, 0xEB, 0xF2, 0xBC, 0x6C, 0xAA, - 0x3B, 0x3E, 0x90, 0xBC, 0x38, 0x67, 0x35, 0x4D}; - // e - static constexpr CryptoPP::byte PublicExponent[] = {0, 1, 0, 1}; - // (InverseQ)(q) = 1 mod p - static constexpr CryptoPP::byte Coefficient[] = { - 0x0B, 0x67, 0x1C, 0x0D, 0x6C, 0x57, 0xD3, 0xE7, 0x05, 0x65, 0x94, 0x31, 0x56, 0x55, 0xFD, - 0x28, 0x08, 0xFA, 0x05, 0x8A, 0xCC, 0x55, 0x39, 0x61, 0x97, 0x63, 0xA0, 0x16, 0x27, 0x3D, - 0xED, 0xC1, 0x16, 0x40, 0x2A, 0x12, 0xEA, 0x6F, 0xD9, 0xD8, 0x58, 0x56, 0xA8, 0x56, 0x8B, - 0x0D, 0x38, 0x5E, 0x1E, 0x80, 0x3B, 0x5F, 0x40, 0x80, 0x6F, 0x62, 0x4F, 0x28, 0xA2, 0x69, - 0xF3, 0xD3, 0xF7, 0xFD, 0xB2, 0xC3, 0x52, 0x43, 0x20, 0x92, 0x9D, 0x97, 0x8D, 0xA0, 0x15, - 0x07, 0x15, 0x6E, 0xA4, 0x0D, 0x56, 0xD3, 0x37, 0x1A, 0xC4, 0x9E, 0xDF, 0x02, 0x49, 0xB8, - 0x0A, 0x84, 0x62, 0xF5, 0xFA, 0xB9, 0x3F, 0xA4, 0x09, 0x76, 0xCC, 0xAA, 0xB9, 0x9B, 0xA6, - 0x4F, 0xC1, 0x6A, 0x64, 0xCE, 0xD8, 0x77, 0xAB, 0x4B, 0xF9, 0xA0, 0xAE, 0xDA, 0xF1, 0x67, - 0x87, 0x7C, 0x98, 0x5C, 0x7E, 0xB8, 0x73, 0xF5}; - // n = p * q - static constexpr CryptoPP::byte Modulus[] = { - 0xC6, 0xCF, 0x71, 0xE7, 0xE5, 0x9A, 0xF0, 0xD1, 0x2A, 0x2C, 0x45, 0x8B, 0xF9, 0x2A, 0x0E, - 0xC1, 0x43, 0x05, 0x8B, 0xC3, 0x71, 0x17, 0x80, 0x1D, 0xCD, 0x49, 0x7D, 0xDE, 0x35, 0x9D, - 0x25, 0x9B, 0xA0, 0xD7, 0xA0, 0xF2, 0x7D, 0x6C, 0x08, 0x7E, 0xAA, 0x55, 0x02, 0x68, 0x2B, - 0x23, 0xC6, 0x44, 0xB8, 0x44, 0x18, 0xEB, 0x56, 0xCF, 0x16, 0xA2, 0x48, 0x03, 0xC9, 0xE7, - 0x4F, 0x87, 0xEB, 0x3D, 0x30, 0xC3, 0x15, 0x88, 0xBF, 0x20, 0xE7, 0x9D, 0xFF, 0x77, 0x0C, - 0xDE, 0x1D, 0x24, 0x1E, 0x63, 0xA9, 0x4F, 0x8A, 0xBF, 0x5B, 0xBE, 0x60, 0x19, 0x68, 0x33, - 0x3B, 0xFC, 0xED, 0x9F, 0x47, 0x4E, 0x5F, 0xF8, 0xEA, 0xCB, 0x3D, 0x00, 0xBD, 0x67, 0x01, - 0xF9, 0x2C, 0x6D, 0xC6, 0xAC, 0x13, 0x64, 0xE7, 0x67, 0x14, 0xF3, 0xDC, 0x52, 0x69, 0x6A, - 0xB9, 0x83, 0x2C, 0x42, 0x30, 0x13, 0x1B, 0xB2, 0xD8, 0xA5, 0x02, 0x0D, 0x79, 0xED, 0x96, - 0xB1, 0x0D, 0xF8, 0xCC, 0x0C, 0xDF, 0x81, 0x95, 0x4F, 0x03, 0x58, 0x09, 0x57, 0x0E, 0x80, - 0x69, 0x2E, 0xFE, 0xFF, 0x52, 0x77, 0xEA, 0x75, 0x28, 0xA8, 0xFB, 0xC9, 0xBE, 0xBF, 0x9F, - 0xBB, 0xB7, 0x79, 0x8E, 0x18, 0x05, 0xE1, 0x80, 0xBD, 0x50, 0x34, 0x94, 0x81, 0xD3, 0x53, - 0xC2, 0x69, 0xA2, 0xD2, 0x4C, 0xCF, 0x6C, 0xF4, 0x57, 0x2C, 0x10, 0x4A, 0x3F, 0xFB, 0x22, - 0xFD, 0x8B, 0x97, 0xE2, 0xC9, 0x5B, 0xA6, 0x2B, 0xCD, 0xD6, 0x1B, 0x6B, 0xDB, 0x68, 0x7F, - 0x4B, 0xC2, 0xA0, 0x50, 0x34, 0xC0, 0x05, 0xE5, 0x8D, 0xEF, 0x24, 0x67, 0xFF, 0x93, 0x40, - 0xCF, 0x2D, 0x62, 0xA2, 0xA0, 0x50, 0xB1, 0xF1, 0x3A, 0xA8, 0x3D, 0xFD, 0x80, 0xD1, 0xF9, - 0xB8, 0x05, 0x22, 0xAF, 0xC8, 0x35, 0x45, 0x90, 0x58, 0x8E, 0xE3, 0x3A, 0x7C, 0xBD, 0x3E, - 0x27}; - // p - static constexpr CryptoPP::byte Prime1[] = { - 0xFE, 0xF6, 0xBF, 0x1D, 0x69, 0xAB, 0x16, 0x25, 0x08, 0x47, 0x55, 0x6B, 0x86, 0xE4, 0x35, - 0x88, 0x72, 0x2A, 0xB1, 0x3D, 0xF8, 0xB6, 0x44, 0xCA, 0xB3, 0xAB, 0x19, 0xD1, 0x04, 0x24, - 0x28, 0x0A, 0x74, 0x55, 0xB8, 0x15, 0x45, 0x09, 0xCC, 0x13, 0x1C, 0xF2, 0xBA, 0x37, 0xA9, - 0x03, 0x90, 0x8F, 0x02, 0x10, 0xFF, 0x25, 0x79, 0x86, 0xCC, 0x18, 0x50, 0x9A, 0x10, 0x5F, - 0x5B, 0x4C, 0x1C, 0x4E, 0xB0, 0xA7, 0xE3, 0x59, 0xB1, 0x2D, 0xA0, 0xC6, 0xB0, 0x20, 0x2C, - 0x21, 0x33, 0x12, 0xB3, 0xAF, 0x72, 0x34, 0x83, 0xCD, 0x52, 0x2F, 0xAF, 0x0F, 0x20, 0x5A, - 0x1B, 0xC0, 0xE2, 0xA3, 0x76, 0x34, 0x0F, 0xD7, 0xFC, 0xC1, 0x41, 0xC9, 0xF9, 0x79, 0x40, - 0x17, 0x42, 0x21, 0x3E, 0x9D, 0xFD, 0xC7, 0xC1, 0x50, 0xDE, 0x44, 0x5A, 0xC9, 0x31, 0x89, - 0x6A, 0x78, 0x05, 0xBE, 0x65, 0xB4, 0xE8, 0x2D}; - // q - static constexpr CryptoPP::byte Prime2[] = { - 0xC7, 0x9E, 0x47, 0x58, 0x00, 0x7D, 0x62, 0x82, 0xB0, 0xD2, 0x22, 0x81, 0xD4, 0xA8, 0x97, - 0x1B, 0x79, 0x0C, 0x3A, 0xB0, 0xD7, 0xC9, 0x30, 0xE3, 0xC3, 0x53, 0x8E, 0x57, 0xEF, 0xF0, - 0x9B, 0x9F, 0xB3, 0x90, 0x52, 0xC6, 0x94, 0x22, 0x36, 0xAA, 0xE6, 0x4A, 0x5F, 0x72, 0x1D, - 0x70, 0xE8, 0x76, 0x58, 0xC8, 0xB2, 0x91, 0xCE, 0x9C, 0xC3, 0xE9, 0x09, 0x7F, 0x2E, 0x47, - 0x97, 0xCC, 0x90, 0x39, 0x15, 0x35, 0x31, 0xDE, 0x1F, 0x0C, 0x8C, 0x0D, 0xC1, 0xC2, 0x92, - 0xBE, 0x97, 0xBF, 0x2F, 0x91, 0xA1, 0x8C, 0x7D, 0x50, 0xA8, 0x21, 0x2F, 0xD7, 0xA2, 0x9A, - 0x7E, 0xB5, 0xA7, 0x2A, 0x90, 0x02, 0xD9, 0xF3, 0x3D, 0xD1, 0xEB, 0xB8, 0xE0, 0x5A, 0x79, - 0x9E, 0x7D, 0x8D, 0xCA, 0x18, 0x6D, 0xBD, 0x9E, 0xA1, 0x80, 0x28, 0x6B, 0x2A, 0xFE, 0x51, - 0x24, 0x9B, 0x6F, 0x4D, 0x84, 0x77, 0x80, 0x23}; - static constexpr CryptoPP::byte PrivateExponent[] = { - 0x7F, 0x76, 0xCD, 0x0E, 0xE2, 0xD4, 0xDE, 0x05, 0x1C, 0xC6, 0xD9, 0xA8, 0x0E, 0x8D, 0xFA, - 0x7B, 0xCA, 0x1E, 0xAA, 0x27, 0x1A, 0x40, 0xF8, 0xF1, 0x22, 0x87, 0x35, 0xDD, 0xDB, 0xFD, - 0xEE, 0xF8, 0xC2, 0xBC, 0xBD, 0x01, 0xFB, 0x8B, 0xE2, 0x3E, 0x63, 0xB2, 0xB1, 0x22, 0x5C, - 0x56, 0x49, 0x6E, 0x11, 0xBE, 0x07, 0x44, 0x0B, 0x9A, 0x26, 0x66, 0xD1, 0x49, 0x2C, 0x8F, - 0xD3, 0x1B, 0xCF, 0xA4, 0xA1, 0xB8, 0xD1, 0xFB, 0xA4, 0x9E, 0xD2, 0x21, 0x28, 0x83, 0x09, - 0x8A, 0xF6, 0xA0, 0x0B, 0xA3, 0xD6, 0x0F, 0x9B, 0x63, 0x68, 0xCC, 0xBC, 0x0C, 0x4E, 0x14, - 0x5B, 0x27, 0xA4, 0xA9, 0xF4, 0x2B, 0xB9, 0xB8, 0x7B, 0xC0, 0xE6, 0x51, 0xAD, 0x1D, 0x77, - 0xD4, 0x6B, 0xB9, 0xCE, 0x20, 0xD1, 0x26, 0x66, 0x7E, 0x5E, 0x9E, 0xA2, 0xE9, 0x6B, 0x90, - 0xF3, 0x73, 0xB8, 0x52, 0x8F, 0x44, 0x11, 0x03, 0x0C, 0x13, 0x97, 0x39, 0x3D, 0x13, 0x22, - 0x58, 0xD5, 0x43, 0x82, 0x49, 0xDA, 0x6E, 0x7C, 0xA1, 0xC5, 0x8C, 0xA5, 0xB0, 0x09, 0xE0, - 0xCE, 0x3D, 0xDF, 0xF4, 0x9D, 0x3C, 0x97, 0x15, 0xE2, 0x6A, 0xC7, 0x2B, 0x3C, 0x50, 0x93, - 0x23, 0xDB, 0xBA, 0x4A, 0x22, 0x66, 0x44, 0xAC, 0x78, 0xBB, 0x0E, 0x1A, 0x27, 0x43, 0xB5, - 0x71, 0x67, 0xAF, 0xF4, 0xAB, 0x48, 0x46, 0x93, 0x73, 0xD0, 0x42, 0xAB, 0x93, 0x63, 0xE5, - 0x6C, 0x9A, 0xDE, 0x50, 0x24, 0xC0, 0x23, 0x7D, 0x99, 0x79, 0x3F, 0x22, 0x07, 0xE0, 0xC1, - 0x48, 0x56, 0x1B, 0xDF, 0x83, 0x09, 0x12, 0xB4, 0x2D, 0x45, 0x6B, 0xC9, 0xC0, 0x68, 0x85, - 0x99, 0x90, 0x79, 0x96, 0x1A, 0xD7, 0xF5, 0x4D, 0x1F, 0x37, 0x83, 0x40, 0x4A, 0xEC, 0x39, - 0x37, 0xA6, 0x80, 0x92, 0x7D, 0xC5, 0x80, 0xC7, 0xD6, 0x6F, 0xFE, 0x8A, 0x79, 0x89, 0xC6, - 0xB1}; -}; - -class DebugRifKeyset { -public: - // std::uint8_t* PrivateExponent; - static constexpr CryptoPP::byte Exponent1[] = { - 0xCD, 0x9A, 0x61, 0xB0, 0xB8, 0xD5, 0xB4, 0xE4, 0xE4, 0xF6, 0xAB, 0xF7, 0x27, 0xB7, 0x56, - 0x59, 0x6B, 0xB9, 0x11, 0xE7, 0xF4, 0x83, 0xAF, 0xB9, 0x73, 0x99, 0x7F, 0x49, 0xA2, 0x9C, - 0xF0, 0xB5, 0x6D, 0x37, 0x82, 0x14, 0x15, 0xF1, 0x04, 0x8A, 0xD4, 0x8E, 0xEB, 0x2E, 0x1F, - 0xE2, 0x81, 0xA9, 0x62, 0x6E, 0xB1, 0x68, 0x75, 0x62, 0xF3, 0x0F, 0xFE, 0xD4, 0x91, 0x87, - 0x98, 0x78, 0xBF, 0x26, 0xB5, 0x07, 0x58, 0xD0, 0xEE, 0x3F, 0x21, 0xE8, 0xC8, 0x0F, 0x5F, - 0xFA, 0x1C, 0x64, 0x74, 0x49, 0x52, 0xEB, 0xE7, 0xEE, 0xDE, 0xBA, 0x23, 0x26, 0x4A, 0xF6, - 0x9C, 0x1A, 0x09, 0x3F, 0xB9, 0x0B, 0x36, 0x26, 0x1A, 0xBE, 0xA9, 0x76, 0xE6, 0xF2, 0x69, - 0xDE, 0xFF, 0xAF, 0xCC, 0x0C, 0x9A, 0x66, 0x03, 0x86, 0x0A, 0x1F, 0x49, 0xA4, 0x10, 0xB6, - 0xBC, 0xC3, 0x7C, 0x88, 0xE8, 0xCE, 0x4B, 0xD9}; - // exponent2 = d mod (q - 1) - static constexpr CryptoPP::byte Exponent2[] = { - 0xB3, 0x73, 0xA3, 0x59, 0xE6, 0x97, 0xC0, 0xAB, 0x3B, 0x68, 0xFC, 0x39, 0xAC, 0xDB, 0x44, - 0xB1, 0xB4, 0x9E, 0x35, 0x4D, 0xBE, 0xC5, 0x36, 0x69, 0x6C, 0x3D, 0xC5, 0xFC, 0xFE, 0x4B, - 0x2F, 0xDC, 0x86, 0x80, 0x46, 0x96, 0x40, 0x1A, 0x0D, 0x6E, 0xFA, 0x8C, 0xE0, 0x47, 0x91, - 0xAC, 0xAD, 0x95, 0x2B, 0x8E, 0x1F, 0xF2, 0x0A, 0x45, 0xF8, 0x29, 0x95, 0x70, 0xC6, 0x88, - 0x5F, 0x71, 0x03, 0x99, 0x79, 0xBC, 0x84, 0x71, 0xBD, 0xE8, 0x84, 0x8C, 0x0E, 0xD4, 0x7B, - 0x30, 0x74, 0x57, 0x1A, 0x95, 0xE7, 0x90, 0x19, 0x8D, 0xAD, 0x8B, 0x4C, 0x4E, 0xC3, 0xE7, - 0x6B, 0x23, 0x86, 0x01, 0xEE, 0x9B, 0xE0, 0x2F, 0x15, 0xA2, 0x2C, 0x4C, 0x39, 0xD3, 0xDF, - 0x9C, 0x39, 0x01, 0xF1, 0x8C, 0x44, 0x4A, 0x15, 0x44, 0xDC, 0x51, 0xF7, 0x22, 0xD7, 0x7F, - 0x41, 0x7F, 0x68, 0xFA, 0xEE, 0x56, 0xE8, 0x05}; - // e - static constexpr CryptoPP::byte PublicExponent[] = {0x00, 0x01, 0x00, 0x01}; - // (InverseQ)(q) = 1 mod p - static constexpr CryptoPP::byte Coefficient[] = { - 0xC0, 0x32, 0x43, 0xD3, 0x8C, 0x3D, 0xB4, 0xD2, 0x48, 0x8C, 0x42, 0x41, 0x24, 0x94, 0x6C, - 0x80, 0xC9, 0xC1, 0x79, 0x36, 0x7F, 0xAC, 0xC3, 0xFF, 0x6A, 0x25, 0xEB, 0x2C, 0xFB, 0xD4, - 0x2B, 0xA0, 0xEB, 0xFE, 0x25, 0xE9, 0xC6, 0x77, 0xCE, 0xFE, 0x2D, 0x23, 0xFE, 0xD0, 0xF4, - 0x0F, 0xD9, 0x7E, 0xD5, 0xA5, 0x7D, 0x1F, 0xC0, 0xE8, 0xE8, 0xEC, 0x80, 0x5B, 0xC7, 0xFD, - 0xE2, 0xBD, 0x94, 0xA6, 0x2B, 0xDD, 0x6A, 0x60, 0x45, 0x54, 0xAB, 0xCA, 0x42, 0x9C, 0x6A, - 0x6C, 0xBF, 0x3C, 0x84, 0xF9, 0xA5, 0x0E, 0x63, 0x0C, 0x51, 0x58, 0x62, 0x6D, 0x5A, 0xB7, - 0x3C, 0x3F, 0x49, 0x1A, 0xD0, 0x93, 0xB8, 0x4F, 0x1A, 0x6C, 0x5F, 0xC5, 0xE5, 0xA9, 0x75, - 0xD4, 0x86, 0x9E, 0xDF, 0x87, 0x0F, 0x27, 0xB0, 0x26, 0x78, 0x4E, 0xFB, 0xC1, 0x8A, 0x4A, - 0x24, 0x3F, 0x7F, 0x8F, 0x9A, 0x12, 0x51, 0xCB}; - // n = p * q - static constexpr CryptoPP::byte Modulus[] = { - 0xC2, 0xD2, 0x44, 0xBC, 0xDD, 0x84, 0x3F, 0xD9, 0xC5, 0x22, 0xAF, 0xF7, 0xFC, 0x88, 0x8A, - 0x33, 0x80, 0xED, 0x8E, 0xE2, 0xCC, 0x81, 0xF7, 0xEC, 0xF8, 0x1C, 0x79, 0xBF, 0x02, 0xBB, - 0x12, 0x8E, 0x61, 0x68, 0x29, 0x1B, 0x15, 0xB6, 0x5E, 0xC6, 0xF8, 0xBF, 0x5A, 0xE0, 0x3B, - 0x6A, 0x6C, 0xD9, 0xD6, 0xF5, 0x75, 0xAB, 0xA0, 0x6F, 0x34, 0x81, 0x34, 0x9A, 0x5B, 0xAD, - 0xED, 0x31, 0xE3, 0xC6, 0xEA, 0x1A, 0xD1, 0x13, 0x22, 0xBB, 0xB3, 0xDA, 0xB3, 0xB2, 0x53, - 0xBD, 0x45, 0x79, 0x87, 0xAD, 0x0A, 0x01, 0x72, 0x18, 0x10, 0x29, 0x49, 0xF4, 0x41, 0x7F, - 0xD6, 0x47, 0x0C, 0x72, 0x92, 0x9E, 0xE9, 0xBB, 0x95, 0xA9, 0x5D, 0x79, 0xEB, 0xE4, 0x30, - 0x76, 0x90, 0x45, 0x4B, 0x9D, 0x9C, 0xCF, 0x92, 0x03, 0x60, 0x8C, 0x4B, 0x6C, 0xB3, 0x7A, - 0x3A, 0x05, 0x39, 0xA0, 0x66, 0xA9, 0x35, 0xCF, 0xB9, 0xFA, 0xAD, 0x9C, 0xAB, 0xEB, 0xE4, - 0x6A, 0x8C, 0xE9, 0x3B, 0xCC, 0x72, 0x12, 0x62, 0x63, 0xBD, 0x80, 0xC4, 0xEE, 0x37, 0x2B, - 0x32, 0x03, 0xA3, 0x09, 0xF7, 0xA0, 0x61, 0x57, 0xAD, 0x0D, 0xCF, 0x15, 0x98, 0x9E, 0x4E, - 0x49, 0xF8, 0xB5, 0xA3, 0x5C, 0x27, 0xEE, 0x45, 0x04, 0xEA, 0xE4, 0x4B, 0xBC, 0x8F, 0x87, - 0xED, 0x19, 0x1E, 0x46, 0x75, 0x63, 0xC4, 0x5B, 0xD5, 0xBC, 0x09, 0x2F, 0x02, 0x73, 0x19, - 0x3C, 0x58, 0x55, 0x49, 0x66, 0x4C, 0x11, 0xEC, 0x0F, 0x09, 0xFA, 0xA5, 0x56, 0x0A, 0x5A, - 0x63, 0x56, 0xAD, 0xA0, 0x0D, 0x86, 0x08, 0xC1, 0xE6, 0xB6, 0x13, 0x22, 0x49, 0x2F, 0x7C, - 0xDB, 0x4C, 0x56, 0x97, 0x0E, 0xC2, 0xD9, 0x2E, 0x87, 0xBC, 0x0E, 0x67, 0xC0, 0x1B, 0x58, - 0xBC, 0x64, 0x2B, 0xC2, 0x6E, 0xE2, 0x93, 0x2E, 0xB5, 0x6B, 0x70, 0xA4, 0x42, 0x9F, 0x64, - 0xC1}; - // p - static constexpr CryptoPP::byte Prime1[] = { - 0xE5, 0x62, 0xE1, 0x7F, 0x9F, 0x86, 0x08, 0xE2, 0x61, 0xD3, 0xD0, 0x42, 0xE2, 0xC4, 0xB6, - 0xA8, 0x51, 0x09, 0x19, 0x14, 0xA4, 0x3A, 0x11, 0x4C, 0x33, 0xA5, 0x9C, 0x01, 0x5E, 0x34, - 0xB6, 0x3F, 0x02, 0x1A, 0xCA, 0x47, 0xF1, 0x4F, 0x3B, 0x35, 0x2A, 0x07, 0x20, 0xEC, 0xD8, - 0xC1, 0x15, 0xD9, 0xCA, 0x03, 0x4F, 0xB8, 0xE8, 0x09, 0x73, 0x3F, 0x85, 0xB7, 0x41, 0xD5, - 0x51, 0x3E, 0x7B, 0xE3, 0x53, 0x2B, 0x48, 0x8B, 0x8E, 0xCB, 0xBA, 0xF7, 0xE0, 0x60, 0xF5, - 0x35, 0x0E, 0x6F, 0xB0, 0xD9, 0x2A, 0x99, 0xD0, 0xFF, 0x60, 0x14, 0xED, 0x40, 0xEA, 0xF8, - 0xD7, 0x0B, 0xC3, 0x8D, 0x8C, 0xE8, 0x81, 0xB3, 0x75, 0x93, 0x15, 0xB3, 0x7D, 0xF6, 0x39, - 0x60, 0x1A, 0x00, 0xE7, 0xC3, 0x27, 0xAD, 0xA4, 0x33, 0xD5, 0x3E, 0xA4, 0x35, 0x48, 0x6F, - 0x22, 0xEF, 0x5D, 0xDD, 0x7D, 0x7B, 0x61, 0x05}; - // q - static constexpr CryptoPP::byte Prime2[] = { - 0xD9, 0x6C, 0xC2, 0x0C, 0xF7, 0xAE, 0xD1, 0xF3, 0x3B, 0x3B, 0x49, 0x1E, 0x9F, 0x12, 0x9C, - 0xA1, 0x78, 0x1F, 0x35, 0x1D, 0x98, 0x26, 0x13, 0x71, 0xF9, 0x09, 0xFD, 0xF0, 0xAD, 0x38, - 0x55, 0xB7, 0xEE, 0x61, 0x04, 0x72, 0x51, 0x87, 0x2E, 0x05, 0x84, 0xB1, 0x1D, 0x0C, 0x0D, - 0xDB, 0xD4, 0x25, 0x3E, 0x26, 0xED, 0xEA, 0xB8, 0xF7, 0x49, 0xFE, 0xA2, 0x94, 0xE6, 0xF2, - 0x08, 0x92, 0xA7, 0x85, 0xF5, 0x30, 0xB9, 0x84, 0x22, 0xBF, 0xCA, 0xF0, 0x5F, 0xCB, 0x31, - 0x20, 0x34, 0x49, 0x16, 0x76, 0x34, 0xCC, 0x7A, 0xCB, 0x96, 0xFE, 0x78, 0x7A, 0x41, 0xFE, - 0x9A, 0xA2, 0x23, 0xF7, 0x68, 0x80, 0xD6, 0xCE, 0x4A, 0x78, 0xA5, 0xB7, 0x05, 0x77, 0x81, - 0x1F, 0xDE, 0x5E, 0xA8, 0x6E, 0x3E, 0x87, 0xEC, 0x44, 0xD2, 0x69, 0xC6, 0x54, 0x91, 0x6B, - 0x5E, 0x13, 0x8A, 0x03, 0x87, 0x05, 0x31, 0x8D}; - static constexpr CryptoPP::byte PrivateExponent[] = { - 0x01, 0x61, 0xAD, 0xD8, 0x9C, 0x06, 0x89, 0xD0, 0x60, 0xC8, 0x41, 0xF0, 0xB3, 0x83, 0x01, - 0x5D, 0xE3, 0xA2, 0x6B, 0xA2, 0xBA, 0x9A, 0x0A, 0x58, 0xCD, 0x1A, 0xA0, 0x97, 0x64, 0xEC, - 0xD0, 0x31, 0x1F, 0xCA, 0x36, 0x0E, 0x69, 0xDD, 0x40, 0xF7, 0x4E, 0xC0, 0xC6, 0xA3, 0x73, - 0xF0, 0x69, 0x84, 0xB2, 0xF4, 0x4B, 0x29, 0x14, 0x2A, 0x6D, 0xB8, 0x23, 0xD8, 0x1B, 0x61, - 0xD4, 0x9E, 0x87, 0xB3, 0xBB, 0xA9, 0xC4, 0x85, 0x4A, 0xF8, 0x03, 0x4A, 0xBF, 0xFE, 0xF9, - 0xFE, 0x8B, 0xDD, 0x54, 0x83, 0xBA, 0xE0, 0x2F, 0x3F, 0xB1, 0xEF, 0xA5, 0x05, 0x5D, 0x28, - 0x8B, 0xAB, 0xB5, 0xD0, 0x23, 0x2F, 0x8A, 0xCF, 0x48, 0x7C, 0xAA, 0xBB, 0xC8, 0x5B, 0x36, - 0x27, 0xC5, 0x16, 0xA4, 0xB6, 0x61, 0xAC, 0x0C, 0x28, 0x47, 0x79, 0x3F, 0x38, 0xAE, 0x5E, - 0x25, 0xC6, 0xAF, 0x35, 0xAE, 0xBC, 0xB0, 0xF3, 0xBC, 0xBD, 0xFD, 0xA4, 0x87, 0x0D, 0x14, - 0x3D, 0x90, 0xE4, 0xDE, 0x5D, 0x1D, 0x46, 0x81, 0xF1, 0x28, 0x6D, 0x2F, 0x2C, 0x5E, 0x97, - 0x2D, 0x89, 0x2A, 0x51, 0x72, 0x3C, 0x20, 0x02, 0x59, 0xB1, 0x98, 0x93, 0x05, 0x1E, 0x3F, - 0xA1, 0x8A, 0x69, 0x30, 0x0E, 0x70, 0x84, 0x8B, 0xAE, 0x97, 0xA1, 0x08, 0x95, 0x63, 0x4C, - 0xC7, 0xE8, 0x5D, 0x59, 0xCA, 0x78, 0x2A, 0x23, 0x87, 0xAC, 0x6F, 0x04, 0x33, 0xB1, 0x61, - 0xB9, 0xF0, 0x95, 0xDA, 0x33, 0xCC, 0xE0, 0x4C, 0x82, 0x68, 0x82, 0x14, 0x51, 0xBE, 0x49, - 0x1C, 0x58, 0xA2, 0x8B, 0x05, 0x4E, 0x98, 0x37, 0xEB, 0x94, 0x0B, 0x01, 0x22, 0xDC, 0xB3, - 0x19, 0xCA, 0x77, 0xA6, 0x6E, 0x97, 0xFF, 0x8A, 0x53, 0x5A, 0xC5, 0x24, 0xE4, 0xAF, 0x6E, - 0xA8, 0x2B, 0x53, 0xA4, 0xBE, 0x96, 0xA5, 0x7B, 0xCE, 0x22, 0x56, 0xA3, 0xF1, 0xCF, 0x14, - 0xA5}; -}; - -class PkgDerivedKey3Keyset { -public: - // std::uint8_t* PrivateExponent; - static constexpr CryptoPP::byte Exponent1[] = { - 0x52, 0xCC, 0x2D, 0xA0, 0x9C, 0x9E, 0x75, 0xE7, 0x28, 0xEE, 0x3D, 0xDE, 0xE3, 0x45, 0xD1, - 0x4F, 0x94, 0x1C, 0xCC, 0xC8, 0x87, 0x29, 0x45, 0x3B, 0x8D, 0x6E, 0xAB, 0x6E, 0x2A, 0xA7, - 0xC7, 0x15, 0x43, 0xA3, 0x04, 0x8F, 0x90, 0x5F, 0xEB, 0xF3, 0x38, 0x4A, 0x77, 0xFA, 0x36, - 0xB7, 0x15, 0x76, 0xB6, 0x01, 0x1A, 0x8E, 0x25, 0x87, 0x82, 0xF1, 0x55, 0xD8, 0xC6, 0x43, - 0x2A, 0xC0, 0xE5, 0x98, 0xC9, 0x32, 0xD1, 0x94, 0x6F, 0xD9, 0x01, 0xBA, 0x06, 0x81, 0xE0, - 0x6D, 0x88, 0xF2, 0x24, 0x2A, 0x25, 0x01, 0x64, 0x5C, 0xBF, 0xF2, 0xD9, 0x99, 0x67, 0x3E, - 0xF6, 0x72, 0xEE, 0xE4, 0xE2, 0x33, 0x5C, 0xF8, 0x00, 0x40, 0xE3, 0x2A, 0x9A, 0xF4, 0x3D, - 0x22, 0x86, 0x44, 0x3C, 0xFB, 0x0A, 0xA5, 0x7C, 0x3F, 0xCC, 0xF5, 0xF1, 0x16, 0xC4, 0xAC, - 0x88, 0xB4, 0xDE, 0x62, 0x94, 0x92, 0x6A, 0x13}; - // exponent2 = d mod (q - 1) - static constexpr CryptoPP::byte Exponent2[] = { - 0x7C, 0x9D, 0xAD, 0x39, 0xE0, 0xD5, 0x60, 0x14, 0x94, 0x48, 0x19, 0x7F, 0x88, 0x95, 0xD5, - 0x8B, 0x80, 0xAD, 0x85, 0x8A, 0x4B, 0x77, 0x37, 0x85, 0xD0, 0x77, 0xBB, 0xBF, 0x89, 0x71, - 0x4A, 0x72, 0xCB, 0x72, 0x68, 0x38, 0xEC, 0x02, 0xC6, 0x7D, 0xC6, 0x44, 0x06, 0x33, 0x51, - 0x1C, 0xC0, 0xFF, 0x95, 0x8F, 0x0D, 0x75, 0xDC, 0x25, 0xBB, 0x0B, 0x73, 0x91, 0xA9, 0x6D, - 0x42, 0xD8, 0x03, 0xB7, 0x68, 0xD4, 0x1E, 0x75, 0x62, 0xA3, 0x70, 0x35, 0x79, 0x78, 0x00, - 0xC8, 0xF5, 0xEF, 0x15, 0xB9, 0xFC, 0x4E, 0x47, 0x5A, 0xC8, 0x70, 0x70, 0x5B, 0x52, 0x98, - 0xC0, 0xC2, 0x58, 0x4A, 0x70, 0x96, 0xCC, 0xB8, 0x10, 0xE1, 0x2F, 0x78, 0x8B, 0x2B, 0xA1, - 0x7F, 0xF9, 0xAC, 0xDE, 0xF0, 0xBB, 0x2B, 0xE2, 0x66, 0xE3, 0x22, 0x92, 0x31, 0x21, 0x57, - 0x92, 0xC4, 0xB8, 0xF2, 0x3E, 0x76, 0x20, 0x37}; - // e - static constexpr CryptoPP::byte PublicExponent[] = {0, 1, 0, 1}; - // (InverseQ)(q) = 1 mod p - static constexpr CryptoPP::byte Coefficient[] = { - 0x45, 0x97, 0x55, 0xD4, 0x22, 0x08, 0x5E, 0xF3, 0x5C, 0xB4, 0x05, 0x7A, 0xFD, 0xAA, 0x42, - 0x42, 0xAD, 0x9A, 0x8C, 0xA0, 0x6C, 0xBB, 0x1D, 0x68, 0x54, 0x54, 0x6E, 0x3E, 0x32, 0xE3, - 0x53, 0x73, 0x76, 0xF1, 0x3E, 0x01, 0xEA, 0xD3, 0xCF, 0xEB, 0xEB, 0x23, 0x3E, 0xC0, 0xBE, - 0xCE, 0xEC, 0x2C, 0x89, 0x5F, 0xA8, 0x27, 0x3A, 0x4C, 0xB7, 0xE6, 0x74, 0xBC, 0x45, 0x4C, - 0x26, 0xC8, 0x25, 0xFF, 0x34, 0x63, 0x25, 0x37, 0xE1, 0x48, 0x10, 0xC1, 0x93, 0xA6, 0xAF, - 0xEB, 0xBA, 0xE3, 0xA2, 0xF1, 0x3D, 0xEF, 0x63, 0xD8, 0xF4, 0xFD, 0xD3, 0xEE, 0xE2, 0x5D, - 0xE9, 0x33, 0xCC, 0xAD, 0xBA, 0x75, 0x5C, 0x85, 0xAF, 0xCE, 0xA9, 0x3D, 0xD1, 0xA2, 0x17, - 0xF3, 0xF6, 0x98, 0xB3, 0x50, 0x8E, 0x5E, 0xF6, 0xEB, 0x02, 0x8E, 0xA1, 0x62, 0xA7, 0xD6, - 0x2C, 0xEC, 0x91, 0xFF, 0x15, 0x40, 0xD2, 0xE3}; - // n = p * q - static constexpr CryptoPP::byte Modulus[] = { - 0xd2, 0x12, 0xfc, 0x33, 0x5f, 0x6d, 0xdb, 0x83, 0x16, 0x09, 0x62, 0x8b, 0x03, 0x56, 0x27, - 0x37, 0x82, 0xd4, 0x77, 0x85, 0x35, 0x29, 0x39, 0x2d, 0x52, 0x6b, 0x8c, 0x4c, 0x8c, 0xfb, - 0x06, 0xc1, 0x84, 0x5b, 0xe7, 0xd4, 0xf7, 0xbc, 0xd2, 0x4e, 0x62, 0x45, 0xcd, 0x2a, 0xbb, - 0xd7, 0x77, 0x76, 0x45, 0x36, 0x55, 0x27, 0x3f, 0xb3, 0xf5, 0xf9, 0x8e, 0xda, 0x4b, 0xef, - 0xaa, 0x59, 0xae, 0xb3, 0x9b, 0xea, 0x54, 0x98, 0xd2, 0x06, 0x32, 0x6a, 0x58, 0x31, 0x2a, - 0xe0, 0xd4, 0x4f, 0x90, 0xb5, 0x0a, 0x7d, 0xec, 0xf4, 0x3a, 0x9c, 0x52, 0x67, 0x2d, 0x99, - 0x31, 0x8e, 0x0c, 0x43, 0xe6, 0x82, 0xfe, 0x07, 0x46, 0xe1, 0x2e, 0x50, 0xd4, 0x1f, 0x2d, - 0x2f, 0x7e, 0xd9, 0x08, 0xba, 0x06, 0xb3, 0xbf, 0x2e, 0x20, 0x3f, 0x4e, 0x3f, 0xfe, 0x44, - 0xff, 0xaa, 0x50, 0x43, 0x57, 0x91, 0x69, 0x94, 0x49, 0x15, 0x82, 0x82, 0xe4, 0x0f, 0x4c, - 0x8d, 0x9d, 0x2c, 0xc9, 0x5b, 0x1d, 0x64, 0xbf, 0x88, 0x8b, 0xd4, 0xc5, 0x94, 0xe7, 0x65, - 0x47, 0x84, 0x1e, 0xe5, 0x79, 0x10, 0xfb, 0x98, 0x93, 0x47, 0xb9, 0x7d, 0x85, 0x12, 0xa6, - 0x40, 0x98, 0x2c, 0xf7, 0x92, 0xbc, 0x95, 0x19, 0x32, 0xed, 0xe8, 0x90, 0x56, 0x0d, 0x65, - 0xc1, 0xaa, 0x78, 0xc6, 0x2e, 0x54, 0xfd, 0x5f, 0x54, 0xa1, 0xf6, 0x7e, 0xe5, 0xe0, 0x5f, - 0x61, 0xc1, 0x20, 0xb4, 0xb9, 0xb4, 0x33, 0x08, 0x70, 0xe4, 0xdf, 0x89, 0x56, 0xed, 0x01, - 0x29, 0x46, 0x77, 0x5f, 0x8c, 0xb8, 0xa9, 0xf5, 0x1e, 0x2e, 0xb3, 0xb9, 0xbf, 0xe0, 0x09, - 0xb7, 0x8d, 0x28, 0xd4, 0xa6, 0xc3, 0xb8, 0x1e, 0x1f, 0x07, 0xeb, 0xb4, 0x12, 0x0b, 0x95, - 0xb8, 0x85, 0x30, 0xfd, 0xdc, 0x39, 0x13, 0xd0, 0x7c, 0xdc, 0x8f, 0xed, 0xf9, 0xc9, 0xa3, - 0xc1}; - // p - static constexpr CryptoPP::byte Prime1[] = { - 0xF9, 0x67, 0xAD, 0x99, 0x12, 0x31, 0x0C, 0x56, 0xA2, 0x2E, 0x16, 0x1C, 0x46, 0xB3, 0x4D, - 0x5B, 0x43, 0xBE, 0x42, 0xA2, 0xF6, 0x86, 0x96, 0x80, 0x42, 0xC3, 0xC7, 0x3F, 0xC3, 0x42, - 0xF5, 0x87, 0x49, 0x33, 0x9F, 0x07, 0x5D, 0x6E, 0x2C, 0x04, 0xFD, 0xE3, 0xE1, 0xB2, 0xAE, - 0x0A, 0x0C, 0xF0, 0xC7, 0xA6, 0x1C, 0xA1, 0x63, 0x50, 0xC8, 0x09, 0x9C, 0x51, 0x24, 0x52, - 0x6C, 0x5E, 0x5E, 0xBD, 0x1E, 0x27, 0x06, 0xBB, 0xBC, 0x9E, 0x94, 0xE1, 0x35, 0xD4, 0x6D, - 0xB3, 0xCB, 0x3C, 0x68, 0xDD, 0x68, 0xB3, 0xFE, 0x6C, 0xCB, 0x8D, 0x82, 0x20, 0x76, 0x23, - 0x63, 0xB7, 0xE9, 0x68, 0x10, 0x01, 0x4E, 0xDC, 0xBA, 0x27, 0x5D, 0x01, 0xC1, 0x2D, 0x80, - 0x5E, 0x2B, 0xAF, 0x82, 0x6B, 0xD8, 0x84, 0xB6, 0x10, 0x52, 0x86, 0xA7, 0x89, 0x8E, 0xAE, - 0x9A, 0xE2, 0x89, 0xC6, 0xF7, 0xD5, 0x87, 0xFB}; - // q - static constexpr CryptoPP::byte Prime2[] = { - 0xD7, 0xA1, 0x0F, 0x9A, 0x8B, 0xF2, 0xC9, 0x11, 0x95, 0x32, 0x9A, 0x8C, 0xF0, 0xD9, 0x40, - 0x47, 0xF5, 0x68, 0xA0, 0x0D, 0xBD, 0xC1, 0xFC, 0x43, 0x2F, 0x65, 0xF9, 0xC3, 0x61, 0x0F, - 0x25, 0x77, 0x54, 0xAD, 0xD7, 0x58, 0xAC, 0x84, 0x40, 0x60, 0x8D, 0x3F, 0xF3, 0x65, 0x89, - 0x75, 0xB5, 0xC6, 0x2C, 0x51, 0x1A, 0x2F, 0x1F, 0x22, 0xE4, 0x43, 0x11, 0x54, 0xBE, 0xC9, - 0xB4, 0xC7, 0xB5, 0x1B, 0x05, 0x0B, 0xBC, 0x56, 0x9A, 0xCD, 0x4A, 0xD9, 0x73, 0x68, 0x5E, - 0x5C, 0xFB, 0x92, 0xB7, 0x8B, 0x0D, 0xFF, 0xF5, 0x07, 0xCA, 0xB4, 0xC8, 0x9B, 0x96, 0x3C, - 0x07, 0x9E, 0x3E, 0x6B, 0x2A, 0x11, 0xF2, 0x8A, 0xB1, 0x8A, 0xD7, 0x2E, 0x1B, 0xA5, 0x53, - 0x24, 0x06, 0xED, 0x50, 0xB8, 0x90, 0x67, 0xB1, 0xE2, 0x41, 0xC6, 0x92, 0x01, 0xEE, 0x10, - 0xF0, 0x61, 0xBB, 0xFB, 0xB2, 0x7D, 0x4A, 0x73}; - static constexpr CryptoPP::byte PrivateExponent[] = { - 0x32, 0xD9, 0x03, 0x90, 0x8F, 0xBD, 0xB0, 0x8F, 0x57, 0x2B, 0x28, 0x5E, 0x0B, 0x8D, 0xB3, - 0xEA, 0x5C, 0xD1, 0x7E, 0xA8, 0x90, 0x88, 0x8C, 0xDD, 0x6A, 0x80, 0xBB, 0xB1, 0xDF, 0xC1, - 0xF7, 0x0D, 0xAA, 0x32, 0xF0, 0xB7, 0x7C, 0xCB, 0x88, 0x80, 0x0E, 0x8B, 0x64, 0xB0, 0xBE, - 0x4C, 0xD6, 0x0E, 0x9B, 0x8C, 0x1E, 0x2A, 0x64, 0xE1, 0xF3, 0x5C, 0xD7, 0x76, 0x01, 0x41, - 0x5E, 0x93, 0x5C, 0x94, 0xFE, 0xDD, 0x46, 0x62, 0xC3, 0x1B, 0x5A, 0xE2, 0xA0, 0xBC, 0x2D, - 0xEB, 0xC3, 0x98, 0x0A, 0xA7, 0xB7, 0x85, 0x69, 0x70, 0x68, 0x2B, 0x64, 0x4A, 0xB3, 0x1F, - 0xCC, 0x7D, 0xDC, 0x7C, 0x26, 0xF4, 0x77, 0xF6, 0x5C, 0xF2, 0xAE, 0x5A, 0x44, 0x2D, 0xD3, - 0xAB, 0x16, 0x62, 0x04, 0x19, 0xBA, 0xFB, 0x90, 0xFF, 0xE2, 0x30, 0x50, 0x89, 0x6E, 0xCB, - 0x56, 0xB2, 0xEB, 0xC0, 0x91, 0x16, 0x92, 0x5E, 0x30, 0x8E, 0xAE, 0xC7, 0x94, 0x5D, 0xFD, - 0x35, 0xE1, 0x20, 0xF8, 0xAD, 0x3E, 0xBC, 0x08, 0xBF, 0xC0, 0x36, 0x74, 0x9F, 0xD5, 0xBB, - 0x52, 0x08, 0xFD, 0x06, 0x66, 0xF3, 0x7A, 0xB3, 0x04, 0xF4, 0x75, 0x29, 0x5D, 0xE9, 0x5F, - 0xAA, 0x10, 0x30, 0xB2, 0x0F, 0x5A, 0x1A, 0xC1, 0x2A, 0xB3, 0xFE, 0xCB, 0x21, 0xAD, 0x80, - 0xEC, 0x8F, 0x20, 0x09, 0x1C, 0xDB, 0xC5, 0x58, 0x94, 0xC2, 0x9C, 0xC6, 0xCE, 0x82, 0x65, - 0x3E, 0x57, 0x90, 0xBC, 0xA9, 0x8B, 0x06, 0xB4, 0xF0, 0x72, 0xF6, 0x77, 0xDF, 0x98, 0x64, - 0xF1, 0xEC, 0xFE, 0x37, 0x2D, 0xBC, 0xAE, 0x8C, 0x08, 0x81, 0x1F, 0xC3, 0xC9, 0x89, 0x1A, - 0xC7, 0x42, 0x82, 0x4B, 0x2E, 0xDC, 0x8E, 0x8D, 0x73, 0xCE, 0xB1, 0xCC, 0x01, 0xD9, 0x08, - 0x70, 0x87, 0x3C, 0x44, 0x08, 0xEC, 0x49, 0x8F, 0x81, 0x5A, 0xE2, 0x40, 0xFF, 0x77, 0xFC, - 0x0D}; -}; \ No newline at end of file diff --git a/src/core/devtools/layer.cpp b/src/core/devtools/layer.cpp index 87fd9ffb3..94b39e801 100644 --- a/src/core/devtools/layer.cpp +++ b/src/core/devtools/layer.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "SDL3/SDL_log.h" #include "layer.h" #include @@ -117,22 +118,6 @@ void L::DrawMenuBar() { EndMainMenuBar(); } - - if (IsKeyPressed(ImGuiKey_F9, false)) { - if (io.KeyCtrl && io.KeyAlt) { - if (!DebugState.ShouldPauseInSubmit()) { - DebugState.RequestFrameDump(dump_frame_count); - } - } - if (!io.KeyCtrl && !io.KeyAlt) { - if (isSystemPaused) { - DebugState.ResumeGuestThreads(); - } else { - DebugState.PauseGuestThreads(); - } - } - } - if (open_popup_options) { OpenPopup("GPU Tools Options"); just_opened_options = true; @@ -381,6 +366,32 @@ void L::Draw() { visibility_toggled = true; } + if (IsKeyPressed(ImGuiKey_F9, false)) { + if (io.KeyCtrl && io.KeyAlt) { + if (!DebugState.ShouldPauseInSubmit()) { + DebugState.RequestFrameDump(dump_frame_count); + } + } else { + if (DebugState.IsGuestThreadsPaused()) { + DebugState.ResumeGuestThreads(); + SDL_Log("Game resumed from Keyboard"); + show_pause_status = false; + } else { + DebugState.PauseGuestThreads(); + SDL_Log("Game paused from Keyboard"); + show_pause_status = true; + } + visibility_toggled = true; + } + } + + if (show_pause_status) { + ImVec2 pos = ImVec2(10, 10); + ImU32 color = IM_COL32(255, 255, 255, 255); + + ImGui::GetForegroundDrawList()->AddText(pos, color, "Game Paused Press F9 to Resume"); + } + if (show_simple_fps) { if (Begin("Video Info", nullptr, ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | diff --git a/src/core/devtools/layer.h b/src/core/devtools/layer.h index 5bb53fbdb..9e949c8e9 100644 --- a/src/core/devtools/layer.h +++ b/src/core/devtools/layer.h @@ -19,6 +19,7 @@ public: static void SetupSettings(); void Draw() override; + bool show_pause_status = false; }; } // namespace Core::Devtools diff --git a/src/core/file_format/pkg.cpp b/src/core/file_format/pkg.cpp deleted file mode 100644 index a6b5eb9a8..000000000 --- a/src/core/file_format/pkg.cpp +++ /dev/null @@ -1,473 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include -#include "common/io_file.h" -#include "common/logging/formatter.h" -#include "core/file_format/pkg.h" -#include "core/file_format/pkg_type.h" - -static void DecompressPFSC(std::span compressed_data, std::span decompressed_data) { - z_stream decompressStream; - decompressStream.zalloc = Z_NULL; - decompressStream.zfree = Z_NULL; - decompressStream.opaque = Z_NULL; - - if (inflateInit(&decompressStream) != Z_OK) { - // std::cerr << "Error initializing zlib for deflation." << std::endl; - } - - decompressStream.avail_in = compressed_data.size(); - decompressStream.next_in = reinterpret_cast(compressed_data.data()); - decompressStream.avail_out = decompressed_data.size(); - decompressStream.next_out = reinterpret_cast(decompressed_data.data()); - - if (inflate(&decompressStream, Z_FINISH)) { - } - if (inflateEnd(&decompressStream) != Z_OK) { - // std::cerr << "Error ending zlib inflate" << std::endl; - } -} - -u32 GetPFSCOffset(std::span pfs_image) { - static constexpr u32 PfscMagic = 0x43534650; - u32 value; - for (u32 i = 0x20000; i < pfs_image.size(); i += 0x10000) { - std::memcpy(&value, &pfs_image[i], sizeof(u32)); - if (value == PfscMagic) - return i; - } - return -1; -} - -PKG::PKG() = default; - -PKG::~PKG() = default; - -bool PKG::Open(const std::filesystem::path& filepath, std::string& failreason) { - Common::FS::IOFile file(filepath, Common::FS::FileAccessMode::Read); - if (!file.IsOpen()) { - return false; - } - pkgSize = file.GetSize(); - - file.Read(pkgheader); - if (pkgheader.magic != 0x7F434E54) - return false; - - for (const auto& flag : flagNames) { - if (isFlagSet(pkgheader.pkg_content_flags, flag.first)) { - if (!pkgFlags.empty()) - pkgFlags += (", "); - pkgFlags += (flag.second); - } - } - - // Find title id it is part of pkg_content_id starting at offset 0x40 - file.Seek(0x47); // skip first 7 characters of content_id - file.Read(pkgTitleID); - - u32 offset = pkgheader.pkg_table_entry_offset; - u32 n_files = pkgheader.pkg_table_entry_count; - - if (!file.Seek(offset)) { - failreason = "Failed to seek to PKG table entry offset"; - return false; - } - - for (int i = 0; i < n_files; i++) { - PKGEntry entry{}; - file.Read(entry.id); - file.Read(entry.filename_offset); - file.Read(entry.flags1); - file.Read(entry.flags2); - file.Read(entry.offset); - file.Read(entry.size); - file.Seek(8, Common::FS::SeekOrigin::CurrentPosition); - - // Try to figure out the name - const auto name = GetEntryNameByType(entry.id); - if (name == "param.sfo") { - sfo.clear(); - if (!file.Seek(entry.offset)) { - failreason = "Failed to seek to param.sfo offset"; - return false; - } - sfo.resize(entry.size); - file.ReadRaw(sfo.data(), entry.size); - } - } - file.Close(); - - return true; -} - -bool PKG::Extract(const std::filesystem::path& filepath, const std::filesystem::path& extract, - std::string& failreason) { - extract_path = extract; - pkgpath = filepath; - Common::FS::IOFile file(filepath, Common::FS::FileAccessMode::Read); - if (!file.IsOpen()) { - return false; - } - pkgSize = file.GetSize(); - file.ReadRaw(&pkgheader, sizeof(PKGHeader)); - - if (pkgheader.magic != 0x7F434E54) - return false; - - if (pkgheader.pkg_size > pkgSize) { - failreason = "PKG file size is different"; - return false; - } - if ((pkgheader.pkg_content_size + pkgheader.pkg_content_offset) > pkgheader.pkg_size) { - failreason = "Content size is bigger than pkg size"; - return false; - } - - u32 offset = pkgheader.pkg_table_entry_offset; - u32 n_files = pkgheader.pkg_table_entry_count; - - std::array concatenated_ivkey_dk3; - std::array seed_digest; - std::array, 7> digest1; - std::array, 7> key1; - std::array imgkeydata; - - if (!file.Seek(offset)) { - failreason = "Failed to seek to PKG table entry offset"; - return false; - } - - for (int i = 0; i < n_files; i++) { - PKGEntry entry{}; - file.Read(entry.id); - file.Read(entry.filename_offset); - file.Read(entry.flags1); - file.Read(entry.flags2); - file.Read(entry.offset); - file.Read(entry.size); - file.Seek(8, Common::FS::SeekOrigin::CurrentPosition); - - auto currentPos = file.Tell(); - - // Try to figure out the name - const auto name = GetEntryNameByType(entry.id); - const auto filepath = extract_path / "sce_sys" / name; - std::filesystem::create_directories(filepath.parent_path()); - - if (name.empty()) { - // Just print with id - Common::FS::IOFile out(extract_path / "sce_sys" / std::to_string(entry.id), - Common::FS::FileAccessMode::Write); - if (!file.Seek(entry.offset)) { - failreason = "Failed to seek to PKG entry offset"; - return false; - } - - std::vector data; - data.resize(entry.size); - file.ReadRaw(data.data(), entry.size); - out.WriteRaw(data.data(), entry.size); - out.Close(); - - file.Seek(currentPos); - continue; - } - - if (entry.id == 0x1) { // DIGESTS, seek; - // file.Seek(entry.offset, fsSeekSet); - } else if (entry.id == 0x10) { // ENTRY_KEYS, seek; - file.Seek(entry.offset); - file.Read(seed_digest); - - for (int i = 0; i < 7; i++) { - file.Read(digest1[i]); - } - - for (int i = 0; i < 7; i++) { - file.Read(key1[i]); - } - - PKG::crypto.RSA2048Decrypt(dk3_, key1[3], true); // decrypt DK3 - } else if (entry.id == 0x20) { // IMAGE_KEY, seek; IV_KEY - file.Seek(entry.offset); - file.Read(imgkeydata); - - // The Concatenated iv + dk3 imagekey for HASH256 - std::memcpy(concatenated_ivkey_dk3.data(), &entry, sizeof(entry)); - std::memcpy(concatenated_ivkey_dk3.data() + sizeof(entry), dk3_.data(), sizeof(dk3_)); - - PKG::crypto.ivKeyHASH256(concatenated_ivkey_dk3, ivKey); // ivkey_ - // imgkey_ to use for last step to get ekpfs - PKG::crypto.aesCbcCfb128Decrypt(ivKey, imgkeydata, imgKey); - // ekpfs key to get data and tweak keys. - PKG::crypto.RSA2048Decrypt(ekpfsKey, imgKey, false); - } else if (entry.id == 0x80) { - // GENERAL_DIGESTS, seek; - // file.Seek(entry.offset, fsSeekSet); - } - - Common::FS::IOFile out(extract_path / "sce_sys" / name, Common::FS::FileAccessMode::Write); - if (!file.Seek(entry.offset)) { - failreason = "Failed to seek to PKG entry offset"; - return false; - } - - std::vector data; - data.resize(entry.size); - file.ReadRaw(data.data(), entry.size); - out.WriteRaw(data.data(), entry.size); - out.Close(); - - // Decrypt Np stuff and overwrite. - if (entry.id == 0x400 || entry.id == 0x401 || entry.id == 0x402 || - entry.id == 0x403) { // somehow 0x401 is not decrypting - decNp.resize(entry.size); - if (!file.Seek(entry.offset)) { - failreason = "Failed to seek to PKG entry offset"; - return false; - } - - std::vector data; - data.resize(entry.size); - file.ReadRaw(data.data(), entry.size); - - std::span cipherNp(data.data(), entry.size); - std::array concatenated_ivkey_dk3_; - std::memcpy(concatenated_ivkey_dk3_.data(), &entry, sizeof(entry)); - std::memcpy(concatenated_ivkey_dk3_.data() + sizeof(entry), dk3_.data(), sizeof(dk3_)); - PKG::crypto.ivKeyHASH256(concatenated_ivkey_dk3_, ivKey); - PKG::crypto.aesCbcCfb128DecryptEntry(ivKey, cipherNp, decNp); - - Common::FS::IOFile out(extract_path / "sce_sys" / name, - Common::FS::FileAccessMode::Write); - out.Write(decNp); - out.Close(); - } - - file.Seek(currentPos); - } - - // Read the seed - std::array seed; - if (!file.Seek(pkgheader.pfs_image_offset + 0x370)) { - failreason = "Failed to seek to PFS image offset"; - return false; - } - file.Read(seed); - - // Get data and tweak keys. - PKG::crypto.PfsGenCryptoKey(ekpfsKey, seed, dataKey, tweakKey); - const u32 length = pkgheader.pfs_cache_size * 0x2; // Seems to be ok. - - int num_blocks = 0; - std::vector pfsc(length); - if (length != 0) { - // Read encrypted pfs_image - std::vector pfs_encrypted(length); - file.Seek(pkgheader.pfs_image_offset); - file.Read(pfs_encrypted); - file.Close(); - // Decrypt the pfs_image. - std::vector pfs_decrypted(length); - PKG::crypto.decryptPFS(dataKey, tweakKey, pfs_encrypted, pfs_decrypted, 0); - - // Retrieve PFSC from decrypted pfs_image. - pfsc_offset = GetPFSCOffset(pfs_decrypted); - std::memcpy(pfsc.data(), pfs_decrypted.data() + pfsc_offset, length - pfsc_offset); - - PFSCHdr pfsChdr; - std::memcpy(&pfsChdr, pfsc.data(), sizeof(pfsChdr)); - - num_blocks = (int)(pfsChdr.data_length / pfsChdr.block_sz2); - sectorMap.resize(num_blocks + 1); // 8 bytes, need extra 1 to get the last offset. - - for (int i = 0; i < num_blocks + 1; i++) { - std::memcpy(§orMap[i], pfsc.data() + pfsChdr.block_offsets + i * 8, 8); - } - } - - u32 ent_size = 0; - u32 ndinode = 0; - int ndinode_counter = 0; - bool dinode_reached = false; - bool uroot_reached = false; - std::vector compressedData; - std::vector decompressedData(0x10000); - - // Get iNdoes and Dirents. - for (int i = 0; i < num_blocks; i++) { - const u64 sectorOffset = sectorMap[i]; - const u64 sectorSize = sectorMap[i + 1] - sectorOffset; - - compressedData.resize(sectorSize); - std::memcpy(compressedData.data(), pfsc.data() + sectorOffset, sectorSize); - - if (sectorSize == 0x10000) // Uncompressed data - std::memcpy(decompressedData.data(), compressedData.data(), 0x10000); - else if (sectorSize < 0x10000) // Compressed data - DecompressPFSC(compressedData, decompressedData); - - if (i == 0) { - std::memcpy(&ndinode, decompressedData.data() + 0x30, 4); // number of folders and files - } - - int occupied_blocks = - (ndinode * 0xA8) / 0x10000; // how many blocks(0x10000) are taken by iNodes. - if (((ndinode * 0xA8) % 0x10000) != 0) - occupied_blocks += 1; - - if (i >= 1 && i <= occupied_blocks) { // Get all iNodes, gives type, file size and location. - for (int p = 0; p < 0x10000; p += 0xA8) { - Inode node; - std::memcpy(&node, &decompressedData[p], sizeof(node)); - if (node.Mode == 0) { - break; - } - iNodeBuf.push_back(node); - } - } - - // let's deal with the root/uroot entries here. - // Sometimes it's more than 2 entries (Tomb Raider Remastered) - const std::string_view flat_path_table(&decompressedData[0x10], 15); - if (flat_path_table == "flat_path_table") { - uroot_reached = true; - } - - if (uroot_reached) { - for (int i = 0; i < 0x10000; i += ent_size) { - Dirent dirent; - std::memcpy(&dirent, &decompressedData[i], sizeof(dirent)); - ent_size = dirent.entsize; - if (dirent.ino != 0) { - ndinode_counter++; - } else { - // Set the the folder according to the current inode. - // Can be 2 or more (rarely) - auto parent_path = extract_path.parent_path(); - auto title_id = GetTitleID(); - - if (parent_path.filename() != title_id && - !fmt::UTF(extract_path.u8string()).data.ends_with("-UPDATE")) { - extractPaths[ndinode_counter] = parent_path / title_id; - } else { - // DLCs path has different structure - extractPaths[ndinode_counter] = extract_path; - } - uroot_reached = false; - break; - } - } - } - - const char dot = decompressedData[0x10]; - const std::string_view dotdot(&decompressedData[0x28], 2); - if (dot == '.' && dotdot == "..") { - dinode_reached = true; - } - - // Get folder and file names. - bool end_reached = false; - if (dinode_reached) { - for (int j = 0; j < 0x10000; j += ent_size) { // Skip the first parent and child. - Dirent dirent; - std::memcpy(&dirent, &decompressedData[j], sizeof(dirent)); - - // Stop here and continue the main loop - if (dirent.ino == 0) { - break; - } - - ent_size = dirent.entsize; - auto& table = fsTable.emplace_back(); - table.name = std::string(dirent.name, dirent.namelen); - table.inode = dirent.ino; - table.type = dirent.type; - - if (table.type == PFS_CURRENT_DIR) { - current_dir = extractPaths[table.inode]; - } - extractPaths[table.inode] = current_dir / std::filesystem::path(table.name); - - if (table.type == PFS_FILE || table.type == PFS_DIR) { - if (table.type == PFS_DIR) { // Create dirs. - std::filesystem::create_directory(extractPaths[table.inode]); - } - ndinode_counter++; - if ((ndinode_counter + 1) == ndinode) // 1 for the image itself (root). - end_reached = true; - } - } - if (end_reached) { - break; - } - } - } - return true; -} - -void PKG::ExtractFiles(const int index) { - int inode_number = fsTable[index].inode; - int inode_type = fsTable[index].type; - std::string inode_name = fsTable[index].name; - - if (inode_type == PFS_FILE) { - int sector_loc = iNodeBuf[inode_number].loc; - int nblocks = iNodeBuf[inode_number].Blocks; - int bsize = iNodeBuf[inode_number].Size; - - Common::FS::IOFile inflated; - inflated.Open(extractPaths[inode_number], Common::FS::FileAccessMode::Write); - - Common::FS::IOFile pkgFile; // Open the file for each iteration to avoid conflict. - pkgFile.Open(pkgpath, Common::FS::FileAccessMode::Read); - - int size_decompressed = 0; - std::vector compressedData; - std::vector decompressedData(0x10000); - - u64 pfsc_buf_size = 0x11000; // extra 0x1000 - std::vector pfsc(pfsc_buf_size); - std::vector pfs_decrypted(pfsc_buf_size); - - for (int j = 0; j < nblocks; j++) { - u64 sectorOffset = - sectorMap[sector_loc + j]; // offset into PFSC_image and not pfs_image. - u64 sectorSize = sectorMap[sector_loc + j + 1] - - sectorOffset; // indicates if data is compressed or not. - u64 fileOffset = (pkgheader.pfs_image_offset + pfsc_offset + sectorOffset); - u64 currentSector1 = - (pfsc_offset + sectorOffset) / 0x1000; // block size is 0x1000 for xts decryption. - - int sectorOffsetMask = (sectorOffset + pfsc_offset) & 0xFFFFF000; - int previousData = (sectorOffset + pfsc_offset) - sectorOffsetMask; - - pkgFile.Seek(fileOffset - previousData); - pkgFile.Read(pfsc); - - PKG::crypto.decryptPFS(dataKey, tweakKey, pfsc, pfs_decrypted, currentSector1); - - compressedData.resize(sectorSize); - std::memcpy(compressedData.data(), pfs_decrypted.data() + previousData, sectorSize); - - if (sectorSize == 0x10000) // Uncompressed data - std::memcpy(decompressedData.data(), compressedData.data(), 0x10000); - else if (sectorSize < 0x10000) // Compressed data - DecompressPFSC(compressedData, decompressedData); - - size_decompressed += 0x10000; - - if (j < nblocks - 1) { - inflated.WriteRaw(decompressedData.data(), decompressedData.size()); - } else { - // This is to remove the zeros at the end of the file. - const u32 write_size = decompressedData.size() - (size_decompressed - bsize); - inflated.WriteRaw(decompressedData.data(), write_size); - } - } - pkgFile.Close(); - inflated.Close(); - } -} diff --git a/src/core/file_format/pkg.h b/src/core/file_format/pkg.h deleted file mode 100644 index a488a2df8..000000000 --- a/src/core/file_format/pkg.h +++ /dev/null @@ -1,174 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include -#include -#include -#include -#include -#include "common/endian.h" -#include "core/crypto/crypto.h" -#include "pfs.h" -#include "trp.h" - -struct PKGHeader { - u32_be magic; // Magic - u32_be pkg_type; - u32_be pkg_0x8; // unknown field - u32_be pkg_file_count; - u32_be pkg_table_entry_count; - u16_be pkg_sc_entry_count; - u16_be pkg_table_entry_count_2; // same as pkg_entry_count - u32_be pkg_table_entry_offset; // file table offset - u32_be pkg_sc_entry_data_size; - u64_be pkg_body_offset; // offset of PKG entries - u64_be pkg_body_size; // length of all PKG entries - u64_be pkg_content_offset; - u64_be pkg_content_size; - u8 pkg_content_id[0x24]; // packages' content ID as a 36-byte string - u8 pkg_padding[0xC]; // padding - u32_be pkg_drm_type; // DRM type - u32_be pkg_content_type; // Content type - u32_be pkg_content_flags; // Content flags - u32_be pkg_promote_size; - u32_be pkg_version_date; - u32_be pkg_version_hash; - u32_be pkg_0x088; - u32_be pkg_0x08C; - u32_be pkg_0x090; - u32_be pkg_0x094; - u32_be pkg_iro_tag; - u32_be pkg_drm_type_version; - - u8 pkg_zeroes_1[0x60]; - - /* Digest table */ - u8 digest_entries1[0x20]; // sha256 digest for main entry 1 - u8 digest_entries2[0x20]; // sha256 digest for main entry 2 - u8 digest_table_digest[0x20]; // sha256 digest for digest table - u8 digest_body_digest[0x20]; // sha256 digest for main table - - u8 pkg_zeroes_2[0x280]; - - u32_be pkg_0x400; - - u32_be pfs_image_count; // count of PFS images - u64_be pfs_image_flags; // PFS flags - u64_be pfs_image_offset; // offset to start of external PFS image - u64_be pfs_image_size; // size of external PFS image - u64_be mount_image_offset; - u64_be mount_image_size; - u64_be pkg_size; - u32_be pfs_signed_size; - u32_be pfs_cache_size; - u8 pfs_image_digest[0x20]; - u8 pfs_signed_digest[0x20]; - u64_be pfs_split_size_nth_0; - u64_be pfs_split_size_nth_1; - - u8 pkg_zeroes_3[0xB50]; - - u8 pkg_digest[0x20]; -}; - -enum class PKGContentFlag { - FIRST_PATCH = 0x100000, - PATCHGO = 0x200000, - REMASTER = 0x400000, - PS_CLOUD = 0x800000, - GD_AC = 0x2000000, - NON_GAME = 0x4000000, - UNKNOWN_0x8000000 = 0x8000000, - SUBSEQUENT_PATCH = 0x40000000, - DELTA_PATCH = 0x41000000, - CUMULATIVE_PATCH = 0x60000000 -}; - -struct PKGEntry { - u32_be id; // File ID, useful for files without a filename entry - u32_be filename_offset; // Offset into the filenames table (ID 0x200) where this file's name is - // located - u32_be flags1; // Flags including encrypted flag, etc - u32_be flags2; // Flags including encryption key index, etc - u32_be offset; // Offset into PKG to find the file - u32_be size; // Size of the file - u64_be padding; // blank padding -}; -static_assert(sizeof(PKGEntry) == 32); - -class PKG { -public: - PKG(); - ~PKG(); - - bool Open(const std::filesystem::path& filepath, std::string& failreason); - void ExtractFiles(const int index); - bool Extract(const std::filesystem::path& filepath, const std::filesystem::path& extract, - std::string& failreason); - - std::vector sfo; - - u32 GetNumberOfFiles() { - return fsTable.size(); - } - - u64 GetPkgSize() { - return pkgSize; - } - - std::string GetPkgFlags() { - return pkgFlags; - } - - std::string_view GetTitleID() { - return std::string_view(pkgTitleID, 9); - } - - PKGHeader GetPkgHeader() { - return pkgheader; - } - - static bool isFlagSet(u32_be variable, PKGContentFlag flag) { - return (variable) & static_cast(flag); - } - - static constexpr std::array, 10> flagNames = { - {{PKGContentFlag::FIRST_PATCH, "FIRST_PATCH"}, - {PKGContentFlag::PATCHGO, "PATCHGO"}, - {PKGContentFlag::REMASTER, "REMASTER"}, - {PKGContentFlag::PS_CLOUD, "PS_CLOUD"}, - {PKGContentFlag::GD_AC, "GD_AC"}, - {PKGContentFlag::NON_GAME, "NON_GAME"}, - {PKGContentFlag::UNKNOWN_0x8000000, "UNKNOWN_0x8000000"}, - {PKGContentFlag::SUBSEQUENT_PATCH, "SUBSEQUENT_PATCH"}, - {PKGContentFlag::DELTA_PATCH, "DELTA_PATCH"}, - {PKGContentFlag::CUMULATIVE_PATCH, "CUMULATIVE_PATCH"}}}; - -private: - Crypto crypto; - TRP trp; - u64 pkgSize = 0; - char pkgTitleID[9]; - PKGHeader pkgheader; - std::string pkgFlags; - - std::unordered_map extractPaths; - std::vector fsTable; - std::vector iNodeBuf; - std::vector sectorMap; - u64 pfsc_offset; - - std::array dk3_; - std::array ivKey; - std::array imgKey; - std::array ekpfsKey; - std::array dataKey; - std::array tweakKey; - std::vector decNp; - - std::filesystem::path pkgpath; - std::filesystem::path current_dir; - std::filesystem::path extract_path; -}; diff --git a/src/core/file_format/pkg_type.cpp b/src/core/file_format/pkg_type.cpp deleted file mode 100644 index 464f0b993..000000000 --- a/src/core/file_format/pkg_type.cpp +++ /dev/null @@ -1,638 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include -#include -#include "pkg_type.h" - -struct PkgEntryValue { - u32 type; - std::string_view name; - - operator u32() const noexcept { - return type; - } -}; - -constexpr static std::array PkgEntries = {{ - {0x0001, "digests"}, - {0x0010, "entry_keys"}, - {0x0020, "image_key"}, - {0x0080, "general_digests"}, - {0x0100, "metas"}, - {0x0200, "entry_names"}, - {0x0400, "license.dat"}, - {0x0401, "license.info"}, - {0x0402, "nptitle.dat"}, - {0x0403, "npbind.dat"}, - {0x0404, "selfinfo.dat"}, - {0x0406, "imageinfo.dat"}, - {0x0407, "target-deltainfo.dat"}, - {0x0408, "origin-deltainfo.dat"}, - {0x0409, "psreserved.dat"}, - {0x1000, "param.sfo"}, - {0x1001, "playgo-chunk.dat"}, - {0x1002, "playgo-chunk.sha"}, - {0x1003, "playgo-manifest.xml"}, - {0x1004, "pronunciation.xml"}, - {0x1005, "pronunciation.sig"}, - {0x1006, "pic1.png"}, - {0x1007, "pubtoolinfo.dat"}, - {0x1008, "app/playgo-chunk.dat"}, - {0x1009, "app/playgo-chunk.sha"}, - {0x100A, "app/playgo-manifest.xml"}, - {0x100B, "shareparam.json"}, - {0x100C, "shareoverlayimage.png"}, - {0x100D, "save_data.png"}, - {0x100E, "shareprivacyguardimage.png"}, - {0x1200, "icon0.png"}, - {0x1201, "icon0_00.png"}, - {0x1202, "icon0_01.png"}, - {0x1203, "icon0_02.png"}, - {0x1204, "icon0_03.png"}, - {0x1205, "icon0_04.png"}, - {0x1206, "icon0_05.png"}, - {0x1207, "icon0_06.png"}, - {0x1208, "icon0_07.png"}, - {0x1209, "icon0_08.png"}, - {0x120A, "icon0_09.png"}, - {0x120B, "icon0_10.png"}, - {0x120C, "icon0_11.png"}, - {0x120D, "icon0_12.png"}, - {0x120E, "icon0_13.png"}, - {0x120F, "icon0_14.png"}, - {0x1210, "icon0_15.png"}, - {0x1211, "icon0_16.png"}, - {0x1212, "icon0_17.png"}, - {0x1213, "icon0_18.png"}, - {0x1214, "icon0_19.png"}, - {0x1215, "icon0_20.png"}, - {0x1216, "icon0_21.png"}, - {0x1217, "icon0_22.png"}, - {0x1218, "icon0_23.png"}, - {0x1219, "icon0_24.png"}, - {0x121A, "icon0_25.png"}, - {0x121B, "icon0_26.png"}, - {0x121C, "icon0_27.png"}, - {0x121D, "icon0_28.png"}, - {0x121E, "icon0_29.png"}, - {0x121F, "icon0_30.png"}, - {0x1220, "pic0.png"}, - {0x1240, "snd0.at9"}, - {0x1241, "pic1_00.png"}, - {0x1242, "pic1_01.png"}, - {0x1243, "pic1_02.png"}, - {0x1244, "pic1_03.png"}, - {0x1245, "pic1_04.png"}, - {0x1246, "pic1_05.png"}, - {0x1247, "pic1_06.png"}, - {0x1248, "pic1_07.png"}, - {0x1249, "pic1_08.png"}, - {0x124A, "pic1_09.png"}, - {0x124B, "pic1_10.png"}, - {0x124C, "pic1_11.png"}, - {0x124D, "pic1_12.png"}, - {0x124E, "pic1_13.png"}, - {0x124F, "pic1_14.png"}, - {0x1250, "pic1_15.png"}, - {0x1251, "pic1_16.png"}, - {0x1252, "pic1_17.png"}, - {0x1253, "pic1_18.png"}, - {0x1254, "pic1_19.png"}, - {0x1255, "pic1_20.png"}, - {0x1256, "pic1_21.png"}, - {0x1257, "pic1_22.png"}, - {0x1258, "pic1_23.png"}, - {0x1259, "pic1_24.png"}, - {0x125A, "pic1_25.png"}, - {0x125B, "pic1_26.png"}, - {0x125C, "pic1_27.png"}, - {0x125D, "pic1_28.png"}, - {0x125E, "pic1_29.png"}, - {0x125F, "pic1_30.png"}, - {0x1260, "changeinfo/changeinfo.xml"}, - {0x1261, "changeinfo/changeinfo_00.xml"}, - {0x1262, "changeinfo/changeinfo_01.xml"}, - {0x1263, "changeinfo/changeinfo_02.xml"}, - {0x1264, "changeinfo/changeinfo_03.xml"}, - {0x1265, "changeinfo/changeinfo_04.xml"}, - {0x1266, "changeinfo/changeinfo_05.xml"}, - {0x1267, "changeinfo/changeinfo_06.xml"}, - {0x1268, "changeinfo/changeinfo_07.xml"}, - {0x1269, "changeinfo/changeinfo_08.xml"}, - {0x126A, "changeinfo/changeinfo_09.xml"}, - {0x126B, "changeinfo/changeinfo_10.xml"}, - {0x126C, "changeinfo/changeinfo_11.xml"}, - {0x126D, "changeinfo/changeinfo_12.xml"}, - {0x126E, "changeinfo/changeinfo_13.xml"}, - {0x126F, "changeinfo/changeinfo_14.xml"}, - {0x1270, "changeinfo/changeinfo_15.xml"}, - {0x1271, "changeinfo/changeinfo_16.xml"}, - {0x1272, "changeinfo/changeinfo_17.xml"}, - {0x1273, "changeinfo/changeinfo_18.xml"}, - {0x1274, "changeinfo/changeinfo_19.xml"}, - {0x1275, "changeinfo/changeinfo_20.xml"}, - {0x1276, "changeinfo/changeinfo_21.xml"}, - {0x1277, "changeinfo/changeinfo_22.xml"}, - {0x1278, "changeinfo/changeinfo_23.xml"}, - {0x1279, "changeinfo/changeinfo_24.xml"}, - {0x127A, "changeinfo/changeinfo_25.xml"}, - {0x127B, "changeinfo/changeinfo_26.xml"}, - {0x127C, "changeinfo/changeinfo_27.xml"}, - {0x127D, "changeinfo/changeinfo_28.xml"}, - {0x127E, "changeinfo/changeinfo_29.xml"}, - {0x127F, "changeinfo/changeinfo_30.xml"}, - {0x1280, "icon0.dds"}, - {0x1281, "icon0_00.dds"}, - {0x1282, "icon0_01.dds"}, - {0x1283, "icon0_02.dds"}, - {0x1284, "icon0_03.dds"}, - {0x1285, "icon0_04.dds"}, - {0x1286, "icon0_05.dds"}, - {0x1287, "icon0_06.dds"}, - {0x1288, "icon0_07.dds"}, - {0x1289, "icon0_08.dds"}, - {0x128A, "icon0_09.dds"}, - {0x128B, "icon0_10.dds"}, - {0x128C, "icon0_11.dds"}, - {0x128D, "icon0_12.dds"}, - {0x128E, "icon0_13.dds"}, - {0x128F, "icon0_14.dds"}, - {0x1290, "icon0_15.dds"}, - {0x1291, "icon0_16.dds"}, - {0x1292, "icon0_17.dds"}, - {0x1293, "icon0_18.dds"}, - {0x1294, "icon0_19.dds"}, - {0x1295, "icon0_20.dds"}, - {0x1296, "icon0_21.dds"}, - {0x1297, "icon0_22.dds"}, - {0x1298, "icon0_23.dds"}, - {0x1299, "icon0_24.dds"}, - {0x129A, "icon0_25.dds"}, - {0x129B, "icon0_26.dds"}, - {0x129C, "icon0_27.dds"}, - {0x129D, "icon0_28.dds"}, - {0x129E, "icon0_29.dds"}, - {0x129F, "icon0_30.dds"}, - {0x12A0, "pic0.dds"}, - {0x12C0, "pic1.dds"}, - {0x12C1, "pic1_00.dds"}, - {0x12C2, "pic1_01.dds"}, - {0x12C3, "pic1_02.dds"}, - {0x12C4, "pic1_03.dds"}, - {0x12C5, "pic1_04.dds"}, - {0x12C6, "pic1_05.dds"}, - {0x12C7, "pic1_06.dds"}, - {0x12C8, "pic1_07.dds"}, - {0x12C9, "pic1_08.dds"}, - {0x12CA, "pic1_09.dds"}, - {0x12CB, "pic1_10.dds"}, - {0x12CC, "pic1_11.dds"}, - {0x12CD, "pic1_12.dds"}, - {0x12CE, "pic1_13.dds"}, - {0x12CF, "pic1_14.dds"}, - {0x12D0, "pic1_15.dds"}, - {0x12D1, "pic1_16.dds"}, - {0x12D2, "pic1_17.dds"}, - {0x12D3, "pic1_18.dds"}, - {0x12D4, "pic1_19.dds"}, - {0x12D5, "pic1_20.dds"}, - {0x12D6, "pic1_21.dds"}, - {0x12D7, "pic1_22.dds"}, - {0x12D8, "pic1_23.dds"}, - {0x12D9, "pic1_24.dds"}, - {0x12DA, "pic1_25.dds"}, - {0x12DB, "pic1_26.dds"}, - {0x12DC, "pic1_27.dds"}, - {0x12DD, "pic1_28.dds"}, - {0x12DE, "pic1_29.dds"}, - {0x12DF, "pic1_30.dds"}, - {0x1400, "trophy/trophy00.trp"}, - {0x1401, "trophy/trophy01.trp"}, - {0x1402, "trophy/trophy02.trp"}, - {0x1403, "trophy/trophy03.trp"}, - {0x1404, "trophy/trophy04.trp"}, - {0x1405, "trophy/trophy05.trp"}, - {0x1406, "trophy/trophy06.trp"}, - {0x1407, "trophy/trophy07.trp"}, - {0x1408, "trophy/trophy08.trp"}, - {0x1409, "trophy/trophy09.trp"}, - {0x140A, "trophy/trophy10.trp"}, - {0x140B, "trophy/trophy11.trp"}, - {0x140C, "trophy/trophy12.trp"}, - {0x140D, "trophy/trophy13.trp"}, - {0x140E, "trophy/trophy14.trp"}, - {0x140F, "trophy/trophy15.trp"}, - {0x1410, "trophy/trophy16.trp"}, - {0x1411, "trophy/trophy17.trp"}, - {0x1412, "trophy/trophy18.trp"}, - {0x1413, "trophy/trophy19.trp"}, - {0x1414, "trophy/trophy20.trp"}, - {0x1415, "trophy/trophy21.trp"}, - {0x1416, "trophy/trophy22.trp"}, - {0x1417, "trophy/trophy23.trp"}, - {0x1418, "trophy/trophy24.trp"}, - {0x1419, "trophy/trophy25.trp"}, - {0x141A, "trophy/trophy26.trp"}, - {0x141B, "trophy/trophy27.trp"}, - {0x141C, "trophy/trophy28.trp"}, - {0x141D, "trophy/trophy29.trp"}, - {0x141E, "trophy/trophy30.trp"}, - {0x141F, "trophy/trophy31.trp"}, - {0x1420, "trophy/trophy32.trp"}, - {0x1421, "trophy/trophy33.trp"}, - {0x1422, "trophy/trophy34.trp"}, - {0x1423, "trophy/trophy35.trp"}, - {0x1424, "trophy/trophy36.trp"}, - {0x1425, "trophy/trophy37.trp"}, - {0x1426, "trophy/trophy38.trp"}, - {0x1427, "trophy/trophy39.trp"}, - {0x1428, "trophy/trophy40.trp"}, - {0x1429, "trophy/trophy41.trp"}, - {0x142A, "trophy/trophy42.trp"}, - {0x142B, "trophy/trophy43.trp"}, - {0x142C, "trophy/trophy44.trp"}, - {0x142D, "trophy/trophy45.trp"}, - {0x142E, "trophy/trophy46.trp"}, - {0x142F, "trophy/trophy47.trp"}, - {0x1430, "trophy/trophy48.trp"}, - {0x1431, "trophy/trophy49.trp"}, - {0x1432, "trophy/trophy50.trp"}, - {0x1433, "trophy/trophy51.trp"}, - {0x1434, "trophy/trophy52.trp"}, - {0x1435, "trophy/trophy53.trp"}, - {0x1436, "trophy/trophy54.trp"}, - {0x1437, "trophy/trophy55.trp"}, - {0x1438, "trophy/trophy56.trp"}, - {0x1439, "trophy/trophy57.trp"}, - {0x143A, "trophy/trophy58.trp"}, - {0x143B, "trophy/trophy59.trp"}, - {0x143C, "trophy/trophy60.trp"}, - {0x143D, "trophy/trophy61.trp"}, - {0x143E, "trophy/trophy62.trp"}, - {0x143F, "trophy/trophy63.trp"}, - {0x1440, "trophy/trophy64.trp"}, - {0x1441, "trophy/trophy65.trp"}, - {0x1442, "trophy/trophy66.trp"}, - {0x1443, "trophy/trophy67.trp"}, - {0x1444, "trophy/trophy68.trp"}, - {0x1445, "trophy/trophy69.trp"}, - {0x1446, "trophy/trophy70.trp"}, - {0x1447, "trophy/trophy71.trp"}, - {0x1448, "trophy/trophy72.trp"}, - {0x1449, "trophy/trophy73.trp"}, - {0x144A, "trophy/trophy74.trp"}, - {0x144B, "trophy/trophy75.trp"}, - {0x144C, "trophy/trophy76.trp"}, - {0x144D, "trophy/trophy77.trp"}, - {0x144E, "trophy/trophy78.trp"}, - {0x144F, "trophy/trophy79.trp"}, - {0x1450, "trophy/trophy80.trp"}, - {0x1451, "trophy/trophy81.trp"}, - {0x1452, "trophy/trophy82.trp"}, - {0x1453, "trophy/trophy83.trp"}, - {0x1454, "trophy/trophy84.trp"}, - {0x1455, "trophy/trophy85.trp"}, - {0x1456, "trophy/trophy86.trp"}, - {0x1457, "trophy/trophy87.trp"}, - {0x1458, "trophy/trophy88.trp"}, - {0x1459, "trophy/trophy89.trp"}, - {0x145A, "trophy/trophy90.trp"}, - {0x145B, "trophy/trophy91.trp"}, - {0x145C, "trophy/trophy92.trp"}, - {0x145D, "trophy/trophy93.trp"}, - {0x145E, "trophy/trophy94.trp"}, - {0x145F, "trophy/trophy95.trp"}, - {0x1460, "trophy/trophy96.trp"}, - {0x1461, "trophy/trophy97.trp"}, - {0x1462, "trophy/trophy98.trp"}, - {0x1463, "trophy/trophy99.trp"}, - {0x1600, "keymap_rp/001.png"}, - {0x1601, "keymap_rp/002.png"}, - {0x1602, "keymap_rp/003.png"}, - {0x1603, "keymap_rp/004.png"}, - {0x1604, "keymap_rp/005.png"}, - {0x1605, "keymap_rp/006.png"}, - {0x1606, "keymap_rp/007.png"}, - {0x1607, "keymap_rp/008.png"}, - {0x1608, "keymap_rp/009.png"}, - {0x1609, "keymap_rp/010.png"}, - {0x1610, "keymap_rp/00/001.png"}, - {0x1611, "keymap_rp/00/002.png"}, - {0x1612, "keymap_rp/00/003.png"}, - {0x1613, "keymap_rp/00/004.png"}, - {0x1614, "keymap_rp/00/005.png"}, - {0x1615, "keymap_rp/00/006.png"}, - {0x1616, "keymap_rp/00/007.png"}, - {0x1617, "keymap_rp/00/008.png"}, - {0x1618, "keymap_rp/00/009.png"}, - {0x1619, "keymap_rp/00/010.png"}, - {0x1620, "keymap_rp/01/001.png"}, - {0x1621, "keymap_rp/01/002.png"}, - {0x1622, "keymap_rp/01/003.png"}, - {0x1623, "keymap_rp/01/004.png"}, - {0x1624, "keymap_rp/01/005.png"}, - {0x1625, "keymap_rp/01/006.png"}, - {0x1626, "keymap_rp/01/007.png"}, - {0x1627, "keymap_rp/01/008.png"}, - {0x1628, "keymap_rp/01/009.png"}, - {0x1629, "keymap_rp/01/010.png"}, - {0x1630, "keymap_rp/02/001.png"}, - {0x1631, "keymap_rp/02/002.png"}, - {0x1632, "keymap_rp/02/003.png"}, - {0x1633, "keymap_rp/02/004.png"}, - {0x1634, "keymap_rp/02/005.png"}, - {0x1635, "keymap_rp/02/006.png"}, - {0x1636, "keymap_rp/02/007.png"}, - {0x1637, "keymap_rp/02/008.png"}, - {0x1638, "keymap_rp/02/009.png"}, - {0x1639, "keymap_rp/02/010.png"}, - {0x1640, "keymap_rp/03/001.png"}, - {0x1641, "keymap_rp/03/002.png"}, - {0x1642, "keymap_rp/03/003.png"}, - {0x1643, "keymap_rp/03/004.png"}, - {0x1644, "keymap_rp/03/005.png"}, - {0x1645, "keymap_rp/03/006.png"}, - {0x1646, "keymap_rp/03/007.png"}, - {0x1647, "keymap_rp/03/008.png"}, - {0x1648, "keymap_rp/03/0010.png"}, - {0x1650, "keymap_rp/04/001.png"}, - {0x1651, "keymap_rp/04/002.png"}, - {0x1652, "keymap_rp/04/003.png"}, - {0x1653, "keymap_rp/04/004.png"}, - {0x1654, "keymap_rp/04/005.png"}, - {0x1655, "keymap_rp/04/006.png"}, - {0x1656, "keymap_rp/04/007.png"}, - {0x1657, "keymap_rp/04/008.png"}, - {0x1658, "keymap_rp/04/009.png"}, - {0x1659, "keymap_rp/04/010.png"}, - {0x1660, "keymap_rp/05/001.png"}, - {0x1661, "keymap_rp/05/002.png"}, - {0x1662, "keymap_rp/05/003.png"}, - {0x1663, "keymap_rp/05/004.png"}, - {0x1664, "keymap_rp/05/005.png"}, - {0x1665, "keymap_rp/05/006.png"}, - {0x1666, "keymap_rp/05/007.png"}, - {0x1667, "keymap_rp/05/008.png"}, - {0x1668, "keymap_rp/05/009.png"}, - {0x1669, "keymap_rp/05/010.png"}, - {0x1670, "keymap_rp/06/001.png"}, - {0x1671, "keymap_rp/06/002.png"}, - {0x1672, "keymap_rp/06/003.png"}, - {0x1673, "keymap_rp/06/004.png"}, - {0x1674, "keymap_rp/06/005.png"}, - {0x1675, "keymap_rp/06/006.png"}, - {0x1676, "keymap_rp/06/007.png"}, - {0x1677, "keymap_rp/06/008.png"}, - {0x1678, "keymap_rp/06/009.png"}, - {0x1679, "keymap_rp/06/010.png"}, - {0x1680, "keymap_rp/07/001.png"}, - {0x1681, "keymap_rp/07/002.png"}, - {0x1682, "keymap_rp/07/003.png"}, - {0x1683, "keymap_rp/07/004.png"}, - {0x1684, "keymap_rp/07/005.png"}, - {0x1685, "keymap_rp/07/006.png"}, - {0x1686, "keymap_rp/07/007.png"}, - {0x1687, "keymap_rp/07/008.png"}, - {0x1688, "keymap_rp/07/009.png"}, - {0x1689, "keymap_rp/07/010.png"}, - {0x1690, "keymap_rp/08/001.png"}, - {0x1691, "keymap_rp/08/002.png"}, - {0x1692, "keymap_rp/08/003.png"}, - {0x1693, "keymap_rp/08/004.png"}, - {0x1694, "keymap_rp/08/005.png"}, - {0x1695, "keymap_rp/08/006.png"}, - {0x1696, "keymap_rp/08/007.png"}, - {0x1697, "keymap_rp/08/008.png"}, - {0x1698, "keymap_rp/08/009.png"}, - {0x1699, "keymap_rp/08/010.png"}, - {0x16A0, "keymap_rp/09/001.png"}, - {0x16A1, "keymap_rp/09/002.png"}, - {0x16A2, "keymap_rp/09/003.png"}, - {0x16A3, "keymap_rp/09/004.png"}, - {0x16A4, "keymap_rp/09/005.png"}, - {0x16A5, "keymap_rp/09/006.png"}, - {0x16A6, "keymap_rp/09/007.png"}, - {0x16A7, "keymap_rp/09/008.png"}, - {0x16A8, "keymap_rp/09/009.png"}, - {0x16A9, "keymap_rp/09/010.png"}, - {0x16B0, "keymap_rp/10/001.png"}, - {0x16B1, "keymap_rp/10/002.png"}, - {0x16B2, "keymap_rp/10/003.png"}, - {0x16B3, "keymap_rp/10/004.png"}, - {0x16B4, "keymap_rp/10/005.png"}, - {0x16B5, "keymap_rp/10/006.png"}, - {0x16B6, "keymap_rp/10/007.png"}, - {0x16B7, "keymap_rp/10/008.png"}, - {0x16B8, "keymap_rp/10/009.png"}, - {0x16B9, "keymap_rp/10/010.png"}, - {0x16C0, "keymap_rp/11/001.png"}, - {0x16C1, "keymap_rp/11/002.png"}, - {0x16C2, "keymap_rp/11/003.png"}, - {0x16C3, "keymap_rp/11/004.png"}, - {0x16C4, "keymap_rp/11/005.png"}, - {0x16C5, "keymap_rp/11/006.png"}, - {0x16C6, "keymap_rp/11/007.png"}, - {0x16C7, "keymap_rp/11/008.png"}, - {0x16C8, "keymap_rp/11/009.png"}, - {0x16C9, "keymap_rp/11/010.png"}, - {0x16D0, "keymap_rp/12/001.png"}, - {0x16D1, "keymap_rp/12/002.png"}, - {0x16D2, "keymap_rp/12/003.png"}, - {0x16D3, "keymap_rp/12/004.png"}, - {0x16D4, "keymap_rp/12/005.png"}, - {0x16D5, "keymap_rp/12/006.png"}, - {0x16D6, "keymap_rp/12/007.png"}, - {0x16D7, "keymap_rp/12/008.png"}, - {0x16D8, "keymap_rp/12/009.png"}, - {0x16D9, "keymap_rp/12/010.png"}, - {0x16E0, "keymap_rp/13/001.png"}, - {0x16E1, "keymap_rp/13/002.png"}, - {0x16E2, "keymap_rp/13/003.png"}, - {0x16E3, "keymap_rp/13/004.png"}, - {0x16E4, "keymap_rp/13/005.png"}, - {0x16E5, "keymap_rp/13/006.png"}, - {0x16E6, "keymap_rp/13/007.png"}, - {0x16E7, "keymap_rp/13/008.png"}, - {0x16E8, "keymap_rp/13/009.png"}, - {0x16E9, "keymap_rp/13/010.png"}, - {0x16F0, "keymap_rp/14/001.png"}, - {0x16F1, "keymap_rp/14/002.png"}, - {0x16F2, "keymap_rp/14/003.png"}, - {0x16F3, "keymap_rp/14/004.png"}, - {0x16F4, "keymap_rp/14/005.png"}, - {0x16F5, "keymap_rp/14/006.png"}, - {0x16F6, "keymap_rp/14/007.png"}, - {0x16F7, "keymap_rp/14/008.png"}, - {0x16F8, "keymap_rp/14/009.png"}, - {0x16F9, "keymap_rp/14/010.png"}, - {0x1700, "keymap_rp/15/001.png"}, - {0x1701, "keymap_rp/15/002.png"}, - {0x1702, "keymap_rp/15/003.png"}, - {0x1703, "keymap_rp/15/004.png"}, - {0x1704, "keymap_rp/15/005.png"}, - {0x1705, "keymap_rp/15/006.png"}, - {0x1706, "keymap_rp/15/007.png"}, - {0x1707, "keymap_rp/15/008.png"}, - {0x1708, "keymap_rp/15/009.png"}, - {0x1709, "keymap_rp/15/010.png"}, - {0x1710, "keymap_rp/16/001.png"}, - {0x1711, "keymap_rp/16/002.png"}, - {0x1712, "keymap_rp/16/003.png"}, - {0x1713, "keymap_rp/16/004.png"}, - {0x1714, "keymap_rp/16/005.png"}, - {0x1715, "keymap_rp/16/006.png"}, - {0x1716, "keymap_rp/16/007.png"}, - {0x1717, "keymap_rp/16/008.png"}, - {0x1718, "keymap_rp/16/009.png"}, - {0x1719, "keymap_rp/16/010.png"}, - {0x1720, "keymap_rp/17/001.png"}, - {0x1721, "keymap_rp/17/002.png"}, - {0x1722, "keymap_rp/17/003.png"}, - {0x1723, "keymap_rp/17/004.png"}, - {0x1724, "keymap_rp/17/005.png"}, - {0x1725, "keymap_rp/17/006.png"}, - {0x1726, "keymap_rp/17/007.png"}, - {0x1727, "keymap_rp/17/008.png"}, - {0x1728, "keymap_rp/17/009.png"}, - {0x1729, "keymap_rp/17/010.png"}, - {0x1730, "keymap_rp/18/001.png"}, - {0x1731, "keymap_rp/18/002.png"}, - {0x1732, "keymap_rp/18/003.png"}, - {0x1733, "keymap_rp/18/004.png"}, - {0x1734, "keymap_rp/18/005.png"}, - {0x1735, "keymap_rp/18/006.png"}, - {0x1736, "keymap_rp/18/007.png"}, - {0x1737, "keymap_rp/18/008.png"}, - {0x1738, "keymap_rp/18/009.png"}, - {0x1739, "keymap_rp/18/010.png"}, - {0x1740, "keymap_rp/19/001.png"}, - {0x1741, "keymap_rp/19/002.png"}, - {0x1742, "keymap_rp/19/003.png"}, - {0x1743, "keymap_rp/19/004.png"}, - {0x1744, "keymap_rp/19/005.png"}, - {0x1745, "keymap_rp/19/006.png"}, - {0x1746, "keymap_rp/19/007.png"}, - {0x1747, "keymap_rp/19/008.png"}, - {0x1748, "keymap_rp/19/009.png"}, - {0x1749, "keymap_rp/19/010.png"}, - {0x1750, "keymap_rp/20/001.png"}, - {0x1751, "keymap_rp/20/002.png"}, - {0x1752, "keymap_rp/20/003.png"}, - {0x1753, "keymap_rp/20/004.png"}, - {0x1754, "keymap_rp/20/005.png"}, - {0x1755, "keymap_rp/20/006.png"}, - {0x1756, "keymap_rp/20/007.png"}, - {0x1757, "keymap_rp/20/008.png"}, - {0x1758, "keymap_rp/20/009.png"}, - {0x1759, "keymap_rp/20/010.png"}, - {0x1760, "keymap_rp/21/001.png"}, - {0x1761, "keymap_rp/21/002.png"}, - {0x1762, "keymap_rp/21/003.png"}, - {0x1763, "keymap_rp/21/004.png"}, - {0x1764, "keymap_rp/21/005.png"}, - {0x1765, "keymap_rp/21/006.png"}, - {0x1766, "keymap_rp/21/007.png"}, - {0x1767, "keymap_rp/21/008.png"}, - {0x1768, "keymap_rp/21/009.png"}, - {0x1769, "keymap_rp/21/010.png"}, - {0x1770, "keymap_rp/22/001.png"}, - {0x1771, "keymap_rp/22/002.png"}, - {0x1772, "keymap_rp/22/003.png"}, - {0x1773, "keymap_rp/22/004.png"}, - {0x1774, "keymap_rp/22/005.png"}, - {0x1775, "keymap_rp/22/006.png"}, - {0x1776, "keymap_rp/22/007.png"}, - {0x1777, "keymap_rp/22/008.png"}, - {0x1778, "keymap_rp/22/009.png"}, - {0x1779, "keymap_rp/22/010.png"}, - {0x1780, "keymap_rp/23/001.png"}, - {0x1781, "keymap_rp/23/002.png"}, - {0x1782, "keymap_rp/23/003.png"}, - {0x1783, "keymap_rp/23/004.png"}, - {0x1784, "keymap_rp/23/005.png"}, - {0x1785, "keymap_rp/23/006.png"}, - {0x1786, "keymap_rp/23/007.png"}, - {0x1787, "keymap_rp/23/008.png"}, - {0x1788, "keymap_rp/23/009.png"}, - {0x1789, "keymap_rp/23/010.png"}, - {0x1790, "keymap_rp/24/001.png"}, - {0x1791, "keymap_rp/24/002.png"}, - {0x1792, "keymap_rp/24/003.png"}, - {0x1793, "keymap_rp/24/004.png"}, - {0x1794, "keymap_rp/24/005.png"}, - {0x1795, "keymap_rp/24/006.png"}, - {0x1796, "keymap_rp/24/007.png"}, - {0x1797, "keymap_rp/24/008.png"}, - {0x1798, "keymap_rp/24/009.png"}, - {0x1799, "keymap_rp/24/010.png"}, - {0x17A0, "keymap_rp/25/001.png"}, - {0x17A1, "keymap_rp/25/002.png"}, - {0x17A2, "keymap_rp/25/003.png"}, - {0x17A3, "keymap_rp/25/004.png"}, - {0x17A4, "keymap_rp/25/005.png"}, - {0x17A5, "keymap_rp/25/006.png"}, - {0x17A6, "keymap_rp/25/007.png"}, - {0x17A7, "keymap_rp/25/008.png"}, - {0x17A8, "keymap_rp/25/009.png"}, - {0x17A9, "keymap_rp/25/010.png"}, - {0x17B0, "keymap_rp/26/001.png"}, - {0x17B1, "keymap_rp/26/002.png"}, - {0x17B2, "keymap_rp/26/003.png"}, - {0x17B3, "keymap_rp/26/004.png"}, - {0x17B4, "keymap_rp/26/005.png"}, - {0x17B5, "keymap_rp/26/006.png"}, - {0x17B6, "keymap_rp/26/007.png"}, - {0x17B7, "keymap_rp/26/008.png"}, - {0x17B8, "keymap_rp/26/009.png"}, - {0x17B9, "keymap_rp/26/010.png"}, - {0x17C0, "keymap_rp/27/001.png"}, - {0x17C1, "keymap_rp/27/002.png"}, - {0x17C2, "keymap_rp/27/003.png"}, - {0x17C3, "keymap_rp/27/004.png"}, - {0x17C4, "keymap_rp/27/005.png"}, - {0x17C5, "keymap_rp/27/006.png"}, - {0x17C6, "keymap_rp/27/007.png"}, - {0x17C7, "keymap_rp/27/008.png"}, - {0x17C8, "keymap_rp/27/009.png"}, - {0x17C9, "keymap_rp/27/010.png"}, - {0x17D0, "keymap_rp/28/001.png"}, - {0x17D1, "keymap_rp/28/002.png"}, - {0x17D2, "keymap_rp/28/003.png"}, - {0x17D3, "keymap_rp/28/004.png"}, - {0x17D4, "keymap_rp/28/005.png"}, - {0x17D5, "keymap_rp/28/006.png"}, - {0x17D6, "keymap_rp/28/007.png"}, - {0x17D7, "keymap_rp/28/008.png"}, - {0x17D8, "keymap_rp/28/009.png"}, - {0x17D9, "keymap_rp/28/010.png"}, - {0x17E0, "keymap_rp/29/001.png"}, - {0x17E1, "keymap_rp/29/002.png"}, - {0x17E2, "keymap_rp/29/003.png"}, - {0x17E3, "keymap_rp/29/004.png"}, - {0x17E4, "keymap_rp/29/005.png"}, - {0x17E5, "keymap_rp/29/006.png"}, - {0x17E6, "keymap_rp/29/007.png"}, - {0x17E7, "keymap_rp/29/008.png"}, - {0x17E8, "keymap_rp/29/009.png"}, - {0x17E9, "keymap_rp/29/010.png"}, - {0x17F0, "keymap_rp/30/001.png"}, - {0x17F1, "keymap_rp/30/002.png"}, - {0x17F2, "keymap_rp/30/003.png"}, - {0x17F3, "keymap_rp/30/004.png"}, - {0x17F4, "keymap_rp/30/005.png"}, - {0x17F5, "keymap_rp/30/006.png"}, - {0x17F6, "keymap_rp/30/007.png"}, - {0x17F7, "keymap_rp/30/008.png"}, - {0x17F8, "keymap_rp/30/009.png"}, - {0x17F9, "keymap_rp/30/010.png"}, -}}; - -std::string_view GetEntryNameByType(u32 type) { - const auto key = PkgEntryValue{type}; - const auto it = std::ranges::lower_bound(PkgEntries, key); - if (it != PkgEntries.end() && it->type == type) { - return it->name; - } - return ""; -} diff --git a/src/core/file_format/pkg_type.h b/src/core/file_format/pkg_type.h deleted file mode 100644 index 6b010e3a3..000000000 --- a/src/core/file_format/pkg_type.h +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include -#include "common/types.h" - -/// Retrieves the PKG entry name from its type identifier. -std::string_view GetEntryNameByType(u32 type); diff --git a/src/core/file_format/trp.cpp b/src/core/file_format/trp.cpp index d25c93c3f..a5d11b0eb 100644 --- a/src/core/file_format/trp.cpp +++ b/src/core/file_format/trp.cpp @@ -1,10 +1,25 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "common/aes.h" #include "common/config.h" #include "common/logging/log.h" #include "common/path_util.h" -#include "trp.h" +#include "core/file_format/trp.h" + +static void DecryptEFSM(std::span trophyKey, std::span NPcommID, + std::span efsmIv, std::span ciphertext, + std::span decrypted) { + // Step 1: Encrypt NPcommID + std::array trophyIv{}; + std::array trpKey; + aes::encrypt_cbc(NPcommID.data(), NPcommID.size(), trophyKey.data(), trophyKey.size(), + trophyIv.data(), trpKey.data(), trpKey.size(), false); + + // Step 2: Decrypt EFSM + aes::decrypt_cbc(ciphertext.data(), ciphertext.size(), trpKey.data(), trpKey.size(), + efsmIv.data(), decrypted.data(), decrypted.size(), nullptr); +} TRP::TRP() = default; TRP::~TRP() = default; @@ -54,7 +69,7 @@ bool TRP::Extract(const std::filesystem::path& trophyPath, const std::string tit return false; } - std::array user_key{}; + std::array user_key{}; hexToBytes(user_key_str.c_str(), user_key.data()); for (int index = 0; const auto& it : std::filesystem::directory_iterator(gameSysDir)) { @@ -115,7 +130,7 @@ bool TRP::Extract(const std::filesystem::path& trophyPath, const std::string tit return false; } file.Read(ESFM); - crypto.decryptEFSM(user_key, np_comm_id, esfmIv, ESFM, XML); // decrypt + DecryptEFSM(user_key, np_comm_id, esfmIv, ESFM, XML); // decrypt removePadding(XML); std::string xml_name = entry.entry_name; size_t pos = xml_name.find("ESFM"); diff --git a/src/core/file_format/trp.h b/src/core/file_format/trp.h index aec129f0e..01207475b 100644 --- a/src/core/file_format/trp.h +++ b/src/core/file_format/trp.h @@ -7,7 +7,6 @@ #include "common/endian.h" #include "common/io_file.h" #include "common/types.h" -#include "core/crypto/crypto.h" struct TrpHeader { u32_be magic; // (0xDCA24D00) @@ -37,10 +36,9 @@ public: void GetNPcommID(const std::filesystem::path& trophyPath, int index); private: - Crypto crypto; std::vector NPcommID = std::vector(12); std::array np_comm_id{}; std::array esfmIv{}; std::filesystem::path trpFilesPath; static constexpr int iv_len = 16; -}; \ No newline at end of file +}; diff --git a/src/core/file_sys/fs.cpp b/src/core/file_sys/fs.cpp index ec940503f..4dad44874 100644 --- a/src/core/file_sys/fs.cpp +++ b/src/core/file_sys/fs.cpp @@ -70,6 +70,10 @@ std::filesystem::path MntPoints::GetHostPath(std::string_view path, bool* is_rea std::filesystem::path host_path = mount->host_path / rel_path; std::filesystem::path patch_path = mount->host_path; patch_path += "-UPDATE"; + if (!std::filesystem::exists(patch_path)) { + patch_path = mount->host_path; + patch_path += "-patch"; + } patch_path /= rel_path; if ((corrected_path.starts_with("/app0") || corrected_path.starts_with("/hostapp")) && diff --git a/src/core/libraries/disc_map/disc_map.cpp b/src/core/libraries/disc_map/disc_map.cpp index bb566a149..e8b40e624 100644 --- a/src/core/libraries/disc_map/disc_map.cpp +++ b/src/core/libraries/disc_map/disc_map.cpp @@ -9,29 +9,29 @@ namespace Libraries::DiscMap { -int PS4_SYSV_ABI sceDiscMapGetPackageSize() { - LOG_WARNING(Lib_DiscMap, "(DUMMY) called"); +int PS4_SYSV_ABI sceDiscMapGetPackageSize(s64 fflags, int* ret1, int* ret2) { return ORBIS_DISC_MAP_ERROR_NO_BITMAP_INFO; } -int PS4_SYSV_ABI sceDiscMapIsRequestOnHDD() { - LOG_WARNING(Lib_DiscMap, "(DUMMY) called"); +int PS4_SYSV_ABI sceDiscMapIsRequestOnHDD(char* path, s64 offset, s64 nbytes, int* ret) { return ORBIS_DISC_MAP_ERROR_NO_BITMAP_INFO; } -int PS4_SYSV_ABI Func_7C980FFB0AA27E7A() { - LOG_ERROR(Lib_DiscMap, "(STUBBED) called"); +int PS4_SYSV_ABI Func_7C980FFB0AA27E7A(char* path, s64 offset, s64 nbytes, int* flags, int* ret1, + int* ret2) { + *flags = 0; + *ret1 = 0; + *ret2 = 0; return ORBIS_OK; } -int PS4_SYSV_ABI Func_8A828CAEE7EDD5E9() { - LOG_ERROR(Lib_DiscMap, "(STUBBED) called"); - return ORBIS_OK; +int PS4_SYSV_ABI Func_8A828CAEE7EDD5E9(char* path, s64 offset, s64 nbytes, int* flags, int* ret1, + int* ret2) { + return ORBIS_DISC_MAP_ERROR_NO_BITMAP_INFO; } int PS4_SYSV_ABI Func_E7EBCE96E92F91F8() { - LOG_ERROR(Lib_DiscMap, "(STUBBED) called"); - return ORBIS_OK; + return ORBIS_DISC_MAP_ERROR_NO_BITMAP_INFO; } void RegisterlibSceDiscMap(Core::Loader::SymbolsResolver* sym) { diff --git a/src/core/libraries/disc_map/disc_map.h b/src/core/libraries/disc_map/disc_map.h index 08abee632..dc8b875ac 100644 --- a/src/core/libraries/disc_map/disc_map.h +++ b/src/core/libraries/disc_map/disc_map.h @@ -10,10 +10,12 @@ class SymbolsResolver; } namespace Libraries::DiscMap { -int PS4_SYSV_ABI sceDiscMapGetPackageSize(); -int PS4_SYSV_ABI sceDiscMapIsRequestOnHDD(); -int PS4_SYSV_ABI Func_7C980FFB0AA27E7A(); -int PS4_SYSV_ABI Func_8A828CAEE7EDD5E9(); +int PS4_SYSV_ABI sceDiscMapGetPackageSize(s64 fflags, int* ret1, int* ret2); +int PS4_SYSV_ABI sceDiscMapIsRequestOnHDD(char* path, s64 offset, s64 nbytes, int* ret); +int PS4_SYSV_ABI Func_7C980FFB0AA27E7A(char* path, s64 offset, s64 nbytes, int* flags, int* ret1, + int* ret2); +int PS4_SYSV_ABI Func_8A828CAEE7EDD5E9(char* path, s64 offset, s64 nbytes, int* flags, int* ret1, + int* ret2); int PS4_SYSV_ABI Func_E7EBCE96E92F91F8(); void RegisterlibSceDiscMap(Core::Loader::SymbolsResolver* sym); diff --git a/src/core/libraries/kernel/debug.cpp b/src/core/libraries/kernel/debug.cpp new file mode 100644 index 000000000..0de67b8b5 --- /dev/null +++ b/src/core/libraries/kernel/debug.cpp @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "common/assert.h" +#include "core/libraries/kernel/file_system.h" +#include "core/libraries/kernel/orbis_error.h" +#include "core/libraries/libs.h" + +namespace Libraries::Kernel { + +void PS4_SYSV_ABI sceKernelDebugOutText(void* unk, char* text) { + sceKernelWrite(1, text, strlen(text)); + return; +} + +void RegisterDebug(Core::Loader::SymbolsResolver* sym) { + LIB_FUNCTION("9JYNqN6jAKI", "libkernel", 1, "libkernel", 1, 1, sceKernelDebugOutText); +} + +} // namespace Libraries::Kernel \ No newline at end of file diff --git a/src/core/libraries/kernel/debug.h b/src/core/libraries/kernel/debug.h new file mode 100644 index 000000000..177046862 --- /dev/null +++ b/src/core/libraries/kernel/debug.h @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +namespace Core::Loader { +class SymbolsResolver; +} + +namespace Libraries::Kernel { + +void RegisterDebug(Core::Loader::SymbolsResolver* sym); + +} // namespace Libraries::Kernel \ No newline at end of file diff --git a/src/core/libraries/kernel/file_system.cpp b/src/core/libraries/kernel/file_system.cpp index 0150c11f5..3321559ed 100644 --- a/src/core/libraries/kernel/file_system.cpp +++ b/src/core/libraries/kernel/file_system.cpp @@ -18,6 +18,7 @@ #include "core/file_sys/fs.h" #include "core/libraries/kernel/file_system.h" #include "core/libraries/kernel/orbis_error.h" +#include "core/libraries/kernel/posix_error.h" #include "core/libraries/libs.h" #include "core/memory.h" #include "kernel.h" @@ -57,7 +58,7 @@ static std::map available_device = { namespace Libraries::Kernel { -int PS4_SYSV_ABI sceKernelOpen(const char* raw_path, int flags, u16 mode) { +s32 PS4_SYSV_ABI open(const char* raw_path, s32 flags, u16 mode) { LOG_INFO(Kernel_Fs, "path = {} flags = {:#x} mode = {}", raw_path, flags, mode); auto* h = Common::Singleton::Instance(); auto* mnt = Common::Singleton::Instance(); @@ -99,7 +100,8 @@ int PS4_SYSV_ABI sceKernelOpen(const char* raw_path, int flags, u16 mode) { file->m_host_name = mnt->GetHostPath(file->m_guest_name); if (!std::filesystem::is_directory(file->m_host_name)) { // directory doesn't exist h->DeleteHandle(handle); - return ORBIS_KERNEL_ERROR_ENOTDIR; + *__Error() = POSIX_ENOENT; + return -1; } else { if (create) { return handle; // dir already exists @@ -116,61 +118,87 @@ int PS4_SYSV_ABI sceKernelOpen(const char* raw_path, int flags, u16 mode) { } else { file->m_guest_name = path; file->m_host_name = mnt->GetHostPath(file->m_guest_name); + bool exists = std::filesystem::exists(file->m_host_name); int e = 0; - if (read) { - e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Read); - } else if (write && (create || truncate)) { - e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Write); - } else if (write && create && append) { // CUSA04729 (appends app0/shaderlist.txt) - e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Append); - } else if (rdwr) { - if (create) { // Create an empty file first. - Common::FS::IOFile out(file->m_host_name, Common::FS::FileAccessMode::Write); + + if (create) { + if (excl && exists) { + // Error if file exists + h->DeleteHandle(handle); + *__Error() = POSIX_EEXIST; + return -1; } - // RW, then scekernelWrite is called and savedata is written just fine now. - e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::ReadWrite); - } else if (write) { - e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Write); - } else { - UNREACHABLE(); - } - if (e != 0) { + // Create file if it doesn't exist + Common::FS::IOFile out(file->m_host_name, Common::FS::FileAccessMode::Write); + } else if (!exists) { + // File to open doesn't exist, return ENOENT h->DeleteHandle(handle); - return ErrnoToSceKernelError(e); + *__Error() = POSIX_ENOENT; + return -1; + } + + if (read) { + // Read only + e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Read); + } else if (write) { + // Write only + if (append) { + e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Append); + } else { + e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Write); + } + } else if (rdwr) { + // Read and write + if (append) { + e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Append); + } else { + e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::ReadWrite); + } + } else { + // Invalid flags + *__Error() = POSIX_EINVAL; + return -1; + } + + if (truncate && e == 0) { + // If the file was opened successfully and truncate was enabled, reduce size to 0 + file->f.SetSize(0); + } + + if (e != 0) { + // Open failed in platform-specific code, errno needs to be converted. + h->DeleteHandle(handle); + SetPosixErrno(e); + return -1; } } file->is_opened = true; return handle; } -int PS4_SYSV_ABI posix_open(const char* path, int flags, /* SceKernelMode*/ u16 mode) { - LOG_INFO(Kernel_Fs, "posix open redirect to sceKernelOpen"); - int result = sceKernelOpen(path, flags, mode); - // Posix calls different only for their return values +s32 PS4_SYSV_ABI posix_open(const char* filename, s32 flags, u16 mode) { + return open(filename, flags, mode); +} + +s32 PS4_SYSV_ABI sceKernelOpen(const char* path, s32 flags, /* SceKernelMode*/ u16 mode) { + s32 result = open(path, flags, mode); if (result < 0) { - ErrSceToPosix(result); - return -1; + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); } return result; } -int PS4_SYSV_ABI open(const char* filename, const char* mode) { - LOG_INFO(Kernel_Fs, "open redirect to sceKernelOpen"); - int result = sceKernelOpen(filename, ORBIS_KERNEL_O_RDWR, 0); - if (result < 0) { - return -1; - } - return result; -} - -int PS4_SYSV_ABI sceKernelClose(int d) { - if (d < 3) { // d probably hold an error code - return ORBIS_KERNEL_ERROR_EPERM; +s32 PS4_SYSV_ABI close(s32 fd) { + if (fd < 3) { + // This is technically possible, but it's usually caused by some stubbed function instead. + LOG_WARNING(Kernel_Fs, "called on an std handle, fd = {}", fd); } auto* h = Common::Singleton::Instance(); - auto* file = h->GetFile(d); + auto* file = h->GetFile(fd); if (file == nullptr) { - return ORBIS_KERNEL_ERROR_EBADF; + *__Error() = POSIX_EBADF; + return -1; } if (file->type == Core::FileSys::FileType::Regular) { file->f.Close(); @@ -178,63 +206,54 @@ int PS4_SYSV_ABI sceKernelClose(int d) { file->is_opened = false; LOG_INFO(Kernel_Fs, "Closing {}", file->m_guest_name); // FIXME: Lock file mutex before deleting it? - h->DeleteHandle(d); + h->DeleteHandle(fd); return ORBIS_OK; } -int PS4_SYSV_ABI posix_close(int d) { - int result = sceKernelClose(d); +s32 PS4_SYSV_ABI posix_close(s32 fd) { + return close(fd); +} + +s32 PS4_SYSV_ABI sceKernelClose(s32 fd) { + s32 result = close(fd); if (result < 0) { - LOG_ERROR(Kernel_Pthread, "posix_close: error = {}", result); - ErrSceToPosix(result); - return -1; + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); } return result; } -s64 PS4_SYSV_ABI sceKernelWrite(int d, const void* buf, size_t nbytes) { +s64 PS4_SYSV_ABI write(s32 fd, const void* buf, size_t nbytes) { auto* h = Common::Singleton::Instance(); - auto* file = h->GetFile(d); + auto* file = h->GetFile(fd); if (file == nullptr) { - return ORBIS_KERNEL_ERROR_EBADF; + *__Error() = POSIX_EBADF; + return -1; } std::scoped_lock lk{file->m_mutex}; if (file->type == Core::FileSys::FileType::Device) { - return file->device->write(buf, nbytes); + s64 result = file->device->write(buf, nbytes); + if (result < 0) { + ErrSceToPosix(result); + return -1; + } + return result; } return file->f.WriteRaw(buf, nbytes); } -int PS4_SYSV_ABI sceKernelUnlink(const char* path) { - if (path == nullptr) { - return ORBIS_KERNEL_ERROR_EINVAL; +s64 PS4_SYSV_ABI posix_write(s32 fd, const void* buf, size_t nbytes) { + return write(fd, buf, nbytes); +} + +s64 PS4_SYSV_ABI sceKernelWrite(s32 fd, const void* buf, size_t nbytes) { + s64 result = write(fd, buf, nbytes); + if (result < 0) { + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); } - - auto* h = Common::Singleton::Instance(); - auto* mnt = Common::Singleton::Instance(); - - bool ro = false; - const auto host_path = mnt->GetHostPath(path, &ro); - if (host_path.empty()) { - return ORBIS_KERNEL_ERROR_EACCES; - } - - if (ro) { - return ORBIS_KERNEL_ERROR_EROFS; - } - - if (std::filesystem::is_directory(host_path)) { - return ORBIS_KERNEL_ERROR_EPERM; - } - - auto* file = h->GetFile(host_path); - if (file != nullptr) { - file->f.Unlink(); - } - - LOG_INFO(Kernel_Fs, "Unlinked {}", path); - return ORBIS_OK; + return result; } size_t ReadFile(Common::FS::IOFile& file, void* buf, size_t nbytes) { @@ -246,58 +265,97 @@ size_t ReadFile(Common::FS::IOFile& file, void* buf, size_t nbytes) { return file.ReadRaw(buf, nbytes); } -size_t PS4_SYSV_ABI _readv(int d, const SceKernelIovec* iov, int iovcnt) { +size_t PS4_SYSV_ABI readv(s32 fd, const SceKernelIovec* iov, s32 iovcnt) { auto* h = Common::Singleton::Instance(); - auto* file = h->GetFile(d); + auto* file = h->GetFile(fd); if (file == nullptr) { - return ORBIS_KERNEL_ERROR_EBADF; + *__Error() = POSIX_EBADF; + return -1; } std::scoped_lock lk{file->m_mutex}; if (file->type == Core::FileSys::FileType::Device) { - int r = file->device->readv(iov, iovcnt); - if (r < 0) { - ErrSceToPosix(r); + size_t result = file->device->readv(iov, iovcnt); + if (result < 0) { + ErrSceToPosix(result); return -1; } - return r; + return result; } size_t total_read = 0; - for (int i = 0; i < iovcnt; i++) { + for (s32 i = 0; i < iovcnt; i++) { total_read += ReadFile(file->f, iov[i].iov_base, iov[i].iov_len); } return total_read; } -size_t PS4_SYSV_ABI _writev(int fd, const SceKernelIovec* iov, int iovcn) { +size_t PS4_SYSV_ABI posix_readv(s32 fd, const SceKernelIovec* iov, s32 iovcnt) { + return readv(fd, iov, iovcnt); +} + +size_t PS4_SYSV_ABI sceKernelReadv(s32 fd, const SceKernelIovec* iov, s32 iovcnt) { + size_t result = readv(fd, iov, iovcnt); + if (result < 0) { + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); + } + return result; +} + +size_t PS4_SYSV_ABI writev(s32 fd, const SceKernelIovec* iov, s32 iovcnt) { auto* h = Common::Singleton::Instance(); auto* file = h->GetFile(fd); if (file == nullptr) { - return ORBIS_KERNEL_ERROR_EBADF; + *__Error() = POSIX_EBADF; + return -1; } std::scoped_lock lk{file->m_mutex}; if (file->type == Core::FileSys::FileType::Device) { - return file->device->writev(iov, iovcn); + size_t result = file->device->writev(iov, iovcnt); + if (result < 0) { + ErrSceToPosix(result); + return -1; + } + return result; } size_t total_written = 0; - for (int i = 0; i < iovcn; i++) { + for (s32 i = 0; i < iovcnt; i++) { total_written += file->f.WriteRaw(iov[i].iov_base, iov[i].iov_len); } return total_written; } -s64 PS4_SYSV_ABI sceKernelLseek(int d, s64 offset, int whence) { +size_t PS4_SYSV_ABI posix_writev(s32 fd, const SceKernelIovec* iov, s32 iovcnt) { + return writev(fd, iov, iovcnt); +} + +size_t PS4_SYSV_ABI sceKernelWritev(s32 fd, const SceKernelIovec* iov, s32 iovcnt) { + size_t result = writev(fd, iov, iovcnt); + if (result < 0) { + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); + } + return result; +} + +s64 PS4_SYSV_ABI posix_lseek(s32 fd, s64 offset, s32 whence) { auto* h = Common::Singleton::Instance(); - auto* file = h->GetFile(d); + auto* file = h->GetFile(fd); if (file == nullptr) { - return ORBIS_KERNEL_ERROR_EBADF; + *__Error() = POSIX_EBADF; + return -1; } std::scoped_lock lk{file->m_mutex}; if (file->type == Core::FileSys::FileType::Device) { - return file->device->lseek(offset, whence); + s64 result = file->device->lseek(offset, whence); + if (result < 0) { + ErrSceToPosix(result); + return -1; + } + return result; } Common::FS::SeekOrigin origin{}; @@ -307,53 +365,82 @@ s64 PS4_SYSV_ABI sceKernelLseek(int d, s64 offset, int whence) { origin = Common::FS::SeekOrigin::CurrentPosition; } else if (whence == 2) { origin = Common::FS::SeekOrigin::End; + } else if (whence == 3) { + origin = Common::FS::SeekOrigin::SeekHole; + } else if (whence == 4) { + origin = Common::FS::SeekOrigin::SeekData; + } else { + // whence parameter is invalid + *__Error() = POSIX_EINVAL; + return -1; } if (!file->f.Seek(offset, origin)) { - LOG_CRITICAL(Kernel_Fs, "sceKernelLseek: failed to seek"); - return ORBIS_KERNEL_ERROR_EINVAL; + if (errno != 0) { + // Seek failed in platform-specific code, errno needs to be converted. + SetPosixErrno(errno); + return -1; + } + // Shouldn't be possible, but just in case. + return -1; } - return file->f.Tell(); -} -s64 PS4_SYSV_ABI posix_lseek(int d, s64 offset, int whence) { - s64 result = sceKernelLseek(d, offset, whence); + s64 result = file->f.Tell(); if (result < 0) { - LOG_ERROR(Kernel_Pthread, "posix_lseek: error = {}", result); - ErrSceToPosix(result); + // Tell failed in platform-specific code, errno needs to be converted. + SetPosixErrno(errno); return -1; } return result; } -s64 PS4_SYSV_ABI sceKernelRead(int d, void* buf, size_t nbytes) { +s64 PS4_SYSV_ABI sceKernelLseek(s32 fd, s64 offset, s32 whence) { + s64 result = posix_lseek(fd, offset, whence); + if (result < 0) { + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); + } + return result; +} + +s64 PS4_SYSV_ABI read(s32 fd, void* buf, size_t nbytes) { auto* h = Common::Singleton::Instance(); - auto* file = h->GetFile(d); + auto* file = h->GetFile(fd); if (file == nullptr) { - return ORBIS_KERNEL_ERROR_EBADF; + *__Error() = POSIX_EBADF; + return -1; } std::scoped_lock lk{file->m_mutex}; if (file->type == Core::FileSys::FileType::Device) { - return file->device->read(buf, nbytes); + s64 result = file->device->read(buf, nbytes); + if (result < 0) { + ErrSceToPosix(result); + return -1; + } + return result; } return ReadFile(file->f, buf, nbytes); } -int PS4_SYSV_ABI posix_read(int d, void* buf, size_t nbytes) { - int result = sceKernelRead(d, buf, nbytes); +s64 PS4_SYSV_ABI posix_read(s32 fd, void* buf, size_t nbytes) { + return read(fd, buf, nbytes); +} + +s64 PS4_SYSV_ABI sceKernelRead(s32 fd, void* buf, size_t nbytes) { + s64 result = read(fd, buf, nbytes); if (result < 0) { - LOG_ERROR(Kernel_Pthread, "posix_read: error = {}", result); - ErrSceToPosix(result); - return -1; + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); } return result; } -int PS4_SYSV_ABI sceKernelMkdir(const char* path, u16 mode) { +s32 PS4_SYSV_ABI posix_mkdir(const char* path, u16 mode) { LOG_INFO(Kernel_Fs, "path = {} mode = {}", path, mode); if (path == nullptr) { - return ORBIS_KERNEL_ERROR_EINVAL; + *__Error() = POSIX_ENOTDIR; + return -1; } auto* mnt = Common::Singleton::Instance(); @@ -361,88 +448,79 @@ int PS4_SYSV_ABI sceKernelMkdir(const char* path, u16 mode) { const auto dir_name = mnt->GetHostPath(path, &ro); if (std::filesystem::exists(dir_name)) { - return ORBIS_KERNEL_ERROR_EEXIST; + *__Error() = POSIX_EEXIST; + return -1; } if (ro) { - return ORBIS_KERNEL_ERROR_EROFS; + *__Error() = POSIX_EROFS; + return -1; } // CUSA02456: path = /aotl after sceSaveDataMount(mode = 1) std::error_code ec; if (dir_name.empty() || !std::filesystem::create_directory(dir_name, ec)) { - return ORBIS_KERNEL_ERROR_EIO; + *__Error() = POSIX_EIO; + return -1; } if (!std::filesystem::exists(dir_name)) { - return ORBIS_KERNEL_ERROR_ENOENT; + *__Error() = POSIX_ENOENT; + return -1; } return ORBIS_OK; } -int PS4_SYSV_ABI posix_mkdir(const char* path, u16 mode) { - int result = sceKernelMkdir(path, mode); +s32 PS4_SYSV_ABI sceKernelMkdir(const char* path, u16 mode) { + s32 result = posix_mkdir(path, mode); if (result < 0) { - LOG_ERROR(Kernel_Pthread, "posix_mkdir: error = {}", result); - ErrSceToPosix(result); - return -1; + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); } return result; } -int PS4_SYSV_ABI sceKernelRmdir(const char* path) { +s32 PS4_SYSV_ABI posix_rmdir(const char* path) { auto* mnt = Common::Singleton::Instance(); bool ro = false; const std::filesystem::path dir_name = mnt->GetHostPath(path, &ro); - if (dir_name.empty()) { - LOG_ERROR(Kernel_Fs, "Failed to remove directory: {}, permission denied", - fmt::UTF(dir_name.u8string())); - return ORBIS_KERNEL_ERROR_EACCES; + if (dir_name.empty() || !std::filesystem::is_directory(dir_name)) { + *__Error() = POSIX_ENOTDIR; + return -1; } if (ro) { - LOG_ERROR(Kernel_Fs, "Failed to remove directory: {}, directory is read only", - fmt::UTF(dir_name.u8string())); - return ORBIS_KERNEL_ERROR_EROFS; - } - - if (!std::filesystem::is_directory(dir_name)) { - LOG_ERROR(Kernel_Fs, "Failed to remove directory: {}, path is not a directory", - fmt::UTF(dir_name.u8string())); - return ORBIS_KERNEL_ERROR_ENOTDIR; + *__Error() = POSIX_EROFS; + return -1; } if (!std::filesystem::exists(dir_name)) { - LOG_ERROR(Kernel_Fs, "Failed to remove directory: {}, no such file or directory", - fmt::UTF(dir_name.u8string())); - return ORBIS_KERNEL_ERROR_ENOENT; + *__Error() = POSIX_ENOENT; + return -1; } std::error_code ec; - int result = std::filesystem::remove_all(dir_name, ec); + s32 result = std::filesystem::remove_all(dir_name, ec); - if (!ec) { - LOG_INFO(Kernel_Fs, "Removed directory: {}", fmt::UTF(dir_name.u8string())); - return ORBIS_OK; + if (ec) { + *__Error() = POSIX_EIO; + return -1; } - LOG_ERROR(Kernel_Fs, "Failed to remove directory: {}, error_code={}", - fmt::UTF(dir_name.u8string()), ec.message()); - return ErrnoToSceKernelError(ec.value()); + return ORBIS_OK; } -int PS4_SYSV_ABI posix_rmdir(const char* path) { - int result = sceKernelRmdir(path); +s32 PS4_SYSV_ABI sceKernelRmdir(const char* path) { + s32 result = posix_rmdir(path); if (result < 0) { - LOG_ERROR(Kernel_Pthread, "posix_rmdir: error = {}", result); - ErrSceToPosix(result); - return -1; + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); } return result; } -int PS4_SYSV_ABI sceKernelStat(const char* path, OrbisKernelStat* sb) { +s32 PS4_SYSV_ABI posix_stat(const char* path, OrbisKernelStat* sb) { LOG_INFO(Kernel_Fs, "(PARTIAL) path = {}", path); auto* mnt = Common::Singleton::Instance(); bool ro = false; @@ -451,7 +529,8 @@ int PS4_SYSV_ABI sceKernelStat(const char* path, OrbisKernelStat* sb) { const bool is_dir = std::filesystem::is_directory(path_name); const bool is_file = std::filesystem::is_regular_file(path_name); if (!is_dir && !is_file) { - return ORBIS_KERNEL_ERROR_ENOENT; + *__Error() = POSIX_ENOENT; + return -1; } if (std::filesystem::is_directory(path_name)) { sb->st_mode = 0000777u | 0040000u; @@ -461,7 +540,7 @@ int PS4_SYSV_ABI sceKernelStat(const char* path, OrbisKernelStat* sb) { // TODO incomplete } else { sb->st_mode = 0000777u | 0100000u; - sb->st_size = static_cast(std::filesystem::file_size(path_name)); + sb->st_size = static_cast(std::filesystem::file_size(path_name)); sb->st_blksize = 512; sb->st_blocks = (sb->st_size + 511) / 512; // TODO incomplete @@ -473,17 +552,16 @@ int PS4_SYSV_ABI sceKernelStat(const char* path, OrbisKernelStat* sb) { return ORBIS_OK; } -int PS4_SYSV_ABI posix_stat(const char* path, OrbisKernelStat* sb) { - int result = sceKernelStat(path, sb); +s32 PS4_SYSV_ABI sceKernelStat(const char* path, OrbisKernelStat* sb) { + s32 result = posix_stat(path, sb); if (result < 0) { - LOG_ERROR(Kernel_Pthread, "posix_stat: error = {}", result); - ErrSceToPosix(result); - return -1; + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); } return result; } -int PS4_SYSV_ABI sceKernelCheckReachability(const char* path) { +s32 PS4_SYSV_ABI sceKernelCheckReachability(const char* path) { auto* mnt = Common::Singleton::Instance(); std::string_view guest_path{path}; for (const auto& prefix : available_device | std::views::keys) { @@ -498,23 +576,165 @@ int PS4_SYSV_ABI sceKernelCheckReachability(const char* path) { return ORBIS_OK; } -s64 PS4_SYSV_ABI sceKernelPreadv(int d, SceKernelIovec* iov, int iovcnt, s64 offset) { - if (d < 3) { - return ORBIS_KERNEL_ERROR_EPERM; +s32 PS4_SYSV_ABI fstat(s32 fd, OrbisKernelStat* sb) { + LOG_INFO(Kernel_Fs, "(PARTIAL) fd = {}", fd); + if (sb == nullptr) { + *__Error() = POSIX_EFAULT; + return -1; } + auto* h = Common::Singleton::Instance(); + auto* file = h->GetFile(fd); + if (file == nullptr) { + *__Error() = POSIX_EBADF; + return -1; + } + std::memset(sb, 0, sizeof(OrbisKernelStat)); + + switch (file->type) { + case Core::FileSys::FileType::Device: { + s32 result = file->device->fstat(sb); + if (result < 0) { + ErrSceToPosix(result); + return -1; + } + return result; + } + case Core::FileSys::FileType::Regular: { + sb->st_mode = 0000777u | 0100000u; + sb->st_size = file->f.GetSize(); + sb->st_blksize = 512; + sb->st_blocks = (sb->st_size + 511) / 512; + // TODO incomplete + break; + } + case Core::FileSys::FileType::Directory: { + sb->st_mode = 0000777u | 0040000u; + sb->st_size = 0; + sb->st_blksize = 512; + sb->st_blocks = 0; + // TODO incomplete + break; + } + default: + UNREACHABLE(); + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI posix_fstat(s32 fd, OrbisKernelStat* sb) { + return fstat(fd, sb); +} + +s32 PS4_SYSV_ABI sceKernelFstat(s32 fd, OrbisKernelStat* sb) { + s32 result = fstat(fd, sb); + if (result < 0) { + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); + } + return result; +} + +s32 PS4_SYSV_ABI posix_ftruncate(s32 fd, s64 length) { + auto* h = Common::Singleton::Instance(); + auto* file = h->GetFile(fd); + + if (file == nullptr) { + *__Error() = POSIX_EBADF; + return -1; + } + + if (file->type == Core::FileSys::FileType::Device) { + s32 result = file->device->ftruncate(length); + if (result < 0) { + ErrSceToPosix(result); + return -1; + } + return result; + } + + if (file->m_host_name.empty()) { + *__Error() = POSIX_EACCES; + return -1; + } + + file->f.SetSize(length); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceKernelFtruncate(s32 fd, s64 length) { + s32 result = posix_ftruncate(fd, length); + if (result < 0) { + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); + } + return result; +} + +s32 PS4_SYSV_ABI posix_rename(const char* from, const char* to) { + auto* mnt = Common::Singleton::Instance(); + bool ro = false; + const auto src_path = mnt->GetHostPath(from, &ro); + if (!std::filesystem::exists(src_path)) { + *__Error() = POSIX_ENOENT; + return -1; + } + if (ro) { + *__Error() = POSIX_EROFS; + return -1; + } + const auto dst_path = mnt->GetHostPath(to, &ro); + if (ro) { + *__Error() = POSIX_EROFS; + return -1; + } + const bool src_is_dir = std::filesystem::is_directory(src_path); + const bool dst_is_dir = std::filesystem::is_directory(dst_path); + if (src_is_dir && !dst_is_dir) { + *__Error() = POSIX_ENOTDIR; + return -1; + } + if (!src_is_dir && dst_is_dir) { + *__Error() = POSIX_EISDIR; + return -1; + } + if (dst_is_dir && !std::filesystem::is_empty(dst_path)) { + *__Error() = POSIX_ENOTEMPTY; + return -1; + } + std::filesystem::copy(src_path, dst_path, std::filesystem::copy_options::overwrite_existing); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceKernelRename(const char* from, const char* to) { + s32 result = posix_rename(from, to); + if (result < 0) { + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); + } + return result; +} + +s64 PS4_SYSV_ABI posix_preadv(s32 fd, SceKernelIovec* iov, s32 iovcnt, s64 offset) { if (offset < 0) { - return ORBIS_KERNEL_ERROR_EINVAL; + *__Error() = POSIX_EINVAL; + return -1; } auto* h = Common::Singleton::Instance(); - auto* file = h->GetFile(d); + auto* file = h->GetFile(fd); if (file == nullptr) { - return ORBIS_KERNEL_ERROR_EBADF; + *__Error() = POSIX_EBADF; + return -1; } std::scoped_lock lk{file->m_mutex}; if (file->type == Core::FileSys::FileType::Device) { - return file->device->preadv(iov, iovcnt, offset); + s64 result = file->device->preadv(iov, iovcnt, offset); + if (result < 0) { + ErrSceToPosix(result); + return -1; + } + return result; } const s64 pos = file->f.Tell(); @@ -522,8 +742,8 @@ s64 PS4_SYSV_ABI sceKernelPreadv(int d, SceKernelIovec* iov, int iovcnt, s64 off file->f.Seek(pos); }; if (!file->f.Seek(offset)) { - LOG_CRITICAL(Kernel_Fs, "failed to seek"); - return ORBIS_KERNEL_ERROR_EINVAL; + *__Error() = POSIX_EIO; + return -1; } size_t total_read = 0; for (int i = 0; i < iovcnt; i++) { @@ -532,118 +752,72 @@ s64 PS4_SYSV_ABI sceKernelPreadv(int d, SceKernelIovec* iov, int iovcnt, s64 off return total_read; } -s64 PS4_SYSV_ABI sceKernelPread(int d, void* buf, size_t nbytes, s64 offset) { - SceKernelIovec iovec{buf, nbytes}; - return sceKernelPreadv(d, &iovec, 1, offset); -} - -int PS4_SYSV_ABI sceKernelFStat(int fd, OrbisKernelStat* sb) { - LOG_INFO(Kernel_Fs, "(PARTIAL) fd = {}", fd); - if (fd < 3) { - return ORBIS_KERNEL_ERROR_EPERM; - } - if (sb == nullptr) { - return ORBIS_KERNEL_ERROR_EFAULT; - } - auto* h = Common::Singleton::Instance(); - auto* file = h->GetFile(fd); - if (file == nullptr) { - return ORBIS_KERNEL_ERROR_EBADF; - } - std::memset(sb, 0, sizeof(OrbisKernelStat)); - - switch (file->type) { - case Core::FileSys::FileType::Device: - return file->device->fstat(sb); - case Core::FileSys::FileType::Regular: - sb->st_mode = 0000777u | 0100000u; - sb->st_size = file->f.GetSize(); - sb->st_blksize = 512; - sb->st_blocks = (sb->st_size + 511) / 512; - // TODO incomplete - break; - case Core::FileSys::FileType::Directory: - sb->st_mode = 0000777u | 0040000u; - sb->st_size = 0; - sb->st_blksize = 512; - sb->st_blocks = 0; - // TODO incomplete - break; - default: - UNREACHABLE(); - } - return ORBIS_OK; -} - -int PS4_SYSV_ABI posix_fstat(int fd, OrbisKernelStat* sb) { - int result = sceKernelFStat(fd, sb); +s64 PS4_SYSV_ABI sceKernelPreadv(s32 fd, SceKernelIovec* iov, s32 iovcnt, s64 offset) { + s64 result = posix_preadv(fd, iov, iovcnt, offset); if (result < 0) { - LOG_ERROR(Kernel_Pthread, "posix_fstat: error = {}", result); - ErrSceToPosix(result); - return -1; + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); } return result; } -s32 PS4_SYSV_ABI sceKernelFsync(int fd) { +s64 PS4_SYSV_ABI posix_pread(s32 fd, void* buf, size_t nbytes, s64 offset) { + SceKernelIovec iovec{buf, nbytes}; + return posix_preadv(fd, &iovec, 1, offset); +} + +s64 PS4_SYSV_ABI sceKernelPread(s32 fd, void* buf, size_t nbytes, s64 offset) { + SceKernelIovec iovec{buf, nbytes}; + return sceKernelPreadv(fd, &iovec, 1, offset); +} + +s32 PS4_SYSV_ABI posix_fsync(s32 fd) { auto* h = Common::Singleton::Instance(); auto* file = h->GetFile(fd); if (file == nullptr) { - return ORBIS_KERNEL_ERROR_EBADF; + *__Error() = POSIX_EBADF; + return -1; } if (file->type == Core::FileSys::FileType::Device) { - return file->device->fsync(); + s32 result = file->device->fsync(); + if (result < 0) { + ErrSceToPosix(result); + return -1; + } + return result; } file->f.Flush(); return ORBIS_OK; } -s32 PS4_SYSV_ABI posix_fsync(int fd) { - s32 result = sceKernelFsync(fd); +s32 PS4_SYSV_ABI sceKernelFsync(s32 fd) { + s32 result = posix_fsync(fd); if (result < 0) { - LOG_ERROR(Kernel_Pthread, "posix_fsync: error = {}", result); - ErrSceToPosix(result); - return -1; + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); } return result; } -int PS4_SYSV_ABI sceKernelFtruncate(int fd, s64 length) { - auto* h = Common::Singleton::Instance(); - auto* file = h->GetFile(fd); - - if (file == nullptr) { - return ORBIS_KERNEL_ERROR_EBADF; - } - - if (file->type == Core::FileSys::FileType::Device) { - return file->device->ftruncate(length); - } - - if (file->m_host_name.empty()) { - return ORBIS_KERNEL_ERROR_EACCES; - } - - file->f.SetSize(length); - return ORBIS_OK; -} - -static int GetDents(int fd, char* buf, int nbytes, s64* basep) { - if (fd < 3) { - return ORBIS_KERNEL_ERROR_EBADF; - } - +static s32 GetDents(s32 fd, char* buf, s32 nbytes, s64* basep) { if (buf == nullptr) { - return ORBIS_KERNEL_ERROR_EFAULT; + *__Error() = POSIX_EFAULT; + return -1; } auto* h = Common::Singleton::Instance(); auto* file = h->GetFile(fd); if (file == nullptr) { - return ORBIS_KERNEL_ERROR_EBADF; + *__Error() = POSIX_EBADF; + return -1; } if (file->type == Core::FileSys::FileType::Device) { - return file->device->getdents(buf, nbytes, basep); + s32 result = file->device->getdents(buf, nbytes, basep); + if (result < 0) { + ErrSceToPosix(result); + return -1; + } + return result; } if (file->dirents_index == file->dirents.size()) { @@ -651,7 +825,8 @@ static int GetDents(int fd, char* buf, int nbytes, s64* basep) { } if (file->type != Core::FileSys::FileType::Directory || nbytes < 512 || file->dirents_index > file->dirents.size()) { - return ORBIS_KERNEL_ERROR_EINVAL; + *__Error() = POSIX_EINVAL; + return -1; } const auto& entry = file->dirents.at(file->dirents_index++); auto str = entry.name; @@ -672,118 +847,178 @@ static int GetDents(int fd, char* buf, int nbytes, s64* basep) { return sizeof(OrbisKernelDirent); } -int PS4_SYSV_ABI sceKernelGetdents(int fd, char* buf, int nbytes) { +s32 PS4_SYSV_ABI posix_getdents(s32 fd, char* buf, s32 nbytes) { return GetDents(fd, buf, nbytes, nullptr); } -int PS4_SYSV_ABI sceKernelGetdirentries(int fd, char* buf, int nbytes, s64* basep) { +s32 PS4_SYSV_ABI sceKernelGetdents(s32 fd, char* buf, s32 nbytes) { + s32 result = GetDents(fd, buf, nbytes, nullptr); + if (result < 0) { + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); + } + return result; +} + +s32 PS4_SYSV_ABI getdirentries(s32 fd, char* buf, s32 nbytes, s64* basep) { return GetDents(fd, buf, nbytes, basep); } -s64 PS4_SYSV_ABI sceKernelPwrite(int d, void* buf, size_t nbytes, s64 offset) { - if (d < 3) { - return ORBIS_KERNEL_ERROR_EPERM; +s32 PS4_SYSV_ABI posix_getdirentries(s32 fd, char* buf, s32 nbytes, s64* basep) { + return GetDents(fd, buf, nbytes, basep); +} + +s32 PS4_SYSV_ABI sceKernelGetdirentries(s32 fd, char* buf, s32 nbytes, s64* basep) { + s32 result = GetDents(fd, buf, nbytes, basep); + if (result < 0) { + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); } + return result; +} + +s64 PS4_SYSV_ABI posix_pwrite(s32 fd, void* buf, size_t nbytes, s64 offset) { if (offset < 0) { - return ORBIS_KERNEL_ERROR_EINVAL; + *__Error() = POSIX_EINVAL; + return -1; } auto* h = Common::Singleton::Instance(); - auto* file = h->GetFile(d); + auto* file = h->GetFile(fd); if (file == nullptr) { - return ORBIS_KERNEL_ERROR_EBADF; + *__Error() = POSIX_EBADF; + return -1; } std::scoped_lock lk{file->m_mutex}; if (file->type == Core::FileSys::FileType::Device) { - return file->device->pwrite(buf, nbytes, offset); + s64 result = file->device->pwrite(buf, nbytes, offset); + if (result < 0) { + ErrSceToPosix(result); + return -1; + } + return result; } const s64 pos = file->f.Tell(); SCOPE_EXIT { file->f.Seek(pos); }; if (!file->f.Seek(offset)) { - LOG_CRITICAL(Kernel_Fs, "sceKernelPwrite: failed to seek"); - return ORBIS_KERNEL_ERROR_EINVAL; + *__Error() = POSIX_EIO; + return -1; } return file->f.WriteRaw(buf, nbytes); } -s32 PS4_SYSV_ABI sceKernelRename(const char* from, const char* to) { +s64 PS4_SYSV_ABI sceKernelPwrite(s32 fd, void* buf, size_t nbytes, s64 offset) { + s64 result = posix_pwrite(fd, buf, nbytes, offset); + if (result < 0) { + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); + } + return result; +} + +s32 PS4_SYSV_ABI posix_unlink(const char* path) { + if (path == nullptr) { + *__Error() = POSIX_EINVAL; + return -1; + } + + auto* h = Common::Singleton::Instance(); auto* mnt = Common::Singleton::Instance(); + bool ro = false; - const auto src_path = mnt->GetHostPath(from, &ro); - if (!std::filesystem::exists(src_path)) { - return ORBIS_KERNEL_ERROR_ENOENT; + const auto host_path = mnt->GetHostPath(path, &ro); + if (host_path.empty()) { + *__Error() = POSIX_ENOENT; + return -1; } + if (ro) { - return ORBIS_KERNEL_ERROR_EROFS; + *__Error() = POSIX_EROFS; + return -1; } - const auto dst_path = mnt->GetHostPath(to, &ro); - if (ro) { - return ORBIS_KERNEL_ERROR_EROFS; + + if (std::filesystem::is_directory(host_path)) { + *__Error() = POSIX_EPERM; + return -1; } - const bool src_is_dir = std::filesystem::is_directory(src_path); - const bool dst_is_dir = std::filesystem::is_directory(dst_path); - if (src_is_dir && !dst_is_dir) { - return ORBIS_KERNEL_ERROR_ENOTDIR; + + auto* file = h->GetFile(host_path); + if (file == nullptr) { + // File to unlink hasn't been opened, manually open and unlink it. + Common::FS::IOFile file(host_path, Common::FS::FileAccessMode::ReadWrite); + file.Unlink(); + } else { + file->f.Unlink(); } - if (!src_is_dir && dst_is_dir) { - return ORBIS_KERNEL_ERROR_EISDIR; - } - if (dst_is_dir && !std::filesystem::is_empty(dst_path)) { - return ORBIS_KERNEL_ERROR_ENOTEMPTY; - } - std::filesystem::copy(src_path, dst_path, std::filesystem::copy_options::overwrite_existing); + + LOG_INFO(Kernel_Fs, "Unlinked {}", path); return ORBIS_OK; } -void RegisterFileSystem(Core::Loader::SymbolsResolver* sym) { - LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, sceKernelOpen); - LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, posix_open); - LIB_FUNCTION("wuCroIGjt2g", "libkernel", 1, "libkernel", 1, 1, open); - LIB_FUNCTION("UK2Tl2DWUns", "libkernel", 1, "libkernel", 1, 1, sceKernelClose); - LIB_FUNCTION("bY-PO6JhzhQ", "libkernel", 1, "libkernel", 1, 1, posix_close); - LIB_FUNCTION("bY-PO6JhzhQ", "libScePosix", 1, "libkernel", 1, 1, posix_close); - LIB_FUNCTION("4wSze92BhLI", "libkernel", 1, "libkernel", 1, 1, sceKernelWrite); +s32 PS4_SYSV_ABI sceKernelUnlink(const char* path) { + s32 result = posix_unlink(path); + if (result < 0) { + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); + } + return result; +} - LIB_FUNCTION("+WRlkKjZvag", "libkernel", 1, "libkernel", 1, 1, _readv); - LIB_FUNCTION("YSHRBRLn2pI", "libkernel", 1, "libkernel", 1, 1, _writev); - LIB_FUNCTION("Oy6IpwgtYOk", "libkernel", 1, "libkernel", 1, 1, posix_lseek); +void RegisterFileSystem(Core::Loader::SymbolsResolver* sym) { + LIB_FUNCTION("6c3rCVE-fTU", "libkernel", 1, "libkernel", 1, 1, open); + LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, posix_open); + LIB_FUNCTION("wuCroIGjt2g", "libkernel", 1, "libkernel", 1, 1, posix_open); + LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, sceKernelOpen); + LIB_FUNCTION("NNtFaKJbPt0", "libkernel", 1, "libkernel", 1, 1, close); + LIB_FUNCTION("bY-PO6JhzhQ", "libScePosix", 1, "libkernel", 1, 1, posix_close); + LIB_FUNCTION("bY-PO6JhzhQ", "libkernel", 1, "libkernel", 1, 1, posix_close); + LIB_FUNCTION("UK2Tl2DWUns", "libkernel", 1, "libkernel", 1, 1, sceKernelClose); + LIB_FUNCTION("FxVZqBAA7ks", "libkernel", 1, "libkernel", 1, 1, write); + LIB_FUNCTION("FN4gaPmuFV8", "libScePosix", 1, "libkernel", 1, 1, posix_write); + LIB_FUNCTION("FN4gaPmuFV8", "libkernel", 1, "libkernel", 1, 1, posix_write); + LIB_FUNCTION("4wSze92BhLI", "libkernel", 1, "libkernel", 1, 1, sceKernelWrite); + LIB_FUNCTION("+WRlkKjZvag", "libkernel", 1, "libkernel", 1, 1, readv); + LIB_FUNCTION("YSHRBRLn2pI", "libkernel", 1, "libkernel", 1, 1, writev); LIB_FUNCTION("Oy6IpwgtYOk", "libScePosix", 1, "libkernel", 1, 1, posix_lseek); + LIB_FUNCTION("Oy6IpwgtYOk", "libkernel", 1, "libkernel", 1, 1, posix_lseek); LIB_FUNCTION("oib76F-12fk", "libkernel", 1, "libkernel", 1, 1, sceKernelLseek); - LIB_FUNCTION("Cg4srZ6TKbU", "libkernel", 1, "libkernel", 1, 1, sceKernelRead); + LIB_FUNCTION("DRuBt2pvICk", "libkernel", 1, "libkernel", 1, 1, read); LIB_FUNCTION("AqBioC2vF3I", "libScePosix", 1, "libkernel", 1, 1, posix_read); - LIB_FUNCTION("1-LFLmRFxxM", "libkernel", 1, "libkernel", 1, 1, sceKernelMkdir); + LIB_FUNCTION("AqBioC2vF3I", "libkernel", 1, "libkernel", 1, 1, posix_read); + LIB_FUNCTION("Cg4srZ6TKbU", "libkernel", 1, "libkernel", 1, 1, sceKernelRead); LIB_FUNCTION("JGMio+21L4c", "libScePosix", 1, "libkernel", 1, 1, posix_mkdir); LIB_FUNCTION("JGMio+21L4c", "libkernel", 1, "libkernel", 1, 1, posix_mkdir); - LIB_FUNCTION("naInUjYt3so", "libkernel", 1, "libkernel", 1, 1, sceKernelRmdir); + LIB_FUNCTION("1-LFLmRFxxM", "libkernel", 1, "libkernel", 1, 1, sceKernelMkdir); LIB_FUNCTION("c7ZnT7V1B98", "libScePosix", 1, "libkernel", 1, 1, posix_rmdir); LIB_FUNCTION("c7ZnT7V1B98", "libkernel", 1, "libkernel", 1, 1, posix_rmdir); - LIB_FUNCTION("eV9wAD2riIA", "libkernel", 1, "libkernel", 1, 1, sceKernelStat); - LIB_FUNCTION("kBwCPsYX-m4", "libkernel", 1, "libkernel", 1, 1, sceKernelFStat); - LIB_FUNCTION("mqQMh1zPPT8", "libScePosix", 1, "libkernel", 1, 1, posix_fstat); - LIB_FUNCTION("mqQMh1zPPT8", "libkernel", 1, "libkernel", 1, 1, posix_fstat); - LIB_FUNCTION("VW3TVZiM4-E", "libkernel", 1, "libkernel", 1, 1, sceKernelFtruncate); - LIB_FUNCTION("52NcYU9+lEo", "libkernel", 1, "libkernel", 1, 1, sceKernelRename); - + LIB_FUNCTION("naInUjYt3so", "libkernel", 1, "libkernel", 1, 1, sceKernelRmdir); LIB_FUNCTION("E6ao34wPw+U", "libScePosix", 1, "libkernel", 1, 1, posix_stat); LIB_FUNCTION("E6ao34wPw+U", "libkernel", 1, "libkernel", 1, 1, posix_stat); - LIB_FUNCTION("+r3rMFwItV4", "libkernel", 1, "libkernel", 1, 1, sceKernelPread); - LIB_FUNCTION("yTj62I7kw4s", "libkernel", 1, "libkernel", 1, 1, sceKernelPreadv); + LIB_FUNCTION("eV9wAD2riIA", "libkernel", 1, "libkernel", 1, 1, sceKernelStat); LIB_FUNCTION("uWyW3v98sU4", "libkernel", 1, "libkernel", 1, 1, sceKernelCheckReachability); - LIB_FUNCTION("fTx66l5iWIA", "libkernel", 1, "libkernel", 1, 1, sceKernelFsync); - LIB_FUNCTION("juWbTNM+8hw", "libkernel", 1, "libkernel", 1, 1, posix_fsync); + LIB_FUNCTION("mqQMh1zPPT8", "libScePosix", 1, "libkernel", 1, 1, posix_fstat); + LIB_FUNCTION("mqQMh1zPPT8", "libkernel", 1, "libkernel", 1, 1, posix_fstat); + LIB_FUNCTION("kBwCPsYX-m4", "libkernel", 1, "libkernel", 1, 1, sceKernelFstat); + LIB_FUNCTION("ih4CD9-gghM", "libkernel", 1, "libkernel", 1, 1, posix_ftruncate); + LIB_FUNCTION("VW3TVZiM4-E", "libkernel", 1, "libkernel", 1, 1, sceKernelFtruncate); + LIB_FUNCTION("52NcYU9+lEo", "libkernel", 1, "libkernel", 1, 1, sceKernelRename); + LIB_FUNCTION("yTj62I7kw4s", "libkernel", 1, "libkernel", 1, 1, sceKernelPreadv); + LIB_FUNCTION("ezv-RSBNKqI", "libScePosix", 1, "libkernel", 1, 1, posix_pread); + LIB_FUNCTION("ezv-RSBNKqI", "libkernel", 1, "libkernel", 1, 1, posix_pread); + LIB_FUNCTION("+r3rMFwItV4", "libkernel", 1, "libkernel", 1, 1, sceKernelPread); LIB_FUNCTION("juWbTNM+8hw", "libScePosix", 1, "libkernel", 1, 1, posix_fsync); + LIB_FUNCTION("juWbTNM+8hw", "libkernel", 1, "libkernel", 1, 1, posix_fsync); + LIB_FUNCTION("fTx66l5iWIA", "libkernel", 1, "libkernel", 1, 1, sceKernelFsync); LIB_FUNCTION("j2AIqSqJP0w", "libkernel", 1, "libkernel", 1, 1, sceKernelGetdents); + LIB_FUNCTION("sfKygSjIbI8", "libkernel", 1, "libkernel", 1, 1, getdirentries); LIB_FUNCTION("taRWhTJFTgE", "libkernel", 1, "libkernel", 1, 1, sceKernelGetdirentries); + LIB_FUNCTION("C2kJ-byS5rM", "libkernel", 1, "libkernel", 1, 1, posix_pwrite); LIB_FUNCTION("nKWi-N2HBV4", "libkernel", 1, "libkernel", 1, 1, sceKernelPwrite); LIB_FUNCTION("AUXVxWeJU-A", "libkernel", 1, "libkernel", 1, 1, sceKernelUnlink); - - // openOrbis (to check if it is valid out of OpenOrbis - LIB_FUNCTION("6c3rCVE-fTU", "libkernel", 1, "libkernel", 1, 1, - posix_open); // _open should be equal to open function } } // namespace Libraries::Kernel diff --git a/src/core/libraries/kernel/file_system.h b/src/core/libraries/kernel/file_system.h index 1838df2fe..77ce3ec3d 100644 --- a/src/core/libraries/kernel/file_system.h +++ b/src/core/libraries/kernel/file_system.h @@ -65,10 +65,10 @@ constexpr int ORBIS_KERNEL_O_DSYNC = 0x1000; constexpr int ORBIS_KERNEL_O_DIRECT = 0x00010000; constexpr int ORBIS_KERNEL_O_DIRECTORY = 0x00020000; -s64 PS4_SYSV_ABI sceKernelWrite(int d, const void* buf, size_t nbytes); -s64 PS4_SYSV_ABI sceKernelRead(int d, void* buf, size_t nbytes); -s64 PS4_SYSV_ABI sceKernelPread(int d, void* buf, size_t nbytes, s64 offset); -s64 PS4_SYSV_ABI sceKernelPwrite(int d, void* buf, size_t nbytes, s64 offset); +s64 PS4_SYSV_ABI sceKernelWrite(s32 fd, const void* buf, size_t nbytes); +s64 PS4_SYSV_ABI sceKernelRead(s32 fd, void* buf, size_t nbytes); +s64 PS4_SYSV_ABI sceKernelPread(s32 fd, void* buf, size_t nbytes, s64 offset); +s64 PS4_SYSV_ABI sceKernelPwrite(s32 fd, void* buf, size_t nbytes, s64 offset); void RegisterFileSystem(Core::Loader::SymbolsResolver* sym); } // namespace Libraries::Kernel diff --git a/src/core/libraries/kernel/kernel.cpp b/src/core/libraries/kernel/kernel.cpp index 2b7735219..33602bfe8 100644 --- a/src/core/libraries/kernel/kernel.cpp +++ b/src/core/libraries/kernel/kernel.cpp @@ -12,6 +12,7 @@ #include "common/va_ctx.h" #include "core/file_sys/fs.h" #include "core/libraries/error_codes.h" +#include "core/libraries/kernel/debug.h" #include "core/libraries/kernel/equeue.h" #include "core/libraries/kernel/file_system.h" #include "core/libraries/kernel/kernel.h" @@ -85,17 +86,23 @@ int ErrnoToSceKernelError(int error) { } void SetPosixErrno(int e) { - // Some error numbers are different between supported OSes or the PS4 + // Some error numbers are different between supported OSes switch (e) { case EPERM: g_posix_errno = POSIX_EPERM; break; - case EAGAIN: - g_posix_errno = POSIX_EAGAIN; + case ENOENT: + g_posix_errno = POSIX_ENOENT; + break; + case EDEADLK: + g_posix_errno = POSIX_EDEADLK; break; case ENOMEM: g_posix_errno = POSIX_ENOMEM; break; + case EACCES: + g_posix_errno = POSIX_EACCES; + break; case EINVAL: g_posix_errno = POSIX_EINVAL; break; @@ -105,13 +112,14 @@ void SetPosixErrno(int e) { case ERANGE: g_posix_errno = POSIX_ERANGE; break; - case EDEADLK: - g_posix_errno = POSIX_EDEADLK; + case EAGAIN: + g_posix_errno = POSIX_EAGAIN; break; case ETIMEDOUT: g_posix_errno = POSIX_ETIMEDOUT; break; default: + LOG_WARNING(Kernel, "Unhandled errno {}", e); g_posix_errno = e; } } @@ -133,14 +141,6 @@ void PS4_SYSV_ABI sceLibcHeapGetTraceInfo(HeapInfoInfo* info) { info->getSegmentInfo = 0; } -s64 PS4_SYSV_ABI ps4__write(int d, const char* buf, std::size_t nbytes) { - return sceKernelWrite(d, buf, nbytes); -} - -s64 PS4_SYSV_ABI ps4__read(int d, void* buf, u64 nbytes) { - return sceKernelRead(d, buf, nbytes); -} - struct OrbisKernelUuid { u32 timeLow; u16 timeMid; @@ -220,6 +220,7 @@ void RegisterKernel(Core::Loader::SymbolsResolver* sym) { Libraries::Kernel::RegisterProcess(sym); Libraries::Kernel::RegisterException(sym); Libraries::Kernel::RegisterAio(sym); + Libraries::Kernel::RegisterDebug(sym); LIB_OBJ("f7uOxY9mM1U", "libkernel", 1, "libkernel", 1, 1, &g_stack_chk_guard); LIB_FUNCTION("PfccT7qURYE", "libkernel", 1, "libkernel", 1, 1, kernel_ioctl); @@ -229,13 +230,10 @@ void RegisterKernel(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("Xjoosiw+XPI", "libkernel", 1, "libkernel", 1, 1, sceKernelUuidCreate); LIB_FUNCTION("Ou3iL1abvng", "libkernel", 1, "libkernel", 1, 1, stack_chk_fail); LIB_FUNCTION("9BcDykPmo1I", "libkernel", 1, "libkernel", 1, 1, __Error); - LIB_FUNCTION("DRuBt2pvICk", "libkernel", 1, "libkernel", 1, 1, ps4__read); LIB_FUNCTION("k+AXqu2-eBc", "libkernel", 1, "libkernel", 1, 1, posix_getpagesize); LIB_FUNCTION("k+AXqu2-eBc", "libScePosix", 1, "libkernel", 1, 1, posix_getpagesize); LIB_FUNCTION("NWtTN10cJzE", "libSceLibcInternalExt", 1, "libSceLibcInternal", 1, 1, sceLibcHeapGetTraceInfo); - LIB_FUNCTION("FxVZqBAA7ks", "libkernel", 1, "libkernel", 1, 1, ps4__write); - LIB_FUNCTION("FN4gaPmuFV8", "libScePosix", 1, "libkernel", 1, 1, ps4__write); } } // namespace Libraries::Kernel diff --git a/src/core/libraries/kernel/process.cpp b/src/core/libraries/kernel/process.cpp index d61ee37ac..02f8a538d 100644 --- a/src/core/libraries/kernel/process.cpp +++ b/src/core/libraries/kernel/process.cpp @@ -127,6 +127,11 @@ int PS4_SYSV_ABI sceKernelGetModuleInfoFromAddr(VAddr addr, int flags, return ORBIS_OK; } +s32 PS4_SYSV_ABI exit(s32 status) { + UNREACHABLE_MSG("Exiting with status code {}", status); + return 0; +} + void RegisterProcess(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("WB66evu8bsU", "libkernel", 1, "libkernel", 1, 1, sceKernelGetCompiledSdkVersion); LIB_FUNCTION("WslcK1FQcGI", "libkernel", 1, "libkernel", 1, 1, sceKernelIsNeoMode); @@ -136,6 +141,7 @@ void RegisterProcess(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("LwG8g3niqwA", "libkernel", 1, "libkernel", 1, 1, sceKernelDlsym); LIB_FUNCTION("RpQJJVKTiFM", "libkernel", 1, "libkernel", 1, 1, sceKernelGetModuleInfoForUnwind); LIB_FUNCTION("f7KBOafysXo", "libkernel", 1, "libkernel", 1, 1, sceKernelGetModuleInfoFromAddr); + LIB_FUNCTION("6Z83sYWFlA8", "libkernel", 1, "libkernel", 1, 1, exit); } } // namespace Libraries::Kernel diff --git a/src/core/libraries/kernel/threads/exception.cpp b/src/core/libraries/kernel/threads/exception.cpp index 5e2f35d69..e257cbea0 100644 --- a/src/core/libraries/kernel/threads/exception.cpp +++ b/src/core/libraries/kernel/threads/exception.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "common/assert.h" +#include "core/libraries/kernel/orbis_error.h" #include "core/libraries/kernel/threads/exception.h" #include "core/libraries/kernel/threads/pthread.h" #include "core/libraries/libs.h" @@ -148,13 +149,19 @@ int PS4_SYSV_ABI sceKernelRaiseException(PthreadT thread, int signum) { return 0; } -int PS4_SYSV_ABI sceKernelDebugRaiseException() { - UNREACHABLE(); +s32 PS4_SYSV_ABI sceKernelDebugRaiseException(s32 error, s64 unk) { + if (unk != 0) { + return ORBIS_KERNEL_ERROR_EINVAL; + } + UNREACHABLE_MSG("error {:#x}", error); return 0; } -int PS4_SYSV_ABI sceKernelDebugRaiseExceptionOnReleaseMode() { - UNREACHABLE(); +s32 PS4_SYSV_ABI sceKernelDebugRaiseExceptionOnReleaseMode(s32 error, s64 unk) { + if (unk != 0) { + return ORBIS_KERNEL_ERROR_EINVAL; + } + UNREACHABLE_MSG("error {:#x}", error); return 0; } @@ -163,7 +170,7 @@ void RegisterException(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("WkwEd3N7w0Y", "libkernel_unity", 1, "libkernel", 1, 1, sceKernelInstallExceptionHandler); LIB_FUNCTION("Qhv5ARAoOEc", "libkernel_unity", 1, "libkernel", 1, 1, - sceKernelRemoveExceptionHandler) + sceKernelRemoveExceptionHandler); LIB_FUNCTION("OMDRKKAZ8I4", "libkernel", 1, "libkernel", 1, 1, sceKernelDebugRaiseException); LIB_FUNCTION("zE-wXIZjLoM", "libkernel", 1, "libkernel", 1, 1, sceKernelDebugRaiseExceptionOnReleaseMode); diff --git a/src/core/libraries/kernel/threads/pthread_spec.cpp b/src/core/libraries/kernel/threads/pthread_spec.cpp index 9e625da32..b36e302d4 100644 --- a/src/core/libraries/kernel/threads/pthread_spec.cpp +++ b/src/core/libraries/kernel/threads/pthread_spec.cpp @@ -147,6 +147,11 @@ void RegisterSpec(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("0-KXaS70xy4", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_getspecific); LIB_FUNCTION("WrOLvHU0yQM", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_setspecific); + // Posix-Kernel + LIB_FUNCTION("mqULNdimTn0", "libkernel", 1, "libkernel", 1, 1, posix_pthread_key_create); + LIB_FUNCTION("0-KXaS70xy4", "libkernel", 1, "libkernel", 1, 1, posix_pthread_getspecific); + LIB_FUNCTION("WrOLvHU0yQM", "libkernel", 1, "libkernel", 1, 1, posix_pthread_setspecific); + // Orbis LIB_FUNCTION("geDaqgH9lTg", "libkernel", 1, "libkernel", 1, 1, ORBIS(posix_pthread_key_create)); LIB_FUNCTION("PrdHuuDekhY", "libkernel", 1, "libkernel", 1, 1, ORBIS(posix_pthread_key_delete)); diff --git a/src/core/libraries/kernel/time.cpp b/src/core/libraries/kernel/time.cpp index 42d959885..b7e4c1756 100644 --- a/src/core/libraries/kernel/time.cpp +++ b/src/core/libraries/kernel/time.cpp @@ -172,7 +172,7 @@ static s32 clock_gettime(u32 clock_id, struct timespec* ts) { } #endif -int PS4_SYSV_ABI orbis_clock_gettime(s32 clock_id, struct timespec* ts) { +int PS4_SYSV_ABI orbis_clock_gettime(s32 clock_id, struct OrbisKernelTimespec* ts) { if (ts == nullptr) { return ORBIS_KERNEL_ERROR_EFAULT; } @@ -265,17 +265,18 @@ int PS4_SYSV_ABI orbis_clock_gettime(s32 clock_id, struct timespec* ts) { return EINVAL; } - return clock_gettime(pclock_id, ts); + timespec t{}; + int result = clock_gettime(pclock_id, &t); + ts->tv_sec = t.tv_sec; + ts->tv_nsec = t.tv_nsec; + return result; } int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) { - struct timespec ts; - const auto res = orbis_clock_gettime(clock_id, &ts); + const auto res = orbis_clock_gettime(clock_id, tp); if (res < 0) { return ErrnoToSceKernelError(res); } - tp->tv_sec = ts.tv_sec; - tp->tv_nsec = ts.tv_nsec; return ORBIS_OK; } @@ -469,4 +470,4 @@ void RegisterTime(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("-o5uEDpN+oY", "libkernel", 1, "libkernel", 1, 1, sceKernelConvertUtcToLocaltime); } -} // namespace Libraries::Kernel +} // namespace Libraries::Kernel \ No newline at end of file diff --git a/src/core/libraries/libs.cpp b/src/core/libraries/libs.cpp index 074cf524e..cd0fe650b 100644 --- a/src/core/libraries/libs.cpp +++ b/src/core/libraries/libs.cpp @@ -115,6 +115,7 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) { Libraries::NpParty::RegisterlibSceNpParty(sym); Libraries::Zlib::RegisterlibSceZlib(sym); Libraries::Hmd::RegisterlibSceHmd(sym); + Libraries::DiscMap::RegisterlibSceDiscMap(sym); } } // namespace Libraries diff --git a/src/core/libraries/ngs2/ngs2.cpp b/src/core/libraries/ngs2/ngs2.cpp index 7eb663413..0b42e2471 100644 --- a/src/core/libraries/ngs2/ngs2.cpp +++ b/src/core/libraries/ngs2/ngs2.cpp @@ -5,21 +5,480 @@ #include "core/libraries/error_codes.h" #include "core/libraries/libs.h" #include "core/libraries/ngs2/ngs2.h" +#include "core/libraries/ngs2/ngs2_custom.h" #include "core/libraries/ngs2/ngs2_error.h" +#include "core/libraries/ngs2/ngs2_geom.h" #include "core/libraries/ngs2/ngs2_impl.h" +#include "core/libraries/ngs2/ngs2_pan.h" +#include "core/libraries/ngs2/ngs2_report.h" namespace Libraries::Ngs2 { -int PS4_SYSV_ABI sceNgs2CalcWaveformBlock() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); +// Ngs2 + +s32 PS4_SYSV_ABI sceNgs2CalcWaveformBlock(const OrbisNgs2WaveformFormat* format, u32 samplePos, + u32 numSamples, OrbisNgs2WaveformBlock* outBlock) { + LOG_INFO(Lib_Ngs2, "samplePos = {}, numSamples = {}", samplePos, numSamples); return ORBIS_OK; } -int PS4_SYSV_ABI sceNgs2CustomRackGetModuleInfo() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); +s32 PS4_SYSV_ABI sceNgs2GetWaveformFrameInfo(const OrbisNgs2WaveformFormat* format, + u32* outFrameSize, u32* outNumFrameSamples, + u32* outUnitsPerFrame, u32* outNumDelaySamples) { + LOG_INFO(Lib_Ngs2, "called"); return ORBIS_OK; } +s32 PS4_SYSV_ABI sceNgs2ParseWaveformData(const void* data, size_t dataSize, + OrbisNgs2WaveformInfo* outInfo) { + LOG_INFO(Lib_Ngs2, "dataSize = {}", dataSize); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2ParseWaveformFile(const char* path, u64 offset, + OrbisNgs2WaveformInfo* outInfo) { + LOG_INFO(Lib_Ngs2, "path = {}, offset = {}", path, offset); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2ParseWaveformUser(OrbisNgs2ParseReadHandler handler, uintptr_t userData, + OrbisNgs2WaveformInfo* outInfo) { + LOG_INFO(Lib_Ngs2, "userData = {}", userData); + if (!handler) { + LOG_ERROR(Lib_Ngs2, "handler is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2RackCreate(OrbisNgs2Handle systemHandle, u32 rackId, + const OrbisNgs2RackOption* option, + const OrbisNgs2ContextBufferInfo* bufferInfo, + OrbisNgs2Handle* outHandle) { + LOG_INFO(Lib_Ngs2, "rackId = {}", rackId); + if (!systemHandle) { + LOG_ERROR(Lib_Ngs2, "systemHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2RackCreateWithAllocator(OrbisNgs2Handle systemHandle, u32 rackId, + const OrbisNgs2RackOption* option, + const OrbisNgs2BufferAllocator* allocator, + OrbisNgs2Handle* outHandle) { + LOG_INFO(Lib_Ngs2, "rackId = {}", rackId); + if (!systemHandle) { + LOG_ERROR(Lib_Ngs2, "systemHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2RackDestroy(OrbisNgs2Handle rackHandle, + OrbisNgs2ContextBufferInfo* outBufferInfo) { + if (!rackHandle) { + LOG_ERROR(Lib_Ngs2, "rackHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE; + } + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2RackGetInfo(OrbisNgs2Handle rackHandle, OrbisNgs2RackInfo* outInfo, + size_t infoSize) { + LOG_INFO(Lib_Ngs2, "infoSize = {}", infoSize); + if (!rackHandle) { + LOG_ERROR(Lib_Ngs2, "rackHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2RackGetUserData(OrbisNgs2Handle rackHandle, uintptr_t* outUserData) { + if (!rackHandle) { + LOG_ERROR(Lib_Ngs2, "rackHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE; + } + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2RackGetVoiceHandle(OrbisNgs2Handle rackHandle, u32 voiceIndex, + OrbisNgs2Handle* outHandle) { + LOG_INFO(Lib_Ngs2, "voiceIndex = {}", voiceIndex); + if (!rackHandle) { + LOG_ERROR(Lib_Ngs2, "rackHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2RackLock(OrbisNgs2Handle rackHandle) { + if (!rackHandle) { + LOG_ERROR(Lib_Ngs2, "rackHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE; + } + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2RackQueryBufferSize(u32 rackId, const OrbisNgs2RackOption* option, + OrbisNgs2ContextBufferInfo* outBufferInfo) { + LOG_INFO(Lib_Ngs2, "rackId = {}", rackId); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2RackSetUserData(OrbisNgs2Handle rackHandle, uintptr_t userData) { + LOG_INFO(Lib_Ngs2, "userData = {}", userData); + if (!rackHandle) { + LOG_ERROR(Lib_Ngs2, "rackHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2RackUnlock(OrbisNgs2Handle rackHandle) { + if (!rackHandle) { + LOG_ERROR(Lib_Ngs2, "rackHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE; + } + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2SystemCreate(const OrbisNgs2SystemOption* option, + const OrbisNgs2ContextBufferInfo* bufferInfo, + OrbisNgs2Handle* outHandle) { + s32 result; + OrbisNgs2ContextBufferInfo localInfo; + if (!bufferInfo || !outHandle) { + if (!bufferInfo) { + result = ORBIS_NGS2_ERROR_INVALID_BUFFER_INFO; + LOG_ERROR(Lib_Ngs2, "Invalid system buffer info {}", (void*)bufferInfo); + } else { + result = ORBIS_NGS2_ERROR_INVALID_OUT_ADDRESS; + LOG_ERROR(Lib_Ngs2, "Invalid system handle address {}", (void*)outHandle); + } + + // TODO: Report errors? + } else { + // Make bufferInfo copy + localInfo.hostBuffer = bufferInfo->hostBuffer; + localInfo.hostBufferSize = bufferInfo->hostBufferSize; + for (int i = 0; i < 5; i++) { + localInfo.reserved[i] = bufferInfo->reserved[i]; + } + localInfo.userData = bufferInfo->userData; + + result = SystemSetup(option, &localInfo, 0, outHandle); + } + + // TODO: API reporting? + + LOG_INFO(Lib_Ngs2, "called"); + return result; +} + +s32 PS4_SYSV_ABI sceNgs2SystemCreateWithAllocator(const OrbisNgs2SystemOption* option, + const OrbisNgs2BufferAllocator* allocator, + OrbisNgs2Handle* outHandle) { + s32 result; + if (allocator && allocator->allocHandler != 0) { + OrbisNgs2BufferAllocHandler hostAlloc = allocator->allocHandler; + if (outHandle) { + OrbisNgs2BufferFreeHandler hostFree = allocator->freeHandler; + OrbisNgs2ContextBufferInfo* bufferInfo = 0; + result = SystemSetup(option, bufferInfo, 0, 0); + if (result >= 0) { + uintptr_t sysUserData = allocator->userData; + result = hostAlloc(bufferInfo); + if (result >= 0) { + OrbisNgs2Handle* handleCopy = outHandle; + result = SystemSetup(option, bufferInfo, hostFree, handleCopy); + if (result < 0) { + if (hostFree) { + hostFree(bufferInfo); + } + } + } + } + } else { + result = ORBIS_NGS2_ERROR_INVALID_OUT_ADDRESS; + LOG_ERROR(Lib_Ngs2, "Invalid system handle address {}", (void*)outHandle); + } + } else { + result = ORBIS_NGS2_ERROR_INVALID_BUFFER_ALLOCATOR; + LOG_ERROR(Lib_Ngs2, "Invalid system buffer allocator {}", (void*)allocator); + } + LOG_INFO(Lib_Ngs2, "called"); + return result; +} + +s32 PS4_SYSV_ABI sceNgs2SystemDestroy(OrbisNgs2Handle systemHandle, + OrbisNgs2ContextBufferInfo* outBufferInfo) { + if (!systemHandle) { + LOG_ERROR(Lib_Ngs2, "systemHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE; + } + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2SystemEnumHandles(OrbisNgs2Handle* aOutHandle, u32 maxHandles) { + LOG_INFO(Lib_Ngs2, "maxHandles = {}", maxHandles); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2SystemEnumRackHandles(OrbisNgs2Handle systemHandle, + OrbisNgs2Handle* aOutHandle, u32 maxHandles) { + LOG_INFO(Lib_Ngs2, "maxHandles = {}", maxHandles); + if (!systemHandle) { + LOG_ERROR(Lib_Ngs2, "systemHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2SystemGetInfo(OrbisNgs2Handle rackHandle, OrbisNgs2SystemInfo* outInfo, + size_t infoSize) { + LOG_INFO(Lib_Ngs2, "infoSize = {}", infoSize); + if (!rackHandle) { + LOG_ERROR(Lib_Ngs2, "rackHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2SystemGetUserData(OrbisNgs2Handle systemHandle, uintptr_t* outUserData) { + if (!systemHandle) { + LOG_ERROR(Lib_Ngs2, "systemHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE; + } + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2SystemLock(OrbisNgs2Handle systemHandle) { + if (!systemHandle) { + LOG_ERROR(Lib_Ngs2, "systemHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE; + } + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2SystemQueryBufferSize(const OrbisNgs2SystemOption* option, + OrbisNgs2ContextBufferInfo* outBufferInfo) { + s32 result; + if (outBufferInfo) { + result = SystemSetup(option, outBufferInfo, 0, 0); + LOG_INFO(Lib_Ngs2, "called"); + } else { + result = ORBIS_NGS2_ERROR_INVALID_OUT_ADDRESS; + LOG_ERROR(Lib_Ngs2, "Invalid system buffer info {}", (void*)outBufferInfo); + } + + return result; +} + +s32 PS4_SYSV_ABI sceNgs2SystemRender(OrbisNgs2Handle systemHandle, + const OrbisNgs2RenderBufferInfo* aBufferInfo, + u32 numBufferInfo) { + LOG_INFO(Lib_Ngs2, "numBufferInfo = {}", numBufferInfo); + if (!systemHandle) { + LOG_ERROR(Lib_Ngs2, "systemHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE; + } + return ORBIS_OK; +} + +static s32 PS4_SYSV_ABI sceNgs2SystemResetOption(OrbisNgs2SystemOption* outOption) { + static const OrbisNgs2SystemOption option = { + sizeof(OrbisNgs2SystemOption), "", 0, 512, 256, 48000, {0}}; + + if (!outOption) { + LOG_ERROR(Lib_Ngs2, "Invalid system option address {}", (void*)outOption); + return ORBIS_NGS2_ERROR_INVALID_OPTION_ADDRESS; + } + *outOption = option; + + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2SystemSetGrainSamples(OrbisNgs2Handle systemHandle, u32 numSamples) { + LOG_INFO(Lib_Ngs2, "numSamples = {}", numSamples); + if (!systemHandle) { + LOG_ERROR(Lib_Ngs2, "systemHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2SystemSetSampleRate(OrbisNgs2Handle systemHandle, u32 sampleRate) { + LOG_INFO(Lib_Ngs2, "sampleRate = {}", sampleRate); + if (!systemHandle) { + LOG_ERROR(Lib_Ngs2, "systemHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2SystemSetUserData(OrbisNgs2Handle systemHandle, uintptr_t userData) { + LOG_INFO(Lib_Ngs2, "userData = {}", userData); + if (!systemHandle) { + LOG_ERROR(Lib_Ngs2, "systemHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2SystemUnlock(OrbisNgs2Handle systemHandle) { + if (!systemHandle) { + LOG_ERROR(Lib_Ngs2, "systemHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE; + } + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2VoiceControl(OrbisNgs2Handle voiceHandle, + const OrbisNgs2VoiceParamHeader* paramList) { + if (!voiceHandle) { + LOG_ERROR(Lib_Ngs2, "voiceHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE; + } + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2VoiceGetMatrixInfo(OrbisNgs2Handle voiceHandle, u32 matrixId, + OrbisNgs2VoiceMatrixInfo* outInfo, size_t outInfoSize) { + LOG_INFO(Lib_Ngs2, "matrixId = {}, outInfoSize = {}", matrixId, outInfoSize); + if (!voiceHandle) { + LOG_ERROR(Lib_Ngs2, "voiceHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2VoiceGetOwner(OrbisNgs2Handle voiceHandle, OrbisNgs2Handle* outRackHandle, + u32* outVoiceId) { + if (!voiceHandle) { + LOG_ERROR(Lib_Ngs2, "voiceHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE; + } + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2VoiceGetPortInfo(OrbisNgs2Handle voiceHandle, u32 port, + OrbisNgs2VoicePortInfo* outInfo, size_t outInfoSize) { + LOG_INFO(Lib_Ngs2, "port = {}, outInfoSize = {}", port, outInfoSize); + if (!voiceHandle) { + LOG_ERROR(Lib_Ngs2, "voiceHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2VoiceGetState(OrbisNgs2Handle voiceHandle, OrbisNgs2VoiceState* outState, + size_t stateSize) { + LOG_INFO(Lib_Ngs2, "stateSize = {}", stateSize); + if (!voiceHandle) { + LOG_ERROR(Lib_Ngs2, "voiceHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2VoiceGetStateFlags(OrbisNgs2Handle voiceHandle, u32* outStateFlags) { + if (!voiceHandle) { + LOG_ERROR(Lib_Ngs2, "voiceHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE; + } + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +// Ngs2Custom + +s32 PS4_SYSV_ABI sceNgs2CustomRackGetModuleInfo(OrbisNgs2Handle rackHandle, u32 moduleIndex, + OrbisNgs2CustomModuleInfo* outInfo, + size_t infoSize) { + LOG_INFO(Lib_Ngs2, "moduleIndex = {}, infoSize = {}", moduleIndex, infoSize); + if (!rackHandle) { + LOG_ERROR(Lib_Ngs2, "rackHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE; + } + return ORBIS_OK; +} + +// Ngs2Geom + +s32 PS4_SYSV_ABI sceNgs2GeomResetListenerParam(OrbisNgs2GeomListenerParam* outListenerParam) { + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2GeomResetSourceParam(OrbisNgs2GeomSourceParam* outSourceParam) { + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2GeomCalcListener(const OrbisNgs2GeomListenerParam* param, + OrbisNgs2GeomListenerWork* outWork, u32 flags) { + LOG_INFO(Lib_Ngs2, "flags = {}", flags); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2GeomApply(const OrbisNgs2GeomListenerWork* listener, + const OrbisNgs2GeomSourceParam* source, + OrbisNgs2GeomAttribute* outAttrib, u32 flags) { + LOG_INFO(Lib_Ngs2, "flags = {}", flags); + return ORBIS_OK; +} + +// Ngs2Pan + +s32 PS4_SYSV_ABI sceNgs2PanInit(OrbisNgs2PanWork* work, const float* aSpeakerAngle, float unitAngle, + u32 numSpeakers) { + LOG_INFO(Lib_Ngs2, "aSpeakerAngle = {}, unitAngle = {}, numSpeakers = {}", *aSpeakerAngle, + unitAngle, numSpeakers); + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2PanGetVolumeMatrix(OrbisNgs2PanWork* work, const OrbisNgs2PanParam* aParam, + u32 numParams, u32 matrixFormat, + float* outVolumeMatrix) { + LOG_INFO(Lib_Ngs2, "numParams = {}, matrixFormat = {}", numParams, matrixFormat); + return ORBIS_OK; +} + +// Ngs2Report + +s32 PS4_SYSV_ABI sceNgs2ReportRegisterHandler(u32 reportType, OrbisNgs2ReportHandler handler, + uintptr_t userData, OrbisNgs2Handle* outHandle) { + LOG_INFO(Lib_Ngs2, "reportType = {}, userData = {}", reportType, userData); + if (!handler) { + LOG_ERROR(Lib_Ngs2, "handler is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_REPORT_HANDLE; + } + return ORBIS_OK; +} + +s32 PS4_SYSV_ABI sceNgs2ReportUnregisterHandler(OrbisNgs2Handle reportHandle) { + if (!reportHandle) { + LOG_ERROR(Lib_Ngs2, "reportHandle is nullptr"); + return ORBIS_NGS2_ERROR_INVALID_REPORT_HANDLE; + } + LOG_INFO(Lib_Ngs2, "called"); + return ORBIS_OK; +} + +// Unknown + int PS4_SYSV_ABI sceNgs2FftInit() { LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); return ORBIS_OK; @@ -35,31 +494,6 @@ int PS4_SYSV_ABI sceNgs2FftQuerySize() { return ORBIS_OK; } -int PS4_SYSV_ABI sceNgs2GeomApply() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2GeomCalcListener() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2GeomResetListenerParam() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2GeomResetSourceParam() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2GetWaveformFrameInfo() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - int PS4_SYSV_ABI sceNgs2JobSchedulerResetOption() { LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); return ORBIS_OK; @@ -80,71 +514,6 @@ int PS4_SYSV_ABI sceNgs2ModuleQueueEnumItems() { return ORBIS_OK; } -int PS4_SYSV_ABI sceNgs2PanGetVolumeMatrix() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2PanInit() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2ParseWaveformData() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2ParseWaveformFile() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2ParseWaveformUser() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2RackCreate() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2RackCreateWithAllocator() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2RackDestroy() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2RackGetInfo() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2RackGetUserData() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2RackGetVoiceHandle() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2RackLock() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2RackQueryBufferSize() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - int PS4_SYSV_ABI sceNgs2RackQueryInfo() { LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); return ORBIS_OK; @@ -155,116 +524,21 @@ int PS4_SYSV_ABI sceNgs2RackRunCommands() { return ORBIS_OK; } -int PS4_SYSV_ABI sceNgs2RackSetUserData() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2RackUnlock() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2ReportRegisterHandler() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2ReportUnregisterHandler() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2SystemCreate() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2SystemCreateWithAllocator() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2SystemDestroy() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2SystemEnumHandles() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2SystemEnumRackHandles() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2SystemGetInfo() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2SystemGetUserData() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2SystemLock() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2SystemQueryBufferSize() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - int PS4_SYSV_ABI sceNgs2SystemQueryInfo() { LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); return ORBIS_OK; } -int PS4_SYSV_ABI sceNgs2SystemRender() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2SystemResetOption() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - int PS4_SYSV_ABI sceNgs2SystemRunCommands() { LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); return ORBIS_OK; } -int PS4_SYSV_ABI sceNgs2SystemSetGrainSamples() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - int PS4_SYSV_ABI sceNgs2SystemSetLoudThreshold() { LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); return ORBIS_OK; } -int PS4_SYSV_ABI sceNgs2SystemSetSampleRate() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2SystemSetUserData() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2SystemUnlock() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - int PS4_SYSV_ABI sceNgs2StreamCreate() { LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); return ORBIS_OK; @@ -300,36 +574,6 @@ int PS4_SYSV_ABI sceNgs2StreamRunCommands() { return ORBIS_OK; } -int PS4_SYSV_ABI sceNgs2VoiceControl() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2VoiceGetMatrixInfo() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2VoiceGetOwner() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2VoiceGetPortInfo() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2VoiceGetState() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - -int PS4_SYSV_ABI sceNgs2VoiceGetStateFlags() { - LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); - return ORBIS_OK; -} - int PS4_SYSV_ABI sceNgs2VoiceQueryInfo() { LOG_ERROR(Lib_Ngs2, "(STUBBED) called"); return ORBIS_OK; diff --git a/src/core/libraries/ngs2/ngs2.h b/src/core/libraries/ngs2/ngs2.h index a5f1f52a6..a34bf21d4 100644 --- a/src/core/libraries/ngs2/ngs2.h +++ b/src/core/libraries/ngs2/ngs2.h @@ -3,7 +3,11 @@ #pragma once +#include "core/libraries/ngs2/ngs2_impl.h" + #include +#include +#include #include "common/types.h" namespace Core::Loader { @@ -12,60 +16,253 @@ class SymbolsResolver; namespace Libraries::Ngs2 { -class Ngs2; +typedef s32 (*OrbisNgs2ParseReadHandler)(uintptr_t userData, u32 offset, void* data, size_t size); -using SceNgs2Handle = Ngs2*; - -enum class SceNgs2HandleType : u32 { - System = 0, +enum class OrbisNgs2HandleType : u32 { + Invalid = 0, + System = 1, + Rack = 2, + Voice = 3, + VoiceControl = 6 }; -struct Ngs2Handle { - void* selfPointer; - void* dataPointer; - std::atomic* atomicPtr; - u32 handleType; - u32 flags_unk; +static const int ORBIS_NGS2_MAX_VOICE_CHANNELS = 8; +static const int ORBIS_NGS2_WAVEFORM_INFO_MAX_BLOCKS = 4; +static const int ORBIS_NGS2_MAX_MATRIX_LEVELS = + (ORBIS_NGS2_MAX_VOICE_CHANNELS * ORBIS_NGS2_MAX_VOICE_CHANNELS); - u32 uid; - u16 maxGrainSamples; - u16 minGrainSamples; - u16 currentGrainSamples; - u16 numGrainSamples; - u16 unknown2; +struct OrbisNgs2WaveformFormat { + u32 waveformType; + u32 numChannels; u32 sampleRate; - u32 unknown3; - - void* flushMutex; - u32 flushMutexInitialized; - void* processMutex; - u32 processMutexInitialized; - - // Linked list pointers for system list - Ngs2Handle* prev; - Ngs2Handle* next; + u32 configData; + u32 frameOffset; + u32 frameMargin; }; -struct SystemOptions { - char padding[6]; - s32 maxGrainSamples; - s32 numGrainSamples; - s32 sampleRate; +struct OrbisNgs2WaveformBlock { + u32 dataOffset; + u32 dataSize; + u32 numRepeats; + u32 numSkipSamples; + u32 numSamples; + u32 reserved; + uintptr_t userData; }; -struct SystemState { - // TODO +struct OrbisNgs2WaveformInfo { + OrbisNgs2WaveformFormat format; + + u32 dataOffset; + u32 dataSize; + + u32 loopBeginPosition; + u32 loopEndPosition; + u32 numSamples; + + u32 audioUnitSize; + u32 numAudioUnitSamples; + u32 numAudioUnitPerFrame; + + u32 audioFrameSize; + u32 numAudioFrameSamples; + + u32 numDelaySamples; + + u32 numBlocks; + OrbisNgs2WaveformBlock aBlock[ORBIS_NGS2_WAVEFORM_INFO_MAX_BLOCKS]; }; -struct StackBuffer { - void** top; - void* base; - void* curr; - size_t usedSize; - size_t totalSize; - size_t alignment; - char isVerifyEnabled; - char padding[7]; +struct OrbisNgs2EnvelopePoint { + u32 curve; + u32 duration; + float height; +}; + +struct OrbisNgs2UserFxProcessContext { + float** aChannelData; + uintptr_t userData0; + uintptr_t userData1; + uintptr_t userData2; + u32 flags; + u32 numChannels; + u32 numGrainSamples; + u32 sampleRate; +}; + +typedef s32 (*OrbisNgs2UserFxProcessHandler)(OrbisNgs2UserFxProcessContext* context); + +struct OrbisNgs2UserFx2SetupContext { + void* common; + void* param; + void* work; + uintptr_t userData; + u32 maxVoices; + u32 voiceIndex; + u64 reserved[4]; +}; + +typedef s32 (*OrbisNgs2UserFx2SetupHandler)(OrbisNgs2UserFx2SetupContext* context); + +struct OrbisNgs2UserFx2CleanupContext { + void* common; + void* param; + void* work; + uintptr_t userData; + u32 maxVoices; + u32 voiceIndex; + u64 reserved[4]; +}; + +typedef s32 (*OrbisNgs2UserFx2CleanupHandler)(OrbisNgs2UserFx2CleanupContext* context); + +struct OrbisNgs2UserFx2ControlContext { + const void* data; + size_t dataSize; + void* common; + void* param; + uintptr_t userData; + u64 reserved[4]; +}; + +typedef s32 (*OrbisNgs2UserFx2ControlHandler)(OrbisNgs2UserFx2ControlContext* context); + +struct OrbisNgs2UserFx2ProcessContext { + float** aChannelData; + void* common; + const void* param; + void* work; + void* state; + uintptr_t userData; + u32 flags; + u32 numInputChannels; + u32 numOutputChannels; + u32 numGrainSamples; + u32 sampleRate; + u32 reserved; + u64 reserved2[4]; +}; + +typedef s32 (*OrbisNgs2UserFx2ProcessHandler)(OrbisNgs2UserFx2ProcessContext* context); + +struct OrbisNgs2BufferAllocator { + OrbisNgs2BufferAllocHandler allocHandler; + OrbisNgs2BufferFreeHandler freeHandler; + uintptr_t userData; +}; + +struct OrbisNgs2RenderBufferInfo { + void* buffer; + size_t bufferSize; + u32 waveformType; + u32 numChannels; +}; + +struct OrbisNgs2RackOption { + size_t size; + char name[ORBIS_NGS2_RACK_NAME_LENGTH]; + + u32 flags; + u32 maxGrainSamples; + u32 maxVoices; + u32 maxInputDelayBlocks; + u32 maxMatrices; + u32 maxPorts; + u32 aReserved[20]; +}; + +struct OrbisNgs2VoiceParamHeader { + u16 size; + s16 next; + u32 id; +}; + +struct OrbisNgs2VoiceMatrixLevelsParam { + OrbisNgs2VoiceParamHeader header; + + u32 matrixId; + u32 numLevels; + const float* aLevel; +}; + +struct OrbisNgs2VoicePortMatrixParam { + OrbisNgs2VoiceParamHeader header; + + u32 port; + s32 matrixId; +}; + +struct OrbisNgs2VoicePortVolumeParam { + OrbisNgs2VoiceParamHeader header; + + u32 port; + float level; +}; + +struct OrbisNgs2VoicePortDelayParam { + OrbisNgs2VoiceParamHeader header; + + u32 port; + u32 numSamples; +}; + +struct OrbisNgs2VoicePatchParam { + OrbisNgs2VoiceParamHeader header; + + u32 port; + u32 destInputId; + OrbisNgs2Handle destHandle; +}; + +struct OrbisNgs2VoiceEventParam { + OrbisNgs2VoiceParamHeader header; + + u32 eventId; +}; + +struct OrbisNgs2VoiceCallbackInfo { + uintptr_t callbackData; + OrbisNgs2Handle voiceHandle; + u32 flag; + u32 reserved; + union { + struct { + uintptr_t userData; + const void* data; + u32 dataSize; + u32 repeatedCount; + u32 attributeFlags; + u32 reserved2; + } waveformBlock; + } param; +}; + +typedef void (*OrbisNgs2VoiceCallbackHandler)(const OrbisNgs2VoiceCallbackInfo* info); + +struct OrbisNgs2VoiceCallbackParam { + OrbisNgs2VoiceParamHeader header; + OrbisNgs2VoiceCallbackHandler callbackHandler; + + uintptr_t callbackData; + u32 flags; + u32 reserved; +}; + +struct OrbisNgs2VoicePortInfo { + s32 matrixId; + float volume; + u32 numDelaySamples; + u32 destInputId; + OrbisNgs2Handle destHandle; +}; + +struct OrbisNgs2VoiceMatrixInfo { + u32 numLevels; + float aLevel[ORBIS_NGS2_MAX_MATRIX_LEVELS]; +}; + +struct OrbisNgs2VoiceState { + u32 stateFlags; }; void RegisterlibSceNgs2(Core::Loader::SymbolsResolver* sym); diff --git a/src/core/libraries/ngs2/ngs2_custom.cpp b/src/core/libraries/ngs2/ngs2_custom.cpp new file mode 100644 index 000000000..8c82e4e49 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_custom.cpp @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ngs2_error.h" +#include "ngs2_impl.h" + +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" + +using namespace Libraries::Kernel; + +namespace Libraries::Ngs2 {} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_custom.h b/src/core/libraries/ngs2/ngs2_custom.h new file mode 100644 index 000000000..0c45a5d81 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_custom.h @@ -0,0 +1,444 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "ngs2.h" +#include "ngs2_reverb.h" + +namespace Libraries::Ngs2 { + +class Ngs2Custom; + +static const int ORBIS_NGS2_CUSTOM_MAX_MODULES = 24; +static const int ORBIS_NGS2_CUSTOM_MAX_PORTS = 16; +static const int ORBIS_NGS2_CUSTOM_DELAY_MAX_TAPS = 8; + +struct OrbisNgs2CustomModuleOption { + u32 size; +}; + +struct OrbisNgs2CustomEnvelopeModuleOption { + OrbisNgs2CustomModuleOption customModuleOption; + + u32 maxPoints; + u32 reserved; +}; + +struct OrbisNgs2CustomReverbModuleOption { + OrbisNgs2CustomModuleOption customModuleOption; + + u32 reverbSize; + u32 reserved; +}; + +struct OrbisNgs2CustomChorusModuleOption { + OrbisNgs2CustomModuleOption customModuleOption; + + u32 maxPhases; + u32 reserved; +} OrbisNgs2CustomChorusModuleOption; + +struct OrbisNgs2CustomPeakMeterModuleOption { + OrbisNgs2CustomModuleOption customModuleOption; + u32 numBlocks; + u32 reserved; +}; + +struct OrbisNgs2CustomDelayModuleOption { + OrbisNgs2CustomModuleOption customModuleOption; + + u32 type; + u32 maxTaps; + float maxLength; + u32 reserved; +}; + +struct OrbisNgs2CustomPitchShiftModuleOption { + OrbisNgs2CustomModuleOption customModuleOption; + + u32 quality; +}; + +struct OrbisNgs2CustomUserFx2ModuleOption { + OrbisNgs2CustomModuleOption customModuleOption; + + OrbisNgs2UserFx2SetupHandler setupHandler; + OrbisNgs2UserFx2CleanupHandler cleanupHandler; + OrbisNgs2UserFx2ControlHandler controlHandler; + OrbisNgs2UserFx2ProcessHandler processHandler; + + size_t commonSize; + size_t paramSize; + size_t workSize; + uintptr_t userData; +}; + +struct OrbisNgs2CustomRackModuleInfo { + const OrbisNgs2CustomModuleOption* option; + + u32 moduleId; + u32 sourceBufferId; + u32 extraBufferId; + u32 destBufferId; + u32 stateOffset; + u32 stateSize; + u32 reserved; + u32 reserved2; +}; + +struct OrbisNgs2CustomRackPortInfo { + u32 sourceBufferId; + u32 reserved; +}; + +struct OrbisNgs2CustomRackOption { + OrbisNgs2RackOption rackOption; + u32 stateSize; + u32 numBuffers; + u32 numModules; + u32 reserved; + OrbisNgs2CustomRackModuleInfo aModule[ORBIS_NGS2_CUSTOM_MAX_MODULES]; + OrbisNgs2CustomRackPortInfo aPort[ORBIS_NGS2_CUSTOM_MAX_PORTS]; +}; + +struct OrbisNgs2CustomSamplerRackOption { + OrbisNgs2CustomRackOption customRackOption; + + u32 maxChannelWorks; + u32 maxWaveformBlocks; + u32 maxAtrac9Decoders; + u32 maxAtrac9ChannelWorks; + u32 maxAjmAtrac9Decoders; + u32 maxCodecCaches; +}; + +struct OrbisNgs2CustomSubmixerRackOption { + OrbisNgs2CustomRackOption customRackOption; + + u32 maxChannels; + u32 maxInputs; +}; + +struct OrbisNgs2CustomMasteringRackOption { + OrbisNgs2CustomRackOption customRackOption; + + u32 maxChannels; + u32 maxInputs; +}; + +struct OrbisNgs2CustomSamplerVoiceSetupParam { + OrbisNgs2VoiceParamHeader header; + OrbisNgs2WaveformFormat format; + u32 flags; + u32 reserved; +}; + +struct OrbisNgs2CustomSamplerVoiceWaveformBlocksParam { + OrbisNgs2VoiceParamHeader header; + const void* data; + u32 flags; + u32 numBlocks; + const OrbisNgs2WaveformBlock* aBlock; +}; + +struct OrbisNgs2CustomSamplerVoiceWaveformAddressParam { + OrbisNgs2VoiceParamHeader header; + const void* from; + const void* to; +}; + +struct OrbisNgs2CustomSamplerVoiceWaveformFrameOffsetParam { + OrbisNgs2VoiceParamHeader header; + u32 frameOffset; + u32 reserved; +}; + +struct OrbisNgs2CustomSamplerVoiceExitLoopParam { + OrbisNgs2VoiceParamHeader header; +}; + +struct OrbisNgs2CustomSamplerVoicePitchParam { + OrbisNgs2VoiceParamHeader header; + float ratio; + u32 reserved; +}; + +struct OrbisNgs2CustomSamplerVoiceState { + OrbisNgs2VoiceState voiceState; + char padding[32]; + const void* waveformData; + u64 numDecodedSamples; + u64 decodedDataSize; + u64 userData; + u32 reserved; + u32 reserved2; +}; + +struct OrbisNgs2CustomSubmixerVoiceSetupParam { + OrbisNgs2VoiceParamHeader header; + u32 numInputChannels; + u32 numOutputChannels; + u32 flags; + u32 reserved; +}; + +struct OrbisNgs2CustomSubmixerVoiceState { + OrbisNgs2VoiceState voiceState; // Voice state + u32 reserved; + u32 reserved2; +}; + +struct OrbisNgs2CustomMasteringVoiceSetupParam { + OrbisNgs2VoiceParamHeader header; + u32 numInputChannels; + u32 flags; +}; + +struct OrbisNgs2CustomMasteringVoiceOutputParam { + OrbisNgs2VoiceParamHeader header; + u32 outputId; + u32 reserved; +}; + +struct OrbisNgs2CustomMasteringVoiceState { + OrbisNgs2VoiceState voiceState; + u32 reserved; + u32 reserved2; +}; + +struct OrbisNgs2CustomVoiceEnvelopeParam { + OrbisNgs2VoiceParamHeader header; + u32 numForwardPoints; + u32 numReleasePoints; + const OrbisNgs2EnvelopePoint* aPoint; +}; + +struct OrbisNgs2CustomVoiceDistortionParam { + OrbisNgs2VoiceParamHeader header; + u32 flags; + float a; + float b; + float clip; + float gate; + float wetLevel; + float dryLevel; + u32 reserved; +}; + +struct OrbisNgs2CustomVoiceCompressorParam { + OrbisNgs2VoiceParamHeader header; + u32 flags; + float threshold; + float ratio; + float knee; + float attackTime; + float releaseTime; + float level; + u32 reserved; +}; + +struct OrbisNgs2CustomVoiceFilterParam { + OrbisNgs2VoiceParamHeader header; + u32 type; + u32 channelMask; + union { + struct { + float i0; + float i1; + float i2; + float o1; + float o2; + } direct; + struct { + float fc; + float q; + float level; + u32 reserved; + u32 reserved2; + } fcq; + } param; + u32 reserved3; +}; + +struct OrbisNgs2CustomVoiceLfeFilterParam { + OrbisNgs2VoiceParamHeader header; + u32 enableFlag; + u32 fc; +}; + +struct OrbisNgs2CustomVoiceGainParam { + OrbisNgs2VoiceParamHeader header; + float aLevel[ORBIS_NGS2_MAX_VOICE_CHANNELS]; +}; + +struct OrbisNgs2CustomVoiceMixerParam { + OrbisNgs2VoiceParamHeader header; + float aSourceLevel[ORBIS_NGS2_MAX_VOICE_CHANNELS]; + float aDestLevel[ORBIS_NGS2_MAX_VOICE_CHANNELS]; +}; + +struct OrbisNgs2CustomVoiceChannelMixerParam { + OrbisNgs2VoiceParamHeader header; + float aLevel[ORBIS_NGS2_MAX_VOICE_CHANNELS][ORBIS_NGS2_MAX_VOICE_CHANNELS]; +}; + +struct OrbisNgs2CustomVoiceUserFxParam { + OrbisNgs2VoiceParamHeader header; + OrbisNgs2UserFxProcessHandler handler; + + uintptr_t userData0; + uintptr_t userData1; + uintptr_t userData2; +}; + +struct OrbisNgs2CustomVoiceUserFx2Param { + OrbisNgs2VoiceParamHeader header; + const void* data; + size_t dataSize; +}; + +struct OrbisNgs2CustomVoiceOutputParam { + OrbisNgs2VoiceParamHeader header; + u32 outputId; + u32 reserved; +}; + +struct OrbisNgs2CustomVoicePeakMeterParam { + OrbisNgs2VoiceParamHeader header; + u32 enableFlag; + u32 reserved; +} OrbisNgs2CustomVoicePeakMeterParam; + +struct OrbisNgs2CustomVoiceReverbParam { + OrbisNgs2VoiceParamHeader header; + OrbisNgs2ReverbI3DL2Param i3dl2; +}; + +struct OrbisNgs2CustomVoiceChorusParam { + OrbisNgs2VoiceParamHeader header; + u32 flags; + u32 numPhases; + u32 channelMask; + float inputLevel; + float delayTime; + float modulationRatio; + float modulationDepth; + float feedbackLevel; + float wetLevel; + float dryLevel; +}; + +struct OrbisNgs2DelayTapInfo { + float tapLevel; + float delayTime; +}; + +struct OrbisNgs2CustomVoiceDelayParam { + OrbisNgs2VoiceParamHeader header; + float dryLevel; + float wetLevel; + float inputLevel; + float feedbackLevel; + float lowpassFc; + u32 numTaps; + OrbisNgs2DelayTapInfo aTap[ORBIS_NGS2_CUSTOM_DELAY_MAX_TAPS]; + float aInputMixLevel[ORBIS_NGS2_MAX_VOICE_CHANNELS]; + u32 channelMask; + u32 flags; +}; + +struct OrbisNgs2CustomVoiceNoiseGateParam { + OrbisNgs2VoiceParamHeader header; + u32 flags; + float threshold; + float attackTime; + float releaseTime; +}; + +struct OrbisNgs2CustomVoicePitchShiftParam { + OrbisNgs2VoiceParamHeader header; + s32 cent; +}; + +struct OrbisNgs2CustomEnvelopeModuleState { + float height; + u32 reserved; +}; + +struct OrbisNgs2CustomCompressorModuleState { + float peakHeight; + float compressorHeight; +}; + +struct OrbisNgs2CustomPeakMeterModuleState { + float peak; + float aChannelPeak[ORBIS_NGS2_MAX_VOICE_CHANNELS]; + u32 reserved; +}; + +struct OrbisNgs2CustomNoiseGateModuleState { + float gateHeight; +}; + +struct OrbisNgs2CustomRackInfo { + OrbisNgs2RackInfo rackInfo; + u32 stateSize; + u32 numBuffers; + u32 numModules; + u32 reserved; + OrbisNgs2CustomRackModuleInfo aModule[ORBIS_NGS2_CUSTOM_MAX_MODULES]; + OrbisNgs2CustomRackPortInfo aPort[ORBIS_NGS2_CUSTOM_MAX_PORTS]; +}; + +struct OrbisNgs2CustomSamplerRackInfo { + OrbisNgs2CustomRackInfo customRackInfo; + + u32 maxChannelWorks; + u32 maxWaveformBlocks; + u32 maxAtrac9Decoders; + u32 maxAtrac9ChannelWorks; + u32 maxAjmAtrac9Decoders; + u32 maxCodecCaches; +}; + +struct OrbisNgs2CustomSubmixerRackInfo { + OrbisNgs2CustomRackInfo customRackInfo; + + u32 maxChannels; + u32 maxInputs; +}; + +struct OrbisNgs2CustomMasteringRackInfo { + OrbisNgs2CustomRackInfo customRackInfo; + + u32 maxChannels; + u32 maxInputs; +}; + +struct OrbisNgs2CustomModuleInfo { + u32 moduleId; + u32 sourceBufferId; + u32 extraBufferId; + u32 destBufferId; + u32 stateOffset; + u32 stateSize; + u32 reserved; + u32 reserved2; +}; + +struct OrbisNgs2CustomEnvelopeModuleInfo { + OrbisNgs2CustomModuleInfo moduleInfo; + + u32 maxPoints; + u32 reserved; +}; + +struct OrbisNgs2CustomReverbModuleInfo { + OrbisNgs2CustomModuleInfo moduleInfo; + + u32 reverbSize; + u32 reserved; +}; + +} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_eq.cpp b/src/core/libraries/ngs2/ngs2_eq.cpp new file mode 100644 index 000000000..8c82e4e49 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_eq.cpp @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ngs2_error.h" +#include "ngs2_impl.h" + +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" + +using namespace Libraries::Kernel; + +namespace Libraries::Ngs2 {} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_eq.h b/src/core/libraries/ngs2/ngs2_eq.h new file mode 100644 index 000000000..99688f24e --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_eq.h @@ -0,0 +1,41 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "ngs2.h" + +namespace Libraries::Ngs2 { + +class Ngs2Eq; + +struct OrbisNgs2EqVoiceSetupParam { + u32 numChannels; +}; + +struct OrbisNgs2EqVoiceFilterParam { + u32 type; + u32 channelMask; + union { + struct { + float i0; + float i1; + float i2; + float o1; + float o2; + } direct; + struct { + float fc; + float q; + float level; + u32 reserved; + u32 reserved2; + } fcq; + } param; +}; + +struct OrbisNgs2EqVoiceState { + u32 stateFlags; +}; + +} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_geom.cpp b/src/core/libraries/ngs2/ngs2_geom.cpp new file mode 100644 index 000000000..8c82e4e49 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_geom.cpp @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ngs2_error.h" +#include "ngs2_impl.h" + +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" + +using namespace Libraries::Kernel; + +namespace Libraries::Ngs2 {} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_geom.h b/src/core/libraries/ngs2/ngs2_geom.h new file mode 100644 index 000000000..93af99d8d --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_geom.h @@ -0,0 +1,80 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "ngs2.h" + +namespace Libraries::Ngs2 { + +class Ngs2Geom; + +struct OrbisNgs2GeomVector { + float x; + float y; + float z; +}; + +struct OrbisNgs2GeomCone { + float innerLevel; + float innerAngle; + float outerLevel; + float outerAngle; +}; + +struct OrbisNgs2GeomRolloff { + u32 model; + float maxDistance; + float rolloffFactor; + float referenceDistance; +}; + +struct OrbisNgs2GeomListenerParam { + OrbisNgs2GeomVector position; + OrbisNgs2GeomVector orientFront; + OrbisNgs2GeomVector orientUp; + OrbisNgs2GeomVector velocity; + float soundSpeed; + u32 reserved[2]; +}; + +struct OrbisNgs2GeomListenerWork { + float matrix[4][4]; + OrbisNgs2GeomVector velocity; + float soundSpeed; + u32 coordinate; + u32 reserved[3]; +}; + +struct OrbisNgs2GeomSourceParam { + OrbisNgs2GeomVector position; + OrbisNgs2GeomVector velocity; + OrbisNgs2GeomVector direction; + OrbisNgs2GeomCone cone; + OrbisNgs2GeomRolloff rolloff; + float dopplerFactor; + float fbwLevel; + float lfeLevel; + float maxLevel; + float minLevel; + float radius; + u32 numSpeakers; + u32 matrixFormat; + u32 reserved[2]; +}; + +struct OrbisNgs2GeomA3dAttribute { + OrbisNgs2GeomVector position; + float volume; + u32 reserved[4]; +}; + +struct OrbisNgs2GeomAttribute { + float pitchRatio; + float aLevel[ORBIS_NGS2_MAX_VOICE_CHANNELS * ORBIS_NGS2_MAX_VOICE_CHANNELS]; + + OrbisNgs2GeomA3dAttribute a3dAttrib; + u32 reserved[4]; +}; + +} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_impl.cpp b/src/core/libraries/ngs2/ngs2_impl.cpp index b358a05f7..1248f76d7 100644 --- a/src/core/libraries/ngs2/ngs2_impl.cpp +++ b/src/core/libraries/ngs2/ngs2_impl.cpp @@ -12,153 +12,171 @@ using namespace Libraries::Kernel; namespace Libraries::Ngs2 { -s32 Ngs2::ReportInvalid(Ngs2Handle* handle, u32 handle_type) const { - uintptr_t hAddress = reinterpret_cast(handle); - switch (handle_type) { +s32 HandleReportInvalid(OrbisNgs2Handle handle, u32 handleType) { + switch (handleType) { case 1: - LOG_ERROR(Lib_Ngs2, "Invalid system handle {}", hAddress); + LOG_ERROR(Lib_Ngs2, "Invalid system handle {}", handle); return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE; case 2: - LOG_ERROR(Lib_Ngs2, "Invalid rack handle {}", hAddress); + LOG_ERROR(Lib_Ngs2, "Invalid rack handle {}", handle); return ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE; case 4: - LOG_ERROR(Lib_Ngs2, "Invalid voice handle {}", hAddress); + LOG_ERROR(Lib_Ngs2, "Invalid voice handle {}", handle); return ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE; case 8: - LOG_ERROR(Lib_Ngs2, "Invalid report handle {}", hAddress); + LOG_ERROR(Lib_Ngs2, "Invalid report handle {}", handle); return ORBIS_NGS2_ERROR_INVALID_REPORT_HANDLE; default: - LOG_ERROR(Lib_Ngs2, "Invalid handle {}", hAddress); + LOG_ERROR(Lib_Ngs2, "Invalid handle {}", handle); return ORBIS_NGS2_ERROR_INVALID_HANDLE; } } -s32 Ngs2::HandleSetup(Ngs2Handle* handle, void* data, std::atomic* atomic, u32 type, - u32 flags) { - handle->dataPointer = data; - handle->atomicPtr = atomic; - handle->handleType = type; - handle->flags_unk = flags; - return ORBIS_OK; +void* MemoryClear(void* buffer, size_t size) { + return memset(buffer, 0, size); } -s32 Ngs2::HandleCleanup(Ngs2Handle* handle, u32 hType, void* dataOut) { - if (handle && handle->selfPointer == handle) { - std::atomic* tmp_atomic = handle->atomicPtr; - if (tmp_atomic && handle->handleType == hType) { - while (tmp_atomic->load() != 0) { - u32 expected = 1; - if (tmp_atomic->compare_exchange_strong(expected, 0)) { - if (dataOut) { - dataOut = handle->dataPointer; - } - // sceNgs2MemoryClear(handle, 32); - return ORBIS_OK; - } - tmp_atomic = handle->atomicPtr; - } - } - } - return this->ReportInvalid(handle, hType); -} - -s32 Ngs2::HandleEnter(Ngs2Handle* handle, u32 hType, Ngs2Handle* handleOut) { - if (!handle) { - return this->ReportInvalid(handle, 0); - } - - if (handle->selfPointer != handle || !handle->atomicPtr || !handle->dataPointer || - (~hType & handle->handleType)) { - return this->ReportInvalid(handle, handle->handleType); - } - - std::atomic* atomic = handle->atomicPtr; - while (true) { - u32 i = atomic->load(); - if (i == 0) { - return this->ReportInvalid(handle, handle->handleType); - } - if (atomic->compare_exchange_strong(i, i + 1)) { - break; - } - } - - if (handleOut) { - handleOut = handle; +s32 StackBufferClose(StackBuffer* stackBuffer, size_t* outTotalSize) { + if (outTotalSize) { + *outTotalSize = stackBuffer->usedSize + stackBuffer->alignment; } return ORBIS_OK; } -s32 Ngs2::HandleLeave(Ngs2Handle* handle) { - std::atomic* tmp_atomic; - u32 i; - do { - tmp_atomic = handle->atomicPtr; - i = tmp_atomic->load(); - } while (!tmp_atomic->compare_exchange_strong(i, i - 1)); - return ORBIS_OK; -} +s32 StackBufferOpen(StackBuffer* stackBuffer, void* bufferStart, size_t bufferSize, + void** outBuffer, u8 flags) { + stackBuffer->top = outBuffer; + stackBuffer->base = bufferStart; + stackBuffer->size = (size_t)bufferStart; + stackBuffer->currentOffset = (size_t)bufferStart; + stackBuffer->usedSize = 0; + stackBuffer->totalSize = bufferSize; + stackBuffer->alignment = 8; // this is a fixed value + stackBuffer->flags = flags; -s32 Ngs2::StackBufferOpen(StackBuffer* buf, void* base_addr, size_t size, void** stackTop, - bool verify) { - buf->top = stackTop; - buf->base = base_addr; - buf->curr = base_addr; - buf->usedSize = 0; - buf->totalSize = size; - buf->alignment = 8; - buf->isVerifyEnabled = verify; - - if (stackTop) { - *stackTop = nullptr; + if (outBuffer != NULL) { + *outBuffer = NULL; } return ORBIS_OK; } -s32 Ngs2::StackBufferClose(StackBuffer* buf, size_t* usedSize) { - if (usedSize) { - *usedSize = buf->usedSize + buf->alignment; +s32 SystemCleanup(OrbisNgs2Handle systemHandle, OrbisNgs2ContextBufferInfo* outInfo) { + if (!systemHandle) { + return ORBIS_NGS2_ERROR_INVALID_HANDLE; } + // TODO + return ORBIS_OK; } -s32 Ngs2::SystemSetupCore(StackBuffer* buf, SystemOptions* options, Ngs2Handle** sysOut) { +s32 SystemSetupCore(StackBuffer* stackBuffer, const OrbisNgs2SystemOption* option, + SystemInternal* outSystem) { u32 maxGrainSamples = 512; u32 numGrainSamples = 256; u32 sampleRate = 48000; - if (options) { - maxGrainSamples = options->maxGrainSamples; - numGrainSamples = options->numGrainSamples; - sampleRate = options->sampleRate; + if (option) { + sampleRate = option->sampleRate; + maxGrainSamples = option->maxGrainSamples; + numGrainSamples = option->numGrainSamples; } - // Validate maxGrainSamples - if (maxGrainSamples < 64 || maxGrainSamples > 1024 || (maxGrainSamples & 0x3F) != 0) { + if (maxGrainSamples < 64 || maxGrainSamples > 1024 || (maxGrainSamples & 63) != 0) { LOG_ERROR(Lib_Ngs2, "Invalid system option (maxGrainSamples={},x64)", maxGrainSamples); return ORBIS_NGS2_ERROR_INVALID_MAX_GRAIN_SAMPLES; } - // Validate numGrainSamples - if (numGrainSamples < 64 || numGrainSamples > 1024 || (numGrainSamples & 0x3F) != 0) { + if (numGrainSamples < 64 || numGrainSamples > 1024 || (numGrainSamples & 63) != 0) { LOG_ERROR(Lib_Ngs2, "Invalid system option (numGrainSamples={},x64)", numGrainSamples); return ORBIS_NGS2_ERROR_INVALID_NUM_GRAIN_SAMPLES; } - // Validate sampleRate if (sampleRate != 11025 && sampleRate != 12000 && sampleRate != 22050 && sampleRate != 24000 && - sampleRate != 44100 && sampleRate != 48000 && sampleRate != 88200 && sampleRate != 96000) { + sampleRate != 44100 && sampleRate != 48000 && sampleRate != 88200 && sampleRate != 96000 && + sampleRate != 176400 && sampleRate != 192000) { LOG_ERROR(Lib_Ngs2, "Invalid system option(sampleRate={}:44.1/48kHz series)", sampleRate); return ORBIS_NGS2_ERROR_INVALID_SAMPLE_RATE; } - int result = ORBIS_OK; + return ORBIS_OK; +} +s32 SystemSetup(const OrbisNgs2SystemOption* option, OrbisNgs2ContextBufferInfo* hostBufferInfo, + OrbisNgs2BufferFreeHandler hostFree, OrbisNgs2Handle* outHandle) { + u8 optionFlags = 0; + StackBuffer stackBuffer; + SystemInternal setupResult; + void* systemList = NULL; + size_t requiredBufferSize = 0; + u32 result = ORBIS_NGS2_ERROR_INVALID_BUFFER_SIZE; + + if (option) { + if (option->size != 64) { + LOG_ERROR(Lib_Ngs2, "Invalid system option size ({})", option->size); + return ORBIS_NGS2_ERROR_INVALID_OPTION_SIZE; + } + optionFlags = option->flags >> 31; + } + + // Init + StackBufferOpen(&stackBuffer, NULL, 0, NULL, optionFlags); + result = SystemSetupCore(&stackBuffer, option, 0); + + if (result < 0) { + return result; + } + + StackBufferClose(&stackBuffer, &requiredBufferSize); + + // outHandle unprovided + if (!outHandle) { + hostBufferInfo->hostBuffer = NULL; + hostBufferInfo->hostBufferSize = requiredBufferSize; + MemoryClear(&hostBufferInfo->reserved, sizeof(hostBufferInfo->reserved)); + return ORBIS_OK; + } + + if (!hostBufferInfo->hostBuffer) { + LOG_ERROR(Lib_Ngs2, "Invalid system buffer address ({})", hostBufferInfo->hostBuffer); + return ORBIS_NGS2_ERROR_INVALID_BUFFER_ADDRESS; + } + + if (hostBufferInfo->hostBufferSize < requiredBufferSize) { + LOG_ERROR(Lib_Ngs2, "Invalid system buffer size ({}<{}[byte])", + hostBufferInfo->hostBufferSize, requiredBufferSize); + return ORBIS_NGS2_ERROR_INVALID_BUFFER_SIZE; + } + + // Setup + StackBufferOpen(&stackBuffer, hostBufferInfo->hostBuffer, hostBufferInfo->hostBufferSize, + &systemList, optionFlags); + result = SystemSetupCore(&stackBuffer, option, &setupResult); + + if (result < 0) { + return result; + } + + StackBufferClose(&stackBuffer, &requiredBufferSize); + + // Copy buffer results + setupResult.bufferInfo = *hostBufferInfo; + setupResult.hostFree = hostFree; // TODO + // setupResult.systemList = systemList; - return result; // Success + OrbisNgs2Handle systemHandle = setupResult.systemHandle; + if (hostBufferInfo->hostBufferSize >= requiredBufferSize) { + *outHandle = systemHandle; + return ORBIS_OK; + } + + SystemCleanup(systemHandle, 0); + + LOG_ERROR(Lib_Ngs2, "Invalid system buffer size ({}<{}[byte])", hostBufferInfo->hostBufferSize, + requiredBufferSize); + return ORBIS_NGS2_ERROR_INVALID_BUFFER_SIZE; } } // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_impl.h b/src/core/libraries/ngs2/ngs2_impl.h index fea87c51c..7be0f89cc 100644 --- a/src/core/libraries/ngs2/ngs2_impl.h +++ b/src/core/libraries/ngs2/ngs2_impl.h @@ -3,23 +3,176 @@ #pragma once -#include "ngs2.h" +#include "core/libraries/kernel/threads/pthread.h" namespace Libraries::Ngs2 { -class Ngs2 { -public: - s32 ReportInvalid(Ngs2Handle* handle, u32 handle_type) const; - s32 HandleSetup(Ngs2Handle* handle, void* data, std::atomic* atomic, u32 type, u32 flags); - s32 HandleCleanup(Ngs2Handle* handle, u32 hType, void* dataOut); - s32 HandleEnter(Ngs2Handle* handle, u32 hType, Ngs2Handle* handleOut); - s32 HandleLeave(Ngs2Handle* handle); - s32 StackBufferOpen(StackBuffer* buf, void* base_addr, size_t size, void** stackTop, - bool verify); - s32 StackBufferClose(StackBuffer* buf, size_t* usedSize); - s32 SystemSetupCore(StackBuffer* buf, SystemOptions* options, Ngs2Handle** sysOut); +static const int ORBIS_NGS2_SYSTEM_NAME_LENGTH = 16; +static const int ORBIS_NGS2_RACK_NAME_LENGTH = 16; -private: +typedef uintptr_t OrbisNgs2Handle; + +struct OrbisNgs2ContextBufferInfo { + void* hostBuffer; + size_t hostBufferSize; + uintptr_t reserved[5]; + uintptr_t userData; }; +struct OrbisNgs2SystemOption { + size_t size; + char name[ORBIS_NGS2_SYSTEM_NAME_LENGTH]; + + u32 flags; + u32 maxGrainSamples; + u32 numGrainSamples; + u32 sampleRate; + u32 aReserved[6]; +}; + +typedef s32 (*OrbisNgs2BufferAllocHandler)(OrbisNgs2ContextBufferInfo* ioBufferInfo); +typedef s32 (*OrbisNgs2BufferFreeHandler)(OrbisNgs2ContextBufferInfo* ioBufferInfo); + +struct OrbisNgs2SystemInfo { + char name[ORBIS_NGS2_SYSTEM_NAME_LENGTH]; // 0 + + OrbisNgs2Handle systemHandle; // 16 + OrbisNgs2ContextBufferInfo bufferInfo; // 24 + + u32 uid; // 88 + u32 minGrainSamples; // 92 + u32 maxGrainSamples; // 96 + + u32 stateFlags; // 100 + u32 rackCount; // 104 + float lastRenderRatio; // 108 + s64 lastRenderTick; // 112 + s64 renderCount; // 120 + u32 sampleRate; // 128 + u32 numGrainSamples; // 132 +}; + +struct OrbisNgs2RackInfo { + char name[ORBIS_NGS2_RACK_NAME_LENGTH]; // 0 + + OrbisNgs2Handle rackHandle; // 16 + OrbisNgs2ContextBufferInfo bufferInfo; // 24 + + OrbisNgs2Handle ownerSystemHandle; // 88 + + u32 type; // 96 + u32 rackId; // 100 + u32 uid; // 104 + u32 minGrainSamples; // 108 + u32 maxGrainSamples; // 112 + u32 maxVoices; // 116 + u32 maxChannelWorks; // 120 + u32 maxInputs; // 124 + u32 maxMatrices; // 128 + u32 maxPorts; // 132 + + u32 stateFlags; // 136 + float lastProcessRatio; // 140 + u64 lastProcessTick; // 144 + u64 renderCount; // 152 + u32 activeVoiceCount; // 160 + u32 activeChannelWorkCount; // 164 +}; + +struct StackBuffer { + void** top; + void* base; + size_t size; + size_t currentOffset; + size_t usedSize; + size_t totalSize; + size_t alignment; + u8 flags; + char padding[7]; +}; + +struct SystemInternal { + // setup init + char name[ORBIS_NGS2_SYSTEM_NAME_LENGTH]; // 0 + OrbisNgs2ContextBufferInfo bufferInfo; // 16 + OrbisNgs2BufferFreeHandler hostFree; // 80 + OrbisNgs2Handle systemHandle; // 88 + void* unknown1; // 96 + void* unknown2; // 104 + OrbisNgs2Handle rackHandle; // 112 + uintptr_t* userData; // 120 + SystemInternal* systemList; // 128 + StackBuffer* stackBuffer; // 136 + OrbisNgs2SystemInfo ownerSystemInfo; // 144 + + struct rackList { + void* prev; + void* next; + void* unknown; + }; + + rackList rackListPreset; // 152 + rackList rackListNormal; // 176 + rackList rackListMaster; // 200 + + void* unknown3; // 208 + void* systemListPrev; // 216 + void* unknown4; // 224 + void* systemListNext; // 232 + void* rackFunction; // 240 + + Kernel::PthreadMutex processLock; // 248 + u32 hasProcessMutex; // 256 + u32 unknown5; // 260 + Kernel::PthreadMutex flushLock; // 264 + u32 hasFlushMutex; // 272 + u32 unknown6; // 276 + + // info + u64 lastRenderTick; // 280 + u64 renderCount; // 288 + u32 isActive; // 296 + std::atomic lockCount; // 300 + u32 uid; // 304 + u32 systemType; // 308 + + struct { + u8 isBufferValid : 1; + u8 isRendering : 1; + u8 isSorted : 1; + u8 isFlushReady : 1; + } flags; // 312 + + u16 currentMaxGrainSamples; // 316 + u16 minGrainSamples; // 318 + u16 maxGrainSamples; // 320 + u16 numGrainSamples; // 322 + u32 currentNumGrainSamples; // 324 + u32 sampleRate; // 328 + u32 currentSampleRate; // 332 + u32 rackCount; // 336 + float lastRenderRatio; // 340 + float cpuLoad; // 344 +}; + +struct HandleInternal { + HandleInternal* selfPtr; // 0 + SystemInternal* systemData; // 8 + std::atomic refCount; // 16 + u32 handleType; // 24 + u32 handleID; // 28 +}; + +s32 StackBufferClose(StackBuffer* stackBuffer, size_t* outTotalSize); +s32 StackBufferOpen(StackBuffer* stackBuffer, void* buffer, size_t bufferSize, void** outBuffer, + u8 flags); +s32 SystemSetupCore(StackBuffer* stackBuffer, const OrbisNgs2SystemOption* option, + SystemInternal* outSystem); + +s32 HandleReportInvalid(OrbisNgs2Handle handle, u32 handleType); +void* MemoryClear(void* buffer, size_t size); +s32 SystemCleanup(OrbisNgs2Handle systemHandle, OrbisNgs2ContextBufferInfo* outInfo); +s32 SystemSetup(const OrbisNgs2SystemOption* option, OrbisNgs2ContextBufferInfo* hostBufferInfo, + OrbisNgs2BufferFreeHandler hostFree, OrbisNgs2Handle* outHandle); + } // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_mastering.cpp b/src/core/libraries/ngs2/ngs2_mastering.cpp new file mode 100644 index 000000000..8c82e4e49 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_mastering.cpp @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ngs2_error.h" +#include "ngs2_impl.h" + +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" + +using namespace Libraries::Kernel; + +namespace Libraries::Ngs2 {} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_mastering.h b/src/core/libraries/ngs2/ngs2_mastering.h new file mode 100644 index 000000000..e0ba478c3 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_mastering.h @@ -0,0 +1,81 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "ngs2.h" + +namespace Libraries::Ngs2 { + +class Ngs2Mastering; + +struct OrbisNgs2MasteringRackOption { + OrbisNgs2RackOption rackOption; + u32 maxChannels; + u32 numPeakMeterBlocks; +}; + +struct OrbisNgs2MasteringVoiceSetupParam { + OrbisNgs2VoiceParamHeader header; + + u32 numInputChannels; + u32 flags; +}; + +struct OrbisNgs2MasteringVoiceMatrixParam { + OrbisNgs2VoiceParamHeader header; + + u32 type; + u32 numLevels; + const float* aLevel; +}; + +struct OrbisNgs2MasteringVoiceLfeParam { + OrbisNgs2VoiceParamHeader header; + + u32 enableFlag; + u32 fc; +}; + +struct OrbisNgs2MasteringVoiceLimiterParam { + OrbisNgs2VoiceParamHeader header; + + u32 enableFlag; + float threshold; +}; + +struct OrbisNgs2MasteringVoiceGainParam { + OrbisNgs2VoiceParamHeader header; + + float fbwLevel; + float lfeLevel; +}; + +struct OrbisNgs2MasteringVoiceOutputParam { + OrbisNgs2VoiceParamHeader header; + + u32 outputId; + u32 reserved; +}; + +struct OrbisNgs2MasteringVoicePeakMeterParam { + OrbisNgs2VoiceParamHeader header; + u32 enableFlag; + u32 reserved; +}; + +struct OrbisNgs2MasteringVoiceState { + OrbisNgs2VoiceState voiceState; + float limiterPeakLevel; + float limiterPressLevel; + float aInputPeakHeight[ORBIS_NGS2_MAX_VOICE_CHANNELS]; + float aOutputPeakHeight[ORBIS_NGS2_MAX_VOICE_CHANNELS]; +}; + +struct OrbisNgs2MasteringRackInfo { + OrbisNgs2RackInfo rackInfo; + u32 maxChannels; + u32 reserved; +}; + +} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_pan.cpp b/src/core/libraries/ngs2/ngs2_pan.cpp new file mode 100644 index 000000000..8c82e4e49 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_pan.cpp @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ngs2_error.h" +#include "ngs2_impl.h" + +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" + +using namespace Libraries::Kernel; + +namespace Libraries::Ngs2 {} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_pan.h b/src/core/libraries/ngs2/ngs2_pan.h new file mode 100644 index 000000000..d39ec67cd --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_pan.h @@ -0,0 +1,25 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "ngs2.h" + +namespace Libraries::Ngs2 { + +class Ngs2Pan; + +struct OrbisNgs2PanParam { + float angle; + float distance; + float fbwLevel; + float lfeLevel; +}; + +struct OrbisNgs2PanWork { + float aSpeakerAngle[ORBIS_NGS2_MAX_VOICE_CHANNELS]; + float unitAngle; + u32 numSpeakers; +}; + +} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_report.cpp b/src/core/libraries/ngs2/ngs2_report.cpp new file mode 100644 index 000000000..8c82e4e49 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_report.cpp @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ngs2_error.h" +#include "ngs2_impl.h" + +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" + +using namespace Libraries::Kernel; + +namespace Libraries::Ngs2 {} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_report.h b/src/core/libraries/ngs2/ngs2_report.h new file mode 100644 index 000000000..88f6d1df0 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_report.h @@ -0,0 +1,78 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "ngs2.h" + +#include // va_list + +namespace Libraries::Ngs2 { + +class Ngs2Report; + +struct OrbisNgs2ReportDataHeader { + size_t size; + OrbisNgs2Handle handle; + u32 type; + s32 result; +}; + +typedef void (*OrbisNgs2ReportHandler)(const OrbisNgs2ReportDataHeader* data, uintptr_t userData); + +struct OrbisNgs2ReportMessageData { + OrbisNgs2ReportDataHeader header; + const char* message; +}; + +struct OrbisNgs2ReportApiData { + OrbisNgs2ReportDataHeader header; + const char* functionName; + const char* format; + va_list argument; +}; + +struct OrbisNgs2ReportControlData { + OrbisNgs2ReportDataHeader header; + const OrbisNgs2VoiceParamHeader* param; +}; + +struct OrbisNgs2ReportOutputData { + OrbisNgs2ReportDataHeader header; + const OrbisNgs2RenderBufferInfo* bufferInfo; + + u32 bufferIndex; + u32 sampleRate; + u32 numGrainSamples; + u32 reserved; +}; + +struct OrbisNgs2ReportCpuLoadData { + OrbisNgs2ReportDataHeader header; + float totalRatio; + float flushRatio; + float processRatio; + float feedbackRatio; +}; + +struct OrbisNgs2ReportRenderStateData { + OrbisNgs2ReportDataHeader header; + u32 state; + u32 reserved; +}; + +struct OrbisNgs2ReportVoiceWaveformData { + OrbisNgs2ReportDataHeader header; + u32 location; + u32 waveformType; + u32 numChannels; + u32 sampleRate; + u32 numGrainSamples; + u32 reserved; + void* const* aData; +}; + +s32 PS4_SYSV_ABI sceNgs2ReportRegisterHandler(u32 reportType, OrbisNgs2ReportHandler handler, + uintptr_t userData, OrbisNgs2Handle* outHandle); + +} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_reverb.cpp b/src/core/libraries/ngs2/ngs2_reverb.cpp new file mode 100644 index 000000000..8c82e4e49 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_reverb.cpp @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ngs2_error.h" +#include "ngs2_impl.h" + +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" + +using namespace Libraries::Kernel; + +namespace Libraries::Ngs2 {} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_reverb.h b/src/core/libraries/ngs2/ngs2_reverb.h new file mode 100644 index 000000000..715d7480a --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_reverb.h @@ -0,0 +1,61 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "ngs2.h" + +namespace Libraries::Ngs2 { + +class Ngs2Reverb; + +struct OrbisNgs2ReverbRackOption { + OrbisNgs2RackOption rackOption; + u32 maxChannels; + u32 reverbSize; +}; + +struct OrbisNgs2ReverbI3DL2Param { + float wet; + float dry; + s32 room; + s32 roomHF; + u32 reflectionPattern; + float decayTime; + float decayHFRatio; + s32 reflections; + float reflectionsDelay; + s32 reverb; + float reverbDelay; + float diffusion; + float density; + float HFReference; + u32 reserve[8]; +}; + +struct OrbisNgs2ReverbVoiceSetupParam { + OrbisNgs2VoiceParamHeader header; + + u32 numInputChannels; + u32 numOutputChannels; + u32 flags; + u32 reserved; +}; + +struct OrbisNgs2ReverbVoiceI3DL2Param { + OrbisNgs2VoiceParamHeader header; + + OrbisNgs2ReverbI3DL2Param i3dl2; +}; + +struct OrbisNgs2ReverbVoiceState { + OrbisNgs2VoiceState voiceState; +}; + +struct OrbisNgs2ReverbRackInfo { + OrbisNgs2RackInfo rackInfo; + u32 maxChannels; + u32 reverbSize; +}; + +} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_sampler.cpp b/src/core/libraries/ngs2/ngs2_sampler.cpp new file mode 100644 index 000000000..8c82e4e49 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_sampler.cpp @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ngs2_error.h" +#include "ngs2_impl.h" + +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" + +using namespace Libraries::Kernel; + +namespace Libraries::Ngs2 {} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_sampler.h b/src/core/libraries/ngs2/ngs2_sampler.h new file mode 100644 index 000000000..0842b9cb2 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_sampler.h @@ -0,0 +1,162 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "ngs2.h" + +namespace Libraries::Ngs2 { + +class Ngs2Sampler; + +struct OrbisNgs2SamplerRackOption { + OrbisNgs2RackOption rackOption; + u32 maxChannelWorks; + u32 maxCodecCaches; + u32 maxWaveformBlocks; + u32 maxEnvelopePoints; + u32 maxFilters; + u32 maxAtrac9Decoders; + u32 maxAtrac9ChannelWorks; + u32 maxAjmAtrac9Decoders; + u32 numPeakMeterBlocks; +}; + +struct OrbisNgs2SamplerVoiceSetupParam { + OrbisNgs2VoiceParamHeader header; + + OrbisNgs2WaveformFormat format; + u32 flags; + u32 reserved; +}; + +struct OrbisNgs2SamplerVoiceWaveformBlocksParam { + OrbisNgs2VoiceParamHeader header; + + const void* data; + u32 flags; + u32 numBlocks; + const OrbisNgs2WaveformBlock* aBlock; + // Blocks +}; + +struct OrbisNgs2SamplerVoiceWaveformAddressParam { + OrbisNgs2VoiceParamHeader header; + + const void* from; + const void* to; +}; + +struct OrbisNgs2SamplerVoiceWaveformFrameOffsetParam { + OrbisNgs2VoiceParamHeader header; + + u32 frameOffset; + u32 reserved; +}; + +struct OrbisNgs2SamplerVoiceExitLoopParam { + OrbisNgs2VoiceParamHeader header; +}; + +struct OrbisNgs2SamplerVoicePitchParam { + OrbisNgs2VoiceParamHeader header; + + float ratio; + u32 reserved; +}; + +struct OrbisNgs2SamplerVoiceEnvelopeParam { + OrbisNgs2VoiceParamHeader header; + + u32 numForwardPoints; + u32 numReleasePoints; + const OrbisNgs2EnvelopePoint* aPoint; +}; + +struct OrbisNgs2SamplerVoiceDistortionParam { + OrbisNgs2VoiceParamHeader header; + + u32 flags; + float a; + float b; + float clip; + float gate; + float wetLevel; + float dryLevel; + u32 reserved; +}; + +struct OrbisNgs2SamplerVoiceUserFxParam { + OrbisNgs2VoiceParamHeader header; + + OrbisNgs2UserFxProcessHandler handler; + + uintptr_t userData0; + uintptr_t userData1; + uintptr_t userData2; +}; + +struct OrbisNgs2SamplerVoicePeakMeterParam { + OrbisNgs2VoiceParamHeader header; + + u32 enableFlag; + u32 reserved; +}; + +struct OrbisNgs2SamplerVoiceFilterParam { + OrbisNgs2VoiceParamHeader header; + + u32 index; + u32 location; + u32 type; + u32 channelMask; + union { + struct { + float i0; + float i1; + float i2; + float o1; + float o2; + } direct; + struct { + float fc; + float q; + float level; + u32 reserved; + u32 reserved2; + } fcq; + } param; + u32 reserved3; +}; + +struct OrbisNgs2SamplerVoiceNumFilters { + OrbisNgs2VoiceParamHeader header; + + u32 numFilters; + u32 reserved; +}; + +struct OrbisNgs2SamplerVoiceState { + OrbisNgs2VoiceState voiceState; + float envelopeHeight; + float peakHeight; + u32 reserved; + u64 numDecodedSamples; + u64 decodedDataSize; + u64 userData; + const void* waveformData; +}; + +struct OrbisNgs2SamplerRackInfo { + OrbisNgs2RackInfo rackInfo; + u32 maxChannelWorks; + u32 maxCodecCaches; + u32 maxWaveformBlocks; + u32 maxEnvelopePoints; + u32 maxFilters; + u32 maxAtrac9Decoders; + u32 maxAtrac9ChannelWorks; + u32 maxAjmAtrac9Decoders; +}; + +} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_submixer.cpp b/src/core/libraries/ngs2/ngs2_submixer.cpp new file mode 100644 index 000000000..8c82e4e49 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_submixer.cpp @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ngs2_error.h" +#include "ngs2_impl.h" + +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" + +using namespace Libraries::Kernel; + +namespace Libraries::Ngs2 {} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/ngs2/ngs2_submixer.h b/src/core/libraries/ngs2/ngs2_submixer.h new file mode 100644 index 000000000..df2d8a835 --- /dev/null +++ b/src/core/libraries/ngs2/ngs2_submixer.h @@ -0,0 +1,126 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "ngs2.h" + +namespace Libraries::Ngs2 { + +class Ngs2Submixer; + +struct OrbisNgs2SubmixerRackOption { + OrbisNgs2RackOption rackOption; + u32 maxChannels; + u32 maxEnvelopePoints; + u32 maxFilters; + u32 maxInputs; + u32 numPeakMeterBlocks; +}; + +struct OrbisNgs2SubmixerVoiceSetupParam { + OrbisNgs2VoiceParamHeader header; + u32 numIoChannels; + u32 flags; +}; + +struct OrbisNgs2SubmixerVoiceEnvelopeParam { + OrbisNgs2VoiceParamHeader header; + + u32 numForwardPoints; + u32 numReleasePoints; + const OrbisNgs2EnvelopePoint* aPoint; +}; + +struct OrbisNgs2SubmixerVoiceCompressorParam { + OrbisNgs2VoiceParamHeader header; + + u32 flags; + float threshold; + float ratio; + float knee; + float attackTime; + float releaseTime; + float level; + u32 reserved; +}; + +struct OrbisNgs2SubmixerVoiceDistortionParam { + OrbisNgs2VoiceParamHeader header; + + u32 flags; + float a; + float b; + float clip; + float gate; + float wetLevel; + float dryLevel; + u32 reserved; +}; + +struct OrbisNgs2SubmixerVoiceUserFxParam { + OrbisNgs2VoiceParamHeader header; + + OrbisNgs2UserFxProcessHandler handler; + + uintptr_t userData0; + uintptr_t userData1; + uintptr_t userData2; +}; + +struct OrbisNgs2SubmixerVoicePeakMeterParam { + OrbisNgs2VoiceParamHeader header; + + u32 enableFlag; + u32 reserved; +}; + +struct OrbisNgs2SubmixerVoiceFilterParam { + OrbisNgs2VoiceParamHeader header; + + u32 index; + u32 location; + u32 type; + u32 channelMask; + union { + struct { + float i0; + float i1; + float i2; + float o1; + float o2; + } direct; + struct { + float fc; + float q; + float level; + u32 reserved; + u32 reserved2; + } fcq; + } param; + u32 reserved3; +}; + +struct OrbisNgs2SubmixerVoiceNumFilters { + OrbisNgs2VoiceParamHeader header; + + u32 numFilters; + u32 reserved; +}; + +struct OrbisNgs2SubmixerVoiceState { + OrbisNgs2VoiceState voiceState; + float envelopeHeight; + float peakHeight; + float compressorHeight; +}; + +struct OrbisNgs2SubmixerRackInfo { + OrbisNgs2RackInfo rackInfo; + u32 maxChannels; + u32 maxEnvelopePoints; + u32 maxFilters; + u32 maxInputs; +}; + +} // namespace Libraries::Ngs2 diff --git a/src/core/libraries/videoout/driver.cpp b/src/core/libraries/videoout/driver.cpp index d2c980882..8f725e549 100644 --- a/src/core/libraries/videoout/driver.cpp +++ b/src/core/libraries/videoout/driver.cpp @@ -63,6 +63,7 @@ void VideoOutDriver::Close(s32 handle) { main_port.is_open = false; main_port.flip_rate = 0; + main_port.prev_index = -1; ASSERT(main_port.flip_events.empty()); } @@ -133,6 +134,10 @@ int VideoOutDriver::RegisterBuffers(VideoOutPort* port, s32 startIndex, void* co .address_right = 0, }; + // Reset flip label also when registering buffer + port->buffer_labels[startIndex + i] = 0; + port->SignalVoLabel(); + presenter->RegisterVideoOutSurface(group, address); LOG_INFO(Lib_VideoOut, "buffers[{}] = {:#x}", i + startIndex, address); } @@ -190,11 +195,13 @@ void VideoOutDriver::Flip(const Request& req) { } } - // Reset flip label - if (req.index != -1) { - port->buffer_labels[req.index] = 0; + // Reset prev flip label + if (port->prev_index != -1) { + port->buffer_labels[port->prev_index] = 0; port->SignalVoLabel(); } + // save to prev buf index + port->prev_index = req.index; } void VideoOutDriver::DrawBlankFrame() { diff --git a/src/core/libraries/videoout/driver.h b/src/core/libraries/videoout/driver.h index e57b189b5..3b0df43b9 100644 --- a/src/core/libraries/videoout/driver.h +++ b/src/core/libraries/videoout/driver.h @@ -32,6 +32,7 @@ struct VideoOutPort { std::condition_variable vo_cv; std::condition_variable vblank_cv; int flip_rate = 0; + int prev_index = -1; bool is_open = false; bool is_mode_changing = false; // Used to prevent flip during mode change diff --git a/src/core/linker.cpp b/src/core/linker.cpp index 18ae62f4b..4ccb9d943 100644 --- a/src/core/linker.cpp +++ b/src/core/linker.cpp @@ -101,6 +101,17 @@ void Linker::Execute(const std::vector args) { memory->SetupMemoryRegions(fmem_size, use_extended_mem1, use_extended_mem2); + // Simulate sceKernelInternalMemory mapping, a mapping usually performed during libkernel init. + // Due to the large size of this mapping, failing to emulate it causes issues in some titles. + // This mapping belongs in the system reserved area, which starts at address 0x880000000. + static constexpr VAddr KernelAllocBase = 0x880000000ULL; + static constexpr s64 InternalMemorySize = 0x1000000; + void* addr_out{reinterpret_cast(KernelAllocBase)}; + + const s32 ret = Libraries::Kernel::sceKernelMapNamedFlexibleMemory( + &addr_out, InternalMemorySize, 3, 0, "SceKernelInternalMemory"); + ASSERT_MSG(ret == 0, "Unable to perform sceKernelInternalMemory mapping"); + main_thread.Run([this, module, args](std::stop_token) { Common::SetCurrentThreadName("GAME_MainThread"); LoadSharedLibraries(); @@ -372,7 +383,8 @@ void* Linker::AllocateTlsForThread(bool is_primary) { // If sceKernelMapNamedFlexibleMemory is being called from libkernel and addr = 0 // it automatically places mappings in system reserved area instead of managed. - static constexpr VAddr KernelAllocBase = 0x880000000ULL; + // Since the system reserved area already has a mapping in it, this address is slightly higher. + static constexpr VAddr KernelAllocBase = 0x881000000ULL; // The kernel module has a few different paths for TLS allocation. // For SDK < 1.7 it allocates both main and secondary thread blocks using libc mspace/malloc. diff --git a/src/core/loader.cpp b/src/core/loader.cpp deleted file mode 100644 index f80bfbb81..000000000 --- a/src/core/loader.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "common/io_file.h" -#include "common/types.h" -#include "loader.h" - -namespace Loader { - -FileTypes DetectFileType(const std::filesystem::path& filepath) { - // No file loaded - if (filepath.empty()) { - return FileTypes::Unknown; - } - Common::FS::IOFile file; - file.Open(filepath, Common::FS::FileAccessMode::Read); - file.Seek(0); - u32 magic; - file.Read(magic); - file.Close(); - switch (magic) { - case PkgMagic: - return FileTypes::Pkg; - } - return FileTypes::Unknown; -} - -} // namespace Loader diff --git a/src/core/loader.h b/src/core/loader.h deleted file mode 100644 index 608970dca..000000000 --- a/src/core/loader.h +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include - -namespace Loader { - -constexpr static u32 PkgMagic = 0x544e437f; - -enum class FileTypes { - Unknown, - Pkg, -}; - -FileTypes DetectFileType(const std::filesystem::path& filepath); -} // namespace Loader diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 98d587e00..8b108a654 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -38,6 +38,16 @@ void MemoryManager::SetupMemoryRegions(u64 flexible_size, bool use_extended_mem1 bool use_extended_mem2) { const bool is_neo = ::Libraries::Kernel::sceKernelIsNeoMode(); auto total_size = is_neo ? SCE_KERNEL_TOTAL_MEM_PRO : SCE_KERNEL_TOTAL_MEM; + if (Config::isDevKitConsole()) { + const auto old_size = total_size; + // Assuming 2gb is neo for now, will need to link it with sceKernelIsDevKit + total_size += is_neo ? 2_GB : 768_MB; + LOG_WARNING(Kernel_Vmm, + "Config::isDevKitConsole is enabled! Added additional {:s} of direct memory.", + is_neo ? "2 GB" : "768 MB"); + LOG_WARNING(Kernel_Vmm, "Old Direct Size: {:#x} -> New Direct Size: {:#x}", old_size, + total_size); + } if (!use_extended_mem1 && is_neo) { total_size -= 256_MB; } diff --git a/src/core/module.cpp b/src/core/module.cpp index a18c1141a..1004f4404 100644 --- a/src/core/module.cpp +++ b/src/core/module.cpp @@ -1,13 +1,12 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include - #include "common/alignment.h" #include "common/arch.h" #include "common/assert.h" #include "common/logging/log.h" #include "common/memory_patcher.h" +#include "common/sha1.h" #include "common/string_util.h" #include "core/aerolib/aerolib.h" #include "core/cpu_patches.h" @@ -65,11 +64,13 @@ static std::string StringToNid(std::string_view symbol) { std::memcpy(input.data(), symbol.data(), symbol.size()); std::memcpy(input.data() + symbol.size(), Salt.data(), Salt.size()); - std::array hash; - CryptoPP::SHA1().CalculateDigest(hash.data(), input.data(), input.size()); + sha1::SHA1::digest8_t hash; + sha1::SHA1 sha; + sha.processBytes(input.data(), input.size()); + sha.getDigestBytes(hash); u64 digest; - std::memcpy(&digest, hash.data(), sizeof(digest)); + std::memcpy(&digest, hash, sizeof(digest)); static constexpr std::string_view codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-"; diff --git a/src/emulator.cpp b/src/emulator.cpp index b2b330527..f6cb9efa7 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -82,7 +82,7 @@ void Emulator::Run(const std::filesystem::path& file, const std::vector ModulesToLoad{ + constexpr std::array ModulesToLoad{ {{"libSceNgs2.sprx", &Libraries::Ngs2::RegisterlibSceNgs2}, {"libSceUlt.sprx", nullptr}, {"libSceJson.sprx", nullptr}, {"libSceJson2.sprx", nullptr}, {"libSceLibcInternal.sprx", &Libraries::LibcInternal::RegisterlibSceLibcInternal}, - {"libSceDiscMap.sprx", &Libraries::DiscMap::RegisterlibSceDiscMap}, {"libSceRtc.sprx", &Libraries::Rtc::RegisterlibSceRtc}, {"libSceCesCs.sprx", nullptr}, {"libSceFont.sprx", &Libraries::Font::RegisterlibSceFont}, diff --git a/src/images/controller_icon.png b/src/images/controller_icon.png index 40c92a89b..0d5556329 100644 Binary files a/src/images/controller_icon.png and b/src/images/controller_icon.png differ diff --git a/src/images/fullscreen_icon.png b/src/images/fullscreen_icon.png new file mode 100644 index 000000000..719ffe4a1 Binary files /dev/null and b/src/images/fullscreen_icon.png differ diff --git a/src/images/pause_icon.png b/src/images/pause_icon.png index 5375689b7..86bbc6acb 100644 Binary files a/src/images/pause_icon.png and b/src/images/pause_icon.png differ diff --git a/src/images/play_icon.png b/src/images/play_icon.png index 2815be39d..d50d404b7 100644 Binary files a/src/images/play_icon.png and b/src/images/play_icon.png differ diff --git a/src/images/refresh_icon.png b/src/images/refresh_icon.png deleted file mode 100644 index 00fe69c20..000000000 Binary files a/src/images/refresh_icon.png and /dev/null differ diff --git a/src/images/refreshlist_icon.png b/src/images/refreshlist_icon.png new file mode 100644 index 000000000..7de6685b2 Binary files /dev/null and b/src/images/refreshlist_icon.png differ diff --git a/src/images/restart_game_icon.png b/src/images/restart_game_icon.png new file mode 100644 index 000000000..1e549e101 Binary files /dev/null and b/src/images/restart_game_icon.png differ diff --git a/src/images/settings_icon.png b/src/images/settings_icon.png index c88cd7a6f..81127bfa3 100644 Binary files a/src/images/settings_icon.png and b/src/images/settings_icon.png differ diff --git a/src/images/stop_icon.png b/src/images/stop_icon.png index 74c615f65..55b6b01c7 100644 Binary files a/src/images/stop_icon.png and b/src/images/stop_icon.png differ diff --git a/src/images/trophy_icon.png b/src/images/trophy_icon.png new file mode 100644 index 000000000..559e7dbb2 Binary files /dev/null and b/src/images/trophy_icon.png differ diff --git a/src/qt_gui/game_info.cpp b/src/qt_gui/game_info.cpp index 947f25d84..19b6adc1e 100644 --- a/src/qt_gui/game_info.cpp +++ b/src/qt_gui/game_info.cpp @@ -20,7 +20,7 @@ void ScanDirectoryRecursively(const QString& dir, QStringList& filePaths, int cu QFileInfoList entries = directory.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); for (const auto& entry : entries) { - if (entry.fileName().endsWith("-UPDATE")) { + if (entry.fileName().endsWith("-UPDATE") || entry.fileName().endsWith("-patch")) { continue; } diff --git a/src/qt_gui/game_info.h b/src/qt_gui/game_info.h index 0759ccc52..09e5a4557 100644 --- a/src/qt_gui/game_info.h +++ b/src/qt_gui/game_info.h @@ -34,6 +34,12 @@ public: game_update_path += "-UPDATE"; if (std::filesystem::exists(game_update_path / "sce_sys" / "param.sfo")) { sce_folder_path = game_update_path / "sce_sys" / "param.sfo"; + } else { + game_update_path = filePath; + game_update_path += "-patch"; + if (std::filesystem::exists(game_update_path / "sce_sys" / "param.sfo")) { + sce_folder_path = game_update_path / "sce_sys" / "param.sfo"; + } } PSF psf; diff --git a/src/qt_gui/game_list_frame.cpp b/src/qt_gui/game_list_frame.cpp index 4c0607571..170215f3d 100644 --- a/src/qt_gui/game_list_frame.cpp +++ b/src/qt_gui/game_list_frame.cpp @@ -185,7 +185,8 @@ void GameListFrame::SetListBackgroundImage(QTableWidgetItem* item) { // Recompute if opacity changed or we switched to a different game if (opacity != m_last_opacity || game.pic_path != m_current_game_path) { - QImage original_image(QString::fromStdString(game.pic_path.string())); + auto image_path = game.pic_path.u8string(); + QImage original_image(QString::fromStdString({image_path.begin(), image_path.end()})); if (!original_image.isNull()) { backgroundImage = m_game_list_utils.ChangeImageOpacity( original_image, original_image.rect(), opacity / 100.0f); diff --git a/src/qt_gui/gui_context_menus.h b/src/qt_gui/gui_context_menus.h index 24b421b9d..b5732d0ca 100644 --- a/src/qt_gui/gui_context_menus.h +++ b/src/qt_gui/gui_context_menus.h @@ -7,7 +7,6 @@ #include #include #include -#include #include #include @@ -116,7 +115,9 @@ public: compatibilityMenu->addAction(updateCompatibility); compatibilityMenu->addAction(viewCompatibilityReport); - compatibilityMenu->addAction(submitCompatibilityReport); + if (Common::isRelease) { + compatibilityMenu->addAction(submitCompatibilityReport); + } menu.addMenu(compatibilityMenu); @@ -139,11 +140,17 @@ public: 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 { + if (std::filesystem::exists(Common::FS::PathFromQString(open_update_path))) { QDesktopServices::openUrl(QUrl::fromLocalFile(open_update_path)); + } else { + Common::FS::PathToQString(open_update_path, m_games[itemID].path); + open_update_path += "-patch"; + if (std::filesystem::exists(Common::FS::PathFromQString(open_update_path))) { + QDesktopServices::openUrl(QUrl::fromLocalFile(open_update_path)); + } else { + QMessageBox::critical(nullptr, tr("Error"), + QString(tr("This game has no update folder to open!"))); + } } } @@ -216,6 +223,12 @@ public: game_update_path += "-UPDATE"; if (std::filesystem::exists(game_update_path)) { game_folder_path = game_update_path; + } else { + game_update_path = game_folder_path; + game_update_path += "-patch"; + if (std::filesystem::exists(game_update_path)) { + game_folder_path = game_update_path; + } } if (psf.Open(game_folder_path / "sce_sys" / "param.sfo")) { int rows = psf.GetEntries().size(); @@ -312,8 +325,40 @@ public: game_update_path += "-UPDATE"; if (std::filesystem::exists(game_update_path)) { Common::FS::PathToQString(gameTrpPath, game_update_path); + } else { + game_update_path = Common::FS::PathFromQString(gameTrpPath); + game_update_path += "-patch"; + if (std::filesystem::exists(game_update_path)) { + Common::FS::PathToQString(gameTrpPath, game_update_path); + } } - TrophyViewer* trophyViewer = new TrophyViewer(trophyPath, gameTrpPath); + + // Array with all games and their trophy information + QVector allTrophyGames; + for (const auto& game : m_games) { + TrophyGameInfo gameInfo; + gameInfo.name = QString::fromStdString(game.name); + Common::FS::PathToQString(gameInfo.trophyPath, game.serial); + Common::FS::PathToQString(gameInfo.gameTrpPath, game.path); + + auto update_path = Common::FS::PathFromQString(gameInfo.gameTrpPath); + update_path += "-UPDATE"; + if (std::filesystem::exists(update_path)) { + Common::FS::PathToQString(gameInfo.gameTrpPath, update_path); + } else { + update_path = Common::FS::PathFromQString(gameInfo.gameTrpPath); + update_path += "-patch"; + if (std::filesystem::exists(update_path)) { + Common::FS::PathToQString(gameInfo.gameTrpPath, update_path); + } + } + + allTrophyGames.append(gameInfo); + } + + QString gameName = QString::fromStdString(m_games[itemID].name); + TrophyViewer* trophyViewer = + new TrophyViewer(trophyPath, gameTrpPath, gameName, allTrophyGames); trophyViewer->show(); connect(widget->parent(), &QWidget::destroyed, trophyViewer, [trophyViewer]() { trophyViewer->deleteLater(); }); @@ -432,6 +477,9 @@ public: QString folder_path, game_update_path, dlc_path, save_data_path, trophy_data_path; Common::FS::PathToQString(folder_path, m_games[itemID].path); game_update_path = folder_path + "-UPDATE"; + if (!std::filesystem::exists(Common::FS::PathFromQString(game_update_path))) { + game_update_path = folder_path + "-patch"; + } Common::FS::PathToQString( dlc_path, Config::getAddonInstallDir() / Common::FS::PathFromQString(folder_path).parent_path().filename()); @@ -521,7 +569,7 @@ public: "title", QString("%1 - %2").arg(QString::fromStdString(m_games[itemID].serial), QString::fromStdString(m_games[itemID].name))); query.addQueryItem("game-name", QString::fromStdString(m_games[itemID].name)); - query.addQueryItem("game-code", QString::fromStdString(m_games[itemID].serial)); + query.addQueryItem("game-serial", QString::fromStdString(m_games[itemID].serial)); query.addQueryItem("game-version", QString::fromStdString(m_games[itemID].version)); query.addQueryItem("emulator-version", QString(Common::VERSION)); url.setQuery(query); @@ -552,30 +600,6 @@ public: return -1; } - void RequestGameMenuPKGViewer( - const QPoint& pos, QStringList m_pkg_app_list, QTreeWidget* treeWidget, - std::function InstallDragDropPkg) { - QPoint global_pos = treeWidget->viewport()->mapToGlobal(pos); // context menu position - QTreeWidgetItem* currentItem = treeWidget->currentItem(); // current clicked item - int itemIndex = GetRowIndex(treeWidget, currentItem); // row - - QMenu menu(treeWidget); - QAction installPackage(tr("Install PKG"), treeWidget); - - menu.addAction(&installPackage); - - auto selected = menu.exec(global_pos); - if (!selected) { - return; - } - - if (selected == &installPackage) { - QStringList pkg_app_ = m_pkg_app_list[itemIndex].split(";;"); - std::filesystem::path path = Common::FS::PathFromQString(pkg_app_[9]); - InstallDragDropPkg(path, 1, 1); - } - } - private: bool convertPngToIco(const QString& pngFilePath, const QString& icoFilePath) { // Load the PNG image diff --git a/src/qt_gui/install_dir_select.cpp b/src/qt_gui/install_dir_select.cpp deleted file mode 100644 index e90a10ee6..000000000 --- a/src/qt_gui/install_dir_select.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "install_dir_select.h" - -InstallDirSelect::InstallDirSelect() : selected_dir() { - auto install_dirs = Config::getGameInstallDirs(); - selected_dir = install_dirs.empty() ? "" : install_dirs.front(); - - if (!install_dirs.empty() && install_dirs.size() == 1) { - accept(); - } - - auto layout = new QVBoxLayout(this); - - layout->addWidget(SetupInstallDirList()); - layout->addStretch(); - layout->addWidget(SetupDialogActions()); - - setWindowTitle(tr("shadPS4 - Choose directory")); - setWindowIcon(QIcon(":images/shadps4.ico")); -} - -InstallDirSelect::~InstallDirSelect() {} - -QWidget* InstallDirSelect::SetupInstallDirList() { - auto group = new QGroupBox(tr("Select which directory you want to install to.")); - auto vlayout = new QVBoxLayout(); - - auto m_path_list = new QListWidget(); - QList qt_list; - for (const auto& str : Config::getGameInstallDirs()) { - QString installDirPath; - Common::FS::PathToQString(installDirPath, str); - qt_list.append(installDirPath); - } - m_path_list->insertItems(0, qt_list); - m_path_list->setSpacing(1); - - connect(m_path_list, &QListWidget::itemClicked, this, &InstallDirSelect::setSelectedDirectory); - connect(m_path_list, &QListWidget::itemActivated, this, - &InstallDirSelect::setSelectedDirectory); - - 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; -} - -void InstallDirSelect::setSelectedDirectory(QListWidgetItem* item) { - if (item) { - const auto highlighted_path = Common::FS::PathFromQString(item->text()); - if (!highlighted_path.empty()) { - selected_dir = highlighted_path; - } - } -} - -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); - - connect(actions, &QDialogButtonBox::accepted, this, &InstallDirSelect::accept); - connect(actions, &QDialogButtonBox::rejected, this, &InstallDirSelect::reject); - - return actions; -} diff --git a/src/qt_gui/install_dir_select.h b/src/qt_gui/install_dir_select.h deleted file mode 100644 index e11cbf381..000000000 --- a/src/qt_gui/install_dir_select.h +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include -#include - -#include "common/config.h" -#include "common/path_util.h" - -class QLineEdit; - -class InstallDirSelect final : public QDialog { - Q_OBJECT - -public: - InstallDirSelect(); - ~InstallDirSelect(); - - std::filesystem::path getSelectedDirectory() { - 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/kbm_config_dialog.cpp b/src/qt_gui/kbm_config_dialog.cpp index 49a6bcd89..1851c591d 100644 --- a/src/qt_gui/kbm_config_dialog.cpp +++ b/src/qt_gui/kbm_config_dialog.cpp @@ -225,7 +225,8 @@ void EditorDialog::loadInstalledGames() { QDir parentFolder(installDir); QFileInfoList fileList = parentFolder.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); for (const auto& fileInfo : fileList) { - if (fileInfo.isDir() && !fileInfo.filePath().endsWith("-UPDATE")) { + if (fileInfo.isDir() && (!fileInfo.filePath().endsWith("-UPDATE") || + !fileInfo.filePath().endsWith("-patch"))) { gameComboBox->addItem(fileInfo.fileName()); // Add game name to combo box } } diff --git a/src/qt_gui/kbm_gui.cpp b/src/qt_gui/kbm_gui.cpp index c148884e9..8777dda95 100644 --- a/src/qt_gui/kbm_gui.cpp +++ b/src/qt_gui/kbm_gui.cpp @@ -15,7 +15,6 @@ #include "ui_kbm_gui.h" HelpDialog* HelpWindow; - KBMSettings::KBMSettings(std::shared_ptr game_info_get, QWidget* parent) : QDialog(parent), m_game_info(game_info_get), ui(new Ui::KBMSettings) { @@ -48,6 +47,7 @@ KBMSettings::KBMSettings(std::shared_ptr game_info_get, QWidget* ui->ProfileComboBox->setCurrentText("Common Config"); ui->TitleLabel->setText("Common Config"); + config_id = "default"; connect(ui->buttonBox, &QDialogButtonBox::clicked, this, [this](QAbstractButton* button) { if (button == ui->buttonBox->button(QDialogButtonBox::Save)) { @@ -72,6 +72,7 @@ KBMSettings::KBMSettings(std::shared_ptr game_info_get, QWidget* connect(ui->TextEditorButton, &QPushButton::clicked, this, [this]() { auto kbmWindow = new EditorDialog(this); kbmWindow->exec(); + SetUIValuestoMappings(config_id); }); connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [this] { @@ -84,9 +85,6 @@ KBMSettings::KBMSettings(std::shared_ptr game_info_get, QWidget* connect(ui->ProfileComboBox, &QComboBox::currentTextChanged, this, [this] { GetGameTitle(); - std::string config_id = (ui->ProfileComboBox->currentText() == "Common Config") - ? "default" - : ui->ProfileComboBox->currentText().toStdString(); SetUIValuestoMappings(config_id); }); @@ -385,10 +383,6 @@ void KBMSettings::SaveKBMConfig(bool CloseOnSave) { lines.push_back(output_string + " = " + input_string); lines.push_back(""); - - std::string config_id = (ui->ProfileComboBox->currentText() == "Common Config") - ? "default" - : ui->ProfileComboBox->currentText().toStdString(); const auto config_file = Config::GetFoolproofKbmConfigFile(config_id); std::fstream file(config_file); int lineCount = 0; @@ -626,6 +620,9 @@ void KBMSettings::GetGameTitle() { } } } + config_id = (ui->ProfileComboBox->currentText() == "Common Config") + ? "default" + : ui->ProfileComboBox->currentText().toStdString(); } void KBMSettings::onHelpClicked() { diff --git a/src/qt_gui/kbm_gui.h b/src/qt_gui/kbm_gui.h index e63d7bd43..06e58eef6 100644 --- a/src/qt_gui/kbm_gui.h +++ b/src/qt_gui/kbm_gui.h @@ -42,7 +42,7 @@ private: QTimer* timer; QPushButton* MappingButton; QList ButtonsList; - + std::string config_id; const std::vector ControllerInputs = { "cross", "circle", "square", "triangle", "l1", "r1", "l2", "r2", "l3", diff --git a/src/qt_gui/kbm_gui.ui b/src/qt_gui/kbm_gui.ui index 0eac88105..c8d63cd00 100644 --- a/src/qt_gui/kbm_gui.ui +++ b/src/qt_gui/kbm_gui.ui @@ -11,10 +11,16 @@ 0 0 - 1193 - 754 + 1234 + 796 + + + 0 + 0 + + Qt::FocusPolicy::StrongFocus @@ -38,8 +44,8 @@ 0 0 - 1173 - 704 + 1214 + 746 @@ -47,8 +53,8 @@ 0 0 - 1171 - 703 + 1211 + 741 @@ -63,7 +69,7 @@ true - + 0 0 @@ -149,6 +155,12 @@ + + + 160 + 0 + + Left @@ -180,6 +192,12 @@ + + + 160 + 0 + + Right @@ -282,11 +300,17 @@ - + 0 0 + + + 344 + 16777215 + + Left Analog Halfmode @@ -319,7 +343,7 @@ - + 0 0 @@ -405,6 +429,12 @@ + + + 160 + 0 + + Left @@ -436,6 +466,12 @@ + + + 160 + 0 + + 179 @@ -528,18 +564,24 @@ - + 0 - + 0 0 + + + 0 + 0 + + 12 @@ -652,6 +694,18 @@ + + + 0 + 0 + + + + + 160 + 0 + + L1 @@ -670,6 +724,12 @@ + + + 0 + 0 + + Qt::FocusPolicy::NoFocus @@ -683,6 +743,12 @@ + + + 0 + 0 + + 160 @@ -707,6 +773,12 @@ + + + 0 + 0 + + Qt::FocusPolicy::NoFocus @@ -724,6 +796,18 @@ + + + 0 + 0 + + + + + 0 + 0 + + true @@ -735,6 +819,12 @@ + + + 0 + 0 + + Qt::FocusPolicy::NoFocus @@ -745,6 +835,12 @@ + + + 0 + 0 + + Qt::FocusPolicy::NoFocus @@ -762,6 +858,12 @@ + + + 0 + 0 + + 160 @@ -786,6 +888,12 @@ + + + 0 + 0 + + Qt::FocusPolicy::NoFocus @@ -799,6 +907,18 @@ + + + 0 + 0 + + + + + 160 + 0 + + R2 @@ -817,6 +937,12 @@ + + + 0 + 0 + + Qt::FocusPolicy::NoFocus @@ -857,7 +983,7 @@ - 420 + 500 200 @@ -887,6 +1013,12 @@ + + + 0 + 0 + + 160 @@ -911,6 +1043,12 @@ + + + 0 + 0 + + Qt::FocusPolicy::NoFocus @@ -924,12 +1062,30 @@ + + + 0 + 0 + + + + + 160 + 0 + + Touchpad Click + + + 0 + 0 + + Qt::FocusPolicy::NoFocus @@ -947,6 +1103,18 @@ + + + 0 + 0 + + + + + 0 + 0 + + Mouse to Joystick @@ -982,6 +1150,12 @@ + + + 0 + 0 + + 160 @@ -1006,6 +1180,12 @@ + + + 0 + 0 + + Qt::FocusPolicy::NoFocus @@ -1019,9 +1199,15 @@ + + + 0 + 0 + + - 145 + 160 0 @@ -1043,6 +1229,12 @@ + + + 0 + 0 + + Qt::FocusPolicy::NoFocus @@ -1064,6 +1256,12 @@ + + + 0 + 0 + + false @@ -1196,6 +1394,25 @@ + + + + + 0 + 0 + + + + + true + false + + + + note: click Help Button/Special Keybindings for more information + + + @@ -1203,19 +1420,6 @@ - - - - - true - false - - - - note: click Help Button/Special Keybindings for more information - - - @@ -1226,7 +1430,7 @@ - + 0 0 @@ -1306,6 +1510,12 @@ + + + 160 + 0 + + Square @@ -1337,6 +1547,12 @@ + + + 160 + 0 + + Circle @@ -1444,6 +1660,12 @@ 0 + + + 344 + 16777215 + + Right Analog Halfmode @@ -1476,7 +1698,7 @@ - + 0 0 @@ -1568,6 +1790,12 @@ + + + 160 + 0 + + Left @@ -1599,6 +1827,12 @@ + + + 160 + 0 + + Right diff --git a/src/qt_gui/main.cpp b/src/qt_gui/main.cpp index 36dc226ae..bd9dca6ce 100644 --- a/src/qt_gui/main.cpp +++ b/src/qt_gui/main.cpp @@ -157,8 +157,8 @@ int main(int argc, char* argv[]) { } } - // If no game directory is set and no command line argument, prompt for it - if (Config::getGameInstallDirs().empty() && !has_command_line_argument) { + // If no game directories are set and no command line argument, prompt for it + if (Config::getGameInstallDirsEnabled().empty() && !has_command_line_argument) { GameInstallDialog dlg; dlg.exec(); } diff --git a/src/qt_gui/main_window.cpp b/src/qt_gui/main_window.cpp index bde32a52d..072ad70e5 100644 --- a/src/qt_gui/main_window.cpp +++ b/src/qt_gui/main_window.cpp @@ -1,10 +1,13 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "SDL3/SDL_events.h" + #include #include #include #include +#include #include "about_dialog.h" #include "cheats_patches.h" @@ -17,10 +20,7 @@ #include "common/string_util.h" #include "common/version.h" #include "control_settings.h" -#include "core/file_format/pkg.h" -#include "core/loader.h" #include "game_install_dialog.h" -#include "install_dir_select.h" #include "kbm_gui.h" #include "main_window.h" #include "settings_dialog.h" @@ -45,11 +45,11 @@ MainWindow::~MainWindow() { bool MainWindow::Init() { auto start = std::chrono::steady_clock::now(); // setup ui + LoadTranslation(); AddUiWidgets(); CreateActions(); CreateRecentGameActions(); ConfigureGuiFromSettings(); - LoadTranslation(); CreateDockWindows(); CreateConnects(); SetLastUsedTheme(); @@ -132,23 +132,160 @@ void MainWindow::CreateActions() { m_theme_act_group->addAction(ui->setThemeOled); } +void MainWindow::PauseGame() { + SDL_Event event; + SDL_memset(&event, 0, sizeof(event)); + event.type = SDL_EVENT_TOGGLE_PAUSE; + is_paused = !is_paused; + UpdateToolbarButtons(); + SDL_PushEvent(&event); +} + +void MainWindow::toggleLabelsUnderIcons() { + bool showLabels = ui->toggleLabelsAct->isChecked(); + Config::setShowLabelsUnderIcons(); + UpdateToolbarLabels(); + if (isGameRunning) { + UpdateToolbarButtons(); + } +} + +void MainWindow::toggleFullscreen() { + SDL_Event event; + SDL_memset(&event, 0, sizeof(event)); + event.type = SDL_EVENT_TOGGLE_FULLSCREEN; + SDL_PushEvent(&event); +} + +QWidget* MainWindow::createButtonWithLabel(QPushButton* button, const QString& labelText, + bool showLabel) { + QWidget* container = new QWidget(this); + QVBoxLayout* layout = new QVBoxLayout(container); + layout->setAlignment(Qt::AlignCenter | Qt::AlignBottom); + layout->setContentsMargins(0, 0, 0, 0); + layout->addWidget(button); + + QLabel* label = nullptr; + if (showLabel && ui->toggleLabelsAct->isChecked()) { + label = new QLabel(labelText, this); + label->setAlignment(Qt::AlignCenter | Qt::AlignBottom); + layout->addWidget(label); + button->setToolTip(""); + } else { + button->setToolTip(labelText); + } + + container->setLayout(layout); + container->setProperty("buttonLabel", QVariant::fromValue(label)); + return container; +} + +QWidget* createSpacer(QWidget* parent) { + QWidget* spacer = new QWidget(parent); + spacer->setFixedWidth(15); + spacer->setFixedHeight(15); + return spacer; +} + void MainWindow::AddUiWidgets() { // add toolbar widgets QApplication::setStyle("Fusion"); - ui->toolBar->setObjectName("mw_toolbar"); - ui->toolBar->addWidget(ui->playButton); - ui->toolBar->addWidget(ui->pauseButton); - ui->toolBar->addWidget(ui->stopButton); - ui->toolBar->addWidget(ui->refreshButton); - ui->toolBar->addWidget(ui->settingsButton); - ui->toolBar->addWidget(ui->controllerButton); - ui->toolBar->addWidget(ui->keyboardButton); + + bool showLabels = ui->toggleLabelsAct->isChecked(); + ui->toolBar->clear(); + + ui->toolBar->addWidget(createSpacer(this)); + ui->toolBar->addWidget(createButtonWithLabel(ui->playButton, tr("Play"), showLabels)); + ui->toolBar->addWidget(createButtonWithLabel(ui->pauseButton, tr("Pause"), showLabels)); + ui->toolBar->addWidget(createButtonWithLabel(ui->stopButton, tr("Stop"), showLabels)); + ui->toolBar->addWidget(createButtonWithLabel(ui->restartButton, tr("Restart"), showLabels)); + ui->toolBar->addWidget(createSpacer(this)); + ui->toolBar->addWidget(createButtonWithLabel(ui->settingsButton, tr("Settings"), showLabels)); + ui->toolBar->addWidget( + createButtonWithLabel(ui->fullscreenButton, tr("Full Screen"), showLabels)); + ui->toolBar->addWidget(createSpacer(this)); + ui->toolBar->addWidget( + createButtonWithLabel(ui->controllerButton, tr("Controllers"), showLabels)); + ui->toolBar->addWidget(createButtonWithLabel(ui->keyboardButton, tr("Keyboard"), showLabels)); + ui->toolBar->addWidget(createSpacer(this)); QFrame* line = new QFrame(this); - line->setFrameShape(QFrame::StyledPanel); + line->setFrameShape(QFrame::VLine); line->setFrameShadow(QFrame::Sunken); + line->setMinimumWidth(2); ui->toolBar->addWidget(line); - ui->toolBar->addWidget(ui->sizeSliderContainer); - ui->toolBar->addWidget(ui->mw_searchbar); + ui->toolBar->addWidget(createSpacer(this)); + if (showLabels) { + QLabel* pauseButtonLabel = ui->pauseButton->parentWidget()->findChild(); + if (pauseButtonLabel) { + pauseButtonLabel->setVisible(false); + } + } + ui->toolBar->addWidget( + createButtonWithLabel(ui->refreshButton, tr("Refresh List"), showLabels)); + ui->toolBar->addWidget(createSpacer(this)); + + QBoxLayout* toolbarLayout = new QBoxLayout(QBoxLayout::TopToBottom); + toolbarLayout->setSpacing(2); + toolbarLayout->setContentsMargins(2, 2, 2, 2); + ui->sizeSliderContainer->setFixedWidth(150); + + QWidget* searchSliderContainer = new QWidget(this); + QBoxLayout* searchSliderLayout = new QBoxLayout(QBoxLayout::TopToBottom); + searchSliderLayout->setContentsMargins(0, 0, 6, 6); + searchSliderLayout->setSpacing(2); + ui->mw_searchbar->setFixedWidth(150); + + searchSliderLayout->addWidget(ui->sizeSliderContainer); + searchSliderLayout->addWidget(ui->mw_searchbar); + + searchSliderContainer->setLayout(searchSliderLayout); + + ui->toolBar->addWidget(searchSliderContainer); + + if (!showLabels) { + toolbarLayout->addWidget(searchSliderContainer); + } + + ui->playButton->setVisible(true); + ui->pauseButton->setVisible(false); +} + +void MainWindow::UpdateToolbarButtons() { + // add toolbar widgets when game is running + bool showLabels = ui->toggleLabelsAct->isChecked(); + + ui->playButton->setVisible(false); + ui->pauseButton->setVisible(true); + + if (showLabels) { + QLabel* playButtonLabel = ui->playButton->parentWidget()->findChild(); + if (playButtonLabel) + playButtonLabel->setVisible(false); + } + + if (is_paused) { + ui->pauseButton->setIcon(ui->playButton->icon()); + ui->pauseButton->setToolTip(tr("Resume")); + } else { + if (isIconBlack) { + ui->pauseButton->setIcon(QIcon(":images/pause_icon.png")); + } else { + ui->pauseButton->setIcon(RecolorIcon(QIcon(":images/pause_icon.png"), isWhite)); + } + ui->pauseButton->setToolTip(tr("Pause")); + } + + if (showLabels) { + QLabel* pauseButtonLabel = ui->pauseButton->parentWidget()->findChild(); + if (pauseButtonLabel) { + pauseButtonLabel->setText(is_paused ? tr("Resume") : tr("Pause")); + pauseButtonLabel->setVisible(true); + } + } +} + +void MainWindow::UpdateToolbarLabels() { + AddUiWidgets(); } void MainWindow::CreateDockWindows() { @@ -253,6 +390,8 @@ void MainWindow::CreateConnects() { connect(ui->refreshButton, &QPushButton::clicked, this, &MainWindow::RefreshGameTable); connect(ui->showGameListAct, &QAction::triggered, this, &MainWindow::ShowGameList); connect(this, &MainWindow::ExtractionFinished, this, &MainWindow::RefreshGameTable); + connect(ui->toggleLabelsAct, &QAction::toggled, this, &MainWindow::toggleLabelsUnderIcons); + connect(ui->fullscreenButton, &QPushButton::clicked, this, &MainWindow::toggleFullscreen); connect(ui->sizeSlider, &QSlider::valueChanged, this, [this](int value) { if (isTableList) { @@ -276,6 +415,7 @@ void MainWindow::CreateConnects() { }); connect(ui->playButton, &QPushButton::clicked, this, &MainWindow::StartGame); + connect(ui->pauseButton, &QPushButton::clicked, this, &MainWindow::PauseGame); connect(m_game_grid_frame.get(), &QTableWidget::cellDoubleClicked, this, &MainWindow::StartGame); connect(m_game_list_frame.get(), &QTableWidget::cellDoubleClicked, this, @@ -576,7 +716,6 @@ void MainWindow::CreateConnects() { }); // Package install. - connect(ui->bootInstallPkgAct, &QAction::triggered, this, &MainWindow::InstallPkg); connect(ui->bootGameAct, &QAction::triggered, this, &MainWindow::BootGame); connect(ui->gameInstallPathAct, &QAction::triggered, this, &MainWindow::InstallDirectory); @@ -584,13 +723,58 @@ void MainWindow::CreateConnects() { connect(ui->addElfFolderAct, &QAction::triggered, m_elf_viewer.data(), &ElfViewer::OpenElfFolder); - // Package Viewer. - connect(ui->pkgViewerAct, &QAction::triggered, this, [this]() { - PKGViewer* pkgViewer = new PKGViewer( - m_game_info, this, [this](std::filesystem::path file, int pkgNum, int nPkg) { - this->InstallDragDropPkg(file, pkgNum, nPkg); - }); - pkgViewer->show(); + // Trophy Viewer + connect(ui->trophyViewerAct, &QAction::triggered, this, [this]() { + if (m_game_info->m_games.empty()) { + QMessageBox::information( + this, tr("Trophy Viewer"), + tr("No games found. Please add your games to your library first.")); + return; + } + + const auto& firstGame = m_game_info->m_games[0]; + QString trophyPath, gameTrpPath; + Common::FS::PathToQString(trophyPath, firstGame.serial); + Common::FS::PathToQString(gameTrpPath, firstGame.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); + } else { + game_update_path = Common::FS::PathFromQString(gameTrpPath); + game_update_path += "-patch"; + if (std::filesystem::exists(game_update_path)) { + Common::FS::PathToQString(gameTrpPath, game_update_path); + } + } + + QVector allTrophyGames; + for (const auto& game : m_game_info->m_games) { + TrophyGameInfo gameInfo; + gameInfo.name = QString::fromStdString(game.name); + Common::FS::PathToQString(gameInfo.trophyPath, game.serial); + Common::FS::PathToQString(gameInfo.gameTrpPath, game.path); + + auto update_path = Common::FS::PathFromQString(gameInfo.gameTrpPath); + update_path += "-UPDATE"; + if (std::filesystem::exists(update_path)) { + Common::FS::PathToQString(gameInfo.gameTrpPath, update_path); + } else { + update_path = Common::FS::PathFromQString(gameInfo.gameTrpPath); + update_path += "-patch"; + if (std::filesystem::exists(update_path)) { + Common::FS::PathToQString(gameInfo.gameTrpPath, update_path); + } + } + + allTrophyGames.append(gameInfo); + } + + QString gameName = QString::fromStdString(firstGame.name); + TrophyViewer* trophyViewer = + new TrophyViewer(trophyPath, gameTrpPath, gameName, allTrophyGames); + trophyViewer->show(); }); // Themes @@ -689,6 +873,8 @@ void MainWindow::StartGame() { return; } StartEmulator(path); + + UpdateToolbarButtons(); } } @@ -767,22 +953,6 @@ void MainWindow::SaveWindowState() const { this->geometry().width(), this->geometry().height()); } -void MainWindow::InstallPkg() { - QFileDialog dialog; - dialog.setFileMode(QFileDialog::ExistingFiles); - dialog.setNameFilter(tr("PKG File (*.PKG *.pkg)")); - if (dialog.exec()) { - QStringList fileNames = dialog.selectedFiles(); - int nPkg = fileNames.size(); - int pkgNum = 0; - for (const QString& file : fileNames) { - ++pkgNum; - std::filesystem::path path = Common::FS::PathFromQString(file); - MainWindow::InstallDragDropPkg(path, pkgNum, nPkg); - } - } -} - void MainWindow::BootGame() { QFileDialog dialog; dialog.setFileMode(QFileDialog::ExistingFile); @@ -806,260 +976,6 @@ void MainWindow::BootGame() { } } -void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int nPkg) { - if (Loader::DetectFileType(file) == Loader::FileTypes::Pkg) { - std::string failreason; - pkg = PKG(); - if (!pkg.Open(file, failreason)) { - QMessageBox::critical(this, tr("PKG ERROR"), QString::fromStdString(failreason)); - return; - } - if (!psf.Open(pkg.sfo)) { - QMessageBox::critical(this, tr("PKG ERROR"), - "Could not read SFO. Check log for details"); - return; - } - auto category = psf.GetString("CATEGORY"); - - 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; - - QString pkgType = QString::fromStdString(pkg.GetPkgFlags()); - bool use_game_update = pkgType.contains("PATCH") && Config::getSeparateUpdateEnabled(); - - // Default paths - auto game_folder_path = game_install_dir / pkg.GetTitleID(); - auto game_update_path = use_game_update ? game_folder_path.parent_path() / - (std::string{pkg.GetTitleID()} + "-UPDATE") - : game_folder_path; - const int max_depth = 5; - - if (pkgType.contains("PATCH")) { - // For patches, try to find the game recursively - auto found_game = Common::FS::FindGameByID(game_install_dir, - std::string{pkg.GetTitleID()}, max_depth); - if (found_game.has_value()) { - game_folder_path = found_game.value().parent_path(); - game_update_path = use_game_update ? game_folder_path.parent_path() / - (std::string{pkg.GetTitleID()} + "-UPDATE") - : game_folder_path; - } - } else { - // For base games, we check if the game is already installed - auto found_game = Common::FS::FindGameByID(game_install_dir, - std::string{pkg.GetTitleID()}, max_depth); - if (found_game.has_value()) { - game_folder_path = found_game.value().parent_path(); - } - // If the game is not found, we install it in the game install directory - else { - game_folder_path = game_install_dir / pkg.GetTitleID(); - } - game_update_path = use_game_update ? game_folder_path.parent_path() / - (std::string{pkg.GetTitleID()} + "-UPDATE") - : game_folder_path; - } - - QString gameDirPath; - Common::FS::PathToQString(gameDirPath, game_folder_path); - QDir game_dir(gameDirPath); - if (game_dir.exists()) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("PKG Extraction")); - - std::string content_id; - if (auto value = psf.GetString("CONTENT_ID"); value.has_value()) { - content_id = std::string{*value}; - } else { - QMessageBox::critical(this, tr("PKG ERROR"), "PSF file there is no CONTENT_ID"); - return; - } - std::string entitlement_label = Common::SplitString(content_id, '-')[2]; - - auto addon_extract_path = - Config::getAddonInstallDir() / pkg.GetTitleID() / entitlement_label; - QString addonDirPath; - Common::FS::PathToQString(addonDirPath, addon_extract_path); - QDir addon_dir(addonDirPath); - - if (pkgType.contains("PATCH")) { - QString pkg_app_version; - if (auto app_ver = psf.GetString("APP_VER"); app_ver.has_value()) { - pkg_app_version = QString::fromStdString(std::string{*app_ver}); - } else { - QMessageBox::critical(this, tr("PKG ERROR"), "PSF file there is no APP_VER"); - return; - } - std::filesystem::path sce_folder_path = - std::filesystem::exists(game_update_path / "sce_sys" / "param.sfo") - ? game_update_path / "sce_sys" / "param.sfo" - : game_folder_path / "sce_sys" / "param.sfo"; - psf.Open(sce_folder_path); - QString game_app_version; - if (auto app_ver = psf.GetString("APP_VER"); app_ver.has_value()) { - game_app_version = QString::fromStdString(std::string{*app_ver}); - } else { - QMessageBox::critical(this, tr("PKG ERROR"), "PSF file there is no APP_VER"); - return; - } - double appD = game_app_version.toDouble(); - double pkgD = pkg_app_version.toDouble(); - if (pkgD == appD) { - msgBox.setText(QString(tr("Patch detected!") + "\n" + - tr("PKG and Game versions match: ") + pkg_app_version + - "\n" + tr("Would you like to overwrite?"))); - msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msgBox.setDefaultButton(QMessageBox::No); - } else if (pkgD < appD) { - msgBox.setText(QString(tr("Patch detected!") + "\n" + - tr("PKG Version %1 is older than installed version: ") - .arg(pkg_app_version) + - game_app_version + "\n" + - tr("Would you like to overwrite?"))); - msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msgBox.setDefaultButton(QMessageBox::No); - } else { - msgBox.setText(QString(tr("Patch detected!") + "\n" + - tr("Game is installed: ") + game_app_version + "\n" + - tr("Would you like to install Patch: ") + - pkg_app_version + " ?")); - msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msgBox.setDefaultButton(QMessageBox::No); - } - int result = msgBox.exec(); - if (result == QMessageBox::Yes) { - // Do nothing. - } else { - return; - } - } else if (category == "ac") { - if (!addon_dir.exists()) { - QMessageBox addonMsgBox; - addonMsgBox.setWindowTitle(tr("DLC Installation")); - addonMsgBox.setText(QString(tr("Would you like to install DLC: %1?")) - .arg(QString::fromStdString(entitlement_label))); - - addonMsgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - addonMsgBox.setDefaultButton(QMessageBox::No); - int result = addonMsgBox.exec(); - if (result == QMessageBox::Yes) { - game_update_path = addon_extract_path; - } else { - return; - } - } else { - msgBox.setText(QString(tr("DLC already installed:") + "\n" + addonDirPath + - "\n\n" + tr("Would you like to overwrite?"))); - msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msgBox.setDefaultButton(QMessageBox::No); - int result = msgBox.exec(); - if (result == QMessageBox::Yes) { - game_update_path = addon_extract_path; - } else { - return; - } - } - } else { - msgBox.setText(QString(tr("Game already installed") + "\n" + gameDirPath + "\n" + - tr("Would you like to overwrite?"))); - msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msgBox.setDefaultButton(QMessageBox::No); - int result = msgBox.exec(); - if (result == QMessageBox::Yes) { - // Do nothing. - } else { - return; - } - } - } else { - // Do nothing; - if (pkgType.contains("PATCH") || category == "ac") { - QMessageBox::information( - this, tr("PKG Extraction"), - tr("PKG is a patch or DLC, please install the game first!")); - return; - } - // what else? - } - if (!pkg.Extract(file, game_update_path, failreason)) { - QMessageBox::critical(this, tr("PKG ERROR"), QString::fromStdString(failreason)); - } else { - int nfiles = pkg.GetNumberOfFiles(); - - if (nfiles > 0) { - QVector indices; - for (int i = 0; i < nfiles; i++) { - indices.append(i); - } - - QProgressDialog dialog; - dialog.setWindowTitle(tr("PKG Extraction")); - dialog.setWindowModality(Qt::WindowModal); - QString extractmsg = QString(tr("Extracting PKG %1/%2")).arg(pkgNum).arg(nPkg); - dialog.setLabelText(extractmsg); - dialog.setAutoClose(true); - dialog.setRange(0, nfiles); - - dialog.setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, - dialog.size(), this->geometry())); - - QFutureWatcher futureWatcher; - connect(&futureWatcher, &QFutureWatcher::finished, this, [=, this]() { - if (pkgNum == nPkg) { - QString path; - - // We want to show the parent path instead of the full path - Common::FS::PathToQString(path, game_folder_path.parent_path()); - 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); - extractMsgBox.setDefaultButton(QMessageBox::Ok); - connect(&extractMsgBox, &QMessageBox::buttonClicked, this, - [&](QAbstractButton* button) { - if (extractMsgBox.button(QMessageBox::Ok) == button) { - extractMsgBox.close(); - emit ExtractionFinished(); - } - }); - extractMsgBox.exec(); - } - if (delete_file_on_install) { - std::filesystem::remove(file); - } - }); - connect(&dialog, &QProgressDialog::canceled, [&]() { futureWatcher.cancel(); }); - connect(&futureWatcher, &QFutureWatcher::progressValueChanged, &dialog, - &QProgressDialog::setValue); - futureWatcher.setFuture( - QtConcurrent::map(indices, [&](int index) { pkg.ExtractFiles(index); })); - dialog.exec(); - } - } - } else { - QMessageBox::critical(this, tr("PKG ERROR"), - tr("File doesn't appear to be a valid PKG file")); - } -} - void MainWindow::InstallDirectory() { GameInstallDialog dlg; dlg.exec(); @@ -1142,7 +1058,6 @@ QIcon MainWindow::RecolorIcon(const QIcon& icon, bool isWhite) { } void MainWindow::SetUiIcons(bool isWhite) { - ui->bootInstallPkgAct->setIcon(RecolorIcon(ui->bootInstallPkgAct->icon(), isWhite)); ui->bootGameAct->setIcon(RecolorIcon(ui->bootGameAct->icon(), isWhite)); ui->shadFolderAct->setIcon(RecolorIcon(ui->shadFolderAct->icon(), isWhite)); ui->exitAct->setIcon(RecolorIcon(ui->exitAct->icon(), isWhite)); @@ -1163,12 +1078,14 @@ void MainWindow::SetUiIcons(bool isWhite) { ui->pauseButton->setIcon(RecolorIcon(ui->pauseButton->icon(), isWhite)); ui->stopButton->setIcon(RecolorIcon(ui->stopButton->icon(), isWhite)); ui->refreshButton->setIcon(RecolorIcon(ui->refreshButton->icon(), isWhite)); + ui->restartButton->setIcon(RecolorIcon(ui->restartButton->icon(), isWhite)); ui->settingsButton->setIcon(RecolorIcon(ui->settingsButton->icon(), isWhite)); + ui->fullscreenButton->setIcon(RecolorIcon(ui->fullscreenButton->icon(), isWhite)); ui->controllerButton->setIcon(RecolorIcon(ui->controllerButton->icon(), isWhite)); ui->keyboardButton->setIcon(RecolorIcon(ui->keyboardButton->icon(), isWhite)); ui->refreshGameListAct->setIcon(RecolorIcon(ui->refreshGameListAct->icon(), isWhite)); ui->menuGame_List_Mode->setIcon(RecolorIcon(ui->menuGame_List_Mode->icon(), isWhite)); - ui->pkgViewerAct->setIcon(RecolorIcon(ui->pkgViewerAct->icon(), isWhite)); + ui->trophyViewerAct->setIcon(RecolorIcon(ui->trophyViewerAct->icon(), isWhite)); ui->configureAct->setIcon(RecolorIcon(ui->configureAct->icon(), isWhite)); ui->addElfFolderAct->setIcon(RecolorIcon(ui->addElfFolderAct->icon(), isWhite)); } diff --git a/src/qt_gui/main_window.h b/src/qt_gui/main_window.h index 5ac56e44c..5d05bfca4 100644 --- a/src/qt_gui/main_window.h +++ b/src/qt_gui/main_window.h @@ -5,6 +5,7 @@ #include #include +#include #include #include "background_music_player.h" @@ -21,7 +22,6 @@ #include "game_list_utils.h" #include "main_window_themes.h" #include "main_window_ui.h" -#include "pkg_viewer.h" class GameListFrame; @@ -35,9 +35,10 @@ public: explicit MainWindow(QWidget* parent = nullptr); ~MainWindow(); bool Init(); - void InstallDragDropPkg(std::filesystem::path file, int pkgNum, int nPkg); void InstallDirectory(); void StartGame(); + void PauseGame(); + bool showLabels; private Q_SLOTS: void ConfigureGuiFromSettings(); @@ -47,15 +48,21 @@ private Q_SLOTS: void RefreshGameTable(); void HandleResize(QResizeEvent* event); void OnLanguageChanged(const std::string& locale); + void toggleLabelsUnderIcons(); private: Ui_MainWindow* ui; void AddUiWidgets(); + void UpdateToolbarLabels(); + void UpdateToolbarButtons(); + QWidget* createButtonWithLabel(QPushButton* button, const QString& labelText, bool showLabel); void CreateActions(); + void toggleFullscreen(); void CreateRecentGameActions(); void CreateDockWindows(); void GetPhysicalDevices(); void LoadGameLists(); + #ifdef ENABLE_UPDATER void CheckUpdateMain(bool checkSave); #endif @@ -63,7 +70,6 @@ private: void SetLastUsedTheme(); void SetLastIconSizeBullet(); void SetUiIcons(bool isWhite); - void InstallPkg(); void BootGame(); void AddRecentFiles(QString filePath); void LoadTranslation(); @@ -73,11 +79,13 @@ private: bool isIconBlack = false; bool isTableList = true; bool isGameRunning = false; + bool isWhite = false; + bool is_paused = false; + QActionGroup* m_icon_size_act_group = nullptr; QActionGroup* m_list_mode_act_group = nullptr; QActionGroup* m_theme_act_group = nullptr; QActionGroup* m_recent_files_group = nullptr; - PKG pkg; // Dockable widget frames WindowThemes m_window_themes; GameListUtils m_game_list_utils; @@ -108,20 +116,6 @@ protected: } } - void dropEvent(QDropEvent* event1) override { - const QMimeData* mimeData = event1->mimeData(); - if (mimeData->hasUrls()) { - QList urlList = mimeData->urls(); - int pkgNum = 0; - int nPkg = urlList.size(); - for (const QUrl& url : urlList) { - pkgNum++; - std::filesystem::path path = Common::FS::PathFromQString(url.toLocalFile()); - InstallDragDropPkg(path, pkgNum, nPkg); - } - } - } - void resizeEvent(QResizeEvent* event) override; std::filesystem::path last_install_dir = ""; diff --git a/src/qt_gui/main_window_themes.cpp b/src/qt_gui/main_window_themes.cpp index c5574fca9..624673cba 100644 --- a/src/qt_gui/main_window_themes.cpp +++ b/src/qt_gui/main_window_themes.cpp @@ -19,7 +19,7 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) { themePalette.setColor(QPalette::WindowText, Qt::white); themePalette.setColor(QPalette::Base, QColor(20, 20, 20)); themePalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53)); - themePalette.setColor(QPalette::ToolTipBase, Qt::white); + themePalette.setColor(QPalette::ToolTipBase, QColor(20, 20, 20)); themePalette.setColor(QPalette::ToolTipText, Qt::white); themePalette.setColor(QPalette::Text, Qt::white); themePalette.setColor(QPalette::Button, QColor(53, 53, 53)); @@ -37,18 +37,18 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) { "border-radius: 4px; padding: 5px; }" "QLineEdit:focus {" "border: 1px solid #2A82DA; }"); - themePalette.setColor(QPalette::Window, QColor(240, 240, 240)); // Light gray - themePalette.setColor(QPalette::WindowText, Qt::black); // Black - themePalette.setColor(QPalette::Base, QColor(230, 230, 230, 80)); // Grayish - themePalette.setColor(QPalette::ToolTipBase, Qt::black); // Black - themePalette.setColor(QPalette::ToolTipText, Qt::black); // Black - themePalette.setColor(QPalette::Text, Qt::black); // Black - themePalette.setColor(QPalette::Button, QColor(240, 240, 240)); // Light gray - themePalette.setColor(QPalette::ButtonText, Qt::black); // Black - themePalette.setColor(QPalette::BrightText, Qt::red); // Red - themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); // Blue - themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); // Blue - themePalette.setColor(QPalette::HighlightedText, Qt::white); // White + themePalette.setColor(QPalette::Window, QColor(240, 240, 240)); // Light gray + themePalette.setColor(QPalette::WindowText, Qt::black); // Black + themePalette.setColor(QPalette::Base, QColor(230, 230, 230, 80)); // Grayish + themePalette.setColor(QPalette::ToolTipBase, QColor(230, 230, 230, 80)); // Grayish + themePalette.setColor(QPalette::ToolTipText, Qt::black); // Black + themePalette.setColor(QPalette::Text, Qt::black); // Black + themePalette.setColor(QPalette::Button, QColor(240, 240, 240)); // Light gray + themePalette.setColor(QPalette::ButtonText, Qt::black); // Black + themePalette.setColor(QPalette::BrightText, Qt::red); // Red + themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); // Blue + themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); // Blue + themePalette.setColor(QPalette::HighlightedText, Qt::white); // White qApp->setPalette(themePalette); break; case Theme::Green: @@ -62,8 +62,9 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) { themePalette.setColor(QPalette::WindowText, Qt::white); // White text themePalette.setColor(QPalette::Base, QColor(25, 40, 25)); // Darker green base themePalette.setColor(QPalette::AlternateBase, - QColor(53, 69, 53)); // Dark green alternate base - themePalette.setColor(QPalette::ToolTipBase, Qt::white); // White tooltip background + QColor(53, 69, 53)); // Dark green alternate base + themePalette.setColor(QPalette::ToolTipBase, + QColor(25, 40, 25)); // White tooltip background themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text themePalette.setColor(QPalette::Text, Qt::white); // White text themePalette.setColor(QPalette::Button, QColor(53, 69, 53)); // Dark green button @@ -85,8 +86,9 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) { themePalette.setColor(QPalette::WindowText, Qt::white); // White text themePalette.setColor(QPalette::Base, QColor(20, 40, 60)); // Darker blue base themePalette.setColor(QPalette::AlternateBase, - QColor(40, 60, 90)); // Dark blue alternate base - themePalette.setColor(QPalette::ToolTipBase, Qt::white); // White tooltip background + QColor(40, 60, 90)); // Dark blue alternate base + themePalette.setColor(QPalette::ToolTipBase, + QColor(20, 40, 60)); // White tooltip background themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text themePalette.setColor(QPalette::Text, Qt::white); // White text themePalette.setColor(QPalette::Button, QColor(40, 60, 90)); // Dark blue button @@ -109,8 +111,9 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) { themePalette.setColor(QPalette::WindowText, Qt::white); // White text themePalette.setColor(QPalette::Base, QColor(80, 30, 90)); // Darker violet base themePalette.setColor(QPalette::AlternateBase, - QColor(100, 50, 120)); // Violet alternate base - themePalette.setColor(QPalette::ToolTipBase, Qt::white); // White tooltip background + QColor(100, 50, 120)); // Violet alternate base + themePalette.setColor(QPalette::ToolTipBase, + QColor(80, 30, 90)); // White tooltip background themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text themePalette.setColor(QPalette::Text, Qt::white); // White text themePalette.setColor(QPalette::Button, QColor(100, 50, 120)); // Violet button @@ -133,7 +136,7 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) { themePalette.setColor(QPalette::WindowText, QColor(249, 245, 215)); themePalette.setColor(QPalette::Base, QColor(29, 32, 33)); themePalette.setColor(QPalette::AlternateBase, QColor(50, 48, 47)); - themePalette.setColor(QPalette::ToolTipBase, QColor(249, 245, 215)); + themePalette.setColor(QPalette::ToolTipBase, QColor(29, 32, 33)); themePalette.setColor(QPalette::ToolTipText, QColor(249, 245, 215)); themePalette.setColor(QPalette::Text, QColor(249, 245, 215)); themePalette.setColor(QPalette::Button, QColor(40, 40, 40)); @@ -155,7 +158,7 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) { themePalette.setColor(QPalette::WindowText, QColor(192, 202, 245)); themePalette.setColor(QPalette::Base, QColor(25, 28, 39)); themePalette.setColor(QPalette::AlternateBase, QColor(36, 40, 59)); - themePalette.setColor(QPalette::ToolTipBase, QColor(192, 202, 245)); + themePalette.setColor(QPalette::ToolTipBase, QColor(25, 28, 39)); themePalette.setColor(QPalette::ToolTipText, QColor(192, 202, 245)); themePalette.setColor(QPalette::Text, QColor(192, 202, 245)); themePalette.setColor(QPalette::Button, QColor(30, 30, 41)); diff --git a/src/qt_gui/main_window_ui.h b/src/qt_gui/main_window_ui.h index 3ebfcee9e..2c4d4480b 100644 --- a/src/qt_gui/main_window_ui.h +++ b/src/qt_gui/main_window_ui.h @@ -9,7 +9,6 @@ class Ui_MainWindow { public: - QAction* bootInstallPkgAct; QAction* bootGameAct; QAction* addElfFolderAct; QAction* shadFolderAct; @@ -20,13 +19,14 @@ public: QAction* setIconSizeSmallAct; QAction* setIconSizeMediumAct; QAction* setIconSizeLargeAct; + QAction* toggleLabelsAct; QAction* setlistModeListAct; QAction* setlistModeGridAct; QAction* setlistElfAct; QAction* gameInstallPathAct; QAction* downloadCheatsPatchesAct; QAction* dumpGameListAct; - QAction* pkgViewerAct; + QAction* trophyViewerAct; #ifdef ENABLE_UPDATER QAction* updaterAct; #endif @@ -49,6 +49,8 @@ public: QPushButton* settingsButton; QPushButton* controllerButton; QPushButton* keyboardButton; + QPushButton* fullscreenButton; + QPushButton* restartButton; QWidget* sizeSliderContainer; QHBoxLayout* sizeSliderContainer_layout; @@ -83,9 +85,6 @@ public: MainWindow->setDockNestingEnabled(true); MainWindow->setDockOptions(QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks | QMainWindow::AnimatedDocks | QMainWindow::GroupedDragging); - bootInstallPkgAct = new QAction(MainWindow); - bootInstallPkgAct->setObjectName("bootInstallPkgAct"); - bootInstallPkgAct->setIcon(QIcon(":images/file_icon.png")); bootGameAct = new QAction(MainWindow); bootGameAct->setObjectName("bootGameAct"); bootGameAct->setIcon(QIcon(":images/play_icon.png")); @@ -103,7 +102,15 @@ public: showGameListAct->setCheckable(true); refreshGameListAct = new QAction(MainWindow); refreshGameListAct->setObjectName("refreshGameListAct"); - refreshGameListAct->setIcon(QIcon(":images/refresh_icon.png")); + refreshGameListAct->setIcon(QIcon(":images/refreshlist_icon.png")); + + toggleLabelsAct = new QAction(MainWindow); + toggleLabelsAct->setObjectName("toggleLabelsAct"); + toggleLabelsAct->setText( + QCoreApplication::translate("MainWindow", "Show Labels Under Icons")); + toggleLabelsAct->setCheckable(true); + toggleLabelsAct->setChecked(Config::getShowLabelsUnderIcons()); + setIconSizeTinyAct = new QAction(MainWindow); setIconSizeTinyAct->setObjectName("setIconSizeTinyAct"); setIconSizeTinyAct->setCheckable(true); @@ -136,9 +143,10 @@ public: dumpGameListAct = new QAction(MainWindow); dumpGameListAct->setObjectName("dumpGameList"); dumpGameListAct->setIcon(QIcon(":images/dump_icon.png")); - pkgViewerAct = new QAction(MainWindow); - pkgViewerAct->setObjectName("pkgViewer"); - pkgViewerAct->setIcon(QIcon(":images/file_icon.png")); + trophyViewerAct = new QAction(MainWindow); + trophyViewerAct->setObjectName("trophyViewer"); + trophyViewerAct->setIcon(QIcon(":images/trophy_icon.png")); + #ifdef ENABLE_UPDATER updaterAct = new QAction(MainWindow); updaterAct->setObjectName("updaterAct"); @@ -205,20 +213,28 @@ public: stopButton->setIconSize(QSize(40, 40)); refreshButton = new QPushButton(centralWidget); refreshButton->setFlat(true); - refreshButton->setIcon(QIcon(":images/refresh_icon.png")); - refreshButton->setIconSize(QSize(32, 32)); + refreshButton->setIcon(QIcon(":images/refreshlist_icon.png")); + refreshButton->setIconSize(QSize(40, 40)); + fullscreenButton = new QPushButton(centralWidget); + fullscreenButton->setFlat(true); + fullscreenButton->setIcon(QIcon(":images/fullscreen_icon.png")); + fullscreenButton->setIconSize(QSize(38, 38)); settingsButton = new QPushButton(centralWidget); settingsButton->setFlat(true); settingsButton->setIcon(QIcon(":images/settings_icon.png")); - settingsButton->setIconSize(QSize(44, 44)); + settingsButton->setIconSize(QSize(40, 40)); controllerButton = new QPushButton(centralWidget); controllerButton->setFlat(true); controllerButton->setIcon(QIcon(":images/controller_icon.png")); - controllerButton->setIconSize(QSize(40, 40)); + controllerButton->setIconSize(QSize(55, 48)); keyboardButton = new QPushButton(centralWidget); keyboardButton->setFlat(true); keyboardButton->setIcon(QIcon(":images/keyboard_icon.png")); - keyboardButton->setIconSize(QSize(48, 44)); + keyboardButton->setIconSize(QSize(50, 50)); + restartButton = new QPushButton(centralWidget); + restartButton->setFlat(true); + restartButton->setIcon(QIcon(":images/restart_game_icon.png")); + restartButton->setIconSize(QSize(40, 40)); sizeSliderContainer = new QWidget(centralWidget); sizeSliderContainer->setObjectName("sizeSliderContainer"); @@ -285,7 +301,6 @@ public: menuBar->addAction(menuView->menuAction()); menuBar->addAction(menuSettings->menuAction()); menuBar->addAction(menuHelp->menuAction()); - menuFile->addAction(bootInstallPkgAct); menuFile->addAction(bootGameAct); menuFile->addSeparator(); menuFile->addAction(addElfFolderAct); @@ -299,6 +314,7 @@ public: menuView->addAction(refreshGameListAct); menuView->addAction(menuGame_List_Mode->menuAction()); menuView->addAction(menuGame_List_Icons->menuAction()); + menuView->addAction(toggleLabelsAct); menuView->addAction(menuThemes->menuAction()); menuThemes->addAction(setThemeDark); menuThemes->addAction(setThemeLight); @@ -320,7 +336,7 @@ public: menuSettings->addAction(menuUtils->menuAction()); menuUtils->addAction(downloadCheatsPatchesAct); menuUtils->addAction(dumpGameListAct); - menuUtils->addAction(pkgViewerAct); + menuUtils->addAction(trophyViewerAct); #ifdef ENABLE_UPDATER menuHelp->addAction(updaterAct); #endif @@ -335,8 +351,6 @@ public: MainWindow->setWindowTitle(QCoreApplication::translate("MainWindow", "shadPS4", nullptr)); addElfFolderAct->setText( QCoreApplication::translate("MainWindow", "Open/Add Elf Folder", nullptr)); - bootInstallPkgAct->setText( - QCoreApplication::translate("MainWindow", "Install Packages (PKG)", nullptr)); bootGameAct->setText(QCoreApplication::translate("MainWindow", "Boot Game", nullptr)); #ifdef ENABLE_UPDATER updaterAct->setText( @@ -345,8 +359,6 @@ public: aboutAct->setText(QCoreApplication::translate("MainWindow", "About shadPS4", nullptr)); configureAct->setText(QCoreApplication::translate("MainWindow", "Configure...", nullptr)); #if QT_CONFIG(tooltip) - bootInstallPkgAct->setToolTip(QCoreApplication::translate( - "MainWindow", "Install application from a .pkg file", nullptr)); #endif // QT_CONFIG(tooltip) menuRecent->setTitle(QCoreApplication::translate("MainWindow", "Recent Games", nullptr)); shadFolderAct->setText( @@ -378,7 +390,8 @@ public: QCoreApplication::translate("MainWindow", "Download Cheats/Patches", nullptr)); dumpGameListAct->setText( QCoreApplication::translate("MainWindow", "Dump Game List", nullptr)); - pkgViewerAct->setText(QCoreApplication::translate("MainWindow", "PKG Viewer", nullptr)); + trophyViewerAct->setText( + QCoreApplication::translate("MainWindow", "Trophy Viewer", nullptr)); mw_searchbar->setPlaceholderText( QCoreApplication::translate("MainWindow", "Search...", nullptr)); menuFile->setTitle(QCoreApplication::translate("MainWindow", "File", nullptr)); @@ -405,4 +418,4 @@ public: namespace Ui { class MainWindow : public Ui_MainWindow {}; -} // namespace Ui \ No newline at end of file +} // namespace Ui diff --git a/src/qt_gui/pkg_viewer.cpp b/src/qt_gui/pkg_viewer.cpp deleted file mode 100644 index ecbc6312d..000000000 --- a/src/qt_gui/pkg_viewer.cpp +++ /dev/null @@ -1,217 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "pkg_viewer.h" - -PKGViewer::PKGViewer(std::shared_ptr game_info_get, QWidget* parent, - std::function InstallDragDropPkg) - : QMainWindow(), m_game_info(game_info_get) { - this->resize(1280, 720); - this->setAttribute(Qt::WA_DeleteOnClose); - dir_list_std = Config::getPkgViewer(); - dir_list.clear(); - for (const auto& str : dir_list_std) { - dir_list.append(QString::fromStdString(str)); - } - statusBar = new QStatusBar(treeWidget); - this->setStatusBar(statusBar); - treeWidget = new QTreeWidget(this); - treeWidget->setColumnCount(9); - QStringList headers; - headers << tr("Name") << tr("Serial") << tr("Installed") << tr("Size") << tr("Category") - << tr("Type") << tr("App Ver") << tr("FW") << tr("Region") << tr("Flags") << tr("Path"); - treeWidget->setHeaderLabels(headers); - treeWidget->header()->setDefaultAlignment(Qt::AlignCenter); - treeWidget->setContextMenuPolicy(Qt::CustomContextMenu); - treeWidget->setColumnWidth(8, 170); - this->setCentralWidget(treeWidget); - QMenuBar* menuBar = new QMenuBar(this); - menuBar->setContextMenuPolicy(Qt::PreventContextMenu); - QMenu* fileMenu = menuBar->addMenu(tr("File")); - QAction* openFolderAct = new QAction(tr("Open Folder"), this); - fileMenu->addAction(openFolderAct); - this->setMenuBar(menuBar); - CheckPKGFolders(); // Check for new PKG files in existing folders. - ProcessPKGInfo(); - - connect(openFolderAct, &QAction::triggered, this, &PKGViewer::OpenPKGFolder); - - connect(treeWidget, &QTreeWidget::customContextMenuRequested, this, - [=, this](const QPoint& pos) { - if (treeWidget->selectedItems().isEmpty()) { - return; - } - m_gui_context_menus.RequestGameMenuPKGViewer(pos, m_full_pkg_list, treeWidget, - InstallDragDropPkg); - }); - - connect(parent, &QWidget::destroyed, this, [this]() { this->deleteLater(); }); -} - -PKGViewer::~PKGViewer() {} - -void PKGViewer::OpenPKGFolder() { - QString folderPath = - QFileDialog::getExistingDirectory(this, tr("Open Folder"), QDir::homePath()); - if (!dir_list.contains(folderPath)) { - dir_list.append(folderPath); - QDir directory(folderPath); - QFileInfoList fileInfoList = directory.entryInfoList(QDir::Files); - for (const QFileInfo& fileInfo : fileInfoList) { - QString file_ext = fileInfo.suffix(); - if (fileInfo.isFile() && file_ext == "pkg") { - m_pkg_list.append(fileInfo.absoluteFilePath()); - } - } - std::sort(m_pkg_list.begin(), m_pkg_list.end()); - ProcessPKGInfo(); - dir_list_std.clear(); - for (auto dir : dir_list) { - dir_list_std.push_back(dir.toStdString()); - } - Config::setPkgViewer(dir_list_std); - } else { - // qDebug() << "Folder selection canceled."; - } -} - -void PKGViewer::CheckPKGFolders() { // Check for new PKG file additions. - m_pkg_list.clear(); - for (const QString& dir : dir_list) { - QDir directory(dir); - QFileInfoList fileInfoList = directory.entryInfoList(QDir::Files); - for (const QFileInfo& fileInfo : fileInfoList) { - QString file_ext = fileInfo.suffix(); - if (fileInfo.isFile() && file_ext == "pkg") { - m_pkg_list.append(fileInfo.absoluteFilePath()); - } - } - } - std::sort(m_pkg_list.begin(), m_pkg_list.end()); -} - -void PKGViewer::ProcessPKGInfo() { - treeWidget->clear(); - map_strings.clear(); - map_integers.clear(); - m_pkg_app_list.clear(); - m_pkg_patch_list.clear(); - m_full_pkg_list.clear(); - for (int i = 0; i < m_pkg_list.size(); i++) { - std::filesystem::path path = Common::FS::PathFromQString(m_pkg_list[i]); - std::string failreason; - if (!package.Open(path, failreason)) { - QMessageBox::critical(this, tr("PKG ERROR"), QString::fromStdString(failreason)); - return; - } - psf.Open(package.sfo); - QString title_name = QString::fromStdString( - std::string{psf.GetString("TITLE").value_or(std::string{tr("Unknown").toStdString()})}); - QString title_id = QString::fromStdString(std::string{ - psf.GetString("TITLE_ID").value_or(std::string{tr("Unknown").toStdString()})}); - QString app_type = GameListUtils::GetAppType(psf.GetInteger("APP_TYPE").value_or(0)); - QString app_version = QString::fromStdString(std::string{ - psf.GetString("APP_VER").value_or(std::string{tr("Unknown").toStdString()})}); - QString title_category = QString::fromStdString(std::string{ - psf.GetString("CATEGORY").value_or(std::string{tr("Unknown").toStdString()})}); - QString pkg_size = GameListUtils::FormatSize(package.GetPkgHeader().pkg_size); - pkg_content_flag = package.GetPkgHeader().pkg_content_flags; - QString flagss = ""; - for (const auto& flag : package.flagNames) { - if (package.isFlagSet(pkg_content_flag, flag.first)) { - if (!flagss.isEmpty()) - flagss += (", "); - flagss += QString::fromStdString(flag.second.data()); - } - } - - QString fw_ = tr("Unknown"); - if (const auto fw_int_opt = psf.GetInteger("SYSTEM_VER"); fw_int_opt.has_value()) { - const u32 fw_int = *fw_int_opt; - if (fw_int == 0) { - fw_ = "0.00"; - } else { - QString fw = QString::number(fw_int, 16); - fw_ = fw.length() > 7 ? QString::number(fw_int, 16).left(3).insert(2, '.') - : fw.left(3).insert(1, '.'); - } - } - char region = package.GetPkgHeader().pkg_content_id[0]; - QString pkg_info = ""; - if (title_category == "gd" && !flagss.contains("PATCH")) { - title_category = "App"; - pkg_info = title_name + ";;" + title_id + ";;" + pkg_size + ";;" + title_category + - ";;" + app_type + ";;" + app_version + ";;" + fw_ + ";;" + - game_list_util.GetRegion(region) + ";;" + flagss + ";;" + m_pkg_list[i]; - m_pkg_app_list.append(pkg_info); - } else { - title_category = "Patch"; - pkg_info = title_name + ";;" + title_id + ";;" + pkg_size + ";;" + title_category + - ";;" + app_type + ";;" + app_version + ";;" + fw_ + ";;" + - game_list_util.GetRegion(region) + ";;" + flagss + ";;" + m_pkg_list[i]; - m_pkg_patch_list.append(pkg_info); - } - } - std::sort(m_pkg_app_list.begin(), m_pkg_app_list.end()); - for (int i = 0; i < m_pkg_app_list.size(); i++) { - QTreeWidgetItem* treeItem = new QTreeWidgetItem(treeWidget); - QStringList pkg_app_ = m_pkg_app_list[i].split(";;"); - m_full_pkg_list.append(m_pkg_app_list[i]); - treeItem->setExpanded(true); - treeItem->setText(0, pkg_app_[0]); - treeItem->setText(1, pkg_app_[1]); - treeItem->setText(3, pkg_app_[2]); - treeItem->setTextAlignment(3, Qt::AlignCenter); - treeItem->setText(4, pkg_app_[3]); - treeItem->setTextAlignment(4, Qt::AlignCenter); - treeItem->setText(5, pkg_app_[4]); - treeItem->setTextAlignment(5, Qt::AlignCenter); - treeItem->setText(6, pkg_app_[5]); - treeItem->setTextAlignment(6, Qt::AlignCenter); - treeItem->setText(7, pkg_app_[6]); - treeItem->setTextAlignment(7, Qt::AlignCenter); - treeItem->setText(8, pkg_app_[7]); - treeItem->setTextAlignment(8, Qt::AlignCenter); - treeItem->setText(9, pkg_app_[8]); - treeItem->setText(10, pkg_app_[9]); - for (const GameInfo& info : m_game_info->m_games) { // Check if game is installed. - if (info.serial == pkg_app_[1].toStdString()) { - treeItem->setText(2, QChar(0x2713)); - treeItem->setTextAlignment(2, Qt::AlignCenter); - } - } - for (const QString& item : m_pkg_patch_list) { - QStringList pkg_patch_ = item.split(";;"); - if (pkg_patch_[1] == pkg_app_[1]) { // check patches with serial. - m_full_pkg_list.append(item); - QTreeWidgetItem* childItem = new QTreeWidgetItem(treeItem); - childItem->setText(0, pkg_patch_[0]); - childItem->setText(1, pkg_patch_[1]); - childItem->setText(3, pkg_patch_[2]); - childItem->setTextAlignment(3, Qt::AlignCenter); - childItem->setText(4, pkg_patch_[3]); - childItem->setTextAlignment(4, Qt::AlignCenter); - childItem->setText(5, pkg_patch_[4]); - childItem->setTextAlignment(5, Qt::AlignCenter); - childItem->setText(6, pkg_patch_[5]); - childItem->setTextAlignment(6, Qt::AlignCenter); - childItem->setText(7, pkg_patch_[6]); - childItem->setTextAlignment(7, Qt::AlignCenter); - childItem->setText(8, pkg_patch_[7]); - childItem->setTextAlignment(8, Qt::AlignCenter); - childItem->setText(9, pkg_patch_[8]); - childItem->setText(10, pkg_patch_[9]); - } - } - } - - for (int column = 0; column < treeWidget->columnCount() - 2; ++column) { - // Resize the column to fit its contents - treeWidget->resizeColumnToContents(column); - } - // Update status bar. - statusBar->clearMessage(); - int numPkgs = m_pkg_list.size(); - QString statusMessage = QString::number(numPkgs) + " " + tr("Package"); - statusBar->showMessage(statusMessage); -} \ No newline at end of file diff --git a/src/qt_gui/pkg_viewer.h b/src/qt_gui/pkg_viewer.h deleted file mode 100644 index 265a03b92..000000000 --- a/src/qt_gui/pkg_viewer.h +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include -#include -#include - -#include "common/io_file.h" -#include "core/file_format/pkg.h" -#include "core/file_format/pkg_type.h" -#include "core/file_format/psf.h" -#include "game_info.h" -#include "game_list_utils.h" -#include "gui_context_menus.h" - -class PKGViewer : public QMainWindow { - Q_OBJECT -public: - explicit PKGViewer( - std::shared_ptr game_info_get, QWidget* parent, - std::function InstallDragDropPkg = nullptr); - ~PKGViewer(); - void OpenPKGFolder(); - void CheckPKGFolders(); - void ProcessPKGInfo(); - -private: - GuiContextMenus m_gui_context_menus; - PKG package; - PSF psf; - PKGHeader pkgheader; - PKGEntry entry; - PSFHeader header; - char pkgTitleID[9]; - std::vector pkg; - u64 pkgSize = 0; - std::unordered_map map_strings; - std::unordered_map map_integers; - - u32_be pkg_content_flag; - std::shared_ptr m_game_info; - GameListUtils game_list_util; - // Status bar - QStatusBar* statusBar; - - std::vector> appTypes = { - {0, "FULL APP"}, - {1, "UPGRADABLE"}, - {2, "DEMO"}, - {3, "FREEMIUM"}, - }; - - QStringList m_full_pkg_list; - QStringList m_pkg_app_list; - QStringList m_pkg_patch_list; - QStringList m_pkg_list; - QStringList dir_list; - std::vector dir_list_std; - QTreeWidget* treeWidget = nullptr; -}; \ No newline at end of file diff --git a/src/qt_gui/settings_dialog.cpp b/src/qt_gui/settings_dialog.cpp index 41caccec9..25c27fef3 100644 --- a/src/qt_gui/settings_dialog.cpp +++ b/src/qt_gui/settings_dialog.cpp @@ -246,12 +246,13 @@ SettingsDialog::SettingsDialog(std::span physical_devices, // PATH TAB { connect(ui->addFolderButton, &QPushButton::clicked, this, [this]() { - const auto config_dir = Config::getGameInstallDirs(); QString file_path_string = QFileDialog::getExistingDirectory(this, tr("Directory to install games")); auto file_path = Common::FS::PathFromQString(file_path_string); - if (!file_path.empty() && Config::addGameInstallDir(file_path)) { + if (!file_path.empty() && Config::addGameInstallDir(file_path, true)) { QListWidgetItem* item = new QListWidgetItem(file_path_string); + item->setFlags(item->flags() | Qt::ItemIsUserCheckable); + item->setCheckState(Qt::Checked); ui->gameFoldersListWidget->addItem(item); } }); @@ -317,7 +318,6 @@ SettingsDialog::SettingsDialog(std::span physical_devices, // General ui->consoleLanguageGroupBox->installEventFilter(this); ui->emulatorLanguageGroupBox->installEventFilter(this); - ui->separateUpdatesCheckBox->installEventFilter(this); ui->showSplashCheckBox->installEventFilter(this); ui->discordRPCCheckbox->installEventFilter(this); ui->userName->installEventFilter(this); @@ -449,8 +449,6 @@ void SettingsDialog::LoadValuesFromConfig() { QString translatedText_FullscreenMode = screenModeMap.key(QString::fromStdString(Config::getFullscreenMode())); ui->displayModeComboBox->setCurrentText(translatedText_FullscreenMode); - ui->separateUpdatesCheckBox->setChecked( - toml::find_or(data, "General", "separateUpdateEnabled", false)); ui->gameSizeCheckBox->setChecked(toml::find_or(data, "GUI", "loadGameSizeEnabled", true)); ui->showSplashCheckBox->setChecked(toml::find_or(data, "General", "showSplash", false)); QString translatedText_logType = logTypeMap.key(QString::fromStdString(Config::getLogType())); @@ -599,8 +597,6 @@ void SettingsDialog::updateNoteTextEdit(const QString& elementName) { text = tr("Console Language:\\nSets the language that the PS4 game uses.\\nIt's recommended to set this to a language the game supports, which will vary by region."); } else if (elementName == "emulatorLanguageGroupBox") { text = tr("Emulator Language:\\nSets the language of the emulator's user interface."); - } else if (elementName == "separateUpdatesCheckBox") { - text = tr("Enable Separate Update Folder:\\nEnables installing game updates into a separate folder for easy management.\\nThis can be manually created by adding the extracted update to the game folder with the name \"CUSA00000-UPDATE\" where the CUSA ID matches the game's ID."); } else if (elementName == "showSplashCheckBox") { text = tr("Show Splash Screen:\\nShows the game's splash screen (a special image) while the game is starting."); } else if (elementName == "discordRPCCheckbox") { @@ -759,7 +755,6 @@ void SettingsDialog::UpdateSettings() { Config::setVblankDiv(ui->vblankSpinBox->value()); Config::setDumpShaders(ui->dumpShadersCheckBox->isChecked()); Config::setNullGpu(ui->nullGpuCheckBox->isChecked()); - Config::setSeparateUpdateEnabled(ui->separateUpdatesCheckBox->isChecked()); Config::setLoadGameSizeEnabled(ui->gameSizeCheckBox->isChecked()); Config::setShowSplash(ui->showSplashCheckBox->isChecked()); Config::setDebugDump(ui->debugDump->isChecked()); @@ -783,6 +778,17 @@ void SettingsDialog::UpdateSettings() { emit BackgroundOpacityChanged(ui->backgroundImageOpacitySlider->value()); Config::setShowBackgroundImage(ui->showBackgroundImageCheckBox->isChecked()); + std::vector dirs_with_states; + for (int i = 0; i < ui->gameFoldersListWidget->count(); i++) { + QListWidgetItem* item = ui->gameFoldersListWidget->item(i); + QString path_string = item->text(); + auto path = Common::FS::PathFromQString(path_string); + bool enabled = (item->checkState() == Qt::Checked); + + dirs_with_states.push_back({path, enabled}); + } + Config::setAllGameInstallDirs(dirs_with_states); + #ifdef ENABLE_DISCORD_RPC auto* rpc = Common::Singleton::Instance(); if (Config::getEnableDiscordRPC()) { @@ -797,6 +803,7 @@ void SettingsDialog::UpdateSettings() { } void SettingsDialog::ResetInstallFolders() { + ui->gameFoldersListWidget->clear(); std::filesystem::path userdir = Common::FS::GetUserPath(Common::FS::PathType::UserDir); const toml::value data = toml::parse(userdir / "config.toml"); @@ -804,22 +811,37 @@ void SettingsDialog::ResetInstallFolders() { if (data.contains("GUI")) { const toml::value& gui = data.at("GUI"); const auto install_dir_array = - toml::find_or>(gui, "installDirs", {}); - std::vector settings_install_dirs_config = {}; + toml::find_or>(gui, "installDirs", {}); - for (const auto& dir : install_dir_array) { - if (std::find(settings_install_dirs_config.begin(), settings_install_dirs_config.end(), - dir) == settings_install_dirs_config.end()) { - settings_install_dirs_config.push_back(dir); - } + std::vector install_dirs_enabled; + try { + install_dirs_enabled = Config::getGameInstallDirsEnabled(); + } catch (...) { + // If it does not exist, assume that all are enabled. + install_dirs_enabled.resize(install_dir_array.size(), true); } - for (const auto& dir : settings_install_dirs_config) { + if (install_dirs_enabled.size() < install_dir_array.size()) { + install_dirs_enabled.resize(install_dir_array.size(), true); + } + + std::vector settings_install_dirs_config; + + for (size_t i = 0; i < install_dir_array.size(); i++) { + std::filesystem::path dir = install_dir_array[i]; + bool enabled = install_dirs_enabled[i]; + + settings_install_dirs_config.push_back({dir, enabled}); + QString path_string; Common::FS::PathToQString(path_string, dir); + QListWidgetItem* item = new QListWidgetItem(path_string); + item->setFlags(item->flags() | Qt::ItemIsUserCheckable); + item->setCheckState(enabled ? Qt::Checked : Qt::Unchecked); ui->gameFoldersListWidget->addItem(item); } - Config::setGameInstallDirs(settings_install_dirs_config); + + Config::setAllGameInstallDirs(settings_install_dirs_config); } } diff --git a/src/qt_gui/settings_dialog.ui b/src/qt_gui/settings_dialog.ui index 5600a0db7..20e26775d 100644 --- a/src/qt_gui/settings_dialog.ui +++ b/src/qt_gui/settings_dialog.ui @@ -135,13 +135,6 @@ 10 - - - - Enable Separate Update Folder - - - diff --git a/src/qt_gui/translations/ar_SA.ts b/src/qt_gui/translations/ar_SA.ts index 090cd4c26..c130a374c 100644 --- a/src/qt_gui/translations/ar_SA.ts +++ b/src/qt_gui/translations/ar_SA.ts @@ -22,7 +22,7 @@ CheatsPatches Cheats / Patches for - Cheats / Patches for + الغِشّ / التصحيحات Cheats/Patches are experimental.\nUse with caution.\n\nDownload cheats individually by selecting the repository and clicking the download button.\nIn the Patches tab, you can download all patches at once, choose which ones you want to use, and save your selection.\n\nSince we do not develop the Cheats/Patches,\nplease report issues to the cheat author.\n\nCreated a new cheat? Visit:\n @@ -407,194 +407,194 @@ ControlSettings Configure Controls - Configure Controls + تعديل عناصر التحكم D-Pad - D-Pad + الأسهم+عصا التحكم Up - Up + فوق Left - Left + يسار Right - Right + يمين Down - Down + تحت Left Stick Deadzone (def:2 max:127) - Left Stick Deadzone (def:2 max:127) + مدى تسجيل الإدخال للعصا اليسرى (التلقائي:2 حد أقصى:127) Left Deadzone - Left Deadzone + إعدادات مدى تسجيل الإدخال لعصا التحكم اليسرى Left Stick - Left Stick + عصا التحكم اليسرى Config Selection - Config Selection + تحديد الإعدادات Common Config - Common Config + إعدادات عامة Use per-game configs - Use per-game configs + استخدام إعدادات كل لُعْبَة L1 / LB - L1 / LB + L1 / LB L2 / LT - L2 / LT + L2 / LT Back - Back + رجوع R1 / RB - R1 / RB + R1 / RB R2 / RT - R2 / RT + R2 / RT L3 - L3 + L3 Options / Start - Options / Start + الخيارات / البَدْء R3 - R3 + R3 Face Buttons - Face Buttons + الأزرار Triangle / Y - Triangle / Y + مثلث / Y Square / X - Square / X + مربع / X Circle / B - Circle / B + دائرة / B Cross / A - Cross / A + إكس / A Right Stick Deadzone (def:2, max:127) - Right Stick Deadzone (def:2, max:127) + مدى تسجيل الإدخال للعصا اليمنى (التلقائي:2 حد أقصى:127) Right Deadzone - Right Deadzone + إعدادات مدى تسجيل الإدخال لعصا التحكم اليمنى Right Stick - Right Stick + عصا التحكم اليمنى Color Adjustment - Color Adjustment + تعديل الألوان R: - R: + أحمر: G: - G: + أخضر: B: - B: + أزرق: Override Lightbar Color - Override Lightbar Color + تجاوز لون شريط الإضاءة Override Color - Override Color + تجاوز اللون Unable to Save - Unable to Save + غير قادر على الحفظ Cannot bind axis values more than once - Cannot bind axis values more than once + لا يمكن ربط قيم المحور أكثر من مرة Save - Save + حفظ Apply - Apply + تطبيق Restore Defaults - Restore Defaults + استعادة الإعدادات الافتراضية Cancel - Cancel + إلغاء EditorDialog Edit Keyboard + Mouse and Controller input bindings - Edit Keyboard + Mouse and Controller input bindings + تحرير أزرار الإدخال للوحة المفاتيح و الفأرة ووحدة التحكم Use Per-Game configs - Use Per-Game configs + استخدام إعدادات كل لُعْبَة Error - Error + خطأ Could not open the file for reading - Could not open the file for reading + تعذر فتح المِلَفّ للقراءة Could not open the file for writing - Could not open the file for writing + تعذر فتح المِلَفّ للكتابة Save Changes - Save Changes + حفظ التغييرات Do you want to save changes? - Do you want to save changes? + هل تريد حفظ التغييرات؟ Help @@ -602,15 +602,15 @@ Do you want to reset your custom default config to the original default config? - Do you want to reset your custom default config to the original default config? + هل تريد إعادة تعيين الإعدادات الافتراضية المخصصة الخاصة بك إلى الإعدادات الافتراضية الأصلية؟ Do you want to reset this config to your custom default config? - Do you want to reset this config to your custom default config? + هل تريد إعادة تعيين هذا الإعداد إلى الإعداد الافتراضي المخصص لك؟ Reset to Default - Reset to Default + إعادة تعيين إلى الافتراضي @@ -702,43 +702,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 + يمكن الانتهاء من اللعبة مع الأداء القابل للتشغيل و لا توجد قلتشات كبيرة Click to see details on github @@ -753,23 +753,23 @@ GameListUtils B - B + بايت KB - KB + كيلو بايت MB - MB + ميغابايت GB - GB + جيجابايت TB - TB + تيرابايت @@ -820,11 +820,11 @@ Copy Version - Copy Version + إصدار النسخة Copy Size - Copy Size + حجم النسخة Copy All @@ -832,39 +832,39 @@ Delete... - Delete... + حذف... Delete Game - Delete Game + حذف اللعبة Delete Update - Delete Update + حذف التحديث Delete DLC - Delete DLC + حذف DLC Delete Trophy - Delete Trophy + حذف الكؤوس Compatibility... - Compatibility... + التوافق... Update database - Update database + تحديث قاعدة البيانات View report - View report + عرض التقرير Submit a report - Submit a report + إرسال بلاغ Shortcut creation @@ -882,330 +882,307 @@ Error creating shortcut! خطأ في إنشاء الاختصار - - Install PKG - PKG تثبيت - Game - Game + اللعبة 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 - DLC + DLC 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's %2؟ Open Update Folder - Open Update Folder + فتح مجلد التحديث Delete Save Data - Delete Save Data + حذف التخزينه This game has no update folder to open! - This game has no update folder to open! + لا تحتوي اللعبة على تحديث لفتحه! No log file found for this game! - No log file found for this game! + لم يتم العثور على ملف سجل لهذه اللعبة! Failed to convert icon. - Failed to convert icon. + فشل تحويل الأيقونة. This game has no save data to delete! - This game has no save data to delete! + هذه اللعبة لا تحتوي على أي تخزينات لحذفها! This game has no saved trophies to delete! - This game has no saved trophies to delete! + هذه اللعبة ليس لديها كؤوس محفوظة للحذف! Save Data - Save Data + حفظ البيانات Trophy - Trophy + الكؤوس SFO Viewer for - SFO Viewer for + عارض SFO لـ HelpDialog Quickstart - Quickstart + التشغيل السريع FAQ - FAQ + الأسئلة الأكثر شيوعاً Syntax - Syntax + الصّيغة Special Bindings - Special Bindings + إدخالات خاصة Keybindings - Keybindings - - - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - اختر المجلد - - - Select which directory you want to install to. - Select which directory you want to install to. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install + أزرار التحكم KBMSettings Configure Controls - Configure Controls + تعديل عناصر التحكم D-Pad - D-Pad + الأسهم+عصا التحكم Up - Up + أعلى unmapped - unmapped + غير معين Left - Left + يسار Right - Right + يمين Down - Down + أسفل Left Analog Halfmode - Left Analog Halfmode + تقليل سرعة عصا التحكم اليسرى للنصف hold to move left stick at half-speed - hold to move left stick at half-speed + الاستمرار للتحرك إلى اليسار بنصف السرعة Left Stick - Left Stick + عصا التحكم اليسرى Config Selection - Config Selection + تحديد الإعدادات Common Config - Common Config + إعدادات عامة Use per-game configs - Use per-game configs + استخدام إعدادات كل لُعْبَة L1 - L1 + L1 L2 - L2 + L2 Text Editor - Text Editor + محرر النص Help - Help + المساعدة R1 - R1 + R1 R2 - R2 + R2 L3 - L3 + L3 Touchpad Click - Touchpad Click + النقر على لوحة اللمس Mouse to Joystick - Mouse to Joystick + الفأرة إلى عصا التحكم *press F7 ingame to activate - *press F7 ingame to activate + * اضغط على F7 للتفعيل R3 - R3 + R3 Options - Options + الخيارات Mouse Movement Parameters - Mouse Movement Parameters + معطيات حركة الفأرة note: click Help Button/Special Keybindings for more information - note: click Help Button/Special Keybindings for more information + ملاحظة: انقر فوق زر المساعدة/روابط المفاتيح الخاصة للحصول على مزيد من المعلومات Face Buttons - Face Buttons + أزرار الوجه Triangle - Triangle + مثلث Square - Square + مربع Circle - Circle + دائرة Cross - Cross + اكس Right Analog Halfmode - Right Analog Halfmode + تقليل سرعة عصا التحكم اليمنى للنصف hold to move right stick at half-speed - hold to move right stick at half-speed + الضغط باستمرار لتحريك العصا اليمنى بنصف السرعة Right Stick - Right Stick + عصا التحكم اليمنى Speed Offset (def 0.125): - Speed Offset (def 0.125): + إزاحة السرعة (تلقائي 0.125): Copy from Common Config - Copy from Common Config + نسخ من الإعدادات الشائعة Deadzone Offset (def 0.50): - Deadzone Offset (def 0.50): + : Speed Multiplier (def 1.0): - Speed Multiplier (def 1.0): + معدل مضاعفة السرعة (التلقائي 1.0): Common Config Selected - Common Config Selected + الإعدادات الشائعة محدده This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config. - This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config. + هذا الزر يقوم بنسخ تعيينات الأزرار من إعدادات المستخدم العامة لإعدادات المستخدم المحددة حالياً، ولا يمكن استعماله عندما تكون الإعدادات المستخدمة هي الإعدادات العامة. Copy values from Common Config - Copy values from Common Config + نسخ من الإعدادات الشائعة Do you want to overwrite existing mappings with the mappings from the Common Config? - Do you want to overwrite existing mappings with the mappings from the Common Config? + هل تريد استبدال التعيينات الحالية بالتعيينات العامة؟ Unable to Save - Unable to Save + غير قادر على الحفظ Cannot bind any unique input more than once - Cannot bind any unique input more than once + لا يمكن ربط أي إدخال فريد أكثر من مرة Press a key - Press a key + اضغط على مفتاح Cannot set mapping - Cannot set mapping + لا يمكن تعيين الأزرار Mousewheel cannot be mapped to stick outputs - Mousewheel cannot be mapped to stick outputs + عجلة الفأرة لا يمكن تعيينها لعصا التحكم Save - Save + حفظ Apply - Apply + تطبيق Restore Defaults - Restore Defaults + استعادة الإعدادات الافتراضية Cancel - Cancel + إلغاء @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Elf فتح/إضافة مجلد - - Install Packages (PKG) - (PKG) تثبيت الحزم - Boot Game تشغيل اللعبة @@ -1234,17 +1207,13 @@ Configure... ...تكوين - - Install application from a .pkg file - .pkg تثبيت التطبيق من ملف - Recent Games الألعاب الأخيرة Open shadPS4 Folder - Open shadPS4 Folder + فتح مجلد shadPS4 Exit @@ -1307,8 +1276,12 @@ تفريغ قائمة الألعاب - PKG Viewer - عارض PKG + Trophy Viewer + عارض الجوائز + + + No games found. Please add your games to your library first. + لم يتم العثور على ألعاب. الرجاء إضافة ألعابك إلى مكتبتك أولاً. Search... @@ -1418,160 +1391,61 @@ Only one file can be selected! !يمكن تحديد ملف واحد فقط - - PKG Extraction - PKG استخراج - - - Patch detected! - تم اكتشاف تصحيح! - - - PKG and Game versions match: - :واللعبة تتطابق إصدارات PKG - - - Would you like to overwrite? - هل ترغب في الكتابة فوق الملف الموجود؟ - - - PKG Version %1 is older than installed version: - :أقدم من الإصدار المثبت PKG Version %1 - - - Game is installed: - :اللعبة مثبتة - - - Would you like to install Patch: - :هل ترغب في تثبيت التصحيح - - - DLC Installation - تثبيت المحتوى القابل للتنزيل - - - Would you like to install DLC: %1? - هل ترغب في تثبيت المحتوى القابل للتنزيل: 1%؟ - - - DLC already installed: - :المحتوى القابل للتنزيل مثبت بالفعل - - - Game already installed - اللعبة مثبتة بالفعل - - - PKG ERROR - PKG خطأ في - - - Extracting PKG %1/%2 - PKG %1/%2 جاري استخراج - - - Extraction Finished - اكتمل الاستخراج - - - Game successfully installed at %1 - تم تثبيت اللعبة بنجاح في %1 - - - File doesn't appear to be a valid PKG file - يبدو أن الملف ليس ملف PKG صالحًا - Run Game - Run Game + تشغيل اللعبة Eboot.bin file not found - Eboot.bin file not found - - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! + لم يتم العثور على ملف Eboot.bin Game is already running! - Game is already running! + اللعبة قيد التشغيل بالفعل! shadPS4 - shadPS4 - - - - PKGViewer - - Open Folder - فتح المجلد + shadPS4 - PKG ERROR - PKG خطأ في + Play + أبدأ اللعب - Name - اسم + Pause + توقف مؤقت - Serial - سيريال + Stop + إيقاف - Installed - Installed + Restart + إعادة تشغيل - Size - حجم + Full Screen + وضع ملء الشاشة - Category - Category + Controllers + أذرعة التحكم - Type - Type + Keyboard + لوحة المفاتيح - App Ver - App Ver + Refresh List + تحديث القائمة - FW - FW + Resume + استئناف - Region - منطقة - - - Flags - Flags - - - Path - مسار - - - File - ملف - - - Unknown - غير معروف - - - Package - Package + Show Labels Under Icons + إظهار العلامات أسفل الأيقونات @@ -1600,10 +1474,6 @@ Emulator المحاكي - - Enable Separate Update Folder - Enable Separate Update Folder - Default tab when opening settings علامة التبويب الافتراضية عند فتح الإعدادات @@ -1626,15 +1496,15 @@ Trophy Key - Trophy Key + زر الميداليات Trophy - Trophy + الكؤوس Open the custom trophy images/sounds folder - Open the custom trophy images/sounds folder + افتح مجلد تخصيص اصوات/صور الميداليات Logger @@ -1670,7 +1540,7 @@ s - s + س Controller @@ -1714,7 +1584,7 @@ Enable HDR - Enable HDR + تشغيل HDR Paths @@ -1754,23 +1624,23 @@ Enable Crash Diagnostics - Enable Crash Diagnostics + تشغيل تشخيص الأعطال Collect Shaders - Collect Shaders + اجمع برامج التظليل Copy GPU Buffers - Copy GPU Buffers + انسخ التخزين المؤقت لوحدة معالجة الرُسوم Host Debug Markers - Host Debug Markers + استضافة علامات التصحيح Guest Debug Markers - Guest Debug Markers + ضيف علامات التصحيح Update @@ -1782,7 +1652,7 @@ Always Show Changelog - Always Show Changelog + اظهر سجل التغيرات دائماً Update Channel @@ -1798,23 +1668,23 @@ Title Music - Title Music + موسيقى الشاشة الرئيسية Disable Trophy Notification - Disable Trophy Notification + إغلاق إشعارات الميداليات Background Image - Background Image + صورة الخلفية Show Background Image - Show Background Image + إظهار صورة الخلفية Opacity - Opacity + درجة السواد Play title music @@ -1822,15 +1692,15 @@ Update Compatibility Database On Startup - Update Compatibility Database On Startup + تحديث قاعدة بيانات التوافق عند التشغيل Game Compatibility - Game Compatibility + توافق الألعاب Display Compatibility Data - Display Compatibility Data + إظهار معلومات التوافق Update Compatibility Database @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. لغة المحاكي:\nتحدد لغة واجهة المستخدم الخاصة بالمحاكي. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. إظهار شاشة البداية:\nيعرض شاشة البداية الخاصة باللعبة (صورة خاصة) أثناء بدء التشغيل. @@ -1886,7 +1752,7 @@ Trophy Key:\nKey used to decrypt trophies. Must be obtained from your jailbroken console.\nMust contain only hex characters. - Trophy Key:\nKey used to decrypt trophies. Must be obtained from your jailbroken console.\nMust contain only hex characters. + مفتاح الميداليات:\nمفتاح يستخدم لفتح تشفير الميداليات. يجب أن يكون من جهاز مكسور الحماية.\nيجي أن يحتوي على أحرف نظام العد السداسي. Log Type:\nSets whether to synchronize the output of the log window for performance. May have adverse effects on emulation. @@ -1902,7 +1768,7 @@ Background Image:\nControl the opacity of the game background image. - Background Image:\nControl the opacity of the game background image. + صورة الخلفية:\nيتحكم في درجة سواد صورة خلفية اللعبة. Play Title Music:\nIf a game supports it, enable playing special music when selecting the game in the GUI. @@ -1910,7 +1776,7 @@ 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). - 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 إغلاق إشعارات الميداليات داخل اللعبة. تقدم الميداليات يمكن تتبعه باستخدام عارض الميداليات (قم بالضغط على زر الفأرة الأيمن داخل النافذة الرئيسية). Hide Cursor:\nChoose when the cursor will disappear:\nNever: You will always see the mouse.\nidle: Set a time for it to disappear after being idle.\nAlways: you will never see the mouse. @@ -2094,23 +1960,23 @@ Display Mode - Display Mode + طريقة العرض Windowed - Windowed + نافذة Fullscreen - Fullscreen + شاشة كاملة Fullscreen (Borderless) - Fullscreen (Borderless) + شاشة كاملة (دون حدود) Window Size - Window Size + حجم النافذة W: @@ -2122,7 +1988,7 @@ Separate Log Files - Separate Log Files + ملفات السجل المنفصل Separate Log Files:\nWrites a separate logfile for each game. @@ -2130,35 +1996,35 @@ Trophy Notification Position - Trophy Notification Position + موقع إشعار الكأس Left - Left + يسار Right - Right + يمين Top - Top + في الأعلى Bottom - Bottom + الأسفل Notification Duration - Notification Duration + مدة الإشعار Portable User Folder - Portable User Folder + مجلد المستخدم المتنقل Create Portable User Folder from Common User Folder - Create Portable User Folder from Common User Folder + إنشاء مجلد مستخدم المتنقل من مجلد المستخدم الشائع Portable user folder:\nStores shadPS4 settings and data that will be applied only to the shadPS4 build located in the current folder. Restart the app after creating the portable user folder to begin using it. @@ -2166,11 +2032,11 @@ Cannot create portable user folder - Cannot create portable user folder + لا يمكن إنشاء مجلد المستخدم المتنقل %1 already exists - %1 already exists + %1 موجود مسبقاً Portable user folder created @@ -2178,7 +2044,7 @@ %1 successfully created. - %1 successfully created. + تم إنشاء %1 بنجاح. Open the custom trophy images/sounds folder:\nYou can add custom images to the trophies and an audio.\nAdd the files to custom_trophy with the following names:\ntrophy.wav OR trophy.mp3, bronze.png, gold.png, platinum.png, silver.png\nNote: The sound will only work in QT versions. @@ -2191,21 +2057,25 @@ Trophy Viewer عارض الجوائز + + Select Game: + اختر الُعْبَه: + Progress - Progress + مقدار التقدُّم Show Earned Trophies - Show Earned Trophies + عرض الكؤوس المكتسبة Show Not Earned Trophies - Show Not Earned Trophies + عرض الكؤوس غير المكتسبة Show Hidden Trophies - Show Hidden Trophies + عرض الكؤوس المخفية diff --git a/src/qt_gui/translations/da_DK.ts b/src/qt_gui/translations/da_DK.ts index 113d13019..131a989e1 100644 --- a/src/qt_gui/translations/da_DK.ts +++ b/src/qt_gui/translations/da_DK.ts @@ -882,10 +882,6 @@ Error creating shortcut! Error creating shortcut! - - Install PKG - Install PKG - Game Game @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Choose directory - - - Select which directory you want to install to. - Select which directory you want to install to. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Open/Add Elf Folder - - Install Packages (PKG) - Install Packages (PKG) - Boot Game Boot Game @@ -1234,10 +1207,6 @@ Configure... Configure... - - Install application from a .pkg file - Install application from a .pkg file - Recent Games Recent Games @@ -1307,8 +1276,12 @@ Dump Game List - PKG Viewer - PKG Viewer + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Kun én fil kan vælges! - - PKG Extraction - PKG-udtrækning - - - Patch detected! - Opdatering detekteret! - - - PKG and Game versions match: - PKG og spilversioner matcher: - - - Would you like to overwrite? - Vil du overskrive? - - - PKG Version %1 is older than installed version: - PKG Version %1 er ældre end den installerede version: - - - Game is installed: - Spillet er installeret: - - - Would you like to install Patch: - Vil du installere opdateringen: - - - DLC Installation - DLC Installation - - - Would you like to install DLC: %1? - Vil du installere DLC: %1? - - - DLC already installed: - DLC allerede installeret: - - - Game already installed - Spillet er allerede installeret - - - PKG ERROR - PKG FEJL - - - Extracting PKG %1/%2 - Udvinding af PKG %1/%2 - - - Extraction Finished - Udvinding afsluttet - - - Game successfully installed at %1 - Spillet blev installeret succesfuldt på %1 - - - File doesn't appear to be a valid PKG file - Filen ser ikke ud til at være en gyldig PKG-fil - Run Game Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin file not found - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! Game is already running! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Open Folder + Play + Play - PKG ERROR - PKG FEJL + Pause + Pause - Name - Navn + Stop + Stop - Serial - Seriel + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - Størrelse + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - Region - - - Flags - Flags - - - Path - Sti - - - File - File - - - Unknown - Ukendt - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulator - - Enable Separate Update Folder - Enable Separate Update Folder - Default tab when opening settings Standardfaneblad ved åbning af indstillinger @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Emulatorsprog:\nIndstiller sproget i emulatorens brugergrænseflade. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Vis startskærm:\nViser en startskærm (speciel grafik) under opstarten. @@ -2191,6 +2057,10 @@ Trophy Viewer Trophy Viewer + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/de_DE.ts b/src/qt_gui/translations/de_DE.ts index d366d1116..9642cd500 100644 --- a/src/qt_gui/translations/de_DE.ts +++ b/src/qt_gui/translations/de_DE.ts @@ -38,7 +38,7 @@ Version: - Version: + Version: Size: @@ -50,7 +50,7 @@ Repository: - Repository: + Quellen: Download Cheats @@ -86,11 +86,11 @@ Cheats - Cheats + Cheats Patches - Patches + Patches Error @@ -407,59 +407,59 @@ ControlSettings Configure Controls - Configure Controls + Steuerung einrichten D-Pad - D-Pad + Steuerkreuz Up - Up + Oben Left - Left + Links Right - Right + Rechts Down - Down + Runter Left Stick Deadzone (def:2 max:127) - Left Stick Deadzone (def:2 max:127) + Linker Stick tote Zone (def:2 max:127) Left Deadzone - Left Deadzone + Linke Deadzone Left Stick - Left Stick + Linker Analogstick Config Selection - Config Selection + Konfigurationsauswahl Common Config - Common Config + Standard Konfiguration Use per-game configs - Use per-game configs + Benutze Per-Game Einstellungen L1 / LB - L1 / LB + L1 / LB L2 / LT - L2 / LT + L2 / LT Back @@ -467,59 +467,59 @@ R1 / RB - R1 / RB + R1 / RB R2 / RT - R2 / RT + R2 / RT L3 - L3 + L3 Options / Start - Options / Start + Options / Start R3 - R3 + R3 Face Buttons - Face Buttons + Aktionstasten Triangle / Y - Triangle / Y + Dreieck / Y Square / X - Square / X + Quadrat / X Circle / B - Circle / B + Kreis / B Cross / A - Cross / A + Kreuz / A Right Stick Deadzone (def:2, max:127) - Right Stick Deadzone (def:2, max:127) + Rechter Stick tote Zone (def:2, max:127) Right Deadzone - Right Deadzone + Rechte tote Zone Right Stick - Right Stick + Rechter Analogstick Color Adjustment - Color Adjustment + Farbanpassung R: @@ -535,46 +535,46 @@ Override Lightbar Color - Override Lightbar Color + Farbe der Leuchtleiste überschreiben Override Color - Override Color + Farbe überschreiben Unable to Save - Unable to Save + Speichern nicht möglich Cannot bind axis values more than once - Cannot bind axis values more than once + Achsenwerte können nicht mehr als einmal gebunden werden Save - Save + Speichern Apply - Apply + Übernehmen Restore Defaults - Restore Defaults + Werkseinstellungen wiederherstellen Cancel - Cancel + Abbrechen EditorDialog Edit Keyboard + Mouse and Controller input bindings - Edit Keyboard + Mouse and Controller input bindings + Tastatur + Maus und Controller Eingabezuordnungen bearbeiten Use Per-Game configs - Use Per-Game configs + Benutze Per-Game Einstellungen Error @@ -582,19 +582,19 @@ Could not open the file for reading - Could not open the file for reading + Datei konnte nicht zum Lesen geöffnet werden Could not open the file for writing - Could not open the file for writing + Datei konnte nicht zum Schreiben geöffnet werden Save Changes - Save Changes + Änderungen Speichern Do you want to save changes? - Do you want to save changes? + Sollen die Änderungen gespeichert werden? Help @@ -602,15 +602,15 @@ Do you want to reset your custom default config to the original default config? - Do you want to reset your custom default config to the original default config? + Möchten Sie Ihre eigene Standardkonfiguration auf die ursprüngliche Standardkonfiguration zurücksetzen? Do you want to reset this config to your custom default config? - Do you want to reset this config to your custom default config? + Möchten Sie diese Konfiguration auf Ihre eigene Standardkonfiguration zurücksetzen? Reset to Default - Reset to Default + Auf Standard zurücksetzen @@ -655,7 +655,7 @@ Directory to install DLC - Directory to install DLC + Verzeichnis zum Installieren von DLC @@ -666,7 +666,7 @@ Name - Name + Name Serial @@ -678,11 +678,11 @@ Region - Region + Region Firmware - Firmware + Firmware Size @@ -690,7 +690,7 @@ Version - Version + Version Path @@ -706,15 +706,15 @@ h - h + h m - m + m s - s + s Compatibility is untested @@ -753,23 +753,23 @@ GameListUtils B - B + B KB - KB + KB MB - MB + MB GB - GB + GB TB - TB + TB @@ -780,7 +780,7 @@ Cheats / Patches - Cheats / Patches + Cheats / Patches SFO Viewer @@ -848,7 +848,7 @@ Delete Trophy - Delete Trophy + Trophäe löschen Compatibility... @@ -882,10 +882,6 @@ Error creating shortcut! Fehler beim Erstellen der Verknüpfung! - - Install PKG - PKG installieren - Game Spiel @@ -904,7 +900,7 @@ DLC - DLC + DLC Delete %1 @@ -924,27 +920,27 @@ This game has no update folder to open! - This game has no update folder to open! + Dieses Spiel hat keinen Update-Ordner zum öffnen! No log file found for this game! - No log file found for this game! + Keine Protokolldatei für dieses Spiel gefunden! Failed to convert icon. - Failed to convert icon. + Fehler beim Konvertieren des Symbols. This game has no save data to delete! - This game has no save data to delete! + Dieses Spiel hat keine Speicherdaten zum Löschen! This game has no saved trophies to delete! - This game has no saved trophies to delete! + Dieses Spiel hat keine gespeicherten Trophäen zum Löschen! Save Data - Save Data + Gespeicherte Daten Trophy @@ -952,7 +948,7 @@ SFO Viewer for - SFO Viewer for + SFO-Betrachter für @@ -963,105 +959,86 @@ FAQ - FAQ + Häufig gestellte Fragen Syntax - Syntax + Syntax Special Bindings - Special Bindings + Spezielle Zuordnungen Keybindings - Keybindings - - - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Wähle Ordner - - - Select which directory you want to install to. - Wählen Sie das Verzeichnis aus, in das Sie installieren möchten. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install + Tastenbelegung KBMSettings Configure Controls - Configure Controls + Steuerung konfigurieren D-Pad - D-Pad + Steuerkreuz Up - Up + Oben unmapped - unmapped + nicht zugeordnet Left - Left + Links Right - Right + Rechts Down - Down + Runter Left Analog Halfmode - Left Analog Halfmode + Linker Analog-Halbmodus hold to move left stick at half-speed - hold to move left stick at half-speed + Halten um den linken Analogstick mit Halbgeschwindigkeit zu bewegen Left Stick - Left Stick + Linker Analogstick Config Selection - Config Selection + Konfigurationsauswahl Common Config - Common Config + Allgemeine Konfiguration Use per-game configs - Use per-game configs + Benutze Per-Game Einstellungen L1 - L1 + L1 L2 - L2 + L2 Text Editor - Text Editor + Textbearbeiter Help @@ -1069,143 +1046,143 @@ R1 - R1 + R1 R2 - R2 + R2 L3 - L3 + L3 Touchpad Click - Touchpad Click + Touchpad-Klick Mouse to Joystick - Mouse to Joystick + Maus zu Joystick *press F7 ingame to activate - *press F7 ingame to activate + *Zum Aktivieren F7 ingame drücken R3 - R3 + R3 Options - Options + Options Mouse Movement Parameters - Mouse Movement Parameters + Mausbewegungsparameter note: click Help Button/Special Keybindings for more information - note: click Help Button/Special Keybindings for more information + Hinweis: Klicken Sie auf Hilfe-Button/Special Tastaturbelegungen für weitere Informationen Face Buttons - Face Buttons + Aktionstasten Triangle - Triangle + Dreieck Square - Square + Quadrat Circle - Circle + Kreis Cross - Cross + Kreuz Right Analog Halfmode - Right Analog Halfmode + Rechter Analog-Halbmodus hold to move right stick at half-speed - hold to move right stick at half-speed + Halten um den rechten Analogstick mit Halbgeschwindigkeit zu bewegen Right Stick - Right Stick + Rechter Analogstick Speed Offset (def 0.125): - Speed Offset (def 0.125): + Geschwindigkeitsversatz (Def 0.125): Copy from Common Config - Copy from Common Config + Von allgemeiner Konfiguration kopieren Deadzone Offset (def 0.50): - Deadzone Offset (def 0.50): + Tote Zone Versatz (Def 0.50): Speed Multiplier (def 1.0): - Speed Multiplier (def 1.0): + Geschwindigkeit Multiplikator (def 1.0): Common Config Selected - Common Config Selected + Allgemeine Konfiguration ausgewählt This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config. - This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config. + Diese Schaltfläche kopiert Zuordnungen aus der allgemeinen Konfiguration in das aktuell ausgewählte Profil, und kann nicht verwendet werden, wenn das aktuell ausgewählte Profil die allgemeine Konfiguration ist. Copy values from Common Config - Copy values from Common Config + Werte von allgemeiner Konfiguration kopieren Do you want to overwrite existing mappings with the mappings from the Common Config? - Do you want to overwrite existing mappings with the mappings from the Common Config? + Möchten Sie die vorhandenen Zuordnungen mit den Zuordnungen der allgemeinen Konfigurationen überschreiben? Unable to Save - Unable to Save + Speichern nicht möglich Cannot bind any unique input more than once - Cannot bind any unique input more than once + Kann keine eindeutige Eingabe mehr als einmal zuordnen Press a key - Press a key + Drücken Sie eine Taste Cannot set mapping - Cannot set mapping + Kann Zuordnung nicht festlegen Mousewheel cannot be mapped to stick outputs - Mousewheel cannot be mapped to stick outputs + Mausrad kann nicht zu Analogstick Ausgabe zugeordnet werden Save - Save + Speichern Apply - Apply + Übernehmen Restore Defaults - Restore Defaults + Werkseinstellungen wiederherstellen Cancel - Cancel + Abbrechen @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Elf-Ordner öffnen/hinzufügen - - Install Packages (PKG) - Pakete installieren (PKG) - Boot Game Spiel starten @@ -1234,10 +1207,6 @@ Configure... Konfigurieren... - - Install application from a .pkg file - Installiere Anwendung aus .pkg-Datei - Recent Games Zuletzt gespielt @@ -1307,8 +1276,12 @@ Spielliste ausgeben - PKG Viewer - PKG-Anschauer + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,160 +1391,61 @@ Only one file can be selected! Es kann nur eine Datei ausgewählt werden! - - PKG Extraction - PKG-Extraktion - - - Patch detected! - Patch erkannt! - - - PKG and Game versions match: - PKG- und Spielversionen stimmen überein: - - - Would you like to overwrite? - Willst du überschreiben? - - - PKG Version %1 is older than installed version: - PKG-Version %1 ist älter als die installierte Version: - - - Game is installed: - Spiel ist installiert: - - - Would you like to install Patch: - Willst du den Patch installieren: - - - DLC Installation - DLC-Installation - - - Would you like to install DLC: %1? - Willst du das DLC installieren: %1? - - - DLC already installed: - DLC bereits installiert: - - - Game already installed - Spiel bereits installiert - - - PKG ERROR - PKG-FEHLER - - - Extracting PKG %1/%2 - Extrahiere PKG %1/%2 - - - Extraction Finished - Extraktion abgeschlossen - - - Game successfully installed at %1 - Spiel erfolgreich installiert auf %1 - - - File doesn't appear to be a valid PKG file - Die Datei scheint keine gültige PKG-Datei zu sein - Run Game - Run Game + Spiel ausführen Eboot.bin file not found - Eboot.bin file not found - - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! + Eboot.bin Datei nicht gefunden Game is already running! - Game is already running! + Spiel läuft bereits! shadPS4 - shadPS4 - - - - PKGViewer - - Open Folder - Ordner öffnen + shadPS4 - PKG ERROR - PKG-FEHLER + Play + Play - Name - Name + Pause + Pause - Serial - Seriennummer + Stop + Stop - Installed - Installed + Restart + Restart - Size - Größe + Full Screen + Full Screen - Category - Kategorie + Controllers + Controllers - Type - Typ + Keyboard + Keyboard - App Ver - App Ver + Refresh List + Refresh List - FW - FW + Resume + Resume - Region - Region - - - Flags - Flags - - - Path - Pfad - - - File - Datei - - - Unknown - Unbekannt - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1598,11 +1472,7 @@ Emulator - Emulator - - - Enable Separate Update Folder - Separaten Update-Ordner aktivieren + Emulator Default tab when opening settings @@ -1634,11 +1504,11 @@ Open the custom trophy images/sounds folder - Open the custom trophy images/sounds folder + Öffne den benutzerdefinierten Ordner für Trophäenbilder/Sounds Logger - Logger + Protokollführer Log Type @@ -1658,7 +1528,7 @@ Cursor - Cursor + Mauszeiger Hide Cursor @@ -1670,11 +1540,11 @@ s - s + s Controller - Controller + Kontroller Back Button Behavior @@ -1714,7 +1584,7 @@ Enable HDR - Enable HDR + HDR aktivieren Paths @@ -1734,7 +1604,7 @@ Debug - Debug + Debug Enable Debug Dumping @@ -1802,19 +1672,19 @@ Disable Trophy Notification - Disable Trophy Notification + Trophäen-Benachrichtigung deaktivieren Background Image - Background Image + Hintergrundbild Show Background Image - Show Background Image + Hintergrundbild anzeigen Opacity - Opacity + Transparenz Play title music @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Emulatorsprache:\nLegt die Sprache der Emulator-Benutzeroberfläche fest. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Separaten Update-Ordner aktivieren:\nErmöglicht die Installation von Spielaktualiserungen in einem separaten Ordner zur einfachen Verwaltung. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Startbildschirm anzeigen:\nZeigt beim Start einen speziellen Bildschirm (Splash) des Spiels an. @@ -1902,7 +1768,7 @@ Background Image:\nControl the opacity of the game background image. - Background Image:\nControl the opacity of the game background image. + Hintergrundbild:\nSteuere die Deckkraft des Spiel-Hintergrundbilds. Play Title Music:\nIf a game supports it, enable playing special music when selecting the game in the GUI. @@ -1986,7 +1852,7 @@ Enable HDR:\nEnables HDR in games that support it.\nYour monitor must have support for the BT2020 PQ color space and the RGB10A2 swapchain format. - Enable HDR:\nEnables HDR in games that support it.\nYour monitor must have support for the BT2020 PQ color space and the RGB10A2 swapchain format. + HDR:\nAktiviert HDR in Spielen, die es unterstützen.\nIhr Monitor muss Unterstützung für den BT2020 PQ Farbraum und das RGB10A2 Swapchain Format haben. Game Folders:\nThe list of folders to check for installed games. @@ -2038,23 +1904,23 @@ Save Data Path:\nThe folder where game save data will be saved. - Save Data Path:\nThe folder where game save data will be saved. + Datenpfad speichern:\nDer Ordner, in dem Spieldaten gespeichert werden. Browse:\nBrowse for a folder to set as the save data path. - Browse:\nBrowse for a folder to set as the save data path. + Durchsuchen:\nDurchsuchen eines Ordners, um den Speicherdatenpfad festzulegen. Release - Release + Veröffentlichung Nightly - Nightly + Nightly Set the volume of the background music. - Set the volume of the background music. + Legen Sie die Lautstärke der Hintergrundmusik fest. Enable Motion Controls @@ -2070,11 +1936,11 @@ async - async + asynchron sync - sync + syncron Auto Select @@ -2086,7 +1952,7 @@ Directory to save data - Directory to save data + Verzeichnis um Daten zu speichern Video @@ -2094,43 +1960,43 @@ Display Mode - Display Mode + Anzeigemodus Windowed - Windowed + Fenster Fullscreen - Fullscreen + Vollbild Fullscreen (Borderless) - Fullscreen (Borderless) + Vollbild (randlos) Window Size - Window Size + Fenstergröße W: - W: + W: H: - H: + H: Separate Log Files - Separate Log Files + Separate Protokolldateien Separate Log Files:\nWrites a separate logfile for each game. - Separate Log Files:\nWrites a separate logfile for each game. + Separate Protokolldateien:\nSchreibt für jedes Spiel eine separate Logdatei. Trophy Notification Position - Trophy Notification Position + Trophäen-Benachrichtigungsposition Left @@ -2142,43 +2008,43 @@ Top - Top + Zuoberst Bottom - Bottom + Zuunterst Notification Duration - Notification Duration + Benachrichtigungsdauer Portable User Folder - Portable User Folder + Portable Benutzerordner Create Portable User Folder from Common User Folder - Create Portable User Folder from Common User Folder + Erstellen eines portablen Benutzerordners aus dem allgemeinen Benutzer Ordner Portable user folder:\nStores shadPS4 settings and data that will be applied only to the shadPS4 build located in the current folder. Restart the app after creating the portable user folder to begin using it. - Portable user folder:\nStores shadPS4 settings and data that will be applied only to the shadPS4 build located in the current folder. Restart the app after creating the portable user folder to begin using it. + Portablen Benutzerordner:\nspeichert ShadPS4 Einstellungen und Daten, die nur auf den ShadPS4 Build im aktuellen Ordner angewendet werden. Starten Sie die App nach dem Erstellen des tragbaren Benutzerordners neu, um sie zu verwenden. Cannot create portable user folder - Cannot create portable user folder + Kann keinen portablen Benutzerordner erstellen %1 already exists - %1 already exists + %1 existiert bereits Portable user folder created - Portable user folder created + Portablen Benutzerordner erstellt %1 successfully created. - %1 successfully created. + %1 erfolgreich erstellt. Open the custom trophy images/sounds folder:\nYou can add custom images to the trophies and an audio.\nAdd the files to custom_trophy with the following names:\ntrophy.wav OR trophy.mp3, bronze.png, gold.png, platinum.png, silver.png\nNote: The sound will only work in QT versions. @@ -2191,6 +2057,10 @@ Trophy Viewer Trophäenansicht + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/el_GR.ts b/src/qt_gui/translations/el_GR.ts index a61d84022..c91e0c731 100644 --- a/src/qt_gui/translations/el_GR.ts +++ b/src/qt_gui/translations/el_GR.ts @@ -882,10 +882,6 @@ Error creating shortcut! Error creating shortcut! - - Install PKG - Install PKG - Game Game @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Choose directory - - - Select which directory you want to install to. - Select which directory you want to install to. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Open/Add Elf Folder - - Install Packages (PKG) - Install Packages (PKG) - Boot Game Boot Game @@ -1234,10 +1207,6 @@ Configure... Configure... - - Install application from a .pkg file - Install application from a .pkg file - Recent Games Recent Games @@ -1307,8 +1276,12 @@ Dump Game List - PKG Viewer - PKG Viewer + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Μπορεί να επιλεγεί μόνο ένα αρχείο! - - PKG Extraction - Εξαγωγή PKG - - - Patch detected! - Αναγνώριση ενημέρωσης! - - - PKG and Game versions match: - Οι εκδόσεις PKG και παιχνιδιού ταιριάζουν: - - - Would you like to overwrite? - Θέλετε να αντικαταστήσετε; - - - PKG Version %1 is older than installed version: - Η έκδοση PKG %1 είναι παλαιότερη από την εγκατεστημένη έκδοση: - - - Game is installed: - Το παιχνίδι είναι εγκατεστημένο: - - - Would you like to install Patch: - Θέλετε να εγκαταστήσετε την ενημέρωση: - - - DLC Installation - Εγκατάσταση DLC - - - Would you like to install DLC: %1? - Θέλετε να εγκαταστήσετε το DLC: %1; - - - DLC already installed: - DLC ήδη εγκατεστημένο: - - - Game already installed - Παιχνίδι ήδη εγκατεστημένο - - - PKG ERROR - ΣΦΑΛΜΑ PKG - - - Extracting PKG %1/%2 - Εξαγωγή PKG %1/%2 - - - Extraction Finished - Η εξαγωγή ολοκληρώθηκε - - - Game successfully installed at %1 - Το παιχνίδι εγκαταστάθηκε επιτυχώς στο %1 - - - File doesn't appear to be a valid PKG file - Η αρχείο δεν φαίνεται να είναι έγκυρο αρχείο PKG - Run Game Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin file not found - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! Game is already running! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Open Folder + Play + Play - PKG ERROR - ΣΦΑΛΜΑ PKG + Pause + Pause - Name - Όνομα + Stop + Stop - Serial - Σειριακός αριθμός + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - Μέγεθος + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - Περιοχή - - - Flags - Flags - - - Path - Διαδρομή - - - File - File - - - Unknown - Άγνωστο - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulator - - Enable Separate Update Folder - Enable Separate Update Folder - Default tab when opening settings Προεπιλεγμένη καρτέλα κατά την ανοίγμα των ρυθμίσεων @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Γλώσσα Εξομοιωτή:\nΡυθμίζει τη γλώσσα του γραφικού περιβάλλοντος του εξομοιωτή. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Εμφάνιση Splash Screen:\nΕμφανίζει ειδική γραφική οθόνη κατά την εκκίνηση. @@ -2191,6 +2057,10 @@ Trophy Viewer Trophy Viewer + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/en_US.ts b/src/qt_gui/translations/en_US.ts index 9c9d56076..780f089e8 100644 --- a/src/qt_gui/translations/en_US.ts +++ b/src/qt_gui/translations/en_US.ts @@ -882,10 +882,6 @@ Error creating shortcut! Error creating shortcut! - - Install PKG - Install PKG - Game Game @@ -978,25 +974,6 @@ - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Choose directory - - - Select which directory you want to install to. - Select which directory you want to install to. - - - Install All Queued to Selected Folder - - - - Delete PKG File on Install - - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Open/Add Elf Folder - - Install Packages (PKG) - Install Packages (PKG) - Boot Game Boot Game @@ -1234,10 +1207,6 @@ Configure... Configure... - - Install application from a .pkg file - Install application from a .pkg file - Recent Games Recent Games @@ -1307,8 +1276,12 @@ Dump Game List - PKG Viewer - PKG Viewer + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Only one file can be selected! - - PKG Extraction - PKG Extraction - - - Patch detected! - Patch detected! - - - PKG and Game versions match: - PKG and Game versions match: - - - Would you like to overwrite? - Would you like to overwrite? - - - PKG Version %1 is older than installed version: - PKG Version %1 is older than installed version: - - - Game is installed: - Game is installed: - - - Would you like to install Patch: - Would you like to install Patch: - - - DLC Installation - DLC Installation - - - Would you like to install DLC: %1? - Would you like to install DLC: %1? - - - DLC already installed: - DLC already installed: - - - Game already installed - Game already installed - - - PKG ERROR - PKG ERROR - - - Extracting PKG %1/%2 - Extracting PKG %1/%2 - - - Extraction Finished - Extraction Finished - - - Game successfully installed at %1 - Game successfully installed at %1 - - - File doesn't appear to be a valid PKG file - File doesn't appear to be a valid PKG file - Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found - - PKG File (*.PKG *.pkg) - - - - PKG is a patch or DLC, please install the game first! - - Game is already running! @@ -1506,71 +1407,44 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Open Folder - - - PKG ERROR - PKG ERROR - - - Name - Name - - - Serial - Serial - - - Installed + Play - Size - Size - - - Category + Pause - Type + Stop - App Ver + Restart - FW + Full Screen - Region - Region - - - Flags + Controllers - Path - Path + Keyboard + - File - File + Refresh List + - Unknown - Unknown + Resume + - Package + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulator - - Enable Separate Update Folder - Enable Separate Update Folder - Default tab when opening settings Default tab when opening settings @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Emulator Language:\nSets the language of the emulator's user interface. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. @@ -2191,6 +2057,10 @@ Trophy Viewer Trophy Viewer + + Select Game: + + Progress diff --git a/src/qt_gui/translations/es_ES.ts b/src/qt_gui/translations/es_ES.ts index 8861185cb..035aac6a3 100644 --- a/src/qt_gui/translations/es_ES.ts +++ b/src/qt_gui/translations/es_ES.ts @@ -443,15 +443,15 @@ Config Selection - Config Selection + Selección de Configuraciones Common Config - Common Config + Configuración Estándar Use per-game configs - Use per-game configs + Usar configuraciones por juego L1 / LB @@ -535,78 +535,78 @@ Override Lightbar Color - Override Lightbar Color + Reemplazar el Color de la Barra de Luz Override Color - Override Color + Reemplazar Color Unable to Save - Unable to Save + No se Pudo Guardar Cannot bind axis values more than once - Cannot bind axis values more than once + No se pueden vincular valores del eje más de una vez Save - Save + Guardar Apply - Apply + Aplicar Restore Defaults - Restore Defaults + Restaurar Valores Por Defecto Cancel - Cancel + Cancelar EditorDialog Edit Keyboard + Mouse and Controller input bindings - Edit Keyboard + Mouse and Controller input bindings + Editar Asignaciones de Teclado + Ratón y Mando Use Per-Game configs - Use Per-Game configs + Usar Configuraciones por Juego Error - Error + Error Could not open the file for reading - Could not open the file for reading + No se pudo abrir el archivo para la lectura Could not open the file for writing - Could not open the file for writing + No se pudo abrir el archivo para escritura Save Changes - Save Changes + Guardar Cambios Do you want to save changes? - Do you want to save changes? + ¿Quieres guardar los cambios? Help - Help + Ayuda Do you want to reset your custom default config to the original default config? - Do you want to reset your custom default config to the original default config? + ¿Desea restablecer su configuración predeterminada personalizada a la configuración por defecto original? Do you want to reset this config to your custom default config? - Do you want to reset this config to your custom default config? + ¿Quieres restablecer esta configuración a tu configuración por defecto personalizada? Reset to Default @@ -702,7 +702,7 @@ Never Played - Never Played + Nunca Jugado h @@ -788,7 +788,7 @@ Trophy Viewer - Ver trofeos + Expositor de Trofeos Open Folder... @@ -848,7 +848,7 @@ Delete Trophy - Delete Trophy + Eliminar Trofeo Compatibility... @@ -882,10 +882,6 @@ Error creating shortcut! ¡Error al crear el acceso directo! - - Install PKG - Instalar PKG - Game Juego @@ -928,7 +924,7 @@ No log file found for this game! - No log file found for this game! + ¡No se encontró un archivo de registro para este juego! Failed to convert icon. @@ -940,7 +936,7 @@ This game has no saved trophies to delete! - This game has no saved trophies to delete! + ¡Este juego no tiene trofeos guardados para eliminar! Save Data @@ -948,7 +944,7 @@ Trophy - Trophy + Trofeo SFO Viewer for @@ -959,97 +955,78 @@ HelpDialog Quickstart - Quickstart + Inicio Rápido FAQ - FAQ + Preguntas Frecuentes (FAQ) Syntax - Syntax + Sintaxis Special Bindings - Special Bindings + Asignación de Teclas Especiales Keybindings - Keybindings - - - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Elegir carpeta - - - Select which directory you want to install to. - Selecciona el directorio de instalación. - - - Install All Queued to Selected Folder - Instalar toda la cola en la carpeta seleccionada - - - Delete PKG File on Install - Eliminar archivo PKG tras la instalación + Asignación de Teclas KBMSettings Configure Controls - Configure Controls + Configurar Controles D-Pad - D-Pad + Cruceta Up - Up + Arriba unmapped - unmapped + sin vincular Left - Left + Izquierda Right - Right + Derecha Down - Down + Abajo Left Analog Halfmode - Left Analog Halfmode + Modo Reducido del Stick Izquierdo hold to move left stick at half-speed - hold to move left stick at half-speed + manten para mover el stick izquierdo a la mitad de la velocidad Left Stick - Left Stick + Stick Izquierdo Config Selection - Config Selection + Selección de Configuraciones Common Config - Common Config + Configuración Estándar Use per-game configs - Use per-game configs + Usar configuraciones por juego L1 @@ -1061,11 +1038,11 @@ Text Editor - Text Editor + Editor de Texto Help - Help + Ayuda R1 @@ -1085,127 +1062,127 @@ Mouse to Joystick - Ratón A Joystick + Ratón a Joystick *press F7 ingame to activate - *press F7 ingame to activate + * presiona F7 en el juego para activar R3 - R3 + R3 Options - Options + Opciones Mouse Movement Parameters - Mouse Movement Parameters + Parámetros Movimiento del Ratón note: click Help Button/Special Keybindings for more information - note: click Help Button/Special Keybindings for more information + nota: haga clic en Botón de ayuda/Asignación de Teclas Especiales para más información Face Buttons - Face Buttons + Botones de Acción Triangle - Triangle + Triángulo Square - Square + Cuadrado Circle - Circle + Círculo Cross - Cross + Equis Right Analog Halfmode - Right Analog Halfmode + Modo Reducido del Stick Derecho hold to move right stick at half-speed - hold to move right stick at half-speed + manten para mover el stick derecho a la mitad de la velocidad Right Stick - Right Stick + Stick Derecho Speed Offset (def 0.125): - Speed Offset (def 0.125): + Compensación de Velocidad (def 0.125): Copy from Common Config - Copy from Common Config + Copiar desde la Configuración Estándar Deadzone Offset (def 0.50): - Deadzone Offset (def 0.50): + Zona Muerta (def 0.50): Speed Multiplier (def 1.0): - Speed Multiplier (def 1.0): + Multiplicador de Velocidad (def 1.0): Common Config Selected - Common Config Selected + Configuración Estándar Seleccionada This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config. - This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config. + Este botón copia mapeos de la Configuración Estándar al perfil seleccionado actualmente, y no se puede utilizar cuando el perfil seleccionado es la Configuración Estándar. Copy values from Common Config - Copy values from Common Config + Copiar valores de la Configuración Estándar Do you want to overwrite existing mappings with the mappings from the Common Config? - Do you want to overwrite existing mappings with the mappings from the Common Config? + ¿Quiere sobrescribir los mapeos existentes con los mapeos de la Configuración Estándar? Unable to Save - Unable to Save + No se Pudo Guardar Cannot bind any unique input more than once - Cannot bind any unique input more than once + No se puede vincular ninguna entrada única más de una vez Press a key - Press a key + Pulsa una tecla Cannot set mapping - Cannot set mapping + No se pudo asignar el mapeo Mousewheel cannot be mapped to stick outputs - Mousewheel cannot be mapped to stick outputs + La rueda del ratón no puede ser mapeada al stick Save - Save + Guardar Apply - Apply + Aplicar Restore Defaults - Restore Defaults + Restaurar Valores Por Defecto Cancel - Cancel + Cancelar @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Abrir/Agregar carpeta Elf - - Install Packages (PKG) - Instalar paquetes (PKG) - Boot Game Iniciar juego @@ -1234,10 +1207,6 @@ Configure... Configurar... - - Install application from a .pkg file - Instalar aplicación desde un archivo .pkg - Recent Games Juegos recientes @@ -1284,11 +1253,11 @@ List View - Vista de lista + Vista de Lista Grid View - Vista de cuadrícula + Vista de Cuadrícula Elf Viewer @@ -1296,7 +1265,7 @@ Game Install Directory - Carpeta de instalación de los juegos + Carpeta de Instalación de Juegos Download Cheats/Patches @@ -1304,11 +1273,15 @@ Dump Game List - Volcar lista de juegos + Volcar Lista de Juegos - PKG Viewer - Vista PKG + Trophy Viewer + Expositor de Trofeos + + + No games found. Please add your games to your library first. + No se encontraron juegos. Por favor, añade tus juegos a tu biblioteca primero. Search... @@ -1324,11 +1297,11 @@ Game List Icons - Iconos de los juegos + Iconos de Juegos Game List Mode - Tipo de lista + Tipo de Lista Settings @@ -1372,7 +1345,7 @@ Game List - Lista de juegos + Lista de Juegos * Unsupported Vulkan Version @@ -1418,70 +1391,6 @@ Only one file can be selected! ¡Solo se puede seleccionar un archivo! - - PKG Extraction - Extracción de PKG - - - Patch detected! - ¡Actualización detectada! - - - PKG and Game versions match: - Las versiones de PKG y del juego coinciden: - - - Would you like to overwrite? - ¿Desea sobrescribir? - - - PKG Version %1 is older than installed version: - La versión de PKG %1 es más antigua que la versión instalada: - - - Game is installed: - El juego está instalado: - - - Would you like to install Patch: - ¿Desea instalar la actualización: - - - DLC Installation - Instalación de DLC - - - Would you like to install DLC: %1? - ¿Desea instalar el DLC: %1? - - - DLC already installed: - DLC ya instalado: - - - Game already installed - Juego ya instalado - - - PKG ERROR - ERROR PKG - - - Extracting PKG %1/%2 - Extrayendo PKG %1/%2 - - - Extraction Finished - Extracción terminada - - - Game successfully installed at %1 - Juego instalado exitosamente en %1 - - - File doesn't appear to be a valid PKG file - El archivo parece no ser un archivo PKG válido - Run Game Ejecutar juego @@ -1490,14 +1399,6 @@ Eboot.bin file not found Archivo Eboot.bin no encontrado - - PKG File (*.PKG *.pkg) - Archivo PKG (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - El archivo PKG es un parche o un DLC, ¡debes instalar el juego primero! - Game is already running! ¡El juego ya se está ejecutando! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Abrir carpeta + Play + Jugar - PKG ERROR - ERROR PKG + Pause + Pausar - Name - Nombre + Stop + Detener - Serial - Numero de serie + Restart + Reiniciar - Installed - Instalado + Full Screen + Pantalla completa - Size - Tamaño + Controllers + Controles - Category - Categoría + Keyboard + Teclado - Type - Tipo + Refresh List + Actualizar lista - App Ver - Versión de aplicación + Resume + Reanudar - FW - FW - - - Region - Región - - - Flags - Etiquetas - - - Path - Ruta - - - File - Archivo - - - Unknown - Desconocido - - - Package - Paquete + Show Labels Under Icons + Mostrar etiquetas debajo de los iconos @@ -1590,7 +1464,7 @@ Console Language - Idioma de la consola + Idioma de la Consola Emulator Language @@ -1600,10 +1474,6 @@ Emulator Emulador - - Enable Separate Update Folder - Habilitar carpeta independiente de actualizaciones - Default tab when opening settings Pestaña predeterminada al abrir la configuración @@ -1614,7 +1484,7 @@ Show Splash - Mostrar splash + Mostrar Pantalla de Bienvenida Enable Discord Rich Presence @@ -1622,11 +1492,11 @@ Username - Nombre de usuario + Nombre de Usuario Trophy Key - Clave de trofeos + Clave de Trofeos Trophy @@ -1634,7 +1504,7 @@ Open the custom trophy images/sounds folder - Open the custom trophy images/sounds folder + Abrir la carpeta de trofeos/sonidos personalizados Logger @@ -1642,15 +1512,15 @@ Log Type - Tipo de registro + Tipo de Registro Log Filter - Filtro de registro + Filtro de Registro Open Log Location - Abrir ubicación del registro + Abrir Ubicación del registro Input @@ -1662,11 +1532,11 @@ Hide Cursor - Ocultar cursor + Ocultar Cursor Hide Cursor Idle Timeout - Tiempo de espera para ocultar cursor inactivo + Tiempo de Espera para Ocultar Cursor Inactivo s @@ -1678,7 +1548,7 @@ Back Button Behavior - Comportamiento del botón de retroceso + Comportamiento del Botón de Retroceso Graphics @@ -1694,7 +1564,7 @@ Graphics Device - Dispositivo gráfico + Dispositivo Gráfico Vblank Divider @@ -1706,7 +1576,7 @@ Enable Shaders Dumping - Habilitar volcado de shaders + Habilitar volcado de Shaders Enable NULL GPU @@ -1722,7 +1592,7 @@ Game Folders - Carpetas de juego + Carpetas de Juegos Add... @@ -1738,27 +1608,27 @@ Enable Debug Dumping - Habilitar volcado de depuración + Habilitar Volcado de Depuración Enable Vulkan Validation Layers - Habilitar capas de validación de Vulkan + Habilitar Capas de Validación de Vulkan Enable Vulkan Synchronization Validation - Habilitar validación de sincronización de Vulkan + Habilitar Validación de Sincronización de Vulkan Enable RenderDoc Debugging - Habilitar depuración de RenderDoc + Habilitar Depuración de RenderDoc Enable Crash Diagnostics - Habilitar diagnóstico de fallos + Habilitar Diagnóstico de Fallos Collect Shaders - Recopilar shaders + Recopilar Shaders Copy GPU Buffers @@ -1766,11 +1636,11 @@ Host Debug Markers - Host Debug Markers + Marcadores de Depuración del Host Guest Debug Markers - Guest Debug Markers + Marcadores de Depuración del Invitado Update @@ -1778,11 +1648,11 @@ Check for Updates at Startup - Buscar actualizaciones al iniciar + Buscar Actualizaciones al Iniciar Always Show Changelog - Mostrar siempre el registro de cambios + Mostrar Siempre el Registro de Cambios Update Channel @@ -1790,7 +1660,7 @@ Check for Updates - Verificar actualizaciones + Buscar Actualizaciones GUI Settings @@ -1802,11 +1672,11 @@ Disable Trophy Notification - Disable Trophy Notification + Desactivar Notificaciones de Trofeos Background Image - Imagen de fondo + Imagen de Fondo Show Background Image @@ -1826,7 +1696,7 @@ Game Compatibility - Game Compatibility + Compatibilidad Display Compatibility Data @@ -1858,7 +1728,7 @@ Point your mouse at an option to display its description. - Coloque el mouse sobre una opción para mostrar su descripción. + Coloque el ratón sobre una opción para mostrar su descripción. Console Language:\nSets the language that the PS4 game uses.\nIt's recommended to set this to a language the game supports, which will vary by region. @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Idioma del Emulador:\nConfigura el idioma de la interfaz de usuario del emulador. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Mostrar Pantalla de Inicio:\nMuestra la pantalla de inicio del juego (una imagen especial) mientras el juego se está iniciando. @@ -1886,7 +1752,7 @@ Trophy Key:\nKey used to decrypt trophies. Must be obtained from your jailbroken console.\nMust contain only hex characters. - Trophy Key:\nKey used to decrypt trophies. Must be obtained from your jailbroken console.\nMust contain only hex characters. + Clave de Trofeos:\nClave utilizada para descifrar trofeos. Debe obtenerse de tu consola desbloqueada.\nSolo debe contener caracteres hexadecimales. Log Type:\nSets whether to synchronize the output of the log window for performance. May have adverse effects on emulation. @@ -1910,15 +1776,15 @@ 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). - 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). + Desactivar Notificaciones de trofeos:\nDesactiva las notificaciones de trofeos en el juego. El progreso de trofeos todavía puede ser rastreado usando el Expositor de Trofeos (haz clic derecho en el juego en la ventana principal). Hide Cursor:\nChoose when the cursor will disappear:\nNever: You will always see the mouse.\nidle: Set a time for it to disappear after being idle.\nAlways: you will never see the mouse. - Ocultar Cursor:\nElija cuándo desaparecerá el cursor:\nNunca: Siempre verá el mouse.\nInactivo: Establezca un tiempo para que desaparezca después de estar inactivo.\nSiempre: nunca verá el mouse. + Ocultar Cursor:\nElija cuándo desaparecerá el cursor:\nNunca: Siempre verá el ratón.\nInactivo: Establezca un tiempo para que desaparezca después de estar inactivo.\nSiempre: nunca verá el ratón. Hide Idle Cursor Timeout:\nThe duration (seconds) after which the cursor that has been idle hides itself. - Establezca un tiempo para que el mouse desaparezca después de estar inactivo. + Establezca un tiempo para que el ratón desaparezca después de estar inactivo. Back Button Behavior:\nSets the controller's back button to emulate tapping the specified position on the PS4 touchpad. @@ -1926,15 +1792,15 @@ Display Compatibility Data:\nDisplays game compatibility information in table view. Enable "Update Compatibility On Startup" to get up-to-date information. - Display Compatibility Data:\nDisplays game compatibility information in table view. Enable "Update Compatibility On Startup" to get up-to-date information. + Mostrar Datos de Compatibilidad:\nMuestra información de compatibilidad de juegos en vista de tabla. Habilite "Actualizar Compatibilidad al Iniciar" para obtener información actualizada. Update Compatibility On Startup:\nAutomatically update the compatibility database when shadPS4 starts. - Update Compatibility On Startup:\nAutomatically update the compatibility database when shadPS4 starts. + Actualizar Compatibilidad al Iniciar:\nActualiza automáticamente la base de datos de compatibilidad cuando shadPS4 se inicia. Update Compatibility Database:\nImmediately update the compatibility database. - Update Compatibility Database:\nImmediately update the compatibility database. + Actualizar Base de Datos de Compatibilidad:\nActualizar inmediatamente la base de datos de compatibilidad. Never @@ -1978,7 +1844,7 @@ Enable Shaders Dumping:\nFor the sake of technical debugging, saves the games shaders to a folder as they render. - Habilitar la Volcadura de Sombras:\nPor el bien de la depuración técnica, guarda las sombras del juego en una carpeta mientras se renderizan. + Habilitar la Volcadura de Shaders:\nPor el bien de la depuración técnica, guarda las sombras del juego en una carpeta mientras se renderizan. Enable Null GPU:\nFor the sake of technical debugging, disables game rendering as if there were no graphics card. @@ -1986,7 +1852,7 @@ Enable HDR:\nEnables HDR in games that support it.\nYour monitor must have support for the BT2020 PQ color space and the RGB10A2 swapchain format. - Enable HDR:\nEnables HDR in games that support it.\nYour monitor must have support for the BT2020 PQ color space and the RGB10A2 swapchain format. + Habilitar HDR:\nHabilita HDR en juegos que lo soporten.\nTu monitor debe tener soporte para el espacio de color PQ BT2020 y el formato RGB10A2 de cadena de intercambio. Game Folders:\nThe list of folders to check for installed games. @@ -2018,31 +1884,31 @@ Collect Shaders:\nYou need this enabled to edit shaders with the debug menu (Ctrl + F10). - Collect Shaders:\nYou need this enabled to edit shaders with the debug menu (Ctrl + F10). + Recopilar Shaders:\nNecesitas esto habilitado para editar shaders con el menú de depuración (Ctrl + F10). Crash Diagnostics:\nCreates a .yaml file with info about the Vulkan state at the time of crashing.\nUseful for debugging 'Device lost' errors. If you have this enabled, you should enable Host AND Guest Debug Markers.\nDoes not work on Intel GPUs.\nYou need Vulkan Validation Layers enabled and the Vulkan SDK for this to work. - Crash Diagnostics:\nCreates a .yaml file with info about the Vulkan state at the time of crashing.\nUseful for debugging 'Device lost' errors. If you have this enabled, you should enable Host AND Guest Debug Markers.\nDoes not work on Intel GPUs.\nYou need Vulkan Validation Layers enabled and the Vulkan SDK for this to work. + Diagnóstico de cuelgues:\nCrea un archivo .yaml con información sobre el estado de Vulkan en el momento del cuelgue.\nÚtil para depurar errores de tipo 'Dispositivo perdido' . Con esto activado, deberías habilitar los marcadores de depuración de Host E Invitado.\nNo funciona en GPUs de Intel.\nNecesitas activar las Capas de Validación de Vulkan y el SDK de Vulkan para que funcione. Copy GPU Buffers:\nGets around race conditions involving GPU submits.\nMay or may not help with PM4 type 0 crashes. - Copy GPU Buffers:\nGets around race conditions involving GPU submits.\nMay or may not help with PM4 type 0 crashes. + Copiar Búferes de GPU:\nSortea condiciones de carrera que implican envíos de GPU.\nPuede o no ayudar con cuelgues del tipo 0 de PM4. Host Debug Markers:\nInserts emulator-side information like markers for specific AMDGPU commands around Vulkan commands, as well as giving resources debug names.\nIf you have this enabled, you should enable Crash Diagnostics.\nUseful for programs like RenderDoc. - Host Debug Markers:\nInserts emulator-side information like markers for specific AMDGPU commands around Vulkan commands, as well as giving resources debug names.\nIf you have this enabled, you should enable Crash Diagnostics.\nUseful for programs like RenderDoc. + Marcadores de Depuración del Host:\n Inserta información del emulador como marcadores para comandos AMDGPU específicos, además de proporcionar nombres de depuración.\nCon esto activado, deberías habilitar el diagnóstico de fallos.\nUtil para programas como RenderDoc. Guest Debug Markers:\nInserts any debug markers the game itself has added to the command buffer.\nIf you have this enabled, you should enable Crash Diagnostics.\nUseful for programs like RenderDoc. - Guest Debug Markers:\nInserts any debug markers the game itself has added to the command buffer.\nIf you have this enabled, you should enable Crash Diagnostics.\nUseful for programs like RenderDoc. + Marcadores de Depuración del Invitado:\n Inserta cualquier marcador que el propio juego ha añadido al búfer de comandos.\nCon esto activado, deberías habilitar el diagnóstico de fallos.\nUtil para programas como RenderDoc. Save Data Path:\nThe folder where game save data will be saved. - Save Data Path:\nThe folder where game save data will be saved. + Ruta de Guardado de Datos:\nLa carpeta donde se guardarán los datos del juego. Browse:\nBrowse for a folder to set as the save data path. - Browse:\nBrowse for a folder to set as the save data path. + Buscar:\nBusque una carpeta para establecer como ruta de datos guardados. Release @@ -2054,11 +1920,11 @@ Set the volume of the background music. - Set the volume of the background music. + Establece el volumen de la música de fondo. Enable Motion Controls - Habilitar controles de movimiento + Habilitar Controles de Movimiento Save Data Path @@ -2070,15 +1936,15 @@ async - async + asíncrono sync - sync + síncrono Auto Select - Selección automática + Selección Automática Directory to install games @@ -2094,7 +1960,7 @@ Display Mode - Modo de imagen + Modo de Imagen Windowed @@ -2102,15 +1968,15 @@ Fullscreen - Pantalla completa + Pantalla Completa Fullscreen (Borderless) - Pantalla completa (sin bordes) + Pantalla Completa (sin bordes) Window Size - Tamaño de ventana + Tamaño de Ventana W: @@ -2122,90 +1988,94 @@ Separate Log Files - Separate Log Files + Archivos de Registro Independientes Separate Log Files:\nWrites a separate logfile for each game. - Separate Log Files:\nWrites a separate logfile for each game. + Archivos de Registro Independientes:\nEscribe un archivo de registro separado para cada juego. Trophy Notification Position - Trophy Notification Position + Posición de Notificación de Trofeos Left - Left + Izquierda Right - Right + Derecha Top - Top + Arriba Bottom - Bottom + Abajo Notification Duration - Notification Duration + Duración de Notificaciones Portable User Folder - Portable User Folder + Carpeta Portable de Usuario Create Portable User Folder from Common User Folder - Create Portable User Folder from Common User Folder + Crear Carpeta Portable de Usuario a partir de la Carpeta de Usuario Estándar Portable user folder:\nStores shadPS4 settings and data that will be applied only to the shadPS4 build located in the current folder. Restart the app after creating the portable user folder to begin using it. - Portable user folder:\nStores shadPS4 settings and data that will be applied only to the shadPS4 build located in the current folder. Restart the app after creating the portable user folder to begin using it. + Carpeta portable de usuario:\nAlmacena la configuración de shadPS4 y los datos que se aplicarán sólo a la compilación shadPS4 ubicada en la carpeta actual. Reinicia la aplicación después de crear la carpeta portable de usuario para empezar a usarla. Cannot create portable user folder - Cannot create portable user folder + No se pudo crear la carpeta portable de usuario %1 already exists - %1 already exists + %1 ya existe Portable user folder created - Portable user folder created + Carpeta Portable de Usuario Creada %1 successfully created. - %1 successfully created. + %1 creado correctamente. Open the custom trophy images/sounds folder:\nYou can add custom images to the trophies and an audio.\nAdd the files to custom_trophy with the following names:\ntrophy.wav OR trophy.mp3, bronze.png, gold.png, platinum.png, silver.png\nNote: The sound will only work in QT versions. - Open the custom trophy images/sounds folder:\nYou can add custom images to the trophies and an audio.\nAdd the files to custom_trophy with the following names:\ntrophy.wav OR trophy.mp3, bronze.png, gold.png, platinum.png, silver.png\nNote: The sound will only work in QT versions. + Abre la carpeta de trofeos/sonidos personalizados:\nPuedes añadir imágenes y un audio personalizados a los trofeos.\nAñade los archivos a custom_trophy con los siguientes nombres:\ntrophy.wav o trophy.mp3, bronze.png, gold.png, platinum.png, silver.png\nNota: El sonido sólo funcionará en versiones QT. TrophyViewer Trophy Viewer - Vista de trofeos + Expositor de Trofeos + + + Select Game: + Selecciona un Juego: Progress - Progress + Progreso Show Earned Trophies - Show Earned Trophies + Mostrar Trofeos Obtenidos Show Not Earned Trophies - Show Not Earned Trophies + Mostrar Trofeos No Obtenidos Show Hidden Trophies - Show Hidden Trophies + Mostrar Trofeos Ocultos diff --git a/src/qt_gui/translations/fa_IR.ts b/src/qt_gui/translations/fa_IR.ts index 6984b29f8..552a0ff23 100644 --- a/src/qt_gui/translations/fa_IR.ts +++ b/src/qt_gui/translations/fa_IR.ts @@ -882,10 +882,6 @@ Error creating shortcut! مشکلی در هنگام ساخت میانبر بوجود آمد! - - Install PKG - نصب PKG - Game بازی @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - ShadPS4 - انتخاب محل نصب بازی - - - Select which directory you want to install to. - محلی را که می‌خواهید در آن نصب شود، انتخاب کنید. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder ELF بازکردن/ساختن پوشه - - Install Packages (PKG) - نصب بسته (PKG) - Boot Game اجرای بازی @@ -1234,10 +1207,6 @@ Configure... ...تنظیمات - - Install application from a .pkg file - .PKG نصب بازی از فایل - Recent Games بازی های اخیر @@ -1307,8 +1276,12 @@ استخراج لیست بازی ها - PKG Viewer - PKG مشاهده گر + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! فقط یک فایل انتخاب کنید! - - PKG Extraction - PKG استخراج فایل - - - Patch detected! - پچ شناسایی شد! - - - PKG and Game versions match: - و نسخه بازی همخوانی دارد PKG فایل: - - - Would you like to overwrite? - آیا مایل به جایگزینی فایل هستید؟ - - - PKG Version %1 is older than installed version: - نسخه فایل PKG %1 قدیمی تر از نسخه نصب شده است: - - - Game is installed: - بازی نصب شد: - - - Would you like to install Patch: - آیا مایل به نصب پچ هستید: - - - DLC Installation - نصب DLC - - - Would you like to install DLC: %1? - آیا مایل به نصب DLC هستید: %1 - - - DLC already installed: - قبلا نصب شده DLC این: - - - Game already installed - این بازی قبلا نصب شده - - - PKG ERROR - PKG ارور فایل - - - Extracting PKG %1/%2 - درحال استخراج PKG %1/%2 - - - Extraction Finished - استخراج به پایان رسید - - - Game successfully installed at %1 - بازی با موفقیت در %1 نصب شد - - - File doesn't appear to be a valid PKG file - این فایل یک PKG درست به نظر نمی آید - Run Game Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin file not found - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! Game is already running! @@ -1506,72 +1407,45 @@ shadPS4 ShadPS4 - - - PKGViewer - Open Folder - بازکردن پوشه + Play + Play - PKG ERROR - PKG ارور فایل + Pause + Pause - Name - نام + Stop + Stop - Serial - سریال + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - اندازه + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - منطقه - - - Flags - Flags - - - Path - مسیر - - - File - فایل - - - Unknown - ناشناخته - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator شبیه ساز - - Enable Separate Update Folder - فعال‌سازی پوشه جداگانه برای به‌روزرسانی - Default tab when opening settings زبان پیش‌فرض هنگام باز کردن تنظیمات @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. زبان شبیه‌ساز:\nزبان رابط کاربری شبیه‌ساز را انتخاب می‌کند. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - فعال‌سازی پوشه جداگانه برای به‌روزرسانی:\nامکان نصب به‌روزرسانی‌های بازی در یک پوشه جداگانه برای مدیریت راحت‌تر را فراهم می‌کند. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. نمایش صفحه شروع:\nصفحه شروع بازی (تصویری ویژه) را هنگام بارگذاری بازی نمایش می‌دهد. @@ -2191,6 +2057,10 @@ Trophy Viewer مشاهده جوایز + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/fi_FI.ts b/src/qt_gui/translations/fi_FI.ts index 81274ae80..44c668560 100644 --- a/src/qt_gui/translations/fi_FI.ts +++ b/src/qt_gui/translations/fi_FI.ts @@ -407,206 +407,206 @@ ControlSettings Configure Controls - Configure Controls + Määritä Kontrollit D-Pad - D-Pad + D-Pad Up - Up + Ylös Left - Left + Vasen Right - Right + Oikea Down - Down + Alas Left Stick Deadzone (def:2 max:127) - Left Stick Deadzone (def:2 max:127) + Vasemman Analogin Deadzone (oletus:2 max:127) Left Deadzone - Left Deadzone + Vasen Deadzone Left Stick - Left Stick + Vasen Analogi Config Selection - Config Selection + Asetusten Valinta Common Config - Common Config + Yleinen Asetus Use per-game configs - Use per-game configs + Käytä pelikohtaisia asetuksia L1 / LB - L1 / LB + L1 / LB L2 / LT - L2 / LT + L2 / LT Back - Back + Back R1 / RB - R1 / RB + R1 / RB R2 / RT - R2 / RT + R2 / RT L3 - L3 + L3 Options / Start - Options / Start + Options / Start R3 - R3 + R3 Face Buttons - Face Buttons + Etunäppäimet Triangle / Y - Triangle / Y + Kolmio / Y Square / X - Square / X + Neliö / X Circle / B - Circle / B + Ympyrä / B Cross / A - Cross / A + Rasti / A Right Stick Deadzone (def:2, max:127) - Right Stick Deadzone (def:2, max:127) + Oikean Analogin Deadzone (oletus:2 max:127) Right Deadzone - Right Deadzone + Oikea Deadzone Right Stick - Right Stick + Oikea Analogi Color Adjustment - Color Adjustment + Värinhallinta R: - R: + R: G: - G: + G: B: - B: + B: Override Lightbar Color - Override Lightbar Color + Pakota Ohjaimen Valopalkin Väri Override Color - Override Color + Pakotettava Väri Unable to Save - Unable to Save + Tallentaminen Epäonnistui Cannot bind axis values more than once - Cannot bind axis values more than once + Akseliarvoja ei voi määrittää kertaa useammin Save - Save + Tallenna Apply - Apply + Ota Käyttöön Restore Defaults - Restore Defaults + Palauta Oletukset Cancel - Cancel + Peruuta EditorDialog Edit Keyboard + Mouse and Controller input bindings - Edit Keyboard + Mouse and Controller input bindings + Muokkaa Näppäimistön + Hiiren ja Ohjaimen näppäinasetuksia Use Per-Game configs - Use Per-Game configs + Käytä Pelikohtaisia Asetuksia Error - Error + Virhe Could not open the file for reading - Could not open the file for reading + Tiedostoa ei voitu avata luettavaksi Could not open the file for writing - Could not open the file for writing + Tiedostoa ei voitu avata kirjoitettavaksi Save Changes - Save Changes + Tallenna Muutokset Do you want to save changes? - Do you want to save changes? + Haluatko tallentaa muutokset? Help - Help + Tietoa Do you want to reset your custom default config to the original default config? - Do you want to reset your custom default config to the original default config? + Haluatko nollata oletusasetuksiin tekemäsi muutokset? Do you want to reset this config to your custom default config? - Do you want to reset this config to your custom default config? + Haluato palauttaa nämä asetukset takaisin määrittämiisi oletuksiin? Reset to Default @@ -882,10 +882,6 @@ Error creating shortcut! Virhe pikakuvakkeen luonnissa! - - Install PKG - Asenna PKG - Game Peli @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Valitse hakemisto - - - Select which directory you want to install to. - Valitse, mihin hakemistoon haluat asentaa. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install - - KBMSettings @@ -1077,35 +1054,35 @@ L3 - L3 + L3 Touchpad Click - Touchpad Click + Kosketuslevyn Klikkaus Mouse to Joystick - Mouse to Joystick + Hiiri Joystickinä *press F7 ingame to activate - *press F7 ingame to activate + *paina F7 pelissä aktivoidaksesi R3 - R3 + R3 Options - Options + Options Mouse Movement Parameters - Mouse Movement Parameters + Hiiren Liikkeen Parametrit note: click Help Button/Special Keybindings for more information - note: click Help Button/Special Keybindings for more information + huomio: klikkaa apunappia/näppäintä saadaksesi lisää tietoa Face Buttons @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Avaa/Lisää Elf Hakemisto - - Install Packages (PKG) - Asenna Paketteja (PKG) - Boot Game Käynnistä Peli @@ -1234,10 +1207,6 @@ Configure... Asetukset... - - Install application from a .pkg file - Asenna sovellus .pkg tiedostosta - Recent Games Viimeisimmät Pelit @@ -1307,8 +1276,12 @@ Kirjoita Pelilista Tiedostoon - PKG Viewer - PKG Selain + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Vain yksi tiedosto voi olla valittuna! - - PKG Extraction - PKG:n purku - - - Patch detected! - Päivitys havaittu! - - - PKG and Game versions match: - PKG- ja peliversiot vastaavat: - - - Would you like to overwrite? - Haluatko korvata? - - - PKG Version %1 is older than installed version: - PKG-versio %1 on vanhempi kuin asennettu versio: - - - Game is installed: - Peli on asennettu: - - - Would you like to install Patch: - Haluatko asentaa päivityksen: - - - DLC Installation - Lisäsisällön asennus - - - Would you like to install DLC: %1? - Haluatko asentaa lisäsisällön: %1? - - - DLC already installed: - Lisäsisältö on jo asennettu: - - - Game already installed - Peli on jo asennettu - - - PKG ERROR - PKG VIRHE - - - Extracting PKG %1/%2 - Purkaminen PKG %1/%2 - - - Extraction Finished - Purku valmis - - - Game successfully installed at %1 - Peli asennettu onnistuneesti kohtaan %1 - - - File doesn't appear to be a valid PKG file - Tiedosto ei vaikuta olevan kelvollinen PKG-tiedosto - Run Game Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin file not found - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! Game is already running! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Avaa Hakemisto + Play + Play - PKG ERROR - PKG VIRHE + Pause + Pause - Name - Nimi + Stop + Stop - Serial - Sarjanumero + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - Koko + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - Alue - - - Flags - Flags - - - Path - Polku - - - File - Tiedosto - - - Unknown - Tuntematon - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulaattori - - Enable Separate Update Folder - Ota Käyttöön Erillinen Päivityshakemisto - Default tab when opening settings Oletusvälilehti avattaessa asetuksia @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Emulaattorin Kieli:\nAsettaa emulaattorin käyttöliittymän kielen. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Ota Käyttöön Erillinen Päivityskansio:\nOttaa käyttöön päivitysten asennuksen erilliseen kansioon helpottamaan niiden hallintaa.\nTämä on tehtävissä manuaalisesti lisäämällä puretun päivityksen pelikansioon "CUSA00000-UPDATE" nimellä, missä CUSA ID vastaa pelin ID:tä. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Näytä Aloitusnäyttö:\nNäyttää pelin aloitusnäytön (erityinen kuva) pelin käynnistyessä. @@ -2191,6 +2057,10 @@ Trophy Viewer Trophy Selain + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/fr_FR.ts b/src/qt_gui/translations/fr_FR.ts index ff1646f9e..13e1be9f5 100644 --- a/src/qt_gui/translations/fr_FR.ts +++ b/src/qt_gui/translations/fr_FR.ts @@ -882,10 +882,6 @@ Error creating shortcut! Erreur lors de la création du raccourci ! - - Install PKG - Installer un PKG - Game Jeu @@ -978,25 +974,6 @@ Raccourcis - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Choisir un répertoire - - - Select which directory you want to install to. - Sélectionnez le répertoire où vous souhaitez effectuer l'installation. - - - Install All Queued to Selected Folder - Installer toute la file d’attente dans le dossier sélectionné - - - Delete PKG File on Install - Supprimer le fichier PKG à l'installation - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Ouvrir/Ajouter un dossier ELF - - Install Packages (PKG) - Installer des packages (PKG) - Boot Game Démarrer un jeu @@ -1234,10 +1207,6 @@ Configure... Configurer... - - Install application from a .pkg file - Installer une application depuis un fichier .pkg - Recent Games Jeux récents @@ -1307,8 +1276,12 @@ Dumper la liste des jeux - PKG Viewer - Visionneuse PKG + Trophy Viewer + Visionneuse de trophées + + + No games found. Please add your games to your library first. + Aucun jeu trouvé. Veuillez d'abord ajouter vos jeux à votre bibliothèque. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Un seul fichier peut être sélectionné ! - - PKG Extraction - Extraction du PKG - - - Patch detected! - Patch détecté ! - - - PKG and Game versions match: - Les versions PKG et jeu correspondent: - - - Would you like to overwrite? - Souhaitez-vous remplacer ? - - - PKG Version %1 is older than installed version: - La version PKG %1 est plus ancienne que la version installée: - - - Game is installed: - Jeu installé: - - - Would you like to install Patch: - Souhaitez-vous installer le patch: - - - DLC Installation - Installation du DLC - - - Would you like to install DLC: %1? - Souhaitez-vous installer le DLC: %1 ? - - - DLC already installed: - DLC déjà installé: - - - Game already installed - Jeu déjà installé - - - PKG ERROR - Erreur PKG - - - Extracting PKG %1/%2 - Extraction PKG %1/%2 - - - Extraction Finished - Extraction terminée - - - Game successfully installed at %1 - Jeu installé avec succès dans %1 - - - File doesn't appear to be a valid PKG file - Le fichier ne semble pas être un PKG valide - Run Game Lancer le jeu @@ -1490,14 +1399,6 @@ Eboot.bin file not found Fichier Eboot.bin introuvable - - PKG File (*.PKG *.pkg) - Fichier PKG (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG est un patch ou DLC, veuillez d'abord installer le jeu ! - Game is already running! Le jeu est déjà en cours ! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Ouvrir un dossier + Play + Jouer - PKG ERROR - Erreur PKG + Pause + Pause - Name - Nom + Stop + Stop - Serial - Numéro de série + Restart + Redémarrer - Installed - Installé + Full Screen + Plein écran - Size - Taille + Controllers + Contrôleurs - Category - Catégorie + Keyboard + Clavier - Type - Type + Refresh List + Rafraîchir la liste - App Ver - App Ver + Resume + Reprendre - FW - FW - - - Region - Région - - - Flags - Les indicateurs - - - Path - Répertoire - - - File - Fichier - - - Unknown - Inconnu - - - Package - Package + Show Labels Under Icons + Afficher les libellés sous les icônes @@ -1600,10 +1474,6 @@ Emulator Émulateur - - Enable Separate Update Folder - Dossier séparé pour les mises à jour - Default tab when opening settings Onglet par défaut lors de l'ouverture des paramètres @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Langue de l'émulateur:\nDéfinit la langue de l'interface utilisateur de l'émulateur. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Dossier séparé pour les mises à jour:\nInstalle les mises à jours des jeux dans un dossier séparé pour une gestion plus facile. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Afficher l'écran de démarrage:\nAffiche l'écran de démarrage du jeu (une image spéciale) lors du démarrage du jeu. @@ -2191,6 +2057,10 @@ Trophy Viewer Visionneuse de trophées + + Select Game: + Sélectionnez un jeu: + Progress Progression diff --git a/src/qt_gui/translations/hu_HU.ts b/src/qt_gui/translations/hu_HU.ts index c22d74257..58857d0d7 100644 --- a/src/qt_gui/translations/hu_HU.ts +++ b/src/qt_gui/translations/hu_HU.ts @@ -882,10 +882,6 @@ Error creating shortcut! Hiba a parancsikon létrehozásával! - - Install PKG - PKG telepítése - Game Játék @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Mappa kiválasztása - - - Select which directory you want to install to. - Válassza ki a mappát a játékok telepítésére. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder ELF Mappa Megnyitása/Hozzáadása - - Install Packages (PKG) - PKG-k Telepítése (PKG) - Boot Game Játék Indítása @@ -1234,10 +1207,6 @@ Configure... Konfigurálás... - - Install application from a .pkg file - Program telepítése egy .pkg fájlból - Recent Games Legutóbbi Játékok @@ -1307,8 +1276,12 @@ Játéklista Dumpolása - PKG Viewer - PKG Nézegető + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Csak egy fájl választható ki! - - PKG Extraction - PKG kicsomagolás - - - Patch detected! - Frissítés észlelve! - - - PKG and Game versions match: - A PKG és a játék verziói egyeznek: - - - Would you like to overwrite? - Szeretné felülírni? - - - PKG Version %1 is older than installed version: - A(z) %1-es PKG verzió régebbi, mint a telepített verzió: - - - Game is installed: - A játék telepítve van: - - - Would you like to install Patch: - Szeretné telepíteni a frissítést: - - - DLC Installation - DLC Telepítés - - - Would you like to install DLC: %1? - Szeretné telepíteni a %1 DLC-t? - - - DLC already installed: - DLC már telepítve: - - - Game already installed - A játék már telepítve van - - - PKG ERROR - PKG HIBA - - - Extracting PKG %1/%2 - PKG kicsomagolása %1/%2 - - - Extraction Finished - Kicsomagolás befejezve - - - Game successfully installed at %1 - A játék sikeresen telepítve itt: %1 - - - File doesn't appear to be a valid PKG file - A fájl nem tűnik érvényes PKG fájlnak - Run Game Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin file not found - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! Game is already running! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Mappa Megnyitása + Play + Play - PKG ERROR - PKG HIBA + Pause + Pause - Name - Név + Stop + Stop - Serial - Sorozatszám + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - Méret + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - Régió - - - Flags - Flags - - - Path - Útvonal - - - File - Fájl - - - Unknown - Ismeretlen - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulátor - - 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 @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Emulátor nyelve:\nBeállítja az emulátor felhasználói felületének nyelvét. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Külön Frissítéi Mappa Engedélyezése:\nEngedélyezi a frissítések külön mappába helyezését, a könnyű kezelésük érdekében. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Indítóképernyő megjelenítése:\nMegjeleníti a játék indítóképernyőjét (különleges képet) a játék elindításakor. @@ -2191,6 +2057,10 @@ Trophy Viewer Trófeák Megtekintése + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/id_ID.ts b/src/qt_gui/translations/id_ID.ts index 1a8b085cf..de19824f7 100644 --- a/src/qt_gui/translations/id_ID.ts +++ b/src/qt_gui/translations/id_ID.ts @@ -7,22 +7,22 @@ AboutDialog About shadPS4 - About shadPS4 + Tentang shadPS4 shadPS4 is an experimental open-source emulator for the PlayStation 4. - shadPS4 is an experimental open-source emulator for the PlayStation 4. + shadPS4 adalah emulator sumber terbuka eksperimental untuk PlayStation 4. This software should not be used to play games you have not legally obtained. - This software should not be used to play games you have not legally obtained. + Perangkat lunak ini tidak boleh digunakan untuk memainkan permainan yang tidak Anda peroleh secara legal. CheatsPatches Cheats / Patches for - Cheats / Patches for + Kecurangan / Tambalan untuk Cheats/Patches are experimental.\nUse with caution.\n\nDownload cheats individually by selecting the repository and clicking the download button.\nIn the Patches tab, you can download all patches at once, choose which ones you want to use, and save your selection.\n\nSince we do not develop the Cheats/Patches,\nplease report issues to the cheat author.\n\nCreated a new cheat? Visit:\n @@ -34,7 +34,7 @@ Serial: - Serial: + Seri: Version: @@ -400,38 +400,38 @@ Playable - Playable + Dapat dimainkan ControlSettings Configure Controls - Configure Controls + Konfigurasi Kontrol D-Pad - D-Pad + Tombol arah Up - Up + Atas Left - Left + Kiri Right - Right + Kanan Down - Down + Bawah Left Stick Deadzone (def:2 max:127) - Left Stick Deadzone (def:2 max:127) + Zona Mati Stik Kiri (standar: 2, maksimum: 127) Left Deadzone @@ -882,10 +882,6 @@ Error creating shortcut! Error creating shortcut! - - Install PKG - Install PKG - Game Game @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Choose directory - - - Select which directory you want to install to. - Select which directory you want to install to. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Open/Add Elf Folder - - Install Packages (PKG) - Install Packages (PKG) - Boot Game Boot Game @@ -1234,10 +1207,6 @@ Configure... Configure... - - Install application from a .pkg file - Install application from a .pkg file - Recent Games Recent Games @@ -1307,8 +1276,12 @@ Dump Game List - PKG Viewer - PKG Viewer + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Hanya satu file yang bisa dipilih! - - PKG Extraction - Ekstraksi PKG - - - Patch detected! - Patch terdeteksi! - - - PKG and Game versions match: - Versi PKG dan Game cocok: - - - Would you like to overwrite? - Apakah Anda ingin menimpa? - - - PKG Version %1 is older than installed version: - Versi PKG %1 lebih lama dari versi yang terpasang: - - - Game is installed: - Game telah terpasang: - - - Would you like to install Patch: - Apakah Anda ingin menginstal patch: - - - DLC Installation - Instalasi DLC - - - Would you like to install DLC: %1? - Apakah Anda ingin menginstal DLC: %1? - - - DLC already installed: - DLC sudah terpasang: - - - Game already installed - Game sudah terpasang - - - PKG ERROR - KESALAHAN PKG - - - Extracting PKG %1/%2 - Mengekstrak PKG %1/%2 - - - Extraction Finished - Ekstraksi Selesai - - - Game successfully installed at %1 - Game berhasil dipasang di %1 - - - File doesn't appear to be a valid PKG file - File tampaknya bukan file PKG yang valid - Run Game Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin file not found - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! Game is already running! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Open Folder + Play + Play - PKG ERROR - KESALAHAN PKG + Pause + Pause - Name - Nama + Stop + Stop - Serial - Serial + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - Ukuran + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - Wilayah - - - Flags - Flags - - - Path - Jalur - - - File - File - - - Unknown - Tidak Dikenal - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulator - - Enable Separate Update Folder - Enable Separate Update Folder - Default tab when opening settings Tab default saat membuka pengaturan @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Bahasa Emulator:\nMenetapkan bahasa antarmuka pengguna emulator. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Tampilkan Layar Pembuka:\nMenampilkan layar pembuka permainan (gambar khusus) saat permainan dimulai. @@ -2191,6 +2057,10 @@ Trophy Viewer Trophy Viewer + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/it_IT.ts b/src/qt_gui/translations/it_IT.ts index 5f57efca3..908013004 100644 --- a/src/qt_gui/translations/it_IT.ts +++ b/src/qt_gui/translations/it_IT.ts @@ -882,10 +882,6 @@ Error creating shortcut! Errore nella creazione della scorciatoia! - - Install PKG - Installa PKG - Game Gioco @@ -978,25 +974,6 @@ Associazioni dei pulsanti - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Scegli cartella - - - Select which directory you want to install to. - Seleziona in quale cartella vuoi effettuare l'installazione. - - - Install All Queued to Selected Folder - Installa tutto in coda nella Cartella Selezionata - - - Delete PKG File on Install - Elimina file PKG dopo Installazione - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Apri/Aggiungi cartella Elf - - Install Packages (PKG) - Installa Pacchetti (PKG) - Boot Game Avvia Gioco @@ -1234,10 +1207,6 @@ Configure... Configura... - - Install application from a .pkg file - Installa applicazione da un file .pkg - Recent Games Giochi Recenti @@ -1307,8 +1276,12 @@ Scarica Lista Giochi - PKG Viewer - Visualizzatore PKG + Trophy Viewer + Visualizzatore Trofei + + + No games found. Please add your games to your library first. + Nessun gioco trovato. Aggiungi prima i tuoi giochi alla tua libreria. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Si può selezionare solo un file! - - PKG Extraction - Estrazione file PKG - - - Patch detected! - Patch rilevata! - - - PKG and Game versions match: - Le versioni di PKG e del Gioco corrispondono: - - - Would you like to overwrite? - Vuoi sovrascrivere? - - - PKG Version %1 is older than installed version: - La versione PKG %1 è più vecchia rispetto alla versione installata: - - - Game is installed: - Gioco installato: - - - Would you like to install Patch: - Vuoi installare la patch: - - - DLC Installation - Installazione DLC - - - Would you like to install DLC: %1? - Vuoi installare il DLC: %1? - - - DLC already installed: - DLC già installato: - - - Game already installed - Gioco già installato - - - PKG ERROR - ERRORE PKG - - - Extracting PKG %1/%2 - Estrazione file PKG %1/%2 - - - Extraction Finished - Estrazione Completata - - - Game successfully installed at %1 - Gioco installato correttamente in %1 - - - File doesn't appear to be a valid PKG file - Il file sembra non essere un file PKG valido - Run Game Esegui Gioco @@ -1490,14 +1399,6 @@ Eboot.bin file not found File Eboot.bin non trovato - - PKG File (*.PKG *.pkg) - File PKG (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - Il file PKG è una patch o DLC, si prega di installare prima il gioco! - Game is already running! Il gioco è già in esecuzione! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Apri Cartella + Play + Riproduci - PKG ERROR - ERRORE PKG + Pause + Pausa - Name - Nome + Stop + Arresta - Serial - Seriale + Restart + Riavvia - Installed - Installato + Full Screen + Schermo Intero - Size - Dimensione + Controllers + Controller - Category - Categoria + Keyboard + Tastiera - Type - Tipo + Refresh List + Aggiorna Lista - App Ver - Vers. App. + Resume + Riprendi - FW - FW - - - Region - Regione - - - Flags - Segnalazioni - - - Path - Percorso - - - File - File - - - Unknown - Sconosciuto - - - Package - Pacchetto + Show Labels Under Icons + Mostra Etichette Sotto Icone @@ -1600,10 +1474,6 @@ Emulator Emulatore - - Enable Separate Update Folder - Abilita Cartella Aggiornamenti Separata - Default tab when opening settings Scheda predefinita all'apertura delle impostazioni @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Lingua dell'Emulatore:\nImposta la lingua dell'interfaccia utente dell'emulatore. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Abilita Cartella Aggiornamenti Separata:\nAbilita l'installazione degli aggiornamenti in una cartella separata per una più facile gestione. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Mostra Schermata di Avvio:\nMostra la schermata di avvio del gioco (un'immagine speciale) mentre il gioco si sta avviando. @@ -2191,6 +2057,10 @@ Trophy Viewer Visualizzatore Trofei + + Select Game: + Seleziona Gioco: + Progress Progresso diff --git a/src/qt_gui/translations/ja_JP.ts b/src/qt_gui/translations/ja_JP.ts index d93e36770..146caa515 100644 --- a/src/qt_gui/translations/ja_JP.ts +++ b/src/qt_gui/translations/ja_JP.ts @@ -882,10 +882,6 @@ Error creating shortcut! ショートカットの作成に失敗しました! - - Install PKG - PKGをインストール - Game ゲーム @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - ディレクトリを選択 - - - Select which directory you want to install to. - インストール先のディレクトリを選択してください。 - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - インストール時にPKGファイルを削除 - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Elfフォルダを開く/追加する - - Install Packages (PKG) - パッケージをインストール (PKG) - Boot Game ゲームを起動 @@ -1234,10 +1207,6 @@ Configure... 設定... - - Install application from a .pkg file - .pkgファイルからアプリケーションをインストール - Recent Games 最近プレイしたゲーム @@ -1307,8 +1276,12 @@ ゲームリストをダンプ - PKG Viewer - PKGビューアー + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! 1つのファイルしか選択できません! - - PKG Extraction - PKGの抽出 - - - Patch detected! - パッチが検出されました! - - - PKG and Game versions match: - PKGとゲームのバージョンが一致しています: - - - Would you like to overwrite? - 上書きしてもよろしいですか? - - - PKG Version %1 is older than installed version: - PKGバージョン %1 はインストールされているバージョンよりも古いです: - - - Game is installed: - ゲームはインストール済みです: - - - Would you like to install Patch: - パッチをインストールしてもよろしいですか: - - - DLC Installation - DLCのインストール - - - Would you like to install DLC: %1? - DLCをインストールしてもよろしいですか: %1? - - - DLC already installed: - DLCはすでにインストールされています: - - - Game already installed - ゲームはすでにインストールされています - - - PKG ERROR - PKGエラー - - - Extracting PKG %1/%2 - PKGを抽出中 %1/%2 - - - Extraction Finished - 抽出完了 - - - Game successfully installed at %1 - ゲームが %1 に正常にインストールされました - - - File doesn't appear to be a valid PKG file - ファイルが有効なPKGファイルでないようです - Run Game ゲームを実行 @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin ファイルが見つかりません - - PKG File (*.PKG *.pkg) - PKGファイル (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! ゲームは既に実行されています! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - フォルダーを開く + Play + Play - PKG ERROR - PKGエラー + Pause + Pause - Name - 名前 + Stop + Stop - Serial - シリアル + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - サイズ + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - 地域 - - - Flags - Flags - - - Path - パス - - - File - ファイル - - - Unknown - 不明 - - - Package - パッケージ + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator エミュレーター - - Enable Separate Update Folder - アップデートフォルダの分離を有効化 - Default tab when opening settings 設定を開くときのデフォルトタブ @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. エミュレーターの言語:\nエミュレーターのユーザーインターフェースの言語を設定します。 - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nゲームのアップデートを別のフォルダにインストールすることで、管理が容易になります。 - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. スプラッシュスクリーンを表示:\nゲーム起動中にゲームのスプラッシュスクリーン(特別な画像)を表示します。 @@ -2191,6 +2057,10 @@ Trophy Viewer トロフィービューアー + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/ko_KR.ts b/src/qt_gui/translations/ko_KR.ts index dc5b61038..b79959d38 100644 --- a/src/qt_gui/translations/ko_KR.ts +++ b/src/qt_gui/translations/ko_KR.ts @@ -882,10 +882,6 @@ Error creating shortcut! Error creating shortcut! - - Install PKG - Install PKG - Game Game @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Choose directory - - - Select which directory you want to install to. - Select which directory you want to install to. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Open/Add Elf Folder - - Install Packages (PKG) - Install Packages (PKG) - Boot Game Boot Game @@ -1234,10 +1207,6 @@ Configure... Configure... - - Install application from a .pkg file - Install application from a .pkg file - Recent Games Recent Games @@ -1307,8 +1276,12 @@ Dump Game List - PKG Viewer - PKG Viewer + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Only one file can be selected! - - PKG Extraction - PKG Extraction - - - Patch detected! - Patch detected! - - - PKG and Game versions match: - PKG and Game versions match: - - - Would you like to overwrite? - Would you like to overwrite? - - - PKG Version %1 is older than installed version: - PKG Version %1 is older than installed version: - - - Game is installed: - Game is installed: - - - Would you like to install Patch: - Would you like to install Patch: - - - DLC Installation - DLC Installation - - - Would you like to install DLC: %1? - Would you like to install DLC: %1? - - - DLC already installed: - DLC already installed: - - - Game already installed - Game already installed - - - PKG ERROR - PKG ERROR - - - Extracting PKG %1/%2 - Extracting PKG %1/%2 - - - Extraction Finished - Extraction Finished - - - Game successfully installed at %1 - Game successfully installed at %1 - - - File doesn't appear to be a valid PKG file - File doesn't appear to be a valid PKG file - Run Game Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin file not found - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! Game is already running! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Open Folder + Play + Play - PKG ERROR - PKG ERROR + Pause + Pause - Name - Name + Stop + Stop - Serial - Serial + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - Size + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - Region - - - Flags - Flags - - - Path - Path - - - File - File - - - Unknown - 알 수 없음 - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulator - - Enable Separate Update Folder - Enable Separate Update Folder - Default tab when opening settings 설정 열기 시 기본 탭 @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Emulator Language:\nSets the language of the emulator's user interface. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. @@ -2191,6 +2057,10 @@ Trophy Viewer Trophy Viewer + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/lt_LT.ts b/src/qt_gui/translations/lt_LT.ts index 2f4b6e59b..03ff5a003 100644 --- a/src/qt_gui/translations/lt_LT.ts +++ b/src/qt_gui/translations/lt_LT.ts @@ -7,7 +7,7 @@ AboutDialog About shadPS4 - About shadPS4 + Apie shadPS4 shadPS4 is an experimental open-source emulator for the PlayStation 4. @@ -15,7 +15,7 @@ This software should not be used to play games you have not legally obtained. - This software should not be used to play games you have not legally obtained. + Ši programa neturėtų būti naudojama žaidimams kurių neturite legaliai įsigiję. @@ -463,7 +463,7 @@ Back - Back + Atgal R1 / RB @@ -519,7 +519,7 @@ Color Adjustment - Color Adjustment + Spalvų Reguliavimas R: @@ -543,7 +543,7 @@ Unable to Save - Unable to Save + Nepavyko Išsaugoti Cannot bind axis values more than once @@ -563,7 +563,7 @@ Cancel - Cancel + Atšaukti @@ -590,15 +590,15 @@ Save Changes - Save Changes + Išsaugoti Pakeitimus Do you want to save changes? - Do you want to save changes? + Ar norite išsaugoti pakeitimus? Help - Help + Pagalba Do you want to reset your custom default config to the original default config? @@ -876,19 +876,15 @@ Error - Error + Klaida Error creating shortcut! Error creating shortcut! - - Install PKG - Install PKG - Game - Game + Žaidimas This game has no update to delete! @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Choose directory - - - Select which directory you want to install to. - Select which directory you want to install to. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Open/Add Elf Folder - - Install Packages (PKG) - Install Packages (PKG) - Boot Game Boot Game @@ -1234,10 +1207,6 @@ Configure... Configure... - - Install application from a .pkg file - Install application from a .pkg file - Recent Games Recent Games @@ -1307,8 +1276,12 @@ Dump Game List - PKG Viewer - PKG Viewer + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Galite pasirinkti tik vieną failą! - - PKG Extraction - PKG ištraukimas - - - Patch detected! - Rasta atnaujinimą! - - - PKG and Game versions match: - PKG ir žaidimo versijos sutampa: - - - Would you like to overwrite? - Ar norite perrašyti? - - - PKG Version %1 is older than installed version: - PKG versija %1 yra senesnė nei įdiegta versija: - - - Game is installed: - Žaidimas įdiegtas: - - - Would you like to install Patch: - Ar norite įdiegti atnaujinimą: - - - DLC Installation - DLC diegimas - - - Would you like to install DLC: %1? - Ar norite įdiegti DLC: %1? - - - DLC already installed: - DLC jau įdiegtas: - - - Game already installed - Žaidimas jau įdiegtas - - - PKG ERROR - PKG KLAIDA - - - Extracting PKG %1/%2 - Ekstrakcinis PKG %1/%2 - - - Extraction Finished - Ekstrakcija baigta - - - Game successfully installed at %1 - Žaidimas sėkmingai įdiegtas %1 - - - File doesn't appear to be a valid PKG file - Failas atrodo, kad nėra galiojantis PKG failas - Run Game Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin file not found - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! Game is already running! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Open Folder + Play + Play - PKG ERROR - PKG KLAIDA + Pause + Pause - Name - Vardas + Stop + Stop - Serial - Serijinis numeris + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - Dydis + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - Regionas - - - Flags - Flags - - - Path - Kelias - - - File - File - - - Unknown - Nežinoma - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulator - - Enable Separate Update Folder - Enable Separate Update Folder - Default tab when opening settings Numatytoji kortelė atidarius nustatymus @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Emuliatoriaus kalba:\nNustato emuliatoriaus vartotojo sąsajos kalbą. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Rodyti paleidimo ekraną:\nPaleidimo metu rodo žaidimo paleidimo ekraną (ypatingą vaizdą). @@ -2191,6 +2057,10 @@ Trophy Viewer Trophy Viewer + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/nb_NO.ts b/src/qt_gui/translations/nb_NO.ts index e7c48e426..e937287fd 100644 --- a/src/qt_gui/translations/nb_NO.ts +++ b/src/qt_gui/translations/nb_NO.ts @@ -882,10 +882,6 @@ Error creating shortcut! Feil ved opprettelse av snarvei! - - Install PKG - Installer PKG - Game Spill @@ -978,25 +974,6 @@ Hurtigtast - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Velg mappe - - - Select which directory you want to install to. - Velg hvilken mappe du vil installere til. - - - Install All Queued to Selected Folder - Installer alle i kø til den valgte mappa - - - Delete PKG File on Install - Slett PKG-fila ved installering - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Åpne eller legg til Elf-mappe - - Install Packages (PKG) - Installer pakker (PKG) - Boot Game Start spill @@ -1234,10 +1207,6 @@ Configure... Sett opp … - - Install application from a .pkg file - Installer fra en .pkg fil - Recent Games Nylige spill @@ -1307,8 +1276,12 @@ Dump spilliste - PKG Viewer - PKG-viser + Trophy Viewer + Troféviser + + + No games found. Please add your games to your library first. + Fant ingen spill. Legg til spillene dine i biblioteket først. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Kun én fil kan velges! - - PKG Extraction - PKG-utpakking - - - Patch detected! - Programrettelse oppdaget! - - - PKG and Game versions match: - PKG og spillversjoner stemmer overens: - - - Would you like to overwrite? - Ønsker du å overskrive? - - - PKG Version %1 is older than installed version: - PKG-versjon %1 er eldre enn installert versjon: - - - Game is installed: - Spillet er installert: - - - Would you like to install Patch: - Ønsker du å installere programrettelsen: - - - DLC Installation - DLC installasjon - - - Would you like to install DLC: %1? - Ønsker du å installere DLC: %1? - - - DLC already installed: - DLC allerede installert: - - - Game already installed - Spillet er allerede installert - - - PKG ERROR - PKG FEIL - - - Extracting PKG %1/%2 - Pakker ut PKG %1/%2 - - - Extraction Finished - Utpakking fullført - - - Game successfully installed at %1 - Spillet ble installert i %1 - - - File doesn't appear to be a valid PKG file - Fila ser ikke ut til å være en gyldig PKG-fil - Run Game Kjør spill @@ -1490,14 +1399,6 @@ Eboot.bin file not found Klarte ikke finne Eboot.bin-fila - - PKG File (*.PKG *.pkg) - PKG-fil (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG er en programrettelse eller DLC. Installer spillet først! - Game is already running! Spillet kjører allerede! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Åpne mappe + Play + Spill - PKG ERROR - PKG FEIL + Pause + Pause - Name - Navn + Stop + Stopp - Serial - Serienummer + Restart + Start på nytt - Installed - Installert + Full Screen + Fullskjerm - Size - Størrelse + Controllers + Kontroller - Category - Kategori + Keyboard + Tastatur - Type - Type + Refresh List + Oppdater lista - App Ver - Programversjon + Resume + Gjenoppta - FW - FV - - - Region - Region - - - Flags - Flagg - - - Path - Adresse - - - File - Fil - - - Unknown - Ukjent - - - Package - Pakke + Show Labels Under Icons + Vis merkelapp under ikoner @@ -1600,10 +1474,6 @@ Emulator Emulator - - Enable Separate Update Folder - Bruk seperat oppdateringsmappe - Default tab when opening settings Standardfanen når innstillingene åpnes @@ -1734,11 +1604,11 @@ Debug - Feilretting + Feilsøking Enable Debug Dumping - Bruk feilrettingsdumping + Bruk feilsøkingsdumping Enable Vulkan Validation Layers @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Emulatorspråket:\nAngir språket for emulatorens brukergrensesnitt. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Bruk separat oppdateringsmappe:\n Gjør det mulig å installere spilloppdateringer i en egen mappe for enkel administrasjon.\nDette kan gjøres manuelt ved å legge til den utpakkede oppdateringen, til spillmappa med navnet "CUSA00000-UPDATE" der CUSA-ID-en samsvarer med spillets-ID. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Vis velkomstbilde:\nViser spillets velkomstbilde (et spesialbilde) når spillet starter. @@ -1950,15 +1816,15 @@ Touchpad Left - Berøringsplate Venstre + Berøringsplate venstre Touchpad Right - Berøringsplate Høyre + Berøringsplate høyre Touchpad Center - Berøringsplate Midt + Berøringsplate midten None @@ -2002,7 +1868,7 @@ Enable Debug Dumping:\nSaves the import and export symbols and file header information of the currently running PS4 program to a directory. - Bruk feilrettingsdumping:\nLagrer import- og eksport-symbolene og filoverskrifts-informasjonen til det nåværende kjørende PS4-programmet i en mappe. + Bruk feilsøkingsdumping:\nLagrer import- og eksport-symbolene og filoverskrifts-informasjonen til det nåværende kjørende PS4-programmet i en mappe. Enable Vulkan Validation Layers:\nEnables a system that validates the state of the Vulkan renderer and logs information about its internal state.\nThis will reduce performance and likely change the behavior of emulation. @@ -2058,7 +1924,7 @@ Enable Motion Controls - Bruk bevegelseskontroller + Bruk bevegelsesstyring Save Data Path @@ -2191,6 +2057,10 @@ Trophy Viewer Troféviser + + Select Game: + Velg spill: + Progress Fremdrift diff --git a/src/qt_gui/translations/nl_NL.ts b/src/qt_gui/translations/nl_NL.ts index f6c062da3..66872455e 100644 --- a/src/qt_gui/translations/nl_NL.ts +++ b/src/qt_gui/translations/nl_NL.ts @@ -882,10 +882,6 @@ Error creating shortcut! Error creating shortcut! - - Install PKG - Install PKG - Game Game @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Choose directory - - - Select which directory you want to install to. - Select which directory you want to install to. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Open/Add Elf Folder - - Install Packages (PKG) - Install Packages (PKG) - Boot Game Boot Game @@ -1234,10 +1207,6 @@ Configure... Configure... - - Install application from a .pkg file - Install application from a .pkg file - Recent Games Recent Games @@ -1307,8 +1276,12 @@ Dump Game List - PKG Viewer - PKG Viewer + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Je kunt slechts één bestand selecteren! - - PKG Extraction - PKG-extractie - - - Patch detected! - Patch gedetecteerd! - - - PKG and Game versions match: - PKG- en gameversies komen overeen: - - - Would you like to overwrite? - Wilt u overschrijven? - - - PKG Version %1 is older than installed version: - PKG-versie %1 is ouder dan de geïnstalleerde versie: - - - Game is installed: - Game is geïnstalleerd: - - - Would you like to install Patch: - Wilt u de patch installeren: - - - DLC Installation - DLC-installatie - - - Would you like to install DLC: %1? - Wilt u DLC installeren: %1? - - - DLC already installed: - DLC al geïnstalleerd: - - - Game already installed - Game al geïnstalleerd - - - PKG ERROR - PKG FOUT - - - Extracting PKG %1/%2 - PKG %1/%2 aan het extraheren - - - Extraction Finished - Extractie voltooid - - - Game successfully installed at %1 - Spel succesvol geïnstalleerd op %1 - - - File doesn't appear to be a valid PKG file - Het bestand lijkt geen geldig PKG-bestand te zijn - Run Game Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin file not found - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! Game is already running! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Open Folder + Play + Play - PKG ERROR - PKG FOUT + Pause + Pause - Name - Naam + Stop + Stop - Serial - Serienummer + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - Grootte + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - Regio - - - Flags - Flags - - - Path - Pad - - - File - File - - - Unknown - Onbekend - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulator - - Enable Separate Update Folder - Enable Separate Update Folder - Default tab when opening settings Standaardtabblad bij het openen van instellingen @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Emulator Taal:\nStelt de taal van de gebruikersinterface van de emulator in. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Opstartscherm weergeven:\nToont het opstartscherm van het spel (een speciale afbeelding) tijdens het starten van het spel. @@ -2191,6 +2057,10 @@ Trophy Viewer Trophy Viewer + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/pl_PL.ts b/src/qt_gui/translations/pl_PL.ts index 4c4a33ec2..bd59a1894 100644 --- a/src/qt_gui/translations/pl_PL.ts +++ b/src/qt_gui/translations/pl_PL.ts @@ -543,38 +543,38 @@ Unable to Save - Unable to Save + Zapisywanie nie powiodło się Cannot bind axis values more than once - Cannot bind axis values more than once + Nie można powiązać wartości osi więcej niż raz Save - Save + Zapisz Apply - Apply + Zastosuj Restore Defaults - Restore Defaults + Przywróć ustawienia domyślne Cancel - Cancel + Anuluj EditorDialog Edit Keyboard + Mouse and Controller input bindings - Edit Keyboard + Mouse and Controller input bindings + Edytuj przypisanie klawiszy klawiatury + myszy oraz kontrolera Use Per-Game configs - Use Per-Game configs + Użyj osobnej konfiguracji dla każdej gry Error @@ -582,11 +582,11 @@ Could not open the file for reading - Could not open the file for reading + Nie można otworzyć pliku do odczytu Could not open the file for writing - Could not open the file for writing + Nie można otworzyć pliku do zapisu Save Changes @@ -602,11 +602,11 @@ Do you want to reset your custom default config to the original default config? - Do you want to reset your custom default config to the original default config? + Czy chcesz zresetować Twoją domyślną konfigurację do oryginalnej domyślnej konfiguracji? Do you want to reset this config to your custom default config? - Do you want to reset this config to your custom default config? + Czy chcesz zresetować tę konfigurację do Twojej domyślnej konfiguracji? Reset to Default @@ -882,10 +882,6 @@ Error creating shortcut! Utworzenie skrótu zakończone niepowodzeniem! - - Install PKG - Zainstaluj PKG - Game Gra @@ -959,253 +955,234 @@ HelpDialog Quickstart - Quickstart + Szybki start FAQ - FAQ + Najczęściej zadawane pytania Syntax - Syntax + Składnia Special Bindings - Special Bindings + Specjalne wiązania Keybindings - Keybindings - - - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Wybierz katalog - - - Select which directory you want to install to. - Wybierz katalog, do którego chcesz zainstalować. - - - Install All Queued to Selected Folder - Zainstaluj wszystkie oczekujące do wybranego folderu - - - Delete PKG File on Install - Usuń plik PKG po instalacji + Przypisanie klawiszy KBMSettings Configure Controls - Configure Controls + Skonfiguruj sterowanie D-Pad - D-Pad + Krzyżak Up - Up + Strzałka w górę unmapped - unmapped + nieprzypisane Left - Left + Strzałka w lewo Right - Right + Strzałka w prawo Down - Down + Strzałka w dół Left Analog Halfmode - Left Analog Halfmode + Połowiczny tryb lewego drążka hold to move left stick at half-speed - hold to move left stick at half-speed + przytrzymaj, aby przesuwać lewy drążek dwa razy wolniej Left Stick - Left Stick + Lewy drążek Config Selection - Config Selection + Wybór konfiguracji Common Config - Common Config + Typowa konfiguracja Use per-game configs - Use per-game configs + Użyj osobnej konfiguracji dla każdej gry L1 - L1 + L1 L2 - L2 + L2 Text Editor - Text Editor + Edytor tekstu Help - Help + Pomoc R1 - R1 + R1 R2 - R2 + R2 L3 - L3 + L3 Touchpad Click - Touchpad Click + Kliknięcie Touchpada Mouse to Joystick - Mouse to Joystick + Mysz na Joystick *press F7 ingame to activate - *press F7 ingame to activate + *naciśnij F7 w grze aby aktywować R3 - R3 + R3 Options - Options + Opcje Mouse Movement Parameters - Mouse Movement Parameters + Parametry ruchu myszy note: click Help Button/Special Keybindings for more information - note: click Help Button/Special Keybindings for more information + uwaga: kliknij przycisk Pomoc/Specjalne skróty klawiszowe, aby uzyskać więcej informacji Face Buttons - Face Buttons + Przednie przyciski Triangle - Triangle + Trójkąt Square - Square + Kwadrat Circle - Circle + Kółko Cross - Cross + Krzyżyk Right Analog Halfmode - Right Analog Halfmode + Połowiczny tryb prawego drążka hold to move right stick at half-speed - hold to move right stick at half-speed + przytrzymaj, aby przesuwać prawy drążek dwa razy wolniej Right Stick - Right Stick + Prawy drążek Speed Offset (def 0.125): - Speed Offset (def 0.125): + Offset prędkości (def 0,125): Copy from Common Config - Copy from Common Config + Kopiuj z typowej konfiguracji Deadzone Offset (def 0.50): - Deadzone Offset (def 0.50): + Offset martwych stref (def 0,50): Speed Multiplier (def 1.0): - Speed Multiplier (def 1.0): + Mnożnik prędkości (def1.0): Common Config Selected - Common Config Selected + Wybrano typową konfigurację This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config. - This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config. + Przycisk ten kopiuje mapowanie z typowej konfiguracji do aktualnie wybranego profilu, i nie może być użyty, gdy aktualnie wybranym profilem jest typowa konfiguracja. Copy values from Common Config - Copy values from Common Config + Kopiuj z typowej konfiguracji Do you want to overwrite existing mappings with the mappings from the Common Config? - Do you want to overwrite existing mappings with the mappings from the Common Config? + Czy chcesz nadpisać istniejące mapowania mapowaniem z typowej konfiguracji? Unable to Save - Unable to Save + Zapisywanie nie powiodło się Cannot bind any unique input more than once - Cannot bind any unique input more than once + Nie można powiązać żadnych unikalnych danych wejściowych więcej niż raz Press a key - Press a key + Naciśnij klawisz Cannot set mapping - Cannot set mapping + Nie można ustawić mapowania Mousewheel cannot be mapped to stick outputs - Mousewheel cannot be mapped to stick outputs + Kółko myszy nie może być przypisane do sterowania drążkiem Save - Save + Zapisz Apply - Apply + Zastosuj Restore Defaults - Restore Defaults + Przywróć ustawienia domyślne Cancel - Cancel + Anuluj @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Otwórz/Dodaj folder Elf - - Install Packages (PKG) - Zainstaluj paczkę (PKG) - Boot Game Uruchom grę @@ -1234,10 +1207,6 @@ Configure... Konfiguruj... - - Install application from a .pkg file - Zainstaluj aplikacje z pliku .pkg - Recent Games Ostatnie gry @@ -1307,8 +1276,12 @@ Zgraj listę gier - PKG Viewer - Menedżer plików PKG + Trophy Viewer + Menedżer trofeów + + + No games found. Please add your games to your library first. + Nie znaleziono gier. Najpierw dodaj swoje gry do swojej biblioteki. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Można wybrać tylko jeden plik! - - PKG Extraction - Wypakowywanie PKG - - - Patch detected! - Wykryto łatkę! - - - PKG and Game versions match: - Wersje PKG i gry są zgodne: - - - Would you like to overwrite? - Czy chcesz nadpisać? - - - PKG Version %1 is older than installed version: - Wersja PKG %1 jest starsza niż zainstalowana wersja: - - - Game is installed: - Gra jest zainstalowana: - - - Would you like to install Patch: - Czy chcesz zainstalować łatkę: - - - DLC Installation - Instalacja dodatkowej zawartości (DLC) - - - Would you like to install DLC: %1? - Czy chcesz zainstalować dodatkową zawartość (DLC): %1? - - - DLC already installed: - Dodatkowa zawartość (DLC) już zainstalowana: - - - Game already installed - Gra już zainstalowana - - - PKG ERROR - BŁĄD PKG - - - Extracting PKG %1/%2 - Wypakowywanie PKG %1/%2 - - - Extraction Finished - Wypakowywanie zakończone - - - Game successfully installed at %1 - Gra pomyślnie zainstalowana w %1 - - - File doesn't appear to be a valid PKG file - Plik nie wydaje się być prawidłowym plikiem PKG - Run Game Uruchom grę @@ -1490,14 +1399,6 @@ Eboot.bin file not found Nie znaleziono pliku EBOOT.BIN - - PKG File (*.PKG *.pkg) - Plik PKG (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG jest aktualizacją lub dodatkową zawartością (DLC), najpierw zainstaluj grę! - Game is already running! Gra jest już uruchomiona! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Otwórz folder + Play + Play - PKG ERROR - BŁĄD PKG + Pause + Pause - Name - Nazwa + Stop + Stop - Serial - Numer seryjny + Restart + Restart - Installed - Zainstalowano + Full Screen + Full Screen - Size - Rozmiar + Controllers + Controllers - Category - Kategoria + Keyboard + Keyboard - Type - Typ + Refresh List + Refresh List - App Ver - Wersja aplikacji + Resume + Resume - FW - Oprogramowanie - - - Region - Region - - - Flags - Flagi - - - Path - Ścieżka - - - File - Plik - - - Unknown - Nieznany - - - Package - Paczka + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulator - - Enable Separate Update Folder - Włącz oddzielny folder aktualizacji - Default tab when opening settings Domyślna zakładka podczas otwierania ustawień @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Język emulatora:\nUstala język interfejsu użytkownika emulatora. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Włącz oddzielny folder aktualizacji:\nUmożliwia instalowanie aktualizacji gier w oddzielnym folderze w celu łatwego zarządzania. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Wyświetl ekran powitalny:\nPodczas uruchamiania gry wyświetla ekran powitalny (specjalny obraz). @@ -2154,35 +2020,35 @@ Portable User Folder - Portable User Folder + Przenośny folder użytkownika Create Portable User Folder from Common User Folder - Create Portable User Folder from Common User Folder + Utwórz przenośny folder użytkownika ze zwykłego folderu użytkownika Portable user folder:\nStores shadPS4 settings and data that will be applied only to the shadPS4 build located in the current folder. Restart the app after creating the portable user folder to begin using it. - Portable user folder:\nStores shadPS4 settings and data that will be applied only to the shadPS4 build located in the current folder. Restart the app after creating the portable user folder to begin using it. + Przenośny folder użytkownika:\nPrzechowuje ustawienia shadPS4 i dane, które zostaną zastosowane tylko do kompilacji shadPS4 znajdującej się w bieżącym folderze. Uruchom ponownie aplikację po utworzeniu przenośnego folderu użytkownika, aby zacząć z niego korzystać. Cannot create portable user folder - Cannot create portable user folder + Nie można utworzyć przenośnego folderu użytkownika %1 already exists - %1 already exists + %1 już istnieje Portable user folder created - Portable user folder created + Utworzono przenośny folder użytkownika %1 successfully created. - %1 successfully created. + %1 prawidłowo utworzony. Open the custom trophy images/sounds folder:\nYou can add custom images to the trophies and an audio.\nAdd the files to custom_trophy with the following names:\ntrophy.wav OR trophy.mp3, bronze.png, gold.png, platinum.png, silver.png\nNote: The sound will only work in QT versions. - Open the custom trophy images/sounds folder:\nYou can add custom images to the trophies and an audio.\nAdd the files to custom_trophy with the following names:\ntrophy.wav OR trophy.mp3, bronze.png, gold.png, platinum.png, silver.png\nNote: The sound will only work in QT versions. + Otwórz niestandardowy folder obrazów/dźwięków:\nMożesz dodać własne obrazy dla trofeów i ich dźwięki.\nDodaj pliki do custom_trophy o następujących nazwach:\ntrophy.wav LUB trophy.mp3, bronze.png, gold.png, platinum.png, silver.png\nUwaga: Dźwięki działają tylko w wersji QT. @@ -2191,6 +2057,10 @@ Trophy Viewer Menedżer trofeów + + Select Game: + Wybierz grę: + Progress Postęp diff --git a/src/qt_gui/translations/pt_BR.ts b/src/qt_gui/translations/pt_BR.ts index 794215401..584d6dc19 100644 --- a/src/qt_gui/translations/pt_BR.ts +++ b/src/qt_gui/translations/pt_BR.ts @@ -730,7 +730,7 @@ Game displays an image but does not go past the menu - Jogo exibe imagem mas não passa do menu + O jogo exibe imagem mas não passa do menu Game has game-breaking glitches or unplayable performance @@ -882,10 +882,6 @@ Error creating shortcut! Erro ao criar atalho! - - Install PKG - Instalar PKG - Game Jogo @@ -912,7 +908,7 @@ Are you sure you want to delete %1's %2 directory? - Tem certeza de que deseja excluir o diretório %2 de %1? + Tem certeza de que deseja excluir o diretório do %2 %1? Open Update Folder @@ -978,25 +974,6 @@ Teclas de atalho - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Escolha o diretório - - - Select which directory you want to install to. - Selecione o diretório em que você deseja instalar. - - - Install All Queued to Selected Folder - Instalar Tudo da Fila para a Pasta Selecionada - - - Delete PKG File on Install - Excluir o PKG após a Instalação - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Abrir/Adicionar pasta Elf - - Install Packages (PKG) - Instalar Pacotes (PKG) - Boot Game Iniciar Jogo @@ -1234,10 +1207,6 @@ Configure... Configurar... - - Install application from a .pkg file - Instalar aplicativo de um arquivo .pkg - Recent Games Jogos Recentes @@ -1284,11 +1253,11 @@ List View - Visualizar em Lista + Visualização em Lista Grid View - Visualizar em Grade + Visualização em Grade Elf Viewer @@ -1307,8 +1276,12 @@ Exportar Lista de Jogos - PKG Viewer - Visualizador de PKG + Trophy Viewer + Visualizador de Troféus + + + No games found. Please add your games to your library first. + Nenhum jogo encontrado. Adicione seus jogos à sua biblioteca primeiro. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Apenas um arquivo pode ser selecionado! - - PKG Extraction - Extração de PKG - - - Patch detected! - Atualização detectada! - - - PKG and Game versions match: - As versões do PKG e do Jogo são iguais: - - - Would you like to overwrite? - Você gostaria de sobrescrever? - - - PKG Version %1 is older than installed version: - A Versão do PKG %1 é mais antiga do que a versão instalada: - - - Game is installed: - Jogo instalado: - - - Would you like to install Patch: - Você gostaria de instalar a atualização: - - - DLC Installation - Instalação de DLC - - - Would you like to install DLC: %1? - Você gostaria de instalar o DLC: %1? - - - DLC already installed: - DLC já está instalado: - - - Game already installed - O jogo já está instalado: - - - PKG ERROR - ERRO DE PKG - - - Extracting PKG %1/%2 - Extraindo PKG %1/%2 - - - Extraction Finished - Extração Concluída - - - Game successfully installed at %1 - Jogo instalado com sucesso em %1 - - - File doesn't appear to be a valid PKG file - O arquivo não parece ser um arquivo PKG válido - Run Game Executar Jogo @@ -1490,14 +1399,6 @@ Eboot.bin file not found Arquivo Eboot.bin não encontrado - - PKG File (*.PKG *.pkg) - Arquivo PKG (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - O PKG é um patch ou DLC, por favor instale o jogo primeiro! - Game is already running! O jogo já está executando! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Abrir Pasta + Play + Jogar - PKG ERROR - ERRO DE PKG + Pause + Pausar - Name - Nome + Stop + Parar - Serial - Serial + Restart + Reiniciar - Installed - Instalado + Full Screen + Tela Cheia - Size - Tamanho + Controllers + Controles - Category - Categoria + Keyboard + Teclado - Type - Tipo + Refresh List + Atualizar Lista - App Ver - Versão do App + Resume + Continuar - FW - FW - - - Region - Região - - - Flags - Flags - - - Path - Caminho - - - File - Arquivo - - - Unknown - Desconhecido - - - Package - Pacote + Show Labels Under Icons + Mostrar Rótulos Sob Ícones @@ -1600,10 +1474,6 @@ Emulator Emulador - - Enable Separate Update Folder - Ativar Pasta de Atualização Separada - Default tab when opening settings Aba padrão ao abrir as configurações @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Idioma do Emulador:\nDefine o idioma da interface do emulador. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Ativar Pasta de Atualização Separada:\nPermite instalar atualizações de jogos em uma pasta separada para fácil gerenciamento.\nIsso pode ser manualmente criado adicionando a atualização extraída à pasta do jogo com o nome "CUSA00000-UPDATE" onde o ID do CUSA corresponde ao ID do jogo. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Mostrar Splash Inicial:\nExibe a tela inicial do jogo (imagem especial) ao iniciar o jogo. @@ -2030,11 +1896,11 @@ Host Debug Markers:\nInserts emulator-side information like markers for specific AMDGPU commands around Vulkan commands, as well as giving resources debug names.\nIf you have this enabled, you should enable Crash Diagnostics.\nUseful for programs like RenderDoc. - Marcadores de Depuração de Host:\nInsere informações vindo do emulador como marcadores para comandos AMDGPU específicos em torno de comandos Vulkan, além de fornecer nomes de depuração aos recursos.\nSe isso estiver habilitado, ative os Diagnósticos de Falha.\nÚtil para programas como o RenderDoc. + Marcadores de Depuração do Host:\nInsere informações vindo do emulador como marcadores para comandos AMDGPU específicos em torno de comandos Vulkan, além de fornecer nomes de depuração aos recursos.\nSe isso estiver habilitado, ative os Diagnósticos de Falhas.\nÚtil para programas como o RenderDoc. Guest Debug Markers:\nInserts any debug markers the game itself has added to the command buffer.\nIf you have this enabled, you should enable Crash Diagnostics.\nUseful for programs like RenderDoc. - Marcadores de Depuração de Convidado:\nInsere quaisquer marcadores de depuração que o próprio jogo adicionou ao buffer de comando.\nSe isso estiver habilitado, ative os Diagnósticos de Falha.\nÚtil para programas como o RenderDoc. + Marcadores de Depuração do Convidado:\nInsere quaisquer marcadores de depuração que o próprio jogo adicionou ao buffer de comando.\nSe isso estiver habilitado, ative os Diagnósticos de Falhas.\nÚtil para programas como o RenderDoc. Save Data Path:\nThe folder where game save data will be saved. @@ -2191,6 +2057,10 @@ Trophy Viewer Visualizador de Troféus + + Select Game: + Selecionar Jogo: + Progress Progresso diff --git a/src/qt_gui/translations/pt_PT.ts b/src/qt_gui/translations/pt_PT.ts index dc0059b86..70a73afe7 100644 --- a/src/qt_gui/translations/pt_PT.ts +++ b/src/qt_gui/translations/pt_PT.ts @@ -543,74 +543,74 @@ Unable to Save - Unable to Save + Não é possível salvar Cannot bind axis values more than once - Cannot bind axis values more than once + Não foi possível atribuir os valores do eixo X ou Y mais de uma vez Save - Save + Salvar Apply - Apply + Aplicar Restore Defaults - Restore Defaults + Restaurar o Padrão Cancel - Cancel + Cancelar EditorDialog Edit Keyboard + Mouse and Controller input bindings - Edit Keyboard + Mouse and Controller input bindings + Editar comandos do Teclado + Mouse e do Controle Use Per-Game configs - Use Per-Game configs + Use uma configuração para cada jogo Error - Error + Erro Could not open the file for reading - Could not open the file for reading + Não foi possível abrir o arquivo para ler Could not open the file for writing - Could not open the file for writing + Não foi possível abrir o arquivo para escrever Save Changes - Save Changes + Salvar mudanças Do you want to save changes? - Do you want to save changes? + Salvar as mudanças? Help - Help + Ajuda Do you want to reset your custom default config to the original default config? - Do you want to reset your custom default config to the original default config? + Restaurar a configuração customizada padrão para a configuração original padrão? Do you want to reset this config to your custom default config? - Do you want to reset this config to your custom default config? + Deseja redefinir esta configuração para a configuração padrão personalizada? Reset to Default - Reset to Default + Resetar ao Padrão @@ -882,10 +882,6 @@ Error creating shortcut! Erro ao criar atalho! - - Install PKG - Instalar PKG - Game Jogo @@ -959,42 +955,23 @@ HelpDialog Quickstart - Quickstart + Início Rápido FAQ - FAQ + Perguntas Frequentes Syntax - Syntax + Sintaxe Special Bindings - Special Bindings + Atalhos Especiais Keybindings - Keybindings - - - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Escolher diretório - - - Select which directory you want to install to. - Selecione o diretório em que deseja instalar. - - - Install All Queued to Selected Folder - Instalar Todos os Pendentes para a Pasta Selecionada - - - Delete PKG File on Install - Eliminar Ficheiro PKG após Instalação + Combinações de Teclas @@ -1145,67 +1122,67 @@ Copy from Common Config - Copy from Common Config + Copiar da Configuração Comum Deadzone Offset (def 0.50): - Deadzone Offset (def 0.50): + Deslocamento da Zona Morta (def 0,50): Speed Multiplier (def 1.0): - Speed Multiplier (def 1.0): + Multiplicador de Velocidade (def 1,0): Common Config Selected - Common Config Selected + Configuração Comum Selecionada This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config. - This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config. + Este botão copia mapeamentos da Configuração Comum para o perfil atualmente selecionado, e não pode ser usado quando o perfil atualmente selecionado é a Configuração Comum. Copy values from Common Config - Copy values from Common Config + Copiar valores da Configuração Comum Do you want to overwrite existing mappings with the mappings from the Common Config? - Do you want to overwrite existing mappings with the mappings from the Common Config? + Substituir mapeamentos existentes com os mapeamentos da Configuração Comum? Unable to Save - Unable to Save + Não é possível salvar Cannot bind any unique input more than once - Cannot bind any unique input more than once + Não é possível vincular qualquer entrada única mais de uma vez Press a key - Press a key + Pressione uma tecla Cannot set mapping - Cannot set mapping + Não é possível definir o mapeamento Mousewheel cannot be mapped to stick outputs - Mousewheel cannot be mapped to stick outputs + Roda do rato não pode ser mapeada para saídas empates Save - Save + Salvar Apply - Apply + Aplicar Restore Defaults - Restore Defaults + Restaurar Definições Cancel - Cancel + Cancelar @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Abrir/Adicionar pasta Elf - - Install Packages (PKG) - Instalar Pacotes (PKG) - Boot Game Iniciar Jogo @@ -1234,10 +1207,6 @@ Configure... Configurar... - - Install application from a .pkg file - Instalar aplicação através de um ficheiro .pkg - Recent Games Jogos Recentes @@ -1307,8 +1276,12 @@ Exportar Lista de Jogos - PKG Viewer - Visualizador PKG + Trophy Viewer + Visualizador de Troféus + + + No games found. Please add your games to your library first. + Nenhum jogo encontrado. Por favor, adicione os seus jogos à sua biblioteca primeiro. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Apenas um ficheiro pode ser selecionado! - - PKG Extraction - Extração de PKG - - - Patch detected! - Patch detetado! - - - PKG and Game versions match: - As versões do PKG e do Jogo coincidem: - - - Would you like to overwrite? - Gostaria de substituir? - - - PKG Version %1 is older than installed version: - A versão do PKG %1 é mais antiga do que a versão instalada: - - - Game is installed: - O jogo está instalado: - - - Would you like to install Patch: - Gostaria de instalar o Patch: - - - DLC Installation - Instalação de DLC - - - Would you like to install DLC: %1? - Deseja instalar o DLC: %1? - - - DLC already installed: - DLC já está instalado: - - - Game already installed - O jogo já está instalado - - - PKG ERROR - ERRO PKG - - - Extracting PKG %1/%2 - A extrair PKG %1/%2 - - - Extraction Finished - Extração Finalizada - - - Game successfully installed at %1 - Jogo instalado com sucesso em %1 - - - File doesn't appear to be a valid PKG file - O ficheiro não aparenta ser um ficheiro PKG válido - Run Game Executar Jogo @@ -1490,14 +1399,6 @@ Eboot.bin file not found Ficheiro eboot.bin não encontrado - - PKG File (*.PKG *.pkg) - Ficheiro PKG (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - Este PKG é um patch ou DLC, por favor instale o respetivo jogo primeiro! - Game is already running! O jogo já está a ser executado! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Abrir Pasta + Play + Play - PKG ERROR - ERRO PKG + Pause + Pause - Name - Nome + Stop + Stop - Serial - Número de Série + Restart + Restart - Installed - Instalado + Full Screen + Full Screen - Size - Tamanho + Controllers + Controllers - Category - Categoria + Keyboard + Keyboard - Type - Tipo + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - Região - - - Flags - Flags - - - Path - Caminho - - - File - Ficheiro - - - Unknown - Desconhecido - - - Package - Pacote + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulador - - Enable Separate Update Folder - Ativar Pasta de Atualizações Separada - Default tab when opening settings Aba padrão ao abrir as definições @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Idioma do Emulador:\nDefine o idioma da interface gráfica do emulador. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Ativar Pasta de Atualização Separada:\nPermite instalar as atualizações dos jogos numa pasta separada para uma fácil gestão.\nIsto pode ser manualmente criado adicionando a atualização extraída à pasta do jogo com o nome "CUSA00000-UPDATE" onde o ID do CUSA corresponde ao ID do jogo. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Mostrar Splash Inicial:\nExibe o ecrã inicial do jogo (uma imagem especial) enquanto o jogo inicia. @@ -2166,23 +2032,23 @@ Cannot create portable user folder - Cannot create portable user folder + Não é possível criar pasta de utilizador portátil %1 already exists - %1 already exists + %1 já existe Portable user folder created - Portable user folder created + Pasta de utilizador portátil criada %1 successfully created. - %1 successfully created. + %1 criado com sucesso. Open the custom trophy images/sounds folder:\nYou can add custom images to the trophies and an audio.\nAdd the files to custom_trophy with the following names:\ntrophy.wav OR trophy.mp3, bronze.png, gold.png, platinum.png, silver.png\nNote: The sound will only work in QT versions. - Open the custom trophy images/sounds folder:\nYou can add custom images to the trophies and an audio.\nAdd the files to custom_trophy with the following names:\ntrophy.wav OR trophy.mp3, bronze.png, gold.png, platinum.png, silver.png\nNote: The sound will only work in QT versions. + Abra a pasta de imagens/sons de troféus personalizados:\nPoderá adicionar imagens personalizadas aos troféus e um áudio.\nAdicione os arquivos na pasta custom_trophy com os seguintes nomes:\ntrophy.mp3 ou trophy.wav, bronze.png, gold.png, platinum.png, silver.png\nObservação: O som funcionará apenas nas versões Qt. @@ -2191,6 +2057,10 @@ Trophy Viewer Visualizador de Troféus + + Select Game: + Escolha o Jogo: + Progress Progresso diff --git a/src/qt_gui/translations/ro_RO.ts b/src/qt_gui/translations/ro_RO.ts index 4261bf9e2..78dd79c53 100644 --- a/src/qt_gui/translations/ro_RO.ts +++ b/src/qt_gui/translations/ro_RO.ts @@ -882,10 +882,6 @@ Error creating shortcut! Error creating shortcut! - - Install PKG - Install PKG - Game Game @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Choose directory - - - Select which directory you want to install to. - Select which directory you want to install to. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Open/Add Elf Folder - - Install Packages (PKG) - Install Packages (PKG) - Boot Game Boot Game @@ -1234,10 +1207,6 @@ Configure... Configure... - - Install application from a .pkg file - Install application from a .pkg file - Recent Games Recent Games @@ -1307,8 +1276,12 @@ Dump Game List - PKG Viewer - PKG Viewer + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Numai un fișier poate fi selectat! - - PKG Extraction - Extracție PKG - - - Patch detected! - Patch detectat! - - - PKG and Game versions match: - Versiunile PKG și ale jocului sunt compatibile: - - - Would you like to overwrite? - Doriți să suprascrieți? - - - PKG Version %1 is older than installed version: - Versiunea PKG %1 este mai veche decât versiunea instalată: - - - Game is installed: - Jocul este instalat: - - - Would you like to install Patch: - Doriți să instalați patch-ul: - - - DLC Installation - Instalare DLC - - - Would you like to install DLC: %1? - Doriți să instalați DLC-ul: %1? - - - DLC already installed: - DLC deja instalat: - - - Game already installed - Jocul deja instalat - - - PKG ERROR - EROARE PKG - - - Extracting PKG %1/%2 - Extracție PKG %1/%2 - - - Extraction Finished - Extracție terminată - - - Game successfully installed at %1 - Jocul a fost instalat cu succes la %1 - - - File doesn't appear to be a valid PKG file - Fișierul nu pare să fie un fișier PKG valid - Run Game Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin file not found - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! Game is already running! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Deschide Folder + Play + Play - PKG ERROR - EROARE PKG + Pause + Pause - Name - Nume + Stop + Stop - Serial - Serie + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - Dimensiune + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - Regiune - - - Flags - Flags - - - Path - Drum - - - File - File - - - Unknown - Necunoscut - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulator - - Enable Separate Update Folder - Enable Separate Update Folder - Default tab when opening settings Tab-ul implicit la deschiderea setărilor @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Limba emulatorului:\nSetează limba interfeței utilizatorului a emulatorului. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Afișează ecranul de încărcare:\nAfișează ecranul de încărcare al jocului (o imagine specială) în timp ce jocul pornește. @@ -2191,6 +2057,10 @@ Trophy Viewer Trophy Viewer + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/ru_RU.ts b/src/qt_gui/translations/ru_RU.ts index 6ca16121f..0f16efc2c 100644 --- a/src/qt_gui/translations/ru_RU.ts +++ b/src/qt_gui/translations/ru_RU.ts @@ -882,10 +882,6 @@ Error creating shortcut! Ошибка создания ярлыка! - - Install PKG - Установить PKG - Game Игры @@ -978,25 +974,6 @@ Бинды клавиш - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Выберите папку - - - Select which directory you want to install to. - Выберите папку, в которую вы хотите установить. - - - Install All Queued to Selected Folder - Установить все из очереди в выбранную папку - - - Delete PKG File on Install - Удалить файл PKG при установке - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Открыть/Добавить папку Elf - - Install Packages (PKG) - Установить пакеты (PKG) - Boot Game Запустить игру @@ -1234,10 +1207,6 @@ Configure... Настроить... - - Install application from a .pkg file - Установить приложение из файла .pkg - Recent Games Недавние игры @@ -1307,8 +1276,12 @@ Дамп списка игр - PKG Viewer - Просмотр PKG + Trophy Viewer + Просмотр трофеев + + + No games found. Please add your games to your library first. + Не найдено ни одной игры. Пожалуйста, сначала добавьте игры в библиотеку. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Можно выбрать только один файл! - - PKG Extraction - Извлечение PKG - - - Patch detected! - Обнаружен патч! - - - PKG and Game versions match: - Версии PKG и игры совпадают: - - - Would you like to overwrite? - Хотите перезаписать? - - - PKG Version %1 is older than installed version: - Версия PKG %1 старше установленной версии: - - - Game is installed: - Игра установлена: - - - Would you like to install Patch: - Хотите установить патч: - - - DLC Installation - Установка DLC - - - Would you like to install DLC: %1? - Вы хотите установить DLC: %1? - - - DLC already installed: - DLC уже установлен: - - - Game already installed - Игра уже установлена - - - PKG ERROR - ОШИБКА PKG - - - Extracting PKG %1/%2 - Извлечение PKG %1/%2 - - - Extraction Finished - Извлечение завершено - - - Game successfully installed at %1 - Игра успешно установлена в %1 - - - File doesn't appear to be a valid PKG file - Файл не является допустимым файлом PKG - Run Game Запустить игру @@ -1490,14 +1399,6 @@ Eboot.bin file not found Файл eboot.bin не найден - - PKG File (*.PKG *.pkg) - Файл PKG (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - Выбранный PKG является патчем или DLC, пожалуйста, сначала установите игру! - Game is already running! Игра уже запущена! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Открыть папку + Play + Играть - PKG ERROR - ОШИБКА PKG + Pause + Пауза - Name - Название + Stop + Остановить - Serial - Серийный номер + Restart + Перезапустить - Installed - Установлено + Full Screen + Полный экран - Size - Размер + Controllers + Контроллеры - Category - Категория + Keyboard + Клавиатура - Type - Тип + Refresh List + Обновить список - App Ver - Версия приложения + Resume + Продолжить - FW - Прошивка - - - Region - Регион - - - Flags - Флаги - - - Path - Путь - - - File - Файл - - - Unknown - Неизвестно - - - Package - Пакет + Show Labels Under Icons + Показывать метки под значками @@ -1600,10 +1474,6 @@ Emulator Эмулятор - - Enable Separate Update Folder - Отдельная папка обновлений - Default tab when opening settings Вкладка по умолчанию при открытии настроек @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Язык эмулятора:\nУстанавливает язык пользовательского интерфейса эмулятора. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Отдельная папка обновлений:\nПозволяет устанавливать обновления игры в отдельную папку для удобства.\nМожно создать вручную, добавив извлеченное обновление в папку с игрой с именем "CUSA00000-UPDATE", где идентификатор CUSA совпадает с идентификатором игры. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Показывать заставку:\nОтображает заставку игры (специальное изображение) во время запуска. @@ -2191,6 +2057,10 @@ Trophy Viewer Просмотр трофеев + + Select Game: + Выберите игру: + Progress Прогресс diff --git a/src/qt_gui/translations/sq_AL.ts b/src/qt_gui/translations/sq_AL.ts index 3d1f1a222..311633a99 100644 --- a/src/qt_gui/translations/sq_AL.ts +++ b/src/qt_gui/translations/sq_AL.ts @@ -559,11 +559,11 @@ Restore Defaults - Restore Defaults + Rikthe Paracaktimet Cancel - Cancel + Anulo @@ -882,10 +882,6 @@ Error creating shortcut! Gabim në krijimin e shkurtores! - - Install PKG - Instalo PKG - Game Loja @@ -978,25 +974,6 @@ Caktimet e Tasteve - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Përzgjidh dosjen - - - Select which directory you want to install to. - Përzgjidh në cilën dosje do që të instalosh. - - - Install All Queued to Selected Folder - Instalo të gjitha të radhiturat në dosjen e zgjedhur - - - Delete PKG File on Install - Fshi skedarin PKG pas instalimit - - KBMSettings @@ -1193,19 +1170,19 @@ Save - Save + Ruaj Apply - Apply + Zbato Restore Defaults - Restore Defaults + Rikthe Paracaktimet Cancel - Cancel + Anulo @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Hap/Shto Dosje ELF - - Install Packages (PKG) - Instalo Paketat (PKG) - Boot Game Nis Lojën @@ -1234,10 +1207,6 @@ Configure... Konfiguro... - - Install application from a .pkg file - Instalo aplikacionin nga një skedar .pkg - Recent Games Lojërat e fundit @@ -1307,8 +1276,12 @@ Zbraz Listën e Lojërave - PKG Viewer - Shikuesi i PKG + Trophy Viewer + Shikuesi i Trofeve + + + No games found. Please add your games to your library first. + Nuk u gjetën lojëra. Shto lojërat në librarinë tënde fillimisht. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Mund të përzgjidhet vetëm një skedar! - - PKG Extraction - Nxjerrja e PKG-së - - - Patch detected! - U zbulua një arnë! - - - PKG and Game versions match: - PKG-ja dhe versioni i Lojës përputhen: - - - Would you like to overwrite? - Dëshiron të mbishkruash? - - - PKG Version %1 is older than installed version: - Versioni %1 i PKG-së është më i vjetër se versioni i instaluar: - - - Game is installed: - Loja është instaluar: - - - Would you like to install Patch: - Dëshiron të instalosh Arnën: - - - DLC Installation - Instalimi i DLC-ve - - - Would you like to install DLC: %1? - Dëshiron të instalosh DLC-në: %1? - - - DLC already installed: - DLC-ja është instaluar tashmë: - - - Game already installed - Loja është instaluar tashmë - - - PKG ERROR - GABIM PKG - - - Extracting PKG %1/%2 - Po nxirret PKG-ja %1/%2 - - - Extraction Finished - Nxjerrja Përfundoi - - - Game successfully installed at %1 - Loja u instalua me sukses në %1 - - - File doesn't appear to be a valid PKG file - Skedari nuk duket si skedar PKG i vlefshëm - Run Game Ekzekuto lojën @@ -1490,14 +1399,6 @@ Eboot.bin file not found Skedari Eboot.bin nuk u gjet - - PKG File (*.PKG *.pkg) - Skedar PKG (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG-ja është një arnë ose DLC, të lutem instalo lojën fillimisht! - Game is already running! Loja tashmë është duke u ekzekutuar! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Hap Dosjen + Play + Play - PKG ERROR - GABIM PKG + Pause + Pause - Name - Emri + Stop + Stop - Serial - Seriku + Restart + Restart - Installed - Instaluar + Full Screen + Full Screen - Size - Madhësia + Controllers + Controllers - Category - Kategoria + Keyboard + Keyboard - Type - Lloji + Refresh List + Refresh List - App Ver - Versioni i aplikacionit + Resume + Resume - FW - Firmueri - - - Region - Rajoni - - - Flags - Flamurët - - - Path - Shtegu - - - File - Skedari - - - Unknown - E panjohur - - - Package - Paketa + Show Labels Under Icons + Show Labels Under Icons @@ -1600,13 +1474,9 @@ Emulator Emulatori - - Enable Separate Update Folder - Aktivizo dosjen e ndarë të përditësimit - Default tab when opening settings - Skeda e parazgjedhur kur hapen cilësimet + Skeda e paracaktuar kur hapen cilësimet Show Game Size In List @@ -1850,7 +1720,7 @@ Restore Defaults - Rikthe paracaktimet + Rikthe Paracaktimet Close @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Gjuha e emulatorit:\nPërcakton gjuhën e ndërfaqes së përdoruesit të emulatorit. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Aktivizo dosjen e ndarë të përditësimit:\nAktivizon instalimin e përditësimeve të lojërave në dosje të veçanta për menaxhim më të lehtë.\nKjo mund të krijohet manualisht duke shtuar përditësimin e shpaketuar në dosjen e lojës me emrin "CUSA00000-UPDATE" ku ID-ja CUSA përputhet me ID-në e lojës. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Shfaq ekranin e ngarkesës:\nShfaq ekranin e ngarkesës së lojës (një pamje e veçantë) gjatë fillimit të lojës. @@ -2191,6 +2057,10 @@ Trophy Viewer Shikuesi i Trofeve + + Select Game: + Zgjidh Lojën: + Progress Ecuria diff --git a/src/qt_gui/translations/sv_SE.ts b/src/qt_gui/translations/sv_SE.ts index de3781414..ce0da785c 100644 --- a/src/qt_gui/translations/sv_SE.ts +++ b/src/qt_gui/translations/sv_SE.ts @@ -551,19 +551,19 @@ Save - Save + Spara Apply - Apply + Tillämpa Restore Defaults - Restore Defaults + Återställ till standard Cancel - Cancel + Avbryt @@ -882,10 +882,6 @@ Error creating shortcut! Fel vid skapandet av genväg! - - Install PKG - Installera PKG - Game Spel @@ -978,25 +974,6 @@ Tangentbindningar - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Välj katalog - - - Select which directory you want to install to. - Välj vilken katalog som du vill installera till. - - - Install All Queued to Selected Folder - Installera alla köade till markerad mapp - - - Delete PKG File on Install - Ta bort PKG-fil efter installation - - KBMSettings @@ -1193,19 +1170,19 @@ Save - Save + Spara Apply - Apply + Tillämpa Restore Defaults - Restore Defaults + Återställ till standard Cancel - Cancel + Avbryt @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Öppna/Lägg till Elf-mapp - - Install Packages (PKG) - Installera paket (PKG) - Boot Game Starta spel @@ -1234,10 +1207,6 @@ Configure... Konfigurera... - - Install application from a .pkg file - Installera program från en .pkg-fil - Recent Games Senaste spel @@ -1307,8 +1276,12 @@ Dumpa spellista - PKG Viewer - PKG-visare + Trophy Viewer + Trofévisare + + + No games found. Please add your games to your library first. + Inga spel hittades. Lägg till dina spel till biblioteket först. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Endast en fil kan väljas! - - PKG Extraction - PKG-extrahering - - - Patch detected! - Patch upptäcktes! - - - PKG and Game versions match: - PKG och spelversioner matchar: - - - Would you like to overwrite? - Vill du skriva över? - - - PKG Version %1 is older than installed version: - PKG-versionen %1 är äldre än installerad version: - - - Game is installed: - Spelet är installerat: - - - Would you like to install Patch: - Vill du installera patch: - - - DLC Installation - DLC-installation - - - Would you like to install DLC: %1? - Vill du installera DLC: %1? - - - DLC already installed: - DLC redan installerat: - - - Game already installed - Spelet redan installerat - - - PKG ERROR - PKG-FEL - - - Extracting PKG %1/%2 - Extraherar PKG %1/%2 - - - Extraction Finished - Extrahering färdig - - - Game successfully installed at %1 - Spelet installerades i %1 - - - File doesn't appear to be a valid PKG file - Filen verkar inte vara en giltig PKG-fil - Run Game Kör spel @@ -1490,14 +1399,6 @@ Eboot.bin file not found Filen eboot.bin hittades inte - - PKG File (*.PKG *.pkg) - PKG-fil (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG är en patch eller DLC. Installera spelet först! - Game is already running! Spelet är redan igång! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Öppna mapp + Play + Spela - PKG ERROR - PKG-FEL + Pause + Paus - Name - Namn + Stop + Stoppa - Serial - Serienummer + Restart + Starta om - Installed - Installerat + Full Screen + Helskärm - Size - Storlek + Controllers + Kontroller - Category - Kategori + Keyboard + Tangentbord - Type - Typ + Refresh List + Uppdatera lista - App Ver - Appver + Resume + Återuppta - FW - FW - - - Region - Region - - - Flags - Flaggor - - - Path - Sökväg - - - File - Arkiv - - - Unknown - Okänt - - - Package - Paket + Show Labels Under Icons + Visa etiketter under ikoner @@ -1600,10 +1474,6 @@ Emulator Emulator - - Enable Separate Update Folder - Aktivera separat uppdateringsmapp - Default tab when opening settings Standardflik när inställningar öppnas @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Emulatorspråk:\nStäller in språket för emulatorns användargränssnitt - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Aktivera separat uppdateringsmapp:\nAktiverar installation av speluppdateringar i en separat mapp för enkel hantering.\nDetta kan skapas manuellt genom att lägga till uppackad uppdatering till spelmappen med namnet "CUSA00000-UPDATE" där CUSA ID matchar spelets id - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Visa startskärm:\nVisar spelets startskärm (en speciell bild) när spelet startas @@ -2191,6 +2057,10 @@ Trophy Viewer Trofé-visare + + Select Game: + Välj spel: + Progress Förlopp diff --git a/src/qt_gui/translations/tr_TR.ts b/src/qt_gui/translations/tr_TR.ts index fd4669369..f5f7b65e5 100644 --- a/src/qt_gui/translations/tr_TR.ts +++ b/src/qt_gui/translations/tr_TR.ts @@ -26,11 +26,11 @@ Cheats/Patches are experimental.\nUse with caution.\n\nDownload cheats individually by selecting the repository and clicking the download button.\nIn the Patches tab, you can download all patches at once, choose which ones you want to use, and save your selection.\n\nSince we do not develop the Cheats/Patches,\nplease report issues to the cheat author.\n\nCreated a new cheat? Visit:\n - Cheats/Patches deneysel niteliktedir.\nDikkatli kullanın.\n\nCheat'leri ayrı ayrı indirerek, depo seçerek ve indirme düğmesine tıklayarak indirin.\nPatches sekmesinde tüm patch'leri bir kerede indirebilir, hangi patch'leri kullanmak istediğinizi seçebilir ve seçiminizi kaydedebilirsiniz.\n\nCheats/Patches'i geliştirmediğimiz için,\nproblemleri cheat yazarına bildirin.\n\nYeni bir cheat mi oluşturduğunuz? Şu adresi ziyaret edin:\n + Hileler/Yamalar deneysel özelliklerdir.\nDikkatli kullanın.\n\nHileleri depo seçerek ve indirme düğmesine tıklayarak ayrı ayrı indirin.\nYamalar sekmesinde tüm yamaları tek seferde indirebilir, hangi yamaları kullanmak istediğinizi seçebilir ve seçiminizi kaydedebilirsiniz.\n\nHileleri ve yamaları biz geliştirmediğimiz için\nsorunlarınızı hile geliştiricisine bildirin.\n\nYeni bir hile oluşturduysanız şu adresi ziyaret edin:\n No Image Available - Görüntü Mevcut Değil + Kaynak Mevcut Değil Serial: @@ -70,7 +70,7 @@ Do you want to delete the selected file?\n%1 - Seçilen dosyayı silmek istiyor musunuz?\n%1 + Seçili dosyayı silmek istiyor musunuz?\n%1 Select Patch File: @@ -122,7 +122,7 @@ Success - Başarı + Başarılı Options saved successfully. @@ -138,11 +138,11 @@ File Exists - Dosya Var + Dosya mevcut File already exists. Do you want to replace it? - Dosya zaten var. Üzerine yazmak ister misiniz? + Dosya zaten mevcut. Var olan dosyayı değiştirmek istiyor musunuz? Failed to save file: @@ -313,7 +313,7 @@ Update - Güncelleme + Güncelle No @@ -551,26 +551,26 @@ Save - Save + Kaydet Apply - Apply + Uygula Restore Defaults - Restore Defaults + Varsayılanlara Sıfırla Cancel - Cancel + İptal EditorDialog Edit Keyboard + Mouse and Controller input bindings - Edit Keyboard + Mouse and Controller input bindings + Klavye + Fare ve Kontrolcü tuş atamalarını düzenle Use Per-Game configs @@ -882,10 +882,6 @@ Error creating shortcut! Kısayol oluşturulurken hata oluştu! - - Install PKG - PKG Yükle - Game Oyun @@ -978,25 +974,6 @@ Tuş Atamaları - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Klasörü Seç - - - Select which directory you want to install to. - Hangi dizine yüklemek istediğinizi seçin. - - - Install All Queued to Selected Folder - Tüm Kuyruktakileri Seçili Klasöre Yükle - - - Delete PKG File on Install - Yüklemede PKG Dosyasını Sil - - KBMSettings @@ -1141,7 +1118,7 @@ Speed Offset (def 0.125): - Speed Offset (def 0.125): + Hız Sapması (varsayılan 0.125): Copy from Common Config @@ -1149,7 +1126,7 @@ Deadzone Offset (def 0.50): - Deadzone Offset (def 0.50): + Ölü Bölge Sapması (varsayılan 0.50): Speed Multiplier (def 1.0): @@ -1161,7 +1138,7 @@ This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config. - This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config. + Bu tuş, Ortak Yapılandırma'daki atamaları seçili profile kopyalar ve seçili profil Ortak Yapılandırma ise kullanılamaz. Copy values from Common Config @@ -1193,19 +1170,19 @@ Save - Save + Kaydet Apply - Apply + Uygula Restore Defaults - Restore Defaults + Varsayılanlara Sıfırla Cancel - Cancel + İptal @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Elf Klasörü Aç/Ekle - - Install Packages (PKG) - Paketleri Kur (PKG) - Boot Game Oyunu Başlat @@ -1234,10 +1207,6 @@ Configure... Yapılandır... - - Install application from a .pkg file - .pkg dosyasından uygulama yükle - Recent Games Son Oyunlar @@ -1307,8 +1276,12 @@ Oyun Listesini Kaydet - PKG Viewer - PKG Görüntüleyici + Trophy Viewer + Kupa Görüntüleyici + + + No games found. Please add your games to your library first. + Oyun bulunamadı. Oyunlarınızı lütfen önce kütüphanenize ekleyin. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Sadece bir dosya seçilebilir! - - PKG Extraction - PKG Çıkartma - - - Patch detected! - Yama tespit edildi! - - - PKG and Game versions match: - PKG ve oyun sürümleri uyumlu: - - - Would you like to overwrite? - Üzerine yazmak ister misiniz? - - - PKG Version %1 is older than installed version: - PKG Sürümü %1, kurulu sürümden daha eski: - - - Game is installed: - Oyun yüklendi: - - - Would you like to install Patch: - Yamanın yüklenmesini ister misiniz: - - - DLC Installation - DLC Yükleme - - - Would you like to install DLC: %1? - DLC'yi yüklemek ister misiniz: %1? - - - DLC already installed: - DLC zaten yüklü: - - - Game already installed - Oyun zaten yüklü - - - PKG ERROR - PKG HATASI - - - Extracting PKG %1/%2 - PKG Çıkarılıyor %1/%2 - - - Extraction Finished - Çıkarma Tamamlandı - - - Game successfully installed at %1 - Oyun başarıyla %1 konumuna yüklendi - - - File doesn't appear to be a valid PKG file - Dosya geçerli bir PKG dosyası gibi görünmüyor - Run Game Oyunu Çalıştır @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin dosyası bulunamadı - - PKG File (*.PKG *.pkg) - PKG Dosyası (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG bir yama ya da DLC, lütfen önce oyunu yükleyin! - Game is already running! Oyun zaten çalışıyor! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Klasörü Aç + Play + Başlat - PKG ERROR - PKG HATASI + Pause + Duraklat - Name - Ad + Stop + Durdur - Serial - Seri Numarası + Restart + Yeniden Başlat - Installed - Yüklü + Full Screen + Tam Ekran - Size - Boyut + Controllers + Kontrolcüler - Category - Kategori + Keyboard + Klavye - Type - Tür + Refresh List + Listeyi Yenile - App Ver - Uygulama Sürümü + Resume + Devam Et - FW - Sistem Yazılımı - - - Region - Bölge - - - Flags - Bayraklar - - - Path - Yol - - - File - Dosya - - - Unknown - Bilinmeyen - - - Package - Paket + Show Labels Under Icons + Simgelerin Altında Etiketleri Göster @@ -1600,10 +1474,6 @@ Emulator Emülatör - - Enable Separate Update Folder - Ayrı Güncelleme Klasörünü Etkinleştir - Default tab when opening settings Ayarlar açıldığında varsayılan sekme @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Emülatör Dili:\nEmülatörün kullanıcı arayüzünün dilini ayarlar. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Açılış Ekranını Göster:\nOyun açılırken (özel bir görüntü) açılış ekranını gösterir. @@ -2030,7 +1896,7 @@ Host Debug Markers:\nInserts emulator-side information like markers for specific AMDGPU commands around Vulkan commands, as well as giving resources debug names.\nIf you have this enabled, you should enable Crash Diagnostics.\nUseful for programs like RenderDoc. - Host Debug Markers:\nInserts emulator-side information like markers for specific AMDGPU commands around Vulkan commands, as well as giving resources debug names.\nIf you have this enabled, you should enable Crash Diagnostics.\nUseful for programs like RenderDoc. + Ana Bilgisayar Hata Ayıklama Göstergeleri:\nVulkan komutlarının etrafına belirli AMDGPU komutları için göstergeler gibi emülatör tarafı bilgileri ekler ve kaynaklara hata ayıklama adları verir.\nBunu etkinleştirdiyseniz, Çökme Tanılamaları'nı etkinleştirmelisiniz.\nRenderDoc gibi programlar için faydalıdır. Guest Debug Markers:\nInserts any debug markers the game itself has added to the command buffer.\nIf you have this enabled, you should enable Crash Diagnostics.\nUseful for programs like RenderDoc. @@ -2191,6 +2057,10 @@ Trophy Viewer Kupa Görüntüleyici + + Select Game: + Oyun Seç: + Progress İlerleme diff --git a/src/qt_gui/translations/uk_UA.ts b/src/qt_gui/translations/uk_UA.ts index 1c074be6a..3eb88bcab 100644 --- a/src/qt_gui/translations/uk_UA.ts +++ b/src/qt_gui/translations/uk_UA.ts @@ -551,19 +551,19 @@ Save - Save + Зберегти Apply - Apply + Застосувати Restore Defaults - Restore Defaults + За замовчуванням Cancel - Cancel + Відмінити @@ -882,10 +882,6 @@ Error creating shortcut! Помилка при створенні ярлика! - - Install PKG - Встановити PKG - Game гри @@ -978,25 +974,6 @@ Призначення клавіш - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Виберіть папку - - - Select which directory you want to install to. - Виберіть папку, до якої ви хочете встановити. - - - Install All Queued to Selected Folder - Встановити все з черги до вибраної папки - - - Delete PKG File on Install - Видалити файл PKG під час встановлення - - KBMSettings @@ -1193,19 +1170,19 @@ Save - Save + Зберегти Apply - Apply + Застосувати Restore Defaults - Restore Defaults + За замовчуванням Cancel - Cancel + Відмінити @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Відкрити/Додати папку Elf - - Install Packages (PKG) - Встановити пакети (PKG) - Boot Game Запустити гру @@ -1234,10 +1207,6 @@ Configure... Налаштувати... - - Install application from a .pkg file - Встановити додаток з файлу .pkg - Recent Games Нещодавні ігри @@ -1307,8 +1276,12 @@ Дамп списку ігор - PKG Viewer - Перегляд PKG + Trophy Viewer + Переглядач трофеїв + + + No games found. Please add your games to your library first. + Не знайдено жодної гри. Будь ласка, спочатку додайте свої ігри до бібліотеки. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Можна вибрати лише один файл! - - PKG Extraction - Розпакування PKG - - - Patch detected! - Виявлено патч! - - - PKG and Game versions match: - Версії PKG та гри збігаються: - - - Would you like to overwrite? - Бажаєте перезаписати? - - - PKG Version %1 is older than installed version: - Версія PKG %1 старіша за встановлену версію: - - - Game is installed: - Встановлена гра: - - - Would you like to install Patch: - Бажаєте встановити патч: - - - DLC Installation - Встановлення DLC - - - Would you like to install DLC: %1? - Ви бажаєте встановити DLC: %1? - - - DLC already installed: - DLC вже встановлено: - - - Game already installed - Гра вже встановлена - - - PKG ERROR - ПОМИЛКА PKG - - - Extracting PKG %1/%2 - Витягування PKG %1/%2 - - - Extraction Finished - Розпакування завершено - - - Game successfully installed at %1 - Гру успішно встановлено у %1 - - - File doesn't appear to be a valid PKG file - Файл не є дійсним PKG-файлом - Run Game Запустити гру @@ -1490,14 +1399,6 @@ Eboot.bin file not found Файл Boot.bin не знайдено - - PKG File (*.PKG *.pkg) - Файл PKG (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG - це патч або DLC, будь ласка, спочатку встановіть гру! - Game is already running! Гра вже запущена! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Відкрити папку + Play + Грати - PKG ERROR - ПОМИЛКА PKG + Pause + Пауза - Name - Назва + Stop + Стоп - Serial - Серійний номер + Restart + Перезапуск - Installed - Встановлені + Full Screen + На повний екран - Size - Розмір + Controllers + Контролери - Category - Категорія + Keyboard + Клавіатура - Type - Тип + Refresh List + Оновити список - App Ver - Версія додатку + Resume + Продовжити - FW - ПЗ - - - Region - Регіон - - - Flags - Мітки - - - Path - Шлях - - - File - Файл - - - Unknown - Невідомо - - - Package - Пакет + Show Labels Under Icons + Показати найменування під іконками @@ -1600,10 +1474,6 @@ Emulator Емулятор - - Enable Separate Update Folder - Увімкнути окрему папку оновлень - Default tab when opening settings Вкладка за замовчуванням при відкритті налаштувань @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Мова емулятора:\nВстановіть мову користувацького інтерфейсу емулятора. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Окрема папка для оновлень:\nДає змогу встановлювати оновлення гри в окрему папку для зручності. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Показувати заставку:\nВідображає заставку гри (спеціальне зображення) під час запуску гри. @@ -2191,6 +2057,10 @@ Trophy Viewer Трофеї + + Select Game: + Виберіть гру: + Progress Прогрес diff --git a/src/qt_gui/translations/vi_VN.ts b/src/qt_gui/translations/vi_VN.ts index 8fa0889bc..e0bc7e4fe 100644 --- a/src/qt_gui/translations/vi_VN.ts +++ b/src/qt_gui/translations/vi_VN.ts @@ -882,10 +882,6 @@ Error creating shortcut! Error creating shortcut! - - Install PKG - Install PKG - Game Game @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Choose directory - - - Select which directory you want to install to. - Select which directory you want to install to. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Open/Add Elf Folder - - Install Packages (PKG) - Install Packages (PKG) - Boot Game Boot Game @@ -1234,10 +1207,6 @@ Configure... Configure... - - Install application from a .pkg file - Install application from a .pkg file - Recent Games Recent Games @@ -1307,8 +1276,12 @@ Dump Game List - PKG Viewer - PKG Viewer + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! Chỉ có thể chọn một tệp duy nhất! - - PKG Extraction - Giải nén PKG - - - Patch detected! - Đã phát hiện bản vá! - - - PKG and Game versions match: - Các phiên bản PKG và trò chơi khớp nhau: - - - Would you like to overwrite? - Bạn có muốn ghi đè không? - - - PKG Version %1 is older than installed version: - Phiên bản PKG %1 cũ hơn phiên bản đã cài đặt: - - - Game is installed: - Trò chơi đã được cài đặt: - - - Would you like to install Patch: - Bạn có muốn cài đặt bản vá: - - - DLC Installation - Cài đặt DLC - - - Would you like to install DLC: %1? - Bạn có muốn cài đặt DLC: %1? - - - DLC already installed: - DLC đã được cài đặt: - - - Game already installed - Trò chơi đã được cài đặt - - - PKG ERROR - LOI PKG - - - Extracting PKG %1/%2 - Đang giải nén PKG %1/%2 - - - Extraction Finished - Giải nén hoàn tất - - - Game successfully installed at %1 - Trò chơi đã được cài đặt thành công tại %1 - - - File doesn't appear to be a valid PKG file - Tệp không có vẻ là tệp PKG hợp lệ - Run Game Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin file not found - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! Game is already running! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Open Folder + Play + Play - PKG ERROR - LOI PKG + Pause + Pause - Name - Tên + Stop + Stop - Serial - Số seri + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - Kích thước + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - Khu vực - - - Flags - Flags - - - Path - Đường dẫn - - - File - File - - - Unknown - Không xác định - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Trình giả lập - - Enable Separate Update Folder - Bật thư mục cập nhật riêng - Default tab when opening settings Tab mặc định khi mở cài đặt @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. Ngôn ngữ của trình giả lập:\nChọn ngôn ngữ của giao diện người dùng của trình giả lập. - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. Hiển thị màn hình khởi động:\nHiển thị màn hình khởi động của trò chơi (một hình ảnh đặc biệt) trong khi trò chơi khởi động. @@ -2191,6 +2057,10 @@ Trophy Viewer Trình xem chiến tích + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/translations/zh_CN.ts b/src/qt_gui/translations/zh_CN.ts index 80b322112..120310810 100644 --- a/src/qt_gui/translations/zh_CN.ts +++ b/src/qt_gui/translations/zh_CN.ts @@ -882,10 +882,6 @@ Error creating shortcut! 创建快捷方式出错! - - Install PKG - 安装 PKG - Game 游戏 @@ -978,25 +974,6 @@ 按键绑定 - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - 选择文件目录 - - - Select which directory you want to install to. - 选择您想要安装到的目录。 - - - Install All Queued to Selected Folder - 安装所有 PKG 到选定的文件夹 - - - Delete PKG File on Install - 安装后删除 PKG 文件 - - KBMSettings @@ -1105,7 +1082,7 @@ note: click Help Button/Special Keybindings for more information - 注意:点击帮助按钮 -> Special Bindings 获取更多信息 + 注意:点击帮助按钮 -> 获取更多关于映射特殊键位的信息 Face Buttons @@ -1214,10 +1191,6 @@ Open/Add Elf Folder 打开/添加 Elf 文件夹 - - Install Packages (PKG) - 安装 Packages (PKG) - Boot Game 启动游戏 @@ -1234,10 +1207,6 @@ Configure... 设置... - - Install application from a .pkg file - 从 .pkg 文件安装应用程序 - Recent Games 最近启动的游戏 @@ -1307,8 +1276,12 @@ 导出游戏列表 - PKG Viewer - PKG 查看器 + Trophy Viewer + 奖杯查看器 + + + No games found. Please add your games to your library first. + 未找到游戏。请先将您的游戏添加到您的资料库。 Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! 只能选择一个文件! - - PKG Extraction - PKG 解压 - - - Patch detected! - 检测到补丁! - - - PKG and Game versions match: - PKG 和游戏版本匹配: - - - Would you like to overwrite? - 您想要覆盖吗? - - - PKG Version %1 is older than installed version: - PKG 版本 %1 比已安装版本更旧: - - - Game is installed: - 游戏已安装: - - - Would you like to install Patch: - 您想安装补丁吗: - - - DLC Installation - DLC 安装 - - - Would you like to install DLC: %1? - 您想安装 DLC:%1 吗? - - - DLC already installed: - DLC 已经安装: - - - Game already installed - 游戏已经安装 - - - PKG ERROR - PKG 错误 - - - Extracting PKG %1/%2 - 正在解压 PKG %1/%2 - - - Extraction Finished - 解压完成 - - - Game successfully installed at %1 - 游戏成功安装在 %1 - - - File doesn't appear to be a valid PKG file - 文件似乎不是有效的 PKG 文件 - Run Game 运行游戏 @@ -1490,14 +1399,6 @@ Eboot.bin file not found 找不到 Eboot.bin 文件 - - PKG File (*.PKG *.pkg) - PKG 文件(*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG是一个补丁或 DLC,请先安装游戏! - Game is already running! 游戏已经在运行中! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - 打开文件夹 + Play + 开始游戏 - PKG ERROR - PKG 错误 + Pause + 暂停 - Name - 名称 + Stop + 关闭 - Serial - 序列号 + Restart + 重新启动 - Installed - 已安装 + Full Screen + 全屏 - Size - 大小 + Controllers + 控制器 - Category - 分类 + Keyboard + 键盘 - Type - 类型 + Refresh List + 刷新列表 - App Ver - 版本 + Resume + 继续游戏 - FW - 固件 - - - Region - 区域 - - - Flags - 标志 - - - Path - 路径 - - - File - 文件 - - - Unknown - 未知 - - - Package - Package + Show Labels Under Icons + 显示图标下的标签 @@ -1600,10 +1474,6 @@ Emulator 模拟器 - - Enable Separate Update Folder - 启用单独的更新目录 - Default tab when opening settings 打开设置时的默认选项卡 @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. 模拟器语言:\n设置模拟器用户界面的语言。 - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - 启用单独的更新目录:\n启用安装游戏更新到一个单独的目录中以更便于管理。 - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. 显示启动画面:\n在游戏启动时显示游戏的启动画面(特殊图像)。 @@ -2191,6 +2057,10 @@ Trophy Viewer 奖杯查看器 + + Select Game: + 选择游戏: + Progress 进度 diff --git a/src/qt_gui/translations/zh_TW.ts b/src/qt_gui/translations/zh_TW.ts index 2950f541f..077455558 100644 --- a/src/qt_gui/translations/zh_TW.ts +++ b/src/qt_gui/translations/zh_TW.ts @@ -407,7 +407,7 @@ ControlSettings Configure Controls - Configure Controls + 操控設定 D-Pad @@ -519,7 +519,7 @@ Color Adjustment - Color Adjustment + 色彩調整 R: @@ -543,7 +543,7 @@ Unable to Save - Unable to Save + 無法保存 Cannot bind axis values more than once @@ -551,11 +551,11 @@ Save - Save + 保存 Apply - Apply + 套用 Restore Defaults @@ -563,7 +563,7 @@ Cancel - Cancel + 取消 @@ -578,7 +578,7 @@ Error - Error + 錯誤 Could not open the file for reading @@ -590,7 +590,7 @@ Save Changes - Save Changes + 儲存變更 Do you want to save changes? @@ -882,10 +882,6 @@ Error creating shortcut! Error creating shortcut! - - Install PKG - Install PKG - Game Game @@ -978,25 +974,6 @@ Keybindings - - InstallDirSelect - - shadPS4 - Choose directory - shadPS4 - Choose directory - - - Select which directory you want to install to. - Select which directory you want to install to. - - - Install All Queued to Selected Folder - Install All Queued to Selected Folder - - - Delete PKG File on Install - Delete PKG File on Install - - KBMSettings @@ -1214,10 +1191,6 @@ Open/Add Elf Folder Open/Add Elf Folder - - Install Packages (PKG) - Install Packages (PKG) - Boot Game Boot Game @@ -1234,10 +1207,6 @@ Configure... Configure... - - Install application from a .pkg file - Install application from a .pkg file - Recent Games Recent Games @@ -1307,8 +1276,12 @@ Dump Game List - PKG Viewer - PKG Viewer + Trophy Viewer + Trophy Viewer + + + No games found. Please add your games to your library first. + No games found. Please add your games to your library first. Search... @@ -1418,70 +1391,6 @@ Only one file can be selected! 只能選擇一個檔案! - - PKG Extraction - PKG 解壓縮 - - - Patch detected! - 檢測到補丁! - - - PKG and Game versions match: - PKG 和遊戲版本匹配: - - - Would you like to overwrite? - 您想要覆蓋嗎? - - - PKG Version %1 is older than installed version: - PKG 版本 %1 比已安裝版本更舊: - - - Game is installed: - 遊戲已安裝: - - - Would you like to install Patch: - 您想要安裝補丁嗎: - - - DLC Installation - DLC 安裝 - - - Would you like to install DLC: %1? - 您想要安裝 DLC: %1 嗎? - - - DLC already installed: - DLC 已經安裝: - - - Game already installed - 遊戲已經安裝 - - - PKG ERROR - PKG 錯誤 - - - Extracting PKG %1/%2 - 正在解壓縮 PKG %1/%2 - - - Extraction Finished - 解壓縮完成 - - - Game successfully installed at %1 - 遊戲成功安裝於 %1 - - - File doesn't appear to be a valid PKG file - 檔案似乎不是有效的 PKG 檔案 - Run Game Run Game @@ -1490,14 +1399,6 @@ Eboot.bin file not found Eboot.bin file not found - - PKG File (*.PKG *.pkg) - PKG File (*.PKG *.pkg) - - - PKG is a patch or DLC, please install the game first! - PKG is a patch or DLC, please install the game first! - Game is already running! Game is already running! @@ -1506,72 +1407,45 @@ shadPS4 shadPS4 - - - PKGViewer - Open Folder - Open Folder + Play + Play - PKG ERROR - PKG 錯誤 + Pause + Pause - Name - 名稱 + Stop + Stop - Serial - 序號 + Restart + Restart - Installed - Installed + Full Screen + Full Screen - Size - 大小 + Controllers + Controllers - Category - Category + Keyboard + Keyboard - Type - Type + Refresh List + Refresh List - App Ver - App Ver + Resume + Resume - FW - FW - - - Region - 區域 - - - Flags - Flags - - - Path - 路徑 - - - File - File - - - Unknown - 未知 - - - Package - Package + Show Labels Under Icons + Show Labels Under Icons @@ -1600,10 +1474,6 @@ Emulator Emulator - - Enable Separate Update Folder - Enable Separate Update Folder - Default tab when opening settings 打開設置時的默認選項卡 @@ -1868,10 +1738,6 @@ Emulator Language:\nSets the language of the emulator's user interface. 模擬器語言:\n設定模擬器的用戶介面的語言。 - - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management.\nThis can be manually created by adding the extracted update to the game folder with the name "CUSA00000-UPDATE" where the CUSA ID matches the game's ID. - Enable Separate Update Folder:\nEnables installing game updates into a separate folder for easy management. - Show Splash Screen:\nShows the game's splash screen (a special image) while the game is starting. 顯示啟動畫面:\n在遊戲啟動時顯示遊戲的啟動畫面(特殊圖片)。 @@ -2191,6 +2057,10 @@ Trophy Viewer Trophy Viewer + + Select Game: + Select Game: + Progress Progress diff --git a/src/qt_gui/trophy_viewer.cpp b/src/qt_gui/trophy_viewer.cpp index bfa47e3cc..bed487605 100644 --- a/src/qt_gui/trophy_viewer.cpp +++ b/src/qt_gui/trophy_viewer.cpp @@ -104,8 +104,10 @@ void TrophyViewer::updateTableFilters() { } } -TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath) : QMainWindow() { - this->setWindowTitle(tr("Trophy Viewer")); +TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath, QString gameName, + const QVector& allTrophyGames) + : QMainWindow(), allTrophyGames_(allTrophyGames), currentGameName_(gameName) { + this->setWindowTitle(tr("Trophy Viewer") + " - " + currentGameName_); this->setAttribute(Qt::WA_DeleteOnClose); tabWidget = new QTabWidget(this); @@ -127,11 +129,40 @@ TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath) : QMainWindo << "PID"; PopulateTrophyWidget(trophyPath); - QDockWidget* trophyInfoDock = new QDockWidget("", this); + trophyInfoDock = new QDockWidget("", this); QWidget* dockWidget = new QWidget(trophyInfoDock); QVBoxLayout* dockLayout = new QVBoxLayout(dockWidget); dockLayout->setAlignment(Qt::AlignTop); + // ComboBox for game selection + if (!allTrophyGames_.isEmpty()) { + QLabel* gameSelectionLabel = new QLabel(tr("Select Game:"), dockWidget); + dockLayout->addWidget(gameSelectionLabel); + + gameSelectionComboBox = new QComboBox(dockWidget); + for (const auto& game : allTrophyGames_) { + gameSelectionComboBox->addItem(game.name); + } + + // Select current game in ComboBox + if (!currentGameName_.isEmpty()) { + int index = gameSelectionComboBox->findText(currentGameName_); + if (index >= 0) { + gameSelectionComboBox->setCurrentIndex(index); + } + } + + dockLayout->addWidget(gameSelectionComboBox); + + connect(gameSelectionComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, + &TrophyViewer::onGameSelectionChanged); + + QFrame* line = new QFrame(dockWidget); + line->setFrameShape(QFrame::HLine); + line->setFrameShadow(QFrame::Sunken); + dockLayout->addWidget(line); + } + trophyInfoLabel = new QLabel(tr("Progress") + ": 0% (0/0)", dockWidget); trophyInfoLabel->setStyleSheet( "font-weight: bold; font-size: 16px; color: white; background: #333; padding: 5px;"); @@ -162,7 +193,7 @@ TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath) : QMainWindo expandButton->setGeometry(80, 0, 27, 27); expandButton->hide(); - connect(expandButton, &QPushButton::clicked, this, [this, trophyInfoDock] { + connect(expandButton, &QPushButton::clicked, this, [this] { trophyInfoDock->setVisible(true); expandButton->hide(); }); @@ -184,13 +215,13 @@ TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath) : QMainWindo updateTrophyInfo(); updateTableFilters(); - connect(trophyInfoDock, &QDockWidget::topLevelChanged, this, [this, trophyInfoDock] { + connect(trophyInfoDock, &QDockWidget::topLevelChanged, this, [this] { if (!trophyInfoDock->isVisible()) { expandButton->show(); } }); - connect(trophyInfoDock, &QDockWidget::visibilityChanged, this, [this, trophyInfoDock] { + connect(trophyInfoDock, &QDockWidget::visibilityChanged, this, [this] { if (!trophyInfoDock->isVisible()) { expandButton->show(); } else { @@ -199,6 +230,29 @@ TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath) : QMainWindo }); } +void TrophyViewer::onGameSelectionChanged(int index) { + if (index < 0 || index >= allTrophyGames_.size()) { + return; + } + + while (tabWidget->count() > 0) { + QWidget* widget = tabWidget->widget(0); + tabWidget->removeTab(0); + delete widget; + } + + const TrophyGameInfo& selectedGame = allTrophyGames_[index]; + currentGameName_ = selectedGame.name; + gameTrpPath_ = selectedGame.gameTrpPath; + + this->setWindowTitle(tr("Trophy Viewer") + " - " + currentGameName_); + + PopulateTrophyWidget(selectedGame.trophyPath); + + updateTrophyInfo(); + updateTableFilters(); +} + void TrophyViewer::onDockClosed() { if (!trophyInfoDock->isVisible()) { reopenButton->setVisible(true); @@ -389,13 +443,15 @@ void TrophyViewer::PopulateTrophyWidget(QString title) { tabWidget->addTab(tableWidget, tabName.insert(6, " ").replace(0, 1, tabName.at(0).toUpper())); - this->resize(width + 400, 720); - QSize mainWindowSize = QApplication::activeWindow()->size(); - this->resize(mainWindowSize.width() * 0.8, mainWindowSize.height() * 0.8); + if (!this->isMaximized()) { + this->resize(width + 400, 720); + QSize mainWindowSize = QApplication::activeWindow()->size(); + this->resize(mainWindowSize.width() * 0.8, mainWindowSize.height() * 0.8); + } this->show(); tableWidget->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Fixed); - tableWidget->setColumnWidth(3, 650); + tableWidget->setColumnWidth(3, 500); } this->setCentralWidget(tabWidget); } diff --git a/src/qt_gui/trophy_viewer.h b/src/qt_gui/trophy_viewer.h index 75fb500e7..c63171774 100644 --- a/src/qt_gui/trophy_viewer.h +++ b/src/qt_gui/trophy_viewer.h @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -12,26 +13,38 @@ #include #include #include +#include #include #include #include #include +#include #include #include "common/types.h" #include "core/file_format/trp.h" +struct TrophyGameInfo { + QString name; + QString trophyPath; + QString gameTrpPath; +}; + class TrophyViewer : public QMainWindow { Q_OBJECT public: - explicit TrophyViewer(QString trophyPath, QString gameTrpPath); + explicit TrophyViewer( + QString trophyPath, QString gameTrpPath, QString gameName = "", + const QVector& allTrophyGames = QVector()); void updateTrophyInfo(); - void updateTableFilters(); void onDockClosed(); void reopenLeftDock(); +private slots: + void onGameSelectionChanged(int index); + private: void PopulateTrophyWidget(QString title); void SetTableItem(QTableWidget* parent, int row, int column, QString str); @@ -39,14 +52,17 @@ private: QTabWidget* tabWidget = nullptr; QStringList headers; QString gameTrpPath_; + QString currentGameName_; TRP trp; QLabel* trophyInfoLabel; QCheckBox* showEarnedCheck; QCheckBox* showNotEarnedCheck; QCheckBox* showHiddenCheck; + QComboBox* gameSelectionComboBox; QPushButton* expandButton; QDockWidget* trophyInfoDock; QPushButton* reopenButton; + QVector allTrophyGames_; std::string GetTrpType(const QChar trp_) { switch (trp_.toLatin1()) { diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index 80d196147..fcdde7240 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -11,6 +11,7 @@ #include "common/config.h" #include "common/elf_info.h" #include "common/version.h" +#include "core/debug_state.h" #include "core/libraries/kernel/time.h" #include "core/libraries/pad/pad.h" #include "imgui/renderer/imgui_core.h" @@ -396,6 +397,25 @@ void WindowSDL::WaitEvent() { case SDL_EVENT_QUIT: is_open = false; break; + case SDL_EVENT_TOGGLE_FULLSCREEN: { + if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) { + SDL_SetWindowFullscreen(window, 0); + } else { + SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN); + } + break; + } + case SDL_EVENT_TOGGLE_PAUSE: + SDL_Log("Received SDL_EVENT_TOGGLE_PAUSE"); + + if (DebugState.IsGuestThreadsPaused()) { + SDL_Log("Game Resumed"); + DebugState.ResumeGuestThreads(); + } else { + SDL_Log("Game Paused"); + DebugState.PauseGuestThreads(); + } + break; default: break; } diff --git a/src/sdl_window.h b/src/sdl_window.h index 03ba0797b..48a9be58c 100644 --- a/src/sdl_window.h +++ b/src/sdl_window.h @@ -7,6 +7,8 @@ #include "core/libraries/pad/pad.h" #include "input/controller.h" #include "string" +#define SDL_EVENT_TOGGLE_FULLSCREEN (SDL_EVENT_USER + 1) +#define SDL_EVENT_TOGGLE_PAUSE (SDL_EVENT_USER + 2) struct SDL_Window; struct SDL_Gamepad; diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp index e2d702389..9f8784797 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp @@ -236,7 +236,7 @@ Id EmitFindILsb64(EmitContext& ctx, Id value) { const Id hi{ctx.OpCompositeExtract(ctx.U32[1], unpacked, 1U)}; const Id lo_lsb{ctx.OpFindILsb(ctx.U32[1], lo)}; const Id hi_lsb{ctx.OpFindILsb(ctx.U32[1], hi)}; - const Id found_lo{ctx.OpINotEqual(ctx.U32[1], lo_lsb, ctx.ConstU32(u32(-1)))}; + const Id found_lo{ctx.OpINotEqual(ctx.U1[1], lo_lsb, ctx.ConstU32(u32(-1)))}; return ctx.OpSelect(ctx.U32[1], found_lo, lo_lsb, hi_lsb); } diff --git a/src/shader_recompiler/frontend/control_flow_graph.cpp b/src/shader_recompiler/frontend/control_flow_graph.cpp index 126cb4eb6..cf1882b8c 100644 --- a/src/shader_recompiler/frontend/control_flow_graph.cpp +++ b/src/shader_recompiler/frontend/control_flow_graph.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include +#include #include "common/assert.h" #include "shader_recompiler/frontend/control_flow_graph.h" @@ -39,9 +40,6 @@ static IR::Condition MakeCondition(const GcnInst& inst) { return IR::Condition::Execz; case Opcode::S_CBRANCH_EXECNZ: return IR::Condition::Execnz; - case Opcode::S_AND_SAVEEXEC_B64: - case Opcode::S_ANDN2_B64: - return IR::Condition::Execnz; default: return IR::Condition::True; } @@ -76,9 +74,9 @@ CFG::CFG(Common::ObjectPool& block_pool_, std::span inst_l index_to_pc.resize(inst_list.size() + 1); labels.reserve(LabelReserveSize); EmitLabels(); - EmitDivergenceLabels(); EmitBlocks(); LinkBlocks(); + SplitDivergenceScopes(); } void CFG::EmitLabels() { @@ -112,7 +110,7 @@ void CFG::EmitLabels() { std::ranges::sort(labels); } -void CFG::EmitDivergenceLabels() { +void CFG::SplitDivergenceScopes() { const auto is_open_scope = [](const GcnInst& inst) { // An open scope instruction is an instruction that modifies EXEC // but also saves the previous value to restore later. This indicates @@ -136,64 +134,97 @@ void CFG::EmitDivergenceLabels() { (inst.opcode == Opcode::S_ANDN2_B64 && inst.dst[0].field == OperandField::ExecLo); }; - // Since we will be adding new labels, avoid iterating those as well. - const size_t end_size = labels.size(); - for (u32 l = 0; l < end_size; l++) { - const Label start = labels[l]; - // Stop if we reached end of existing labels. - if (l == end_size - 1) { - break; - } - const Label end = labels[l + 1]; - const size_t end_index = GetIndex(end); - + for (auto blk = blocks.begin(); blk != blocks.end(); blk++) { + auto next_blk = std::next(blk); s32 curr_begin = -1; - s32 last_exec_idx = -1; - for (size_t index = GetIndex(start); index < end_index; index++) { + for (size_t index = blk->begin_index; index <= blk->end_index; index++) { const auto& inst = inst_list[index]; - if (curr_begin != -1) { - // Keep note of the last instruction that does not ignore exec, so we know where - // to end the divergence block without impacting trailing instructions that do. - if (!IgnoresExecMask(inst)) { - last_exec_idx = index; - } - // Consider a close scope on certain instruction types or at the last instruction - // before the next label. - if (is_close_scope(inst) || index == end_index - 1) { - // Only insert a scope if, since the open-scope instruction, there is at least - // one instruction that does not ignore exec. - if (index - curr_begin > 1 && last_exec_idx != -1) { - // Add a label to the instruction right after the open scope call. - // It is the start of a new basic block. - const auto& save_inst = inst_list[curr_begin]; - AddLabel(index_to_pc[curr_begin] + save_inst.length); - // Add a label to the close scope instruction. - // There are 3 cases where we need to close a scope. - // * Close scope instruction inside the block - // * Close scope instruction at the end of the block (cbranch or endpgm) - // * Normal instruction at the end of the block - // If the instruction we want to close the scope at is at the end of the - // block, we do not need to insert a new label. - if (last_exec_idx != end_index - 1) { - // Add the label after the last instruction affected by exec. - const auto& last_exec_inst = inst_list[last_exec_idx]; - AddLabel(index_to_pc[last_exec_idx] + last_exec_inst.length); - } - } - // Reset scope begin. + const bool is_close = is_close_scope(inst); + if ((is_close || index == blk->end_index) && curr_begin != -1) { + // If there are no instructions inside scope don't do anything. + if (index - curr_begin == 1) { curr_begin = -1; + continue; } + // If all instructions in the scope ignore exec masking, we shouldn't insert a + // scope. + const auto start = inst_list.begin() + curr_begin + 1; + if (!std::ranges::all_of(start, inst_list.begin() + index, IgnoresExecMask)) { + // Determine the first instruction affected by the exec mask. + do { + ++curr_begin; + } while (IgnoresExecMask(inst_list[curr_begin])); + + // Determine the last instruction affected by the exec mask. + s32 curr_end = index; + while (IgnoresExecMask(inst_list[curr_end])) { + --curr_end; + } + + // Create a new block for the divergence scope. + Block* block = block_pool.Create(); + block->begin = index_to_pc[curr_begin]; + block->end = index_to_pc[curr_end]; + block->begin_index = curr_begin; + block->end_index = curr_end; + block->end_inst = inst_list[curr_end]; + blocks.insert_before(next_blk, *block); + + // If we are inside the parent block, make an epilogue block and jump to it. + if (curr_end != blk->end_index) { + Block* epi_block = block_pool.Create(); + epi_block->begin = index_to_pc[curr_end + 1]; + epi_block->end = blk->end; + epi_block->begin_index = curr_end + 1; + epi_block->end_index = blk->end_index; + epi_block->end_inst = blk->end_inst; + epi_block->cond = blk->cond; + epi_block->end_class = blk->end_class; + epi_block->branch_true = blk->branch_true; + epi_block->branch_false = blk->branch_false; + blocks.insert_before(next_blk, *epi_block); + + // Have divergence block always jump to epilogue block. + block->cond = IR::Condition::True; + block->branch_true = epi_block; + block->branch_false = nullptr; + + // If the parent block fails to enter divergence block make it jump to + // epilogue too + blk->branch_false = epi_block; + } else { + // No epilogue block is needed since the divergence block + // also ends the parent block. Inherit the end condition. + auto& parent_blk = *blk; + ASSERT(blk->cond == IR::Condition::True && blk->branch_true); + block->cond = IR::Condition::True; + block->branch_true = blk->branch_true; + block->branch_false = nullptr; + + // If the parent block didn't enter the divergence scope + // have it jump directly to the next one + blk->branch_false = blk->branch_true; + } + + // Shrink parent block to end right before curr_begin + // and make it jump to divergence block + --curr_begin; + blk->end = index_to_pc[curr_begin]; + blk->end_index = curr_begin; + blk->end_inst = inst_list[curr_begin]; + blk->cond = IR::Condition::Execnz; + blk->end_class = EndClass::Branch; + blk->branch_true = block; + } + // Reset scope begin. + curr_begin = -1; } // Mark a potential start of an exec scope. if (is_open_scope(inst)) { curr_begin = index; - last_exec_idx = -1; } } } - - // Sort labels to make sure block insertion is correct. - std::ranges::sort(labels); } void CFG::EmitBlocks() { @@ -234,22 +265,6 @@ void CFG::LinkBlocks() { for (auto it = blocks.begin(); it != blocks.end(); it++) { auto& block = *it; const auto end_inst{block.end_inst}; - // Handle divergence block inserted here. - if (end_inst.opcode == Opcode::S_AND_SAVEEXEC_B64 || - end_inst.opcode == Opcode::S_ANDN2_B64 || end_inst.IsCmpx()) { - // Blocks are stored ordered by address in the set - auto next_it = std::next(it); - auto* target_block = &(*next_it); - ++target_block->num_predecessors; - block.branch_true = target_block; - - auto merge_it = std::next(next_it); - auto* merge_block = &(*merge_it); - ++merge_block->num_predecessors; - block.branch_false = merge_block; - block.end_class = EndClass::Branch; - continue; - } // If the block doesn't end with a branch we simply // need to link with the next block. diff --git a/src/shader_recompiler/frontend/control_flow_graph.h b/src/shader_recompiler/frontend/control_flow_graph.h index d98d4b05d..0acce3306 100644 --- a/src/shader_recompiler/frontend/control_flow_graph.h +++ b/src/shader_recompiler/frontend/control_flow_graph.h @@ -57,9 +57,9 @@ public: private: void EmitLabels(); - void EmitDivergenceLabels(); void EmitBlocks(); void LinkBlocks(); + void SplitDivergenceScopes(); void AddLabel(Label address) { const auto it = std::ranges::find(labels, address); diff --git a/src/shader_recompiler/frontend/translate/scalar_flow.cpp b/src/shader_recompiler/frontend/translate/scalar_flow.cpp index ef8bab789..0e02b77a2 100644 --- a/src/shader_recompiler/frontend/translate/scalar_flow.cpp +++ b/src/shader_recompiler/frontend/translate/scalar_flow.cpp @@ -13,6 +13,9 @@ void Translator::EmitFlowControl(u32 pc, const GcnInst& inst) { case Opcode::S_TTRACEDATA: LOG_WARNING(Render_Vulkan, "S_TTRACEDATA instruction!"); return; + case Opcode::S_SETPRIO: + LOG_WARNING(Render_Vulkan, "S_SETPRIO instruction!"); + return; case Opcode::S_GETPC_B64: return S_GETPC_B64(pc, inst); case Opcode::S_WAITCNT: diff --git a/src/shader_recompiler/ir/passes/constant_propagation_pass.cpp b/src/shader_recompiler/ir/passes/constant_propagation_pass.cpp index c8a4b13cb..5c66b1115 100644 --- a/src/shader_recompiler/ir/passes/constant_propagation_pass.cpp +++ b/src/shader_recompiler/ir/passes/constant_propagation_pass.cpp @@ -251,54 +251,6 @@ void FoldCmpClass(IR::Block& block, IR::Inst& inst) { } } -void FoldReadLane(IR::Block& block, IR::Inst& inst) { - const u32 lane = inst.Arg(1).U32(); - IR::Inst* prod = inst.Arg(0).InstRecursive(); - - const auto search_chain = [lane](const IR::Inst* prod) -> IR::Value { - while (prod->GetOpcode() == IR::Opcode::WriteLane) { - if (prod->Arg(2).U32() == lane) { - return prod->Arg(1); - } - prod = prod->Arg(0).InstRecursive(); - } - return {}; - }; - - if (prod->GetOpcode() == IR::Opcode::WriteLane) { - if (const IR::Value value = search_chain(prod); !value.IsEmpty()) { - inst.ReplaceUsesWith(value); - } - return; - } - - if (prod->GetOpcode() == IR::Opcode::Phi) { - boost::container::small_vector phi_args; - for (size_t arg_index = 0; arg_index < prod->NumArgs(); ++arg_index) { - const IR::Inst* arg{prod->Arg(arg_index).InstRecursive()}; - if (arg->GetOpcode() != IR::Opcode::WriteLane) { - return; - } - const IR::Value value = search_chain(arg); - if (value.IsEmpty()) { - continue; - } - phi_args.emplace_back(value); - } - if (std::ranges::all_of(phi_args, [&](IR::Value value) { return value == phi_args[0]; })) { - inst.ReplaceUsesWith(phi_args[0]); - return; - } - const auto insert_point = IR::Block::InstructionList::s_iterator_to(*prod); - IR::Inst* const new_phi{&*block.PrependNewInst(insert_point, IR::Opcode::Phi)}; - new_phi->SetFlags(IR::Type::U32); - for (size_t arg_index = 0; arg_index < phi_args.size(); arg_index++) { - new_phi->AddPhiOperand(prod->PhiBlock(arg_index), phi_args[arg_index]); - } - inst.ReplaceUsesWith(IR::Value{new_phi}); - } -} - void ConstantPropagation(IR::Block& block, IR::Inst& inst) { switch (inst.GetOpcode()) { case IR::Opcode::IAdd32: @@ -408,8 +360,6 @@ void ConstantPropagation(IR::Block& block, IR::Inst& inst) { case IR::Opcode::SelectF32: case IR::Opcode::SelectF64: return FoldSelect(inst); - case IR::Opcode::ReadLane: - return FoldReadLane(block, inst); case IR::Opcode::FPNeg32: FoldWhenAllImmediates(inst, [](f32 a) { return -a; }); return; diff --git a/src/shader_recompiler/ir/passes/hull_shader_transform.cpp b/src/shader_recompiler/ir/passes/hull_shader_transform.cpp index 48727e32a..5cf8a1525 100644 --- a/src/shader_recompiler/ir/passes/hull_shader_transform.cpp +++ b/src/shader_recompiler/ir/passes/hull_shader_transform.cpp @@ -1,11 +1,13 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later + #include "common/assert.h" #include "shader_recompiler/info.h" #include "shader_recompiler/ir/attribute.h" #include "shader_recompiler/ir/breadth_first_search.h" #include "shader_recompiler/ir/ir_emitter.h" #include "shader_recompiler/ir/opcodes.h" +#include "shader_recompiler/ir/passes/ir_passes.h" #include "shader_recompiler/ir/pattern_matching.h" #include "shader_recompiler/ir/program.h" #include "shader_recompiler/runtime_info.h" @@ -734,6 +736,8 @@ void TessellationPreprocess(IR::Program& program, RuntimeInfo& runtime_info) { } } } + + ConstantPropagationPass(program.post_order_blocks); } } // namespace Shader::Optimization diff --git a/src/shader_recompiler/ir/passes/ir_passes.h b/src/shader_recompiler/ir/passes/ir_passes.h index 69628dbfd..760dbb112 100644 --- a/src/shader_recompiler/ir/passes/ir_passes.h +++ b/src/shader_recompiler/ir/passes/ir_passes.h @@ -17,11 +17,11 @@ void IdentityRemovalPass(IR::BlockList& program); void DeadCodeEliminationPass(IR::Program& program); void ConstantPropagationPass(IR::BlockList& program); void FlattenExtendedUserdataPass(IR::Program& program); +void ReadLaneEliminationPass(IR::Program& program); void ResourceTrackingPass(IR::Program& program); void CollectShaderInfoPass(IR::Program& program); void LowerBufferFormatToRaw(IR::Program& program); -void RingAccessElimination(const IR::Program& program, const RuntimeInfo& runtime_info, - Stage stage); +void RingAccessElimination(const IR::Program& program, const RuntimeInfo& runtime_info); void TessellationPreprocess(IR::Program& program, RuntimeInfo& runtime_info); void HullShaderTransform(IR::Program& program, RuntimeInfo& runtime_info); void DomainShaderTransform(IR::Program& program, RuntimeInfo& runtime_info); diff --git a/src/shader_recompiler/ir/passes/readlane_elimination_pass.cpp b/src/shader_recompiler/ir/passes/readlane_elimination_pass.cpp new file mode 100644 index 000000000..fbe382d41 --- /dev/null +++ b/src/shader_recompiler/ir/passes/readlane_elimination_pass.cpp @@ -0,0 +1,115 @@ +// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "shader_recompiler/ir/program.h" + +namespace Shader::Optimization { + +static IR::Inst* SearchChain(IR::Inst* inst, u32 lane) { + while (inst->GetOpcode() == IR::Opcode::WriteLane) { + if (inst->Arg(2).U32() == lane) { + // We found a possible write lane source, return it. + return inst; + } + inst = inst->Arg(0).InstRecursive(); + } + return inst; +} + +static bool IsPossibleToEliminate(IR::Inst* inst, u32 lane) { + // Breadth-first search visiting the right most arguments first + boost::container::small_vector visited; + std::queue queue; + queue.push(inst); + + while (!queue.empty()) { + // Pop one instruction from the queue + IR::Inst* inst{queue.front()}; + queue.pop(); + + // If it's a WriteLane search for possible candidates + if (inst = SearchChain(inst, lane); inst->GetOpcode() == IR::Opcode::WriteLane) { + // We found a possible write lane source, stop looking here. + continue; + } + // If there are other instructions in-between that use the value we can't eliminate. + if (inst->GetOpcode() != IR::Opcode::ReadLane && inst->GetOpcode() != IR::Opcode::Phi) { + return false; + } + // Visit the right most arguments first + for (size_t arg = inst->NumArgs(); arg--;) { + auto arg_value{inst->Arg(arg)}; + if (arg_value.IsImmediate()) { + continue; + } + // Queue instruction if it hasn't been visited + IR::Inst* arg_inst{arg_value.InstRecursive()}; + if (std::ranges::find(visited, arg_inst) == visited.end()) { + visited.push_back(arg_inst); + queue.push(arg_inst); + } + } + } + return true; +} + +using PhiMap = std::unordered_map; + +static IR::Value GetRealValue(PhiMap& phi_map, IR::Inst* inst, u32 lane) { + // If this is a WriteLane op search the chain for a possible candidate. + if (inst = SearchChain(inst, lane); inst->GetOpcode() == IR::Opcode::WriteLane) { + return inst->Arg(1); + } + + // If this is a phi, duplicate it and populate its arguments with real values. + if (inst->GetOpcode() == IR::Opcode::Phi) { + // We are in a phi cycle, use the already duplicated phi. + const auto [it, is_new_phi] = phi_map.try_emplace(inst); + if (!is_new_phi) { + return IR::Value{it->second}; + } + + // Create new phi and insert it right before the old one. + const auto insert_point = IR::Block::InstructionList::s_iterator_to(*inst); + IR::Block* block = inst->GetParent(); + IR::Inst* new_phi{&*block->PrependNewInst(insert_point, IR::Opcode::Phi)}; + new_phi->SetFlags(IR::Type::U32); + it->second = new_phi; + + // Gather all arguments. + for (size_t arg_index = 0; arg_index < inst->NumArgs(); arg_index++) { + IR::Inst* arg_prod = inst->Arg(arg_index).InstRecursive(); + const IR::Value arg = GetRealValue(phi_map, arg_prod, lane); + new_phi->AddPhiOperand(inst->PhiBlock(arg_index), arg); + } + return IR::Value{new_phi}; + } + UNREACHABLE(); +} + +void ReadLaneEliminationPass(IR::Program& program) { + PhiMap phi_map; + for (IR::Block* const block : program.blocks) { + for (IR::Inst& inst : block->Instructions()) { + if (inst.GetOpcode() != IR::Opcode::ReadLane) { + continue; + } + const u32 lane = inst.Arg(1).U32(); + IR::Inst* prod = inst.Arg(0).InstRecursive(); + + // Check simple case of no control flow and phis + if (prod = SearchChain(prod, lane); prod->GetOpcode() == IR::Opcode::WriteLane) { + inst.ReplaceUsesWith(prod->Arg(1)); + continue; + } + + // Traverse the phi tree to see if it's possible to eliminate + if (prod->GetOpcode() == IR::Opcode::Phi && IsPossibleToEliminate(prod, lane)) { + inst.ReplaceUsesWith(GetRealValue(phi_map, prod, lane)); + phi_map.clear(); + } + } + } +} + +} // namespace Shader::Optimization diff --git a/src/shader_recompiler/ir/passes/ring_access_elimination.cpp b/src/shader_recompiler/ir/passes/ring_access_elimination.cpp index d6f1efb12..071b94ac0 100644 --- a/src/shader_recompiler/ir/passes/ring_access_elimination.cpp +++ b/src/shader_recompiler/ir/passes/ring_access_elimination.cpp @@ -11,8 +11,7 @@ namespace Shader::Optimization { -void RingAccessElimination(const IR::Program& program, const RuntimeInfo& runtime_info, - Stage stage) { +void RingAccessElimination(const IR::Program& program, const RuntimeInfo& runtime_info) { auto& info = program.info; const auto& ForEachInstruction = [&](auto func) { @@ -24,7 +23,7 @@ void RingAccessElimination(const IR::Program& program, const RuntimeInfo& runtim } }; - switch (stage) { + switch (program.info.stage) { case Stage::Local: { ForEachInstruction([=](IR::IREmitter& ir, IR::Inst& inst) { const auto opcode = inst.GetOpcode(); diff --git a/src/shader_recompiler/recompiler.cpp b/src/shader_recompiler/recompiler.cpp index 1c132ebbb..5004e0beb 100644 --- a/src/shader_recompiler/recompiler.cpp +++ b/src/shader_recompiler/recompiler.cpp @@ -1,9 +1,6 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "common/config.h" -#include "common/io_file.h" -#include "common/path_util.h" #include "shader_recompiler/frontend/control_flow_graph.h" #include "shader_recompiler/frontend/decode.h" #include "shader_recompiler/frontend/structured_control_flow.h" @@ -63,26 +60,18 @@ IR::Program TranslateProgram(std::span code, Pools& pools, Info& info program.post_order_blocks = Shader::IR::PostOrder(program.syntax_list.front()); // Run optimization passes - const auto stage = program.info.stage; - Shader::Optimization::SsaRewritePass(program.post_order_blocks); + Shader::Optimization::ConstantPropagationPass(program.post_order_blocks); Shader::Optimization::IdentityRemovalPass(program.blocks); if (info.l_stage == LogicalStage::TessellationControl) { - // Tess passes require previous const prop passes for now (for simplicity). TODO allow - // fine grained folding or opportunistic folding we set an operand to an immediate - Shader::Optimization::ConstantPropagationPass(program.post_order_blocks); Shader::Optimization::TessellationPreprocess(program, runtime_info); - Shader::Optimization::ConstantPropagationPass(program.post_order_blocks); Shader::Optimization::HullShaderTransform(program, runtime_info); } else if (info.l_stage == LogicalStage::TessellationEval) { - Shader::Optimization::ConstantPropagationPass(program.post_order_blocks); Shader::Optimization::TessellationPreprocess(program, runtime_info); - Shader::Optimization::ConstantPropagationPass(program.post_order_blocks); Shader::Optimization::DomainShaderTransform(program, runtime_info); } - Shader::Optimization::ConstantPropagationPass(program.post_order_blocks); - Shader::Optimization::RingAccessElimination(program, runtime_info, stage); - Shader::Optimization::ConstantPropagationPass(program.post_order_blocks); + Shader::Optimization::RingAccessElimination(program, runtime_info); + Shader::Optimization::ReadLaneEliminationPass(program); Shader::Optimization::FlattenExtendedUserdataPass(program); Shader::Optimization::ResourceTrackingPass(program); Shader::Optimization::LowerBufferFormatToRaw(program); diff --git a/src/shadps4.qrc b/src/shadps4.qrc index a1ff680ed..83dea01c4 100644 --- a/src/shadps4.qrc +++ b/src/shadps4.qrc @@ -1,37 +1,40 @@ - - images/shadps4.ico - images/about_icon.png - images/dump_icon.png - images/play_icon.png - images/pause_icon.png - images/stop_icon.png - images/utils_icon.png - images/file_icon.png - images/folder_icon.png - images/themes_icon.png - images/iconsize_icon.png - images/list_icon.png - images/grid_icon.png - images/exit_icon.png - images/settings_icon.png - images/controller_icon.png - images/refresh_icon.png - images/update_icon.png - images/list_mode_icon.png - images/flag_jp.png - images/flag_eu.png - images/flag_unk.png - images/flag_us.png - images/flag_world.png - images/flag_china.png - images/github.png - images/discord.png - images/ko-fi.png - images/youtube.png - images/website.png - images/ps4_controller.png - images/keyboard_icon.png - images/KBM.png - + + images/shadps4.ico + images/about_icon.png + images/dump_icon.png + images/play_icon.png + images/pause_icon.png + images/stop_icon.png + images/utils_icon.png + images/file_icon.png + images/folder_icon.png + images/themes_icon.png + images/iconsize_icon.png + images/list_icon.png + images/grid_icon.png + images/exit_icon.png + images/settings_icon.png + images/controller_icon.png + images/restart_game_icon.png + images/update_icon.png + images/list_mode_icon.png + images/flag_jp.png + images/flag_eu.png + images/flag_unk.png + images/flag_us.png + images/flag_world.png + images/flag_china.png + images/github.png + images/discord.png + images/ko-fi.png + images/youtube.png + images/website.png + images/ps4_controller.png + images/keyboard_icon.png + images/KBM.png + images/fullscreen_icon.png + images/refreshlist_icon.png + images/trophy_icon.png + diff --git a/src/video_core/amdgpu/liverpool.cpp b/src/video_core/amdgpu/liverpool.cpp index 246c8c947..967b952c6 100644 --- a/src/video_core/amdgpu/liverpool.cpp +++ b/src/video_core/amdgpu/liverpool.cpp @@ -602,20 +602,25 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::spansrc_sel == DmaDataSrc::Data && dma_data->dst_sel == DmaDataDst::Gds) { rasterizer->InlineData(dma_data->dst_addr_lo, &dma_data->data, sizeof(u32), true); - } else if (dma_data->src_sel == DmaDataSrc::Memory && + } else if ((dma_data->src_sel == DmaDataSrc::Memory || + dma_data->src_sel == DmaDataSrc::MemoryUsingL2) && dma_data->dst_sel == DmaDataDst::Gds) { rasterizer->InlineData(dma_data->dst_addr_lo, dma_data->SrcAddress(), dma_data->NumBytes(), true); } else if (dma_data->src_sel == DmaDataSrc::Data && - dma_data->dst_sel == DmaDataDst::Memory) { + (dma_data->dst_sel == DmaDataDst::Memory || + dma_data->dst_sel == DmaDataDst::MemoryUsingL2)) { rasterizer->InlineData(dma_data->DstAddress(), &dma_data->data, sizeof(u32), false); } else if (dma_data->src_sel == DmaDataSrc::Gds && - dma_data->dst_sel == DmaDataDst::Memory) { + (dma_data->dst_sel == DmaDataDst::Memory || + dma_data->dst_sel == DmaDataDst::MemoryUsingL2)) { // LOG_WARNING(Render_Vulkan, "GDS memory read"); - } else if (dma_data->src_sel == DmaDataSrc::Memory && - dma_data->dst_sel == DmaDataDst::Memory) { + } else if ((dma_data->src_sel == DmaDataSrc::Memory || + dma_data->src_sel == DmaDataSrc::MemoryUsingL2) && + (dma_data->dst_sel == DmaDataDst::Memory || + dma_data->dst_sel == DmaDataDst::MemoryUsingL2)) { rasterizer->InlineData(dma_data->DstAddress(), dma_data->SrcAddress(), dma_data->NumBytes(), false); @@ -726,20 +731,39 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::span -Liverpool::Task Liverpool::ProcessCompute(std::span acb, u32 vqid) { +Liverpool::Task Liverpool::ProcessCompute(const u32* acb, u32 acb_dwords, u32 vqid) { FIBER_ENTER(acb_task_name[vqid]); - const auto& queue = asc_queues[{vqid}]; + auto& queue = asc_queues[{vqid}]; - auto base_addr = reinterpret_cast(acb.data()); - while (!acb.empty()) { - const auto* header = reinterpret_cast(acb.data()); - const u32 type = header->type; - if (type != 3) { - // No other types of packets were spotted so far - UNREACHABLE_MSG("Invalid PM4 type {}", type); + auto base_addr = reinterpret_cast(acb); + while (acb_dwords > 0) { + auto* header = reinterpret_cast(acb); + u32 next_dw_off = header->type3.NumWords() + 1; + + // If we have a buffered packet, use it. + if (queue.tmp_dwords > 0) [[unlikely]] { + header = reinterpret_cast(queue.tmp_packet.data()); + next_dw_off = header->type3.NumWords() + 1 - queue.tmp_dwords; + std::memcpy(queue.tmp_packet.data() + queue.tmp_dwords, acb, next_dw_off * sizeof(u32)); + queue.tmp_dwords = 0; + } + + // If the packet is split across ring boundary, buffer until next submission + if (next_dw_off > acb_dwords) [[unlikely]] { + std::memcpy(queue.tmp_packet.data(), acb, acb_dwords * sizeof(u32)); + queue.tmp_dwords = acb_dwords; + if constexpr (!is_indirect) { + *queue.read_addr += acb_dwords; + *queue.read_addr %= queue.ring_size_dw; + } + break; + } + + if (header->type != 3) { + // No other types of packets were spotted so far + UNREACHABLE_MSG("Invalid PM4 type {}", header->type.Value()); } - const u32 count = header->type3.NumWords(); const PM4ItOpcode opcode = header->type3.opcode; const auto* it_body = reinterpret_cast(header) + 1; switch (opcode) { @@ -749,8 +773,8 @@ Liverpool::Task Liverpool::ProcessCompute(std::span acb, u32 vqid) { } case PM4ItOpcode::IndirectBuffer: { const auto* indirect_buffer = reinterpret_cast(header); - auto task = ProcessCompute( - {indirect_buffer->Address(), indirect_buffer->ib_size}, vqid); + auto task = ProcessCompute(indirect_buffer->Address(), + indirect_buffer->ib_size, vqid); RESUME_ASC(task, vqid); while (!task.handle.done()) { @@ -766,19 +790,24 @@ Liverpool::Task Liverpool::ProcessCompute(std::span acb, u32 vqid) { } if (dma_data->src_sel == DmaDataSrc::Data && dma_data->dst_sel == DmaDataDst::Gds) { rasterizer->InlineData(dma_data->dst_addr_lo, &dma_data->data, sizeof(u32), true); - } else if (dma_data->src_sel == DmaDataSrc::Memory && + } else if ((dma_data->src_sel == DmaDataSrc::Memory || + dma_data->src_sel == DmaDataSrc::MemoryUsingL2) && dma_data->dst_sel == DmaDataDst::Gds) { rasterizer->InlineData(dma_data->dst_addr_lo, dma_data->SrcAddress(), dma_data->NumBytes(), true); } else if (dma_data->src_sel == DmaDataSrc::Data && - dma_data->dst_sel == DmaDataDst::Memory) { + (dma_data->dst_sel == DmaDataDst::Memory || + dma_data->dst_sel == DmaDataDst::MemoryUsingL2)) { rasterizer->InlineData(dma_data->DstAddress(), &dma_data->data, sizeof(u32), false); } else if (dma_data->src_sel == DmaDataSrc::Gds && - dma_data->dst_sel == DmaDataDst::Memory) { + (dma_data->dst_sel == DmaDataDst::Memory || + dma_data->dst_sel == DmaDataDst::MemoryUsingL2)) { // LOG_WARNING(Render_Vulkan, "GDS memory read"); - } else if (dma_data->src_sel == DmaDataSrc::Memory && - dma_data->dst_sel == DmaDataDst::Memory) { + } else if ((dma_data->src_sel == DmaDataSrc::Memory || + dma_data->src_sel == DmaDataSrc::MemoryUsingL2) && + (dma_data->dst_sel == DmaDataDst::Memory || + dma_data->dst_sel == DmaDataDst::MemoryUsingL2)) { rasterizer->InlineData(dma_data->DstAddress(), dma_data->SrcAddress(), dma_data->NumBytes(), false); @@ -800,7 +829,7 @@ Liverpool::Task Liverpool::ProcessCompute(std::span acb, u32 vqid) { } case PM4ItOpcode::SetShReg: { const auto* set_data = reinterpret_cast(header); - const auto set_size = (count - 1) * sizeof(u32); + const auto set_size = (header->type3.NumWords() - 1) * sizeof(u32); if (set_data->reg_offset >= 0x200 && set_data->reg_offset <= (0x200 + sizeof(ComputeProgram) / 4)) { @@ -895,14 +924,14 @@ Liverpool::Task Liverpool::ProcessCompute(std::span acb, u32 vqid) { } default: UNREACHABLE_MSG("Unknown PM4 type 3 opcode {:#x} with count {}", - static_cast(opcode), count); + static_cast(opcode), header->type3.NumWords()); } - const auto packet_size_dw = header->type3.NumWords() + 1; - acb = NextPacket(acb, packet_size_dw); + acb += next_dw_off; + acb_dwords -= next_dw_off; if constexpr (!is_indirect) { - *queue.read_addr += packet_size_dw; + *queue.read_addr += next_dw_off; *queue.read_addr %= queue.ring_size_dw; } } @@ -969,7 +998,7 @@ void Liverpool::SubmitAsc(u32 gnm_vqid, std::span acb) { auto& queue = mapped_queues[gnm_vqid]; const auto vqid = gnm_vqid - 1; - const auto& task = ProcessCompute(acb, vqid); + const auto& task = ProcessCompute(acb.data(), acb.size(), vqid); { std::scoped_lock lock{queue.m_access}; queue.submits.emplace(task.handle); diff --git a/src/video_core/amdgpu/liverpool.h b/src/video_core/amdgpu/liverpool.h index c18bcd57b..474c04ec2 100644 --- a/src/video_core/amdgpu/liverpool.h +++ b/src/video_core/amdgpu/liverpool.h @@ -1496,10 +1496,13 @@ public: } struct AscQueueInfo { + static constexpr size_t Pm4BufferSize = 1024; VAddr map_addr; u32* read_addr; u32 ring_size_dw; u32 pipe_id; + std::array tmp_packet; + u32 tmp_dwords; }; Common::SlotVector asc_queues{}; @@ -1541,7 +1544,7 @@ private: Task ProcessGraphics(std::span dcb, std::span ccb); Task ProcessCeUpdate(std::span ccb); template - Task ProcessCompute(std::span acb, u32 vqid); + Task ProcessCompute(const u32* acb, u32 acb_dwords, u32 vqid); void Process(std::stop_token stoken); diff --git a/src/video_core/amdgpu/pm4_cmds.h b/src/video_core/amdgpu/pm4_cmds.h index e92ba17fa..ae1d32e00 100644 --- a/src/video_core/amdgpu/pm4_cmds.h +++ b/src/video_core/amdgpu/pm4_cmds.h @@ -377,12 +377,14 @@ struct PM4CmdAcquireMem { enum class DmaDataDst : u32 { Memory = 0, Gds = 1, + MemoryUsingL2 = 3, }; enum class DmaDataSrc : u32 { Memory = 0, Gds = 1, Data = 2, + MemoryUsingL2 = 3, }; struct PM4DmaData { diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 901096259..c528258fb 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp @@ -77,8 +77,8 @@ GraphicsPipeline::GraphicsPipeline( auto prim_restart = key.enable_primitive_restart != 0; if (prim_restart && IsPrimitiveListTopology() && !instance.IsListRestartSupported()) { - LOG_WARNING(Render_Vulkan, - "Primitive restart is enabled for list topology but not supported by driver."); + LOG_DEBUG(Render_Vulkan, + "Primitive restart is enabled for list topology but not supported by driver."); prim_restart = false; } const vk::PipelineInputAssemblyStateCreateInfo input_assembly = {