Files
AnyPS5/core/libs/tests/GuestSharePlay.cpp
T
Jan ŠléglandClaude Opus 5.5 60148c0e96 fix(libSceSharePlay): accept a null heap in sceSharePlayInitialize
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>
2026-10-10 20:38:56 +02:00

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