resonance 1.0.1
Loading...
Searching...
No Matches
CallbackXferBdToIop Class Reference

Receiver that streams a BD sound bank into the sound driver one chunk at a time. More...

#include <callbackxferbdtoiop.h>

Inheritance diagram for CallbackXferBdToIop:
Collaboration diagram for CallbackXferBdToIop:

Public Member Functions

 CallbackXferBdToIop (int nFile, char *pReadBuffer, int nDest, int nChunkLength, int nLength)
 Prepare a transfer of a bank already measured.
virtual void Done (int nHandle, int nFile, void *pBuffer, int nLength, int nStatus)
 Move the chunk that has just been read and queue the next one.
void Resume ()
 Pick a deferred transfer back up.
Public Member Functions inherited from AsyncCallback
virtual ~AsyncCallback ()
 Release the receiver.

Public Attributes

int mRequestId
int mRemaining

Detailed Description

Receiver that streams a BD sound bank into the sound driver one chunk at a time.

Its RTTI descriptor is at 0x008eeed8. It has AsyncCallback as its one public base at offset 0. The vtable at 0x0081cf10 has the base's three slots and no more. The class does not add a virtual or declare a destructor; slot 1 addresses a copy of the base destructor. An instance is 0x20 bytes. The allocation at 0x00462018 measures that size, and the field range does not imply it.

The transfer is a loop of asynchronous reads of at most 0x2000 bytes. Each completion moves the chunk just read into a staging buffer on the IOP, submits it to the driver, and queues the read for the next chunk. The last chunk releases the read buffer, closes the file, and tells the driver the bank is complete.

The object registers itself with the one static CallbackXferHdToIop so that an HD transfer finishing can resume a BD transfer that deferred to it.

Constructor & Destructor Documentation

◆ CallbackXferBdToIop()

CallbackXferBdToIop::CallbackXferBdToIop ( int nFile,
char * pReadBuffer,
int nDest,
int nChunkLength,
int nLength )

Prepare a transfer of a bank already measured.

The transfer starts idle. StartBdBankXfer() queues the first read straight afterwards, with the same chunk length it passes here, which is why the length is a parameter rather than being derived from nLength inside.

The constructor is inlined into its one caller, which is why the vptr store and all seven field stores appear there as one run rather than as a call. It has no address of its own.

Parameters
nFileThe bank, positioned at its start.
pReadBufferThe staging buffer every chunk is read into, aligned by the caller.
nDestWhere the driver writes the bank.
nChunkLengthThe first chunk, which is the whole bank when it fits within kBankChunkSize.
nLengthThe bank's length.

Member Function Documentation

◆ Done()

virtual void CallbackXferBdToIop::Done ( int nHandle,
int nFile,
void * pBuffer,
int nLength,
int nStatus )
virtual

Move the chunk that has just been read and queue the next one.

Reports BD bank loading returned async error d for a positive status and then continues regardless. Marks the transfer busy before testing whether an HD transfer holds the shared command block, and returns with the transfer still marked busy when one does. Resume() is what picks the transfer back up.

Parameters
nHandleThe identifier the read was queued under.
nFileThe file the read was issued against.
pBufferThe destination the read filled.
nLengthThe number of bytes the read requested.
nStatusZero once the data is in place, or a positive failure code.
Ghidra address:
NTSC-U/C: 0x00464430
Ghidra address:
PAL: 0x004a1f10

Implements AsyncCallback.

◆ Resume()

void CallbackXferBdToIop::Resume ( )

Pick a deferred transfer back up.

CallbackXferHdToIop::Done() is the only caller. Performs no work while an HD transfer still holds the shared command block, or while this transfer is not marked busy.

Ghidra address:
NTSC-U/C: 0x00464da8
Ghidra address:
PAL: 0x004a2768 Read the transfer is waiting on, or zero when none is outstanding. Public because CallbackXferHdToIop::Done() tests it through a pointer before resuming the transfer, which is access from outside the hierarchy, and the image has no accessor for it. +0x04

Member Data Documentation

◆ mRequestId

int CallbackXferBdToIop::mRequestId

◆ mRemaining

int CallbackXferBdToIop::mRemaining

< Bytes of the bank still to move. Public because IsBankXferBusy() at 0x00464628 tests it through g_pBdXfer, and the image has no accessor for it. +0x18


The documentation for this class was generated from the following file: