Commit Graph

1079 Commits

Author SHA1 Message Date
TheTurtle
d9108cd39a video_core: Rework tile manager (#3374)
* video_core: Rework detiling

* video_core: Support tiling and macrotile detiling

* clang format

* image_info: Cleanups

* resource: Revert some changes

* texture_cache: Fix small error

* image_info: Set depth flag on depth promote

* buffer_cache: Remove level check

* tile_manager: Handle case of staging buffer causing flush

* image_info: Add 2D thick array mode

* image_info: Add slices to mip size

* tile_manager: Set bank swizzle

* buffer_cache: Support image copies from DmaData

* vk_rasterizer: Accelerate trivial render target copies with compute

Before tiling PR compute image copies were done with the following sequence

vkCmdCopyImageToBuffer (in SynchronizeBufferFromImage)  -> vkCmdDispatch (copy) -> vkCmdCopyBufferToImage (in RefreshImage)

With the tiling PR it added extra tiling/detiling steps

vkCmdCopyImageToBuffer -> vkCmdDispatch (tiling) -> vkCmdDispatch (copy) -> vkCmdDispatch (detiling) -> vkCmdCopyBufferToImage

This is quite a bit of overhead for a simple image copy. This commit tries to detect trivial image copies i.e cs shaders that copy the full source image to all of the destination.
So now all this sequence is just a vkCmdCopyImage. How much it triggers depends on the guest

* texture_cache: Fix build

* image: Copy all subresources with buffer too
2025-08-08 05:27:11 -07:00
Marcin Mikołajczyk
befc5ec17b select (#3353)
* select

* select for windows

* fixed windows only function

* windows error converts

* fixed up

* fixed compile

* another implementation for windows

* draft rewrite for windows

* implementation for windows

* added some debugging info

* more debugging

* extensive log

* Windows: Add device files to output fd_sets

Cyberpunk 2077 breaks without this.
Also added some formatting changes, to bring the implementation closer to our typical coding standards.

* Clang

* Formatting + cleanup

Removed some excessive logging used for debugging, and did some cleanup on the non-Windows implementation.

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
Co-authored-by: Stephen Miller <millerste004@gmail.com>
2025-08-08 00:20:49 +03:00
Valdis Bogdāns
f9ab6c48e3 Ime fixes (#3399)
* 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`

---------

Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
2025-08-07 19:24:14 +03:00
marecl
f83619e313 Fixed green artifacts in movies/animations (ffmpeg) (#3398)
* Fixed green artifacts in movies/animations (ffmpeg)

* cleanup&clang

* Avoid for-loop when source and target widths are equal
2025-08-06 22:08:59 +03:00
kalaposfos13
5b46216bae Make libSceRtc fully HLE (#3330)
* Add stubbed libkernel time functions

* Implement remaining stubbed Rtc functions

* Move Rtc from the optionally HLE loading part to the always loaded part

* Remove Rtc from the README list of LLE modules

* Mfw last second hotfix I noticed while double checking that everything's good before opening the PR
2025-08-06 20:08:26 +03:00
Marcin Mikołajczyk
2f701311f2 Sockets fixes (#3392)
* Print errnos as decimal

* SetSocketOptions: prevent setting SO_TYPE

* Extract net error handler

* Change the local IP retrieval method

* Fix windows
2025-08-06 08:00:29 +03:00
Stephen Miller
074dfe2571 Update file_system.cpp (#3388) 2025-08-05 19:58:23 +03:00
Valdis Bogdāns
7dd64f889f FF9 ImeDialog Hotfix (#3386)
* 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.

---------

Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
2025-08-05 19:57:31 +03:00
Stephen Miller
7ec3a38b89 libSceAppContent: Use last 16 characters of DLC folder to determine entitlement label (#3375)
* Use last 16 characters of DLC folder name to determine entitlement label

Code comments and commit name say it all.

* Clang

* Adjust comment

ftpdump appends -ac at the end of the entitlement label, so my comment was partially incorrect.
2025-08-05 11:52:53 +03:00
psucien
afb9e220aa libkernel: more network functions for OpenOrbis compatibility (#3373) 2025-08-05 11:25:18 +03:00
Vinicius Rangel
0044a27c1f Simple IPC for external control (#3345)
* add simple IPC protocol

to allow communication via stdin/stdout

* ipc: add PATCH_MEMORY command

enables patches & cheates
2025-08-04 20:32:50 -03:00
Marcin Mikołajczyk
77410fd228 Stub remaining netctl properties (#3385) 2025-08-04 23:20:39 +03:00
Marcin Mikołajczyk
b53bda852d Fix get/setsockopt levels (#3384) 2025-08-04 22:48:56 +03:00
Valdis Bogdāns
012b01d81f Another ImeDialog hotfix (#3371)
* 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

---------

Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
2025-08-03 12:51:26 +03:00
rainmakerv2
c7f1c66b82 Qt: add customizable controller hotkeys (#3369)
* customizable controller hotkeys - initial

* Update input_handler.h
2025-08-03 11:59:12 +03:00
kalaposfos13
a362f20dae Implement ORBIS_NET_CTL_INFO_HTTP_PROXY_CONFIG (#3366) 2025-08-03 11:15:13 +03:00
Valdis Bogdāns
1e7c4bb69c ime-changes (#3348)
* 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

---------

Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
2025-07-31 12:24:36 +03:00
Marcin Mikołajczyk
78936f31fc sys_getpeername (#3354) 2025-07-31 00:28:09 +03:00
Stephen Miller
6c34b86add Net: Fix various socket-related issues (#3347)
* Store platform-specific level in a separate variable

So the level logged in the getsockopt/setsockopt unreachable is actually useful in cases where the level is unknown.

* Define ORBIS_NET_IPPROTO_IPV6

Not implemented yet, but since it's known we might as well add it.

* Fix error codes

Our libSceNet code expects accurate ORBIS_NET_E* errors, while the sys_net code returns ORBIS_NET_ERROR_* errors.

* Remove duplicate getsockname implementation

* Use separate mutex for ReceivePacket calls

Calls to ReceivePacket shouldn't block other socket functions, and allowing them to block these functions frequently causes deadlocks in games that use multiple threads for socket behaviors.
That said, concurrent receives are still a potential issue, so the function should still have a mutex.

* Add missing error codes

* Clang

* Minor nit

Not sure why these were left separate from the rest of the net errnos

* Set __Error() in ConvertReturnErrorCode

Because the new error values are positive, the logic of "negative return is an error" doesn't work anymore. The easiest fix, while retaining corrected error values, is to just set __Error() in ConvertReturnErrorCode, and have that return -1 instead.
I also added some formatting fixes here too.

* Set errno on stubbed P2P socket error returns.

Otherwise the errno is just whatever was set by a previous failing function, which may cause issues in some games.
I used EAGAIN here since it appears to be valid for all three of these functions, but this can be changed if requested.

* Fix missed error returns

* Fix socket methods in file_system

Missed these
2025-07-30 21:54:28 +03:00
Marcin Mikołajczyk
26a92d97fa Sockets are now files (#3319)
* Socket support for read/write/fstat

* Sockets are now files

* Fix ssize_t for windows

* Return posix error codes in net functions
2025-07-29 00:20:10 +03:00
kalaposfos13
968cfe1180 Reset orientation on scePadOpen call (#3341) 2025-07-28 00:27:49 -07:00
georgemoralis
df85efde7c fixed RetrieveNetmask for windows (#3338)
* fixed RetrieveNetmask for windows

* clang..
2025-07-27 19:14:11 +03:00
Marcin Mikołajczyk
ee3816ffd6 Fix sceAudioOutOutputs (#3335) 2025-07-26 16:05:01 -07:00
DanielSvoboda
2e237051e3 scePadResetOrientation (#3332) 2025-07-26 15:48:30 -07:00
Marcin Mikołajczyk
c863b350b2 Return an error before a pad is opened (#3323) 2025-07-25 16:23:57 -07:00
Marcin Mikołajczyk
446426224e Return the number of samples enqueued in AudioOut (#3324) 2025-07-25 16:23:10 -07:00
Stephen Miller
90705cbe51 Return error if dmem query address is too high (#3325)
Also adjusts the log message to align with how we log error returns in sceKernelVirtualQuery.
2025-07-25 21:40:14 +03:00
Marcin Mikołajczyk
8b1b0fa0dc Implement simple DNS name resolution (#3318)
* Implement simple DNS name resolution

* Remove conversion of getaddrinfo errors to string

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2025-07-25 19:05:28 +03:00
Marcin Mikołajczyk
d46792da94 Extract netmask and default gateway from host system (#3294)
* Retrieve correct netmask in netctl

* Retrieve correct default route in netctl (Linux)

* Retrieve default gateway on mac

* added default gateway for windows

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2025-07-25 13:20:23 +03:00
Marcin Mikołajczyk
61ce393673 inet_ntop and inet_pton (#3317) 2025-07-25 09:53:41 +03:00
Valdis Bogdāns
7ef0cc0698 ime-fixes-hotfix (#3304)
* ime-fixes-hotfix
- Fixed incorrect validation of internal errors causing the keyboard GUI to not close on call to sceImeClose.
- Removed nonstop spam when ImeDialog is opened.
- Fixed text and data decoding for logs.
- Fixed incorrect validation of internal errors in sceImeKeyboardClose.
- Added partial implementation of sceImeKeyboardGetResourceId (always returns that the USB keyboard is disconnected); used in CUSA33782.

* fix clang in ime.cpp

* Update ime_dialog.cpp

Remove unnecessary Log spam

* Update ime.cpp

- use brackets for loops
- removed duplicated Log

* Update ime_dialog_ui.cpp

- fixed comment style code removal

* Update ime.cpp

- more brackets

---------

Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
2025-07-24 13:20:39 +03:00
Marcin Mikołajczyk
539b1b91a8 Define NetEpoll structures (#3311) 2025-07-24 10:57:55 +03:00
Marcin Mikołajczyk
fb5ac912cd Wiring misc functions (#3293)
* Register some posix functions

* Stub sceKernelIsAddressSanitizerEnabled

* Wire more pthread_attr functions

* Register sys_getsockopt to libScePosix

* Register sys_getpeername to libScePosix

* getpid() returns tid now

* Log sceKernelIsAddressSanitizerEnabled
2025-07-24 00:34:13 +03:00
Marcin Mikołajczyk
824d332d0f Setsockopt fixes (#3308)
* setsockopt: return correct error values for EPROCUNAVAIL

* setsockopt: handle SO_CONNECTTIMEO
2025-07-23 21:34:25 +03:00
Marcin Mikołajczyk
8dc50ffc79 Ssl stub (#3307)
* Correctly return zero root CA certs

* Stub sceHttpsGetCaList
2025-07-23 20:34:07 +03:00
Marcin Mikołajczyk
ea37ea11fc Network config (#3292)
* Config entry isConnectedToNetwork

* Respect Config::isConnectedToNetwork when returning connection state

* Return connection status in NetCtlGetInfo

* Print connection data in log
2025-07-23 20:07:42 +03:00
georgemoralis
0ad7fcb341 Microphone support (#3228)
* initial drafts

* initial implementation

* clang+reuse

* restore main

* improved AudioInInput

* fix microphone

* +

* +

* adds microphone selection to the interface

* added squidbus review fixes

* Update src/core/libraries/audio/audioin.cpp

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

* Update src/core/libraries/audio/audioin.cpp

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

* Increased entries in config.cpp

---------

Co-authored-by: DanielSvoboda <daniel.svoboda@hotmail.com>
Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
2025-07-23 06:54:18 +03:00
georgemoralis
14ef56d148 clang fix 2025-07-23 00:11:09 +03:00
Valdis Bogdāns
637e503685 Ime fixes (#3288)
* - typo fix
- added validations for sceImeKeyboardOpen/Close
- fixed mistakes in logs
- additional  log spam for debuging

* Disable user id validation

Disable user id validation until user manager is ready.

---------

Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
2025-07-22 11:27:02 +03:00
rainmakerv2
1fc9eedbab Add default trophy sound (#3271)
* Add default trophy sound

* delete include to removed folder

* remove redundant conditions

* Change trophy sound - credit to Tlarok
2025-07-22 00:52:20 +03:00
kalaposfos13
95a386308a Implement sceKernelError (#3282)
* Implement sceKernelError

* Oh come on
2025-07-20 22:52:44 +03:00
Randomuser8219
0706223aaf Small typo fix for avplayer assert (#3283)
Found that this assert message was typoed when running Knack 2 through a debugger.
2025-07-20 22:52:31 +03:00
Marcin Mikołajczyk
fd03fe2b5a Register posix_rename (#3281) 2025-07-20 22:07:37 +03:00
kalaposfos13
f0cd981548 Implement sceAudioOutGetLastOutputTime (#3279)
* Implement sceAudioOutGetLastOutputTime

* Error returns

* Logging
2025-07-20 21:15:16 +03:00
Valdis Bogdāns
af67473de3 Ime lib fixes (#3244)
* IME fixes

- Moved enums, flags, and structs to ime_common.h to simplify usage with Ime and ImeDialog
- Updated Ime to use an enum as the return type, consistent with ImeDialog
- Removed duplicate definition of OrbisImeKeycode
- Added OrbisImeLanguage as a flags enum
- Added missing options to OrbisImeOption
- Removed OrbisImeDialogOption; OrbisImeOption should be used instead
- Added OrbisImeTextAreaMode
- Updated OrbisImeTextAreaMode
- Fixed OrbisImeEventParam by adding the missing member OrbisImePanelType panel_type
- Updated the sceImeOpen declaration to use extended parameters (not yet implemented)
-Fixed Diablo III (CUSA00434) assertion failure on ImeDialog initialization

* Ime lib fixes
- Updated functions to consistently use the Error enum type for return values.
- Added detailed logging to aid future IME/OSK development and debugging.
- Now use OrbisUserServiceUserId (s32) and OrbisImeKeycodeState in relevant functions and structs.
- Introduced a generic template method to generate full bitmasks for all Orbis flag-style enums, simplifying validation and mask creation.
- Implemented additional parameter validations in sceImeOpen.
- Added missing enums: OrbisDisableDevice, OrbisImeInputMethodState, OrbisImeInitExtKeyboardMode, OrbisImeKeycodeState, and other USB keyboard-related enums.
- Fixed incorrect usage of format specifiers in calls to logging macros (LOG_*).

* Data Type Fixes

- Replaced the use of the type alias OrbisUserServiceUserId = s32 with Libraries::UserService::OrbisUserServiceUserId directly.

* Fixed IDE warnings
- generate_full_mask now returns const instead of constexpr.
- Added argument list to std::unique_lock<std::mutex> construction for clarity.

* Clang fixes

* Removed unneccessary comment

---------

Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
2025-07-18 12:40:05 +03:00
UltraDaCat
fafd3fb564 Volume slider that adjusts how loud games are on a global level (#3240)
* Update config.cpp

* Update config.h

* Update sdl_audio.cpp

* Update settings_dialog.cpp

* Update settings_dialog.h

* Update settings_dialog.ui

* Update gui_settings.h

* Update audioout.cpp

* Update audioout.h

* Update settings_dialog.cpp

* remove leftover settings_dialog.ui

* Update settings_dialog.ui

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2025-07-18 11:20:05 +03:00
kalaposfos13
fddded8d20 Add an unreachable on hitting ud2 instead of getting stuck in an infinite loop (#3257)
* Add an unreachable on hitting ud2 instead of getting stuck in an infinite loop

* Add [[unlikely]] to get ahead of the inevitable PR review comment
2025-07-16 18:06:58 +03:00
Stephen Miller
aeab525a7f Fix create flag handling in open (#3255)
If the create flag is specified, but the file already exists, then the file should open successfully, regardless of permissions.
This fixes a crash seen in Phantasy Star Online 2 New Genesis (CUSA29813)
2025-07-16 12:30:20 +03:00
kalaposfos13
499451bb80 Standardize RegisterLib names for HLE libraries (#3234) 2025-07-16 12:23:03 +03:00
Stephen Miller
bf623d4f85 Libraries: Implement sceAudio3dTerminate (#3247)
* sceAudio3dTerminate

My First Gran Turismo® (CUSA49696) uses this while initializing it's audio system. Without it, the game spams errored sceAudio3dInitialize calls.

* Properly close AudioOut handle

Based on library decompilation.
2025-07-15 15:48:05 +03:00