mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 00:22:57 -05:00
Two exports were missing. System modules are linked statically, so load and unload are reference counts over the known module table, exactly like the existing sceSysmoduleLoadModuleInternalWithArg and sceSysmoduleUnloadModule: - sceSysmoduleLoadModuleInternal(uint32_t) -> increments the module's load count, returns 0 - sceSysmoduleUnloadModuleInternal(uint32_t) -> decrements it, or 0x80A90003 when the module was not loaded Unknown or zero ids throw, like the sibling internal loader. Adds a CMakeLists.txt so the library can carry its guest test. Signatures follow the public OpenOrbis SDK headers. New test core/libs/tests/GuestSysmodule.cpp loads a module twice, unloads it twice and checks the not-loaded error on a third unload; it fails without the change (the symbols are undefined) and passes with it.
26 lines
791 B
C++
26 lines
791 B
C++
#include "prx/libc/include/general/VabiMacros.hpp"
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
|
|
extern "C" {
|
|
int APS5_VABI sceSysmoduleLoadModuleInternal(std::uint32_t id);
|
|
int APS5_VABI sceSysmoduleUnloadModuleInternal(std::uint32_t id);
|
|
}
|
|
|
|
namespace {
|
|
|
|
void Require(bool value) { if (!value) std::abort(); }
|
|
|
|
constexpr std::uint32_t kFiberModuleId = 0x00000006;
|
|
constexpr int kModuleNotLoaded = static_cast<int>(0x80A90003);
|
|
|
|
}
|
|
|
|
int main() {
|
|
Require(sceSysmoduleLoadModuleInternal(kFiberModuleId) == 0);
|
|
Require(sceSysmoduleLoadModuleInternal(kFiberModuleId) == 0);
|
|
Require(sceSysmoduleUnloadModuleInternal(kFiberModuleId) == 0);
|
|
Require(sceSysmoduleUnloadModuleInternal(kFiberModuleId) == 0);
|
|
Require(sceSysmoduleUnloadModuleInternal(kFiberModuleId) == kModuleNotLoaded);
|
|
}
|