fix(libkernel): answer sceKernelGetModuleInfoFromAddr's flags and failures as measured on a PS5

Flags 1 finds any module and flags 2 only non-system ones; other flags return EINVAL instead of throwing, every failure clears the 0x1A8 bytes, and st_size is left 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
orezraeyandClaude Opus 5.5 committed 2026-10-23 11:49:24 -03:00
1 parent 4997726a5f
commit 3717573887
7 files changed
+53 -19

No files matched your search

@@ -57,11 +57,12 @@ static void CheckEachModule() {
static void CheckMatchesAddressLookup() {
ModuleInfoEx byAddress{};
byAddress.st_size = sizeof(ModuleInfoEx);
Require(sceKernelGetModuleInfoFromAddr(reinterpret_cast<std::uintptr_t>(&sceKernelGetModuleInfo), 2, &byAddress) == 0);
Require(sceKernelGetModuleInfoFromAddr(reinterpret_cast<std::uintptr_t>(&sceKernelGetModuleInfo), 1, &byAddress) == 0);
ModuleInfoEx byHandle{};
byHandle.st_size = sizeof(ModuleInfoEx);
Require(sceKernelGetModuleInfoInternal(byAddress.id, &byHandle) == 0);
Require(std::memcmp(&byHandle, &byAddress, sizeof(ModuleInfoEx)) == 0);
Require(byAddress.st_size == 0 && byHandle.st_size == sizeof(ModuleInfoEx));
Require(std::memcmp(byHandle.name, byAddress.name, sizeof(ModuleInfoEx) - offsetof(ModuleInfoEx, name)) == 0);
}
static void CheckRefusals() {