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

Write one remix to a card and add it to the index of the directory it lands in. More...

#include <saveremixmct.h>

Inheritance diagram for SaveRemixMCT:
Collaboration diagram for SaveRemixMCT:

Public Member Functions

 SaveRemixMCT (MemcardUser *pUser, Memcard *pCard, int nPortSlot, int nCookie, const HxStr &remixName, const std::vector< FreqAppearance > &appearances, const HxStr &levelName, int nAlbumNum)
 Construct an idle remix save.
virtual ~SaveRemixMCT ()
 Delete the inner save and the inner read.
void ListRemixDir ()
 List every remix save directory on the card.
void WriteIndex ()
 Rewrite the target directory's index with the saved remix, and save it.
virtual void OnCheckInfo (CheckInfoOp *pOp)
 Start the listing unless the card cannot be read or has too little room.
virtual void OnListDir (ListDirOp *pOp)
 Collect the listed directories and start the index walk.
virtual void Finish ()
 Report the finished save through MemcardUser::OnRemixSaved().
virtual void Execute ()
 Enquire about the card and start the save.
virtual void OnFileLoaded (int nStatus)
 Advance the index walk, or move from the target's index to the payload write.
virtual void OnFileSaved (int nStatus)
 Advance past a finished write, or rewrite the index once the payload has been written.
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 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 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.
Public Member Functions inherited from MemcardUser
virtual ~MemcardUser ()
 Release the receiver.
virtual void OnConnectState (MemcardConnectState state, int nStatus)
 Report the state of one slot.
virtual void OnAllConnectStates ()
 Report that every slot has been enquired about.
virtual void OnMinimumSaveSpace (int nPortSlot, int nSpace)
 Report the space a save would need against the space a card has.
virtual void OnCardFormatted (int nPortSlot, int nStatus)
 Report a finished format.
virtual void OnCardUnformatted (int nPortSlot, int nStatus)
 Report a finished unformat.
virtual void OnPersonasSaved (int nPortSlot, int nStatus)
 Report a finished save of the FreQ roster.
virtual void OnRemixSaved (int nPortSlot, int nStatus)
 Report a finished save of one remix.
virtual void OnGlobalSettingsSaved (int nPortSlot, int nStatus)
 Report a finished save of the global settings.
virtual void OnJukeboxPlayListSaved (int nPortSlot, int nStatus)
 Report a finished save of a jukebox playlist.
virtual void OnRemixesListed (int nPortSlot, int nStatus)
 Report a finished listing of the saved remixes.
virtual void OnRemixLoaded (int nPortSlot, int nStatus)
 Report a finished load of one remix.
virtual void OnPersonasLoaded (int nPortSlot, int nStatus)
 Report a finished load of the FreQ roster.
virtual void OnGlobalSettingsLoaded (int nPortSlot, int nStatus)
 Report a finished load of the global settings.
virtual void OnJukeboxPlayListLoaded (int nPortSlot, int nStatus)
 Report a finished load of a jukebox playlist.
virtual void OnRemixDeleted (int nPortSlot, int nStatus)
 Report a finished deletion of one remix.
virtual void UnusedFirstReport (int nPortSlot, int nStatus)
 Do nothing.
virtual void UnusedSecondReport (int nPortSlot, int nStatus)
 Do nothing.

Additional Inherited Members

Protected Member Functions inherited from MemcardTask
void HandleError ()
 Abandon the task when the last operation reported a failure.
Protected Attributes inherited from MemcardTask
MemcardUser * mUser
Memcard * mCard
int mCookie
int mPortSlot
int mState
int mStatus

Detailed Description

Write one remix to a card and add it to the index of the directory it lands in.

Its RTTI descriptor is at 0x008ef5e0. It has two public non-virtual bases, MemcardTask at offset 0 and MemcardUser at offset 28. Two vtables belong to the class, the 19-entry primary at 0x007da938 and the 21-entry MemcardUser table at 0x007da888, whose first two entries and whose slots 19 and 20 adjust this back by 28. An instance is 0xa4 bytes, from the constructor's highest store at +0xa0. No class derives from it. The size 0xa4 is therefore a lower bound rather than a settled size.

The task enquires about the card, rejects a card with fewer than kRemixSaveMinimumFreeClusters free clusters, lists /BASCUS-97125r*, and then reads the index out of each remix save directory (step 1), recording a RemixDirInfo for each. A directory whose index already lists a remix of the same name becomes the target and the save replaces that entry. Otherwise ChooseTargetDir() picks the first directory with room, or a fresh one. The task then reads the target's index (step 2), writes the payload from the shared log stream (step 3), and finally rewrites the target's index (step 4). It has a LoadFileMCT and a SaveFileMCT, and receives both reports as a MemcardUser. It therefore derives from both interfaces.

The European release derives the class from SaveFileMCT at offset 0 instead of MemcardTask, with MemcardUser at offset 0x41c. The primary vtable is at 0x0081e7a8, the MemcardUser table at 0x0081e6f8, and an instance is 0x4a0 bytes, from MemcardManager::CreateSaveRemixTask()'s allocation. Execute() lists the remix directories at once, without the card enquiry and its free-cluster test. Once the target's index is read, WriteIndex() hands the payload and the rewritten index to the inherited save sequence together. That sequence checks the space both files need. The task has an inner LoadFileMCT and no inner SaveFileMCT.

The method titles are inferred. No string in the image identifies any of them.

Constructor & Destructor Documentation

◆ SaveRemixMCT()

SaveRemixMCT::SaveRemixMCT ( MemcardUser * pUser,
Memcard * pCard,
int nPortSlot,
int nCookie,
const HxStr & remixName,
const std::vector< FreqAppearance > & appearances,
const HxStr & levelName,
int nAlbumNum )

Construct an idle remix save.

MemcardManager::CreateSaveRemixTask() at 0x001f31c8 is the one caller. mStep and mTargetIndexStatus are not written.

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.
remixNameThe remix's name, copied into mRemixName.
appearancesThe players' appearances, copied into mAppearances.
levelNameThe level the remix was built over, copied into mLevelName.
nAlbumNumThe album number the index entry records.
Ghidra address:
NTSC-U/C: 0x00179ec0
Ghidra address:
PAL: 0x0017e068

◆ ~SaveRemixMCT()

virtual SaveRemixMCT::~SaveRemixMCT ( )
virtual

Delete the inner save and the inner read.

The European release has no inner save.

Ghidra address:
NTSC-U/C: 0x001850a8
Ghidra address:
PAL: 0x0018a898

Member Function Documentation

◆ ListRemixDir()

void SaveRemixMCT::ListRemixDir ( )

List every remix save directory on the card.

Unlike the other three remix tasks, this one does not clear mStep, because Execute() has already cleared it.

Ghidra address:
NTSC-U/C: 0x0017a778
Ghidra address:
PAL: 0x0017eb60

◆ WriteIndex()

void SaveRemixMCT::WriteIndex ( )

Rewrite the target directory's index with the saved remix, and save it.

The index read in step 2 is parsed again from the start of mStream, or started afresh at version 1 when that read failed. When mReplacing is set, the entry with the same RemixName is refreshed in place. Otherwise a new entry is appended. mStream then receives the rewritten index, and a fresh SaveFileMCT saves it with its icon files as <dir>/index.

The European release first sets mState to kMemcardTaskRunning and adds the payload from the shared log stream to SaveFileMCT::mFiles. It then adds the rewritten index as index and runs SaveFileMCT::Execute() with mTargetDir as the directory.

Ghidra address:
NTSC-U/C: 0x0017b318
Ghidra address:
PAL: 0x0017f868

◆ OnCheckInfo()

virtual void SaveRemixMCT::OnCheckInfo ( CheckInfoOp * pOp)
virtual

Start the listing unless the card cannot be read or has too little room.

A card with fewer than kRemixSaveMinimumFreeClusters free clusters reports kMemcardStatusCardFull and abandons the task rather than proceeding to the listing. The European release inherits SaveFileMCT::OnCheckInfo() instead.

Parameters
pOpThe finished enquiry.
Ghidra address:
NTSC-U/C: 0x00186a40

Reimplemented from MemcardCBHandler.

◆ OnListDir()

virtual void SaveRemixMCT::OnListDir ( ListDirOp * pOp)
virtual

Collect the listed directories and start the index walk.

A failed listing collects nothing. With directories listed the first index is read in step

  1. With none, the target and payload file name are chosen at once and step 2 starts.
Parameters
pOpThe finished listing.
Ghidra address:
NTSC-U/C: 0x0017a430
Ghidra address:
PAL: 0x0017e768

Reimplemented from MemcardCBHandler.

◆ Finish()

virtual void SaveRemixMCT::Finish ( )
virtual

Report the finished save through MemcardUser::OnRemixSaved().

Ghidra address:
NTSC-U/C: 0x00186b60
Ghidra address:
PAL: 0x0018c338

Implements MemcardTask.

◆ Execute()

virtual void SaveRemixMCT::Execute ( )
virtual

Enquire about the card and start the save.

The European release runs ListRemixDir() instead of the enquiry.

Ghidra address:
NTSC-U/C: 0x00186a08
Ghidra address:
PAL: 0x0018c310

Implements MemcardTask.

◆ OnFileLoaded()

virtual void SaveRemixMCT::OnFileLoaded ( int nStatus)
virtual

Advance the index walk, or move from the target's index to the payload write.

A failure outside step 2 abandons the task. In step 1 the index is parsed, recorded through AppendDirInfo(), and each element's file number raises the directory's highestFileNumber. An element named mRemixName makes this directory the target and its file name the payload file name, and step 2 starts. Otherwise the next directory is read, or the target and payload file name are chosen and step 2 starts. In step 2 the read status, success or not, is recorded in mTargetIndexStatus and step 3 writes the payload. In the European release step 3 runs WriteIndex() at once.

Parameters
nStatusThe inner read's status.
Ghidra address:
NTSC-U/C: 0x0017ad70
Ghidra address:
PAL: 0x0017f260

Reimplemented from MemcardUser.

◆ OnFileSaved()

virtual void SaveRemixMCT::OnFileSaved ( int nStatus)
virtual

Advance past a finished write, or rewrite the index once the payload has been written.

The status is recorded whether the write succeeded or not. A successful write at step 3 moves to step 4 and rewrites the index, and every other successful write reports the task finished.

Parameters
nStatusOne of MemcardStatus.
Ghidra address:
NTSC-U/C: 0x00186ad8

Reimplemented from MemcardUser.


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