Commit Graph

3571 Commits

Author SHA1 Message Date
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
Marcin Mikołajczyk
937d50cb00 np: stub sceNpSnsFacebookDialogUpdateStatus (#3661) 2025-09-26 19:19:41 -07:00
georgemoralis
905c536ef4 make sys_modules folder configurable (#3657)
* make sys_modules folder configurable

* Update src/common/config.cpp

Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>

---------

Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
2025-09-26 12:35:43 -07:00
Stephen Miller
528a060709 Core: Memory code cleanup and further direct memory fixes (#3655)
* Remove mapped dmem type

Since physical addresses can be mapped multiple times, tracking mapped pages is not necessary.
This also allows me to significantly simplify the MapMemory physical address validation logic.

* Proper implementation for sceKernelMtypeprotect

I've rewritten SetDirectMemoryType to use virtual addresses instead of physical addresses, allowing it to be used in sceKernelMtypeprotect.

To accommodate this change, I've also moved address and size alignment out of MemoryManager::Protect

* Apply memory type in sceKernelMemoryPoolCommit

* Organization

Some potentially important missing mutexes, removed some unnecessary mutexes, moved some mutexes after early error returns, and updated copyright dates

* Iterator logic cleanup

Missing end check in ClampRangeSize, and adjusted VirtualQuery and DirectMemoryQuery.

* Clang

* Adjustments

* Properly account for behavior differences in MapDirectMemory2

Undid the changes to direct memory areas, added more robust logic for changing dma types, and fixed DirectMemoryQuery to return hardware-accurate direct memory information in cases where dmas split here, but not on real hardware.

I've also changed MapMemory's is_exec flag to a validate_dmem flag, used to handle alternate behavior in MapDirectMemory2. is_exec is now determined by the use of MemoryProt::CpuExec instead.

* Clang

* Add execute permissions to physical backing

Needed for executable mappings to work properly on Windows, fixes regression in RE2 with prior commit.

* Minor variable cleanup

* Update memory.h

* Prohibit direct memory mappings with exec protections

Did a quick hardware test to confirm, only seems to be prohibited for dmem mappings though.

* Update memory.cpp
2025-09-26 02:28:32 -07:00
georgemoralis
6e27842562 Trophy fixes IXXXX (#3653)
* fixing missing trophy files extraction

* implemented sceNpTrophyGetGameIcon

* adjustments

* improvements

* argg

* added assert

* done

* fixed compiling
2025-09-26 00:00:12 -07:00
Vinicius Rangel
71f343d2d6 Impl sceSystemServiceLoadExec (#3647)
* Add support for restarting the emulator with new configurations

- Implement `Restart` function in `Emulator` to enable process relaunch with updated parameters.
- Modify `sceSystemServiceLoadExec` to use the restart functionality.

* Add logging for emulator restart and system service load execution

* Add IPC emulator PID output command

Impl `PID` output command to return the emulator process ID
- required for launches supporting emulator restart

* Add log file append mode support (used after restarting to keep the same log file)

* Keep game root between restarts

* add --wait-for-debugger option flag

* add --wait-for-pid flag

used for sync between parent & child process during restart

* impl restart via ipc

* fix override game root

* add qt flags to allow restart
2025-09-25 23:01:52 -03:00
Marcin Mikołajczyk
a6f5e4c7dc net: silence some epoll logs (#3654) 2025-09-25 12:41:31 -07:00
Stephen Miller
98ceb6e43e Allow overlapping direct memory mappings (#3648)
Real hardware allows this, and it worked fine in the past, so allow it here.
2025-09-24 19:22:48 +03:00
Stephen Miller
eeee6ad0ee Memory: Implement sceKernelMemoryPoolGetBlockStats (#3646)
* Implement sceKernelMemoryPoolGetBlockStats

Not entirely sure on the logic behind the cached blocks work, but flushed blocks seems to just be based on committed direct memory.

* Fix comment
2025-09-24 02:40:26 -07:00
Stephen Miller
5d8027f0c0 Core: Refactor direct memory handling (#3645)
* Refactor direct memory areas

At this point, swapping the multiple booleans for an enum is cleaner, and makes it easier to track the state of a direct memory area.

I've also sped up the logic for mapping direct memory by checking for out-of-bounds physical addresses before looping, and made the logic more solid using my dma type logic.

* Fix PoolCommit assert

Windows devices will throw an access violation if we don't check for iterator reaching end.
2025-09-23 22:42:15 +03:00
Vladislav Mikhalin
1eead6a5ee avplayer: fix play request state handling (#3644) 2025-09-23 21:17:48 +03:00
Stephen Miller
419ea140ab Core: physical backing for flexible and pooled memory allocations (#3639)
* Fix isDevKit

Previously, isDevKit could increase the physical memory used above the length we reserve in the backing file.

* Physical backing for flexible allocations

I took the simple approach here, creating a separate map for flexible allocations and pretty much just copying over the logic used in the direct memory map.

* Various fixups

* Fix mistake #1

* Assert + clang

* Fix 2

* Clang

* Fix CanMergeWith

Validate physical base for flexible mappings

* Clang

* Physical backing for pooled memory

* Allow VMA splitting in NameVirtualRange

This should be safe, since with the changes in this PR, the only issues that come from discrepancies between address space and vma_map are issues related to vmas being larger than address space mappings. NameVirtualRange will only ever shrink VMAs by naming part of one.

* Fix

* Fix NameVirtualRange

* Revert NameVirtualRange changes

Seems like it doesn't play nice for Windows

* Clean up isDevKit logic

We already log both isNeo and isDevKit in Emulator::Run, so the additional logging in MemoryManager::SetupMemoryRegions isn't really necessary.

I've also added a separate constant for non-pro devkit memory, as suggested.

Finally I've changed a couple constants to use the ORBIS prefix we generally follow here, instead of the SCE prefix.

* Erase flexible memory contents from physical memory on unmap

Flexible memory should not be preserved on unmap, so erase flexible contents from the physical backing when unmapping.

* Expand flexible memory map

Some games will end up fragmenting the physical backing space used for flexible memory. To reduce the frequency of this happening under normal circumstances, allocate the entirety of the remaining physical backing to the flexible memory map.

This is effectively a workaround to the problem, but at the moment I think this should suffice.

* Clang
2025-09-23 17:24:37 +03:00
Marcin Mikołajczyk
976d12f4e6 Epolls are file descriptors (#3622)
* net: Register epolls in file descriptor table

* fstat: stub epoll, resolver

* Fake async hostname resolution

* net: epoll fixes

* epoll: actually close the file descriptor
2025-09-22 22:57:51 +03:00
Vladislav Mikhalin
50a3081084 ajm: handle ParseRiffHeader flag (#3618)
* ajm: handle ParseRiffheader flag

* small optimizations and cleanup

* allow uninitialized instances handle RIFF

* fixed audio cutoff and small refactoring

* small fix to the returned data

* fix gapless init, reset total samples on RIFF init

* warning reporting + consume input buffer on gapless loop
2025-09-22 18:50:57 +03:00
Vladislav Mikhalin
525d24a7fc avplayer: do not start the video multiple times (#3638) 2025-09-21 16:03:24 +03:00
Missake212
51c96b8ee6 Lower "Trophy key is not specified" message from critical to info (#3636) 2025-09-20 12:47:46 -07:00
Vladislav Mikhalin
2b1c0b4f82 avplayer: implemented AddSourceEx, SetAvSyncMode, Pause and Resume (#2456)
* avplayer: code improvements

* avplayer: implemented pause/resume

* avplayer: implemented sync modes

* avplayer: issue warning on loopback

* avplayer: sync on video ts in default mode when audio ts is not available

* avplayer: removed waits for the frame in Get*Data, replaced cv with sleep

* avplayer: removed all waits from GetVideoData

* avplayer: fix warning propagation + small fixes

* Using texture memory for video frames, dropped video frame cache, syncing audio to video

* do not sync to audio when audio is not enabled

* removed logs, fixed sync

* reverted the removal of pre-allocated buffers
2025-09-20 19:27:16 +03:00
DanielSvoboda
eb18382396 Fix: V_MUL_I32_I24 | V_MUL_U32_U24 (#3632) 2025-09-19 19:05:22 -07:00
Missake212
fa489c023e Update game-bug-report.yaml (#3628) 2025-09-19 18:36:52 +03:00
kalaposfos13
f01b6295dd Make UpdatePlayTime not depend on Qt (#3629)
* Make UpdatePlayTime not depend on Qt

* sir clang offnir, the all-formatting
2025-09-19 18:34:21 +03:00
squidbus
be80276ec3 Fix Pthread memset warning and add comment. (#3625) 2025-09-19 02:17:30 -07:00
DanielSvoboda
71e81c836c Remove Crowdin integration and related Actions (#3623) 2025-09-18 23:36:38 +03:00
kalaposfos13
ddb59edd3e Enable autoupdating on actions that run for tags, not commits (#3621) 2025-09-18 16:30:53 +03:00
Marcin Mikołajczyk
7bd3eb485f Epoll (#3476)
* Epoll

* Change companion util stub to return NO_EVENT

* Revert "Change companion util stub to return NO_EVENT"

This reverts commit 8dd9913cda39b641cd3b65925e1f31fa713e8a24.

* added wepoll

* shallow..

* dist branch

* updated wepoll

* compiles on windows

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2025-09-18 11:53:04 +03:00
squidbus
0eff74223a shader_recompiler: Implement fallback path for missing shaderFloat16 support. (#3604) 2025-09-18 00:43:47 -07:00
georgemoralis
1e949c5813 started 0.11.1 WIP 2025-09-18 10:18:02 +03:00
georgemoralis
1c0ec3be2a tagged 0.11.0 release v.0.11.0 2025-09-18 09:54:56 +03:00
georgemoralis
cf1f0f25c1 New Crowdin updates (#3619)
* New translations en_us.ts (Romanian)

* New translations en_us.ts (French)

* New translations en_us.ts (Spanish)

* New translations en_us.ts (Arabic)

* New translations en_us.ts (Catalan)

* New translations en_us.ts (Danish)

* New translations en_us.ts (German)

* New translations en_us.ts (Greek)

* New translations en_us.ts (Finnish)

* New translations en_us.ts (Hungarian)

* New translations en_us.ts (Italian)

* New translations en_us.ts (Japanese)

* New translations en_us.ts (Korean)

* New translations en_us.ts (Lithuanian)

* New translations en_us.ts (Dutch)

* New translations en_us.ts (Polish)

* New translations en_us.ts (Portuguese)

* New translations en_us.ts (Russian)

* New translations en_us.ts (Slovenian)

* New translations en_us.ts (Albanian)

* New translations en_us.ts (Swedish)

* New translations en_us.ts (Turkish)

* New translations en_us.ts (Ukrainian)

* New translations en_us.ts (Chinese Simplified)

* New translations en_us.ts (Chinese Traditional)

* New translations en_us.ts (Urdu (Pakistan))

* New translations en_us.ts (Vietnamese)

* New translations en_us.ts (Portuguese, Brazilian)

* New translations en_us.ts (Indonesian)

* New translations en_us.ts (Persian)

* New translations en_us.ts (Norwegian Bokmal)

* New translations en_us.ts (Serbian (Latin))
2025-09-18 09:37:53 +03:00
georgemoralis
932bb25a4c [ci skip] Qt GUI: Update Translation. (#3617)
Co-authored-by: georgemoralis <4313123+georgemoralis@users.noreply.github.com>
2025-09-18 08:45:31 +03:00
georgemoralis
99a398bd41 New Crowdin updates (#3611)
* New translations en_us.ts (Romanian)

* New translations en_us.ts (French)

* New translations en_us.ts (Spanish)

* New translations en_us.ts (Arabic)

* New translations en_us.ts (Catalan)

* New translations en_us.ts (Danish)

* New translations en_us.ts (German)

* New translations en_us.ts (Greek)

* New translations en_us.ts (Finnish)

* New translations en_us.ts (Hungarian)

* New translations en_us.ts (Italian)

* New translations en_us.ts (Japanese)

* New translations en_us.ts (Korean)

* New translations en_us.ts (Lithuanian)

* New translations en_us.ts (Dutch)

* New translations en_us.ts (Polish)

* New translations en_us.ts (Portuguese)

* New translations en_us.ts (Russian)

* New translations en_us.ts (Slovenian)

* New translations en_us.ts (Albanian)

* New translations en_us.ts (Swedish)

* New translations en_us.ts (Ukrainian)

* New translations en_us.ts (Chinese Simplified)

* New translations en_us.ts (Chinese Traditional)

* New translations en_us.ts (Urdu (Pakistan))

* New translations en_us.ts (Vietnamese)

* New translations en_us.ts (Portuguese, Brazilian)

* New translations en_us.ts (Indonesian)

* New translations en_us.ts (Persian)

* New translations en_us.ts (Norwegian Bokmal)

* New translations en_us.ts (Serbian (Latin))

* New translations en_us.ts (Turkish)

* New translations en_us.ts (Italian)

* New translations en_us.ts (Norwegian Bokmal)

* New translations en_us.ts (Chinese Simplified)

* New translations en_us.ts (German)

* New translations en_us.ts (Spanish)

* New translations en_us.ts (German)

* New translations en_us.ts (Russian)

* New translations en_us.ts (Chinese Simplified)

* New translations en_us.ts (Serbian (Latin))

* New translations en_us.ts (Russian)

* New translations en_us.ts (Catalan)

* New translations en_us.ts (Swedish)

* New translations en_us.ts (German)
2025-09-18 08:28:47 +03:00
Randomuser8219
cf9b5a2942 Some new README images for 0.11.0 (#3615)
* New Bloodborne image for README

* Replace P4G with Driveclub

So Atlus doesn't go ham on us just like RPCS3.

* Update README.md

I hope I got the Yakuza game correct

* Downscale Project DIVA image to 720p

So the table scale isn't weird

* Whoops

* Update README.md

* Yakuza image is actually 1280x720

Should fix the misaligning
2025-09-18 08:28:36 +03:00
nickci2002
0d09c32df9 Ds4 Speaker Audio Rebase Fix (#3607)
* Logic update, no QT ui

* Fixing errors

* Gui boxes

* fixes

* prevent device list refreshing too fast when game not running

* Removed duplicate Socket declarations in kernel/file_system.cpp and fs.h

* Fixed clang-format and micDevice errors

* Ran clang-format and fixed rebase compiler issues

* Settings dialog fix

* Addressed squidbus' concerns

* Update config.cpp to adhere to clang-format

* Removed a space causing clang-format to complain

* Addressed squidbus' concerns and added fallbacks

Concerns:
- Changed dev_name construct to remove unnecessary cast
- Added an invalid AudioDeviceID macro to replace magic number

---------

Co-authored-by: rainmakerv2 <30595646+rainmakerv3@users.noreply.github.com>
2025-09-18 08:28:12 +03:00
Gabriel
7101caa80b Fix: Extend strlcpy implementation to Linux builds (#3616)
* Fix: Add libbsd dependency for Linux builds

Adds conditional libbsd support to resolve strlcpy undefined reference
on Linux systems. Includes proper CMake detection and header includes.

* Fix: Use internal strlcpy implementation for Linux

- Extend existing Windows strlcpy implementation to Linux
- Remove libbsd dependency from CMakeLists.txt
- Resolves undefined reference to strlcpy on glibc systems

Uses the project's existing approach instead of adding external dependencies.
2025-09-17 20:45:28 -07:00
Marcin Mikołajczyk
6ab7aa3b18 Open a dummy audio input device if none is present in the system (#3514) 2025-09-17 12:50:47 -07:00