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

Owner of the running game. More...

#include <gamemanagerimpl.h>

Inheritance diagram for GameManagerImpl:
Collaboration diagram for GameManagerImpl:

Public Member Functions

 GameManagerImpl ()
 Build the manager, its input poller, and its message queue.
virtual ~GameManagerImpl ()
 Destroy the recorder, the front-end world, the poller, the queue, and the tally.
virtual void DrawFrame ()
 Draw one frame.
virtual void DrawFrameSimple ()
 Redraw the front-end world alone.
virtual void StartPlay ()
 Starts play on the game world.
virtual void StartRecording ()
 Start recording the session.
virtual void Recreate (const HxStr &file, int nUnusedFlag)
 Replay a recorded session from a file.
virtual int GetWorldLoadFlag ()
 Report the flag the world load sets.
virtual void AddPersona (const MetPersonaData &persona)
 Copy one persona onto the roster.
virtual std::vector< MetPersonaData * > * GetPersonas ()
 Resolve the roster.
virtual void ClearPersonas ()
 Delete every persona on the roster and empty it.
virtual void Start ()
 Create the front-end world and hand it to the poller.
virtual void PollPlayback ()
 Poll the controllers, and end a playback when a button is pressed.
virtual GrooveWorld * GetWorld ()
 Resolve the world a game session runs in.
virtual MetaGameWorld * GetMetaWorld ()
 Resolve the front-end world.
virtual InputPoller * GetPoller ()
 Resolve the controller reader.
virtual int GetUnwrittenValue ()
 Report a word that only the constructor writes.
virtual GameStats * GetStats ()
 Resolve the tally.
virtual void Save (OBStream *pStream)
 Write the manager to a stream.
virtual void Load (IBStream *pStream)
 Read the manager back from a stream.
virtual int IsPlaybackActive ()
 Report whether a playback is running.
virtual void SetGameMode (int nMode)
 Record the connectivity mode and publish it to the script layer.
virtual int GetGameMode ()
 Resolve the connectivity mode.
virtual GameParams * GetParams ()
 Resolve the settings a session starts with.
virtual int GetChangeCount ()
 Report how many times the settings have changed.
virtual void SetParams (const GameParams &params)
 Replace the settings and republish the two modes.
virtual void SetDifficulty (int nDifficulty)
 Record the difficulty and publish it to the script layer.
virtual void SetPlayMode (int nMode)
 Record the play mode and publish it to the script layer.
virtual int GetDifficulty ()
 Report the difficulty.
virtual int GetPlayMode ()
 Resolve the play mode.
virtual void QueueMessage (Message *pMsg)
 Store a message on the embedded queue.
virtual void SetDrawEnabled (int nEnabled)
 Enable or suppress drawing.
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.

Protected Member Functions

virtual void DispatchPriv (Message *pMsg)
 Act on a message.
virtual void OnBeginGameLocal (Message *pMsg)
 Enter a local game.
virtual void OnEndGame (Message *pMsg)
 Leave the game.
virtual void OnPauseGameSystem (Message *pMsg)
 Pause the session.
virtual void OnUnpauseGameSystem (Message *pMsg)
 Resume the session.
virtual void OnDoPlayback (Message *pMsg)
 Replay the recording the script layer nominates.

Detailed Description

Owner of the running game.

Its RTTI descriptor is at 0x008f0090. It derives from GameManager, whose descriptor is at 0x008ef6b0, which derives in turn from the builtin MsgSink descriptor at 0x0086f780. The object is 0x10c bytes, its constructor is at 0x00105f50, and its table at 0x007cd5f8 has 39 entries followed by the zero terminator.

The split between GameManager and GameManagerImpl cannot be recovered. No vtable in the image addresses a GameManager subobject, the accessor at 0x0010b7c8 builds both descriptors and returns the derived one, and nothing outside the accessor references 0x008ef6b0. Every slot is therefore declared here, on the derived class the vtable belongs to, and the base is declared only so that the descriptor chain reads correctly.

Every entry of the 39-entry table. Slot 0 is the compiler-generated type function at 0x0010b7c8 and is not source. Slot 2 is MsgSink::Dispatch() at 0x00105158, inherited unchanged.

The five handler slots are each pinned by DispatchPriv(), which compares the reported message type against five globals and dispatches one slot for each. 0x006d03a4 belongs to BeginGameLocalMsg, 0x006d03ac to EndGameMsg, 0x006d03b4 to PauseGameSystemMsg, 0x006d03bc to UnpauseGameSystemMsg, and 0x006d03c4 to GameManagerDoPlaybackMsg. Each of the five globals has exactly two readers, this dispatcher and the message class's own type reporter, which is what makes the pairing certain. A type that matches none of the five trips FatalError("DISPATCH_CHECK: Unhandled Message: s", pMsg->Name()).

StartRecording() installs a GameRecorder and Recreate() a GamePlaybacker.

Four slots read or write the embedded settings rather than a member of this class. The offsets +0x84, +0x88, and +0x90 all fall inside the 0x38-byte GameParams subobject at +0x68, so SetPlayMode() and GetPlayMode() drive GameParams::mPlayMode, SetDifficulty() and GetDifficulty() drive GameParams::mDifficulty, and SetGameMode() writes GameParams::mNetGame. Those three settings members are public for that reason, and a friend declaration on GameParams would fit the image equally well.

Every member of this class is private. Nothing outside the class touches one directly, and each of the members a caller needs has a virtual accessor among slots 9 to 31.

Constructor & Destructor Documentation

◆ GameManagerImpl()

GameManagerImpl::GameManagerImpl ( )

Build the manager, its input poller, and its message queue.

The constructor creates the InputPoller, registers itself as a sink of its own embedded queue, and clears the poller's field at +0x34. Every word it does not set otherwise starts at zero, mUnwrittenValue at 0x00105f8c included.

mWorldLoadFlag and mDrawSuppressed both start at 1. mDrawSuppressed stops the first frame after construction from drawing until SetDrawEnabled() runs.

Ghidra address:
NTSC-U/C: 0x00105f50
Ghidra address:
PAL: 0x00105f50

◆ ~GameManagerImpl()

virtual GameManagerImpl::~GameManagerImpl ( )
virtual

Destroy the recorder, the front-end world, the poller, the queue, and the tally.

The game world is not deleted here. CheckState() runs first and its result is discarded.

Ghidra address:
NTSC-U/C: 0x001062d0
Ghidra address:
PAL: 0x00106310

Member Function Documentation

◆ DrawFrame()

virtual void GameManagerImpl::DrawFrame ( )
virtual

Draw one frame.

Slot 4. The queue is drained first. The routine then collects up to two renderers, the game world's when it has one and the front-end world's when one exists, and runs RendererBase slots 6 and 7 on each. While mFrontEndActive is set, MemcardManager::Update() runs next. Unless drawing is suppressed, slot 8 then runs on each renderer between the display device's frame pair, inside the VU1 path.

Ghidra address:
NTSC-U/C: 0x001065a8
Ghidra address:
PAL: 0x00106620

◆ DrawFrameSimple()

virtual void GameManagerImpl::DrawFrameSimple ( )
virtual

Redraw the front-end world alone.

Slot 5. The routine returns at once without a front-end world, with a game world, or while drawing is suppressed, so it runs only in the front end. MainLoop uses it to refresh the screen during a long operation. RendererBase slot 9 runs before the frame pair and slot 10 inside it.

Ghidra address:
NTSC-U/C: 0x0010bfa0
Ghidra address:
PAL: 0x0010c158

◆ StartPlay()

virtual void GameManagerImpl::StartPlay ( )
virtual

Starts play on the game world.

Slot 6.

Calls GrooveWorld::StartPlay() and nothing else. DoGameSystemPlayCmd runs it.

Ghidra address:
NTSC-U/C: 0x0010c128
Ghidra address:
PAL: 0x0010c2e0

◆ StartRecording()

virtual void GameManagerImpl::StartRecording ( )
virtual

Start recording the session.

Slot 7. Trips Recording already in progress when a recorder already exists and Cannot start recording from this state when mState is non-zero. The two diagnostics are what establish mState as a state word. Otherwise it installs a GameRecorder.

Ghidra address:
NTSC-U/C: 0x0010c420
Ghidra address:
PAL: 0x0010c5d8

◆ Recreate()

virtual void GameManagerImpl::Recreate ( const HxStr & file,
int nUnusedFlag )
virtual

Replay a recorded session from a file.

Slot 8. Trips Cannot recreate game from this state when mState is non-zero and Playback already in progress when a playback already exists. Any recorder is destroyed first, and the front-end world is then asked to tear its game down through 0x003d4890.

The installed GamePlaybacker reopens the file, reads three words from it, and runs Load() on this manager, so a playback restores a saved session rather than feeding input back.

Parameters
fileThe recording to replay.
nUnusedFlagPassed unchanged to the installed object, and not read there.
Ghidra address:
NTSC-U/C: 0x0010c4b8
Ghidra address:
PAL: 0x0010c670

◆ GetWorldLoadFlag()

virtual int GameManagerImpl::GetWorldLoadFlag ( )
virtual

Report the flag the world load sets.

Slot 9. No caller is recovered.

Returns
mWorldLoadFlag.
Ghidra address:
NTSC-U/C: 0x0010b870
Ghidra address:
PAL: 0x0010b9f8

◆ AddPersona()

virtual void GameManagerImpl::AddPersona ( const MetPersonaData & persona)
virtual

Copy one persona onto the roster.

Slot 10. The argument is copied into a fresh heap MetPersonaData rather than adopted, and the copy is appended. The allocation tag is the literal MetPersonaData, which is what fixes the element type of mPersonas.

Parameters
personaThe persona to copy.
Ghidra address:
NTSC-U/C: 0x00105e80
Ghidra address:
PAL: 0x00105e80

◆ GetPersonas()

virtual std::vector< MetPersonaData * > * GameManagerImpl::GetPersonas ( )
virtual

Resolve the roster.

Slot 11.

Returns
The roster.
Ghidra address:
NTSC-U/C: 0x0010b888
Ghidra address:
PAL: 0x0010ba10

◆ ClearPersonas()

virtual void GameManagerImpl::ClearPersonas ( )
virtual

Delete every persona on the roster and empty it.

Slot 12. Each element is destroyed through its own vtable slot 1, which sits at +0x168 inside a MetPersonaData.

Ghidra address:
NTSC-U/C: 0x0010be20
Ghidra address:
PAL: 0x0010bfb8

◆ Start()

virtual void GameManagerImpl::Start ( )
virtual

Create the front-end world and hand it to the poller.

Slot 13.

Ghidra address:
NTSC-U/C: 0x0010c168
Ghidra address:
PAL: 0x0010c320

◆ PollPlayback()

virtual void GameManagerImpl::PollPlayback ( )
virtual

Poll the controllers, and end a playback when a button is pressed.

Slot 14. The routine runs InputPoller::Poll(), resolves the watchdog and discards it, and reads the elapsed time through GetElapsedMilliseconds() and discards that too. When the poll sent a reading out while a playback runs in a game world, the world queues its first exit mode through GrooveWorld::PostFinish(). MainLoop drives it from one of its two periodic timers.

Ghidra address:
NTSC-U/C: 0x00106e28
Ghidra address:
PAL: 0x00106eb8

◆ GetWorld()

virtual GrooveWorld * GameManagerImpl::GetWorld ( )
virtual

Resolve the world a game session runs in.

Slot 15. Null until CreateWorld() runs.

Returns
The game world, or null in the front end.
Ghidra address:
NTSC-U/C: 0x0010b890
Ghidra address:
PAL: 0x0010ba18

◆ GetMetaWorld()

virtual MetaGameWorld * GameManagerImpl::GetMetaWorld ( )
virtual

Resolve the front-end world.

Slot 16. Null until Start() runs.

Returns
The front-end world.
Ghidra address:
NTSC-U/C: 0x0010b898
Ghidra address:
PAL: 0x0010ba20

◆ GetPoller()

virtual InputPoller * GameManagerImpl::GetPoller ( )
virtual

Resolve the controller reader.

Slot 17.

Returns
The poller the constructor created.
Ghidra address:
NTSC-U/C: 0x0010b8a0
Ghidra address:
PAL: 0x0010ba28

◆ GetUnwrittenValue()

virtual int GameManagerImpl::GetUnwrittenValue ( )
virtual

Report a word that only the constructor writes.

Slot 18. No caller is recovered, and the word is zero for the life of the manager.

Returns
mUnwrittenValue.
Ghidra address:
NTSC-U/C: 0x0010b8a8
Ghidra address:
PAL: 0x0010ba30

◆ GetStats()

virtual GameStats * GameManagerImpl::GetStats ( )
virtual

Resolve the tally.

Slot 19. The subobject is embedded, so the accessor is an address computation rather than a load.

Returns
The tally.
Ghidra address:
NTSC-U/C: 0x0010b8b0
Ghidra address:
PAL: 0x0010ba38

◆ Save()

virtual void GameManagerImpl::Save ( OBStream * pStream)
virtual

Write the manager to a stream.

Slot 20. Three words go out, mState, mSavedWord, and mGameMode, and the settings write themselves afterwards through their own slot 2.

Parameters
pStreamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x0010c588
Ghidra address:
PAL: 0x0010c740

◆ Load()

virtual void GameManagerImpl::Load ( IBStream * pStream)
virtual

Read the manager back from a stream.

Slot 21. The three words come back in the order Save() wrote them and the settings read themselves through their own slot 3. The three setters then run on the restored values, the roster is emptied and given one persona called freq player 1, and the front end receives IsRecordingMsg(1). The level is loaded through Renderer::LoadLevel(), and the world is created and finished as FinishWorldLoad() does, whose body the binary expands here. The world then has mIsPlayback set, and the poller stops handing readings to it.

Parameters
pStreamThe stream to read from.
Ghidra address:
NTSC-U/C: 0x001072b0
Ghidra address:
PAL: 0x00107360

◆ IsPlaybackActive()

virtual int GameManagerImpl::IsPlaybackActive ( )
virtual

Report whether a playback is running.

Slot 22.

Returns
Non-zero while a playback exists.
Ghidra address:
NTSC-U/C: 0x0010b8b8
Ghidra address:
PAL: 0x0010ba40

◆ SetGameMode()

virtual void GameManagerImpl::SetGameMode ( int nMode)
virtual

Record the connectivity mode and publish it to the script layer.

Slot 23. The mode is published under script symbol 0x262 as one of none, solo, local, and net, in that value order, and any other value publishes the empty string. Those four literals are the whole evidence for the value set. The settings field mNetGame becomes the test for net, and the change counter advances.

Parameters
nModeThe mode, 0 through 3.
Ghidra address:
NTSC-U/C: 0x0010c290
Ghidra address:
PAL: 0x0010c448

◆ GetGameMode()

virtual int GameManagerImpl::GetGameMode ( )
virtual

Resolve the connectivity mode.

Slot 24.

Returns
The mode SetGameMode() recorded.
Ghidra address:
NTSC-U/C: 0x0010b8c8
Ghidra address:
PAL: 0x0010ba50

◆ GetParams()

virtual GameParams * GameManagerImpl::GetParams ( )
virtual

Resolve the settings a session starts with.

Slot 25. The subobject is embedded, so the accessor is an address computation.

Returns
The settings.
Ghidra address:
NTSC-U/C: 0x0010b8d0
Ghidra address:
PAL: 0x0010ba58

◆ GetChangeCount()

virtual int GameManagerImpl::GetChangeCount ( )
virtual

Report how many times the settings have changed.

Slot 26. SetGameMode(), SetParams(), SetDifficulty(), and SetPlayMode() each advance the count by one, and nothing resets it.

Returns
The count.
Ghidra address:
NTSC-U/C: 0x0010b8d8
Ghidra address:
PAL: 0x0010ba60

◆ SetParams()

virtual void GameManagerImpl::SetParams ( const GameParams & params)
virtual

Replace the settings and republish the two modes.

Slot 27. The two modes are republished from the members rather than from the new settings, so the script layer sees the values already recorded. The change counter advances.

Parameters
paramsThe settings to copy.
Ghidra address:
NTSC-U/C: 0x0010c210
Ghidra address:
PAL: 0x0010c3c8

◆ SetDifficulty()

virtual void GameManagerImpl::SetDifficulty ( int nDifficulty)
virtual

Record the difficulty and publish it to the script layer.

Slot 28. The value lands in GameParams::mDifficulty and is published raw under script symbol 0x264. GameParams::Print() labels the field difficulty=. The change counter advances.

Parameters
nDifficultyThe difficulty.
Ghidra address:
NTSC-U/C: 0x0010c3e0
Ghidra address:
PAL: 0x0010c598

◆ SetPlayMode()

virtual void GameManagerImpl::SetPlayMode ( int nMode)
virtual

Record the play mode and publish it to the script layer.

Slot 29. The mode lands in the settings field mPlayMode and is published under script symbol 0x263 as one of none, game, and jam, in that value order, and any other value publishes the empty string. Those three literals are the whole evidence for the value set. The change counter advances.

Parameters
nModeThe mode, 0 through 2.
Ghidra address:
NTSC-U/C: 0x0010c348
Ghidra address:
PAL: 0x0010c500

◆ GetDifficulty()

virtual int GameManagerImpl::GetDifficulty ( )
virtual

Report the difficulty.

Slot 30.

Returns
GameParams::mDifficulty.
Ghidra address:
NTSC-U/C: 0x0010b8e0
Ghidra address:
PAL: 0x0010ba68

◆ GetPlayMode()

virtual int GameManagerImpl::GetPlayMode ( )
virtual

Resolve the play mode.

Slot 31. Returns the settings field mPlayMode.

Returns
The mode SetPlayMode() recorded.
Ghidra address:
NTSC-U/C: 0x0010b8e8
Ghidra address:
PAL: 0x0010ba70

◆ QueueMessage()

virtual void GameManagerImpl::QueueMessage ( Message * pMsg)
virtual

Store a message on the embedded queue.

Slot 32. The call runs through the queue's MsgSink subobject at +0x14 rather than through the queue itself, so it reaches MsgQueue::DispatchPriv() virtually.

Parameters
pMsgThe message to store.
Ghidra address:
NTSC-U/C: 0x0010bee0
Ghidra address:
PAL: 0x0010c078

◆ SetDrawEnabled()

virtual void GameManagerImpl::SetDrawEnabled ( int nEnabled)
virtual

Enable or suppress drawing.

Slot 33. The member records the inverse of the argument, and the two draw slots run only while it is clear.

Parameters
nEnabledNon-zero to draw.
Ghidra address:
NTSC-U/C: 0x0010b878
Ghidra address:
PAL: 0x0010ba00

◆ DispatchPriv()

virtual void GameManagerImpl::DispatchPriv ( Message * pMsg)
protectedvirtual

Act on a message.

Parameters
pMsgThe message.
Ghidra address:
NTSC-U/C: 0x00107540
Ghidra address:
PAL: 0x00107610

Implements MsgSink.

◆ OnBeginGameLocal()

virtual void GameManagerImpl::OnBeginGameLocal ( Message * pMsg)
protectedvirtual

Enter a local game.

Slot 34. Clears mRestartPending, or runs the front-end world's forwarder when it was clear, deactivates the poller, clears mFrontEndActive, and sends the front end IsRecordingMsg(0). The world is then created and finished, its mIsPlayback cleared, and the poller hands it readings outside jukebox mode. A recorder starts recording, the watchdog is flushed, and a DoGameSystemPlayCmd is posted on the watchdog timer to start play. The message itself is ignored, and DispatchPriv() passes it all the same.

Parameters
pMsgThe message, ignored.
Ghidra address:
NTSC-U/C: 0x00106720
Ghidra address:
PAL: 0x00106798

◆ OnEndGame()

virtual void GameManagerImpl::OnEndGame ( Message * pMsg)
protectedvirtual

Leave the game.

Slot 35. Forwards EndGameMsg::mRestart to EndGame().

Parameters
pMsgThe EndGameMsg.
Ghidra address:
NTSC-U/C: 0x0010c148
Ghidra address:
PAL: 0x0010c300

◆ OnPauseGameSystem()

virtual void GameManagerImpl::OnPauseGameSystem ( Message * pMsg)
protectedvirtual

Pause the session.

Slot 36. Returns at once when already paused. Otherwise records the pause, stops the watchdog clock unless the connectivity mode is net, reconnects the poller to the front-end world and pauses it, silences and pauses the synthesiser, pauses the vibration, and hands the front-end renderer a MetStartPauseMsg. The message itself is ignored.

Parameters
pMsgThe message, ignored.
Ghidra address:
NTSC-U/C: 0x001069a8
Ghidra address:
PAL: 0x00106a38

◆ OnUnpauseGameSystem()

virtual void GameManagerImpl::OnUnpauseGameSystem ( Message * pMsg)
protectedvirtual

Resume the session.

Slot 37. Returns at once when not paused. Otherwise clears the pause and undoes each step OnPauseGameSystem() took, handing the poller to the game world. It also rebuilds the world's input map while the world's mIsTutorial is zero. The message itself is ignored.

Parameters
pMsgThe message, ignored.
Ghidra address:
NTSC-U/C: 0x00106af8
Ghidra address:
PAL: 0x00106b88

◆ OnDoPlayback()

virtual void GameManagerImpl::OnDoPlayback ( Message * pMsg)
protectedvirtual

Replay the recording the script layer nominates.

Slot 38. The file comes from script symbol 0x26a and the flag is zero. The message is ignored.

Parameters
pMsgThe message, ignored.
Ghidra address:
NTSC-U/C: 0x0010bf10
Ghidra address:
PAL: 0x0010c0a8

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