|
resonance 1.0.1
|
Owner of the running game. More...
#include <gamemanagerimpl.h>


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 ¶ms) |
| 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. | |
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.
| 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.
|
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.
|
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.
|
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.
|
virtual |
Starts play on the game world.
Slot 6.
Calls GrooveWorld::StartPlay() and nothing else. DoGameSystemPlayCmd runs it.
|
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.
|
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.
| file | The recording to replay. |
| nUnusedFlag | Passed unchanged to the installed object, and not read there. |
|
virtual |
Report the flag the world load sets.
Slot 9. No caller is recovered.
|
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.
| persona | The persona to copy. |
|
virtual |
Resolve the roster.
Slot 11.
|
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.
|
virtual |
Create the front-end world and hand it to the poller.
Slot 13.
|
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.
|
virtual |
Resolve the world a game session runs in.
Slot 15. Null until CreateWorld() runs.
|
virtual |
Resolve the front-end world.
Slot 16. Null until Start() runs.
|
virtual |
Resolve the controller reader.
Slot 17.
|
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.
|
virtual |
Resolve the tally.
Slot 19. The subobject is embedded, so the accessor is an address computation rather than a load.
|
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.
| pStream | The stream to write to. |
|
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.
| pStream | The stream to read from. |
|
virtual |
Report whether a playback is running.
Slot 22.
|
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.
| nMode | The mode, 0 through 3. |
|
virtual |
Resolve the connectivity mode.
Slot 24.
|
virtual |
Resolve the settings a session starts with.
Slot 25. The subobject is embedded, so the accessor is an address computation.
|
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.
|
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.
| params | The settings to copy. |
|
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.
| nDifficulty | The difficulty. |
|
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.
| nMode | The mode, 0 through 2. |
|
virtual |
Report the difficulty.
Slot 30.
|
virtual |
Resolve the play mode.
Slot 31. Returns the settings field mPlayMode.
|
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.
| pMsg | The message to store. |
|
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.
| nEnabled | Non-zero to draw. |
|
protectedvirtual |
Act on a message.
| pMsg | The message. |
Implements MsgSink.
|
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.
| pMsg | The message, ignored. |
|
protectedvirtual |
Leave the game.
Slot 35. Forwards EndGameMsg::mRestart to EndGame().
| pMsg | The EndGameMsg. |
|
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.
| pMsg | The message, ignored. |
|
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.
| pMsg | The message, ignored. |
|
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.
| pMsg | The message, ignored. |