Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions runtime/include/bozo/libs/cd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion runtime/include/bozo/render/texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace bozo::render
{
uint32_t width = 0;
uint32_t height = 0;
std::vector<uint32_t> rgba; // R in the low byte; alpha scaled from the GS's 0x80 = opaque to 255
std::vector<uint32_t> 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<std::pair<uint32_t, uint32_t>> pages; // (page, generation) the texture was decoded from
Expand Down
15 changes: 15 additions & 0 deletions runtime/libs/cd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>(available), to, errorAt);
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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});
Expand Down
3 changes: 3 additions & 0 deletions runtime/libs/mpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
5 changes: 5 additions & 0 deletions runtime/libs/sif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
Loading