feat(libScePsml): implement the MFSR query exports #8290
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8290"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-20T09:03:58Z.
What
Real signatures and semantics for five
libScePsmlMFSR query exports, reversed from the APR-EMUfakelib/libScePsml.sprxbundled with the PPSA20397 dump, which imports three of them:scePsmlMfsrGetDispatchMfsrPacketSizeInDwords(context, out)— validates the handle and writes0x600dwords, the size the dispatch packet builders writescePsmlMfsrGetMipmapBias(context, bias, dimension)— writeslog2f(dimension / context->inputWidth) - 1.0f;CreateContext800M3_2now records the input width/height from the parameter's 16-bit pair at0x18, falling back todescriptor0 + 0x20scePsmlMfsrSelectConfig,scePsmlMfsrRequestCapture,scePsmlMfsrIsCaptureInProgress— validate the handle and return 0 (the fakelib'sRequestCaptureonly sets a once-flag and logs;IsCaptureInProgressreports no capture)Guard order from the fakelib:
0x8A810001before init,0x8A810005for a null or foreign handle (the fakelib checks a leading engine id0xA9C4/0x9231; the existing handle map plays the same role),0x8A810009for a null output pointer. TheGetDispatchMfsrPacket*builders still throw — the 0x158-byte template's packet-construction routine is not yet understood; recorded in the debt file.Tested
Extended
guest_psmlwith before-init error checks, valid-context queries (packet size0x600, mip bias0/–1for 2×/1× dimensions via both dimension paths), foreign-handle and null-output error codes;ctest -R guest_psmlpasses on Linux x86-64.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T09:04:49Z.
Progress report (
a07e985→988f98f)📈 System libraries: 60.53% (+0.07%, +5 implemented functions)
✅ 5 implemented
scePsmlMfsrGetDispatchMfsrPacketSizeInDwordsscePsmlMfsrGetMipmapBiasscePsmlMfsrIsCaptureInProgressscePsmlMfsrRequestCapturescePsmlMfsrSelectConfigImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T09:14:30Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/tests/GuestPsml.cppImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T11:32:12Z.
Thanks, the guard order and the new query results read well, and the test covers each path.
One change before merge: the new debt line in
docs/dev/debt/libScePsml_debug.mdnames the dump the fakelib came from by its title ID. The repository docs shouldn't name specific titles or title IDs. Please describe the source without the ID (for example "semantics from the APR-EMUfakelib/libScePsml.sprx") and keep the rest of the line as it is.Two small points, not blocking:
MfsrInputDimensionsreads the width atdescriptor0 + 0x20when the parameter pair at 0x18 is zero, and the debt line says that indirection is inferred. If it's wrong,GetMipmapBiasreturns a bias from unrelated bytes. Returning0x8A810005for a zero width with no fallback would fail visibly instead. Keep the fallback if you have a caller that needs it, but please say which case it serves in the debt line.FindMfsrObjectreturns the object pointer after dropping the lock, so a concurrentReleaseContexton the same handle could free it whileGetMipmapBiasreads it. Copying the two dimensions out under the lock avoids that.Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-20T12:24:48Z.
All three addressed in
9fc0c88:fakelib/libScePsml.sprx" with the rest unchanged (and trimmed to stay under the 1000-char lint).FindMfsrObjectrace: it now copies the object fields out underg_mfsrMutex(FindMfsrObject(handle, &out)); every caller — including the validate-only ones that also dereferenced->kind/->inputWidthafter the lock — works on a snapshot, so a concurrentReleaseContextcan no longer free the object mid-read.GetMipmapBiasalready returns0x8A810005when the recorded width is 0, so a wrong indirection fails there rather than producing a bias from unrelated bytes.guest_psmlpasses; conventions clean.Imported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-20T22:04:09Z.
Two entries in
docs/dev/debt/libScePsml_debug.mdthat this PR doesn't touch now contradict the new code and the new entry on line 14. CONTRIBUTING.md says "A pull request that closes a gap removes its entry, or cuts it to what is still open".Line 5 still says "The other context parameter fields (a 16-bit size pair at 0x18, two descriptor pointers at 0x20 and 0x28) are not read."
scePsmlMfsrCreateContext800M3_2now reads the pair at 0x18 throughMfsrInputDimensions. When the width there is 0, it dereferences the pointer at 0x20 and reads the width and height atdescriptor0 + 0x20and+ 0x22. The newguest_psmlcases test both paths. Someone chasing a fault inCreateContext800M3_2for a parameter with a zero pair would be told that this pointer is never read. Only the pointer at 0x28 is still unread, so I'd cut the sentence to "The descriptor pointer at 0x28 is not read." Editing that line will show the non-blockingdebt-lengthwarning, because the entry is already 1538 characters long.Line 15 still ends with "so the dispatch, mip bias and capture calls still throw".
scePsmlMfsrGetMipmapBias,scePsmlMfsrRequestCaptureandscePsmlMfsrIsCaptureInProgressno longer callNotImplemented_nid_no_patch. For example,scePsmlMfsrGetMipmapBias(context, &bias, 1920)on a context created with width 1920 returns 0 and writes-1.0f, as the new test checks. Line 14 already records that theGetDispatchMfsrPacket*calls still throw, so line 15 can end at "which AnyPS5 reports as 0".Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-21T05:22:40Z.
Both entries cut in
988f98f40c:MfsrInputDimensions, as you noted.The line-5 edit does trip the non-blocking debt-length warning as predicted; left it as the minimal correct cut rather than rewriting the whole entry.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-21T12:02:48Z.
Checked the five MFSR query exports against the diff, the guard order, the mip-bias values (3840/1920 → 0, 1920/1920 → -1) and the new
guest_psmlcases (each failed on main, where these threw); the lock-copy fix forFindMfsrObjectand the debt edits requested by @oneandonlydean and @nikowolf123 are in; merged.