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

Write one payload to a card, together with the save directory and its browser icon. More...

#include <savefilemct.h>

Inheritance diagram for SaveFileMCT:
Collaboration diagram for SaveFileMCT:

Public Member Functions

 SaveFileMCT (MemcardUser *pUser, Memcard *pCard, int nPortSlot, int nCookie)
 Construct an idle save task.
virtual ~SaveFileMCT ()
void Save (const HxStr &dirName, const HxStr &fileName, const HxStr &iconTitle, const void *pData, int nLength, int bSkipIconFiles)
 Record what to write and start the sequence.
void RunStep ()
 Run the step mStep selects and advance to the step after it.
void BuildIconSys (const char *pszTitle)
 Fill mIconSys with the browser icon header.
virtual void OnCreateDir (CreateDirOp *pOp)
virtual void OnWrite (WriteOp *pOp)
virtual void OnOpenWrite (OpenWriteOp *pOp)
virtual void OnClose (CloseOp *pOp)
virtual void Finish ()
virtual void Execute ()
 Start the sequence.
Public Member Functions inherited from MemcardTask
 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 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 OnListDir (ListDirOp *pOp)
 Report a finished directory listing.
virtual void OnRead (ReadOp *pOp)
 Report a finished read.
virtual void OnOpenRead (OpenReadOp *pOp)
 Report a finished open for reading.
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 Attributes

int mFile
sceMcIconSys mIconSys
HxStr mDirName
HxStr mFileName
HxStr mIconTitle
int mStep
const void * mData
int mDataLength
int mSkipIconFiles
Protected Attributes inherited from MemcardTask
MemcardUser * mUser
Memcard * mCard
int mCookie
int mPortSlot
int mState
int mStatus

Additional Inherited Members

Protected Member Functions inherited from MemcardTask
void HandleError ()
 Abandon the task when the last operation reported a failure.

Detailed Description

Write one payload to a card, together with the save directory and its browser icon.

Its RTTI descriptor is at 0x008ef590. It has single inheritance from MemcardTask at offset 0. SavePersonasMCT::~SavePersonasMCT() pins an instance at 0x40c bytes by placing the first SavePersonasMCT member at 0x40c. The vtable is at 0x007daed8.

The task is a nine-step sequence, driven one step per operation report. It creates the directory, writes icon.sys, writes freq1.ico, writes a two-byte marker file under the directory's name, and finally writes the payload. mSkipIconFiles jumps directly from the directory creation to the payload. A save into a directory that already has an icon takes this path.

Three subclasses exist, SavePersonasMCT, SaveGlobalSettingsMCT, and SaveJukeboxPlayListMCT. SaveRemixMCT instead has one of these tasks and receives its report as a MemcardUser.

The European release rewrites the task. An instance is 0x41c bytes, from the allocation in DeleteRemixMCT, and the vtable is at 0x0081ed98. Execute() lists the payload, the marker file, freq1.ico, and icon.sys as SaveFileEntry records in mFiles and enquires about the card. OnCheckInfo() records the free clusters, and a SaveSpaceCheckerMCT then measures the kilobytes the files need beyond the space the directory's present files occupy. A card without that room fails with kMemcardStatusCardFull and the missing kilobytes in mKilobytes. Every save task passes mKilobytes on to its MemcardUser. Otherwise the task creates the directory and writes each file in turn. mSkipIconFiles is stored but has no effect. SaveRemixMCT derives from the class in that release.

The method titles Save(), RunStep(), and BuildIconSys() are inferred. No string in the image identifies any of them.

Constructor & Destructor Documentation

◆ SaveFileMCT()

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

Construct an idle save task.

The compiler inlined this body into all three subclass constructors. No North American address of the body remains, and the European release also has an out-of-line 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.
Ghidra address:
PAL: 0x00189900

◆ ~SaveFileMCT()

virtual SaveFileMCT::~SaveFileMCT ( )
virtual
Ghidra address:
NTSC-U/C: 0x00184658
Ghidra address:
PAL: 0x00189968

Member Function Documentation

◆ Save()

void SaveFileMCT::Save ( const HxStr & dirName,
const HxStr & fileName,
const HxStr & iconTitle,
const void * pData,
int nLength,
int bSkipIconFiles )

Record what to write and start the sequence.

The European release records fileName, pData, and nLength as the one SaveFileEntry of mFiles, replacing any earlier entries, and starts through the virtual Execute().

Parameters
dirNameThe save directory, also the name of the marker file written inside it.
fileNameThe payload file, appended to dirName.
iconTitleThe text the browser shows for the save.
pDataThe payload.
nLengthThe payload length.
bSkipIconFilesNon-zero to write the payload alone, with no icon files. The European release stores it and otherwise ignores it.
Ghidra address:
NTSC-U/C: 0x001859e8
Ghidra address:
PAL: 0x0017a1c0

◆ RunStep()

void SaveFileMCT::RunStep ( )

Run the step mStep selects and advance to the step after it.

Ghidra address:
NTSC-U/C: 0x001776e8
Ghidra address:
PAL: 0x0017a6f0

◆ BuildIconSys()

void SaveFileMCT::BuildIconSys ( const char * pszTitle)

Fill mIconSys with the browser icon header.

The background is a four-corner gradient at half intensity, the three light directions and colours are file-scope constants, and all three icon file-name fields receive freq1.ico. The title is converted from ASCII to Shift-JIS first, because icon.sys stores it that way.

Parameters
pszTitleThe text the browser shows, in ASCII.
Ghidra address:
NTSC-U/C: 0x00177ca0
Ghidra address:
PAL: 0x0017ab40

◆ OnCreateDir()

virtual void SaveFileMCT::OnCreateDir ( CreateDirOp * pOp)
virtual
Ghidra address:
NTSC-U/C: 0x00185c20
Ghidra address:
PAL: 0x0018b558

Reimplemented from MemcardCBHandler.

◆ OnWrite()

virtual void SaveFileMCT::OnWrite ( WriteOp * pOp)
virtual
Ghidra address:
NTSC-U/C: 0x00185b40
Ghidra address:
PAL: 0x0018b4a8

Reimplemented from MemcardCBHandler.

◆ OnOpenWrite()

virtual void SaveFileMCT::OnOpenWrite ( OpenWriteOp * pOp)
virtual
Ghidra address:
NTSC-U/C: 0x00185ae0
Ghidra address:
PAL: 0x0018b448

Reimplemented from MemcardCBHandler.

◆ OnClose()

virtual void SaveFileMCT::OnClose ( CloseOp * pOp)
virtual
Ghidra address:
NTSC-U/C: 0x00185bc0
Ghidra address:
PAL: 0x0018b4f8

Reimplemented from MemcardCBHandler.

◆ Finish()

virtual void SaveFileMCT::Finish ( )
virtual
Ghidra address:
NTSC-U/C: 0x00185a88
Ghidra address:
PAL: 0x0018b410

Implements MemcardTask.

Reimplemented in SaveGlobalSettingsMCT, SaveJukeboxPlayListMCT, and SavePersonasMCT.

◆ Execute()

virtual void SaveFileMCT::Execute ( )
virtual

Start the sequence.

The European release first builds the icon header, appends the marker file, freq1.ico, and icon.sys to mFiles, and enquires about the card. Each subclass appends its payload before calling it.

Ghidra address:
NTSC-U/C: 0x00185ac0
Ghidra address:
PAL: 0x0017a390

Implements MemcardTask.

Reimplemented in SaveGlobalSettingsMCT, SaveJukeboxPlayListMCT, and SavePersonasMCT.

Member Data Documentation

◆ mFile

int SaveFileMCT::mFile
protected

◆ mIconSys

sceMcIconSys SaveFileMCT::mIconSys
protected

◆ mDirName

HxStr SaveFileMCT::mDirName
protected

◆ mFileName

HxStr SaveFileMCT::mFileName
protected

◆ mIconTitle

HxStr SaveFileMCT::mIconTitle
protected

◆ mStep

int SaveFileMCT::mStep
protected

◆ mData

const void* SaveFileMCT::mData
protected

◆ mDataLength

int SaveFileMCT::mDataLength
protected

◆ mSkipIconFiles

int SaveFileMCT::mSkipIconFiles
protected

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