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

Network packet the game sends between game systems. More...

#include <gempacket.h>

Inheritance diagram for GemPacket:
Collaboration diagram for GemPacket:

Public Member Functions

 GemPacket ()
 Construct a packet with the payload unset beyond the Packet words and the position.
 GemPacket (const Gem &fields, int nTr)
 Report one gem event.
virtual Message * Clone ()
 Produce a heap copy of this packet.
virtual int Type ()
 Report this packet's registered identity.
virtual const char * GetName () const
 Report this packet's class name.
virtual void PrintExtra (std::ostream &stream) const
 Write a description of the packet to a diagnostic stream.
virtual void saveGuts (OBStream &stream) const
 Write the packet to a stream.
virtual void restoreGuts (IBStream &stream)
 Read the packet back from a stream.
Public Member Functions inherited from ToAllOtherGameSystemsPacket
 ToAllOtherGameSystemsPacket ()
 Route the packet with the pair 2 and 3.
Public Member Functions inherited from Message
void * operator new (size_t nSize)
 Allocate a message from the tagged heap under the tag MSG.
void operator delete (void *pBlock)
 Release a message to the tagged heap under the tag MSG.
virtual ~Message ()
 Vtable slot 1.
std::ostream & Print (std::ostream &stream) const
 Write this message to a diagnostic stream as {GetName() PrintExtra()}.

Static Public Member Functions

static Message * New ()
 Produce a default-constructed packet on the heap.
Static Public Member Functions inherited from Message
static Message * NewMessage (int nType)
 Produce a message of the identified class through the factory list.

Public Attributes

Gem mFields
 The gem.
int mTr
 The track, labelled tr: by PrintExtra().

Additional Inherited Members

Protected Member Functions inherited from Packet
 Packet (int nDestination, int nDestinationSystem)
 Set the two routing words and mark the remaining two as unset.
Protected Attributes inherited from Packet
int mDestination
int mDestinationSystem
int mClientId
 The client the packet concerns, or -1 until set.
int mTargetClientId
 A second client identifier, -1 until set.

Detailed Description

Network packet the game sends between game systems.

Its RTTI descriptor is at 0x008ef710. It has ToAllOtherGameSystemsPacket as its one base. The object is 0x2c bytes and its vtable is at 0x00814380, with eight entries and a zero terminator at index 8. Slot 1 is the compiler-generated destructor, slots 2 through 4 supply the three pure slots Packet does not implement, and slots 5, 6, and 7 override Message::PrintExtra(), Packet::saveGuts(), and Packet::restoreGuts(). The four words Packet provides are declared there rather than here.

This class shares its RTTI accessor and vtable with ToAllOtherGameSystemsPacket, its own base, which has no implementation of its own. The vtable belongs to this class.

The payload layout is recovered from the three field routines rather than from the copy constructor. The copy constructor at 0x003f3d18 moves +0x14 through +0x23 with two unaligned 64-bit pairs, which reads as two eight-byte members and is the compiler merging adjacent four-byte fields. Gem::saveGuts() at 0x001a2560, Gem::restoreGuts() at 0x001a2630, and Gem::Print() at 0x001a2ce0 transfer the same region as five separate four-byte lvalues, and Gem::Print() labels each one, which is what recovers both the widths and the names.

The allocation tag on both the allocation in Clone() and the release in the destructor is MSG, which is the tag Message declares rather than one of this class.

The destructor at 0x003f16d8 is compiler-generated and has no declaration here.

Constructor & Destructor Documentation

◆ GemPacket() [1/2]

GemPacket::GemPacket ( )
inline

Construct a packet with the payload unset beyond the Packet words and the position.

Inline. New() expands it. A declaration is required because the class declares a second constructor.

◆ GemPacket() [2/2]

GemPacket::GemPacket ( const Gem & fields,
int nTr )
inline

Report one gem event.

Inline, with no address of its own. PhraseMgr::AddGem() at 0x001bab84 expands it on its stack. That routine fills a local Gem with mGem, mBar, mLoc, and mPlayer, leaving mTrans unset, copies the whole subobject in, and passes the manager's word at +0x30 as the track.

Parameters
fieldsThe gem event.
nTrThe track.

Member Function Documentation

◆ New()

Message * GemPacket::New ( )
static

Produce a default-constructed packet on the heap.

The registry the translation unit at 0x003ed2e0 builds stores this address against g_nGemPacketType.

Returns
The packet.
Ghidra address:
NTSC-U/C: 0x003e5148
Ghidra address:
PAL: 0x0041d3e0

◆ Clone()

virtual Message * GemPacket::Clone ( )
virtual

Produce a heap copy of this packet.

Returns
The copy.
Ghidra address:
NTSC-U/C: 0x003f1750
Ghidra address:
PAL: 0x00429c18

Implements Message.

◆ Type()

virtual int GemPacket::Type ( )
virtual

Report this packet's registered identity.

Returns
g_nGemPacketType.
Ghidra address:
NTSC-U/C: 0x003f17c8
Ghidra address:
PAL: 0x00429c90

Implements Message.

◆ GetName()

virtual const char * GemPacket::GetName ( ) const
virtual

Report this packet's class name.

Returns
The literal GemPacket.
Ghidra address:
NTSC-U/C: 0x003f17d8
Ghidra address:
PAL: 0x00429ca0

Implements Message.

◆ PrintExtra()

virtual void GemPacket::PrintExtra ( std::ostream & stream) const
virtual

Write a description of the packet to a diagnostic stream.

Slot 5, overriding Message::PrintExtra().

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x003f2878
Ghidra address:
PAL: 0x0042adc0

Reimplemented from Message.

◆ saveGuts()

virtual void GemPacket::saveGuts ( OBStream & stream) const
virtual

Write the packet to a stream.

Slot 6, overriding Packet::saveGuts(). mClientId is written a second time after the payload, repeating the transfer the Packet prefix already performed, and restoreGuts() reads the same word twice to match.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x003e8258
Ghidra address:
PAL: 0x00420538

Reimplemented from Packet.

◆ restoreGuts()

virtual void GemPacket::restoreGuts ( IBStream & stream)
virtual

Read the packet back from a stream.

Slot 7, overriding Packet::restoreGuts().

Parameters
streamThe stream to read from.
Ghidra address:
NTSC-U/C: 0x003e8368
Ghidra address:
PAL: 0x00420648

Reimplemented from Packet.

Member Data Documentation

◆ mFields

Gem GemPacket::mFields

The gem.

+0x14

PhraseMgr::PostGemMsg() at 0x001ba6d0 reads it directly.

◆ mTr

int GemPacket::mTr

The track, labelled tr: by PrintExtra().

+0x28

PhraseMgr::PostGemMsg() compares it with the track the manager serves.


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