Files
AnyPS5/core/libs/tests/GuestGameLiveStreaming.cpp
T
hypermistandClaude Opus 5.5 98e8a2b791 feat(libSceGameLiveStreaming): answer sceGameLiveStreamingGetProgramInfo with an empty program
The PS5 module returns 0x80A00002 for a null pointer and otherwise
clears the 0x134C-byte program info before filling it from the system
service. Nothing is broadcast here, so the info stays zero.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 23:06:19 +13:00

81 lines
2.4 KiB
C++

#include "prx/libc/include/general/VabiMacros.hpp"
#include <array>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <stdexcept>
struct GameLiveStreamingStatus2 {
std::int32_t userId;
bool isOnAir;
std::uint8_t align[3];
std::uint32_t spectatorCounts;
std::uint32_t textMessageCounts;
std::uint32_t commandMessageCounts;
std::uint32_t broadcastVideoResolution;
std::uint8_t reserved[48];
};
static_assert(sizeof(GameLiveStreamingStatus2) == 72);
extern "C" {
int APS5_VABI sceGameLiveStreamingInitialize(std::size_t heap_size);
int APS5_VABI sceGameLiveStreamingTerminate(void);
int APS5_VABI sceGameLiveStreamingGetCurrentStatus2(GameLiveStreamingStatus2* status);
int APS5_VABI sceGameLiveStreamingGetProgramInfo(void* info);
}
namespace {
void Require(bool value) { if (!value) std::abort(); }
constexpr std::int32_t kInvalidUserId = -1;
}
int main() {
bool threwZeroHeap = false;
try {
sceGameLiveStreamingInitialize(0);
} catch (const std::invalid_argument&) {
threwZeroHeap = true;
}
Require(threwZeroHeap);
Require(sceGameLiveStreamingInitialize(1024 * 1024) == 0);
bool threwNullStatus = false;
try {
sceGameLiveStreamingGetCurrentStatus2(nullptr);
} catch (const std::invalid_argument&) {
threwNullStatus = true;
}
Require(threwNullStatus);
GameLiveStreamingStatus2 status{};
std::memset(&status, 0x7f, sizeof(status));
Require(sceGameLiveStreamingGetCurrentStatus2(&status) == 0);
Require(status.userId == kInvalidUserId);
Require(!status.isOnAir);
Require(status.spectatorCounts == 0);
Require(status.textMessageCounts == 0);
Require(status.commandMessageCounts == 0);
Require(status.broadcastVideoResolution == 0);
for (std::uint8_t byte : status.align) {
Require(byte == 0);
}
for (std::uint8_t byte : status.reserved) {
Require(byte == 0);
}
Require(sceGameLiveStreamingGetProgramInfo(nullptr) == static_cast<int>(0x80A00002));
std::array<std::uint8_t, 0x134C + 16> programInfo{};
programInfo.fill(0x7f);
Require(sceGameLiveStreamingGetProgramInfo(programInfo.data()) == 0);
for (std::size_t i = 0; i < programInfo.size(); ++i) {
Require(programInfo[i] == (i < 0x134C ? 0 : 0x7f));
}
Require(sceGameLiveStreamingTerminate() == 0);
}