1
0
mirror of https://github.com/jummy0/sb2-decomp synced 2025-03-21 15:12:10 +01:00
sb2-decomp/network.h
2024-07-29 17:44:22 -04:00

76 lines
1.7 KiB
C++

#include "dplay.h"
typedef struct NetSessionList
{
int nbSessions;
DPSESSIONDESC sessions[100];
}
NetSessionList;
typedef struct
{
byte bIsPresent;
byte ready;
byte unk_2;
byte unk_3;
byte ip[4];
short team;
char name[22];
}
NetPlayer;
typedef struct
{
byte type;
byte a;
short x;
short y;
short channel;
}
NetEvent;
typedef struct
{
byte type;
int packetsSent;
short x;
short y;
NetEvent event[5];
};
class CNetwork
{
public:
CNetwork();
~CNetwork();
BOOL Create(int index);
BOOL IsSessionFree();
LPVOID GetContext();
BOOL AllocateSessionList2();
BOOL EnumSessions();
BOOL EnumSessionsCallback(LPDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, NetSessionList* lpContext);
void FreeCurrentSession();
void FreeSessionList();
void FreeSessionList2();
void FreeField18();
BOOL Send(LPVOID lpData, DWORD lpdwDataSize, int dwFlags);
BOOL Recieve(void* pDest, int dataSize, int* pPlayer);
BOOL Close();
BOOL IsHost();
BOOL EnumerateCallback(LPGUID lpguidSP, LPSTR lpSTName, DWORD dwMajorVersion, DWORD dwMinorVersion, NetSessionList *lpContext);
char GetStringFromSessionData1(int index);
BOOL CreateDirectPlayInterface(LPGUID lpguidServiceProvider, LPDIRECTPLAY2A* lplpDirectPlay2A);
protected:
IDirectPlay2* m_pDP;
LPVOID m_pContext;
NetSessionList m_pSessions;
LPVOID m_pContext2;
NetSessionList* m_pSessions2;
LPVOID m_pUnk4;
addr m_pUnk18;
BOOL m_bHost;
DPID m_pDPID;
NetPlayer m_players[4];
};