Files
AnyPS5/core/libs/tests/GuestOperationMode.cpp
T
Flamefusion 7b477b6d66 feat(libkernel): implement sceKernelHasTrinityMode for a base PS5
sceKernelHasTrinityMode returns 0, the answer of a base PS5, as
sceKernelIsTrinityMode already does. Two public readings of firmware
libkernel (OpenAGC for 11.60, Backport for 11.00 to 12.70) say it
compares hw.sce_main_socid with its low five bits cleared against
0x840fc0; the base PS5 SoC id recorded for sceKernelGetMainSocId,
0x840f80, fails that test. The prototype int (void) comes from the 23
calls in a UE5 title, each storing setne of the result in a guarded
static with no argument set up.

Titles import it from libkernel, but only the libkernel_sys placeholder
inventory exported it, as a throwing stub. The export moves to libkernel
next to sceKernelIsTrinityMode, and the inventory and its counts drop
the entry. guest_operation_mode checks the result.
2026-10-31 10:42:24 +05:30

23 lines
781 B
C++

#include "prx/libkernel/include/Api.hpp"
#include "prx/libc/include/general/VabiMacros.hpp"
#include <cstdlib>
#include <stdexcept>
static void Require(bool value) { if (!value) std::abort(); }
static bool Throws(int* mode, int* submode) {
try { sceKernelGetOperationMode(mode, submode); } catch (const std::invalid_argument&) { return true; }
return false;
}
int main() {
int out[4] = {-1, -1, -1, -1};
sceKernelGetOperationMode(&out[0], &out[2]);
Require(out[0] == 2 && out[1] == -1);
Require(out[2] == 0 && out[3] == -1);
int value = -1;
Require(Throws(nullptr, &value) && Throws(&value, nullptr) && Throws(nullptr, nullptr));
Require(value == -1);
Require(sceKernelIsTrinityMode() == 0);
Require(sceKernelHasTrinityMode() == 0);
}