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

Work that measures the space a save to the Freq directory needs, and checks it against the free space of the card. More...

#include <mcchecksavespaceneededtask.h>

Inheritance diagram for MCCheckSaveSpaceNeededTask:
Collaboration diagram for MCCheckSaveSpaceNeededTask:

Public Member Functions

 ~MCCheckSaveSpaceNeededTask () override=default
 Destroy the object.
 MCCheckSaveSpaceNeededTask ()
 Construct the steps.
void Set (SaveSpaceUser *pUser, int nPort, const char *pszName, const char *pszExt, int nMaxFiles, int nFileSize, int nOverwrite)
 Prepare the work, and make g_MemcardPath the Freq directory.
void OnDirListed () override
 Record whether the directory exists, then measure the space once the files are listed.
Public Member Functions inherited from MemcardSerialTask
 ~MemcardSerialTask () override=default
 Destroy the object.
int GetResult ()
 Report the outcome of the work.
virtual void OnCardInfo ()
 Learn that a card information step ended.
virtual void OnFileLoaded ()
 Learn that a file load step ended.
Public Member Functions inherited from SerialTasks
 ~SerialTasks () override
 Release the list and every task in it.
void Add (Task *pTask)
 Append a task, which the list then manages.
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.

Protected Member Functions

void OnStop () override
 End with the outcome, and report it to mUser.
Protected Member Functions inherited from MemcardSerialTask
void OnStop () override
 Record MemcardTask::sStatus in mResult.
Protected Member Functions inherited from SerialTasks
void OnStart () override
 Start the first task, or finish with success when the list is empty.
void OnStop () override
 Stop the task that runs now.
void OnPoll () override
 Poll the task that runs now, start the next one after it is done, and finish after the last one or after a failure.
const std::vector< std::unique_ptr< Task > > & GetTasks () const

Additional Inherited Members

Public Types inherited from Task
enum  State { kStateIdle = 0 , kStateRunning = 1 , kStateDone = 2 , kStateFailed = 3 }
 Values of mState. More...

Detailed Description

Work that measures the space a save to the Freq directory needs, and checks it against the free space of the card.

The RTTI records the class as deriving from MemcardSerialTask. The object is 0x58 bytes, and 0x5c in the PAL build. The PAL build first checks the directory with an MCCheckDirExistsTask. When the work ends, OnStop() reports the outcome to mUser. The outcome is MemcardTask::kStatusLimit when the directory includes mMaxFiles files of the kind already, MemcardTask::kStatusExists when the file exists and may not be replaced, and MemcardTask::kStatusFull when the card lacks the space.

Constructor & Destructor Documentation

◆ ~MCCheckSaveSpaceNeededTask()

MCCheckSaveSpaceNeededTask::~MCCheckSaveSpaceNeededTask ( )
overridedefault

Destroy the object.

Ghidra address:
NTSC-U/C: 0x00352278
Ghidra address:
PAL: 0x003bf4f8

◆ MCCheckSaveSpaceNeededTask()

MCCheckSaveSpaceNeededTask::MCCheckSaveSpaceNeededTask ( )

Construct the steps.

Ghidra address:
NTSC-U/C: 0x0015ea48
Ghidra address:
PAL: 0x00160288

Member Function Documentation

◆ Set()

void MCCheckSaveSpaceNeededTask::Set ( SaveSpaceUser * pUser,
int nPort,
const char * pszName,
const char * pszExt,
int nMaxFiles,
int nFileSize,
int nOverwrite )

Prepare the work, and make g_MemcardPath the Freq directory.

Parameters
pUserThe receiver of the outcome.
nPortThe memory card slot.
pszNameThe name of the file, without its extension.
pszExtThe extension of the file.
nMaxFilesThe files of the extension the directory may include.
nFileSizeThe size of the file in bytes.
nOverwriteNon-zero when an existing file may be replaced.
Ghidra address:
NTSC-U/C: 0x0015eba0
Ghidra address:
PAL: 0x00160490

◆ OnDirListed()

void MCCheckSaveSpaceNeededTask::OnDirListed ( )
overridevirtual

Record whether the directory exists, then measure the space once the files are listed.

Ghidra address:
NTSC-U/C: 0x0015ece8
Ghidra address:
PAL: 0x001605f0

Reimplemented from MemcardSerialTask.

◆ OnStop()

void MCCheckSaveSpaceNeededTask::OnStop ( )
overrideprotectedvirtual

End with the outcome, and report it to mUser.

Ghidra address:
NTSC-U/C: 0x0015ee98
Ghidra address:
PAL: 0x001607b0

Reimplemented from Task.


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