* Hardcoded limit to pending flips
Real hardware has a fixed-size queue, and doesn't depend on the number of registered buffers.
While the kernel supposedly uses an array of 18 elements, my tests suggest the cap is 16 pending flips.
* Assert on trying to flip unregistered buffer
I haven't seen anything do this intentionally yet, but I do have cases where games do this unintentionally (do to unimplemented functions).
* There is a mountain of evidence suggesting that flip_arg for these functions should be a 64-bit integer.
This fixes "memory" errors in some Unity titles.
* oops
* Fix sceVideoOutGetEventData
This bug went unnoticed for a while because the selection of Unity games I had at the time didn't actually care.
This + the prior fix is needed for Unity titles.
* Improve stack clearing logic in ExecuteGuest
Added a check for fiber stacks before clearing the stack in ExecuteGuest.
That fixes Gravity Rush 2 crash on Windows.
* Refactor ExecuteGuest to simplify stack clearing logic
This enough for GR2
* Recover thread initialization in ExecuteGuest function
* Enhance null check for thread control block
* Fix condition to check tcb before clearing stack
* Don't clear events that don't need clearing
Unless the event has the clear flag, it will be returned multiple times after triggering.
* Fix event flags
As older code suggests, the PS4 kernel does append the clear flag to various event types internally. This is visible when observing the returned event data from sceKernelWaitEqueue (or kevent, if you're feeling ambitious)
Add flag is also removed from events internally.
Just a typical day of me pushing something a month ago, nobody testing/reviewing it, then finding out it's broken when that code inevitably makes it into production.
* Initial definitions
* internal__Fofind
* Libcinternal threads
fopen stores a valid pthread mutex in the FILE struct. Since this is exposed to the game/app, we need to handle this accurately.
* internal__Foprep (and various other functions called in it)
* Actual fopen implementation
At long last, an actual function I'm supposed to implement.
* fflush + compile fixes
* fseek implementation
Comes with functions fseek calls, aside from fflush which I pushed earlier.
* fread, _Frprep
Also changed some parameter names a tad to match how I named things in my decomp.
And fixed some bugs with how I was handling the weird offseted mode thing
* fclose, _Fofree
Not confident on this one, but we'll see I guess.
* Bug fixing
No more crashes at least, fread seems to be broken though.
* fopen bugfixes
Behavior now matches LLE, at least in how LLE font seems to use it.
* Fix _Frprep
Seems like everything works now?
* Logging
Probably going to need to swap lseek and read logs to debug/trace later but this is for debugging.
* Remove alignment check
Seems I must've misinterpreted some of what Ghidra spat out, since libSceNgs2 is calling with size 1, nmemb 4.
* Reduce fseek, fread logs to trace
* Clang
* twos
* Fixes
Still can't test properly, but this seems to hide system libs, which I'm pretty sure is the necessary difference here.
* Clang
* Extra export for sceKernelGetModuleInfo2
* Fix assert
Just a typical day of me pushing something a month ago, nobody testing/reviewing it, then finding out it's broken when that code inevitably makes it into production.
* Remove unreachable in posix_pthread_mutex_timedlock
It's apparently something that was added during pthreads rewrite, but the actual code for this function seems to be fully implemented?
Just a typical day of me pushing something a month ago, nobody testing/reviewing it, then finding out it's broken when that code inevitably makes it into production.
* added function parameters
* added logging
* more logging
* added error codes file
* sceNpWebApiCreateExtdPushEventFilter some re
* added np_web_api_internal
* more np_web_api_internal definations
* Initial types cleanup
* Basic library context handling.
Followed decomp closely, using standard library classes where possible to simplify code.
* Fix params to sceNpWebApiCreateContext
* Context logic fixes
* User contexts
* Clang
* sceNpWebApiVshInitialize
* Better initialization
* Request creation logic
* Some cleanup
* sceNpWebApiAbortRequest, sceNpWebApiDeleteRequest
* SendRequest functions
* formatting
* Update terminateContext and deleteUserContext
Addressing some unimplemented bits now that I have requests and user contexts here.
* Copyright
* sceNpWebApiCreateHandle, sceNpWebApiDeleteHandle, sceNpWebApiAbortHandle
also some bugfixing
* Extended push event filter
* abort handles in terminateContext
* Other push event filter types
* Register callbacks
* unregister callbacks
* oops
* One final update to deleteContext
* Logging changes
* Bug fixes
Fixes memory leaks, pretty sure these are the only places where that was an issue.
* sceNpWebApiCheckTimeout
* Handle and request timeouts
* Oops
* Push event filter parameters
Tested with Assassin's Creed Unity, seems to be correct.
* Service push event filter parameters
Tested again with Assassin's Creed Unity, seems to work fine.
Also fixed some code bugs I noticed, and removed an unnecessary part of my internal structs
* Stub implementation for createUserContextWithOnlineId
Might need a PSN check to be properly accurate, not sure.
* added sceNpWebApiGetHttpStatusCode
* opps
* opss 2
* sceNpWebApiReadData
* clang
* Fix context ids, user context ids, and request ids
Overlooked how these ids are actually calculated.
* Additional PSN checks
Seems creating any form of push event filter with an np service name fails when you're not connected to PSN.
Not sure of the actual cause yet, but given the error code, it's related to sceNpManagerIntGetUserList.
* compile fix
---------
Co-authored-by: Stephen Miller <millerste004@gmail.com>
Co-authored-by: Stephen Miller <56742918+StevenMiller123@users.noreply.github.com>
* improved sdl backend
* small cleanups
* misc
* adjustments and new definations
* cleanups
* more debuging
* rewrote sceAudioOut calls
* fixed a trace
* fixed audio3d port
* small debug fixes
* small additions
* using shared_ptr
* compile fixes
* make macOS happy
* using shared mutex
* implemented audio input backend
* fixed port construction based on decompile
* implemented partially sceAudioInGetSilentState to return correct code if mic device is null
* improved sdl volume handling
* dynamic volume update
* this one is for @UltraDaCat
---------
Co-authored-by: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com>
* Fix bug with "phys_addr_to_search" logic
By improperly updating the variable, some games would mark the same dmem area as mapped in different parts of the vma, and the dmem map wouldn't properly reflect the state of the vma's phys areas.
* Clang
* Oops
* Fixed sceCompanionUtilGetEvent stub
Previously we effectively stubbed with ORBIS_COMPANION_UTIL_INVALID_POINTER, which makes no sense and caused issues in games.
* Check for null issuer_id in libSceNpAuth's GetAuthorizationCode
Comes up in Mirror's Edge Catalyst, according to some debugging done by a community member.
Given the library didn't have any null checks for that value, this is probably allowed.
SetThreadName gets passed an std::string's c_str whose pointer gets invalidated by the assignment of g_curthread->name, resulting in broken thread names further down the line