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

Front-end renderer that owns the screen stack and drives every MetScreen. More...

#include <metrenderer.h>

Inheritance diagram for MetRenderer:
Collaboration diagram for MetRenderer:

Public Member Functions

 MetRenderer ()
 Construct the renderer and start the front-end load.
virtual ~MetRenderer ()
 Release the screen stack, the two input helpers, and the fade.
virtual void DispatchPriv (Message *pMsg)
 Dispatch one front-end message.
virtual void Start ()
 Start the front end running.
virtual void Stop ()
 Stop the front end running.
virtual void Update ()
 Advance the front end by one frame, including the boot and disc-problem phases.
virtual void Draw ()
 Draw the front-end scene, every screen, and the debug overlays.
virtual void UpdateSimple ()
 Advance every screen's animation frame.
virtual void DrawSimple ()
 Draw the front-end scene and the debug overlays, and no screen.
virtual void OnFadeOutDone ()
 Promote the pending panel and start it entering.
virtual void OnFadeInDone ()
 Do nothing when a fade in finishes.
void SetActivePanel (MetScreen *pScreen)
 Record one screen as the active panel.
void OnReturnFromGame ()
 Do nothing.
void OnReturnToMenus ()
 Do nothing.
void ResolveArenaView (int nSkipResolve)
 Resolve Metagame_arena.view and attach it to the background scene.
void ClearBackgroundScene ()
 Release the animatable, drawable, and transformable lists of the background scene at mBackgroundScene.
void AddScreenView (Rnd::View *pView)
 Attach the three animatable, drawable, and transformable subobjects of one view to the screen scene at mScreenScene.
void AddBackgroundView (Rnd::View *pView)
 Attach one view to the background scene at mBackgroundScene.
void RemoveScreenView (Rnd::View *pView)
 Detach one view from the screen scene at mScreenScene.
void AddScreen (MetScreen *pScreen)
 Append one screen to the screen stack.
void RemoveScreen (MetScreen *pScreen)
 Erase one screen from the screen stack and detach its view from the scene.
void ActivatePanel (MetScreen *pScreen)
 Make one screen the active panel and start it entering.
void MoveScreenViewToFront (Rnd::View *pView)
 Move a screen view to the front of the screen scene's draw order.
void UnlockAllStages ()
 Send a MetUnlockStagesMsg to the active panel, when there is one.
int IsLogoScreenActive ()
 Report whether the active panel is a MetLogoScreen.
void ForwardToPanel (Message *pMsg)
 Hand a message to the active panel, when there is one.
void ForwardToPanelUnchecked (Message *pMsg)
 Hand a message to the active panel without testing for one.
Public Member Functions inherited from MsgSource
virtual ~MsgSource ()
virtual void AddSink (MsgSink *pSink)
 Register a sink, ignoring a sink that is already registered.
virtual void RemoveSink (MsgSink *pSink)
 Unregister the first occurrence of a sink.
void Send (Message *pMsg) const
 Deliver a message to every registered sink, in registration order.
void ClearSinks ()
 Unregister every sink.
Public Member Functions inherited from RendererBase
 RendererBase ()
 Start the queue with the router as its one sink.
virtual ~RendererBase ()
 Release the queue and the router.
virtual void Dispatch (Message *pMsg)
 Accept a message into the queue.
virtual void PollMessages ()
 Deliver every queued message.
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 ()
Public Member Functions inherited from FadeUser
virtual ~FadeUser ()

Static Public Member Functions

static int PollArenaLoader (float *pfProgress)
 Report how far the arena container load has advanced.
static void UnloadArenaLoader ()
 Unload the arena container.

Public Attributes

float mAnimationFrame
 Current animation frame position of the front end.
int mPanelActive
 Flag that MetScreen sets when it activates a named sub-screen and clears when it activates none.
int mTitlePromptShowing
 Zeroed by the constructor.
int mMaxPadIndex
 Highest pad index DispatchPriv() accepts a RawControllerMsg from.
Public Attributes inherited from MsgSource
int mGraphBuilt
 A word no member of this class reads.

Static Public Attributes

static MetRenderer * sInstance
 The one front-end renderer.

Friends

class MetaGameWorld

Detailed Description

Front-end renderer that owns the screen stack and drives every MetScreen.

Its RTTI descriptor is at 0x008eef98. It has three public non-virtual bases at fixed offsets, MsgSource at +0x00, RendererBase at +0x14, and FadeUser at +0x5c. Its GetTypeInfo is at 0x00370f98.

MetScreen stores its renderer at +0x10 and registers itself on it as a message sink through MsgSource::AddSink() during construction, which is how the pointer is known to address the MsgSource subobject at offset 0.

All three bases are declared and the three RTTI offsets follow from their sizes rather than being asserted. MsgSource is 0x14 bytes, which places RendererBase at 20. The constructor at 0x00369fb0 confirms that independently: it writes the MsgSource table at +0x10 rather than at +0x00, which is where a class with no base of its own stores its vptr, and the destructor deallocates a three-word std::vector at +0x00 through +0x0c below it. RendererBase is 0x48 bytes, being its 4-byte MsgSink base, the 0x3c-byte MsgQueue at +0x04, and the 8-byte Router at +0x40, which places FadeUser at 92. FadeUser is 4 bytes of vptr, which ends the base region at +0x60. Each figure is recovered independently of the others, so the three offsets agreeing with the descriptor is a check rather than an assumption.

Three vtables belong to the class, one per base, and a slot index restarts in each.

The primary table at 0x008091f8 is the MsgSource table and has four entries, the same length as MsgSource's own table at 0x008299f0. The class therefore declares no virtual of its own, and the only entry that differs is slot 1, the destructor.

The RendererBase table at 0x00809198 has eleven entries and adjusts this by -20. A diff against RendererBase's own table at 0x007d2d20 reads overrides at slots 1, 3, 4, 5, 7, 8, 9, and 10, with slots 2 and 6 inherited. Slots 3, 7, and 8 store the __pure_virtual stub at 0x005381a8 in the base, so this class is what makes the renderer concrete.

The FadeUser table at 0x00809170 has four entries and adjusts this by -92. Every entry differs from FadeUser's own table at 0x007ec070, and the two that matter are slots 2 and 3, both of which are pure in the base.

The object is at least 0xd8 bytes. Nothing derives from the class, so no base offset in any descriptor pins the total, and the figure is the lower bound the constructor's highest store gives.

Six of the eight RendererBase overrides take the names RendererBase declares them under, and what each override does is recorded on its declaration.

0x00390088 and 0x00390090 are empty bodies that take the renderer. Every caller, from nine screens and the renderer's own OnFreqEnded(), reaches the same single copy of each, so they are ordinary members, OnReturnFromGame() and OnReturnToMenus().

Constructor & Destructor Documentation

◆ MetRenderer()

MetRenderer::MetRenderer ( )

Construct the renderer and start the front-end load.

Records itself in the singleton pointer at 0x006c3598, which the destructor clears, fills the two debug-overlay switches from Script::QueryConfigString()'s integer sibling under codes 0x397 and 0x3a2, sets the device clear colour to opaque black, and enqueues the three container loads the boot phase of the poll routine waits on.

Ghidra address:
NTSC-U/C: 0x00369fb0
Ghidra address:
PAL: 0x00398428

◆ ~MetRenderer()

virtual MetRenderer::~MetRenderer ( )
virtual

Release the screen stack, the two input helpers, and the fade.

Slot 1 of all three tables. ~RendererBase and ~MsgSource are inlined into the body rather than called, and the tagged release at the end passes MsgSink rather than the name of this class, because MsgSink declares the allocation pair and this class inherits it.

Ghidra address:
NTSC-U/C: 0x0036a460
Ghidra address:
PAL: 0x003988e0

Member Function Documentation

◆ DispatchPriv()

virtual void MetRenderer::DispatchPriv ( Message * pMsg)
virtual

Dispatch one front-end message.

Slot 3 of the RendererBase table, where both RendererBase and MsgSink store the __pure_virtual stub. Compares the message identity against seven registered identities and forwards anything else to the active panel.

A RawControllerMsg is decoded into a MetScreenCommand and delivered to the active panel. A MetStartNetLaunchMsg and a LobbyConnectionLostMsg are forwarded to the active panel's MsgSink::Dispatch(). A GameConnectionLostMsg is discarded. An IsRecordingMsg stores its payload in mRecording.

Parameters
pMsgThe message to dispatch.
Ghidra address:
NTSC-U/C: 0x0036c5d8
Ghidra address:
PAL: 0x0039afd8

Implements MsgSink.

◆ Start()

virtual void MetRenderer::Start ( )
virtual

Start the front end running.

RendererBase slot 4, empty in the base. Clears the auto-repeat state, sets mRunning, rewinds the animation frame to 1.0f, and records the current time as the frame base in mPreviousFrameNs.

Ghidra address:
NTSC-U/C: 0x0036a900
Ghidra address:
PAL: 0x00398de0

Reimplemented from RendererBase.

◆ Stop()

virtual void MetRenderer::Stop ( )
virtual

Stop the front end running.

RendererBase slot 5, empty in the base. Clears mRunning, resets the command repeater, empties the screen stack one element at a time from the front, releases both scene views, clears the active panel, and stops SND_MET_MUSIC1 unless MetFrontEndState::mPendingTransition is 2. The destructor calls the routine directly.

Ghidra address:
NTSC-U/C: 0x0036b0c0
Ghidra address:
PAL: 0x00399748

Reimplemented from RendererBase.

◆ Update()

virtual void MetRenderer::Update ( )
virtual

Advance the front end by one frame, including the boot and disc-problem phases.

RendererBase slot 7, where the base stores the __pure_virtual stub. Four phases, each guarded by its own flag. The boot phase waits for the three container loads, runs Start() through the table, and makes MetMemDetectStartup the active panel. The disc-problem phase starts the front-end music and promotes the pending panel. The third phase shows or hides met_disc_prob.view. The frame phase advances the animation frame and runs MetScreen::UpdateFrame() on every screen on the stack.

Ghidra address:
NTSC-U/C: 0x0036b190
Ghidra address:
PAL: 0x00399818

Implements RendererBase.

◆ Draw()

virtual void MetRenderer::Draw ( )
virtual

Draw the front-end scene, every screen, and the debug overlays.

RendererBase slot 8, where the base stores the __pure_virtual stub. Draws nothing at all while mRunning is clear.

Ghidra address:
NTSC-U/C: 0x00371670
Ghidra address:
PAL: 0x003a0168

Implements RendererBase.

◆ UpdateSimple()

virtual void MetRenderer::UpdateSimple ( )
virtual

Advance every screen's animation frame.

RendererBase slot 9, empty in the base. The routine differs from Update()'s frame phase in exactly one respect: it runs MetScreen::UpdateAnimationFrame() where the poll routine runs MetScreen::UpdateFrame().

Ghidra address:
NTSC-U/C: 0x0036b740
Ghidra address:
PAL: 0x00399e28

Reimplemented from RendererBase.

◆ DrawSimple()

virtual void MetRenderer::DrawSimple ( )
virtual

Draw the front-end scene and the debug overlays, and no screen.

RendererBase slot 10, empty in the base. The routine is Draw() without the pre-pass and without the walk of the screen stack.

Ghidra address:
NTSC-U/C: 0x00371570
Ghidra address:
PAL: 0x003a0068

Reimplemented from RendererBase.

◆ OnFadeOutDone()

virtual void MetRenderer::OnFadeOutDone ( )
virtual

Promote the pending panel and start it entering.

FadeUser slot 2. Does nothing while mDiscProblemPending is set. The same five-step promotion appears twice more inside Update().

Ghidra address:
NTSC-U/C: 0x003715e0
Ghidra address:
PAL: 0x003a00d8

Implements FadeUser.

◆ OnFadeInDone()

virtual void MetRenderer::OnFadeInDone ( )
virtual

Do nothing when a fade in finishes.

FadeUser slot 3.

The body is empty. It is a genuine override rather than an inherited empty body, because a class cannot be concrete while a slot points at that stub, so this empty body is what makes the renderer instantiable.

Ghidra address:
NTSC-U/C: 0x003715d8
Ghidra address:
PAL: 0x003a00d0

Implements FadeUser.

◆ SetActivePanel()

void MetRenderer::SetActivePanel ( MetScreen * pScreen)

Record one screen as the active panel.

Stores pScreen in mActivePanel and then, when the auto-repeat table is present, clears it. The title is inferred from the field MetScreen slot 6 pairs the call with.

Parameters
pScreenThe screen to record.
Ghidra address:
NTSC-U/C: 0x003714c8
Ghidra address:
PAL: 0x0039ffc0

◆ OnReturnFromGame()

void MetRenderer::OnReturnFromGame ( )

Do nothing.

A two-instruction jr ra body that about ten screens call as they enter or return to the title, among them MetSaveRemixScreen::EnterAndShow(), MetSoloEndRemixScreen::ReturnToTitle(), and MetSoloWinScreen's slot 36. The caller passes the renderer as the receiver. OnFreqEnded() calls it on every path from a finished song to a front-end screen other than the end-of-game screen. The title records that return. The body supplies no further evidence.

Ghidra address:
NTSC-U/C: 0x00390088
Ghidra address:
PAL: 0x003c1958

◆ OnReturnToMenus()

void MetRenderer::OnReturnToMenus ( )

Do nothing.

A two-instruction jr ra body that the same screens call after OnReturnFromGame(). OnFreqEnded() calls it on the paths that also clear GameParams::mLoadingGame and return to a selection menu, and MetMainScreen calls it alone as the solo and multiplayer menus open. The title records that return to the menus. The body supplies no further evidence.

Ghidra address:
NTSC-U/C: 0x00390090
Ghidra address:
PAL: 0x003c1960

◆ ResolveArenaView()

void MetRenderer::ResolveArenaView ( int nSkipResolve)

Resolve Metagame_arena.view and attach it to the background scene.

A non-zero argument skips the resolve and attaches nothing, because the view pointer then stays null. The title is inferred from the literal. Public because the screens that return to the title call it directly: MetMultiEndScreen's slot 36, the routine at 0x002fb350, MetSoloEndRemixScreen::ReturnToTitle(), and the slot 36 of MetSoloLoseScreen and MetSoloWinScreen. The image has no accessor to route those calls through.

Parameters
nSkipResolveNon-zero to attach nothing.
Ghidra address:
NTSC-U/C: 0x0036a9e0
Ghidra address:
PAL: 0x00398ec0

◆ ClearBackgroundScene()

void MetRenderer::ClearBackgroundScene ( )

Release the animatable, drawable, and transformable lists of the background scene at mBackgroundScene.

The title is inferred. Stop() calls it, and so do MetSonyScreen's finishing routine at 0x003ba620 and MetLoadGameScreen::OnFadeInDone() at 0x0028e02c from outside the class, which is why it is public. The image has no accessor to route those calls through.

Ghidra address:
NTSC-U/C: 0x00371960
Ghidra address:
PAL: 0x003a0458

◆ AddScreenView()

void MetRenderer::AddScreenView ( Rnd::View * pView)

Attach the three animatable, drawable, and transformable subobjects of one view to the screen scene at mScreenScene.

Each of the three is appended only when the scene does not already store it, which the three membership tests at 0x00370ab8, 0x00370b08, and 0x00370b58 decide. A null view is passed through to all three as null rather than rejected. The title is inferred.

Parameters
pViewThe view to attach.
Ghidra address:
NTSC-U/C: 0x003717b0
Ghidra address:
PAL: 0x003a02a8

◆ AddBackgroundView()

void MetRenderer::AddBackgroundView ( Rnd::View * pView)

Attach one view to the background scene at mBackgroundScene.

The body is AddScreenView() against the other scene, instruction for instruction, including the three membership tests and the null pass-through. The title is inferred.

Parameters
pViewThe view to attach.
Ghidra address:
NTSC-U/C: 0x003718b8
Ghidra address:
PAL: 0x003a03b0

◆ RemoveScreenView()

void MetRenderer::RemoveScreenView ( Rnd::View * pView)

Detach one view from the screen scene at mScreenScene.

The counterpart of AddScreenView(). The transformable, drawable, and animatable subobjects are removed in that order, and a null view is passed through to all three as null. The title is inferred.

Parameters
pViewThe view to detach.
Ghidra address:
NTSC-U/C: 0x00371858
Ghidra address:
PAL: 0x003a0350

◆ AddScreen()

void MetRenderer::AddScreen ( MetScreen * pScreen)

Append one screen to the screen stack.

A screen already on the stack is not appended a second time. The title is inferred from the vector the body appends to.

Parameters
pScreenThe screen to append.
Ghidra address:
NTSC-U/C: 0x003719e0
Ghidra address:
PAL: 0x003a04d8

◆ RemoveScreen()

void MetRenderer::RemoveScreen ( MetScreen * pScreen)

Erase one screen from the screen stack and detach its view from the scene.

A screen absent from the stack does nothing. The title is inferred.

Parameters
pScreenThe screen to erase.
Ghidra address:
NTSC-U/C: 0x00371a78
Ghidra address:
PAL: 0x003a0570

◆ ActivatePanel()

void MetRenderer::ActivatePanel ( MetScreen * pScreen)

Make one screen the active panel and start it entering.

The same promotion OnFadeOutDone() performs on the pending panel. The image records no caller. The title is inferred.

Parameters
pScreenThe screen to promote.
Ghidra address:
NTSC-U/C: 0x003714f8
Ghidra address:
PAL: 0x0039fff0

◆ MoveScreenViewToFront()

void MetRenderer::MoveScreenViewToFront ( Rnd::View * pView)

Move a screen view to the front of the screen scene's draw order.

A view the scene does not draw yet is attached through AddScreenView() instead. The image records no caller. The title is inferred.

Parameters
pViewThe view to raise.
Ghidra address:
NTSC-U/C: 0x00371730
Ghidra address:
PAL: 0x003a0228

◆ UnlockAllStages()

void MetRenderer::UnlockAllStages ( )

Send a MetUnlockStagesMsg to the active panel, when there is one.

The ActivateAllAccessMode script command is the caller. The title is inferred.

Ghidra address:
NTSC-U/C: 0x0036b8c8
Ghidra address:
PAL: 0x00399fb0

◆ IsLogoScreenActive()

int MetRenderer::IsLogoScreenActive ( )

Report whether the active panel is a MetLogoScreen.

The three cheat script commands test it. The title is inferred.

Returns
Non-zero when the active panel is a MetLogoScreen.
Ghidra address:
NTSC-U/C: 0x00371b58
Ghidra address:
PAL: 0x003a0650

◆ ForwardToPanel()

void MetRenderer::ForwardToPanel ( Message * pMsg)

Hand a message to the active panel, when there is one.

The image records no caller. The title is inferred.

Parameters
pMsgThe message.
Ghidra address:
NTSC-U/C: 0x00371cb0
Ghidra address:
PAL: 0x003a07a8

◆ ForwardToPanelUnchecked()

void MetRenderer::ForwardToPanelUnchecked ( Message * pMsg)

Hand a message to the active panel without testing for one.

The image records no caller. The title is inferred.

Parameters
pMsgThe message.
Ghidra address:
NTSC-U/C: 0x00371cf0
Ghidra address:
PAL: 0x003a07e8

◆ PollArenaLoader()

int MetRenderer::PollArenaLoader ( float * pfProgress)
static

Report how far the arena container load has advanced.

MetSonyScreen slot 26 is the caller. The title is inferred.

Parameters
pfProgressReceives the load's progress, between 0 and 1.
Returns
Non-zero once the load is complete.
Ghidra address:
NTSC-U/C: 0x003713f0
Ghidra address:
PAL: 0x0039fee8

◆ UnloadArenaLoader()

void MetRenderer::UnloadArenaLoader ( )
static

Unload the arena container.

The image records no caller. The title is inferred.

Ghidra address:
NTSC-U/C: 0x00371490
Ghidra address:
PAL: 0x0039ff88

◆ MetaGameWorld

friend class MetaGameWorld
friend

Member Data Documentation

◆ mAnimationFrame

float MetRenderer::mAnimationFrame

Current animation frame position of the front end.

MetScreen reads this field and passes it straight to its own enter and exit animation virtuals at vtable slots 31 and 34, both of which take a float, and every screen that starts a prompt or a title passes it on. The units are animation frames rather than seconds, which mFrameRate fixes.

+0x68

◆ mPanelActive

int MetRenderer::mPanelActive

Flag that MetScreen sets when it activates a named sub-screen and clears when it activates none.

Written directly by MetScreen vtable slot 6 at 0x0038b828, which stores 0 for the empty name and 1 once the named screen reports that it has finished loading. No accessor for the field appears in the image, so it is public. The constructor starts it at 1.

+0x80

◆ sInstance

MetRenderer* MetRenderer::sInstance
static

The one front-end renderer.

The constructor records itself here and the destructor clears it.

Public because MetSonyScreen::OnFadeOutDone() reads it directly, and the image has no accessor.

Ghidra address:
NTSC-U/C: 0x006c3598
Ghidra address:
PAL: 0x00706608

◆ mTitlePromptShowing

int MetRenderer::mTitlePromptShowing

Zeroed by the constructor.

MetaGameWorld::IsAwaitingStart() reads it. Public because MetLogoScreen writes it directly, 1 in slot 33 at 0x002bae40 and 0 in slot 19 at 0x002be4d8, and the image has no accessor for it. +0x60

◆ mMaxPadIndex

int MetRenderer::mMaxPadIndex

Highest pad index DispatchPriv() accepts a RawControllerMsg from.

The constructor sets 4. The test is mMaxPadIndex < padIndex, and index 4 is accepted while index 5 is not. MetMainScreen writes it at 0x002c6dc0 (slot 5) and 0x002c7520. +0xd4


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