Files
AnyPS5/core/libs/tests/GuestBemp2sys.cpp
T
Eduardo Ruiz c3cb4d0f8e feat(libSceBemp2sys): implement the logging and memory manager configuration
Recover the 11.00 wrappers for bemp2sys_logprintf_getlevel, setfunc and setlevel and bemp2sys_memmanager_set. The host keeps a process-global log level (0 by default), log function pointer and three memory-manager pointers; setlevel accepts 0..3 with the wrapper's unsigned compare, so larger and negative values are ignored. The pointers have no consumer until the parsers are implemented, and the rest of the library keeps throwing.
2026-11-02 14:20:09 +01:00

28 lines
991 B
C++

#include "prx/libSceBemp2sys/libSceBemp2sys.hpp"
#include <cstddef>
#include <cstdlib>
static void Require(bool value) { if (!value) std::abort(); }
namespace {
void LogFunction(int, const char*) {}
void* Allocate(std::size_t) { return nullptr; }
void Deallocate(void*) {}
void* Reallocate(void*, std::size_t) { return nullptr; }
}
int main() {
Require(bemp2sys_logprintf_getlevel_nid_postfix() == 0);
bemp2sys_logprintf_setlevel_nid_postfix(3);
Require(bemp2sys_logprintf_getlevel_nid_postfix() == 3);
bemp2sys_logprintf_setlevel_nid_postfix(4);
Require(bemp2sys_logprintf_getlevel_nid_postfix() == 3);
bemp2sys_logprintf_setlevel_nid_postfix(-1);
Require(bemp2sys_logprintf_getlevel_nid_postfix() == 3);
bemp2sys_logprintf_setfunc_nid_postfix(reinterpret_cast<void*>(&LogFunction));
bemp2sys_memmanager_set_nid_postfix(reinterpret_cast<void*>(&Allocate), reinterpret_cast<void*>(&Deallocate), reinterpret_cast<void*>(&Reallocate));
return 0;
}