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

One queued memory-card operation. More...

#include <memcardop.h>

Inheritance diagram for MemcardOp:
Collaboration diagram for MemcardOp:

Public Member Functions

 MemcardOp (MemcardCBHandler *pHandler, int nPortSlot, int nCookie)
 Construct an operation against one card slot, with no libmc call issued yet.
 MemcardOp (MemcardCBHandler *pHandler, int nCookie)
 Construct an operation against an open descriptor alone.
virtual ~MemcardOp ()
 Release the operation.
virtual void Execute ()
 Start the libmc call this operation stands for and record that it is in flight.
virtual void NotifyDone ()
 Interpret the finished libmc call and report it to the handler.
virtual void InterpretResult ()
 Map mResult to mStatus, and copy any result the call delivered out of it.

Public Attributes

int mCookie
 Ticket number Memcard::Cancel() matches on.
int mIssued
 Zero until Execute() has run, then 1 while libmc is servicing the call.
int mResult
 The libmc result, as sceMcSync() delivered it.
int mStatus
 One of MemcardStatus, written by InterpretResult().

Protected Attributes

int mPortSlot
MemcardCBHandler * mHandler

Detailed Description

One queued memory-card operation.

Its RTTI descriptor is at 0x0086f608. It has no base class. The vptr therefore sits after the data at offset 0x18 rather than at offset 0. An instance is 0x1c bytes and the vtable is at 0x0082c050.

Fourteen classes derive from this one, one per libmc entry point, and each of them supplies the three virtuals below. Memcard owns the queue, constructs an operation on the heap for every request, and drives it through Execute(), then NotifyDone(), then destruction.

The three method titles are inferred from the bodies. No string in the image identifies any of them. The base bodies at 0x0055f310, 0x0055f318 and 0x0055f320 are each a single jr ra, so all three virtuals are declared with an empty body rather than as pure virtuals.

Neither mResult nor mStatus is written by either constructor. An operation that libmc has not finished therefore reports whatever those two words stored when the block was allocated.

Constructor & Destructor Documentation

◆ MemcardOp() [1/2]

MemcardOp::MemcardOp ( MemcardCBHandler * pHandler,
int nPortSlot,
int nCookie )

Construct an operation against one card slot, with no libmc call issued yet.

Every derived constructor writes these four members itself rather than delegating, because the compiler inlined this body into all twelve of the operations that address a card. No address of its own survives.

Parameters
pHandlerThe receiver NotifyDone() reports to.
nPortSlotThe port shifted up by kMemcardPortShift, with the slot in the low bits.
nCookieThe tag Memcard::Cancel() matches on.

◆ MemcardOp() [2/2]

MemcardOp::MemcardOp ( MemcardCBHandler * pHandler,
int nCookie )

Construct an operation against an open descriptor alone.

mPortSlot is not written. SeekOp and CloseOp are the two operations that use this form, and neither reads mPortSlot.

Parameters
pHandlerThe receiver NotifyDone() reports to.
nCookieThe tag Memcard::Cancel() matches on.

◆ ~MemcardOp()

virtual MemcardOp::~MemcardOp ( )
virtual

Release the operation.

The body is empty. MemcardPS2::Update() destroys an operation through this slot as soon as NotifyDone() has returned.

Ghidra address:
NTSC-U/C: 0x0055f2e0
Ghidra address:
PAL: 0x005a05c0

Member Function Documentation

◆ Execute()

virtual void MemcardOp::Execute ( )
virtual

Start the libmc call this operation stands for and record that it is in flight.

Every derived body ends by writing 1 to mIssued, which is what moves the operation from the queue head into the polling state.

Ghidra address:
NTSC-U/C: 0x0055f310
Ghidra address:
PAL: 0x005a05f0

Reimplemented in CheckInfoOp, CloseOp, CreateDirOp, DeleteFileOp, EntSpaceOp, FormatOp, ListDirOp, OpenReadOp, OpenWriteOp, ReadOp, RenameFileOp, SeekOp, UnformatOp, and WriteOp.

◆ NotifyDone()

virtual void MemcardOp::NotifyDone ( )
virtual

Interpret the finished libmc call and report it to the handler.

Each derived body calls InterpretResult() on itself and then the one MemcardCBHandler method that matches the operation's type.

Ghidra address:
NTSC-U/C: 0x0055f318
Ghidra address:
PAL: 0x005a05f8

Reimplemented in CheckInfoOp, CloseOp, CreateDirOp, DeleteFileOp, EntSpaceOp, FormatOp, ListDirOp, OpenReadOp, OpenWriteOp, ReadOp, RenameFileOp, SeekOp, UnformatOp, and WriteOp.

◆ InterpretResult()

virtual void MemcardOp::InterpretResult ( )
virtual

Map mResult to mStatus, and copy any result the call delivered out of it.

Ghidra address:
NTSC-U/C: 0x0055f320
Ghidra address:
PAL: 0x005a0600

Reimplemented in CheckInfoOp, CloseOp, CreateDirOp, DeleteFileOp, EntSpaceOp, FormatOp, ListDirOp, OpenReadOp, OpenWriteOp, ReadOp, RenameFileOp, SeekOp, UnformatOp, and WriteOp.

Member Data Documentation

◆ mCookie

int MemcardOp::mCookie

Ticket number Memcard::Cancel() matches on.

Public because Memcard::Cancel() compares this member against its argument directly, and the image exposes no accessor. Every MemcardTask passes its own ticket, which MemcardManager's task factories draw by pre-incrementing MemcardManager::mTicket. Cancelling a task therefore abandons exactly the operations that task queued.

+0x04

◆ mIssued

int MemcardOp::mIssued

Zero until Execute() has run, then 1 while libmc is servicing the call.

Public because MemcardPS2::Update() reads it directly.

+0x08

◆ mResult

int MemcardOp::mResult

The libmc result, as sceMcSync() delivered it.

Public because MemcardPS2::Update() writes it directly.

+0x0c

◆ mStatus

int MemcardOp::mStatus

One of MemcardStatus, written by InterpretResult().

Public because every MemcardCBHandler implementation reads it directly.

+0x10

◆ mPortSlot

int MemcardOp::mPortSlot
protected

◆ mHandler

MemcardCBHandler* MemcardOp::mHandler
protected

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