wavelength 1.0.0
Loading...
Searching...
No Matches
MemcardTask Class Reference

Task that issues one memory card command and ends when the command reports its result. More...

#include <memcardtask.h>

Inheritance diagram for MemcardTask:
Collaboration diagram for MemcardTask:

Public Types

enum  Status {
  kStatusOk = 0 , kStatusNoCard = 1 , kStatusFull = 2 , kStatusUnformatted = 3 ,
  kStatusChangedCard = 4 , kStatusExists = 5 , kStatusLimit = 6 , kStatusFormatted = 7 ,
  kStatusNotFound = 8 , kStatusConfigsBad = 9 , kStatusConfigsError = 10
}
 Values of sStatus, the outcome every memory card task and user reports. More...
Public Types inherited from Task
enum  State { kStateIdle = 0 , kStateRunning = 1 , kStateDone = 2 , kStateFailed = 3 }
 Values of mState. More...

Public Member Functions

 ~MemcardTask () override=default
 Destroy the object.
 MemcardTask ()
 Construct an idle task for the first slot.
void SetPort (int nPort)
 Select the slot the command addresses.
Public Member Functions inherited from Task
 Task ()
 Construct an idle task.
virtual ~Task ()
 Release the task.
int Poll ()
 Report the state after giving a running task one poll.
void Start ()
 Enter the running state and call OnStart(), unless the task is already running.
void Stop ()
 Call OnStop() when the task is running, and return to the idle state.
void Finish (bool bSucceeded)
 End the task from outside its poll, and call OnStop() when it was running.
int GetState () const
 Report mState.
Public Member Functions inherited from MemcardCBHandler
virtual ~MemcardCBHandler ()
 Release the handler.
virtual void OnGetInfo (int nResult)
 Receive the result of MemcardGetInfo().
virtual void OnGetEntSpace (int nResult)
 Receive the free entries of a directory.
virtual void OnOpen (int nResult)
 Receive the result of MemcardOpen().
virtual void OnClose (int nResult)
 Receive the result of MemcardClose().
virtual void OnRead (int nResult)
 Receive the result of MemcardRead().
virtual void OnWrite (int nResult)
 Receive the result of MemcardWrite().
virtual void OnSeek (int nResult)
 Receive the result of MemcardSeek().
virtual void OnMkdir (int nResult)
 Receive the result of MemcardMkdir().
virtual void OnRename (int nResult)
 Receive the result of a rename.
virtual void OnDelete (int nResult)
 Receive the result of MemcardDelete().
virtual void OnFormat (int nResult)
 Receive the result of MemcardFormat().
virtual void OnUnformat (int nResult)
 Receive the result of MemcardUnformat().
virtual void OnGetDir (int nResult, MemcardDirEntry *pEntries)
 Receive the result of MemcardGetDir().

Static Public Member Functions

static void SetStatus (int nResult)
 Record a library result in sResult, and translate the result into sStatus.

Static Public Attributes

static int sFd
 The file descriptor the last open reported.
static int sResult
 The library result SetStatus() last translated.
static int sStatus
 The outcome of the last command, one of Status.
static MemcardDirEntry * sDirEntries
 The entries the last directory listing reported.
static int sDirCount
 The number of entries the last directory listing reported.

Protected Member Functions

void OnPoll () override
 Advance the memory card command in flight.
Protected Member Functions inherited from Task
virtual void OnStart ()
 Begin the work.
virtual void OnStop ()
 Abandon the work.

Protected Attributes

int mPort

Detailed Description

Task that issues one memory card command and ends when the command reports its result.

The RTTI records the class as deriving from Task and from MemcardCBHandler at +0x08. The object is 0x10 bytes. A subclass issues its command from OnStart(), and the handler method for the command translates the library's result into sStatus and finishes the task. OnPoll() polls the command in flight.

Member Enumeration Documentation

◆ Status

Values of sStatus, the outcome every memory card task and user reports.

Enumerator
kStatusOk 

The work succeeded.

kStatusNoCard 

No usable card is in the slot.

kStatusFull 

The card lacks the space the work needs.

kStatusUnformatted 

The card is not formatted.

kStatusChangedCard 

Another card is in the slot than before.

kStatusExists 

The file exists and may not be replaced.

kStatusLimit 

The card includes as many saves of the kind as allowed.

kStatusFormatted 

The card to format is formatted already.

kStatusNotFound 

The file or the network configurations do not exist.

kStatusConfigsBad 

The network configurations could not be read.

kStatusConfigsError 

Listing the network configurations failed otherwise.

Constructor & Destructor Documentation

◆ ~MemcardTask()

MemcardTask::~MemcardTask ( )
overridedefault

Destroy the object.

Ghidra address:
NTSC-U/C: 0x00351488
Ghidra address:
PAL: 0x003be700

◆ MemcardTask()

MemcardTask::MemcardTask ( )
inline

Construct an idle task for the first slot.

Member Function Documentation

◆ SetPort()

void MemcardTask::SetPort ( int nPort)

Select the slot the command addresses.

Parameters
nPortThe memory card slot.
Ghidra address:
NTSC-U/C: 0x0015d848
Ghidra address:
PAL: 0x0015f060

◆ SetStatus()

void MemcardTask::SetStatus ( int nResult)
static

Record a library result in sResult, and translate the result into sStatus.

A result the translation does not cover is reported as Unhandled memcard error code: d and does not change sStatus.

Parameters
nResultThe library's result.
Ghidra address:
NTSC-U/C: 0x0015d788
Ghidra address:
PAL: 0x0015efa0

◆ OnPoll()

void MemcardTask::OnPoll ( )
overrideprotectedvirtual

Advance the memory card command in flight.

Ghidra address:
NTSC-U/C: 0x0015d880
Ghidra address:
PAL: 0x0015f098

Reimplemented from Task.

Member Data Documentation

◆ sFd

int MemcardTask::sFd
static

The file descriptor the last open reported.

Ghidra address:
NTSC-U/C: 0x003af844
Ghidra address:
PAL: 0x0042e6dc

◆ sResult

int MemcardTask::sResult
static

The library result SetStatus() last translated.

Ghidra address:
NTSC-U/C: 0x003af848
Ghidra address:
PAL: 0x0042e6e0

◆ sStatus

int MemcardTask::sStatus
static

The outcome of the last command, one of Status.

Ghidra address:
NTSC-U/C: 0x003af84c
Ghidra address:
PAL: 0x0042e6e4

◆ sDirEntries

MemcardDirEntry* MemcardTask::sDirEntries
static

The entries the last directory listing reported.

Ghidra address:
NTSC-U/C: 0x003af850
Ghidra address:
PAL: 0x0042e6e8

◆ sDirCount

int MemcardTask::sDirCount
static

The number of entries the last directory listing reported.

Ghidra address:
NTSC-U/C: 0x003af854
Ghidra address:
PAL: 0x0042e6ec

◆ mPort

int MemcardTask::mPort
protected

The memory card slot.


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