diff --git a/runtime/include/bozo/libs/cd.h b/runtime/include/bozo/libs/cd.h index a267802..37e8f70 100644 --- a/runtime/include/bozo/libs/cd.h +++ b/runtime/include/bozo/libs/cd.h @@ -77,6 +77,11 @@ namespace bozo::libs bool paused = false; // A blocked sceCdStRead, finished as its thread resumes. uint32_t pendingSectors = 0, pendingBuffer = 0, pendingError = 0; + // A port's choice: a sceCdStRead that does not wait (mode 0) brings all the sectors asked for or none, as a + // console's drive fills the stream's ring a bank at a time (the ring here fills a sector at a time). Amplitude's + // movie player resumes its demux at `buffer + 0x4000 - bytes left`, taking a short read for a whole one: it + // skipped a sector, with a sound packet in it. + bool wholeStreamReads = false; // Brings the drive's reading up to `cycle`. void advance(uint64_t cycle) diff --git a/runtime/include/bozo/render/texture.h b/runtime/include/bozo/render/texture.h index ee6def4..f2f35ea 100644 --- a/runtime/include/bozo/render/texture.h +++ b/runtime/include/bozo/render/texture.h @@ -16,7 +16,7 @@ namespace bozo::render { uint32_t width = 0; uint32_t height = 0; - std::vector rgba; // R in the low byte; alpha scaled from the GS's 0x80 = opaque to 255 + std::vector rgba; // R in the low byte; alpha as the GS has it (0x80 is opaque: the renderer scales it) uint64_t key = 0; uint64_t version = 0; // new for every decode: a renderer re-sends the image to its GPU when it changes std::vector> pages; // (page, generation) the texture was decoded from diff --git a/runtime/libs/cd.cpp b/runtime/libs/cd.cpp index 19b0b5e..113e78b 100644 --- a/runtime/libs/cd.cpp +++ b/runtime/libs/cd.cpp @@ -440,6 +440,8 @@ namespace bozo::libs l.waitVblank(token, -1, Resume{kResumeCdStreamRead, {n}}); return; } + if (mode == 0 && cd.wholeStreamReads && available < n) + available = 0; deliver(l, g, mode == 1 ? n : static_cast(available), to, errorAt); } } @@ -487,6 +489,18 @@ namespace bozo::libs const int32_t id=l.cd.nextFile++; l.cd.files.emplace(id,CdState::File{lbn,bytes,0}); g.ret(id); } void fsClose(Libraries &l, Guest &g) { g.ret(l.cd.files.erase(g.sarg(0)) ? 0 : -1); } + // sceIoctl(fd, request, arg): request 1 is the status a file opened with O_NOWAIT (0x8001) is polled with: 1 + // while an operation runs. The native sceOpen / sceRead have finished as they return: *arg = 0, done (Amplitude + // polls it after each, 0x1af6a0 and 0x28f528). Any other request: -1. + void fsIoctl(Libraries &, Guest &g) { + const uint32_t request = g.arg(1), arg = g.arg(2); + if (request == 1u && arg) { + g.write32(arg, 0); + g.ret(0); + return; + } + g.ret(-1); + } // sceGetstat(name, struct sce_stat *): a disc file's size, as a read-only regular file (iomanX's sce_stat: // mode +0, attr +4, size +8, ctime/atime/mtime +12..+35, hisize +36, private +40..+63); -1 when it is not on // the disc. The image is opened first, as sceOpen does. Shinobido checks its files with it before reading @@ -550,6 +564,7 @@ namespace bozo::libs out.push_back({"sceWrite", kCd, fsWrite}); out.push_back({"sceLseek", kCd, fsSeek}); out.push_back({"sceGetstat", kCd, fsGetstat}); + out.push_back({"sceIoctl", kCd, fsIoctl}); out.push_back({"sceCdSearchFile", kCd, searchFile}); out.push_back({"sceCdLayerSearchFile", kCd, layerSearchFile}); out.push_back({"sceCdReadDvdDualInfo", kCd, readDvdDualInfo}); diff --git a/runtime/libs/mpeg.cpp b/runtime/libs/mpeg.cpp index 7a43661..802869c 100644 --- a/runtime/libs/mpeg.cpp +++ b/runtime/libs/mpeg.cpp @@ -730,6 +730,9 @@ namespace bozo::libs { if (!haveVideoDecoder()) return; + // sceIpuInit: the IPU's reset (IPU_CTRL's RST, then a wait on its busy bit). There is no IPU: what a game then + // asks of it is answered where it asks (libmpeg's functions here; a port's own IPU use, Amplitude's menus). + out.push_back({"sceIpuInit", kMpeg, [](Libraries &, Guest &g) { g.ret(0); }}); out.push_back({"sceMpegInit", kMpeg, init}); out.push_back({"sceMpegCreate", kMpeg, create}); out.push_back({"sceMpegDelete", kMpeg, destroy}); diff --git a/runtime/libs/sif.cpp b/runtime/libs/sif.cpp index 2f1e67b..855febb 100644 --- a/runtime/libs/sif.cpp +++ b/runtime/libs/sif.cpp @@ -326,6 +326,11 @@ namespace bozo::libs out.push_back({"sceSifInitRpc", kSif, initRpc}); out.push_back({"sceSifExitRpc", kSif, nothing}); out.push_back({"sceSifExitCmd", kSif, nothing}); + // The SIF command layer's set-up, and the DMA chain armed before a sceSifSetDma: nothing to set up or arm (the + // native sceSifSetDma's data reaches the IOP at once). Amplitude's sound set-up calls sceSifInitCmd itself. + out.push_back({"sceSifInitCmd", kSif, nothing}); + out.push_back({"sceSifSetDChain", kSif, nothing}); + out.push_back({"isceSifSetDChain", kSif, nothing}); out.push_back({"sceSifLoadFileReset", kSif, nothing}); out.push_back({"sceSifWriteBackDCache", kSif, nothing}); out.push_back({"sceSifResetIop", kSif, rebootIop});