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

Message sink that runs the script text a message supplies. More...

#include <scriptsink.h>

Inheritance diagram for ScriptSink:
Collaboration diagram for ScriptSink:

Public Member Functions

 ScriptSink (Globals *pOwner)
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.

Static Public Member Functions

static ScriptSink * CreateInstance (Globals *pOwner)
 Build a sink on the heap.

Protected Member Functions

virtual void DispatchPriv (Message *pMsg)
 Run the message's script text when the message is a ScriptMsg.

Detailed Description

Message sink that runs the script text a message supplies.

Its RTTI descriptor is at 0x00901e60. It has MsgSink as its one base. The object is eight bytes. The compiler-generated vptr lands at offset 0, and the Globals back pointer occupies +0x04. Globals::InitServices() at 0x001170d0 allocates eight bytes, stores the Globals pointer at +0x04, and writes the vptr, and CreateInstance() does the same. The table at 0x007cee50 runs GetTypeInfo, the destructor, the inherited MsgSink::Dispatch(), then the override below.

Globals creates the single instance in Init() and destroys it in Shutdown(). The sink accepts every message, acts only on one identity, and is registered broadly. The allocation tag on both construction paths reads MsgSink rather than ScriptSink, because a tag names the class that declares the operator and this class inherits the pair from its base.

The Globals back pointer is private, because no recovered routine reads it. The constructor stores it and nothing else recovered so far uses it.

Constructor & Destructor Documentation

◆ ScriptSink()

ScriptSink::ScriptSink ( Globals * pOwner)
Parameters
pOwnerThe globals this sink belongs to.

Member Function Documentation

◆ CreateInstance()

ScriptSink * ScriptSink::CreateInstance ( Globals * pOwner)
static

Build a sink on the heap.

The body is the same allocation and construction Globals::InitServices() inlines. No caller is recovered. The name is inferred.

Parameters
pOwnerThe globals the sink belongs to.
Returns
The new sink.
Ghidra address:
NTSC-U/C: 0x00118c00
Ghidra address:
PAL: 0x00119150

◆ DispatchPriv()

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

Run the message's script text when the message is a ScriptMsg.

Ignores every message whose identity is not g_nScriptMsgType. For a ScriptMsg it builds an HxStr from ScriptMsg::mScript, substituting the program-wide empty string for a null buffer, and passes it to RunScript().

Parameters
pMsgThe message.
Ghidra address:
NTSC-U/C: 0x00118b50
Ghidra address:
PAL: 0x00119088

Implements MsgSink.


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