Libs: add libSceDiscMap HLE exports
What
Adds an HLE implementation of libSceDiscMap as a new DiscMapExports class in SharpEmu.Libs, following the existing SysAbiExport conventions (validated pointers, OrbisGen2Result codes, optional env-gated tracing).
Disc-installed titles call into libSceDiscMap on most file accesses to decide whether a read has to be redirected to the Blu-ray drive. Without these exports the imports resolve to ORBIS_GEN2_ERROR_NOT_FOUND, which titles can treat as an I/O failure. Reporting every request as already resident on internal storage keeps reads on the regular file system path.
Exports
| NID | Export | Behavior |
|---|---|---|
lbQKqsERhtE |
sceDiscMapIsRequestOnHDD |
writes 1 to the result pointer, returns 0 |
fJgP+wqifno |
sceDiscMapUnknownFJgP |
zero-fills the three output pointers, returns 0 |
ioKMruft1ek |
sceDiscMapUnknownIoKM |
zero-fills the three output pointers, returns 0 |
- Null path/output pointers return
DISC_MAP_ERROR_INVALID_ARGUMENT(0x81100001), consistent with the known0x811000xxlibSceDiscMap error range. - Unreadable/unwritable guest memory returns
ORBIS_GEN2_ERROR_MEMORY_FAULT. - Set
SHARPEMU_LOG_DISCMAP=1to trace calls (path, offset, size), matching theSHARPEMU_LOG_PTHREADSpattern. sceDiscMapIsRequestOnHDDis already inscripts/ps5_names.txt, so Aerolib resolves the name; the two unidentified NIDs keep descriptiveUnknownexport names like the existingsceKernelUnknown*entries.
Source / attribution
Behavior is ported from the LibDiscMap.cpp stubs in Kyty (MIT), rewritten in C# for SharpEmu's export model. shadPS4's HLE discmap work was used as a cross-reference for the argument layout of the two unidentified NIDs (path, offset, nbytes, three out-pointers). This PR was prepared with the help of an AI assistant; flagging that for the maintainers' awareness.
Testing
dotnet build SharpEmu.slnx— clean, 0 warnings / 0 errors (SDK 10.0.103)- Verified via a small harness against
ModuleManager.RegisterFromAssembly: all three NIDs register and dispatch,sceDiscMapIsRequestOnHDDwrites1and returns0, null-pointer calls return0x81100001, and the triple-output NIDs zero their out-params.
No existing NIDs are touched; the change is purely additive.