Correct packet sending.
This commit is contained in:
parent
77be8fb151
commit
0a68ff2dff
@ -89,7 +89,7 @@ namespace Components
|
||||
|
||||
void Network::Send(Game::netsrc_t type, Address target, std::string data)
|
||||
{
|
||||
Game::OOBPrintT(type, *target.Get(), data.data());
|
||||
Game::NET_OutOfBandPrint(type, *target.Get(), data.data());
|
||||
}
|
||||
|
||||
void Network::Send(Address target, std::string data)
|
||||
@ -106,7 +106,9 @@ namespace Components
|
||||
rawData.append(data.begin(), data.end());
|
||||
rawData.append("\0", 1);
|
||||
|
||||
Game::OOBPrintRaw(type, *target.Get(), rawData.data(), rawData.size());
|
||||
// NET_OutOfBandData doesn't seem to work properly
|
||||
//Game::NET_OutOfBandData(type, *target.Get(), data.data(), data.size());
|
||||
Game::Sys_SendPacket(type, rawData.size(), rawData.data(), *target.Get());
|
||||
}
|
||||
|
||||
void Network::SendRaw(Address target, std::string data)
|
||||
@ -214,6 +216,8 @@ namespace Components
|
||||
|
||||
Network::Network()
|
||||
{
|
||||
Assert_Size(Game::netadr_t, 20);
|
||||
|
||||
// maximum size in NET_OutOfBandPrint
|
||||
Utils::Hook::Set<DWORD>(0x4AEF08, 0x1FFFC);
|
||||
Utils::Hook::Set<DWORD>(0x4AEFA3, 0x1FFFC);
|
||||
|
@ -88,6 +88,8 @@ namespace Game
|
||||
NET_CompareAdr_t NET_CompareAdr = (NET_CompareAdr_t)0x4D0AA0;
|
||||
NET_IsLocalAddress_t NET_IsLocalAddress = (NET_IsLocalAddress_t)0x402BD0;
|
||||
NET_StringToAdr_t NET_StringToAdr = (NET_StringToAdr_t)0x409010;
|
||||
NET_OutOfBandPrint_t NET_OutOfBandPrint = (NET_OutOfBandPrint_t)0x4AEF00;
|
||||
NET_OutOfBandData_t NET_OutOfBandData = (NET_OutOfBandData_t)0x49C7E0;
|
||||
|
||||
Live_MPAcceptInvite_t Live_MPAcceptInvite = (Live_MPAcceptInvite_t)0x420A6D;
|
||||
Live_ParsePlaylists_t Live_ParsePlaylists = (Live_ParsePlaylists_t)0x4295A0;
|
||||
@ -98,9 +100,6 @@ namespace Game
|
||||
LocalizeString_t LocalizeString = (LocalizeString_t)0x4FB010;
|
||||
LocalizeMapString_t LocalizeMapString = (LocalizeMapString_t)0x44BB30;
|
||||
|
||||
sendOOB_t OOBPrint = (sendOOB_t)0x4AEF00;
|
||||
sendOOBRaw_t OOBPrintRawData = (sendOOBRaw_t)0x60FDC0;
|
||||
|
||||
SE_Load_t SE_Load = (SE_Load_t)0x502A30;
|
||||
|
||||
PC_ReadToken_t PC_ReadToken = (PC_ReadToken_t)0x4ACCD0;
|
||||
@ -132,6 +131,7 @@ namespace Game
|
||||
SV_GameClientNum_Score_t SV_GameClientNum_Score = (SV_GameClientNum_Score_t)0x469AC0;
|
||||
|
||||
Sys_IsMainThread_t Sys_IsMainThread = (Sys_IsMainThread_t)0x4C37D0;
|
||||
Sys_SendPacket_t Sys_SendPacket = (Sys_SendPacket_t)0x60FDC0;
|
||||
|
||||
UI_AddMenuList_t UI_AddMenuList = (UI_AddMenuList_t)0x4533C0;
|
||||
UI_LoadMenus_t UI_LoadMenus = (UI_LoadMenus_t)0x641460;
|
||||
@ -205,20 +205,6 @@ namespace Game
|
||||
return value;
|
||||
}
|
||||
|
||||
void OOBPrintT(int type, netadr_t netadr, const char* message)
|
||||
{
|
||||
int* adr = reinterpret_cast<int*>(&netadr);
|
||||
|
||||
OOBPrint(type, adr[0], adr[1], adr[2], 0xFFFFFFFF, adr[4], message);
|
||||
}
|
||||
|
||||
void OOBPrintRaw(int type, netadr_t netadr, const char* message, size_t length)
|
||||
{
|
||||
int* adr = reinterpret_cast<int*>(&netadr);
|
||||
|
||||
OOBPrintRawData(type, length, message, adr[0], adr[1], adr[2], 0xFFFFFFFF, adr[4]);
|
||||
}
|
||||
|
||||
const char* UI_LocalizeMapName(const char* mapName)
|
||||
{
|
||||
for (int i = 0; i < *arenaCount; i++)
|
||||
|
@ -212,6 +212,12 @@ namespace Game
|
||||
typedef bool(__cdecl * NET_StringToAdr_t)(const char*, netadr_t*);
|
||||
extern NET_StringToAdr_t NET_StringToAdr;
|
||||
|
||||
typedef void(__cdecl* NET_OutOfBandPrint_t)(netsrc_t sock, netadr_t adr, const char *data);
|
||||
extern NET_OutOfBandPrint_t NET_OutOfBandPrint;
|
||||
|
||||
typedef void(__cdecl* NET_OutOfBandData_t)(netsrc_t sock, netadr_t adr, const char *format, int len);
|
||||
extern NET_OutOfBandData_t NET_OutOfBandData;
|
||||
|
||||
typedef void(__cdecl * Live_MPAcceptInvite_t)(_XSESSION_INFO *hostInfo, const int controllerIndex, bool fromGameInvite);
|
||||
extern Live_MPAcceptInvite_t Live_MPAcceptInvite;
|
||||
|
||||
@ -230,12 +236,6 @@ namespace Game
|
||||
typedef char* (__cdecl * LocalizeMapString_t)(char*);
|
||||
extern LocalizeMapString_t LocalizeMapString;
|
||||
|
||||
typedef void(__cdecl* sendOOB_t)(int, int, int, int, int, int, const char*);
|
||||
extern sendOOB_t OOBPrint;
|
||||
|
||||
typedef void(__cdecl* sendOOBRaw_t)(int, size_t, const char*, int, int, int, int, int);
|
||||
extern sendOOBRaw_t OOBPrintRawData;
|
||||
|
||||
typedef char* (__cdecl * SE_Load_t)(char* file, int Unk);
|
||||
extern SE_Load_t SE_Load;
|
||||
|
||||
@ -302,6 +302,9 @@ namespace Game
|
||||
typedef bool(__cdecl * Sys_IsMainThread_t)();
|
||||
extern Sys_IsMainThread_t Sys_IsMainThread;
|
||||
|
||||
typedef bool(__cdecl * Sys_SendPacket_t)(netsrc_t sock, size_t len, const char *format, netadr_t adr);
|
||||
extern Sys_SendPacket_t Sys_SendPacket;
|
||||
|
||||
typedef void(__cdecl * UI_AddMenuList_t)(UiContext *dc, MenuList *menuList, int close);
|
||||
extern UI_AddMenuList_t UI_AddMenuList;
|
||||
|
||||
@ -353,8 +356,6 @@ namespace Game
|
||||
|
||||
void* ReallocateAssetPool(XAssetType type, unsigned int newSize);
|
||||
void Menu_FreeItemMemory(Game::itemDef_t* item);
|
||||
void OOBPrintT(int type, netadr_t netadr, const char* message);
|
||||
void OOBPrintRaw(int type, netadr_t netadr, const char* message, size_t length);
|
||||
const char* TabeLookup(StringTable* stringtable, int row, int column);
|
||||
const char* UI_LocalizeMapName(const char* mapName);
|
||||
const char* UI_LocalizeGameType(const char* gameType);
|
||||
|
@ -822,8 +822,8 @@ namespace Game
|
||||
{
|
||||
netadrtype_t type;
|
||||
netIP_t ip;
|
||||
unsigned short port;
|
||||
unsigned char ipx[10];
|
||||
unsigned short port;
|
||||
unsigned char ipx[8];
|
||||
} netadr_t;
|
||||
|
||||
typedef struct
|
||||
|
Loading…
Reference in New Issue
Block a user