Files
AnyPS5/core/libs/tests/GuestRazorCpu.cpp
T
screammandClaude Fable 5.1 4ab6a047f6 feat(libSceRazorCpu): implement sceRazorCpuSync
PRAGMATA (PPSA02530) imports sceRazorCpuSync (NID Ax7NjOzctIM), which no
library exports on main, so the load fails on the unresolved import. The
title calls it after sceConvertKeycodeGetCharacter. From #3043 (comment
6106731532): "`sceRazorCpuSync`: answering 0 and doing nothing was
enough to carry on (the other `sceRazorCpu*` calls in `main` are no-ops
without a capture)."

SharpProspero src/SharpProspero/Interop/Debug/RazorCpu.cs:119-122
(5dfdb4b0b166e83dc9ae275001afb695f12c7174, GPL-3.0, used as a source of
facts) gives int sceRazorCpuSync(void), an unnamed frame-boundary event.
Without a capture there is no event to record, so it returns 0 and does
nothing, like the other sceRazorCpu markers here and the shadPS4 stub
(razor_cpu.cpp:143, 3a9f57265d28975658f1ca941daa5c879c7a74bd). The NID
hashes from the name and is in aerolib. Unverified points are in
TechnicalDebt.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-12 21:58:39 +02:00

49 lines
2.1 KiB
C++

#include "prx/libc/include/general/VabiMacros.hpp"
#include <cstdint>
#include <cstdlib>
extern "C" {
std::uint32_t APS5_VABI sceRazorCpuIsCapturing(void);
int APS5_VABI sceRazorCpuJobManagerDispatch(const void* args);
int APS5_VABI sceRazorCpuJobManagerJob(const void* args);
int APS5_VABI sceRazorCpuJobManagerSequence(const void* args);
int APS5_VABI sceRazorCpuPushMarker(const char* label, std::uint32_t color, std::uint32_t flags);
int APS5_VABI sceRazorCpuPushMarkerStatic(const char* name, std::uint32_t color, std::uint32_t flags);
int APS5_VABI sceRazorCpuPopMarker(void);
int APS5_VABI sceRazorCpuFlushOccurred(std::uint64_t* timeSpentInFlush);
int APS5_VABI sceRazorCpuPlotValue(const char* series, float value);
int APS5_VABI sceRazorCpuWriteBookmark(const char* label, const char* description);
int APS5_VABI sceRazorCpuSync(void);
}
namespace {
void Require(bool value) { if (!value) std::abort(); }
}
int main() {
Require(sceRazorCpuIsCapturing() == 0);
Require(sceRazorCpuJobManagerDispatch(nullptr) == 0);
Require(sceRazorCpuJobManagerJob(nullptr) == 0);
Require(sceRazorCpuJobManagerSequence(nullptr) == 0);
Require(sceRazorCpuPushMarkerStatic("outer", 0x80ffffffu, 2) == 0);
Require(sceRazorCpuPushMarkerStatic("inner", 0x80ffffffu, 2) == 0);
Require(sceRazorCpuPopMarker() == 0);
Require(sceRazorCpuPopMarker() == 0);
Require(sceRazorCpuPushMarker("copied", 0xff00ff00u, 1) == 0);
Require(sceRazorCpuPopMarker() == 0);
Require(sceRazorCpuPushMarkerStatic("unbalanced", 0x80ffffffu, 2) == 0);
Require(sceRazorCpuIsCapturing() == 0);
std::uint64_t timeSpentInFlush = 0x123456789abcdef0ull;
Require(sceRazorCpuFlushOccurred(&timeSpentInFlush) == 0);
Require(timeSpentInFlush == 0);
Require(sceRazorCpuFlushOccurred(nullptr) == 0);
Require(sceRazorCpuPlotValue("read time (ms)", 1.5f) == 0);
Require(sceRazorCpuWriteBookmark("read timeout", "lba=0x10") == 0);
Require(sceRazorCpuWriteBookmark("read timeout", nullptr) == 0);
Require(sceRazorCpuSync() == 0);
Require(sceRazorCpuSync() == 0);
Require(sceRazorCpuIsCapturing() == 0);
}