resonance 1.0.1
Loading...
Searching...
No Matches
metrenderer.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <vector>
5
6#include "app/msgsource.h"
7#include "app/rendererbase.h"
8#include "met/fadeuser.h"
9#include "os/hostmode.h"
10#include "rnd/view.h"
11
12// MetScreen stores its renderer and the renderer stores its screens, so one of the two
13// declarations has to be incomplete. MemcardOp declares MemcardCBHandler the same way.
14class MetScreen;
16class RndAsyncLoader;
17class MetCommandMap;
19class MetFade;
20
68class MetRenderer : public MsgSource, public RendererBase, public FadeUser {
69 // MetaGameWorld::IsAwaitingStart() at 0x003d48c0 reads mTitlePromptShowing directly.
70 friend class MetaGameWorld;
71
72public:
85
96 virtual ~MetRenderer();
97
114 virtual void DispatchPriv(Message *pMsg);
115
126 virtual void Start();
127
139 virtual void Stop();
140
154 virtual void Update();
155
165 virtual void Draw();
166
177 virtual void UpdateSimple();
178
188 virtual void DrawSimple();
189
199 virtual void OnFadeOutDone();
200
211 virtual void OnFadeInDone();
212
223 void SetActivePanel(MetScreen *pScreen);
224
239
252
266 void ResolveArenaView(int nSkipResolve);
267
280
294
306
319
330 void AddScreen(MetScreen *pScreen);
331
341 void RemoveScreen(MetScreen *pScreen);
342
353 void ActivatePanel(MetScreen *pScreen);
354
366
376
387
398
409
420 static int PollArenaLoader(float *pfProgress);
421
430 static void UnloadArenaLoader();
431
443
455
456private:
465 void ResolveSceneViews();
466
476 void ClearScreenScene();
477
485 void OnStartPause(Message *pMsg);
486
497 void OnFreqEnded(Message *pMsg);
498
507 MetScreen *SelectEndScreen();
508
518 inline void OnRawController(RawControllerMsg *pMsg);
519
528 static void CreateCommonLoaders();
529
536 static void CreateArenaLoader();
537
544 static void StartArenaLoad();
545
552 static void EnqueueArenaLoader();
553
554public:
566
573
574private:
575 // Rate the animation frame advances at, in frames per second. The constructor sets 500.0f, and
576 // both frame routines compute `mAnimationFrame += mFrameRate * elapsedMilliseconds / 1000.0f`.
577 float mFrameRate; // +0x64
578 // +0x6c. The constructor does not write it and no reader is identified.
579 int mReserved;
580 // Time the previous frame ran at, in nanoseconds since the watchdog's base. Both frame
581 // routines difference it against the current time and then overwrite it.
582 long long mPreviousFrameNs; // +0x70
583 // Payload of the last IsRecordingMsg. DispatchPriv() is the one writer.
584 int mRecording; // +0x78
585 // The screen that receives decoded commands. SetActivePanel() is the named writer, and the two
586 // promotion sequences write it directly.
587 MetScreen *mActivePanel; // +0x7c
588 // Every screen the front end is showing, in the order it was pushed. AddScreen() appends and
589 // RemoveScreen() erases, and both set mScreensChanged afterwards.
590 std::vector<MetScreen *> mScreens; // +0x84
591 // Translates a controller reading into a command. Allocated by the constructor as twelve bytes
592 // and released by the destructor. The class name is inferred, for the reason its own header
593 // records.
594 MetCommandMap *mCommandMap; // +0x90
595 // One auto-repeat record per controller. Allocated by the constructor as twelve bytes and
596 // released by the destructor. The class name is inferred on the same basis.
597 MetCommandRepeater *mCommandRepeater; // +0x94
598 // Set by AddScreen() and RemoveScreen() once either has changed mScreens. Both frame
599 // routines abandon their walk of the stack when they observe it, because the change
600 // invalidated the iterator they were holding.
601 int mScreensChanged; // +0x98
602 // `met top view`, the front-end shell. Both draw routines draw it and both frame routines set
603 // its frame.
604 Rnd::View *mTopView; // +0x9c
605 // `metscreens.view`, the scene AddScreenView() attaches a screen's view to.
606 Rnd::View *mScreenScene; // +0xa0
607 // `meta bg view`, the scene AddBackgroundView() attaches to.
608 Rnd::View *mBackgroundScene; // +0xa4
609 // Set while the front end is running. Every draw and frame routine returns at once when it is
610 // clear.
611 int mRunning; // +0xa8
612 // Draw the subsystem timing graph. Filled from configuration code 0x397.
613 int mShowTimingGraph; // +0xac
614 // Draw the render-statistics overlay. Filled from configuration code 0x3a2.
615 int mShowRenderStats; // +0xb0
616 // +0xb4. The constructor sets 1 and no reader is identified.
617 int mUnreadFlag;
618 // Set while the three boot container loads are outstanding. The poll routine clears it once
619 // all three report complete.
620 int mBootLoadPending; // +0xb8
621 // +0xbc. Zeroed by the constructor and read nowhere that has been identified.
622 int mUnreadValue;
623 // +0xc0. The constructor creates the list's dummy node inline under the allocation tag
624 // `stl_list` for a four-byte element, and the destructor clears the list through 0x00272ee8
625 // and returns the node. Nothing that has been read appends to it or walks it, so the element
626 // type is not recovered, and int stands in for the four-byte element.
627 std::list<int> mUnusedList;
628 // The screen the next fade promotes to the active panel.
629 MetScreen *mPendingPanel; // +0xc4
630 // Set while the disc-problem phase of the poll routine has work outstanding.
631 int mDiscProblemPending; // +0xc8
632 // The fade, allocated by ResolveSceneViews() as forty-four bytes. The destructor releases it
633 // with the scalar free rather than through a destructor, which is what a class with no virtual
634 // and no member needing teardown compiles to.
635 MetFade *mFade; // +0xcc
636 // Set while a fade is running. Both the poll routine and the fade-finished override return
637 // early on it rather than promoting a panel.
638 int mFading; // +0xd0
639
640public:
647};
648
658
668
679int ProgressMetGlobal(float &flProgress);
680
681#ifdef VIDEO_STANDARD_PAL
691inline const char *LocalizedAssetSuffix() {
692 switch (GetLanguage()) {
693 case SCE_GERMAN_LANGUAGE:
694 return "_ger";
695 case SCE_FRENCH_LANGUAGE:
696 return "_fre";
697 case SCE_ITALIAN_LANGUAGE:
698 return "_ita";
699 case SCE_SPANISH_LANGUAGE:
700 return "_spa";
701 default:
702 return "";
703 }
704}
705#endif
Mix-in for an object that takes part in a screen fade.
Definition fadeuser.h:28
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:41
Translator from one raw controller reading to one front-end command.
Definition metcommandmap.h:28
Auto-repeat state for the front end, one record per controller.
Definition metcommandrepeater.h:19
Driver of the full-screen metagame fade.
Definition metfade.h:29
void OnReturnFromGame()
Do nothing.
void OnReturnToMenus()
Do nothing.
float mAnimationFrame
Current animation frame position of the front end.
Definition metrenderer.h:442
int IsLogoScreenActive()
Report whether the active panel is a MetLogoScreen.
void AddScreenView(Rnd::View *pView)
Attach the three animatable, drawable, and transformable subobjects of one view to the screen scene a...
static MetRenderer * sInstance
The one front-end renderer.
Definition metrenderer.h:565
void ForwardToPanel(Message *pMsg)
Hand a message to the active panel, when there is one.
virtual void OnFadeInDone()
Do nothing when a fade in finishes.
virtual void DrawSimple()
Draw the front-end scene and the debug overlays, and no screen.
void ForwardToPanelUnchecked(Message *pMsg)
Hand a message to the active panel without testing for one.
virtual void DispatchPriv(Message *pMsg)
Dispatch one front-end message.
void AddScreen(MetScreen *pScreen)
Append one screen to the screen stack.
virtual void Stop()
Stop the front end running.
void UnlockAllStages()
Send a MetUnlockStagesMsg to the active panel, when there is one.
virtual void Draw()
Draw the front-end scene, every screen, and the debug overlays.
virtual ~MetRenderer()
Release the screen stack, the two input helpers, and the fade.
void ClearBackgroundScene()
Release the animatable, drawable, and transformable lists of the background scene at mBackgroundScene...
void RemoveScreenView(Rnd::View *pView)
Detach one view from the screen scene at mScreenScene.
MetRenderer()
Construct the renderer and start the front-end load.
void SetActivePanel(MetScreen *pScreen)
Record one screen as the active panel.
friend class MetaGameWorld
Definition metrenderer.h:70
void AddBackgroundView(Rnd::View *pView)
Attach one view to the background scene at mBackgroundScene.
int mTitlePromptShowing
Zeroed by the constructor.
Definition metrenderer.h:572
int mMaxPadIndex
Highest pad index DispatchPriv() accepts a RawControllerMsg from.
Definition metrenderer.h:646
virtual void Update()
Advance the front end by one frame, including the boot and disc-problem phases.
void ActivatePanel(MetScreen *pScreen)
Make one screen the active panel and start it entering.
void RemoveScreen(MetScreen *pScreen)
Erase one screen from the screen stack and detach its view from the scene.
static void UnloadArenaLoader()
Unload the arena container.
void ResolveArenaView(int nSkipResolve)
Resolve Metagame_arena.view and attach it to the background scene.
virtual void Start()
Start the front end running.
virtual void UpdateSimple()
Advance every screen's animation frame.
static int PollArenaLoader(float *pfProgress)
Report how far the arena container load has advanced.
int mPanelActive
Flag that MetScreen sets when it activates a named sub-screen and clears when it activates none.
Definition metrenderer.h:454
virtual void OnFadeOutDone()
Promote the pending panel and start it entering.
void MoveScreenViewToFront(Rnd::View *pView)
Move a screen view to the front of the screen scene's draw order.
Base of every front-end screen.
Definition metscreen.h:212
Sender of engine messages, which stores the list of sinks that receive them.
Definition msgsource.h:26
Event the game passes between a MsgSource and a MsgSink.
Definition rawcontrollermsg.h:24
RendererBase()
Start the queue with the router as its one sink.
Request to load one renderer file in the background.
Definition asyncloader.h:29
Root of a loadable scene.
Definition view.h:47
void ReleaseMetGlobal()
Unload the three common containers.
int ProgressMetGlobal(float &flProgress)
Report how far the three common container loads have advanced together.
void LoadMetGlobal()
Enqueue each common container load that is still pending.