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

Base of the two screens that write a remix to a memory card. More...

#include <metsaveremix.h>

Inheritance diagram for MetSaveRemix:
Collaboration diagram for MetSaveRemix:

Public Member Functions

 MetSaveRemix (MetRenderer *pRenderer, int nPriority, const HxStr &name, const HxStr &directory, const HxStr &file)
 Construct the saver.
virtual ~MetSaveRemix ()
virtual void RecordPendingSave (const MemcardConnectState &selection, int nOwnerPad, HxStr remixName, HxStr levelName, std::vector< FreqAppearance > appearances, int nAlbumNumber)
 Record the remix a save is about to write and enquire about the target card.
virtual void OnSaveAbandoned ()
 React to the user giving up on the save.
virtual void OnSaveDialogueClosed ()
 React to the closing of a save dialogue that OnMsgScreenDismissed() does not handle.
virtual void OnDuplicateNameDeclined ()
 React to NO on mem_remix_dupe.
virtual void OnKeyboardTextEntered (const HxStr &text)
 Record the entered name and start the save.
virtual void OnConnectState (MemcardConnectState state, int nStatus)
 Act on the state of the card the save targets.
virtual void OnCardFormatted (int nPortSlot, int nStatus)
 Report a finished format.
virtual void OnRemixSaved (int nPortSlot, int nStatus)
 Report a finished remix save.
virtual void OnRemixesListed (int nPortSlot, int nStatus)
 Check the listing of the target card before saving.
virtual void OnMsgScreenDismissed (const HxStr &name, int nChoice)
 Act on the answer to one of the save dialogues.
Public Member Functions inherited from MetScreen
 MetScreen (MetRenderer *pRenderer, int nPriority, const HxStr &name, const HxStr &directory, const HxStr &file)
 Construct a screen and start its container load.
virtual ~MetScreen ()
 Unregister from the renderer and release the container.
void DeliverCommand (const MetScreenCommand *pCommand)
 Play the sound one navigation command calls for and then act on the command.
void UpdateAnimationFrame (float flTime)
 Drive the frame of whichever animation is running and run the idle hook when none is.
void UpdateFrame (float flTime)
 Advance one screen by one frame.
virtual void PushNamedScreen (const HxStr &name)
 Bring one named screen onto the renderer's screen stack.
virtual void EnterAndShow ()
 Show this screen and start its enter animation.
virtual void ActivateNamedPanel (const HxStr &name)
 Make one named screen the renderer's active panel.
virtual void OnPanelActivated ()
 Act on this screen having become the renderer's active panel.
virtual void ExitScreenByName (const HxStr &name)
 Start one named screen's exit animation.
virtual void BeginExit ()
 Start this screen's exit animation at the renderer's current time.
virtual void OnUnusedHook ()
 Do nothing.
virtual void OnKeyboardDismissed ()
 Take control back after the keyboard screen has finished.
virtual void OnDrawPass ()
 Contribute to the renderer's draw pass.
virtual void OnDestroying ()
 Release what the screen acquired, ahead of the rest of destruction.
virtual int PollContainerLoad ()
 Advance this screen's container load and resolve its views once the load finishes.
virtual void OnMsgScreenShown (const HxStr &name)
 Act on a message dialogue becoming visible.
virtual void SetShowing (int nShowing)
 Show or hide the view and every drawable the container loaded.
virtual void BeginContainerLoad (const HxStr &directory, const HxStr &file)
 Intern a container load under this screen's container name and enqueue it.
virtual void HandleCommand (const MetScreenCommand *pCommand)
 Act on a navigation command.
virtual void PlaySlideSound (int nSelector)
 Play the sound that accompanies sliding between screens.
virtual void PlayLeaveSound (int nSelector)
 Play the sound that accompanies departing a screen.
virtual void PlayHighSound (int nSelector)
 Play the sound that accompanies the emphasised selection.
virtual void PlayCycleLeftSound (int nSelector)
 Play the sound that accompanies cycling a value to the left.
virtual void PlayCycleRightSound (int nSelector)
 Play the sound that accompanies cycling a value to the right.
virtual void PlayErrorSound (int nSelector)
 Play the sound that accompanies a rejected input.
virtual void UpdateIdle (float flTime)
 Advance whatever the screen updates once per frame while it is idle.
virtual void UpdateIdleAnimation (float flTime)
 Advance whatever the screen animates while it is neither entering nor exiting.
virtual void StartRepeatingSound (float flStartTime, float flInterval, Rnd::Button *pButton, int nCycles)
 Start alternating one button between its states 2 and 1.
virtual void UpdateRepeatingSound (float flTime)
 Advance the alternation that StartRepeatingSound() started.
virtual void OnRepeatingSoundFinished (Rnd::Button *pButton)
 Act on the alternation that StartRepeatingSound() started having finished.
virtual void StartEnterAnimation (float flTime)
 Rewind the enter animation and record the time it starts at.
virtual void UpdateEnterAnimation (float flTime)
 Drive the enter animation and finish it once it passes its end.
virtual void OnEnterFinished ()
 Act on the enter animation having finished.
virtual void StartExitAnimation (float flTime)
 Record the time the exit animation starts at.
virtual void UpdateExitAnimation (float flTime)
 Drive the exit animation and hide the screen once it passes its end.
virtual void OnExitFinished ()
 Act on the exit animation having finished.
virtual void Draw ()
 Draw the view.
virtual void ResolveContainerViews ()
 Resolve the three views the container produced and hide the screen.
Public Member Functions inherited from MsgSink
void * operator new (size_t nSize)
 Allocate a sink from the tagged heap under the tag "MsgSink".
void operator delete (void *pBlock)
 Release a sink to the tagged heap.
virtual ~MsgSink ()
virtual void Dispatch (Message *pMsg)
 Accept a message.
Public Member Functions inherited from MemcardUser
virtual ~MemcardUser ()
 Release the receiver.
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 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 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 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.
virtual void OnFileLoaded (int nStatus)
 Report a finished load of one file.
virtual void OnFileSaved (int nStatus)
 Report a finished save of one file.
Public Member Functions inherited from MetKBUser
virtual ~MetKBUser ()

Protected Attributes

MemcardConnectState mTargetSlot
std::vector< FreqAppearance > mAppearances
HxStr mRemixName
int mOwnerPad
int mCopying
int mKeyboardPending
Protected Attributes inherited from MetScreen
float mAnimEndFrame
float mEnterStartTime
MetRenderer * mRenderer
int mExitChoice
int mAcceptsCommands
Rnd::View * mEnterAnim
std::vector< HxStr > mHelpKeys
int mViewsUnresolved
int mPlaysCommandSounds
int mShowsLoadedDrawables

Additional Inherited Members

Static Public Member Functions inherited from MetScreen
static std::map< HxStr, MetContainerLoad * > & ContainerLoaderMap ()
 Shared table of container loads, interned under the container name.
static std::map< HxStr, MetScreenEntry > & ScreenRegistry ()
 Shared table of live screens, interned under the screen registry key.
static MetScreen * FindScreenByName (const HxStr &name)
 Resolve one screen by its registry key.
static MetScreen * FindEndScreen (MetRenderer *pRenderer, const HxStr &name)
 Resolve one end-of-game screen by its registry key, failing fatally when it is absent.
static void CreateMainMenuScreens (MetRenderer *pRenderer)
 Create the main-menu screens.
static void DestroyAllScreens ()
 Delete every registered screen and release every container loader.
static void CreateStartupScreens (MetRenderer *pRenderer)
 Create the four screens the front end needs before its containers have loaded.
static void CreateFrontEndScreens (MetRenderer *pRenderer)
 Create every remaining front-end screen, once.
static void DestroyCategory2Screens ()
 Delete and unregister every screen in category 2.
static void DestroyCategory1Screens ()
 Delete and unregister every screen in category 1.
static void DestroyNonDefaultScreens ()
 Delete and unregister every screen outside category 0, then rewind the rndMetLocAndNet zone.
static void PollContainerLoads ()
 Poll every container load that has not finished, and hide the drawables of each that does.
Public Attributes inherited from MetScreen
Rnd::View * mView
 The container's root view.
int mEnterPending
 Set when the screen was pushed before its container load finished.
int mActivatePending
 Set when the screen was activated as a panel before its container load finished.
float mRepeatScale
 Scale on the input auto-repeat interval.
Protected Member Functions inherited from MetScreen
virtual void DispatchPriv (Message *pMsg)
 Act on a message.
void ResolveAnimationViews ()
 Resolves the two animation views from the screen name and records the enter animation's end frame.

Detailed Description

Base of the two screens that write a remix to a memory card.

13MetSaveRemix in the RTTI descriptor at 0x008ef660, with three public non-virtual bases at fixed offsets, MetScreen at +0x00, MemcardUser at +140, and MetKBUser at +144. The object is 0xe8 bytes. Both children fix the size independently. MetSaveRemixScreen starts its members at +0xe8 and MetRemixDelScreen places its ListDataProvider base at +232.

Two classes derive from the class, MetRemixDelScreen and MetSaveRemixScreen.

Three vtables belong to the class. The primary table at 0x00809c00 has 43 entries, four more than the MetScreen table. The class declares four new virtuals at slots 39 through 42 at 0x00372488, 0x0037a618, 0x0037a620, and 0x0037a628. Slots 40 and 41 are two-instruction jr ra stubs. Slot 42 is not. Its body dispatches back through slot 40 of the primary table with no argument. Slot 42 is therefore a public alias for the empty slot 40. The 21-entry MemcardUser table at 0x00809b50 adjusts this by -140 and overrides its slots 2, 5, 8, and 11 at 0x00372c10, 0x00373808, 0x00374b58, and 0x00374208. The three-entry MetKBUser table at 0x00809b30 adjusts this by -144 and overrides its slot 2 at 0x0037a650.

All four slots the class declares are declared below. Slot 39 takes six arguments in a1 through t2, and two of their types come from other classes. MemcardConnectState is the 0x18-byte record whose five fields mirror this class's +0x94 through +0xa8, and FreqAppearance is the 0x14-byte element of the vector at +0xac, a name the RTTI records. The 0x38-byte element of the vector at +0xcc is MetRemixRecord, whose name is inferred.

The constructor at 0x00372120 takes the renderer, the load priority, and the three names, and forwards all five to MetScreen. Everything it does after the three vptr writes is member initialisation, in this order. The port and slot of mTargetSlot start at -1. Its name is built from the empty string at 0x00809840, and the destructor frees its buffer for that reason. Its words at +0xa0 and +0xa4 start at -1 and its word at +0xa8 at zero. Both vectors and the two strings at +0xb8 and +0xc0 start empty, mOwnerPad, mRefreshFirstCardSlot, mCopying, and mAlbumNumber start at zero, and mKeyboardPending is never written. The three words at +0xa0, +0xa4, and +0xa8 are accessed through a register set to this + 0x94, and all three receive literals.

Every one of those stores is a member initialiser, and the MemcardConnectState default constructor produces the -1, empty-string, -1, -1, zero run at +0x94 exactly. The match independently confirms the layout of MemcardConnectState.

The destructor at 0x00372248 destroys the 0x38-byte elements of mCardRemixes and deallocates its buffer, frees the two strings at +0xc0 and +0xb8, destroys the 0x14-byte elements of mAppearances and deallocates that buffer, frees the name of mTargetSlot, restores the MetKBUser vptr to 0x007f16a0 and the MemcardUser vptr to 0x007daf78, runs the MetScreen destructor, and releases the object with the tag MsgSink. Every one of those steps is compiler-generated member destruction or a vptr restore. The definition is therefore empty. The routine at 0x00183fd0 is the element destructor rather than a statement of this destructor.

One inherited slot differs from the MetScreen table, slot 15 at 0x00375590. That override compares an HxStr argument in a1 against a literal and then tests a second argument in a2 against one. Slot 15 therefore takes two parameters rather than the one MetScreen records for it.

Constructor & Destructor Documentation

◆ MetSaveRemix()

MetSaveRemix::MetSaveRemix ( MetRenderer * pRenderer,
int nPriority,
const HxStr & name,
const HxStr & directory,
const HxStr & file )

Construct the saver.

Parameters
pRendererThe front-end renderer this screen registers on.
nPriorityThe load priority.
nameThe screen name.
directoryThe directory the container loads from.
fileThe container name, without the .rnd suffix.
Ghidra address:
NTSC-U/C: 0x00372120
Ghidra address:
PAL: 0x003a0c30

◆ ~MetSaveRemix()

virtual MetSaveRemix::~MetSaveRemix ( )
virtual
Ghidra address:
NTSC-U/C: 0x00372248
Ghidra address:
PAL: 0x003a0d60

Member Function Documentation

◆ RecordPendingSave()

virtual void MetSaveRemix::RecordPendingSave ( const MemcardConnectState & selection,
int nOwnerPad,
HxStr remixName,
HxStr levelName,
std::vector< FreqAppearance > appearances,
int nAlbumNumber )
virtual

Record the remix a save is about to write and enquire about the target card.

Slot 39.

The register reads prove six parameters. a1 is a MemcardConnectState whose five fields are copied into mTargetSlot through the compiler-generated assignment, a2 becomes mOwnerPad, a3 and t0 are assigned to mRemixName and mLevelName, t1 is assigned to mAppearances, and t2 becomes mAlbumNumber. It also clears mRefreshFirstCardSlot, stores itself in MemcardManager::mUser, and queues a connect-state enquiry for the selection's port and slot, with OnConnectState() receiving the result.

a3, t0, and t1 are by value rather than by reference. The tail of the routine frees the string buffer of each of the first two and destroys every element of the third before returning. a1 is not destroyed there and is therefore a reference. OnMsgScreenDismissed() is the one recovered caller, and the title is inferred.

Parameters
selectionThe remix being saved.
nOwnerPadThe controller the save belongs to, or -1 for any controller.
remixNameAssigned to mRemixName.
levelNameAssigned to mLevelName.
appearancesAssigned to mAppearances.
nAlbumNumberAssigned to mAlbumNumber.
Ghidra address:
NTSC-U/C: 0x00372488
Ghidra address:
PAL: 0x003a0fd0

◆ OnSaveAbandoned()

virtual void MetSaveRemix::OnSaveAbandoned ( )
virtual

React to the user giving up on the save.

Slot 40, empty.

A two-instruction jr ra stub. OnMsgScreenDismissed() runs it for the giving-up choice of mem_check, mem_remix_2many, and the two no-space dialogues, and OnDuplicateNameDeclined() runs it as well.

Ghidra address:
NTSC-U/C: 0x0037a618
Ghidra address:
PAL: 0x003aa0c8

Reimplemented in MetRemixDelScreen, and MetSaveRemixScreen.

◆ OnSaveDialogueClosed()

virtual void MetSaveRemix::OnSaveDialogueClosed ( )
virtual

React to the closing of a save dialogue that OnMsgScreenDismissed() does not handle.

Slot 41, empty.

A two-instruction jr ra stub.

Ghidra address:
NTSC-U/C: 0x0037a620
Ghidra address:
PAL: 0x003aa0d0

Reimplemented in MetRemixDelScreen, and MetSaveRemixScreen.

◆ OnDuplicateNameDeclined()

virtual void MetSaveRemix::OnDuplicateNameDeclined ( )
virtual

React to NO on mem_remix_dupe.

Slot 42.

Dispatches through OnSaveAbandoned() and does nothing else. It is therefore an alias for the empty slot 40 rather than a separate stub. Both subclasses override it to request a new name from the on-screen keyboard.

Ghidra address:
NTSC-U/C: 0x0037a628
Ghidra address:
PAL: 0x003aa200

Reimplemented in MetRemixDelScreen, and MetSaveRemixScreen.

◆ OnKeyboardTextEntered()

virtual void MetSaveRemix::OnKeyboardTextEntered ( const HxStr & text)
virtual

Record the entered name and start the save.

MetKBUser slot 2.

The override assigns its argument to mRemixName. That assignment settles the parameter of the MetKBUser virtual as a const HxStr &. Both subclasses forward to this body.

After the assignment it stores itself in MemcardManager::mUser, queues a connect-state enquiry for mTargetSlot, raises the save dialogue through BeginSave(), and limits that dialogue to the controller mOwnerPad identifies.

Parameters
textThe remix name the user entered.
Ghidra address:
NTSC-U/C: 0x0037a650
Ghidra address:
PAL: 0x003aa228

Implements MetKBUser.

Reimplemented in MetRemixDelScreen, and MetSaveRemixScreen.

◆ OnConnectState()

virtual void MetSaveRemix::OnConnectState ( MemcardConnectState state,
int nStatus )
virtual

Act on the state of the card the save targets.

MemcardUser slot 2.

A failed enquiry raises mem_check with RETRY and CONTINUE, or RETRY and CANCEL when mCopying marks a copy. An unformatted card raises mem_format_check with NO and YES. A formatted card either records the state as the first GlobalSettings::mCardSlots entry and exits MetMsgScreen when mRefreshFirstCardSlot is set, or empties mCardRemixes, queues a listing of the target card into it, and raises the save dialogue. Every dialogue is limited to the controller mOwnerPad identifies. The European release also raises mem_format_check for an enquiry that fails with kMemcardStatusNotFormatted.

Parameters
stateThe card's state, passed by value and destroyed on return.
nStatusThe enquiry status, kMemcardStatusOk on success.
Ghidra address:
NTSC-U/C: 0x00372c10
Ghidra address:
PAL: 0x003a1840

Reimplemented from MemcardUser.

◆ OnCardFormatted()

virtual void MetSaveRemix::OnCardFormatted ( int nPortSlot,
int nStatus )
virtual

Report a finished format.

MemcardUser slot 5.

Success raises mem_format_done and status 13 raises mem_format_already, each with one CONTINUE button and made the active panel. Any other status raises mem_check with RETRY and BACK. The port and slot are not read.

Parameters
nPortSlotThe packed port and slot. The body does not read it.
nStatusThe format status.
Ghidra address:
NTSC-U/C: 0x00373808
Ghidra address:
PAL: 0x003a2b28

Reimplemented from MemcardUser.

◆ OnRemixSaved()

virtual void MetSaveRemix::OnRemixSaved ( int nPortSlot,
int nStatus )
virtual

Report a finished remix save.

MemcardUser slot 8.

Success on port 1 sets mRefreshFirstCardSlot and queues a connect-state enquiry. OnConnectState() then records the result as the first GlobalSettings::mCardSlots entry. The European release does this only while GlobalSettings::mCardSlots has an entry. Success anywhere else exits MetMsgScreen. A full card raises save_fail_no_space, or copy_fail_no_space for a copy with the space GlobalSettings::mMinimumFreeClusters requires, and any other status raises save_fail_no_space with the save_fail_general text. In the European release the routine takes a third argument, nKilobytes, the kilobytes the card lacked, and the save_fail_no_space text for a full card receives it.

Parameters
nPortSlotThe packed port and slot. The body does not read it.
nStatusThe save status.
Ghidra address:
NTSC-U/C: 0x00374b58
Ghidra address:
PAL: 0x003a4158

Reimplemented from MemcardUser.

◆ OnRemixesListed()

virtual void MetSaveRemix::OnRemixesListed ( int nPortSlot,
int nStatus )
virtual

Check the listing of the target card before saving.

MemcardUser slot 11.

A remix in mCardRemixes with the name mRemixName raises mem_remix_dupe with NO and YES. Fifty or more remixes raise mem_remix_2many with RETRY and CONTINUE. Otherwise the remix is saved through MemcardManager::CreateSaveRemixTask(). Neither argument is read.

Parameters
nPortSlotThe packed port and slot. The body does not read it.
nStatusThe listing status. The body does not read it.
Ghidra address:
NTSC-U/C: 0x00374208
Ghidra address:
PAL: 0x003a36b8

Reimplemented from MemcardUser.

◆ OnMsgScreenDismissed()

virtual void MetSaveRemix::OnMsgScreenDismissed ( const HxStr & name,
int nChoice )
virtual

Act on the answer to one of the save dialogues.

Slot 15.

A retry answer queues a new connect-state enquiry, and a give-up answer runs OnSaveAbandoned(). The YES answer to mem_format_check queues a format and raises mem_format_go, and NO runs slot 39 with the recorded request. mem_format_done and the YES answer to mem_remix_dupe save the remix and raise the save dialogue, and NO to mem_remix_dupe runs OnDuplicateNameDeclined(). Any other dialogue runs OnSaveDialogueClosed(). In the European release, NO to mem_format_check raises the save_fail_no_format error with the save_aborted text in place of slot 39, and the answers to save_fail_no_format act like those to save_fail_no_space.

Parameters
nameThe dialogue name.
nChoiceThe index of the button chosen.
Ghidra address:
NTSC-U/C: 0x00375590
Ghidra address:
PAL: 0x003a4dd8

Reimplemented from MetScreen.

Reimplemented in MetRemixDelScreen, and MetSaveRemixScreen.

Member Data Documentation

◆ mTargetSlot

MemcardConnectState MetSaveRemix::mTargetSlot
protected

◆ mAppearances

std::vector<FreqAppearance> MetSaveRemix::mAppearances
protected

◆ mRemixName

HxStr MetSaveRemix::mRemixName
protected

◆ mOwnerPad

int MetSaveRemix::mOwnerPad
protected

◆ mCopying

int MetSaveRemix::mCopying
protected

◆ mKeyboardPending

int MetSaveRemix::mKeyboardPending
protected

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