wavelength 1.0.0
Loading...
Searching...
No Matches
JoinpadRT Class Reference

The online session of a console that joins it. More...

#include <joinpadrt.h>

Inheritance diagram for JoinpadRT:
Collaboration diagram for JoinpadRT:

Public Member Functions

 JoinpadRT (MsgSink *pScreen, MsgSink *pGame, int nWorldId, int nHostAccount)
 Construct the session, request the key from the host, and start mConnectTask.
 ~JoinpadRT () override
 Stop and delete mClockSync, and clear TheJoinpadRT.
void RemovePlayer (int nId) override
 Remove a player who left, and exit the session when the host left.
float GetTime () override
 Report the clock of the host.
void OnConnected () override
 Report JoinLaunchpadSuccessMsg to the sink of mConnectTask.
void PollPriv () override
 Poll mClockSync.
bool DispatchPriv (Message *pMsg) override
 Act on a packet of the session, before LaunchpadRT does.
void RequestKey (int nHostAccount)
 Ask the host for the key of the session.
void OnClockSynced (float fOffset, float fRoundTrip)
 Take the offset of the clock of the host, and report this console ready when it can be.
bool OnMsg (WelcomePkt *pPkt)
 Take the colour and the settings the host welcomed this console with.
bool OnMsg (JoinFailedPkt *pPkt)
 Fail the session with the reason of the host.
bool OnMsg (ClientInfoPkt *pPkt)
 Enter a player of the session.
bool OnMsg (TimeResponsePkt *pPkt)
 Pass the clock of the host to mClockSync.
bool OnMsg (GameParamsPkt *pPkt)
 Pass the settings the host published to mGameSink, or exit for a song this console lacks.
bool OnMsg (BootPkt *pPkt)
 Exit when the host removed this console, and otherwise remove the guest.
bool OnMsg (GameOverPkt *pPkt)
 Rate the game from the final scores, report them, and leave the game.
bool OnMsg (ShareRemixPkt *pPkt)
 Prepare the buffer of the remix the host shares.
bool OnMsg (DataBlockPkt *pPkt)
 Store a block of the remix the host shares and acknowledge it.
bool OnMsg (ChatMsg *pMsg)
 Take the key of the session the host sent.
int GetKeyReceived () const
ClockSyncTask * GetClockSync () const
const NetGameParams & GetParams () const
float GetClockOffset () const
const RemixInfo & GetRemixInfo () const
bool OnMsg (ClientStatusPkt *pPkt)
 Take the state of a player.
bool OnMsg (ClientRatingPkt *pPkt)
 Take the rating of a player.
bool OnMsg (LoadGamePkt *pPkt)
 Enter the game, and tell mGameSink to load the song.
bool OnMsg (StartGamePkt *pPkt)
 Take the time the song starts at and the seed of the game.
bool OnMsg (ClientAbortedPkt *pPkt)
 Drop a player who exited the game, and end the game when the host exited.
bool OnMsg (UpdateRanksPkt *pPkt)
 Take the ranks of the players.
Public Member Functions inherited from LaunchpadRT
 LaunchpadRT (MsgSink *pGame)
 Construct the session, stored in TheNetLaunchpad and TheLaunchpadRT.
 ~LaunchpadRT () override
 Stop the requests, and clear TheNetLaunchpad and TheLaunchpadRT.
void Cancel (MsgSink *pSink) override
 Exit the session with reason 0.
void Activate () override
 Mark the session active, and report this console ready when it can be.
void NotifyLoaded () override
 Report this console loaded.
int IsGuest () override
 Report mLocalId.
int GetPlayersVersion () override
 Report sPlayersVersion.
std::list< NetLaunchpadPlayer > * GetPlayers () override
 Report mPlayers.
virtual void ReportNow ()
 Vtable slot 12.
virtual void SetLocalId (int nId)
 Vtable slot 13.
virtual void AddClient (int nId)
 Vtable slot 14.
virtual void EndGame ()
 Vtable slot 19.
virtual void SendRating (int nRank)
 Vtable slot 20.
bool DispatchPriv (Message *pMsg) override
 Act on a packet of the session.
void SetReady (int nReady)
 Set the state of this console and send it to every console.
int Poll ()
 Service the session once per frame.
NetLaunchpadPlayer * FindPlayer (int nId)
 Find a player of the session.
NetLaunchpadPlayer * GetLocalPlayer ()
 Find the player of this console.
void AddPlayer (const NetLaunchpadPlayer &player)
 Insert a player before the first player with a higher colour.
void StartGame ()
 Start the song, and rate the start of a rated game as a loss of this console.
void DropRating (int nId)
 Rate a player who left as a loser, and drop every guest when the host left.
void RateGame (const std::vector< NetGameScore > &scores)
 Rate the players from the final scores of the game, and clear the rating.
void UpdateRating ()
 Rate the player of this console from mRatings and publish the rating.
void Exit (MsgSink *pSink, int nReason)
 End the game and start mExitTask.
int FindIdByAccount (int nAccountId)
 Find the identifier in the session of an account.
void Abort (int nReason)
 Exit the session for mGameSink.
void Send (Packet *pPacket)
 Encrypt a packet and send it to the consoles its receiver selects.
void Leave ()
 Leave the game and tell the other consoles.
void PlayersChanged ()
 Count a change of the players.
void CheckReady ()
 Report this console ready once the session is active and synced.
bool OnMsg (ClientStatusPkt *pPkt)
 Take the state of a player.
bool OnMsg (ClientRatingPkt *pPkt)
 Take the rating of a player.
bool OnMsg (LoadGamePkt *pPkt)
 Enter the game, and tell mGameSink to load the song.
bool OnMsg (StartGamePkt *pPkt)
 Take the time the song starts at and the seed of the game.
bool OnMsg (ClientAbortedPkt *pPkt)
 Drop a player who exited the game, and end the game when the host exited.
bool OnMsg (UpdateRanksPkt *pPkt)
 Take the ranks of the players.
int GetWorldId () const
void SetWorldId (int nValue)
const rtNetConnectionInfo & GetConnectionInfo () const
void SetConnectionInfo (const rtNetConnectionInfo &info)
int GetConnection () const
void SetConnection (int nValue)
int GetLocalId () const
void SetLocalIdValue (int nValue)
int GetState () const
void SetState (int nValue)
int GetError () const
void SetError (int nValue)
MsgSink * GetGameSink () const
std::list< NetLaunchpadPlayer > & GetPlayersList ()
const std::vector< int > & GetClients () const
Public Member Functions inherited from NetLaunchpad
virtual void EndEdit ()
 Vtable slot 7.
virtual bool ShareRemix ()
 Vtable slot 8.
virtual int Launch ()
 Vtable slot 9.
virtual void BootPlayer (int nPlayer)
 Vtable slot 10.
virtual ~NetLaunchpad ()
 Vtable slot 11.
Public Member Functions inherited from MsgSink
void * operator new (size_t nSize)
 Allocate a sink from the pool heaps under the tag "MsgSink".
void operator delete (void *pBlock)
 Return a sink to the pool heaps.
virtual ~MsgSink ()
virtual bool Dispatch (Message *pMsg)
 Accept a message.
void * operator new (size_t size)
 Allocate from the main heap under the name MsgSink.
void operator delete (void *mem)
 Return memory to its heap.
virtual ~MsgSink ()
 Destroy the sink.
virtual bool Dispatch (Message *msg)
 Handle a message.

Static Public Member Functions

static void Create (MsgSink *pScreen, MsgSink *pGame, int nWorldId, int nHostAccount)
 Start joining a session.
Static Public Member Functions inherited from LaunchpadRT
static int RegisterMessages ()
 Register the packets of the session with the session library.
static void SetMgclReady (int nReady)
 Set sMgclReady.
static int IsMgclReady ()
 Report sMgclReady.
static NetTask * GetNetTask ()
static void SetNetTask (NetTask *pTask)
static unsigned char DecodeByte (const char *pszText)
 Read a byte EncodeByte() wrote.
static void EncodeByte (char *pszText, unsigned char nByte)
 Write a byte as two characters and a terminator.
static int FindScore (const std::vector< NetGameScore > &scores, int nId)
 Report the score of a player in the final scores.
static int Receive (int nConnection, int nType, int nSender, rtDmeMessage *pMessage)
 Receive a message of the session, the handler rtDmeRegisterMessageHandler() registers.
static void OnNetConnect (int nConnection, int nReserved1, int nReserved2, int nStatus)
 Receive the result of NetHostTask and NetConnectTask, and finish sNetTask.
static void OnNetClientJoin (int nConnection, int nClient, const char *pszAddress)
 Note a console that connected to the session.
static void OnNetClientLeave (int nConnection, int nClient, const char *pszAddress)
 Remove a console that left the session.

Additional Inherited Members

Public Types inherited from LaunchpadRT
enum  State {
  kStateFailed = -1 , kStateConnecting = 0 , kStateConnected = 1 , kStateWelcomed = 2 ,
  kStateSynced = 3
}
 Values of mState. More...
enum  Ready { kReadyNo = 0 , kReadyYes = 1 , kReadyLoading = 2 , kReadyLoaded = 3 }
 Values of NetLaunchpadPlayer::mReady. More...
Static Public Attributes inherited from LaunchpadRT
static constexpr int kHostId = 0
 The identifier of the host in the session.
static constexpr int kNoId = -2
 The identifier of a console that has none yet.
static constexpr int kNoWorld = -1
 The value of mWorldId and mConnection without a session.
static constexpr int kKeyChannel = 4
 The chat channel the session exchanges its key on.
static constexpr int kKeySize = 16
 The size of the key of the session in bytes.
static constexpr int kMaxClients = 5
 The consoles a session takes on the session library and the game server.
static constexpr int kGameHostPeerToPeer = 2
 The kind of host the session reports to the servers, a host among its peers.
Protected Attributes inherited from LaunchpadRT
int mWorldId
rtNetConnectionInfo mConnectionInfo
int mConnection
int mLocalId
int mState
int mError
MsgSink * mGameSink
NetMultiTask mConnectTask
NetMultiTask mExitTask
NetMultiTask mRankTask
PeriodicTask mPlayerReport
TaskList mTasks
std::list< NetLaunchpadPlayer > mPlayers
float mStartTime
int mSeed
int mActive
int mShareOnly
int mStarting
int mInGame
std::vector< int > mClients
std::vector< RatingStat > mRatings

Detailed Description

The online session of a console that joins it.

The RTTI records the class as deriving from LaunchpadRT. The vtables are at 0x003d45c0 and 0x003d4598, and the object is 0x278 bytes. The constructor stores the instance in TheJoinpadRT. A guest asks the host for the key of the session, follows the clock of the host, and receives the settings and the remix of the game.

Constructor & Destructor Documentation

◆ JoinpadRT()

JoinpadRT::JoinpadRT ( MsgSink * pScreen,
MsgSink * pGame,
int nWorldId,
int nHostAccount )

Construct the session, request the key from the host, and start mConnectTask.

Parameters
pScreenThe screen that receives the result of the attempt.
pGameThe sink that receives the messages of the session.
nWorldIdThe session on the game server.
nHostAccountThe account of the host.
Ghidra address:
NTSC-U/C: 0x00259e30
Ghidra address:
PAL: 0x00262d30

◆ ~JoinpadRT()

JoinpadRT::~JoinpadRT ( )
override

Stop and delete mClockSync, and clear TheJoinpadRT.

Ghidra address:
NTSC-U/C: 0x0025a0a0
Ghidra address:
PAL: 0x00262fa0

Member Function Documentation

◆ Create()

void JoinpadRT::Create ( MsgSink * pScreen,
MsgSink * pGame,
int nWorldId,
int nHostAccount )
static

Start joining a session.

Parameters
pScreenThe screen that receives the result of the attempt.
pGameThe sink that receives the messages of the session.
nWorldIdThe session on the game server.
nHostAccountThe account of the host, who sends the key of the session.
Ghidra address:
NTSC-U/C: 0x00254d98
Ghidra address:
PAL: 0x0025dcb0

◆ RemovePlayer()

void JoinpadRT::RemovePlayer ( int nId)
overridevirtual

Remove a player who left, and exit the session when the host left.

Parameters
nIdThe player's identifier in the session.
Ghidra address:
NTSC-U/C: 0x0025a170
Ghidra address:
PAL: 0x00263080

Reimplemented from LaunchpadRT.

◆ GetTime()

float JoinpadRT::GetTime ( )
overridevirtual

Report the clock of the host.

Returns
SystemMs() plus mClockOffset.
Ghidra address:
NTSC-U/C: 0x0025a408
Ghidra address:
PAL: 0x00263318

Implements LaunchpadRT.

◆ OnConnected()

void JoinpadRT::OnConnected ( )
overridevirtual

Report JoinLaunchpadSuccessMsg to the sink of mConnectTask.

Ghidra address:
NTSC-U/C: 0x0025a1b8
Ghidra address:
PAL: 0x002630c8

Implements LaunchpadRT.

◆ PollPriv()

void JoinpadRT::PollPriv ( )
overridevirtual

Poll mClockSync.

The European release then calls PollStart().

Ghidra address:
NTSC-U/C: 0x0025a150
Ghidra address:
PAL: 0x00263050

Implements LaunchpadRT.

◆ DispatchPriv()

bool JoinpadRT::DispatchPriv ( Message * pMsg)
overridevirtual

Act on a packet of the session, before LaunchpadRT does.

Parameters
pMsgThe message.
Returns
The result of the handler, false for every handler here.
Ghidra address:
NTSC-U/C: 0x0025ad30
Ghidra address:
PAL: 0x00263d80

Implements MsgSink.

◆ RequestKey()

void JoinpadRT::RequestKey ( int nHostAccount)

Ask the host for the key of the session.

The name is inferred.

Parameters
nHostAccountThe account of the host.
Ghidra address:
NTSC-U/C: 0x0025a480
Ghidra address:
PAL: 0x00263390

◆ OnClockSynced()

void JoinpadRT::OnClockSynced ( float fOffset,
float fRoundTrip )

Take the offset of the clock of the host, and report this console ready when it can be.

ClockSyncTask calls the member. The name is inferred.

Parameters
fOffsetThe clock of the host less the clock of this console, in milliseconds.
fRoundTripThe mean round trip to the host, in milliseconds. It is not read.
Ghidra address:
NTSC-U/C: 0x0025a4a8
Ghidra address:
PAL: 0x002633b8

◆ OnMsg() [1/16]

bool JoinpadRT::OnMsg ( WelcomePkt * pPkt)

Take the colour and the settings the host welcomed this console with.

A song the console does not have fails the session.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x0025a4d0
Ghidra address:
PAL: 0x00263520

◆ OnMsg() [2/16]

bool JoinpadRT::OnMsg ( JoinFailedPkt * pPkt)

Fail the session with the reason of the host.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x0025a720
Ghidra address:
PAL: 0x00263770

◆ OnMsg() [3/16]

bool JoinpadRT::OnMsg ( ClientInfoPkt * pPkt)

Enter a player of the session.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x0025a738
Ghidra address:
PAL: 0x00263788

◆ OnMsg() [4/16]

bool JoinpadRT::OnMsg ( TimeResponsePkt * pPkt)

Pass the clock of the host to mClockSync.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x0025a758
Ghidra address:
PAL: 0x002637a8

◆ OnMsg() [5/16]

bool JoinpadRT::OnMsg ( GameParamsPkt * pPkt)

Pass the settings the host published to mGameSink, or exit for a song this console lacks.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x0025a780
Ghidra address:
PAL: 0x002637d0

◆ OnMsg() [6/16]

bool JoinpadRT::OnMsg ( BootPkt * pPkt)

Exit when the host removed this console, and otherwise remove the guest.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x0025a8c0
Ghidra address:
PAL: 0x00263910

◆ OnMsg() [7/16]

bool JoinpadRT::OnMsg ( GameOverPkt * pPkt)

Rate the game from the final scores, report them, and leave the game.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x0025a910
Ghidra address:
PAL: 0x00263960

◆ OnMsg() [8/16]

bool JoinpadRT::OnMsg ( ShareRemixPkt * pPkt)

Prepare the buffer of the remix the host shares.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x0025aab0
Ghidra address:
PAL: 0x00263b00

◆ OnMsg() [9/16]

bool JoinpadRT::OnMsg ( DataBlockPkt * pPkt)

Store a block of the remix the host shares and acknowledge it.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x0025abc0
Ghidra address:
PAL: 0x00263c10

◆ OnMsg() [10/16]

bool JoinpadRT::OnMsg ( ChatMsg * pMsg)

Take the key of the session the host sent.

Parameters
pMsgThe message.
Returns
False.
Ghidra address:
NTSC-U/C: 0x0025acc0
Ghidra address:
PAL: 0x00263d10

◆ GetKeyReceived()

int JoinpadRT::GetKeyReceived ( ) const
inline
Returns
Non-zero once the key of the session arrived.

◆ GetClockSync()

ClockSyncTask * JoinpadRT::GetClockSync ( ) const
inline
Returns
The task that follows the clock of the host.

◆ GetParams()

const NetGameParams & JoinpadRT::GetParams ( ) const
inline
Returns
The settings of the game the host published.

◆ GetClockOffset()

float JoinpadRT::GetClockOffset ( ) const
inline
Returns
The clock of the host less the clock of this console.

◆ GetRemixInfo()

const RemixInfo & JoinpadRT::GetRemixInfo ( ) const
inline
Returns
The description of the remix the host shares.

◆ OnMsg() [11/16]

Take the state of a player.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x00256760
Ghidra address:
PAL: 0x0025f668

◆ OnMsg() [12/16]

Take the rating of a player.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x002567b0
Ghidra address:
PAL: 0x0025f6b8

◆ OnMsg() [13/16]

Enter the game, and tell mGameSink to load the song.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x00256830
Ghidra address:
PAL: 0x0025f738

◆ OnMsg() [14/16]

Take the time the song starts at and the seed of the game.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x002568b8
Ghidra address:
PAL: 0x0025f7c0

◆ OnMsg() [15/16]

Drop a player who exited the game, and end the game when the host exited.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x00256940
Ghidra address:
PAL: 0x0025f848

◆ OnMsg() [16/16]

Take the ranks of the players.

Parameters
pPktThe packet.
Returns
False.
Ghidra address:
NTSC-U/C: 0x00256a48
Ghidra address:
PAL: 0x0025f950

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