Files
AnyPS5/core/libs/tests/GuestPlayGo.cpp
T
Cesar RodriguezandClaude Opus 5.5 082177e1b7 fix(libScePlayGo): accept chunk ids when the dump has no chunk definitions
PS5 dumps carry no playgo-chunkdefs.xml (only sce_sys/playgo-scenario.json, which
lists no chunks), so the valid set fell back to chunk 0 and every query for another
chunk returned SCE_PLAYGO_ERROR_BAD_CHUNK_ID. A title that asks for all of its chunks
in one scePlayGoGetLocus call then never sees them as installed and waits forever.

Without definitions the chunk table is unknown and a dump is fully installed, so any
chunk id is accepted and reported as local. With playgo-chunkdefs.xml present,
validation is unchanged. scePlayGoGetChunkId still reports the known set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 09:44:13 +02:00

61 lines
2.6 KiB
C++

#include "SceTypes.hpp"
#include "prx/libc/include/general/VabiMacros.hpp"
#include <cstdint>
#include <cstdlib>
extern "C" {
int APS5_VABI scePlayGoInitialize(const PlayGoInitParams*);
int APS5_VABI scePlayGoOpen(int*, const void*);
int APS5_VABI scePlayGoClose(int);
int APS5_VABI scePlayGoGetLanguageMask(int, std::uint64_t*);
int APS5_VABI scePlayGoSetToDoList(int, const PlayGoToDo*, std::uint32_t);
int APS5_VABI scePlayGoGetToDoList(int, PlayGoToDo*, std::uint32_t, std::uint32_t*);
int APS5_VABI scePlayGoGetLocus(int, const std::uint16_t*, std::uint32_t, std::int8_t*);
int APS5_VABI scePlayGoGetChunkId(int, std::uint16_t*, std::uint32_t, std::uint32_t*);
}
static void Require(bool value) { if (!value) std::abort(); }
int main() {
constexpr int badHandle = static_cast<int>(0x80B20009);
constexpr int badPointer = static_cast<int>(0x80B2000A);
constexpr int badSize = static_cast<int>(0x80B2000B);
constexpr int badLocus = static_cast<int>(0x80B20010);
PlayGoInitParams init{};
int handle = 0;
Require(scePlayGoInitialize(nullptr) == badPointer);
Require(scePlayGoInitialize(&init) == 0);
Require(scePlayGoOpen(nullptr, nullptr) == badPointer);
Require(scePlayGoOpen(&handle, nullptr) == 0);
std::uint64_t mask = 0;
Require(scePlayGoGetLanguageMask(handle + 1, &mask) == badHandle);
Require(scePlayGoGetLanguageMask(handle, nullptr) == badPointer);
Require(scePlayGoGetLanguageMask(handle, &mask) == 0 && mask == ~0ull);
PlayGoToDo todo[2] = {{0, 3, 0}, {0, 0, 0}};
Require(scePlayGoSetToDoList(handle + 1, todo, 2) == badHandle);
Require(scePlayGoSetToDoList(handle, nullptr, 2) == badPointer);
Require(scePlayGoSetToDoList(handle, todo, 0) == badSize);
Require(scePlayGoSetToDoList(handle, todo, 2) == 0);
todo[1].locus = 1;
Require(scePlayGoSetToDoList(handle, todo, 2) == badLocus);
todo[1] = {0xFFFF, 3, 0};
Require(scePlayGoSetToDoList(handle, todo, 2) == 0);
std::uint32_t entries = 1;
Require(scePlayGoGetToDoList(handle, todo, 2, &entries) == 0 && entries == 0);
const std::uint16_t chunk = 0;
std::int8_t locus = 0;
Require(scePlayGoGetLocus(handle, &chunk, 0, &locus) == badSize);
Require(scePlayGoGetLocus(handle, &chunk, 1, &locus) == 0 && locus == 3);
const std::uint16_t undeclared[2] = {1, 10};
std::int8_t loci[2] = {0, 0};
Require(scePlayGoGetLocus(handle, undeclared, 2, loci) == 0 && loci[0] == 3 && loci[1] == 3);
std::uint32_t chunkCount = 0;
Require(scePlayGoGetChunkId(handle, nullptr, 0, &chunkCount) == 0 && chunkCount == 1);
Require(scePlayGoClose(handle + 1) == badHandle);
Require(scePlayGoClose(handle) == 0);
}