543 Commits

Author SHA1 Message Date
georgemoralis
ec7a541263 tagged 0.6.0 release 2025-01-31 09:53:35 +02:00
Martin
a55cec1954 add advdebug translation nb (#2296)
* add advdebug translation nb

* vvl is a project so no tr
2025-01-31 08:35:31 +02:00
C4ndyF1sh
6e58c6c513 update german ts (#2294)
* Update de.ts (p1)

* Update de.ts (p2)

* Update de.ts (p3)

* Update de.ts (p4)
2025-01-31 08:35:06 +02:00
bigol83
647694d1b9 Update Italian translation (#2293)
* Update it.ts

Update Italian translation

* Update Italian translation

* Update Italian translation
2025-01-31 08:34:42 +02:00
tomboylover93
7ae1d73781 Fix minor issue with 'Emulator' group box (#2292) 2025-01-31 00:41:17 +02:00
kalaposfos13
be74f65864 Fix ccrash if remote is not set (#2291) 2025-01-31 00:14:13 +02:00
C4ndyF1sh
b5d63a31cc update german ts (#2290)
* Update de.ts (p1)

* Update de.ts (p2)
2025-01-31 00:05:50 +02:00
kalaposfos13
c77f62a738 Detect and log if the user is using a fork (#2219)
* Added fork detection

* Fallback to "origin" if branch is not found

* Add fork names to window titles

* clang
2025-01-30 22:45:49 +02:00
Missake212
52df7f6fe5 add french tl (#2289) 2025-01-30 22:18:45 +02:00
DanielSvoboda
ad5bd91a13 Fix game title sorting (#2286)
* Fix game title sorting

* fix

* fix

* fix
2025-01-30 10:34:42 -08:00
tomboylover93
e805b97520 Add Vulkan debug options to the Debug tab (#2254)
Co-authored-by: DanielSvoboda <daniel.svoboda@hotmail.com>
2025-01-30 18:34:31 +01:00
squidbus
c89c7e8fed cpu_patches: Always use AVX for certain patches. (#2274) 2025-01-30 18:17:03 +01:00
Zaid Ismail
19bbbf994c Fix game title sorting bug from Issue #2260 (#2284)
* Fix alphabetical sorting bug caused by case-sensitive string comparisons in GameListFrame.

* Fix bug with incorrect use of std::tolower.

* Fix clang-format error.

---------

Co-authored-by: Zaid Ismail <ZaidI@thoroughtec.com>
2025-01-30 14:09:50 +02:00
Missake212
3a163002d7 Update README.md (#2281)
Lot of people seem to think that building is required to use shad, adding a little note in the README to redirect them to tabs where they can simply download it.
2025-01-30 04:06:55 -08:00
squidbus
132a9d7d35 externals: Update MoltenVK (#2280)
Small fix for pipeline serialization from last change.
2025-01-30 01:38:34 -08:00
Bhaal42
d8b4114296 Patch 1 (#2278)
* Update fr.ts

Corrected some typos

* Update fr.ts

forgot plural
2025-01-30 10:25:29 +02:00
squidbus
0b50e2e270 sdl_window: Allow alternate face button keys on any system. (#2275)
* sdl_window: Allow alternate face button keys on any system.

* readme: Fix typo
2025-01-30 10:09:11 +02:00
Vinicius Rangel
0358271b93 Savefixes vii (#2279)
* savedata: rewrite save memory functions to handle slot id & better backup management

* savedata: auto-restore backup if needed

* safe save backup shutdown

replaced exit by quick_exit
2025-01-30 09:45:48 +02:00
squidbus
929e15260d shader_recompiler: Fix cube sampling coordinates. (#2266) 2025-01-29 18:14:36 -08:00
Missake212
4bb578f9fb updates french translation (#2262)
* updates the french translation

* fix space at the end

* forgot to translate a line

* final changes

* final changes 2
2025-01-29 12:45:44 +02:00
isshininu
aa847de043 Update ru_RU translation (#2267)
Several changes in ru_RU translation file.
2025-01-29 12:54:08 +03:00
squidbus
9bad66b24d hotfix: Raise videodec memory back up to 16MB.
Found a game that needs more, still should be low enough compared to before to fix some games.
2025-01-29 01:32:12 -08:00
ElBread3
78a0a755c5 qt_gui: Some game install features and fixes (#2261)
* open update folder + delete save folder + bulk install checkbox

* delete pkg on install checkbox + use game icon for finish window
2025-01-29 05:14:47 +02:00
squidbus
0575853be1 externals: Update MoltenVK. (#2264)
Adds support for VK_EXT_depth_clip_control
2025-01-28 17:56:05 -08:00
squidbus
a78f8afe58 libraries: Implement libSceZlib. (#2256)
* libraries: add zlib hle skeleton/stub

* libraries: Implement libSceZlib.

* zlib: Make variables static.

---------

Co-authored-by: Nenkai <Nenkai@users.noreply.github.com>
2025-01-28 18:48:19 +02:00
slick-daddy
2cdd873681 Update tr_TR.ts (#2255) 2025-01-28 18:47:12 +02:00
Martin
4b93b8b574 add missing translations and other corrections nb (#2253) 2025-01-28 18:47:00 +02:00
squidbus
8379922f8a hotfix: Reduce requested videodec memory block sizes.
This really needs a more accurate implementation, but for the stub lowering the value helps games that run out of memory space if it is too large.
2025-01-28 02:33:17 -08:00
squidbus
d2127b38de vk_rasterizer: Keep viewport depth offset even without native depth clip control. (#2257) 2025-01-28 11:12:48 +03:00
panzone91
2837d848ed linker: handle relocation for exported modules (#2247) 2025-01-27 22:40:58 +02:00
F1219R
665261efc5 Update sq translation (#2251) 2025-01-27 17:39:27 +02:00
Vladislav Mikhalin
191e64bfa1 renderer: respect zmin/zmax even if clipping is disabled (#2250) 2025-01-27 00:17:23 -08:00
squidbus
6f04ea18e4 externals: Update MoltenVK (#2249)
Fixes broken vertex binding dynamic stride when used with tessellation.
2025-01-26 19:28:58 -08:00
Ian Carpenter
7d1631f9f4 memory_patcher: Remove hardcoded repositories when loading patches (#2241) 2025-01-26 15:46:59 -08:00
squidbus
46b5437fdf emulator: Use correct game folder mount when opening update eboot directly. (#2244) 2025-01-26 18:01:15 +02:00
squidbus
461148c227 qt: Prevent interacting with empty grid cells. (#2243) 2025-01-26 04:32:14 -08:00
squidbus
3960283a67 hotfix: Fix missing embedded PS shader address bits.
If the emulator code is above a 40-bit address, the embedded shaders need to use address-hi to work. Embedded VS shader already supplies it, PS shader should as well.
2025-01-26 01:02:55 -08:00
squidbus
f1bc3b4f3d shader_recompiler: Add another constant propagation pass near the end. (#2231) 2025-01-25 14:59:18 -08:00
squidbus
a5a1253185 liverpool: Implement PM4 MEM_SEMAPHORE. (#2235) 2025-01-25 04:12:18 -08:00
Ian Carpenter
564dbc7b94 system_service: Add simple event queue and push an EntitlementUpdate event to it when app content is initialized (#2238) 2025-01-25 11:00:52 +02:00
squidbus
e433f3116d hotfix 2: clang format 2025-01-24 19:57:09 -08:00
squidbus
73b7d34460 hotfix: Drop scePadSetLightBar log to debug level.
Some games like to spam this a lot, and we already handle it.
2025-01-24 19:56:05 -08:00
hspir404
7072dfc99f Fix stale heap read in UnmapMemoryImpl (#2232) 2025-01-24 23:56:21 +02:00
squidbus
361532418c externals: Update SPIRV-Cross for MoltenVK (#2237) 2025-01-24 12:47:24 -08:00
squidbus
a51c8c17e0 shader_recompiler: Fix image write swizzles. (#2236) 2025-01-24 12:47:04 -08:00
squidbus
56f4b8a2b8 shader_recompiler: Implement shader export formats. (#2226) 2025-01-24 10:41:58 -08:00
poly
b3c573f798 libraries/fiber: print fiber ctx size on stack overflow 2025-01-24 19:37:34 +01:00
georgemoralis
a4eba8e827 stubbed webbrowserdialog,npparty (#2234)
* stubbed webbrowserdialog,npparty

* added poly's suggestions
2025-01-24 19:22:06 +02:00
kalaposfos13
4f426b723f Rebase of "Handle munmap over multiple VMAs" (#2233)
* Unmap memory in chunks if spanning over multiple VMAs

* clang

* Merge fixups

* Minor code style changes

* Update function declarations

---------

Co-authored-by: Marcin Mikołajczyk <marcinmikolajcz@gmail.com>
2025-01-24 15:30:55 +02:00
squidbus
4d12de8149 hotfix: 64-bit shift fixups 2025-01-24 03:14:37 -08:00
Marcin Mikołajczyk
9dcf40e261 Handle more 64bit shifts in Translator (#1825) 2025-01-24 03:07:36 -08:00
squidbus
0f69697acb documents: Update CPU requirements. (#2229) 2025-01-24 10:48:39 +02:00
georgemoralis
481f420a89 Update building-linux.md 2025-01-24 10:28:14 +02:00
squidbus
d1b9a5adcc texture_cache: Do not overwrite overlap hit with a miss. (#2217) 2025-01-24 10:23:18 +02:00
squidbus
74710116f6 renderer_vulkan: Remove dead code. (#2228) 2025-01-24 10:21:56 +02:00
squidbus
91444a0545 liverpool: Fix tiled check for color buffer. (#2227) 2025-01-24 10:21:32 +02:00
DanielSvoboda
a8a779c79b Fix AutoUpdate Changelog (#2224) 2025-01-24 10:11:48 +02:00
georgemoralis
e652369f22 sdl3 update (#2221) 2025-01-23 23:58:43 +02:00
Log3rinioo
cc4ddd28c3 Add missing Polish translations and fix typos (#2222) 2025-01-23 23:56:06 +02:00
georgemoralis
0ebe817a28 Update building-linux.md 2025-01-23 23:46:15 +02:00
georgemoralis
cdca420a2e Update building-linux.md 2025-01-23 23:27:37 +02:00
georgemoralis
2e6c9b8f98 Revert "Optimize workflows by caching apt install (#2212)" (#2220)
This reverts commit fb738bc247.
2025-01-23 22:58:45 +02:00
Angelo Rosa
fb738bc247 Optimize workflows by caching apt install (#2212)
* optimize apt caches

* change on push syntax

* removing comments and check time improvements on following pushes

* add recursive submodule fetch

* Revert "add recursive submodule fetch"

This reverts commit b059bda3b8.

* restore old push on everyhing rule

* fix libfuse2 uncaching package

* moving qt deps outside from caching directives
2025-01-23 15:54:42 +02:00
DemoJameson
cef92fbcaa Update Simplified Chinese translation (#2216)
* Update Simplified Chinese translation

* Fix incorrect translation

* Fix new line
2025-01-23 13:28:44 +02:00
DanielSvoboda
cc2e13873f Fix showing debug menu bar / Devtools (#2214)
* Fix showing debug menu bar / Devtools

* Fix
2025-01-22 22:21:41 -03:00
georgemoralis
81e7e4b216 Update building-linux.md 2025-01-23 00:52:22 +02:00
DanielSvoboda
1fcfb07421 GUI: Settings improvements (#2213) 2025-01-23 00:21:52 +02:00
panzone91
d7c2cb17f3 update extension vector capacity (#2210) 2025-01-22 23:53:54 +02:00
tomboylover93
c015ac1344 Update Linux building documentation (#2211)
* wip: redo build instructions guide for Linux

* Add Linux screenshots directory to REUSE.toml

* change links for Visual Studio Code images

* change instructions for building from terminal

reference: https://github.com/shadps4-emu/shadPS4/pull/2211#issuecomment-2608134455
2025-01-22 23:53:27 +02:00
お餅のCreeeper
e584444aa3 Update Japanese translation (#2209)
* Update Japanese translation

* Update Japanese translation

* Update Japanese translation
2025-01-22 23:52:27 +02:00
Vinicius Rangel
b3bce086b3 devtools: fix ReleaseKeyboard assert being triggered if many shader editor windows exist (#2205) 2025-01-22 12:08:49 -03:00
Stephen Miller
2968cf5a99 sceKernelVirtualQuery Fixes (#2204) 2025-01-22 16:06:27 +01:00
f3d209
adbff4056f Added ability to change save data path (#2199)
* added ability to change save data path

* get default save data path from fs

* add copyright

* formatting
2025-01-22 12:10:35 +02:00
Stephen Miller
78ae9613c5 Fix for address_space initialization on Windows (#2202)
Should fix some `Region coalescing failed: Attempt to access invalid address.` crashes.

Co-authored-by: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com>
2025-01-22 12:07:43 +02:00
squidbus
2a4798cfa6 tile: Fix some tile thickness calculation errors. (#2203)
* tile: Fix some tile thickness calculation errors.

* tile: Do not pad mip height to tile height.
2025-01-22 09:40:00 +01:00
polyproxy
5c62a00134 clang-format (again) 2025-01-21 21:14:05 +01:00
polyproxy
41b3942833 clang-format 2025-01-21 19:34:05 +01:00
polyproxy
84a341dce5 remove BADF return 2025-01-21 19:30:34 +01:00
polyproxy
3563b88d8c hotfix: use logger device on stdin 2025-01-21 19:28:39 +01:00
squidbus
95a30b2b3e texture_cache: Lock when updating image. (#2198) 2025-01-20 22:38:09 +01:00
squidbus
a3967ccdb4 externals: Update vulkan-headers (#2197) 2025-01-20 14:48:32 +02:00
squidbus
e1132db197 texture_cache: Prevent unregistered images from being tracked. (#2196) 2025-01-20 08:33:37 +01:00
Stephen Miller
0f93edb377 Implement IMAGE_ATOMIC_SWAP (#2194)
We already handle everything for this opcode in our IMAGE_ATOMIC function, so implementing this is fairly simple.
Should improve Wipeout 3.
2025-01-19 19:20:51 -08:00
Stephen Miller
4fa501c8d5 Additional libSceNpManager functions and cleanup (#2195)
* Error return on sceNpGetAccountIdA

Confirmed through hardware testing, this returns ORBIS_NP_ERROR_SIGNED_OUT on a signed out console.

Parameters are based on fpPS4 code.

* Fix compile

* Move errors to separate file

* Cleanup function headers

Swaps user_ids to use our OrbisUserServiceUserId type, and fixes parameter names to align with our coding standards.

* Add proper parameter checks

* Implement sceNpGetAccountId

This function takes an online_id, uses an NpManager function to get the user_id, then uses that user_id to perform the same internal functions as sceNpGetAccountIdA.

* Implement sceNpHasSignedUp

* Fix sceNpGetAccountId

Further hardware testing shows that these always write 0 to account_id when failing.

* Update np_manager.cpp
2025-01-19 19:12:42 -08:00
squidbus
d14e57f6a8 hotfix: Move some command buffer references down.
Prevents references becoming stale due to stream buffer flushes.
2025-01-19 18:45:37 -08:00
DanielSvoboda
80092b6367 Fix SurfaceFormat Format4_4_4_4 (#2193)
* Fix SurfaceFormat Format4_4_4_4

Pac-Man 256

* add_extension
2025-01-19 15:09:10 -08:00
DanielSvoboda
201f2817ca Fix SurfaceFormat Format1_5_5_5 - Format5_5_5_1 (#2191)
* Fix SurfaceFormat Format1_5_5_5 - again

* Fix Format5_5_5_1
2025-01-19 13:55:27 -08:00
DanielSvoboda
17ac63d23a Fix SurfaceFormat (#2188) 2025-01-19 17:47:40 +02:00
DanielSvoboda
c8bbecda26 Devtools: Close Button ( X ) (#2187) 2025-01-19 17:45:24 +02:00
georgemoralis
a7d45231b7 Filesystem devices (#2184)
* added dummy devices

* More WIP

* added urandom,srandom,random,console,deci_tty6 devices

* small fix

* macOS fix
2025-01-19 10:44:57 -03:00
Quang Ngô
ec0dfb32b5 Some ImGui tweaks for the game window (#2183)
* Remove window border
* Remove window rounding
* Set background color to black
2025-01-19 09:03:15 -03:00
squidbus
746f2e091d tile: Account for thickness in micro tiled size calculation. (#2185) 2025-01-19 12:06:31 +01:00
Vladislav Mikhalin
269ce12614 fix build on arch 2025-01-18 16:54:06 +03:00
¥IGA
388548ba47 pad: Configurable DeadZone (#2030) 2025-01-18 16:02:02 +03:00
kalaposfos13
3b92cd1c1a CLI: Add argument to pass an argument to the game (#2135) 2025-01-18 15:21:08 +03:00
Quang Ngô
1ea5f8f092 input: Unbroke KBM-only input (#2179) 2025-01-18 13:48:39 +03:00
squidbus
c80151adde vk_presenter: Fix splash issues. (#2180) 2025-01-18 02:29:19 -08:00
squidbus
d361579618 texture_cache: Fix image mip overlap. (#2177) 2025-01-18 10:35:44 +01:00
squidbus
12364b197a renderer_vulkan: Remove swapchain image reinterpretation. (#2176) 2025-01-18 01:13:16 -08:00
Quang Ngô
81ad575b22 video_core: Use adaptive mutex on Linux (#2105)
Fix performance regression with #1973 on SteamDeck
2025-01-17 23:47:38 -08:00
Quang Ngô
9a956f5ed0 renderer_vulkan: Clear blank frame (#2095)
* renderer_vulkan: Clear blank frame

Fix display of garbage images on startup on some drivers.

* Remove duplicated attachment declarations

* Remove duplicated rendering_info declarations
2025-01-17 23:08:45 -08:00
tomboylover93
40385e13e7 qt: Improve user experience on Steam Deck and window managers (#2103) 2025-01-18 10:08:20 +03:00
Quang Ngô
90b04e8cc0 input: Don't use old input state in GameController::ReadState() (#2170) 2025-01-18 09:59:38 +03:00
Vladislav Mikhalin
7b8177f48e renderer: handle disabled clipping (#2146)
Co-authored-by: IndecisiveTurtle <47210458+raphaelthegreat@users.noreply.github.com>
2025-01-18 09:20:38 +03:00
Ian Maclachlan
a5440e0e43 Update kernel.cpp (#2125)
In kernel.cpp boost io_context.reset() deprecated/discontinued in latest versions.  Changed to io_context.restart() as recommended.
2025-01-17 22:16:07 -08:00
¥IGA
e134fc5f1e Qt: Open shadPS4 Folder (#2107)
* Qt: Open shadPS4 Folder

* clang-format

* Change order

* Update pt_BR.ts
2025-01-17 22:09:10 -08:00
polybiusproxy
99a04357d1 don't compile cs with higher shared memory than supported (#2175) 2025-01-17 21:51:33 +01:00
Vinicius Rangel
4e8c178aec imgui: central node auto-hide tab (#2174) 2025-01-17 16:11:37 -03:00
Plínio Larrubia
0cee59cbe6 ci: Don't use the same cache for clang and gcc on linux (#2173) 2025-01-17 16:56:52 +02:00
squidbus
9e5b50c866 vk_platform: Clean up unnecessary debug message filters. (#2171) 2025-01-17 10:16:15 +02:00
squidbus
1d3427780a renderer_vulkan: Fix present related validation errors. (#2169) 2025-01-17 10:16:03 +02:00
squidbus
1e5b316ac4 renderer_vulkan: Add debug markers for presenter. (#2167) 2025-01-17 10:15:43 +02:00
baggins183
c13b29662e handle control point strides that arent a multiple of 16 (#2172) 2025-01-17 10:14:54 +02:00
squidbus
3b474a12f9 shader_recompiler: Improvements to buffer addressing implementation. (#2123) 2025-01-16 18:40:03 -08:00
squidbus
eb49193309 liverpool: Revert queue scope markers. (#2166) 2025-01-16 18:24:29 -08:00
Vinicius Rangel
8695383d35 keep framerate stable even without vsync (#2165) 2025-01-16 21:10:17 -03:00
Vinicius Rangel
56a6c95730 Render without rendering (#2152)
* presenter: render the game inside a ImGui window

* presenter: render the previous frame to keep the render rendering

* swapchain: fix swapchain image view format not being converted to unorm

* devtools: fix frame graph timing
2025-01-16 21:27:23 +02:00
Stephen Miller
440a693fae Crash on sceKernelDebugRaiseExceptionOnReleaseMode (#2163) 2025-01-16 18:22:39 +01:00
georgemoralis
4695aaa830 sceKernelAio* implementation (#2160)
* draft Aio from https://github.com/GoldHEN/GoldHEN_Plugins_Repository

* cleanup and fixes to Aio
2025-01-16 18:27:52 +02:00
squidbus
34a5f2319c network: Remove firing Np callbacks from check stubs. (#2161) 2025-01-16 13:17:07 +02:00
squidbus
da2b58f66e resource_tracking_pass: Persist image resource atomic designation. (#2158) 2025-01-16 12:36:41 +02:00
squidbus
b3739bea92 renderer_vulkan: Simplify debug marker settings. (#2159)
* renderer_vulkan: Simplify debug marker settings.

* liverpool: Add scope markers for graphics/compute queues.

* liverpool: Remove unneeded extra label from command buffer markers.

* vk_rasterizer: Add scopes around filtered draw passes.
2025-01-16 12:14:34 +02:00
DanielSvoboda
1c3048ccc2 Fix V_FRACT_F64 (#2156) 2025-01-15 16:45:02 +01:00
Stephen Miller
5a7d45fdfa Missing pthread exports (#2144) 2025-01-15 18:37:20 +03:00
squidbus
53d0a309cc liverpool_to_vk: Add R32Uint depth promote. (#2145) 2025-01-15 18:33:15 +03:00
Stephen Miller
c10f9b8269 Add libSceNpWebApi (#2150)
Includes a dummy return for sceNpWebApiInitialize, to make it return a positive value.
2025-01-15 13:19:41 +02:00
squidbus
5040be1640 renderer_vulkan: Handle depth-stencil copies through depth render overrides. (#2134) 2025-01-15 08:48:40 +03:00
jarred wilson
d94abffd9a Fix: rename yakuza screenshot to correct game (#2141) 2025-01-13 12:54:20 +02:00
squidbus
4719d32295 sdl: Respect text input main thread requirements. (#2138) 2025-01-12 22:44:42 +02:00
kalaposfos13
4f2f9494b0 GUI: Speed up GUI loading by caching game sizes (#2130)
* Add show game size toggle

* Fix (#7)

* Fix

I removed the gameSizeCheckBox from the 'Emulator' group and put it in 'GUI settings'
hLayoutTrophy which contains the Trophy information was inside the GUIMusicLayout, so I fixed that too.

* TR

* Use cached sizes if the feature is enabled

---------

Co-authored-by: DanielSvoboda <daniel.svoboda@hotmail.com>
2025-01-12 22:31:05 +02:00
Stephen Miller
c6ab149c56 libSceHttp2 Stubs (#2139)
* Auto-generate libSceHttp2

* Improved stub for sceHttp2Init

Needed for updated versions of Cyberpunk 2077.

Parameters are based on fpPS4, while the stub itself is based on similar stubs in our other networking libraries.

* Clang

I guess the line length calculations in the moduleGenerator are still not perfect?
2025-01-12 22:27:54 +02:00
psucien
394331f206 video_core: detiler: display micro 64bpp (#2137) 2025-01-12 19:25:25 +01:00
Stephen Miller
8a309c30a9 Check thread param on posix_pthread_rename_np (#2133) 2025-01-12 11:24:49 +02:00
Stephen Miller
466e071c97 Add libSceSsl2 stubs (#2132)
* Auto-generate libSceSsl2 stubs

* Copy over sceSslInit stub

* Update CMakeLists.txt

* Swap to Lib_Ssl2 log category

* Fix compile

Since libSceSsl has many functions of the same name, these functions get treated as overloaded functions and break compiling.

* Clang
2025-01-12 11:24:12 +02:00
squidbus
82cb298c5c shader_recompiler: Remove AMD native CubeFaceCoord. (#2129) 2025-01-11 13:57:49 -08:00
squidbus
5810c88c00 hotfix: Fix cube instructions. 2025-01-11 12:04:46 -08:00
Stephen Miller
62bbad62fc Implement sceNpCmp functions (#2114) 2025-01-11 17:58:07 +01:00
DemoJameson
5ac7e70e4b Update zh_CN.ts (#2122) 2025-01-11 17:55:10 +01:00
squidbus
5c845d4ecc hotfix: Constrain view layers to actual layers. 2025-01-10 16:30:28 -08:00
squidbus
6ec68f66a9 hotfix: Check correct template for setting binding divisor. 2025-01-10 15:59:20 -08:00
Quang Ngô
cfaea1ea6d qt_gui: Fix shortcut's name got cut off in some cases (#2116)
Example: P.T. -> P
2025-01-10 22:59:19 +02:00
DanielSvoboda
4a21d94871 Fix -PKG Viewer -Button install (#2113)
https://github.com/shadps4-emu/shadPS4/issues/2112
2025-01-10 22:58:41 +02:00
squidbus
e656093d85 shader_recompiler: Fix some image view type issues. (#2118) 2025-01-10 12:35:03 -08:00
squidbus
562ed2a025 renderer_vulkan: Simplify vertex binding logic and properly handle null buffers. (#2104)
* renderer_vulkan: Simplify vertex binding logic and properly handle null buffers.

* renderer_vulkan: Remove need for empty bindVertexBuffers2EXT.
2025-01-10 10:52:12 +02:00
squidbus
4563b6379d amdgpu: Handle 8-bit float format case for stencil. (#2092) 2025-01-10 10:49:08 +02:00
squidbus
725814ce01 shader_recompiler: Improvements to array and cube handling. (#2083)
* shader_recompiler: Account for instruction array flag in image type.

* shader_recompiler: Check da flag for all mimg instructions.

* shader_recompiler: Convert cube images into 2D arrays.

* shader_recompiler: Move image resource functions into sharp type.

* shader_recompiler: Use native AMD cube instructions when possible.

* specialization: Fix buffer storage mistake.
2025-01-10 10:48:12 +02:00
DanielSvoboda
93402620de GUI: Open Log Location - Button (#2102) 2025-01-09 08:42:07 +02:00
squidbus
65f9bbbfed shader_recompiler: Ignore exec mask for scalar instructions. (#2097) 2025-01-08 19:14:06 +02:00
tomboylover93
0eee36cbc7 ci: Add GCC build job for Linux (#2027)
* Add GCC CI build job

* gcc-ci: Change Clang CI job naming to avoid confusion

* gcc-ci: Remove GCC CI job from pre-release

This also removes the packaging step for linux-sdl-gcc and linux-qt-gcc so that the only available artifacts for download are compiled with Clang

* gcc-ci: Remove -clang prefix from Clang build jobs

* hot-fix

* specify gcc-14

* hot-fix: use system rapidjson

* use rapidjson-dev

* revert "use system rapidjson"
2025-01-08 14:41:01 +02:00
Stephen Miller
fc50567fc2 Unmap Fixes (#2080)
* Fix unmapping reserved memory

* Fix bug with unmapping before reserve

* Clang

* Ignore free memory pages

* Handle pooled memory
2025-01-08 14:08:54 +02:00
squidbus
e791ff4c5c externals: Update discord-rpc. (#2094) 2025-01-08 13:50:39 +02:00
squidbus
8f5bcb0f1c file_sys: Consolidate separate update directory handling. (#2041) 2025-01-08 13:23:40 +02:00
squidbus
af8c748e9c elf_info: Fix GCC build. (#2089) 2025-01-07 17:37:08 +02:00
Quang Ngô
3e5d4bb69c Fix double closing tag in metainfo.xml (#2090) 2025-01-07 17:36:56 +02:00
jarred wilson
c055c80c6f Remove releases.xml references (#2087) 2025-01-07 17:11:01 +02:00
Florian Piesche
a4c18b1434 Move release info into metainfo.xml (#2085) 2025-01-07 16:05:15 +02:00
kalaposfos13
4df0d9c035 Add support for true fullscreen (#2016)
* Support for true fullscreen

* clang

* Re-add mistakenly deleted line

* Size

I adjusted the size of the entire screen.
trophies font size and added a margin so it wouldn't be so spaced out.

---------

Co-authored-by: DanielSvoboda <daniel.svoboda@hotmail.com>
2025-01-07 15:30:05 +02:00
F1219R
32fc983ef8 Update sq translation (#2084)
* Update sq translation

* Update sq translation
2025-01-07 13:58:33 +02:00
squidbus
b0d7feb292 video_core: Implement conversion for uncommon/unsupported number formats. (#2047)
* video_core: Implement conversion for uncommon/unsupported number formats.

* shader_recompiler: Reinterpret image sample output as well.

* liverpool_to_vk: Remove mappings for remapped number formats.

These were poorly supported by drivers anyway.

* resource_tracking_pass: Fix image write swizzle mistake.

* amdgpu: Add missing specialization and move format mapping data to types

* reinterpret: Fix U/SToF input type.
2025-01-07 12:21:49 +02:00
kalaposfos13
c3ecf599ad Add motion controls toggle (#2029)
* Add motion controls toggle

* clang
2025-01-07 11:50:54 +02:00
squidbus
86038e6a71 shader_recompiler: Fix V_CMP_U_F32 (#2082) 2025-01-07 11:36:14 +02:00
Daniel Nylander
7bf467c653 Updated Swedish translation with additional strings (#2081)
* Adding Swedish translation

* Updated Swedish translation with additional strings

Updated the Swedish translations using lupdate to found additional strings

cd src/qt_gui/treanslations

lupdate ../../../../shadPS4/ -tr-function-alias QT_TRANSLATE_NOOP+=TRANSLATE,QT_TRANSLATE_NOOP+=TRANSLATE_SV,QT_TRANSLATE_NOOP+=TRANSLATE_STR,QT_TRANSLATE_NOOP+=TRANSLATE_FS,QT_TRANSLATE_N_NOOP3+=TRANSLATE_FMT,QT_TRANSLATE_NOOP+=TRANSLATE_NOOP,translate+=TRANSLATE_PLURAL_STR,translate+=TRANSLATE_PLURAL_FS -no-obsolete -locations none -source-language en -ts sv.ts

* Update sv.ts
2025-01-07 09:55:53 +02:00
¥IGA
869bf85e9a CI: Switch to Windows 2025 & Reduce Warnings (#2052) 2025-01-07 09:07:41 +02:00
squidbus
c08fc85b72 renderer_vulkan: Fix null buffer views with wrong format. (#2079) 2025-01-07 07:00:07 +02:00
DanielSvoboda
39b511070a TR: remove 'location' (#2078) 2025-01-07 06:58:49 +02:00
psucien
5559f35905 hot-fix: buffers resolve barriers fixed 2025-01-06 22:50:09 +01:00
Daniel Nylander
6f3c767b99 Adding Swedish translation (#2075) 2025-01-06 23:10:15 +02:00
georgemoralis
121328eced dummy sceMouse module and change sceMouseRead to debug to reduce spam (#2074) 2025-01-06 18:45:53 +02:00
squidbus
fb67d948b6 vk_resource_pool: Handle eErrorFragmentedPool. (#2071) 2025-01-06 15:31:45 +02:00
squidbus
7cdeb51670 renderer_vulkan: Add debug names to pipelines. (#2069) 2025-01-06 15:31:25 +02:00
squidbus
8879380427 shader_recompiler: Implement S_BITSET(0/1)_B32 (#2039) 2025-01-06 01:08:27 +02:00
Stephen Miller
e5f638b378 fix scePlayGoGetLocus (#2067)
Due to an issue with the if statement, scePlayGoGetLocus outputs an extra locus compared to real hardware.
2025-01-06 00:46:26 +02:00
Bettehem
4dcd7f0271 translation: Update Finnish translation (#2057) 2025-01-06 00:46:08 +02:00
squidbus
c0f57df4e6 vk_instance: Enable additional debug tagging if crash diagnostics is enabled. (#2066) 2025-01-06 00:45:54 +02:00
Vladislav Mikhalin
8f33dfe4f1 infra: require the log to be attched in template 2025-01-05 14:10:23 +03:00
Mahmoud Adel
79663789bd bump up vector size to 64 in image_info and image_binding (#2055)
solves ```boost::bad_alloc``` error when compiling shaders
2025-01-05 00:02:37 +02:00
psucien
9d3143231c macOS build fixed; indirect_args_addr moved out from queues context 2025-01-04 22:44:46 +01:00
psucien
7459d9c333 hot-fix: amdgpu: use different indirect dispatch packet on ASC 2025-01-04 22:23:12 +01:00
Quang Ngô
f2f24bb2cd input: Add missing poll lock (#2044) 2025-01-04 14:33:23 +02:00
squidbus
f42b8acf47 sdl_audio: Remove buffer samples hint. (#2038) 2025-01-04 14:33:07 +02:00
squidbus
78a32a3c0f image_info: Add Neo mode macro tile extents. (#2045) 2025-01-04 11:44:14 +01:00
psucien
ddc658f8c8 clang-format 2025-01-04 00:32:17 +01:00
squidbus
7153bc8d8f kernel: Check PSF for neo mode support. (#2028) 2025-01-04 00:29:09 +01:00
psucien
8e8671323a texture_cache: slight detilers refactoring (#2036) 2025-01-03 21:42:23 +01:00
squidbus
c2be12f009 amdgpu: Add some resource bits for Neo mode. (#2035) 2025-01-03 21:25:20 +01:00
squidbus
9434cae458 gnmdriver: Implement neo mode differences. (#2011)
* gnmdriver: Implement neo mode differences.

* gnmdriver: Move init sequences to separate file.
2025-01-03 21:22:27 +01:00
¥IGA
2951788afc texture_cache: Adding some missing textures (#2031) 2025-01-03 20:11:24 +01:00
psucien
345d55669e texture_cache: 8bpp macro detiler 2025-01-02 23:27:18 +01:00
georgemoralis
4e1733222f fixed deadzones (#2025) 2025-01-02 23:21:43 +02:00
TheTurtle
dcc662ff1a ir_passes: Integrate DS barriers in block (#2020) 2025-01-02 22:52:10 +02:00
Stephen Miller
67c531298a Fixup returns (#2023)
On a signed out console, these two functions return ERROR_SIGNED_OUT.
2025-01-02 22:51:47 +02:00
TheTurtle
77d2172441 renderer_vulkan: Cleanup and improve barriers in caches (#1865)
* texture_cache: Stricter barriers on image upload

* buffer_cache: Stricter barrier for vkCmdUpdateBuffer

* vk_rasterizer: Barrier also normal buffers and make it apply to all stages

* texture_cache: Minor barrier cleanup

* Batch image and buffer barriers in a single command

* clang format
2025-01-02 19:43:56 +01:00
psucien
f7a8e2409c hot-fix: debug build 2025-01-02 19:41:15 +01:00
polyproxy
55ccec4a38 fix typos 2025-01-02 18:40:10 +01:00
Vinicius Rangel
c977011d2f Merge pull request #2014 from viniciuslrangel/save-fixes-vi
Save Fixes VI
2025-01-02 12:40:05 -03:00
¥IGA
b87bca2e46 Reduce USBD Log Spamming (#2019) 2025-01-02 17:37:19 +02:00
squidbus
55b50171f8 audio: Improve port state guards. (#1998) 2025-01-02 17:33:53 +02:00
liberodark
596f4cdf0e Fix amdgpu & other issues (#2000) 2025-01-02 15:39:39 +02:00
TheTurtle
c25447097e buffer_cache: Improve buffer cache locking contention (#1973)
* Improve buffer cache locking contention

* buffer_cache: Revert some changes

* clang fmt 1

* clang fmt 2

* clang fmt 3

* buffer_cache: Fix build
2025-01-02 15:39:02 +02:00
hspir404
6862c9aad7 Speed up LiverpoolToVK::SurfaceFormat (#1982)
* Speed up LiverpoolToVK::SurfaceFormat

In Bloodborne this shows up as the function with the very highest cumulative "exclusive time". This is true both in scenes that perform poorly, and scenes that perform well.

I took (approximately) 10s samples using an 8khz sampling profiler.

In the Nightmare Grand Cathedral (looking towards the stairs, at the rest of the level):
- Reduced total time from 757.34ms to 82.61ms (out of ~10000ms).
- Reduced average frame times by 2ms (though according to the graph, the gap may be as big as 9ms every N frames).

In the Hunter's Dream (in the spawn position):
- Reduced the total time from 486.50ms to 53.83ms (out of ~10000ms).
- Average frame times appear to be roughly the same.

These are profiles of the change vs the version currently in the main branch. These improvements also improve things in the `threading` branch. They might improve them even more in that branch, but I didn't bother keeping track of my measurements as well in that branch. I believe this change will still be useful even when that branch is stabilized and merged.

It could be there are other bottlenecks in rendering on this branch that are preventing this code from being the critical path in places like the Hunter's Dream, where performance isn't currently as constrained. That might explain why the reduction in call times isn't resulting in a higher frame rate.

* Implement SurfaceFormat with derived lookup table instead of switch

* Clang format fixes
2025-01-02 15:38:51 +02:00
Mahmoud Adel
099e685bff add R16Uint to Format Detiler (#1995)
helps with Matterfall
2025-01-02 14:29:57 +02:00
polyproxy
1926900945 hotfix: reset stop source on thread stop 2025-01-02 12:30:05 +01:00
polyproxy
33afc00c3a Update improper wording in translations 2025-01-02 10:07:48 +01:00
Vinicius Rangel
3109bd245f savedata: Avoid Save memory concurrency 2025-01-02 05:04:54 -03:00
DanielSvoboda
8b66e9f78d GUI: Settings - Trophy Key (#2013)
* GUI: Settings-Trophy Key

* -

* QLineEdit::Password

* clang

* size
2025-01-02 09:15:08 +02:00
georgemoralis
4e0757ed55 Removed LLE libs (#2012)
* Removed LLE fiber, JpegEnc modules . HLE replacements are good enough

* fixup
2025-01-01 23:08:56 +02:00
Vladislav Mikhalin
46720e756b infra: more clarifications in issue templates (#2010) 2025-01-01 23:08:04 +03:00
psucien
40211642ca kernel: memory: PRT mapped area setter/getter 2025-01-01 21:04:59 +01:00
psucien
444016df7e Fix for trophy decryption (#2005)
* fix for trophy decryption

* more sanity checks

* switch back to strings for simplicity

* get rid of unnecessary span
2025-01-01 19:11:30 +01:00
kalaposfos13
15c9bb0e83 Motion controls (#1984)
* Initial motion controls

* Store sensor polling rate, and add more logging

* Revert commented out logging for testing purposes

* Code cleanup & clang

* New orientation handling

* clang
2025-01-01 20:05:22 +02:00
Stephen Miller
5631a31640 Fix flags (#1999) 2025-01-01 19:34:40 +02:00
polybiusproxy
a76e8f0211 clang-format 2025-01-01 13:21:00 +01:00
georgemoralis
283442b42f Storing encryption trophy key in config.toml (#1930)
* get trophy key from toml file

* clang format fix

* get trophy key from toml file

* clang format fix

* merge fixes

* Update config.cpp
2025-01-01 12:04:51 +02:00
psucien
d69341fd31 hot-fix: detiler: forgotten lut optimizations 2025-01-01 03:40:28 +01:00
oltolm
65cd3be4ca Qt: fix deprecation warnings (#1672) 2024-12-31 20:08:47 +02:00
psucien
174b5c0f95 kernel: equeue: added missing sceKernelDeleteHRTimerEvent 2024-12-31 17:24:56 +01:00
squidbus
48c51bd9ef audio: Accurate audio output timing. (#1986)
* audio: Accurate audio output timing.

* audio: Handle SDL audio queue stalls.

* audio: Format info cleanup.
2024-12-31 12:38:52 +02:00
squidbus
927dc6d95c vk_platform: Fix incorrect type for MVK debug flag. (#1993) 2024-12-31 12:38:30 +02:00
squidbus
f41829707d equeue: Fix regression from Filter type. (#1992) 2024-12-31 12:16:26 +02:00
Vladislav Mikhalin
052473e048 infra: emphasize the contact information (#1990) 2024-12-31 11:02:33 +02:00
squidbus
e1cf1f500d native_clock: Remove unused process code. (#1989) 2024-12-31 10:04:26 +02:00
squidbus
41d64a200d shader_recompiler: Add swizzle support for unsupported formats. (#1869)
* shader_recompiler: Add swizzle support for unsupported formats.

* renderer_vulkan: Rework MRT swizzles and add unsupported format swizzle support.

* shader_recompiler: Clean up swizzle handling and handle ImageRead storage swizzle.

* shader_recompiler: Fix type errors

* liverpool_to_vk: Remove redundant clear color swizzles.

* shader_recompiler: Reduce CompositeConstruct to constants where possible.

* shader_recompiler: Fix ImageRead/Write and StoreBufferFormatF32 types.

* amdgpu: Add a few more unsupported format remaps.
2024-12-31 06:14:47 +02:00
squidbus
284f473a52 shader_recompiler: Fix BitCount64 and FindILsb64 (#1978) 2024-12-31 06:10:29 +02:00
baggins183
62780e4e43 Initialize V0 to PrimitiveId in hull shader (#1985) 2024-12-31 06:00:52 +02:00
Stephen Miller
9091223396 Fix sceKernelGetEventFilter (#1987) 2024-12-31 05:59:14 +02:00
Vladislav Mikhalin
dd3f24614b infra: updated github issue templates 2024-12-29 21:13:19 +01:00
Nenkai
ac2e8c2602 gnmdriver: remove redundant EqEventType assert (#1975) 2024-12-29 19:15:04 +01:00
squidbus
38f1cc2652 renderer_vulkan: Render polygons using triangle fans. (#1969) 2024-12-29 12:30:37 +01:00
Quang Ngô
1bc27135e3 renderer_vulkan: fix deadlock when resizing the SDL window (#1860)
* renderer_vulkan: Fix deadlock when resizing the SDL window

* Address review comment
2024-12-29 13:22:35 +02:00
Vladislav Mikhalin
ee72d99947 ajm: added stubbed statistics instance (#1924)
* ajm: added stubbed statistics instance

* fixed a typo, thanks poly

* fixed clang-format

* removed unused struct

* small fixes

* fixed typedefs, added per codec statistics
2024-12-29 12:53:06 +02:00
TheTurtle
f09a95453e hot-fix: Correct queue id in dispatch indirect
I missed this
2024-12-29 12:48:45 +02:00
Mahmoud Adel
e952013fe0 add EventWrite and DispatchIndirect to ProcessCompute (#1948)
* add EventWrite and DispatchIndirect to ProcessCompute

helps Alienation go Ingame

* apply review changes

Co-authored-by: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com>

---------

Co-authored-by: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com>
2024-12-29 12:47:15 +02:00
squidbus
f8177902a5 cubeb_audio: Make sure COM is initialized on Windows. (#1958) 2024-12-29 12:46:59 +02:00
TheTurtle
4b2db61120 Update issue templates 2024-12-29 12:45:18 +02:00
squidbus
248220fef3 pthread: Change minimum stack for HLE to additional stack. (#1960) 2024-12-29 12:37:37 +02:00
baggins183
62c47cb1b7 recompiler: handle reads of output variables in hull shaders (#1962)
* Handle output control point reads in hull shader. Might need additional barriers

* output storage class
2024-12-29 12:37:15 +02:00
squidbus
da9e45b582 build: Update MoltenVK and fix missing add_dependencies for copy. (#1970)
* build: Fix missing add_dependencies for MoltenVK copy target.

* externals: Update MoltenVK
2024-12-29 12:36:41 +02:00
Quang Ngô
202c1046a1 Fix loading RenderDoc in offline mode for Linux (#1968) 2024-12-29 12:36:29 +02:00
Quang Ngô
468d7ea80e config: Don't load config in the Emulator class (#1965)
Allows overriding of configs in frontends.

Fix set fullscreen not working when specified in the CLI.
2024-12-29 12:36:16 +02:00
Quang Ngô
ab7e794f23 sdl: Limit minimum window size (#1966) 2024-12-29 12:35:52 +02:00
polyproxy
ee974414d2 hotfix: fix fiber initialization 2024-12-28 17:43:29 +01:00
polybiusproxy
851995d444 libraries/fiber: implement context switching (#1950) 2024-12-28 17:33:40 +01:00
tomboylover93
e8b0fdd6cc style: add Tokyo Night theme (#1811)
* style: add Tokyo Night theme

* clang-format: Update main_window_themes.h
2024-12-28 17:09:33 +02:00
Quang Ngô
a8b4e14bf5 Fix SDL version cannot launch game using game ID (#1650)
* Fix SDL version cannot launch game using game ID

Missing from https://github.com/shadps4-emu/shadPS4/pull/1507.

* Added --add-game-folder argument
Also added "treat the last argument as the game, if it isn't found already" option to the qt version

---------

Co-authored-by: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com>
2024-12-28 16:35:12 +02:00
rainmakerv2
8447d6ea1c Remove PS4 pro mode from GUI, can still be edited in from config file (#1871) 2024-12-28 14:30:26 +01:00
jas0n098
63d2d1ebe8 Handle RectList primitives in Geometry shaders (#1936) 2024-12-28 13:19:41 +02:00
DemoJameson
668d5f65dc Update zh_CN translation (#1946) 2024-12-28 13:19:16 +02:00
Quang Ngô
99e1e028c0 texture_cache: Don't read max ansio value if not aniso filter (#1942)
Fix Sonic Forces.
2024-12-28 13:18:56 +02:00
georgemoralis
f0352d2f7d Updated dev team (sorry frodo , the ring is yours) 2024-12-28 13:16:25 +02:00
georgemoralis
c8b704e4a3 Update README.md 2024-12-28 13:06:51 +02:00
georgemoralis
fc2fd9fd3c Update README.md with latest (not quite) addition to dev team 2024-12-28 13:05:53 +02:00
polybiusproxy
817a62468e core: better memory configuration (#1896) 2024-12-28 12:03:00 +01:00
mailwl
55f78a0b94 libraries: Add libSceMove HLE skeleton (#1945)
* libraries: Add libSceMove HLE skeleton

* Fix clang-format issue
2024-12-28 12:58:37 +02:00
DemoJameson
9aabe98e4e Fix a translation not working (#1947) 2024-12-28 11:49:44 +01:00
psucien
04933ac863 hot-fix: handle ASC ring wrap 2024-12-28 11:44:11 +01:00
Stephen Miller
122fe22a32 Implement IMAGE_GATHER4 and IMAGE_GATHER4_O (#1939)
* Implement IMAGE_GATHER4_O

Used by The Last of Us Remastered.

* Fix type on IMAGE_GATHER4_C_LZ

Had a different set of types compared to the other IMAGE_GATHER4 ops.

* IMAGE_GATHER4
2024-12-28 02:42:41 +02:00
squidbus
49ffb7b120 sdl_audio: Implement SetVolume and add more error checking. (#1935) 2024-12-28 00:07:16 +02:00
georgemoralis
3218c36b22 knack fixes by niko (#1933) 2024-12-27 23:03:03 +02:00
DanielSvoboda
abe85fd3e0 GUI: Fix TR Units - Size and Time - more... (#1927)
* GUI: TR Units - Size and Time

Added translation for these units:
B, KB, MB, GB, TB
h, m, s

Added missing text:
Games: - text in the lower left corner
Compatibility...
Update database
View report
Submit a report

Fixed the size of the settings menu

* Audio Backend

* Fixed the size of the settings menu
2024-12-27 22:23:11 +02:00
squidbus
f4c1d827d5 build: Do not generate files in source. (#1929) 2024-12-27 22:20:30 +02:00
squidbus
115aa61d04 build: Fix MoltenVK bundling copy. (#1928) 2024-12-27 22:10:16 +02:00
squidbus
333f35ef25 audio: Implement cubeb audio out backend. (#1895)
* audio: Implement cubeb audio out backend.

* cubeb_audio: Add some additional safety checks.

* cubeb_audio: Add debug logging callback.

* audioout: Refactor backend ports into class.

* pthread: Bump minimum stack size to fix cubeb crash.

* cubeb_audio: Replace output yield loop with condvar.

* common: Rename ring_buffer_base to RingBuffer.
2024-12-27 21:04:49 +02:00
Nenkai
f95803664b equeue: sceGnmGetEqEventType/sceKernelGetEventData impl (#1839) 2024-12-27 20:33:45 +02:00
Martin
e40ede5db2 Update nb translation (#1904)
* add more translations and make more consistent nb

* typo and make easier to read

* fix wording
2024-12-27 16:51:23 +02:00
Yury
ff4d37cbc8 Update russian translation for 0.5.0 (#1903) 2024-12-27 16:50:46 +02:00
Quang Ngô
0351b864d0 texture_cache: Enable anisotropic filtering (#1872) 2024-12-27 16:47:26 +02:00
squidbus
a86ee7e7f5 vk_platform: Enable MoltenVK debug if crash diagnostics is enabled. (#1887)
* vk_platform: Enable MoltenVK debug if crash diagnostics is enabled.

* build: Make sure MoltenVK gets re-bundled when changed.
2024-12-27 16:46:31 +02:00
squidbus
b1f74660df shader_recompiler: Implement S_BCNT1_I32_B64 and S_FF1_I32_B64 (#1889)
* shader_recompiler: Implement S_BCNT1_I32_B64

* shader_recompiler: Implement S_FF1_I32_B64

* shader_recompiler: Implement IEqual for 64-bit.

* shader_recompiler: Fix immediate type in S_FF1_I32_B32
2024-12-27 16:46:07 +02:00
mailwl
1c5947d93b Load HLE library if native library can't be loaded (#1899) 2024-12-27 16:44:57 +02:00
¥IGA
cf84c46a49 Fix for D32Sfloat and R8Snorm Tiled image (#1898)
* Fix for D32Sfloat Tiled image

* Fix for R8Snorm Tiled image
2024-12-27 16:43:44 +02:00
mailwl
0677d7a214 Avoid to access invalid iterator (#1892) 2024-12-27 16:43:10 +02:00
DanielSvoboda
9b8de8d320 Fix TR (#1897) 2024-12-27 13:54:31 +02:00
bigol83
4e8b8887df Fix typo (#1918) 2024-12-27 13:53:58 +02:00
f8ith
5dd1e7c32e settings-dialog: use grid layout (#1920) 2024-12-27 13:53:41 +02:00
Vinicius Rangel
edc027a8bc Devtools IV (#1910)
* devtools: fix popen in non-windows environment

* devtools: fix frame crash assertion when hidden

* devtools: add search to shader list

* devtools: add copy name to shader list

* devtools: frame dump: search by shader name
2024-12-26 23:08:47 +02:00
IndecisiveTurtle
0bb1c05aff hot-fix: Drop key
* Caution is best
2024-12-26 17:41:40 +02:00
Daniel R.
cbb13fa39b hotfix: fix incorrect appcontent available space size 2024-12-26 13:18:53 +01:00
Mohsen
91d4044162 Translated most of the remaining texts into Persian (fa_IR.ts) and fixed incorrect translations (#1885) 2024-12-26 13:01:31 +01:00
F1219R
e885088632 Update sq translation (#1893) 2024-12-26 12:58:42 +01:00
bigol83
ba9273d1cc Update it.ts (#1894)
Add missing translation and fixed some typos
2024-12-26 12:53:20 +01:00
rafael-57
5f9abd1db4 Add info for QT Multimedia (#1886)
QT Multimedia is mandatory for building on Windows, and it's not mentioned in the guide.
2024-12-26 01:55:15 +02:00
DanielSvoboda
0939082aca Fix button changelog (#1882) 2024-12-25 23:58:19 +02:00
georgemoralis
3a1a3fc75e 0.5.1 WIP started 2024-12-25 22:42:49 +02:00
georgemoralis
a1a98966ee retagged 0.5.0 2024-12-25 22:35:00 +02:00
georgemoralis
195929953b tagged 0.5.0 2024-12-25 22:08:43 +02:00
DanielSvoboda
3d0d1a26df Add missing translations (#1879)
* Add missing translations

* +
2024-12-25 22:05:36 +02:00
¥IGA
3ab118837a Fix for D16Unorm Tiled image (#1863) 2024-12-25 16:06:12 +02:00
squidbus
3c111202e1 renderer_vulkan: Make sure at least one viewport is set (#1859) 2024-12-25 16:05:51 +02:00
Marcin Mikołajczyk
db43c601fc README: mention alternative key mappings on Mac (#1876)
Co-authored-by: Marcin Mikolajczyk <github@mikolajczyk.dev>
2024-12-25 16:05:15 +02:00
f8ith
d55e41a19e compatibility_data: Added compatibility related settings to GUI (#1855)
* compatibility_data: added compatibility related settings to gui
* New game compatibility section in settings dialog
* Context menu now has a compatibility section
* Adjusted minimum size of updater section to 265

* update translations

* revert to deprecated statechanged

* fix display compatibility data option
2024-12-25 09:30:09 +02:00
squidbus
a89c29c2ca shader_recompiler: Rework image read/write emit. (#1819) 2024-12-25 01:13:32 +02:00
squidbus
95638d5ca5 exception: Fix raising exceptions on POSIX systems (#1868) 2024-12-25 00:21:32 +02:00
squidbus
6d728ec7ed renderer_vulkan: Enable LDS barriers for MoltenVK (#1866) 2024-12-24 23:03:04 +02:00
IndecisiveTurtle
7b24b42711 data_share: Emit barrier before reads
* Fixes artifacts in TLG when using NVIDIA gpus. When LDS is written and read in the same basic block, the barrier pass wont handle it properly, so insert a barrier before reads
2024-12-24 16:04:30 +02:00
IndecisiveTurtle
8f7eb2d0e9 semaphore: Attempt to acquire before checking timeout
* The posix specification says that if the object can be acquired immediately, timeout doesnt matter
2024-12-24 15:39:17 +02:00
Daniel R.
c284cf72e1 Switch remaining CRLF terminated files to LF 2024-12-24 13:56:31 +01:00
Daniel R.
2c0f986c52 core/libraries: HLE fiber reimplementation (#1836) 2024-12-24 13:33:00 +01:00
squidbus
0a4453b912 renderer_vulkan: Simplify depth pipeline state and move stencil to dynamic state. (#1854)
* renderer_vulkan: Simplify depth pipeline state and move stencil to dynamic state.

* Change graphics key depth-stencil flags to bitfields.
2024-12-24 13:45:11 +02:00
TheTurtle
092d42e981 renderer_vulkan: Implement rectlist emulation with tessellation (#1857)
* renderer_vulkan: Implement rectlist emulation with tessellation

* clang format

* renderer_vulkan: Use tessellation for quad primitive as well

* vk_rasterizer: Handle viewport enable flags

* review

* shader_recompiler: Fix quad/rect list FS passthrough semantics.

* spirv: Bump to 1.5

* remove pragma

---------

Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
2024-12-24 13:28:47 +02:00
psucien
c2e9c877dd hot-fix: missing fce barrier 2024-12-23 18:20:37 +01:00
Quang Ngô
400da1aa8d Handle swapchain recreation (#1830) 2024-12-23 16:21:48 +02:00
Emulator-Team-2
94f861588d added B5G6R5UnormPack16 format (#1856) 2024-12-23 15:52:29 +02:00
DanielSvoboda
dfdd819e3e Fix AutoUpdate Issue with Non-Latin Usernames/Directories (#1853)
* Fix updater for non-Latin user directories

* QStandardPaths
2024-12-23 09:29:30 +02:00
psucien
43fd8fa44a hot-fix: macos release build 2024-12-22 23:11:16 +01:00
psucien
2dc5755799 build: exclude Tracy from release builds 2024-12-22 22:51:48 +01:00
psucien
8abc43a03d texture_cache: 32bpp and 64bpp macro detilers (#1852)
* added 32bpp macro detiler

* added 64bpp macro detiler

* consider 3d depth alignment in size calculations
2024-12-22 19:43:44 +01:00
Vladislav Mikhalin
7fe4df85ab Clear color attachment if FCE was invoked before any draws (#1851)
* Clear RT if FCE was invoked before any draws

Co-authored-by: psucien <bad_cast@protonmail.com>

* address review comments

---------

Co-authored-by: psucien <bad_cast@protonmail.com>
2024-12-22 18:12:43 +01:00
setepenre
8a409d86d4 post-processing: rework gamma correction (#1756) 2024-12-22 16:18:07 +01:00
squidbus
ab5240d8d2 qt: Do not run emulator on separate thread on Mac. (#1849) 2024-12-22 16:31:59 +02:00
squidbus
14dc136832 renderer_vulkan: Various attachment cleanup and fixes. (#1795) 2024-12-22 16:08:48 +02:00
Quang Ngô
aba2b29074 gui: start the emulator in new thread (#1829) 2024-12-22 15:47:28 +02:00
rainmakerv2
433d9459e0 Disable trophy pop-up with config setting (#1834) 2024-12-22 15:46:45 +02:00
TheTurtle
5eebb04de9 vk_rasterizer: hot fix 2024-12-22 15:31:10 +02:00
squidbus
fac21a5362 audio: Move port logic out of SDL backend and define backend interface. (#1848) 2024-12-22 11:46:28 +02:00
f8ith
0931802151 compatibility_data: various fixes (#1847)
* temporarily disable status column + various fixes

* add configuration option to enable compatibility data

* clang format
2024-12-22 11:05:44 +02:00
TheTurtle
fb2c035c05 vk_rasterizer: Fix stencil clears (#1840) 2024-12-22 02:49:42 +02:00
squidbus
7e890def48 fs: Return nullptr when file descriptor is out of bounds. (#1842) 2024-12-22 02:49:34 +02:00
Martin
08182f814f Disable userfaultfd again by making it opt-in (#1777)
* Disable userfaultfd again

* Let userfd be be opt-in instead of disabled
2024-12-22 02:49:12 +02:00
Daniel R.
8d8bb05055 renderer_vulkan: add support for Polygon draws (#1798) 2024-12-21 10:20:24 +01:00
alvinkim101
39fed1f469 Fix splash assert (#1832) 2024-12-20 19:27:27 +01:00
Alessandro Ampala
953fb14638 Fix update on windows when path contains powershell wildcards (#1391) (#1779)
* Fix update process on windows when there are some powershell wildcards in the installation path. (#1391)

* Fix coding style error. (#1391)
2024-12-19 10:59:26 +02:00
f8ith
f2a989b9da wip: added status column for compat data (#1668)
* wip: added basic gui for compat data

* data is currently pulled directly from github API, awaiting server infra

* removed unused initalizer

* fixes

* fix cmake

* wip: add some testing date / version

* add tooltip

* fix nested QJsonObject

* fix tooltip color

* fix clang-format

* Edit style

* Add clickable status

* formatting

* import order

* typo

* fix clang format 2

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2024-12-19 10:58:11 +02:00
georgemoralis
b0b74243af clang-fix 2024-12-19 10:25:03 +02:00
TheTurtle
188eebb92a ir: Add heuristic based LDS barrier pass (#1801)
* ir: Add heuristic based LDS barrier pass

* Attempts to insert barriers after zero-depth divergant conditional blocks in shaders that use shared memory

* lds_barriers: Limit to nvidia

* Intel has historically had problems with cs barriers, will debug other time
2024-12-19 10:18:28 +02:00
TheTurtle
adf4b635f7 hot-fix: Proper abi on init_routine 2024-12-18 22:11:09 +02:00
Mahmoud Adel
1e08099036 add R8Uint in image Detiling (#1812)
used by InFamous, and maybe other games
2024-12-18 22:06:30 +02:00
Stephen Miller
32435674f2 Misc UE4 fixes (#1821)
* Add ExecLo case to S_SAVEEXEC_B64

Seen in CUSA38209

* S_BCNT1_I32_B32

Turtle said our implementation of S_BCNT1_I32_B64 was meant to be for S_BCNT1_I32_B32, so renaming the opcode is the fix.
2024-12-18 22:05:35 +02:00
Marcin Mikołajczyk
b1b4c8c487 Handle setting Vcc in Translator::SetDst64 (#1826) 2024-12-18 21:57:58 +02:00
Marcin Mikołajczyk
be4c38bf1c Handle 32bit int ImageFormat (#1823) 2024-12-18 21:48:00 +02:00
squidbus
ccfb1bbfa8 vk_instance: Add additional fallback for missing D16UnormS8Uint. (#1810) 2024-12-18 07:56:08 +02:00
squidbus
87773a417b mac: Choose whether system Vulkan is needed at runtime. (#1780) 2024-12-17 15:04:19 +02:00
ElBread3
aa5c1c10df More Fixes for Separate Update (#1487)
* handle getdents + fix condition + add info to description

* fix not handling dents errors

* to not overwrite it, only gather separate update entries when normal folder is done

* fix always setting entries to 0 and guest name including "UPDATE"

* reset indexes on completion

* don't use concat, fixes long standing bug

* make sce_module module loading take both paths into account
2024-12-17 12:42:21 +02:00
squidbus
3c8e25e8e4 fs: Fix wrong mounts being matched by partial guest path. (#1809) 2024-12-17 12:34:43 +02:00
Richard Habitzreuter
5585e42677 style: add rounded borders and focus color styling to the search bar (#1804) 2024-12-17 12:32:30 +02:00
squidbus
8a4e03228a spirv_emit_context: Prevent double-add of GS in attributes to interface. (#1800) 2024-12-16 02:11:15 +02:00
psucien
e7c4ffe032 hot-fix: Tracy operation restored; memory leak fix as a bonus 2024-12-15 20:53:29 +01:00
DanielSvoboda
3001b007f6 Keybord on README / Fix Play Time (#1786)
* Keybord on README F10_F11_F12

* Update game_list_frame.cpp
2024-12-15 16:30:53 +02:00
baggins183
9aa1c13c7e Fix some compiler problems with ds3 (#1793)
- Implement S_CMOVK_I32
- Handle Isoline abstract patch type
2024-12-15 16:30:19 +02:00
Richard Habitzreuter
d2ac92481b style: add Gruvbox theme (#1796) 2024-12-15 16:28:36 +02:00
psucien
0fd1ab674b GPU processor refactoring (#1787)
* coroutine code prettification

* asc queues submission refactoring

* better asc ring context handling

* final touches and review notes

* even more simplification for context saving
2024-12-15 00:54:46 +02:00
Connor Garey
af26c945b1 Fix for "shadPS4" not being given on Linux volume mixers (#1789) 2024-12-14 23:30:17 +01:00
Vladislav Mikhalin
876445faf1 recompiler: emit a label right after s_branch to prevent dead code interferrence (#1785) 2024-12-14 22:46:55 +02:00
squidbus
f93677b953 resource_tracking_pass: Fix converting dimensions to float for normalization. (#1790) 2024-12-14 22:46:35 +02:00
squidbus
8b88344679 vk_instance: Remove unused dynamic state 2 features struct (#1791) 2024-12-14 22:46:19 +02:00
TheTurtle
e9ede8d627 Revert "DmaData and Recompiler fixes (#1775)" (#1784)
This reverts commit cafd40f2c2.
2024-12-14 16:17:14 +02:00
squidbus
27447537c3 externals: Update sirit to fix debug assert (#1783) 2024-12-14 16:12:41 +02:00
squidbus
e752f04cde shader_recompiler: Fixups from stencil changes (#1776) 2024-12-14 14:33:24 +02:00
Vladislav Mikhalin
cafd40f2c2 DmaData and Recompiler fixes (#1775)
* liverpool: fix dmadata packet handling

* recompiler: emit a label right after s_branch to prevent dead code interferrence

* specialize barriers
2024-12-14 14:33:06 +02:00
baggins183
3c0c921ef5 Tessellation (#1528)
* shader_recompiler: Tessellation WIP

* fix compiler errors after merge

DONT MERGE set log file to /dev/null

DONT MERGE linux pthread bb fix

save work

DONT MERGE dump ir

save more work

fix mistake with ES shader

skip list

add input patch control points dynamic state

random stuff

* WIP Tessellation partial implementation. Squash commits

* test: make local/tcs use attr arrays

* attr arrays in TCS/TES

* dont define empty attr arrays

* switch to special opcodes for tess tcs/tes reads and tcs writes

* impl tcs/tes read attr insts

* rebase fix

* save some work

* save work probably broken and slow

* put Vertex LogicalStage after TCS and TES to fix bindings

* more refactors

* refactor pattern matching and optimize modulos (disabled)

* enable modulo opt

* copyright

* rebase fixes

* remove some prints

* remove some stuff

* Add TCS/TES support for shader patching and use LogicalStage

* refactor and handle wider DS instructions

* get rid of GetAttributes for special tess constants reads. Immediately replace some upon seeing readconstbuffer. Gets rid of some extra passes over IR

* stop relying on GNMX HsConstants struct. Change runtime_info.hs_info and some regs

* delete some more stuff

* update comments for current implementation

* some cleanup

* uint error

* more cleanup

* remove patch control points dynamic state (because runtime_info already depends on it)

* fix potential problem with determining passthrough

---------

Co-authored-by: IndecisiveTurtle <47210458+raphaelthegreat@users.noreply.github.com>
2024-12-14 12:56:17 +02:00
squidbus
3e22622508 renderer_vulkan: Remove some fallbacks and misc format queries that are no longer needed. (#1773) 2024-12-14 12:04:30 +02:00
squidbus
8caca4df32 shader_recompiler: Support VK_AMD_shader_image_load_store_lod for IMAGE_STORE_MIP (#1770)
* shader_recompiler: Support VK_AMD_shader_image_load_store_lod for IMAGE_STORE_MIP

* emit_spirv: Fix missing extension declaration.
2024-12-14 12:03:42 +02:00
squidbus
40e8a40ada externals: Add MoltenVK as an external. (#1767) 2024-12-14 10:20:04 +02:00
rainmakerv2
a57ccf9112 Save main window together with config to avoid rare crash (#1772) 2024-12-14 10:18:34 +02:00
Alexandre Bouvier
32556ad0d8 cmake: fix double alias (#1771) 2024-12-14 10:18:05 +02:00
rainmakerv2
8bb1e8fcdb Resize trophy pop up windows based on window size (#1769) 2024-12-14 10:17:00 +02:00
Diego Cea López
715ac8a279 vk_shader_hle: Don't alter the order of the skipped copies. (#1757)
* vk_shader_hle: Don't alter the order of the skipped copies.

* Simplification.

* Format.

* More simplification.
2024-12-14 00:27:09 +02:00
squidbus
f1c23d514b shader_recompiler: Implement FREXP instructions. (#1766) 2024-12-13 21:51:39 +02:00
TheTurtle
722a0e36be graphics: Improve handling of color buffer and storage image swizzles (#1763)
* liverpool_to_vk: Remove wrong component swap formats

* shader_recompiler: Handle storage and buffer format swizzles

* shader_recompiler: Skip unsupported depth export

* image_view: Remove image format swizzle

* Platform support is not always guaranteed
2024-12-13 21:49:37 +02:00
squidbus
028be3ba5d shader_recompiler: Emulate unnormalized sampler coordinates in shader. (#1762)
* shader_recompiler: Emulate unnormalized sampler coordinates in shader.

* Address review comments.
2024-12-13 21:49:07 +02:00
MajorP93
306279901f ci: Use link-time optimization for building (#1636)
* ci: Use link-time optimization for building

* cmake: Set CMP0069 policy to new for external dependencies
* This enables LTO also when building external dependencies that do not
  handle CMP0069 in their CMake scripts.
2024-12-13 18:30:16 +02:00
TheTurtle
cfbd869126 texture_cache: Improve support for stencil reads (#1758)
* texture_cache: Improve support for stencil reads

* libraries: Supress some spammy logs

* core: Support loading font libraries

* texture_cache: Remove assert
2024-12-13 18:28:19 +02:00
TheTurtle
8acefd25e7 hot-fix the hot-fix 2024-12-13 18:26:16 +02:00
TheTurtle
bab00dbca8 kernel: Fix module finding
Patch by Elbread
2024-12-13 18:23:01 +02:00
rainmakerv2
f587931ed3 Fix for adding game folders (#1761)
Co-authored-by: rainmakerv2 <30595646+jpau02@users.noreply.github.com>
2024-12-13 09:52:54 +02:00
rainmakerv2
91d57e830b Fix lowercase filenames fox Linux (#1760)
Fix uppercase config filenames

Co-authored-by: rainmakerv2 <30595646+jpau02@users.noreply.github.com>
2024-12-13 08:27:36 +02:00
TheTurtle
5be807fc8a hot-fix: Fix order of operands 2024-12-13 00:31:49 +02:00
rainmakerv2
3f1061de56 Resubmit - Prevent settings from being saved when close button is pressed instead of save (#1747)
* Do not save settings when close button pressed instead of save

* Update src/common/config.h

Co-authored-by: TheTurtle <geoster3d@gmail.com>

* Revert "Update src/common/config.h"

This reverts commit 125303ea86.

---------

Co-authored-by: rainmakerv2 <30595646+jpau02@users.noreply.github.com>
Co-authored-by: TheTurtle <geoster3d@gmail.com>
2024-12-12 22:46:31 +02:00
georgemoralis
2a19d915e8 fix for detecting more that 2 players and play both with player 1 keys (#1750) 2024-12-12 22:46:20 +02:00
Diego Cea López
1e3d034f96 Fix HLE buffer copy not executed when there's only 1 copy. (#1754) 2024-12-12 22:45:56 +02:00
squidbus
ec8e5d5ef1 renderer_vulkan: Fix some color attachment indexing issues. (#1755) 2024-12-12 20:45:18 +02:00
Osyotr
7aa868562c video_core: add eR5G5B5A1UnormPack16 support to the detiler (#1741) 2024-12-12 15:45:59 +02:00
squidbus
3d1e332c6f renderer_vulkan: Disable culling for RectList. (#1749) 2024-12-12 11:05:59 +02:00
squidbus
5789d1a5fb playgo: Lower scePlayGoGetLocus log to debug. (#1748) 2024-12-12 09:47:07 +02:00
TheTurtle
7f4265834a hot-fix: Fix race in rwlock
Resetting the owner should be before the lock is unlocked, otherwise a waiter might lock and set a new owner before its reset.
2024-12-12 03:33:49 +02:00
squidbus
714605c6a7 renderer_vulkan: Require exact image format for resolve pass. (#1742) 2024-12-11 21:51:39 +01:00
TheTurtle
0a9c437ec8 hot-fix: Enforce minimum stack size of 64KB
Fixes some crashes in BB from unity pt 1
2024-12-11 21:17:55 +02:00
Daniel R.
b82993c568 core/kernel: implement condvar signalto 2024-12-11 20:12:35 +01:00
slick-daddy
0211b7e38e Minor Translation Fixes (#1691)
* Update tr_TR.ts

Minor translation fixes. Mainly contains capitalization and small changes.

* Update tr_TR.ts
2024-12-11 21:11:34 +02:00
squidbus
14f7dc3527 cache: Invalidate pages for file reads. (#1726)
* cache: Invalidate pages for file reads.

* texture_cache: Simplify invalidate intersection check.

* vk_rasterizer: Make aware of mapped memory ranges.

* buffer_cache: Remove redundant page calculations.

Called functions will convert to page numbers/addresses themselves.

* file_system: Simplify memory invalidation and add a few missed cases.
2024-12-11 21:11:24 +02:00
squidbus
e612e881ac renderer_vulkan: Bind null color attachments when target is masked out. (#1740)
* renderer_vulkan: Bind null color attachments when target is masked out.

* Simplify setting null color attachment
2024-12-11 21:10:40 +02:00
¥IGA
8db1beaec6 Displays FPS before frame latency (#1736) 2024-12-11 19:44:18 +01:00
Daniel R.
2a953391ef liverpool: implement Rewind and IndirectBuffer packets 2024-12-11 19:40:45 +01:00
¥IGA
51bf98a7b5 Fix for R4G4B4A4UnormPack16 Tiled image (#1738) 2024-12-11 16:07:33 +02:00
rainmakerv2
14c2be8c67 Add default value for Separate Update Folder (#1735)
Co-authored-by: rainmakerv2 <30595646+jpau02@users.noreply.github.com>
2024-12-11 14:57:11 +02:00
¥IGA
e36c4d5f75 Displays "Never Played" if the game has never been played (#1697)
* Displays "Never Played" if the game has never been played

* Update nb.ts + pt_BR.ts
2024-12-10 22:16:16 +02:00
Martin
b8a443c728 Fix compiling due to typedefs varying across platforms (#1729)
* Fix compiling on modern C++ compilers

cd9fc5d0e9 broke it

* Fix order

* Test

* Test putting flags in old order

* Remove designated initializer
2024-12-10 22:15:43 +02:00
DanielSvoboda
ea8ad35947 Fix delete cheats button (#1731) 2024-12-10 18:57:30 +02:00
DanielSvoboda
00543fe640 Remove game from list after deletion (#1730) 2024-12-10 15:40:54 +02:00
squidbus
e5e1aba241 renderer_vulkan: Introduce shader HLE system with copy shader implementation. (#1683)
* renderer_vulkan: Introduce shader HLE system with copy shader implementation.

Co-authored-by: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com>

* buffer_cache: Handle obtaining buffer views partially within buffers.

* vk_shader_hle: Make more efficient

---------

Co-authored-by: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com>
2024-12-10 14:44:08 +02:00
squidbus
41fd1c84cf semaphore: Use handles to properly handle semaphore double-delete. (#1728) 2024-12-10 14:43:32 +02:00
squidbus
bf41ab6c40 memory: Handle 0 alignment in MemoryManager::Allocate (#1692) 2024-12-10 13:13:34 +02:00
DanielSvoboda
aa5293e3ad Delete Patches Button (#1722) 2024-12-10 13:12:58 +02:00
squidbus
cd9fc5d0e9 thread: Apply alternate signal stack to created threads. (#1724) 2024-12-10 13:08:53 +02:00
Vinicius Rangel
f1b23c616e Devtools - Shader editing (#1705)
* devtools: shader editing and compiling

* devtools: patch shader at runtime

* devtools: shader editing load patch even with config disabled
2024-12-09 21:11:11 +01:00
Martin
f623613d12 Update nb translations (#1712)
* update nb_NO.ts

* small grammar changes

* revert to nb.ts
2024-12-09 18:53:25 +02:00
DanielSvoboda
07f451650f Help - improvement (#1522)
* Help - improvement

* Adding shadow below icons

* Adding keys icon + Update changelog

* color according to the selected theme

* submenu 'Keys and Shortcuts'

* clang

* +

* remove keys_shortcuts

---------

Co-authored-by: ¥IGA <164882787+Xphalnos@users.noreply.github.com>
2024-12-09 18:47:26 +02:00
squidbus
0b59ebb22f shader_recompiler: Implement S_ABS_I32 (#1713) 2024-12-09 12:12:33 +01:00
squidbus
f347d3df18 image_view: Correct view format for D16Unorm images as well. (#1708) 2024-12-08 21:53:29 +01:00
Stephen Miller
f938829f12 Implement sceGnmDingDongForWorkload (#1707)
Seen in Final Fantasy XV.
2024-12-08 22:04:33 +02:00
Daniel R.
fea2593ab4 The way to Unity, pt.3 (#1681) 2024-12-08 18:30:33 +02:00
Daniel R.
1793fd4df0 format 2024-12-08 16:05:36 +01:00
Daniel R.
a88850fec6 video_core/amdgpu: fix calculation of lod range 2024-12-08 16:02:38 +01:00
Daniel R.
0b672a08ac video_core: improve image cube heuristic 2024-12-08 15:57:51 +01:00
¥IGA
4fb2247196 Better title bar for Cheats/Patches menu (#1696) 2024-12-08 10:20:24 +02:00
squidbus
71a82199ed shader_recompiler: Fix check for fragment depth store. (#1694) 2024-12-08 10:20:05 +02:00
squidbus
7d546f32d8 image_view: Add more BGRA storage format swizzles. (#1693) 2024-12-08 10:19:39 +02:00
auser1337
1940ac0fec ajm: support for multiple contexts (#1690)
* ajm: support for multiple contexts

* fix sceAjmInitialize
2024-12-08 10:18:12 +02:00
Ada Ahmed
dad5953e8c fix: fix #1457 again by moving av_err2str to a common header (#1688) 2024-12-08 00:52:03 +02:00
TheTurtle
8ee672fe32 hot-fix: Allow unpriviledged userfaultfd 2024-12-08 00:10:20 +02:00
IndecisiveTurtle
cde84e4bac shader_recompiler: Fix mistake 2024-12-07 23:45:23 +02:00
psucien
119e03cb58 hot-fix: fix for incorrect asc qid 2024-12-07 22:28:31 +01:00
squidbus
c076ba69e8 shader_recompiler: Implement V_LSHL_B64 for immediate arguments. (#1674) 2024-12-07 23:28:17 +02:00
¥IGA
57e762468f Fix + documentation update (#1689) 2024-12-07 23:27:57 +02:00
¥IGA
2266622dcf Support for Vulkan 1.4 (#1665) 2024-12-07 19:41:41 +02:00
psucien
941a668f78 hot-fix: obtain cmdbuf for dispatches after cache ops
This fixes cmdbuf being in incorrect state after scheduler rotation on flush
2024-12-07 10:30:36 +01:00
Daniel R.
9524f94749 hotfix: add missing include 2024-12-07 10:07:14 +01:00
Daniel R.
6f543b5bd9 hotfix: enable discord RPC 2024-12-07 09:48:12 +01:00
Vladislav Mikhalin
8eacb88a86 recompiler: fixed fragment shader built-in attribute access (#1676)
* recompiler: fixed fragment shader built-in attribute access

* handle en/addr separately

* handle other registers as well
2024-12-07 01:20:09 +02:00
squidbus
e1ecfb8dd1 semaphore: Add GCD semaphore implementation. (#1677) 2024-12-06 23:46:44 +02:00
Daniel R.
7ffa581d4b The way to Unity, pt.2 (#1671) 2024-12-06 22:04:36 +01:00
IndecisiveTurtle
357b7829c3 hot-fix: Silence depth macrotiled warning 2024-12-06 21:50:25 +02:00
IndecisiveTurtle
6acfdd5e33 buffer_cache: Bump usable address space to 40bits
* Fixes crashes in games that use the upper region of user area
2024-12-06 20:00:21 +02:00
TheTurtle
9e618c0e0c video_core: Add multipler to handle special cases of texture buffer stride mismatch (#1640)
* page_manager: Enable userfaultfd by default

* Much faster than page faults and causes less problems

* shader_recompiler: Add texel buffer multiplier

* Fixes format mismatch assert when vsharp stride is multiple of format stride

* shader_recompiler: Specialize UBOs on size

* Some games can perform manual vertex pulling and thus bind read only buffers of varying size. We only recompile when the vsharp size is larger than size in shader, in opposite case its not needed

* clang format
2024-12-06 19:54:59 +02:00
squidbus
d05846a327 specialization: Fix fetch shader field type (#1675) 2024-12-06 12:59:55 +02:00
squidbus
17abbcd74d misc: Fix clang format (#1673) 2024-12-06 02:21:35 +02:00
IndecisiveTurtle
77da8bac00 core: Return proper address of eh frame/add more opcodes 2024-12-06 00:47:11 +02:00
TheTurtle
22a2741ea0 shader_recompilers: Improvements to SSA phi generation and lane instruction elimination (#1667)
* shader_recompiler: Add use tracking for Insts

* ssa_rewrite: Recursively remove phis

* ssa_rewrite: Correct recursive trivial phi elimination

* ir: Improve read lane folding pass

* control_flow: Avoid adding unnecessary divergant blocks

* clang format

* externals: Update ext-boost

---------

Co-authored-by: Frodo Baggins <baggins31084@proton.me>
2024-12-05 23:14:16 +02:00
Alexandre Bouvier
874508f8c2 cmake: unbundle stb (#1601) 2024-12-05 23:10:27 +02:00
Marcin Mikołajczyk
642dedea8c Handle INDIRECT_BUFFER_CONST in ProcessCeUpdate (#1613) 2024-12-05 23:09:59 +02:00
Richard Habitzreuter
7fbe15de28 Missing dependency on building-windows.md (#1658)
* Missing dependency on building-windows.md

* Update building-windows.md
2024-12-05 23:09:43 +02:00
psucien
37f4bad2b7 video_core: fix for targets clears and copies (#1670) 2024-12-05 23:09:22 +02:00
Daniel R.
15ae7a094d hotfix: fix inverted operator on GetDents 2024-12-05 18:45:55 +01:00
Daniel R.
98f0cb65d7 The way to Unity, pt.1 (#1659) 2024-12-05 17:21:35 +01:00
Vinicius Rangel
2380f2f9c9 Virtual device abstraction (#1577)
* IOFile: removes seek limit checks when file is writable

* add virtual devices scaffold

* add stdin/out/err as virtual devices

* fixed some merging issues

* clang-fix

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2024-12-05 18:00:17 +02:00
squidbus
c019b54fec thread: Configure stack and guard on POSIX hosts. (#1664) 2024-12-04 20:21:03 +02:00
squidbus
920acb8d8b renderer_vulkan: Parse fetch shader per-pipeline (#1656)
* shader_recompiler: Read image format info directly from sharps instead of storing in shader info.

* renderer_vulkan: Parse fetch shader per-pipeline

* Few minor fixes.

* shader_recompiler: Specialize on vertex attribute number types.

* shader_recompiler: Move GetDrawOffsets to fetch shader
2024-12-04 13:03:47 +02:00
squidbus
74b091fd08 renderer_vulkan: Add support for indexed QuadList draw. (#1661) 2024-12-04 10:15:58 +01:00
TheTurtle
6bf93071cf hot-fix: Correct getpagesize
Tested on my PS4 pro, returns 16KB instead of 4KB
2024-12-03 14:15:08 +02:00
georgemoralis
c66db95378 Misc Ime fixes continue (#1655)
* core/libraries: Misc. Ime fixes

* fixed issues

---------

Co-authored-by: Daniel R <47796739+polybiusproxy@users.noreply.github.com>
2024-12-03 10:05:51 +02:00
psucien
f0b75289c8 video_core: few detiler formats added 2024-12-02 22:24:54 +01:00
TheTurtle
eb844b9b63 shader_recompiler: Implement manual barycentric interpolation path (#1644)
* shader_recompiler: Implement manual barycentric interpolation path

* clang format

* emit_spirv: Fix typo

* emit_spirv: Simplify variable definition

* spirv_emit: clang format
2024-12-02 23:20:54 +02:00
squidbus
fda4f06518 devtools: More warning fixes (#1652) 2024-12-02 20:46:51 +01:00
Alexandre Bouvier
3dc0f6d831 cmake: fix build (#1645) 2024-12-02 05:04:44 +02:00
Vinicius Rangel
0835dc71b3 More devtools stuff (#1637)
* devtools: memory map viewer

* devtools: batch highlight only for non-group viewer

* devtools: fix not showing entire user data

* devtools: shader debug viewer

* devtools: add more reg naming
2024-12-01 19:34:29 +01:00
psucien
f658fc58d1 Merge pull request #1630 from vladmikhalin/fix-missing-rts
Fixed incorrectly skipped RTs
2024-12-01 16:47:25 +01:00
psucien
4a5850628e hot-fix: debug build fixed 2024-12-01 15:46:08 +01:00
squidbus
b00a321b5e playgo: Fix loading PlayGo file. (#1639) 2024-12-01 14:12:04 +02:00
squidbus
394a14626b libraries: Add stubs for libScePlayGoDialog (#1635) 2024-12-01 13:44:15 +02:00
Alexandre Bouvier
4ebb90c774 cmake: hot fixes (#1638) 2024-12-01 11:16:01 +02:00
Alexandre Bouvier
5f4d03172f cmake: unbundle libpng (#1576) 2024-11-30 22:39:51 +02:00
Jamie Tong
b0860d6e8c implement DS_AND_B32, DS_OR_B32, DS_XOR_B32 (#1593)
* implement DS_OR_B32

* implement DS_AND_B32, DS_XOR_B32
2024-11-30 22:39:11 +02:00
TheTurtle
5b6e0ab238 core: Library cleanup (#1631)
* core: Split error codes into separate files

* Reduces build times and is cleaner

* core: Bring structs and enums to codebase style

* core: More style changes
2024-11-30 22:37:36 +02:00
squidbus
3d0aacd43d ci: Limit build parallelism to number of processors. (#1632) 2024-11-30 22:24:32 +02:00
squidbus
7153838c4e libraries: Add initial HLE JPEG encoder skeleton (#1607)
* libraries: Add initial HLE JPEG encoder skeleton

* jpegenc: Finish adding parameter validation.

* updated enums , added logging

* jpegenc: Clean up parameter validations.

* jpegenc: Fix missing log.

* externals: Update ffmpeg-core

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2024-11-30 21:43:12 +02:00
Vinicius Rangel
2002e37ce9 Allow shader patching (#1633) 2024-11-30 20:15:55 +01:00
squidbus
07f4a0305b semaphore: Use condvars with separate signaled flag to prevent races (#1615)
* Revert "semaphore: Use binary_semaphore instead of condvar"

This reverts commit 85dc57b868.

* semaphore: Use separate signaled flag to prevent races

* mutex: Few misc fixes

* condvar: Few misc fixes

* signals: Add thread name to unhandled signal message.
2024-11-30 19:19:07 +02:00
Vladislav Mikhalin
c0d43a1a5f Fixed incorrectly skipped RTs 2024-11-30 17:05:08 +03:00
squidbus
36044043bc config: Fix loading install directories. (#1626) 2024-11-30 11:08:34 +01:00
squidbus
99ac10a417 libraries: Add libSceRazorCpu HLE skeleton. (#1624)
* Remove save migration code (#1621)

* Kernel Fixes (#1605)

* scePthreadSetprio Changes

FindThread uses posix error codes, so the function export should apply the ORBIS wrapper to convert these. Since it uses posix codes, I've also renamed the function to align with other posix functions. Lastly, this fixes a compile warning about ret sometimes not getting initialized.

* Implement posix_munmap

Used by Hatsune Miku Project Diva X during intros. May help with stability on Linux, probably won't change anything on Windows.

* Exports

Some missing function exports I've seen in my tests.
sceKernelAvailableFlexibleMemorySize export is used in Final Fantasy XV Episode Duscae
posix_pthread_setprio and posix_pthread_getschedparam are used by Spider-Man Miles Morales
scePthreadKeyDelete is used in UE4 games.

I've also added in a typo fix related to my previous PR.

* libScePosix export for posix_pthread_attr_setguardsize

Used in Hatsune Miku Project Diva X v1.02

* libraries: Add libSceRazorCpu HLE skeleton.

---------

Co-authored-by: ¥IGA <164882787+Xphalnos@users.noreply.github.com>
Co-authored-by: Stephen Miller <56742918+StevenMiller123@users.noreply.github.com>
2024-11-30 11:30:22 +02:00
georgemoralis
7bf168e47f Revert "Remove save migration code (#1621)"
This reverts commit b1a024efbd.
2024-11-30 11:28:46 +02:00
Stephen Miller
7e525a59e4 Kernel Fixes (#1605)
* scePthreadSetprio Changes

FindThread uses posix error codes, so the function export should apply the ORBIS wrapper to convert these. Since it uses posix codes, I've also renamed the function to align with other posix functions. Lastly, this fixes a compile warning about ret sometimes not getting initialized.

* Implement posix_munmap

Used by Hatsune Miku Project Diva X during intros. May help with stability on Linux, probably won't change anything on Windows.

* Exports

Some missing function exports I've seen in my tests.
sceKernelAvailableFlexibleMemorySize export is used in Final Fantasy XV Episode Duscae
posix_pthread_setprio and posix_pthread_getschedparam are used by Spider-Man Miles Morales
scePthreadKeyDelete is used in UE4 games.

I've also added in a typo fix related to my previous PR.

* libScePosix export for posix_pthread_attr_setguardsize

Used in Hatsune Miku Project Diva X v1.02
2024-11-30 11:23:48 +02:00
¥IGA
b1a024efbd Remove save migration code (#1621) 2024-11-30 11:23:42 +02:00
squidbus
7b68004a40 sysmodule: Remove need for libSceRazorCpu (#1622) 2024-11-30 10:08:46 +02:00
squidbus
6c215e672d Revert "core: fix patch paths applying when no folder exists" (#1620)
This reverts commit 9f6261524b.
2024-11-29 22:57:56 +02:00
Vladislav Mikhalin
086c5802f4 Fixed DS_SWIZZLE_32 (#1619) 2024-11-29 22:13:36 +02:00
Daniel R.
9f6261524b core: fix patch paths applying when no folder exists 2024-11-29 20:02:45 +01:00
psucien
d6d1ec4f22 hot-fix: apply vgt index offset to draw commands 2024-11-29 14:17:53 +01:00
squidbus
57a3c0132d semaphore: Fix returned iterator from AddWaiter (#1614) 2024-11-29 01:42:39 +02:00
Marcin Mikołajczyk
bd3371bdfb implement sceKernelPreadv (#1611) 2024-11-28 22:26:44 +02:00
Marcin Mikołajczyk
286a288bfd Fix GetDents truncating the last character of filenames (#1610) 2024-11-28 22:25:37 +02:00
squidbus
471ebdb4f0 libc_internal: Implement more functions. (#1606) 2024-11-27 11:50:57 +02:00
Vladislav Mikhalin
18a36c5daa Fixed false-positive image reuploads (#1557)
* Fixed false-positive image reuploads

* Fixed userfaultfd path, removed dead code, simplified calculations

* oopsie

* track potentially dirty images and hash them

* untrack only first page of the image in case of head access

* rebase, initialize hash, fix bounds check

* include image tail in the calculations
2024-11-26 22:45:15 +02:00
¥IGA
3f1be5a4ce Adding Utils Icon (#1600) 2024-11-26 08:48:14 +02:00
psucien
cd4f48cb8d Revert "hot-fix: downgrade Nx1 2D render targets to 1D" due to regression
This reverts commit cea6d87472.
2024-11-25 22:14:53 +01:00
psucien
cea6d87472 hot-fix: downgrade Nx1 2D render targets to 1D 2024-11-25 20:52:09 +01:00
DanielSvoboda
2226175d9b Fix Shortcut (#1586) 2024-11-25 14:26:56 +02:00
¥IGA
ff18b89e66 Fix Game List Mode (#1591) 2024-11-25 14:26:40 +02:00
F1219R
20b4cd2a32 Update sq translation (#1595) 2024-11-25 14:26:12 +02:00
psucien
001b94e802 hot-fix: skip indirect draw for quad lists
* needs to be fixed properly with indirect args re-packing
2024-11-24 18:33:38 +01:00
squidbus
23bb5f09fd devtools: Fix a few compiler warnings. (#1575) 2024-11-24 18:47:19 +02:00
kalaposfos13
82bd780a6b Fix --help text in cli (#1588) 2024-11-24 18:45:17 +02:00
psucien
3d95ad0e3a Image binding and texture cache interface refactor (1/2) (#1481)
* video_core: texture_cache: interface refactor and better overlap handling

* resources binding moved into vk_rasterizer

* remove `virtual` flag leftover
2024-11-24 17:07:51 +01:00
psucien
16e1d679dc video_core: clean-up of indirect draws logic (#1589) 2024-11-24 15:43:28 +01:00
baggins183
fde1726af5 recompiler: fix how srt pass handles step rate sharps in special case (#1587) 2024-11-24 11:49:59 +01:00
psucien
add6eeeb8a update: Tracy 0.11.1 2024-11-24 11:37:14 +01:00
psucien
d7d28aa8da video_core: restored presenter aspect calculations (#1583)
* video_core: restored presenter aspect calculations

* code simplification
2024-11-23 11:46:31 +01:00
psucien
5976300788 hot-fix: proper offset calculation for single offset lds instructions 2024-11-23 10:14:19 +01:00
Daniel R.
df8284c5f8 Fix splashes using the wrong image
Supposedly, only pic1.png is used for the splash
2024-11-22 21:20:47 +01:00
squidbus
15d6b095f7 savedatadialog_ui: Use fmt::localtime instead of formatting std::chrono::local_time (#1574) 2024-11-22 18:29:41 +02:00
squidbus
c71385ec90 misc: Add JetBrains build directories to gitignore. (#1573) 2024-11-22 17:36:31 +02:00
georgemoralis
9ed07f6f6e @Roamic's hot region fix (#1570) 2024-11-22 14:53:16 +02:00
georgemoralis
8c9d7d1a08 Port libpngdec to libpng (#1555)
* intial try to include libpng

* fixing libpng cmake

* cleanup structs and error codes

* building libpng , destroying pkg ;/

* fixed pkg with zlib_comp mode

* attemp to fix ci

* rewrote png encoder with libpng

* small corrections

* clang fix

* clang-fix?

* take alpha value from decode parameters

* more cleanup

* fix stride calculation

* libpng: avoid unnecessary allocation in decoding

* libpng: interlaced support

* libpng: lowered log level

* revert wrong merge

---------

Co-authored-by: Vinicius Rangel <me@viniciusrangel.dev>
2024-11-22 12:42:53 +02:00
kalaposfos13
8f2d71d458 Skip GUI if launching a game directly (#1507)
* Skip GUI if launching a game directly

* Rerun jobs 2

* Added --show-gui, --help, open game by ID and more

* Clang-format

* Added non-GUI related upgrades to SDL version

* clang-format

* Added --fullscreen <true|false> argument

* Update --help text
2024-11-22 07:55:55 +02:00
psucien
f9ae945a55 hot-fix: clang-format 2024-11-21 22:23:09 +01:00
TheTurtle
c4506da0ae kernel: Rewrite pthread emulation (#1440)
* libkernel: Cleanup some function places

* kernel: Refactor thread functions

* kernel: It builds

* kernel: Fix a bunch of bugs, kernel thread heap

* kernel: File cleanup pt1

* File cleanup pt2

* File cleanup pt3

* File cleanup pt4

* kernel: Add missing funcs

* kernel: Add basic exceptions for linux

* gnmdriver: Add workload functions

* kernel: Fix new pthreads code on macOS. (#1441)

* kernel: Downgrade edeadlk to log

* gnmdriver: Add sceGnmSubmitCommandBuffersForWorkload

* exception: Add context register population for macOS. (#1444)

* kernel: Pthread rewrite touchups for Windows

* kernel: Multiplatform thread implementation

* mutex: Remove spamming log

* pthread_spec: Make assert into a log

* pthread_spec: Zero initialize array

* Attempt to fix non-Windows builds

* hotfix: change incorrect NID for scePthreadAttrSetaffinity

* scePthreadAttrSetaffinity implementation

* Attempt to fix Linux

* windows: Address a bunch of address space problems

* address_space: Fix unmap of region surrounded by placeholders

* libs: Reduce logging

* pthread: Implement condvar with waitable atomics and sleepqueue

* sleepq: Separate and make faster

* time: Remove delay execution

* Causes high cpu usage in Tohou Luna Nights

* kernel: Cleanup files again

* pthread: Add missing include

* semaphore: Use binary_semaphore instead of condvar

* Seems more reliable

* libraries/sysmodule: log module on `sceSysmoduleIsLoaded`

* libraries/kernel: implement `scePthreadSetPrio`

---------

Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
Co-authored-by: Daniel R. <47796739+polybiusproxy@users.noreply.github.com>
2024-11-21 22:59:38 +02:00
Daniel R.
6904764aab shader_recompiler/frontend: implement V_MIN3_U32 2024-11-21 19:52:48 +01:00
Daniel R.
e968b1c23f video_core/amdgpu: heuristic for shader binary info
Games can strip the first shader instruction (meant for debugging) which we rely on for obtaining shader information (e.g. LittleBigPlanet 3). For this reason, we start a search through the code start until we arrive at the shader binary info.
2024-11-21 19:24:13 +01:00
Marat Idrisov
2a0629477b [MacOS] Enable game mode when switching to full screen mode (#1541)
* GH-1515: enable game mode when switching to full screen mode

* GH-1515: minor fix

* GH-1515: add MacOSBundleInfo.plist.in to REUSE.toml
2024-11-21 19:02:30 +02:00
Florian Piesche
5054827441 Don't use github as a CDN for Discord RPC icon (#1496)
[jsdelivr](https://www.jsdelivr.com/?docs=gh) is a free CDN for opensource projects that offers mirroring and CDN services for files on GitHub with just a minor URL change, backed by a number of major organizations in the CDN industry.
2024-11-21 12:09:10 +02:00
psucien
c55d7fbb6a Proper MSAA surfaces support (#1560) 2024-11-21 12:08:52 +02:00
¥IGA
c83ac654ce Bump to Clang 18 (#1549) 2024-11-21 12:08:22 +02:00
psucien
3d04765a3f Respect game brightness settings (#1559)
* `RendererVulkan` -> `Presenter`

* support for Video Out gamma setting

* sRGB hack removed

* added post process pass to presenter

* splash functionality restored
2024-11-21 12:06:53 +02:00
psucien
e98fab4b58 hot-fix: correct M-tiled surface size calculation when mip is less than a tile 2024-11-21 00:04:46 +01:00
squidbus
e585330744 image_view: Use array view for color/depth buffers with multiple layers. (#1556) 2024-11-20 20:24:30 +02:00
Vinicius Rangel
b41664ac61 savedata: fix dir name search with wildcard (#1552)
* savedata: fix dir name search with wildcard

* psf: replace filesystem clock by system clock (utc)

* savedatadialog_ui: macOS zoned_time formatting

Signed-off-by: Vinicius Rangel <me@viniciusrangel.dev>

---------

Signed-off-by: Vinicius Rangel <me@viniciusrangel.dev>
Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
2024-11-20 18:31:44 +02:00
Ruah Devlin
96cd79f272 Implement V_MED3_U32 vector ALU Opcode (#1553) 2024-11-20 17:23:59 +01:00
korenkonder
da00235eaf Don't read uninitialized memory in sceSystemServiceReceiveEvent (#1554) 2024-11-20 17:22:30 +01:00
Alexander Y.
9f42a12baf Fix build when -DENABLE_DISCORD_RPC=OFF (#1551)
* added ifdef for discordrpc

* replaced discordrpc include correctly
2024-11-20 08:41:35 +02:00
Daniel R.
17c47bcd96 shader_recompiler/frontend: Implement bitcmp instructions (#1550) 2024-11-19 21:38:32 +01:00
Vladislav Mikhalin
c45af9a2ca Fix border color (#1548) 2024-11-19 18:55:05 +02:00
psucien
8fbd9187f8 libraries: gnmdriver: few more functions implemented (#1544) 2024-11-18 11:23:21 +02:00
Vladislav Mikhalin
e1fecda74f Fix depth bias (#1538) 2024-11-16 19:17:43 +02:00
Stephen Miller
ce158290fb Minor Kernel Fixes (#1529)
* Skip destruction of adaptive mutex initializers

Based around similar behaviors implemented in the more-kernel branch. Hatsune Miku Project Diva X needs this.

* Fix posix_lseek result overflow

Seen when testing Spider-Man Miles Morales on more-kernel.

* Add posix_fsync

Used by Spider-Man Miles Morales. I've added the normal posix error handling to this function, though I'm aware sceKernelFsync doesn't return any errors currently. This is for future proofing and accuracy, as the actual libkernel does the usual error handling too.

* Properly handle VirtualQuery calls on PoolReserved memory.

* Export posix_getpagesize under libkernel

Bloons TD 5 needs this.

* Clang
2024-11-14 18:00:57 +02:00
Osyotr
7be35c3997 Save config in UTF-8 (#1524) 2024-11-14 12:01:33 +02:00
Vladislav Mikhalin
bf239ebc04 ajm: handle single-frame decode jobs (+mp3 imrovements) (#1520)
* ajm: handle single-frame decode jobs (+mp3 imrovements)

* disable breaking the loop in multi-frame if storage is insufficient

* simplified gapless decoding
2024-11-14 12:01:20 +02:00
Martin
8e281575b5 Update Norwegian Bokmål translations (#1525)
* specify nb_NO

* Update Norwegian Bokmål translation

* change patch wording nb_NO
2024-11-14 12:00:59 +02:00
Florian Piesche
6ae92c0aac Add FreeDesktop metadata (#1495) 2024-11-14 10:56:14 +02:00
squidbus
0c52d02043 videodec: Lower sceVideodecDecode log to trace. (#1527) 2024-11-13 18:04:13 +01:00
Florian Piesche
85f45d2788 Add scalable vector redraw of shadps4 icon (#1501)
* Add scalable vector redraw of shadps4 icon

* Update icon name in desktop file

* Fix svg
2024-11-12 09:32:56 +02:00
kalaposfos13
8a15d68a8d Update Hungarian translation (#1518) 2024-11-12 09:31:56 +02:00
squidbus
f5618e0342 imgui: Dispatch SDL text input requests to main thread on macOS. (#1519) 2024-11-12 09:27:30 +02:00
Lander Gallastegi
b64dcd2f56 Assert fix (#1521) 2024-11-12 09:26:48 +02:00
georgemoralis
7ab851592b Videocodec implementation (#1484)
* dummy videocodec

* filled videodec parameters

* vdec1 implementation

* clang format fix

* fixed codecType

* added crop offset info

* align output

* align all h/w

* some touchups

* small touch (last one)
2024-11-10 11:33:08 +02:00
DanielSvoboda
4fd7f67459 Open Folder - improvement (Save/Log) (#1513)
* Open Folder - improvement

* TR
2024-11-10 10:14:48 +02:00
squidbus
f7b458c85a ci: Change to macOS 15 (#1508) 2024-11-10 00:20:54 +02:00
Vladislav Mikhalin
75d2181489 ajm mp3: fix resampling (#1500) 2024-11-08 07:45:03 +02:00
squidbus
176d222519 vk_pipeline_cache: Skip pipelines with geometry shaders when unsupported. (#1486) 2024-11-07 14:57:31 +02:00
Quang Ngô
ed0a9c0e4e Fix emulator name in desktop entry for appimages (#1491) 2024-11-07 14:56:24 +02:00
Quang Ngô
a547b2774f Allow disable the auto updater (#1490) 2024-11-07 14:56:02 +02:00
Quang Ngô
f45cad6bc9 Fix patches not save changes properly (#1493)
Don't use ```QCheckBox::text()``` because it may return strings that contain "&" cause patch name comparison to fail.
2024-11-06 22:44:22 +02:00
Vladislav Mikhalin
46ac48c311 AJM: Added some missing features (#1489)
* AJM: Added support for different PCM formats

* updated libatrac9 ref

* remove log

* Add support for non-interleaved flag

* Added support for output sideband format query
2024-11-06 22:39:43 +02:00
georgemoralis
f98b9f7726 hot-fix : removed libSceRudp.srpx from lle modules since it appears it create more issues than solves 2024-11-06 07:20:58 +02:00
psucien
204bba9be8 hot-fix: pr merge conflict resolved 2024-11-05 22:59:45 +01:00
Lander Gallastegi
aa4c6c0178 shader_recompiler: patch fmask access instructions (#1439)
* Fix multisample texture fetch

* Patch some fmask reads

* clang-format

* Assert insteed of ignore, coordinate fixes

* Patch ImageQueryDimensions
2024-11-05 22:39:57 +01:00
SAN4EZDREAMS
fe389e560a Added uk_UA language support (#1483)
* Add Ukrainian localization

* Fixed langIndexes

* Fixed langIndexes_2

* Added uk_UA language support

* Added uk_UA language support
2024-11-05 10:46:12 +02:00
georgemoralis
f068f13e4a Ajm (#1456)
* ajm: Initial ajm implementation

* AJM code improvements (#1453)

* Fix sideband buffer order (#1454)

* ajm: Attempt to add gapless support

* ajm_at9: Return superframes decoded in a single job

* WIP (#1460)

* Fix gapless decode and combine split buffers

* Fixed linux build

* fix number of samples reported with gapless decoding

* fixed number of remaining samples calculation

should fix the small crackling sounds that play every now and again

* refactor half ajm

* refactored most of ajm

* refactored ajm

* clang-format, in-repo libatrac9, removed debug stuff

---------

Co-authored-by: auser1337 <aaravsandhu10@outlook.com>
Co-authored-by: Vladislav Mikhalin <mikhalinvlad@gmail.com>
Co-authored-by: IndecisiveTurtle <geoster3d@gmail.com>
2024-11-05 09:16:57 +02:00
squidbus
76f440889b qt: Error if installing DLC without game. (#1476) 2024-11-03 01:06:55 +02:00
Daniel R.
29183354cc libraries/videodec: Fix build errors with av_err2str 2024-11-02 19:11:57 +01:00
squidbus
0b015daff7 netctl: Add null check for gethostbyname output. (#1468) 2024-11-01 14:29:24 +02:00
baggins183
9ec75c3feb Implement shader resource tables (#1165)
* Implement shader resource tables

* fix after rebase + squash

* address some review comments

* fix pipeline_common

* cleanup debug stuff

* switch to using single codegenerator
2024-11-01 08:55:53 +02:00
DanielSvoboda
7b16085c59 Fix update loop between release (#1465) 2024-10-31 20:59:14 +02:00
Daniel R.
b7fe08519f core/gnmdriver: Proper interrupt registering (#1218) 2024-10-31 17:53:03 +02:00
georgemoralis
72440a4996 starting 0.4.1 2024-10-31 17:35:39 +02:00
579 changed files with 65184 additions and 30837 deletions

View File

@@ -10,7 +10,7 @@ if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .ci* dis
fi fi
# Default clang-format points to default 3.5 version one # Default clang-format points to default 3.5 version one
CLANG_FORMAT=clang-format-17 CLANG_FORMAT=clang-format-18
$CLANG_FORMAT --version $CLANG_FORMAT --version
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then

View File

@@ -0,0 +1,55 @@
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
# Docs - https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
name: Application Bug Report
description: Problem with the application itself (ie. bad file path handling, UX issue)
title: "[APP BUG]: "
body:
- type: markdown
attributes:
value: |
## Important: Read First
**Please do not make support requests on GitHub. Our issue tracker is for tracking bugs and feature requests only.
If you have a support request or are unsure about the nature of your issue please contact us on [discord](https://discord.gg/bFJxfftGW6).**
Please make an effort to make sure your issue isn't already reported.
Do not create issues involving software piracy, our rules specifically prohibit this. Otherwise your issue will be closed and you will be banned in this repository.
- type: checkboxes
id: checklist
attributes:
label: Checklist
options:
- label: I have searched for a similar issue in this repository and did not find one.
required: true
- label: I am using an official build obtained from [releases](https://github.com/shadps4-emu/shadPS4/releases) or updated one of those builds using its in-app updater.
required: true
- type: textarea
id: desc
attributes:
label: Describe the Bug
description: "A clear and concise description of what the bug is"
validations:
required: true
- type: textarea
id: repro
attributes:
label: Reproduction Steps
description: "Detailed steps to reproduce the behavior"
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behavior
description: "A clear and concise description of what you expected to happen"
validations:
required: false
- type: input
id: os
attributes:
label: Specify OS Version
placeholder: "Example: Windows 11, Arch Linux, MacOS 15"
validations:
required: true

10
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
blank_issues_enabled: false
contact_links:
- name: Discord
url: https://discord.gg/bFJxfftGW6
about: Get direct support and hang out with us
- name: Wiki
url: https://github.com/shadps4-emu/shadPS4/wiki
about: Information, guides, etc.

View File

@@ -0,0 +1,54 @@
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
# Docs - https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
name: Feature Request
description: Suggest a new feature or improve an existing one
title: "[Feature Request]: "
body:
- type: markdown
attributes:
value: |
## Important: Read First
Please make an effort to make sure your issue isn't already reported.
Do not create issues involving software piracy, our rules specifically prohibit this. Otherwise your issue will be closed and you will be banned in this repository.
- type: checkboxes
id: checklist
attributes:
label: Checklist
options:
- label: I have searched for a similar issue in this repository and did not find one.
required: true
- type: textarea
id: desc
attributes:
label: Description
description: |
A concise description of the feature you want
Include step by step examples of how the feature should work under various circumstances
validations:
required: true
- type: textarea
id: reason
attributes:
label: Reason
description: |
Give a reason why you want this feature
- How will it make things easier for you?
- How does this feature help your enjoyment of the emulator?
- What does it provide that isn't being provided currently?
validations:
required: true
- type: textarea
id: examples
attributes:
label: Examples
description: |
Provide examples of the feature as implemented by other software
Include screenshots or video if you like to help demonstrate how you'd like this feature to work
validations:
required: false

View File

@@ -0,0 +1,95 @@
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
# Docs - https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
name: Game Emulation Bug Report
description: Problem in a game (ie. graphical artifacts, crashes, etc.)
title: "[GAME BUG]: "
body:
- type: markdown
attributes:
value: |
## Important: Read First
**Please do not make support requests on GitHub. Our issue tracker is for tracking bugs and feature requests only.
If you have a support request or are unsure about the nature of your issue please contact us on [discord](https://discord.gg/bFJxfftGW6).**
This repository does not provide support for modded games. You should perform and test a clean game installation before submitting an issue.
This repository does not provide support for game patches. If you are having issues with patches please refer to [Cheats and Patches Repository](https://github.com/shadps4-emu/ps4_cheats).
Before submitting an issue please check [Game Compatibility Repository](https://github.com/shadps4-emu/shadps4-game-compatibility) for the information about the status of the game.
Please make an effort to make sure your issue isn't already reported.
Do not create issues involving software piracy, our rules specifically prohibit this. Otherwise your issue will be closed and you will be banned in this repository.
- type: checkboxes
id: checklist
attributes:
label: Checklist (we expect you to perform these steps before opening the issue)
options:
- label: I have searched for a similar issue in this repository and did not find one.
required: true
- label: I am using an official build obtained from [releases](https://github.com/shadps4-emu/shadPS4/releases) or updated one of those builds using its in-app updater.
required: true
- label: I have re-dumped the game and performed a clean install without mods and the issue is still present.
required: true
- label: I have disabled all patches and cheats and the issue is still present.
required: true
- label: I have all the required [system modules](https://github.com/shadps4-emu/shadps4-game-compatibility?tab=readme-ov-file#informations) installed.
required: true
- type: textarea
id: desc
attributes:
label: Describe the Bug
description: "A clear and concise description of what the bug is"
validations:
required: true
- type: textarea
id: repro
attributes:
label: Reproduction Steps
description: "Detailed steps to reproduce the behavior"
validations:
required: true
- type: input
id: os
attributes:
label: Specify OS Version
placeholder: "Example: Windows 11, Arch Linux, MacOS 15"
validations:
required: true
- type: input
id: cpu
attributes:
label: CPU
placeholder: "Example: Intel Core i7-8700"
validations:
required: true
- type: input
id: gpu
attributes:
label: GPU
placeholder: "Example: nVidia GTX 1650"
validations:
required: true
- type: input
id: ram
attributes:
label: Amount of RAM in GB
placeholder: "Example: 16 GB"
validations:
required: true
- type: input
id: vram
attributes:
label: Amount of VRAM in GB
placeholder: "Example: 8 GB"
validations:
required: true
- type: textarea
id: logs
attributes:
label: "Log File"
description: Drag and drop the log file here. It can be found by right clicking on a game name -> Open Folder... -> Open Log Folder. Make sure that the log type is set to `sync`.
validations:
required: true

View File

@@ -27,7 +27,7 @@ chmod a+x linuxdeploy-plugin-checkrt-x86_64.sh
cp -a "$GITHUB_WORKSPACE/build/translations" AppDir/usr/bin cp -a "$GITHUB_WORKSPACE/build/translations" AppDir/usr/bin
./linuxdeploy-x86_64.AppImage --appdir AppDir -d "$GITHUB_WORKSPACE"/.github/shadps4.desktop -e "$GITHUB_WORKSPACE"/build/shadps4 -i "$GITHUB_WORKSPACE"/.github/shadps4.png --plugin qt ./linuxdeploy-x86_64.AppImage --appdir AppDir -d "$GITHUB_WORKSPACE"/dist/net.shadps4.shadPS4.desktop -e "$GITHUB_WORKSPACE"/build/shadps4 -i "$GITHUB_WORKSPACE"/src/images/net.shadps4.shadPS4.svg --plugin qt
rm AppDir/usr/plugins/multimedia/libgstreamermediaplugin.so rm AppDir/usr/plugins/multimedia/libgstreamermediaplugin.so
./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage ./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage
mv Shadps4-x86_64.AppImage Shadps4-qt.AppImage mv shadPS4-x86_64.AppImage Shadps4-qt.AppImage

View File

@@ -17,5 +17,5 @@ chmod a+x linuxdeploy-plugin-checkrt-x86_64.sh
# Build AppImage # Build AppImage
./linuxdeploy-x86_64.AppImage --appdir AppDir ./linuxdeploy-x86_64.AppImage --appdir AppDir
./linuxdeploy-plugin-checkrt-x86_64.sh --appdir AppDir ./linuxdeploy-plugin-checkrt-x86_64.sh --appdir AppDir
./linuxdeploy-x86_64.AppImage --appdir AppDir -d "$GITHUB_WORKSPACE"/.github/shadps4.desktop -e "$GITHUB_WORKSPACE"/build/shadps4 -i "$GITHUB_WORKSPACE"/.github/shadps4.png --output appimage ./linuxdeploy-x86_64.AppImage --appdir AppDir -d "$GITHUB_WORKSPACE"/dist/net.shadps4.shadPS4.desktop -e "$GITHUB_WORKSPACE"/build/shadps4 -i "$GITHUB_WORKSPACE"/src/images/net.shadps4.shadPS4.svg --output appimage
mv Shadps4-x86_64.AppImage Shadps4-sdl.AppImage mv shadPS4-x86_64.AppImage Shadps4-sdl.AppImage

View File

@@ -14,14 +14,14 @@ env:
jobs: jobs:
reuse: reuse:
runs-on: ubuntu-latest runs-on: ubuntu-24.04
continue-on-error: true continue-on-error: true
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: fsfe/reuse-action@v4 - uses: fsfe/reuse-action@v5
clang-format: clang-format:
runs-on: ubuntu-latest runs-on: ubuntu-24.04
continue-on-error: true continue-on-error: true
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -30,16 +30,16 @@ jobs:
- name: Install - name: Install
run: | run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main' sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main'
sudo apt update sudo apt update
sudo apt install clang-format-17 sudo apt install clang-format-18
- name: Build - name: Build
env: env:
COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
run: ./.ci/clang-format.sh run: ./.ci/clang-format.sh
get-info: get-info:
runs-on: ubuntu-latest runs-on: ubuntu-24.04
outputs: outputs:
date: ${{ steps.vars.outputs.date }} date: ${{ steps.vars.outputs.date }}
shorthash: ${{ steps.vars.outputs.shorthash }} shorthash: ${{ steps.vars.outputs.shorthash }}
@@ -57,7 +57,7 @@ jobs:
echo "fullhash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT echo "fullhash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
windows-sdl: windows-sdl:
runs-on: windows-latest runs-on: windows-2025
needs: get-info needs: get-info
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -89,10 +89,10 @@ jobs:
arch: amd64 arch: amd64
- name: Configure CMake - name: Configure CMake
run: cmake --fresh -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache run: cmake --fresh -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $env:NUMBER_OF_PROCESSORS
- name: Upload Windows SDL artifact - name: Upload Windows SDL artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@@ -101,7 +101,7 @@ jobs:
path: ${{github.workspace}}/build/shadPS4.exe path: ${{github.workspace}}/build/shadPS4.exe
windows-qt: windows-qt:
runs-on: windows-latest runs-on: windows-2025
needs: get-info needs: get-info
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -143,10 +143,10 @@ jobs:
arch: amd64 arch: amd64
- name: Configure CMake - name: Configure CMake
run: cmake --fresh -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_QT_GUI=ON -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache run: cmake --fresh -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $env:NUMBER_OF_PROCESSORS
- name: Deploy and Package - name: Deploy and Package
run: | run: |
@@ -162,7 +162,7 @@ jobs:
path: upload/ path: upload/
macos-sdl: macos-sdl:
runs-on: macos-latest runs-on: macos-15
needs: get-info needs: get-info
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -174,11 +174,6 @@ jobs:
with: with:
xcode-version: latest xcode-version: latest
- name: Install MoltenVK
run: |
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
arch -x86_64 /usr/local/bin/brew install molten-vk
- name: Cache CMake Configuration - name: Cache CMake Configuration
uses: actions/cache@v4 uses: actions/cache@v4
env: env:
@@ -201,7 +196,7 @@ jobs:
variant: sccache variant: sccache
- name: Configure CMake - name: Configure CMake
run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(sysctl -n hw.ncpu) run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(sysctl -n hw.ncpu)
@@ -210,7 +205,7 @@ jobs:
run: | run: |
mkdir upload mkdir upload
mv ${{github.workspace}}/build/shadps4 upload mv ${{github.workspace}}/build/shadps4 upload
cp $(arch -x86_64 /usr/local/bin/brew --prefix)/opt/molten-vk/lib/libMoltenVK.dylib upload cp ${{github.workspace}}/build/externals/MoltenVK/libMoltenVK.dylib upload
tar cf shadps4-macos-sdl.tar.gz -C upload . tar cf shadps4-macos-sdl.tar.gz -C upload .
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
@@ -218,7 +213,7 @@ jobs:
path: shadps4-macos-sdl.tar.gz path: shadps4-macos-sdl.tar.gz
macos-qt: macos-qt:
runs-on: macos-latest runs-on: macos-15
needs: get-info needs: get-info
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -230,11 +225,8 @@ jobs:
with: with:
xcode-version: latest xcode-version: latest
- name: Install MoltenVK and Setup Qt - name: Setup Qt
run: | uses: jurplel/install-qt-action@v4
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
arch -x86_64 /usr/local/bin/brew install molten-vk
- uses: jurplel/install-qt-action@v4
with: with:
version: 6.7.3 version: 6.7.3
host: mac host: mac
@@ -265,7 +257,7 @@ jobs:
variant: sccache variant: sccache
- name: Configure CMake - name: Configure CMake
run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_OSX_ARCHITECTURES=x86_64 -DENABLE_QT_GUI=ON -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_OSX_ARCHITECTURES=x86_64 -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(sysctl -n hw.ncpu) run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(sysctl -n hw.ncpu)
@@ -312,10 +304,10 @@ jobs:
key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Configure CMake - name: Configure CMake
run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(nproc)
- name: Package and Upload Linux(ubuntu64) SDL artifact - name: Package and Upload Linux(ubuntu64) SDL artifact
run: | run: |
@@ -368,10 +360,10 @@ jobs:
key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Configure CMake - name: Configure CMake
run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DENABLE_QT_GUI=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel3 run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(nproc)
- name: Run AppImage packaging script - name: Run AppImage packaging script
run: ./.github/linux-appimage-qt.sh run: ./.github/linux-appimage-qt.sh
@@ -384,6 +376,78 @@ jobs:
name: shadps4-linux-qt-${{ needs.get-info.outputs.date }}-${{ needs.get-info.outputs.shorthash }} name: shadps4-linux-qt-${{ needs.get-info.outputs.date }}-${{ needs.get-info.outputs.shorthash }}
path: Shadps4-qt.AppImage path: Shadps4-qt.AppImage
linux-sdl-gcc:
runs-on: ubuntu-24.04
needs: get-info
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: sudo apt-get update && sudo apt install -y libx11-dev libxext-dev libwayland-dev libdecor-0-dev libxkbcommon-dev libglfw3-dev libgles2-mesa-dev libfuse2 gcc-14 build-essential libasound2-dev libpulse-dev libopenal-dev libudev-dev
- name: Cache CMake Configuration
uses: actions/cache@v4
env:
cache-name: ${{ runner.os }}-sdl-gcc-cache-cmake-configuration
with:
path: |
${{github.workspace}}/build
key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
restore-keys: |
${{ env.cache-name }}-
- name: Cache CMake Build
uses: hendrikmuhs/ccache-action@v1.2.14
env:
cache-name: ${{ runner.os }}-sdl-gcc-cache-cmake-build
with:
append-timestamp: false
key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Configure CMake
run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(nproc)
linux-qt-gcc:
runs-on: ubuntu-24.04
needs: get-info
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: sudo apt-get update && sudo apt install -y libx11-dev libxext-dev libwayland-dev libdecor-0-dev libxkbcommon-dev libglfw3-dev libgles2-mesa-dev libfuse2 gcc-14 build-essential qt6-base-dev qt6-tools-dev qt6-multimedia-dev libasound2-dev libpulse-dev libopenal-dev libudev-dev
- name: Cache CMake Configuration
uses: actions/cache@v4
env:
cache-name: ${{ runner.os }}-qt-gcc-cache-cmake-configuration
with:
path: |
${{github.workspace}}/build
key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
restore-keys: |
${{ env.cache-name }}-
- name: Cache CMake Build
uses: hendrikmuhs/ccache-action@v1.2.14
env:
cache-name: ${{ runner.os }}-qt-gcc-cache-cmake-build
with:
append-timestamp: false
key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Configure CMake
run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14 -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(nproc)
pre-release: pre-release:
if: github.ref == 'refs/heads/main' && github.repository == 'shadps4-emu/shadPS4' && github.event_name == 'push' if: github.ref == 'refs/heads/main' && github.repository == 'shadps4-emu/shadPS4' && github.event_name == 'push'
needs: [get-info, windows-sdl, windows-qt, macos-sdl, macos-qt, linux-sdl, linux-qt] needs: [get-info, windows-sdl, windows-qt, macos-sdl, macos-qt, linux-sdl, linux-qt]

12
.gitignore vendored
View File

@@ -382,10 +382,10 @@ FodyWeavers.xsd
# VS Code files for those working on multiple tools # VS Code files for those working on multiple tools
.vscode/* .vscode/*
!.vscode/settings.json .vscode/settings.json
!.vscode/tasks.json .vscode/tasks.json
!.vscode/launch.json .vscode/launch.json
!.vscode/extensions.json .vscode/extensions.json
*.code-workspace *.code-workspace
/CMakeUserPresets.json /CMakeUserPresets.json
/compile_commands.json /compile_commands.json
@@ -414,3 +414,7 @@ FodyWeavers.xsd
# for macOS # for macOS
**/.DS_Store **/.DS_Store
# JetBrains
.idea
cmake-build-*

20
.gitmodules vendored
View File

@@ -99,3 +99,23 @@
path = externals/discord-rpc path = externals/discord-rpc
url = https://github.com/shadps4-emu/ext-discord-rpc.git url = https://github.com/shadps4-emu/ext-discord-rpc.git
shallow = true shallow = true
[submodule "externals/LibAtrac9"]
path = externals/LibAtrac9
url = https://github.com/shadps4-emu/ext-LibAtrac9.git
shallow = true
[submodule "externals/libpng"]
path = externals/libpng
url = https://github.com/pnggroup/libpng
shallow = true
[submodule "externals/MoltenVK/SPIRV-Cross"]
path = externals/MoltenVK/SPIRV-Cross
url = https://github.com/KhronosGroup/SPIRV-Cross
shallow = true
[submodule "externals/MoltenVK/MoltenVK"]
path = externals/MoltenVK/MoltenVK
url = https://github.com/KhronosGroup/MoltenVK
shallow = true
[submodule "externals/MoltenVK/cereal"]
path = externals/MoltenVK/cereal
url = https://github.com/USCiLab/cereal
shallow = true

View File

@@ -1,7 +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
cmake_minimum_required(VERSION 3.16.3) # Version 3.24 needed for FetchContent OVERRIDE_FIND_PACKAGE
cmake_minimum_required(VERSION 3.24)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_CXX_STANDARD_REQUIRED True)
@@ -15,7 +16,7 @@ if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
endif() endif()
project(shadPS4) project(shadPS4 CXX C ASM)
# Forcing PIE makes sure that the base address is high enough so that it doesn't clash with the PS4 memory. # Forcing PIE makes sure that the base address is high enough so that it doesn't clash with the PS4 memory.
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
@@ -31,6 +32,7 @@ endif()
option(ENABLE_QT_GUI "Enable the Qt GUI. If not selected then the emulator uses a minimal SDL-based UI instead" OFF) option(ENABLE_QT_GUI "Enable the Qt GUI. If not selected then the emulator uses a minimal SDL-based UI instead" OFF)
option(ENABLE_DISCORD_RPC "Enable the Discord RPC integration" ON) option(ENABLE_DISCORD_RPC "Enable the Discord RPC integration" ON)
option(ENABLE_UPDATER "Enables the options to updater" ON)
# First, determine whether to use CMAKE_OSX_ARCHITECTURES or CMAKE_SYSTEM_PROCESSOR. # First, determine whether to use CMAKE_OSX_ARCHITECTURES or CMAKE_SYSTEM_PROCESSOR.
if (APPLE AND CMAKE_OSX_ARCHITECTURES) if (APPLE AND CMAKE_OSX_ARCHITECTURES)
@@ -104,23 +106,55 @@ git_describe(GIT_DESC --always --long --dirty)
git_branch_name(GIT_BRANCH) git_branch_name(GIT_BRANCH)
string(TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S") string(TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/common/scm_rev.cpp.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/common/scm_rev.cpp" @ONLY) # Try to get the upstream remote and branch
execute_process(
COMMAND git rev-parse --abbrev-ref --symbolic-full-name @{u}
OUTPUT_VARIABLE GIT_REMOTE_NAME
RESULT_VARIABLE GIT_BRANCH_RESULT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Default to origin if there's no upstream set or if the command failed
if (GIT_BRANCH_RESULT OR GIT_REMOTE_NAME STREQUAL "")
set(GIT_REMOTE_NAME "origin")
else()
# Extract remote name if the output contains a remote/branch format
string(FIND "${GIT_REMOTE_NAME}" "/" INDEX)
if (INDEX GREATER -1)
string(SUBSTRING "${GIT_REMOTE_NAME}" 0 "${INDEX}" GIT_REMOTE_NAME)
else()
# If no remote is present (only a branch name), default to origin
set(GIT_REMOTE_NAME "origin")
endif()
endif()
# Get remote link
execute_process(
COMMAND git config --get remote.${GIT_REMOTE_NAME}.url
OUTPUT_VARIABLE GIT_REMOTE_URL
OUTPUT_STRIP_TRAILING_WHITESPACE
)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/common/scm_rev.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/src/common/scm_rev.cpp" @ONLY)
find_package(Boost 1.84.0 CONFIG) find_package(Boost 1.84.0 CONFIG)
find_package(FFmpeg 5.1.2 MODULE) find_package(FFmpeg 5.1.2 MODULE)
find_package(fmt 10.2.0 CONFIG) find_package(fmt 10.2.0 CONFIG)
find_package(glslang 14.2.0 CONFIG) find_package(glslang 15 CONFIG)
find_package(half 1.12.0 MODULE) find_package(half 1.12.0 MODULE)
find_package(magic_enum 0.9.6 CONFIG) find_package(magic_enum 0.9.7 CONFIG)
find_package(PNG 1.6 MODULE)
find_package(RenderDoc 1.6.0 MODULE) find_package(RenderDoc 1.6.0 MODULE)
find_package(SDL3 3.1.2 CONFIG) find_package(SDL3 3.1.2 CONFIG)
find_package(stb MODULE)
find_package(toml11 4.2.0 CONFIG) find_package(toml11 4.2.0 CONFIG)
find_package(tsl-robin-map 1.3.0 CONFIG) find_package(tsl-robin-map 1.3.0 CONFIG)
find_package(VulkanHeaders 1.3.289 CONFIG) find_package(VulkanHeaders 1.4.305 CONFIG)
find_package(VulkanMemoryAllocator 3.1.0 CONFIG) find_package(VulkanMemoryAllocator 3.1.0 CONFIG)
find_package(xbyak 7.07 CONFIG) find_package(xbyak 7.07 CONFIG)
find_package(xxHash 0.8.2 MODULE) find_package(xxHash 0.8.2 MODULE)
find_package(zlib-ng 2.1.7 MODULE) find_package(ZLIB 1.3 MODULE)
find_package(Zydis 5.0.0 CONFIG) find_package(Zydis 5.0.0 CONFIG)
find_package(pugixml 1.14 CONFIG) find_package(pugixml 1.14 CONFIG)
@@ -175,54 +209,85 @@ if(ENABLE_QT_GUI)
qt_add_resources(TRANSLATIONS ${TRANSLATIONS_QRC}) qt_add_resources(TRANSLATIONS ${TRANSLATIONS_QRC})
endif() endif()
set(AUDIO_CORE src/audio_core/sdl_audio.cpp set(AJM_LIB src/core/libraries/ajm/ajm.cpp
src/audio_core/sdl_audio.h src/core/libraries/ajm/ajm.h
src/core/libraries/ajm/ajm_at9.cpp
src/core/libraries/ajm/ajm_at9.h
src/core/libraries/ajm/ajm_batch.cpp
src/core/libraries/ajm/ajm_batch.h
src/core/libraries/ajm/ajm_context.cpp
src/core/libraries/ajm/ajm_context.h
src/core/libraries/ajm/ajm_error.h
src/core/libraries/ajm/ajm_instance_statistics.cpp
src/core/libraries/ajm/ajm_instance_statistics.h
src/core/libraries/ajm/ajm_instance.cpp
src/core/libraries/ajm/ajm_instance.h
src/core/libraries/ajm/ajm_mp3.cpp
src/core/libraries/ajm/ajm_mp3.h
) )
set(AUDIO_LIB src/core/libraries/audio/audioin.cpp set(AUDIO_LIB src/core/libraries/audio/audioin.cpp
src/core/libraries/audio/audioin.h src/core/libraries/audio/audioin.h
src/core/libraries/audio/audioout.cpp src/core/libraries/audio/audioout.cpp
src/core/libraries/audio/audioout.h src/core/libraries/audio/audioout.h
src/core/libraries/ajm/ajm.cpp src/core/libraries/audio/audioout_backend.h
src/core/libraries/ajm/ajm.h src/core/libraries/audio/audioout_error.h
src/core/libraries/audio/sdl_audio.cpp
src/core/libraries/ngs2/ngs2.cpp src/core/libraries/ngs2/ngs2.cpp
src/core/libraries/ngs2/ngs2.h src/core/libraries/ngs2/ngs2.h
) )
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/gnmdriver_init.h
src/core/libraries/gnmdriver/gnm_error.h src/core/libraries/gnmdriver/gnm_error.h
) )
set(KERNEL_LIB set(KERNEL_LIB src/core/libraries/kernel/sync/mutex.cpp
src/core/libraries/kernel/event_flag/event_flag.cpp src/core/libraries/kernel/sync/mutex.h
src/core/libraries/kernel/event_flag/event_flag.h src/core/libraries/kernel/sync/semaphore.h
src/core/libraries/kernel/event_flag/event_flag_obj.cpp src/core/libraries/kernel/threads/condvar.cpp
src/core/libraries/kernel/event_flag/event_flag_obj.h src/core/libraries/kernel/threads/event_flag.cpp
src/core/libraries/kernel/threads/exception.cpp
src/core/libraries/kernel/threads/exception.h
src/core/libraries/kernel/threads/mutex.cpp
src/core/libraries/kernel/threads/pthread_attr.cpp
src/core/libraries/kernel/threads/pthread_clean.cpp
src/core/libraries/kernel/threads/pthread.cpp
src/core/libraries/kernel/threads/pthread_spec.cpp
src/core/libraries/kernel/threads/rwlock.cpp src/core/libraries/kernel/threads/rwlock.cpp
src/core/libraries/kernel/threads/semaphore.cpp src/core/libraries/kernel/threads/semaphore.cpp
src/core/libraries/kernel/threads/keys.cpp src/core/libraries/kernel/threads/sleepq.cpp
src/core/libraries/kernel/threads/threads.h src/core/libraries/kernel/threads/sleepq.h
src/core/libraries/kernel/cpu_management.cpp src/core/libraries/kernel/threads/stack.cpp
src/core/libraries/kernel/cpu_management.h src/core/libraries/kernel/threads/tcb.cpp
src/core/libraries/kernel/event_queue.cpp src/core/libraries/kernel/threads/pthread.h
src/core/libraries/kernel/event_queue.h src/core/libraries/kernel/threads/thread_state.cpp
src/core/libraries/kernel/event_queues.cpp src/core/libraries/kernel/threads/thread_state.h
src/core/libraries/kernel/event_queues.h src/core/libraries/kernel/process.cpp
src/core/libraries/kernel/process.h
src/core/libraries/kernel/equeue.cpp
src/core/libraries/kernel/equeue.h
src/core/libraries/kernel/file_system.cpp src/core/libraries/kernel/file_system.cpp
src/core/libraries/kernel/file_system.h src/core/libraries/kernel/file_system.h
src/core/libraries/kernel/libkernel.cpp src/core/libraries/kernel/kernel.cpp
src/core/libraries/kernel/libkernel.h src/core/libraries/kernel/kernel.h
src/core/libraries/kernel/memory_management.cpp src/core/libraries/kernel/memory.cpp
src/core/libraries/kernel/memory_management.h src/core/libraries/kernel/memory.h
src/core/libraries/kernel/thread_management.cpp src/core/libraries/kernel/threads.cpp
src/core/libraries/kernel/thread_management.h src/core/libraries/kernel/threads.h
src/core/libraries/kernel/time_management.cpp src/core/libraries/kernel/time.cpp
src/core/libraries/kernel/time_management.h src/core/libraries/kernel/time.h
src/core/libraries/kernel/orbis_error.h
src/core/libraries/kernel/posix_error.h
src/core/libraries/kernel/aio.cpp
src/core/libraries/kernel/aio.h
) )
set(NETWORK_LIBS src/core/libraries/network/http.cpp set(NETWORK_LIBS src/core/libraries/network/http.cpp
src/core/libraries/network/http.h src/core/libraries/network/http.h
src/core/libraries/network/http2.cpp
src/core/libraries/network/http2.h
src/core/libraries/network/net.cpp src/core/libraries/network/net.cpp
src/core/libraries/network/netctl.cpp src/core/libraries/network/netctl.cpp
src/core/libraries/network/netctl.h src/core/libraries/network/netctl.h
@@ -232,6 +297,23 @@ set(NETWORK_LIBS src/core/libraries/network/http.cpp
src/core/libraries/network/net.h src/core/libraries/network/net.h
src/core/libraries/network/ssl.cpp src/core/libraries/network/ssl.cpp
src/core/libraries/network/ssl.h src/core/libraries/network/ssl.h
src/core/libraries/network/ssl2.cpp
src/core/libraries/network/ssl2.h
)
set(AVPLAYER_LIB src/core/libraries/avplayer/avplayer_common.cpp
src/core/libraries/avplayer/avplayer_common.h
src/core/libraries/avplayer/avplayer_file_streamer.cpp
src/core/libraries/avplayer/avplayer_file_streamer.h
src/core/libraries/avplayer/avplayer_impl.cpp
src/core/libraries/avplayer/avplayer_impl.h
src/core/libraries/avplayer/avplayer_source.cpp
src/core/libraries/avplayer/avplayer_source.h
src/core/libraries/avplayer/avplayer_state.cpp
src/core/libraries/avplayer/avplayer_state.h
src/core/libraries/avplayer/avplayer.cpp
src/core/libraries/avplayer/avplayer.h
src/core/libraries/avplayer/avplayer_error.h
) )
set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
@@ -255,30 +337,22 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
src/core/libraries/save_data/dialog/savedatadialog_ui.h src/core/libraries/save_data/dialog/savedatadialog_ui.h
src/core/libraries/system/sysmodule.cpp src/core/libraries/system/sysmodule.cpp
src/core/libraries/system/sysmodule.h src/core/libraries/system/sysmodule.h
src/core/libraries/system/system_error.h
src/core/libraries/system/systemservice.cpp src/core/libraries/system/systemservice.cpp
src/core/libraries/system/systemservice.h src/core/libraries/system/systemservice.h
src/core/libraries/system/systemservice_error.h
src/core/libraries/system/userservice.cpp src/core/libraries/system/userservice.cpp
src/core/libraries/system/userservice.h src/core/libraries/system/userservice.h
src/core/libraries/system/userservice_error.h
src/core/libraries/app_content/app_content.cpp src/core/libraries/app_content/app_content.cpp
src/core/libraries/app_content/app_content.h src/core/libraries/app_content/app_content.h
src/core/libraries/app_content/app_content_error.h
src/core/libraries/rtc/rtc.cpp src/core/libraries/rtc/rtc.cpp
src/core/libraries/rtc/rtc.h src/core/libraries/rtc/rtc.h
src/core/libraries/rtc/rtc_error.h src/core/libraries/rtc/rtc_error.h
src/core/libraries/disc_map/disc_map.cpp src/core/libraries/disc_map/disc_map.cpp
src/core/libraries/disc_map/disc_map.h src/core/libraries/disc_map/disc_map.h
src/core/libraries/disc_map/disc_map_codes.h src/core/libraries/disc_map/disc_map_codes.h
src/core/libraries/avplayer/avplayer_common.cpp
src/core/libraries/avplayer/avplayer_common.h
src/core/libraries/avplayer/avplayer_file_streamer.cpp
src/core/libraries/avplayer/avplayer_file_streamer.h
src/core/libraries/avplayer/avplayer_impl.cpp
src/core/libraries/avplayer/avplayer_impl.h
src/core/libraries/avplayer/avplayer_source.cpp
src/core/libraries/avplayer/avplayer_source.h
src/core/libraries/avplayer/avplayer_state.cpp
src/core/libraries/avplayer/avplayer_state.h
src/core/libraries/avplayer/avplayer.cpp
src/core/libraries/avplayer/avplayer.h
src/core/libraries/ngs2/ngs2.cpp src/core/libraries/ngs2/ngs2.cpp
src/core/libraries/ngs2/ngs2.h src/core/libraries/ngs2/ngs2.h
src/core/libraries/ngs2/ngs2_error.h src/core/libraries/ngs2/ngs2_error.h
@@ -296,6 +370,12 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
src/core/libraries/remote_play/remoteplay.h src/core/libraries/remote_play/remoteplay.h
src/core/libraries/share_play/shareplay.cpp src/core/libraries/share_play/shareplay.cpp
src/core/libraries/share_play/shareplay.h src/core/libraries/share_play/shareplay.h
src/core/libraries/razor_cpu/razor_cpu.cpp
src/core/libraries/razor_cpu/razor_cpu.h
src/core/libraries/mouse/mouse.cpp
src/core/libraries/mouse/mouse.h
src/core/libraries/web_browser_dialog/webbrowserdialog.cpp
src/core/libraries/web_browser_dialog/webbrowserdialog.h
) )
set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h
@@ -303,6 +383,7 @@ set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h
src/core/libraries/videoout/driver.h src/core/libraries/videoout/driver.h
src/core/libraries/videoout/video_out.cpp src/core/libraries/videoout/video_out.cpp
src/core/libraries/videoout/video_out.h src/core/libraries/videoout/video_out.h
src/core/libraries/videoout/videoout_error.h
) )
set(LIBC_SOURCES src/core/libraries/libc_internal/libc_internal.cpp set(LIBC_SOURCES src/core/libraries/libc_internal/libc_internal.cpp
@@ -320,18 +401,28 @@ set(IME_LIB src/core/libraries/ime/error_dialog.cpp
src/core/libraries/ime/ime_ui.h src/core/libraries/ime/ime_ui.h
src/core/libraries/ime/ime.cpp src/core/libraries/ime/ime.cpp
src/core/libraries/ime/ime.h src/core/libraries/ime/ime.h
src/core/libraries/ime/ime_error.h
) )
set(PAD_LIB src/core/libraries/pad/pad.cpp set(PAD_LIB src/core/libraries/pad/pad.cpp
src/core/libraries/pad/pad.h src/core/libraries/pad/pad.h
src/core/libraries/pad/pad_errors.h
) )
set(PNG_LIB src/core/libraries/libpng/pngdec.cpp set(PNG_LIB src/core/libraries/libpng/pngdec.cpp
src/core/libraries/libpng/pngdec.h src/core/libraries/libpng/pngdec.h
src/core/libraries/libpng/pngdec_error.h
)
set(JPEG_LIB src/core/libraries/jpeg/jpeg_error.h
src/core/libraries/jpeg/jpegenc.cpp
src/core/libraries/jpeg/jpegenc.h
) )
set(PLAYGO_LIB src/core/libraries/playgo/playgo.cpp set(PLAYGO_LIB src/core/libraries/playgo/playgo.cpp
src/core/libraries/playgo/playgo.h src/core/libraries/playgo/playgo.h
src/core/libraries/playgo/playgo_dialog.cpp
src/core/libraries/playgo/playgo_dialog.h
src/core/libraries/playgo/playgo_types.h src/core/libraries/playgo/playgo_types.h
) )
@@ -344,8 +435,10 @@ set(USBD_LIB src/core/libraries/usbd/usbd.cpp
src/core/libraries/usbd/usbd.h src/core/libraries/usbd/usbd.h
) )
set(FIBER_LIB src/core/libraries/fiber/fiber.cpp set(FIBER_LIB src/core/libraries/fiber/fiber_context.s
src/core/libraries/fiber/fiber.cpp
src/core/libraries/fiber/fiber.h src/core/libraries/fiber/fiber.h
src/core/libraries/fiber/fiber_error.h
) )
set(VDEC_LIB src/core/libraries/videodec/videodec2_impl.cpp set(VDEC_LIB src/core/libraries/videodec/videodec2_impl.cpp
@@ -353,9 +446,16 @@ set(VDEC_LIB src/core/libraries/videodec/videodec2_impl.cpp
src/core/libraries/videodec/videodec2.cpp src/core/libraries/videodec/videodec2.cpp
src/core/libraries/videodec/videodec2.h src/core/libraries/videodec/videodec2.h
src/core/libraries/videodec/videodec2_avc.h src/core/libraries/videodec/videodec2_avc.h
src/core/libraries/videodec/videodec.cpp
src/core/libraries/videodec/videodec.h
src/core/libraries/videodec/videodec_error.h
src/core/libraries/videodec/videodec_impl.cpp
src/core/libraries/videodec/videodec_impl.h
) )
set(NP_LIBS src/core/libraries/np_manager/np_manager.cpp set(NP_LIBS src/core/libraries/np_common/np_common.cpp
src/core/libraries/np_common/np_common.h
src/core/libraries/np_manager/np_manager.cpp
src/core/libraries/np_manager/np_manager.h src/core/libraries/np_manager/np_manager.h
src/core/libraries/np_score/np_score.cpp src/core/libraries/np_score/np_score.cpp
src/core/libraries/np_score/np_score.h src/core/libraries/np_score/np_score.h
@@ -363,10 +463,22 @@ set(NP_LIBS src/core/libraries/np_manager/np_manager.cpp
src/core/libraries/np_trophy/np_trophy.h src/core/libraries/np_trophy/np_trophy.h
src/core/libraries/np_trophy/trophy_ui.cpp src/core/libraries/np_trophy/trophy_ui.cpp
src/core/libraries/np_trophy/trophy_ui.h src/core/libraries/np_trophy/trophy_ui.h
src/core/libraries/np_trophy/np_trophy_error.h
src/core/libraries/np_web_api/np_web_api.cpp
src/core/libraries/np_web_api/np_web_api.h
src/core/libraries/np_party/np_party.cpp
src/core/libraries/np_party/np_party.h
)
set(ZLIB_LIB src/core/libraries/zlib/zlib.cpp
src/core/libraries/zlib/zlib_sce.h
src/core/libraries/zlib/zlib_error.h
) )
set(MISC_LIBS src/core/libraries/screenshot/screenshot.cpp set(MISC_LIBS src/core/libraries/screenshot/screenshot.cpp
src/core/libraries/screenshot/screenshot.h src/core/libraries/screenshot/screenshot.h
src/core/libraries/move/move.cpp
src/core/libraries/move/move.h
) )
set(DEV_TOOLS src/core/devtools/layer.cpp set(DEV_TOOLS src/core/devtools/layer.cpp
@@ -384,10 +496,14 @@ set(DEV_TOOLS src/core/devtools/layer.cpp
src/core/devtools/widget/frame_graph.cpp src/core/devtools/widget/frame_graph.cpp
src/core/devtools/widget/frame_graph.h src/core/devtools/widget/frame_graph.h
src/core/devtools/widget/imgui_memory_editor.h src/core/devtools/widget/imgui_memory_editor.h
src/core/devtools/widget/memory_map.cpp
src/core/devtools/widget/memory_map.h
src/core/devtools/widget/reg_popup.cpp src/core/devtools/widget/reg_popup.cpp
src/core/devtools/widget/reg_popup.h src/core/devtools/widget/reg_popup.h
src/core/devtools/widget/reg_view.cpp src/core/devtools/widget/reg_view.cpp
src/core/devtools/widget/reg_view.h src/core/devtools/widget/reg_view.h
src/core/devtools/widget/shader_list.cpp
src/core/devtools/widget/shader_list.h
src/core/devtools/widget/text_editor.cpp src/core/devtools/widget/text_editor.cpp
src/core/devtools/widget/text_editor.h src/core/devtools/widget/text_editor.h
) )
@@ -436,7 +552,12 @@ set(COMMON src/common/logging/backend.cpp
src/common/signal_context.h src/common/signal_context.h
src/common/signal_context.cpp src/common/signal_context.cpp
src/common/singleton.h src/common/singleton.h
src/common/slab_heap.h
src/common/slot_vector.h src/common/slot_vector.h
src/common/spin_lock.cpp
src/common/spin_lock.h
src/common/stb.cpp
src/common/stb.h
src/common/string_util.cpp src/common/string_util.cpp
src/common/string_util.h src/common/string_util.h
src/common/thread.cpp src/common/thread.cpp
@@ -444,6 +565,7 @@ set(COMMON src/common/logging/backend.cpp
src/common/types.h src/common/types.h
src/common/uint128.h src/common/uint128.h
src/common/unique_function.h src/common/unique_function.h
src/common/va_ctx.h
src/common/version.h src/common/version.h
src/common/ntapi.h src/common/ntapi.h
src/common/ntapi.cpp src/common/ntapi.cpp
@@ -451,7 +573,7 @@ set(COMMON src/common/logging/backend.cpp
src/common/number_utils.cpp src/common/number_utils.cpp
src/common/memory_patcher.h src/common/memory_patcher.h
src/common/memory_patcher.cpp src/common/memory_patcher.cpp
src/common/scm_rev.cpp ${CMAKE_CURRENT_BINARY_DIR}/src/common/scm_rev.cpp
src/common/scm_rev.h src/common/scm_rev.h
) )
@@ -468,6 +590,22 @@ set(CORE src/core/aerolib/stubs.cpp
src/core/crypto/crypto.cpp src/core/crypto/crypto.cpp
src/core/crypto/crypto.h src/core/crypto/crypto.h
src/core/crypto/keys.h src/core/crypto/keys.h
src/core/devices/base_device.cpp
src/core/devices/base_device.h
src/core/devices/ioccom.h
src/core/devices/logger.cpp
src/core/devices/logger.h
src/core/devices/nop_device.h
src/core/devices/console_device.cpp
src/core/devices/console_device.h
src/core/devices/deci_tty6_device.cpp
src/core/devices/deci_tty6_device.h
src/core/devices/random_device.cpp
src/core/devices/random_device.h
src/core/devices/urandom_device.cpp
src/core/devices/urandom_device.h
src/core/devices/srandom_device.cpp
src/core/devices/srandom_device.h
src/core/file_format/pfs.h src/core/file_format/pfs.h
src/core/file_format/pkg.cpp src/core/file_format/pkg.cpp
src/core/file_format/pkg.h src/core/file_format/pkg.h
@@ -491,9 +629,10 @@ set(CORE src/core/aerolib/stubs.cpp
src/core/loader/elf.h src/core/loader/elf.h
src/core/loader/symbols_resolver.h src/core/loader/symbols_resolver.h
src/core/loader/symbols_resolver.cpp src/core/loader/symbols_resolver.cpp
src/core/libraries/error_codes.h
src/core/libraries/libs.h src/core/libraries/libs.h
src/core/libraries/libs.cpp src/core/libraries/libs.cpp
${AJM_LIB}
${AVPLAYER_LIB}
${AUDIO_LIB} ${AUDIO_LIB}
${GNM_LIB} ${GNM_LIB}
${KERNEL_LIB} ${KERNEL_LIB}
@@ -504,9 +643,11 @@ set(CORE src/core/aerolib/stubs.cpp
${VIDEOOUT_LIB} ${VIDEOOUT_LIB}
${NP_LIBS} ${NP_LIBS}
${PNG_LIB} ${PNG_LIB}
${JPEG_LIB}
${PLAYGO_LIB} ${PLAYGO_LIB}
${RANDOM_LIB} ${RANDOM_LIB}
${USBD_LIB} ${USBD_LIB}
${ZLIB_LIB}
${MISC_LIBS} ${MISC_LIBS}
${IME_LIB} ${IME_LIB}
${FIBER_LIB} ${FIBER_LIB}
@@ -523,10 +664,10 @@ set(CORE src/core/aerolib/stubs.cpp
src/core/platform.h src/core/platform.h
src/core/signals.cpp src/core/signals.cpp
src/core/signals.h src/core/signals.h
src/core/thread.cpp
src/core/thread.h
src/core/tls.cpp src/core/tls.cpp
src/core/tls.h src/core/tls.h
src/core/virtual_memory.cpp
src/core/virtual_memory.h
) )
if (ARCHITECTURE STREQUAL "x86_64") if (ARCHITECTURE STREQUAL "x86_64")
@@ -557,6 +698,8 @@ set(SHADER_RECOMPILER src/shader_recompiler/exception.h
src/shader_recompiler/backend/spirv/emit_spirv_instructions.h src/shader_recompiler/backend/spirv/emit_spirv_instructions.h
src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp src/shader_recompiler/backend/spirv/emit_spirv_integer.cpp
src/shader_recompiler/backend/spirv/emit_spirv_logical.cpp src/shader_recompiler/backend/spirv/emit_spirv_logical.cpp
src/shader_recompiler/backend/spirv/emit_spirv_quad_rect.cpp
src/shader_recompiler/backend/spirv/emit_spirv_quad_rect.h
src/shader_recompiler/backend/spirv/emit_spirv_select.cpp src/shader_recompiler/backend/spirv/emit_spirv_select.cpp
src/shader_recompiler/backend/spirv/emit_spirv_shared_memory.cpp src/shader_recompiler/backend/spirv/emit_spirv_shared_memory.cpp
src/shader_recompiler/backend/spirv/emit_spirv_special.cpp src/shader_recompiler/backend/spirv/emit_spirv_special.cpp
@@ -590,12 +733,15 @@ set(SHADER_RECOMPILER src/shader_recompiler/exception.h
src/shader_recompiler/frontend/structured_control_flow.h src/shader_recompiler/frontend/structured_control_flow.h
src/shader_recompiler/ir/passes/constant_propagation_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/flatten_extended_userdata_pass.cpp
src/shader_recompiler/ir/passes/hull_shader_transform.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
src/shader_recompiler/ir/passes/lower_shared_mem_to_registers.cpp src/shader_recompiler/ir/passes/lower_shared_mem_to_registers.cpp
src/shader_recompiler/ir/passes/resource_tracking_pass.cpp src/shader_recompiler/ir/passes/resource_tracking_pass.cpp
src/shader_recompiler/ir/passes/ring_access_elimination.cpp src/shader_recompiler/ir/passes/ring_access_elimination.cpp
src/shader_recompiler/ir/passes/shader_info_collection_pass.cpp src/shader_recompiler/ir/passes/shader_info_collection_pass.cpp
src/shader_recompiler/ir/passes/shared_memory_barrier_pass.cpp
src/shader_recompiler/ir/passes/ssa_rewrite_pass.cpp src/shader_recompiler/ir/passes/ssa_rewrite_pass.cpp
src/shader_recompiler/ir/abstract_syntax_list.h src/shader_recompiler/ir/abstract_syntax_list.h
src/shader_recompiler/ir/attribute.cpp src/shader_recompiler/ir/attribute.cpp
@@ -609,10 +755,13 @@ set(SHADER_RECOMPILER src/shader_recompiler/exception.h
src/shader_recompiler/ir/opcodes.cpp src/shader_recompiler/ir/opcodes.cpp
src/shader_recompiler/ir/opcodes.h src/shader_recompiler/ir/opcodes.h
src/shader_recompiler/ir/opcodes.inc src/shader_recompiler/ir/opcodes.inc
src/shader_recompiler/ir/patch.cpp
src/shader_recompiler/ir/patch.h
src/shader_recompiler/ir/post_order.cpp src/shader_recompiler/ir/post_order.cpp
src/shader_recompiler/ir/post_order.h src/shader_recompiler/ir/post_order.h
src/shader_recompiler/ir/program.cpp src/shader_recompiler/ir/program.cpp
src/shader_recompiler/ir/program.h src/shader_recompiler/ir/program.h
src/shader_recompiler/ir/reinterpret.h
src/shader_recompiler/ir/reg.h src/shader_recompiler/ir/reg.h
src/shader_recompiler/ir/type.cpp src/shader_recompiler/ir/type.cpp
src/shader_recompiler/ir/type.h src/shader_recompiler/ir/type.h
@@ -638,14 +787,10 @@ set(VIDEO_CORE src/video_core/amdgpu/liverpool.cpp
src/video_core/buffer_cache/word_manager.h src/video_core/buffer_cache/word_manager.h
src/video_core/renderer_vulkan/liverpool_to_vk.cpp src/video_core/renderer_vulkan/liverpool_to_vk.cpp
src/video_core/renderer_vulkan/liverpool_to_vk.h src/video_core/renderer_vulkan/liverpool_to_vk.h
src/video_core/renderer_vulkan/renderer_vulkan.cpp
src/video_core/renderer_vulkan/renderer_vulkan.h
src/video_core/renderer_vulkan/vk_common.cpp src/video_core/renderer_vulkan/vk_common.cpp
src/video_core/renderer_vulkan/vk_common.h src/video_core/renderer_vulkan/vk_common.h
src/video_core/renderer_vulkan/vk_compute_pipeline.cpp src/video_core/renderer_vulkan/vk_compute_pipeline.cpp
src/video_core/renderer_vulkan/vk_compute_pipeline.h src/video_core/renderer_vulkan/vk_compute_pipeline.h
src/video_core/renderer_vulkan/vk_descriptor_update_queue.cpp
src/video_core/renderer_vulkan/vk_descriptor_update_queue.h
src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
src/video_core/renderer_vulkan/vk_graphics_pipeline.h src/video_core/renderer_vulkan/vk_graphics_pipeline.h
src/video_core/renderer_vulkan/vk_instance.cpp src/video_core/renderer_vulkan/vk_instance.cpp
@@ -658,12 +803,16 @@ set(VIDEO_CORE src/video_core/amdgpu/liverpool.cpp
src/video_core/renderer_vulkan/vk_pipeline_common.h src/video_core/renderer_vulkan/vk_pipeline_common.h
src/video_core/renderer_vulkan/vk_platform.cpp src/video_core/renderer_vulkan/vk_platform.cpp
src/video_core/renderer_vulkan/vk_platform.h src/video_core/renderer_vulkan/vk_platform.h
src/video_core/renderer_vulkan/vk_presenter.cpp
src/video_core/renderer_vulkan/vk_presenter.h
src/video_core/renderer_vulkan/vk_rasterizer.cpp src/video_core/renderer_vulkan/vk_rasterizer.cpp
src/video_core/renderer_vulkan/vk_rasterizer.h src/video_core/renderer_vulkan/vk_rasterizer.h
src/video_core/renderer_vulkan/vk_resource_pool.cpp src/video_core/renderer_vulkan/vk_resource_pool.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_hle.cpp
src/video_core/renderer_vulkan/vk_shader_hle.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
@@ -718,6 +867,12 @@ set(EMULATOR src/emulator.cpp
if(ENABLE_QT_GUI) if(ENABLE_QT_GUI)
qt_add_resources(RESOURCE_FILES src/shadps4.qrc) qt_add_resources(RESOURCE_FILES src/shadps4.qrc)
if (ENABLE_UPDATER)
set(UPDATER src/qt_gui/check_update.cpp
src/qt_gui/check_update.h
)
endif()
set(QT_GUI src/qt_gui/about_dialog.cpp 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
@@ -725,8 +880,8 @@ set(QT_GUI src/qt_gui/about_dialog.cpp
src/qt_gui/background_music_player.h src/qt_gui/background_music_player.h
src/qt_gui/cheats_patches.cpp src/qt_gui/cheats_patches.cpp
src/qt_gui/cheats_patches.h src/qt_gui/cheats_patches.h
src/qt_gui/check_update.cpp src/qt_gui/compatibility_info.cpp
src/qt_gui/check_update.h src/qt_gui/compatibility_info.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
@@ -757,6 +912,7 @@ set(QT_GUI src/qt_gui/about_dialog.cpp
${EMULATOR} ${EMULATOR}
${RESOURCE_FILES} ${RESOURCE_FILES}
${TRANSLATIONS} ${TRANSLATIONS}
${UPDATER}
) )
endif() endif()
@@ -793,20 +949,41 @@ endif()
create_target_directory_groups(shadps4) create_target_directory_groups(shadps4)
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg Dear_ImGui gcn half::half) target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg Dear_ImGui gcn half::half ZLIB::ZLIB PNG::PNG)
target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::SPIRV glslang::glslang SDL3::SDL3 pugixml::pugixml) target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator LibAtrac9 sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::glslang SDL3::SDL3 pugixml::pugixml stb::headers)
target_compile_definitions(shadps4 PRIVATE IMGUI_USER_CONFIG="imgui/imgui_config.h") target_compile_definitions(shadps4 PRIVATE IMGUI_USER_CONFIG="imgui/imgui_config.h")
target_compile_definitions(Dear_ImGui PRIVATE IMGUI_USER_CONFIG="${PROJECT_SOURCE_DIR}/src/imgui/imgui_config.h") target_compile_definitions(Dear_ImGui PRIVATE IMGUI_USER_CONFIG="${PROJECT_SOURCE_DIR}/src/imgui/imgui_config.h")
if (ENABLE_DISCORD_RPC)
target_compile_definitions(shadps4 PRIVATE ENABLE_DISCORD_RPC)
endif()
# Optional due to https://github.com/shadps4-emu/shadPS4/issues/1704
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND ENABLE_USERFAULTFD)
target_compile_definitions(shadps4 PRIVATE ENABLE_USERFAULTFD)
endif()
if (APPLE) if (APPLE)
option(USE_SYSTEM_VULKAN_LOADER "Enables using the system Vulkan loader instead of directly linking with MoltenVK. Useful for loading validation layers." OFF) if (ENABLE_QT_GUI)
if (USE_SYSTEM_VULKAN_LOADER) # Include MoltenVK in the app bundle, along with an ICD file so it can be found by the system Vulkan loader if used for loading layers.
target_compile_definitions(shadps4 PRIVATE USE_SYSTEM_VULKAN_LOADER=1) set(MVK_ICD ${CMAKE_CURRENT_SOURCE_DIR}/externals/MoltenVK/MoltenVK_icd.json)
target_sources(shadps4 PRIVATE ${MVK_ICD})
set_source_files_properties(${MVK_ICD} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/vulkan/icd.d)
set(MVK_DYLIB_SRC ${CMAKE_CURRENT_BINARY_DIR}/externals/MoltenVK/libMoltenVK.dylib)
set(MVK_DYLIB_DST ${CMAKE_CURRENT_BINARY_DIR}/shadps4.app/Contents/Frameworks/libMoltenVK.dylib)
add_custom_command(
OUTPUT ${MVK_DYLIB_DST}
DEPENDS ${MVK_DYLIB_SRC}
COMMAND cmake -E copy ${MVK_DYLIB_SRC} ${MVK_DYLIB_DST})
add_custom_target(CopyMoltenVK DEPENDS ${MVK_DYLIB_DST})
add_dependencies(CopyMoltenVK MoltenVK)
add_dependencies(shadps4 CopyMoltenVK)
set_property(TARGET shadps4 APPEND PROPERTY BUILD_RPATH "@executable_path/../Frameworks")
else() else()
# Link MoltenVK for Vulkan support # For non-bundled SDL build, just do a normal library link.
find_library(MOLTENVK MoltenVK REQUIRED) target_link_libraries(shadps4 PRIVATE MoltenVK)
target_link_libraries(shadps4 PRIVATE ${MOLTENVK})
endif() endif()
if (ARCHITECTURE STREQUAL "x86_64") if (ARCHITECTURE STREQUAL "x86_64")
@@ -823,14 +1000,17 @@ if (NOT ENABLE_QT_GUI)
endif() endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND MSVC) if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND MSVC)
target_link_libraries(shadps4 PRIVATE cryptoppwin zlib-ng::zlib) target_link_libraries(shadps4 PRIVATE cryptoppwin)
else() else()
target_link_libraries(shadps4 PRIVATE cryptopp::cryptopp zlib-ng::zlib) target_link_libraries(shadps4 PRIVATE cryptopp::cryptopp)
endif() endif()
if (ENABLE_QT_GUI) if (ENABLE_QT_GUI)
target_link_libraries(shadps4 PRIVATE Qt6::Widgets Qt6::Concurrent Qt6::Network Qt6::Multimedia) target_link_libraries(shadps4 PRIVATE Qt6::Widgets Qt6::Concurrent Qt6::Network Qt6::Multimedia)
add_definitions(-DENABLE_QT_GUI) add_definitions(-DENABLE_QT_GUI)
if (ENABLE_UPDATER)
add_definitions(-DENABLE_UPDATER)
endif()
endif() endif()
if (WIN32) if (WIN32)
@@ -894,7 +1074,10 @@ if (ENABLE_QT_GUI)
set_target_properties(shadps4 PROPERTIES set_target_properties(shadps4 PROPERTIES
# WIN32_EXECUTABLE ON # WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON MACOSX_BUNDLE ON
MACOSX_BUNDLE_ICON_FILE shadPS4.icns) MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/dist/MacOSBundleInfo.plist.in"
MACOSX_BUNDLE_ICON_FILE "shadPS4.icns"
MACOSX_BUNDLE_SHORT_VERSION_STRING "0.4.1"
)
set_source_files_properties(src/images/shadPS4.icns PROPERTIES set_source_files_properties(src/images/shadPS4.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources) MACOSX_PACKAGE_LOCATION Resources)
@@ -916,6 +1099,8 @@ endif()
install(TARGETS shadps4 BUNDLE DESTINATION .) install(TARGETS shadps4 BUNDLE DESTINATION .)
if (ENABLE_QT_GUI AND CMAKE_SYSTEM_NAME STREQUAL "Linux") if (ENABLE_QT_GUI AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
install(FILES ".github/shadps4.desktop" DESTINATION "share/applications") install(FILES "dist/net.shadps4.shadPS4.desktop" DESTINATION "share/applications")
install(FILES ".github/shadps4.png" DESTINATION "share/icons/hicolor/512x512/apps") install(FILES "dist/net.shadps4.shadPS4.metainfo.xml" DESTINATION "share/metainfo")
install(FILES ".github/shadps4.png" DESTINATION "share/icons/hicolor/512x512/apps" RENAME "net.shadps4.shadPS4.png")
install(FILES "src/images/net.shadps4.shadPS4.svg" DESTINATION "share/icons/hicolor/scalable/apps")
endif() endif()

View File

@@ -55,6 +55,9 @@ This project began as a fun project. Given our limited free time, it may take so
# Building # Building
> [!IMPORTANT]
> If you want to use shadPS4 to play your games, you don't have to follow the build instructions, you can simply download the emulator from either the [**release tab**](https://github.com/shadps4-emu/shadPS4/releases) or the [**action tab**](https://github.com/shadps4-emu/shadPS4/actions).
## Windows ## Windows
Check the build instructions for [**Windows**](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-windows.md). Check the build instructions for [**Windows**](https://github.com/shadps4-emu/shadPS4/blob/main/documents/building-windows.md).
@@ -76,10 +79,20 @@ For more information on how to test, debug and report issues with the emulator o
# Keyboard mapping # Keyboard mapping
> [!NOTE]
> Some keyboards may also require you to hold the Fn key to use the F\* keys. Mac users should use the Command key instead of Control, and need to use Command+F11 for full screen to avoid conflicting with system key bindings.
| Button | Function |
|-------------|-------------|
F10 | FPS Counter
Ctrl+F10 | Video Debug Info
F11 | Fullscreen
F12 | Trigger RenderDoc Capture
> [!NOTE] > [!NOTE]
> Xbox and DualShock controllers work out of the box. > Xbox and DualShock controllers work out of the box.
| Controller button | Keyboard equivelant | | Controller button | Keyboard equivalent |
|-------------|-------------| |-------------|-------------|
LEFT AXIS UP | W | LEFT AXIS UP | W |
LEFT AXIS DOWN | S | LEFT AXIS DOWN | S |
@@ -89,10 +102,10 @@ RIGHT AXIS UP | I |
RIGHT AXIS DOWN | K | RIGHT AXIS DOWN | K |
RIGHT AXIS LEFT | J | RIGHT AXIS LEFT | J |
RIGHT AXIS RIGHT | L | RIGHT AXIS RIGHT | L |
TRIANGLE | Numpad 8 | TRIANGLE | Numpad 8 or C |
CIRCLE | Numpad 6 | CIRCLE | Numpad 6 or B |
CROSS | Numpad 2 | CROSS | Numpad 2 or N |
SQUARE | Numpad 4 | SQUARE | Numpad 4 or V |
PAD UP | UP | PAD UP | UP |
PAD DOWN | DOWN | PAD DOWN | DOWN |
PAD LEFT | LEFT | PAD LEFT | LEFT |
@@ -114,6 +127,11 @@ R3 | M |
- [**skmp**](https://github.com/skmp) - [**skmp**](https://github.com/skmp)
- [**wheremyfoodat**](https://github.com/wheremyfoodat) - [**wheremyfoodat**](https://github.com/wheremyfoodat)
- [**raziel1000**](https://github.com/raziel1000) - [**raziel1000**](https://github.com/raziel1000)
- [**viniciuslrangel**](https://github.com/viniciuslrangel)
- [**roamic**](https://github.com/vladmikhalin)
- [**poly**](https://github.com/polybiusproxy)
- [**squidbus**](https://github.com/squidbus)
- [**frodo**](https://github.com/baggins183)
Logo is done by [**Xphalnos**](https://github.com/Xphalnos) Logo is done by [**Xphalnos**](https://github.com/Xphalnos)

View File

@@ -5,15 +5,21 @@ path = [
"REUSE.toml", "REUSE.toml",
"CMakeSettings.json", "CMakeSettings.json",
".github/FUNDING.yml", ".github/FUNDING.yml",
".github/shadps4.desktop",
".github/shadps4.png", ".github/shadps4.png",
".gitmodules", ".gitmodules",
"documents/changelog.txt", "dist/MacOSBundleInfo.plist.in",
"dist/net.shadps4.shadPS4.desktop",
"dist/net.shadps4.shadPS4_metadata.pot",
"dist/net.shadps4.shadPS4.metainfo.xml",
"documents/changelog.md",
"documents/Quickstart/2.png", "documents/Quickstart/2.png",
"documents/Screenshots/*", "documents/Screenshots/*",
"documents/Screenshots/Linux/*",
"externals/MoltenVK/MoltenVK_icd.json",
"scripts/ps4_names.txt", "scripts/ps4_names.txt",
"src/images/about_icon.png", "src/images/about_icon.png",
"src/images/controller_icon.png", "src/images/controller_icon.png",
"src/images/discord.png",
"src/images/dump_icon.png", "src/images/dump_icon.png",
"src/images/exit_icon.png", "src/images/exit_icon.png",
"src/images/file_icon.png", "src/images/file_icon.png",
@@ -24,8 +30,10 @@ path = [
"src/images/flag_us.png", "src/images/flag_us.png",
"src/images/flag_world.png", "src/images/flag_world.png",
"src/images/folder_icon.png", "src/images/folder_icon.png",
"src/images/github.png",
"src/images/grid_icon.png", "src/images/grid_icon.png",
"src/images/iconsize_icon.png", "src/images/iconsize_icon.png",
"src/images/ko-fi.png",
"src/images/list_icon.png", "src/images/list_icon.png",
"src/images/list_mode_icon.png", "src/images/list_mode_icon.png",
"src/images/pause_icon.png", "src/images/pause_icon.png",
@@ -33,10 +41,14 @@ path = [
"src/images/refresh_icon.png", "src/images/refresh_icon.png",
"src/images/settings_icon.png", "src/images/settings_icon.png",
"src/images/stop_icon.png", "src/images/stop_icon.png",
"src/images/utils_icon.png",
"src/images/shadPS4.icns", "src/images/shadPS4.icns",
"src/images/shadps4.ico", "src/images/shadps4.ico",
"src/images/net.shadps4.shadPS4.svg",
"src/images/themes_icon.png", "src/images/themes_icon.png",
"src/images/update_icon.png", "src/images/update_icon.png",
"src/images/youtube.png",
"src/images/website.png",
"src/shadps4.qrc", "src/shadps4.qrc",
"src/shadps4.rc", "src/shadps4.rc",
] ]
@@ -57,7 +69,7 @@ SPDX-FileCopyrightText = "2019-2024 Baldur Karlsson"
SPDX-License-Identifier = "MIT" SPDX-License-Identifier = "MIT"
[[annotations]] [[annotations]]
path = "externals/stb_image.h" path = "externals/stb/**"
precedence = "aggregate" precedence = "aggregate"
SPDX-FileCopyrightText = "2017 Sean Barrett" SPDX-FileCopyrightText = "2017 Sean Barrett"
SPDX-License-Identifier = "MIT" SPDX-License-Identifier = "MIT"

19
cmake/Findstb.cmake Normal file
View File

@@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
find_path(stb_image_INCLUDE_DIR stb_image.h PATH_SUFFIXES stb)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(stb
REQUIRED_VARS stb_image_INCLUDE_DIR
)
if (stb_FOUND AND NOT TARGET stb::headers)
add_library(stb::headers INTERFACE IMPORTED)
set_property(TARGET stb::headers PROPERTY
INTERFACE_INCLUDE_DIRECTORIES
"${stb_image_INCLUDE_DIR}"
)
endif()
mark_as_advanced(stb_image_INCLUDE_DIR)

View File

@@ -1,15 +0,0 @@
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
find_package(PkgConfig QUIET)
pkg_search_module(ZLIB_NG QUIET IMPORTED_TARGET zlib-ng)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(zlib-ng
REQUIRED_VARS ZLIB_NG_LINK_LIBRARIES
VERSION_VAR ZLIB_NG_VERSION
)
if (zlib-ng_FOUND AND NOT TARGET zlib-ng::zlib)
add_library(zlib-ng::zlib ALIAS PkgConfig::ZLIB_NG)
endif()

46
dist/MacOSBundleInfo.plist.in vendored Normal file
View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>shadps4</string>
<key>CFBundleIdentifier</key>
<string>com.shadps4-emu.shadps4</string>
<key>CFBundleExecutable</key>
<string>shadps4</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>LSMinimumSystemVersion</key>
<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>GCSupportsGameMode</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>

View File

@@ -1,9 +1,9 @@
[Desktop Entry] [Desktop Entry]
Name=Shadps4 Name=shadPS4
Exec=shadps4 Exec=shadps4
Terminal=false Terminal=false
Type=Application Type=Application
Icon=shadps4 Icon=net.shadps4.shadPS4
Comment=shadps4 emulator Comment=PlayStation 4 emulator
Categories=Game; Categories=Game;
StartupWMClass=shadps4; StartupWMClass=shadps4;

84
dist/net.shadps4.shadPS4.metainfo.xml vendored Normal file
View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id translate="no">net.shadps4.shadPS4</id>
<name translate="no">shadPS4</name>
<developer id="net.shadps4.shadPS4">
<name>shadPS4 Contributors</name>
<url translate="no">https://github.com/shadps4-emu/shadps4/graphs/contributors</url>
</developer>
<summary>PS4 Emulator</summary>
<metadata_license translate="no">CC0-1.0</metadata_license>
<project_license translate="no">GPL-2.0</project_license>
<launchable type="desktop-id" translate="no">net.shadps4.shadPS4.desktop</launchable>
<url type="homepage" translate="no">https://shadps4.net/</url>
<description>
<p>shadPS4 is an early PlayStation 4 emulator for Windows, Linux and macOS written in C++.</p>
<p>The emulator is still early in development, so don't expect a flawless experience. Nonetheless, the emulator can already run a number of commercial games.</p>
</description>
<screenshots>
<screenshot type="default">
<image type="source" translate="no" >https://cdn.jsdelivr.net/gh/shadps4-emu/shadps4@main/documents/Screenshots/1.png</image>
<caption>Bloodborne</caption>
</screenshot>
<screenshot>
<image type="source" translate="no">https://cdn.jsdelivr.net/gh/shadps4-emu/shadps4@main/documents/Screenshots/2.png</image>
<caption>Hatsune Miku: Project DIVA Future Tone</caption>
</screenshot>
<screenshot>
<image type="source" translate="no">https://cdn.jsdelivr.net/gh/shadps4-emu/shadps4@main/documents/Screenshots/3.png</image>
<caption>Yakuza 0</caption>
</screenshot>
<screenshot>
<image type="source" translate="no">https://cdn.jsdelivr.net/gh/shadps4-emu/shadps4@main/documents/Screenshots/4.png</image>
<caption>Persona 4 Golden</caption>
</screenshot>
</screenshots>
<categories>
<category translate="no">Game</category>
</categories>
<releases>
<release version="0.5.0" date="2024-12-25">
<url>https://github.com/shadps4-emu/shadPS4/releases/tag/v.0.5.0</url>
</release>
<release version="0.4.0" date="2024-10-31">
<url>https://github.com/shadps4-emu/shadPS4/releases/tag/v.0.4.0</url>
</release>
<release version="0.3.0" date="2024-09-23">
<url>https://github.com/shadps4-emu/shadPS4/releases/tag/v.0.3.0</url>
</release>
<release version="0.2.0" date="2024-08-15">
<url>https://github.com/shadps4-emu/shadPS4/releases/tag/v.0.2.0</url>
</release>
<release version="0.1.0" date="2024-07-01">
<url>https://github.com/shadps4-emu/shadPS4/releases/tag/0.1.0</url>
</release>
<release version="0.0.3" date="2024-03-23">
<url>https://github.com/shadps4-emu/shadPS4/releases/tag/v0.0.3</url>
</release>
<release version="0.0.2" date="2023-10-21">
<url>https://github.com/shadps4-emu/shadPS4/releases/tag/v0.0.2</url>
</release>
<release version="0.0.1" date="2024-09-29">
<url>https://github.com/shadps4-emu/shadPS4/releases/tag/v0.0.1</url>
</release>
</releases>
<content_rating type="oars-1.1"/>
<supports>
<control translate="no">keyboard</control>
</supports>
<recommends>
<control translate="no">gamepad</control>
</recommends>
<requires>
<internet translate="no">offline-only</internet>
</requires>
<provides>
<binary translate="no">shadps4</binary>
</provides>
<keywords>
<keyword>emulator</keyword>
<keyword>emulation</keyword>
<keyword translate="no">playstation</keyword>
<keyword translate="no">ps4</keyword>
</keywords>
</component>

65
dist/net.shadps4.shadPS4_metadata.pot vendored Normal file
View File

@@ -0,0 +1,65 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-11-08 09:07+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. (itstool) path: component/name
#: ./net.shadps4.shadPS4.metainfo.xml:4
msgid "shadPS4"
msgstr ""
#. (itstool) path: developer/name
#: ./net.shadps4.shadPS4.metainfo.xml:6
msgid "shadPS4 Contributors"
msgstr ""
#. (itstool) path: component/summary
#: ./net.shadps4.shadPS4.metainfo.xml:9
msgid "PS4 Emulator"
msgstr ""
#. (itstool) path: description/p
#: ./net.shadps4.shadPS4.metainfo.xml:16
msgid "shadPS4 is an early PlayStation 4 emulator for Windows, Linux and macOS written in C++."
msgstr ""
#. (itstool) path: description/p
#: ./net.shadps4.shadPS4.metainfo.xml:17
msgid "The emulator is still early in development, so don't expect a flawless experience. Nonetheless, the emulator can already run a number of commercial games."
msgstr ""
#. (itstool) path: screenshot/caption
#: ./net.shadps4.shadPS4.metainfo.xml:22
msgid "Bloodborne"
msgstr ""
#. (itstool) path: screenshot/caption
#: ./net.shadps4.shadPS4.metainfo.xml:26
msgid "Hatsune Miku: Project DIVA Future Tone"
msgstr ""
#. (itstool) path: screenshot/caption
#: ./net.shadps4.shadPS4.metainfo.xml:30
msgid "Yakuza Kiwami"
msgstr ""
#. (itstool) path: screenshot/caption
#: ./net.shadps4.shadPS4.metainfo.xml:34
msgid "Persona 4 Golden"
msgstr ""
#. (itstool) path: keywords/keyword
#: ./net.shadps4.shadPS4.metainfo.xml:59
msgid "emulator"
msgstr ""
#. (itstool) path: keywords/keyword
#: ./net.shadps4.shadPS4.metainfo.xml:60
msgid "emulation"
msgstr ""

View File

@@ -22,7 +22,10 @@ SPDX-License-Identifier: GPL-2.0-or-later
- A processor with at least 4 cores and 6 threads - A processor with at least 4 cores and 6 threads
- Above 2.5 GHz frequency - Above 2.5 GHz frequency
- required support AVX2 extension or Rosetta 2 on ARM - A CPU supporting the following instruction sets: MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, F16C, CLMUL, AES, BMI1, MOVBE, XSAVE, ABM
- **Intel**: Haswell generation or newer
- **AMD**: Jaguar generation or newer
- **Apple**: Rosetta 2 on macOS 15 or newer
### GPU ### GPU

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -5,57 +5,132 @@ SPDX-License-Identifier: GPL-2.0-or-later
## Build shadPS4 for Linux ## Build shadPS4 for Linux
### Install the necessary tools to build shadPS4: First and foremost, Clang 18 is the **recommended compiler** as it is used for official builds and CI. If you build with GCC, you might encounter issues — please report any you find. Additionally, if you choose to use GCC, please build shadPS4 with Clang at least once before creating an `[APP BUG]` issue or submitting a pull request.
## Preparatory steps
### Installing dependencies
#### Debian & Ubuntu #### Debian & Ubuntu
``` ```
sudo apt install build-essential clang git cmake libasound2-dev libpulse-dev libopenal-dev libssl-dev zlib1g-dev libedit-dev libudev-dev libevdev-dev libsdl2-dev libjack-dev libsndio-dev qt6-base-dev qt6-tools-dev qt6-multimedia-dev libvulkan-dev vulkan-validationlayers sudo apt install build-essential clang git cmake libasound2-dev libpulse-dev libopenal-dev libssl-dev zlib1g-dev libedit-dev libudev-dev libevdev-dev libsdl2-dev libjack-dev libsndio-dev qt6-base-dev qt6-tools-dev qt6-multimedia-dev libvulkan-dev vulkan-validationlayers
``` ```
#### Fedora #### Fedora
``` ```
sudo dnf install clang git cmake libatomic alsa-lib-devel pipewire-jack-audio-connection-kit-devel openal-devel openssl-devel libevdev-devel libudev-devel libXext-devel qt6-qtbase-devel qt6-qtbase-private-devel qt6-qtmultimedia-devel qt6-qtsvg-devel qt6-qttools-devel vulkan-devel vulkan-validation-layers sudo dnf install clang git cmake libatomic alsa-lib-devel pipewire-jack-audio-connection-kit-devel openal-devel openssl-devel libevdev-devel libudev-devel libXext-devel qt6-qtbase-devel qt6-qtbase-private-devel qt6-qtmultimedia-devel qt6-qtsvg-devel qt6-qttools-devel vulkan-devel vulkan-validation-layers
``` ```
#### Arch Linux #### Arch Linux
``` ```
sudo pacman -S base-devel clang git cmake sndio jack2 openal qt6-base qt6-declarative qt6-multimedia sdl2 vulkan-validation-layers sudo pacman -S base-devel clang git cmake sndio jack2 openal qt6-base qt6-declarative qt6-multimedia sdl2 vulkan-validation-layers
``` ```
**Note**: The `shadps4-git` AUR package is not maintained by any of the developers, and it uses the default compiler, which is often set to GCC. Use at your own discretion.
#### OpenSUSE #### OpenSUSE
``` ```
sudo zypper install clang git cmake libasound2 libpulse-devel libsndio7 libjack-devel openal-soft-devel libopenssl-devel zlib-devel libedit-devel systemd-devel libevdev-devel qt6-base-devel qt6-multimedia-devel qt6-svg-devel qt6-linguist-devel qt6-gui-private-devel vulkan-devel vulkan-validationlayers sudo zypper install clang git cmake libasound2 libpulse-devel libsndio7 libjack-devel openal-soft-devel libopenssl-devel zlib-devel libedit-devel systemd-devel libevdev-devel qt6-base-devel qt6-multimedia-devel qt6-svg-devel qt6-linguist-devel qt6-gui-private-devel vulkan-devel vulkan-validationlayers
``` ```
### Cloning and compiling:
Clone the repository recursively: #### Other Linux distributions
You can try one of two methods:
- Search the packages by name and install them with your package manager, or
- Install [distrobox](https://distrobox.it/), create a container using any of the distributions cited above as a base, for Arch Linux you'd do:
```
distrobox create --name archlinux --init --image archlinux:latest
```
and install the dependencies on that container as cited above.
This option is **highly recommended** for NixOS and distributions with immutable/atomic filesystems (example: Fedora Kinoite, SteamOS).
### Cloning
``` ```
git clone --recursive https://github.com/shadps4-emu/shadPS4.git git clone --recursive https://github.com/shadps4-emu/shadPS4.git
cd shadPS4 cd shadPS4
``` ```
Generate the build directory in the shadPS4 directory. To disable the QT GUI, remove the ```-DENABLE_QT_GUI=ON``` flag: ## Building
There are 3 options you can choose from. Option 1 is **highly recommended**.
#### Option 1: Terminal-only
1. Generate the build directory in the shadPS4 directory.
**Note**: Clang is the compiler used for official builds and CI. If you build with GCC, you might encounter issues—please report any you find. If you choose to use GCC, we recommend building with Clang at least once before submitting a pull request.
``` ```
cmake -S . -B build/ -DENABLE_QT_GUI=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ cmake -S . -B build/ -DENABLE_QT_GUI=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
``` ```
Enter the directory: To disable the Qt GUI, remove the `-DENABLE_QT_GUI=ON` flag. To change the build type (for debugging), add `-DCMAKE_BUILD_TYPE=Debug`.
2. Use CMake to build the project:
``` ```
cd build/ cmake --build ./build --parallel$(nproc)
``` ```
Use make to build the project: If your computer freezes during this step, this could be caused by excessive system resource usage. In that case, remove `--parallel$(nproc)`.
Now run the emulator. If Qt was enabled at configure time:
``` ```
cmake --build . --parallel$(nproc) ./build/shadps4
``` ```
Now run the emulator. If QT is enabled:
```
./shadps4
```
Otherwise, specify the path to your PKG's boot file: Otherwise, specify the path to your PKG's boot file:
``` ```
./shadps4 /"PATH"/"TO"/"GAME"/"FOLDER"/eboot.bin ./build/shadps4 /"PATH"/"TO"/"GAME"/"FOLDER"/eboot.bin
``` ```
You can also specify the Game ID as an argument for which game to boot, as long as the folder containing the games is specified in config.toml (example: Bloodborne (US) is CUSA00900).
#### Option 2: Configuring with cmake-gui
`cmake-gui` should be installed by default alongside `cmake`, if not search for the package in your package manager and install it.
Open `cmake-gui` and specify the source code and build directories. If you cloned the source code to your Home directory, it would be `/home/user/shadPS4` and `/home/user/shadPS4/build`.
Click on Configure, select "Unix Makefiles", select "Specify native compilers", click Next and choose `clang` and `clang++` as the C and CXX compilers. Usually they are located in `/bin/clang` and `/bin/clang++`. Click on Finish and let it configure the project.
Now every option should be displayed in red. Change anything you want, then click on Generate to make the changes permanent, then open a terminal window and do step 2 of Option 1.
#### Option 3: Visual Studio Code
This option is pretty convoluted and should only be used if you have VSCode as your default IDE, or just prefer building and debugging projects through it. This also assumes that you're using an Arch Linux environment, as the naming for some options might differ from other distros.
[Download Visual Studio Code for your platform](https://code.visualstudio.com/download), or use [Code - OSS](https://github.com/microsoft/vscode) if you'd like. Code - OSS is available on most Linux distributions' package repositories (on Arch Linux it is simply named `code`).
Once set up, go to Extensions and install "CMake Tools":
![image](https://raw.githubusercontent.com/shadps4-emu/shadPS4/refs/heads/main/documents/Screenshots/Linux/3.png)
You can also install other CMake and Clang related extensions if you'd like, but this one is what enables you to configure and build CMake projects directly within VSCode.
Go to Settings, filter by `@ext:ms-vscode.cmake-tools configure` and disable this option:
![image](https://raw.githubusercontent.com/shadps4-emu/shadPS4/refs/heads/main/documents/Screenshots/Linux/1.png)
If you wish to build with the Qt GUI, add `-DENABLE_QT_GUI=ON` to the configure arguments:
![image](https://raw.githubusercontent.com/shadps4-emu/shadPS4/refs/heads/main/documents/Screenshots/Linux/2.png)
On the CMake tab, change the options as you wish, but make sure that it looks similar to or exactly like this:
![image](https://raw.githubusercontent.com/shadps4-emu/shadPS4/refs/heads/main/documents/Screenshots/Linux/4.png)
When hovering over Project Status > Configure, there should be an icon titled "Configure". Click on it and let it configure the project, then do the same for Project Status > Build.
If you want to debug it, change the build type under Project Status > Configure to Debug (it should be the default) and compile it, then click on the icon in Project Status > Debug. If you simply want to launch the shadPS4 executable from within VSCode, click on the icon in Project Status > Launch.
Don't forget to change the launch target for both options to the shadPS4 executable inside shadPS4/build:
![image](https://raw.githubusercontent.com/shadps4-emu/shadPS4/refs/heads/main/documents/Screenshots/Linux/5.png)

View File

@@ -24,23 +24,21 @@ eval $(/opt/homebrew/bin/brew shellenv)
brew install clang-format cmake brew install clang-format cmake
``` ```
Next, install x86_64 Homebrew and libraries. Next, install x86_64 Qt. You can skip these steps and move on to **Cloning and compiling** if you do not intend to build the Qt GUI.
**If you are on an ARM Mac:** **If you are on an ARM Mac:**
``` ```
# Installs x86_64 Homebrew to /usr/local # Installs x86_64 Homebrew to /usr/local
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Installs libraries. # Installs libraries.
arch -x86_64 /usr/local/bin/brew install molten-vk qt@6 arch -x86_64 /usr/local/bin/brew install qt@6
``` ```
**If you are on an x86_64 Mac:** **If you are on an x86_64 Mac:**
``` ```
brew install molten-vk qt@6 brew install qt@6
``` ```
If you don't need the Qt GUI you can remove `qt@6` from the last command.
### Cloning and compiling: ### Cloning and compiling:
Clone the repository recursively: Clone the repository recursively:

View File

@@ -25,8 +25,8 @@ Once you are within the installer:
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. 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. 1. Under the current, non beta version of Qt (at the time of writing 6.7.3), select the option `MSVC 2022 64-bit` or similar, as well as `QT Multimedia`.
If you are on Windows on ARM / Qualcomm Snapdragon Elite X, select `MSVC 2019 ARM64` instead. If you are on Windows on ARM / Qualcomm Snapdragon Elite X, select `MSVC 2022 ARM64` instead.
Go through the installation normally. If you know what you are doing, you may unselect individual components that eat up too much disk space. Go through the installation normally. If you know what you are doing, you may unselect individual components that eat up too much disk space.
@@ -35,7 +35,7 @@ Beware, this requires you to create a Qt account. If you do not want to do this,
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.2\msvc2019_64` 2. Add a new Qt version and navigate it to the correct folder. Should look like so: `C:\Qt\6.7.3\msvc2022_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)
@@ -55,16 +55,16 @@ Go through the Git for Windows installation as normal
3. If you want to build shadPS4 with the Qt Gui: 3. If you want to build shadPS4 with the Qt Gui:
1. Click x64-Clang-Release and select "Manage Configurations" 1. Click x64-Clang-Release and select "Manage Configurations"
2. Look for "CMake command arguments" and add to the text field 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` `-DENABLE_QT_GUI=ON -DCMAKE_PREFIX_PATH=C:\Qt\6.7.3\msvc2022_64`
(Change Qt path if you've installed it to non-default path) (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 3. Press CTRL+S to save and wait a moment for CMake generation
4. Change the project to build to shadps4.exe 4. Change the project to build to shadps4.exe
5. Build -> Build All 5. Build -> Build All
Your shadps4.exe will be in `c:\path\to\source\Build\x64-Clang-Release\` 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: 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"` `C:\Qt\6.7.3\msvc2022_64\bin\windeployqt6.exe "C:\path\to\shadps4.exe"`
(Change Qt path if you've installed it to non-default path) (Change Qt path if you've installed it to non-default path)
## Option 2: MSYS2/MinGW ## Option 2: MSYS2/MinGW
@@ -79,7 +79,7 @@ Normal x86-based computers, follow:
1. Open "MSYS2 MINGW64" from your new applications 1. Open "MSYS2 MINGW64" from your new applications
2. Run `pacman -Syu`, let it complete; 2. Run `pacman -Syu`, let it complete;
3. Run `pacman -S --needed git mingw-w64-x86_64-binutils mingw-w64-x86_64-clang mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-ffmpeg` 3. Run `pacman -S --needed git mingw-w64-x86_64-binutils mingw-w64-x86_64-clang mingw-w64-x86_64-cmake mingw-w64-x86_64-rapidjson mingw-w64-x86_64-ninja mingw-w64-x86_64-ffmpeg`
1. Optional (Qt only): run `pacman -S --needed mingw-w64-x86_64-qt6-base mingw-w64-x86_64-qt6-tools mingw-w64-x86_64-qt6-multimedia` 1. Optional (Qt only): run `pacman -S --needed mingw-w64-x86_64-qt6-base mingw-w64-x86_64-qt6-tools mingw-w64-x86_64-qt6-multimedia`
4. Run `git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4` 4. Run `git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4`
5. Run `cd shadPS4` 5. Run `cd shadPS4`
@@ -93,7 +93,7 @@ ARM64-based computers, follow:
1. Open "MSYS2 CLANGARM64" from your new applications 1. Open "MSYS2 CLANGARM64" from your new applications
2. Run `pacman -Syu`, let it complete; 2. Run `pacman -Syu`, let it complete;
3. Run `pacman -S --needed git mingw-w64-clang-aarch64-binutils mingw-w64-clang-aarch64-clang mingw-w64-clang-aarch64-cmake mingw-w64-clang-aarch64-ninja mingw-w64-clang-aarch64-ffmpeg` 3. Run `pacman -S --needed git mingw-w64-clang-aarch64-binutils mingw-w64-clang-aarch64-clang mingw-w64-clang-aarch64-rapidjson mingw-w64-clang-aarch64-cmake mingw-w64-clang-aarch64-ninja mingw-w64-clang-aarch64-ffmpeg`
1. Optional (Qt only): run `pacman -S --needed mingw-w64-clang-aarch64-qt6-base mingw-w64-clang-aarch64-qt6-tools mingw-w64-clang-aarch64-qt6-multimedia` 1. Optional (Qt only): run `pacman -S --needed mingw-w64-clang-aarch64-qt6-base mingw-w64-clang-aarch64-qt6-tools mingw-w64-clang-aarch64-qt6-multimedia`
4. Run `git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4` 4. Run `git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4`
5. Run `cd shadPS4` 5. Run `cd shadPS4`

View File

@@ -1,3 +1,47 @@
v0.4.0 31/10/2024 - codename divicius
=================
- Shader recompiler fixes
- Emulated support for cpus that doesn't have SSE4.2a (intel cpus)
- Frame graph + Precise 60 fps timing
- Save data: fix nullptr & concurrent file write
- Auto Update
- Error dialog implementation
- Swapchain recreation and window resizing
- Add playback of background/title music in game list
- Kernel: Quiet sceKernelWaitEventFlag error log on timeout
- Improve keyboard navigation in game list
- core/memory: Pooled memory implementation
- Fix PKG loading
- replace trophy xml assert with error
- Refactor audio handling with range checks, buffer threshold, and lock
- audio_core: Fix return value types and shift some error handling to library
- Devtools: PM4 Explorer
- Initial support of Geometry shaders
- Working touchpad support
- net: Stub sceNetErrnoLoc
- Add support to click touchpad using back button on non PS4/5 controllers
- Multiple Install Folders
- Using a more standard data directory for linux
- video_core: Implement sceGnmInsertPushColorMarker
- ime_dialog: Initial implementation
- Network libs fixes
- Use GetSystemTimePreciseAsFileTime to fix fps timing issues
- Added adaptive mutex initializer
- Small Np + trophy fixes
- Separate Updates from Game Folder
- Minor Fixes for Separate Update Folder
- AvPlayer: Do not align w/h to 16 with vdec2
- Improve sceSystemServiceReceiveEvent stub
- renderer_vulkan: Commize and adjust buffer bindings
- Add poll interval to libScePad
- Add more surface format mappings.
- vulkan: Report only missing format feature flags.
- IME implementation
- Videodec2 implementation
- path_util: Make sure macOS has current directory set and clean up path code.
- Load LLE modules from sys_modules/GAMEID folder
v0.3.0 23/09/2024 - codename broamic v0.3.0 23/09/2024 - codename broamic
================= =================

View File

@@ -0,0 +1,19 @@
<!--
SPDX-FileCopyrightText: 2024 shadPS4 Emulator Project
SPDX-License-Identifier: GPL-2.0-or-later
-->
### Install Vulkan SDK and \*ensure `spirv-cross` and `glslc` are in PATH\*.
1. Enable `dumpShaders` in config.toml
2. Run `spirv-cross -V fs_0x000000.spv --output fs_0x000000.glsl` to decompile the SPIR-V IR to GLSL.
3. Edit the GLSL file as you wish
4. To compile back to SPIR-V, run (change the _**-fshader-stage**_ to correct stage):
`glslc --target-env=vulkan1.3 --target-spv=spv1.6 -fshader-stage=frag fs_0x000000.glsl -o fs_0x000000.spv`
5. Put the updated .spv file to `shader/patch` folder with the same name as the original shader
6. Enable `patchShaders` in config.toml

View File

@@ -8,6 +8,9 @@ set_directory_properties(PROPERTIES
SYSTEM ON SYSTEM ON
) )
# Set CMP0069 policy to "NEW" in order to ensure consistent behavior when building external targets with LTO enabled
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
if (MSVC) if (MSVC)
# Silence "deprecation" warnings # Silence "deprecation" warnings
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
@@ -35,10 +38,11 @@ else()
if (NOT TARGET cryptopp::cryptopp) if (NOT TARGET cryptopp::cryptopp)
set(CRYPTOPP_INSTALL OFF) set(CRYPTOPP_INSTALL OFF)
set(CRYPTOPP_BUILD_TESTING OFF) set(CRYPTOPP_BUILD_TESTING OFF)
set(CRYPTOPP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/) set(CRYPTOPP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp)
add_subdirectory(cryptopp-cmake) add_subdirectory(cryptopp-cmake)
file(COPY cryptopp DESTINATION cryptopp FILES_MATCHING PATTERN "*.h") file(COPY cryptopp DESTINATION cryptopp FILES_MATCHING PATTERN "*.h")
target_include_directories(cryptopp INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/cryptopp") # remove externals/cryptopp from include directories because it contains a conflicting zlib.h file
set_target_properties(cryptopp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/cryptopp")
endif() endif()
endif() endif()
@@ -47,14 +51,28 @@ if (NOT TARGET FFmpeg::ffmpeg)
add_library(FFmpeg::ffmpeg ALIAS ffmpeg) add_library(FFmpeg::ffmpeg ALIAS ffmpeg)
endif() endif()
# Zlib-Ng # LibAtrac9
if (NOT TARGET zlib-ng::zlib) file(GLOB LIBATRAC9_SOURCES LibAtrac9/C/src/*.c)
add_library(LibAtrac9 STATIC ${LIBATRAC9_SOURCES})
target_include_directories(LibAtrac9 INTERFACE LibAtrac9/C/src)
# zlib
if (NOT TARGET ZLIB::ZLIB)
set(ZLIB_ENABLE_TESTS OFF) set(ZLIB_ENABLE_TESTS OFF)
set(WITH_GTEST OFF) set(WITH_GTEST OFF)
set(WITH_NEW_STRATEGIES ON) set(WITH_NEW_STRATEGIES ON)
set(WITH_NATIVE_INSTRUCTIONS ON) set(WITH_NATIVE_INSTRUCTIONS ON)
add_subdirectory(zlib-ng) set(ZLIB_COMPAT ON CACHE BOOL "" FORCE)
add_library(zlib-ng::zlib ALIAS zlib) include(FetchContent)
FetchContent_Declare(
ZLIB
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/zlib-ng"
OVERRIDE_FIND_PACKAGE
)
FetchContent_MakeAvailable(ZLIB)
add_library(ZLIB::ZLIB ALIAS zlib)
# libpng expects this variable to exist after its find_package(ZLIB)
set(ZLIB_INCLUDE_DIRS "${FETCHCONTENT_BASE_DIR}/zlib-build")
endif() endif()
# SDL3 # SDL3
@@ -92,7 +110,7 @@ if (NOT TARGET glslang::glslang)
set(ENABLE_OPT OFF CACHE BOOL "") set(ENABLE_OPT OFF CACHE BOOL "")
add_subdirectory(glslang) add_subdirectory(glslang)
file(COPY glslang/SPIRV DESTINATION glslang/glslang FILES_MATCHING PATTERN "*.h") file(COPY glslang/SPIRV DESTINATION glslang/glslang FILES_MATCHING PATTERN "*.h")
target_include_directories(SPIRV INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/glslang") target_include_directories(glslang INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/glslang")
endif() endif()
# Robin-map # Robin-map
@@ -148,13 +166,15 @@ if (NOT TARGET half::half)
add_library(half::half ALIAS half) add_library(half::half ALIAS half)
endif() endif()
if (APPLE) # libpng
# date if (NOT TARGET PNG::PNG)
if (NOT TARGET date::date-tz) set(PNG_SHARED OFF CACHE BOOL "" FORCE)
option(BUILD_TZ_LIB "" ON) set(PNG_STATIC ON CACHE BOOL "" FORCE)
option(USE_SYSTEM_TZ_DB "" ON) set(PNG_TESTS OFF CACHE BOOL "" FORCE)
add_subdirectory(date) set(PNG_TOOLS OFF CACHE BOOL "" FORCE)
endif() set(SKIP_INSTALL_ALL OFF CACHE BOOL "" FORCE)
add_subdirectory(libpng)
add_library(PNG::PNG ALIAS png_static)
endif() endif()
# Dear ImGui # Dear ImGui
@@ -169,11 +189,15 @@ add_library(Dear_ImGui
target_include_directories(Dear_ImGui INTERFACE dear_imgui/) target_include_directories(Dear_ImGui INTERFACE dear_imgui/)
# Tracy # Tracy
option(TRACY_ENABLE "" ON) if (CMAKE_BUILD_TYPE STREQUAL "Release")
option(TRACY_ENABLE "" OFF)
else()
option(TRACY_ENABLE "" ON)
endif()
option(TRACY_NO_CRASH_HANDLER "" ON) # Otherwise texture cache exceptions will be treaten as a crash option(TRACY_NO_CRASH_HANDLER "" ON) # Otherwise texture cache exceptions will be treaten as a crash
option(TRACY_ON_DEMAND "" ON) option(TRACY_ON_DEMAND "" ON)
option(TRACY_NO_FRAME_IMAGE "" ON) option(TRACY_NO_FRAME_IMAGE "" ON)
option(TRACY_FIBERS "" ON) # For AmdGpu frontend profiling option(TRACY_FIBERS "" OFF) # For AmdGpu frontend profiling, disabled due to instability
option(TRACY_NO_SYSTEM_TRACING "" ON) option(TRACY_NO_SYSTEM_TRACING "" ON)
option(TRACY_NO_CALLSTACK "" ON) option(TRACY_NO_CALLSTACK "" ON)
option(TRACY_NO_CODE_TRANSFER "" ON) option(TRACY_NO_CODE_TRANSFER "" ON)
@@ -189,10 +213,30 @@ endif()
# Discord RPC # Discord RPC
if (ENABLE_DISCORD_RPC) if (ENABLE_DISCORD_RPC)
set(BUILD_EXAMPLES OFF) add_subdirectory(discord-rpc)
add_subdirectory(discord-rpc/)
target_include_directories(discord-rpc INTERFACE discord-rpc/include)
endif() endif()
# GCN Headers # GCN Headers
add_subdirectory(gcn) add_subdirectory(gcn)
# stb
if (NOT TARGET stb::headers)
add_library(stb INTERFACE)
target_include_directories(stb INTERFACE stb)
add_library(stb::headers ALIAS stb)
endif()
# Apple-only dependencies
if (APPLE)
# date
if (NOT TARGET date::date-tz)
option(BUILD_TZ_LIB "" ON)
option(USE_SYSTEM_TZ_DB "" ON)
add_subdirectory(date)
endif()
# MoltenVK
if (NOT TARGET MoltenVK)
add_subdirectory(MoltenVK)
endif()
endif()

1
externals/LibAtrac9 vendored Submodule

Submodule externals/LibAtrac9 added at 9640129dc6

93
externals/MoltenVK/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,93 @@
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
# Prepare MoltenVK Git revision
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
OUTPUT_VARIABLE MVK_GIT_REV
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
set(MVK_GENERATED_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/Generated)
file(WRITE ${MVK_GENERATED_INCLUDES}/mvkGitRevDerived.h "static const char* mvkRevString = \"${MVK_GIT_REV}\";")
message(STATUS "MoltenVK revision: ${MVK_GIT_REV}")
# Prepare MoltenVK version
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK/MoltenVK/MoltenVK/API/mvk_private_api.h MVK_PRIVATE_API)
string(REGEX MATCH "#define MVK_VERSION_MAJOR [0-9]+" MVK_VERSION_MAJOR_LINE "${MVK_PRIVATE_API}")
string(REGEX MATCH "[0-9]+" MVK_VERSION_MAJOR "${MVK_VERSION_MAJOR_LINE}")
string(REGEX MATCH "#define MVK_VERSION_MINOR [0-9]+" MVK_VERSION_MINOR_LINE "${MVK_PRIVATE_API}")
string(REGEX MATCH "[0-9]+" MVK_VERSION_MINOR "${MVK_VERSION_MINOR_LINE}")
string(REGEX MATCH "#define MVK_VERSION_PATCH [0-9]+" MVK_VERSION_PATCH_LINE "${MVK_PRIVATE_API}")
string(REGEX MATCH "[0-9]+" MVK_VERSION_PATCH "${MVK_VERSION_PATCH_LINE}")
set(MVK_VERSION "${MVK_VERSION_MAJOR}.${MVK_VERSION_MINOR}.${MVK_VERSION_PATCH}")
message(STATUS "MoltenVK version: ${MVK_VERSION}")
# Find required system libraries
find_library(APPKIT_LIBRARY AppKit REQUIRED)
find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
find_library(IOKIT_LIBRARY IOKit REQUIRED)
find_library(IOSURFACE_LIBRARY IOSurface REQUIRED)
find_library(METAL_LIBRARY Metal REQUIRED)
find_library(QUARTZCORE_LIBRARY QuartzCore REQUIRED)
# cereal
option(SKIP_PORTABILITY_TEST "" ON)
option(BUILD_DOC "" OFF)
option(BUILD_SANDBOX "" OFF)
option(SKIP_PERFORMANCE_COMPARISON "" ON)
option(SPIRV_CROSS_SKIP_INSTALL "" ON)
add_subdirectory(cereal)
# SPIRV-Cross
option(SPIRV_CROSS_CLI "" OFF)
option(SPIRV_CROSS_ENABLE_TESTS "" OFF)
option(SPIRV_CROSS_ENABLE_HLSL "" OFF)
option(SPIRV_CROSS_ENABLE_CPP "" OFF)
option(SPIRV_CROSS_SKIP_INSTALL "" ON)
add_subdirectory(SPIRV-Cross)
# Common
set(MVK_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK/Common)
file(GLOB_RECURSE MVK_COMMON_SOURCES CONFIGURE_DEPENDS
${MVK_COMMON_DIR}/*.cpp
${MVK_COMMON_DIR}/*.m
${MVK_COMMON_DIR}/*.mm)
set(MVK_COMMON_INCLUDES ${MVK_COMMON_DIR})
add_library(MoltenVKCommon STATIC ${MVK_COMMON_SOURCES})
target_include_directories(MoltenVKCommon PUBLIC ${MVK_COMMON_INCLUDES})
target_compile_options(MoltenVKCommon PRIVATE -w)
# MoltenVKShaderConverter
set(MVK_SHADER_CONVERTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK/MoltenVKShaderConverter)
file(GLOB_RECURSE MVK_SHADER_CONVERTER_SOURCES CONFIGURE_DEPENDS
${MVK_SHADER_CONVERTER_DIR}/MoltenVKShaderConverter/*.cpp
${MVK_SHADER_CONVERTER_DIR}/MoltenVKShaderConverter/*.m
${MVK_SHADER_CONVERTER_DIR}/MoltenVKShaderConverter/*.mm)
set(MVK_SHADER_CONVERTER_INCLUDES ${MVK_SHADER_CONVERTER_DIR} ${MVK_SHADER_CONVERTER_DIR}/include)
add_library(MoltenVKShaderConverter STATIC ${MVK_SHADER_CONVERTER_SOURCES})
target_include_directories(MoltenVKShaderConverter PUBLIC ${MVK_SHADER_CONVERTER_INCLUDES})
target_compile_options(MoltenVKShaderConverter PRIVATE -w)
target_link_libraries(MoltenVKShaderConverter PRIVATE spirv-cross-msl spirv-cross-reflect MoltenVKCommon)
target_compile_definitions(MoltenVKShaderConverter PRIVATE MVK_EXCLUDE_SPIRV_TOOLS=1)
# MoltenVK
set(MVK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK/MoltenVK)
file(GLOB_RECURSE MVK_SOURCES CONFIGURE_DEPENDS
${MVK_DIR}/MoltenVK/*.cpp
${MVK_DIR}/MoltenVK/*.m
${MVK_DIR}/MoltenVK/*.mm)
file(GLOB MVK_SRC_INCLUDES LIST_DIRECTORIES ON ${MVK_DIR}/MoltenVK/*)
set(MVK_INCLUDES ${MVK_SRC_INCLUDES} ${MVK_GENERATED_INCLUDES} ${MVK_DIR}/include)
add_library(MoltenVK SHARED ${MVK_SOURCES})
target_include_directories(MoltenVK PRIVATE ${MVK_INCLUDES})
target_compile_options(MoltenVK PRIVATE -w)
target_link_libraries(MoltenVK PRIVATE
${APPKIT_LIBRARY} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY} ${IOSURFACE_LIBRARY} ${METAL_LIBRARY} ${QUARTZCORE_LIBRARY}
Vulkan::Headers cereal::cereal spirv-cross-msl MoltenVKCommon MoltenVKShaderConverter)
target_compile_definitions(MoltenVK PRIVATE MVK_FRAMEWORK_VERSION=${MVK_VERSION} MVK_USE_METAL_PRIVATE_API=1)

1
externals/MoltenVK/MoltenVK vendored Submodule

8
externals/MoltenVK/MoltenVK_icd.json vendored Normal file
View File

@@ -0,0 +1,8 @@
{
"file_format_version": "1.0.0",
"ICD": {
"library_path": "../../../Frameworks/libMoltenVK.dylib",
"api_version": "1.2.0",
"is_portability_driver": true
}
}

1
externals/MoltenVK/cereal vendored Submodule

2
externals/date vendored

1
externals/libpng vendored Submodule

Submodule externals/libpng added at c1cc0f3f4c

2
externals/sdl3 vendored

2
externals/vma vendored

View File

@@ -1,166 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "sdl_audio.h"
#include "common/assert.h"
#include "core/libraries/error_codes.h"
#include <SDL3/SDL_audio.h>
#include <SDL3/SDL_init.h>
#include <SDL3/SDL_timer.h>
#include <mutex> // std::unique_lock
namespace Audio {
constexpr int AUDIO_STREAM_BUFFER_THRESHOLD = 65536; // Define constant for buffer threshold
s32 SDLAudio::AudioOutOpen(int type, u32 samples_num, u32 freq,
Libraries::AudioOut::OrbisAudioOutParamFormat format) {
using Libraries::AudioOut::OrbisAudioOutParamFormat;
std::unique_lock lock{m_mutex};
for (int id = 0; id < portsOut.size(); id++) {
auto& port = portsOut[id];
if (!port.isOpen) {
port.isOpen = true;
port.type = type;
port.samples_num = samples_num;
port.freq = freq;
port.format = format;
SDL_AudioFormat sampleFormat;
switch (format) {
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_MONO:
sampleFormat = SDL_AUDIO_S16;
port.channels_num = 1;
port.sample_size = 2;
break;
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_MONO:
sampleFormat = SDL_AUDIO_F32;
port.channels_num = 1;
port.sample_size = 4;
break;
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_STEREO:
sampleFormat = SDL_AUDIO_S16;
port.channels_num = 2;
port.sample_size = 2;
break;
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_STEREO:
sampleFormat = SDL_AUDIO_F32;
port.channels_num = 2;
port.sample_size = 4;
break;
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_8CH:
sampleFormat = SDL_AUDIO_S16;
port.channels_num = 8;
port.sample_size = 2;
break;
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH:
sampleFormat = SDL_AUDIO_F32;
port.channels_num = 8;
port.sample_size = 4;
break;
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_8CH_STD:
sampleFormat = SDL_AUDIO_S16;
port.channels_num = 8;
port.sample_size = 2;
break;
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH_STD:
sampleFormat = SDL_AUDIO_F32;
port.channels_num = 8;
port.sample_size = 4;
break;
default:
UNREACHABLE_MSG("Unknown format");
}
for (int i = 0; i < port.channels_num; i++) {
port.volume[i] = Libraries::AudioOut::SCE_AUDIO_OUT_VOLUME_0DB;
}
SDL_AudioSpec fmt;
SDL_zero(fmt);
fmt.format = sampleFormat;
fmt.channels = port.channels_num;
fmt.freq = freq; // Set frequency from the argument
port.stream =
SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &fmt, NULL, NULL);
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(port.stream));
return id + 1;
}
}
LOG_ERROR(Lib_AudioOut, "Audio ports are full");
return ORBIS_AUDIO_OUT_ERROR_PORT_FULL; // all ports are used
}
s32 SDLAudio::AudioOutOutput(s32 handle, const void* ptr) {
std::shared_lock lock{m_mutex};
auto& port = portsOut[handle - 1];
if (!port.isOpen) {
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
}
const size_t data_size = port.samples_num * port.sample_size * port.channels_num;
bool result = SDL_PutAudioStreamData(port.stream, ptr, data_size);
lock.unlock(); // Unlock only after necessary operations
while (SDL_GetAudioStreamAvailable(port.stream) > AUDIO_STREAM_BUFFER_THRESHOLD) {
SDL_Delay(0);
}
return result ? ORBIS_OK : -1;
}
s32 SDLAudio::AudioOutSetVolume(s32 handle, s32 bitflag, s32* volume) {
using Libraries::AudioOut::OrbisAudioOutParamFormat;
std::shared_lock lock{m_mutex};
auto& port = portsOut[handle - 1];
if (!port.isOpen) {
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
}
for (int i = 0; i < port.channels_num; i++, bitflag >>= 1u) {
auto bit = bitflag & 0x1u;
if (bit == 1) {
int src_index = i;
if (port.format ==
OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH_STD ||
port.format == OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_8CH_STD) {
switch (i) {
case 4:
src_index = 6;
break;
case 5:
src_index = 7;
break;
case 6:
src_index = 4;
break;
case 7:
src_index = 5;
break;
default:
break;
}
}
port.volume[i] = volume[src_index];
}
}
return ORBIS_OK;
}
s32 SDLAudio::AudioOutGetStatus(s32 handle, int* type, int* channels_num) {
std::shared_lock lock{m_mutex};
auto& port = portsOut[handle - 1];
*type = port.type;
*channels_num = port.channels_num;
return ORBIS_OK;
}
} // namespace Audio

View File

@@ -1,39 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <shared_mutex>
#include <SDL3/SDL_audio.h>
#include "core/libraries/audio/audioout.h"
namespace Audio {
class SDLAudio {
public:
SDLAudio() = default;
virtual ~SDLAudio() = default;
s32 AudioOutOpen(int type, u32 samples_num, u32 freq,
Libraries::AudioOut::OrbisAudioOutParamFormat format);
s32 AudioOutOutput(s32 handle, const void* ptr);
s32 AudioOutSetVolume(s32 handle, s32 bitflag, s32* volume);
s32 AudioOutGetStatus(s32 handle, int* type, int* channels_num);
private:
struct PortOut {
SDL_AudioStream* stream = nullptr;
u32 samples_num = 0;
u32 freq = 0;
u32 format = -1;
int type = 0;
int channels_num = 0;
int volume[8] = {};
u8 sample_size = 0;
bool isOpen = false;
};
std::shared_mutex m_mutex;
std::array<PortOut, Libraries::AudioOut::SCE_AUDIO_OUT_NUM_PORTS> portsOut;
};
} // namespace Audio

View File

@@ -0,0 +1,27 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#ifdef __linux__
#include <pthread.h>
#endif
namespace Common {
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
class AdaptiveMutex {
public:
void lock() {
pthread_mutex_lock(&mutex);
}
void unlock() {
pthread_mutex_unlock(&mutex);
}
private:
pthread_mutex_t mutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP;
};
#endif // PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
} // namespace Common

View File

@@ -22,6 +22,12 @@ template <typename T>
return static_cast<T>(value - value % size); return static_cast<T>(value - value % size);
} }
template <typename T>
requires std::is_integral_v<T>
[[nodiscard]] constexpr bool IsAligned(T value, std::size_t alignment) {
return (value & (alignment - 1)) == 0;
}
template <typename T> template <typename T>
requires std::is_integral_v<T> requires std::is_integral_v<T>
[[nodiscard]] constexpr bool Is16KBAligned(T value) { [[nodiscard]] constexpr bool Is16KBAligned(T value) {

View File

@@ -3,13 +3,14 @@
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <common/version.h>
#include <fmt/core.h> #include <fmt/core.h>
#include <fmt/xchar.h> // for wstring support #include <fmt/xchar.h> // for wstring support
#include <toml.hpp> #include <toml.hpp>
#include "common/logging/formatter.h"
#include "common/path_util.h" #include "common/path_util.h"
#include "config.h" #include "config.h"
#include "logging/formatter.h"
#include "version.h"
namespace toml { namespace toml {
template <typename TC, typename K> template <typename TC, typename K>
@@ -32,7 +33,9 @@ namespace Config {
static bool isNeo = false; static bool isNeo = false;
static bool isFullscreen = false; static bool isFullscreen = false;
static std::string fullscreenMode = "borderless";
static bool playBGM = false; static bool playBGM = false;
static bool isTrophyPopupDisabled = false;
static int BGMvolume = 50; static int BGMvolume = 50;
static bool enableDiscordRPC = false; static bool enableDiscordRPC = false;
static u32 screenWidth = 1280; static u32 screenWidth = 1280;
@@ -42,29 +45,41 @@ 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 std::string updateChannel; static std::string updateChannel;
static std::string chooseHomeTab;
static u16 deadZoneLeft = 2.0;
static u16 deadZoneRight = 2.0;
static std::string backButtonBehavior = "left"; static std::string backButtonBehavior = "left";
static bool useSpecialPad = false; static bool useSpecialPad = false;
static int specialPadClass = 1; static int specialPadClass = 1;
static bool isMotionControlsEnabled = true;
static bool isDebugDump = false; static bool isDebugDump = false;
static bool isShaderDebug = false;
static bool isShowSplash = false; static bool isShowSplash = false;
static bool isAutoUpdate = false; static bool isAutoUpdate = false;
static bool isNullGpu = false; static bool isNullGpu = false;
static bool shouldCopyGPUBuffers = false; static bool shouldCopyGPUBuffers = false;
static bool shouldDumpShaders = false; static bool shouldDumpShaders = false;
static bool shouldPatchShaders = true;
static u32 vblankDivider = 1; static u32 vblankDivider = 1;
static bool vkValidation = false; static bool vkValidation = false;
static bool vkValidationSync = false; static bool vkValidationSync = false;
static bool vkValidationGpu = false; static bool vkValidationGpu = false;
static bool rdocEnable = false;
static bool vkMarkers = false;
static bool vkCrashDiagnostic = false; static bool vkCrashDiagnostic = false;
static bool vkHostMarkers = false;
static bool vkGuestMarkers = false;
static bool rdocEnable = false;
static s16 cursorState = HideCursorState::Idle; static s16 cursorState = HideCursorState::Idle;
static int cursorHideTimeout = 5; // 5 seconds (default) static int cursorHideTimeout = 5; // 5 seconds (default)
static bool separateupdatefolder = false; static bool separateupdatefolder = false;
static bool compatibilityData = false;
static bool checkCompatibilityOnStartup = false;
static std::string trophyKey;
// Gui // Gui
static bool load_game_size = true;
std::vector<std::filesystem::path> settings_install_dirs = {}; std::vector<std::filesystem::path> settings_install_dirs = {};
std::filesystem::path settings_addon_install_dir = {}; std::filesystem::path settings_addon_install_dir = {};
std::filesystem::path save_data_path = {};
u32 main_window_geometry_x = 400; u32 main_window_geometry_x = 400;
u32 main_window_geometry_y = 400; u32 main_window_geometry_y = 400;
u32 main_window_geometry_w = 1280; u32 main_window_geometry_w = 1280;
@@ -81,17 +96,49 @@ std::vector<std::string> m_pkg_viewer;
std::vector<std::string> m_elf_viewer; std::vector<std::string> m_elf_viewer;
std::vector<std::string> m_recent_files; std::vector<std::string> m_recent_files;
std::string emulator_language = "en"; std::string emulator_language = "en";
// Settings
// Language
u32 m_language = 1; // english u32 m_language = 1; // english
bool isNeoMode() { std::string getTrophyKey() {
return trophyKey;
}
void setTrophyKey(std::string key) {
trophyKey = key;
}
bool GetLoadGameSizeEnabled() {
return load_game_size;
}
std::filesystem::path GetSaveDataPath() {
if (save_data_path.empty()) {
return Common::FS::GetUserPath(Common::FS::PathType::SaveDataDir);
}
return save_data_path;
}
void setLoadGameSizeEnabled(bool enable) {
load_game_size = enable;
}
bool isNeoModeConsole() {
return isNeo; return isNeo;
} }
bool isFullscreenMode() { bool getIsFullscreen() {
return isFullscreen; return isFullscreen;
} }
std::string getFullscreenMode() {
return fullscreenMode;
}
bool getisTrophyPopupDisabled() {
return isTrophyPopupDisabled;
}
bool getPlayBGM() { bool getPlayBGM() {
return playBGM; return playBGM;
} }
@@ -104,6 +151,14 @@ bool getEnableDiscordRPC() {
return enableDiscordRPC; return enableDiscordRPC;
} }
u16 leftDeadZone() {
return deadZoneLeft;
}
u16 rightDeadZone() {
return deadZoneRight;
}
s16 getCursorState() { s16 getCursorState() {
return cursorState; return cursorState;
} }
@@ -140,6 +195,10 @@ std::string getUpdateChannel() {
return updateChannel; return updateChannel;
} }
std::string getChooseHomeTab() {
return chooseHomeTab;
}
std::string getBackButtonBehavior() { std::string getBackButtonBehavior() {
return backButtonBehavior; return backButtonBehavior;
} }
@@ -152,10 +211,18 @@ int getSpecialPadClass() {
return specialPadClass; return specialPadClass;
} }
bool getIsMotionControlsEnabled() {
return isMotionControlsEnabled;
}
bool debugDump() { bool debugDump() {
return isDebugDump; return isDebugDump;
} }
bool collectShadersForDebug() {
return isShaderDebug;
}
bool showSplash() { bool showSplash() {
return isShowSplash; return isShowSplash;
} }
@@ -176,12 +243,12 @@ bool dumpShaders() {
return shouldDumpShaders; return shouldDumpShaders;
} }
bool isRdocEnabled() { bool patchShaders() {
return rdocEnable; return shouldPatchShaders;
} }
bool isMarkersEnabled() { bool isRdocEnabled() {
return vkMarkers; return rdocEnable;
} }
u32 vblankDiv() { u32 vblankDiv() {
@@ -200,18 +267,42 @@ bool vkValidationGpuEnabled() {
return vkValidationGpu; return vkValidationGpu;
} }
bool vkMarkersEnabled() { bool getVkCrashDiagnosticEnabled() {
return vkMarkers || vkCrashDiagnostic; // Crash diagnostic forces markers on return vkCrashDiagnostic;
} }
bool vkCrashDiagnosticEnabled() { bool getVkHostMarkersEnabled() {
return vkCrashDiagnostic; return vkHostMarkers;
}
bool getVkGuestMarkersEnabled() {
return vkGuestMarkers;
}
void setVkCrashDiagnosticEnabled(bool enable) {
vkCrashDiagnostic = enable;
}
void setVkHostMarkersEnabled(bool enable) {
vkHostMarkers = enable;
}
void setVkGuestMarkersEnabled(bool enable) {
vkGuestMarkers = enable;
} }
bool getSeparateUpdateEnabled() { bool getSeparateUpdateEnabled() {
return separateupdatefolder; return separateupdatefolder;
} }
bool getCompatibilityEnabled() {
return compatibilityData;
}
bool getCheckCompatibilityOnStartup() {
return checkCompatibilityOnStartup;
}
void setGpuId(s32 selectedGpuId) { void setGpuId(s32 selectedGpuId) {
gpuId = selectedGpuId; gpuId = selectedGpuId;
} }
@@ -228,6 +319,10 @@ void setDebugDump(bool enable) {
isDebugDump = enable; isDebugDump = enable;
} }
void setCollectShaderForDebug(bool enable) {
isShaderDebug = enable;
}
void setShowSplash(bool enable) { void setShowSplash(bool enable) {
isShowSplash = enable; isShowSplash = enable;
} }
@@ -264,10 +359,18 @@ void setVblankDiv(u32 value) {
vblankDivider = value; vblankDivider = value;
} }
void setFullscreenMode(bool enable) { void setIsFullscreen(bool enable) {
isFullscreen = enable; isFullscreen = enable;
} }
void setFullscreenMode(std::string mode) {
fullscreenMode = mode;
}
void setisTrophyPopupDisabled(bool disable) {
isTrophyPopupDisabled = disable;
}
void setPlayBGM(bool enable) { void setPlayBGM(bool enable) {
playBGM = enable; playBGM = enable;
} }
@@ -311,6 +414,9 @@ void setUserName(const std::string& type) {
void setUpdateChannel(const std::string& type) { void setUpdateChannel(const std::string& type) {
updateChannel = type; updateChannel = type;
} }
void setChooseHomeTab(const std::string& type) {
chooseHomeTab = type;
}
void setBackButtonBehavior(const std::string& type) { void setBackButtonBehavior(const std::string& type) {
backButtonBehavior = type; backButtonBehavior = type;
@@ -324,16 +430,29 @@ void setSpecialPadClass(int type) {
specialPadClass = type; specialPadClass = type;
} }
void setIsMotionControlsEnabled(bool use) {
isMotionControlsEnabled = use;
}
void setSeparateUpdateEnabled(bool use) { void setSeparateUpdateEnabled(bool use) {
separateupdatefolder = use; separateupdatefolder = use;
} }
void setCompatibilityEnabled(bool use) {
compatibilityData = use;
}
void setCheckCompatibilityOnStartup(bool use) {
checkCompatibilityOnStartup = use;
}
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;
main_window_geometry_w = w; main_window_geometry_w = w;
main_window_geometry_h = h; main_window_geometry_h = h;
} }
bool addGameInstallDir(const std::filesystem::path& dir) { bool addGameInstallDir(const std::filesystem::path& dir) {
if (std::find(settings_install_dirs.begin(), settings_install_dirs.end(), dir) == if (std::find(settings_install_dirs.begin(), settings_install_dirs.end(), dir) ==
settings_install_dirs.end()) { settings_install_dirs.end()) {
@@ -342,47 +461,60 @@ bool addGameInstallDir(const std::filesystem::path& dir) {
} }
return false; return false;
} }
void removeGameInstallDir(const std::filesystem::path& dir) { void removeGameInstallDir(const std::filesystem::path& dir) {
auto iterator = std::find(settings_install_dirs.begin(), settings_install_dirs.end(), dir); auto iterator = std::find(settings_install_dirs.begin(), settings_install_dirs.end(), dir);
if (iterator != settings_install_dirs.end()) { if (iterator != settings_install_dirs.end()) {
settings_install_dirs.erase(iterator); settings_install_dirs.erase(iterator);
} }
} }
void setAddonInstallDir(const std::filesystem::path& dir) { void setAddonInstallDir(const std::filesystem::path& dir) {
settings_addon_install_dir = dir; settings_addon_install_dir = dir;
} }
void setMainWindowTheme(u32 theme) { void setMainWindowTheme(u32 theme) {
mw_themes = theme; mw_themes = theme;
} }
void setIconSize(u32 size) { void setIconSize(u32 size) {
m_icon_size = size; m_icon_size = size;
} }
void setIconSizeGrid(u32 size) { void setIconSizeGrid(u32 size) {
m_icon_size_grid = size; m_icon_size_grid = size;
} }
void setSliderPosition(u32 pos) { void setSliderPosition(u32 pos) {
m_slider_pos = pos; m_slider_pos = pos;
} }
void setSliderPositionGrid(u32 pos) { void setSliderPositionGrid(u32 pos) {
m_slider_pos_grid = pos; m_slider_pos_grid = pos;
} }
void setTableMode(u32 mode) { void setTableMode(u32 mode) {
m_table_mode = mode; m_table_mode = mode;
} }
void setMainWindowWidth(u32 width) { void setMainWindowWidth(u32 width) {
m_window_size_W = width; m_window_size_W = width;
} }
void setMainWindowHeight(u32 height) { void setMainWindowHeight(u32 height) {
m_window_size_H = height; m_window_size_H = height;
} }
void setPkgViewer(const std::vector<std::string>& pkgList) { void setPkgViewer(const std::vector<std::string>& pkgList) {
m_pkg_viewer.resize(pkgList.size()); m_pkg_viewer.resize(pkgList.size());
m_pkg_viewer = pkgList; m_pkg_viewer = pkgList;
} }
void setElfViewer(const std::vector<std::string>& elfList) { void setElfViewer(const std::vector<std::string>& elfList) {
m_elf_viewer.resize(elfList.size()); m_elf_viewer.resize(elfList.size());
m_elf_viewer = elfList; m_elf_viewer = elfList;
} }
void setRecentFiles(const std::vector<std::string>& recentFiles) { void setRecentFiles(const std::vector<std::string>& recentFiles) {
m_recent_files.resize(recentFiles.size()); m_recent_files.resize(recentFiles.size());
m_recent_files = recentFiles; m_recent_files = recentFiles;
@@ -392,21 +524,34 @@ void setEmulatorLanguage(std::string language) {
emulator_language = language; emulator_language = language;
} }
void setGameInstallDirs(const std::vector<std::filesystem::path>& settings_install_dirs_config) {
settings_install_dirs = settings_install_dirs_config;
}
void setSaveDataPath(const std::filesystem::path& path) {
save_data_path = path;
}
u32 getMainWindowGeometryX() { u32 getMainWindowGeometryX() {
return main_window_geometry_x; return main_window_geometry_x;
} }
u32 getMainWindowGeometryY() { u32 getMainWindowGeometryY() {
return main_window_geometry_y; return main_window_geometry_y;
} }
u32 getMainWindowGeometryW() { u32 getMainWindowGeometryW() {
return main_window_geometry_w; return main_window_geometry_w;
} }
u32 getMainWindowGeometryH() { u32 getMainWindowGeometryH() {
return main_window_geometry_h; return main_window_geometry_h;
} }
const std::vector<std::filesystem::path>& getGameInstallDirs() { const std::vector<std::filesystem::path>& getGameInstallDirs() {
return settings_install_dirs; return settings_install_dirs;
} }
std::filesystem::path getAddonInstallDir() { std::filesystem::path getAddonInstallDir() {
if (settings_addon_install_dir.empty()) { if (settings_addon_install_dir.empty()) {
// Default for users without a config file or a config file from before this option existed // Default for users without a config file or a config file from before this option existed
@@ -414,36 +559,47 @@ std::filesystem::path getAddonInstallDir() {
} }
return settings_addon_install_dir; return settings_addon_install_dir;
} }
u32 getMainWindowTheme() { u32 getMainWindowTheme() {
return mw_themes; return mw_themes;
} }
u32 getIconSize() { u32 getIconSize() {
return m_icon_size; return m_icon_size;
} }
u32 getIconSizeGrid() { u32 getIconSizeGrid() {
return m_icon_size_grid; return m_icon_size_grid;
} }
u32 getSliderPosition() { u32 getSliderPosition() {
return m_slider_pos; return m_slider_pos;
} }
u32 getSliderPositionGrid() { u32 getSliderPositionGrid() {
return m_slider_pos_grid; return m_slider_pos_grid;
} }
u32 getTableMode() { u32 getTableMode() {
return m_table_mode; return m_table_mode;
} }
u32 getMainWindowWidth() { u32 getMainWindowWidth() {
return m_window_size_W; return m_window_size_W;
} }
u32 getMainWindowHeight() { u32 getMainWindowHeight() {
return m_window_size_H; return m_window_size_H;
} }
std::vector<std::string> getPkgViewer() { std::vector<std::string> getPkgViewer() {
return m_pkg_viewer; return m_pkg_viewer;
} }
std::vector<std::string> getElfViewer() { std::vector<std::string> getElfViewer() {
return m_elf_viewer; return m_elf_viewer;
} }
std::vector<std::string> getRecentFiles() { std::vector<std::string> getRecentFiles() {
return m_recent_files; return m_recent_files;
} }
@@ -455,6 +611,7 @@ std::string getEmulatorLanguage() {
u32 GetLanguage() { u32 GetLanguage() {
return m_language; return m_language;
} }
void load(const std::filesystem::path& path) { void load(const std::filesystem::path& path) {
// If the configuration file does not exist, create it and return // If the configuration file does not exist, create it and return
std::error_code error; std::error_code error;
@@ -479,7 +636,9 @@ void load(const std::filesystem::path& path) {
isNeo = toml::find_or<bool>(general, "isPS4Pro", false); isNeo = toml::find_or<bool>(general, "isPS4Pro", false);
isFullscreen = toml::find_or<bool>(general, "Fullscreen", false); isFullscreen = toml::find_or<bool>(general, "Fullscreen", false);
fullscreenMode = toml::find_or<std::string>(general, "FullscreenMode", "borderless");
playBGM = toml::find_or<bool>(general, "playBGM", false); playBGM = toml::find_or<bool>(general, "playBGM", false);
isTrophyPopupDisabled = toml::find_or<bool>(general, "isTrophyPopupDisabled", false);
BGMvolume = toml::find_or<int>(general, "BGMvolume", 50); BGMvolume = toml::find_or<int>(general, "BGMvolume", 50);
enableDiscordRPC = toml::find_or<bool>(general, "enableDiscordRPC", true); enableDiscordRPC = toml::find_or<bool>(general, "enableDiscordRPC", true);
logFilter = toml::find_or<std::string>(general, "logFilter", ""); logFilter = toml::find_or<std::string>(general, "logFilter", "");
@@ -493,16 +652,23 @@ void load(const std::filesystem::path& path) {
isShowSplash = toml::find_or<bool>(general, "showSplash", true); isShowSplash = toml::find_or<bool>(general, "showSplash", true);
isAutoUpdate = toml::find_or<bool>(general, "autoUpdate", false); isAutoUpdate = toml::find_or<bool>(general, "autoUpdate", false);
separateupdatefolder = toml::find_or<bool>(general, "separateUpdateEnabled", false); separateupdatefolder = toml::find_or<bool>(general, "separateUpdateEnabled", false);
compatibilityData = toml::find_or<bool>(general, "compatibilityEnabled", false);
checkCompatibilityOnStartup =
toml::find_or<bool>(general, "checkCompatibilityOnStartup", false);
chooseHomeTab = toml::find_or<std::string>(general, "chooseHomeTab", "Release");
} }
if (data.contains("Input")) { if (data.contains("Input")) {
const toml::value& input = data.at("Input"); const toml::value& input = data.at("Input");
deadZoneLeft = toml::find_or<float>(input, "deadZoneLeft", 2.0);
deadZoneRight = toml::find_or<float>(input, "deadZoneRight", 2.0);
cursorState = toml::find_or<int>(input, "cursorState", HideCursorState::Idle); cursorState = toml::find_or<int>(input, "cursorState", HideCursorState::Idle);
cursorHideTimeout = toml::find_or<int>(input, "cursorHideTimeout", 5); cursorHideTimeout = toml::find_or<int>(input, "cursorHideTimeout", 5);
backButtonBehavior = toml::find_or<std::string>(input, "backButtonBehavior", "left"); backButtonBehavior = toml::find_or<std::string>(input, "backButtonBehavior", "left");
useSpecialPad = toml::find_or<bool>(input, "useSpecialPad", false); useSpecialPad = toml::find_or<bool>(input, "useSpecialPad", false);
specialPadClass = toml::find_or<int>(input, "specialPadClass", 1); specialPadClass = toml::find_or<int>(input, "specialPadClass", 1);
isMotionControlsEnabled = toml::find_or<bool>(input, "isMotionControlsEnabled", true);
} }
if (data.contains("GPU")) { if (data.contains("GPU")) {
@@ -513,6 +679,7 @@ void load(const std::filesystem::path& path) {
isNullGpu = toml::find_or<bool>(gpu, "nullGpu", false); isNullGpu = toml::find_or<bool>(gpu, "nullGpu", false);
shouldCopyGPUBuffers = toml::find_or<bool>(gpu, "copyGPUBuffers", 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);
shouldPatchShaders = toml::find_or<bool>(gpu, "patchShaders", true);
vblankDivider = toml::find_or<int>(gpu, "vblankDivider", 1); vblankDivider = toml::find_or<int>(gpu, "vblankDivider", 1);
} }
@@ -523,20 +690,23 @@ void load(const std::filesystem::path& path) {
vkValidation = toml::find_or<bool>(vk, "validation", false); vkValidation = toml::find_or<bool>(vk, "validation", false);
vkValidationSync = toml::find_or<bool>(vk, "validation_sync", false); vkValidationSync = toml::find_or<bool>(vk, "validation_sync", false);
vkValidationGpu = toml::find_or<bool>(vk, "validation_gpu", true); vkValidationGpu = toml::find_or<bool>(vk, "validation_gpu", true);
rdocEnable = toml::find_or<bool>(vk, "rdocEnable", false);
vkMarkers = toml::find_or<bool>(vk, "rdocMarkersEnable", false);
vkCrashDiagnostic = toml::find_or<bool>(vk, "crashDiagnostic", false); vkCrashDiagnostic = toml::find_or<bool>(vk, "crashDiagnostic", false);
vkHostMarkers = toml::find_or<bool>(vk, "hostMarkers", false);
vkGuestMarkers = toml::find_or<bool>(vk, "guestMarkers", false);
rdocEnable = toml::find_or<bool>(vk, "rdocEnable", false);
} }
if (data.contains("Debug")) { if (data.contains("Debug")) {
const toml::value& debug = data.at("Debug"); const toml::value& debug = data.at("Debug");
isDebugDump = toml::find_or<bool>(debug, "DebugDump", false); isDebugDump = toml::find_or<bool>(debug, "DebugDump", false);
isShaderDebug = toml::find_or<bool>(debug, "CollectShader", false);
} }
if (data.contains("GUI")) { if (data.contains("GUI")) {
const toml::value& gui = data.at("GUI"); const toml::value& gui = data.at("GUI");
load_game_size = toml::find_or<bool>(gui, "loadGameSizeEnabled", true);
m_icon_size = toml::find_or<int>(gui, "iconSize", 0); m_icon_size = toml::find_or<int>(gui, "iconSize", 0);
m_icon_size_grid = toml::find_or<int>(gui, "iconSizeGrid", 0); m_icon_size_grid = toml::find_or<int>(gui, "iconSizeGrid", 0);
m_slider_pos = toml::find_or<int>(gui, "sliderPos", 0); m_slider_pos = toml::find_or<int>(gui, "sliderPos", 0);
@@ -545,18 +715,14 @@ void load(const std::filesystem::path& path) {
m_window_size_W = toml::find_or<int>(gui, "mw_width", 0); m_window_size_W = toml::find_or<int>(gui, "mw_width", 0);
m_window_size_H = toml::find_or<int>(gui, "mw_height", 0); m_window_size_H = toml::find_or<int>(gui, "mw_height", 0);
// TODO Migration code, after a major release this should be removed. const auto install_dir_array =
auto old_game_install_dir = toml::find_fs_path_or(gui, "installDir", {}); toml::find_or<std::vector<std::string>>(gui, "installDirs", {});
if (!old_game_install_dir.empty()) { for (const auto& dir : install_dir_array) {
addGameInstallDir(std::filesystem::path{old_game_install_dir}); addGameInstallDir(std::filesystem::path{dir});
} else {
const auto install_dir_array =
toml::find_or<std::vector<std::string>>(gui, "installDirs", {});
for (const auto& dir : install_dir_array) {
addGameInstallDir(std::filesystem::path{dir});
}
} }
save_data_path = toml::find_fs_path_or(gui, "saveDataPath", {});
settings_addon_install_dir = toml::find_fs_path_or(gui, "addonInstallDir", {}); settings_addon_install_dir = toml::find_fs_path_or(gui, "addonInstallDir", {});
main_window_geometry_x = toml::find_or<int>(gui, "geometry_x", 0); main_window_geometry_x = toml::find_or<int>(gui, "geometry_x", 0);
main_window_geometry_y = toml::find_or<int>(gui, "geometry_y", 0); main_window_geometry_y = toml::find_or<int>(gui, "geometry_y", 0);
@@ -574,7 +740,13 @@ void load(const std::filesystem::path& path) {
m_language = toml::find_or<int>(settings, "consoleLanguage", 1); m_language = toml::find_or<int>(settings, "consoleLanguage", 1);
} }
if (data.contains("Keys")) {
const toml::value& keys = data.at("Keys");
trophyKey = toml::find_or<std::string>(keys, "TrophyKey", "");
}
} }
void save(const std::filesystem::path& path) { void save(const std::filesystem::path& path) {
toml::value data; toml::value data;
@@ -598,6 +770,8 @@ void save(const std::filesystem::path& path) {
data["General"]["isPS4Pro"] = isNeo; data["General"]["isPS4Pro"] = isNeo;
data["General"]["Fullscreen"] = isFullscreen; data["General"]["Fullscreen"] = isFullscreen;
data["General"]["FullscreenMode"] = fullscreenMode;
data["General"]["isTrophyPopupDisabled"] = isTrophyPopupDisabled;
data["General"]["playBGM"] = playBGM; data["General"]["playBGM"] = playBGM;
data["General"]["BGMvolume"] = BGMvolume; data["General"]["BGMvolume"] = BGMvolume;
data["General"]["enableDiscordRPC"] = enableDiscordRPC; data["General"]["enableDiscordRPC"] = enableDiscordRPC;
@@ -605,45 +779,88 @@ 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"]["updateChannel"] = updateChannel; data["General"]["updateChannel"] = updateChannel;
data["General"]["chooseHomeTab"] = chooseHomeTab;
data["General"]["showSplash"] = isShowSplash; data["General"]["showSplash"] = isShowSplash;
data["General"]["autoUpdate"] = isAutoUpdate; data["General"]["autoUpdate"] = isAutoUpdate;
data["General"]["separateUpdateEnabled"] = separateupdatefolder; data["General"]["separateUpdateEnabled"] = separateupdatefolder;
data["General"]["compatibilityEnabled"] = compatibilityData;
data["General"]["checkCompatibilityOnStartup"] = checkCompatibilityOnStartup;
data["Input"]["deadZoneLeft"] = deadZoneLeft;
data["Input"]["deadZoneRight"] = deadZoneRight;
data["Input"]["cursorState"] = cursorState; data["Input"]["cursorState"] = cursorState;
data["Input"]["cursorHideTimeout"] = cursorHideTimeout; data["Input"]["cursorHideTimeout"] = cursorHideTimeout;
data["Input"]["backButtonBehavior"] = backButtonBehavior; data["Input"]["backButtonBehavior"] = backButtonBehavior;
data["Input"]["useSpecialPad"] = useSpecialPad; data["Input"]["useSpecialPad"] = useSpecialPad;
data["Input"]["specialPadClass"] = specialPadClass; data["Input"]["specialPadClass"] = specialPadClass;
data["Input"]["isMotionControlsEnabled"] = isMotionControlsEnabled;
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"]["copyGPUBuffers"] = shouldCopyGPUBuffers;
data["GPU"]["dumpShaders"] = shouldDumpShaders; data["GPU"]["dumpShaders"] = shouldDumpShaders;
data["GPU"]["patchShaders"] = shouldPatchShaders;
data["GPU"]["vblankDivider"] = vblankDivider; data["GPU"]["vblankDivider"] = vblankDivider;
data["Vulkan"]["gpuId"] = gpuId; data["Vulkan"]["gpuId"] = gpuId;
data["Vulkan"]["validation"] = vkValidation; data["Vulkan"]["validation"] = vkValidation;
data["Vulkan"]["validation_sync"] = vkValidationSync; data["Vulkan"]["validation_sync"] = vkValidationSync;
data["Vulkan"]["validation_gpu"] = vkValidationGpu; data["Vulkan"]["validation_gpu"] = vkValidationGpu;
data["Vulkan"]["rdocEnable"] = rdocEnable;
data["Vulkan"]["rdocMarkersEnable"] = vkMarkers;
data["Vulkan"]["crashDiagnostic"] = vkCrashDiagnostic; data["Vulkan"]["crashDiagnostic"] = vkCrashDiagnostic;
data["Vulkan"]["hostMarkers"] = vkHostMarkers;
data["Vulkan"]["guestMarkers"] = vkGuestMarkers;
data["Vulkan"]["rdocEnable"] = rdocEnable;
data["Debug"]["DebugDump"] = isDebugDump; data["Debug"]["DebugDump"] = isDebugDump;
data["GUI"]["theme"] = mw_themes; data["Debug"]["CollectShader"] = isShaderDebug;
data["GUI"]["iconSize"] = m_icon_size;
data["GUI"]["sliderPos"] = m_slider_pos; data["Keys"]["TrophyKey"] = trophyKey;
data["GUI"]["iconSizeGrid"] = m_icon_size_grid;
data["GUI"]["sliderPosGrid"] = m_slider_pos_grid;
data["GUI"]["gameTableMode"] = m_table_mode;
data["GUI"]["mw_width"] = m_window_size_W;
data["GUI"]["mw_height"] = m_window_size_H;
std::vector<std::string> install_dirs; std::vector<std::string> install_dirs;
for (const auto& dirString : settings_install_dirs) { for (const auto& dirString : settings_install_dirs) {
install_dirs.emplace_back(std::string{fmt::UTF(dirString.u8string()).data}); install_dirs.emplace_back(std::string{fmt::UTF(dirString.u8string()).data});
} }
data["GUI"]["installDirs"] = install_dirs; data["GUI"]["installDirs"] = install_dirs;
data["GUI"]["saveDataPath"] = std::string{fmt::UTF(save_data_path.u8string()).data};
data["GUI"]["loadGameSizeEnabled"] = load_game_size;
data["GUI"]["addonInstallDir"] = data["GUI"]["addonInstallDir"] =
std::string{fmt::UTF(settings_addon_install_dir.u8string()).data}; std::string{fmt::UTF(settings_addon_install_dir.u8string()).data};
data["GUI"]["emulatorLanguage"] = emulator_language;
data["Settings"]["consoleLanguage"] = m_language;
std::ofstream file(path, std::ios::binary);
file << data;
file.close();
saveMainWindow(path);
}
void saveMainWindow(const std::filesystem::path& path) {
toml::value data;
std::error_code error;
if (std::filesystem::exists(path, error)) {
try {
std::ifstream ifs;
ifs.exceptions(std::ifstream::failbit | std::ifstream::badbit);
ifs.open(path, std::ios_base::binary);
data = toml::parse(ifs, std::string{fmt::UTF(path.filename().u8string()).data});
} catch (const std::exception& ex) {
fmt::print("Exception trying to parse config file. Exception: {}\n", ex.what());
return;
}
} else {
if (error) {
fmt::print("Filesystem error: {}\n", error.message());
}
fmt::print("Saving new configuration file {}\n", fmt::UTF(path.u8string()));
}
data["GUI"]["mw_width"] = m_window_size_W;
data["GUI"]["mw_height"] = m_window_size_H;
data["GUI"]["theme"] = mw_themes;
data["GUI"]["iconSize"] = m_icon_size;
data["GUI"]["sliderPos"] = m_slider_pos;
data["GUI"]["iconSizeGrid"] = m_icon_size_grid;
data["GUI"]["sliderPosGrid"] = m_slider_pos_grid;
data["GUI"]["gameTableMode"] = m_table_mode;
data["GUI"]["geometry_x"] = main_window_geometry_x; data["GUI"]["geometry_x"] = main_window_geometry_x;
data["GUI"]["geometry_y"] = main_window_geometry_y; data["GUI"]["geometry_y"] = main_window_geometry_y;
data["GUI"]["geometry_w"] = main_window_geometry_w; data["GUI"]["geometry_w"] = main_window_geometry_w;
@@ -651,14 +868,8 @@ void save(const std::filesystem::path& path) {
data["GUI"]["pkgDirs"] = m_pkg_viewer; data["GUI"]["pkgDirs"] = m_pkg_viewer;
data["GUI"]["elfDirs"] = m_elf_viewer; data["GUI"]["elfDirs"] = m_elf_viewer;
data["GUI"]["recentFiles"] = m_recent_files; data["GUI"]["recentFiles"] = m_recent_files;
data["GUI"]["emulatorLanguage"] = emulator_language;
data["Settings"]["consoleLanguage"] = m_language; std::ofstream file(path, std::ios::binary);
// TODO Migration code, after a major release this should be removed.
data.at("GUI").as_table().erase("installDir");
std::ofstream file(path, std::ios::out);
file << data; file << data;
file.close(); file.close();
} }
@@ -666,6 +877,7 @@ void save(const std::filesystem::path& path) {
void setDefaultValues() { void setDefaultValues() {
isNeo = false; isNeo = false;
isFullscreen = false; isFullscreen = false;
isTrophyPopupDisabled = false;
playBGM = false; playBGM = false;
BGMvolume = 50; BGMvolume = 50;
enableDiscordRPC = true; enableDiscordRPC = true;
@@ -679,12 +891,14 @@ void setDefaultValues() {
} else { } else {
updateChannel = "Nightly"; updateChannel = "Nightly";
} }
chooseHomeTab = "General";
cursorState = HideCursorState::Idle; cursorState = HideCursorState::Idle;
cursorHideTimeout = 5; cursorHideTimeout = 5;
backButtonBehavior = "left"; backButtonBehavior = "left";
useSpecialPad = false; useSpecialPad = false;
specialPadClass = 1; specialPadClass = 1;
isDebugDump = false; isDebugDump = false;
isShaderDebug = false;
isShowSplash = false; isShowSplash = false;
isAutoUpdate = false; isAutoUpdate = false;
isNullGpu = false; isNullGpu = false;
@@ -693,12 +907,16 @@ void setDefaultValues() {
vkValidation = false; vkValidation = false;
vkValidationSync = false; vkValidationSync = false;
vkValidationGpu = false; vkValidationGpu = false;
rdocEnable = false;
vkMarkers = false;
vkCrashDiagnostic = false; vkCrashDiagnostic = false;
vkHostMarkers = false;
vkGuestMarkers = false;
rdocEnable = false;
emulator_language = "en"; emulator_language = "en";
m_language = 1; m_language = 1;
gpuId = -1; gpuId = -1;
separateupdatefolder = false;
compatibilityData = false;
checkCompatibilityOnStartup = false;
} }
} // namespace Config } // namespace Config

View File

@@ -13,39 +13,56 @@ enum HideCursorState : s16 { Never, Idle, Always };
void load(const std::filesystem::path& path); void load(const std::filesystem::path& path);
void save(const std::filesystem::path& path); void save(const std::filesystem::path& path);
void saveMainWindow(const std::filesystem::path& path);
bool isNeoMode(); std::string getTrophyKey();
bool isFullscreenMode(); void setTrophyKey(std::string key);
bool GetLoadGameSizeEnabled();
std::filesystem::path GetSaveDataPath();
void setLoadGameSizeEnabled(bool enable);
bool getIsFullscreen();
std::string getFullscreenMode();
bool isNeoModeConsole();
bool getPlayBGM(); bool getPlayBGM();
int getBGMvolume(); int getBGMvolume();
bool getisTrophyPopupDisabled();
bool getEnableDiscordRPC(); bool getEnableDiscordRPC();
bool getSeparateUpdateEnabled(); bool getSeparateUpdateEnabled();
bool getCompatibilityEnabled();
bool getCheckCompatibilityOnStartup();
std::string getLogFilter(); std::string getLogFilter();
std::string getLogType(); std::string getLogType();
std::string getUserName(); std::string getUserName();
std::string getUpdateChannel(); std::string getUpdateChannel();
std::string getChooseHomeTab();
u16 leftDeadZone();
u16 rightDeadZone();
s16 getCursorState(); s16 getCursorState();
int getCursorHideTimeout(); int getCursorHideTimeout();
std::string getBackButtonBehavior(); std::string getBackButtonBehavior();
bool getUseSpecialPad(); bool getUseSpecialPad();
int getSpecialPadClass(); int getSpecialPadClass();
bool getIsMotionControlsEnabled();
u32 getScreenWidth(); u32 getScreenWidth();
u32 getScreenHeight(); u32 getScreenHeight();
s32 getGpuId(); s32 getGpuId();
bool debugDump(); bool debugDump();
bool collectShadersForDebug();
bool showSplash(); bool showSplash();
bool autoUpdate(); bool autoUpdate();
bool nullGpu(); bool nullGpu();
bool copyGPUCmdBuffers(); bool copyGPUCmdBuffers();
bool dumpShaders(); bool dumpShaders();
bool patchShaders();
bool isRdocEnabled(); bool isRdocEnabled();
u32 vblankDiv(); u32 vblankDiv();
void setDebugDump(bool enable); void setDebugDump(bool enable);
void setCollectShaderForDebug(bool enable);
void setShowSplash(bool enable); void setShowSplash(bool enable);
void setAutoUpdate(bool enable); void setAutoUpdate(bool enable);
void setNullGpu(bool enable); void setNullGpu(bool enable);
@@ -55,7 +72,9 @@ void setVblankDiv(u32 value);
void setGpuId(s32 selectedGpuId); void setGpuId(s32 selectedGpuId);
void setScreenWidth(u32 width); void setScreenWidth(u32 width);
void setScreenHeight(u32 height); void setScreenHeight(u32 height);
void setFullscreenMode(bool enable); void setIsFullscreen(bool enable);
void setFullscreenMode(std::string mode);
void setisTrophyPopupDisabled(bool disable);
void setPlayBGM(bool enable); void setPlayBGM(bool enable);
void setBGMvolume(int volume); void setBGMvolume(int volume);
void setEnableDiscordRPC(bool enable); void setEnableDiscordRPC(bool enable);
@@ -63,13 +82,19 @@ 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 setUpdateChannel(const std::string& type); void setUpdateChannel(const std::string& type);
void setChooseHomeTab(const std::string& type);
void setSeparateUpdateEnabled(bool use); void setSeparateUpdateEnabled(bool use);
void setGameInstallDirs(const std::vector<std::filesystem::path>& settings_install_dirs_config);
void setSaveDataPath(const std::filesystem::path& path);
void setCompatibilityEnabled(bool use);
void setCheckCompatibilityOnStartup(bool use);
void setCursorState(s16 cursorState); void setCursorState(s16 cursorState);
void setCursorHideTimeout(int newcursorHideTimeout); void setCursorHideTimeout(int newcursorHideTimeout);
void setBackButtonBehavior(const std::string& type); void setBackButtonBehavior(const std::string& type);
void setUseSpecialPad(bool use); void setUseSpecialPad(bool use);
void setSpecialPadClass(int type); void setSpecialPadClass(int type);
void setIsMotionControlsEnabled(bool use);
void setLogType(const std::string& type); void setLogType(const std::string& type);
void setLogFilter(const std::string& type); void setLogFilter(const std::string& type);
@@ -81,8 +106,12 @@ void setRdocEnabled(bool enable);
bool vkValidationEnabled(); bool vkValidationEnabled();
bool vkValidationSyncEnabled(); bool vkValidationSyncEnabled();
bool vkValidationGpuEnabled(); bool vkValidationGpuEnabled();
bool vkMarkersEnabled(); bool getVkCrashDiagnosticEnabled();
bool vkCrashDiagnosticEnabled(); bool getVkHostMarkersEnabled();
bool getVkGuestMarkersEnabled();
void setVkCrashDiagnosticEnabled(bool enable);
void setVkHostMarkersEnabled(bool enable);
void setVkGuestMarkersEnabled(bool enable);
// Gui // Gui
void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h); void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h);

View File

@@ -14,9 +14,15 @@
#include <tracy/Tracy.hpp> #include <tracy/Tracy.hpp>
static inline bool IsProfilerConnected() { static inline bool IsProfilerConnected() {
#if TRACY_ENABLE
return tracy::GetProfiler().IsConnected(); return tracy::GetProfiler().IsConnected();
#else
return false;
#endif
} }
#define TRACY_GPU_ENABLED 0
#define CUSTOM_LOCK(type, varname) \ #define CUSTOM_LOCK(type, varname) \
tracy::LockableCtx varname { \ tracy::LockableCtx varname { \
[]() -> const tracy::SourceLocationData* { \ []() -> const tracy::SourceLocationData* { \
@@ -41,7 +47,7 @@ enum MarkersPalette : int {
#define RENDERER_TRACE ZoneScopedC(RendererMarkerColor) #define RENDERER_TRACE ZoneScopedC(RendererMarkerColor)
#define HLE_TRACE ZoneScopedC(HleMarkerColor) #define HLE_TRACE ZoneScopedC(HleMarkerColor)
#define TRACE_HINT(str) ZoneText(str.c_str(), str.size()) #define TRACE_HINT(str) ZoneText(str.data(), str.size())
#define TRACE_WARN(msg) \ #define TRACE_WARN(msg) \
[](const auto& msg) { TracyMessageC(msg.c_str(), msg.size(), tracy::Color::DarkOrange); }(msg); [](const auto& msg) { TracyMessageC(msg.c_str(), msg.size(), tracy::Color::DarkOrange); }(msg);
@@ -57,3 +63,11 @@ enum MarkersPalette : int {
tracy::SourceLocationData{nullptr, name, TracyFile, (uint32_t)TracyLine, 0}; tracy::SourceLocationData{nullptr, name, TracyFile, (uint32_t)TracyLine, 0};
#define FRAME_END FrameMark #define FRAME_END FrameMark
#ifdef TRACY_FIBERS
#define FIBER_ENTER(name) TracyFiberEnter(name)
#define FIBER_EXIT TracyFiberLeave
#else
#define FIBER_ENTER(name)
#define FIBER_EXIT
#endif

View File

@@ -13,6 +13,15 @@ DecoderImpl::DecoderImpl() {
DecoderImpl::~DecoderImpl() = default; DecoderImpl::~DecoderImpl() = default;
std::string DecoderImpl::disassembleInst(ZydisDecodedInstruction& inst,
ZydisDecodedOperand* operands, u64 address) {
const int bufLen = 256;
char szBuffer[bufLen];
ZydisFormatterFormatInstruction(&m_formatter, &inst, operands, inst.operand_count_visible,
szBuffer, sizeof(szBuffer), address, ZYAN_NULL);
return szBuffer;
}
void DecoderImpl::printInstruction(void* code, u64 address) { void DecoderImpl::printInstruction(void* code, u64 address) {
ZydisDecodedInstruction instruction; ZydisDecodedInstruction instruction;
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT_VISIBLE]; ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT_VISIBLE];
@@ -27,11 +36,8 @@ void DecoderImpl::printInstruction(void* code, u64 address) {
void DecoderImpl::printInst(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands, void DecoderImpl::printInst(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands,
u64 address) { u64 address) {
const int bufLen = 256; std::string s = disassembleInst(inst, operands, address);
char szBuffer[bufLen]; fmt::print("instruction: {}\n", s);
ZydisFormatterFormatInstruction(&m_formatter, &inst, operands, inst.operand_count_visible,
szBuffer, sizeof(szBuffer), address, ZYAN_NULL);
fmt::print("instruction: {}\n", szBuffer);
} }
ZyanStatus DecoderImpl::decodeInstruction(ZydisDecodedInstruction& inst, ZyanStatus DecoderImpl::decodeInstruction(ZydisDecodedInstruction& inst,

View File

@@ -14,6 +14,8 @@ public:
DecoderImpl(); DecoderImpl();
~DecoderImpl(); ~DecoderImpl();
std::string disassembleInst(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands,
u64 address);
void printInst(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands, u64 address); void printInst(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands, u64 address);
void printInstruction(void* code, u64 address); void printInstruction(void* code, u64 address);
ZyanStatus decodeInstruction(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands, ZyanStatus decodeInstruction(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands,

View File

@@ -3,7 +3,7 @@
#include <cstring> #include <cstring>
#include <ctime> #include <ctime>
#include "src/common/discord_rpc_handler.h" #include "discord_rpc_handler.h"
namespace DiscordRPCHandler { namespace DiscordRPCHandler {
@@ -17,7 +17,7 @@ void RPC::init() {
void RPC::setStatusIdling() { void RPC::setStatusIdling() {
DiscordRichPresence rpc{}; DiscordRichPresence rpc{};
rpc.largeImageKey = "https://github.com/shadps4-emu/shadPS4/raw/main/.github/shadps4.png"; rpc.largeImageKey = "https://cdn.jsdelivr.net/gh/shadps4-emu/shadPS4@main/.github/shadps4.png";
rpc.largeImageText = "shadPS4 is a PS4 emulator"; rpc.largeImageText = "shadPS4 is a PS4 emulator";
rpc.startTimestamp = startTimestamp; rpc.startTimestamp = startTimestamp;
rpc.details = "Idle"; rpc.details = "Idle";

View File

@@ -7,6 +7,7 @@
#include <string_view> #include <string_view>
#include "assert.h" #include "assert.h"
#include "bit_field.h"
#include "singleton.h" #include "singleton.h"
#include "types.h" #include "types.h"
@@ -16,6 +17,46 @@ class Emulator;
namespace Common { namespace Common {
union PSFAttributes {
/// Supports initial user's logout
BitField<0, 1, u32> support_initial_user_logout;
/// Enter button for the common dialog is cross.
BitField<1, 1, u32> enter_button_cross;
/// Warning dialog for PS Move is displayed in the options menu.
BitField<2, 1, u32> ps_move_warning;
/// Supports stereoscopic 3D.
BitField<3, 1, u32> support_stereoscopic_3d;
/// Suspends when PS button is pressed.
BitField<4, 1, u32> ps_button_suspend;
/// Enter button for the common dialog is assigned by the system software.
BitField<5, 1, u32> enter_button_system;
/// Overrides share menu behavior.
BitField<6, 1, u32> override_share_menu;
/// Suspends when PS button is pressed and special output resolution is set.
BitField<8, 1, u32> special_res_ps_button_suspend;
/// Enable HDCP.
BitField<9, 1, u32> enable_hdcp;
/// Disable HDCP for non-game.
BitField<10, 1, u32> disable_hdcp_non_game;
/// Supports PS VR.
BitField<14, 1, u32> support_ps_vr;
/// CPU mode (6 CPU)
BitField<15, 1, u32> six_cpu_mode;
/// CPU mode (7 CPU)
BitField<16, 1, u32> seven_cpu_mode;
/// Supports PS4 Pro (Neo) mode.
BitField<23, 1, u32> support_neo_mode;
/// Requires PS VR.
BitField<26, 1, u32> require_ps_vr;
/// Supports HDR.
BitField<29, 1, u32> support_hdr;
/// Display location.
BitField<31, 1, u32> display_location;
u32 raw{};
};
static_assert(sizeof(PSFAttributes) == 4);
class ElfInfo { class ElfInfo {
friend class Core::Emulator; friend class Core::Emulator;
@@ -26,6 +67,7 @@ class ElfInfo {
std::string app_ver{}; std::string app_ver{};
u32 firmware_ver = 0; u32 firmware_ver = 0;
u32 raw_firmware_ver = 0; u32 raw_firmware_ver = 0;
PSFAttributes psf_attributes{};
public: public:
static constexpr u32 FW_15 = 0x1500000; static constexpr u32 FW_15 = 0x1500000;
@@ -34,9 +76,11 @@ public:
static constexpr u32 FW_20 = 0x2000000; static constexpr u32 FW_20 = 0x2000000;
static constexpr u32 FW_25 = 0x2500000; static constexpr u32 FW_25 = 0x2500000;
static constexpr u32 FW_30 = 0x3000000; static constexpr u32 FW_30 = 0x3000000;
static constexpr u32 FW_35 = 0x3500000;
static constexpr u32 FW_40 = 0x4000000; static constexpr u32 FW_40 = 0x4000000;
static constexpr u32 FW_45 = 0x4500000; static constexpr u32 FW_45 = 0x4500000;
static constexpr u32 FW_50 = 0x5000000; static constexpr u32 FW_50 = 0x5000000;
static constexpr u32 FW_55 = 0x5500000;
static constexpr u32 FW_80 = 0x8000000; static constexpr u32 FW_80 = 0x8000000;
static ElfInfo& Instance() { static ElfInfo& Instance() {
@@ -67,6 +111,11 @@ public:
ASSERT(initialized); ASSERT(initialized);
return raw_firmware_ver; return raw_firmware_ver;
} }
[[nodiscard]] const PSFAttributes& GetPSFAttributes() const {
ASSERT(initialized);
return psf_attributes;
}
}; };
} // namespace Common } // namespace Common

14
src/common/hash.h Normal file
View File

@@ -0,0 +1,14 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/types.h"
[[nodiscard]] inline u64 HashCombine(const u64 seed, const u64 hash) {
return seed ^ (hash + 0x9e3779b9 + (seed << 12) + (seed >> 4));
}
[[nodiscard]] inline u32 HashCombine(const u32 seed, const u32 hash) {
return seed ^ (hash + 0x9e3779b9 + (seed << 6) + (seed >> 2));
}

View File

@@ -377,16 +377,18 @@ bool IOFile::Seek(s64 offset, SeekOrigin origin) const {
return false; return false;
} }
u64 size = GetSize(); if (False(file_access_mode & (FileAccessMode::Write | FileAccessMode::Append))) {
if (origin == SeekOrigin::CurrentPosition && Tell() + offset > size) { u64 size = GetSize();
LOG_ERROR(Common_Filesystem, "Seeking past the end of the file"); if (origin == SeekOrigin::CurrentPosition && Tell() + offset > size) {
return false; LOG_ERROR(Common_Filesystem, "Seeking past the end of the file");
} else if (origin == SeekOrigin::SetOrigin && (u64)offset > size) { return false;
LOG_ERROR(Common_Filesystem, "Seeking past the end of the file"); } else if (origin == SeekOrigin::SetOrigin && (u64)offset > size) {
return false; LOG_ERROR(Common_Filesystem, "Seeking past the end of the file");
} else if (origin == SeekOrigin::End && offset > 0) { return false;
LOG_ERROR(Common_Filesystem, "Seeking past the end of the file"); } else if (origin == SeekOrigin::End && offset > 0) {
return false; LOG_ERROR(Common_Filesystem, "Seeking past the end of the file");
return false;
}
} }
errno = 0; errno = 0;

View File

@@ -10,6 +10,7 @@
#include "common/concepts.h" #include "common/concepts.h"
#include "common/types.h" #include "common/types.h"
#include "enum.h"
namespace Common::FS { namespace Common::FS {
@@ -42,6 +43,7 @@ enum class FileAccessMode {
*/ */
ReadAppend = Read | Append, ReadAppend = Read | Append,
}; };
DECLARE_ENUM_FLAG_OPERATORS(FileAccessMode);
enum class FileType { enum class FileType {
BinaryFile, BinaryFile,
@@ -205,7 +207,7 @@ public:
return WriteSpan(string); return WriteSpan(string);
} }
static size_t WriteBytes(const std::filesystem::path path, std::span<const u8> data) { static size_t WriteBytes(const std::filesystem::path path, const auto& data) {
IOFile out(path, FileAccessMode::Write); IOFile out(path, FileAccessMode::Write);
return out.Write(data); return out.Write(data);
} }

View File

@@ -69,6 +69,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
SUB(Common, Memory) \ SUB(Common, Memory) \
CLS(Core) \ CLS(Core) \
SUB(Core, Linker) \ SUB(Core, Linker) \
SUB(Core, Devices) \
CLS(Config) \ CLS(Config) \
CLS(Debug) \ CLS(Debug) \
CLS(Kernel) \ CLS(Kernel) \
@@ -94,18 +95,25 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
SUB(Lib, SaveData) \ SUB(Lib, SaveData) \
SUB(Lib, SaveDataDialog) \ SUB(Lib, SaveDataDialog) \
SUB(Lib, Http) \ SUB(Lib, Http) \
SUB(Lib, Http2) \
SUB(Lib, Ssl) \ SUB(Lib, Ssl) \
SUB(Lib, Ssl2) \
SUB(Lib, SysModule) \ SUB(Lib, SysModule) \
SUB(Lib, Move) \
SUB(Lib, NpCommon) \
SUB(Lib, NpManager) \ SUB(Lib, NpManager) \
SUB(Lib, NpScore) \ SUB(Lib, NpScore) \
SUB(Lib, NpTrophy) \ SUB(Lib, NpTrophy) \
SUB(Lib, NpWebApi) \
SUB(Lib, Screenshot) \ SUB(Lib, Screenshot) \
SUB(Lib, LibCInternal) \ SUB(Lib, LibCInternal) \
SUB(Lib, AppContent) \ SUB(Lib, AppContent) \
SUB(Lib, Rtc) \ SUB(Lib, Rtc) \
SUB(Lib, DiscMap) \ SUB(Lib, DiscMap) \
SUB(Lib, Png) \ SUB(Lib, Png) \
SUB(Lib, Jpeg) \
SUB(Lib, PlayGo) \ SUB(Lib, PlayGo) \
SUB(Lib, PlayGoDialog) \
SUB(Lib, Random) \ SUB(Lib, Random) \
SUB(Lib, Usbd) \ SUB(Lib, Usbd) \
SUB(Lib, Ajm) \ SUB(Lib, Ajm) \
@@ -120,6 +128,12 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
SUB(Lib, SharePlay) \ SUB(Lib, SharePlay) \
SUB(Lib, Fiber) \ SUB(Lib, Fiber) \
SUB(Lib, Vdec2) \ SUB(Lib, Vdec2) \
SUB(Lib, Videodec) \
SUB(Lib, RazorCpu) \
SUB(Lib, Mouse) \
SUB(Lib, WebBrowserDialog) \
SUB(Lib, NpParty) \
SUB(Lib, Zlib) \
CLS(Frontend) \ CLS(Frontend) \
CLS(Render) \ CLS(Render) \
SUB(Render, Vulkan) \ SUB(Render, Vulkan) \

View File

@@ -35,6 +35,7 @@ enum class Class : u8 {
Common_Memory, ///< Memory mapping and management functions Common_Memory, ///< Memory mapping and management functions
Core, ///< LLE emulation core Core, ///< LLE emulation core
Core_Linker, ///< The module linker Core_Linker, ///< The module linker
Core_Devices, ///< Devices emulation
Config, ///< Emulator configuration (including commandline) Config, ///< Emulator configuration (including commandline)
Debug, ///< Debugging tools Debug, ///< Debugging tools
Kernel, ///< The HLE implementation of the PS4 kernel. Kernel, ///< The HLE implementation of the PS4 kernel.
@@ -56,23 +57,30 @@ enum class Class : u8 {
Lib_MsgDlg, ///< The LibSceMsgDialog implementation. Lib_MsgDlg, ///< The LibSceMsgDialog implementation.
Lib_AudioOut, ///< The LibSceAudioOut implementation. Lib_AudioOut, ///< The LibSceAudioOut implementation.
Lib_AudioIn, ///< The LibSceAudioIn implementation. Lib_AudioIn, ///< The LibSceAudioIn implementation.
Lib_Move, ///< The LibSceMove implementation.
Lib_Net, ///< The LibSceNet implementation. Lib_Net, ///< The LibSceNet implementation.
Lib_NetCtl, ///< The LibSecNetCtl implementation. Lib_NetCtl, ///< The LibSceNetCtl implementation.
Lib_SaveData, ///< The LibSceSaveData implementation. Lib_SaveData, ///< The LibSceSaveData implementation.
Lib_SaveDataDialog, ///< The LibSceSaveDataDialog implementation. Lib_SaveDataDialog, ///< The LibSceSaveDataDialog implementation.
Lib_Ssl, ///< The LibSceSsl implementation. Lib_Ssl, ///< The LibSceSsl implementation.
Lib_Ssl2, ///< The LibSceSsl2 implementation.
Lib_Http, ///< The LibSceHttp implementation. Lib_Http, ///< The LibSceHttp implementation.
Lib_Http2, ///< The LibSceHttp2 implementation.
Lib_SysModule, ///< The LibSceSysModule implementation Lib_SysModule, ///< The LibSceSysModule implementation
Lib_NpCommon, ///< The LibSceNpCommon implementation
Lib_NpManager, ///< The LibSceNpManager implementation Lib_NpManager, ///< The LibSceNpManager implementation
Lib_NpScore, ///< The LibSceNpScore implementation Lib_NpScore, ///< The LibSceNpScore implementation
Lib_NpTrophy, ///< The LibSceNpTrophy implementation Lib_NpTrophy, ///< The LibSceNpTrophy implementation
Lib_NpWebApi, ///< The LibSceWebApi implementation
Lib_Screenshot, ///< The LibSceScreenshot implementation Lib_Screenshot, ///< The LibSceScreenshot implementation
Lib_LibCInternal, ///< The LibCInternal implementation. Lib_LibCInternal, ///< The LibCInternal implementation.
Lib_AppContent, ///< The LibSceAppContent implementation. Lib_AppContent, ///< The LibSceAppContent implementation.
Lib_Rtc, ///< The LibSceRtc implementation. Lib_Rtc, ///< The LibSceRtc implementation.
Lib_DiscMap, ///< The LibSceDiscMap implementation. Lib_DiscMap, ///< The LibSceDiscMap implementation.
Lib_Png, ///< The LibScePng implementation. Lib_Png, ///< The LibScePng implementation.
Lib_Jpeg, ///< The LibSceJpeg implementation.
Lib_PlayGo, ///< The LibScePlayGo implementation. Lib_PlayGo, ///< The LibScePlayGo implementation.
Lib_PlayGoDialog, ///< The LibScePlayGoDialog implementation.
Lib_Random, ///< The libSceRandom implementation. Lib_Random, ///< The libSceRandom implementation.
Lib_Usbd, ///< The LibSceUsbd implementation. Lib_Usbd, ///< The LibSceUsbd implementation.
Lib_Ajm, ///< The LibSceAjm implementation. Lib_Ajm, ///< The LibSceAjm implementation.
@@ -87,6 +95,12 @@ enum class Class : u8 {
Lib_SharePlay, ///< The LibSceSharePlay implemenation Lib_SharePlay, ///< The LibSceSharePlay implemenation
Lib_Fiber, ///< The LibSceFiber implementation. Lib_Fiber, ///< The LibSceFiber implementation.
Lib_Vdec2, ///< The LibSceVideodec2 implementation. Lib_Vdec2, ///< The LibSceVideodec2 implementation.
Lib_Videodec, ///< The LibSceVideodec implementation.
Lib_RazorCpu, ///< The LibRazorCpu implementation.
Lib_Mouse, ///< The LibSceMouse implementation
Lib_WebBrowserDialog, ///< The LibSceWebBrowserDialog implementation
Lib_NpParty, ///< The LibSceNpParty implementation
Lib_Zlib, ///< The LibSceZlib implementation.
Frontend, ///< Emulator UI Frontend, ///< Emulator UI
Render, ///< Video Core Render, ///< Video Core
Render_Vulkan, ///< Vulkan backend Render_Vulkan, ///< Vulkan backend

View File

@@ -7,6 +7,7 @@
#include <string> #include <string>
#include <pugixml.hpp> #include <pugixml.hpp>
#ifdef ENABLE_QT_GUI #ifdef ENABLE_QT_GUI
#include <QDir>
#include <QFile> #include <QFile>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument> #include <QJsonDocument>
@@ -28,7 +29,7 @@ std::string g_game_serial;
std::string patchFile; std::string patchFile;
std::vector<patchInfo> pending_patches; std::vector<patchInfo> pending_patches;
std::string toHex(unsigned long long value, size_t byteSize) { std::string toHex(u64 value, size_t byteSize) {
std::stringstream ss; std::stringstream ss;
ss << std::hex << std::setfill('0') << std::setw(byteSize * 2) << value; ss << std::hex << std::setfill('0') << std::setw(byteSize * 2) << value;
return ss.str(); return ss.str();
@@ -38,16 +39,16 @@ std::string convertValueToHex(const std::string type, const std::string valueStr
std::string result; std::string result;
if (type == "byte") { if (type == "byte") {
unsigned int value = std::stoul(valueStr, nullptr, 16); const u32 value = std::stoul(valueStr, nullptr, 16);
result = toHex(value, 1); result = toHex(value, 1);
} else if (type == "bytes16") { } else if (type == "bytes16") {
unsigned int value = std::stoul(valueStr, nullptr, 16); const u32 value = std::stoul(valueStr, nullptr, 16);
result = toHex(value, 2); result = toHex(value, 2);
} else if (type == "bytes32") { } else if (type == "bytes32") {
unsigned long value = std::stoul(valueStr, nullptr, 16); const u32 value = std::stoul(valueStr, nullptr, 16);
result = toHex(value, 4); result = toHex(value, 4);
} else if (type == "bytes64") { } else if (type == "bytes64") {
unsigned long long value = std::stoull(valueStr, nullptr, 16); const u64 value = std::stoull(valueStr, nullptr, 16);
result = toHex(value, 8); result = toHex(value, 8);
} else if (type == "float32") { } else if (type == "float32") {
union { union {
@@ -189,14 +190,16 @@ void OnGameLoaded() {
// We use the QT headers for the xml and json parsing, this define is only true on QT builds // We use the QT headers for the xml and json parsing, this define is only true on QT builds
QString patchDir; QString patchDir;
Common::FS::PathToQString(patchDir, Common::FS::GetUserPath(Common::FS::PathType::PatchesDir)); Common::FS::PathToQString(patchDir, Common::FS::GetUserPath(Common::FS::PathType::PatchesDir));
QString repositories[] = {"GoldHEN", "shadPS4"}; QDir dir(patchDir);
QStringList folders = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
for (const QString& repository : repositories) { for (const QString& folder : folders) {
QString filesJsonPath = patchDir + "/" + repository + "/files.json"; QString filesJsonPath = patchDir + "/" + folder + "/files.json";
QFile jsonFile(filesJsonPath); QFile jsonFile(filesJsonPath);
if (!jsonFile.open(QIODevice::ReadOnly)) { if (!jsonFile.open(QIODevice::ReadOnly)) {
LOG_ERROR(Loader, "Unable to open files.json for reading."); LOG_ERROR(Loader, "Unable to open files.json for reading in repository {}",
folder.toStdString());
continue; continue;
} }
@@ -220,11 +223,12 @@ void OnGameLoaded() {
} }
if (selectedFileName.isEmpty()) { if (selectedFileName.isEmpty()) {
LOG_ERROR(Loader, "No patch file found for the current serial."); LOG_ERROR(Loader, "No patch file found for the current serial in repository {}",
folder.toStdString());
continue; continue;
} }
QString filePath = patchDir + "/" + repository + "/" + selectedFileName; QString filePath = patchDir + "/" + folder + "/" + selectedFileName;
QFile file(filePath); QFile file(filePath);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
LOG_ERROR(Loader, "Unable to open the file for reading."); LOG_ERROR(Loader, "Unable to open the file for reading.");

View File

@@ -4,11 +4,6 @@
#include "common/native_clock.h" #include "common/native_clock.h"
#include "common/rdtsc.h" #include "common/rdtsc.h"
#include "common/uint128.h" #include "common/uint128.h"
#ifdef _WIN64
#include <pthread_time.h>
#else
#include <time.h>
#endif
namespace Common { namespace Common {
@@ -34,10 +29,4 @@ u64 NativeClock::GetUptime() const {
return FencedRDTSC(); return FencedRDTSC();
} }
u64 NativeClock::GetProcessTimeUS() const {
timespec ret;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ret);
return ret.tv_nsec / 1000 + ret.tv_sec * 1000000;
}
} // namespace Common } // namespace Common

View File

@@ -20,7 +20,6 @@ public:
u64 GetTimeUS(u64 base_ptc = 0) const; u64 GetTimeUS(u64 base_ptc = 0) const;
u64 GetTimeMS(u64 base_ptc = 0) const; u64 GetTimeMS(u64 base_ptc = 0) const;
u64 GetUptime() const; u64 GetUptime() const;
u64 GetProcessTimeUS() const;
private: private:
u64 rdtsc_frequency; u64 rdtsc_frequency;

View File

@@ -5,8 +5,11 @@
#include "ntapi.h" #include "ntapi.h"
NtDelayExecution_t NtDelayExecution = nullptr; NtClose_t NtClose = nullptr;
NtSetInformationFile_t NtSetInformationFile = nullptr; NtSetInformationFile_t NtSetInformationFile = nullptr;
NtCreateThread_t NtCreateThread = nullptr;
NtTerminateThread_t NtTerminateThread = nullptr;
NtQueueApcThreadEx_t NtQueueApcThreadEx = nullptr;
namespace Common::NtApi { namespace Common::NtApi {
@@ -14,9 +17,12 @@ void Initialize() {
HMODULE nt_handle = GetModuleHandleA("ntdll.dll"); HMODULE nt_handle = GetModuleHandleA("ntdll.dll");
// http://stackoverflow.com/a/31411628/4725495 // http://stackoverflow.com/a/31411628/4725495
NtDelayExecution = (NtDelayExecution_t)GetProcAddress(nt_handle, "NtDelayExecution"); NtClose = (NtClose_t)GetProcAddress(nt_handle, "NtClose");
NtSetInformationFile = NtSetInformationFile =
(NtSetInformationFile_t)GetProcAddress(nt_handle, "NtSetInformationFile"); (NtSetInformationFile_t)GetProcAddress(nt_handle, "NtSetInformationFile");
NtCreateThread = (NtCreateThread_t)GetProcAddress(nt_handle, "NtCreateThread");
NtTerminateThread = (NtTerminateThread_t)GetProcAddress(nt_handle, "NtTerminateThread");
NtQueueApcThreadEx = (NtQueueApcThreadEx_t)GetProcAddress(nt_handle, "NtQueueApcThreadEx");
} }
} // namespace Common::NtApi } // namespace Common::NtApi

View File

@@ -108,14 +108,444 @@ typedef struct _FILE_DISPOSITION_INFORMATION {
BOOLEAN DeleteFile; BOOLEAN DeleteFile;
} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION; } FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
typedef u32(__stdcall* NtDelayExecution_t)(BOOL Alertable, PLARGE_INTEGER DelayInterval); typedef struct _UNICODE_STRING {
USHORT Length;
USHORT MaximumLength;
PWCH Buffer;
} UNICODE_STRING, *PUNICODE_STRING;
typedef u32(__stdcall* NtSetInformationFile_t)(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, typedef const UNICODE_STRING* PCUNICODE_STRING;
typedef struct _OBJECT_ATTRIBUTES {
ULONG Length;
HANDLE RootDirectory;
PCUNICODE_STRING ObjectName;
ULONG Attributes;
PVOID SecurityDescriptor; // PSECURITY_DESCRIPTOR;
PVOID SecurityQualityOfService; // PSECURITY_QUALITY_OF_SERVICE
} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
typedef const OBJECT_ATTRIBUTES* PCOBJECT_ATTRIBUTES;
typedef struct _CLIENT_ID {
HANDLE UniqueProcess;
HANDLE UniqueThread;
} CLIENT_ID, *PCLIENT_ID;
typedef struct _INITIAL_TEB {
struct {
PVOID OldStackBase;
PVOID OldStackLimit;
} OldInitialTeb;
PVOID StackBase;
PVOID StackLimit;
PVOID StackAllocationBase;
} INITIAL_TEB, *PINITIAL_TEB;
typedef struct _PEB_LDR_DATA {
ULONG Length;
BOOLEAN Initialized;
PVOID SsHandle;
LIST_ENTRY InLoadOrderModuleList;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;
PVOID EntryInProgress;
BOOLEAN ShutdownInProgress;
HANDLE ShutdownThreadId;
} PEB_LDR_DATA, *PPEB_LDR_DATA;
typedef struct _CURDIR {
UNICODE_STRING DosPath;
PVOID Handle;
} CURDIR, *PCURDIR;
typedef struct RTL_DRIVE_LETTER_CURDIR {
USHORT Flags;
USHORT Length;
ULONG TimeStamp;
UNICODE_STRING DosPath;
} RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
typedef struct _RTL_USER_PROCESS_PARAMETERS {
ULONG AllocationSize;
ULONG Size;
ULONG Flags;
ULONG DebugFlags;
HANDLE ConsoleHandle;
ULONG ConsoleFlags;
HANDLE hStdInput;
HANDLE hStdOutput;
HANDLE hStdError;
CURDIR CurrentDirectory;
UNICODE_STRING DllPath;
UNICODE_STRING ImagePathName;
UNICODE_STRING CommandLine;
PWSTR Environment;
ULONG dwX;
ULONG dwY;
ULONG dwXSize;
ULONG dwYSize;
ULONG dwXCountChars;
ULONG dwYCountChars;
ULONG dwFillAttribute;
ULONG dwFlags;
ULONG wShowWindow;
UNICODE_STRING WindowTitle;
UNICODE_STRING Desktop;
UNICODE_STRING ShellInfo;
UNICODE_STRING RuntimeInfo;
RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory[0x20];
ULONG_PTR EnvironmentSize;
ULONG_PTR EnvironmentVersion;
PVOID PackageDependencyData;
ULONG ProcessGroupId;
ULONG LoaderThreads;
} RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
typedef struct tagRTL_BITMAP {
ULONG SizeOfBitMap;
PULONG Buffer;
} RTL_BITMAP, *PRTL_BITMAP;
typedef struct {
UINT next;
UINT id;
ULONGLONG addr;
ULONGLONG size;
UINT args[4];
} CROSS_PROCESS_WORK_ENTRY;
typedef union {
struct {
UINT first;
UINT counter;
};
volatile LONGLONG hdr;
} CROSS_PROCESS_WORK_HDR;
typedef struct {
CROSS_PROCESS_WORK_HDR free_list;
CROSS_PROCESS_WORK_HDR work_list;
ULONGLONG unknown[4];
CROSS_PROCESS_WORK_ENTRY entries[1];
} CROSS_PROCESS_WORK_LIST;
typedef struct _CHPEV2_PROCESS_INFO {
ULONG Wow64ExecuteFlags; /* 000 */
USHORT NativeMachineType; /* 004 */
USHORT EmulatedMachineType; /* 006 */
HANDLE SectionHandle; /* 008 */
CROSS_PROCESS_WORK_LIST* CrossProcessWorkList; /* 010 */
void* unknown; /* 018 */
} CHPEV2_PROCESS_INFO, *PCHPEV2_PROCESS_INFO;
typedef u64(__stdcall* KERNEL_CALLBACK_PROC)(void*, ULONG);
typedef struct _PEB { /* win32/win64 */
BOOLEAN InheritedAddressSpace; /* 000/000 */
BOOLEAN ReadImageFileExecOptions; /* 001/001 */
BOOLEAN BeingDebugged; /* 002/002 */
UCHAR ImageUsedLargePages : 1; /* 003/003 */
UCHAR IsProtectedProcess : 1;
UCHAR IsImageDynamicallyRelocated : 1;
UCHAR SkipPatchingUser32Forwarders : 1;
UCHAR IsPackagedProcess : 1;
UCHAR IsAppContainer : 1;
UCHAR IsProtectedProcessLight : 1;
UCHAR IsLongPathAwareProcess : 1;
HANDLE Mutant; /* 004/008 */
HMODULE ImageBaseAddress; /* 008/010 */
PPEB_LDR_DATA LdrData; /* 00c/018 */
RTL_USER_PROCESS_PARAMETERS* ProcessParameters; /* 010/020 */
PVOID SubSystemData; /* 014/028 */
HANDLE ProcessHeap; /* 018/030 */
PRTL_CRITICAL_SECTION FastPebLock; /* 01c/038 */
PVOID AtlThunkSListPtr; /* 020/040 */
PVOID IFEOKey; /* 024/048 */
ULONG ProcessInJob : 1; /* 028/050 */
ULONG ProcessInitializing : 1;
ULONG ProcessUsingVEH : 1;
ULONG ProcessUsingVCH : 1;
ULONG ProcessUsingFTH : 1;
ULONG ProcessPreviouslyThrottled : 1;
ULONG ProcessCurrentlyThrottled : 1;
ULONG ProcessImagesHotPatched : 1;
ULONG ReservedBits0 : 24;
KERNEL_CALLBACK_PROC* KernelCallbackTable; /* 02c/058 */
ULONG Reserved; /* 030/060 */
ULONG AtlThunkSListPtr32; /* 034/064 */
PVOID ApiSetMap; /* 038/068 */
ULONG TlsExpansionCounter; /* 03c/070 */
PRTL_BITMAP TlsBitmap; /* 040/078 */
ULONG TlsBitmapBits[2]; /* 044/080 */
PVOID ReadOnlySharedMemoryBase; /* 04c/088 */
PVOID SharedData; /* 050/090 */
PVOID* ReadOnlyStaticServerData; /* 054/098 */
PVOID AnsiCodePageData; /* 058/0a0 */
PVOID OemCodePageData; /* 05c/0a8 */
PVOID UnicodeCaseTableData; /* 060/0b0 */
ULONG NumberOfProcessors; /* 064/0b8 */
ULONG NtGlobalFlag; /* 068/0bc */
LARGE_INTEGER CriticalSectionTimeout; /* 070/0c0 */
SIZE_T HeapSegmentReserve; /* 078/0c8 */
SIZE_T HeapSegmentCommit; /* 07c/0d0 */
SIZE_T HeapDeCommitTotalFreeThreshold; /* 080/0d8 */
SIZE_T HeapDeCommitFreeBlockThreshold; /* 084/0e0 */
ULONG NumberOfHeaps; /* 088/0e8 */
ULONG MaximumNumberOfHeaps; /* 08c/0ec */
PVOID* ProcessHeaps; /* 090/0f0 */
PVOID GdiSharedHandleTable; /* 094/0f8 */
PVOID ProcessStarterHelper; /* 098/100 */
PVOID GdiDCAttributeList; /* 09c/108 */
PVOID LoaderLock; /* 0a0/110 */
ULONG OSMajorVersion; /* 0a4/118 */
ULONG OSMinorVersion; /* 0a8/11c */
ULONG OSBuildNumber; /* 0ac/120 */
ULONG OSPlatformId; /* 0b0/124 */
ULONG ImageSubSystem; /* 0b4/128 */
ULONG ImageSubSystemMajorVersion; /* 0b8/12c */
ULONG ImageSubSystemMinorVersion; /* 0bc/130 */
KAFFINITY ActiveProcessAffinityMask; /* 0c0/138 */
#ifdef _WIN64
ULONG GdiHandleBuffer[60]; /* /140 */
#else
ULONG GdiHandleBuffer[34]; /* 0c4/ */
#endif
PVOID PostProcessInitRoutine; /* 14c/230 */
PRTL_BITMAP TlsExpansionBitmap; /* 150/238 */
ULONG TlsExpansionBitmapBits[32]; /* 154/240 */
ULONG SessionId; /* 1d4/2c0 */
ULARGE_INTEGER AppCompatFlags; /* 1d8/2c8 */
ULARGE_INTEGER AppCompatFlagsUser; /* 1e0/2d0 */
PVOID ShimData; /* 1e8/2d8 */
PVOID AppCompatInfo; /* 1ec/2e0 */
UNICODE_STRING CSDVersion; /* 1f0/2e8 */
PVOID ActivationContextData; /* 1f8/2f8 */
PVOID ProcessAssemblyStorageMap; /* 1fc/300 */
PVOID SystemDefaultActivationData; /* 200/308 */
PVOID SystemAssemblyStorageMap; /* 204/310 */
SIZE_T MinimumStackCommit; /* 208/318 */
PVOID* FlsCallback; /* 20c/320 */
LIST_ENTRY FlsListHead; /* 210/328 */
union {
PRTL_BITMAP FlsBitmap; /* 218/338 */
#ifdef _WIN64
CHPEV2_PROCESS_INFO* ChpeV2ProcessInfo; /* /338 */
#endif
};
ULONG FlsBitmapBits[4]; /* 21c/340 */
ULONG FlsHighIndex; /* 22c/350 */
PVOID WerRegistrationData; /* 230/358 */
PVOID WerShipAssertPtr; /* 234/360 */
PVOID EcCodeBitMap; /* 238/368 */
PVOID pImageHeaderHash; /* 23c/370 */
ULONG HeapTracingEnabled : 1; /* 240/378 */
ULONG CritSecTracingEnabled : 1;
ULONG LibLoaderTracingEnabled : 1;
ULONG SpareTracingBits : 29;
ULONGLONG CsrServerReadOnlySharedMemoryBase; /* 248/380 */
ULONG TppWorkerpListLock; /* 250/388 */
LIST_ENTRY TppWorkerpList; /* 254/390 */
PVOID WaitOnAddressHashTable[0x80]; /* 25c/3a0 */
PVOID TelemetryCoverageHeader; /* 45c/7a0 */
ULONG CloudFileFlags; /* 460/7a8 */
ULONG CloudFileDiagFlags; /* 464/7ac */
CHAR PlaceholderCompatibilityMode; /* 468/7b0 */
CHAR PlaceholderCompatibilityModeReserved[7]; /* 469/7b1 */
PVOID LeapSecondData; /* 470/7b8 */
ULONG LeapSecondFlags; /* 474/7c0 */
ULONG NtGlobalFlag2; /* 478/7c4 */
} PEB, *PPEB;
typedef struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME {
struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME* Previous;
struct _ACTIVATION_CONTEXT* ActivationContext;
ULONG Flags;
} RTL_ACTIVATION_CONTEXT_STACK_FRAME, *PRTL_ACTIVATION_CONTEXT_STACK_FRAME;
typedef struct _ACTIVATION_CONTEXT_STACK {
RTL_ACTIVATION_CONTEXT_STACK_FRAME* ActiveFrame;
LIST_ENTRY FrameListCache;
ULONG Flags;
ULONG NextCookieSequenceNumber;
ULONG_PTR StackId;
} ACTIVATION_CONTEXT_STACK, *PACTIVATION_CONTEXT_STACK;
typedef struct _GDI_TEB_BATCH {
ULONG Offset;
HANDLE HDC;
ULONG Buffer[0x136];
} GDI_TEB_BATCH;
typedef struct _TEB_ACTIVE_FRAME_CONTEXT {
ULONG Flags;
const char* FrameName;
} TEB_ACTIVE_FRAME_CONTEXT, *PTEB_ACTIVE_FRAME_CONTEXT;
typedef struct _TEB_ACTIVE_FRAME {
ULONG Flags;
struct _TEB_ACTIVE_FRAME* Previous;
TEB_ACTIVE_FRAME_CONTEXT* Context;
} TEB_ACTIVE_FRAME, *PTEB_ACTIVE_FRAME;
typedef struct _TEB { /* win32/win64 */
NT_TIB Tib; /* 000/0000 */
PVOID EnvironmentPointer; /* 01c/0038 */
CLIENT_ID ClientId; /* 020/0040 */
PVOID ActiveRpcHandle; /* 028/0050 */
PVOID ThreadLocalStoragePointer; /* 02c/0058 */
PPEB Peb; /* 030/0060 */
ULONG LastErrorValue; /* 034/0068 */
ULONG CountOfOwnedCriticalSections; /* 038/006c */
PVOID CsrClientThread; /* 03c/0070 */
PVOID Win32ThreadInfo; /* 040/0078 */
ULONG User32Reserved[26]; /* 044/0080 */
ULONG UserReserved[5]; /* 0ac/00e8 */
PVOID WOW32Reserved; /* 0c0/0100 */
ULONG CurrentLocale; /* 0c4/0108 */
ULONG FpSoftwareStatusRegister; /* 0c8/010c */
PVOID ReservedForDebuggerInstrumentation[16]; /* 0cc/0110 */
#ifdef _WIN64
PVOID SystemReserved1[30]; /* /0190 */
#else
PVOID SystemReserved1[26]; /* 10c/ */
#endif
char PlaceholderCompatibilityMode; /* 174/0280 */
BOOLEAN PlaceholderHydrationAlwaysExplicit; /* 175/0281 */
char PlaceholderReserved[10]; /* 176/0282 */
DWORD ProxiedProcessId; /* 180/028c */
ACTIVATION_CONTEXT_STACK ActivationContextStack; /* 184/0290 */
UCHAR WorkingOnBehalfOfTicket[8]; /* 19c/02b8 */
LONG ExceptionCode; /* 1a4/02c0 */
ACTIVATION_CONTEXT_STACK* ActivationContextStackPointer; /* 1a8/02c8 */
ULONG_PTR InstrumentationCallbackSp; /* 1ac/02d0 */
ULONG_PTR InstrumentationCallbackPreviousPc; /* 1b0/02d8 */
ULONG_PTR InstrumentationCallbackPreviousSp; /* 1b4/02e0 */
#ifdef _WIN64
ULONG TxFsContext; /* /02e8 */
BOOLEAN InstrumentationCallbackDisabled; /* /02ec */
BOOLEAN UnalignedLoadStoreExceptions; /* /02ed */
#else
BOOLEAN InstrumentationCallbackDisabled; /* 1b8/ */
BYTE SpareBytes1[23]; /* 1b9/ */
ULONG TxFsContext; /* 1d0/ */
#endif
GDI_TEB_BATCH GdiTebBatch; /* 1d4/02f0 */
CLIENT_ID RealClientId; /* 6b4/07d8 */
HANDLE GdiCachedProcessHandle; /* 6bc/07e8 */
ULONG GdiClientPID; /* 6c0/07f0 */
ULONG GdiClientTID; /* 6c4/07f4 */
PVOID GdiThreadLocaleInfo; /* 6c8/07f8 */
ULONG_PTR Win32ClientInfo[62]; /* 6cc/0800 */
PVOID glDispatchTable[233]; /* 7c4/09f0 */
PVOID glReserved1[29]; /* b68/1138 */
PVOID glReserved2; /* bdc/1220 */
PVOID glSectionInfo; /* be0/1228 */
PVOID glSection; /* be4/1230 */
PVOID glTable; /* be8/1238 */
PVOID glCurrentRC; /* bec/1240 */
PVOID glContext; /* bf0/1248 */
ULONG LastStatusValue; /* bf4/1250 */
UNICODE_STRING StaticUnicodeString; /* bf8/1258 */
WCHAR StaticUnicodeBuffer[261]; /* c00/1268 */
PVOID DeallocationStack; /* e0c/1478 */
PVOID TlsSlots[64]; /* e10/1480 */
LIST_ENTRY TlsLinks; /* f10/1680 */
PVOID Vdm; /* f18/1690 */
PVOID ReservedForNtRpc; /* f1c/1698 */
PVOID DbgSsReserved[2]; /* f20/16a0 */
ULONG HardErrorMode; /* f28/16b0 */
#ifdef _WIN64
PVOID Instrumentation[11]; /* /16b8 */
#else
PVOID Instrumentation[9]; /* f2c/ */
#endif
GUID ActivityId; /* f50/1710 */
PVOID SubProcessTag; /* f60/1720 */
PVOID PerflibData; /* f64/1728 */
PVOID EtwTraceData; /* f68/1730 */
PVOID WinSockData; /* f6c/1738 */
ULONG GdiBatchCount; /* f70/1740 */
ULONG IdealProcessorValue; /* f74/1744 */
ULONG GuaranteedStackBytes; /* f78/1748 */
PVOID ReservedForPerf; /* f7c/1750 */
PVOID ReservedForOle; /* f80/1758 */
ULONG WaitingOnLoaderLock; /* f84/1760 */
PVOID SavedPriorityState; /* f88/1768 */
ULONG_PTR ReservedForCodeCoverage; /* f8c/1770 */
PVOID ThreadPoolData; /* f90/1778 */
PVOID* TlsExpansionSlots; /* f94/1780 */
#ifdef _WIN64
union {
PVOID DeallocationBStore; /* /1788 */
PVOID* ChpeV2CpuAreaInfo; /* /1788 */
} DUMMYUNIONNAME;
PVOID BStoreLimit; /* /1790 */
#endif
ULONG MuiGeneration; /* f98/1798 */
ULONG IsImpersonating; /* f9c/179c */
PVOID NlsCache; /* fa0/17a0 */
PVOID ShimData; /* fa4/17a8 */
ULONG HeapVirtualAffinity; /* fa8/17b0 */
PVOID CurrentTransactionHandle; /* fac/17b8 */
TEB_ACTIVE_FRAME* ActiveFrame; /* fb0/17c0 */
PVOID* FlsSlots; /* fb4/17c8 */
PVOID PreferredLanguages; /* fb8/17d0 */
PVOID UserPrefLanguages; /* fbc/17d8 */
PVOID MergedPrefLanguages; /* fc0/17e0 */
ULONG MuiImpersonation; /* fc4/17e8 */
USHORT CrossTebFlags; /* fc8/17ec */
USHORT SameTebFlags; /* fca/17ee */
PVOID TxnScopeEnterCallback; /* fcc/17f0 */
PVOID TxnScopeExitCallback; /* fd0/17f8 */
PVOID TxnScopeContext; /* fd4/1800 */
ULONG LockCount; /* fd8/1808 */
LONG WowTebOffset; /* fdc/180c */
PVOID ResourceRetValue; /* fe0/1810 */
PVOID ReservedForWdf; /* fe4/1818 */
ULONGLONG ReservedForCrt; /* fe8/1820 */
GUID EffectiveContainerId; /* ff0/1828 */
} TEB, *PTEB;
static_assert(offsetof(TEB, DeallocationStack) ==
0x1478); /* The only member we care about at the moment */
typedef enum _QUEUE_USER_APC_FLAGS {
QueueUserApcFlagsNone,
QueueUserApcFlagsSpecialUserApc,
QueueUserApcFlagsMaxValue
} QUEUE_USER_APC_FLAGS;
typedef union _USER_APC_OPTION {
ULONG_PTR UserApcFlags;
HANDLE MemoryReserveHandle;
} USER_APC_OPTION, *PUSER_APC_OPTION;
using PPS_APC_ROUTINE = void (*)(PVOID ApcArgument1, PVOID ApcArgument2, PVOID ApcArgument3,
PCONTEXT Context);
typedef u64(__stdcall* NtClose_t)(HANDLE Handle);
typedef u64(__stdcall* NtSetInformationFile_t)(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock,
PVOID FileInformation, ULONG Length, PVOID FileInformation, ULONG Length,
FILE_INFORMATION_CLASS FileInformationClass); FILE_INFORMATION_CLASS FileInformationClass);
extern NtDelayExecution_t NtDelayExecution; typedef u64(__stdcall* NtCreateThread_t)(PHANDLE ThreadHandle, ACCESS_MASK DesiredAccess,
PCOBJECT_ATTRIBUTES ObjectAttributes, HANDLE ProcessHandle,
PCLIENT_ID ClientId, PCONTEXT ThreadContext,
PINITIAL_TEB InitialTeb, BOOLEAN CreateSuspended);
typedef u64(__stdcall* NtTerminateThread_t)(HANDLE ThreadHandle, u64 ExitStatus);
typedef u64(__stdcall* NtQueueApcThreadEx_t)(HANDLE ThreadHandle,
USER_APC_OPTION UserApcReserveHandle,
PPS_APC_ROUTINE ApcRoutine, PVOID ApcArgument1,
PVOID ApcArgument2, PVOID ApcArgument3);
extern NtClose_t NtClose;
extern NtSetInformationFile_t NtSetInformationFile; extern NtSetInformationFile_t NtSetInformationFile;
extern NtCreateThread_t NtCreateThread;
extern NtTerminateThread_t NtTerminateThread;
extern NtQueueApcThreadEx_t NtQueueApcThreadEx;
namespace Common::NtApi { namespace Common::NtApi {
void Initialize(); void Initialize();

View File

@@ -6,14 +6,18 @@
#define GIT_REV "@GIT_REV@" #define GIT_REV "@GIT_REV@"
#define GIT_BRANCH "@GIT_BRANCH@" #define GIT_BRANCH "@GIT_BRANCH@"
#define GIT_DESC "@GIT_DESC@" #define GIT_DESC "@GIT_DESC@"
#define GIT_REMOTE_NAME "@GIT_REMOTE_NAME@"
#define GIT_REMOTE_URL "@GIT_REMOTE_URL@"
#define BUILD_DATE "@BUILD_DATE@" #define BUILD_DATE "@BUILD_DATE@"
namespace Common { namespace Common {
const char g_scm_rev[] = GIT_REV; const char g_scm_rev[] = GIT_REV;
const char g_scm_branch[] = GIT_BRANCH; const char g_scm_branch[] = GIT_BRANCH;
const char g_scm_desc[] = GIT_DESC; const char g_scm_desc[] = GIT_DESC;
const char g_scm_date[] = BUILD_DATE; const char g_scm_remote_name[] = GIT_REMOTE_NAME;
const char g_scm_remote_url[] = GIT_REMOTE_URL;
const char g_scm_date[] = BUILD_DATE;
} // namespace } // namespace

View File

@@ -8,6 +8,8 @@ namespace Common {
extern const char g_scm_rev[]; extern const char g_scm_rev[];
extern const char g_scm_branch[]; extern const char g_scm_branch[];
extern const char g_scm_desc[]; extern const char g_scm_desc[];
extern const char g_scm_remote_name[];
extern const char g_scm_remote_url[];
extern const char g_scm_date[]; extern const char g_scm_date[];
} // namespace Common } // namespace Common

163
src/common/slab_heap.h Normal file
View File

@@ -0,0 +1,163 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <atomic>
#include "common/assert.h"
#include "common/spin_lock.h"
namespace Common {
class SlabHeapImpl {
public:
struct Node {
Node* next{};
};
public:
constexpr SlabHeapImpl() = default;
void Initialize() {
ASSERT(m_head == nullptr);
}
Node* GetHead() const {
return m_head;
}
void* Allocate() {
m_lock.lock();
Node* ret = m_head;
if (ret != nullptr) {
m_head = ret->next;
}
m_lock.unlock();
return ret;
}
void Free(void* obj) {
m_lock.lock();
Node* node = static_cast<Node*>(obj);
node->next = m_head;
m_head = node;
m_lock.unlock();
}
private:
std::atomic<Node*> m_head{};
Common::SpinLock m_lock;
};
class SlabHeapBase : protected SlabHeapImpl {
private:
size_t m_obj_size{};
uintptr_t m_peak{};
uintptr_t m_start{};
uintptr_t m_end{};
public:
constexpr SlabHeapBase() = default;
bool Contains(uintptr_t address) const {
return m_start <= address && address < m_end;
}
void Initialize(size_t obj_size, void* memory, size_t memory_size) {
// Ensure we don't initialize a slab using null memory.
ASSERT(memory != nullptr);
// Set our object size.
m_obj_size = obj_size;
// Initialize the base allocator.
SlabHeapImpl::Initialize();
// Set our tracking variables.
const size_t num_obj = (memory_size / obj_size);
m_start = reinterpret_cast<uintptr_t>(memory);
m_end = m_start + num_obj * obj_size;
m_peak = m_start;
// Free the objects.
u8* cur = reinterpret_cast<u8*>(m_end);
for (size_t i = 0; i < num_obj; i++) {
cur -= obj_size;
SlabHeapImpl::Free(cur);
}
}
size_t GetSlabHeapSize() const {
return (m_end - m_start) / this->GetObjectSize();
}
size_t GetObjectSize() const {
return m_obj_size;
}
void* Allocate() {
void* obj = SlabHeapImpl::Allocate();
return obj;
}
void Free(void* obj) {
// Don't allow freeing an object that wasn't allocated from this heap.
const bool contained = this->Contains(reinterpret_cast<uintptr_t>(obj));
ASSERT(contained);
SlabHeapImpl::Free(obj);
}
size_t GetObjectIndex(const void* obj) const {
return (reinterpret_cast<uintptr_t>(obj) - m_start) / this->GetObjectSize();
}
size_t GetPeakIndex() const {
return this->GetObjectIndex(reinterpret_cast<const void*>(m_peak));
}
uintptr_t GetSlabHeapAddress() const {
return m_start;
}
size_t GetNumRemaining() const {
// Only calculate the number of remaining objects under debug configuration.
return 0;
}
};
template <typename T>
class SlabHeap final : public SlabHeapBase {
private:
using BaseHeap = SlabHeapBase;
public:
constexpr SlabHeap() = default;
void Initialize(void* memory, size_t memory_size) {
BaseHeap::Initialize(sizeof(T), memory, memory_size);
}
T* Allocate() {
T* obj = static_cast<T*>(BaseHeap::Allocate());
if (obj != nullptr) [[likely]] {
std::construct_at(obj);
}
return obj;
}
void Free(T* obj) {
BaseHeap::Free(obj);
}
size_t GetObjectIndex(const T* obj) const {
return BaseHeap::GetObjectIndex(obj);
}
};
} // namespace Common

63
src/common/slot_array.h Normal file
View File

@@ -0,0 +1,63 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
// #include <boost/icl/interval_set.hpp>
#include <limits>
#include <optional>
#include <shared_mutex>
#include <unordered_map>
#include <memory>
#include <numeric>
namespace Common {
template <class IndexType, class ResourceType,
IndexType MaxIndex = std::numeric_limits<IndexType>::max(), IndexType MinIndex = 0>
class SlotArray {
public:
SlotArray() {
std::iota(m_free_indices.begin(), m_free_indices.end(), MinIndex);
}
template <class... Types>
std::optional<IndexType> Create(Types&&... args) {
if (!HasFreeSlots()) {
return std::nullopt;
}
const auto index = m_free_indices[m_curr_cursor];
m_resources[index - MinIndex] = ResourceType(std::forward<Types>(args)...);
m_curr_cursor += 1;
return index;
}
bool Destroy(IndexType index) {
if (!m_resources[index - MinIndex].has_value()) {
return false;
}
m_curr_cursor -= 1;
m_free_indices[m_curr_cursor] = index;
m_resources[index - MinIndex] = std::nullopt;
return true;
}
ResourceType* Get(IndexType index) {
auto& resource = m_resources[index - MinIndex];
if (!resource.has_value()) {
return nullptr;
}
return &resource.value();
}
bool HasFreeSlots() {
return m_curr_cursor < m_free_indices.size();
}
private:
size_t m_curr_cursor = 0;
std::array<IndexType, MaxIndex - MinIndex> m_free_indices;
std::array<std::optional<ResourceType>, MaxIndex - MinIndex> m_resources;
};
} // namespace Common

View File

@@ -3,10 +3,7 @@
#pragma once #pragma once
#include <bit>
#include <compare>
#include <numeric> #include <numeric>
#include <type_traits>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "common/assert.h" #include "common/assert.h"

53
src/common/spin_lock.cpp Executable file
View File

@@ -0,0 +1,53 @@
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/spin_lock.h"
#if _MSC_VER
#include <intrin.h>
#if _M_AMD64
#define __x86_64__ 1
#endif
#if _M_ARM64
#define __aarch64__ 1
#endif
#else
#if __x86_64__
#include <xmmintrin.h>
#endif
#endif
namespace {
void ThreadPause() {
#if __x86_64__
_mm_pause();
#elif __aarch64__ && _MSC_VER
__yield();
#elif __aarch64__
asm("yield");
#endif
}
} // Anonymous namespace
namespace Common {
void SpinLock::lock() {
while (lck.test_and_set(std::memory_order_acquire)) {
ThreadPause();
}
}
void SpinLock::unlock() {
lck.clear(std::memory_order_release);
}
bool SpinLock::try_lock() {
if (lck.test_and_set(std::memory_order_acquire)) {
return false;
}
return true;
}
} // namespace Common

33
src/common/spin_lock.h Executable file
View File

@@ -0,0 +1,33 @@
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <atomic>
namespace Common {
/**
* SpinLock class
* a lock similar to mutex that forces a thread to spin wait instead calling the
* supervisor. Should be used on short sequences of code.
*/
class SpinLock {
public:
SpinLock() = default;
SpinLock(const SpinLock&) = delete;
SpinLock& operator=(const SpinLock&) = delete;
SpinLock(SpinLock&&) = delete;
SpinLock& operator=(SpinLock&&) = delete;
void lock();
void unlock();
[[nodiscard]] bool try_lock();
private:
std::atomic_flag lck = ATOMIC_FLAG_INIT;
};
} // namespace Common

7
src/common/stb.cpp Normal file
View File

@@ -0,0 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#define STB_IMAGE_IMPLEMENTATION
#define STBI_ONLY_PNG
#define STBI_NO_STDIO
#include "common/stb.h"

6
src/common/stb.h Normal file
View File

@@ -0,0 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <stb_image.h>

View File

@@ -37,6 +37,10 @@ std::vector<std::string> SplitString(const std::string& str, char delimiter) {
return output; return output;
} }
std::string_view U8stringToString(std::u8string_view u8str) {
return std::string_view{reinterpret_cast<const char*>(u8str.data()), u8str.size()};
}
#ifdef _WIN32 #ifdef _WIN32
static std::wstring CPToUTF16(u32 code_page, std::string_view input) { static std::wstring CPToUTF16(u32 code_page, std::string_view input) {
const auto size = const auto size =

View File

@@ -16,6 +16,8 @@ void ToLowerInPlace(std::string& str);
std::vector<std::string> SplitString(const std::string& str, char delimiter); std::vector<std::string> SplitString(const std::string& str, char delimiter);
std::string_view U8stringToString(std::u8string_view u8str);
#ifdef _WIN32 #ifdef _WIN32
[[nodiscard]] std::string UTF16ToUTF8(std::wstring_view input); [[nodiscard]] std::string UTF16ToUTF8(std::wstring_view input);
[[nodiscard]] std::wstring UTF8ToUTF16W(std::string_view str); [[nodiscard]] std::wstring UTF8ToUTF16W(std::string_view str);

View File

@@ -0,0 +1,17 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
// support header file for libav
// The av_err2str macro in libavutil/error.h does not play nice with C++
#ifdef av_err2str
#undef av_err2str
#include <string>
av_always_inline std::string av_err2string(int errnum) {
char errbuf[AV_ERROR_MAX_STRING_SIZE];
return av_make_error_string(errbuf, AV_ERROR_MAX_STRING_SIZE, errnum);
}
#define av_err2str(err) av_err2string(err).c_str()
#endif // av_err2str

View File

@@ -147,6 +147,10 @@ void SetCurrentThreadName(const char* name) {
SetThreadDescription(GetCurrentThread(), UTF8ToUTF16W(name).data()); SetThreadDescription(GetCurrentThread(), UTF8ToUTF16W(name).data());
} }
void SetThreadName(void* thread, const char* name) {
SetThreadDescription(thread, UTF8ToUTF16W(name).data());
}
#else // !MSVC_VER, so must be POSIX threads #else // !MSVC_VER, so must be POSIX threads
// MinGW with the POSIX threading model does not support pthread_setname_np // MinGW with the POSIX threading model does not support pthread_setname_np
@@ -170,11 +174,19 @@ void SetCurrentThreadName(const char* name) {
pthread_setname_np(pthread_self(), name); pthread_setname_np(pthread_self(), name);
#endif #endif
} }
void SetThreadName(void* thread, const char* name) {
// TODO
}
#endif #endif
#if defined(_WIN32) #if defined(_WIN32)
void SetCurrentThreadName(const char*) { void SetCurrentThreadName(const char*) {
// Do Nothing on MingW // Do Nothing on MinGW
}
void SetThreadName(void* thread, const char* name) {
// Do Nothing on MinGW
} }
#endif #endif

View File

@@ -23,6 +23,8 @@ void SetCurrentThreadPriority(ThreadPriority new_priority);
void SetCurrentThreadName(const char* name); void SetCurrentThreadName(const char* name);
void SetThreadName(void* thread, const char* name);
class AccurateTimer { class AccurateTimer {
std::chrono::nanoseconds target_interval{}; std::chrono::nanoseconds target_interval{};
std::chrono::nanoseconds total_wait{}; std::chrono::nanoseconds total_wait{};
@@ -35,6 +37,10 @@ public:
void Start(); void Start();
void End(); void End();
std::chrono::nanoseconds GetTotalWait() const {
return total_wait;
}
}; };
} // namespace Common } // namespace Common

111
src/common/va_ctx.h Normal file
View File

@@ -0,0 +1,111 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <xmmintrin.h>
#include "common/types.h"
#define VA_ARGS \
uint64_t rdi, uint64_t rsi, uint64_t rdx, uint64_t rcx, uint64_t r8, uint64_t r9, \
uint64_t overflow_arg_area, __m128 xmm0, __m128 xmm1, __m128 xmm2, __m128 xmm3, \
__m128 xmm4, __m128 xmm5, __m128 xmm6, __m128 xmm7, ...
#define VA_CTX(ctx) \
alignas(16)::Common::VaCtx ctx{}; \
(ctx).reg_save_area.gp[0] = rdi; \
(ctx).reg_save_area.gp[1] = rsi; \
(ctx).reg_save_area.gp[2] = rdx; \
(ctx).reg_save_area.gp[3] = rcx; \
(ctx).reg_save_area.gp[4] = r8; \
(ctx).reg_save_area.gp[5] = r9; \
(ctx).reg_save_area.fp[0] = xmm0; \
(ctx).reg_save_area.fp[1] = xmm1; \
(ctx).reg_save_area.fp[2] = xmm2; \
(ctx).reg_save_area.fp[3] = xmm3; \
(ctx).reg_save_area.fp[4] = xmm4; \
(ctx).reg_save_area.fp[5] = xmm5; \
(ctx).reg_save_area.fp[6] = xmm6; \
(ctx).reg_save_area.fp[7] = xmm7; \
(ctx).va_list.reg_save_area = &(ctx).reg_save_area; \
(ctx).va_list.gp_offset = offsetof(::Common::VaRegSave, gp); \
(ctx).va_list.fp_offset = offsetof(::Common::VaRegSave, fp); \
(ctx).va_list.overflow_arg_area = &overflow_arg_area;
namespace Common {
// https://stackoverflow.com/questions/4958384/what-is-the-format-of-the-x86-64-va-list-structure
struct VaList {
u32 gp_offset;
u32 fp_offset;
void* overflow_arg_area;
void* reg_save_area;
};
struct VaRegSave {
u64 gp[6];
__m128 fp[8];
};
struct VaCtx {
VaRegSave reg_save_area;
VaList va_list;
};
template <class T, uint32_t Size>
T vaArgRegSaveAreaGp(VaList* l) {
auto* addr = reinterpret_cast<T*>(static_cast<u8*>(l->reg_save_area) + l->gp_offset);
l->gp_offset += Size;
return *addr;
}
template <class T, u64 Align, u64 Size>
T vaArgOverflowArgArea(VaList* l) {
auto ptr = ((reinterpret_cast<u64>(l->overflow_arg_area) + (Align - 1)) & ~(Align - 1));
auto* addr = reinterpret_cast<T*>(ptr);
l->overflow_arg_area = reinterpret_cast<void*>(ptr + Size);
return *addr;
}
template <class T, uint32_t Size>
T vaArgRegSaveAreaFp(VaList* l) {
auto* addr = reinterpret_cast<T*>(static_cast<u8*>(l->reg_save_area) + l->fp_offset);
l->fp_offset += Size;
return *addr;
}
inline int vaArgInteger(VaList* l) {
if (l->gp_offset <= 40) {
return vaArgRegSaveAreaGp<int, 8>(l);
}
return vaArgOverflowArgArea<int, 1, 8>(l);
}
inline long long vaArgLongLong(VaList* l) {
if (l->gp_offset <= 40) {
return vaArgRegSaveAreaGp<long long, 8>(l);
}
return vaArgOverflowArgArea<long long, 1, 8>(l);
}
inline long vaArgLong(VaList* l) {
if (l->gp_offset <= 40) {
return vaArgRegSaveAreaGp<long, 8>(l);
}
return vaArgOverflowArgArea<long, 1, 8>(l);
}
inline double vaArgDouble(VaList* l) {
if (l->fp_offset <= 160) {
return vaArgRegSaveAreaFp<double, 16>(l);
}
return vaArgOverflowArgArea<double, 1, 8>(l);
}
template <class T>
T* vaArgPtr(VaList* l) {
if (l->gp_offset <= 40) {
return vaArgRegSaveAreaGp<T*, 8>(l);
}
return vaArgOverflowArgArea<T*, 1, 8>(l);
}
} // namespace Common

View File

@@ -8,7 +8,7 @@
namespace Common { namespace Common {
constexpr char VERSION[] = "0.4.0"; constexpr char VERSION[] = "0.6.0";
constexpr bool isRelease = true; constexpr bool isRelease = true;
} // namespace Common } // namespace Common

View File

@@ -1,13 +1,14 @@
// 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 <map>
#include <boost/icl/separate_interval_set.hpp> #include <boost/icl/separate_interval_set.hpp>
#include "common/alignment.h" #include "common/alignment.h"
#include "common/arch.h" #include "common/arch.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/error.h" #include "common/error.h"
#include "core/address_space.h" #include "core/address_space.h"
#include "core/libraries/kernel/memory_management.h" #include "core/libraries/kernel/memory.h"
#include "core/memory.h" #include "core/memory.h"
#include "libraries/error_codes.h" #include "libraries/error_codes.h"
@@ -25,7 +26,7 @@ asm(".zerofill GUEST_SYSTEM,GUEST_SYSTEM,__guest_system,0xFBFC00000");
namespace Core { namespace Core {
static constexpr size_t BackingSize = SCE_KERNEL_MAIN_DMEM_SIZE_PRO; static constexpr size_t BackingSize = SCE_KERNEL_TOTAL_MEM_PRO;
#ifdef _WIN32 #ifdef _WIN32
@@ -40,6 +41,12 @@ static constexpr size_t BackingSize = SCE_KERNEL_MAIN_DMEM_SIZE_PRO;
} }
} }
struct MemoryRegion {
VAddr base;
size_t size;
bool is_mapped;
};
struct AddressSpace::Impl { struct AddressSpace::Impl {
Impl() : process{GetCurrentProcess()} { Impl() : process{GetCurrentProcess()} {
// Allocate virtual address placeholder for our address space. // Allocate virtual address placeholder for our address space.
@@ -60,27 +67,25 @@ struct AddressSpace::Impl {
static constexpr size_t ReductionOnFail = 1_GB; static constexpr size_t ReductionOnFail = 1_GB;
static constexpr size_t MaxReductions = 10; static constexpr size_t MaxReductions = 10;
size_t reduction = 0;
size_t virtual_size = SystemManagedSize + SystemReservedSize + UserSize; size_t virtual_size = SystemManagedSize + SystemReservedSize + UserSize;
for (u32 i = 0; i < MaxReductions; i++) { for (u32 i = 0; i < MaxReductions; i++) {
virtual_base = static_cast<u8*>(VirtualAlloc2(process, NULL, virtual_size - reduction, virtual_base = static_cast<u8*>(VirtualAlloc2(process, NULL, virtual_size,
MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER,
PAGE_NOACCESS, &param, 1)); PAGE_NOACCESS, &param, 1));
if (virtual_base) { if (virtual_base) {
break; break;
} }
reduction += ReductionOnFail; virtual_size -= ReductionOnFail;
} }
ASSERT_MSG(virtual_base, "Unable to reserve virtual address space: {}", ASSERT_MSG(virtual_base, "Unable to reserve virtual address space: {}",
Common::GetLastErrorMsg()); Common::GetLastErrorMsg());
// Take the reduction off of the system managed area, and leave the others unchanged.
system_managed_base = virtual_base;
system_managed_size = SystemManagedSize - reduction;
system_reserved_base = reinterpret_cast<u8*>(SYSTEM_RESERVED_MIN); system_reserved_base = reinterpret_cast<u8*>(SYSTEM_RESERVED_MIN);
system_reserved_size = SystemReservedSize; system_reserved_size = SystemReservedSize;
system_managed_base = virtual_base;
system_managed_size = system_reserved_base - virtual_base;
user_base = reinterpret_cast<u8*>(USER_MIN); user_base = reinterpret_cast<u8*>(USER_MIN);
user_size = UserSize; user_size = virtual_base + virtual_size - user_base;
LOG_INFO(Kernel_Vmm, "System managed virtual memory region: {} - {}", LOG_INFO(Kernel_Vmm, "System managed virtual memory region: {} - {}",
fmt::ptr(system_managed_base), fmt::ptr(system_managed_base),
@@ -93,9 +98,8 @@ struct AddressSpace::Impl {
// Initializer placeholder tracker // Initializer placeholder tracker
const uintptr_t system_managed_addr = reinterpret_cast<uintptr_t>(system_managed_base); const uintptr_t system_managed_addr = reinterpret_cast<uintptr_t>(system_managed_base);
const uintptr_t system_reserved_addr = reinterpret_cast<uintptr_t>(system_reserved_base); regions.emplace(system_managed_addr,
const uintptr_t user_addr = reinterpret_cast<uintptr_t>(user_base); MemoryRegion{system_managed_addr, virtual_size, false});
placeholders.insert({system_managed_addr, virtual_size - reduction});
// Allocate backing file that represents the total physical memory. // Allocate backing file that represents the total physical memory.
backing_handle = backing_handle =
@@ -132,42 +136,15 @@ struct AddressSpace::Impl {
} }
void* Map(VAddr virtual_addr, PAddr phys_addr, size_t size, ULONG prot, uintptr_t fd = 0) { void* Map(VAddr virtual_addr, PAddr phys_addr, size_t size, ULONG prot, uintptr_t fd = 0) {
const size_t aligned_size = Common::AlignUp(size, 16_KB); // Before mapping we must carve a placeholder with the exact properties of our mapping.
const auto it = placeholders.find(virtual_addr); auto* region = EnsureSplitRegionForMapping(virtual_addr, size);
ASSERT_MSG(it != placeholders.end(), "Cannot map already mapped region"); region->is_mapped = true;
ASSERT_MSG(virtual_addr >= it->lower() && virtual_addr + aligned_size <= it->upper(),
"Map range must be fully contained in a placeholder");
// Windows only allows splitting a placeholder into two.
// This means that if the map range is fully
// contained the the placeholder we need to perform two split operations,
// one at the start and at the end.
const VAddr placeholder_start = it->lower();
const VAddr placeholder_end = it->upper();
const VAddr virtual_end = virtual_addr + aligned_size;
// If the placeholder doesn't exactly start at virtual_addr, split it at the start.
if (placeholder_start != virtual_addr) {
VirtualFreeEx(process, reinterpret_cast<LPVOID>(placeholder_start),
virtual_addr - placeholder_start, MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER);
}
// If the placeholder doesn't exactly end at virtual_end, split it at the end.
if (placeholder_end != virtual_end) {
VirtualFreeEx(process, reinterpret_cast<LPVOID>(virtual_end),
placeholder_end - virtual_end, MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER);
}
// Remove the placeholder.
placeholders.erase({virtual_addr, virtual_end});
// Perform the map.
void* ptr = nullptr; void* ptr = nullptr;
if (phys_addr != -1) { if (phys_addr != -1) {
HANDLE backing = fd ? reinterpret_cast<HANDLE>(fd) : backing_handle; HANDLE backing = fd ? reinterpret_cast<HANDLE>(fd) : backing_handle;
if (fd && prot == PAGE_READONLY) { if (fd && prot == PAGE_READONLY) {
DWORD resultvar; DWORD resultvar;
ptr = VirtualAlloc2(process, reinterpret_cast<PVOID>(virtual_addr), aligned_size, ptr = VirtualAlloc2(process, reinterpret_cast<PVOID>(virtual_addr), size,
MEM_RESERVE | MEM_COMMIT | MEM_REPLACE_PLACEHOLDER, MEM_RESERVE | MEM_COMMIT | MEM_REPLACE_PLACEHOLDER,
PAGE_READWRITE, nullptr, 0); PAGE_READWRITE, nullptr, 0);
bool ret = ReadFile(backing, ptr, size, &resultvar, NULL); bool ret = ReadFile(backing, ptr, size, &resultvar, NULL);
@@ -176,12 +153,11 @@ struct AddressSpace::Impl {
ASSERT_MSG(ret, "VirtualProtect failed. {}", Common::GetLastErrorMsg()); ASSERT_MSG(ret, "VirtualProtect failed. {}", Common::GetLastErrorMsg());
} else { } else {
ptr = MapViewOfFile3(backing, process, reinterpret_cast<PVOID>(virtual_addr), ptr = MapViewOfFile3(backing, process, reinterpret_cast<PVOID>(virtual_addr),
phys_addr, aligned_size, MEM_REPLACE_PLACEHOLDER, prot, phys_addr, size, MEM_REPLACE_PLACEHOLDER, prot, nullptr, 0);
nullptr, 0);
} }
} else { } else {
ptr = ptr =
VirtualAlloc2(process, reinterpret_cast<PVOID>(virtual_addr), aligned_size, VirtualAlloc2(process, reinterpret_cast<PVOID>(virtual_addr), size,
MEM_RESERVE | MEM_COMMIT | MEM_REPLACE_PLACEHOLDER, prot, nullptr, 0); MEM_RESERVE | MEM_COMMIT | MEM_REPLACE_PLACEHOLDER, prot, nullptr, 0);
} }
ASSERT_MSG(ptr, "{}", Common::GetLastErrorMsg()); ASSERT_MSG(ptr, "{}", Common::GetLastErrorMsg());
@@ -202,33 +178,118 @@ struct AddressSpace::Impl {
// The unmap call will create a new placeholder region. We need to see if we can coalesce it // The unmap call will create a new placeholder region. We need to see if we can coalesce it
// with neighbors. // with neighbors.
VAddr placeholder_start = virtual_addr; JoinRegionsAfterUnmap(virtual_addr, size);
VAddr placeholder_end = virtual_addr + size; }
// The following code is inspired from Dolphin's MemArena
// https://github.com/dolphin-emu/dolphin/blob/deee3ee4/Source/Core/Common/MemArenaWin.cpp#L212
MemoryRegion* EnsureSplitRegionForMapping(VAddr address, size_t size) {
// Find closest region that is <= the given address by using upper bound and decrementing
auto it = regions.upper_bound(address);
ASSERT_MSG(it != regions.begin(), "Invalid address {:#x}", address);
--it;
ASSERT_MSG(!it->second.is_mapped,
"Attempt to map {:#x} with size {:#x} which overlaps with {:#x} mapping",
address, size, it->second.base);
auto& [base, region] = *it;
const VAddr mapping_address = region.base;
const size_t region_size = region.size;
if (mapping_address == address) {
// If this region is already split up correctly we don't have to do anything
if (region_size == size) {
return &region;
}
ASSERT_MSG(region_size >= size,
"Region with address {:#x} and size {:#x} can't fit {:#x}", mapping_address,
region_size, size);
// Split the placeholder.
if (!VirtualFreeEx(process, LPVOID(address), size,
MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER)) {
UNREACHABLE_MSG("Region splitting failed: {}", Common::GetLastErrorMsg());
return nullptr;
}
// Update tracked mappings and return the first of the two
region.size = size;
const VAddr new_mapping_start = address + size;
regions.emplace_hint(std::next(it), new_mapping_start,
MemoryRegion(new_mapping_start, region_size - size, false));
return &region;
}
ASSERT(mapping_address < address);
// Is there enough space to map this?
const size_t offset_in_region = address - mapping_address;
const size_t minimum_size = size + offset_in_region;
ASSERT(region_size >= minimum_size);
// Split the placeholder.
if (!VirtualFreeEx(process, LPVOID(address), size,
MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER)) {
UNREACHABLE_MSG("Region splitting failed: {}", Common::GetLastErrorMsg());
return nullptr;
}
// Do we now have two regions or three regions?
if (region_size == minimum_size) {
// Split into two; update tracked mappings and return the second one
region.size = offset_in_region;
it = regions.emplace_hint(std::next(it), address, MemoryRegion(address, size, false));
return &it->second;
} else {
// Split into three; update tracked mappings and return the middle one
region.size = offset_in_region;
const VAddr middle_mapping_start = address;
const size_t middle_mapping_size = size;
const VAddr after_mapping_start = address + size;
const size_t after_mapping_size = region_size - minimum_size;
it = regions.emplace_hint(std::next(it), after_mapping_start,
MemoryRegion(after_mapping_start, after_mapping_size, false));
it = regions.emplace_hint(
it, middle_mapping_start,
MemoryRegion(middle_mapping_start, middle_mapping_size, false));
return &it->second;
}
}
void JoinRegionsAfterUnmap(VAddr address, size_t size) {
// There should be a mapping that matches the request exactly, find it
auto it = regions.find(address);
ASSERT_MSG(it != regions.end() && it->second.size == size,
"Invalid address/size given to unmap.");
auto& [base, region] = *it;
region.is_mapped = false;
// Check if a placeholder exists right before us. // Check if a placeholder exists right before us.
const auto left_it = placeholders.find(virtual_addr - 1); auto it_prev = it != regions.begin() ? std::prev(it) : regions.end();
if (left_it != placeholders.end()) { if (it_prev != regions.end() && !it_prev->second.is_mapped) {
ASSERT_MSG(left_it->upper() == virtual_addr, const size_t total_size = it_prev->second.size + size;
"Left placeholder does not end at virtual_addr!"); if (!VirtualFreeEx(process, LPVOID(it_prev->first), total_size,
placeholder_start = left_it->lower(); MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS)) {
VirtualFreeEx(process, reinterpret_cast<LPVOID>(placeholder_start), UNREACHABLE_MSG("Region coalescing failed: {}", Common::GetLastErrorMsg());
placeholder_end - placeholder_start, }
MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS);
it_prev->second.size = total_size;
regions.erase(it);
it = it_prev;
} }
// Check if a placeholder exists right after us. // Check if a placeholder exists right after us.
const auto right_it = placeholders.find(placeholder_end + 1); auto it_next = std::next(it);
if (right_it != placeholders.end()) { if (it_next != regions.end() && !it_next->second.is_mapped) {
ASSERT_MSG(right_it->lower() == placeholder_end, const size_t total_size = it->second.size + it_next->second.size;
"Right placeholder does not start at virtual_end!"); if (!VirtualFreeEx(process, LPVOID(it->first), total_size,
placeholder_end = right_it->upper(); MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS)) {
VirtualFreeEx(process, reinterpret_cast<LPVOID>(placeholder_start), UNREACHABLE_MSG("Region coalescing failed: {}", Common::GetLastErrorMsg());
placeholder_end - placeholder_start, }
MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS);
}
// Insert the new placeholder. it->second.size = total_size;
placeholders.insert({placeholder_start, placeholder_end}); regions.erase(it_next);
}
} }
void Protect(VAddr virtual_addr, size_t size, bool read, bool write, bool execute) { void Protect(VAddr virtual_addr, size_t size, bool read, bool write, bool execute) {
@@ -251,18 +312,22 @@ struct AddressSpace::Impl {
return; return;
} }
DWORD old_flags{}; const VAddr virtual_end = virtual_addr + size;
bool success = auto it = --regions.upper_bound(virtual_addr);
VirtualProtect(reinterpret_cast<void*>(virtual_addr), size, new_flags, &old_flags); for (; it->first < virtual_end; it++) {
if (!it->second.is_mapped) {
if (!success) { continue;
LOG_ERROR(Common_Memory, }
"Failed to change virtual memory protection for address {:#x}, size {}", const auto& region = it->second;
virtual_addr, size); const size_t range_addr = std::max(region.base, virtual_addr);
const size_t range_size = std::min(region.base + region.size, virtual_end) - range_addr;
DWORD old_flags{};
if (!VirtualProtectEx(process, LPVOID(range_addr), range_size, new_flags, &old_flags)) {
UNREACHABLE_MSG(
"Failed to change virtual memory protection for address {:#x}, size {}",
range_addr, range_size);
}
} }
// Use assert to ensure success in debug builds
DEBUG_ASSERT(success && "Failed to change virtual memory protection");
} }
HANDLE process{}; HANDLE process{};
@@ -275,7 +340,7 @@ struct AddressSpace::Impl {
size_t system_reserved_size{}; size_t system_reserved_size{};
u8* user_base{}; u8* user_base{};
size_t user_size{}; size_t user_size{};
boost::icl::separate_interval_set<uintptr_t> placeholders; std::map<VAddr, MemoryRegion> regions;
}; };
#else #else

View File

@@ -30,16 +30,6 @@
using namespace Xbyak::util; using namespace Xbyak::util;
#define MAYBE_AVX(OPCODE, ...) \
[&] { \
Cpu cpu; \
if (cpu.has(Cpu::tAVX)) { \
c.v##OPCODE(__VA_ARGS__); \
} else { \
c.OPCODE(__VA_ARGS__); \
} \
}()
namespace Core { namespace Core {
static Xbyak::Reg ZydisToXbyakRegister(const ZydisRegister reg) { static Xbyak::Reg ZydisToXbyakRegister(const ZydisRegister reg) {
@@ -643,7 +633,7 @@ static void GenerateEXTRQ(const ZydisDecodedOperand* operands, Xbyak::CodeGenera
ASSERT_MSG(length + index <= 64, "length + index must be less than or equal to 64."); ASSERT_MSG(length + index <= 64, "length + index must be less than or equal to 64.");
// Get lower qword from xmm register // Get lower qword from xmm register
MAYBE_AVX(movq, scratch1, xmm_dst); c.vmovq(scratch1, xmm_dst);
if (index != 0) { if (index != 0) {
c.shr(scratch1, index); c.shr(scratch1, index);
@@ -656,7 +646,7 @@ static void GenerateEXTRQ(const ZydisDecodedOperand* operands, Xbyak::CodeGenera
// Writeback to xmm register, extrq instruction says top 64-bits are undefined so we don't // Writeback to xmm register, extrq instruction says top 64-bits are undefined so we don't
// care to preserve them // care to preserve them
MAYBE_AVX(movq, xmm_dst, scratch1); c.vmovq(xmm_dst, scratch1);
c.pop(scratch2); c.pop(scratch2);
c.pop(scratch1); c.pop(scratch1);
@@ -690,7 +680,7 @@ static void GenerateEXTRQ(const ZydisDecodedOperand* operands, Xbyak::CodeGenera
c.push(mask); c.push(mask);
// Construct the mask out of the length that resides in bottom 6 bits of source xmm // Construct the mask out of the length that resides in bottom 6 bits of source xmm
MAYBE_AVX(movq, scratch1, xmm_src); c.vmovq(scratch1, xmm_src);
c.mov(scratch2, scratch1); c.mov(scratch2, scratch1);
c.and_(scratch2, 0x3F); c.and_(scratch2, 0x3F);
c.jz(length_zero); c.jz(length_zero);
@@ -711,10 +701,10 @@ static void GenerateEXTRQ(const ZydisDecodedOperand* operands, Xbyak::CodeGenera
c.and_(scratch1, 0x3F); c.and_(scratch1, 0x3F);
c.mov(scratch2, scratch1); // cl now contains the shift amount c.mov(scratch2, scratch1); // cl now contains the shift amount
MAYBE_AVX(movq, scratch1, xmm_dst); c.vmovq(scratch1, xmm_dst);
c.shr(scratch1, cl); c.shr(scratch1, cl);
c.and_(scratch1, mask); c.and_(scratch1, mask);
MAYBE_AVX(movq, xmm_dst, scratch1); c.vmovq(xmm_dst, scratch1);
c.pop(mask); c.pop(mask);
c.pop(scratch2); c.pop(scratch2);
@@ -765,8 +755,8 @@ static void GenerateINSERTQ(const ZydisDecodedOperand* operands, Xbyak::CodeGene
ASSERT_MSG(length + index <= 64, "length + index must be less than or equal to 64."); ASSERT_MSG(length + index <= 64, "length + index must be less than or equal to 64.");
MAYBE_AVX(movq, scratch1, xmm_src); c.vmovq(scratch1, xmm_src);
MAYBE_AVX(movq, scratch2, xmm_dst); c.vmovq(scratch2, xmm_dst);
c.mov(mask, mask_value); c.mov(mask, mask_value);
// src &= mask // src &= mask
@@ -784,12 +774,7 @@ static void GenerateINSERTQ(const ZydisDecodedOperand* operands, Xbyak::CodeGene
c.or_(scratch2, scratch1); c.or_(scratch2, scratch1);
// Insert scratch2 into low 64 bits of dst, upper 64 bits are unaffected // Insert scratch2 into low 64 bits of dst, upper 64 bits are unaffected
Cpu cpu; c.vpinsrq(xmm_dst, xmm_dst, scratch2, 0);
if (cpu.has(Cpu::tAVX)) {
c.vpinsrq(xmm_dst, xmm_dst, scratch2, 0);
} else {
c.pinsrq(xmm_dst, scratch2, 0);
}
c.pop(mask); c.pop(mask);
c.pop(scratch2); c.pop(scratch2);
@@ -816,7 +801,7 @@ static void GenerateINSERTQ(const ZydisDecodedOperand* operands, Xbyak::CodeGene
c.push(mask); c.push(mask);
// Get upper 64 bits of src and copy it to mask and index // Get upper 64 bits of src and copy it to mask and index
MAYBE_AVX(pextrq, index, xmm_src, 1); c.vpextrq(index, xmm_src, 1);
c.mov(mask, index); c.mov(mask, index);
// When length is 0, set it to 64 // When length is 0, set it to 64
@@ -839,7 +824,7 @@ static void GenerateINSERTQ(const ZydisDecodedOperand* operands, Xbyak::CodeGene
c.and_(index, 0x3F); c.and_(index, 0x3F);
// src &= mask // src &= mask
MAYBE_AVX(movq, scratch1, xmm_src); c.vmovq(scratch1, xmm_src);
c.and_(scratch1, mask); c.and_(scratch1, mask);
// mask = ~(mask << index) // mask = ~(mask << index)
@@ -851,12 +836,12 @@ static void GenerateINSERTQ(const ZydisDecodedOperand* operands, Xbyak::CodeGene
c.shl(scratch1, cl); c.shl(scratch1, cl);
// dst = (dst & mask) | src // dst = (dst & mask) | src
MAYBE_AVX(movq, scratch2, xmm_dst); c.vmovq(scratch2, xmm_dst);
c.and_(scratch2, mask); c.and_(scratch2, mask);
c.or_(scratch2, scratch1); c.or_(scratch2, scratch1);
// Upper 64 bits are undefined in insertq // Upper 64 bits are undefined in insertq
MAYBE_AVX(movq, xmm_dst, scratch2); c.vmovq(xmm_dst, scratch2);
c.pop(mask); c.pop(mask);
c.pop(index); c.pop(index);

View File

@@ -3,6 +3,8 @@
#pragma once #pragma once
#include "common/types.h"
namespace Core { namespace Core {
/// Initializes a stack for the current thread for use by patch implementations. /// Initializes a stack for the current thread for use by patch implementations.

View File

@@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <array> #include <array>
#include "crypto.h" #include "crypto.h"
CryptoPP::RSA::PrivateKey Crypto::key_pkg_derived_key3_keyset_init() { CryptoPP::RSA::PrivateKey Crypto::key_pkg_derived_key3_keyset_init() {
@@ -137,20 +138,20 @@ void Crypto::aesCbcCfb128DecryptEntry(std::span<const CryptoPP::byte, 32> ivkey,
} }
} }
void Crypto::decryptEFSM(std::span<CryptoPP::byte, 16> NPcommID, void Crypto::decryptEFSM(std::span<CryptoPP::byte, 16> trophyKey,
std::span<CryptoPP::byte, 16> NPcommID,
std::span<CryptoPP::byte, 16> efsmIv, std::span<CryptoPP::byte> ciphertext, std::span<CryptoPP::byte, 16> efsmIv, std::span<CryptoPP::byte> ciphertext,
std::span<CryptoPP::byte> decrypted) { std::span<CryptoPP::byte> decrypted) {
std::vector<CryptoPP::byte> TrophyKey = {0x21, 0xF4, 0x1A, 0x6B, 0xAD, 0x8A, 0x1D, 0x3E,
0xCA, 0x7A, 0xD5, 0x86, 0xC1, 0x01, 0xB7, 0xA9};
std::vector<CryptoPP::byte> TrophyIV = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
// step 1: Encrypt NPcommID // step 1: Encrypt NPcommID
CryptoPP::CBC_Mode<CryptoPP::AES>::Encryption encrypt; CryptoPP::CBC_Mode<CryptoPP::AES>::Encryption encrypt;
encrypt.SetKeyWithIV(TrophyKey.data(), TrophyKey.size(), TrophyIV.data());
std::vector<CryptoPP::byte> trophyIv(16, 0);
std::vector<CryptoPP::byte> trpKey(16); std::vector<CryptoPP::byte> trpKey(16);
encrypt.SetKeyWithIV(trophyKey.data(), trophyKey.size(), trophyIv.data());
encrypt.ProcessData(trpKey.data(), NPcommID.data(), 16); encrypt.ProcessData(trpKey.data(), NPcommID.data(), 16);
// step 2: decrypt efsm. // step 2: decrypt efsm.
CryptoPP::CBC_Mode<CryptoPP::AES>::Decryption decrypt; CryptoPP::CBC_Mode<CryptoPP::AES>::Decryption decrypt;
decrypt.SetKeyWithIV(trpKey.data(), trpKey.size(), efsmIv.data()); decrypt.SetKeyWithIV(trpKey.data(), trpKey.size(), efsmIv.data());

View File

@@ -32,7 +32,8 @@ public:
void aesCbcCfb128DecryptEntry(std::span<const CryptoPP::byte, 32> ivkey, void aesCbcCfb128DecryptEntry(std::span<const CryptoPP::byte, 32> ivkey,
std::span<CryptoPP::byte> ciphertext, std::span<CryptoPP::byte> ciphertext,
std::span<CryptoPP::byte> decrypted); std::span<CryptoPP::byte> decrypted);
void decryptEFSM(std::span<CryptoPP::byte, 16>, std::span<CryptoPP::byte, 16> efsmIv, void decryptEFSM(std::span<CryptoPP::byte, 16> trophyKey,
std::span<CryptoPP::byte, 16> NPcommID, std::span<CryptoPP::byte, 16> efsmIv,
std::span<CryptoPP::byte> ciphertext, std::span<CryptoPP::byte> decrypted); std::span<CryptoPP::byte> ciphertext, std::span<CryptoPP::byte> decrypted);
void PfsGenCryptoKey(std::span<const CryptoPP::byte, 32> ekpfs, void PfsGenCryptoKey(std::span<const CryptoPP::byte, 32> ekpfs,
std::span<const CryptoPP::byte, 16> seed, std::span<const CryptoPP::byte, 16> seed,

View File

@@ -8,14 +8,17 @@
#include "common/singleton.h" #include "common/singleton.h"
#include "debug_state.h" #include "debug_state.h"
#include "devtools/widget/common.h" #include "devtools/widget/common.h"
#include "libraries/kernel/time_management.h" #include "libraries/kernel/time.h"
#include "libraries/system/msgdialog.h" #include "libraries/system/msgdialog.h"
#include "video_core/amdgpu/pm4_cmds.h" #include "video_core/amdgpu/pm4_cmds.h"
#include "video_core/renderer_vulkan/vk_pipeline_cache.h"
using namespace DebugStateType; using namespace DebugStateType;
DebugStateImpl& DebugState = *Common::Singleton<DebugStateImpl>::Instance(); DebugStateImpl& DebugState = *Common::Singleton<DebugStateImpl>::Instance();
bool DebugStateType::showing_debug_menu_bar = false;
static ThreadID ThisThreadID() { static ThreadID ThisThreadID() {
#ifdef _WIN32 #ifdef _WIN32
return GetCurrentThreadId(); return GetCurrentThreadId();
@@ -142,37 +145,73 @@ void DebugStateImpl::PushQueueDump(QueueDump dump) {
frame.queues.push_back(std::move(dump)); frame.queues.push_back(std::move(dump));
} }
void DebugStateImpl::PushRegsDump(uintptr_t base_addr, uintptr_t header_addr, std::optional<RegDump*> DebugStateImpl::GetRegDump(uintptr_t base_addr, uintptr_t header_addr) {
const AmdGpu::Liverpool::Regs& regs, bool is_compute) {
std::scoped_lock lock{frame_dump_list_mutex};
const auto it = waiting_reg_dumps.find(header_addr); const auto it = waiting_reg_dumps.find(header_addr);
if (it == waiting_reg_dumps.end()) { if (it == waiting_reg_dumps.end()) {
return; return std::nullopt;
} }
auto& frame = *it->second; auto& frame = *it->second;
waiting_reg_dumps.erase(it); waiting_reg_dumps.erase(it);
waiting_reg_dumps_dbg.erase(waiting_reg_dumps_dbg.find(header_addr)); waiting_reg_dumps_dbg.erase(waiting_reg_dumps_dbg.find(header_addr));
auto& dump = frame.regs[header_addr - base_addr]; return &frame.regs[header_addr - base_addr];
dump.regs = regs; }
if (is_compute) {
dump.is_compute = true; void DebugStateImpl::PushRegsDump(uintptr_t base_addr, uintptr_t header_addr,
const auto& cs = dump.regs.cs_program; const AmdGpu::Liverpool::Regs& regs) {
dump.cs_data = ComputerShaderDump{ std::scoped_lock lock{frame_dump_list_mutex};
.cs_program = cs,
.code = std::vector<u32>{cs.Code().begin(), cs.Code().end()}, auto dump = GetRegDump(base_addr, header_addr);
}; if (!dump) {
} else { return;
for (int i = 0; i < RegDump::MaxShaderStages; i++) { }
if (regs.stage_enable.IsStageEnabled(i)) {
auto stage = regs.ProgramForStage(i); (*dump)->regs = regs;
if (stage->address_lo != 0) {
auto code = stage->Code(); for (int i = 0; i < RegDump::MaxShaderStages; i++) {
dump.stages[i] = ShaderDump{ if ((*dump)->regs.stage_enable.IsStageEnabled(i)) {
.user_data = *stage, auto stage = (*dump)->regs.ProgramForStage(i);
.code = std::vector<u32>{code.begin(), code.end()}, if (stage->address_lo != 0) {
}; const auto& info = AmdGpu::Liverpool::SearchBinaryInfo(stage->Address<u32*>());
} auto code = stage->Code();
(*dump)->stages[i] = PipelineShaderProgramDump{
.name = Vulkan::PipelineCache::GetShaderName(Shader::StageFromIndex(i),
info.shader_hash),
.hash = info.shader_hash,
.user_data = *stage,
.code = std::vector<u32>{code.begin(), code.end()},
};
} }
} }
} }
} }
void DebugStateImpl::PushRegsDumpCompute(uintptr_t base_addr, uintptr_t header_addr,
const CsState& cs_state) {
std::scoped_lock lock{frame_dump_list_mutex};
auto dump = GetRegDump(base_addr, header_addr);
if (!dump) {
return;
}
(*dump)->is_compute = true;
auto& cs = (*dump)->regs.cs_program;
cs = cs_state;
const auto& info = AmdGpu::Liverpool::SearchBinaryInfo(cs.Address<u32*>());
(*dump)->cs_data = PipelineComputerProgramDump{
.name = Vulkan::PipelineCache::GetShaderName(Shader::Stage::Compute, info.shader_hash),
.hash = info.shader_hash,
.cs_program = cs,
.code = std::vector<u32>{cs.Code().begin(), cs.Code().end()},
};
}
void DebugStateImpl::CollectShader(const std::string& name, Shader::LogicalStage l_stage,
vk::ShaderModule module, std::span<const u32> spv,
std::span<const u32> raw_code, std::span<const u32> patch_spv,
bool is_patched) {
shader_dump_list.emplace_back(name, l_stage, module, std::vector<u32>{spv.begin(), spv.end()},
std::vector<u32>{raw_code.begin(), raw_code.end()},
std::vector<u32>{patch_spv.begin(), patch_spv.end()}, is_patched);
}

View File

@@ -11,8 +11,7 @@
#include <queue> #include <queue>
#include "common/types.h" #include "common/types.h"
#include "video_core/amdgpu/liverpool.h" #include "video_core/renderer_vulkan/vk_graphics_pipeline.h"
#include "video_core/renderer_vulkan/vk_pipeline_cache.h"
#ifdef _WIN32 #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
@@ -30,11 +29,14 @@ namespace Core::Devtools {
class Layer; class Layer;
namespace Widget { namespace Widget {
class FrameGraph; class FrameGraph;
} class ShaderList;
} // namespace Widget
} // namespace Core::Devtools } // namespace Core::Devtools
namespace DebugStateType { namespace DebugStateType {
extern bool showing_debug_menu_bar;
enum class QueueType { enum class QueueType {
dcb = 0, dcb = 0,
ccb = 1, ccb = 1,
@@ -49,12 +51,16 @@ struct QueueDump {
uintptr_t base_addr; uintptr_t base_addr;
}; };
struct ShaderDump { struct PipelineShaderProgramDump {
std::string name;
u64 hash;
Vulkan::Liverpool::ShaderProgram user_data{}; Vulkan::Liverpool::ShaderProgram user_data{};
std::vector<u32> code{}; std::vector<u32> code{};
}; };
struct ComputerShaderDump { struct PipelineComputerProgramDump {
std::string name;
u64 hash;
Vulkan::Liverpool::ComputeProgram cs_program{}; Vulkan::Liverpool::ComputeProgram cs_program{};
std::vector<u32> code{}; std::vector<u32> code{};
}; };
@@ -63,8 +69,8 @@ struct RegDump {
bool is_compute{false}; bool is_compute{false};
static constexpr size_t MaxShaderStages = 5; static constexpr size_t MaxShaderStages = 5;
Vulkan::Liverpool::Regs regs{}; Vulkan::Liverpool::Regs regs{};
std::array<ShaderDump, MaxShaderStages> stages{}; std::array<PipelineShaderProgramDump, MaxShaderStages> stages{};
ComputerShaderDump cs_data{}; PipelineComputerProgramDump cs_data{};
}; };
struct FrameDump { struct FrameDump {
@@ -73,9 +79,61 @@ struct FrameDump {
std::unordered_map<uintptr_t, RegDump> regs; // address -> reg dump std::unordered_map<uintptr_t, RegDump> regs; // address -> reg dump
}; };
struct ShaderDump {
std::string name;
Shader::LogicalStage l_stage;
vk::ShaderModule module;
std::vector<u32> spv;
std::vector<u32> isa;
std::vector<u32> patch_spv;
std::string patch_source{};
bool loaded_data = false;
bool is_patched = false;
std::string cache_spv_disasm{};
std::string cache_isa_disasm{};
std::string cache_patch_disasm{};
ShaderDump(std::string name, Shader::LogicalStage l_stage, vk::ShaderModule module,
std::vector<u32> spv, std::vector<u32> isa, std::vector<u32> patch_spv,
bool is_patched)
: name(std::move(name)), l_stage(l_stage), module(module), spv(std::move(spv)),
isa(std::move(isa)), patch_spv(std::move(patch_spv)), is_patched(is_patched) {}
ShaderDump(const ShaderDump& other) = delete;
ShaderDump(ShaderDump&& other) noexcept
: name{std::move(other.name)}, l_stage(other.l_stage), module{std::move(other.module)},
spv{std::move(other.spv)}, isa{std::move(other.isa)},
patch_spv{std::move(other.patch_spv)}, patch_source{std::move(other.patch_source)},
cache_spv_disasm{std::move(other.cache_spv_disasm)},
cache_isa_disasm{std::move(other.cache_isa_disasm)},
cache_patch_disasm{std::move(other.cache_patch_disasm)} {}
ShaderDump& operator=(const ShaderDump& other) = delete;
ShaderDump& operator=(ShaderDump&& other) noexcept {
if (this == &other)
return *this;
name = std::move(other.name);
l_stage = other.l_stage;
module = std::move(other.module);
spv = std::move(other.spv);
isa = std::move(other.isa);
patch_spv = std::move(other.patch_spv);
patch_source = std::move(other.patch_source);
cache_spv_disasm = std::move(other.cache_spv_disasm);
cache_isa_disasm = std::move(other.cache_isa_disasm);
cache_patch_disasm = std::move(other.cache_patch_disasm);
return *this;
}
};
class DebugStateImpl { class DebugStateImpl {
friend class Core::Devtools::Layer; friend class Core::Devtools::Layer;
friend class Core::Devtools::Widget::FrameGraph; friend class Core::Devtools::Widget::FrameGraph;
friend class Core::Devtools::Widget::ShaderList;
std::queue<std::string> debug_message_popup;
std::mutex guest_threads_mutex{}; std::mutex guest_threads_mutex{};
std::vector<ThreadID> guest_threads{}; std::vector<ThreadID> guest_threads{};
@@ -94,9 +152,12 @@ class DebugStateImpl {
std::shared_mutex frame_dump_list_mutex; std::shared_mutex frame_dump_list_mutex;
std::vector<FrameDump> frame_dump_list{}; std::vector<FrameDump> frame_dump_list{};
std::queue<std::string> debug_message_popup; std::vector<ShaderDump> shader_dump_list{};
public: public:
float Framerate = 1.0f / 60.0f;
float FrameDeltaTime;
void ShowDebugMessage(std::string message) { void ShowDebugMessage(std::string message) {
if (message.empty()) { if (message.empty()) {
return; return;
@@ -104,6 +165,10 @@ public:
debug_message_popup.push(std::move(message)); debug_message_popup.push(std::move(message));
} }
bool& IsShowingDebugMenuBar() {
return showing_debug_menu_bar;
}
void AddCurrentThreadToGuestList(); void AddCurrentThreadToGuestList();
void RemoveCurrentThreadFromGuestList(); void RemoveCurrentThreadFromGuestList();
@@ -151,7 +216,17 @@ public:
void PushQueueDump(QueueDump dump); void PushQueueDump(QueueDump dump);
void PushRegsDump(uintptr_t base_addr, uintptr_t header_addr, void PushRegsDump(uintptr_t base_addr, uintptr_t header_addr,
const AmdGpu::Liverpool::Regs& regs, bool is_compute = false); const AmdGpu::Liverpool::Regs& regs);
using CsState = AmdGpu::Liverpool::ComputeProgram;
void PushRegsDumpCompute(uintptr_t base_addr, uintptr_t header_addr, const CsState& cs_state);
void CollectShader(const std::string& name, Shader::LogicalStage l_stage,
vk::ShaderModule module, std::span<const u32> spv,
std::span<const u32> raw_code, std::span<const u32> patch_spv,
bool is_patched);
private:
std::optional<RegDump*> GetRegDump(uintptr_t base_addr, uintptr_t header_addr);
}; };
} // namespace DebugStateType } // namespace DebugStateType

View File

@@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "base_device.h"
namespace Core::Devices {
BaseDevice::BaseDevice() = default;
BaseDevice::~BaseDevice() = default;
} // namespace Core::Devices

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