Merge pull request #564 from Phi1ow/implement-razor-cpu

feat(razor): implement the libSceRazorCpu CPU profiler stubs
This commit is contained in:
Dean 2026-10-05 11:46:10 +13:00 committed by GitHub
commit 28e7799183
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 43 additions and 4 deletions

View File

@ -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()

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;
}

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);
}