mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
refactor: migrate CPlatformNetworkManager into IPlatformNetwork
This commit is contained in:
parent
7b1a6092e1
commit
35b63da24d
|
|
@ -3203,7 +3203,7 @@ void CMinecraftApp::HandleXuiActions(void) {
|
||||||
SetAction(i, eAppAction_Idle);
|
SetAction(i, eAppAction_Idle);
|
||||||
|
|
||||||
// 4J Stu - Move this state block from
|
// 4J Stu - Move this state block from
|
||||||
// CPlatformNetworkManager::ExitAndJoinFromInviteThreadProc,
|
// IPlatformNetwork::ExitAndJoinFromInviteThreadProc,
|
||||||
// as g_NetworkManager.JoinGameFromInviteInfo ultimately can
|
// as g_NetworkManager.JoinGameFromInviteInfo ultimately can
|
||||||
// call NavigateToScene,
|
// call NavigateToScene,
|
||||||
/// and we should only be calling that from the main thread
|
/// and we should only be calling that from the main thread
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ public:
|
||||||
static IPlatformLeaderboard* Instance() { return m_instance; }
|
static IPlatformLeaderboard* Instance() { return m_instance; }
|
||||||
static void DeleteInstance();
|
static void DeleteInstance();
|
||||||
|
|
||||||
// IPlatformLeaderboard pure virtuals — subclasses must implement:
|
// IPlatformLeaderboard pure virtuals - subclasses must implement:
|
||||||
// Tick, OpenSession, CloseSession, DeleteSession, WriteStats,
|
// Tick, OpenSession, CloseSession, DeleteSession, WriteStats,
|
||||||
// FlushStats, CancelOperation, isIdle
|
// FlushStats, CancelOperation, isIdle
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class INVITE_INFO;
|
||||||
|
|
||||||
// Global instance
|
// Global instance
|
||||||
CGameNetworkManager g_NetworkManager;
|
CGameNetworkManager g_NetworkManager;
|
||||||
CPlatformNetworkManager* CGameNetworkManager::s_pPlatformNetworkManager;
|
IPlatformNetwork* CGameNetworkManager::s_pPlatformNetworkManager;
|
||||||
|
|
||||||
int64_t CGameNetworkManager::messageQueue[512];
|
int64_t CGameNetworkManager::messageQueue[512];
|
||||||
int64_t CGameNetworkManager::byteQueue[512];
|
int64_t CGameNetworkManager::byteQueue[512];
|
||||||
|
|
@ -80,7 +80,7 @@ void CGameNetworkManager::Initialise() {
|
||||||
LevelRenderer::getGlobalChunkCount() /
|
LevelRenderer::getGlobalChunkCount() /
|
||||||
(Level::maxBuildHeight /
|
(Level::maxBuildHeight /
|
||||||
16); // dividing here by number of renderer chunks in one column
|
16); // dividing here by number of renderer chunks in one column
|
||||||
s_pPlatformNetworkManager = new CPlatformNetworkManagerStub();
|
s_pPlatformNetworkManager = new IPlatformNetworkStub();
|
||||||
s_pPlatformNetworkManager->Initialise(this, flagIndexSize);
|
s_pPlatformNetworkManager->Initialise(this, flagIndexSize);
|
||||||
m_bNetworkThreadRunning = false;
|
m_bNetworkThreadRunning = false;
|
||||||
m_bInitialised = true;
|
m_bInitialised = true;
|
||||||
|
|
@ -1073,13 +1073,13 @@ void CGameNetworkManager::StateChange_AnyToJoining() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameNetworkManager::StateChange_JoiningToIdle(
|
void CGameNetworkManager::StateChange_JoiningToIdle(
|
||||||
CPlatformNetworkManager::eJoinFailedReason reason) {
|
IPlatformNetwork::eJoinFailedReason reason) {
|
||||||
DisconnectPacket::eDisconnectReason disconnectReason;
|
DisconnectPacket::eDisconnectReason disconnectReason;
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case CPlatformNetworkManager::JOIN_FAILED_SERVER_FULL:
|
case IPlatformNetwork::JOIN_FAILED_SERVER_FULL:
|
||||||
disconnectReason = DisconnectPacket::eDisconnect_ServerFull;
|
disconnectReason = DisconnectPacket::eDisconnect_ServerFull;
|
||||||
break;
|
break;
|
||||||
case CPlatformNetworkManager::JOIN_FAILED_INSUFFICIENT_PRIVILEGES:
|
case IPlatformNetwork::JOIN_FAILED_INSUFFICIENT_PRIVILEGES:
|
||||||
disconnectReason =
|
disconnectReason =
|
||||||
DisconnectPacket::eDisconnect_NoMultiplayerPrivilegesJoin;
|
DisconnectPacket::eDisconnect_NoMultiplayerPrivilegesJoin;
|
||||||
app.SetAction(ProfileManager.GetPrimaryPad(),
|
app.SetAction(ProfileManager.GetPrimaryPad(),
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include <qnet.h>
|
#include <qnet.h>
|
||||||
#endif
|
#endif
|
||||||
#include "4J.Common/4J_Compat.h"
|
#include "4J.Common/4J_Compat.h"
|
||||||
#include "Minecraft.Client/Common/src/Network/PlatformNetworkManagerInterface.h"
|
#include "platform/IPlatformNetwork.h"
|
||||||
#include "Minecraft.Client/include/NetTypes.h"
|
#include "Minecraft.Client/include/NetTypes.h"
|
||||||
#include "NetworkPlayerInterface.h"
|
#include "NetworkPlayerInterface.h"
|
||||||
#include "PlatformNetworkManagerStub.h"
|
#include "PlatformNetworkManagerStub.h"
|
||||||
|
|
@ -30,7 +30,7 @@ const int NON_QNET_SENDDATA_ACK_REQUIRED = 1;
|
||||||
// implementation of PlatformNetworkManager to provide this functionality.
|
// implementation of PlatformNetworkManager to provide this functionality.
|
||||||
|
|
||||||
class CGameNetworkManager {
|
class CGameNetworkManager {
|
||||||
friend class CPlatformNetworkManagerStub;
|
friend class IPlatformNetworkStub;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CGameNetworkManager();
|
CGameNetworkManager();
|
||||||
|
|
@ -175,7 +175,7 @@ private:
|
||||||
void StateChange_AnyToHosting();
|
void StateChange_AnyToHosting();
|
||||||
void StateChange_AnyToJoining();
|
void StateChange_AnyToJoining();
|
||||||
void StateChange_JoiningToIdle(
|
void StateChange_JoiningToIdle(
|
||||||
CPlatformNetworkManager::eJoinFailedReason reason);
|
IPlatformNetwork::eJoinFailedReason reason);
|
||||||
void StateChange_AnyToStarting();
|
void StateChange_AnyToStarting();
|
||||||
void StateChange_AnyToEnding(bool bStateWasPlaying);
|
void StateChange_AnyToEnding(bool bStateWasPlaying);
|
||||||
void StateChange_AnyToIdle();
|
void StateChange_AnyToIdle();
|
||||||
|
|
@ -202,7 +202,7 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float m_lastPlayerEventTimeStart; // For telemetry
|
float m_lastPlayerEventTimeStart; // For telemetry
|
||||||
static CPlatformNetworkManager* s_pPlatformNetworkManager;
|
static IPlatformNetwork* s_pPlatformNetworkManager;
|
||||||
bool m_bNetworkThreadRunning;
|
bool m_bNetworkThreadRunning;
|
||||||
int GetJoiningReadyPercentage();
|
int GetJoiningReadyPercentage();
|
||||||
bool m_bLastDisconnectWasLostRoomOnly;
|
bool m_bLastDisconnectWasLostRoomOnly;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ typedef struct _SearchForGamesData {
|
||||||
XOVERLAPPED* pOverlapped;
|
XOVERLAPPED* pOverlapped;
|
||||||
} SearchForGamesData;
|
} SearchForGamesData;
|
||||||
|
|
||||||
class CPlatformNetworkManager {
|
class IPlatformNetwork {
|
||||||
friend class CGameNetworkManager;
|
friend class CGameNetworkManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
#include "Socket.h"
|
#include "Socket.h"
|
||||||
#include "console_helpers/C4JThread.h"
|
#include "console_helpers/C4JThread.h"
|
||||||
|
|
||||||
CPlatformNetworkManagerStub* g_pPlatformNetworkManager;
|
IPlatformNetworkStub* g_pPlatformNetworkManager;
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) {
|
void IPlatformNetworkStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) {
|
||||||
const char* pszDescription;
|
const char* pszDescription;
|
||||||
|
|
||||||
// 4J Stu - We create a fake socket for every where that we need an INBOUND
|
// 4J Stu - We create a fake socket for every where that we need an INBOUND
|
||||||
|
|
@ -109,7 +109,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::Initialise(
|
bool IPlatformNetworkStub::Initialise(
|
||||||
CGameNetworkManager* pGameNetworkManager, int flagIndexSize) {
|
CGameNetworkManager* pGameNetworkManager, int flagIndexSize) {
|
||||||
m_pGameNetworkManager = pGameNetworkManager;
|
m_pGameNetworkManager = pGameNetworkManager;
|
||||||
m_flagIndexSize = flagIndexSize;
|
m_flagIndexSize = flagIndexSize;
|
||||||
|
|
@ -147,58 +147,58 @@ bool CPlatformNetworkManagerStub::Initialise(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::Terminate() {
|
void IPlatformNetworkStub::Terminate() {
|
||||||
// TODO: 4jcraft, no release of ressources
|
// TODO: 4jcraft, no release of ressources
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPlatformNetworkManagerStub::GetJoiningReadyPercentage() { return 100; }
|
int IPlatformNetworkStub::GetJoiningReadyPercentage() { return 100; }
|
||||||
|
|
||||||
int CPlatformNetworkManagerStub::CorrectErrorIDS(int IDS) { return IDS; }
|
int IPlatformNetworkStub::CorrectErrorIDS(int IDS) { return IDS; }
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::isSystemPrimaryPlayer(
|
bool IPlatformNetworkStub::isSystemPrimaryPlayer(
|
||||||
IQNetPlayer* pQNetPlayer) {
|
IQNetPlayer* pQNetPlayer) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We call this twice a frame, either side of the render call so is a good place
|
// We call this twice a frame, either side of the render call so is a good place
|
||||||
// to "tick" things
|
// to "tick" things
|
||||||
void CPlatformNetworkManagerStub::DoWork() {}
|
void IPlatformNetworkStub::DoWork() {}
|
||||||
|
|
||||||
int CPlatformNetworkManagerStub::GetPlayerCount() {
|
int IPlatformNetworkStub::GetPlayerCount() {
|
||||||
return m_pIQNet->GetPlayerCount();
|
return m_pIQNet->GetPlayerCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::ShouldMessageForFullSession() {
|
bool IPlatformNetworkStub::ShouldMessageForFullSession() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPlatformNetworkManagerStub::GetOnlinePlayerCount() { return 1; }
|
int IPlatformNetworkStub::GetOnlinePlayerCount() { return 1; }
|
||||||
|
|
||||||
int CPlatformNetworkManagerStub::GetLocalPlayerMask(int playerIndex) {
|
int IPlatformNetworkStub::GetLocalPlayerMask(int playerIndex) {
|
||||||
return 1 << playerIndex;
|
return 1 << playerIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::AddLocalPlayerByUserIndex(int userIndex) {
|
bool IPlatformNetworkStub::AddLocalPlayerByUserIndex(int userIndex) {
|
||||||
NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(userIndex));
|
NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(userIndex));
|
||||||
return (m_pIQNet->AddLocalPlayerByUserIndex(userIndex) == 0);
|
return (m_pIQNet->AddLocalPlayerByUserIndex(userIndex) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::RemoveLocalPlayerByUserIndex(int userIndex) {
|
bool IPlatformNetworkStub::RemoveLocalPlayerByUserIndex(int userIndex) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::IsInStatsEnabledSession() { return true; }
|
bool IPlatformNetworkStub::IsInStatsEnabledSession() { return true; }
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::SessionHasSpace(
|
bool IPlatformNetworkStub::SessionHasSpace(
|
||||||
unsigned int spaceRequired /*= 1*/) {
|
unsigned int spaceRequired /*= 1*/) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::SendInviteGUI(int quadrant) {}
|
void IPlatformNetworkStub::SendInviteGUI(int quadrant) {}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::IsAddingPlayer() { return false; }
|
bool IPlatformNetworkStub::IsAddingPlayer() { return false; }
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::LeaveGame(bool bMigrateHost) {
|
bool IPlatformNetworkStub::LeaveGame(bool bMigrateHost) {
|
||||||
if (m_bLeavingGame) return true;
|
if (m_bLeavingGame) return true;
|
||||||
|
|
||||||
m_bLeavingGame = true;
|
m_bLeavingGame = true;
|
||||||
|
|
@ -212,12 +212,12 @@ bool CPlatformNetworkManagerStub::LeaveGame(bool bMigrateHost) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::_LeaveGame(bool bMigrateHost,
|
bool IPlatformNetworkStub::_LeaveGame(bool bMigrateHost,
|
||||||
bool bLeaveRoom) {
|
bool bLeaveRoom) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::HostGame(
|
void IPlatformNetworkStub::HostGame(
|
||||||
int localUsersMask, bool bOnlineGame, bool bIsPrivate,
|
int localUsersMask, bool bOnlineGame, bool bIsPrivate,
|
||||||
unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/,
|
unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/,
|
||||||
unsigned char privateSlots /*= 0*/) {
|
unsigned char privateSlots /*= 0*/) {
|
||||||
|
|
@ -238,30 +238,30 @@ void CPlatformNetworkManagerStub::HostGame(
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::_HostGame(
|
void IPlatformNetworkStub::_HostGame(
|
||||||
int usersMask, unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/,
|
int usersMask, unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/,
|
||||||
unsigned char privateSlots /*= 0*/) {}
|
unsigned char privateSlots /*= 0*/) {}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::_StartGame() { return true; }
|
bool IPlatformNetworkStub::_StartGame() { return true; }
|
||||||
|
|
||||||
int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult,
|
int IPlatformNetworkStub::JoinGame(FriendSessionInfo* searchResult,
|
||||||
int localUsersMask,
|
int localUsersMask,
|
||||||
int primaryUserIndex) {
|
int primaryUserIndex) {
|
||||||
return CGameNetworkManager::JOINGAME_SUCCESS;
|
return CGameNetworkManager::JOINGAME_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::SetLocalGame(bool isLocal) {
|
bool IPlatformNetworkStub::SetLocalGame(bool isLocal) {
|
||||||
m_bIsOfflineGame = isLocal;
|
m_bIsOfflineGame = isLocal;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::SetPrivateGame(bool isPrivate) {
|
void IPlatformNetworkStub::SetPrivateGame(bool isPrivate) {
|
||||||
app.DebugPrintf("Setting as private game: %s\n", isPrivate ? "yes" : "no");
|
app.DebugPrintf("Setting as private game: %s\n", isPrivate ? "yes" : "no");
|
||||||
m_bIsPrivateGame = isPrivate;
|
m_bIsPrivateGame = isPrivate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::RegisterPlayerChangedCallback(
|
void IPlatformNetworkStub::RegisterPlayerChangedCallback(
|
||||||
int iPad,
|
int iPad,
|
||||||
void (*callback)(void* callbackParam, INetworkPlayer* pPlayer,
|
void (*callback)(void* callbackParam, INetworkPlayer* pPlayer,
|
||||||
bool leaving),
|
bool leaving),
|
||||||
|
|
@ -270,7 +270,7 @@ void CPlatformNetworkManagerStub::RegisterPlayerChangedCallback(
|
||||||
playerChangedCallbackParam[iPad] = callbackParam;
|
playerChangedCallbackParam[iPad] = callbackParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(
|
void IPlatformNetworkStub::UnRegisterPlayerChangedCallback(
|
||||||
int iPad,
|
int iPad,
|
||||||
void (*callback)(void* callbackParam, INetworkPlayer* pPlayer,
|
void (*callback)(void* callbackParam, INetworkPlayer* pPlayer,
|
||||||
bool leaving),
|
bool leaving),
|
||||||
|
|
@ -281,11 +281,11 @@ void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::HandleSignInChange() { return; }
|
void IPlatformNetworkStub::HandleSignInChange() { return; }
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::_RunNetworkGame() { return true; }
|
bool IPlatformNetworkStub::_RunNetworkGame() { return true; }
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(
|
void IPlatformNetworkStub::UpdateAndSetGameSessionData(
|
||||||
INetworkPlayer* pNetworkPlayerLeaving /*= nullptr*/) {
|
INetworkPlayer* pNetworkPlayerLeaving /*= nullptr*/) {
|
||||||
// uint32_t playerCount = m_pIQNet->GetPlayerCount();
|
// uint32_t playerCount = m_pIQNet->GetPlayerCount();
|
||||||
//
|
//
|
||||||
|
|
@ -332,7 +332,7 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(
|
||||||
// app.GetGameHostOption(eGameHostOption_All);
|
// app.GetGameHostOption(eGameHostOption_All);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc(
|
int IPlatformNetworkStub::RemovePlayerOnSocketClosedThreadProc(
|
||||||
void* lpParam) {
|
void* lpParam) {
|
||||||
INetworkPlayer* pNetworkPlayer = (INetworkPlayer*)lpParam;
|
INetworkPlayer* pNetworkPlayer = (INetworkPlayer*)lpParam;
|
||||||
|
|
||||||
|
|
@ -351,12 +351,12 @@ int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc(
|
||||||
return g_pPlatformNetworkManager->RemoveLocalPlayer(pNetworkPlayer);
|
return g_pPlatformNetworkManager->RemoveLocalPlayer(pNetworkPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::RemoveLocalPlayer(
|
bool IPlatformNetworkStub::RemoveLocalPlayer(
|
||||||
INetworkPlayer* pNetworkPlayer) {
|
INetworkPlayer* pNetworkPlayer) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlatformNetworkManagerStub::PlayerFlags::PlayerFlags(
|
IPlatformNetworkStub::PlayerFlags::PlayerFlags(
|
||||||
INetworkPlayer* pNetworkPlayer, unsigned int count) {
|
INetworkPlayer* pNetworkPlayer, unsigned int count) {
|
||||||
// 4J Stu - Don't assert, just make it a multiple of 8! This count is
|
// 4J Stu - Don't assert, just make it a multiple of 8! This count is
|
||||||
// calculated from a load of separate values, and makes tweaking
|
// calculated from a load of separate values, and makes tweaking
|
||||||
|
|
@ -368,11 +368,11 @@ CPlatformNetworkManagerStub::PlayerFlags::PlayerFlags(
|
||||||
memset(this->flags, 0, count / 8);
|
memset(this->flags, 0, count / 8);
|
||||||
this->count = count;
|
this->count = count;
|
||||||
}
|
}
|
||||||
CPlatformNetworkManagerStub::PlayerFlags::~PlayerFlags() { delete[] flags; }
|
IPlatformNetworkStub::PlayerFlags::~PlayerFlags() { delete[] flags; }
|
||||||
|
|
||||||
// Add a player to the per system flag storage - if we've already got a player
|
// Add a player to the per system flag storage - if we've already got a player
|
||||||
// from that system, copy its flags over
|
// from that system, copy its flags over
|
||||||
void CPlatformNetworkManagerStub::SystemFlagAddPlayer(
|
void IPlatformNetworkStub::SystemFlagAddPlayer(
|
||||||
INetworkPlayer* pNetworkPlayer) {
|
INetworkPlayer* pNetworkPlayer) {
|
||||||
PlayerFlags* newPlayerFlags =
|
PlayerFlags* newPlayerFlags =
|
||||||
new PlayerFlags(pNetworkPlayer, m_flagIndexSize);
|
new PlayerFlags(pNetworkPlayer, m_flagIndexSize);
|
||||||
|
|
@ -390,7 +390,7 @@ void CPlatformNetworkManagerStub::SystemFlagAddPlayer(
|
||||||
|
|
||||||
// Remove a player from the per system flag storage - just maintains the
|
// Remove a player from the per system flag storage - just maintains the
|
||||||
// m_playerFlags vector without any gaps in it
|
// m_playerFlags vector without any gaps in it
|
||||||
void CPlatformNetworkManagerStub::SystemFlagRemovePlayer(
|
void IPlatformNetworkStub::SystemFlagRemovePlayer(
|
||||||
INetworkPlayer* pNetworkPlayer) {
|
INetworkPlayer* pNetworkPlayer) {
|
||||||
for (unsigned int i = 0; i < m_playerFlags.size(); i++) {
|
for (unsigned int i = 0; i < m_playerFlags.size(); i++) {
|
||||||
if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) {
|
if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) {
|
||||||
|
|
@ -402,7 +402,7 @@ void CPlatformNetworkManagerStub::SystemFlagRemovePlayer(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::SystemFlagReset() {
|
void IPlatformNetworkStub::SystemFlagReset() {
|
||||||
for (unsigned int i = 0; i < m_playerFlags.size(); i++) {
|
for (unsigned int i = 0; i < m_playerFlags.size(); i++) {
|
||||||
delete m_playerFlags[i];
|
delete m_playerFlags[i];
|
||||||
}
|
}
|
||||||
|
|
@ -411,7 +411,7 @@ void CPlatformNetworkManagerStub::SystemFlagReset() {
|
||||||
|
|
||||||
// Set a per system flag - this is done by setting the flag on every player that
|
// Set a per system flag - this is done by setting the flag on every player that
|
||||||
// shares that system
|
// shares that system
|
||||||
void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer,
|
void IPlatformNetworkStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer,
|
||||||
int index) {
|
int index) {
|
||||||
if ((index < 0) || (index >= m_flagIndexSize)) return;
|
if ((index < 0) || (index >= m_flagIndexSize)) return;
|
||||||
if (pNetworkPlayer == nullptr) return;
|
if (pNetworkPlayer == nullptr) return;
|
||||||
|
|
@ -426,7 +426,7 @@ void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer,
|
||||||
// Get value of a per system flag - can be read from the flags of the passed in
|
// Get value of a per system flag - can be read from the flags of the passed in
|
||||||
// player as anything else sent to that system should also have been duplicated
|
// player as anything else sent to that system should also have been duplicated
|
||||||
// here
|
// here
|
||||||
bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer* pNetworkPlayer,
|
bool IPlatformNetworkStub::SystemFlagGet(INetworkPlayer* pNetworkPlayer,
|
||||||
int index) {
|
int index) {
|
||||||
if ((index < 0) || (index >= m_flagIndexSize)) return false;
|
if ((index < 0) || (index >= m_flagIndexSize)) return false;
|
||||||
if (pNetworkPlayer == nullptr) {
|
if (pNetworkPlayer == nullptr) {
|
||||||
|
|
@ -442,9 +442,9 @@ bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer* pNetworkPlayer,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring CPlatformNetworkManagerStub::GatherStats() { return L""; }
|
std::wstring IPlatformNetworkStub::GatherStats() { return L""; }
|
||||||
|
|
||||||
std::wstring CPlatformNetworkManagerStub::GatherRTTStats() {
|
std::wstring IPlatformNetworkStub::GatherRTTStats() {
|
||||||
std::wstring stats(L"Rtt: ");
|
std::wstring stats(L"Rtt: ");
|
||||||
|
|
||||||
wchar_t stat[32];
|
wchar_t stat[32];
|
||||||
|
|
@ -462,20 +462,20 @@ std::wstring CPlatformNetworkManagerStub::GatherRTTStats() {
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::TickSearch() {}
|
void IPlatformNetworkStub::TickSearch() {}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::SearchForGames() {}
|
void IPlatformNetworkStub::SearchForGames() {}
|
||||||
|
|
||||||
int CPlatformNetworkManagerStub::SearchForGamesThreadProc(void* lpParameter) {
|
int IPlatformNetworkStub::SearchForGamesThreadProc(void* lpParameter) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::SetSearchResultsReady(int resultCount) {
|
void IPlatformNetworkStub::SetSearchResultsReady(int resultCount) {
|
||||||
m_bSearchResultsReady = true;
|
m_bSearchResultsReady = true;
|
||||||
m_searchResultsCount[m_lastSearchPad] = resultCount;
|
m_searchResultsCount[m_lastSearchPad] = resultCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<FriendSessionInfo*>* CPlatformNetworkManagerStub::GetSessionList(
|
std::vector<FriendSessionInfo*>* IPlatformNetworkStub::GetSessionList(
|
||||||
int iPad, int localPlayers, bool partyOnly) {
|
int iPad, int localPlayers, bool partyOnly) {
|
||||||
std::vector<FriendSessionInfo*>* filteredList =
|
std::vector<FriendSessionInfo*>* filteredList =
|
||||||
new std::vector<FriendSessionInfo*>();
|
new std::vector<FriendSessionInfo*>();
|
||||||
|
|
@ -483,24 +483,24 @@ std::vector<FriendSessionInfo*>* CPlatformNetworkManagerStub::GetSessionList(
|
||||||
return filteredList;
|
return filteredList;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::GetGameSessionInfo(
|
bool IPlatformNetworkStub::GetGameSessionInfo(
|
||||||
int iPad, SessionID sessionId, FriendSessionInfo* foundSessionInfo) {
|
int iPad, SessionID sessionId, FriendSessionInfo* foundSessionInfo) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::SetSessionsUpdatedCallback(
|
void IPlatformNetworkStub::SetSessionsUpdatedCallback(
|
||||||
void (*SessionsUpdatedCallback)(void* pParam), void* pSearchParam) {
|
void (*SessionsUpdatedCallback)(void* pParam), void* pSearchParam) {
|
||||||
m_SessionsUpdatedCallback = SessionsUpdatedCallback;
|
m_SessionsUpdatedCallback = SessionsUpdatedCallback;
|
||||||
m_pSearchParam = pSearchParam;
|
m_pSearchParam = pSearchParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::GetFullFriendSessionInfo(
|
void IPlatformNetworkStub::GetFullFriendSessionInfo(
|
||||||
FriendSessionInfo* foundSession,
|
FriendSessionInfo* foundSession,
|
||||||
void (*FriendSessionUpdatedFn)(bool success, void* pParam), void* pParam) {
|
void (*FriendSessionUpdatedFn)(bool success, void* pParam), void* pParam) {
|
||||||
FriendSessionUpdatedFn(true, pParam);
|
FriendSessionUpdatedFn(true, pParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh() {
|
void IPlatformNetworkStub::ForceFriendsSessionRefresh() {
|
||||||
app.DebugPrintf("Resetting friends session search data\n");
|
app.DebugPrintf("Resetting friends session search data\n");
|
||||||
|
|
||||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
||||||
|
|
@ -511,7 +511,7 @@ void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer* CPlatformNetworkManagerStub::addNetworkPlayer(
|
INetworkPlayer* IPlatformNetworkStub::addNetworkPlayer(
|
||||||
IQNetPlayer* pQNetPlayer) {
|
IQNetPlayer* pQNetPlayer) {
|
||||||
NetworkPlayerQNet* pNetworkPlayer = new NetworkPlayerQNet(pQNetPlayer);
|
NetworkPlayerQNet* pNetworkPlayer = new NetworkPlayerQNet(pQNetPlayer);
|
||||||
pQNetPlayer->SetCustomDataValue((uintptr_t)pNetworkPlayer);
|
pQNetPlayer->SetCustomDataValue((uintptr_t)pNetworkPlayer);
|
||||||
|
|
@ -519,7 +519,7 @@ INetworkPlayer* CPlatformNetworkManagerStub::addNetworkPlayer(
|
||||||
return pNetworkPlayer;
|
return pNetworkPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::removeNetworkPlayer(
|
void IPlatformNetworkStub::removeNetworkPlayer(
|
||||||
IQNetPlayer* pQNetPlayer) {
|
IQNetPlayer* pQNetPlayer) {
|
||||||
INetworkPlayer* pNetworkPlayer = getNetworkPlayer(pQNetPlayer);
|
INetworkPlayer* pNetworkPlayer = getNetworkPlayer(pQNetPlayer);
|
||||||
for (auto it = currentNetworkPlayers.begin();
|
for (auto it = currentNetworkPlayers.begin();
|
||||||
|
|
@ -531,60 +531,60 @@ void CPlatformNetworkManagerStub::removeNetworkPlayer(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer* CPlatformNetworkManagerStub::getNetworkPlayer(
|
INetworkPlayer* IPlatformNetworkStub::getNetworkPlayer(
|
||||||
IQNetPlayer* pQNetPlayer) {
|
IQNetPlayer* pQNetPlayer) {
|
||||||
return pQNetPlayer ? (INetworkPlayer*)(pQNetPlayer->GetCustomDataValue())
|
return pQNetPlayer ? (INetworkPlayer*)(pQNetPlayer->GetCustomDataValue())
|
||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer* CPlatformNetworkManagerStub::GetLocalPlayerByUserIndex(
|
INetworkPlayer* IPlatformNetworkStub::GetLocalPlayerByUserIndex(
|
||||||
int userIndex) {
|
int userIndex) {
|
||||||
return getNetworkPlayer(m_pIQNet->GetLocalPlayerByUserIndex(userIndex));
|
return getNetworkPlayer(m_pIQNet->GetLocalPlayerByUserIndex(userIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer* CPlatformNetworkManagerStub::GetPlayerByIndex(int playerIndex) {
|
INetworkPlayer* IPlatformNetworkStub::GetPlayerByIndex(int playerIndex) {
|
||||||
return getNetworkPlayer(m_pIQNet->GetPlayerByIndex(playerIndex));
|
return getNetworkPlayer(m_pIQNet->GetPlayerByIndex(playerIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer* CPlatformNetworkManagerStub::GetPlayerByXuid(PlayerUID xuid) {
|
INetworkPlayer* IPlatformNetworkStub::GetPlayerByXuid(PlayerUID xuid) {
|
||||||
return getNetworkPlayer(m_pIQNet->GetPlayerByXuid(xuid));
|
return getNetworkPlayer(m_pIQNet->GetPlayerByXuid(xuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer* CPlatformNetworkManagerStub::GetPlayerBySmallId(
|
INetworkPlayer* IPlatformNetworkStub::GetPlayerBySmallId(
|
||||||
unsigned char smallId) {
|
unsigned char smallId) {
|
||||||
return getNetworkPlayer(m_pIQNet->GetPlayerBySmallId(smallId));
|
return getNetworkPlayer(m_pIQNet->GetPlayerBySmallId(smallId));
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer* CPlatformNetworkManagerStub::GetHostPlayer() {
|
INetworkPlayer* IPlatformNetworkStub::GetHostPlayer() {
|
||||||
return getNetworkPlayer(m_pIQNet->GetHostPlayer());
|
return getNetworkPlayer(m_pIQNet->GetHostPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::IsHost() {
|
bool IPlatformNetworkStub::IsHost() {
|
||||||
return m_pIQNet->IsHost() && !m_bHostChanged;
|
return m_pIQNet->IsHost() && !m_bHostChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::JoinGameFromInviteInfo(
|
bool IPlatformNetworkStub::JoinGameFromInviteInfo(
|
||||||
int userIndex, int userMask, const INVITE_INFO* pInviteInfo) {
|
int userIndex, int userMask, const INVITE_INFO* pInviteInfo) {
|
||||||
return (m_pIQNet->JoinGameFromInviteInfo(userIndex, userMask,
|
return (m_pIQNet->JoinGameFromInviteInfo(userIndex, userMask,
|
||||||
pInviteInfo) == 0);
|
pInviteInfo) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::SetSessionTexturePackParentId(int id) {
|
void IPlatformNetworkStub::SetSessionTexturePackParentId(int id) {
|
||||||
m_hostGameSessionData.texturePackParentId = id;
|
m_hostGameSessionData.texturePackParentId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::SetSessionSubTexturePackId(int id) {
|
void IPlatformNetworkStub::SetSessionSubTexturePackId(int id) {
|
||||||
m_hostGameSessionData.subTexturePackId = id;
|
m_hostGameSessionData.subTexturePackId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::Notify(int ID, uintptr_t Param) {}
|
void IPlatformNetworkStub::Notify(int ID, uintptr_t Param) {}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::IsInSession() {
|
bool IPlatformNetworkStub::IsInSession() {
|
||||||
return m_pIQNet->GetState() != QNET_STATE_IDLE;
|
return m_pIQNet->GetState() != QNET_STATE_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::IsInGameplay() {
|
bool IPlatformNetworkStub::IsInGameplay() {
|
||||||
return m_pIQNet->GetState() == QNET_STATE_GAME_PLAY;
|
return m_pIQNet->GetState() == QNET_STATE_GAME_PLAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlatformNetworkManagerStub::IsReadyToPlayOrIdle() { return true; }
|
bool IPlatformNetworkStub::IsReadyToPlayOrIdle() { return true; }
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#include "Minecraft.Client/include/SkinBox.h"
|
#include "Minecraft.Client/include/SkinBox.h"
|
||||||
#include "Minecraft.Client/include/XboxStubs.h"
|
#include "Minecraft.Client/include/XboxStubs.h"
|
||||||
#include "NetworkPlayerInterface.h"
|
#include "NetworkPlayerInterface.h"
|
||||||
#include "PlatformNetworkManagerInterface.h"
|
#include "platform/IPlatformNetwork.h"
|
||||||
#include "SessionInfo.h"
|
#include "SessionInfo.h"
|
||||||
#include "console_helpers/C4JThread.h"
|
#include "console_helpers/C4JThread.h"
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ class C4JThread;
|
||||||
class CGameNetworkManager;
|
class CGameNetworkManager;
|
||||||
class INetworkPlayer;
|
class INetworkPlayer;
|
||||||
|
|
||||||
class CPlatformNetworkManagerStub : public CPlatformNetworkManager {
|
class IPlatformNetworkStub : public IPlatformNetwork {
|
||||||
friend class CGameNetworkManager;
|
friend class CGameNetworkManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "Minecraft.Client/Common/src/BuildVer/BuildVer.h"
|
#include "Minecraft.Client/Common/src/BuildVer/BuildVer.h"
|
||||||
#include "Minecraft.Client/Common/src/Network/PlatformNetworkManagerInterface.h"
|
#include "platform/IPlatformNetwork.h"
|
||||||
#include "Minecraft.Client/Linux/Linux_App.h"
|
#include "Minecraft.Client/Linux/Linux_App.h"
|
||||||
#include "Minecraft.Client/Linux/Stubs/winapi_stubs.h"
|
#include "Minecraft.Client/Linux/Stubs/winapi_stubs.h"
|
||||||
#include "PacketListener.h"
|
#include "PacketListener.h"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#include "Minecraft.Client/Common/App_enums.h"
|
#include "Minecraft.Client/Common/App_enums.h"
|
||||||
#include "Minecraft.Client/Common/src/BuildVer/BuildVer.h"
|
#include "Minecraft.Client/Common/src/BuildVer/BuildVer.h"
|
||||||
#include "Minecraft.Client/Common/src/Network/NetworkPlayerInterface.h"
|
#include "Minecraft.Client/Common/src/Network/NetworkPlayerInterface.h"
|
||||||
#include "Minecraft.Client/Common/src/Network/PlatformNetworkManagerInterface.h"
|
#include "platform/IPlatformNetwork.h"
|
||||||
#include "Minecraft.Client/Linux/Linux_App.h"
|
#include "Minecraft.Client/Linux/Linux_App.h"
|
||||||
#include "Minecraft.Client/Linux/Stubs/winapi_stubs.h"
|
#include "Minecraft.Client/Linux/Stubs/winapi_stubs.h"
|
||||||
#include "Minecraft.Client/include/NetTypes.h"
|
#include "Minecraft.Client/include/NetTypes.h"
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,26 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "../4J.Common/4J_Compat.h"
|
#include "../4J.Common/4J_Compat.h"
|
||||||
|
#include "Minecraft.Client/include/NetTypes.h"
|
||||||
|
|
||||||
|
#ifndef VER_NETWORK
|
||||||
|
#define VER_NETWORK 560
|
||||||
|
#endif
|
||||||
|
#define MINECRAFT_NET_VERSION VER_NETWORK
|
||||||
|
|
||||||
class INetworkPlayer;
|
class INetworkPlayer;
|
||||||
class ClientConnection;
|
|
||||||
class Minecraft;
|
|
||||||
class CGameNetworkManager;
|
class CGameNetworkManager;
|
||||||
struct FriendSessionInfo;
|
struct FriendSessionInfo;
|
||||||
using SessionID = uint64_t;
|
|
||||||
|
|
||||||
|
struct SearchForGamesData {
|
||||||
|
unsigned int sessionIDCount;
|
||||||
|
XSESSION_SEARCHRESULT_HEADER* searchBuffer;
|
||||||
|
XNQOS** ppQos;
|
||||||
|
SessionID* sessionIDList;
|
||||||
|
XOVERLAPPED* pOverlapped;
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: migrate C-style callbacks to std::function or std::function_ref (C++26).
|
||||||
class IPlatformNetwork {
|
class IPlatformNetwork {
|
||||||
public:
|
public:
|
||||||
enum eJoinFailedReason {
|
enum eJoinFailedReason {
|
||||||
|
|
@ -23,69 +35,112 @@ public:
|
||||||
|
|
||||||
virtual ~IPlatformNetwork() = default;
|
virtual ~IPlatformNetwork() = default;
|
||||||
|
|
||||||
|
// Lifecycle
|
||||||
virtual bool Initialise(CGameNetworkManager* pGameNetworkManager,
|
virtual bool Initialise(CGameNetworkManager* pGameNetworkManager,
|
||||||
int flagIndexSize) = 0;
|
int flagIndexSize) = 0;
|
||||||
virtual void Terminate() = 0;
|
virtual void Terminate() = 0;
|
||||||
virtual void DoWork() = 0;
|
virtual void DoWork() = 0;
|
||||||
|
[[nodiscard]] virtual int GetJoiningReadyPercentage() = 0;
|
||||||
|
[[nodiscard]] virtual int CorrectErrorIDS(int IDS) = 0;
|
||||||
|
|
||||||
// Players
|
// Players
|
||||||
virtual int GetPlayerCount() = 0;
|
[[nodiscard]] virtual int GetPlayerCount() = 0;
|
||||||
virtual int GetOnlinePlayerCount() = 0;
|
[[nodiscard]] virtual int GetOnlinePlayerCount() = 0;
|
||||||
virtual int GetLocalPlayerMask(int playerIndex) = 0;
|
[[nodiscard]] virtual int GetLocalPlayerMask(int playerIndex) = 0;
|
||||||
virtual bool AddLocalPlayerByUserIndex(int userIndex) = 0;
|
virtual bool AddLocalPlayerByUserIndex(int userIndex) = 0;
|
||||||
virtual bool RemoveLocalPlayerByUserIndex(int userIndex) = 0;
|
virtual bool RemoveLocalPlayerByUserIndex(int userIndex) = 0;
|
||||||
virtual INetworkPlayer* GetLocalPlayerByUserIndex(int userIndex) = 0;
|
[[nodiscard]] virtual INetworkPlayer* GetLocalPlayerByUserIndex(
|
||||||
virtual INetworkPlayer* GetPlayerByIndex(int playerIndex) = 0;
|
int userIndex) = 0;
|
||||||
virtual INetworkPlayer* GetPlayerByXuid(PlayerUID xuid) = 0;
|
[[nodiscard]] virtual INetworkPlayer* GetPlayerByIndex(
|
||||||
virtual INetworkPlayer* GetPlayerBySmallId(unsigned char smallId) = 0;
|
int playerIndex) = 0;
|
||||||
virtual INetworkPlayer* GetHostPlayer() = 0;
|
[[nodiscard]] virtual INetworkPlayer* GetPlayerByXuid(PlayerUID xuid) = 0;
|
||||||
virtual bool ShouldMessageForFullSession() = 0;
|
[[nodiscard]] virtual INetworkPlayer* GetPlayerBySmallId(
|
||||||
|
unsigned char smallId) = 0;
|
||||||
|
[[nodiscard]] virtual INetworkPlayer* GetHostPlayer() = 0;
|
||||||
|
[[nodiscard]] virtual bool ShouldMessageForFullSession() = 0;
|
||||||
|
|
||||||
// Session
|
// Session state
|
||||||
virtual bool IsHost() = 0;
|
[[nodiscard]] virtual bool IsHost() = 0;
|
||||||
virtual bool IsInSession() = 0;
|
virtual bool JoinGameFromInviteInfo(int userIndex, int userMask,
|
||||||
virtual bool IsInGameplay() = 0;
|
const INVITE_INFO* pInviteInfo) = 0;
|
||||||
virtual bool IsReadyToPlayOrIdle() = 0;
|
virtual bool LeaveGame(bool bMigrateHost) = 0;
|
||||||
virtual bool IsInStatsEnabledSession() = 0;
|
[[nodiscard]] virtual bool IsInSession() = 0;
|
||||||
virtual bool SessionHasSpace(unsigned int spaceRequired = 1) = 0;
|
[[nodiscard]] virtual bool IsInGameplay() = 0;
|
||||||
virtual bool IsAddingPlayer() = 0;
|
[[nodiscard]] virtual bool IsReadyToPlayOrIdle() = 0;
|
||||||
virtual bool IsLocalGame() = 0;
|
[[nodiscard]] virtual bool IsInStatsEnabledSession() = 0;
|
||||||
virtual void SetLocalGame(bool isLocal) = 0;
|
[[nodiscard]] virtual bool SessionHasSpace(
|
||||||
virtual bool IsPrivateGame() = 0;
|
unsigned int spaceRequired = 1) = 0;
|
||||||
virtual void SetPrivateGame(bool isPrivate) = 0;
|
virtual void SendInviteGUI(int quadrant) = 0;
|
||||||
virtual bool IsLeavingGame() = 0;
|
[[nodiscard]] virtual bool IsAddingPlayer() = 0;
|
||||||
virtual void ResetLeavingGame() = 0;
|
|
||||||
|
|
||||||
// Hosting / joining
|
// Hosting / joining
|
||||||
virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate,
|
virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate,
|
||||||
unsigned char publicSlots,
|
unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS,
|
||||||
unsigned char privateSlots) = 0;
|
unsigned char privateSlots = 0) = 0;
|
||||||
virtual int JoinGame(FriendSessionInfo* searchResult, int dwLocalUsersMask,
|
virtual int JoinGame(FriendSessionInfo* searchResult, int dwLocalUsersMask,
|
||||||
int dwPrimaryUserIndex) = 0;
|
int dwPrimaryUserIndex) = 0;
|
||||||
virtual void CancelJoinGame() {}
|
virtual void CancelJoinGame() {}
|
||||||
virtual bool LeaveGame(bool bMigrateHost) = 0;
|
virtual bool SetLocalGame(bool isLocal) = 0;
|
||||||
virtual void SendInviteGUI(int quadrant) = 0;
|
[[nodiscard]] virtual bool IsLocalGame() = 0;
|
||||||
virtual int GetJoiningReadyPercentage() = 0;
|
virtual void SetPrivateGame(bool isPrivate) = 0;
|
||||||
|
[[nodiscard]] virtual bool IsPrivateGame() = 0;
|
||||||
|
[[nodiscard]] virtual bool IsLeavingGame() = 0;
|
||||||
|
virtual void ResetLeavingGame() = 0;
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
virtual void RegisterPlayerChangedCallback(
|
virtual void RegisterPlayerChangedCallback(
|
||||||
int iPad, void (*callback)(void*, INetworkPlayer*, bool),
|
int iPad,
|
||||||
|
void (*callback)(void* callbackParam, INetworkPlayer* pPlayer,
|
||||||
|
bool leaving),
|
||||||
void* callbackParam) = 0;
|
void* callbackParam) = 0;
|
||||||
virtual void UnRegisterPlayerChangedCallback(
|
virtual void UnRegisterPlayerChangedCallback(
|
||||||
int iPad, void (*callback)(void*, INetworkPlayer*, bool),
|
int iPad,
|
||||||
|
void (*callback)(void* callbackParam, INetworkPlayer* pPlayer,
|
||||||
|
bool leaving),
|
||||||
void* callbackParam) = 0;
|
void* callbackParam) = 0;
|
||||||
|
|
||||||
virtual void HandleSignInChange() = 0;
|
virtual void HandleSignInChange() = 0;
|
||||||
|
|
||||||
|
// Game loop
|
||||||
|
virtual bool _RunNetworkGame() = 0;
|
||||||
|
virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom) = 0;
|
||||||
|
virtual void _HostGame(
|
||||||
|
int usersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS,
|
||||||
|
unsigned char privateSlots = 0) = 0;
|
||||||
|
virtual bool _StartGame() = 0;
|
||||||
|
|
||||||
|
// Session data
|
||||||
|
virtual void UpdateAndSetGameSessionData(
|
||||||
|
INetworkPlayer* pNetworkPlayerLeaving = nullptr) = 0;
|
||||||
|
virtual bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer) = 0;
|
||||||
|
|
||||||
|
// System flags
|
||||||
|
virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index) = 0;
|
||||||
|
[[nodiscard]] virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer,
|
||||||
|
int index) = 0;
|
||||||
|
|
||||||
// Stats
|
// Stats
|
||||||
virtual std::wstring GatherStats() = 0;
|
[[nodiscard]] virtual std::wstring GatherStats() = 0;
|
||||||
virtual std::wstring GatherRTTStats() = 0;
|
[[nodiscard]] virtual std::wstring GatherRTTStats() = 0;
|
||||||
|
|
||||||
|
// Session internals
|
||||||
|
virtual void SetSessionTexturePackParentId(int id) = 0;
|
||||||
|
virtual void SetSessionSubTexturePackId(int id) = 0;
|
||||||
|
virtual void Notify(int ID, uintptr_t Param) = 0;
|
||||||
|
|
||||||
// Session list
|
// Session list
|
||||||
virtual std::vector<FriendSessionInfo*>* GetSessionList(int iPad,
|
[[nodiscard]] virtual std::vector<FriendSessionInfo*>* GetSessionList(
|
||||||
int localPlayers,
|
int iPad, int localPlayers, bool partyOnly) = 0;
|
||||||
bool partyOnly) = 0;
|
[[nodiscard]] virtual bool GetGameSessionInfo(
|
||||||
|
int iPad, SessionID sessionId, FriendSessionInfo* foundSession) = 0;
|
||||||
virtual void SetSessionsUpdatedCallback(
|
virtual void SetSessionsUpdatedCallback(
|
||||||
void (*SessionsUpdatedCallback)(void*), void* pSearchParam) = 0;
|
void (*SessionsUpdatedCallback)(void* pParam),
|
||||||
|
void* pSearchParam) = 0;
|
||||||
|
virtual void GetFullFriendSessionInfo(
|
||||||
|
FriendSessionInfo* foundSession,
|
||||||
|
void (*FriendSessionUpdatedFn)(bool success, void* pParam),
|
||||||
|
void* pParam) = 0;
|
||||||
virtual void ForceFriendsSessionRefresh() = 0;
|
virtual void ForceFriendsSessionRefresh() = 0;
|
||||||
|
|
||||||
|
virtual void FakeLocalPlayerJoined() {}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue