Files
AnyPS5/docs/dev/debt/libScePsml_debug.md
T
akkadbakkad89 fe38bc485d fix(libScePsml): fail MFSR init and shared-resource limits as a base console does
The firmware disassembly (the real Sony libScePsml.sprx inside PPSA20397)
shows scePsmlMfsrInit returning 0x8A810012 before touching the initialized
flag when sceKernelIsTrinityMode is 0, so on the modelled console every MFSR
call correctly stays uninitialized instead of reaching the unimplemented
dispatch path. The shared-resources pair likewise returns 0x8A81000D for
disallowed types and 0x8A810015 while a shared-resources object already
exists.
2026-10-26 00:58:27 +05:30

4.9 KiB

libScePsml_debug technical debt

Unknown function info

  • scePsmlMfsrGetSharedResourcesInitRequirement, scePsmlMfsrCreateSharedResources, scePsmlMfsrReleaseSharedResources, scePsmlMfsrGetContextBufferRequirement800M3_2, scePsmlMfsrCreateContext800M3_2, scePsmlMfsrReleaseContext (libScePsml) - verified from the firmware disassembly: resource type 0 is always allowed, types 1 and 2 need a console feature flag set during initialization (disallowed returns 0x8A81000D), and only one shared-resources object may exist at a time (a second create returns 0x8A810015). The context requirement reports four 2 MiB blocks regardless of its parameters, while the system calculation depends on the context configuration. The descriptor pointer at 0x28 is not read. Validation throws for null pointers, short block lists and foreign handles instead of reproducing the system error and fault behaviour.
  • scePsmlMfsr2Init and the other MFSR2 calls (libScePsml) - only a console without PSSR is modelled. In firmware 13.60 libScePsml.sprx (read from disassembly, not measured on a console), scePsmlMfsr2Init returns 0x8A8A0012 when sceKernelIsTrinityMode returns 0, and until Init succeeds every other MFSR2 call returns 0x8A8A0001 without touching its arguments. AnyPS5 reports 0, so Init throws only if that changes: the initialization after the check, the shared resource and context requirements, and the 0x800-dword size that GetDispatchPacketsSizeInDwords writes through its second argument are not implemented
  • scePsmlMfsrGetContextBufferRequirement1100, scePsmlMfsrCreateContext1100, scePsmlMfsrGetDispatchMfsrPacket1100 (libScePsml_debug) - argument layouts unknown; PPSA26344 imports but does not call the first two and at 0x87EFA passes (rdi, rsi=&stack, rdx) as three pointers to GetDispatchMfsrPacket1100; they return 0x8A810001 (not initialized) and the NotImplemented arm is unreachable while scePsmlMfsrInit cannot succeed on the modelled console. scePsmlMfsrCreateContext1300 and scePsmlMfsrGetDispatchMfsrPacket900, 1000 and 1300 take the same shapes (context slot and parameter; context, command buffer and parameter). PPSA08330 and PPSA03016 advance a command-buffer cursor by the scePsmlMfsrGetDispatchMfsrPacketSizeInDwords size. Firmware 13.60 copies a 0x158-byte template per variant into a shared writer that rotates eight ring slots and emits AGC packets; the 1100/1300 arguments and console errors are unverified
  • scePsmlMfsrGetDispatchMfsrPacket1000 (libScePsml) - imported by PPSA25344. libScePsml and libScePsml_debug are built from the same source
  • scePsmlMfsrCreateContext1300, scePsmlMfsrGetDispatchMfsrPacket1300 (libScePsml) - imported by PPSA28416 next to scePsmlMfsrGetContextBufferRequirement1100. The names are not in the aerolib NID list; they hash to the imported NIDs kLF7WtQ1-Dg and DDVUyPyYHTA (tools/nid_names.py)

Functional

  • scePsmlMfsrGetDispatchMfsrPacketSizeInDwords, scePsmlMfsrGetMipmapBias, scePsmlMfsrSelectConfig, scePsmlMfsrRequestCapture, scePsmlMfsrIsCaptureInProgress (libScePsml) - semantics verified against the real Sony libScePsml.sprx in PPSA20397's fakelib. Guards: 0x8A810001 uninitialized, 0x8A810005 null/foreign handle (the binary checks an engine id 0xA9C4/0x9231; our map check is the equivalent), 0x8A810009 null output. GetDispatchMfsrPacketSizeInDwords writes 0x600; GetMipmapBias(context, bias, dimension) writes log2f(dimension / context->inputWidth) - 1.0f (the binary reads the recorded width at context +0x1920), width recorded at CreateContext800M3_2 from the parameter pair at 0x18 or descriptor0 + 0x20 (zero width returns 0x8A810005). SelectConfig, IsCaptureInProgress validate then return 0; RequestCapture validates, logs a one-shot message and returns 0.
  • scePsmlMfsrInit (libScePsml) - mirrors the console library (verified from the firmware disassembly): it logs the release banner, then returns 0x8A810012 when sceKernelIsTrinityMode returns 0 — ahead of the initialized-state check, so repeated calls also return 0x8A810012 — and every later MFSR call returns 0x8A810001. On a Trinity console the real routine sets its initialized flag (a second call then returns 0x8A810002) and builds the contexts and shared resources as bookkeeping objects; AnyPS5 reports 0 for sceKernelIsTrinityMode, so Init throws if that ever changes instead of fabricating the real init path. PPSA08330 calls the setup unconditionally and only uses a context when its cached sceKernelIsTrinityMode result is set (0x3c643d, 0x567f97; otherwise it stores a -0.25 mip bias itself at 0x567fe2)