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

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

#include <mccheckremixspaceneededtask.h>

Inheritance diagram for MCCheckRemixSpaceNeededTask:
Collaboration diagram for MCCheckRemixSpaceNeededTask:

Public Member Functions

 ~MCCheckRemixSpaceNeededTask () override=default
 Destroy the object.
 MCCheckRemixSpaceNeededTask ()
 Construct the steps, one listing for each remix directory.
void Set (SaveSpaceUser *pUser, int nPort, const char *pszName, int nFileSize, int nOverwrite)
 Prepare the work, and clear g_MemcardPath.
void OnDirListed () override
 Search one listed directory for the file, and measure the space once every directory is 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 chooses the remix directory a remix is saved to, measures the space the save needs, and checks it against the free space of the card.

The RTTI records the class as deriving from MemcardSerialTask. The object is 0x64 bytes, and 0x84 in the PAL build. The PAL build first checks every directory with an MCCheckDirExistsTask. The directories are listed in order. A directory that includes the file is chosen; otherwise the first directory with room is, and g_MemcardPath records it. When the work ends, OnStop() reports the outcome to mUser. The outcome is MemcardTask::kStatusLimit when the card includes g_nMaxRemixes remixes already, MemcardTask::kStatusExists when the file exists and may not be replaced, and MemcardTask::kStatusFull when the card lacks the space.

Constructor & Destructor Documentation

◆ ~MCCheckRemixSpaceNeededTask()

MCCheckRemixSpaceNeededTask::~MCCheckRemixSpaceNeededTask ( )
overridedefault

Destroy the object.

Ghidra address:
NTSC-U/C: 0x00352548
Ghidra address:
PAL: 0x003bf7c8

◆ MCCheckRemixSpaceNeededTask()

MCCheckRemixSpaceNeededTask::MCCheckRemixSpaceNeededTask ( )

Construct the steps, one listing for each remix directory.

Ghidra address:
NTSC-U/C: 0x0015ef00
Ghidra address:
PAL: 0x00160818

Member Function Documentation

◆ Set()

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

Prepare the work, and clear g_MemcardPath.

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

◆ OnDirListed()

void MCCheckRemixSpaceNeededTask::OnDirListed ( )
overridevirtual

Search one listed directory for the file, and measure the space once every directory is listed.

Ghidra address:
NTSC-U/C: 0x0015f278
Ghidra address:
PAL: 0x00160df8

Reimplemented from MemcardSerialTask.

◆ OnStop()

void MCCheckRemixSpaceNeededTask::OnStop ( )
overrideprotectedvirtual

End with the outcome, and report it to mUser.

Ghidra address:
NTSC-U/C: 0x0015f4a8
Ghidra address:
PAL: 0x00161138

Reimplemented from Task.


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