mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-08 13:50:20 +00:00
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.
28 lines
991 B
C++
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;
|
|
}
|