Commit Graph

2590 Commits

Author SHA1 Message Date
squidbus
e2b726382e
vulkan: Fix two validation errors introduced by shared memory changes. (#3074) 2025-06-09 19:48:20 -07:00
squidbus
0444e590e0
mac: Fix building on macOS 26. (#3073) 2025-06-09 19:29:15 -07:00
Marcin Mikołajczyk
217d32b502
Handle DS_READ_U16, DS_WRITE_B16, DS_ADD_U64 (#3007)
* Handle DS_READ_U16 & DS_WRITE_B16

* Refactor DS translation

* Translate DS_ADD_U64

* format

* Fix RingAccessElimination after changing WriteShared64 type

* Simplify bounds checking in generated SPIR-V
2025-06-09 22:03:38 +03:00
Lander Gallastegi
a71bfb30a2
shader_recompiler: Patch SRT walker on segfault (#2991)
* Patch srt walker access violations

* Fix range

* clang-format lolz

* Lower log from warning to debug
2025-06-09 13:04:21 +03:00
mailwl
046cf50412
PM4 type 2 in acb (#3047)
* Stub PM4 type 0

* fix command size

* revert command size to actual

* return unreachable for PM4t0

* remove skipping command body
2025-06-09 01:27:37 -07:00
TheTurtle
d7051f15f4
texture_cache: Basic handling of partially resident images (#3066)
* texture_cache: Avoid gpu tracking assert on sparse image

At the moment just take the easy way of creating the entire image normally and uploading unmapped subresources are zero

* tile_manager: Downgrade assert to error

* fix macos
2025-06-09 01:26:10 -07:00
TheTurtle
12f4a8f073
tile_manager: Downgrade assert to error (#3067) 2025-06-09 09:35:43 +03:00
TheTurtle
c20d02dd40
shader_recompiler: Better handling of geometry shader scenario G (#3064) 2025-06-08 17:31:51 -07:00
squidbus
ae2053c487 fix: Disable eBlockTexelViewCompatible on MoltenVK 2025-06-08 15:41:58 -07:00
TheTurtle
14b082f5ea
buffer_cache: Inline data to cpu unless gpu modified (#3061) 2025-06-08 15:28:00 -07:00
TheTurtle
ce42eccc9d
texture_cache: Handle compressed views of uncompressed images (#3056)
* pixel_format: Remove unused tables, refactor

* host_compatibilty: Cleanup and support uncompressed views of compressed formats

* texture_cache: Handle compressed views of uncompressed images

* tile_manager: Bump max supported mips to 16

Fixes a crash during start

* oops

* texture_cache: Fix order of format compat check
2025-06-08 23:09:08 +03:00
TheTurtle
8ffcfc87bd
shader_recompiler: Implement linear interpolation support (#3055) 2025-06-08 22:46:34 +03:00
Paris Oplopoios
5004e41100
Patch movntss and movntsd (#3049)
* Patch movntss and movntsd

* clang-format

* Deduplication

* Allow rep to be in other places
2025-06-08 22:29:33 +03:00
TheTurtle
a07a6bb9d3
buffer_cache: Better image search for buffer validation (#3057) 2025-06-08 22:14:09 +03:00
squidbus
f2bbb6847d fix: Missing switch case for BUFFER_ATOMIC_CMPSWAP 2025-06-08 11:53:11 -07:00
Marcin Mikołajczyk
ce84e80f65
BUFFER_ATOMIC_CMPSWAP (#3045) 2025-06-08 11:43:58 -07:00
TheTurtle
952cef5a15
shader_recompiler: Implement dual source blending (#3054) 2025-06-08 21:38:58 +03:00
Mahmoud Adel
2bc199a41b
black image error fix (#3051) 2025-06-08 11:33:08 -07:00
Fire Cube
5d064dd89f
Dev Tools: Fix Module Viewer HLE detection (#3058)
* fix

* clang
2025-06-08 21:04:55 +03:00
Stephen Miller
2857ef34f0
Don't coalesce dmem pages (#3059)
Looks like this change is what broke P.T.
I'll need to look closer at this when I have a chance, clearly we're doing something wrong here.
2025-06-08 21:04:43 +03:00
Stephen Miller
5edd9ff54b
Improved sceKernelMapNamedFlexibleMemory logging (#3050)
* More descriptive sceKernelMapNamedFlexibleMemory logging

* Misc exports

These functions are used by Overwatch: Origins Edition

* Clang

* Function parameter cleanup

Changes the parameters on our sceKernelMapNamedFlexibleMemory and sceKernelMapFlexibleMemory functions to better align with our current standards.
2025-06-08 00:17:45 +03:00
Marcin Mikołajczyk
91d29459fb
Implement PM4CondExec (#3046) 2025-06-05 20:19:05 -07:00
Marcin Mikołajczyk
fff3bf9917
s_flbit_i32_b64 (#3033)
* s_flbit_i32_b64

* Split FindUMsb64 into two 32bit ops
2025-06-05 14:33:25 -07:00
Stephen Miller
43bf4ed1bc
sceVideoOutGetResolutionStatus error behavior (#3044) 2025-06-05 12:14:34 -07:00
Stephen Miller
0e9420a7b2
Fix request queues in libSceZlib (#3041)
Queues are a FIFO data structure, so pop() removes the front, not the end.
2025-06-05 16:43:39 +03:00
georgemoralis
93222c6f9f
New Crowdin updates (#3038)
* New translations en_us.ts (Portuguese, Brazilian)

* New translations en_us.ts (Turkish)
2025-06-05 08:49:32 +03:00
DanielSvoboda
285df1b5be
QT: AutoUpdate - Fix Changelog Error (#3042) 2025-06-05 08:48:47 +03:00
Marcin Mikołajczyk
d4fbeea085
Stub PM4 COPY_DATA opcode (#3032) 2025-06-04 17:00:11 -07:00
Marcin Mikołajczyk
4d1a1ce9c2
v_rcp_legacy_f32 (#3040) 2025-06-04 16:55:47 -07:00
Stephen Miller
23710f397e
Reduce clamp threshold to 2MB (#3034)
A proposed solution to the non-GPU memory asserts seen in RESIDENT EVIL 2 (CUSA09193)
2025-06-03 22:17:35 -07:00
Dmugetsu
88f6cb4d41
clean up main window from extraction remains (#3035) 2025-06-04 00:26:04 +03:00
Marcin Mikołajczyk
5b6fc788b3
Fix passing user data in user-triggered equeue events (#2948) 2025-06-03 11:42:20 -07:00
Stephen Miller
8cdd8dd725
Core: Pthread affinity fixups (#3021)
* posix_pthread_attr_getschedparam

* Fixes for scePthreadGetAffinity and scePthreadSetAffinity

Looking at FreeBSD source, and our other pthread functions, we should be using our FindThread function to get the appropriate thread if thread != g_curthread.
2025-06-03 03:43:56 -07:00
Fire Cube
c09d1c3cff
Add support for game folder and fail early if eboot.bin is missing or corrupt (#3027) 2025-06-03 13:34:29 +03:00
Stephen Miller
bb3f8af81a
Core: Protect fixes (#3029)
* Swap do-while to while

If we use a do-while loop, we waste time if `aligned_size = 0`.  This is also still accurate to FreeBSD behavior, where it returns success if `start == end` during mprotect.
This also effectively prevents the memory assert seen in updated versions of RESIDENT EVIL 2 (CUSA09193)

* Move prot validation outside loop

The prot variable shouldn't change during a mprotect call, so we can check the flags before protecting instead.
Also cleans up the code for prot validation.
This should improve performance, and is more accurate to FreeBSD code.

* Add logging for protect calls

This will help in debugging future problems
2025-06-03 09:29:25 +03:00
mailwl
eed99141b3
Network Play: set user signed in (#2944)
* Network Play: set user signed in

* get signedIn status from config

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2025-06-03 09:11:18 +03:00
Stephen Miller
2c78272185
Emulate libSceGnmDriver's init behavior (#3024)
This time, perform it after the LoadSharedLibraries call, which places it after the various init memory mappings GFD engine titles perform.
2025-06-03 08:02:51 +03:00
kalaposfos13
1930a2132c
Fix SSH remote links (#3025) 2025-06-02 19:02:37 +03:00
Stephen Miller
6bdd83684b
Libs: libSceVoice stubs (#3022)
* voice lib stubs

Primarily for GTA V

* Clang
2025-06-01 19:30:03 +03:00
WujekFoliarz
b1af1334c9
Fix touchpad handling and change gyro calculation (#3006)
* Change touchpad handling and orientation calculation

* remove unnecessary includes in pad.cpp

* remove the cmake command arguments

* remove the weird file

* try to fix formatting

* limit new gyro and touchpad logic to controller 1

* remove cout

* fix formatting and add the handle check to scePadRead

* swap y and z back
2025-06-01 19:13:02 +03:00
¥IGA
bb199865cf
Qt: Set Minimum Icon Size List to 48 (#3018) 2025-06-01 14:52:09 +03:00
Stephen Miller
c09e463b8e
Revert new GPU map logic (#3019)
Something's wrong somewhere, and there's just too many places that somewhere could be for me to debug it right now.
2025-05-31 17:35:52 +03:00
Marcin Mikołajczyk
4019319d92
Provide custom border color to samplers (#3014) 2025-05-30 12:04:31 -07:00
Marcin Mikołajczyk
790b54bf29
Misc opcodes fixes (#3009) 2025-05-29 18:51:36 -07:00
Marcin Mikołajczyk
2091bc5651
Handle R128 bit in MIMG instructions (#3010) 2025-05-29 16:56:24 -07:00
Marcin Mikołajczyk
8fffdc3918
Handle V_CVT_F64_U32 (#3008) 2025-05-29 12:20:16 -07:00
Stephen Miller
6cdc52cdde
Core: More Memory Cleanup & Fixes (#2997)
* Only perform GPU memory mapping when GPU can access it

This better aligns with hardware observations, and should also speed up unmaps and decommits, since they don't need to be compared with the GPU max address anymore.

* Reserve fixes

ReserveVirtualRange seems to follow the 0x200000000 base address like MemoryPoolReserve does.
Both also need checks in their flags Fixed path to ensure we're mapping in-bounds. If we're not in mapping to our address space, we'll end up reserving and returning the wrong address, which could lead to weird memory issues in games.

I'll need to test on real hardware to verify if such changes are appropriate.

* Better sceKernelMmap

Handles errors where we would previously throw exceptions. Also moves the file logic to MapFile, since that way all the possible errors are in one place.
Also fixes some function parameters to align with our current standards.

* Major refactor

MapDirectMemory, MapFlexibleMemory, ReserveVirtualRange, and MemoryPoolReserve all internally use mmap to perform their mappings. Naturally, this means that all functions have similar behaviors, and a lot of duplicate code.
This add necessary conditional behavior to MapMemory so MemoryPoolReserve and ReserveVirtualRange can use it, without disrupting the behavior of MapDirectMemory or MapFlexibleMemory calls.

* Accurate phys_addr for non-direct mappings

* Properly handle GPU access rights

Since my first commit restricts GPU mappings to memory areas with GPU access permissions, we also need to be updating the GPU mappings appropriately during Protect calls too.

* Update memory.cpp

* Update memory.h

* Update memory.cpp

* Update memory.cpp

* Update memory.cpp

* Revert "Update memory.cpp"

This reverts commit 2c55d014c0.

* Coalesce dmem map

Aligns with hardware observations, hopefully shouldn't break anything since nothing should change hardware-wise when release dmem calls and unmap calls are performed?
Either that or Windows breaks because Windows, will need to test.

* Implement posix_mprotect

Unity calls this
Also fixes the names of sceKernelMprotect and sceKernelMtypeprotect, though that's more of a style change and can be reverted if requested.

* Fix sceKernelSetVirtualRangeName

Partially addresses a "regression" introduced when I fixed up some asserts.
As noted in the code, this implementation is still slightly inaccurate, as handling this properly could cause regressions on Windows.

* Unconditional assert in MapFile

* Remove protect warning

This is expected behavior, shouldn't need any logging.

* Respect alignment

Forgot to properly do this when updating ReserveVirtualRange and MemoryPoolReserve

* Fix Mprotect on free memory

On real hardware, this just does nothing. If something did get protected, there's no way to query that information.
Therefore, it seems pretty safe to just behave like munmap and return size here.

* Minor tidy-up

No functional difference, but looks better.
2025-05-29 18:56:03 +03:00
georgemoralis
aca8e7e9eb
New Crowdin updates (#2982)
* New translations en_us.ts (Spanish)

* New translations en_us.ts (Spanish)

* New translations en_us.ts (Turkish)
2025-05-29 12:42:52 +03:00
Fire Cube
eb9f66c349
Libs: CompanionUtil (#2963)
* impl

* more

* move log

* cleanup type definitions

* error code cleanup and clang

* cleanup ugly RE code

* shame

* clang

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2025-05-29 12:33:56 +03:00
georgemoralis
7f0503bf8b
Implemented sceNetInetNtop in RE (#3003)
* implemented sceNetInetNtop in RE

* some logging

* added freebsd_inet_ntop4

* freebsd_inet_ntop6

* fixups based on reviews

* review fixes
2025-05-29 11:59:34 +03:00
squidbus
95f04b746d
equeue: Move small timer check to WaitForEvents. (#3000) 2025-05-28 19:54:47 +03:00
Fire Cube
e0309a4b01
Equeue: fix WaitEqueue assert on nullptr (#2994)
* fix

* fix infinite call of waitforsmalltimer

* fix wrong nullptr check

* add comment back

* fix discrepancy

* remove assert

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2025-05-27 14:47:54 -07:00
Marcin Mikołajczyk
139a253edc
Stub PM4 0x8E opcode (#2998) 2025-05-27 12:09:03 -07:00
Lander Gallastegi
99ccf56938
Fix float on f64 (#2985) 2025-05-25 03:49:39 -07:00
Fire Cube
149898193f
Devtools: Add Module Viewer (#2976)
* impl

* add User or Sysmodule detection

* fix compiler warning

* clang

* fix string

* add HLE

* prevent crash

* fix mutex

* remove ref in arg

* cleanup

* move gamefolder to elfinfo
2025-05-24 09:15:10 -03:00
Lander Gallastegi
10d09ac977
Added back the "Attempted to track non-GPU memory" assert. (#2980)
* Fix log message

* Add non-GPU memory assert back
2025-05-24 01:48:40 +03:00
squidbus
e5c6c88835
texture_cache: Handle overlap with equal address and different tiling mode (#2981) 2025-05-23 10:56:46 -07:00
Marcin Mikołajczyk
e518a7062c
Fix image extent in buffer copy to image (#2961) 2025-05-22 12:17:34 -07:00
Lander Gallastegi
f9bbde9c79
video_core: Implement DMA. (#2819)
* Import memory

* 64K pages and fix memory mapping

* Queue coverage

* Buffer syncing, faulted readback adn BDA in Buffer

* Base DMA implementation

* Preparations for implementing SPV DMA access

* Base impl (pending 16K pages and getbuffersize)

* 16K pages and stack overflow fix

* clang-format

* clang-format but for real this time

* Try to fix macOS build

* Correct decltype

* Add testing log

* Fix stride and patch phi node blocks

* No need to check if it is a deleted buffer

* Clang format once more

* Offset in bytes

* Removed host buffers (may do it in another PR)

Also some random barrier fixes

* Add IR dumping from my read-const branch

* clang-format

* Correct size insteed of end

* Fix incorrect assert

* Possible fix for NieR deadlock

* Copy to avoid deadlock

* Use 2 mutexes insteed of copy

* Attempt to range sync error

* Revert "Attempt to range sync error"

This reverts commit dd287b48682b50f215680bb0956e39c2809bf3fe.

* Fix size truncated when syncing range

And memory barrier

* Some fixes (and async testing (doesn't work))

* Use compute to parse fault buffer

* Process faults on submit

* Only sync in the first time we see a readconst

Thsi is partialy wrong. We need to save the state into the submission context itself, not the rasterizer since we can yield and process another sumission (if im not understanding wrong).

* Use spec const and 32 bit atomic

* 32 bit counter

* Fix store_index

* Better sync (WIP, breaks PR now)

* Fixes for better sync

* Better sync

* Remove memory coveragte logic

* Point sirit to upstream

* Less waiting and barriers

* Correctly checkout moltenvk

* Bring back applying pending operations in wait

* Sync the whole buffer insteed of only the range

* Implement recursive shared/scoped locks

* Iterators

* Faster syncing with ranges

* Some alignment fixes

* fixed clang format

* Fix clang-format again

* Port page_manager from readbacks-poc

* clang-format

* Defer memory protect

* Remove RENDERER_TRACE

* Experiment: only sync on first readconst

* Added profiling (will be removed)

* Don't sync entire buffers

* Added logging for testing

* Updated temporary workaround to use 4k pages

* clang.-format

* Cleanup part 1

* Make ReadConst a SPIR-V function

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2025-05-22 21:00:15 +03:00
georgemoralis
b55c3f4555
Trophy fix (#2975)
* fixed invalid handle destroy

* removed log
2025-05-22 05:35:00 -07:00
squidbus
3f949d2b6c
amdgpu: Handle 32-bit Unorm formats. (#2974) 2025-05-22 03:16:20 -07:00
squidbus
f4eb0b9b9e
shader_recompiler: Fix buffer type reading from step rate attribute. (#2973) 2025-05-22 03:03:24 -07:00
squidbus
6935b24440
savedata: Fix missing uses of config based save data dir. (#2971) 2025-05-22 11:28:41 +03:00
kalaposfos13
786ad6f71e
Fork detection fixes IIIIX (#2966)
* Fix local builds

* Add remote fork windows title to release builds too

* Remove trailing slah from remote links before processing
2025-05-21 23:00:11 +03:00
kalaposfos13
eb21083078
Lower stack size to clear from 13 to 12 KB (#2967) 2025-05-21 16:22:38 -03:00
Lander Gallastegi
1b952bf173
ReadConst debug msg (#2964) 2025-05-21 19:08:27 +03:00
georgemoralis
60224e1d22
New Crowdin updates (#2953)
* New translations en_us.ts (Portuguese)

* New translations en_us.ts (Portuguese)

* New translations en_us.ts (Albanian)

* New translations en_us.ts (Russian)

* New translations en_us.ts (Norwegian Bokmal)

* New translations en_us.ts (French)

* New translations en_us.ts (Swedish)

* New translations en_us.ts (Norwegian Bokmal)
2025-05-21 13:57:52 +03:00
squidbus
034ae8cffa
qt: Update save data dir open to use name from PSF. (#2954) 2025-05-18 13:16:31 -07:00
Vinicius Rangel
5eb58799fe
SaveData: respect install dir in param.sfo to select the game save folder (#2951) 2025-05-17 12:00:35 -03:00
georgemoralis
6ee205d4e2
New Crowdin updates (#2946)
* New translations en_us.ts (Korean)

* 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 (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 (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 (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 (Chinese Simplified)

* New translations en_us.ts (Italian)
2025-05-17 17:33:24 +03:00
Vinicius Rangel
5f447a815e
SaveDataDialog: fix possible null access (#2947) 2025-05-17 10:41:16 -03:00
tlarok
e2513d50be
New kbm icon (#2898)
* Update kbm_gui.cpp

* Update kbm_gui.cpp

* Update kbm_gui.h

* Update kbm_gui.cpp

* lunix test

* linux test

* Update kbm_gui.h

* Update kbm_gui.cpp

* Update kbm_gui.cpp

* Update kbm_gui.cpp

* Update kbm_gui.cpp

* Update kbm_gui.h

* Update kbm_gui.cpp

* Update kbm_gui.h

* Update kbm_gui.cpp

* Update kbm_gui.h

* Update kbm_gui.cpp

* kbm_gui.cpp's names fix

just cleaning my code

* name fix

* Update kbm_gui.cpp

* Update kbm_gui.h

* Update kbm_gui.cpp

* Update src/qt_gui/kbm_gui.cpp

Co-authored-by: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com>

* clean up from main

* bruh, welp here we go again

* Update KBM.png

* resize kbm.png

* Update kbm_gui.ui

* test update kbm_gui.ui

---------

Co-authored-by: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com>
2025-05-17 11:39:35 +03:00
georgemoralis
a09f7158b8
New translations en_us.ts (Korean) (#2943) 2025-05-17 11:38:38 +03:00
georgemoralis
251d0f0d7c
[ci skip] Qt GUI: Update Translation. (#2910)
Co-authored-by: georgemoralis <4313123+georgemoralis@users.noreply.github.com>
2025-05-17 11:38:04 +03:00
Stephen Miller
a0acb47185
Only align when flags Fixed is not present (#2945)
Should fix some remaining memory issues.
2025-05-16 14:21:13 -07:00
mailwl
ffd31589cf
Fix reading not existing savedata (#2941)
* Fix reading not existing savedata

* alloc save memory instead return error

* save memory saze to save slot instead of global

* remove unused enum

* remove unneeded memory clean
2025-05-16 13:22:47 -03:00
Stephen Miller
4d769d9c7e
Proper error handling for MapMemory errors (#2938)
* Properly handle ENOMEM error return in MapMemory

Needed for Assassin's Creed Unity to behave properly.

* Change error message

If I left the message as-is, we'd probably see inexperienced people claiming the assert means your device needs more memory, which is completely false.

* Clang

You know you're doing something right when Clang complains.

* Attempt to handle MemoryMapFlags::NoOverwrite

Based on my interpretation of red_prig's descriptions. These changes are untested, as I'm not able to test right now.

* Fix flag description

* Move overwrite check to while condition
2025-05-16 17:41:22 +03:00
georgemoralis
7de6aec337
[Libs] Companion httpd (#2942)
* stubbed companion httpd

* sceCompanionHttpdGetEvent returns disconnected device

* more function definations

* added error codes file
2025-05-16 16:17:37 +03:00
Stephen Miller
18ff65efc8
Implement sceKernelMapDirectMemory2 (#2940)
* Implement sceKernelMapDirectMemory2

Behaves similarly to sceKernelMapDirectMemory, but has a type parameter.

* Simplify

No need to copy all the MapDirectMemory code over, can just call the function, then do the SetDirectMemoryType call

* Clang
2025-05-16 05:38:40 -07:00
squidbus
aeb4536988
externals: Remove winpthreads. (#2932) 2025-05-15 13:59:34 -07:00
Stephen Miller
6d38100a41
Avoid logging nulls in sceKernelIsStack (#2933)
Games would crash if providing nullptr to start or end.
Also don't need the :# part when logging pointers, as they're automatically formatted.
2025-05-14 17:09:23 +03:00
squidbus
26c965cf4a equeue: Fix timer cancel error code check. 2025-05-13 17:31:23 -07:00
squidbus
99eaba7c96
liverpool: Lower SetQueueReg to warning log. (#2930) 2025-05-13 16:08:25 -07:00
squidbus
1639640902 event_flag: Lower error logs to debug. 2025-05-13 14:46:59 -07:00
Marcin Mikołajczyk
647b1d3ee4
Handle VgtStreamoutFlush event (#2929) 2025-05-13 14:34:22 -07:00
Marcin Mikołajczyk
6abda17532
Avoid post-increment of SGPR in S_*_LOAD_DWORD (#2928) 2025-05-13 14:31:14 -07:00
squidbus
3ab69e24db fix: Compiling with newer Boost 2025-05-13 14:22:44 -07:00
squidbus
073f931729 fix: PM4CmdWaitRegMem memory address 2025-05-13 14:14:11 -07:00
squidbus
0d127a82dd
equeue: Clean up timers implementation. (#2925) 2025-05-13 14:05:29 -07:00
Marcin Mikołajczyk
e5b675d607
Handle IT_WAIT_REG_MEM with Register argument (#2927) 2025-05-13 13:56:20 -07:00
Marcin Mikołajczyk
1832ec2ac2
Implement sceKernelIsStack (#2917) 2025-05-13 13:54:22 -07:00
Marcin Mikołajczyk
484fbcc320
Handle -1 as V_CMP_NE_U64 argument (#2919) 2025-05-13 13:19:56 -07:00
Fire Cube
7334fb620b
sceKernelAddTimerEvent implementation (#2906)
* implementation

* add backend (WIP)

* now should be good
- fix implementation based on homebrew tests
- demote log to debug
- make squidbus happy (hopefully)

* fix moved m_name

* fix clang

* replace existing event when its same id and filter

* run timercallback after addEvent and remove useless code

* move KernelSignalRequest to the end

* clang (i hate you)
2025-05-13 12:16:53 -07:00
georgemoralis
f97c0deea9
ngs2: removed possible nullptr value from logging (#2924) 2025-05-13 11:29:47 -07:00
squidbus
4cd13ea9d8 fix: Disable emitting bounds checks until fixed. 2025-05-12 23:10:48 -07:00
georgemoralis
e6a144ddb0
[Libs] sceNet IV (#2867)
* dummy returns in p2p sockets

* added logging for sceNetSetsockopt

* possible fix for ORBIS_NET_SO_LINGER set

* logging for getsockoption as well

* disable kernel getsockname (seems to create issues with cyberpunk)

* some fixes with SetSocketOptions

* arggg

* posix_getsockname try

* mutex protection

* removed duplicated include (diegolix29)

* posix_getsockname appears to have issues in cyberpunk , comment it for now
2025-05-13 08:54:38 +03:00
squidbus
3a10fda008 kernel: Simplify sceKernelUuidCreate 2025-05-12 22:15:04 -07:00
Roman
2a3a701115
kernel: macos/linux Implement sceKernelUuidCreate (#2923)
* kernel: macos/linux Implement sceKernelUuidCreate

* Fix clang-format

* Fix Linux build

* Fix Linux build (2)

---------

Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
2025-05-12 22:10:33 -07:00
squidbus
6bbb424c28
vk_instance: Enable robustImageAccess2 (#2922) 2025-05-12 18:03:55 -07:00
Marcin Mikołajczyk
3a3a6d8e45
Mprotect only over whole pages (#2918)
* Mprotect only over whole pages

* Fix aligned_size error and clang-format.

---------

Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
2025-05-12 16:55:19 -07:00
squidbus
b23f6fdc1d
buffer_cache: Split updateBuffer calls into 65536 byte chunks. (#2915) 2025-05-12 15:27:47 -07:00
Randomuser8219
9baa58dd92
renderer_vulkan: Properly enable dualSrcBlend feature. (#2921)
* renderer_vulkan: Properly enable dualSrcBlend feature

* whoops
2025-05-12 15:26:55 -07:00
Vinicius Rangel
5ab5fa7024
hotfix: replace memset declaration by cstring include
fixes the Arch package build (https://aur.archlinux.org/packages/shadps4-git#comment-1023984)
2025-05-12 18:35:04 -03:00
ringolol
b3abb83fc5
fix rough mouse movement due to incorrect check (#2911)
Co-authored-by: rnglol <kek@example.com>
2025-05-12 21:39:50 +02:00
squidbus
f94c7e52b7
kernel: Implement scePthreadGetaffinity (#2916) 2025-05-12 10:46:53 -07:00
squidbus
8909d9bb89
shader_recompiler: Always mark buffers as storage buffers. (#2914) 2025-05-12 10:46:40 -07:00
squidbus
678f18ddb9
core: Introduce host call wrapper. (#2913) 2025-05-11 20:27:54 -07:00
squidbus
02d3ed4973
liverpool: Log more information on SetQueueReg. (#2912) 2025-05-11 20:27:43 -07:00
Stephen Miller
6206986914
libkernel: Implement sceKernelMemoryPoolBatch (#2909)
* Implement sceKernelMemoryPoolBatch

I've tested Commit and Decommit on real hardware, haven't tested Protect or TypeProtect yet.

Implementation is primarily based on our sceKernelBatchMap implementation.

* Clang
2025-05-11 19:51:03 -07:00
squidbus
c0562a6b1b
qt: Delay physical device enumeration to settings open. (#2908) 2025-05-11 14:23:49 -07:00
squidbus
3a090e988c
kernel: Clean up and fix some mistakes. (#2907) 2025-05-11 14:22:17 -07:00
georgemoralis
ff1339b0b6
[Libs] Camera (#2902)
* stubbed camera lib

* function definations

* added error codes
2025-05-11 19:03:55 +03:00
Stephen Miller
afcf3a12a3
Core: Pooled Memory Fixes (#2895)
* Update sceKernelMemoryPoolExpand

Hardware tests show that this function is basically the same as sceKernelAllocateDirectMemory, with some minor differences.
Update the memory searching code to match my updated AllocateDirectMemory code, with appropriate error conditions.

* Update MemoryPoolReserve

Only difference between real hw and our code is behavior with addr = 0.

* Don't coalesce PoolReserved areas.

Real hardware doesn't coalesce them.

* Update PoolCommit

Plenty of edge case behaviors to handle here.
Addresses are treated as fixed, EINVAL is returned for bad mappings, name should be preserved from PoolReserving, committed areas should coalesce, reserved areas get their phys_base updated

* Formatting

* Adjust fixed PoolReserve path

Hardware tests suggest this will overwrite all VMAs in the range. Run UnmapMemoryImpl on the full area, then reserve. Same logic applies to normal reservations too.

Also adjusts logic of the non-fixed path to more closely align with hardware observations.

* Remove phys_base modifications

This can be handled later. Doing the logic properly would likely take work in MergeAdjacent, and would probably need to be applied to normal dmem mappings too.

* Use VMAHandle.Contains()

Why do extra math when we have a function specifically for this?

* Update memory.cpp

* Remove unnecessary code

Since I've removed those two asserts, these two lines of code effectively do nothing.

* Clang

* Fix names

* Fix PoolDecommit

Should fix the address space regressions in UE titles on Windows.

* Fix error log

Should make the cause of this clearer?

* Clang

* Oops

* Remove coalesce on PoolCommit

Windows makes this more difficult.

* Track pool budgets

If you try to commit more pooled memory than is allocated, PoolCommit returns ENOMEM.
Also fixes error conditions for PoolDecommit, that should return EINVAL if given an address that isn't part of the pool.

Note: Seems like the pool budget can't hit zero? I used a <= comparison based on hardware tests, otherwise we're able to make more mappings than real hardware can.
2025-05-11 02:59:14 -07:00
Stephen Miller
6ece91c763
sceKernelVirtualQuery Fixes VI (#2904)
* Reduce bitfield size

Linux compilers automatically convert this, Windows not so much.

* Static assert for VirtualQueryInfo struct size

Since compilers can be weird, having a static assert for this will be helpful.
Granted, this probably wont need changing after this PR.
2025-05-10 20:02:00 -07:00
georgemoralis
7eea1fc4d6
log error for videodec ,videodec2 (#2900) 2025-05-10 23:29:23 +03:00
Stephen Miller
6477dc4f1e
Core: Memory Fixes (#2872)
* Fix VirtualQuery behavior on low addresses.

* Fix VirtualQuery struct

Somewhere in our BitField and array use, the size of our VirtualQuery struct became larger than the struct used on real hardware.
Fixing this fixes some data corruption visible in the name parameter during my tests.

* Default name to anon

On real hardware, nameless mappings are given the name "anon:address" where address appears to be the address that made the memory call.
For simplicity sake, I'll stick to the name "anon" for now.

* Place an upper bound on returns from SearchFree

Right now, this upper bound is set based on the limitations of our GPU buffer cache and page table.
Someone with more experience in that area of code should probably fix that at some point.

* More anons

* Clang

* Fix name in sceKernelMapNamedDirectMemory

* strncpy instead of strcpy

Hardcoded the constant size for now, I need to review how real hardware behaves here to determine if anything else is necessary for this to be accurate.

* Fix name behavior

All memory naming functions restrict the name size to a 31 character limit, and return `ORBIS_KERNEL_ERROR_ENAMETOOLONG` if that limit is exceeded.
Since this value is constant for all functions involving names, I've defined it as a constant in kernel's memory.h, and used that in place of any hardcoded 32 character limits.

* Error logging

Hopefully this helps in catching the UFC regression?

* Increase address space upper bound

Probably needs heavy testing, especially on Mac/Windows.
This increases the address space, as needed to accommodate strange memory behaviors seen in UFC.

* VirtualQuery fix

Due to limitations of certain platforms, we initialize our vma_map with 3 separate free mappings.
As such, we need to use a while loop here to accurately query mappings with high addresses

* Fix mappings to high addresses

The PS4's GPU can only handle 40bit addresses. Our texture cache and buffer cache were designed around these limits, and mapping to higher addresses would cause segmentation faults and access violations.
To fix these crashes, only map to the GPU if the mapping is fully contained within the address space the GPU should access.
I'm open to suggestions on how to make this cleaner

* Revert "Increase address space upper bound"

This reverts commit 3d50eeeebb.

* Revert VirtualQuery while loop

Windows wasn't happy with this, again.
Will try to debug and properly fix this when I have a good chance.

* Fix asserts

FindVMA, due to the way it's programmed, never actually returns vma_map.end(), the furthest it ever returns is the last valid memory area. All those asserts we involving vma_map.end() never actually trigger due to this.
This commit removes redundant asserts, adds messages to asserts that were lacking them, and fixes all asserts designed to detect out of bounds memory accesses so they actually trigger.
I've also fixed some potential memory safety issues.

* Proper error behavior in QueryProtection

Might as well handle this properly while I'm here.

* Clang

* More information about ReserveVirtualRange results

Should help debug issues like the one in The Order: 1886 (CUSA00076)

* Fix assert message

* Update assert message

Extra space

* Fix my bug

Oh hey, finally something that's my fault.

* Fix rasterizer unmaps

Should use adjusted_size here, otherwise we could unmap too much.
Thanks to diegolix29 for spotting this.

* Fix edge case in MapMemory

Code comments explain everything.
This should fix some memory asserts.

* Fix fix

Avoid running the code path if it's unnecessary, since there are many additional edge cases to handle when the VMA map is small.

* Fix fix fix

Should prevent infinite loops, haven't tested properly yet though.

* Split logging for inputs and out_addr in ReserveVirtualRange

Addresses review comments.
2025-05-09 12:33:04 -07:00
squidbus
a1439b15cf
gnm: Implement sceGnmDrawIndexIndirectMulti (#2889) 2025-05-09 10:04:37 -07:00
Missake212
8d7cbf9943
Adding opcode IMAGE_SAMPLE_B_O (#2894)
* Adding opcode IMAGE_SAMPLE_B_O:

* fix clang (my first time !)
2025-05-09 09:01:34 -07:00
squidbus
b130fe6ed5
vulkan: Handle incompatible depth format using null binding. (#2892)
Co-authored-by: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com>
2025-05-09 08:43:20 -07:00
kalaposfos13
8e7c5a4d99
Remove deprecated include (#2893) 2025-05-09 08:33:32 -07:00
mailwl
46b88bd10f
[Libs] Stubs sceSigninDialog (#2890)
* [Libs] Stubs SigninDialog

* clang-format

* clang-format again

* remove magic constant

* log dialog finished status
2025-05-09 11:08:22 +03:00
Paris Oplopoios
58df609ba0
Optimize games that hit unpatchable EXTRQ/INSERTQ (#2888)
* Make signal handler faster

* I love clang-format

* Use faster decoding

* MacOS CI
2025-05-08 19:59:12 +03:00
Vinicius Rangel
3b7c36e1ba
Clear stack before executing guest code (#2877)
* Clear stack before executing guest code

* clang, don't optimize me 🚨

avoid ClearStack function being optimized in release builds
2025-05-07 15:20:55 -07:00
Fire Cube
1aa7eb8a42
add scePthreadSetaffinity and emulate affinity (#2885)
* add implementation

* fix preprocessor

* fixes squidbus's comments

* fix clang

* comment became fucked up?

* fix removed return
2025-05-07 14:50:16 -07:00
MajorP93
c7fb3ebd93
shader_recompiler: Widen num_conversion bitfield (#2886)
We do this in order to be able to actually fit in all possible values from AmdGpu::NumberConversion.

Fixes gcc compiler warnings:
warning: ‘Shader::PsColorBuffer::num_conversion’ is too small to hold all values of ‘enum class AmdGpu::NumberConversion’
2025-05-06 17:11:32 -07:00
Stephen Miller
fed064931a
Core: Fix module load addresses (#2879)
* Fix module map addresses

Most modules are mapped starting at 0x800000000, with no gaps between mappings.

* Hardcode hardware accurate base address

Looking at our address space, all platforms will have this base address mapped, so there shouldn't be any problem in using it.

* Clang

* Swap module mapping to NoFlags, remove offset code

Since real hardware has no gap between module mappings, the Fixed flag is just an annoyance to work around, and has no impact on the actual mappings.
Swapping the module mappings to use flags NoFlags instead simplifies our code slightly.

* Fix module mapping names

On real hardware, the file extension is part of the mapping name. Easiest way to manage this is to swap the name to be `file.filename().string()` instead of `file.stem().string()`

* Fix patches

Completely missed this, whoops.
2025-05-05 03:24:08 -07:00
oltolm
9a22185ab7
vulkan: do not use VK_EXT_extended_dynamic_state (#2880)
fixes Bloodborne crashing on RX 580
2025-05-04 03:11:02 -07:00
squidbus
17b6343f18
emulator: Fix log initialization order. (#2878) 2025-05-03 13:47:03 -07:00
Vinicius Rangel
d542d952f4
Savefixes VIII (#2851)
* savedata dialog: fix SaveDialogUi move semantics

fix possible dangling points

* savedata dialog: removed unnecessary firmware version checks
2025-05-03 12:51:10 -03:00
Stephen Miller
0ba9ea6a3b
Only perform early read-write open when truncating is needed (#2874)
Should stop some fs error spam when games open files from /app0, as this open call would fail from reduced permissions.
2025-05-02 11:22:05 -07:00
squidbus
eb09c4ccce
vk_presenter: Use correct format for output frame image and view. (#2871) 2025-05-01 20:10:42 -07:00
Stephen Miller
6c39bf229c
libkernel: Various filesystem fixes (#2868)
* Proper handling of whence 3 & 4

* Accurate directory handling in open

Directories can be opened, and can be created in open, these changes should handle that more accurately.

* Mount /app0 as read only

On real hardware, it's read only.

* Proper directory flag handling.

Even when directory is specified, it will still succeed to open non-directories.

* Check for read only directories

* Earlier ro check in posix_rmdir

Hardware tests suggest these checks are in a different order

* Clear temp folder on boot

My tests rely on this, and some games do too.
Two birds with one stone

* Clang

* Add missing DeleteHandle calls

Whoops

* Final flags adjustment in sceKernelOpen

All my current tests are now hardware accurate.

* Fix truncates

Host ftruncate consistently fails on EINVAL, I'll need to test if this issue affected Windows too.

* Windows hacks

Windows is more limiting about how folders are opened and things like that. For now, pretend these calls didn't error.
Also fixes compilation for Windows

* Final touch-ups

After expanding my test suite further, I found a couple more edge cases that needed addressing.
Bloodborne audio is still broken, I'll look into that soon.

* Remove hacky read-only behavior in posix_stat

Bloodborne apparently uses the mode parameter here when querying it's audio files, and the mode we returned led to it disabling audio entirely.

* Clang

* Cleaner code

* Combine fsync and sync flags

According to FreeBSD docs, the "sync" flag is synonymous with the fsync flag, and is only included to meet the POSIX spec.

* Log if any currently unhandled flags are encountered.

These are rare and probably not too important, but log a warning when they're seen.

* Update file_system.cpp

* Update file_system.cpp

* Clang

* Revert truncate fix

Using ftruncate works fine after moving the call to before the proper file opening code.

* Truncate before open

Open the file as read-write, then try truncating.
This fixes read | truncate flag behavior on Windows.

* Slightly adjust check for invalid flags

Any open call with invalid flags should return EINVAL, regardless of other errors parameters might cause.
2025-05-01 14:47:43 +03:00
Mahmoud Adel
b0e4e87ff3
Implement SnormNz conversion (#2841)
* +

* +

* Unpack Snorm 2x16

* +

* SintToSnormNz

* all is broken ig....

* review changes

* my stupid ass messed all while trying to resolve the conflicts..

* +

* +

* fix rebase

* clang-format fix (1)

* clang-format fix (2)

---------

Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
2025-05-01 02:12:15 -07:00
squidbus
4202d9d621 fix: Add missing ctime includes. 2025-04-30 23:37:37 -07:00
squidbus
5fd5b62539
shader_recompiler: Few fixes for buffer number conversions. (#2869)
* liverpool: Pass correct color buffer number type for conversion mapping.

* shader_recompiler: Apply number conversion to vertex inputs.
2025-04-30 20:46:16 -07:00
squidbus
10b24d04bc fix: Add new image atomic instructions to relevant lists. 2025-04-30 17:55:50 -07:00
anna12831920
c47d9b2ad6
Export eboot address (#2866) 2025-04-30 22:56:44 +03:00
squidbus
ede60e8f7f fix: Do not declare atomic float capability when not supported. 2025-04-30 11:43:51 -07:00
Marcin Mikołajczyk
c08f92aca1
Implement IMAGE_ATOMIC_FMIN and IMAGE_ATOMIC_FMAX for 32bit floats (#2820)
* Implement IMAGE_ATOMIC_FMIN and IMAGE_ATOMIC_FMAX for 32bit floats

* Handle missing VK_EXT_shader_atomic_float2
2025-04-30 11:42:08 -07:00
squidbus
a3bbf2274f fix: Mistake in store bounds check index. 2025-04-30 11:39:42 -07:00
georgemoralis
bb59cd81fa
[Libs] sceNet (#2815)
* implemented sceNetGetMacAddress

* added all error codes

* added ORBIS_NET_CTL_INFO_DEVICE , ORBIS_NET_CTL_INFO_MTU

* RE sceNetConnect

* sceNetBind RE

* RE sceNetAccept

* RE sceNetGetpeername ,sceNetGetsockname

* fixup

* RE sceNetListen ,sceNetSetsockopt

* sceNetShutdown,sceNetSocket,sceNetSocketAbort,sceNetSocketClose

* sceSend,sceSendTo,sceSendMsg

* sceNetRecv,sceNetRecvFrom,sceNetRecvMsg RE

* some kernel net calls

* init winsock2

* logging

* sockets interface

* added winsock to SCE* error codes conversion

* implemented net basic calls

* some net calls implementation

* clang fixes

* fixes for linux+macOS

* more fix

* added sys_accept implementation

* more posix net calls

* implemented sys_getsockname

* fixed redirection

* fixed posix socket?

* posix_sendto , recvfrom

* added sys_socketclose

* unsigned error log

* added setsocketoptions

* added more posix net calls

* implement getsocketOptions

* stubbed p2p calls
2025-04-30 17:58:39 +03:00
georgemoralis
53b2ccffca
New Crowdin updates (#2846)
* New translations en_us.ts (Vietnamese)

* New translations en_us.ts (Vietnamese)

* New translations en_us.ts (Vietnamese)

* New translations en_us.ts (Vietnamese)
2025-04-30 12:41:30 +03:00
Marcin Mikołajczyk
fa9f58446f
Implement sceKernelPwritev (#2865) 2025-04-30 02:09:40 -07:00
squidbus
5e3157a82c
vk_rasterizer: Fix updating wrong color attachment when skipped by mask. (#2859) 2025-04-29 16:29:35 -07:00
lcjh
beb9c86749
Code Review: SuspiciousPriority (#2854)
Priority of the '&&' operation is higher than that of the '||' operation.It's possible that parentheses should be used in the expression.
2025-04-28 11:27:25 -07:00
squidbus
81fa9b7fff
shader_recompiler: Add lowering pass for when 64-bit float is unsupported. (#2858)
* shader_recompiler: Add lowering pass for when 64-bit float is unsupported.

* shader_recompiler: Fix PackDouble2x32/UnpackDouble2x32 type.

* shader_recompiler: Remove extra bit cast implementations.
2025-04-28 00:04:16 -07:00
squidbus
385c5a4507 fix: Add missing OpSelectionMerge in bounds check. 2025-04-27 21:53:36 -07:00
squidbus
59d060bc16 fix: gcc compile 2025-04-27 21:06:10 -07:00
squidbus
83fd0683fa fix: Properly enable depthBounds feature. 2025-04-27 20:57:04 -07:00
squidbus
81ad31ce31
pp_pass: Use correct surface format. (#2860) 2025-04-27 20:56:17 -07:00