Skip to content

feat(libSceDiscMap): report no disc bitmap from the two disc map queries - #6527

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
SandstromPL:feat/libscediscmap
Oct 19, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
SandstromPL:feat/libscediscmap

Conversation

@SandstromPL

Copy link
Copy Markdown
Contributor

What

Until Dawn (CUSA02636) bundles libSceFios2.prx (01.00), which imports two functions from the system library libSceDiscMap.prx. SuperCatElvis reported the stop on #3093, on an earlier Windows checkout (#3141, #3142 and local changes): "The EXE then starts and stops at load on libSceDiscMap.prx, imported by the bundled libSceFios2.prx (NIDs ioKMruft1ek, lbQKqsERhtE)". No log line was posted. AnyPS5 has no libSceDiscMap; the only mention on main is the sysmodule table entry 0xd7.

Bloodborne bundles an old libSceFios2.prx too, and it imports the same two NIDs and no other libSceDiscMap function:

Why the missing library matters. As for #4960, every module in sce_module is converted and loaded at start-up. Each module's DT_NEEDED goes into the converted executable's host libraries (GuestModuleBuilder.cpp L301-L304), so libSceDiscMap.prx is needed at start-up.

On Linux, it becomes a DT_NEEDED entry of the executable (L312), found through the run path $ORIGIN/libs, on main and with #6381 alike.

On Windows, what the start-up stub (WindowsEntryStubBuilder.cpp) does with a missing file depends on whether the imports name their library. I read both cases from the stub; I didn't run them.

Is it a system library? Yes. Titles ship libSceFios2.prx in sce_module. SuperCatElvis's CUSA02636 01.00 has libc.prx and libSceFios2.prx there (comment). The console provides libSceDiscMap.prx in system/common/lib (ps4libdoc 9.00), and the sysmodule table lists it as module 0xd7.

Change. New system library core/libs/prx/libSceDiscMap, with the two functions:

NID Name Signature
lbQKqsERhtE sceDiscMapIsRequestOnHDD (const char* path, int64 offset, int64 size, int32* result)
ioKMruft1ek no known name (sceDiscMapUnknown_ioKMruft1ek, exported with APS5_EXPORT) (const char* path, int64 offset, int64 size, void* flags, void* out1, void* out2)

Both return SCE_DISC_MAP_ERROR_NO_BITMAP_INFO (0x81100004) and write nothing. That is what the console library appears to return before it is initialised:

  • shadPS4 returns it from both (disc_map.cpp L16-L18, L28-L31), since shadps4-emu/shadPS4#2686. That PR reads the console library in Ghidra as checking an initialisation global first in every call, and returning this error while the global is clear. It judges returning the error safe "since it is likely the same we do when we load this lib lle".
  • fpPS4 returns it from both, with its writes to the outputs commented out (ps4_libscediscmap.pas L24-L36). The two agree on the value (shadPS4 disc_map_codes.h, fpPS4 L15-L19).
  • With this stub and the title's own libSceFios2.prx, shadPS4 lists CUSA02636 as in-game on Linux (shadps4-game-compatibility#617).
  • Kyty returns 0 from both and writes nothing. sharpemu checks the pointers, writes 1 to sceDiscMapIsRequestOnHDD's result and 64-bit zeros to all three ioKMruft1ek outputs, and returns 0. I found no title evidence for either.

Neither function throws, ioKMruft1ek included. #2686 reads every console libSceDiscMap call as returning this error while the library is uninitialised, and in that state nothing is written. So the unknown widths of ioKMruft1ek's outputs (shadPS4 int*, fpPS4 PInt64) don't matter here; they are void* and never written.

Not added: the other libSceDiscMap NIDs. No title reported here imports them; Bloodborne's Fios2 also imports only these two. A title that does import one fails at start-up with a clear error.

  • fJgP+wqifno is the likely next one: by firmware 3.55 the system libSceFios2 imports it instead of ioKMruft1ek, so a title that bundles a newer libSceFios2.prx will need it. ps4libdoc's 3.00 Fios2 imports ioKMruft1ek and its 3.55 Fios2 imports fJgP+wqifno; it has no dump in between.
  • fl1eoDnwQ4s (sceDiscMapGetPackageSize) and 5+vOlukvkfg.

Listed as silent stubs. Both functions are listed under Silent stubs in the new docs/dev/debt/libSceDiscMap.md. CONTRIBUTING allows a silent stub only when it only affects the UI, and this one doesn't: its caller is Fios2, the title's file I/O library.

  • The listing follows other non-UI silent stubs merged after that rule: the no-device paths of libSceMbus and libSceBluetoothHid, and libSceTextToSpeech2 with no speech engine.
  • The host has no disc bitmap, so only the console's no-bitmap state is implemented. Like libSceTextToSpeech2, both functions return an error rather than success: the library's own error for a missing bitmap.
  • What CUSA02636's libSceFios2.prx does with that error wasn't seen here. shadPS4 returns the same error to the same module, and the title is in-game there (test(agc): discard the results of recompiles expected to be refused #617, above).
  • The signatures and the console behaviour are under Unknown function info; nothing here was measured on a console.

Tested

Ubuntu 24.04, GCC 13.3, Release with BUILD_TESTING=ON, on main 92e5041. Locally the libusb submodule isn't checked out, so I removed its two lines from CMakeLists.txt.

New guest_disc_map (core/libs/tests/GuestDiscMap.cpp, registered from the library's CMakeLists.txt as for libSceMbus) calls both functions with sentinel outputs. It requires 0x81100004 from each and every output unchanged.

  • On main it does not build: nothing defines either function.
  • With the change it passes, 5 runs out of 5.
  • It fails if either function returns 0, if sceDiscMapIsRequestOnHDD writes 1 to its result, or if ioKMruft1ek writes a 32-bit or 64-bit zero to any output.

Full ctest on the RTX 3050 Ti: 1,259 of 1,264 pass.

  • 12 tests skip themselves: agc_driver_stencil_ref_export on this GPU, and the VideoOut flip and frame-dump tests, which need a display.
  • patched_libraries and guest_usbd are Not Run, because the libusb submodule isn't checked out. So I patched libSceDiscMap.prx by hand with the build's nid_patcher command.
  • Three tests fail, in code this branch does not change; none of their binaries loads libSceDiscMap.prx:
    • agc_pending_key_stores fails on main since perf(agc): clear a register fast clear without waiting for a known key store #6247.
    • agc_driver_store_over_untracked fails at store over untracked: the result did not reach a block the CPU left alone. adriadam10 also sees it fail intermittently with main's code (#5815, #5750).
    • video_out_hdr_present fails at SDR presentation of the DCC-cleared PQ buffer at 437 nits (clear value conversion) has no frame dump within one level of the CPU conversion, 4 runs out of 4. It passed in my first full run on main ff23657, before the rebase, so something in main since then or this host is the cause; I haven't looked further.

nm -D on the NID-patched libSceDiscMap.prx lists lbQKqsERhtE and ioKMruft1ek, and rYeuVKb2RZQ, the NID of the C name sceDiscMapUnknown_ioKMruft1ek (libScePad's unnamed exports get the same).

  • Not run on the game here; we have no game files. The stop is SuperCatElvis's.
  • Merges: no open PR touches these four new files.
  • tools/check_conventions.py from main passes with this title and body.

@SuperCatElvis, if you can, could you swap this in for your local state and check that the start-up gets past libSceDiscMap.prx? The exact start-up line from your earlier run would help too.

Checklist

🤖 Generated with Claude Code

Until Dawn (CUSA02636) bundles a libSceFios2.prx that imports two
libSceDiscMap functions, sceDiscMapIsRequestOnHDD (lbQKqsERhtE) and
ioKMruft1ek, and no host library exported them.

Both now return SCE_DISC_MAP_ERROR_NO_BITMAP_INFO (0x81100004) and
write nothing, as shadPS4 and fpPS4 do. That is the error the console
library returns while it has no disc bitmap loaded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Progress report (44df216 → 716d811)

➖ System libraries: 88.8% (+0.0%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceDiscMap sceDiscMapIsRequestOnHDD
libSceDiscMap sceDiscMapUnknown_ioKMruft1ek
⚪ 2 behaviourally empty (constant return or throw)
Library Name
libSceDiscMap sceDiscMapIsRequestOnHDD
libSceDiscMap sceDiscMapUnknown_ioKMruft1ek

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6977 sceDiscMapIsRequestOnHDD
sceDiscMapUnknown_ioKMruft1ek
core/libs/prx/libSceDiscMap/CMakeLists.txt
core/libs/prx/libSceDiscMap/Export.cpp
core/libs/tests/GuestDiscMap.cpp
docs/dev/debt/libSceDiscMap.md

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.

Pull request Shared files not compared
PR 6977 core/libs/prx/libSceDiscMap/CMakeLists.txt
core/libs/prx/libSceDiscMap/Export.cpp
core/libs/tests/GuestDiscMap.cpp
docs/dev/debt/libSceDiscMap.md

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 18, 2026
@adriadam10 adriadam10 self-assigned this Oct 19, 2026
@adriadam10
adriadam10 merged commit d72c9e3 into boykopovar:main Oct 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs prx unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants