1
0
mirror of https://github.com/jummy0/sb2-decomp synced 2025-03-21 23:22:11 +01:00
sb2-decomp/network.h

99 lines
2.4 KiB
C
Raw Normal View History

2024-06-24 15:46:58 -04:00
#include "dplay.h"
2024-07-02 15:32:32 -04:00
typedef struct NetSessionList
2024-06-24 15:46:58 -04:00
{
int nbSessions;
DPSESSIONDESC sessions[100];
}
NetSessionList;
2024-07-31 10:39:50 -04:00
typedef struct NetSession
{
int index;
LPGUID lpID;
DPSESSIONDESC2 desc;
}
NetSession;
typedef struct NetSession2
{
int index;
LPGUID lpID;
DPSESSIONDESC2 desc;
}
NetSession2;
2024-06-24 15:46:58 -04:00
typedef struct
{
2024-07-31 10:39:50 -04:00
BYTE bIsPresent;
BYTE ready;
BYTE unk_2;
BYTE unk_3;
BYTE ip[4];
2024-06-24 15:46:58 -04:00
short team;
char name[22];
}
NetPlayer;
typedef struct
{
2024-07-31 10:39:50 -04:00
BYTE type;
BYTE a;
2024-06-24 15:46:58 -04:00
short x;
short y;
short channel;
}
NetEvent;
typedef struct
{
2024-07-31 10:39:50 -04:00
BYTE type;
2024-06-24 15:46:58 -04:00
int packetsSent;
short x;
short y;
NetEvent event[5];
};
class CNetwork
{
public:
CNetwork();
~CNetwork();
2024-07-27 10:48:12 -04:00
BOOL Create(int index);
2024-07-31 10:39:50 -04:00
void FreeSessionList3Unused();
2024-07-02 11:52:36 -04:00
BOOL IsSessionFree();
2024-07-02 15:32:32 -04:00
LPVOID GetContext();
BOOL AllocateSessionList2();
2024-07-31 10:39:50 -04:00
BOOL EnumSessions1();
BOOL EnumSessions2();
DPSESSIONDESC* GetSessionDesc1(int index);
DPSESSIONDESC2* GetSessionDesc2(int index);
BOOL JoinSession(int index);
2024-07-29 17:44:22 -04:00
BOOL EnumSessionsCallback(LPDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, NetSessionList* lpContext);
2024-07-02 11:52:36 -04:00
void FreeCurrentSession();
2024-07-31 10:39:50 -04:00
void FreeSessionList1();
BOOL EnumSessionsCallback2(LPDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, NetSession2* lpContext); void FreeSessionList2();
2024-06-24 15:46:58 -04:00
void FreeField18();
2024-07-04 12:23:47 -04:00
BOOL Send(LPVOID lpData, DWORD lpdwDataSize, int dwFlags);
2024-07-29 17:44:22 -04:00
BOOL Recieve(void* pDest, int dataSize, int* pPlayer);
BOOL Close();
BOOL IsHost();
2024-07-31 10:39:50 -04:00
BOOL EnumSessionsCallback1(LPGUID lpguidSP, LPSTR lpSTName, DWORD dwMajorVersion, DWORD dwMinorVersion, NetSessionList *lpContext);
2024-07-27 10:48:12 -04:00
char GetStringFromSessionData1(int index);
2024-07-02 15:32:32 -04:00
BOOL CreateDirectPlayInterface(LPGUID lpguidServiceProvider, LPDIRECTPLAY2A* lplpDirectPlay2A);
2024-06-01 20:56:16 -04:00
protected:
2024-07-04 12:23:47 -04:00
IDirectPlay2* m_pDP;
2024-07-31 10:39:50 -04:00
int m_pContext;
int m_nbSessions1;
NetSession* m_pSessions1[100];
int m_nbSessions2;
NetSession2* m_pSessions2[100];
int m_nbSessions3Unused;
void* m_pSessions3Unused;
2024-07-27 10:48:12 -04:00
BOOL m_bHost;
DPID m_pDPID;
2024-07-02 15:32:32 -04:00
NetPlayer m_players[4];
2024-07-31 10:39:50 -04:00
int m_pContext2;
};