Commit Graph

3554 Commits

Author SHA1 Message Date
georgemoralis
f06e126330 tagged v0.12.0 v.0.12.0 2025-10-31 09:01:12 +02:00
Stephen Miller
715eb512c9 Core: Read-only file mmap fix (#3757)
* Extra validity checks for file mmaps

* Add comment
2025-10-30 15:47:08 -07:00
jzwmvqttmd-svg
87e09b613b Fixes scePlayGoDialog status stub (#3750)
* Fixes scePlayGoDialog status stub

* input: Fix analog stick stuttering caused by excessive state buffering
2025-10-26 05:40:00 +02:00
Randomuser8219
6c08c6983b Change log level from WARNING to INFO for tiler compilation (#3749) 2025-10-25 17:43:52 -07:00
squidbus
6bd74ef769 Add CMake presets for macOS. (#3748) 2025-10-24 16:55:41 -07:00
squidbus
bf34665a8f externals: Update and simplify MoltenVK setup. (#3747) 2025-10-23 10:17:47 +03:00
DanielSvoboda
2d17ab8e4b Add informative update message for Qt build deprecation (#3740)
* Add informative update message for Qt build deprecation

* Update ru_RU.ts
2025-10-20 13:19:35 +03:00
Valdis Bogdāns
db9921baf2 GE2: Fix IME text conversion length handling (#3735)
- Reserve an extra space for the terminating character, resolving an issue in GE2 where the last character did not appear when input reached the maximum length.

Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
2025-10-14 08:41:47 +03:00
rainmakerv2
17fab7fdf1 IPC: commands for volume adjustment, input parsing, fsr, gamepad select (#3734)
* Add IPC functions: volume, fsr settings, parse inputs

* always process fsr values

* set controller command
2025-10-13 15:04:34 +03:00
Valdis Bogdāns
0cd6248eee Ime fixes (#3731)
* Changes
-Added support for OrbisImeParamExtended (extended IME parameters) in ImeHandler, ImeState, and ImeUi
-Updated all relevant constructors and logic to propagate and store the extended parameter
- Now fully supports passing extended options from sceImeOpen to the IME UI and backend

* Potential CUSA00434 [Debug] <Critical> assert.cpp:30 assert_fail_debug_msg: Assertion Failed!
buf_len + 1 <= buf_size && "Is your input buffer properly zero-terminated?" at C:/VS/shadPS4-ime-fixes/externals/dear_imgui/imgui_widgets.cpp:4601 fix

* Attempting to resolve an assertion failure in Diablo III:
- Adjusted buffer sizes
- Updated the calculation of text‑length values

* ime-lib another hotfix

Fixed incorrect param->title validation, which caused the IME dialog to fail to appear in Stardew Valley. Need to be checked.

* Clang fix

* FF9 ImeDialog Hotfix

* Removed the validation that disallowed null text and null placeholder, since using null values is valid in `ImeDialog`.
* Added additional debug logs to aid troubleshooting.

* IME Fixes
- Add missing flags to `OrbisImeExtOption`
- Improve debug logging
- Resolve nonstop `sceImeKeyboardOpen` calls in Stardew Valley (MonoGame engine) for `userId = 254`

* IME: guard null params for CUSA04909

- Add null checks in IME constructors to prevent crashes seen in CUSA04909.
- Leave a clear note about deferring keyboard event dispatch until guest-space translation is ready.

* Some improvements
- Added debug logs so every IME event and host callback (text/caret updates) shows what the guest sent back.
- Updated ImeState to respect the guest’s text-length limit, keep buffers in sync, and record caret/text changes without duplicates.
- Fixed shutdown by actually destroying the handler on close and letting sceImeUpdate exit quietly once the IME is gone.

* CLang

* IME: simplify handlers, add param checks, fix caret index

- Unify ImeHandler init; support optional OrbisImeParamExtended; drop userId from keyboard handler.
- Add basic null checks for work and inputTextBuffer; early error logging.
- Fixed incorrect caret position. Make caret and text area indices 1-based in ImeUi::InputTextCallback.
- Set default user_id to ORBIS_USER_SERVICE_USER_ID_INVALID in sceImeParamInit.
- Reduce noisy debug logs; promote key calls to LOG_INFO.
- Remove unused extended fields from ImeState; minor cleanups.

* IME: text/caret sync fixes; add Enter payload

- Sync UI input and work buffers on UpdateText
- Sync caret position on mouse click by emiting multiple UpdateCaret events for jumps (loop over delta)
- Add text payload to PressEnter (and Close); fixes IME in God Eater 2
- Queue initial Open event after open
- Fix UTF-8 → UTF-16 conversion bounds
- Add debug logs for all queued events

* CLang

* fixed accidental copy / paste replacement in text update event that broke text deletion.

* IME: Add code-point limited InputText and use in IME UI

- Add InputTextExLimited helper to cap Unicode code points and forward callbacks
- Switch IME input to InputTextExLimited with ime_param->maxTextLength and CallbackAlways

---------

Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
2025-10-13 13:38:44 +03:00
Stephen Miller
a1973438db Documents: More verbose warning about using --depth 1 when cloning (#3732)
* More verbose warning about --depth 1 flag in git clone

Just spent an hour and a half learning what this does the hard way, hopefully this prevents at least a few others from facing the same issues.

* Adjust grammar

Also updated copyright year, because why not.
2025-10-12 21:07:51 -07:00
tomboylover93
a7376dd41f Mark linux-sdl and macos-sdl binaries as executable (#3730) 2025-10-12 15:59:02 -07:00
Stephen Miller
6b6294a750 Filesystem: Always log mode as an octal (#3729)
Mode is an octal, print it as one.
2025-10-11 20:22:35 -07:00
Alexandre Bouvier
999960a6e6 fix for fmt 12 (#3719) 2025-10-08 01:49:46 -07:00
kalaposfos13
6805baffb2 posix_pthread_mutex_destroy (#3720) 2025-10-08 01:44:17 -07:00
Stephen Miller
109b239ddf Fix NoOverwrite flag behavior in MapMemory (#3718)
Reserved memory counts here, so we need to use !IsFree instead of IsMapped.
I swear this is like the 10th time I've messed this sorta thing up. Seems like it's the last case of this type of mistake in our current code though.
2025-10-07 18:39:39 -07:00
Stephen Miller
1714647343 Fix return for running out of flexible memory (#3717) 2025-10-07 17:33:09 -07:00
Stephen Miller
794d593a02 Fix alignment for mmap (#3716) 2025-10-07 16:22:21 -07:00
Stephen Miller
b34556702e NpAuth: Improved stubs (#3712)
* Some structs and function definitions

* Fill in remaining function definitions and structs

The original variants of GetIdToken and GetAuthorizationCode use an online id instead of user id.
The V3 functions use the same internal function, but with a different flag. Unless games show me something different, they likely use the same structs, and definitely use the same parameters.

* Some errors

* Minor formatting change

* Some more errors

* GetIdToken error cases

* Remaining error cases

Just need to tackle request-related logic now.

* Basic request handling

Seems to internally behave similarly to libSceNpManager, but the actual data stored in libSceNpAuth requests appears to be different, so I've kept everything separated.

* NpAuthRequest usage

Again, behavior mirrors libSceNpManager request behavior, though it appears to be a separate implementation.
The only time libSceNpAuth uses libSceNpManager is to actually send the requests, where the act of sending a request involves creating a completely separate NpManager request, using NpManager functions to retrieve the desired data, then deleting the underlying NpManager request. All of this would happen inside GetAuthorizationCode and GetIdToken.

* Oops

* Missing mutexes

* Default output variables to zero

Not sure what all games might check for here, but setting the outputs to zero is probably safe.
2025-10-05 17:31:21 -07:00
Stephen Miller
a0e7f7fb65 NpManager: Implement more request-related behavior (#3703)
* Implement sceNpCheckPlus

* Rework request storage

We'll need to store more data to "fake" async requests.

* sceNpAbortRequest

Pretty simple to add, so might as well.

* Formatting changes

* Async request logic

There's probably some things I'm getting wrong for cases where PSN is connected, but for reasons that should be pretty obvious, learning how that all works is a little more involved than the PSN disconnected results.

* Add missing error check

* Update np_manager.cpp

* Add a mutex to prevent concurrent reads/writes to g_requests

I imagine multi-threading is a lot more commonly used with the async functions, though I haven't tested enough to know.

* Update np_manager.h

* Move request creation to separate internal function

* Oops

Not sure how that got missed, but good thing I spotted it

* Oops
2025-10-05 17:25:46 -07:00
TheTurtle
8f37cfb739 amdgpu: Split liverpool registers and cleanup (#3707) 2025-10-05 13:42:40 -07:00
Stephen Miller
d17a4fb8cc Include older Windows 11 builds in the address space workaround (#3711)
For now, I've included up to Windows 11 22H2 in the workaround.
I've only personally seen reports of issues on Windows 11 21H2, but better safe than sorry (considering Windows 10 22H2 has issues).
2025-10-05 12:46:06 -07:00
kalaposfos13
4fa435490c Add missing function exports for OpenOrbis (#3708)
* Add missing function exports for OpenOrbis

* copyright 2025

* review comment
2025-10-05 19:31:05 +03:00
Stephen Miller
11229c1dc0 Use correct trophy folder for games with multiple trophy lists (#3704)
Based on the games I've checked, it seems like the service label parameter of sceNpTrophyCreateContext is what determines the trophy list.
Since we're already storing the service label in our contexts, and we're already extracting all trophy lists, all that needs doing is using the service label to select the right trophy list.
2025-10-05 18:39:14 +03:00
Stephen Miller
455cd37aae Fix tess addr (#3706) 2025-10-05 18:23:42 +03:00
Stephen Miller
e7194af881 Core: Increase address space limits and rework Windows address space initialization. (#3697)
* SearchFree adjustments

* Robust address validation

I've adjusted IsValidAddress to take in a size, and check whether the whole range is contained in vma map.
If no size is provided, the function reverts to the old form of address validation instead.

* Map around gaps

As is, this should work mostly.
Only remaining issue is adding logic to pass the "mapped regions" to the guest vma map (and make such logic cross-platform).

* Initialize vma_map using gaps

This should allow memory code to catch any issues from address space gaps, and prevent non-fixed mappings from jumping to a location that isn't actually available.

* Clang

* Fix compile

* Clang

* Fix compile again

* Set system_managed_base and system_managed_size based on

Many places in our code use system_managed_base as the minimum mappable address, ensure this fact remains the same  on Windows to prevent potential bugs.

* Reduce address validation in SearchFree

Allows SearchFree to function when a certain Windows GPU driver goes and reserves the whole system managed area.

Since SearchFree is only called on flexible addresses, allowing this particular case, where addresses are in bounds, but there's not enough space to map, should be safe enough.

* Bump address space size further

To handle Madden NFL 16 (and any games like it)

* More thorough logging of available memory regions

Should help with spotting weirdness.

* Formatting fixes

* Clang

* Slight reduction of user space

Still large enough to handle EA's shenanigans, but small enough that Linux doesn't break.

* Assert on VirtualQuery failure

* Extra debugging information

* Further reduce user space

This will unfix most of EA's titles, but UFC will still work.
Older windows versions support the high addresses, but trying to actually use them causes significant performance issues.

* Extra debugging info

Just in case other testers still run into issues.

* Remove debug logging

* Revert user space increases

Technically this constant is still higher than before, but weird side effects of our old logic resulted in a max address somewhere around this in main.

* address_space: Support expanded virtual memory space on macOS.

Co-Authored-By: squidbus <175574877+squidbus@users.noreply.github.com>

* Move address space constants to address_space.cpp

This ensures that all code must use the calculated address space memory values instead of the constants, since the calculated values can differ based on the platform.

This does require slight modification to thread state and gnmdriver code, since both were already using these constants directly.

* Workaround Windows 10 limitations

If a Windows 10 device is detected, use a lower value for USER_MAX to prevent system-wide hangs in VirtualAlloc2 calls.

* Fix compile for Windows-Qt

* Move tessellation_factors_ring_addr initialization to sceGnmGetTheTessellationFactorRingBufferBaseAddress

* Set image base address on Windows

This seems to work fine on Windows 11, needs testing from Windows 10 due to the previously discussed bugs.

* Set Linux executable base to 0x700000000000

This allows Linux to map the full user space without any workarounds.

Co-Authored-By: Marcin Mikołajczyk <2052578+mikusp@users.noreply.github.com>

* Basic formatting changes

* Reduce USER_MAX on Linux

Seems like finding a reliable way to move shadPS4's position in memory is difficult, for now limit the user size so we aren't trying to overwrite ourselves.

* Move memory and address_space variables.

---------

Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
Co-authored-by: Marcin Mikołajczyk <2052578+mikusp@users.noreply.github.com>
2025-10-04 14:52:50 -07:00
TheTurtle
08878385e1 image_info: Fix guest size calculation for linear render targets (#3700) 2025-10-04 23:09:40 +03:00
kalaposfos13
81098da509 did really no one ever test this (#3702) 2025-10-04 23:09:10 +03:00
kalaposfos13
5fedf9daea add missing pthread_condvar_signal export (#3701) 2025-10-04 12:09:03 +03:00
Niram7777
23d0fc6493 Vk validation core on for game specific + optimize search extension (#3698)
* VK validation Core on by default

* VK stop searching extension when found
2025-10-03 12:45:46 -07:00
Niram7777
5c7f802233 VK Layer Settings remove deprecated (#3676) 2025-10-02 12:50:23 -07:00
Niram7777
54b5520c1a VK settings activation based on layers (#3691) 2025-10-02 12:50:12 -07:00
kalaposfos13
02f9aef34a restore accidentally deleted line (#3695) 2025-10-02 12:34:17 +03:00
Valdis Bogdāns
8de385a4f1 IME: guard null params for CUSA04909 (#3680)
* Changes
-Added support for OrbisImeParamExtended (extended IME parameters) in ImeHandler, ImeState, and ImeUi
-Updated all relevant constructors and logic to propagate and store the extended parameter
- Now fully supports passing extended options from sceImeOpen to the IME UI and backend

* Potential CUSA00434 [Debug] <Critical> assert.cpp:30 assert_fail_debug_msg: Assertion Failed!
buf_len + 1 <= buf_size && "Is your input buffer properly zero-terminated?" at C:/VS/shadPS4-ime-fixes/externals/dear_imgui/imgui_widgets.cpp:4601 fix

* Attempting to resolve an assertion failure in Diablo III:
- Adjusted buffer sizes
- Updated the calculation of text‑length values

* ime-lib another hotfix

Fixed incorrect param->title validation, which caused the IME dialog to fail to appear in Stardew Valley. Need to be checked.

* Clang fix

* FF9 ImeDialog Hotfix

* Removed the validation that disallowed null text and null placeholder, since using null values is valid in `ImeDialog`.
* Added additional debug logs to aid troubleshooting.

* IME Fixes
- Add missing flags to `OrbisImeExtOption`
- Improve debug logging
- Resolve nonstop `sceImeKeyboardOpen` calls in Stardew Valley (MonoGame engine) for `userId = 254`

* IME: guard null params for CUSA04909

- Add null checks in IME constructors to prevent crashes seen in CUSA04909.
- Leave a clear note about deferring keyboard event dispatch until guest-space translation is ready.

* Some improvements
- Added debug logs so every IME event and host callback (text/caret updates) shows what the guest sent back.
- Updated ImeState to respect the guest’s text-length limit, keep buffers in sync, and record caret/text changes without duplicates.
- Fixed shutdown by actually destroying the handler on close and letting sceImeUpdate exit quietly once the IME is gone.

* CLang

---------

Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
2025-10-02 10:25:58 +03:00
squidbus
110a735a04 externals: Update MoltenVK (#3694) 2025-10-01 18:52:12 -07:00
kalaposfos13
74c0ea8432 Add CLI argument to launch the emulator with global config or with default settings (#3688)
* --config-clean, --config-global

* copyright 2025

* fine you win

* copyright 2024
2025-10-01 12:28:34 -07:00
Stephen Miller
af147debc6 Lock linker mutex in RelocateAnyImports (#3693)
Module relocation is not thread safe, games calling LoadAndStartModule on multiple threads can invalidate pointers while iterating through m_modules.

This fixes crashes in some apps on Windows.
2025-10-01 22:27:12 +03:00
Vladislav Mikhalin
1020c3150f avplayer: remove maximum audio delay (#3692) 2025-10-01 22:26:28 +03:00
TheTurtle
0134b8c3a8 buffer_cache: Bring back CPU path (#3679)
It was reported this resulted in a noticeable 10+ fps drop in Driveclub so bring it back just with check to avoid it if the source range is an image alias
2025-10-01 22:22:48 +03:00
Stephen Miller
6fb64a8054 Kernel.Fs: Device file cleanup and /dev/rng implementation (#3682)
* Add RNG device

* rng device implementation

Tailored around libSceSsl2's usage, and based on fpPS4's implementation.

* Device file function types and log fixups

* Updated creates

Updates device file create functions to be the same as the directory file create functions.

* Fix compile

* Includes cleanup

Generally preferred to have full paths. Also removed some unused imports too.

* Fix buffer size

* Bring back cstdlib imports

Needed for Mac OS.
2025-10-01 12:20:58 -07:00
squidbus
6d0b179d24 videoout: Move HDR swapchain configuration to present thread. (#3690) 2025-10-01 12:20:43 -07:00
squidbus
68fca2552f audioout: Do not wait for data within timer. (#3689) 2025-10-01 12:20:35 -07:00
¥IGA
0e6dea1059 Update Qt to 6.9.3 (#3683) 2025-10-01 16:11:39 +03:00
squidbus
8a8ee395c5 image: Improve enforcement of image copy layer rules. (#3681) 2025-09-30 22:47:56 -07:00
Niram7777
a8f4a20b24 VK Wayland RenderDoc log incompatible (#3675) 2025-09-30 07:21:48 -07:00
squidbus
505e80e756 video_core: Fix some image copy and buffer offset validation errors. (#3673) 2025-09-30 16:17:22 +03:00
TheTurtle
ad99bda08d video_core: Better handling of image copies with DmaData (#3672) 2025-09-30 15:51:30 +03:00
TheTurtle
a35c9f3586 Handle mixed samples attachments (V2) (#3667)
* video_core: Refactor render target bind to allow disabling MSAA

* video_core: Implement swapping of backing samples

* clang format

* video_core: Better implementation

Instead of downgrading to 1 sample, always try to match depth samples. This avoids needing to copy depth-stencil attachment and copying multisampled stencil is not possible on some vendors

* video_core: Small bugfixes

* image: Add null check

* vk_rasterizer: Swap backing samples on resolve dst

* vk_presenter: Reset backing samples before present

* video_core: Small refactor to make this implementation better

* reinterpret: Fix channel check for degamma

Seems this was simpler than I thought, hardware doesn't apply degamma on the W channel regardless of swizzle

* image: Add missing end rendering call

* blit_helper: Fix bug in old reinterpret path

* blit_helper: Remove unused layer vertex

Should be used in the future if copying many layers is needed

* vk_rasterizer: Apply suggestion

* vk_rasterizer: More bind refactor

* vk_instance: Re-enable extensions
2025-09-29 16:27:39 +03:00
kalaposfos13
cad027845f Add configurable extra memory (#3513)
* Add configurable extra memory

* lowercase getter and setter

* Refactor memory setup to configure maximum memory limits at runtime

* sir clang offnir, the all-formatting

* Correctly update BackingSize on W*ndows too

* small format change

* remove total_memory_to_use from the header

* i have no idea how to name this commit
"addressing review comments" is a good name i guess

* Do not include extraDmem in the general config
2025-09-28 20:16:03 +03:00
Stephen Miller
6c5a84dc99 Core: Handle various edge cases related to executable permissions. (#3660)
* Fix flag handling on Windows

Fixes a weird homebrew kalaposfos made

* Fix backing protects

Windows requires that protections on areas committed through MapViewOfFile functions are less than the original mapping.
The best way to make sure everything works is to VirtualProtect the code area with the requested protection instead of applying prot directly.

* Fix error code for sceKernelMapDirectMemory2

Real hardware returns EINVAL instead of EACCES here

* Fix prot setting in ProtectBytes

* Handle some extra protection-related edge cases.

Real hardware treats read and write as separate perms, but appends read if you call with write-only (this is visible in VirtualQuery calls)

Additionally, execute permissions are ignored when protecting dmem mappings.

* Properly handle exec permission behavior for memory pools

Calling sceKernelMemoryPoolCommit with executable permissions returns EINVAL, mprotect on pooled mappings ignores the exec protection.

* Clang

* Allow execution protection for direct memory

Further hardware tests show that the dmem area is actually executable, this permission is just hidden from the end user.

* Clang

* More descriptive assert message

* Align address and size in mmap

Like most POSIX functions, mmap aligns address down to the nearest page boundary, and aligns address up to the nearest page boundary.
Since mmap is the only memory mapping function that doesn't error early on misaligned length or size, handle the alignment in the libkernel code.

* Clang

* Fix valid flags

After changing the value, games that specify just CpuWrite would hit the error return.

* Fix prot conversion functions

The True(bool) function returns true whenever value is greater than 0. While this rarely manifested before because of our wrongly defined CpuReadWrite prot, it's now causing trouble with the corrected values.
Technically this could've also caused trouble with games mapping GpuRead permissions, but that seems to be a rare enough use case that I guess it never happened?

I've also added a warning for the case where `write & !read`, since we don't properly handle write-only permissions, and I'm not entirely sure what it would take to deal with that.

* Fix some lingering dmem issues

ReleaseDirectMemory was always unmapping with the size parameter, which could cause it to unmap too much. Since multiple mappings can reference the same dmem area, I've calculated how much of each VMA we're supposed to unmap.
Additionally, I've adjusted the logic for carving out the free dmem area to properly work if ReleaseDirectMemory is called over multiple dmem areas.

Finally, I've patched a bug with my code in UnmapMemory.
2025-09-28 11:36:12 +03:00