Compare commits

...

109 Commits

Author SHA1 Message Date
psucien 4182740384 Don't load `sync2` ext if `nv_checkpoints` isn't used 2024-08-31 00:10:47 +02:00
psucien ca1613258f
video_core: added support for indirect draws (#678)
* video_core: added support for indirect draws

* barriers simplified
2024-08-30 22:59:56 +02:00
georgemoralis 3d375a28eb
Merge pull request #671 from Xphalnos/main
Reorganization of includes (Part 2)
2024-08-30 22:10:49 +03:00
jnack 69d4fecdfe
Allow graphics/compute shader list for skipping (#674)
* Allow graphics/compute shader list for skipping

* nintendo ultra 64 + formatting

* indentation..

* allow empty array in ShouldSkipShader

* simpler check for skip hashes
2024-08-30 21:51:20 +03:00
Xphalnos 7886761476 Reorganization of includes (Part 2) 2024-08-30 15:48:21 +02:00
squidbus 6080066f75
vulkan: Few fixes for MoltenVK (#670)
* vulkan: Use SPIR-V 1.5 when Vulkan version is 1.2

* vulkan: Fix Format2_10_10_10 mismap
2024-08-30 16:40:39 +03:00
georgemoralis f1fe6b9f96
Merge pull request #668 from squidbus/fix-patch-stack
Initialize patch stack before thread TLS.
2024-08-30 14:58:34 +03:00
squidbus 6e552aac6a Initialize patch stack before thread TLS. 2024-08-30 04:43:11 -07:00
adjonesey 0f87d1e3d4 Remove from_compute check in texture cache invalidation (#665)
* Remove from_compute check in texture cache invalidation (hack)

* Remove from_compute parameter

---------

Co-authored-by: Adam Jones <a.c.jones@outlook.com>
2024-08-30 13:01:59 +03:00
georgemoralis 68fa5e292f
Merge pull request #666 from bigol83/patch-3
Update Italian translation
2024-08-30 12:39:30 +03:00
bigol83 bdfff5e8ea
Update it.ts 2024-08-30 11:01:48 +02:00
georgemoralis cdd193d5b1
Merge pull request #638 from squidbus/f16c
Add patches for F16C instructions under Rosetta 2.
2024-08-30 11:16:21 +03:00
georgemoralis 30ab2b7f71
Merge pull request #658 from DanielSvoboda/main
fix tr
2024-08-30 11:15:09 +03:00
DanielSvoboda f2b6843f9d fix tr 2024-08-29 23:11:20 -03:00
squidbus a17150960f Add patches for F16C instructions under Rosetta 2. 2024-08-29 17:31:25 -07:00
Grégoire Hage 1651db24fe
Implement S_XNOR_B64 (#654) 2024-08-30 02:43:12 +03:00
IndecisiveTurtle 6bf42aa985 vk_graphics_pipeline: Fix texel buffer offset 2024-08-30 01:09:39 +03:00
georgemoralis 8d41695e74
Merge pull request #651 from LeDragoX/pt-br-update-1
Update PT-BR localization
2024-08-30 01:08:07 +03:00
IndecisiveTurtle cb5190e31a vk_graphics_pipeline: Fix copy paste error 2024-08-30 00:59:12 +03:00
IndecisiveTurtle cf706f8cc7 buffer: Don't leak texel buffers, blacklist stream buffer with texel buffers 2024-08-30 00:26:08 +03:00
IndecisiveTurtle 6fbbe3d79b translator: Add missed flow instruction 2024-08-30 00:26:01 +03:00
IndecisiveTurtle fab390b860 spirv: More correct texel buffer usage 2024-08-30 00:25:56 +03:00
Plínio Larrubia 5a96ac1a4f
Update PT-BR translation
- Support DLC texts
- Fixed some errors on Cheats (Trapaças) translation
2024-08-29 18:22:36 -03:00
georgemoralis ac2fa103fa
Merge pull request #649 from f1amy/ru-translation-fixes
ru DLC translation and translation fixes
2024-08-29 23:47:47 +03:00
georgemoralis 7e7854346d
Merge pull request #650 from DanielSvoboda/main
Fix creation files.json in 'Download All Patches'
2024-08-29 23:47:25 +03:00
DanielSvoboda 751f6f9bab Fix creation files.json in 'Download ALL' 2024-08-29 17:26:06 -03:00
Flamy 1c835a1aa4
ru DLC translation and translation fixes 2024-08-29 23:59:52 +05:00
georgemoralis 07c8c28000
Merge pull request #647 from DanielSvoboda/main
fix tr cheats_patches.cpp
2024-08-29 19:44:04 +03:00
TheTurtle 66e96dd944
video_core: Account of runtime state changes when compiling shaders (#575)
* video_core: Compile shader permutations

* spirv: Only specific storage image format for atomics

* ir: Avoid cube coord patching for storage image

* spirv: Fix default attributes

* data_share: Add more instructions

* video_core: Query storage flag with runtime state

* kernel: Use std::list for semaphore

* video_core: Use texture buffers for untyped format load/store

* buffer_cache: Limit view usage

* vk_pipeline_cache: Fix invalid iterator

* image_view: Reduce log spam when alpha=1 in storage swizzle

* video_core: More features and proper spirv feature detection

* video_core: Attempt no2 for specialization

* spirv: Remove conflict

* vk_shader_cache: Small cleanup
2024-08-29 19:29:54 +03:00
DanielSvoboda aef7498c49
fix tr cheats_patches.cpp
the 2 words were not being translated
2024-08-29 13:21:58 -03:00
georgemoralis 790d19e59b
Merge pull request #646 from kiwidoggie/patch-1
Add /hostapp support
2024-08-29 17:03:35 +03:00
georgemoralis 3ae18c9073
Merge pull request #645 from mavethee/dlc-polish-localization
DLCs - Polish localization
2024-08-29 17:02:55 +03:00
georgemoralis 83e343f77e
Merge pull request #637 from shadps4-emu/amdgpu/indirect_dispatch
video_core: added support for indirect dispatches (gfx only)
2024-08-29 17:02:37 +03:00
kiwipuppeh 81eb3a4d14
Add /hostapp support
In the case of certain games, such as Battlefield 4 (CUSA00110), the local pathing will resolve to /hostapp instead of /app0, which works fine on PS4, but was failing to resolve to any meaningful mount in shadPS4, this corrects this issue when running from eboot.bin directly.
2024-08-29 08:22:19 -04:00
Marcin Mitura 37786e06c2 DLCs - Polish localization
Translates strings introduced in #596.
2024-08-29 13:27:11 +02:00
psucien 9d349a1308 video_core: added support for indirect dispatches (gfx only) 2024-08-29 12:32:37 +02:00
bigol83 c997490645
DLC Italian translation (#644) 2024-08-29 13:31:48 +03:00
bigol83 600c5079ce
Cheats/patches Italian translation (#642)
* Update it.ts

* Update it.ts
2024-08-29 13:11:17 +03:00
Dzmitry Dubrova 8827c72a1c
Add DLC support (#596)
* fs/core: Add DLC support

* fs/core: Fix extraction paths

* Fix DLC mounting

* gui: Add translations
2024-08-29 12:55:40 +03:00
¥IGA e1382b43c8
Update French translation (#641) 2024-08-29 10:02:36 +03:00
DanielSvoboda 614a23b369
Cheats/Patches (#493)
* Cheats/Patches

Adds the possibility of applying cheats/patches according to the specific game serial+version

The logic for adding modifications has not yet been implemented!

Interface based on issues/372 https://github.com/shadps4-emu/shadPS4/issues/372

[X]Front-end
[]Back-end

Create a synchronized fork of the cheats/patches repository

* Clang Format

* separate files

The code has been separated into separate files as suggested by georgemoralis.
Added the Patch tab, which has not been implemented yet.
Added the 'applyCheat' area to apply the modification, not implemented yet...
And added LOG_INFO.

* reuse

* initial implementation of cheat functionality

* Update cheats_patches.cpp

sets all added buttons to the size of the largest button.
and fixes some aesthetic issues.

* move eboot_address to module.h

fixes the non-qt builds and makes more sense to be there anyway

* Patchs menu and fixes

adds the possibility to download Patches, it does not modify the memory yet.
and some other fixes

* MemoryPatcher namespace, activate cheats on start

* format

* initial patch implementation

* format

* format again...

* convertValueToHex

* Fixes

Choosing which cheat file to use.
And some other fixes

* fix bytes16, bytes32, bytes64 type patches

If a patch is any of these types we convert it from little endian to big endian

* format

* format again :(

* Implement pattern scanning for mask type patches

* add check to stop patches applying to wrong game

previously if you added a patch to a game, but closed the window and opened a different game it would still try to apply the patch, this is now fixed

* format

* Fix 'Hint' 0x400000 |  and Author

* Management |save checkbox | shadps4 repository

MENU - Cheats/Patches Management (implementing Patches)
save patches checkbox
add shadps4 repository

* Load saved patches, miscellaneous fixes

* Fix an issue with mask patches not being saved

* format + remove debug log

* multiple patches | TR translation for cheats/patches

* clang

* ENABLE_QT_GUI

* OK

* move memory_patcher to qt_gui

* clang

* add cheats hu_HU

* fix log

* Remove the item from the patchesListView if no patches were added (the game has patches, but not for the current version)

---------

Co-authored-by: CrazyBloo <CrazyBloo@users.noreply.github.com>
2024-08-29 07:18:50 +03:00
georgemoralis a6a9fff666
Merge pull request #636 from CyntexMore/main
Added HU translation
2024-08-29 00:08:51 +03:00
psucien 3fbb68048e
shader_recompiler: frontend: `SOPC` and `SOPK` handling separated; more cmp opcodes (#634) 2024-08-28 22:27:47 +02:00
CyntexMore 55be97bca3 feat(translation): hu_HU translated 2024-08-28 22:15:03 +02:00
georgemoralis d2e4a200fb
Merge pull request #631 from Emulator-Team-2/Fix
Misc fixes
2024-08-28 22:26:50 +03:00
georgemoralis a291800418
Merge pull request #632 from bigol83/patch-2
Update Italian translation
2024-08-28 21:13:47 +03:00
bigol83 365e17f64e
Update it.ts 2024-08-28 19:14:33 +02:00
Emulator-Team-2 af18728962
clang-format fix 2024-08-28 18:45:32 +02:00
Emulator-Team-2 6f938a10ce
added data_format=3 and num_format=4 2024-08-28 18:12:59 +02:00
Emulator-Team-2 08036d2b49
added data_format=36 and num_format=9 2024-08-28 18:10:23 +02:00
georgemoralis e57d55e6e9
Merge pull request #624 from Exhigh/savedata-fix-4
savedata: Add another missed case in saveDataMount
2024-08-28 18:07:50 +03:00
georgemoralis 163019e3dc
Merge pull request #629 from counter185/gamepad-tp-and-reconnect
Auto reconnect controllers + touchpad functionality
2024-08-28 18:03:13 +03:00
counter185 bc661039c5 get rid of one space 2024-08-28 14:25:07 +02:00
counter185 2e2f3bb2c6 clang format 2024-08-28 14:22:59 +02:00
counter185 89bdd3bba2 it's actually 1920x941 2024-08-28 14:15:01 +02:00
counter185 15fc267f0d Update controller.h 2024-08-28 13:58:37 +02:00
counter185 0b24ac6991 actually get rid of that comment 2024-08-28 13:56:49 +02:00
counter185 698dade864 * 2024-08-28 13:53:07 +02:00
counter185 4e6e90dfb9 add touchpad support, auto reconnect 2024-08-28 13:48:50 +02:00
georgemoralis be49871c68
Merge pull request #618 from vertver/main
video_core: Added copyGPUCmdBuffers option
2024-08-28 14:00:26 +03:00
squidbus 905d49fd96
memory: Fixes for direct memory allocation. (#615)
* memory: Size direct memory based on requested flexible memory.

* memory: Guard against OrbisProcParam without an OrbisKernelMemParam.

* memory: Account for alignment in direct memory suitability checks and add more debugging.
2024-08-28 13:42:53 +03:00
georgemoralis dcc4762c7e
Merge pull request #628 from squidbus/pkg-fix
crypto: Fix deallocation of key data while in use.
2024-08-28 13:42:01 +03:00
squidbus 4a6ce1e0d6 crypto: Fix deallocation of key data while in use. 2024-08-28 03:39:51 -07:00
georgemoralis 878fac7f94
Merge pull request #626 from InvoxiPlayGames/special-pad
pad: add support for configurable special pad class
2024-08-28 13:24:37 +03:00
squidbus da966bedfd
kernel: Reimplement POSIX semaphores using std::counting_semaphore. (#600) 2024-08-28 13:13:33 +03:00
Vinicius Rangel 8192eaa668
video_core: re-enable culling (#551) 2024-08-28 13:11:55 +03:00
0xsegf4ult 9f4e55a8e7
shader_recompiler: constant propagation bitwise operations + S_CMPK_EQ_U32 fix (#613)
* rebase on main branch impl of V_LSHL_B64

* remove V_LSHR_B64

* fix S_CMPK_EQ_u32

* fix conflicts

* fix broken merge

* remove duplicate cases

* remove duplicate declaration
2024-08-28 13:10:21 +03:00
InvoxiPlayGames 9d59ea06c7 clang-format fix: scePadOpenExt 2024-08-28 11:10:20 +01:00
tGecko 990da7edcc
DOCS: Correct and expand windows build instructions (#617)
* correct and expand windows build instructions

* fix numbering

* remove instructions to clone a different branch
2024-08-28 13:10:04 +03:00
InvoxiPlayGames 550cf0188d return proper error code for scePadOpen failure 2024-08-28 10:51:30 +01:00
InvoxiPlayGames 79e86a39fc add support for configurable special pad type 2024-08-28 10:27:51 +01:00
Anton Kovalev dfb30ea955 Use pair of spans instead of references in copy command buffers function 2024-08-28 11:24:15 +02:00
Random c37679154e
Handle PM4 type-2 packets (#556)
* video_core: handle PM4 type-2 packets

* video_core: rewrite pm4 comand type handling into a switch statement
2024-08-28 09:53:27 +02:00
Anton Kovalev 87ccfdfbbd Fixed type on function 2024-08-28 09:42:31 +02:00
Exhigh ed42db47af savedata: Add another missed case in saveDataMount
This should potentially fix Deadpool (CUSA03528) #554.
2024-08-28 08:52:20 +04:00
Anton Kovalev 1a02efbd15 clang-format style fix 2024-08-28 05:42:48 +02:00
georgemoralis e4254ebdaa
Merge pull request #605 from SolidStateDj/add-toggle-fullscreen
Add a toggle fullscreen button
2024-08-28 06:32:21 +03:00
georgemoralis e65bf19118
Merge pull request #620 from GermanAizek/fixes
crypto: added destructors and fixed direct memleaks
2024-08-28 06:31:07 +03:00
Semenov Herman 860b935054 crypto: added destructors fix memleak FakeKeyset, DebugRifKeyset, PkgDerivedKey3Keyset 2024-08-28 01:32:14 +03:00
Anton Kovalev 3842993a43 Use input dcb and ccb instead of copy 2024-08-28 00:21:12 +02:00
Anton Kovalev 3d46a5d492 Do not shrink buffer's size on submit 2024-08-27 23:33:24 +02:00
Anton Kovalev 595b845df0 clang-format fix 2024-08-27 23:31:04 +02:00
Anton Kovalev 659e7a4675 video_core: Added copyGPUCmdBuffers option 2024-08-27 23:16:14 +02:00
psucien 3eb47226d9 libraries: kernel: fix `scePthreadMutexattrSettype` error value return 2024-08-27 22:25:46 +02:00
psucien 371d1d009a Added missing headers and 2D MSAA image type 2024-08-27 19:17:23 +02:00
Lizardy 59b651be07
[Libs] Error Codes (#612)
* ngs2: all errors w/ official names

* ajm errors

* gnm errors

* random errors

* clang

* random error

* linux

---------

Co-authored-by: microsoftv <6063922+microsoftv@users.noreply.github.com>
2024-08-27 15:53:38 +03:00
Grégoire Hage 288db9a0cf
Implement V_LSHL_B64 (#608) 2024-08-27 14:15:32 +03:00
georgemoralis 62f165a7e4
Merge pull request #610 from vladmikhalin/avplayer-handle-init-errors
AvPlayer: Handle Initialization errors
2024-08-27 09:59:19 +03:00
Vladislav Mikhalin 2d354a095a AvPlayer: Handle Initialization errors 2024-08-27 09:32:42 +03:00
SolidStateDj 7ecc1d3be0 Add a toggle fullscreen button
Assigns F11 as the key for toggling fullscreen.
2024-08-26 18:27:31 -04:00
psucien af4356bfe1 shader_recompiler: fix for pattern detection in `TryDisableAnisoLod0`
Also fix for forgotten log message params.
2024-08-26 23:49:36 +02:00
psucien 3e94b533b6
libraries: kernel: skip for protection op; processing logic fixes (#602) 2024-08-26 23:14:22 +02:00
georgemoralis 287c3a4ab1
Merge pull request #599 from Exhigh/savedata-fix-3
savedata: Handle another missed case in saveDataMount
2024-08-27 00:02:41 +03:00
Exhigh 7c7d04133e savedata: Handle another missed case in saveDataMount
This should potentially fix (CUSA01019) - The Walking Dead: The Complete First Season.
2024-08-26 19:34:35 +04:00
Plínio Larrubia ad8373095a
fix typo in LOG_INFO (#559)
fix: file name typo constant_propogation_pass.cpp

fix typo from 'symbol_vitrual_addr' variable

fix typo in emit_spirv_context_get_set.cpp

fix typo from constant_propagation_pass.cpp in CMakeLists

fix typo in these some config.cpp functions
- setSliderPosition
- setSliderPositionGrid
- getSliderPosition
- getSliderPositionGrid

fix typo inside src\core\aerolib\stubs.cpp

fix typo in a comment from src\core\file_format\pkg.cpp

fix typo inside src\core\file_sys\fs.cpp + fs.h
- NeedsCaseInsensiveSearch -> NeedsCaseInsensitiveSearch

fix 2 function typos: sceAppContentAddcontEnqueueDownloadByEntitlemetId and sceAppContentAddcontMountByEntitlemetId

fix typo on comment inside src\core\libraries\kernel\file_system.cpp

fix typo on src\core\libraries\videoout\driver.cpp

fix typo in src\core\memory.cpp

fix typo from comment in src\qt_gui\game_list_utils.h

fix typo in src\video_core\amdgpu\liverpool.h
- window_offset_disble to window_offset_disable

fix typo from comments in src\video_core\host_shaders\detile_m32x1.comp + detile_m32x2.comp
- subotimal -> suboptimal

fix typo from comment in src\video_core\renderer_vulkan\renderer_vulkan.cpp
- dimentions -> dimensions

fix typo from enum in src\common\debug.h and other files
- MarkersPallete -> MarkersPalette

fix last typo in src\video_core\amdgpu\pm4_opcodes.h
- PremableCntl -> PreambleCntl
2024-08-26 15:22:11 +03:00
Lizardy aae6e5be73
shader_recompiler: BUFFER_ATOMIC_SWAP Opcode (#566)
* shader_recompiler: BUFFER_ATOMIC_SWAP Opcode

* clang

* follow 32 convention

---------

Co-authored-by: microsoftv <6063922+microsoftv@users.noreply.github.com>
2024-08-26 15:21:20 +03:00
Batu cd6b5abccf
added tr language support (#587) 2024-08-26 13:20:53 +03:00
Plínio Larrubia 6520f3ca17
feat: add pt_BR translation (#584)
* feat: add pt_BR translation
- Made by @LeDragoX
- Revised by @gabsF

* fix: change translation string 'Mostrar Tela Inicial' to 'Mostrar Splash Inicial'
2024-08-26 13:20:40 +03:00
Cristóbal Martí Méndez d3b6b17c75
Add spanish translation (#583)
* Add spanish transalation

* Update es_ES.ts
2024-08-26 13:20:26 +03:00
Marcin Mitura 0b5616c493
Polish localization (#580)
Initial polish localization for shadPS4
2024-08-26 13:20:12 +03:00
georgemoralis 3627393707
Merge pull request #593 from shadps4-emu/fix/better_timings
libraries: kernel: fix for inaccurate `sceKernelGetProcessTime`
2024-08-26 10:56:54 +03:00
nishinji 6e340bcdc1
Fix ja_JP.ts (#594)
* Fix ja_JP.ts

* a
2024-08-26 10:56:11 +03:00
georgemoralis 7f6d08a3c8
Merge pull request #589 from greggameplayer/feature/TBUFFER_STORE_FORMAT_XY
Implement missing TBUFFER_STORE_FORMAT_XY
2024-08-26 09:40:40 +03:00
nishinji 7aa8cf992f
Add Japanese translation (#591) 2024-08-26 09:39:49 +03:00
¥IGA e16aa2a012
Update French tranlations (#592) 2024-08-26 09:39:24 +03:00
greggameplayer 86870e7c8d Implement TBUFFER_STORE_FORMAT_XY 2024-08-26 03:39:38 +02:00
Daniel R. fae0c0ae85
core/kernel: Miscellaneous memory fixes (#557)
* core/libraries/kernel: Fix inaccurate direct memory size

* core/memory: Fix available dmem query on non-free dmem areas

* core/kernel: return ENOMEM if memory area size is zero

* core/kernel: Fix returns on `sceKernelAvailableDirectMemorySize`

* core/memory: Remove unneeded size alignment
2024-08-26 04:14:21 +03:00
Yury 5d7407dc7d
Add ru translation (#579) 2024-08-26 03:22:30 +03:00
bigol83 bcc3a10557
Add Italian translation (#585)
* Update it.ts

* Update it.ts
2024-08-26 03:22:07 +03:00
182 changed files with 16290 additions and 3522 deletions

3
.gitmodules vendored
View File

@ -82,3 +82,6 @@
path = externals/ffmpeg-core path = externals/ffmpeg-core
url = https://github.com/shadps4-emu/ext-ffmpeg-core.git url = https://github.com/shadps4-emu/ext-ffmpeg-core.git
shallow = true shallow = true
[submodule "externals/half"]
path = externals/half
url = https://github.com/ROCm/half.git

View File

@ -95,10 +95,6 @@ check_symbol_exists(pthread_mutex_timedlock "pthread.h" HAVE_PTHREAD_MUTEX_TIMED
if(HAVE_PTHREAD_MUTEX_TIMEDLOCK OR WIN32) if(HAVE_PTHREAD_MUTEX_TIMEDLOCK OR WIN32)
add_compile_options(-DHAVE_PTHREAD_MUTEX_TIMEDLOCK) add_compile_options(-DHAVE_PTHREAD_MUTEX_TIMEDLOCK)
endif() endif()
check_symbol_exists(sem_timedwait "semaphore.h" HAVE_SEM_TIMEDWAIT)
if(HAVE_SEM_TIMEDWAIT OR WIN32)
add_compile_options(-DHAVE_SEM_TIMEDWAIT)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# libc++ requires -fexperimental-library to enable std::jthread and std::stop_token support. # libc++ requires -fexperimental-library to enable std::jthread and std::stop_token support.
@ -113,7 +109,7 @@ add_subdirectory(externals)
include_directories(src) include_directories(src)
if(ENABLE_QT_GUI) if(ENABLE_QT_GUI)
find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent LinguistTools) find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent LinguistTools Network)
qt_standard_project_setup() qt_standard_project_setup()
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
@ -152,6 +148,7 @@ set(AUDIO_LIB src/core/libraries/audio/audioin.cpp
set(GNM_LIB src/core/libraries/gnmdriver/gnmdriver.cpp set(GNM_LIB src/core/libraries/gnmdriver/gnmdriver.cpp
src/core/libraries/gnmdriver/gnmdriver.h src/core/libraries/gnmdriver/gnmdriver.h
src/core/libraries/gnmdriver/gnm_error.h
) )
set(KERNEL_LIB set(KERNEL_LIB
@ -233,6 +230,7 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
src/core/libraries/ngs2/ngs2_error.h src/core/libraries/ngs2/ngs2_error.h
src/core/libraries/ngs2/ngs2_impl.cpp src/core/libraries/ngs2/ngs2_impl.cpp
src/core/libraries/ngs2/ngs2_impl.h src/core/libraries/ngs2/ngs2_impl.h
src/core/libraries/ajm/ajm_error.h
) )
set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h
@ -268,6 +266,7 @@ set(PLAYGO_LIB src/core/libraries/playgo/playgo.cpp
set(RANDOM_LIB src/core/libraries/random/random.cpp set(RANDOM_LIB src/core/libraries/random/random.cpp
src/core/libraries/random/random.h src/core/libraries/random/random.h
src/core/libraries/random/random_error.h
) )
set(USBD_LIB src/core/libraries/usbd/usbd.cpp set(USBD_LIB src/core/libraries/usbd/usbd.cpp
@ -450,7 +449,7 @@ set(SHADER_RECOMPILER src/shader_recompiler/exception.h
src/shader_recompiler/frontend/opcodes.h src/shader_recompiler/frontend/opcodes.h
src/shader_recompiler/frontend/structured_control_flow.cpp src/shader_recompiler/frontend/structured_control_flow.cpp
src/shader_recompiler/frontend/structured_control_flow.h src/shader_recompiler/frontend/structured_control_flow.h
src/shader_recompiler/ir/passes/constant_propogation_pass.cpp src/shader_recompiler/ir/passes/constant_propagation_pass.cpp
src/shader_recompiler/ir/passes/dead_code_elimination_pass.cpp src/shader_recompiler/ir/passes/dead_code_elimination_pass.cpp
src/shader_recompiler/ir/passes/identity_removal_pass.cpp src/shader_recompiler/ir/passes/identity_removal_pass.cpp
src/shader_recompiler/ir/passes/ir_passes.h src/shader_recompiler/ir/passes/ir_passes.h
@ -522,6 +521,8 @@ set(VIDEO_CORE src/video_core/amdgpu/liverpool.cpp
src/video_core/renderer_vulkan/vk_resource_pool.h src/video_core/renderer_vulkan/vk_resource_pool.h
src/video_core/renderer_vulkan/vk_scheduler.cpp src/video_core/renderer_vulkan/vk_scheduler.cpp
src/video_core/renderer_vulkan/vk_scheduler.h src/video_core/renderer_vulkan/vk_scheduler.h
src/video_core/renderer_vulkan/vk_shader_cache.cpp
src/video_core/renderer_vulkan/vk_shader_cache.h
src/video_core/renderer_vulkan/vk_shader_util.cpp src/video_core/renderer_vulkan/vk_shader_util.cpp
src/video_core/renderer_vulkan/vk_shader_util.h src/video_core/renderer_vulkan/vk_shader_util.h
src/video_core/renderer_vulkan/vk_swapchain.cpp src/video_core/renderer_vulkan/vk_swapchain.cpp
@ -564,6 +565,10 @@ qt_add_resources(RESOURCE_FILES src/shadps4.qrc)
set(QT_GUI src/qt_gui/about_dialog.cpp set(QT_GUI src/qt_gui/about_dialog.cpp
src/qt_gui/about_dialog.h src/qt_gui/about_dialog.h
src/qt_gui/about_dialog.ui src/qt_gui/about_dialog.ui
src/qt_gui/cheats_patches.cpp
src/qt_gui/cheats_patches.h
src/qt_gui/memory_patcher.cpp
src/qt_gui/memory_patcher.h
src/qt_gui/main_window_ui.h src/qt_gui/main_window_ui.h
src/qt_gui/main_window.cpp src/qt_gui/main_window.cpp
src/qt_gui/main_window.h src/qt_gui/main_window.h
@ -639,6 +644,9 @@ if (APPLE)
# Replacement for std::chrono::time_zone # Replacement for std::chrono::time_zone
target_link_libraries(shadps4 PRIVATE date::date-tz) target_link_libraries(shadps4 PRIVATE date::date-tz)
# Half float conversions for F16C patches
target_link_libraries(shadps4 PRIVATE half)
endif() endif()
if (NOT ENABLE_QT_GUI) if (NOT ENABLE_QT_GUI)
@ -652,7 +660,8 @@ else()
endif() endif()
if (ENABLE_QT_GUI) if (ENABLE_QT_GUI)
target_link_libraries(shadps4 PRIVATE Qt6::Widgets Qt6::Concurrent) target_link_libraries(shadps4 PRIVATE Qt6::Widgets Qt6::Concurrent Qt6::Network)
add_definitions(-DENABLE_QT_GUI)
endif() endif()
if (WIN32) if (WIN32)

View File

@ -17,34 +17,53 @@ Note: **ARM64 is not supported!** As of writing, it will not build nor run. The
Once you are within the installer: Once you are within the installer:
1. Select `Desktop development with C++` 1. Select `Desktop development with C++`
2. Go to "Individual Components" tab 2. Go to "Individual Components" tab
3. Make sure `C++ Clang Compiler for Windows`, `MSBuild support for LLVM` and `C++ CMake Tools for Windows` are selected 3. Search and select `C++ Clang Compiler for Windows` and `MSBuild support for LLVM`
4. Continue the installation 4. Continue the installation
### (Prerequisite) Download [**Qt**](https://doc.qt.io/qt-6/get-and-install-qt.html) ### (Prerequisite) Download [**Qt**](https://doc.qt.io/qt-6/get-and-install-qt.html)
Beware, this requires you to create a Qt account. If you do not want to do this, please follow the MSYS2/MinGW compilation method instead. Beware, this requires you to create a Qt account. If you do not want to do this, please follow the MSYS2/MinGW compilation method instead.
1. Select Qt for Visual Studio plugin 1. Under the current, non beta version of Qt (at the time of writing 6.7.2), select the option `MSVC 2019 64-bit` or similar.
2. Select `msvc2019_64` option or similar. If you are on Windows on ARM / Qualcomm Snapdragon Elite X, select `msvc2019_arm64` If you are on Windows on ARM / Qualcomm Snapdragon Elite X, select `MSVC 2019 ARM64` instead.
Go through the installation normally. If you do not know what components to select, just select the newest Qt version it gives you. Go through the installation normally. If you know what you are doing, you may unselect individual components that eat up too much disk space.
If you know what you are doing, you may unselect individual components that eat up too much disk space.
2. Download and install [Qt Visual Studio Tools](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.QtVisualStudioTools2022)
Once you are finished, you will have to configure Qt within Visual Studio: Once you are finished, you will have to configure Qt within Visual Studio:
1. Tools -> Options -> Qt -> Versions 1. Tools -> Options -> Qt -> Versions
2. Add a new Qt version and navigate it to the correct folder. Should look like so: `C:\Qt\6.7.1\msvc2019_64` 2. Add a new Qt version and navigate it to the correct folder. Should look like so: `C:\Qt\6.7.2\msvc2019_64`
3. Enable the default checkmark on the new version you just created. 3. Enable the default checkmark on the new version you just created.
### (Prerequisite) Download [**Git for Windows**](https://git-scm.com/download/win) ### (Prerequisite) Download [**Git for Windows**](https://git-scm.com/download/win)
Go through the Git for Windows installation as normal Go through the Git for Windows installation as normal
### Compiling with Visual Studio GUI ### Cloning the source code
1. Open Git for Windows, navigate to a place where you want to store the shadPS4 source code folder 1. Open Git for Windows, navigate to a place where you want to store the shadPS4 source code folder
2. Run `git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4` 2. Clone the repository by running
3. Open up Visual Studio, select `Open a local folder` and select the folder with the shadPS4 source code. The folder should contain `CMakeLists.txt` `git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4`
4. Build -> Build All
### Compiling with Visual Studio GUI
1. Open up Visual Studio, select `Open a local folder` and select the folder with the shadPS4 source code. The folder should contain `CMakeLists.txt`
2. Change x64-Clang-Debug to x64-Clang-Release if you want a regular, non-debug build.
3. If you want to build shadPS4 with the Qt Gui:
1. Click x64-Clang-Release and select "Manage Configurations"
2. Look for "CMake command arguments" and add to the text field
`-DENABLE_QT_GUI=ON -DCMAKE_PREFIX_PATH=C:\Qt\6.7.2\msvc2019_64`
(Change Qt path if you've installed it to non-default path)
3. Press CTRL+S to save and wait a moment for CMake generation
4. Change the project to build to shadps4.exe
5. Build -> Build All
Your shadps4.exe will be in `c:\path\to\source\Build\x64-Clang-Release\`
To automatically populate the necessary files to run shadPS4.exe, run in a command prompt or terminal:
`C:\Qt\6.7.2\msvc2019_64\bin\windeployqt.exe c:\path\to\shadps4.exe`
(Change Qt path if you've installed it to non-default path)
## Option 2: MSYS2/MinGW ## Option 2: MSYS2/MinGW

View File

@ -142,11 +142,17 @@ if (WIN32)
target_compile_options(sirit PUBLIC "-Wno-error=unused-command-line-argument") target_compile_options(sirit PUBLIC "-Wno-error=unused-command-line-argument")
endif() endif()
# date if (APPLE)
if (APPLE AND NOT TARGET date::date-tz) # half
add_library(half INTERFACE)
target_include_directories(half INTERFACE half/include)
# date
if (NOT TARGET date::date-tz)
option(BUILD_TZ_LIB "" ON) option(BUILD_TZ_LIB "" ON)
option(USE_SYSTEM_TZ_DB "" ON) option(USE_SYSTEM_TZ_DB "" ON)
add_subdirectory(date) add_subdirectory(date)
endif()
endif() endif()
# Tracy # Tracy

2
externals/glslang vendored

@ -1 +1 @@
Subproject commit d59c84d388c805022e2bddea08aa41cbe7e43e55 Subproject commit 12cbda959b6df2af119a76a73ff906c2bed36884

1
externals/half vendored Submodule

@ -0,0 +1 @@
Subproject commit 1ddada225144cac0de8f6b5c0dd9acffd99a2e68

2
externals/robin-map vendored

@ -1 +1 @@
Subproject commit 1115dad3ffa0994e3f43b693d9b9cc99944c64c1 Subproject commit 2c48a1a50203bbaf1e3d0d64c5d726d56f8d3bb3

2
externals/sirit vendored

@ -1 +1 @@
Subproject commit 8db09231c448b913ae905d5237ce2eca46e3fe87 Subproject commit 37090c74cc6e680f2bc334cac8fd182f7634a1f6

2
externals/toml11 vendored

@ -1 +1 @@
Subproject commit cc0bee4fd46ea1f5db147d63ea545208cc9e8405 Subproject commit 4b740127230472779c4a4d71e1a75aaa3a367a2d

2
externals/xbyak vendored

@ -1 +1 @@
Subproject commit aabb091ae37068498751fd58202a9854408ecb0e Subproject commit ccdf68421bc8eb85693f573080fc0a5faad862db

View File

@ -114108,7 +114108,7 @@ STUB(
_ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS1_7Matches2V124RequestCompetitiveResultEE7add_refEv) _ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS1_7Matches2V124RequestCompetitiveResultEE7add_refEv)
STUB("efPahl2FufA", STUB("efPahl2FufA",
_ZN3sce2Np9CppWebApi30CommunicationRestrictionStatus2V35Error8fromJsonERKNS_4Json5ValueE) _ZN3sce2Np9CppWebApi30CommunicationRestrictionStatus2V35Error8fromJsonERKNS_4Json5ValueE)
STUB("efX3lrPwdKA", sceAppContentAddcontMountByEntitlemetId) STUB("efX3lrPwdKA", sceAppContentAddcontMountByEntitlementId)
STUB("efXnxYFN5oE", _ZNSt11range_errorD0Ev) STUB("efXnxYFN5oE", _ZNSt11range_errorD0Ev)
STUB("efcwuDLsAM0", _ZThn120_NK7WebCore16HTMLMediaElement5mutedEv) STUB("efcwuDLsAM0", _ZThn120_NK7WebCore16HTMLMediaElement5mutedEv)
STUB("efhGArzWdxE", _ZN7bmalloc6IsoTLS15s_didInitializeE) STUB("efhGArzWdxE", _ZN7bmalloc6IsoTLS15s_didInitializeE)
@ -129493,7 +129493,7 @@ STUB(
STUB("kJlYH5uMAWI", sceNetResolverDestroy) STUB("kJlYH5uMAWI", sceNetResolverDestroy)
STUB("kJmdxo4uM+8", STUB("kJmdxo4uM+8",
_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE5_InitERKSt8_Locinfo) _ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE5_InitERKSt8_Locinfo)
STUB("kJmjt81mXKQ", sceAppContentAddcontEnqueueDownloadByEntitlemetId) STUB("kJmjt81mXKQ", sceAppContentAddcontEnqueueDownloadByEntitlementId)
STUB( STUB(
"kJoY9lMIFzY", "kJoY9lMIFzY",
_ZN3sce2Np9CppWebApi6Common8IteratorINS2_12IntrusivePtrINS1_21AdvancedPlayerProfile2V138MatchCompletionRateDisconnectedMetricsEEEEmmEi) _ZN3sce2Np9CppWebApi6Common8IteratorINS2_12IntrusivePtrINS1_21AdvancedPlayerProfile2V138MatchCompletionRateDisconnectedMetricsEEEEmmEi)

View File

@ -80897,10 +80897,10 @@ sceAppCheckerExecute
sceAppCheckerExecuteEx sceAppCheckerExecuteEx
sceAppContentAddcontDelete sceAppContentAddcontDelete
sceAppContentAddcontEnqueueDownload sceAppContentAddcontEnqueueDownload
sceAppContentAddcontEnqueueDownloadByEntitlemetId sceAppContentAddcontEnqueueDownloadByEntitlementId
sceAppContentAddcontEnqueueDownloadSp sceAppContentAddcontEnqueueDownloadSp
sceAppContentAddcontMount sceAppContentAddcontMount
sceAppContentAddcontMountByEntitlemetId sceAppContentAddcontMountByEntitlementId
sceAppContentAddcontShrink sceAppContentAddcontShrink
sceAppContentAddcontUnmount sceAppContentAddcontUnmount
sceAppContentAppParamGetInt sceAppContentAppParamGetInt

View File

@ -17,9 +17,12 @@ static s32 gpuId = -1; // Vulkan physical device index. Set to negative for auto
static std::string logFilter; static std::string logFilter;
static std::string logType = "async"; static std::string logType = "async";
static std::string userName = "shadPS4"; static std::string userName = "shadPS4";
static bool useSpecialPad = false;
static int specialPadClass = 1;
static bool isDebugDump = false; static bool isDebugDump = false;
static bool isShowSplash = false; static bool isShowSplash = false;
static bool isNullGpu = false; static bool isNullGpu = false;
static bool shouldCopyGPUBuffers = false;
static bool shouldDumpShaders = false; static bool shouldDumpShaders = false;
static bool shouldDumpPM4 = false; static bool shouldDumpPM4 = false;
static u32 vblankDivider = 1; static u32 vblankDivider = 1;
@ -81,6 +84,14 @@ std::string getUserName() {
return userName; return userName;
} }
bool getUseSpecialPad() {
return useSpecialPad;
}
int getSpecialPadClass() {
return specialPadClass;
}
bool debugDump() { bool debugDump() {
return isDebugDump; return isDebugDump;
} }
@ -93,6 +104,10 @@ bool nullGpu() {
return isNullGpu; return isNullGpu;
} }
bool copyGPUCmdBuffers() {
return shouldCopyGPUBuffers;
}
bool dumpShaders() { bool dumpShaders() {
return shouldDumpShaders; return shouldDumpShaders;
} }
@ -149,6 +164,10 @@ void setNullGpu(bool enable) {
isNullGpu = enable; isNullGpu = enable;
} }
void setCopyGPUCmdBuffers(bool enable) {
shouldCopyGPUBuffers = enable;
}
void setDumpShaders(bool enable) { void setDumpShaders(bool enable) {
shouldDumpShaders = enable; shouldDumpShaders = enable;
} }
@ -197,6 +216,14 @@ void setUserName(const std::string& type) {
userName = type; userName = type;
} }
void setUseSpecialPad(bool use) {
useSpecialPad = use;
}
void setSpecialPadClass(int type) {
specialPadClass = type;
}
void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h) { void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h) {
main_window_geometry_x = x; main_window_geometry_x = x;
main_window_geometry_y = y; main_window_geometry_y = y;
@ -215,10 +242,10 @@ void setIconSize(u32 size) {
void setIconSizeGrid(u32 size) { void setIconSizeGrid(u32 size) {
m_icon_size_grid = size; m_icon_size_grid = size;
} }
void setSliderPositon(u32 pos) { void setSliderPosition(u32 pos) {
m_slider_pos = pos; m_slider_pos = pos;
} }
void setSliderPositonGrid(u32 pos) { void setSliderPositionGrid(u32 pos) {
m_slider_pos_grid = pos; m_slider_pos_grid = pos;
} }
void setTableMode(u32 mode) { void setTableMode(u32 mode) {
@ -271,10 +298,10 @@ u32 getIconSize() {
u32 getIconSizeGrid() { u32 getIconSizeGrid() {
return m_icon_size_grid; return m_icon_size_grid;
} }
u32 getSliderPositon() { u32 getSliderPosition() {
return m_slider_pos; return m_slider_pos;
} }
u32 getSliderPositonGrid() { u32 getSliderPositionGrid() {
return m_slider_pos_grid; return m_slider_pos_grid;
} }
u32 getTableMode() { u32 getTableMode() {
@ -330,12 +357,20 @@ void load(const std::filesystem::path& path) {
isShowSplash = toml::find_or<bool>(general, "showSplash", true); isShowSplash = toml::find_or<bool>(general, "showSplash", true);
} }
if (data.contains("Input")) {
const toml::value& input = data.at("Input");
useSpecialPad = toml::find_or<bool>(input, "useSpecialPad", false);
specialPadClass = toml::find_or<int>(input, "specialPadClass", 1);
}
if (data.contains("GPU")) { if (data.contains("GPU")) {
const toml::value& gpu = data.at("GPU"); const toml::value& gpu = data.at("GPU");
screenWidth = toml::find_or<int>(gpu, "screenWidth", screenWidth); screenWidth = toml::find_or<int>(gpu, "screenWidth", screenWidth);
screenHeight = toml::find_or<int>(gpu, "screenHeight", screenHeight); screenHeight = toml::find_or<int>(gpu, "screenHeight", screenHeight);
isNullGpu = toml::find_or<bool>(gpu, "nullGpu", false); isNullGpu = toml::find_or<bool>(gpu, "nullGpu", false);
shouldCopyGPUBuffers = toml::find_or<bool>(gpu, "copyGPUBuffers", false);
shouldDumpShaders = toml::find_or<bool>(gpu, "dumpShaders", false); shouldDumpShaders = toml::find_or<bool>(gpu, "dumpShaders", false);
shouldDumpPM4 = toml::find_or<bool>(gpu, "dumpPM4", false); shouldDumpPM4 = toml::find_or<bool>(gpu, "dumpPM4", false);
vblankDivider = toml::find_or<int>(gpu, "vblankDivider", 1); vblankDivider = toml::find_or<int>(gpu, "vblankDivider", 1);
@ -411,9 +446,12 @@ void save(const std::filesystem::path& path) {
data["General"]["logType"] = logType; data["General"]["logType"] = logType;
data["General"]["userName"] = userName; data["General"]["userName"] = userName;
data["General"]["showSplash"] = isShowSplash; data["General"]["showSplash"] = isShowSplash;
data["Input"]["useSpecialPad"] = useSpecialPad;
data["Input"]["specialPadClass"] = specialPadClass;
data["GPU"]["screenWidth"] = screenWidth; data["GPU"]["screenWidth"] = screenWidth;
data["GPU"]["screenHeight"] = screenHeight; data["GPU"]["screenHeight"] = screenHeight;
data["GPU"]["nullGpu"] = isNullGpu; data["GPU"]["nullGpu"] = isNullGpu;
data["GPU"]["copyGPUBuffers"] = shouldCopyGPUBuffers;
data["GPU"]["dumpShaders"] = shouldDumpShaders; data["GPU"]["dumpShaders"] = shouldDumpShaders;
data["GPU"]["dumpPM4"] = shouldDumpPM4; data["GPU"]["dumpPM4"] = shouldDumpPM4;
data["GPU"]["vblankDivider"] = vblankDivider; data["GPU"]["vblankDivider"] = vblankDivider;
@ -457,6 +495,8 @@ void setDefaultValues() {
logFilter = ""; logFilter = "";
logType = "async"; logType = "async";
userName = "shadPS4"; userName = "shadPS4";
useSpecialPad = false;
specialPadClass = 1;
isDebugDump = false; isDebugDump = false;
isShowSplash = false; isShowSplash = false;
isNullGpu = false; isNullGpu = false;

View File

@ -17,6 +17,9 @@ std::string getLogFilter();
std::string getLogType(); std::string getLogType();
std::string getUserName(); std::string getUserName();
bool getUseSpecialPad();
int getSpecialPadClass();
u32 getScreenWidth(); u32 getScreenWidth();
u32 getScreenHeight(); u32 getScreenHeight();
s32 getGpuId(); s32 getGpuId();
@ -24,6 +27,7 @@ s32 getGpuId();
bool debugDump(); bool debugDump();
bool showSplash(); bool showSplash();
bool nullGpu(); bool nullGpu();
bool copyGPUCmdBuffers();
bool dumpShaders(); bool dumpShaders();
bool dumpPM4(); bool dumpPM4();
bool isRdocEnabled(); bool isRdocEnabled();
@ -33,6 +37,7 @@ u32 vblankDiv();
void setDebugDump(bool enable); void setDebugDump(bool enable);
void setShowSplash(bool enable); void setShowSplash(bool enable);
void setNullGpu(bool enable); void setNullGpu(bool enable);
void setCopyGPUCmdBuffers(bool enable);
void setDumpShaders(bool enable); void setDumpShaders(bool enable);
void setDumpPM4(bool enable); void setDumpPM4(bool enable);
void setVblankDiv(u32 value); void setVblankDiv(u32 value);
@ -44,6 +49,9 @@ void setLanguage(u32 language);
void setNeoMode(bool enable); void setNeoMode(bool enable);
void setUserName(const std::string& type); void setUserName(const std::string& type);
void setUseSpecialPad(bool use);
void setSpecialPadClass(int type);
void setLogType(const std::string& type); void setLogType(const std::string& type);
void setLogFilter(const std::string& type); void setLogFilter(const std::string& type);
@ -61,8 +69,8 @@ void setGameInstallDir(const std::string& dir);
void setMainWindowTheme(u32 theme); void setMainWindowTheme(u32 theme);
void setIconSize(u32 size); void setIconSize(u32 size);
void setIconSizeGrid(u32 size); void setIconSizeGrid(u32 size);
void setSliderPositon(u32 pos); void setSliderPosition(u32 pos);
void setSliderPositonGrid(u32 pos); void setSliderPositionGrid(u32 pos);
void setTableMode(u32 mode); void setTableMode(u32 mode);
void setMainWindowWidth(u32 width); void setMainWindowWidth(u32 width);
void setMainWindowHeight(u32 height); void setMainWindowHeight(u32 height);
@ -79,8 +87,8 @@ std::string getGameInstallDir();
u32 getMainWindowTheme(); u32 getMainWindowTheme();
u32 getIconSize(); u32 getIconSize();
u32 getIconSizeGrid(); u32 getIconSizeGrid();
u32 getSliderPositon(); u32 getSliderPosition();
u32 getSliderPositonGrid(); u32 getSliderPositionGrid();
u32 getTableMode(); u32 getTableMode();
u32 getMainWindowWidth(); u32 getMainWindowWidth();
u32 getMainWindowHeight(); u32 getMainWindowHeight();

View File

@ -29,7 +29,7 @@ static inline bool IsProfilerConnected() {
#define TRACK_ALLOC(ptr, size, pool) TracyAllocN(std::bit_cast<void*>(ptr), (size), (pool)) #define TRACK_ALLOC(ptr, size, pool) TracyAllocN(std::bit_cast<void*>(ptr), (size), (pool))
#define TRACK_FREE(ptr, pool) TracyFreeN(std::bit_cast<void*>(ptr), (pool)) #define TRACK_FREE(ptr, pool) TracyFreeN(std::bit_cast<void*>(ptr), (pool))
enum MarkersPallete : int { enum MarkersPalette : int {
EmulatorMarkerColor = 0x264653, EmulatorMarkerColor = 0x264653,
RendererMarkerColor = 0x2a9d8f, RendererMarkerColor = 0x2a9d8f,
HleMarkerColor = 0xe9c46a, HleMarkerColor = 0xe9c46a,

View File

@ -104,6 +104,9 @@ static auto UserPaths = [] {
create_path(PathType::SysModuleDir, user_dir / SYSMODULES_DIR); create_path(PathType::SysModuleDir, user_dir / SYSMODULES_DIR);
create_path(PathType::DownloadDir, user_dir / DOWNLOAD_DIR); create_path(PathType::DownloadDir, user_dir / DOWNLOAD_DIR);
create_path(PathType::CapturesDir, user_dir / CAPTURES_DIR); create_path(PathType::CapturesDir, user_dir / CAPTURES_DIR);
create_path(PathType::CheatsDir, user_dir / CHEATS_DIR);
create_path(PathType::PatchesDir, user_dir / PATCHES_DIR);
create_path(PathType::AddonsDir, user_dir / ADDONS_DIR);
return paths; return paths;
}(); }();

View File

@ -20,6 +20,9 @@ enum class PathType {
SysModuleDir, // Where system modules are stored. SysModuleDir, // Where system modules are stored.
DownloadDir, // Where downloads/temp files are stored. DownloadDir, // Where downloads/temp files are stored.
CapturesDir, // Where rdoc captures are stored. CapturesDir, // Where rdoc captures are stored.
CheatsDir, // Where cheats are stored.
PatchesDir, // Where patches are stored.
AddonsDir, // Where additional content is stored.
}; };
constexpr auto PORTABLE_DIR = "user"; constexpr auto PORTABLE_DIR = "user";
@ -35,6 +38,9 @@ constexpr auto TEMPDATA_DIR = "temp";
constexpr auto SYSMODULES_DIR = "sys_modules"; constexpr auto SYSMODULES_DIR = "sys_modules";
constexpr auto DOWNLOAD_DIR = "download"; constexpr auto DOWNLOAD_DIR = "download";
constexpr auto CAPTURES_DIR = "captures"; constexpr auto CAPTURES_DIR = "captures";
constexpr auto CHEATS_DIR = "cheats";
constexpr auto PATCHES_DIR = "patches";
constexpr auto ADDONS_DIR = "addcont";
// Filenames // Filenames
constexpr auto LOG_FILE = "shad_log.txt"; constexpr auto LOG_FILE = "shad_log.txt";

View File

@ -114108,7 +114108,7 @@ STUB(
_ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS1_7Matches2V124RequestCompetitiveResultEE7add_refEv) _ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS1_7Matches2V124RequestCompetitiveResultEE7add_refEv)
STUB("efPahl2FufA", STUB("efPahl2FufA",
_ZN3sce2Np9CppWebApi30CommunicationRestrictionStatus2V35Error8fromJsonERKNS_4Json5ValueE) _ZN3sce2Np9CppWebApi30CommunicationRestrictionStatus2V35Error8fromJsonERKNS_4Json5ValueE)
STUB("efX3lrPwdKA", sceAppContentAddcontMountByEntitlemetId) STUB("efX3lrPwdKA", sceAppContentAddcontMountByEntitlementId)
STUB("efXnxYFN5oE", _ZNSt11range_errorD0Ev) STUB("efXnxYFN5oE", _ZNSt11range_errorD0Ev)
STUB("efcwuDLsAM0", _ZThn120_NK7WebCore16HTMLMediaElement5mutedEv) STUB("efcwuDLsAM0", _ZThn120_NK7WebCore16HTMLMediaElement5mutedEv)
STUB("efhGArzWdxE", _ZN7bmalloc6IsoTLS15s_didInitializeE) STUB("efhGArzWdxE", _ZN7bmalloc6IsoTLS15s_didInitializeE)
@ -129493,7 +129493,7 @@ STUB(
STUB("kJlYH5uMAWI", sceNetResolverDestroy) STUB("kJlYH5uMAWI", sceNetResolverDestroy)
STUB("kJmdxo4uM+8", STUB("kJmdxo4uM+8",
_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE5_InitERKSt8_Locinfo) _ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE5_InitERKSt8_Locinfo)
STUB("kJmjt81mXKQ", sceAppContentAddcontEnqueueDownloadByEntitlemetId) STUB("kJmjt81mXKQ", sceAppContentAddcontEnqueueDownloadByEntitlementId)
STUB( STUB(
"kJoY9lMIFzY", "kJoY9lMIFzY",
_ZN3sce2Np9CppWebApi6Common8IteratorINS2_12IntrusivePtrINS1_21AdvancedPlayerProfile2V138MatchCompletionRateDisconnectedMetricsEEEEmmEi) _ZN3sce2Np9CppWebApi6Common8IteratorINS2_12IntrusivePtrINS1_21AdvancedPlayerProfile2V138MatchCompletionRateDisconnectedMetricsEEEEmmEi)

View File

@ -13,7 +13,7 @@ namespace Core::AeroLib {
// on lookup, setting up the nid_entry they are matched with // on lookup, setting up the nid_entry they are matched with
// //
// If it runs out of stubs with name information, it will return // If it runs out of stubs with name information, it will return
// a default implemetnation without function name details // a default implementation without function name details
// Up to 512, larger values lead to more resolve stub slots // Up to 512, larger values lead to more resolve stub slots
// and to longer compile / CI times // and to longer compile / CI times

View File

@ -15,6 +15,7 @@
#else #else
#include <pthread.h> #include <pthread.h>
#ifdef __APPLE__ #ifdef __APPLE__
#include <half.hpp>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif #endif
#endif #endif
@ -30,6 +31,12 @@ static Xbyak::Reg ZydisToXbyakRegister(const ZydisRegister reg) {
if (reg >= ZYDIS_REGISTER_RAX && reg <= ZYDIS_REGISTER_R15) { if (reg >= ZYDIS_REGISTER_RAX && reg <= ZYDIS_REGISTER_R15) {
return Xbyak::Reg64(reg - ZYDIS_REGISTER_RAX + Xbyak::Operand::RAX); return Xbyak::Reg64(reg - ZYDIS_REGISTER_RAX + Xbyak::Operand::RAX);
} }
if (reg >= ZYDIS_REGISTER_XMM0 && reg <= ZYDIS_REGISTER_XMM31) {
return Xbyak::Xmm(reg - ZYDIS_REGISTER_XMM0 + xmm0.getIdx());
}
if (reg >= ZYDIS_REGISTER_YMM0 && reg <= ZYDIS_REGISTER_YMM31) {
return Xbyak::Ymm(reg - ZYDIS_REGISTER_YMM0 + ymm0.getIdx());
}
UNREACHABLE_MSG("Unsupported register: {}", static_cast<u32>(reg)); UNREACHABLE_MSG("Unsupported register: {}", static_cast<u32>(reg));
} }
@ -66,6 +73,12 @@ static Xbyak::Address ZydisToXbyakMemoryOperand(const ZydisDecodedOperand& opera
return ptr[expression]; return ptr[expression];
} }
static u64 ZydisToXbyakImmediateOperand(const ZydisDecodedOperand& operand) {
ASSERT_MSG(operand.type == ZYDIS_OPERAND_TYPE_IMMEDIATE,
"Expected immediate operand, got type: {}", static_cast<u32>(operand.type));
return operand.imm.value.u;
}
static std::unique_ptr<Xbyak::Operand> ZydisToXbyakOperand(const ZydisDecodedOperand& operand) { static std::unique_ptr<Xbyak::Operand> ZydisToXbyakOperand(const ZydisDecodedOperand& operand) {
switch (operand.type) { switch (operand.type) {
case ZYDIS_OPERAND_TYPE_REGISTER: { case ZYDIS_OPERAND_TYPE_REGISTER: {
@ -110,51 +123,135 @@ static Xbyak::Reg AllocateScratchRegister(
#ifdef __APPLE__ #ifdef __APPLE__
static constexpr u32 MaxSavedRegisters = 3; static pthread_key_t stack_pointer_slot;
static pthread_key_t register_save_slots[MaxSavedRegisters]; static pthread_key_t patch_stack_slot;
static std::once_flag register_save_init_flag; static std::once_flag patch_context_slots_init_flag;
static_assert(sizeof(void*) == sizeof(u64), static_assert(sizeof(void*) == sizeof(u64),
"Cannot fit a register inside a thread local storage slot."); "Cannot fit a register inside a thread local storage slot.");
static void InitializeRegisterSaveSlots() { static void InitializePatchContextSlots() {
for (u32 i = 0; i < MaxSavedRegisters; i++) { ASSERT_MSG(pthread_key_create(&stack_pointer_slot, nullptr) == 0,
ASSERT_MSG(pthread_key_create(&register_save_slots[i], nullptr) == 0, "Unable to allocate thread-local register for stack pointer.");
"Unable to allocate thread-local register save slot {}", i); ASSERT_MSG(pthread_key_create(&patch_stack_slot, nullptr) == 0,
"Unable to allocate thread-local register for patch stack.");
}
void InitializeThreadPatchStack() {
std::call_once(patch_context_slots_init_flag, InitializePatchContextSlots);
const auto* patch_stack = std::malloc(0x1000);
pthread_setspecific(patch_stack_slot, patch_stack);
}
void CleanupThreadPatchStack() {
std::call_once(patch_context_slots_init_flag, InitializePatchContextSlots);
auto* patch_stack = pthread_getspecific(patch_stack_slot);
if (patch_stack != nullptr) {
std::free(patch_stack);
pthread_setspecific(patch_stack_slot, nullptr);
} }
} }
static void SaveRegisters(Xbyak::CodeGenerator& c, const std::initializer_list<Xbyak::Reg> regs) { /// Saves the stack pointer to thread local storage and loads the patch stack.
ASSERT_MSG(regs.size() <= MaxSavedRegisters, "Not enough space to save {} registers.", static void SaveStack(Xbyak::CodeGenerator& c) {
regs.size()); std::call_once(patch_context_slots_init_flag, InitializePatchContextSlots);
std::call_once(register_save_init_flag, &InitializeRegisterSaveSlots);
u32 index = 0;
for (const auto& reg : regs) {
const auto offset = reinterpret_cast<void*>(register_save_slots[index++] * sizeof(void*));
// Save stack pointer and load patch stack.
c.putSeg(gs); c.putSeg(gs);
c.mov(qword[offset], reg.cvt64()); c.mov(qword[reinterpret_cast<void*>(stack_pointer_slot * sizeof(void*))], rsp);
} c.putSeg(gs);
c.mov(rsp, qword[reinterpret_cast<void*>(patch_stack_slot * sizeof(void*))]);
} }
/// Restores the stack pointer from thread local storage.
static void RestoreStack(Xbyak::CodeGenerator& c) {
std::call_once(patch_context_slots_init_flag, InitializePatchContextSlots);
// Save patch stack pointer and load original stack.
c.putSeg(gs);
c.mov(qword[reinterpret_cast<void*>(patch_stack_slot * sizeof(void*))], rsp);
c.putSeg(gs);
c.mov(rsp, qword[reinterpret_cast<void*>(stack_pointer_slot * sizeof(void*))]);
}
#else
// These utilities are not implemented as we can't save anything to thread local storage without
// temporary registers.
void InitializeThreadPatchStack() {
// No-op
}
void CleanupThreadPatchStack() {
// No-op
}
/// Saves the stack pointer to thread local storage and loads the patch stack.
static void SaveStack(Xbyak::CodeGenerator& c) {
UNIMPLEMENTED();
}
/// Restores the stack pointer from thread local storage.
static void RestoreStack(Xbyak::CodeGenerator& c) {
UNIMPLEMENTED();
}
#endif
/// Switches to the patch stack, saves registers, and restores the original stack.
static void SaveRegisters(Xbyak::CodeGenerator& c, const std::initializer_list<Xbyak::Reg> regs) {
SaveStack(c);
for (const auto& reg : regs) {
c.push(reg.cvt64());
}
RestoreStack(c);
}
/// Switches to the patch stack, restores registers, and restores the original stack.
static void RestoreRegisters(Xbyak::CodeGenerator& c, static void RestoreRegisters(Xbyak::CodeGenerator& c,
const std::initializer_list<Xbyak::Reg> regs) { const std::initializer_list<Xbyak::Reg> regs) {
ASSERT_MSG(regs.size() <= MaxSavedRegisters, "Not enough space to restore {} registers.", SaveStack(c);
regs.size());
std::call_once(register_save_init_flag, &InitializeRegisterSaveSlots);
u32 index = 0;
for (const auto& reg : regs) { for (const auto& reg : regs) {
const auto offset = reinterpret_cast<void*>(register_save_slots[index++] * sizeof(void*)); c.pop(reg.cvt64());
}
RestoreStack(c);
}
c.putSeg(gs); /// Switches to the patch stack and stores all registers.
c.mov(reg.cvt64(), qword[offset]); static void SaveContext(Xbyak::CodeGenerator& c) {
SaveStack(c);
for (int reg = Xbyak::Operand::RAX; reg <= Xbyak::Operand::R15; reg++) {
c.push(Xbyak::Reg64(reg));
}
for (int reg = 0; reg <= 7; reg++) {
c.sub(rsp, 32);
c.vmovdqu(ptr[rsp], Xbyak::Ymm(reg));
} }
} }
/// Restores all registers and restores the original stack.
/// If the destination is a register, it is not restored to preserve the output.
static void RestoreContext(Xbyak::CodeGenerator& c, const Xbyak::Operand& dst) {
for (int reg = 7; reg >= 0; reg--) {
if ((!dst.isXMM() && !dst.isYMM()) || dst.getIdx() != reg) {
c.vmovdqu(Xbyak::Ymm(reg), ptr[rsp]);
}
c.add(rsp, 32);
}
for (int reg = Xbyak::Operand::R15; reg >= Xbyak::Operand::RAX; reg--) {
if (!dst.isREG() || dst.getIdx() != reg) {
c.pop(Xbyak::Reg64(reg));
} else {
c.add(rsp, 4);
}
}
RestoreStack(c);
}
#ifdef __APPLE__
static void GenerateANDN(const ZydisDecodedOperand* operands, Xbyak::CodeGenerator& c) { static void GenerateANDN(const ZydisDecodedOperand* operands, Xbyak::CodeGenerator& c) {
const auto dst = ZydisToXbyakRegisterOperand(operands[0]); const auto dst = ZydisToXbyakRegisterOperand(operands[0]);
const auto src1 = ZydisToXbyakRegisterOperand(operands[1]); const auto src1 = ZydisToXbyakRegisterOperand(operands[1]);
@ -204,9 +301,9 @@ static void GenerateBEXTR(const ZydisDecodedOperand* operands, Xbyak::CodeGenera
c.and_(dst, scratch2); c.and_(dst, scratch2);
if (dst.getIdx() == shift.getIdx()) { if (dst.getIdx() == shift.getIdx()) {
RestoreRegisters(c, {scratch1, scratch2}); RestoreRegisters(c, {scratch2, scratch1});
} else { } else {
RestoreRegisters(c, {scratch1, scratch2, shift}); RestoreRegisters(c, {shift, scratch2, scratch1});
} }
} }
@ -258,10 +355,138 @@ static void GenerateBLSR(const ZydisDecodedOperand* operands, Xbyak::CodeGenerat
RestoreRegisters(c, {scratch}); RestoreRegisters(c, {scratch});
} }
bool FilterRosetta2Only(const ZydisDecodedOperand*) { static __attribute__((sysv_abi)) void PerformVCVTPH2PS(float* out, const half_float::half* in,
const u32 count) {
for (u32 i = 0; i < count; i++) {
out[i] = half_float::half_cast<float>(in[i]);
}
}
static void GenerateVCVTPH2PS(const ZydisDecodedOperand* operands, Xbyak::CodeGenerator& c) {
const auto dst = ZydisToXbyakRegisterOperand(operands[0]);
const auto src = ZydisToXbyakOperand(operands[1]);
const auto float_count = dst.getBit() / 32;
const auto byte_count = float_count * 4;
SaveContext(c);
// Allocate stack space for outputs and load into first parameter.
c.sub(rsp, byte_count);
c.mov(rdi, rsp);
if (src->isXMM()) {
// Allocate stack space for inputs and load into second parameter.
c.sub(rsp, byte_count);
c.mov(rsi, rsp);
// Move input to the allocated space.
c.movdqu(ptr[rsp], *reinterpret_cast<Xbyak::Xmm*>(src.get()));
} else {
c.lea(rsi, src->getAddress());
}
// Load float count into third parameter.
c.mov(rdx, float_count);
c.mov(rax, reinterpret_cast<u64>(PerformVCVTPH2PS));
c.call(rax);
if (src->isXMM()) {
// Clean up after inputs space.
c.add(rsp, byte_count);
}
// Load outputs into destination register and clean up space.
if (dst.isYMM()) {
c.vmovdqu(*reinterpret_cast<const Xbyak::Ymm*>(&dst), ptr[rsp]);
} else {
c.movdqu(*reinterpret_cast<const Xbyak::Xmm*>(&dst), ptr[rsp]);
}
c.add(rsp, byte_count);
RestoreContext(c, dst);
}
using SingleToHalfFloatConverter = half_float::half (*)(float);
static const SingleToHalfFloatConverter SingleToHalfFloatConverters[4] = {
half_float::half_cast<half_float::half, std::round_to_nearest, float>,
half_float::half_cast<half_float::half, std::round_toward_neg_infinity, float>,
half_float::half_cast<half_float::half, std::round_toward_infinity, float>,
half_float::half_cast<half_float::half, std::round_toward_zero, float>,
};
static __attribute__((sysv_abi)) void PerformVCVTPS2PH(half_float::half* out, const float* in,
const u32 count, const u8 rounding_mode) {
const auto conversion_func = SingleToHalfFloatConverters[rounding_mode];
for (u32 i = 0; i < count; i++) {
out[i] = conversion_func(in[i]);
}
}
static void GenerateVCVTPS2PH(const ZydisDecodedOperand* operands, Xbyak::CodeGenerator& c) {
const auto dst = ZydisToXbyakOperand(operands[0]);
const auto src = ZydisToXbyakRegisterOperand(operands[1]);
const auto ctrl = ZydisToXbyakImmediateOperand(operands[2]);
const auto float_count = src.getBit() / 32;
const auto byte_count = float_count * 4;
SaveContext(c);
if (dst->isXMM()) {
// Allocate stack space for outputs and load into first parameter.
c.sub(rsp, byte_count);
c.mov(rdi, rsp);
} else {
c.lea(rdi, dst->getAddress());
}
// Allocate stack space for inputs and load into second parameter.
c.sub(rsp, byte_count);
c.mov(rsi, rsp);
// Move input to the allocated space.
if (src.isYMM()) {
c.vmovdqu(ptr[rsp], *reinterpret_cast<const Xbyak::Ymm*>(&src));
} else {
c.movdqu(ptr[rsp], *reinterpret_cast<const Xbyak::Xmm*>(&src));
}
// Load float count into third parameter.
c.mov(rdx, float_count);
// Load rounding mode into fourth parameter.
if (ctrl & 4) {
// Load from MXCSR.RC.
c.stmxcsr(ptr[rsp - 4]);
c.mov(rcx, ptr[rsp - 4]);
c.shr(rcx, 13);
c.and_(rcx, 3);
} else {
c.mov(rcx, ctrl & 3);
}
c.mov(rax, reinterpret_cast<u64>(PerformVCVTPS2PH));
c.call(rax);
// Clean up after inputs space.
c.add(rsp, byte_count);
if (dst->isXMM()) {
// Load outputs into destination register and clean up space.
c.movdqu(*reinterpret_cast<Xbyak::Xmm*>(dst.get()), ptr[rsp]);
c.add(rsp, byte_count);
}
RestoreContext(c, *dst);
}
static bool FilterRosetta2Only(const ZydisDecodedOperand*) {
int ret = 0; int ret = 0;
size_t size = sizeof(ret); size_t size = sizeof(ret);
if (sysctlbyname("sysctl.proc_translated", &ret, &size, NULL, 0) != 0) { if (sysctlbyname("sysctl.proc_translated", &ret, &size, nullptr, 0) != 0) {
return false; return false;
} }
return ret; return ret;
@ -339,12 +564,16 @@ static const std::unordered_map<ZydisMnemonic, PatchInfo> Patches = {
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__
// BMI1 instructions that are not supported by Rosetta 2 on Apple Silicon. // Patches for instruction sets not supported by Rosetta 2.
// BMI1
{ZYDIS_MNEMONIC_ANDN, {FilterRosetta2Only, GenerateANDN, true}}, {ZYDIS_MNEMONIC_ANDN, {FilterRosetta2Only, GenerateANDN, true}},
{ZYDIS_MNEMONIC_BEXTR, {FilterRosetta2Only, GenerateBEXTR, true}}, {ZYDIS_MNEMONIC_BEXTR, {FilterRosetta2Only, GenerateBEXTR, true}},
{ZYDIS_MNEMONIC_BLSI, {FilterRosetta2Only, GenerateBLSI, true}}, {ZYDIS_MNEMONIC_BLSI, {FilterRosetta2Only, GenerateBLSI, true}},
{ZYDIS_MNEMONIC_BLSMSK, {FilterRosetta2Only, GenerateBLSMSK, true}}, {ZYDIS_MNEMONIC_BLSMSK, {FilterRosetta2Only, GenerateBLSMSK, true}},
{ZYDIS_MNEMONIC_BLSR, {FilterRosetta2Only, GenerateBLSR, true}}, {ZYDIS_MNEMONIC_BLSR, {FilterRosetta2Only, GenerateBLSR, true}},
// F16C
{ZYDIS_MNEMONIC_VCVTPH2PS, {FilterRosetta2Only, GenerateVCVTPH2PS, true}},
{ZYDIS_MNEMONIC_VCVTPS2PH, {FilterRosetta2Only, GenerateVCVTPS2PH, true}},
#endif #endif
}; };

View File

@ -9,6 +9,12 @@ class CodeGenerator;
namespace Core { namespace Core {
/// Initializes a stack for the current thread for use by patch implementations.
void InitializeThreadPatchStack();
/// Cleans up the patch stack for the current thread.
void CleanupThreadPatchStack();
/// Patches CPU instructions that cannot run as-is on the host. /// Patches CPU instructions that cannot run as-is on the host.
void PatchInstructions(u64 segment_addr, u64 segment_size, Xbyak::CodeGenerator& c); void PatchInstructions(u64 segment_addr, u64 segment_size, Xbyak::CodeGenerator& c);

View File

@ -6,18 +6,18 @@
CryptoPP::RSA::PrivateKey Crypto::key_pkg_derived_key3_keyset_init() { CryptoPP::RSA::PrivateKey Crypto::key_pkg_derived_key3_keyset_init() {
CryptoPP::InvertibleRSAFunction params; CryptoPP::InvertibleRSAFunction params;
params.SetPrime1(CryptoPP::Integer(pkg_derived_key3_keyset.Prime1, 0x80)); params.SetPrime1(CryptoPP::Integer(PkgDerivedKey3Keyset::Prime1, 0x80));
params.SetPrime2(CryptoPP::Integer(pkg_derived_key3_keyset.Prime2, 0x80)); params.SetPrime2(CryptoPP::Integer(PkgDerivedKey3Keyset::Prime2, 0x80));
params.SetPublicExponent(CryptoPP::Integer(pkg_derived_key3_keyset.PublicExponent, 4)); params.SetPublicExponent(CryptoPP::Integer(PkgDerivedKey3Keyset::PublicExponent, 4));
params.SetPrivateExponent(CryptoPP::Integer(pkg_derived_key3_keyset.PrivateExponent, 0x100)); params.SetPrivateExponent(CryptoPP::Integer(PkgDerivedKey3Keyset::PrivateExponent, 0x100));
params.SetModPrime1PrivateExponent(CryptoPP::Integer(pkg_derived_key3_keyset.Exponent1, 0x80)); params.SetModPrime1PrivateExponent(CryptoPP::Integer(PkgDerivedKey3Keyset::Exponent1, 0x80));
params.SetModPrime2PrivateExponent(CryptoPP::Integer(pkg_derived_key3_keyset.Exponent2, 0x80)); params.SetModPrime2PrivateExponent(CryptoPP::Integer(PkgDerivedKey3Keyset::Exponent2, 0x80));
params.SetModulus(CryptoPP::Integer(pkg_derived_key3_keyset.Modulus, 0x100)); params.SetModulus(CryptoPP::Integer(PkgDerivedKey3Keyset::Modulus, 0x100));
params.SetMultiplicativeInverseOfPrime2ModPrime1( params.SetMultiplicativeInverseOfPrime2ModPrime1(
CryptoPP::Integer(pkg_derived_key3_keyset.Coefficient, 0x80)); CryptoPP::Integer(PkgDerivedKey3Keyset::Coefficient, 0x80));
CryptoPP::RSA::PrivateKey privateKey(params); CryptoPP::RSA::PrivateKey privateKey(params);
@ -26,18 +26,18 @@ CryptoPP::RSA::PrivateKey Crypto::key_pkg_derived_key3_keyset_init() {
CryptoPP::RSA::PrivateKey Crypto::FakeKeyset_keyset_init() { CryptoPP::RSA::PrivateKey Crypto::FakeKeyset_keyset_init() {
CryptoPP::InvertibleRSAFunction params; CryptoPP::InvertibleRSAFunction params;
params.SetPrime1(CryptoPP::Integer(FakeKeyset_keyset.Prime1, 0x80)); params.SetPrime1(CryptoPP::Integer(FakeKeyset::Prime1, 0x80));
params.SetPrime2(CryptoPP::Integer(FakeKeyset_keyset.Prime2, 0x80)); params.SetPrime2(CryptoPP::Integer(FakeKeyset::Prime2, 0x80));
params.SetPublicExponent(CryptoPP::Integer(FakeKeyset_keyset.PublicExponent, 4)); params.SetPublicExponent(CryptoPP::Integer(FakeKeyset::PublicExponent, 4));
params.SetPrivateExponent(CryptoPP::Integer(FakeKeyset_keyset.PrivateExponent, 0x100)); params.SetPrivateExponent(CryptoPP::Integer(FakeKeyset::PrivateExponent, 0x100));
params.SetModPrime1PrivateExponent(CryptoPP::Integer(FakeKeyset_keyset.Exponent1, 0x80)); params.SetModPrime1PrivateExponent(CryptoPP::Integer(FakeKeyset::Exponent1, 0x80));
params.SetModPrime2PrivateExponent(CryptoPP::Integer(FakeKeyset_keyset.Exponent2, 0x80)); params.SetModPrime2PrivateExponent(CryptoPP::Integer(FakeKeyset::Exponent2, 0x80));
params.SetModulus(CryptoPP::Integer(FakeKeyset_keyset.Modulus, 0x100)); params.SetModulus(CryptoPP::Integer(FakeKeyset::Modulus, 0x100));
params.SetMultiplicativeInverseOfPrime2ModPrime1( params.SetMultiplicativeInverseOfPrime2ModPrime1(
CryptoPP::Integer(FakeKeyset_keyset.Coefficient, 0x80)); CryptoPP::Integer(FakeKeyset::Coefficient, 0x80));
CryptoPP::RSA::PrivateKey privateKey(params); CryptoPP::RSA::PrivateKey privateKey(params);
@ -46,25 +46,22 @@ CryptoPP::RSA::PrivateKey Crypto::FakeKeyset_keyset_init() {
CryptoPP::RSA::PrivateKey Crypto::DebugRifKeyset_init() { CryptoPP::RSA::PrivateKey Crypto::DebugRifKeyset_init() {
CryptoPP::InvertibleRSAFunction params; CryptoPP::InvertibleRSAFunction params;
params.SetPrime1( params.SetPrime1(CryptoPP::Integer(DebugRifKeyset::Prime1, sizeof(DebugRifKeyset::Prime1)));
CryptoPP::Integer(DebugRifKeyset_keyset.Prime1, sizeof(DebugRifKeyset_keyset.Prime1))); params.SetPrime2(CryptoPP::Integer(DebugRifKeyset::Prime2, sizeof(DebugRifKeyset::Prime2)));
params.SetPrime2(
CryptoPP::Integer(DebugRifKeyset_keyset.Prime2, sizeof(DebugRifKeyset_keyset.Prime2)));
params.SetPublicExponent(CryptoPP::Integer(DebugRifKeyset_keyset.PublicExponent, params.SetPublicExponent(
sizeof(DebugRifKeyset_keyset.PublicExponent))); CryptoPP::Integer(DebugRifKeyset::PublicExponent, sizeof(DebugRifKeyset::PublicExponent)));
params.SetPrivateExponent(CryptoPP::Integer(DebugRifKeyset_keyset.PrivateExponent, params.SetPrivateExponent(CryptoPP::Integer(DebugRifKeyset::PrivateExponent,
sizeof(DebugRifKeyset_keyset.PrivateExponent))); sizeof(DebugRifKeyset::PrivateExponent)));
params.SetModPrime1PrivateExponent(CryptoPP::Integer(DebugRifKeyset_keyset.Exponent1, params.SetModPrime1PrivateExponent(
sizeof(DebugRifKeyset_keyset.Exponent1))); CryptoPP::Integer(DebugRifKeyset::Exponent1, sizeof(DebugRifKeyset::Exponent1)));
params.SetModPrime2PrivateExponent(CryptoPP::Integer(DebugRifKeyset_keyset.Exponent2, params.SetModPrime2PrivateExponent(
sizeof(DebugRifKeyset_keyset.Exponent2))); CryptoPP::Integer(DebugRifKeyset::Exponent2, sizeof(DebugRifKeyset::Exponent2)));
params.SetModulus( params.SetModulus(CryptoPP::Integer(DebugRifKeyset::Modulus, sizeof(DebugRifKeyset::Modulus)));
CryptoPP::Integer(DebugRifKeyset_keyset.Modulus, sizeof(DebugRifKeyset_keyset.Modulus))); params.SetMultiplicativeInverseOfPrime2ModPrime1(
params.SetMultiplicativeInverseOfPrime2ModPrime1(CryptoPP::Integer( CryptoPP::Integer(DebugRifKeyset::Coefficient, sizeof(DebugRifKeyset::Coefficient)));
DebugRifKeyset_keyset.Coefficient, sizeof(DebugRifKeyset_keyset.Coefficient)));
CryptoPP::RSA::PrivateKey privateKey(params); CryptoPP::RSA::PrivateKey privateKey(params);

View File

@ -17,10 +17,6 @@
class Crypto { class Crypto {
public: public:
PkgDerivedKey3Keyset pkg_derived_key3_keyset;
FakeKeyset FakeKeyset_keyset;
DebugRifKeyset DebugRifKeyset_keyset;
CryptoPP::RSA::PrivateKey key_pkg_derived_key3_keyset_init(); CryptoPP::RSA::PrivateKey key_pkg_derived_key3_keyset_init();
CryptoPP::RSA::PrivateKey FakeKeyset_keyset_init(); CryptoPP::RSA::PrivateKey FakeKeyset_keyset_init();
CryptoPP::RSA::PrivateKey DebugRifKeyset_init(); CryptoPP::RSA::PrivateKey DebugRifKeyset_init();

View File

@ -7,384 +7,299 @@
class FakeKeyset { class FakeKeyset {
public: public:
// Constructor // Constructor
const CryptoPP::byte* Exponent1; 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) // exponent2 = d mod (q - 1)
const CryptoPP::byte* Exponent2; 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 // e
const CryptoPP::byte* PublicExponent; static constexpr CryptoPP::byte PublicExponent[] = {0, 1, 0, 1};
// (InverseQ)(q) = 1 mod p // (InverseQ)(q) = 1 mod p
const CryptoPP::byte* Coefficient; 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 // n = p * q
const CryptoPP::byte* Modulus; 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 // p
const CryptoPP::byte* Prime1; 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 // q
const CryptoPP::byte* Prime2; static constexpr CryptoPP::byte Prime2[] = {
const CryptoPP::byte* PrivateExponent; 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,
// Constructor 0x9B, 0x9F, 0xB3, 0x90, 0x52, 0xC6, 0x94, 0x22, 0x36, 0xAA, 0xE6, 0x4A, 0x5F, 0x72, 0x1D,
FakeKeyset() { 0x70, 0xE8, 0x76, 0x58, 0xC8, 0xB2, 0x91, 0xCE, 0x9C, 0xC3, 0xE9, 0x09, 0x7F, 0x2E, 0x47,
// Initialize PrivateExponent 0x97, 0xCC, 0x90, 0x39, 0x15, 0x35, 0x31, 0xDE, 0x1F, 0x0C, 0x8C, 0x0D, 0xC1, 0xC2, 0x92,
PrivateExponent = new CryptoPP::byte[0x100]{ 0xBE, 0x97, 0xBF, 0x2F, 0x91, 0xA1, 0x8C, 0x7D, 0x50, 0xA8, 0x21, 0x2F, 0xD7, 0xA2, 0x9A,
0x7F, 0x76, 0xCD, 0x0E, 0xE2, 0xD4, 0xDE, 0x05, 0x1C, 0xC6, 0xD9, 0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x6C, 0x58, 0xD5, 0x43, 0x82, 0x49, 0xDA, 0x6E, 0x7C, 0xA1, 0xC5, 0x8C, 0xA5, 0xB0, 0x09, 0xE0,
0x9A, 0xDE, 0x50, 0x24, 0xC0, 0x23, 0x7D, 0x99, 0x79, 0x3F, 0x22, 0x07, 0xE0, 0xC1, 0xCE, 0x3D, 0xDF, 0xF4, 0x9D, 0x3C, 0x97, 0x15, 0xE2, 0x6A, 0xC7, 0x2B, 0x3C, 0x50, 0x93,
0x48, 0x56, 0x1B, 0xDF, 0x83, 0x09, 0x12, 0xB4, 0x2D, 0x45, 0x6B, 0xC9, 0xC0, 0x68, 0x23, 0xDB, 0xBA, 0x4A, 0x22, 0x66, 0x44, 0xAC, 0x78, 0xBB, 0x0E, 0x1A, 0x27, 0x43, 0xB5,
0x85, 0x99, 0x90, 0x79, 0x96, 0x1A, 0xD7, 0xF5, 0x4D, 0x1F, 0x37, 0x83, 0x40, 0x4A, 0x71, 0x67, 0xAF, 0xF4, 0xAB, 0x48, 0x46, 0x93, 0x73, 0xD0, 0x42, 0xAB, 0x93, 0x63, 0xE5,
0xEC, 0x39, 0x37, 0xA6, 0x80, 0x92, 0x7D, 0xC5, 0x80, 0xC7, 0xD6, 0x6F, 0xFE, 0x8A, 0x6C, 0x9A, 0xDE, 0x50, 0x24, 0xC0, 0x23, 0x7D, 0x99, 0x79, 0x3F, 0x22, 0x07, 0xE0, 0xC1,
0x79, 0x89, 0xC6, 0xB1}; 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,
// Initialize Exponent1 0x37, 0xA6, 0x80, 0x92, 0x7D, 0xC5, 0x80, 0xC7, 0xD6, 0x6F, 0xFE, 0x8A, 0x79, 0x89, 0xC6,
Exponent1 = new Cry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D2, 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};
PublicExponent = new CryptoPP::byte[4]{0, 1, 0, 1};
Coefficient = new CryptoPP::byte[0x80]{
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,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x80, 0x28, 0x6B,
0x2A, 0xFE, 0x51, 0x24, 0x9B, 0x6F, 0x4D, 0x84, 0x77, 0x80, 0x23};
};
}; };
class DebugRifKeyset { class DebugRifKeyset {
public: public:
// Constructor
// std::uint8_t* PrivateExponent; // std::uint8_t* PrivateExponent;
const CryptoPP::byte* Exponent1; 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) // exponent2 = d mod (q - 1)
const CryptoPP::byte* Exponent2; 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 // e
const CryptoPP::byte* PublicExponent; static constexpr CryptoPP::byte PublicExponent[] = {0x00, 0x01, 0x00, 0x01};
// (InverseQ)(q) = 1 mod p // (InverseQ)(q) = 1 mod p
const CryptoPP::byte* Coefficient; 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,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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 // p
const CryptoPP::byte* Prime1; 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 // q
const CryptoPP::byte* Prime2; static constexpr CryptoPP::byte Prime2[] = {
const CryptoPP::byte* PrivateExponent; 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,
// Constructor 0x55, 0xB7, 0xEE, 0x61, 0x04, 0x72, 0x51, 0x87, 0x2E, 0x05, 0x84, 0xB1, 0x1D, 0x0C, 0x0D,
DebugRifKeyset() { 0xDB, 0xD4, 0x25, 0x3E, 0x26, 0xED, 0xEA, 0xB8, 0xF7, 0x49, 0xFE, 0xA2, 0x94, 0xE6, 0xF2,
// Initialize PrivateExponent 0x08, 0x92, 0xA7, 0x85, 0xF5, 0x30, 0xB9, 0x84, 0x22, 0xBF, 0xCA, 0xF0, 0x5F, 0xCB, 0x31,
PrivateExponent = new CryptoPP::byte[0x100]{ 0x20, 0x34, 0x49, 0x16, 0x76, 0x34, 0xCC, 0x7A, 0xCB, 0x96, 0xFE, 0x78, 0x7A, 0x41, 0xFE,
0x01, 0x61, 0xAD, 0xD8, 0x9C, 0x06, 0x89, 0xD0, 0x60, 0xC8, 0x41, 0xF0, 0xB3, 0x83, 0x9A, 0xA2, 0x23, 0xF7, 0x68, 0x80, 0xD6, 0xCE, 0x4A, 0x78, 0xA5, 0xB7, 0x05, 0x77, 0x81,
0x01, 0x5D, 0xE3, 0xA2, 0x6B, 0xA2, 0xBA, 0x9A, 0x0A, 0x58, 0xCD, 0x1A, 0xA0, 0x97, 0x1F, 0xDE, 0x5E, 0xA8, 0x6E, 0x3E, 0x87, 0xEC, 0x44, 0xD2, 0x69, 0xC6, 0x54, 0x91, 0x6B,
0x64, 0xEC, 0xD0, 0x31, 0x1F, 0xCA, 0x36, 0x0E, 0x69, 0xDD, 0x40, 0xF7, 0x4E, 0xC0, 0x5E, 0x13, 0x8A, 0x03, 0x87, 0x05, 0x31, 0x8D};
0xC6, 0xA3, 0x73, 0xF0, 0x69, 0x84, 0xB2, 0xF4, 0x4B, 0x29, 0x14, 0x2A, 0x6D, 0xB8, static constexpr CryptoPP::byte PrivateExponent[] = {
0x23, 0xD8, 0x1B, 0x61, 0xD4, 0x9E, 0x87, 0xB3, 0xBB, 0xA9, 0xC4, 0x85, 0x4A, 0xF8, 0x01, 0x61, 0xAD, 0xD8, 0x9C, 0x06, 0x89, 0xD0, 0x60, 0xC8, 0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 0xCC, 0x0C, 0x9A, 0x66, 0x03, 0x86, 0x0A, 0x1F, 0x49,
0xA4, 0x10, 0xB6, 0xBC, 0xC3, 0x7C, 0x88, 0xE8, 0xCE, 0x4B, 0xD9
};
Exponent2 = new CryptoPP::byte[0x80]{
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};
PublicExponent = new CryptoPP::byte[4]{0x00, 0x01, 0x00, 0x01};
Coefficient = new CryptoPP::byte[0x80]{
0xC0, 0x32, 0x43, 0xD3, 0x8C, 0x3D, 0xB4, 0xD2, 0x48, 0x8C, 0x42, 0x41, 0x24,
0x94, 0x6C, 0x80, 0xC9, 0xC1, 0x79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05, 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};
};
}; };
class PkgDerivedKey3Keyset { class PkgDerivedKey3Keyset {
public: public:
// PkgDerivedKey3Keyset();
//~PkgDerivedKey3Keyset();
// Constructor
// std::uint8_t* PrivateExponent; // std::uint8_t* PrivateExponent;
const CryptoPP::byte* Exponent1; 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) // exponent2 = d mod (q - 1)
const CryptoPP::byte* Exponent2; 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 // e
const CryptoPP::byte* PublicExponent; static constexpr CryptoPP::byte PublicExponent[] = {0, 1, 0, 1};
// (InverseQ)(q) = 1 mod p // (InverseQ)(q) = 1 mod p
const CryptoPP::byte* Coefficient; 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 // n = p * q
const CryptoPP::byte* Modulus; static constexpr CryptoPP::byte Modulus[] = {
0xd2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fd, 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 // p
const CryptoPP::byte* Prime1; 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 // q
const CryptoPP::byte* Prime2; static constexpr CryptoPP::byte Prime2[] = {
const CryptoPP::byte* PrivateExponent; 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,
PkgDerivedKey3Keyset() { 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,
Prime1 = new CryptoPP::byte[0x80]{ 0xB4, 0xC7, 0xB5, 0x1B, 0x05, 0x0B, 0xBC, 0x56, 0x9A, 0xCD, 0x4A, 0xD9, 0x73, 0x68, 0x5E,
0xF9, 0x67, 0xAD, 0x99, 0x12, 0x31, 0x0C, 0x56, 0xA2, 0x2E, 0x16, 0x1C, 0x46, 0x5C, 0xFB, 0x92, 0xB7, 0x8B, 0x0D, 0xFF, 0xF5, 0x07, 0xCA, 0xB4, 0xC8, 0x9B, 0x96, 0x3C,
0xB3, 0x4D, 0x5B, 0x43, 0xBE, 0x42, 0xA2, 0xF6, 0x86, 0x96, 0x80, 0x42, 0xC3, 0x07, 0x9E, 0x3E, 0x6B, 0x2A, 0x11, 0xF2, 0x8A, 0xB1, 0x8A, 0xD7, 0x2E, 0x1B, 0xA5, 0x53,
0xC7, 0x3F, 0xC3, 0x42, 0xF5, 0x87, 0x49, 0x33, 0x9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x2d, 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};
PublicExponent = new CryptoPP::byte[4]{0, 1, 0, 1};
};
}; };

View File

@ -67,15 +67,19 @@ bool PKG::Open(const std::filesystem::path& filepath) {
file.Seek(0x47); // skip first 7 characters of content_id file.Seek(0x47); // skip first 7 characters of content_id
file.Read(pkgTitleID); file.Read(pkgTitleID);
file.Seek(0);
pkg.resize(pkgheader.pkg_promote_size);
file.Read(pkg);
u32 offset = pkgheader.pkg_table_entry_offset; u32 offset = pkgheader.pkg_table_entry_offset;
u32 n_files = pkgheader.pkg_table_entry_count; u32 n_files = pkgheader.pkg_table_entry_count;
file.Seek(offset);
for (int i = 0; i < n_files; i++) { for (int i = 0; i < n_files; i++) {
PKGEntry entry; PKGEntry entry{};
std::memcpy(&entry, &pkg[offset + i * 0x20], sizeof(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 // Try to figure out the name
const auto name = GetEntryNameByType(entry.id); const auto name = GetEntryNameByType(entry.id);
@ -113,9 +117,6 @@ bool PKG::Extract(const std::filesystem::path& filepath, const std::filesystem::
failreason = "Content size is bigger than pkg size"; failreason = "Content size is bigger than pkg size";
return false; return false;
} }
file.Seek(0);
pkg.resize(pkgheader.pkg_promote_size);
file.Read(pkg);
u32 offset = pkgheader.pkg_table_entry_offset; u32 offset = pkgheader.pkg_table_entry_offset;
u32 n_files = pkgheader.pkg_table_entry_count; u32 n_files = pkgheader.pkg_table_entry_count;
@ -126,9 +127,18 @@ bool PKG::Extract(const std::filesystem::path& filepath, const std::filesystem::
std::array<std::array<u8, 256>, 7> key1; std::array<std::array<u8, 256>, 7> key1;
std::array<u8, 256> imgkeydata; std::array<u8, 256> imgkeydata;
file.Seek(offset);
for (int i = 0; i < n_files; i++) { for (int i = 0; i < n_files; i++) {
PKGEntry entry; PKGEntry entry{};
std::memcpy(&entry, &pkg[offset + i * 0x20], sizeof(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 // Try to figure out the name
const auto name = GetEntryNameByType(entry.id); const auto name = GetEntryNameByType(entry.id);
@ -139,8 +149,15 @@ bool PKG::Extract(const std::filesystem::path& filepath, const std::filesystem::
// Just print with id // Just print with id
Common::FS::IOFile out(extract_path / "sce_sys" / std::to_string(entry.id), Common::FS::IOFile out(extract_path / "sce_sys" / std::to_string(entry.id),
Common::FS::FileAccessMode::Write); Common::FS::FileAccessMode::Write);
out.WriteRaw<u8>(pkg.data() + entry.offset, entry.size); file.Seek(entry.offset);
std::vector<u8> data;
data.resize(entry.size);
file.ReadRaw<u8>(data.data(), entry.size);
out.WriteRaw<u8>(data.data(), entry.size);
out.Close(); out.Close();
file.Seek(currentPos);
continue; continue;
} }
@ -178,14 +195,25 @@ bool PKG::Extract(const std::filesystem::path& filepath, const std::filesystem::
} }
Common::FS::IOFile out(extract_path / "sce_sys" / name, Common::FS::FileAccessMode::Write); Common::FS::IOFile out(extract_path / "sce_sys" / name, Common::FS::FileAccessMode::Write);
out.WriteRaw<u8>(pkg.data() + entry.offset, entry.size); file.Seek(entry.offset);
std::vector<u8> data;
data.resize(entry.size);
file.ReadRaw<u8>(data.data(), entry.size);
out.WriteRaw<u8>(data.data(), entry.size);
out.Close(); out.Close();
// Decrypt Np stuff and overwrite. // Decrypt Np stuff and overwrite.
if (entry.id == 0x400 || entry.id == 0x401 || entry.id == 0x402 || if (entry.id == 0x400 || entry.id == 0x401 || entry.id == 0x402 ||
entry.id == 0x403) { // somehow 0x401 is not decrypting entry.id == 0x403) { // somehow 0x401 is not decrypting
decNp.resize(entry.size); decNp.resize(entry.size);
std::span<u8> cipherNp(pkg.data() + entry.offset, entry.size); file.Seek(entry.offset);
std::vector<u8> data;
data.resize(entry.size);
file.ReadRaw<u8>(data.data(), entry.size);
std::span<u8> cipherNp(data.data(), entry.size);
std::array<u8, 64> concatenated_ivkey_dk3_; std::array<u8, 64> concatenated_ivkey_dk3_;
std::memcpy(concatenated_ivkey_dk3_.data(), &entry, sizeof(entry)); std::memcpy(concatenated_ivkey_dk3_.data(), &entry, sizeof(entry));
std::memcpy(concatenated_ivkey_dk3_.data() + sizeof(entry), dk3_.data(), sizeof(dk3_)); std::memcpy(concatenated_ivkey_dk3_.data() + sizeof(entry), dk3_.data(), sizeof(dk3_));
@ -197,6 +225,8 @@ bool PKG::Extract(const std::filesystem::path& filepath, const std::filesystem::
out.Write(decNp); out.Write(decNp);
out.Close(); out.Close();
} }
file.Seek(currentPos);
} }
// Extract trophy files // Extract trophy files
@ -214,6 +244,9 @@ bool PKG::Extract(const std::filesystem::path& filepath, const std::filesystem::
PKG::crypto.PfsGenCryptoKey(ekpfsKey, seed, dataKey, tweakKey); PKG::crypto.PfsGenCryptoKey(ekpfsKey, seed, dataKey, tweakKey);
const u32 length = pkgheader.pfs_cache_size * 0x2; // Seems to be ok. const u32 length = pkgheader.pfs_cache_size * 0x2; // Seems to be ok.
int num_blocks = 0;
std::vector<u8> pfsc(length);
if (length != 0) {
// Read encrypted pfs_image // Read encrypted pfs_image
std::vector<u8> pfs_encrypted(length); std::vector<u8> pfs_encrypted(length);
file.Seek(pkgheader.pfs_image_offset); file.Seek(pkgheader.pfs_image_offset);
@ -225,18 +258,18 @@ bool PKG::Extract(const std::filesystem::path& filepath, const std::filesystem::
// Retrieve PFSC from decrypted pfs_image. // Retrieve PFSC from decrypted pfs_image.
pfsc_offset = GetPFSCOffset(pfs_decrypted); pfsc_offset = GetPFSCOffset(pfs_decrypted);
std::vector<u8> pfsc(length);
std::memcpy(pfsc.data(), pfs_decrypted.data() + pfsc_offset, length - pfsc_offset); std::memcpy(pfsc.data(), pfs_decrypted.data() + pfsc_offset, length - pfsc_offset);
PFSCHdr pfsChdr; PFSCHdr pfsChdr;
std::memcpy(&pfsChdr, pfsc.data(), sizeof(pfsChdr)); std::memcpy(&pfsChdr, pfsc.data(), sizeof(pfsChdr));
const int num_blocks = (int)(pfsChdr.data_length / pfsChdr.block_sz2); num_blocks = (int)(pfsChdr.data_length / pfsChdr.block_sz2);
sectorMap.resize(num_blocks + 1); // 8 bytes, need extra 1 to get the last offset. sectorMap.resize(num_blocks + 1); // 8 bytes, need extra 1 to get the last offset.
for (int i = 0; i < num_blocks + 1; i++) { for (int i = 0; i < num_blocks + 1; i++) {
std::memcpy(&sectorMap[i], pfsc.data() + pfsChdr.block_offsets + i * 8, 8); std::memcpy(&sectorMap[i], pfsc.data() + pfsChdr.block_offsets + i * 8, 8);
} }
}
u32 ent_size = 0; u32 ent_size = 0;
u32 ndinode = 0; u32 ndinode = 0;
@ -279,8 +312,8 @@ bool PKG::Extract(const std::filesystem::path& filepath, const std::filesystem::
} }
} }
// let's deal with the root/uroot enteries here. // let's deal with the root/uroot entries here.
// Sometimes it's more than 2 enteries (Tomb Raider Remastered) // Sometimes it's more than 2 entries (Tomb Raider Remastered)
const std::string_view flat_path_table(&decompressedData[0x10], 15); const std::string_view flat_path_table(&decompressedData[0x10], 15);
if (flat_path_table == "flat_path_table") { if (flat_path_table == "flat_path_table") {
uroot_reached = true; uroot_reached = true;
@ -296,7 +329,15 @@ bool PKG::Extract(const std::filesystem::path& filepath, const std::filesystem::
} else { } else {
// Set the the folder according to the current inode. // Set the the folder according to the current inode.
// Can be 2 or more (rarely) // Can be 2 or more (rarely)
extractPaths[ndinode_counter] = extract_path.parent_path() / GetTitleID(); auto parent_path = extract_path.parent_path();
auto title_id = GetTitleID();
if (parent_path.filename() != title_id) {
extractPaths[ndinode_counter] = parent_path / title_id;
} else {
// DLCs path has different structure
extractPaths[ndinode_counter] = extract_path;
}
uroot_reached = false; uroot_reached = false;
break; break;
} }

View File

@ -149,7 +149,6 @@ public:
private: private:
Crypto crypto; Crypto crypto;
TRP trp; TRP trp;
std::vector<u8> pkg;
u64 pkgSize = 0; u64 pkgSize = 0;
char pkgTitleID[9]; char pkgTitleID[9];
PKGHeader pkgheader; PKGHeader pkgheader;

View File

@ -48,7 +48,7 @@ std::filesystem::path MntPoints::GetHostPath(std::string_view guest_directory) {
pos = mount->mount.size() + 1; pos = mount->mount.size() + 1;
const auto rel_path = std::string_view(corrected_path).substr(pos); const auto rel_path = std::string_view(corrected_path).substr(pos);
const auto host_path = mount->host_path / rel_path; const auto host_path = mount->host_path / rel_path;
if (!NeedsCaseInsensiveSearch) { if (!NeedsCaseInsensitiveSearch) {
return host_path; return host_path;
} }

View File

@ -14,9 +14,9 @@ namespace Core::FileSys {
class MntPoints { class MntPoints {
#ifdef _WIN64 #ifdef _WIN64
static constexpr bool NeedsCaseInsensiveSearch = false; static constexpr bool NeedsCaseInsensitiveSearch = false;
#else #else
static constexpr bool NeedsCaseInsensiveSearch = true; static constexpr bool NeedsCaseInsensitiveSearch = true;
#endif #endif
public: public:
struct MntPair { struct MntPair {

View File

@ -1,9 +1,10 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator #include "ajm.h"
#include "ajm_error.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/ajm/ajm.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"

View File

@ -0,0 +1,28 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
constexpr int ORBIS_AJM_ERROR_UNKNOWN = 0x80930001;
constexpr int ORBIS_AJM_ERROR_INVALID_CONTEXT = 0x80930002;
constexpr int ORBIS_AJM_ERROR_INVALID_INSTANCE = 0x80930003;
constexpr int ORBIS_AJM_ERROR_INVALID_BATCH = 0x80930004;
constexpr int ORBIS_AJM_ERROR_INVALID_PARAMETER = 0x80930005;
constexpr int ORBIS_AJM_ERROR_OUT_OF_MEMORY = 0x80930006;
constexpr int ORBIS_AJM_ERROR_OUT_OF_RESOURCES = 0x80930007;
constexpr int ORBIS_AJM_ERROR_CODEC_NOT_SUPPORTED = 0x80930008;
constexpr int ORBIS_AJM_ERROR_CODEC_ALREADY_REGISTERED = 0x80930009;
constexpr int ORBIS_AJM_ERROR_CODEC_NOT_REGISTERED = 0x8093000A;
constexpr int ORBIS_AJM_ERROR_WRONG_REVISION_FLAG = 0x8093000B;
constexpr int ORBIS_AJM_ERROR_FLAG_NOT_SUPPORTED = 0x8093000C;
constexpr int ORBIS_AJM_ERROR_BUSY = 0x8093000D;
constexpr int ORBIS_AJM_ERROR_BAD_PRIORITY = 0x8093000E;
constexpr int ORBIS_AJM_ERROR_IN_PROGRESS = 0x8093000F;
constexpr int ORBIS_AJM_ERROR_RETRY = 0x80930010;
constexpr int ORBIS_AJM_ERROR_MALFORMED_BATCH = 0x80930011;
constexpr int ORBIS_AJM_ERROR_JOB_CREATION = 0x80930012;
constexpr int ORBIS_AJM_ERROR_INVALID_OPCODE = 0x80930013;
constexpr int ORBIS_AJM_ERROR_PRIORITY_VIOLATION = 0x80930014;
constexpr int ORBIS_AJM_ERROR_BUFFER_TOO_BIG = 0x80930015;
constexpr int ORBIS_AJM_ERROR_INVALID_ADDRESS = 0x80930016;
constexpr int ORBIS_AJM_ERROR_CANCELLED = 0x80930017;

View File

@ -1,20 +1,38 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include <cmath> #include <cmath>
#include <common/path_util.h>
#include <common/singleton.h>
#include <core/file_format/psf.h>
#include <core/file_sys/fs.h>
#include "app_content.h" #include "app_content.h"
#include "common/io_file.h" #include "common/io_file.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/path_util.h"
#include "common/singleton.h"
#include "common/string_util.h"
#include "core/file_format/psf.h"
#include "core/file_sys/fs.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"
namespace Libraries::AppContent { namespace Libraries::AppContent {
int32_t addcont_count = 0;
struct AddContInfo {
char entitlementLabel[ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE];
OrbisAppContentAddcontDownloadStatus status;
OrbisAppContentGetEntitlementKey key;
};
std::array<AddContInfo, ORBIS_APP_CONTENT_INFO_LIST_MAX_SIZE> addcont_info = {{
{"0000000000000000",
ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_INSTALLED,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00}},
}};
std::string title_id;
int PS4_SYSV_ABI _Z5dummyv() { int PS4_SYSV_ABI _Z5dummyv() {
LOG_ERROR(Lib_AppContent, "(STUBBED) called"); LOG_ERROR(Lib_AppContent, "(STUBBED) called");
return ORBIS_OK; return ORBIS_OK;
@ -35,9 +53,31 @@ int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownloadSp() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceAppContentAddcontMount() { int PS4_SYSV_ABI sceAppContentAddcontMount(u32 service_label,
LOG_ERROR(Lib_AppContent, "(STUBBED) called"); const OrbisNpUnifiedEntitlementLabel* entitlement_label,
OrbisAppContentMountPoint* mount_point) {
LOG_INFO(Lib_AppContent, "called");
const auto& mount_dir = Common::FS::GetUserPath(Common::FS::PathType::AddonsDir) / title_id /
entitlement_label->data;
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
for (int i = 0; i < addcont_count; i++) {
if (strncmp(entitlement_label->data, addcont_info[i].entitlementLabel,
ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE - 1) != 0) {
continue;
}
if (addcont_info[i].status != ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_INSTALLED) {
return ORBIS_APP_CONTENT_ERROR_NOT_FOUND;
}
snprintf(mount_point->data, ORBIS_APP_CONTENT_MOUNTPOINT_DATA_MAXSIZE, "/addcont%d", i);
mnt->Mount(mount_dir, mount_point->data);
return ORBIS_OK; return ORBIS_OK;
}
return ORBIS_APP_CONTENT_ERROR_NOT_FOUND;
} }
int PS4_SYSV_ABI sceAppContentAddcontShrink() { int PS4_SYSV_ABI sceAppContentAddcontShrink() {
@ -124,22 +164,80 @@ int PS4_SYSV_ABI sceAppContentGetAddcontDownloadProgress() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceAppContentGetAddcontInfo() { int PS4_SYSV_ABI sceAppContentGetAddcontInfo(u32 service_label,
LOG_ERROR(Lib_AppContent, "(STUBBED) called"); const OrbisNpUnifiedEntitlementLabel* entitlementLabel,
OrbisAppContentAddcontInfo* info) {
LOG_INFO(Lib_AppContent, "called");
if (entitlementLabel == nullptr || info == nullptr) {
return ORBIS_APP_CONTENT_ERROR_PARAMETER;
}
for (auto i = 0; i < addcont_count; i++) {
if (strncmp(entitlementLabel->data, addcont_info[i].entitlementLabel,
ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE - 1) != 0) {
continue;
}
LOG_INFO(Lib_AppContent, "found DLC {}", entitlementLabel->data);
strncpy(info->entitlement_label.data, addcont_info[i].entitlementLabel,
ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE);
info->status = addcont_info[i].status;
return ORBIS_OK; return ORBIS_OK;
}
return ORBIS_APP_CONTENT_ERROR_DRM_NO_ENTITLEMENT;
} }
int PS4_SYSV_ABI sceAppContentGetAddcontInfoList(u32 service_label, int PS4_SYSV_ABI sceAppContentGetAddcontInfoList(u32 service_label,
OrbisAppContentAddcontInfo* list, u32 list_num, OrbisAppContentAddcontInfo* list, u32 list_num,
u32* hit_num) { u32* hit_num) {
*hit_num = 0; LOG_INFO(Lib_AppContent, "called");
LOG_ERROR(Lib_AppContent, "(DUMMY) called");
if (list_num == 0 || list == nullptr) {
if (hit_num == nullptr) {
return ORBIS_APP_CONTENT_ERROR_PARAMETER;
}
*hit_num = addcont_count;
return ORBIS_OK;
}
int dlcs_to_list = addcont_count < list_num ? addcont_count : list_num;
for (int i = 0; i < dlcs_to_list; i++) {
strncpy(list[i].entitlement_label.data, addcont_info[i].entitlementLabel,
ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE);
list[i].status = addcont_info[i].status;
}
if (hit_num != nullptr) {
*hit_num = dlcs_to_list;
}
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceAppContentGetEntitlementKey() { int PS4_SYSV_ABI sceAppContentGetEntitlementKey(
LOG_ERROR(Lib_AppContent, "(STUBBED) called"); u32 service_label, const OrbisNpUnifiedEntitlementLabel* entitlement_label,
OrbisAppContentGetEntitlementKey* key) {
LOG_ERROR(Lib_AppContent, "called");
if (entitlement_label == nullptr || key == nullptr) {
return ORBIS_APP_CONTENT_ERROR_PARAMETER;
}
for (int i = 0; i < addcont_count; i++) {
if (strncmp(entitlement_label->data, addcont_info[i].entitlementLabel,
ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE - 1) != 0) {
continue;
}
memcpy(key->data, addcont_info[i].key.data, ORBIS_APP_CONTENT_ENTITLEMENT_KEY_SIZE);
return ORBIS_OK; return ORBIS_OK;
}
return ORBIS_APP_CONTENT_ERROR_DRM_NO_ENTITLEMENT;
} }
int PS4_SYSV_ABI sceAppContentGetRegion() { int PS4_SYSV_ABI sceAppContentGetRegion() {
@ -150,7 +248,25 @@ int PS4_SYSV_ABI sceAppContentGetRegion() {
int PS4_SYSV_ABI sceAppContentInitialize(const OrbisAppContentInitParam* initParam, int PS4_SYSV_ABI sceAppContentInitialize(const OrbisAppContentInitParam* initParam,
OrbisAppContentBootParam* bootParam) { OrbisAppContentBootParam* bootParam) {
LOG_ERROR(Lib_AppContent, "(DUMMY) called"); LOG_ERROR(Lib_AppContent, "(DUMMY) called");
bootParam->attr = 0; // always 0 auto* param_sfo = Common::Singleton<PSF>::Instance();
const auto addons_dir = Common::FS::GetUserPath(Common::FS::PathType::AddonsDir);
title_id = param_sfo->GetString("TITLE_ID");
auto addon_path = addons_dir / title_id;
if (std::filesystem::exists(addon_path)) {
for (const auto& entry : std::filesystem::directory_iterator(addon_path)) {
if (entry.is_directory()) {
auto entitlement_label = entry.path().filename().string();
AddContInfo info{};
info.status = ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_INSTALLED;
strcpy(info.entitlementLabel, entitlement_label.c_str());
addcont_info[addcont_count++] = info;
}
}
}
return ORBIS_OK; return ORBIS_OK;
} }
@ -221,12 +337,12 @@ int PS4_SYSV_ABI Func_C59A36FF8D7C59DA() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownloadByEntitlemetId() { int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownloadByEntitlementId() {
LOG_ERROR(Lib_AppContent, "(STUBBED) called"); LOG_ERROR(Lib_AppContent, "(STUBBED) called");
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceAppContentAddcontMountByEntitlemetId() { int PS4_SYSV_ABI sceAppContentAddcontMountByEntitlementId() {
LOG_ERROR(Lib_AppContent, "(STUBBED) called"); LOG_ERROR(Lib_AppContent, "(STUBBED) called");
return ORBIS_OK; return ORBIS_OK;
} }
@ -313,9 +429,9 @@ void RegisterlibSceAppContent(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("xZo2-418Wdo", "libSceAppContentBundle", 1, "libSceAppContent", 1, 1, LIB_FUNCTION("xZo2-418Wdo", "libSceAppContentBundle", 1, "libSceAppContent", 1, 1,
Func_C59A36FF8D7C59DA); Func_C59A36FF8D7C59DA);
LIB_FUNCTION("kJmjt81mXKQ", "libSceAppContentIro", 1, "libSceAppContent", 1, 1, LIB_FUNCTION("kJmjt81mXKQ", "libSceAppContentIro", 1, "libSceAppContent", 1, 1,
sceAppContentAddcontEnqueueDownloadByEntitlemetId); sceAppContentAddcontEnqueueDownloadByEntitlementId);
LIB_FUNCTION("efX3lrPwdKA", "libSceAppContentIro", 1, "libSceAppContent", 1, 1, LIB_FUNCTION("efX3lrPwdKA", "libSceAppContentIro", 1, "libSceAppContent", 1, 1,
sceAppContentAddcontMountByEntitlemetId); sceAppContentAddcontMountByEntitlementId);
LIB_FUNCTION("z9hgjLd1SGA", "libSceAppContentIro", 1, "libSceAppContent", 1, 1, LIB_FUNCTION("z9hgjLd1SGA", "libSceAppContentIro", 1, "libSceAppContent", 1, 1,
sceAppContentGetAddcontInfoByEntitlementId); sceAppContentGetAddcontInfoByEntitlementId);
LIB_FUNCTION("3wUaDTGmjcQ", "libSceAppContentIro", 1, "libSceAppContent", 1, 1, LIB_FUNCTION("3wUaDTGmjcQ", "libSceAppContentIro", 1, "libSceAppContent", 1, 1,

View File

@ -41,6 +41,16 @@ struct OrbisAppContentMountPoint {
constexpr int ORBIS_APP_CONTENT_TEMPORARY_DATA_OPTION_NONE = 0; constexpr int ORBIS_APP_CONTENT_TEMPORARY_DATA_OPTION_NONE = 0;
constexpr int ORBIS_APP_CONTENT_TEMPORARY_DATA_OPTION_FORMAT = (1 << 0); constexpr int ORBIS_APP_CONTENT_TEMPORARY_DATA_OPTION_FORMAT = (1 << 0);
constexpr int ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE = 17; constexpr int ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE = 17;
constexpr int ORBIS_APP_CONTENT_ENTITLEMENT_KEY_SIZE = 16;
constexpr int ORBIS_APP_CONTENT_INFO_LIST_MAX_SIZE = 2500;
enum OrbisAppContentAddcontDownloadStatus : u32 {
ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_NO_EXTRA_DATA = 0,
ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_NO_IN_QUEUE = 1,
ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_DOWNLOADING = 2,
ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_DOWNLOAD_SUSPENDED = 3,
ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_INSTALLED = 4
};
struct OrbisNpUnifiedEntitlementLabel { struct OrbisNpUnifiedEntitlementLabel {
char data[ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE]; char data[ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE];
@ -54,11 +64,17 @@ struct OrbisAppContentAddcontInfo {
u32 status; u32 status;
}; };
struct OrbisAppContentGetEntitlementKey {
char data[ORBIS_APP_CONTENT_ENTITLEMENT_KEY_SIZE];
};
int PS4_SYSV_ABI _Z5dummyv(); int PS4_SYSV_ABI _Z5dummyv();
int PS4_SYSV_ABI sceAppContentAddcontDelete(); int PS4_SYSV_ABI sceAppContentAddcontDelete();
int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownload(); int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownload();
int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownloadSp(); int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownloadSp();
int PS4_SYSV_ABI sceAppContentAddcontMount(); int PS4_SYSV_ABI sceAppContentAddcontMount(u32 service_label,
const OrbisNpUnifiedEntitlementLabel* entitlement_label,
OrbisAppContentMountPoint* mount_point);
int PS4_SYSV_ABI sceAppContentAddcontShrink(); int PS4_SYSV_ABI sceAppContentAddcontShrink();
int PS4_SYSV_ABI sceAppContentAddcontUnmount(); int PS4_SYSV_ABI sceAppContentAddcontUnmount();
int PS4_SYSV_ABI sceAppContentAppParamGetInt(OrbisAppContentAppParamId paramId, s32* value); int PS4_SYSV_ABI sceAppContentAppParamGetInt(OrbisAppContentAppParamId paramId, s32* value);
@ -70,11 +86,15 @@ int PS4_SYSV_ABI sceAppContentDownload1Shrink();
int PS4_SYSV_ABI sceAppContentDownloadDataFormat(); int PS4_SYSV_ABI sceAppContentDownloadDataFormat();
int PS4_SYSV_ABI sceAppContentDownloadDataGetAvailableSpaceKb(); int PS4_SYSV_ABI sceAppContentDownloadDataGetAvailableSpaceKb();
int PS4_SYSV_ABI sceAppContentGetAddcontDownloadProgress(); int PS4_SYSV_ABI sceAppContentGetAddcontDownloadProgress();
int PS4_SYSV_ABI sceAppContentGetAddcontInfo(); int PS4_SYSV_ABI sceAppContentGetAddcontInfo(u32 service_label,
const OrbisNpUnifiedEntitlementLabel* entitlementLabel,
OrbisAppContentAddcontInfo* info);
int PS4_SYSV_ABI sceAppContentGetAddcontInfoList(u32 service_label, int PS4_SYSV_ABI sceAppContentGetAddcontInfoList(u32 service_label,
OrbisAppContentAddcontInfo* list, u32 list_num, OrbisAppContentAddcontInfo* list, u32 list_num,
u32* hit_num); u32* hit_num);
int PS4_SYSV_ABI sceAppContentGetEntitlementKey(); int PS4_SYSV_ABI sceAppContentGetEntitlementKey(
u32 service_label, const OrbisNpUnifiedEntitlementLabel* entitlement_label,
OrbisAppContentGetEntitlementKey* key);
int PS4_SYSV_ABI sceAppContentGetRegion(); int PS4_SYSV_ABI sceAppContentGetRegion();
int PS4_SYSV_ABI sceAppContentInitialize(const OrbisAppContentInitParam* initParam, int PS4_SYSV_ABI sceAppContentInitialize(const OrbisAppContentInitParam* initParam,
OrbisAppContentBootParam* bootParam); OrbisAppContentBootParam* bootParam);
@ -92,8 +112,8 @@ int PS4_SYSV_ABI sceAppContentTemporaryDataMount2(OrbisAppContentTemporaryDataOp
int PS4_SYSV_ABI sceAppContentTemporaryDataUnmount(); int PS4_SYSV_ABI sceAppContentTemporaryDataUnmount();
int PS4_SYSV_ABI sceAppContentGetPftFlag(); int PS4_SYSV_ABI sceAppContentGetPftFlag();
int PS4_SYSV_ABI Func_C59A36FF8D7C59DA(); int PS4_SYSV_ABI Func_C59A36FF8D7C59DA();
int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownloadByEntitlemetId(); int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownloadByEntitlementId();
int PS4_SYSV_ABI sceAppContentAddcontMountByEntitlemetId(); int PS4_SYSV_ABI sceAppContentAddcontMountByEntitlementId();
int PS4_SYSV_ABI sceAppContentGetAddcontInfoByEntitlementId(); int PS4_SYSV_ABI sceAppContentGetAddcontInfoByEntitlementId();
int PS4_SYSV_ABI sceAppContentGetAddcontInfoListByIroTag(); int PS4_SYSV_ABI sceAppContentGetAddcontInfoListByIroTag();
int PS4_SYSV_ABI sceAppContentGetDownloadedStoreCountry(); int PS4_SYSV_ABI sceAppContentGetDownloadedStoreCountry();

View File

@ -2,9 +2,10 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <memory> #include <memory>
#include <common/assert.h>
#include <magic_enum.hpp> #include <magic_enum.hpp>
#include "audio_core/sdl_audio.h" #include "audio_core/sdl_audio.h"
#include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/audio/audioout.h" #include "core/libraries/audio/audioout.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"

View File

@ -7,6 +7,8 @@
#include "common/types.h" #include "common/types.h"
#include <string_view>
struct AVIOContext; struct AVIOContext;
namespace Libraries::AvPlayer { namespace Libraries::AvPlayer {
@ -14,6 +16,7 @@ namespace Libraries::AvPlayer {
class IDataStreamer { class IDataStreamer {
public: public:
virtual ~IDataStreamer() = default; virtual ~IDataStreamer() = default;
virtual bool Init(std::string_view path) = 0;
virtual AVIOContext* GetContext() = 0; virtual AVIOContext* GetContext() = 0;
}; };

View File

@ -18,19 +18,8 @@ extern "C" {
namespace Libraries::AvPlayer { namespace Libraries::AvPlayer {
AvPlayerFileStreamer::AvPlayerFileStreamer(const SceAvPlayerFileReplacement& file_replacement, AvPlayerFileStreamer::AvPlayerFileStreamer(const SceAvPlayerFileReplacement& file_replacement)
std::string_view path) : m_file_replacement(file_replacement) {}
: m_file_replacement(file_replacement) {
const auto ptr = m_file_replacement.object_ptr;
m_fd = m_file_replacement.open(ptr, path.data());
ASSERT(m_fd >= 0);
m_file_size = m_file_replacement.size(ptr);
// avio_buffer is deallocated in `avio_context_free`
const auto avio_buffer = reinterpret_cast<u8*>(av_malloc(AVPLAYER_AVIO_BUFFER_SIZE));
m_avio_context =
avio_alloc_context(avio_buffer, AVPLAYER_AVIO_BUFFER_SIZE, 0, this,
&AvPlayerFileStreamer::ReadPacket, nullptr, &AvPlayerFileStreamer::Seek);
}
AvPlayerFileStreamer::~AvPlayerFileStreamer() { AvPlayerFileStreamer::~AvPlayerFileStreamer() {
if (m_avio_context != nullptr) { if (m_avio_context != nullptr) {
@ -43,6 +32,21 @@ AvPlayerFileStreamer::~AvPlayerFileStreamer() {
} }
} }
bool AvPlayerFileStreamer::Init(std::string_view path) {
const auto ptr = m_file_replacement.object_ptr;
m_fd = m_file_replacement.open(ptr, path.data());
if (m_fd < 0) {
return false;
}
m_file_size = m_file_replacement.size(ptr);
// avio_buffer is deallocated in `avio_context_free`
const auto avio_buffer = reinterpret_cast<u8*>(av_malloc(AVPLAYER_AVIO_BUFFER_SIZE));
m_avio_context =
avio_alloc_context(avio_buffer, AVPLAYER_AVIO_BUFFER_SIZE, 0, this,
&AvPlayerFileStreamer::ReadPacket, nullptr, &AvPlayerFileStreamer::Seek);
return true;
}
s32 AvPlayerFileStreamer::ReadPacket(void* opaque, u8* buffer, s32 size) { s32 AvPlayerFileStreamer::ReadPacket(void* opaque, u8* buffer, s32 size) {
const auto self = reinterpret_cast<AvPlayerFileStreamer*>(opaque); const auto self = reinterpret_cast<AvPlayerFileStreamer*>(opaque);
if (self->m_position >= self->m_file_size) { if (self->m_position >= self->m_file_size) {

View File

@ -15,9 +15,11 @@ namespace Libraries::AvPlayer {
class AvPlayerFileStreamer : public IDataStreamer { class AvPlayerFileStreamer : public IDataStreamer {
public: public:
AvPlayerFileStreamer(const SceAvPlayerFileReplacement& file_replacement, std::string_view path); AvPlayerFileStreamer(const SceAvPlayerFileReplacement& file_replacement);
~AvPlayerFileStreamer(); ~AvPlayerFileStreamer();
bool Init(std::string_view path) override;
AVIOContext* GetContext() override { AVIOContext* GetContext() override {
return m_avio_context; return m_avio_context;
} }

View File

@ -110,7 +110,7 @@ s32 AvPlayer::AddSource(std::string_view path) {
if (path.empty()) { if (path.empty()) {
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS; return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
} }
if (AVPLAYER_IS_ERROR(m_state->AddSource(path, GetSourceType(path)))) { if (!m_state->AddSource(path, GetSourceType(path))) {
return ORBIS_AVPLAYER_ERROR_OPERATION_FAILED; return ORBIS_AVPLAYER_ERROR_OPERATION_FAILED;
} }
return ORBIS_OK; return ORBIS_OK;
@ -128,7 +128,7 @@ s32 AvPlayer::GetStreamCount() {
} }
s32 AvPlayer::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info) { s32 AvPlayer::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info) {
if (AVPLAYER_IS_ERROR(m_state->GetStreamInfo(stream_index, info))) { if (!m_state->GetStreamInfo(stream_index, info)) {
return ORBIS_AVPLAYER_ERROR_OPERATION_FAILED; return ORBIS_AVPLAYER_ERROR_OPERATION_FAILED;
} }
return ORBIS_OK; return ORBIS_OK;
@ -145,7 +145,10 @@ s32 AvPlayer::EnableStream(u32 stream_index) {
} }
s32 AvPlayer::Start() { s32 AvPlayer::Start() {
return m_state->Start(); if (!m_state->Start()) {
return ORBIS_AVPLAYER_ERROR_OPERATION_FAILED;
}
return ORBIS_OK;
} }
bool AvPlayer::GetVideoData(SceAvPlayerFrameInfo& video_info) { bool AvPlayer::GetVideoData(SceAvPlayerFrameInfo& video_info) {

View File

@ -24,31 +24,39 @@ namespace Libraries::AvPlayer {
using namespace Kernel; using namespace Kernel;
AvPlayerSource::AvPlayerSource(AvPlayerStateCallback& state, std::string_view path, AvPlayerSource::AvPlayerSource(AvPlayerStateCallback& state) : m_state(state) {}
const SceAvPlayerInitData& init_data,
SceAvPlayerSourceType source_type)
: m_state(state), m_memory_replacement(init_data.memory_replacement),
m_num_output_video_framebuffers(
std::min(std::max(2, init_data.num_output_video_framebuffers), 16)) {
AVFormatContext* context = avformat_alloc_context();
if (init_data.file_replacement.open != nullptr) {
m_up_data_streamer =
std::make_unique<AvPlayerFileStreamer>(init_data.file_replacement, path);
context->pb = m_up_data_streamer->GetContext();
ASSERT(!AVPLAYER_IS_ERROR(avformat_open_input(&context, nullptr, nullptr, nullptr)));
} else {
const auto mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
const auto filepath = mnt->GetHostPath(path);
ASSERT(!AVPLAYER_IS_ERROR(
avformat_open_input(&context, filepath.string().c_str(), nullptr, nullptr)));
}
m_avformat_context = AVFormatContextPtr(context, &ReleaseAVFormatContext);
}
AvPlayerSource::~AvPlayerSource() { AvPlayerSource::~AvPlayerSource() {
Stop(); Stop();
} }
bool AvPlayerSource::Init(const SceAvPlayerInitData& init_data, std::string_view path) {
m_memory_replacement = init_data.memory_replacement,
m_num_output_video_framebuffers =
std::min(std::max(2, init_data.num_output_video_framebuffers), 16);
AVFormatContext* context = avformat_alloc_context();
if (init_data.file_replacement.open != nullptr) {
m_up_data_streamer = std::make_unique<AvPlayerFileStreamer>(init_data.file_replacement);
if (!m_up_data_streamer->Init(path)) {
return false;
}
context->pb = m_up_data_streamer->GetContext();
if (AVPLAYER_IS_ERROR(avformat_open_input(&context, nullptr, nullptr, nullptr))) {
return false;
}
} else {
const auto mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
const auto filepath = mnt->GetHostPath(path);
if (AVPLAYER_IS_ERROR(
avformat_open_input(&context, filepath.string().c_str(), nullptr, nullptr))) {
return false;
}
}
m_avformat_context = AVFormatContextPtr(context, &ReleaseAVFormatContext);
return true;
}
bool AvPlayerSource::FindStreamInfo() { bool AvPlayerSource::FindStreamInfo() {
if (m_avformat_context == nullptr) { if (m_avformat_context == nullptr) {
LOG_ERROR(Lib_AvPlayer, "Could not find stream info. NULL context."); LOG_ERROR(Lib_AvPlayer, "Could not find stream info. NULL context.");
@ -87,16 +95,16 @@ static f32 AVRationalToF32(const AVRational rational) {
return f32(rational.num) / rational.den; return f32(rational.num) / rational.den;
} }
s32 AvPlayerSource::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info) { bool AvPlayerSource::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info) {
info = {}; info = {};
if (m_avformat_context == nullptr || stream_index >= m_avformat_context->nb_streams) { if (m_avformat_context == nullptr || stream_index >= m_avformat_context->nb_streams) {
LOG_ERROR(Lib_AvPlayer, "Could not get stream {} info.", stream_index); LOG_ERROR(Lib_AvPlayer, "Could not get stream {} info.", stream_index);
return -1; return false;
} }
const auto p_stream = m_avformat_context->streams[stream_index]; const auto p_stream = m_avformat_context->streams[stream_index];
if (p_stream == nullptr || p_stream->codecpar == nullptr) { if (p_stream == nullptr || p_stream->codecpar == nullptr) {
LOG_ERROR(Lib_AvPlayer, "Could not get stream {} info. NULL stream.", stream_index); LOG_ERROR(Lib_AvPlayer, "Could not get stream {} info. NULL stream.", stream_index);
return -1; return false;
} }
info.type = CodecTypeToStreamType(p_stream->codecpar->codec_type); info.type = CodecTypeToStreamType(p_stream->codecpar->codec_type);
info.start_time = p_stream->start_time; info.start_time = p_stream->start_time;
@ -140,9 +148,9 @@ s32 AvPlayerSource::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info)
break; break;
default: default:
LOG_ERROR(Lib_AvPlayer, "Stream {} type is unknown: {}.", stream_index, info.type); LOG_ERROR(Lib_AvPlayer, "Stream {} type is unknown: {}.", stream_index, info.type);
return -1; return false;
} }
return 0; return true;
} }
bool AvPlayerSource::EnableStream(u32 stream_index) { bool AvPlayerSource::EnableStream(u32 stream_index) {
@ -215,12 +223,12 @@ std::optional<bool> AvPlayerSource::HasFrames(u32 num_frames) {
return m_video_packets.Size() > num_frames || m_is_eof; return m_video_packets.Size() > num_frames || m_is_eof;
} }
s32 AvPlayerSource::Start() { bool AvPlayerSource::Start() {
std::unique_lock lock(m_state_mutex); std::unique_lock lock(m_state_mutex);
if (m_audio_codec_context == nullptr && m_video_codec_context == nullptr) { if (m_audio_codec_context == nullptr && m_video_codec_context == nullptr) {
LOG_ERROR(Lib_AvPlayer, "Could not start playback. NULL context."); LOG_ERROR(Lib_AvPlayer, "Could not start playback. NULL context.");
return -1; return false;
} }
m_demuxer_thread = std::jthread([this](std::stop_token stop) { this->DemuxerThread(stop); }); m_demuxer_thread = std::jthread([this](std::stop_token stop) { this->DemuxerThread(stop); });
m_video_decoder_thread = m_video_decoder_thread =
@ -228,7 +236,7 @@ s32 AvPlayerSource::Start() {
m_audio_decoder_thread = m_audio_decoder_thread =
std::jthread([this](std::stop_token stop) { this->AudioDecoderThread(stop); }); std::jthread([this](std::stop_token stop) { this->AudioDecoderThread(stop); });
m_start_time = std::chrono::high_resolution_clock::now(); m_start_time = std::chrono::high_resolution_clock::now();
return 0; return true;
} }
bool AvPlayerSource::Stop() { bool AvPlayerSource::Stop() {

View File

@ -120,17 +120,17 @@ private:
class AvPlayerSource { class AvPlayerSource {
public: public:
AvPlayerSource(AvPlayerStateCallback& state, std::string_view path, AvPlayerSource(AvPlayerStateCallback& state);
const SceAvPlayerInitData& init_data, SceAvPlayerSourceType source_type);
~AvPlayerSource(); ~AvPlayerSource();
bool Init(const SceAvPlayerInitData& init_data, std::string_view path);
bool FindStreamInfo(); bool FindStreamInfo();
s32 GetStreamCount(); s32 GetStreamCount();
s32 GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info); bool GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info);
bool EnableStream(u32 stream_index); bool EnableStream(u32 stream_index);
void SetLooping(bool is_looping); void SetLooping(bool is_looping);
std::optional<bool> HasFrames(u32 num_frames); std::optional<bool> HasFrames(u32 num_frames);
s32 Start(); bool Start();
bool Stop(); bool Stop();
bool GetAudioData(SceAvPlayerFrameInfo& audio_info); bool GetAudioData(SceAvPlayerFrameInfo& audio_info);
bool GetVideoData(SceAvPlayerFrameInfo& video_info); bool GetVideoData(SceAvPlayerFrameInfo& video_info);

View File

@ -24,6 +24,7 @@ void PS4_SYSV_ABI AvPlayerState::AutoPlayEventCallback(void* opaque, s32 event_i
s32 timedtext_stream_index = -1; s32 timedtext_stream_index = -1;
const s32 stream_count = self->GetStreamCount(); const s32 stream_count = self->GetStreamCount();
if (AVPLAYER_IS_ERROR(stream_count)) { if (AVPLAYER_IS_ERROR(stream_count)) {
self->Stop();
return; return;
} }
if (stream_count == 0) { if (stream_count == 0) {
@ -32,7 +33,10 @@ void PS4_SYSV_ABI AvPlayerState::AutoPlayEventCallback(void* opaque, s32 event_i
} }
for (u32 stream_index = 0; stream_index < stream_count; ++stream_index) { for (u32 stream_index = 0; stream_index < stream_count; ++stream_index) {
SceAvPlayerStreamInfo info{}; SceAvPlayerStreamInfo info{};
self->GetStreamInfo(stream_index, info); if (!self->GetStreamInfo(stream_index, info)) {
self->Stop();
return;
}
const std::string_view default_language( const std::string_view default_language(
reinterpret_cast<char*>(self->m_default_language)); reinterpret_cast<char*>(self->m_default_language));
@ -116,23 +120,28 @@ AvPlayerState::~AvPlayerState() {
} }
// Called inside GAME thread // Called inside GAME thread
s32 AvPlayerState::AddSource(std::string_view path, SceAvPlayerSourceType source_type) { bool AvPlayerState::AddSource(std::string_view path, SceAvPlayerSourceType source_type) {
if (path.empty()) { if (path.empty()) {
LOG_ERROR(Lib_AvPlayer, "File path is empty."); LOG_ERROR(Lib_AvPlayer, "File path is empty.");
return -1; return false;
} }
{ {
std::unique_lock lock(m_source_mutex); std::unique_lock lock(m_source_mutex);
if (m_up_source != nullptr) { if (m_up_source != nullptr) {
LOG_ERROR(Lib_AvPlayer, "Only one source is supported."); LOG_ERROR(Lib_AvPlayer, "Only one source is supported.");
return -1; return false;
} }
m_up_source = std::make_unique<AvPlayerSource>(*this, path, m_init_data, source_type); m_up_source = std::make_unique<AvPlayerSource>(*this);
if (!m_up_source->Init(m_init_data, path)) {
SetState(AvState::Error);
m_up_source.reset();
return false;
}
} }
AddSourceEvent(); AddSourceEvent();
return 0; return true;
} }
// Called inside GAME thread // Called inside GAME thread
@ -146,25 +155,25 @@ s32 AvPlayerState::GetStreamCount() {
} }
// Called inside GAME thread // Called inside GAME thread
s32 AvPlayerState::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info) { bool AvPlayerState::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info) {
std::shared_lock lock(m_source_mutex); std::shared_lock lock(m_source_mutex);
if (m_up_source == nullptr) { if (m_up_source == nullptr) {
LOG_ERROR(Lib_AvPlayer, "Could not get stream {} info. No source.", stream_index); LOG_ERROR(Lib_AvPlayer, "Could not get stream {} info. No source.", stream_index);
return -1; return false;
} }
return m_up_source->GetStreamInfo(stream_index, info); return m_up_source->GetStreamInfo(stream_index, info);
} }
// Called inside GAME thread // Called inside GAME thread
s32 AvPlayerState::Start() { bool AvPlayerState::Start() {
std::shared_lock lock(m_source_mutex); std::shared_lock lock(m_source_mutex);
if (m_up_source == nullptr || m_up_source->Start() < 0) { if (m_up_source == nullptr || !m_up_source->Start()) {
LOG_ERROR(Lib_AvPlayer, "Could not start playback."); LOG_ERROR(Lib_AvPlayer, "Could not start playback.");
return -1; return false;
} }
SetState(AvState::Play); SetState(AvState::Play);
OnPlaybackStateChanged(AvState::Play); OnPlaybackStateChanged(AvState::Play);
return 0; return true;
} }
void AvPlayerState::AvControllerThread(std::stop_token stop) { void AvPlayerState::AvControllerThread(std::stop_token stop) {
@ -219,10 +228,10 @@ bool AvPlayerState::Stop() {
if (m_up_source == nullptr || m_current_state == AvState::Stop) { if (m_up_source == nullptr || m_current_state == AvState::Stop) {
return false; return false;
} }
if (!SetState(AvState::Stop)) { if (!m_up_source->Stop()) {
return false; return false;
} }
if (!m_up_source->Stop()) { if (!SetState(AvState::Stop)) {
return false; return false;
} }
OnPlaybackStateChanged(AvState::Stop); OnPlaybackStateChanged(AvState::Stop);

View File

@ -24,11 +24,11 @@ public:
AvPlayerState(const SceAvPlayerInitData& init_data); AvPlayerState(const SceAvPlayerInitData& init_data);
~AvPlayerState(); ~AvPlayerState();
s32 AddSource(std::string_view filename, SceAvPlayerSourceType source_type); bool AddSource(std::string_view filename, SceAvPlayerSourceType source_type);
s32 GetStreamCount(); s32 GetStreamCount();
s32 GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info); bool GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info);
bool EnableStream(u32 stream_index); bool EnableStream(u32 stream_index);
s32 Start(); bool Start();
bool Stop(); bool Stop();
bool GetAudioData(SceAvPlayerFrameInfo& audio_info); bool GetAudioData(SceAvPlayerFrameInfo& audio_info);
bool GetVideoData(SceAvPlayerFrameInfo& video_info); bool GetVideoData(SceAvPlayerFrameInfo& video_info);

View File

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"

View File

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"

View File

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"

View File

@ -233,9 +233,6 @@ constexpr int SCE_KERNEL_ERROR_ESDKVERSION = 0x80020063;
constexpr int SCE_KERNEL_ERROR_ESTART = 0x80020064; constexpr int SCE_KERNEL_ERROR_ESTART = 0x80020064;
constexpr int SCE_KERNEL_ERROR_ESTOP = 0x80020065; constexpr int SCE_KERNEL_ERROR_ESTOP = 0x80020065;
// libSceRandom error codes
constexpr int SCE_RANDOM_ERROR_INVALID = 0x817C0016;
// videoOut // videoOut
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_VALUE = 0x80290001; // invalid argument constexpr int SCE_VIDEO_OUT_ERROR_INVALID_VALUE = 0x80290001; // invalid argument
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS = 0x80290002; // invalid addresses constexpr int SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS = 0x80290002; // invalid addresses
@ -249,14 +246,6 @@ constexpr int SCE_VIDEO_OUT_ERROR_SLOT_OCCUPIED = 0x80290010; // slot alr
constexpr int SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL = 0x80290012; // flip queue is full constexpr int SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL = 0x80290012; // flip queue is full
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_OPTION = 0x8029001A; // Invalid buffer attribute option constexpr int SCE_VIDEO_OUT_ERROR_INVALID_OPTION = 0x8029001A; // Invalid buffer attribute option
// GnmDriver
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_PIPE_ID = 0x80D17000;
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_QUEUE_ID = 0x80D17001;
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_RING_BASE_ADDR = 0x80D17003;
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_RING_SIZE = 0x80D17002;
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_READ_PTR_ADDR = 0x80D17004;
constexpr int ORBIS_GNM_ERROR_FAILURE = 0x8EEE00FF;
// Generic // Generic
constexpr int ORBIS_OK = 0x00000000; constexpr int ORBIS_OK = 0x00000000;
constexpr int ORBIS_FAIL = 0xFFFFFFFF; constexpr int ORBIS_FAIL = 0xFFFFFFFF;
@ -472,3 +461,5 @@ constexpr int ORBIS_AVPLAYER_ERROR_INFO_OTHER_ENCRY = 0x806A00BF;
// AppContent library // AppContent library
constexpr int ORBIS_APP_CONTENT_ERROR_PARAMETER = 0x80D90002; constexpr int ORBIS_APP_CONTENT_ERROR_PARAMETER = 0x80D90002;
constexpr int ORBIS_APP_CONTENT_ERROR_DRM_NO_ENTITLEMENT = 0x80D90007;
constexpr int ORBIS_APP_CONTENT_ERROR_NOT_FOUND = 0x80D90005;

View File

@ -0,0 +1,85 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
constexpr int ORBIS_GNM_ERROR_SUBMISSION_FAILED_INVALID_ARGUMENT = 0x80D11000;
constexpr int ORBIS_GNM_ERROR_SUBMISSION_NOT_ENOUGH_RESOURCES = 0x80D11001;
constexpr int ORBIS_GNM_ERROR_SUBMISSION_AND_FLIP_FAILED_INVALID_COMMAND_BUFFER = 0x80D11080;
constexpr int ORBIS_GNM_ERROR_SUBMISSION_AND_FLIP_FAILED_INVALID_QUEUE_FULL = 0x80D11081;
constexpr int ORBIS_GNM_ERROR_SUBMISSION_AND_FLIP_FAILED_REQUEST_FAILED = 0x80D11082;
constexpr int ORBIS_GNM_ERROR_SUBMISSION_FAILED_INTERNAL_ERROR = 0x80D110FF;
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING = 0x80D12000;
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING_RWBUFFER_ROTYPE = 0x80D12001;
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING_BLENDING = 0x80D12002;
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING_DRAW_CU_MASK = 0x80D12003;
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING_MRT_SETUP = 0x80D12004;
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING_DEPTH_RT_SETUP = 0x80D12005;
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING_PS_AND_MRT_FORMAT = 0x80D1200F;
constexpr int ORBIS_GNM_ERROR_VALIDATION_ERROR = 0x80D13000;
constexpr int ORBIS_GNM_ERROR_VALIDATION_VSHARP = 0x80D13001;
constexpr int ORBIS_GNM_ERROR_VALIDATION_TSHARP = 0x80D13002;
constexpr int ORBIS_GNM_ERROR_VALIDATION_RESOURCE = 0x80D13003;
constexpr int ORBIS_GNM_ERROR_VALIDATION_TABLE_MEMORY = 0x80D13004;
constexpr int ORBIS_GNM_ERROR_VALIDATION_WRITE_EVENT_OP = 0x80D13005;
constexpr int ORBIS_GNM_ERROR_VALIDATION_INDEX_BUFFER = 0x80D13006;
constexpr int ORBIS_GNM_ERROR_VALIDATION_TESS_FACTOR_BUFFER = 0x80D13007;
constexpr int ORBIS_GNM_ERROR_VALIDATION_SCRATCH_RING = 0x80D13008;
constexpr int ORBIS_GNM_ERROR_VALIDATION_PRIMITIVE_TYPE = 0x80D13009;
constexpr int ORBIS_GNM_ERROR_VALIDATION_INDEX_SIZE = 0x80D1300A;
constexpr int ORBIS_GNM_ERROR_VALIDATION_INLINE_DRAW_SIZE = 0x80D1300B;
constexpr int ORBIS_GNM_ERROR_VALIDATION_NUM_INPUT_PATCHES = 0x80D1300C;
constexpr int ORBIS_GNM_ERROR_VALIDATION_GS_MODE = 0x80D1300D;
constexpr int ORBIS_GNM_ERROR_VALIDATION_SHADER_ADDRESS = 0x80D1300E;
constexpr int ORBIS_GNM_ERROR_VALIDATION_BORDER_COLOR_TABLE = 0x80D1300F;
constexpr int ORBIS_GNM_ERROR_VALIDATION_SSHARP = 0x80D13010;
constexpr int ORBIS_GNM_ERROR_VALIDATION_DISPATCH_DRAW = 0x80D13011;
constexpr int ORBIS_GNM_ERROR_VALIDATION_ACTIVE_SHADER_STAGE = 0x80D13012;
constexpr int ORBIS_GNM_ERROR_VALIDATION_DCB = 0x80D13013;
constexpr int ORBIS_GNM_ERROR_VALIDATION_MISMATCH_SHADER_STAGE = 0x80D13014;
constexpr int ORBIS_GNM_ERROR_VALIDATION_MRT_SETUP = 0x80D13015;
constexpr int ORBIS_GNM_ERROR_VALIDATION_BAD_OP_CODE = 0x80D13016;
constexpr int ORBIS_GNM_ERROR_VALIDATION_DEPTH_RT_SETUP = 0x80D13017;
constexpr int ORBIS_GNM_ERROR_VALIDATION_NUM_INSTANCES = 0x80D13018;
constexpr int ORBIS_GNM_ERROR_VALIDATION_SRT = 0x80D13019;
constexpr int ORBIS_GNM_ERROR_VALIDATION_INVALID_ARGUMENT = 0x80D13FFD;
constexpr int ORBIS_GNM_ERROR_VALIDATION_FAILED_INTERNAL_ERROR = 0x80D13FFE;
constexpr int ORBIS_GNM_ERROR_VALIDATION_NOT_ENABLED = 0x80D13FFF;
constexpr int ORBIS_GNM_ERROR_CAPTURE_FILE_IO = 0x80D15000;
constexpr int ORBIS_GNM_ERROR_CAPTURE_RAZOR_NOT_LOADED = 0x80D15001;
constexpr int ORBIS_GNM_ERROR_CAPTURE_NOTHING_TO_CAPTURE = 0x80D15002;
constexpr int ORBIS_GNM_ERROR_CAPTURE_FAILED_INTERNAL = 0x80D1500F;
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_PIPE_ID = 0x80D17000;
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_QUEUE_ID = 0x80D17001;
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_RING_SIZE = 0x80D17002;
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_RING_BASE_ADDR = 0x80D17003;
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_READ_PTR_ADDR = 0x80D17004;
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_PIPE_PRIORITY = 0x80D17005;
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INTERNAL = 0x80D170FF;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_INVALID_ARGUMENT = 0x80D19000;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_INVALID_SHADER = 0x80D19001;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_STALE_HANDLE = 0x80D19002;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_FULL = 0x80D19003;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_NOT_PERMITTED = 0x80D19004;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_OUTPUT_ARGUMENT_IS_NULL = 0x80D19005;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_OWNER_HANDLE_INVALID = 0x80D19006;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_RESOURCE_HANDLE_INVALID = 0x80D19007;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_RESOURCE_TYPE_INVALID = 0x80D19008;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_GDS_RESOURCE_TYPE_INVALID = 0x80D19009;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_RESOURCE_SIZE_INVALID = 0x80D1900A;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_RESOURCE_ADDRESS_IS_NULL = 0x80D1900B;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_GDS_OFFSET_INVALID = 0x80D1900C;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_RESOURCE_NAME_IS_NULL = 0x80D1900D;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_OWNER_NAME_IS_NULL = 0x80D1900E;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_FIND_CALLBACK_IS_NULL = 0x80D1900F;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_RESOURCE_IS_NOT_SHADER = 0x80D19010;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_USER_MEMORY_PARAM_IS_NULL = 0x80D19011;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_USER_MEMORY_PARAM_NOT_ALIGNED = 0x80D19012;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_INVALID_NAME_LENGTH_PARAM = 0x80D19013;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_INVALID_SIZE_PARAM = 0x80D19014;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_INVALID_NUM_RESOURCES_PARAM = 0x80D19015;
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_INTERNAL = 0x80D19FFF;
constexpr int ORBIS_GNM_ERROR_GET_GPU_INFO_PARAMETER_NULL = 0x80D1B000;
constexpr int ORBIS_GNM_ERROR_GET_GPU_INFO_FAILED = 0x80D1B001;
constexpr int ORBIS_GNM_ERROR_GET_GPU_INFO_PARAMETER_INVALID = 0x80D1B002;
constexpr int ORBIS_GNM_ERROR_FAILURE = 0x8EEE00FF;

View File

@ -1,6 +1,9 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "gnm_error.h"
#include "gnmdriver.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/config.h" #include "common/config.h"
#include "common/debug.h" #include "common/debug.h"
@ -9,7 +12,6 @@
#include "common/slot_vector.h" #include "common/slot_vector.h"
#include "core/address_space.h" #include "core/address_space.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/gnmdriver/gnmdriver.h"
#include "core/libraries/kernel/libkernel.h" #include "core/libraries/kernel/libkernel.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"
#include "core/libraries/videoout/video_out.h" #include "core/libraries/videoout/video_out.h"
@ -648,12 +650,12 @@ s32 PS4_SYSV_ABI sceGnmDrawIndexAuto(u32* cmdbuf, u32 size, u32 index_count, u32
} }
s32 PS4_SYSV_ABI sceGnmDrawIndexIndirect(u32* cmdbuf, u32 size, u32 data_offset, u32 shader_stage, s32 PS4_SYSV_ABI sceGnmDrawIndexIndirect(u32* cmdbuf, u32 size, u32 data_offset, u32 shader_stage,
u32 vertex_sgpr_offset, u32 instance_vgpr_offset, u32 vertex_sgpr_offset, u32 instance_sgpr_offset,
u32 flags) { u32 flags) {
LOG_TRACE(Lib_GnmDriver, "called"); LOG_TRACE(Lib_GnmDriver, "called");
if (cmdbuf && (size == 9) && (shader_stage < ShaderStages::Max) && if (cmdbuf && (size == 9) && (shader_stage < ShaderStages::Max) &&
(vertex_sgpr_offset < 0x10u) && (instance_vgpr_offset < 0x10u)) { (vertex_sgpr_offset < 0x10u) && (instance_sgpr_offset < 0x10u)) {
const auto predicate = flags & 1 ? PM4Predicate::PredEnable : PM4Predicate::PredDisable; const auto predicate = flags & 1 ? PM4Predicate::PredEnable : PM4Predicate::PredDisable;
cmdbuf = WriteHeader<PM4ItOpcode::DrawIndexIndirect>( cmdbuf = WriteHeader<PM4ItOpcode::DrawIndexIndirect>(
@ -663,7 +665,7 @@ s32 PS4_SYSV_ABI sceGnmDrawIndexIndirect(u32* cmdbuf, u32 size, u32 data_offset,
cmdbuf[0] = data_offset; cmdbuf[0] = data_offset;
cmdbuf[1] = vertex_sgpr_offset == 0 ? 0 : (vertex_sgpr_offset & 0xffffu) + sgpr_offset; cmdbuf[1] = vertex_sgpr_offset == 0 ? 0 : (vertex_sgpr_offset & 0xffffu) + sgpr_offset;
cmdbuf[2] = instance_vgpr_offset == 0 ? 0 : (instance_vgpr_offset & 0xffffu) + sgpr_offset; cmdbuf[2] = instance_sgpr_offset == 0 ? 0 : (instance_sgpr_offset & 0xffffu) + sgpr_offset;
cmdbuf[3] = 0; cmdbuf[3] = 0;
cmdbuf += 4; cmdbuf += 4;
@ -705,11 +707,11 @@ s32 PS4_SYSV_ABI sceGnmDrawIndexOffset(u32* cmdbuf, u32 size, u32 index_offset,
} }
s32 PS4_SYSV_ABI sceGnmDrawIndirect(u32* cmdbuf, u32 size, u32 data_offset, u32 shader_stage, s32 PS4_SYSV_ABI sceGnmDrawIndirect(u32* cmdbuf, u32 size, u32 data_offset, u32 shader_stage,
u32 vertex_sgpr_offset, u32 instance_vgpr_offset, u32 flags) { u32 vertex_sgpr_offset, u32 instance_sgpr_offset, u32 flags) {
LOG_TRACE(Lib_GnmDriver, "called"); LOG_TRACE(Lib_GnmDriver, "called");
if (cmdbuf && (size == 9) && (shader_stage < ShaderStages::Max) && if (cmdbuf && (size == 9) && (shader_stage < ShaderStages::Max) &&
(vertex_sgpr_offset < 0x10u) && (instance_vgpr_offset < 0x10u)) { (vertex_sgpr_offset < 0x10u) && (instance_sgpr_offset < 0x10u)) {
const auto predicate = flags & 1 ? PM4Predicate::PredEnable : PM4Predicate::PredDisable; const auto predicate = flags & 1 ? PM4Predicate::PredEnable : PM4Predicate::PredDisable;
cmdbuf = WriteHeader<PM4ItOpcode::DrawIndirect>(cmdbuf, 4, PM4ShaderType::ShaderGraphics, cmdbuf = WriteHeader<PM4ItOpcode::DrawIndirect>(cmdbuf, 4, PM4ShaderType::ShaderGraphics,
@ -719,7 +721,7 @@ s32 PS4_SYSV_ABI sceGnmDrawIndirect(u32* cmdbuf, u32 size, u32 data_offset, u32
cmdbuf[0] = data_offset; cmdbuf[0] = data_offset;
cmdbuf[1] = vertex_sgpr_offset == 0 ? 0 : (vertex_sgpr_offset & 0xffffu) + sgpr_offset; cmdbuf[1] = vertex_sgpr_offset == 0 ? 0 : (vertex_sgpr_offset & 0xffffu) + sgpr_offset;
cmdbuf[2] = instance_vgpr_offset == 0 ? 0 : (instance_vgpr_offset & 0xffffu) + sgpr_offset; cmdbuf[2] = instance_sgpr_offset == 0 ? 0 : (instance_sgpr_offset & 0xffffu) + sgpr_offset;
cmdbuf[3] = 2; // auto index cmdbuf[3] = 2; // auto index
cmdbuf += 4; cmdbuf += 4;

View File

@ -45,7 +45,7 @@ s32 PS4_SYSV_ABI sceGnmDrawIndex(u32* cmdbuf, u32 size, u32 index_count, uintptr
u32 flags, u32 type); u32 flags, u32 type);
s32 PS4_SYSV_ABI sceGnmDrawIndexAuto(u32* cmdbuf, u32 size, u32 index_count, u32 flags); s32 PS4_SYSV_ABI sceGnmDrawIndexAuto(u32* cmdbuf, u32 size, u32 index_count, u32 flags);
s32 PS4_SYSV_ABI sceGnmDrawIndexIndirect(u32* cmdbuf, u32 size, u32 data_offset, u32 shader_stage, s32 PS4_SYSV_ABI sceGnmDrawIndexIndirect(u32* cmdbuf, u32 size, u32 data_offset, u32 shader_stage,
u32 vertex_sgpr_offset, u32 instance_vgpr_offset, u32 vertex_sgpr_offset, u32 instance_sgpr_offset,
u32 flags); u32 flags);
int PS4_SYSV_ABI sceGnmDrawIndexIndirectCountMulti(); int PS4_SYSV_ABI sceGnmDrawIndexIndirectCountMulti();
int PS4_SYSV_ABI sceGnmDrawIndexIndirectMulti(); int PS4_SYSV_ABI sceGnmDrawIndexIndirectMulti();
@ -53,7 +53,7 @@ int PS4_SYSV_ABI sceGnmDrawIndexMultiInstanced();
s32 PS4_SYSV_ABI sceGnmDrawIndexOffset(u32* cmdbuf, u32 size, u32 index_offset, u32 index_count, s32 PS4_SYSV_ABI sceGnmDrawIndexOffset(u32* cmdbuf, u32 size, u32 index_offset, u32 index_count,
u32 flags); u32 flags);
s32 PS4_SYSV_ABI sceGnmDrawIndirect(u32* cmdbuf, u32 size, u32 data_offset, u32 shader_stage, s32 PS4_SYSV_ABI sceGnmDrawIndirect(u32* cmdbuf, u32 size, u32 data_offset, u32 shader_stage,
u32 vertex_sgpr_offset, u32 instance_vgpr_offset, u32 flags); u32 vertex_sgpr_offset, u32 instance_sgpr_offset, u32 flags);
int PS4_SYSV_ABI sceGnmDrawIndirectCountMulti(); int PS4_SYSV_ABI sceGnmDrawIndirectCountMulti();
int PS4_SYSV_ABI sceGnmDrawIndirectMulti(); int PS4_SYSV_ABI sceGnmDrawIndirectMulti();
u32 PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState(u32* cmdbuf, u32 size); u32 PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState(u32* cmdbuf, u32 size);

View File

@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <common/assert.h> #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <thread> #include <thread>
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "event_flag_obj.h" #include "event_flag_obj.h"

View File

@ -2,8 +2,10 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#pragma once #pragma once
#include <condition_variable> #include <condition_variable>
#include <mutex> #include <mutex>
#include "common/types.h" #include "common/types.h"
namespace Libraries::Kernel { namespace Libraries::Kernel {

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <thread> #include <thread>
#include "common/assert.h" #include "common/assert.h"
#include "core/libraries/kernel/event_queue.h" #include "core/libraries/kernel/event_queue.h"

View File

@ -538,7 +538,7 @@ void fileSystemSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
// openOrbis (to check if it is valid out of OpenOrbis // openOrbis (to check if it is valid out of OpenOrbis
LIB_FUNCTION("6c3rCVE-fTU", "libkernel", 1, "libkernel", 1, 1, LIB_FUNCTION("6c3rCVE-fTU", "libkernel", 1, "libkernel", 1, 1,
posix_open); // _open shoudld be equal to open function posix_open); // _open should be equal to open function
} }
} // namespace Libraries::Kernel } // namespace Libraries::Kernel

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <sys/types.h> #include <sys/types.h>
#include "common/types.h" #include "common/types.h"
namespace Core::Loader { namespace Core::Loader {

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <bit> #include <bit>
#include "common/alignment.h" #include "common/alignment.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
@ -15,7 +16,8 @@ namespace Libraries::Kernel {
u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() { u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() {
LOG_WARNING(Kernel_Vmm, "called"); LOG_WARNING(Kernel_Vmm, "called");
return SCE_KERNEL_MAIN_DMEM_SIZE; const auto* memory = Core::Memory::Instance();
return memory->GetTotalDirectSize();
} }
int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u64 len, int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u64 len,
@ -52,8 +54,8 @@ int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u
s32 PS4_SYSV_ABI sceKernelAllocateMainDirectMemory(size_t len, size_t alignment, int memoryType, s32 PS4_SYSV_ABI sceKernelAllocateMainDirectMemory(size_t len, size_t alignment, int memoryType,
s64* physAddrOut) { s64* physAddrOut) {
return sceKernelAllocateDirectMemory(0, SCE_KERNEL_MAIN_DMEM_SIZE, len, alignment, memoryType, const auto searchEnd = static_cast<s64>(sceKernelGetDirectMemorySize());
physAddrOut); return sceKernelAllocateDirectMemory(0, searchEnd, len, alignment, memoryType, physAddrOut);
} }
s32 PS4_SYSV_ABI sceKernelCheckedReleaseDirectMemory(u64 start, size_t len) { s32 PS4_SYSV_ABI sceKernelCheckedReleaseDirectMemory(u64 start, size_t len) {
@ -75,19 +77,28 @@ s32 PS4_SYSV_ABI sceKernelAvailableDirectMemorySize(u64 searchStart, u64 searchE
LOG_WARNING(Kernel_Vmm, "called searchStart = {:#x}, searchEnd = {:#x}, alignment = {:#x}", LOG_WARNING(Kernel_Vmm, "called searchStart = {:#x}, searchEnd = {:#x}, alignment = {:#x}",
searchStart, searchEnd, alignment); searchStart, searchEnd, alignment);
if (searchEnd <= searchStart) { if (physAddrOut == nullptr || sizeOut == nullptr) {
return ORBIS_KERNEL_ERROR_EINVAL; return ORBIS_KERNEL_ERROR_EINVAL;
} }
if (searchEnd > SCE_KERNEL_MAIN_DMEM_SIZE) { if (searchEnd > sceKernelGetDirectMemorySize()) {
return ORBIS_KERNEL_ERROR_EINVAL; return ORBIS_KERNEL_ERROR_EINVAL;
} }
if (searchEnd <= searchStart) {
return ORBIS_KERNEL_ERROR_ENOMEM;
}
auto* memory = Core::Memory::Instance(); auto* memory = Core::Memory::Instance();
PAddr physAddr; PAddr physAddr{};
s32 result = size_t size{};
memory->DirectQueryAvailable(searchStart, searchEnd, alignment, &physAddr, sizeOut); s32 result = memory->DirectQueryAvailable(searchStart, searchEnd, alignment, &physAddr, &size);
if (size == 0) {
return ORBIS_KERNEL_ERROR_ENOMEM;
}
*physAddrOut = static_cast<u64>(physAddr); *physAddrOut = static_cast<u64>(physAddr);
*sizeOut = size;
return result; return result;
} }
@ -245,46 +256,56 @@ int PS4_SYSV_ABI sceKernelMunmap(void* addr, size_t len);
s32 PS4_SYSV_ABI sceKernelBatchMap2(OrbisKernelBatchMapEntry* entries, int numEntries, s32 PS4_SYSV_ABI sceKernelBatchMap2(OrbisKernelBatchMapEntry* entries, int numEntries,
int* numEntriesOut, int flags) { int* numEntriesOut, int flags) {
int result = ORBIS_OK;
int processed = 0; int processed = 0;
int result = 0; for (int i = 0; i < numEntries; i++, processed++) {
for (int i = 0; i < numEntries; i++) {
if (entries == nullptr || entries[i].length == 0 || entries[i].operation > 4) { if (entries == nullptr || entries[i].length == 0 || entries[i].operation > 4) {
result = ORBIS_KERNEL_ERROR_EINVAL; result = ORBIS_KERNEL_ERROR_EINVAL;
break; // break and assign a value to numEntriesOut. break; // break and assign a value to numEntriesOut.
} }
if (entries[i].operation == MemoryOpTypes::ORBIS_KERNEL_MAP_OP_MAP_DIRECT) { switch (entries[i].operation) {
case MemoryOpTypes::ORBIS_KERNEL_MAP_OP_MAP_DIRECT: {
result = sceKernelMapNamedDirectMemory(&entries[i].start, entries[i].length, result = sceKernelMapNamedDirectMemory(&entries[i].start, entries[i].length,
entries[i].protection, flags, entries[i].protection, flags,
static_cast<s64>(entries[i].offset), 0, ""); static_cast<s64>(entries[i].offset), 0, "");
LOG_INFO( LOG_INFO(Kernel_Vmm,
Kernel_Vmm, "entry = {}, operation = {}, len = {:#x}, offset = {:#x}, type = {}, "
"BatchMap: entry = {}, operation = {}, len = {:#x}, offset = {:#x}, type = {}, "
"result = {}", "result = {}",
i, entries[i].operation, entries[i].length, entries[i].offset, (u8)entries[i].type, i, entries[i].operation, entries[i].length, entries[i].offset,
result); (u8)entries[i].type, result);
break;
if (result == 0) }
processed++; case MemoryOpTypes::ORBIS_KERNEL_MAP_OP_UNMAP: {
} else if (entries[i].operation == MemoryOpTypes::ORBIS_KERNEL_MAP_OP_UNMAP) {
result = sceKernelMunmap(entries[i].start, entries[i].length); result = sceKernelMunmap(entries[i].start, entries[i].length);
LOG_INFO(Kernel_Vmm, "BatchMap: entry = {}, operation = {}, len = {:#x}, result = {}", LOG_INFO(Kernel_Vmm, "entry = {}, operation = {}, len = {:#x}, result = {}", i,
i, entries[i].operation, entries[i].length, result); entries[i].operation, entries[i].length, result);
break;
if (result == 0) }
processed++; case MemoryOpTypes::ORBIS_KERNEL_MAP_OP_MAP_FLEXIBLE: {
} else if (entries[i].operation == MemoryOpTypes::ORBIS_KERNEL_MAP_OP_MAP_FLEXIBLE) {
result = sceKernelMapNamedFlexibleMemory(&entries[i].start, entries[i].length, result = sceKernelMapNamedFlexibleMemory(&entries[i].start, entries[i].length,
entries[i].protection, flags, ""); entries[i].protection, flags, "");
LOG_INFO(Kernel_Vmm, LOG_INFO(Kernel_Vmm,
"BatchMap: entry = {}, operation = {}, len = {:#x}, type = {}, " "entry = {}, operation = {}, len = {:#x}, type = {}, "
"result = {}", "result = {}",
i, entries[i].operation, entries[i].length, (u8)entries[i].type, result); i, entries[i].operation, entries[i].length, (u8)entries[i].type, result);
break;
}
case MemoryOpTypes::ORBIS_KERNEL_MAP_OP_TYPE_PROTECT: {
// By now, ignore protection and log it instead
LOG_WARNING(Kernel_Vmm,
"entry = {}, operation = {}, len = {:#x}, type = {} "
"is UNSUPPORTED and skipped",
i, entries[i].operation, entries[i].length, (u8)entries[i].type);
break;
}
default: {
UNREACHABLE();
}
}
if (result == 0) if (result != ORBIS_OK) {
processed++; break;
} else {
UNREACHABLE_MSG("called: Unimplemented Operation = {}", entries[i].operation);
} }
} }
if (numEntriesOut != NULL) { // can be zero. do not return an error code. if (numEntriesOut != NULL) { // can be zero. do not return an error code.

View File

@ -6,7 +6,7 @@
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/types.h" #include "common/types.h"
constexpr u64 SCE_KERNEL_MAIN_DMEM_SIZE = 6_GB; // ~ 6GB constexpr u64 SCE_KERNEL_MAIN_DMEM_SIZE = 5056_MB; // ~ 5GB
namespace Libraries::Kernel { namespace Libraries::Kernel {

View File

@ -2,14 +2,16 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <mutex> #include <mutex>
#include <semaphore>
#include <thread> #include <thread>
#include <semaphore.h>
#include "common/alignment.h" #include "common/alignment.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/error.h" #include "common/error.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "common/thread.h" #include "common/thread.h"
#include "core/cpu_patches.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/kernel/libkernel.h" #include "core/libraries/kernel/libkernel.h"
#include "core/libraries/kernel/thread_management.h" #include "core/libraries/kernel/thread_management.h"
@ -510,23 +512,24 @@ int PS4_SYSV_ABI scePthreadMutexattrInit(ScePthreadMutexattr* attr) {
int PS4_SYSV_ABI scePthreadMutexattrSettype(ScePthreadMutexattr* attr, int type) { int PS4_SYSV_ABI scePthreadMutexattrSettype(ScePthreadMutexattr* attr, int type) {
int ptype = PTHREAD_MUTEX_DEFAULT; int ptype = PTHREAD_MUTEX_DEFAULT;
switch (type) { switch (type) {
case 1: case ORBIS_PTHREAD_MUTEX_ERRORCHECK:
ptype = PTHREAD_MUTEX_ERRORCHECK; ptype = PTHREAD_MUTEX_ERRORCHECK;
break; break;
case 2: case ORBIS_PTHREAD_MUTEX_RECURSIVE:
ptype = PTHREAD_MUTEX_RECURSIVE; ptype = PTHREAD_MUTEX_RECURSIVE;
break; break;
case 3: case ORBIS_PTHREAD_MUTEX_NORMAL:
case 4: case ORBIS_PTHREAD_MUTEX_ADAPTIVE:
ptype = PTHREAD_MUTEX_NORMAL; ptype = PTHREAD_MUTEX_NORMAL;
break; break;
default: default:
UNREACHABLE_MSG("Invalid type: {}", type); return SCE_KERNEL_ERROR_EINVAL;
} }
int result = pthread_mutexattr_settype(&(*attr)->pth_mutex_attr, ptype); int result = pthread_mutexattr_settype(&(*attr)->pth_mutex_attr, ptype);
ASSERT(result == 0);
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL; return SCE_OK;
} }
int PS4_SYSV_ABI scePthreadMutexattrSetprotocol(ScePthreadMutexattr* attr, int protocol) { int PS4_SYSV_ABI scePthreadMutexattrSetprotocol(ScePthreadMutexattr* attr, int protocol) {
@ -984,6 +987,7 @@ static void cleanup_thread(void* arg) {
destructor(value); destructor(value);
} }
} }
Core::CleanupThreadPatchStack();
thread->is_almost_done = true; thread->is_almost_done = true;
} }
@ -991,6 +995,7 @@ static void* run_thread(void* arg) {
auto* thread = static_cast<ScePthread>(arg); auto* thread = static_cast<ScePthread>(arg);
Common::SetCurrentThreadName(thread->name.c_str()); Common::SetCurrentThreadName(thread->name.c_str());
auto* linker = Common::Singleton<Core::Linker>::Instance(); auto* linker = Common::Singleton<Core::Linker>::Instance();
Core::InitializeThreadPatchStack();
linker->InitTlsForThread(false); linker->InitTlsForThread(false);
void* ret = nullptr; void* ret = nullptr;
g_pthread_self = thread; g_pthread_self = thread;
@ -1373,90 +1378,97 @@ int PS4_SYSV_ABI posix_pthread_detach(ScePthread thread) {
return pthread_detach(thread->pth); return pthread_detach(thread->pth);
} }
int PS4_SYSV_ABI posix_sem_init(sem_t* sem, int pshared, unsigned int value) { int PS4_SYSV_ABI posix_sem_init(PthreadSemInternal** sem, int pshared, unsigned int value) {
int result = sem_init(sem, pshared, value); if (value > ORBIS_KERNEL_SEM_VALUE_MAX) {
if (result == -1) { SetPosixErrno(EINVAL);
SetPosixErrno(errno); return -1;
} }
return result; if (sem != nullptr) {
*sem = new PthreadSemInternal{
.semaphore = std::counting_semaphore<ORBIS_KERNEL_SEM_VALUE_MAX>{value},
.value = {static_cast<int>(value)},
};
}
return 0;
} }
int PS4_SYSV_ABI posix_sem_wait(sem_t* sem) { int PS4_SYSV_ABI posix_sem_wait(PthreadSemInternal** sem) {
int result = sem_wait(sem); if (sem == nullptr || *sem == nullptr) {
if (result == -1) { SetPosixErrno(EINVAL);
SetPosixErrno(errno); return -1;
} }
return result; (*sem)->semaphore.acquire();
--(*sem)->value;
return 0;
} }
int PS4_SYSV_ABI posix_sem_trywait(sem_t* sem) { int PS4_SYSV_ABI posix_sem_trywait(PthreadSemInternal** sem) {
int result = sem_trywait(sem); if (sem == nullptr || *sem == nullptr) {
if (result == -1) { SetPosixErrno(EINVAL);
SetPosixErrno(errno); return -1;
} }
return result; if (!(*sem)->semaphore.try_acquire()) {
SetPosixErrno(EAGAIN);
return -1;
}
--(*sem)->value;
return 0;
} }
#ifndef HAVE_SEM_TIMEDWAIT int PS4_SYSV_ABI posix_sem_timedwait(PthreadSemInternal** sem, const timespec* t) {
int sem_timedwait(sem_t* sem, const struct timespec* abstime) { if (sem == nullptr || *sem == nullptr) {
int rc; SetPosixErrno(EINVAL);
while ((rc = sem_trywait(sem)) == EAGAIN) { return -1;
struct timespec curr_time;
clock_gettime(CLOCK_REALTIME, &curr_time);
s64 remaining_ns = 0;
remaining_ns +=
(static_cast<s64>(abstime->tv_sec) - static_cast<s64>(curr_time.tv_sec)) * 1000000000L;
remaining_ns += static_cast<s64>(abstime->tv_nsec) - static_cast<s64>(curr_time.tv_nsec);
if (remaining_ns <= 0) {
return ETIMEDOUT;
} }
struct timespec sleep_time; using std::chrono::duration_cast;
sleep_time.tv_sec = 0; using std::chrono::nanoseconds;
if (remaining_ns < 5000000L) { using std::chrono::seconds;
sleep_time.tv_nsec = remaining_ns; using std::chrono::system_clock;
} else {
sleep_time.tv_nsec = 5000000;
}
nanosleep(&sleep_time, nullptr); const system_clock::time_point time{
duration_cast<system_clock::duration>(seconds{t->tv_sec} + nanoseconds{t->tv_nsec})};
if (!(*sem)->semaphore.try_acquire_until(time)) {
SetPosixErrno(ETIMEDOUT);
return -1;
} }
return rc; --(*sem)->value;
} return 0;
#endif
int PS4_SYSV_ABI posix_sem_timedwait(sem_t* sem, const timespec* t) {
int result = sem_timedwait(sem, t);
if (result == -1) {
SetPosixErrno(errno);
}
return result;
} }
int PS4_SYSV_ABI posix_sem_post(sem_t* sem) { int PS4_SYSV_ABI posix_sem_post(PthreadSemInternal** sem) {
int result = sem_post(sem); if (sem == nullptr || *sem == nullptr) {
if (result == -1) { SetPosixErrno(EINVAL);
SetPosixErrno(errno); return -1;
} }
return result; if ((*sem)->value == ORBIS_KERNEL_SEM_VALUE_MAX) {
SetPosixErrno(EOVERFLOW);
return -1;
}
++(*sem)->value;
(*sem)->semaphore.release();
return 0;
} }
int PS4_SYSV_ABI posix_sem_destroy(sem_t* sem) { int PS4_SYSV_ABI posix_sem_destroy(PthreadSemInternal** sem) {
int result = sem_destroy(sem); if (sem == nullptr || *sem == nullptr) {
if (result == -1) { SetPosixErrno(EINVAL);
SetPosixErrno(errno); return -1;
} }
return result; delete *sem;
*sem = nullptr;
return 0;
} }
int PS4_SYSV_ABI posix_sem_getvalue(sem_t* sem, int* sval) { int PS4_SYSV_ABI posix_sem_getvalue(PthreadSemInternal** sem, int* sval) {
int result = sem_getvalue(sem, sval); if (sem == nullptr || *sem == nullptr) {
if (result == -1) { SetPosixErrno(EINVAL);
SetPosixErrno(errno); return -1;
} }
return result; if (sval) {
*sval = (*sem)->value;
}
return 0;
} }
int PS4_SYSV_ABI posix_pthread_attr_getstacksize(const pthread_attr_t* attr, size_t* size) { int PS4_SYSV_ABI posix_pthread_attr_getstacksize(const pthread_attr_t* attr, size_t* size) {

View File

@ -5,10 +5,12 @@
#include <atomic> #include <atomic>
#include <mutex> #include <mutex>
#include <semaphore>
#include <string> #include <string>
#include <vector> #include <vector>
#include <pthread.h> #include <pthread.h>
#include <sched.h> #include <sched.h>
#include "common/types.h" #include "common/types.h"
namespace Core::Loader { namespace Core::Loader {
@ -19,6 +21,12 @@ namespace Libraries::Kernel {
constexpr int ORBIS_KERNEL_PRIO_FIFO_DEFAULT = 700; constexpr int ORBIS_KERNEL_PRIO_FIFO_DEFAULT = 700;
constexpr int ORBIS_KERNEL_PRIO_FIFO_HIGHEST = 256; constexpr int ORBIS_KERNEL_PRIO_FIFO_HIGHEST = 256;
constexpr int ORBIS_KERNEL_PRIO_FIFO_LOWEST = 767; constexpr int ORBIS_KERNEL_PRIO_FIFO_LOWEST = 767;
constexpr int ORBIS_KERNEL_SEM_VALUE_MAX = 0x7FFFFFFF;
constexpr int ORBIS_PTHREAD_MUTEX_ERRORCHECK = 1;
constexpr int ORBIS_PTHREAD_MUTEX_RECURSIVE = 2;
constexpr int ORBIS_PTHREAD_MUTEX_NORMAL = 3;
constexpr int ORBIS_PTHREAD_MUTEX_ADAPTIVE = 4;
struct PthreadInternal; struct PthreadInternal;
struct PthreadAttrInternal; struct PthreadAttrInternal;
@ -104,6 +112,11 @@ struct PthreadRwInternal {
std::string name; std::string name;
}; };
struct PthreadSemInternal {
std::counting_semaphore<ORBIS_KERNEL_SEM_VALUE_MAX> semaphore;
std::atomic<s32> value;
};
class PThreadPool { class PThreadPool {
public: public:
ScePthread Create(); ScePthread Create();

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <condition_variable> #include <condition_variable>
#include <list>
#include <mutex> #include <mutex>
#include <utility>
#include <boost/intrusive/list.hpp>
#include <pthread.h> #include <pthread.h>
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
@ -13,9 +13,6 @@
namespace Libraries::Kernel { namespace Libraries::Kernel {
using ListBaseHook =
boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>>;
class Semaphore { class Semaphore {
public: public:
Semaphore(s32 init_count, s32 max_count, std::string_view name, bool is_fifo) Semaphore(s32 init_count, s32 max_count, std::string_view name, bool is_fifo)
@ -37,7 +34,7 @@ public:
// Create waiting thread object and add it into the list of waiters. // Create waiting thread object and add it into the list of waiters.
WaitingThread waiter{need_count, is_fifo}; WaitingThread waiter{need_count, is_fifo};
AddWaiter(waiter); AddWaiter(&waiter);
// Perform the wait. // Perform the wait.
return waiter.Wait(lk, timeout); return waiter.Wait(lk, timeout);
@ -52,14 +49,14 @@ public:
// Wake up threads in order of priority. // Wake up threads in order of priority.
for (auto it = wait_list.begin(); it != wait_list.end();) { for (auto it = wait_list.begin(); it != wait_list.end();) {
auto& waiter = *it; auto* waiter = *it;
if (waiter.need_count > token_count) { if (waiter->need_count > token_count) {
it++; it++;
continue; continue;
} }
it = wait_list.erase(it); it = wait_list.erase(it);
token_count -= waiter.need_count; token_count -= waiter->need_count;
waiter.cv.notify_one(); waiter->cv.notify_one();
} }
return true; return true;
@ -70,9 +67,9 @@ public:
if (num_waiters) { if (num_waiters) {
*num_waiters = wait_list.size(); *num_waiters = wait_list.size();
} }
for (auto& waiter : wait_list) { for (auto* waiter : wait_list) {
waiter.was_cancled = true; waiter->was_cancled = true;
waiter.cv.notify_one(); waiter->cv.notify_one();
} }
wait_list.clear(); wait_list.clear();
token_count = set_count < 0 ? init_count : set_count; token_count = set_count < 0 ? init_count : set_count;
@ -80,7 +77,7 @@ public:
} }
public: public:
struct WaitingThread : public ListBaseHook { struct WaitingThread {
std::condition_variable cv; std::condition_variable cv;
u32 priority; u32 priority;
s32 need_count; s32 need_count;
@ -132,7 +129,7 @@ public:
} }
}; };
void AddWaiter(WaitingThread& waiter) { void AddWaiter(WaitingThread* waiter) {
// Insert at the end of the list for FIFO order. // Insert at the end of the list for FIFO order.
if (is_fifo) { if (is_fifo) {
wait_list.push_back(waiter); wait_list.push_back(waiter);
@ -140,16 +137,13 @@ public:
} }
// Find the first with priority less then us and insert right before it. // Find the first with priority less then us and insert right before it.
auto it = wait_list.begin(); auto it = wait_list.begin();
while (it != wait_list.end() && it->priority > waiter.priority) { while (it != wait_list.end() && (*it)->priority > waiter->priority) {
it++; it++;
} }
wait_list.insert(it, waiter); wait_list.insert(it, waiter);
} }
using WaitingThreads = std::list<WaitingThread*> wait_list;
boost::intrusive::list<WaitingThread, boost::intrusive::base_hook<ListBaseHook>,
boost::intrusive::constant_time_size<false>>;
WaitingThreads wait_list;
std::string name; std::string name;
std::atomic<s32> token_count; std::atomic<s32> token_count;
std::mutex mutex; std::mutex mutex;

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <thread> #include <thread>
#include "common/assert.h" #include "common/assert.h"
#include "common/debug.h" #include "common/debug.h"
#include "common/native_clock.h" #include "common/native_clock.h"

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <cmath> #include <cmath>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"

View File

@ -2,13 +2,18 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "common/config.h" #include "common/config.h"
#include "core/libraries/ajm/ajm.h"
#include "core/libraries/app_content/app_content.h" #include "core/libraries/app_content/app_content.h"
#include "core/libraries/audio/audioin.h" #include "core/libraries/audio/audioin.h"
#include "core/libraries/audio/audioout.h" #include "core/libraries/audio/audioout.h"
#include "core/libraries/avplayer/avplayer.h"
#include "core/libraries/dialogs/error_dialog.h"
#include "core/libraries/dialogs/ime_dialog.h"
#include "core/libraries/disc_map/disc_map.h" #include "core/libraries/disc_map/disc_map.h"
#include "core/libraries/gnmdriver/gnmdriver.h" #include "core/libraries/gnmdriver/gnmdriver.h"
#include "core/libraries/kernel/libkernel.h" #include "core/libraries/kernel/libkernel.h"
#include "core/libraries/libc_internal/libc_internal.h" #include "core/libraries/libc_internal/libc_internal.h"
#include "core/libraries/libpng/pngdec.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"
#include "core/libraries/network/http.h" #include "core/libraries/network/http.h"
#include "core/libraries/network/net.h" #include "core/libraries/network/net.h"
@ -32,11 +37,6 @@
#include "core/libraries/system/userservice.h" #include "core/libraries/system/userservice.h"
#include "core/libraries/usbd/usbd.h" #include "core/libraries/usbd/usbd.h"
#include "core/libraries/videoout/video_out.h" #include "core/libraries/videoout/video_out.h"
#include "src/core/libraries/ajm/ajm.h"
#include "src/core/libraries/avplayer/avplayer.h"
#include "src/core/libraries/dialogs/error_dialog.h"
#include "src/core/libraries/dialogs/ime_dialog.h"
#include "src/core/libraries/libpng/pngdec.h"
namespace Libraries { namespace Libraries {

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <functional> #include <functional>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/loader/elf.h" #include "core/loader/elf.h"
#include "core/loader/symbols_resolver.h" #include "core/loader/symbols_resolver.h"

View File

@ -3,54 +3,116 @@
#pragma once #pragma once
constexpr int ORBIS_NGS2_ERROR_INVALID_PARAMETERS = 0x804A0001; constexpr int ORBIS_NGS2_ERROR_FAIL = 0x804A0001;
constexpr int ORBIS_NGS2_ERROR_INVALID_MAXIMUM_GRAIN_SAMPLES = 0x804A0050; constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_GRAIN_SAMPLES = 0x804A0050;
constexpr int ORBIS_NGS2_ERROR_INVALID_GRAIN_SAMPLES = 0x804A0051; constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_GRAIN_SAMPLES = 0x804A0051;
constexpr int ORBIS_NGS2_ERROR_INVALID_CHANNELS = 0x804A0052; constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_CHANNELS = 0x804A0052;
constexpr int ORBIS_NGS2_ERROR_INVALD_ADDRESS = 0x804A0053; constexpr int ORBIS_NGS2_ERROR_INVALID_OUT_ADDRESS = 0x804A0053;
constexpr int ORBIS_NGS2_ERROR_INVALD_SIZE = 0x804A0054; constexpr int ORBIS_NGS2_ERROR_INVALID_OUT_SIZE = 0x804A0054;
constexpr int ORBIS_NGS2_ERROR_INVALID_OPTION_ADDRESS = 0x804A0080;
constexpr int ORBIS_NGS2_ERROR_INVALID_OPTION_SIZE = 0x804A0081; constexpr int ORBIS_NGS2_ERROR_INVALID_OPTION_SIZE = 0x804A0081;
constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_OPTION_MAX_MATRICES = 0x804A0100; constexpr int ORBIS_NGS2_ERROR_INVALID_OPTION_FLAG = 0x804A0082;
constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_OPTION_MAX_PORTS = 0x804A0101; constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_MATRICES = 0x804A0100;
constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_OPTION_MAX_INPUT_DELAY_BLOCKS = 0x804A0102; constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_PORTS = 0x804A0101;
constexpr int ORBIS_NGS2_ERROR_INVALID_MATRIX_LEVELS = 0x804A0150; constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_INPUT_DELAY_BLOCKS = 0x804A0102;
constexpr int ORBIS_NGS2_ERROR_SAMPLER_WAVEFORM_TERMINATED = 0x804A0151; constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_VOICES = 0x804A0103;
constexpr int ORBIS_NGS2_ERROR_INVALID_ENVELOPE_POINTS = 0x804A0152; constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_CHANNELS = 0x804A0104;
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_CHANNEL_WORKS = 0x804A0105;
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_WAVEFORM_BLOCKS = 0x804A0106;
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_ENVELOPE_POINTS = 0x804A0107;
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_FILTERS = 0x804A0108;
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_CODEC_CACHES = 0x804A0109;
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_ATRAC9_DECODERS = 0x804A010A;
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_ATRAC9_CHANNEL_WORKS = 0x804A010B;
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_INPUTS = 0x804A010C;
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_MATRIX_LEVELS = 0x804A0150;
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_WAVEFORM_BLOCKS = 0x804A0151;
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_ENVELOPE_POINTS = 0x804A0152;
constexpr int ORBIS_NGS2_ERROR_INVALID_MATRIX_LEVEL_ADDRESS = 0x804A0153; constexpr int ORBIS_NGS2_ERROR_INVALID_MATRIX_LEVEL_ADDRESS = 0x804A0153;
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_BLOCK_ADDRESS = 0x804A0154; constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_BLOCK_ADDRESS = 0x804A0154;
constexpr int ORBIS_NGS2_ERROR_INVALID_ENVELOPE_POINT_ADDRESS = 0x804A0155; constexpr int ORBIS_NGS2_ERROR_INVALID_ENVELOPE_POINT_ADDRESS = 0x804A0155;
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_PEAKMETER_BLOCKS = 0x804A0156;
constexpr int ORBIS_NGS2_ERROR_INVALID_HANDLE = 0x804A0200; constexpr int ORBIS_NGS2_ERROR_INVALID_HANDLE = 0x804A0200;
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLE_RATE = 0x804A0201; constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLE_RATE = 0x804A0201;
constexpr int ORBIS_NGS2_ERROR_INVALID_REPORT_TYPE = 0x804A0202;
constexpr int ORBIS_NGS2_ERROR_INVALID_REPORT_HANDLER = 0x804A0203;
constexpr int ORBIS_NGS2_ERROR_INVALID_REPORT_HANDLE = 0x804A0204; constexpr int ORBIS_NGS2_ERROR_INVALID_REPORT_HANDLE = 0x804A0204;
constexpr int ORBIS_NGS2_ERROR_EMPTY_REPORT_HANDLE = 0x804A0205;
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_INFO = 0x804A0206; constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_INFO = 0x804A0206;
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_ADDRESS = 0x804A0207; constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_ADDRESS = 0x804A0207;
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_ALIGNMENT = 0x804A0208; constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_ALIGN = 0x804A0208;
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_SIZE = 0x804A0209; constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_SIZE = 0x804A0209;
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_ALLOCATOR = 0x804A020A; constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_ALLOCATOR = 0x804A020A;
constexpr int ORBIS_NGS2_ERROR_BUFFER_VERIFY_FAILED = 0x804A020B; constexpr int ORBIS_NGS2_ERROR_BUFFER_BROKEN = 0x804A020B;
constexpr int ORBIS_NGS2_ERROR_MODULE_PLAYER_DATA_EMPTY = 0x804A020C; constexpr int ORBIS_NGS2_ERROR_EMPTY_BUFFER = 0x804A020C;
constexpr int ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE = 0x804A0230; constexpr int ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE = 0x804A0230;
constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_ID = 0x804A0260; constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_ID = 0x804A0260;
constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE = 0x804A0261; constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE = 0x804A0261;
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE = 0x804A0300; constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE = 0x804A0300;
constexpr int ORBIS_NGS2_ERROR_UNINIT_VOICE = 0x804A0301;
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_INDEX = 0x804A0302; constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_INDEX = 0x804A0302;
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_EVENT = 0x804A0303; constexpr int ORBIS_NGS2_ERROR_INVALID_EVENT_TYPE = 0x804A0303;
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_PORT_INDEX = 0x804A0304; constexpr int ORBIS_NGS2_ERROR_INVALID_PORT_INDEX = 0x804A0304;
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_INPUT_OR_RACK_OCCUPIED = 0x804A0305; constexpr int ORBIS_NGS2_ERROR_INVALID_PATCH = 0x804A0305;
constexpr int ORBIS_NGS2_ERROR_INVALID_CONTROL_ID = 0x804A0308; constexpr int ORBIS_NGS2_ERROR_EMPTY_CHANNEL_WORK = 0x804A0306;
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_CONTROL_PARAMETER = 0x804A0309; constexpr int ORBIS_NGS2_ERROR_EMPTY_CODEC_DECODER = 0x804A0307;
constexpr int ORBIS_NGS2_ERROR_INVALID_PARAMETER_SIZE = 0x804A030A; constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_CONTROL_ID = 0x804A0308;
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_CONTROL_ADDRESS = 0x804A0309;
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_CONTROL_SIZE = 0x804A030A;
constexpr int ORBIS_NGS2_ERROR_DETECTED_CIRCULAR_VOICE_CONTROL = 0x804A030B; constexpr int ORBIS_NGS2_ERROR_DETECTED_CIRCULAR_VOICE_CONTROL = 0x804A030B;
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_DATA = 0x804A0400; constexpr int ORBIS_NGS2_ERROR_UNABLE_CALLBACK = 0x804A030C;
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_FORMAT = 0x804A0401; constexpr int ORBIS_NGS2_ERROR_INVALID_CALLBACK_FLAG = 0x804A030D;
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_TYPE_NO_ATRAC9_DECODERS = 0x804A0402; constexpr int ORBIS_NGS2_ERROR_INVALID_CALLBACK_HANDLER = 0x804A030E;
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_ATRAC9_CONFIG_DATA = 0x804A0403; constexpr int ORBIS_NGS2_ERROR_INVALID_OPERATION = 0x804A030F;
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_SAMPLE_RATE = 0x804A0404; constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_FORMAT = 0x804A0400;
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_FRAME = 0x804A0405; constexpr int ORBIS_NGS2_ERROR_UNKNOWN_WAVEFORM_FORMAT = 0x804A0401;
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_ADDRESS = 0x804A0406; constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_TYPE = 0x804A0402;
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_CONFIG = 0x804A0403;
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_SAMPLE_RATE = 0x804A0404;
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_FRAME = 0x804A0405;
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_ADDRESS = 0x804A0406;
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_SIZE = 0x804A0407;
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_DATA = 0x804A0408;
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_BLOCK_NUM_REPEATS = 0x804A0409;
constexpr int ORBIS_NGS2_ERROR_INVALID_ENVELOPE_CURVE = 0x804A0500; constexpr int ORBIS_NGS2_ERROR_INVALID_ENVELOPE_CURVE = 0x804A0500;
constexpr int ORBIS_NGS2_ERROR_INVALID_PEAKMETER_FLAG = 0x804A0510;
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_CHORUS_PHASES = 0x804A0520;
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_CHORUS_PHASES = 0x804A0521;
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_DELAY_LENGTH = 0x804A0530;
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_DELAY_TAPS = 0x804A0531;
constexpr int ORBIS_NGS2_ERROR_INVALID_DELAY_TYPE = 0x804A0532;
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_DELAY_TAPS = 0x804A0533;
constexpr int ORBIS_NGS2_ERROR_INVALID_DELAY_TAP_INFO = 0x804A0534;
constexpr int ORBIS_NGS2_ERROR_INVALID_PITCH_SHIFT_QUALITY = 0x804A0540;
constexpr int ORBIS_NGS2_ERROR_INVALID_FILTER_INDEX = 0x804A0600; constexpr int ORBIS_NGS2_ERROR_INVALID_FILTER_INDEX = 0x804A0600;
constexpr int ORBIS_NGS2_ERROR_INVALID_FILTER_TYPE = 0x804A0601; constexpr int ORBIS_NGS2_ERROR_INVALID_FILTER_TYPE = 0x804A0601;
constexpr int ORBIS_NGS2_ERROR_INVALID_FILTER_LOCATION = 0x804A0602; constexpr int ORBIS_NGS2_ERROR_INVALID_FILTER_LOCATION = 0x804A0602;
constexpr int ORBIS_NGS2_ERROR_INVALID_LFE_CUT_OFF_FREQUENCY = 0x804A0603; constexpr int ORBIS_NGS2_ERROR_INVALID_LFE_FC = 0x804A0603;
constexpr int ORBIS_NGS2_ERROR_INVALID_MATRIX_INDEX_OR_TYPE = 0x804A0700; constexpr int ORBIS_NGS2_ERROR_INVALID_USER_FX_PARAM_SIZE = 0x804A0650;
constexpr int ORBIS_NGS2_ERROR_INVALID_MATRIX_INDEX = 0x804A0700;
constexpr int ORBIS_NGS2_ERROR_CODEC_UNKNOWN_WAVEFORM = 0x804A0800;
constexpr int ORBIS_NGS2_ERROR_CODEC_EMPTY_INSTANCE = 0x804A0801;
constexpr int ORBIS_NGS2_ERROR_CODEC_EMPTY_CHANNEL = 0x804A0802;
constexpr int ORBIS_NGS2_ERROR_CODEC_SETUP_FAIL = 0x804A0803;
constexpr int ORBIS_NGS2_ERROR_CODEC_RESET_FAIL = 0x804A0804;
constexpr int ORBIS_NGS2_ERROR_CODEC_DECODE_FAIL = 0x804A0805;
constexpr int ORBIS_NGS2_ERROR_INVALID_REVERB_SIZE = 0x804A0900;
constexpr int ORBIS_NGS2_ERROR_INVALID_PAN_UNIT_ANGLE = 0x804A0910;
constexpr int ORBIS_NGS2_ERROR_INVALID_PAN_SPEAKER = 0x804A0911;
constexpr int ORBIS_NGS2_ERROR_INVALID_PAN_MATRIX_FORMAT = 0x804A0912;
constexpr int ORBIS_NGS2_ERROR_INVALID_PAN_WORK = 0x804A0913;
constexpr int ORBIS_NGS2_ERROR_INVALID_PAN_PARAM = 0x804A0914;
constexpr int ORBIS_NGS2_ERROR_INVALID_GEOM_DISTANCE = 0x804A0920;
constexpr int ORBIS_NGS2_ERROR_INVALID_GEOM_LISTENER_ADDRESS = 0x804A0921;
constexpr int ORBIS_NGS2_ERROR_INVALID_GEOM_SOURCE_ADDRESS = 0x804A0922;
constexpr int ORBIS_NGS2_ERROR_INVALID_GEOM_FLAG = 0x804A0923;
constexpr int ORBIS_NGS2_ERROR_INVALID_GEOM_CONE = 0x804A0924;
constexpr int ORBIS_NGS2_ERROR_INVALID_MODULE_ID = 0x804A0A00;
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_MODULES = 0x804A0A01;
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_MODULE_BUFFERS = 0x804A0A02;
constexpr int ORBIS_NGS2_ERROR_INVALID_MODULE_BUFFER_ID = 0x804A0A03;
constexpr int ORBIS_NGS2_ERROR_INVALID_MODULE_STATE_OFFSET = 0x804A0A04;
constexpr int ORBIS_NGS2_ERROR_INVALID_MODULE_STATE_SIZE = 0x804A0A05;
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_STATE_SIZE = 0x804A0A06;
constexpr int ORBIS_NGS2_ERROR_INVALID_MODULE_INDEX = 0x804A0B00;
constexpr int ORBIS_NGS2_ERROR_INVALID_MODULE_INFO_SIZE = 0x804A0B01;

View File

@ -138,13 +138,13 @@ s32 Ngs2::SystemSetupCore(StackBuffer* buf, SystemOptions* options, Ngs2Handle**
// Validate maxGrainSamples // Validate maxGrainSamples
if (maxGrainSamples < 64 || maxGrainSamples > 1024 || (maxGrainSamples & 0x3F) != 0) { if (maxGrainSamples < 64 || maxGrainSamples > 1024 || (maxGrainSamples & 0x3F) != 0) {
LOG_ERROR(Lib_Ngs2, "Invalid system option (maxGrainSamples={},x64)", maxGrainSamples); LOG_ERROR(Lib_Ngs2, "Invalid system option (maxGrainSamples={},x64)", maxGrainSamples);
return ORBIS_NGS2_ERROR_INVALID_MAXIMUM_GRAIN_SAMPLES; return ORBIS_NGS2_ERROR_INVALID_MAX_GRAIN_SAMPLES;
} }
// Validate numGrainSamples // Validate numGrainSamples
if (numGrainSamples < 64 || numGrainSamples > 1024 || (numGrainSamples & 0x3F) != 0) { if (numGrainSamples < 64 || numGrainSamples > 1024 || (numGrainSamples & 0x3F) != 0) {
LOG_ERROR(Lib_Ngs2, "Invalid system option (numGrainSamples={},x64)", numGrainSamples); LOG_ERROR(Lib_Ngs2, "Invalid system option (numGrainSamples={},x64)", numGrainSamples);
return ORBIS_NGS2_ERROR_INVALID_GRAIN_SAMPLES; return ORBIS_NGS2_ERROR_INVALID_NUM_GRAIN_SAMPLES;
} }
// Validate sampleRate // Validate sampleRate

View File

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include "common/config.h" #include "common/config.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"

View File

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"

View File

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include <unordered_map> #include <unordered_map>
#include "common/logging/log.h" #include "common/logging/log.h"

View File

@ -1,10 +1,10 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator #include "common/assert.h"
#include <common/assert.h> #include "common/config.h"
#include <common/singleton.h>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/singleton.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"
#include "input/controller.h" #include "input/controller.h"
@ -25,6 +25,9 @@ int PS4_SYSV_ABI scePadConnectPort() {
int PS4_SYSV_ABI scePadDeviceClassGetExtendedInformation( int PS4_SYSV_ABI scePadDeviceClassGetExtendedInformation(
s32 handle, OrbisPadDeviceClassExtendedInformation* pExtInfo) { s32 handle, OrbisPadDeviceClassExtendedInformation* pExtInfo) {
LOG_ERROR(Lib_Pad, "(STUBBED) called"); LOG_ERROR(Lib_Pad, "(STUBBED) called");
if (Config::getUseSpecialPad()) {
pExtInfo->deviceClass = (OrbisPadDeviceClass)Config::getSpecialPadClass();
}
return ORBIS_OK; return ORBIS_OK;
} }
@ -107,6 +110,10 @@ int PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadControllerIn
pInfo->connectedCount = 1; pInfo->connectedCount = 1;
pInfo->connected = true; pInfo->connected = true;
pInfo->deviceClass = ORBIS_PAD_DEVICE_CLASS_STANDARD; pInfo->deviceClass = ORBIS_PAD_DEVICE_CLASS_STANDARD;
if (Config::getUseSpecialPad()) {
pInfo->connectionType = ORBIS_PAD_PORT_TYPE_SPECIAL;
pInfo->deviceClass = (OrbisPadDeviceClass)Config::getSpecialPadClass();
}
return SCE_OK; return SCE_OK;
} }
@ -239,11 +246,26 @@ int PS4_SYSV_ABI scePadMbusTerm() {
int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenParam* pParam) { int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenParam* pParam) {
LOG_INFO(Lib_Pad, "(DUMMY) called user_id = {} type = {} index = {}", userId, type, index); LOG_INFO(Lib_Pad, "(DUMMY) called user_id = {} type = {} index = {}", userId, type, index);
if (Config::getUseSpecialPad()) {
if (type != ORBIS_PAD_PORT_TYPE_SPECIAL)
return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED;
} else {
if (type != ORBIS_PAD_PORT_TYPE_STANDARD)
return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED;
}
return 1; // dummy return 1; // dummy
} }
int PS4_SYSV_ABI scePadOpenExt() { int PS4_SYSV_ABI scePadOpenExt(s32 userId, s32 type, s32 index,
const OrbisPadOpenExtParam* pParam) {
LOG_ERROR(Lib_Pad, "(STUBBED) called"); LOG_ERROR(Lib_Pad, "(STUBBED) called");
if (Config::getUseSpecialPad()) {
if (type != ORBIS_PAD_PORT_TYPE_SPECIAL)
return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED;
} else {
if (type != ORBIS_PAD_PORT_TYPE_STANDARD)
return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED;
}
return 1; // dummy return 1; // dummy
} }
@ -286,12 +308,13 @@ int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num) {
pData[i].angularVelocity.x = 0.0f; pData[i].angularVelocity.x = 0.0f;
pData[i].angularVelocity.y = 0.0f; pData[i].angularVelocity.y = 0.0f;
pData[i].angularVelocity.z = 0.0f; pData[i].angularVelocity.z = 0.0f;
pData[i].touchData.touchNum = 0; pData[i].touchData.touchNum =
pData[i].touchData.touch[0].x = 0; (states[i].touchpad[0].state ? 1 : 0) + (states[i].touchpad[1].state ? 1 : 0);
pData[i].touchData.touch[0].y = 0; pData[i].touchData.touch[0].x = states[i].touchpad[0].x;
pData[i].touchData.touch[0].y = states[i].touchpad[0].y;
pData[i].touchData.touch[0].id = 1; pData[i].touchData.touch[0].id = 1;
pData[i].touchData.touch[1].x = 0; pData[i].touchData.touch[1].x = states[i].touchpad[1].x;
pData[i].touchData.touch[1].y = 0; pData[i].touchData.touch[1].y = states[i].touchpad[1].y;
pData[i].touchData.touch[1].id = 2; pData[i].touchData.touch[1].id = 2;
pData[i].connected = connected; pData[i].connected = connected;
pData[i].timestamp = states[i].time; pData[i].timestamp = states[i].time;

View File

@ -229,6 +229,13 @@ struct OrbisPadOpenParam {
u8 reserve[8]; u8 reserve[8];
}; };
struct OrbisPadOpenExtParam {
u16 vendorId;
u16 productId;
u16 productId_2;
u8 reserve[10];
};
struct OrbisPadLightBarParam { struct OrbisPadLightBarParam {
u8 r; u8 r;
u8 g; u8 g;
@ -284,7 +291,7 @@ int PS4_SYSV_ABI scePadIsValidHandle();
int PS4_SYSV_ABI scePadMbusInit(); int PS4_SYSV_ABI scePadMbusInit();
int PS4_SYSV_ABI scePadMbusTerm(); int PS4_SYSV_ABI scePadMbusTerm();
int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenParam* pParam); int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenParam* pParam);
int PS4_SYSV_ABI scePadOpenExt(); int PS4_SYSV_ABI scePadOpenExt(s32 userId, s32 type, s32 index, const OrbisPadOpenExtParam* pParam);
int PS4_SYSV_ABI scePadOpenExt2(); int PS4_SYSV_ABI scePadOpenExt2();
int PS4_SYSV_ABI scePadOutputReport(); int PS4_SYSV_ABI scePadOutputReport();
int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num); int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num);

View File

@ -1,9 +1,9 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <core/file_format/playgo_chunk.h>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "core/file_format/playgo_chunk.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"
#include "core/libraries/system/systemservice.h" #include "core/libraries/system/systemservice.h"

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#pragma once #pragma once
#include "common/types.h" #include "common/types.h"
#include "playgo_types.h" #include "playgo_types.h"

View File

@ -1,14 +1,16 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "random.h"
#include "random_error.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"
#include "random.h"
namespace Libraries::Random { namespace Libraries::Random {
s32 PS4_SYSV_ABI sceRandomGetRandomNumber(u8* buf, size_t size) { s32 PS4_SYSV_ABI sceRandomGetRandomNumber(u8* buf, std::size_t size) {
LOG_TRACE(Lib_Random, "called"); LOG_TRACE(Lib_Random, "called");
if (size > SCE_RANDOM_MAX_SIZE) { if (size > SCE_RANDOM_MAX_SIZE) {
return SCE_RANDOM_ERROR_INVALID; return SCE_RANDOM_ERROR_INVALID;

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#pragma once #pragma once
#include "common/types.h" #include "common/types.h"
namespace Core::Loader { namespace Core::Loader {
@ -11,7 +12,7 @@ class SymbolsResolver;
namespace Libraries::Random { namespace Libraries::Random {
constexpr int32_t SCE_RANDOM_MAX_SIZE = 64; constexpr int32_t SCE_RANDOM_MAX_SIZE = 64;
s32 PS4_SYSV_ABI sceRandomGetRandomNumber(u8* buf, size_t size); s32 PS4_SYSV_ABI sceRandomGetRandomNumber(u8* buf, std::size_t size);
void RegisterlibSceRandom(Core::Loader::SymbolsResolver* sym); void RegisterlibSceRandom(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Random } // namespace Libraries::Random

View File

@ -0,0 +1,8 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
constexpr int SCE_RANDOM_ERROR_INVALID = 0x817C0016;
constexpr int SCE_RANDOM_ERROR_OUT_OF_RESOURCES = 0x817C001C;
constexpr int SCE_RANDOM_ERROR_FATAL = 0x817C00FF;

View File

@ -1,8 +1,8 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include <chrono> #include <chrono>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"

View File

@ -3,12 +3,13 @@
#include <span> #include <span>
#include <vector> #include <vector>
#include <common/path_util.h>
#include <common/singleton.h>
#include <core/file_format/psf.h>
#include <core/file_sys/fs.h>
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/path_util.h"
#include "common/singleton.h"
#include "core/file_format/psf.h"
#include "core/file_sys/fs.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"
#include "core/libraries/save_data/savedata.h" #include "core/libraries/save_data/savedata.h"
@ -505,8 +506,11 @@ s32 saveDataMount(u32 user_id, char* dir_name, u32 mount_mode,
ORBIS_SAVE_DATA_MOUNT_MODE_DESTRUCT_OFF: ORBIS_SAVE_DATA_MOUNT_MODE_DESTRUCT_OFF:
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_RDWR | case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_RDWR |
ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON: ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON:
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON:
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_DESTRUCT_OFF | case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_DESTRUCT_OFF |
ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON: { ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON:
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_RDWR |
ORBIS_SAVE_DATA_MOUNT_MODE_DESTRUCT_OFF | ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON: {
if (std::filesystem::exists(mount_dir)) { if (std::filesystem::exists(mount_dir)) {
return ORBIS_SAVE_DATA_ERROR_EXISTS; return ORBIS_SAVE_DATA_ERROR_EXISTS;
} }

View File

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"

View File

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#pragma once #pragma once
#include "common/types.h" #include "common/types.h"
namespace Core::Loader { namespace Core::Loader {

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <string_view> #include <string_view>
#include "common/assert.h" #include "common/assert.h"
#include "common/types.h" #include "common/types.h"

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <pthread.h> #include <pthread.h>
#include "common/assert.h" #include "common/assert.h"
#include "common/config.h" #include "common/config.h"
#include "common/debug.h" #include "common/debug.h"
@ -96,7 +97,7 @@ int VideoOutDriver::RegisterBuffers(VideoOutPort* port, s32 startIndex, void* co
} }
if (attribute->reserved0 != 0 || attribute->reserved1 != 0) { if (attribute->reserved0 != 0 || attribute->reserved1 != 0) {
LOG_ERROR(Lib_VideoOut, "Invalid reserved memebers"); LOG_ERROR(Lib_VideoOut, "Invalid reserved members");
return ORBIS_VIDEO_OUT_ERROR_INVALID_VALUE; return ORBIS_VIDEO_OUT_ERROR_INVALID_VALUE;
} }
if (attribute->aspect_ratio != 0) { if (attribute->aspect_ratio != 0) {

View File

@ -10,6 +10,7 @@
#include "common/thread.h" #include "common/thread.h"
#include "core/aerolib/aerolib.h" #include "core/aerolib/aerolib.h"
#include "core/aerolib/stubs.h" #include "core/aerolib/stubs.h"
#include "core/cpu_patches.h"
#include "core/libraries/kernel/memory_management.h" #include "core/libraries/kernel/memory_management.h"
#include "core/libraries/kernel/thread_management.h" #include "core/libraries/kernel/thread_management.h"
#include "core/linker.h" #include "core/linker.h"
@ -68,15 +69,24 @@ void Linker::Execute() {
} }
// Configure used flexible memory size. // Configure used flexible memory size.
// if (auto* mem_param = GetProcParam()->mem_param) { if (const auto* proc_param = GetProcParam()) {
// if (u64* flexible_size = mem_param->flexible_memory_size) { if (proc_param->size >=
// memory->SetTotalFlexibleSize(*flexible_size); offsetof(OrbisProcParam, mem_param) + sizeof(OrbisKernelMemParam*)) {
// } if (const auto* mem_param = proc_param->mem_param) {
// } if (mem_param->size >=
offsetof(OrbisKernelMemParam, flexible_memory_size) + sizeof(u64*)) {
if (const auto* flexible_size = mem_param->flexible_memory_size) {
memory->SetupMemoryRegions(*flexible_size);
}
}
}
}
}
// Init primary thread. // Init primary thread.
Common::SetCurrentThreadName("GAME_MainThread"); Common::SetCurrentThreadName("GAME_MainThread");
Libraries::Kernel::pthreadInitSelfMainThread(); Libraries::Kernel::pthreadInitSelfMainThread();
InitializeThreadPatchStack();
InitTlsForThread(true); InitTlsForThread(true);
// Start shared library modules // Start shared library modules
@ -96,6 +106,8 @@ void Linker::Execute() {
RunMainEntry(m->GetEntryAddress(), &p, ProgramExitFunc); RunMainEntry(m->GetEntryAddress(), &p, ProgramExitFunc);
} }
} }
CleanupThreadPatchStack();
} }
s32 Linker::LoadModule(const std::filesystem::path& elf_name, bool is_dynamic) { s32 Linker::LoadModule(const std::filesystem::path& elf_name, bool is_dynamic) {
@ -168,7 +180,7 @@ void Linker::Relocate(Module* module) {
auto sym_bind = sym.GetBind(); auto sym_bind = sym.GetBind();
auto sym_type = sym.GetType(); auto sym_type = sym.GetType();
auto sym_visibility = sym.GetVisibility(); auto sym_visibility = sym.GetVisibility();
u64 symbol_vitrual_addr = 0; u64 symbol_virtual_addr = 0;
Loader::SymbolRecord symrec{}; Loader::SymbolRecord symrec{};
switch (sym_type) { switch (sym_type) {
case STT_FUN: case STT_FUN:
@ -185,12 +197,12 @@ void Linker::Relocate(Module* module) {
} }
if (sym_visibility != 0) { if (sym_visibility != 0) {
LOG_INFO(Core_Linker, "symbol visilibity !=0"); LOG_INFO(Core_Linker, "symbol visibility !=0");
} }
switch (sym_bind) { switch (sym_bind) {
case STB_LOCAL: case STB_LOCAL:
symbol_vitrual_addr = rel_base_virtual_addr + sym.st_value; symbol_virtual_addr = rel_base_virtual_addr + sym.st_value;
module->SetRelaBit(bit_idx); module->SetRelaBit(bit_idx);
break; break;
case STB_GLOBAL: case STB_GLOBAL:
@ -200,14 +212,14 @@ void Linker::Relocate(Module* module) {
// Only set the rela bit if the symbol was actually resolved and not stubbed. // Only set the rela bit if the symbol was actually resolved and not stubbed.
module->SetRelaBit(bit_idx); module->SetRelaBit(bit_idx);
} }
symbol_vitrual_addr = symrec.virtual_address; symbol_virtual_addr = symrec.virtual_address;
break; break;
} }
default: default:
ASSERT_MSG(0, "unknown bind type {}", sym_bind); ASSERT_MSG(0, "unknown bind type {}", sym_bind);
} }
rel_is_resolved = (symbol_vitrual_addr != 0); rel_is_resolved = (symbol_virtual_addr != 0);
rel_value = (rel_is_resolved ? symbol_vitrual_addr + addend : 0); rel_value = (rel_is_resolved ? symbol_virtual_addr + addend : 0);
rel_name = symrec.name; rel_name = symrec.name;
break; break;
} }

View File

@ -11,9 +11,11 @@
namespace Core { namespace Core {
constexpr u64 SCE_DEFAULT_FLEXIBLE_MEMORY_SIZE = 448_MB;
MemoryManager::MemoryManager() { MemoryManager::MemoryManager() {
// Insert an area that covers direct memory physical block. // Set up the direct and flexible memory regions.
dmem_map.emplace(0, DirectMemoryArea{0, SCE_KERNEL_MAIN_DMEM_SIZE}); SetupMemoryRegions(SCE_DEFAULT_FLEXIBLE_MEMORY_SIZE);
// Insert a virtual memory area that covers the entire area we manage. // Insert a virtual memory area that covers the entire area we manage.
const VAddr system_managed_base = impl.SystemManagedVirtualBase(); const VAddr system_managed_base = impl.SystemManagedVirtualBase();
@ -35,6 +37,19 @@ MemoryManager::MemoryManager() {
MemoryManager::~MemoryManager() = default; MemoryManager::~MemoryManager() = default;
void MemoryManager::SetupMemoryRegions(u64 flexible_size) {
total_flexible_size = flexible_size;
total_direct_size = SCE_KERNEL_MAIN_DMEM_SIZE - flexible_size;
// Insert an area that covers direct memory physical block.
// Note that this should never be called after direct memory allocations have been made.
dmem_map.clear();
dmem_map.emplace(0, DirectMemoryArea{0, total_direct_size});
LOG_INFO(Kernel_Vmm, "Configured memory regions: flexible size = {:#x}, direct size = {:#x}",
total_flexible_size, total_direct_size);
}
PAddr MemoryManager::Allocate(PAddr search_start, PAddr search_end, size_t size, u64 alignment, PAddr MemoryManager::Allocate(PAddr search_start, PAddr search_end, size_t size, u64 alignment,
int memory_type) { int memory_type) {
std::scoped_lock lk{mutex}; std::scoped_lock lk{mutex};
@ -42,12 +57,17 @@ PAddr MemoryManager::Allocate(PAddr search_start, PAddr search_end, size_t size,
auto dmem_area = FindDmemArea(search_start); auto dmem_area = FindDmemArea(search_start);
const auto is_suitable = [&] { const auto is_suitable = [&] {
return dmem_area->second.is_free && dmem_area->second.size >= size; const auto aligned_base = alignment > 0 ? Common::AlignUp(dmem_area->second.base, alignment)
: dmem_area->second.base;
const auto alignment_size = aligned_base - dmem_area->second.base;
const auto remaining_size =
dmem_area->second.size >= alignment_size ? dmem_area->second.size - alignment_size : 0;
return dmem_area->second.is_free && remaining_size >= size;
}; };
while (!is_suitable() && dmem_area->second.GetEnd() <= search_end) { while (!is_suitable() && dmem_area->second.GetEnd() <= search_end) {
dmem_area++; dmem_area++;
} }
ASSERT_MSG(is_suitable(), "Unable to find free direct memory area"); ASSERT_MSG(is_suitable(), "Unable to find free direct memory area: size = {:#x}", size);
// Align free position // Align free position
PAddr free_addr = dmem_area->second.base; PAddr free_addr = dmem_area->second.base;
@ -328,14 +348,24 @@ int MemoryManager::DirectQueryAvailable(PAddr search_start, PAddr search_end, si
PAddr paddr{}; PAddr paddr{};
size_t max_size{}; size_t max_size{};
while (dmem_area != dmem_map.end() && dmem_area->second.GetEnd() <= search_end) { while (dmem_area != dmem_map.end() && dmem_area->second.GetEnd() <= search_end) {
if (dmem_area->second.size > max_size) { if (!dmem_area->second.is_free) {
paddr = dmem_area->second.base; dmem_area++;
max_size = dmem_area->second.size; continue;
}
const auto aligned_base = alignment > 0 ? Common::AlignUp(dmem_area->second.base, alignment)
: dmem_area->second.base;
const auto alignment_size = aligned_base - dmem_area->second.base;
const auto remaining_size =
dmem_area->second.size >= alignment_size ? dmem_area->second.size - alignment_size : 0;
if (remaining_size > max_size) {
paddr = aligned_base;
max_size = remaining_size;
} }
dmem_area++; dmem_area++;
} }
*phys_addr_out = alignment > 0 ? Common::AlignUp(paddr, alignment) : paddr; *phys_addr_out = paddr;
*size_out = max_size; *size_out = max_size;
return ORBIS_OK; return ORBIS_OK;
} }
@ -344,7 +374,7 @@ void MemoryManager::NameVirtualRange(VAddr virtual_addr, size_t size, std::strin
auto it = FindVMA(virtual_addr); auto it = FindVMA(virtual_addr);
ASSERT_MSG(it->second.Contains(virtual_addr, size), ASSERT_MSG(it->second.Contains(virtual_addr, size),
"Range provided is not fully containted in vma"); "Range provided is not fully contained in vma");
it->second.name = name; it->second.name = name;
} }
VAddr MemoryManager::SearchFree(VAddr virtual_addr, size_t size, u32 alignment) { VAddr MemoryManager::SearchFree(VAddr virtual_addr, size_t size, u32 alignment) {
@ -413,7 +443,8 @@ MemoryManager::DMemHandle MemoryManager::CarveDmemArea(PAddr addr, size_t size)
const PAddr start_in_area = addr - area.base; const PAddr start_in_area = addr - area.base;
const PAddr end_in_vma = start_in_area + size; const PAddr end_in_vma = start_in_area + size;
ASSERT_MSG(end_in_vma <= area.size, "Mapping cannot fit inside free region"); ASSERT_MSG(end_in_vma <= area.size, "Mapping cannot fit inside free region: size = {:#x}",
size);
if (end_in_vma != area.size) { if (end_in_vma != area.size) {
// Split VMA at the end of the allocated region // Split VMA at the end of the allocated region

View File

@ -130,8 +130,8 @@ public:
rasterizer = rasterizer_; rasterizer = rasterizer_;
} }
void SetTotalFlexibleSize(u64 size) { u64 GetTotalDirectSize() const {
total_flexible_size = size; return total_direct_size;
} }
u64 GetAvailableFlexibleSize() const { u64 GetAvailableFlexibleSize() const {
@ -142,6 +142,8 @@ public:
return impl.SystemReservedVirtualBase(); return impl.SystemReservedVirtualBase();
} }
void SetupMemoryRegions(u64 flexible_size);
PAddr Allocate(PAddr search_start, PAddr search_end, size_t size, u64 alignment, PAddr Allocate(PAddr search_start, PAddr search_end, size_t size, u64 alignment,
int memory_type); int memory_type);
@ -217,7 +219,8 @@ private:
DMemMap dmem_map; DMemMap dmem_map;
VMAMap vma_map; VMAMap vma_map;
std::recursive_mutex mutex; std::recursive_mutex mutex;
size_t total_flexible_size = 448_MB; size_t total_direct_size{};
size_t total_flexible_size{};
size_t flexible_usage{}; size_t flexible_usage{};
Vulkan::Rasterizer* rasterizer{}; Vulkan::Rasterizer* rasterizer{};
}; };

View File

@ -5,6 +5,9 @@
#include "common/alignment.h" #include "common/alignment.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#ifdef ENABLE_QT_GUI
#include "qt_gui/memory_patcher.h"
#endif
#include "common/string_util.h" #include "common/string_util.h"
#include "core/aerolib/aerolib.h" #include "core/aerolib/aerolib.h"
#include "core/cpu_patches.h" #include "core/cpu_patches.h"
@ -192,6 +195,16 @@ void Module::LoadModuleToMemory(u32& max_tls_index) {
const VAddr entry_addr = base_virtual_addr + elf.GetElfEntry(); const VAddr entry_addr = base_virtual_addr + elf.GetElfEntry();
LOG_INFO(Core_Linker, "program entry addr ..........: {:#018x}", entry_addr); LOG_INFO(Core_Linker, "program entry addr ..........: {:#018x}", entry_addr);
#ifdef ENABLE_QT_GUI
if (MemoryPatcher::g_eboot_address == 0) {
if (name == "eboot") {
MemoryPatcher::g_eboot_address = base_virtual_addr;
MemoryPatcher::g_eboot_image_size = base_size;
MemoryPatcher::OnGameLoaded();
}
}
#endif
} }
void Module::LoadDynamicInfo() { void Module::LoadDynamicInfo() {

View File

@ -7,6 +7,9 @@
#include "common/debug.h" #include "common/debug.h"
#include "common/logging/backend.h" #include "common/logging/backend.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#ifdef ENABLE_QT_GUI
#include "qt_gui/memory_patcher.h"
#endif
#include "common/ntapi.h" #include "common/ntapi.h"
#include "common/path_util.h" #include "common/path_util.h"
#include "common/polyfill_thread.h" #include "common/polyfill_thread.h"
@ -81,6 +84,8 @@ void Emulator::Run(const std::filesystem::path& file) {
// Applications expect to be run from /app0 so mount the file's parent path as app0. // Applications expect to be run from /app0 so mount the file's parent path as app0.
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance(); auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
mnt->Mount(file.parent_path(), "/app0"); mnt->Mount(file.parent_path(), "/app0");
// Certain games may use /hostapp as well such as CUSA001100
mnt->Mount(file.parent_path(), "/hostapp");
// Loading param.sfo file if exists // Loading param.sfo file if exists
std::string id; std::string id;
@ -93,6 +98,9 @@ void Emulator::Run(const std::filesystem::path& file) {
auto* param_sfo = Common::Singleton<PSF>::Instance(); auto* param_sfo = Common::Singleton<PSF>::Instance();
param_sfo->open(sce_sys_folder.string() + "/param.sfo", {}); param_sfo->open(sce_sys_folder.string() + "/param.sfo", {});
id = std::string(param_sfo->GetString("CONTENT_ID"), 7, 9); id = std::string(param_sfo->GetString("CONTENT_ID"), 7, 9);
#ifdef ENABLE_QT_GUI
MemoryPatcher::g_game_serial = id;
#endif
title = param_sfo->GetString("TITLE"); title = param_sfo->GetString("TITLE");
LOG_INFO(Loader, "Game id: {} Title: {}", id, title); LOG_INFO(Loader, "Game id: {} Title: {}", id, title);
u32 fw_version = param_sfo->GetInteger("SYSTEM_VER"); u32 fw_version = param_sfo->GetInteger("SYSTEM_VER");

View File

@ -132,15 +132,29 @@ bool GameController::SetVibration(u8 smallMotor, u8 largeMotor) {
return true; return true;
} }
void GameController::SetTouchpadState(int touchIndex, bool touchDown, float x, float y) {
if (touchIndex < 2) {
std::scoped_lock lock{m_mutex};
auto state = GetLastState();
state.time = Libraries::Kernel::sceKernelGetProcessTime();
state.touchpad[touchIndex].state = touchDown;
state.touchpad[touchIndex].x = static_cast<u16>(x * 1920);
state.touchpad[touchIndex].y = static_cast<u16>(y * 941);
AddState(state);
}
}
void GameController::TryOpenSDLController() { void GameController::TryOpenSDLController() {
if (m_sdl_gamepad == nullptr || !SDL_GamepadConnected(m_sdl_gamepad)) { if (m_sdl_gamepad == nullptr || !SDL_GamepadConnected(m_sdl_gamepad)) {
int gamepad_count; int gamepad_count;
SDL_JoystickID* gamepads = SDL_GetGamepads(&gamepad_count); SDL_JoystickID* gamepads = SDL_GetGamepads(&gamepad_count);
m_sdl_gamepad = gamepad_count > 0 ? SDL_OpenGamepad(gamepads[0]) : nullptr; m_sdl_gamepad = gamepad_count > 0 ? SDL_OpenGamepad(gamepads[0]) : nullptr;
SDL_free(gamepads); SDL_free(gamepads);
}
SetLightBarRGB(0, 0, 255); SetLightBarRGB(0, 0, 255);
}
} }
} // namespace Input } // namespace Input

View File

@ -21,10 +21,17 @@ enum class Axis {
AxisMax AxisMax
}; };
struct TouchpadEntry {
bool state{};
u16 x{};
u16 y{};
};
struct State { struct State {
u32 buttonsState = 0; u32 buttonsState = 0;
u64 time = 0; u64 time = 0;
int axes[static_cast<int>(Axis::AxisMax)] = {128, 128, 128, 128, 0, 0}; int axes[static_cast<int>(Axis::AxisMax)] = {128, 128, 128, 128, 0, 0};
TouchpadEntry touchpad[2] = {{false, 0, 0}, {false, 0, 0}};
}; };
inline int GetAxis(int min, int max, int value) { inline int GetAxis(int min, int max, int value) {
@ -47,6 +54,7 @@ public:
void Axis(int id, Input::Axis axis, int value); void Axis(int id, Input::Axis axis, int value);
void SetLightBarRGB(u8 r, u8 g, u8 b); void SetLightBarRGB(u8 r, u8 g, u8 b);
bool SetVibration(u8 smallMotor, u8 largeMotor); bool SetVibration(u8 smallMotor, u8 largeMotor);
void SetTouchpadState(int touchIndex, bool touchDown, float x, float y);
void TryOpenSDLController(); void TryOpenSDLController();
private: private:

File diff suppressed because it is too large Load Diff

115
src/qt_gui/cheats_patches.h Normal file
View File

@ -0,0 +1,115 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef CHEATS_PATCHES_H
#define CHEATS_PATCHES_H
#include <QCheckBox>
#include <QComboBox>
#include <QGroupBox>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QLabel>
#include <QListView>
#include <QMap>
#include <QNetworkAccessManager>
#include <QPixmap>
#include <QPushButton>
#include <QScrollArea>
#include <QString>
#include <QTabWidget>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QVector>
#include <QWidget>
class CheatsPatches : public QWidget {
Q_OBJECT
public:
CheatsPatches(const QString& gameName, const QString& gameSerial, const QString& gameVersion,
const QString& gameSize, const QPixmap& gameImage, QWidget* parent = nullptr);
~CheatsPatches();
// Public Methods
void downloadCheats(const QString& source, const QString& m_gameSerial,
const QString& m_gameVersion, bool showMessageBox);
void downloadPatches(const QString repository, const bool showMessageBox);
void createFilesJson(const QString& repository);
signals:
void downloadFinished();
private:
// UI Setup and Event Handlers
void setupUI();
void onSaveButtonClicked();
QCheckBox* findCheckBoxByName(const QString& name);
bool eventFilter(QObject* obj, QEvent* event);
void onPatchCheckBoxHovered(QCheckBox* checkBox, bool hovered);
// Cheat and Patch Management
void populateFileListCheats();
void populateFileListPatches();
void addCheatsToLayout(const QJsonArray& modsArray, const QJsonArray& creditsArray);
void addPatchesToLayout(const QString& serial);
void applyCheat(const QString& modName, bool enabled);
void applyPatch(const QString& patchName, bool enabled);
void uncheckAllCheatCheckBoxes();
void updateNoteTextEdit(const QString& patchName);
// Network Manager
QNetworkAccessManager* manager;
// Patch Info Structures
struct MemoryMod {
QString offset;
QString on;
QString off;
};
struct Cheat {
QString name;
QString type;
bool hasHint;
QVector<MemoryMod> memoryMods;
};
struct PatchInfo {
QString name;
QString author;
QString note;
QJsonArray linesArray;
QString serial;
};
// Members
QString m_gameName;
QString m_gameSerial;
QString m_gameVersion;
QString m_gameSize;
QPixmap m_gameImage;
QString m_cheatFilePath;
QMap<QString, Cheat> m_cheats;
QMap<QString, PatchInfo> m_patchInfos;
QVector<QCheckBox*> m_cheatCheckBoxes;
// UI Elements
QVBoxLayout* rightLayout;
QVBoxLayout* patchesGroupBoxLayout;
QGroupBox* patchesGroupBox;
QVBoxLayout* patchesLayout;
QTextEdit* instructionsTextEdit;
QListView* listView_selectFile;
QItemSelectionModel* selectionModel;
QComboBox* patchesComboBox;
QListView* patchesListView;
QString defaultTextEdit;
};
#endif // CHEATS_PATCHES_H

View File

@ -4,7 +4,7 @@
#pragma once #pragma once
struct GameInfo { struct GameInfo {
std::string path; // root path of game directory (normaly directory that contains eboot.bin) std::string path; // root path of game directory (normally directory that contains eboot.bin)
std::string icon_path; // path of icon0.png std::string icon_path; // path of icon0.png
std::string pic_path; // path of pic1.png std::string pic_path; // path of pic1.png
QImage icon; QImage icon;

View File

@ -10,6 +10,7 @@
#include <QTreeWidget> #include <QTreeWidget>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include "cheats_patches.h"
#include "game_info.h" #include "game_info.h"
#include "trophy_viewer.h" #include "trophy_viewer.h"
@ -20,6 +21,7 @@
#include <shlguid.h> #include <shlguid.h>
#include <shobjidl.h> #include <shobjidl.h>
#endif #endif
#include "common/path_util.h"
class GuiContextMenus : public QObject { class GuiContextMenus : public QObject {
Q_OBJECT Q_OBJECT
@ -34,15 +36,22 @@ public:
itemID = widget->currentRow() * widget->columnCount() + widget->currentColumn(); itemID = widget->currentRow() * widget->columnCount() + widget->currentColumn();
} }
// Do not show the menu if an item is selected
if (itemID == -1) {
return;
}
// Setup menu. // Setup menu.
QMenu menu(widget); QMenu menu(widget);
QAction createShortcut(tr("Create Shortcut"), widget); QAction createShortcut(tr("Create Shortcut"), widget);
QAction openFolder(tr("Open Game Folder"), widget); QAction openFolder(tr("Open Game Folder"), widget);
QAction openCheats(tr("Cheats / Patches"), widget);
QAction openSfoViewer(tr("SFO Viewer"), widget); QAction openSfoViewer(tr("SFO Viewer"), widget);
QAction openTrophyViewer(tr("Trophy Viewer"), widget); QAction openTrophyViewer(tr("Trophy Viewer"), widget);
menu.addAction(&openFolder); menu.addAction(&openFolder);
menu.addAction(&createShortcut); menu.addAction(&createShortcut);
menu.addAction(&openCheats);
menu.addAction(&openSfoViewer); menu.addAction(&openSfoViewer);
menu.addAction(&openTrophyViewer); menu.addAction(&openTrophyViewer);
@ -121,6 +130,19 @@ public:
} }
} }
if (selected == &openCheats) {
QString gameName = QString::fromStdString(m_games[itemID].name);
QString gameSerial = QString::fromStdString(m_games[itemID].serial);
QString gameVersion = QString::fromStdString(m_games[itemID].version);
QString gameSize = QString::fromStdString(m_games[itemID].size);
QPixmap gameImage(QString::fromStdString(m_games[itemID].icon_path));
CheatsPatches* cheatsPatches =
new CheatsPatches(gameName, gameSerial, gameVersion, gameSize, gameImage);
cheatsPatches->show();
connect(widget->parent(), &QWidget::destroyed, cheatsPatches,
[cheatsPatches]() { cheatsPatches->deleteLater(); });
}
if (selected == &openTrophyViewer) { if (selected == &openTrophyViewer) {
QString trophyPath = QString::fromStdString(m_games[itemID].serial); QString trophyPath = QString::fromStdString(m_games[itemID].serial);
QString gameTrpPath = QString::fromStdString(m_games[itemID].path); QString gameTrpPath = QString::fromStdString(m_games[itemID].path);

View File

@ -5,7 +5,9 @@
#include <QProgressDialog> #include <QProgressDialog>
#include "about_dialog.h" #include "about_dialog.h"
#include "cheats_patches.h"
#include "common/io_file.h" #include "common/io_file.h"
#include "common/string_util.h"
#include "common/version.h" #include "common/version.h"
#include "core/file_format/pkg.h" #include "core/file_format/pkg.h"
#include "core/loader.h" #include "core/loader.h"
@ -116,7 +118,7 @@ void MainWindow::CreateDockWindows() {
m_elf_viewer->hide(); m_elf_viewer->hide();
m_game_list_frame->show(); m_game_list_frame->show();
m_dock_widget->setWidget(m_game_list_frame.data()); m_dock_widget->setWidget(m_game_list_frame.data());
slider_pos = Config::getSliderPositon(); slider_pos = Config::getSliderPosition();
ui->sizeSlider->setSliderPosition(slider_pos); // set slider pos at start; ui->sizeSlider->setSliderPosition(slider_pos); // set slider pos at start;
isTableList = true; isTableList = true;
} else if (table_mode == 1) { // Grid } else if (table_mode == 1) { // Grid
@ -124,7 +126,7 @@ void MainWindow::CreateDockWindows() {
m_elf_viewer->hide(); m_elf_viewer->hide();
m_game_grid_frame->show(); m_game_grid_frame->show();
m_dock_widget->setWidget(m_game_grid_frame.data()); m_dock_widget->setWidget(m_game_grid_frame.data());
slider_pos = Config::getSliderPositonGrid(); slider_pos = Config::getSliderPositionGrid();
ui->sizeSlider->setSliderPosition(slider_pos); // set slider pos at start; ui->sizeSlider->setSliderPosition(slider_pos); // set slider pos at start;
isTableList = false; isTableList = false;
} else { } else {
@ -164,7 +166,7 @@ void MainWindow::GetPhysicalDevices() {
auto prop = physical_device.getProperties(); auto prop = physical_device.getProperties();
QString name = QString::fromUtf8(prop.deviceName, -1); QString name = QString::fromUtf8(prop.deviceName, -1);
if (prop.apiVersion < Vulkan::TargetVulkanApiVersion) { if (prop.apiVersion < Vulkan::TargetVulkanApiVersion) {
name += " * Unsupported Vulkan Version"; name += tr(" * Unsupported Vulkan Version");
} }
m_physical_devices.push_back(name); m_physical_devices.push_back(name);
} }
@ -184,12 +186,12 @@ void MainWindow::CreateConnects() {
36 + value; // 36 is the minimum icon size to use due to text disappearing. 36 + value; // 36 is the minimum icon size to use due to text disappearing.
m_game_list_frame->ResizeIcons(36 + value); m_game_list_frame->ResizeIcons(36 + value);
Config::setIconSize(36 + value); Config::setIconSize(36 + value);
Config::setSliderPositon(value); Config::setSliderPosition(value);
} else { } else {
m_game_grid_frame->icon_size = 69 + value; m_game_grid_frame->icon_size = 69 + value;
m_game_grid_frame->PopulateGameGrid(m_game_info->m_games, false); m_game_grid_frame->PopulateGameGrid(m_game_info->m_games, false);
Config::setIconSizeGrid(69 + value); Config::setIconSizeGrid(69 + value);
Config::setSliderPositonGrid(value); Config::setSliderPositionGrid(value);
} }
}); });
@ -228,11 +230,11 @@ void MainWindow::CreateConnects() {
36; // 36 is the minimum icon size to use due to text disappearing. 36; // 36 is the minimum icon size to use due to text disappearing.
ui->sizeSlider->setValue(0); // icone_size - 36 ui->sizeSlider->setValue(0); // icone_size - 36
Config::setIconSize(36); Config::setIconSize(36);
Config::setSliderPositon(0); Config::setSliderPosition(0);
} else { } else {
ui->sizeSlider->setValue(0); // icone_size - 36 ui->sizeSlider->setValue(0); // icone_size - 36
Config::setIconSizeGrid(69); Config::setIconSizeGrid(69);
Config::setSliderPositonGrid(0); Config::setSliderPositionGrid(0);
} }
}); });
@ -241,11 +243,11 @@ void MainWindow::CreateConnects() {
m_game_list_frame->icon_size = 64; m_game_list_frame->icon_size = 64;
ui->sizeSlider->setValue(28); ui->sizeSlider->setValue(28);
Config::setIconSize(64); Config::setIconSize(64);
Config::setSliderPositon(28); Config::setSliderPosition(28);
} else { } else {
ui->sizeSlider->setValue(28); ui->sizeSlider->setValue(28);
Config::setIconSizeGrid(97); Config::setIconSizeGrid(97);
Config::setSliderPositonGrid(28); Config::setSliderPositionGrid(28);
} }
}); });
@ -254,11 +256,11 @@ void MainWindow::CreateConnects() {
m_game_list_frame->icon_size = 128; m_game_list_frame->icon_size = 128;
ui->sizeSlider->setValue(92); ui->sizeSlider->setValue(92);
Config::setIconSize(128); Config::setIconSize(128);
Config::setSliderPositon(92); Config::setSliderPosition(92);
} else { } else {
ui->sizeSlider->setValue(92); ui->sizeSlider->setValue(92);
Config::setIconSizeGrid(160); Config::setIconSizeGrid(160);
Config::setSliderPositonGrid(91); Config::setSliderPositionGrid(91);
} }
}); });
@ -267,11 +269,11 @@ void MainWindow::CreateConnects() {
m_game_list_frame->icon_size = 256; m_game_list_frame->icon_size = 256;
ui->sizeSlider->setValue(220); ui->sizeSlider->setValue(220);
Config::setIconSize(256); Config::setIconSize(256);
Config::setSliderPositon(220); Config::setSliderPosition(220);
} else { } else {
ui->sizeSlider->setValue(220); ui->sizeSlider->setValue(220);
Config::setIconSizeGrid(256); Config::setIconSizeGrid(256);
Config::setSliderPositonGrid(220); Config::setSliderPositionGrid(220);
} }
}); });
// List // List
@ -286,7 +288,7 @@ void MainWindow::CreateConnects() {
} }
isTableList = true; isTableList = true;
Config::setTableMode(0); Config::setTableMode(0);
int slider_pos = Config::getSliderPositon(); int slider_pos = Config::getSliderPosition();
ui->sizeSlider->setEnabled(true); ui->sizeSlider->setEnabled(true);
ui->sizeSlider->setSliderPosition(slider_pos); ui->sizeSlider->setSliderPosition(slider_pos);
}); });
@ -302,7 +304,7 @@ void MainWindow::CreateConnects() {
} }
isTableList = false; isTableList = false;
Config::setTableMode(1); Config::setTableMode(1);
int slider_pos_grid = Config::getSliderPositonGrid(); int slider_pos_grid = Config::getSliderPositionGrid();
ui->sizeSlider->setEnabled(true); ui->sizeSlider->setEnabled(true);
ui->sizeSlider->setSliderPosition(slider_pos_grid); ui->sizeSlider->setSliderPosition(slider_pos_grid);
}); });
@ -317,6 +319,85 @@ void MainWindow::CreateConnects() {
Config::setTableMode(2); Config::setTableMode(2);
}); });
// Cheats/Patches Download.
connect(ui->downloadCheatsPatchesAct, &QAction::triggered, this, [this]() {
QDialog* panelDialog = new QDialog(this);
QVBoxLayout* layout = new QVBoxLayout(panelDialog);
QPushButton* downloadAllCheatsButton =
new QPushButton(tr("Download Cheats For All Installed Games"), panelDialog);
QPushButton* downloadAllPatchesButton =
new QPushButton(tr("Download Patches For All Games"), panelDialog);
layout->addWidget(downloadAllCheatsButton);
layout->addWidget(downloadAllPatchesButton);
panelDialog->setLayout(layout);
connect(downloadAllCheatsButton, &QPushButton::clicked, this, [this, panelDialog]() {
QEventLoop eventLoop;
int pendingDownloads = 0;
auto onDownloadFinished = [&]() {
if (--pendingDownloads <= 0) {
eventLoop.quit();
}
};
for (const GameInfo& game : m_game_info->m_games) {
QString empty = "";
QString gameSerial = QString::fromStdString(game.serial);
QString gameVersion = QString::fromStdString(game.version);
CheatsPatches* cheatsPatches =
new CheatsPatches(empty, empty, empty, empty, empty, nullptr);
connect(cheatsPatches, &CheatsPatches::downloadFinished, onDownloadFinished);
pendingDownloads += 3;
cheatsPatches->downloadCheats("wolf2022", gameSerial, gameVersion, false);
cheatsPatches->downloadCheats("GoldHEN", gameSerial, gameVersion, false);
cheatsPatches->downloadCheats("shadPS4", gameSerial, gameVersion, false);
}
eventLoop.exec();
QMessageBox::information(
nullptr, tr("Download Complete"),
tr("You have downloaded cheats for all the games you have installed."));
panelDialog->accept();
});
connect(downloadAllPatchesButton, &QPushButton::clicked, [panelDialog]() {
QEventLoop eventLoop;
int pendingDownloads = 0;
auto onDownloadFinished = [&]() {
if (--pendingDownloads <= 0) {
eventLoop.quit();
}
};
QString empty = "";
CheatsPatches* cheatsPatches =
new CheatsPatches(empty, empty, empty, empty, empty, nullptr);
connect(cheatsPatches, &CheatsPatches::downloadFinished, onDownloadFinished);
pendingDownloads += 2;
cheatsPatches->downloadPatches("GoldHEN", false);
cheatsPatches->downloadPatches("shadPS4", false);
eventLoop.exec();
QMessageBox::information(
nullptr, tr("Download Complete"),
QString(tr("Patches Downloaded Successfully!") + "\n" +
tr("All Patches available for all games have been downloaded.")));
cheatsPatches->createFilesJson("GoldHEN");
cheatsPatches->createFilesJson("shadPS4");
panelDialog->accept();
});
panelDialog->exec();
});
// Dump game list. // Dump game list.
connect(ui->dumpGameListAct, &QAction::triggered, this, [&] { connect(ui->dumpGameListAct, &QAction::triggered, this, [&] {
QString filePath = qApp->applicationDirPath().append("/GameList.txt"); QString filePath = qApp->applicationDirPath().append("/GameList.txt");
@ -468,7 +549,7 @@ void MainWindow::RefreshGameTable() {
m_game_grid_frame->PopulateGameGrid(m_game_info->m_games, false); m_game_grid_frame->PopulateGameGrid(m_game_info->m_games, false);
statusBar->clearMessage(); statusBar->clearMessage();
int numGames = m_game_info->m_games.size(); int numGames = m_game_info->m_games.size();
QString statusMessage = "Games: " + QString::number(numGames); QString statusMessage = tr("Games: ") + QString::number(numGames);
statusBar->showMessage(statusMessage); statusBar->showMessage(statusMessage);
} }
@ -519,7 +600,8 @@ void MainWindow::BootGame() {
int nFiles = fileNames.size(); int nFiles = fileNames.size();
if (nFiles > 1) { if (nFiles > 1) {
QMessageBox::critical(nullptr, "Game Boot", QString("Only one file can be selected!")); QMessageBox::critical(nullptr, tr("Game Boot"),
QString(tr("Only one file can be selected!")));
} else { } else {
std::filesystem::path path(fileNames[0].toStdString()); std::filesystem::path path(fileNames[0].toStdString());
#ifdef _WIN64 #ifdef _WIN64
@ -536,38 +618,48 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
pkg = PKG(); pkg = PKG();
pkg.Open(file); pkg.Open(file);
std::string failreason; std::string failreason;
const auto extract_path = auto extract_path = std::filesystem::path(Config::getGameInstallDir()) / pkg.GetTitleID();
std::filesystem::path(Config::getGameInstallDir()) / pkg.GetTitleID();
QString pkgType = QString::fromStdString(pkg.GetPkgFlags()); QString pkgType = QString::fromStdString(pkg.GetPkgFlags());
QDir game_dir(QString::fromStdString(extract_path.string())); QDir game_dir(QString::fromStdString(extract_path.string()));
if (game_dir.exists()) { if (game_dir.exists()) {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setWindowTitle("PKG Extraction"); msgBox.setWindowTitle(tr("PKG Extraction"));
if (pkgType.contains("PATCH")) {
psf.open("", pkg.sfo); psf.open("", pkg.sfo);
std::string content_id = psf.GetString("CONTENT_ID");
std::string entitlement_label = Common::SplitString(content_id, '-')[2];
auto addon_extract_path = Common::FS::GetUserPath(Common::FS::PathType::AddonsDir) /
pkg.GetTitleID() / entitlement_label;
QDir addon_dir(QString::fromStdString(addon_extract_path.string()));
auto category = psf.GetString("CATEGORY");
if (pkgType.contains("PATCH")) {
QString pkg_app_version = QString::fromStdString(psf.GetString("APP_VER")); QString pkg_app_version = QString::fromStdString(psf.GetString("APP_VER"));
psf.open(extract_path.string() + "/sce_sys/param.sfo", {}); psf.open(extract_path.string() + "/sce_sys/param.sfo", {});
QString game_app_version = QString::fromStdString(psf.GetString("APP_VER")); QString game_app_version = QString::fromStdString(psf.GetString("APP_VER"));
double appD = game_app_version.toDouble(); double appD = game_app_version.toDouble();
double pkgD = pkg_app_version.toDouble(); double pkgD = pkg_app_version.toDouble();
if (pkgD == appD) { if (pkgD == appD) {
msgBox.setText( msgBox.setText(QString(tr("Patch detected!") + "\n" +
QString("Patch detected!\nPKG and Game versions match!: %1\nWould you like " tr("PKG and Game versions match: ") + pkg_app_version +
"to overwrite?") "\n" + tr("Would you like to overwrite?")));
.arg(pkg_app_version));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No); msgBox.setDefaultButton(QMessageBox::No);
} else if (pkgD < appD) { } else if (pkgD < appD) {
msgBox.setText(QString("Patch detected!\nPKG Version %1 is older " msgBox.setText(QString(tr("Patch detected!") + "\n" +
"than installed version!: %2\nWould you like " tr("PKG Version %1 is older than installed version: ")
"to overwrite?") .arg(pkg_app_version) +
.arg(pkg_app_version, game_app_version)); game_app_version + "\n" +
tr("Would you like to overwrite?")));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No); msgBox.setDefaultButton(QMessageBox::No);
} else { } else {
msgBox.setText(QString("Patch detected!\nGame is installed: %1\nWould you like " msgBox.setText(QString(tr("Patch detected!") + "\n" +
"to install Patch: %2?") tr("Game is installed: ") + game_app_version + "\n" +
.arg(game_app_version, pkg_app_version)); tr("Would you like to install Patch: ") +
pkg_app_version + " ?"));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No); msgBox.setDefaultButton(QMessageBox::No);
} }
@ -577,9 +669,38 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
} else { } else {
return; 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) {
extract_path = addon_extract_path;
} else { } else {
msgBox.setText(QString("Game already installed\n%1\nWould you like to overwrite?") return;
.arg(QString::fromStdString(extract_path.string()))); }
} else {
msgBox.setText(QString(tr("DLC already installed:") + "\n" +
QString::fromStdString(addon_extract_path.string()) +
"\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) {
extract_path = addon_extract_path;
} else {
return;
}
}
} else {
msgBox.setText(QString(tr("Game already installed") + "\n" +
QString::fromStdString(extract_path.string()) + "\n" +
tr("Would you like to overwrite?")));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No); msgBox.setDefaultButton(QMessageBox::No);
int result = msgBox.exec(); int result = msgBox.exec();
@ -592,27 +713,28 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
} else { } else {
// Do nothing; // Do nothing;
if (pkgType.contains("PATCH")) { if (pkgType.contains("PATCH")) {
QMessageBox::information(this, "PKG Extraction", QMessageBox::information(this, tr("PKG Extraction"),
"PKG is a patch, please install the game first!"); tr("PKG is a patch, please install the game first!"));
return; return;
} }
// what else? // what else?
} }
if (!pkg.Extract(file, extract_path, failreason)) { if (!pkg.Extract(file, extract_path, failreason)) {
QMessageBox::critical(this, "PKG ERROR", QString::fromStdString(failreason)); QMessageBox::critical(this, tr("PKG ERROR"), QString::fromStdString(failreason));
} else { } else {
int nfiles = pkg.GetNumberOfFiles(); int nfiles = pkg.GetNumberOfFiles();
if (nfiles > 0) {
QVector<int> indices; QVector<int> indices;
for (int i = 0; i < nfiles; i++) { for (int i = 0; i < nfiles; i++) {
indices.append(i); indices.append(i);
} }
QProgressDialog dialog; QProgressDialog dialog;
dialog.setWindowTitle("PKG Extraction"); dialog.setWindowTitle(tr("PKG Extraction"));
dialog.setWindowModality(Qt::WindowModal); dialog.setWindowModality(Qt::WindowModal);
QString extractmsg = QString("Extracting PKG %1/%2").arg(pkgNum).arg(nPkg); QString extractmsg = QString(tr("Extracting PKG %1/%2")).arg(pkgNum).arg(nPkg);
dialog.setLabelText(extractmsg); dialog.setLabelText(extractmsg);
dialog.setAutoClose(true); dialog.setAutoClose(true);
dialog.setRange(0, nfiles); dialog.setRange(0, nfiles);
@ -622,8 +744,9 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
if (pkgNum == nPkg) { if (pkgNum == nPkg) {
QString path = QString::fromStdString(Config::getGameInstallDir()); QString path = QString::fromStdString(Config::getGameInstallDir());
QMessageBox extractMsgBox(this); QMessageBox extractMsgBox(this);
extractMsgBox.setWindowTitle("Extraction Finished"); extractMsgBox.setWindowTitle(tr("Extraction Finished"));
extractMsgBox.setText(QString("Game successfully installed at %1").arg(path)); extractMsgBox.setText(
QString(tr("Game successfully installed at %1")).arg(path));
extractMsgBox.addButton(QMessageBox::Ok); extractMsgBox.addButton(QMessageBox::Ok);
extractMsgBox.setDefaultButton(QMessageBox::Ok); extractMsgBox.setDefaultButton(QMessageBox::Ok);
connect(&extractMsgBox, &QMessageBox::buttonClicked, this, connect(&extractMsgBox, &QMessageBox::buttonClicked, this,
@ -643,8 +766,10 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
QtConcurrent::map(indices, [&](int index) { pkg.ExtractFiles(index); })); QtConcurrent::map(indices, [&](int index) { pkg.ExtractFiles(index); }));
dialog.exec(); dialog.exec();
} }
}
} else { } else {
QMessageBox::critical(this, "PKG ERROR", "File doesn't appear to be a valid PKG file"); QMessageBox::critical(this, tr("PKG ERROR"),
tr("File doesn't appear to be a valid PKG file"));
} }
} }

View File

@ -25,6 +25,7 @@ public:
QAction* setlistModeGridAct; QAction* setlistModeGridAct;
QAction* setlistElfAct; QAction* setlistElfAct;
QAction* gameInstallPathAct; QAction* gameInstallPathAct;
QAction* downloadCheatsPatchesAct;
QAction* dumpGameListAct; QAction* dumpGameListAct;
QAction* pkgViewerAct; QAction* pkgViewerAct;
QAction* aboutAct; QAction* aboutAct;
@ -120,11 +121,12 @@ public:
gameInstallPathAct = new QAction(MainWindow); gameInstallPathAct = new QAction(MainWindow);
gameInstallPathAct->setObjectName("gameInstallPathAct"); gameInstallPathAct->setObjectName("gameInstallPathAct");
gameInstallPathAct->setIcon(QIcon(":images/folder_icon.png")); gameInstallPathAct->setIcon(QIcon(":images/folder_icon.png"));
downloadCheatsPatchesAct = new QAction(MainWindow);
downloadCheatsPatchesAct->setObjectName("downloadCheatsPatchesAct");
dumpGameListAct = new QAction(MainWindow); dumpGameListAct = new QAction(MainWindow);
dumpGameListAct->setObjectName("dumpGameList"); dumpGameListAct->setObjectName("dumpGameList");
pkgViewerAct = new QAction(MainWindow); pkgViewerAct = new QAction(MainWindow);
pkgViewerAct->setObjectName("pkgViewer"); pkgViewerAct->setObjectName("pkgViewer");
pkgViewerAct->setObjectName("pkgViewer");
pkgViewerAct->setIcon(QIcon(":images/file_icon.png")); pkgViewerAct->setIcon(QIcon(":images/file_icon.png"));
aboutAct = new QAction(MainWindow); aboutAct = new QAction(MainWindow);
aboutAct->setObjectName("aboutAct"); aboutAct->setObjectName("aboutAct");
@ -277,6 +279,7 @@ public:
menuSettings->addAction(configureAct); menuSettings->addAction(configureAct);
menuSettings->addAction(gameInstallPathAct); menuSettings->addAction(gameInstallPathAct);
menuSettings->addAction(menuUtils->menuAction()); menuSettings->addAction(menuUtils->menuAction());
menuUtils->addAction(downloadCheatsPatchesAct);
menuUtils->addAction(dumpGameListAct); menuUtils->addAction(dumpGameListAct);
menuUtils->addAction(pkgViewerAct); menuUtils->addAction(pkgViewerAct);
menuAbout->addAction(aboutAct); menuAbout->addAction(aboutAct);
@ -323,6 +326,8 @@ public:
setlistElfAct->setText(QCoreApplication::translate("MainWindow", "Elf Viewer", nullptr)); setlistElfAct->setText(QCoreApplication::translate("MainWindow", "Elf Viewer", nullptr));
gameInstallPathAct->setText( gameInstallPathAct->setText(
QCoreApplication::translate("MainWindow", "Game Install Directory", nullptr)); QCoreApplication::translate("MainWindow", "Game Install Directory", nullptr));
downloadCheatsPatchesAct->setText(
QCoreApplication::translate("MainWindow", "Download Cheats/Patches", nullptr));
dumpGameListAct->setText( dumpGameListAct->setText(
QCoreApplication::translate("MainWindow", "Dump Game List", nullptr)); QCoreApplication::translate("MainWindow", "Dump Game List", nullptr));
pkgViewerAct->setText(QCoreApplication::translate("MainWindow", "PKG Viewer", nullptr)); pkgViewerAct->setText(QCoreApplication::translate("MainWindow", "PKG Viewer", nullptr));

View File

@ -0,0 +1,347 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm>
#include <string>
#include <QFile>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QListView>
#include <QMessageBox>
#include <QXmlStreamReader>
#include "common/logging/log.h"
#include "common/path_util.h"
#include "memory_patcher.h"
namespace MemoryPatcher {
uintptr_t g_eboot_address;
u64 g_eboot_image_size;
std::string g_game_serial;
std::vector<patchInfo> pending_patches;
QString toHex(unsigned long long value, size_t byteSize) {
std::stringstream ss;
ss << std::hex << std::setfill('0') << std::setw(byteSize * 2) << value;
return QString::fromStdString(ss.str());
}
QString convertValueToHex(const QString& type, const QString& valueStr) {
QString result;
std::string typeStr = type.toStdString();
std::string valueStrStd = valueStr.toStdString();
if (typeStr == "byte") {
unsigned int value = std::stoul(valueStrStd, nullptr, 16);
result = toHex(value, 1);
} else if (typeStr == "bytes16") {
unsigned int value = std::stoul(valueStrStd, nullptr, 16);
result = toHex(value, 2);
} else if (typeStr == "bytes32") {
unsigned long value = std::stoul(valueStrStd, nullptr, 16);
result = toHex(value, 4);
} else if (typeStr == "bytes64") {
unsigned long long value = std::stoull(valueStrStd, nullptr, 16);
result = toHex(value, 8);
} else if (typeStr == "float32") {
union {
float f;
uint32_t i;
} floatUnion;
floatUnion.f = std::stof(valueStrStd);
result = toHex(floatUnion.i, sizeof(floatUnion.i));
} else if (typeStr == "float64") {
union {
double d;
uint64_t i;
} doubleUnion;
doubleUnion.d = std::stod(valueStrStd);
result = toHex(doubleUnion.i, sizeof(doubleUnion.i));
} else if (typeStr == "utf8") {
QByteArray byteArray = QString::fromStdString(valueStrStd).toUtf8();
byteArray.append('\0');
std::stringstream ss;
for (unsigned char c : byteArray) {
ss << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>(c);
}
result = QString::fromStdString(ss.str());
} else if (typeStr == "utf16") {
QByteArray byteArray(
reinterpret_cast<const char*>(QString::fromStdString(valueStrStd).utf16()),
QString::fromStdString(valueStrStd).size() * 2);
byteArray.append('\0');
byteArray.append('\0');
std::stringstream ss;
for (unsigned char c : byteArray) {
ss << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>(c);
}
result = QString::fromStdString(ss.str());
} else if (typeStr == "bytes") {
result = valueStr;
} else if (typeStr == "mask" || typeStr == "mask_jump32") {
result = valueStr;
} else {
LOG_INFO(Loader, "Error applying Patch, unknown type: {}", typeStr);
}
return result;
}
void OnGameLoaded() {
// We use the QT headers for the xml and json parsing, this define is only true on QT builds
QString patchDir =
QString::fromStdString(Common::FS::GetUserPath(Common::FS::PathType::PatchesDir).string());
QString repositories[] = {"GoldHEN", "shadPS4"};
for (const QString& repository : repositories) {
QString filesJsonPath = patchDir + "/" + repository + "/files.json";
QFile jsonFile(filesJsonPath);
if (!jsonFile.open(QIODevice::ReadOnly)) {
LOG_ERROR(Loader, "Unable to open files.json for reading.");
continue;
}
QByteArray jsonData = jsonFile.readAll();
jsonFile.close();
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
QJsonObject jsonObject = jsonDoc.object();
QString selectedFileName;
QString serial = QString::fromStdString(g_game_serial);
for (auto it = jsonObject.constBegin(); it != jsonObject.constEnd(); ++it) {
QString filePath = it.key();
QJsonArray idsArray = it.value().toArray();
if (idsArray.contains(QJsonValue(serial))) {
selectedFileName = filePath;
break;
}
}
if (selectedFileName.isEmpty()) {
LOG_ERROR(Loader, "No patch file found for the current serial.");
continue;
}
QString filePath = patchDir + "/" + repository + "/" + selectedFileName;
QFile file(filePath);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
LOG_ERROR(Loader, "Unable to open the file for reading.");
continue;
}
QByteArray xmlData = file.readAll();
file.close();
QString newXmlData;
QXmlStreamReader xmlReader(xmlData);
bool insideMetadata = false;
bool isEnabled = false;
std::string currentPatchName;
while (!xmlReader.atEnd()) {
xmlReader.readNext();
if (xmlReader.isStartElement()) {
QJsonArray patchLines;
if (xmlReader.name() == QStringLiteral("Metadata")) {
insideMetadata = true;
QString name = xmlReader.attributes().value("Name").toString();
currentPatchName = name.toStdString();
// Check and update the isEnabled attribute
for (const QXmlStreamAttribute& attr : xmlReader.attributes()) {
if (attr.name() == QStringLiteral("isEnabled")) {
if (attr.value().toString() == "true") {
isEnabled = true;
} else
isEnabled = false;
}
}
} else if (xmlReader.name() == QStringLiteral("PatchList")) {
QJsonArray linesArray;
while (!xmlReader.atEnd() &&
!(xmlReader.tokenType() == QXmlStreamReader::EndElement &&
xmlReader.name() == QStringLiteral("PatchList"))) {
xmlReader.readNext();
if (xmlReader.tokenType() == QXmlStreamReader::StartElement &&
xmlReader.name() == QStringLiteral("Line")) {
QXmlStreamAttributes attributes = xmlReader.attributes();
QJsonObject lineObject;
lineObject["Type"] = attributes.value("Type").toString();
lineObject["Address"] = attributes.value("Address").toString();
lineObject["Value"] = attributes.value("Value").toString();
linesArray.append(lineObject);
}
}
patchLines = linesArray;
if (isEnabled) {
foreach (const QJsonValue& value, patchLines) {
QJsonObject lineObject = value.toObject();
QString type = lineObject["Type"].toString();
QString address = lineObject["Address"].toString();
QString patchValue = lineObject["Value"].toString();
QString maskOffsetStr = lineObject["Offset"].toString();
patchValue = convertValueToHex(type, patchValue);
bool littleEndian = false;
if (type == "bytes16") {
littleEndian = true;
} else if (type == "bytes32") {
littleEndian = true;
} else if (type == "bytes64") {
littleEndian = true;
}
MemoryPatcher::PatchMask patchMask = MemoryPatcher::PatchMask::None;
int maskOffsetValue = 0;
if (type == "mask") {
patchMask = MemoryPatcher::PatchMask::Mask;
// im not sure if this works, there is no games to test the mask
// offset on yet
if (!maskOffsetStr.toStdString().empty())
maskOffsetValue = std::stoi(maskOffsetStr.toStdString(), 0, 10);
}
if (type == "mask_jump32")
patchMask = MemoryPatcher::PatchMask::Mask_Jump32;
MemoryPatcher::PatchMemory(currentPatchName, address.toStdString(),
patchValue.toStdString(), false,
littleEndian, patchMask);
}
}
}
}
}
if (xmlReader.hasError()) {
LOG_ERROR(Loader, "Failed to parse XML for {}", g_game_serial);
} else {
LOG_INFO(Loader, "Patches loaded successfully");
}
ApplyPendingPatches();
}
}
void AddPatchToQueue(patchInfo patchToAdd) {
pending_patches.push_back(patchToAdd);
}
void ApplyPendingPatches() {
for (size_t i = 0; i < pending_patches.size(); ++i) {
patchInfo currentPatch = pending_patches[i];
if (currentPatch.gameSerial != g_game_serial)
continue;
PatchMemory(currentPatch.modNameStr, currentPatch.offsetStr, currentPatch.valueStr,
currentPatch.isOffset, currentPatch.littleEndian, currentPatch.patchMask,
currentPatch.maskOffset);
}
pending_patches.clear();
}
void PatchMemory(std::string modNameStr, std::string offsetStr, std::string valueStr, bool isOffset,
bool littleEndian, PatchMask patchMask, int maskOffset) {
// Send a request to modify the process memory.
void* cheatAddress = nullptr;
if (patchMask == PatchMask::None) {
if (isOffset) {
cheatAddress = reinterpret_cast<void*>(g_eboot_address + std::stoi(offsetStr, 0, 16));
} else {
cheatAddress =
reinterpret_cast<void*>(g_eboot_address + (std::stoi(offsetStr, 0, 16) - 0x400000));
}
}
if (patchMask == PatchMask::Mask) {
cheatAddress = reinterpret_cast<void*>(PatternScan(offsetStr) + maskOffset);
}
// TODO: implement mask_jump32
if (cheatAddress == nullptr) {
LOG_ERROR(Loader, "Failed to get address for patch {}", modNameStr);
return;
}
std::vector<unsigned char> bytePatch;
for (size_t i = 0; i < valueStr.length(); i += 2) {
unsigned char byte =
static_cast<unsigned char>(std::strtol(valueStr.substr(i, 2).c_str(), nullptr, 16));
bytePatch.push_back(byte);
}
if (littleEndian) {
std::reverse(bytePatch.begin(), bytePatch.end());
}
std::memcpy(cheatAddress, bytePatch.data(), bytePatch.size());
LOG_INFO(Loader, "Applied patch: {}, Offset: {}, Value: {}", modNameStr,
(uintptr_t)cheatAddress, valueStr);
}
static std::vector<int32_t> PatternToByte(const std::string& pattern) {
std::vector<int32_t> bytes;
const char* start = pattern.data();
const char* end = start + pattern.size();
for (const char* current = start; current < end; ++current) {
if (*current == '?') {
++current;
if (*current == '?')
++current;
bytes.push_back(-1);
} else {
bytes.push_back(strtoul(current, const_cast<char**>(&current), 16));
}
}
return bytes;
}
uintptr_t PatternScan(const std::string& signature) {
std::vector<int32_t> patternBytes = PatternToByte(signature);
const auto scanBytes = static_cast<uint8_t*>((void*)g_eboot_address);
const int32_t* sigPtr = patternBytes.data();
const size_t sigSize = patternBytes.size();
uint32_t foundResults = 0;
for (uint32_t i = 0; i < g_eboot_image_size - sigSize; ++i) {
bool found = true;
for (uint32_t j = 0; j < sigSize; ++j) {
if (scanBytes[i + j] != sigPtr[j] && sigPtr[j] != -1) {
found = false;
break;
}
}
if (found) {
foundResults++;
return reinterpret_cast<uintptr_t>(&scanBytes[i]);
}
}
return 0;
}
} // namespace MemoryPatcher

View File

@ -0,0 +1,47 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <cstring>
#include <string>
#include <vector>
#include <QString>
namespace MemoryPatcher {
extern uintptr_t g_eboot_address;
extern u64 g_eboot_image_size;
extern std::string g_game_serial;
enum PatchMask : uint8_t {
None,
Mask,
Mask_Jump32,
};
struct patchInfo {
std::string gameSerial;
std::string modNameStr;
std::string offsetStr;
std::string valueStr;
bool isOffset;
bool littleEndian;
PatchMask patchMask;
int maskOffset;
};
extern std::vector<patchInfo> pending_patches;
QString convertValueToHex(const QString& type, const QString& valueStr);
void OnGameLoaded();
void AddPatchToQueue(patchInfo patchToAdd);
void ApplyPendingPatches();
void PatchMemory(std::string modNameStr, std::string offsetStr, std::string valueStr, bool isOffset,
bool littleEndian, PatchMask patchMask = PatchMask::None, int maskOffset = 0);
static std::vector<int32_t> PatternToByte(const std::string& pattern);
uintptr_t PatternScan(const std::string& signature);
} // namespace MemoryPatcher

View File

@ -81,67 +81,72 @@
<context> <context>
<name>GuiContextMenus</name> <name>GuiContextMenus</name>
<message> <message>
<location filename="../gui_context_menus.h" line="39"/> <location filename="../gui_context_menus.h" line="46"/>
<source>Create Shortcut</source> <source>Create Shortcut</source>
<translation>Create Shortcut</translation> <translation>Create Shortcut</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="40"/> <location filename="../gui_context_menus.h" line="47"/>
<source>Open Game Folder</source> <source>Open Game Folder</source>
<translation>Open Game Folder</translation> <translation>Open Game Folder</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="41"/> <location filename="../gui_context_menus.h" line="48"/>
<source>Cheats / Patches</source>
<translation>Trick / Patches</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="49"/>
<source>SFO Viewer</source> <source>SFO Viewer</source>
<translation>SFO Viewer</translation> <translation>SFO Viewer</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="42"/> <location filename="../gui_context_menus.h" line="50"/>
<source>Trophy Viewer</source> <source>Trophy Viewer</source>
<translation>Trophy Viewer</translation> <translation>Trophy Viewer</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="50"/> <location filename="../gui_context_menus.h" line="59"/>
<source>Copy info</source> <source>Copy info</source>
<translation>Copy info</translation> <translation>Copy info</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="51"/> <location filename="../gui_context_menus.h" line="60"/>
<source>Copy Name</source> <source>Copy Name</source>
<translation>Copy Name</translation> <translation>Copy Name</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="52"/> <location filename="../gui_context_menus.h" line="61"/>
<source>Copy Serial</source> <source>Copy Serial</source>
<translation>Copy Serial</translation> <translation>Copy Serial</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="53"/> <location filename="../gui_context_menus.h" line="62"/>
<source>Copy All</source> <source>Copy All</source>
<translation>Copy All</translation> <translation>Copy All</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="173"/> <location filename="../gui_context_menus.h" line="195"/>
<source>Shortcut creation</source> <source>Shortcut creation</source>
<translation>Shortcut creation</translation> <translation>Shortcut creation</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="174"/> <location filename="../gui_context_menus.h" line="196"/>
<source>Shortcut created successfully!\n %1</source> <source>Shortcut created successfully!\n %1</source>
<translation>Shortcut created successfully!\n %1</translation> <translation>Shortcut created successfully!\n %1</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="177"/> <location filename="../gui_context_menus.h" line="199"/>
<source>Error</source> <source>Error</source>
<translation>Error</translation> <translation>Error</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="178"/> <location filename="../gui_context_menus.h" line="200"/>
<source>Error creating shortcut!\n %1</source> <source>Error creating shortcut!\n %1</source>
<translation>Error creating shortcut!\n %1</translation> <translation>Error creating shortcut!\n %1</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="253"/> <location filename="../gui_context_menus.h" line="275"/>
<source>Install PKG</source> <source>Install PKG</source>
<translation>Install PKG</translation> <translation>Install PKG</translation>
</message> </message>
@ -248,6 +253,11 @@
<source>Game Install Directory</source> <source>Game Install Directory</source>
<translation>Game Install Directory</translation> <translation>Game Install Directory</translation>
</message> </message>
<message>
<location filename="../main_window_ui.h" line="343"/>
<source>Download Cheats/Patches</source>
<translation>Download Tricks / Patches</translation>
</message>
<message> <message>
<location filename="../main_window_ui.h" line="345"/> <location filename="../main_window_ui.h" line="345"/>
<source>Dump Game List</source> <source>Dump Game List</source>
@ -488,4 +498,405 @@
<translation>Enable RenderDoc Debugging</translation> <translation>Enable RenderDoc Debugging</translation>
</message> </message>
</context> </context>
<context>
<name>MainWindow</name>
<message>
<location filename="../main_window.cpp" line="168"/>
<source> * Unsupported Vulkan Version</source>
<translation> * Ikke understøttet Vulkan-version</translation>
</message>
<message>
<location filename="../main_window.cpp" line="326"/>
<source>Download Cheats For All Installed Games</source>
<translation>Hent snyd til alle installerede spil</translation>
</message>
<message>
<location filename="../main_window.cpp" line="328"/>
<source>Download Patches For All Games</source>
<translation>Hent patches til alle spil</translation>
</message>
<message>
<location filename="../main_window.cpp" line="363"/>
<source>Download Complete</source>
<translation>Download fuldført</translation>
</message>
<message>
<location filename="../main_window.cpp" line="364"/>
<source>You have downloaded cheats for all the games you have installed.</source>
<translation>Du har hentet snyd til alle de spil, du har installeret.</translation>
</message>
<message>
<location filename="../main_window.cpp" line="391"/>
<source>Patches Downloaded Successfully!</source>
<translation>Patcher hentet med succes!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="392"/>
<source>All Patches available for all games have been downloaded.</source>
<translation>Alle patches til alle spil er blevet hentet.</translation>
</message>
<message>
<location filename="../main_window.cpp" line="549"/>
<source>Games: </source>
<translation>Spil: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="575"/>
<source>PKG File (*.PKG)</source>
<translation>PKG-fil (*.PKG)</translation>
</message>
<message>
<location filename="../main_window.cpp" line="594"/>
<source>ELF files (*.bin *.elf *.oelf)</source>
<translation>ELF-filer (*.bin *.elf *.oelf)</translation>
</message>
<message>
<location filename="../main_window.cpp" line="600"/>
<source>Game Boot</source>
<translation>Spil-boot</translation>
</message>
<message>
<location filename="../main_window.cpp" line="600"/>
<source>Only one file can be selected!</source>
<translation>Kun én fil kan vælges!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="623"/>
<source>PKG Extraction</source>
<translation>PKG-udtrækning</translation>
</message>
<message>
<location filename="../main_window.cpp" line="646"/>
<source>Patch detected!</source>
<translation>Opdatering detekteret!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="646"/>
<source>PKG and Game versions match: </source>
<translation>PKG og spilversioner matcher: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="647"/>
<source>Would you like to overwrite?</source>
<translation>Vil du overskrive?</translation>
</message>
<message>
<location filename="../main_window.cpp" line="639"/>
<source>PKG Version %1 is older than installed version: </source>
<translation>PKG Version %1 er ældre end den installerede version: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="660"/>
<source>Game is installed: </source>
<translation>Spillet er installeret: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="660"/>
<source>Would you like to install Patch: </source>
<translation>Vil du installere opdateringen: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="673"/>
<source>DLC Installation</source>
<translation>DLC Installation</translation>
</message>
<message>
<location filename="../main_window.cpp" line="674"/>
<source>Would you like to install DLC: %1?</source>
<translation>Vil du installere DLC: %1?</translation>
</message>
<message>
<location filename="../main_window.cpp" line="688"/>
<source>DLC already installed:</source>
<translation>DLC allerede installeret:</translation>
</message>
<message>
<location filename="../main_window.cpp" line="701"/>
<source>Game already installed</source>
<translation>Spillet er allerede installeret</translation>
</message>
<message>
<location filename="../main_window.cpp" line="674"/>
<source>PKG is a patch, please install the game first!</source>
<translation>PKG er en patch, venligst installer spillet først!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="681"/>
<source>PKG ERROR</source>
<translation>PKG FEJL</translation>
</message>
<message>
<location filename="../main_window.cpp" line="693"/>
<source>Extracting PKG %1/%2</source>
<translation>Udvinding af PKG %1/%2</translation>
</message>
<message>
<location filename="../main_window.cpp" line="703"/>
<source>Extraction Finished</source>
<translation>Udvinding afsluttet</translation>
</message>
<message>
<location filename="../main_window.cpp" line="704"/>
<source>Game successfully installed at %1</source>
<translation>Spillet blev installeret succesfuldt %1</translation>
</message>
<message>
<location filename="../main_window.cpp" line="725"/>
<source>File doesn't appear to be a valid PKG file</source>
<translation>Filen ser ikke ud til at være en gyldig PKG-fil</translation>
</message>
</context>
<context>
<name>CheatsPatches</name>
<message>
<location filename="../cheats_patches.cpp" line="44"/>
<source>Cheats / Patches</source>
<translation>Snyd / Patches</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="50"/>
<source>defaultTextEdit_MSG</source>
<translation>Cheats/Patches er eksperimentelle.\nBrug med forsigtighed.\n\nDownload cheats individuelt ved at vælge lageret og klikke download-knappen.\nUnder fanen Patches kan du downloade alle patches én gang, vælge hvilke du vil bruge og gemme valget.\n\nDa vi ikke udvikler cheats/patches,\nvenligst rapporter problemer til cheat-udvikleren.\n\nHar du lavet en ny cheat? Besøg:\nhttps://github.com/shadps4-emu/ps4_cheats</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="69"/>
<source>No Image Available</source>
<translation>Ingen billede tilgængelig</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="79"/>
<source>Serial: </source>
<translation>Serienummer: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="83"/>
<source>Version: </source>
<translation>Version: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="87"/>
<source>Size: </source>
<translation>Størrelse: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="126"/>
<source>Select Cheat File:</source>
<translation>Vælg snyd-fil:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="133"/>
<source>Repository:</source>
<translation>Repository:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="149"/>
<source>Download Cheats</source>
<translation>Hent snyd</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="155"/>
<source>Delete File</source>
<translation>Slet fil</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="169"/>
<source>No files selected.</source>
<translation>Ingen filer valgt.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="170"/>
<source>You can delete the cheats you don't want after downloading them.</source>
<translation>Du kan slette de snyd, du ikke ønsker, efter at have hentet dem.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="178"/>
<source>Do you want to delete the selected file?\n%1</source>
<translation>Ønsker du at slette den valgte fil?\n%1</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="213"/>
<source>Select Patch File:</source>
<translation>Vælg patch-fil:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="241"/>
<source>Download Patches</source>
<translation>Hent patches</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="248"/>
<source>Save</source>
<translation>Gem</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="256"/>
<source>Cheats</source>
<translation>Snyd</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="257"/>
<source>Patches</source>
<translation>Patches</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="278"/>
<source>Error</source>
<translation>Fejl</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="278"/>
<source>No patch selected.</source>
<translation>Ingen patch valgt.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="292"/>
<source>Unable to open files.json for reading.</source>
<translation>Kan ikke åbne files.json til læsning.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="316"/>
<source>No patch file found for the current serial.</source>
<translation>Ingen patch-fil fundet for det nuværende serienummer.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="323"/>
<source>Unable to open the file for reading.</source>
<translation>Kan ikke åbne filen til læsning.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="422"/>
<source>Unable to open the file for writing.</source>
<translation>Kan ikke åbne filen til skrivning.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="432"/>
<source>Failed to parse XML: </source>
<translation>Kunne ikke analysere XML: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="434"/>
<source>Success</source>
<translation>Succes</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="434"/>
<source>Options saved successfully.</source>
<translation>Indstillinger gemt med succes.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="470"/>
<source>Invalid Source</source>
<translation>Ugyldig kilde</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="471"/>
<source>The selected source is invalid.</source>
<translation>Den valgte kilde er ugyldig.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="519"/>
<source>File Exists</source>
<translation>Fil findes</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="520"/>
<source>File already exists. Do you want to replace it?</source>
<translation>Filen findes allerede. Vil du erstatte den?</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="539"/>
<source>Failed to save file:</source>
<translation>Kunne ikke gemme fil:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="545"/>
<source>Failed to download file:</source>
<translation>Kunne ikke hente fil:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="556"/>
<source>Cheats Not Found</source>
<translation>Snyd ikke fundet</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="556"/>
<source>CheatsNotFound_MSG</source>
<translation>Ingen snyd fundet til dette spil i denne version af det valgte repository, prøv et andet repository eller en anden version af spillet.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="593"/>
<source>Cheats Downloaded Successfully</source>
<translation>Snyd hentet med succes</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="594"/>
<source>CheatsDownloadedSuccessfully_MSG</source>
<translation>Du har succesfuldt hentet snyd for denne version af spillet fra det valgte repository. Du kan prøve at hente fra et andet repository, hvis det er tilgængeligt, vil det også være muligt at bruge det ved at vælge filen fra listen.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="747"/>
<source>Failed to save:</source>
<translation>Kunne ikke gemme:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="754"/>
<source>Failed to download:</source>
<translation>Kunne ikke hente:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="762"/>
<source>Download Complete</source>
<translation>Download fuldført</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="763"/>
<source>DownloadComplete_MSG</source>
<translation>Patcher hentet med succes! Alle patches til alle spil er blevet hentet, der er ikke behov for at hente dem individuelt for hvert spil, som det sker med snyd.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="773"/>
<source>Failed to parse JSON data from HTML.</source>
<translation>Kunne ikke analysere JSON-data fra HTML.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="778"/>
<source>Failed to retrieve HTML page.</source>
<translation>Kunne ikke hente HTML-side.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="801"/>
<source>Failed to open file:</source>
<translation>Kunne ikke åbne fil:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="819"/>
<source>XML ERROR:</source>
<translation>XML FEJL:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="826"/>
<source>Failed to open files.json for writing</source>
<translation>Kunne ikke åbne files.json til skrivning</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="925"/>
<source>Author: </source>
<translation>Forfatter: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="997"/>
<source>Directory does not exist:</source>
<translation>Mappe findes ikke:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="1006"/>
<source>Failed to open files.json for reading.</source>
<translation>Kunne ikke åbne files.json til læsning.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="1006"/>
<source>Name:</source>
<translation>Navn:</translation>
</message>
</context>
</TS> </TS>

View File

@ -81,67 +81,72 @@
<context> <context>
<name>GuiContextMenus</name> <name>GuiContextMenus</name>
<message> <message>
<location filename="../gui_context_menus.h" line="39"/> <location filename="../gui_context_menus.h" line="46"/>
<source>Create Shortcut</source> <source>Create Shortcut</source>
<translation>Create Shortcut</translation> <translation>Create Shortcut</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="40"/> <location filename="../gui_context_menus.h" line="47"/>
<source>Open Game Folder</source> <source>Open Game Folder</source>
<translation>Open Game Folder</translation> <translation>Open Game Folder</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="41"/> <location filename="../gui_context_menus.h" line="48"/>
<source>Cheats / Patches</source>
<translation>Cheats / Patches</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="49"/>
<source>SFO Viewer</source> <source>SFO Viewer</source>
<translation>SFO Viewer</translation> <translation>SFO Viewer</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="42"/> <location filename="../gui_context_menus.h" line="50"/>
<source>Trophy Viewer</source> <source>Trophy Viewer</source>
<translation>Trophy Viewer</translation> <translation>Trophy Viewer</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="50"/> <location filename="../gui_context_menus.h" line="59"/>
<source>Copy info</source> <source>Copy info</source>
<translation>Copy info</translation> <translation>Copy info</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="51"/> <location filename="../gui_context_menus.h" line="60"/>
<source>Copy Name</source> <source>Copy Name</source>
<translation>Copy Name</translation> <translation>Copy Name</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="52"/> <location filename="../gui_context_menus.h" line="61"/>
<source>Copy Serial</source> <source>Copy Serial</source>
<translation>Copy Serial</translation> <translation>Copy Serial</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="53"/> <location filename="../gui_context_menus.h" line="62"/>
<source>Copy All</source> <source>Copy All</source>
<translation>Copy All</translation> <translation>Copy All</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="173"/> <location filename="../gui_context_menus.h" line="195"/>
<source>Shortcut creation</source> <source>Shortcut creation</source>
<translation>Shortcut creation</translation> <translation>Shortcut creation</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="174"/> <location filename="../gui_context_menus.h" line="196"/>
<source>Shortcut created successfully!\n %1</source> <source>Shortcut created successfully!\n %1</source>
<translation>Shortcut created successfully!\n %1</translation> <translation>Shortcut created successfully!\n %1</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="177"/> <location filename="../gui_context_menus.h" line="199"/>
<source>Error</source> <source>Error</source>
<translation>Error</translation> <translation>Error</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="178"/> <location filename="../gui_context_menus.h" line="200"/>
<source>Error creating shortcut!\n %1</source> <source>Error creating shortcut!\n %1</source>
<translation>Error creating shortcut!\n %1</translation> <translation>Error creating shortcut!\n %1</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="253"/> <location filename="../gui_context_menus.h" line="275"/>
<source>Install PKG</source> <source>Install PKG</source>
<translation>Install PKG</translation> <translation>Install PKG</translation>
</message> </message>
@ -248,6 +253,11 @@
<source>Game Install Directory</source> <source>Game Install Directory</source>
<translation>Game Install Directory</translation> <translation>Game Install Directory</translation>
</message> </message>
<message>
<location filename="../main_window_ui.h" line="343"/>
<source>Download Cheats/Patches</source>
<translation>Cheats / Patches herunterladen</translation>
</message>
<message> <message>
<location filename="../main_window_ui.h" line="345"/> <location filename="../main_window_ui.h" line="345"/>
<source>Dump Game List</source> <source>Dump Game List</source>
@ -488,4 +498,405 @@
<translation>Enable RenderDoc Debugging</translation> <translation>Enable RenderDoc Debugging</translation>
</message> </message>
</context> </context>
<context>
<name>MainWindow</name>
<message>
<location filename="../main_window.cpp" line="168"/>
<source> * Unsupported Vulkan Version</source>
<translation> * Nicht unterstützte Vulkan-Version</translation>
</message>
<message>
<location filename="../main_window.cpp" line="326"/>
<source>Download Cheats For All Installed Games</source>
<translation>Cheats für alle installierten Spiele herunterladen</translation>
</message>
<message>
<location filename="../main_window.cpp" line="328"/>
<source>Download Patches For All Games</source>
<translation>Patches für alle Spiele herunterladen</translation>
</message>
<message>
<location filename="../main_window.cpp" line="363"/>
<source>Download Complete</source>
<translation>Download abgeschlossen</translation>
</message>
<message>
<location filename="../main_window.cpp" line="364"/>
<source>You have downloaded cheats for all the games you have installed.</source>
<translation>Sie haben Cheats für alle installierten Spiele heruntergeladen.</translation>
</message>
<message>
<location filename="../main_window.cpp" line="391"/>
<source>Patches Downloaded Successfully!</source>
<translation>Patches erfolgreich heruntergeladen!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="392"/>
<source>All Patches available for all games have been downloaded.</source>
<translation>Alle Patches für alle Spiele wurden heruntergeladen.</translation>
</message>
<message>
<location filename="../main_window.cpp" line="549"/>
<source>Games: </source>
<translation>Spiele: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="575"/>
<source>PKG File (*.PKG)</source>
<translation>PKG-Datei (*.PKG)</translation>
</message>
<message>
<location filename="../main_window.cpp" line="594"/>
<source>ELF files (*.bin *.elf *.oelf)</source>
<translation>ELF-Dateien (*.bin *.elf *.oelf)</translation>
</message>
<message>
<location filename="../main_window.cpp" line="600"/>
<source>Game Boot</source>
<translation>Spiel-Start</translation>
</message>
<message>
<location filename="../main_window.cpp" line="600"/>
<source>Only one file can be selected!</source>
<translation>Es kann nur eine Datei ausgewählt werden!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="623"/>
<source>PKG Extraction</source>
<translation>PKG-Extraktion</translation>
</message>
<message>
<location filename="../main_window.cpp" line="646"/>
<source>Patch detected!</source>
<translation>Patch erkannt!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="646"/>
<source>PKG and Game versions match: </source>
<translation>PKG- und Spielversionen stimmen überein: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="647"/>
<source>Would you like to overwrite?</source>
<translation>Würden Sie gerne überschreiben?</translation>
</message>
<message>
<location filename="../main_window.cpp" line="639"/>
<source>PKG Version %1 is older than installed version: </source>
<translation>PKG-Version %1 ist älter als die installierte Version: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="660"/>
<source>Game is installed: </source>
<translation>Spiel ist installiert: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="660"/>
<source>Would you like to install Patch: </source>
<translation>Möchten Sie den Patch installieren: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="673"/>
<source>DLC Installation</source>
<translation>DLC-Installation</translation>
</message>
<message>
<location filename="../main_window.cpp" line="674"/>
<source>Would you like to install DLC: %1?</source>
<translation>Würden Sie gerne DLC installieren: %1?</translation>
</message>
<message>
<location filename="../main_window.cpp" line="688"/>
<source>DLC already installed:</source>
<translation>DLC bereits installiert:</translation>
</message>
<message>
<location filename="../main_window.cpp" line="701"/>
<source>Game already installed</source>
<translation>Spiel bereits installiert</translation>
</message>
<message>
<location filename="../main_window.cpp" line="674"/>
<source>PKG is a patch, please install the game first!</source>
<translation>PKG ist ein Patch, bitte installieren Sie zuerst das Spiel!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="681"/>
<source>PKG ERROR</source>
<translation>PKG-ERROR</translation>
</message>
<message>
<location filename="../main_window.cpp" line="693"/>
<source>Extracting PKG %1/%2</source>
<translation>Extrahiere PKG %1/%2</translation>
</message>
<message>
<location filename="../main_window.cpp" line="703"/>
<source>Extraction Finished</source>
<translation>Extraktion abgeschlossen</translation>
</message>
<message>
<location filename="../main_window.cpp" line="704"/>
<source>Game successfully installed at %1</source>
<translation>Spiel erfolgreich installiert auf %1</translation>
</message>
<message>
<location filename="../main_window.cpp" line="725"/>
<source>File doesn't appear to be a valid PKG file</source>
<translation>Die Datei scheint keine gültige PKG-Datei zu sein</translation>
</message>
</context>
<context>
<name>CheatsPatches</name>
<message>
<location filename="../cheats_patches.cpp" line="44"/>
<source>Cheats / Patches</source>
<translation>Cheats / Patches</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="50"/>
<source>defaultTextEdit_MSG</source>
<translation>Cheats/Patches sind experimentell.\nVerwenden Sie sie mit Vorsicht.\n\nLaden Sie Cheats einzeln herunter, indem Sie das Repository auswählen und auf die Download-Schaltfläche klicken.\nAuf der Registerkarte Patches können Sie alle Patches auf einmal herunterladen, auswählen, welche Sie verwenden möchten, und die Auswahl speichern.\n\nDa wir die Cheats/Patches nicht entwickeln,\nbitte melden Sie Probleme an den Cheat-Autor.\n\nHaben Sie einen neuen Cheat erstellt? Besuchen Sie:\nhttps://github.com/shadps4-emu/ps4_cheats</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="69"/>
<source>No Image Available</source>
<translation>Kein Bild verfügbar</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="79"/>
<source>Serial: </source>
<translation>Seriennummer: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="83"/>
<source>Version: </source>
<translation>Version: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="87"/>
<source>Size: </source>
<translation>Größe: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="126"/>
<source>Select Cheat File:</source>
<translation>Cheat-Datei auswählen:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="133"/>
<source>Repository:</source>
<translation>Repository:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="149"/>
<source>Download Cheats</source>
<translation>Cheats herunterladen</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="155"/>
<source>Delete File</source>
<translation>Datei löschen</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="169"/>
<source>No files selected.</source>
<translation>Keine Dateien ausgewählt.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="170"/>
<source>You can delete the cheats you don't want after downloading them.</source>
<translation>Sie können die Cheats, die Sie nicht möchten, nach dem Herunterladen löschen.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="178"/>
<source>Do you want to delete the selected file?\n%1</source>
<translation>Wollen Sie die ausgewählte Datei löschen?\n%1</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="213"/>
<source>Select Patch File:</source>
<translation>Patch-Datei auswählen:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="241"/>
<source>Download Patches</source>
<translation>Patches herunterladen</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="248"/>
<source>Save</source>
<translation>Speichern</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="256"/>
<source>Cheats</source>
<translation>Cheats</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="257"/>
<source>Patches</source>
<translation>Patches</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="278"/>
<source>Error</source>
<translation>Fehler</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="278"/>
<source>No patch selected.</source>
<translation>Kein Patch ausgewählt.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="292"/>
<source>Unable to open files.json for reading.</source>
<translation>Kann files.json nicht zum Lesen öffnen.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="316"/>
<source>No patch file found for the current serial.</source>
<translation>Keine Patch-Datei für die aktuelle Seriennummer gefunden.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="323"/>
<source>Unable to open the file for reading.</source>
<translation>Kann die Datei nicht zum Lesen öffnen.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="422"/>
<source>Unable to open the file for writing.</source>
<translation>Kann die Datei nicht zum Schreiben öffnen.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="432"/>
<source>Failed to parse XML: </source>
<translation>Fehler beim Parsen von XML: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="434"/>
<source>Success</source>
<translation>Erfolg</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="434"/>
<source>Options saved successfully.</source>
<translation>Optionen erfolgreich gespeichert.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="470"/>
<source>Invalid Source</source>
<translation>Ungültige Quelle</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="471"/>
<source>The selected source is invalid.</source>
<translation>Die ausgewählte Quelle ist ungültig.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="519"/>
<source>File Exists</source>
<translation>Datei existiert</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="520"/>
<source>File already exists. Do you want to replace it?</source>
<translation>Datei existiert bereits. Möchten Sie sie ersetzen?</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="539"/>
<source>Failed to save file:</source>
<translation>Fehler beim Speichern der Datei:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="545"/>
<source>Failed to download file:</source>
<translation>Fehler beim Herunterladen der Datei:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="556"/>
<source>Cheats Not Found</source>
<translation>Cheats nicht gefunden</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="556"/>
<source>CheatsNotFound_MSG</source>
<translation>Keine Cheats für dieses Spiel in dieser Version des gewählten Repositories gefunden. Versuchen Sie es mit einem anderen Repository oder einer anderen Version des Spiels.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="593"/>
<source>Cheats Downloaded Successfully</source>
<translation>Cheats erfolgreich heruntergeladen</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="594"/>
<source>CheatsDownloadedSuccessfully_MSG</source>
<translation>Sie haben erfolgreich Cheats für diese Version des Spiels aus dem gewählten Repository heruntergeladen. Sie können versuchen, von einem anderen Repository herunterzuladen. Wenn verfügbar, können Sie es auswählen, indem Sie die Datei aus der Liste auswählen.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="747"/>
<source>Failed to save:</source>
<translation>Speichern fehlgeschlagen:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="754"/>
<source>Failed to download:</source>
<translation>Herunterladen fehlgeschlagen:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="762"/>
<source>Download Complete</source>
<translation>Download abgeschlossen</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="763"/>
<source>DownloadComplete_MSG</source>
<translation>Patches erfolgreich heruntergeladen! Alle Patches für alle Spiele wurden heruntergeladen, es ist nicht notwendig, sie einzeln für jedes Spiel herunterzuladen, wie es bei Cheats der Fall ist.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="773"/>
<source>Failed to parse JSON data from HTML.</source>
<translation>Fehler beim Parsen der JSON-Daten aus HTML.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="778"/>
<source>Failed to retrieve HTML page.</source>
<translation>Fehler beim Abrufen der HTML-Seite.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="801"/>
<source>Failed to open file:</source>
<translation>Fehler beim Öffnen der Datei:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="819"/>
<source>XML ERROR:</source>
<translation>XML-Fehler:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="826"/>
<source>Failed to open files.json for writing</source>
<translation>Kann files.json nicht zum Schreiben öffnen</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="925"/>
<source>Author: </source>
<translation>Autor: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="997"/>
<source>Directory does not exist:</source>
<translation>Verzeichnis existiert nicht:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="1006"/>
<source>Failed to open files.json for reading.</source>
<translation>Kann files.json nicht zum Lesen öffnen.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="1006"/>
<source>Name:</source>
<translation>Name:</translation>
</message>
</context>
</TS> </TS>

View File

@ -81,67 +81,72 @@
<context> <context>
<name>GuiContextMenus</name> <name>GuiContextMenus</name>
<message> <message>
<location filename="../gui_context_menus.h" line="39"/> <location filename="../gui_context_menus.h" line="46"/>
<source>Create Shortcut</source> <source>Create Shortcut</source>
<translation>Create Shortcut</translation> <translation>Create Shortcut</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="40"/> <location filename="../gui_context_menus.h" line="47"/>
<source>Open Game Folder</source> <source>Open Game Folder</source>
<translation>Open Game Folder</translation> <translation>Open Game Folder</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="41"/> <location filename="../gui_context_menus.h" line="48"/>
<source>Cheats / Patches</source>
<translation>Kodikí / Enimeróseis</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="49"/>
<source>SFO Viewer</source> <source>SFO Viewer</source>
<translation>SFO Viewer</translation> <translation>SFO Viewer</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="42"/> <location filename="../gui_context_menus.h" line="50"/>
<source>Trophy Viewer</source> <source>Trophy Viewer</source>
<translation>Trophy Viewer</translation> <translation>Trophy Viewer</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="50"/> <location filename="../gui_context_menus.h" line="59"/>
<source>Copy info</source> <source>Copy info</source>
<translation>Copy info</translation> <translation>Copy info</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="51"/> <location filename="../gui_context_menus.h" line="60"/>
<source>Copy Name</source> <source>Copy Name</source>
<translation>Copy Name</translation> <translation>Copy Name</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="52"/> <location filename="../gui_context_menus.h" line="61"/>
<source>Copy Serial</source> <source>Copy Serial</source>
<translation>Copy Serial</translation> <translation>Copy Serial</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="53"/> <location filename="../gui_context_menus.h" line="62"/>
<source>Copy All</source> <source>Copy All</source>
<translation>Copy All</translation> <translation>Copy All</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="173"/> <location filename="../gui_context_menus.h" line="195"/>
<source>Shortcut creation</source> <source>Shortcut creation</source>
<translation>Shortcut creation</translation> <translation>Shortcut creation</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="174"/> <location filename="../gui_context_menus.h" line="196"/>
<source>Shortcut created successfully!\n %1</source> <source>Shortcut created successfully!\n %1</source>
<translation>Shortcut created successfully!\n %1</translation> <translation>Shortcut created successfully!\n %1</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="177"/> <location filename="../gui_context_menus.h" line="199"/>
<source>Error</source> <source>Error</source>
<translation>Error</translation> <translation>Error</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="178"/> <location filename="../gui_context_menus.h" line="200"/>
<source>Error creating shortcut!\n %1</source> <source>Error creating shortcut!\n %1</source>
<translation>Error creating shortcut!\n %1</translation> <translation>Error creating shortcut!\n %1</translation>
</message> </message>
<message> <message>
<location filename="../gui_context_menus.h" line="253"/> <location filename="../gui_context_menus.h" line="275"/>
<source>Install PKG</source> <source>Install PKG</source>
<translation>Install PKG</translation> <translation>Install PKG</translation>
</message> </message>
@ -248,6 +253,11 @@
<source>Game Install Directory</source> <source>Game Install Directory</source>
<translation>Game Install Directory</translation> <translation>Game Install Directory</translation>
</message> </message>
<message>
<location filename="../main_window_ui.h" line="343"/>
<source>Download Cheats/Patches</source>
<translation>Κατεβάστε Κωδικούς / Ενημερώσεις</translation>
</message>
<message> <message>
<location filename="../main_window_ui.h" line="345"/> <location filename="../main_window_ui.h" line="345"/>
<source>Dump Game List</source> <source>Dump Game List</source>
@ -488,4 +498,405 @@
<translation>Enable RenderDoc Debugging</translation> <translation>Enable RenderDoc Debugging</translation>
</message> </message>
</context> </context>
<context>
<name>MainWindow</name>
<message>
<location filename="../main_window.cpp" line="168"/>
<source> * Unsupported Vulkan Version</source>
<translation> * Μη υποστηριζόμενη έκδοση Vulkan</translation>
</message>
<message>
<location filename="../main_window.cpp" line="326"/>
<source>Download Cheats For All Installed Games</source>
<translation>Λήψη Cheats για όλα τα εγκατεστημένα παιχνίδια</translation>
</message>
<message>
<location filename="../main_window.cpp" line="328"/>
<source>Download Patches For All Games</source>
<translation>Λήψη Patches για όλα τα παιχνίδια</translation>
</message>
<message>
<location filename="../main_window.cpp" line="363"/>
<source>Download Complete</source>
<translation>Η λήψη ολοκληρώθηκε</translation>
</message>
<message>
<location filename="../main_window.cpp" line="364"/>
<source>You have downloaded cheats for all the games you have installed.</source>
<translation>Έχετε κατεβάσει cheats για όλα τα εγκατεστημένα παιχνίδια.</translation>
</message>
<message>
<location filename="../main_window.cpp" line="391"/>
<source>Patches Downloaded Successfully!</source>
<translation>Τα Patches κατέβηκαν επιτυχώς!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="392"/>
<source>All Patches available for all games have been downloaded.</source>
<translation>Όλα τα διαθέσιμα Patches για όλα τα παιχνίδια έχουν κατέβει.</translation>
</message>
<message>
<location filename="../main_window.cpp" line="549"/>
<source>Games: </source>
<translation>Παιχνίδια: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="575"/>
<source>PKG File (*.PKG)</source>
<translation>Αρχείο PKG (*.PKG)</translation>
</message>
<message>
<location filename="../main_window.cpp" line="594"/>
<source>ELF files (*.bin *.elf *.oelf)</source>
<translation>Αρχεία ELF (*.bin *.elf *.oelf)</translation>
</message>
<message>
<location filename="../main_window.cpp" line="600"/>
<source>Game Boot</source>
<translation>Εκκίνηση παιχνιδιού</translation>
</message>
<message>
<location filename="../main_window.cpp" line="600"/>
<source>Only one file can be selected!</source>
<translation>Μπορεί να επιλεγεί μόνο ένα αρχείο!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="623"/>
<source>PKG Extraction</source>
<translation>Εξαγωγή PKG</translation>
</message>
<message>
<location filename="../main_window.cpp" line="646"/>
<source>Patch detected!</source>
<translation>Αναγνώριση ενημέρωσης!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="646"/>
<source>PKG and Game versions match: </source>
<translation>Οι εκδόσεις PKG και παιχνιδιού ταιριάζουν: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="647"/>
<source>Would you like to overwrite?</source>
<translation>Θέλετε να αντικαταστήσετε;</translation>
</message>
<message>
<location filename="../main_window.cpp" line="639"/>
<source>PKG Version %1 is older than installed version: </source>
<translation>Η έκδοση PKG %1 είναι παλαιότερη από την εγκατεστημένη έκδοση: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="660"/>
<source>Game is installed: </source>
<translation>Το παιχνίδι είναι εγκατεστημένο: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="660"/>
<source>Would you like to install Patch: </source>
<translation>Θέλετε να εγκαταστήσετε την ενημέρωση: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="673"/>
<source>DLC Installation</source>
<translation>Εγκατάσταση DLC</translation>
</message>
<message>
<location filename="../main_window.cpp" line="674"/>
<source>Would you like to install DLC: %1?</source>
<translation>Θέλετε να εγκαταστήσετε το DLC: %1;</translation>
</message>
<message>
<location filename="../main_window.cpp" line="688"/>
<source>DLC already installed:</source>
<translation>DLC ήδη εγκατεστημένο:</translation>
</message>
<message>
<location filename="../main_window.cpp" line="701"/>
<source>Game already installed</source>
<translation>Παιχνίδι ήδη εγκατεστημένο</translation>
</message>
<message>
<location filename="../main_window.cpp" line="674"/>
<source>PKG is a patch, please install the game first!</source>
<translation>Το PKG είναι patch, παρακαλώ εγκαταστήστε πρώτα το παιχνίδι!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="681"/>
<source>PKG ERROR</source>
<translation>ΣΦΑΛΜΑ PKG</translation>
</message>
<message>
<location filename="../main_window.cpp" line="693"/>
<source>Extracting PKG %1/%2</source>
<translation>Εξαγωγή PKG %1/%2</translation>
</message>
<message>
<location filename="../main_window.cpp" line="703"/>
<source>Extraction Finished</source>
<translation>Η εξαγωγή ολοκληρώθηκε</translation>
</message>
<message>
<location filename="../main_window.cpp" line="704"/>
<source>Game successfully installed at %1</source>
<translation>Το παιχνίδι εγκαταστάθηκε επιτυχώς στο %1</translation>
</message>
<message>
<location filename="../main_window.cpp" line="725"/>
<source>File doesn't appear to be a valid PKG file</source>
<translation>Η αρχείο δεν φαίνεται να είναι έγκυρο αρχείο PKG</translation>
</message>
</context>
<context>
<name>CheatsPatches</name>
<message>
<location filename="../cheats_patches.cpp" line="44"/>
<source>Cheats / Patches</source>
<translation>Cheats / Patches</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="50"/>
<source>defaultTextEdit_MSG</source>
<translation>Οι cheats/patches είναι πειραματικά.\nΧρησιμοποιήστε τα με προσοχή.\n\nΚατεβάστε τους cheats μεμονωμένα επιλέγοντας το αποθετήριο και κάνοντας κλικ στο κουμπί λήψης.\nΣτην καρτέλα Patches, μπορείτε να κατεβάσετε όλα τα patches ταυτόχρονα, να επιλέξετε ποια θέλετε να χρησιμοποιήσετε και να αποθηκεύσετε την επιλογή.\n\nΔεδομένου ότι δεν αναπτύσσουμε τους cheats/patches,\αρακαλώ αναφέρετε προβλήματα στον δημιουργό του cheat.\n\nΔημιουργήσατε ένα νέο cheat; Επισκεφθείτε:\nhttps://github.com/shadps4-emu/ps4_cheats</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="69"/>
<source>No Image Available</source>
<translation>Δεν διατίθεται εικόνα</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="79"/>
<source>Serial: </source>
<translation>Σειριακός αριθμός: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="83"/>
<source>Version: </source>
<translation>Έκδοση: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="87"/>
<source>Size: </source>
<translation>Μέγεθος: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="126"/>
<source>Select Cheat File:</source>
<translation>Επιλέξτε αρχείο Cheat:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="133"/>
<source>Repository:</source>
<translation>Αποθετήριο:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="149"/>
<source>Download Cheats</source>
<translation>Λήψη Cheats</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="155"/>
<source>Delete File</source>
<translation>Διαγραφή αρχείου</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="169"/>
<source>No files selected.</source>
<translation>Δεν έχουν επιλεγεί αρχεία.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="170"/>
<source>You can delete the cheats you don't want after downloading them.</source>
<translation>Μπορείτε να διαγράψετε τα cheats που δεν θέλετε μετά τη λήψη τους.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="178"/>
<source>Do you want to delete the selected file?\n%1</source>
<translation>Θέλετε να διαγράψετε το επιλεγμένο αρχείο;\n%1</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="213"/>
<source>Select Patch File:</source>
<translation>Επιλέξτε αρχείο Patch:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="241"/>
<source>Download Patches</source>
<translation>Λήψη Patches</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="248"/>
<source>Save</source>
<translation>Αποθήκευση</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="256"/>
<source>Cheats</source>
<translation>Cheats</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="257"/>
<source>Patches</source>
<translation>Patches</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="278"/>
<source>Error</source>
<translation>Σφάλμα</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="278"/>
<source>No patch selected.</source>
<translation>Δεν έχει επιλεγεί κανένα patch.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="292"/>
<source>Unable to open files.json for reading.</source>
<translation>Αδυναμία ανοίγματος του files.json για ανάγνωση.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="316"/>
<source>No patch file found for the current serial.</source>
<translation>Δεν βρέθηκε αρχείο patch για τον τρέχοντα σειριακό αριθμό.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="323"/>
<source>Unable to open the file for reading.</source>
<translation>Αδυναμία ανοίγματος του αρχείου για ανάγνωση.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="422"/>
<source>Unable to open the file for writing.</source>
<translation>Αδυναμία ανοίγματος του αρχείου για εγγραφή.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="432"/>
<source>Failed to parse XML: </source>
<translation>Αποτυχία ανάλυσης XML: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="434"/>
<source>Success</source>
<translation>Επιτυχία</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="434"/>
<source>Options saved successfully.</source>
<translation>Οι ρυθμίσεις αποθηκεύτηκαν επιτυχώς.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="470"/>
<source>Invalid Source</source>
<translation>Μη έγκυρη Πηγή</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="471"/>
<source>The selected source is invalid.</source>
<translation>Η επιλεγμένη πηγή είναι μη έγκυρη.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="519"/>
<source>File Exists</source>
<translation>Η αρχείο υπάρχει</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="520"/>
<source>File already exists. Do you want to replace it?</source>
<translation>Η αρχείο υπάρχει ήδη. Θέλετε να την αντικαταστήσετε;</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="539"/>
<source>Failed to save file:</source>
<translation>Αποτυχία αποθήκευσης αρχείου:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="545"/>
<source>Failed to download file:</source>
<translation>Αποτυχία λήψης αρχείου:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="556"/>
<source>Cheats Not Found</source>
<translation>Δεν βρέθηκαν Cheats</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="556"/>
<source>CheatsNotFound_MSG</source>
<translation>Δεν βρέθηκαν cheats για αυτό το παιχνίδι στην τρέχουσα έκδοση του επιλεγμένου αποθετηρίου. Δοκιμάστε να κατεβάσετε από άλλο αποθετήριο ή άλλη έκδοση του παιχνιδιού.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="593"/>
<source>Cheats Downloaded Successfully</source>
<translation>Cheats κατεβάστηκαν επιτυχώς</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="594"/>
<source>CheatsDownloadedSuccessfully_MSG</source>
<translation>Κατεβάσατε επιτυχώς cheats για αυτή την έκδοση του παιχνιδιού από το επιλεγμένο αποθετήριο. Μπορείτε να δοκιμάσετε να κατεβάσετε από άλλο αποθετήριο. Αν είναι διαθέσιμο, μπορείτε να το επιλέξετε επιλέγοντας το αρχείο από τη λίστα.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="747"/>
<source>Failed to save:</source>
<translation>Αποτυχία αποθήκευσης:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="754"/>
<source>Failed to download:</source>
<translation>Αποτυχία λήψης:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="762"/>
<source>Download Complete</source>
<translation>Η λήψη ολοκληρώθηκε</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="763"/>
<source>DownloadComplete_MSG</source>
<translation>Τα Patches κατεβάστηκαν επιτυχώς! Όλα τα Patches για όλα τα παιχνίδια έχουν κατέβει, δεν είναι απαραίτητο να τα κατεβάσετε ένα-ένα για κάθε παιχνίδι, όπως με τα Cheats.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="773"/>
<source>Failed to parse JSON data from HTML.</source>
<translation>Αποτυχία ανάλυσης δεδομένων JSON από HTML.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="778"/>
<source>Failed to retrieve HTML page.</source>
<translation>Αποτυχία ανάκτησης σελίδας HTML.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="801"/>
<source>Failed to open file:</source>
<translation>Αποτυχία ανοίγματος αρχείου:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="819"/>
<source>XML ERROR:</source>
<translation>ΣΦΑΛΜΑ XML:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="826"/>
<source>Failed to open files.json for writing</source>
<translation>Αποτυχία ανοίγματος του files.json για εγγραφή</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="925"/>
<source>Author: </source>
<translation>Συγγραφέας: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="997"/>
<source>Directory does not exist:</source>
<translation>Ο φάκελος δεν υπάρχει:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="1006"/>
<source>Failed to open files.json for reading.</source>
<translation>Αποτυχία ανοίγματος του files.json για ανάγνωση.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="1006"/>
<source>Name:</source>
<translation>Όνομα:</translation>
</message>
</context>
</TS> </TS>

Some files were not shown because too many files have changed in this diff Show More