mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-23 00:53:02 -05:00
PPSA11386 calls sceSharePlayInitialize(NULL, 0x1800) at start-up and stops on any non-zero result, so the console accepts a null heap. The library keeps no state and does not use the heap; a zero size still throws, as its error is unknown. libSceSharePlay gets its own CMakeLists for the test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
870 B
C++
32 lines
870 B
C++
#include "prx/libc/include/general/VabiMacros.hpp"
|
|
#include <cstddef>
|
|
#include <cstdlib>
|
|
#include <exception>
|
|
|
|
extern "C" {
|
|
int APS5_VABI sceSharePlayInitialize(void*, std::size_t);
|
|
int APS5_VABI sceSharePlayTerminate(void);
|
|
}
|
|
|
|
static void Require(bool value) { if (!value) std::abort(); }
|
|
|
|
template <typename TCall>
|
|
static bool Throws(TCall call) {
|
|
try {
|
|
call();
|
|
} catch (const std::exception&) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
int main() {
|
|
alignas(16) static unsigned char heap[0x1800];
|
|
Require(sceSharePlayInitialize(nullptr, sizeof(heap)) == 0);
|
|
Require(sceSharePlayTerminate() == 0);
|
|
Require(sceSharePlayInitialize(heap, sizeof(heap)) == 0);
|
|
Require(sceSharePlayTerminate() == 0);
|
|
Require(Throws([&] { sceSharePlayInitialize(heap, 0); }));
|
|
Require(Throws([&] { sceSharePlayInitialize(nullptr, 0); }));
|
|
}
|