* Earlier initialization of elf info.
Everything used for elf info initialization comes from the param.sfo, so we can initialize this earlier to have this information accessible during memory init.
* Extract compiled SDK version from pubtoolinfo string
Up until now, we've been using the game's reported "firmware version" as our compiled SDK version. This behavior is inaccurate, and is something that has come up in my hardware tests before.
For the actual compiled SDK version, we should use the SDK version in the PUBTOOLINFO string of the param.sfo, only falling back on the firmware version when that the sdk_ver component isn't present.
* Store compiled SDK version in ElfInfo
* Limit address space for compiled SDK version at or above FW 3
Sony placed a hard cap at 0xfc00000000, with a slight extension for stack mappings. For now, though stack mappings aren't implemented, there's no harm in keeping a slightly extended address space (since this cap is lower than our old user max).
Limiting the max through address space is necessary for Windows due to performance issues, in the future I plan to properly implement checks in memory manager code to properly handle this behavior for all platforms.
* Use compiled SDK version for sceKernelGetCompiledSdkVersion
I think this is pretty self explanatory.
* Log SDK version
Since this value is what most internal firmware version checks are against, logging the value will help with debugging.
* Update address_space.cpp
* Update emulator.cpp
* Backwards compatible logging
Because that's apparently an issue now
* Define latest released firmware version, use that for sceKernelGetSystemSwVersion
I feel this is less hacky and error-prone than just returning the game firmware.
* sceKernelGetAllowedSdkVersionOnSystem
* sceKernelHasNeoMode
* sceKernelGetAppInfo stub
* sceKernelGetCurrentCpu
* fixups
* sceKernelGetMainSocId
Used by libSceAvPlayer to determine if console is a pro or not.
* Update process.cpp
* Set has_param_sfo to true
* Clang
* Swap write access mode for read write
Opening with access mode w will erase the opened file. We do not want this.
* Create mode
Opening with write access was previously the only way to create a file through open, so add a separate FileAccessMode that uses the write access mode to create files.
* Update file_system.cpp
Remove a hack added to posix_rename to bypass the file clearing behaviors of FileAccessMode::Write
* Check access mode in read functions
Write-only files cause the EBADF return on the various read functions. Now that we're opening files differently, properly handling this is necessary.
* Separate appends into proper modes
Fixes a potential regression from one of my prior PRs, and ensures the Write | Append flag combo also behaves properly in read-related functions.
* Move IsWriteOnly check after device/socket reads
file->f is only valid for files, so checking this before checking for sockets/devices will cause access violations.
* Fix issues
Now that Write is identical to ReadWrite, internal uses of Write need to be swapped to my new Create mode
* Fix remaining uses of FileAccessMode write to create files
Missed these before.
* Fix rebase
* Add stubbed get_authinfo (#3722)
* mostly stubbed get_authinfo
* Return value observed on console if get_authinfo was called for the current thread, esrch otherwise
---------
Co-authored-by: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com>
Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
These are used by LLE libSceVideodec.
From decompiling the two GnmDriver libraries, it seems like sceGnmDrawInitToDefaultContextStateInternalCommand inlines a call to sceGnmDrawInitToDefaultContextState, so I've replaced that with an actual call to the function for readability.
sceGnmDrawInitToDefaultContextStateInternalSize is one to one with decomp.
* buffer_cache: smaller regions
this was a change back between v0.9.0 to v0.10.0
9f37ede336
reverting the TRACKER_HIGHER_PAGE_BITS from 24 to 22 gives a notable increase to performance.
* Update region_definitions.h
updated copyright
- 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>
* 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>
* 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.
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.
* 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.
* 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