Docs: One HLE entry per function, other firmwares' NIDs go in hleKernelNids

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-25 11:38:51 +01:00
1 parent 2c0b9dbc4c
commit b1401dcbf6
2 files changed
+9 -1

No files matched your search

+2 -1
View File
@@ -262,7 +262,8 @@ writing BMPs (and when reading BMP references). `TranslateDebugBufferToCompare`
HLE module implementations live in `Core/HLE/sce<ModuleName>.cpp` / `.h`, as a `const HLEFunction
<name>[]` table registered via `RegisterHLEModule()`. Both the function table and the `Register_*()`
calls are append-only - see Core Safety Checks above, which is what breaks old savestates silently
if ignored.
if ignored. A kernel/driver function whose NID differs between firmware versions gets one entry
(the 6.60 NID) plus a row in `hleKernelNids` in `HLETables.cpp`, never one duplicate entry per NID.
Also: a new `.cpp`/`.c` file has to be added to **seven** build files (CMake, Core.vcxproj + filters,
the two UWP projects, `android/jni/Android.mk`, `libretro/Makefile.common`); headers to the first five.
+7
View File
@@ -17,6 +17,13 @@ small examples to copy from). A module is a `const HLEFunction <name>[]` table o
`I` = s64, `v` = void.
- For functions of genuinely unknown purpose (only known by NID), name them `<moduleName>_<NID>` and stub them with
`return hleLogError(Log::HLE, 0, "UNIMPL");` - an established pattern (see `scePauth.cpp`, `sceOpenPSID.cpp`).
- **A function with a different NID in each firmware version gets one table entry, with the 6.60/6.61 NID.**
Kernel and driver NIDs were renumbered at several releases, so an XMB or firmware module from another version
imports the same function under another NID. Don't add a duplicate table entry per NID: put a row in
`hleKernelNids` in `Core/HLE/HLETables.cpp`, which `GetHLENidAlias()` uses to map each generation's NID to the
first column when an import is resolved. To find a function's NID in each version, disassemble the exporting
module from each firmware dump (`--re-module`, see [reverse-engineering.md](reverse-engineering.md)) and match the
function by its body. A full set of dumps is in `D:\PSP ISO\FirmwareVersions` on the main dev machine.
- **New modules must be registered at the very end** of the registration function in `Core/HLE/HLETables.cpp` (look for
the `// add new modules here.` comment near the end of that function) - not inserted alphabetically/logically among
the existing `Register_*()` calls. Module registration order affects numeric IDs used in savestates, so inserting a