resonance 1.0.1
Loading...
Searching...
No Matches
MemcardTask Class Referenceabstract

One multi-step piece of memory-card work, driven by the operations it queues. More...

#include <memcardtask.h>

Inheritance diagram for MemcardTask:
Collaboration diagram for MemcardTask:

Public Member Functions

 MemcardTask (MemcardUser *pUser, Memcard *pCard, int nPortSlot, int nCookie)
 Construct an idle task against one card slot.
 MemcardTask (MemcardUser *pUser, Memcard *pCard, int nCookie)
 Construct an idle task that does not address a single card slot.
virtual void Finish ()=0
 Report the finished task to its user and record that it is done.
virtual void Execute ()=0
 Start the task.
virtual void UnusedHook ()
 Do nothing.
Public Member Functions inherited from MemcardCBHandler
virtual ~MemcardCBHandler ()
 Release the receiver.
virtual void OnCheckInfo (CheckInfoOp *pOp)
 Report a finished card enquiry.
virtual void OnEntSpace (EntSpaceOp *pOp)
 Report a finished free-entry enquiry.
virtual void OnFormat (FormatOp *pOp)
 Report a finished format.
virtual void OnUnformat (UnformatOp *pOp)
 Report a finished unformat.
virtual void OnCreateDir (CreateDirOp *pOp)
 Report a finished directory creation.
virtual void OnListDir (ListDirOp *pOp)
 Report a finished directory listing.
virtual void OnRead (ReadOp *pOp)
 Report a finished read.
virtual void OnWrite (WriteOp *pOp)
 Report a finished write.
virtual void OnOpenWrite (OpenWriteOp *pOp)
 Report a finished open for writing.
virtual void OnOpenRead (OpenReadOp *pOp)
 Report a finished open for reading.
virtual void OnClose (CloseOp *pOp)
 Report a finished close.
virtual void OnSeek (SeekOp *pOp)
 Report a finished seek.
virtual void OnDeleteFile (DeleteFileOp *pOp)
 Report a finished file deletion.
virtual void OnRenameFile (RenameFileOp *pOp)
 Report a finished rename.

Protected Member Functions

void HandleError ()
 Abandon the task when the last operation reported a failure.

Protected Attributes

MemcardUser * mUser
Memcard * mCard
int mCookie
int mPortSlot
int mState
int mStatus

Friends

class MemcardManager

Detailed Description

One multi-step piece of memory-card work, driven by the operations it queues.

Its RTTI descriptor is at 0x008ef670. It has single inheritance from MemcardCBHandler at offset 0. An instance is 0x1c bytes. No vtable for this class is emitted anywhere in the image. The class is therefore abstract, and the two virtuals every subclass overrides are declared pure here.

A task is a MemcardCBHandler and therefore receives the completion of every operation it queues. It drives itself forward from inside those reports. SaveFileMCT for example creates the save directory, then opens the file, then writes it, then closes it, advancing one step per report. The task finally reports to the MemcardUser it was constructed with.

Sixteen concrete subclasses exist. SaveFileMCT and LoadFileMCT perform the file transfer, and the fourteen others either drive the card directly or wrap one of those two. The European release adds a seventeenth, SaveSpaceCheckerMCT.

The method titles Execute() and Finish() are inferred. The diagnostic MemcardTask::Execute() at 0x007da088 attests the class and the method together, but the routine that prints it has not been located and no string identifies Finish(). In the European release, SaveSpaceCheckerMCT::Execute() prints the same text.

Constructor & Destructor Documentation

◆ MemcardTask() [1/2]

MemcardTask::MemcardTask ( MemcardUser * pUser,
Memcard * pCard,
int nPortSlot,
int nCookie )

Construct an idle task against one card slot.

mStatus is not written. A task that is read before it reports therefore exposes whatever that word stored when the block was allocated. The compiler inlined this body into every subclass constructor, and the image has no out-of-line copy. GetConnectStateMCT::GetConnectStateMCT() at 0x001848f8 is the clearest copy.

Parameters
pUserThe receiver Finish() reports to.
pCardThe queue the task submits operations to.
nPortSlotThe packed port and slot.
nCookieThe tag that abandons exactly this task's operations.

◆ MemcardTask() [2/2]

MemcardTask::MemcardTask ( MemcardUser * pUser,
Memcard * pCard,
int nCookie )
inline

Construct an idle task that does not address a single card slot.

mPortSlot and mStatus are not written. The only copy is inlined into MemcardManager::CreateGetAllConnectStatesTask() at 0x001f2c70, whose task enquires about every slot from its tables.

Parameters
pUserThe receiver Finish() reports to.
pCardThe queue the task submits operations to.
nCookieThe tag that abandons exactly this task's operations.

Member Function Documentation

◆ Finish()

virtual void MemcardTask::Finish ( )
pure virtual

Report the finished task to its user and record that it is done.

Occupies vtable slot 16. Every subclass writes 2 to mState, or its state member, and then calls the one MemcardUser method that matches the task.

Implemented in DeleteRemixMCT, FormatCardMCT, GetAllConnectStatesMCT, GetConnectStateMCT, ListRemixesMCT, LoadFileMCT, LoadGlobalSettingsMCT, LoadJukeboxPlayListMCT, LoadPersonasMCT, LoadRemixMCT, MinimumSaveSpaceMCT, SaveFileMCT, SaveGlobalSettingsMCT, SaveJukeboxPlayListMCT, SavePersonasMCT, SaveRemixMCT, and SaveSpaceCheckerMCT.

◆ Execute()

virtual void MemcardTask::Execute ( )
pure virtual

Start the task.

Occupies vtable slot 17. Every subclass writes 1 to mState, or its state member, and then queues its first operation on mCard.

Implemented in DeleteRemixMCT, FormatCardMCT, GetAllConnectStatesMCT, GetConnectStateMCT, ListRemixesMCT, LoadFileMCT, LoadGlobalSettingsMCT, LoadJukeboxPlayListMCT, LoadPersonasMCT, LoadRemixMCT, MinimumSaveSpaceMCT, SaveFileMCT, SaveGlobalSettingsMCT, SaveJukeboxPlayListMCT, SavePersonasMCT, SaveRemixMCT, and SaveSpaceCheckerMCT.

◆ UnusedHook()

virtual void MemcardTask::UnusedHook ( )
virtual

Do nothing.

Slot 18. The body is empty, every subclass in the image inherits it, and the image never calls it. It is declared without arguments because no call site exists to prove any. The European release has no slot 18.

Ghidra address:
NTSC-U/C: 0x00184530

◆ HandleError()

void MemcardTask::HandleError ( )
protected

Abandon the task when the last operation reported a failure.

An mStatus other than kMemcardStatusOk abandons every operation still queued under mCookie and then reports through Finish(). kMemcardStatusOk does nothing. The out-of-line copy is never called. Every report handler across the sixteen subclasses inlined the body instead.

Ghidra address:
NTSC-U/C: 0x00185998
Ghidra address:
PAL: 0x0018b3c0

◆ MemcardManager

friend class MemcardManager
friend

Member Data Documentation

◆ mUser

MemcardUser* MemcardTask::mUser
protected

◆ mCard

Memcard* MemcardTask::mCard
protected

◆ mCookie

int MemcardTask::mCookie
protected

◆ mPortSlot

int MemcardTask::mPortSlot
protected

◆ mState

int MemcardTask::mState
protected

◆ mStatus

int MemcardTask::mStatus
protected

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