feat(razor): implement the libSceRazorCpu CPU profiler stubs

libSceRazorCpu is the CPU-side instrumentation for the Razor capture tool. AnyPS5 does not host
that tool, so the instrumentation does nothing and succeeds, which is also what shadPS4 does:

- sceRazorCpuIsCapturing -> 0 (no capture is in progress, so titles skip their profiling paths)
- sceRazorCpuJobManagerDispatch / sceRazorCpuJobManagerJob / sceRazorCpuJobManagerSequence -> 0

These only feed the profiler; they do not affect execution. Adds a CMakeLists.txt so the library
can carry its guest test.

New test core/libs/tests/GuestRazorCpu.cpp checks the four return values; it fails on main (the
functions throw) and passes with the change.
This commit is contained in:
Phi1ow
2026-10-04 23:12:52 +02:00
parent d7f0c49fdc
commit ce6b26fadb
3 changed files with 43 additions and 4 deletions
@@ -0,0 +1,20 @@
add_library(libSceRazorCpu SHARED EXCLUDE_FROM_ALL Export.cpp)
target_include_directories(libSceRazorCpu PRIVATE ${LIBS_INCLUDE_DIR})
configure_windows_unwind(libSceRazorCpu)
if(MINGW)
foreach(runtimeLinkFlag IN ITEMS -static-libgcc -static-libstdc++ -static)
string(REPLACE "${runtimeLinkFlag}" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
endforeach()
endif()
if(BUILD_TESTING)
add_test_executable(guest_razor_cpu_tests ${LIBS_INCLUDE_DIR}/tests/GuestRazorCpu.cpp)
target_include_directories(guest_razor_cpu_tests PRIVATE ${LIBS_INCLUDE_DIR})
target_link_libraries(guest_razor_cpu_tests PRIVATE libSceRazorCpu)
add_test(NAME guest_razor_cpu COMMAND guest_razor_cpu_tests)
if(WIN32)
set_tests_properties(guest_razor_cpu PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceRazorCpu>")
endif()
endif()
-4
View File
@@ -6,25 +6,21 @@
extern "C" {
uint32_t APS5_VABI sceRazorCpuIsCapturing(void) {
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceRazorCpuJobManagerDispatch(const void* args) {
(void)args;
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceRazorCpuJobManagerJob(const void* args) {
(void)args;
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceRazorCpuJobManagerSequence(const void* args) {
(void)args;
NotImplemented_nid_no_patch(__func__);
return 0;
}
+23
View File
@@ -0,0 +1,23 @@
#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);
}
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);
}