resonance 1.0.1
Loading...
Searching...
No Matches
Globals Class Referenceabstract

Abstract owner of the process-wide services. More...

#include <globals.h>

Inheritance diagram for Globals:

Public Member Functions

 Globals ()
 Clear the service pointers.
virtual ~Globals ()
virtual int Run ()=0
 Run the game until it exits.
virtual int ExitInstance ()=0
 Tear the game down as it exits.
void Init ()
 Create every process-wide service.
void Shutdown ()
 Destroy every process-wide service.
void CreateSynth ()
 Create the hardware synth.
void RunMainLoop ()
 Drive the main loop until it stops.
GameManagerImpl * GetGameManager ()
Ps2HardSynth * GetSynth ()
Sch::Scheduler * GetWatchdog ()
Sch::TimeClock * GetWatchdogTimer ()
ScriptSink * GetScriptSink ()
IOBPreallocMemStream * GetLog ()
IOBPreallocMemStream * GetResetLog ()
 Rewind the shared log stream and report it.
GrooveWorld * GetWorld ()
 Report the game manager's world.
MetaGameWorld * GetMetaWorld ()
 Report the game manager's front-end world.
int GetUnwrittenValue ()
 Forward GameManagerImpl::GetUnwrittenValue().
int GetPlayMode ()
 Report the game manager's play mode.
int GetGameMode ()
 Report the game manager's game mode.
Sch::TickClock * GetSongClock ()
 Report the song clock of the game manager's world.
PlayMap * GetPlayMap ()
 Report the play map of the world's level.
int IsJukeboxMode ()
 Report whether the session is a jukebox session.
LevelData * GetLevel ()
 Report the world's level.
int GetTempo ()
 Report the tempo of the song clock's tempo map.

Detailed Description

Abstract owner of the process-wide services.

Its RTTI descriptor is at 0x0086f5d0. It has no base. The compiler therefore places the vptr after the seven declared pointers, at +0x1c, and the class is 0x20 bytes. The destructor is declared first and takes vtable slot 1 of the table at 0x007cee78; the two pure virtuals follow it in slots 2 and 3, both pointing at the shared pure-virtual handler.

Application is the only class in the image that derives from it, and the names of the two overrides come from the two exception templates the script layer registers, An exception was thrown by the function Application::Run(). and An exception was thrown by the function Application::ExitInstance().

Init() creates every service and Shutdown() destroys them in the reverse order.

Every service pointer is private. Four of them have an accessor of their own, and foreign code reads those four only through the accessor. A scan of all 420 Application::shared() call sites found exactly one direct access to the returned object, the vptr load in main() that dispatches Run(), so no code outside the class reads any of the seven fields and no Application member reads one either. The accessors are themselves the out-of-line copies of inline members, and dozens of call sites inlined their own copy.

Four further accessors forward into the game manager and are not declared yet: 0x00118ce8, 0x00118d18, 0x00118d70, and 0x00118ec8.

Constructor & Destructor Documentation

◆ Globals()

Globals::Globals ( )

Clear the service pointers.

The synth and the script sink are not cleared, so Shutdown() tests uninitialised memory when it runs before Init().

Ghidra address:
NTSC-U/C: 0x00118c40
Ghidra address:
PAL: 0x00119190

◆ ~Globals()

virtual Globals::~Globals ( )
virtual
Ghidra address:
NTSC-U/C: 0x00118c68
Ghidra address:
PAL: 0x001191b8

Member Function Documentation

◆ Run()

virtual int Globals::Run ( )
pure virtual

Run the game until it exits.

Returns
The process result.

Implemented in Application.

◆ ExitInstance()

virtual int Globals::ExitInstance ( )
pure virtual

Tear the game down as it exits.

Returns
The process result.

Implemented in Application.

◆ Init()

void Globals::Init ( )

Create every process-wide service.

Ghidra address:
NTSC-U/C: 0x001170d0
Ghidra address:
PAL: 0x001175a0

◆ Shutdown()

void Globals::Shutdown ( )

Destroy every process-wide service.

The watchdog is flushed first, then each service is destroyed in the reverse of the order Init() created them. The routine is unreferenced in the NTSC-U/C image. The PAL build calls it from Application::ExitInstance() and does not destroy the synth.

Ghidra address:
NTSC-U/C: 0x00117270
Ghidra address:
PAL: 0x00117740

◆ CreateSynth()

void Globals::CreateSynth ( )

Create the hardware synth.

Ghidra address:
NTSC-U/C: 0x00118c98
Ghidra address:
PAL: 0x001191e8

◆ RunMainLoop()

void Globals::RunMainLoop ( )

Drive the main loop until it stops.

Ghidra address:
NTSC-U/C: 0x00118cc8
Ghidra address:
PAL: 0x00119218

◆ GetGameManager()

GameManagerImpl * Globals::GetGameManager ( )
Returns
The game manager.
Ghidra address:
NTSC-U/C: 0x00118eb8
Ghidra address:
PAL: 0x00119418

◆ GetSynth()

Ps2HardSynth * Globals::GetSynth ( )
Returns
The hardware synth.
Ghidra address:
NTSC-U/C: 0x00118ec0
Ghidra address:
PAL: 0x00119420

◆ GetWatchdog()

Sch::Scheduler * Globals::GetWatchdog ( )
Returns
The command scheduler.
Ghidra address:
NTSC-U/C: 0x00118eb0
Ghidra address:
PAL: 0x00119410

◆ GetWatchdogTimer()

Sch::TimeClock * Globals::GetWatchdogTimer ( )
Returns
The scheduler's time base.
Ghidra address:
NTSC-U/C: 0x00118e70
Ghidra address:
PAL: 0x001193d0

◆ GetScriptSink()

ScriptSink * Globals::GetScriptSink ( )
Returns
The sink that runs posted script text.
Ghidra address:
NTSC-U/C: 0x00118ef8
Ghidra address:
PAL: 0x00119458

◆ GetLog()

IOBPreallocMemStream * Globals::GetLog ( )
Returns
The shared log stream, which the remix tasks also use as the remix payload buffer.
Ghidra address:
NTSC-U/C: 0x00118f00
Ghidra address:
PAL: 0x00119460

◆ GetResetLog()

IOBPreallocMemStream * Globals::GetResetLog ( )

Rewind the shared log stream and report it.

LoadRemixMCT's constructor and MetRemixManager::AsyncCallbackDone() use the rewound stream as the destination of a remix payload. The title is inferred.

Returns
The log stream, rewound through Reset().
Ghidra address:
NTSC-U/C: 0x00118f08
Ghidra address:
PAL: 0x00119468

◆ GetWorld()

GrooveWorld * Globals::GetWorld ( )

Report the game manager's world.

Reads mGameManager directly rather than through GetGameManager().

Returns
GameManagerImpl::GetWorld().
Ghidra address:
NTSC-U/C: 0x00118d40
Ghidra address:
PAL: 0x001192a0

◆ GetMetaWorld()

MetaGameWorld * Globals::GetMetaWorld ( )

Report the game manager's front-end world.

Reads mGameManager directly rather than through GetGameManager(). Two script commands call it.

Returns
GameManagerImpl::GetMetaWorld().
Ghidra address:
NTSC-U/C: 0x00118d70
Ghidra address:
PAL: 0x001192d0

◆ GetUnwrittenValue()

int Globals::GetUnwrittenValue ( )

Forward GameManagerImpl::GetUnwrittenValue().

Reads mGameManager directly. The image records no caller.

Returns
GameManagerImpl::GetUnwrittenValue().
Ghidra address:
NTSC-U/C: 0x00118ec8
Ghidra address:
PAL: 0x00119428

◆ GetPlayMode()

int Globals::GetPlayMode ( )

Report the game manager's play mode.

Returns
GameManagerImpl::GetPlayMode().
Ghidra address:
NTSC-U/C: 0x00118dd8
Ghidra address:
PAL: 0x00119338

◆ GetGameMode()

int Globals::GetGameMode ( )

Report the game manager's game mode.

Returns
GameManagerImpl::GetGameMode().
Ghidra address:
NTSC-U/C: 0x00118e08
Ghidra address:
PAL: 0x00119368

◆ GetSongClock()

Sch::TickClock * Globals::GetSongClock ( )

Report the song clock of the game manager's world.

The body composes GetWorld() with GrooveWorld::GetSongClock().

Returns
The world's song clock.
Ghidra address:
NTSC-U/C: 0x00118e78
Ghidra address:
PAL: 0x001193d8

◆ GetPlayMap()

PlayMap * Globals::GetPlayMap ( )

Report the play map of the world's level.

The body composes GetWorld() with GrooveWorld::GetPlayMap().

Returns
The play map.
Ghidra address:
NTSC-U/C: 0x00118da0
Ghidra address:
PAL: 0x00119300

◆ IsJukeboxMode()

int Globals::IsJukeboxMode ( )

Report whether the session is a jukebox session.

Returns
GameParams::mJukeboxMode of GameManagerImpl::GetParams().
Ghidra address:
NTSC-U/C: 0x00118e38
Ghidra address:
PAL: 0x00119398

◆ GetLevel()

LevelData * Globals::GetLevel ( )

Report the world's level.

The body composes GetWorld() with GrooveWorld::GetLevel().

Returns
The level.
Ghidra address:
NTSC-U/C: 0x00118d18
Ghidra address:
PAL: 0x00119278

◆ GetTempo()

int Globals::GetTempo ( )

Report the tempo of the song clock's tempo map.

Reads Sch::TempoMap::mMicrosecondsPerQuarter through Sch::TickClock::mTempoMap inline, after a finiteness test of song position 0 whose result is discarded. The title is inferred.

Returns
The tempo, in microseconds per quarter note.
Ghidra address:
NTSC-U/C: 0x00118ce8
Ghidra address:
PAL: 0x00119248

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