the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2using namespace std;
3#include <vector>
4#include <qnet.h>
5#include "..\..\..\Minecraft.World\C4JThread.h"
6#include "NetworkPlayerInterface.h"
7#include "SessionInfo.h"
8
9class ClientConnection;
10class Minecraft;
11class CGameNetworkManager;
12
13// This is the interface to be implemented by the platform-specific versions of the PlatformNetworkManagers. This API is used directly by GameNetworkManager so that
14// it can remain as platform independent as possible.
15
16// This value should be incremented if the server version changes, or the game session data changes
17#define MINECRAFT_NET_VERSION VER_NETWORK
18
19
20typedef struct _SearchForGamesData
21{
22 DWORD sessionIDCount;
23 XSESSION_SEARCHRESULT_HEADER *searchBuffer;
24 XNQOS **ppQos;
25 SessionID *sessionIDList;
26 XOVERLAPPED *pOverlapped;
27} SearchForGamesData;
28
29class CPlatformNetworkManager
30{
31 friend class CGameNetworkManager;
32public:
33
34 typedef enum
35 {
36 JOIN_FAILED_SERVER_FULL,
37 JOIN_FAILED_INSUFFICIENT_PRIVILEGES,
38 JOIN_FAILED_NONSPECIFIC,
39 } eJoinFailedReason;
40
41 virtual bool Initialise(CGameNetworkManager *pGameNetworkManager, int flagIndexSize) = 0;
42 virtual void Terminate() = 0;
43 virtual int GetJoiningReadyPercentage() = 0;
44 virtual int CorrectErrorIDS(int IDS) = 0;
45
46 virtual void DoWork() = 0;
47 virtual int GetPlayerCount() = 0;
48 virtual int GetOnlinePlayerCount() = 0;
49 virtual int GetLocalPlayerMask(int playerIndex) = 0;
50 virtual bool AddLocalPlayerByUserIndex( int userIndex ) = 0;
51 virtual bool RemoveLocalPlayerByUserIndex( int userIndex ) = 0;
52 virtual INetworkPlayer *GetLocalPlayerByUserIndex( int userIndex ) = 0;
53 virtual INetworkPlayer *GetPlayerByIndex(int playerIndex) = 0;
54 virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid) = 0;
55 virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId) = 0;
56 virtual bool ShouldMessageForFullSession() = 0;
57
58 virtual INetworkPlayer *GetHostPlayer() = 0;
59 virtual bool IsHost() = 0;
60 virtual bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo) = 0;
61 virtual bool LeaveGame(bool bMigrateHost) = 0;
62
63 virtual bool IsInSession() = 0;
64 virtual bool IsInGameplay() = 0;
65 virtual bool IsReadyToPlayOrIdle() = 0;
66 virtual bool IsInStatsEnabledSession() = 0;
67 virtual bool SessionHasSpace(unsigned int spaceRequired = 1) = 0;
68 virtual void SendInviteGUI(int quadrant) = 0;
69 virtual bool IsAddingPlayer() = 0;
70
71 virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0) = 0;
72 virtual int JoinGame(FriendSessionInfo *searchResult, int dwLocalUsersMask, int dwPrimaryUserIndex ) = 0;
73 virtual void CancelJoinGame() {};
74 virtual bool SetLocalGame(bool isLocal) = 0;
75 virtual bool IsLocalGame() = 0;
76 virtual void SetPrivateGame(bool isPrivate) = 0;
77 virtual bool IsPrivateGame() = 0;
78 virtual bool IsLeavingGame() = 0;
79 virtual void ResetLeavingGame() = 0;
80
81 virtual void RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam) = 0;
82 virtual void UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam) = 0;
83
84 virtual void HandleSignInChange() = 0;
85
86 virtual bool _RunNetworkGame() = 0;
87 virtual void SetGamePlayState() {}
88
89private:
90 virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom) = 0;
91 virtual void _HostGame(int usersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0) = 0;
92 virtual bool _StartGame() = 0;
93
94
95public:
96 virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL) = 0;
97
98private:
99 virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ) = 0;
100
101public:
102 virtual void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) = 0;
103 virtual bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) = 0;
104
105 virtual wstring GatherStats() = 0;
106 virtual wstring GatherRTTStats() = 0;
107
108private:
109 virtual void SetSessionTexturePackParentId( int id ) = 0;
110 virtual void SetSessionSubTexturePackId( int id ) = 0;
111 virtual void Notify(int ID, ULONG_PTR Param) = 0;
112
113public:
114 virtual vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly) = 0;
115 virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession) = 0;
116 virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ) = 0;
117 virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ) = 0;
118 virtual void ForceFriendsSessionRefresh() = 0;
119
120#ifndef _XBOX
121 virtual void FakeLocalPlayerJoined() {}; // Temporary method whilst we don't have real networking to make this happen
122#endif
123
124#ifdef _DURANGO
125 virtual wstring GetDisplayNameByGamertag(wstring gamertag) = 0;
126#endif
127};