[bot] Update CNetGame::Init()

This commit is contained in:
RD42 2023-11-18 00:00:52 +08:00
parent efae836897
commit e661820274
6 changed files with 86 additions and 57 deletions

View File

@ -25,6 +25,11 @@ typedef struct _GAME_SETTINGS {
#include <stdio.h>
#include <stdlib.h>
#include "scrtimers.h"
#include "npcmode.h"
#include "net/playerpool.h"
#include "net/vehiclepool.h"
#include "net/netgame.h"
void logprintf(char* format, ...);

View File

@ -1,6 +1,16 @@
#include "../main.h"
char unnamed_2[63];
char unnamed_5[1000][24];
int unnamed_6[1000];
char unnamed_9;
char unnamed_1[68];
char unnamed_3[1000][68];
char unnamed_8[1000];
int unnamed_7[2000];
char unnamed_4[1000][63];
//----------------------------------------------------
CNetGame::CNetGame()
@ -62,27 +72,25 @@ CNetGame::~CNetGame()
//----------------------------------------------------
void CNetGame::Init(char *a2, int a3, char *a4, char *a5, char *a6)
void CNetGame::Init(PCHAR szHostOrIp, int iPort,
PCHAR szPlayerName, PCHAR szPass,
PCHAR szNpcMode)
{
strcpy(m_szHostName, "San Andreas Multiplayer");
strncpy(m_szHostOrIp, szHostOrIp, sizeof(m_szHostOrIp));
m_iPort = iPort;
m_pNPCMode = new CNPCMode();
m_pScriptTimers = new CScriptTimers();
// Setup player pool
m_pPlayerPool = new CPlayerPool();
m_pPlayerPool->SetLocalPlayerName(szPlayerName);
m_pVehiclePool = new CVehiclePool();
// TODO: CNetGame::Init (W: 00416490 L: 080AD126)
/*
strcpy(this->field_202, "San Andreas Multiplayer");
strncpy(this->field_302, src, 0x80u);
this->field_382 = a3;
v6 = (void *)operator new(0x6Eu);
sub_80A940C(v6);
this->field_386 = (int)v6;
v7 = (void *)operator new(0x19u);
sub_80B8036(v7);
this->field_38A = (int)v7;
v8 = (void *)operator new(0xA04Bu);
sub_80B1F4E(v8);
this->field_4 = (int)v8;
sub_80AFBA2(this->field_4, a4);
v9 = (void *)operator new(0x1BD50u);
sub_80B9408(v9);
this->field_8 = (int)v9;
this->field_0 = sub_8070E80();
sub_8094DD0((unsigned __int16)a3);
sub_80B1714(this->field_0);
@ -97,38 +105,37 @@ void CNetGame::Init(char *a2, int a3, char *a4, char *a5, char *a6)
(unsigned __int16)a3,
0,
0,
10);
this->field_C = 1;
this->field_14 = 0;
this->field_1E = 12;
this->field_1F = 0;
this->field_20 = 10;
this->field_34 = 1006834287;
this->field_38 = 0;
this->field_10 = 0;
this->field_3C = 1;
this->field_40 = 0;
for ( i = 0; i <= 99; ++i )
this->field_4A[i] = 0;
this->field_31 = 1;
this->field_3E = 0;
this->field_3D = 0;
memset(&word_80E1600, 0, 0x44u);
memset(&word_80E1660, 0, 0x3Fu);
memset(&word_80E16C0, 0, 0x109A0u);
memset(&word_80F2060, 0, 0xF618u);
memset(&word_8101680, 0, 0x5DC0u);
memset(&dword_8107440, 0, 0xFA0u);
memset(&dword_81083E0, 0, 0x1F40u);
memset(&byte_810A320, 0, 0x3E8u);
this->field_1DE = 0;
this->field_1E2 = 0;
this->field_1F2 = sub_80AC0BE();
byte_80E16B7 = 0;
this->field_1FA = -1;
this->field_1FE = -1;
10);*/
m_iGameState = 1;
field_14 = 0;
field_1E = 12;
field_1F = 0;
field_20 = 10;
field_34 = 1006834287;
field_38 = 0;
field_10 = 0;
field_3C = 1;
field_40 = 0;
for (int i = 0; i < 100; ++i )
field_4A[i] = 0;
field_31 = 1;
field_3E = 0;
field_3D = 0;
memset(unnamed_1,0,sizeof(unnamed_1));
memset(unnamed_2,0,sizeof(unnamed_2));
memset(unnamed_3,0,sizeof(unnamed_3));
memset(unnamed_4,0,sizeof(unnamed_4));
memset(unnamed_5,0,sizeof(unnamed_5));
memset(unnamed_6,0,sizeof(unnamed_6));
memset(unnamed_7,0,sizeof(unnamed_7));
memset(unnamed_8,0,sizeof(unnamed_8));
field_1DE = 0;
field_1E2 = 0;
field_1F2 = sub_80AC0BE();
unnamed_9 = 0;
field_1FA = -1;
field_1FE = -1;
srand(0);
*/
}
//----------------------------------------------------

View File

@ -7,9 +7,9 @@ class CNetGame // size: 910 bytes
{
private:
int field_0; // highly m_pRakClient
int field_4;
int field_8;
int field_C;
CPlayerPool* m_pPlayerPool;
CVehiclePool* m_pVehiclePool;
int m_iGameState;
int field_10;
int field_14;
char _gap18[6];
@ -36,18 +36,20 @@ private:
char _gap1F6[4];
int field_1FA;
int field_1FE;
char field_202[256];
char field_302[128];
int field_382;
int field_386;
int field_38A;
char m_szHostName[256];
char m_szHostOrIp[128];
int m_iPort;
CNPCMode* m_pNPCMode;
CScriptTimers* m_pScriptTimers;
public:
CNetGame();
~CNetGame();
void Init(char *a2, int a3, char *a4, char *a5, char *a6);
void Init(PCHAR szHostOrIp,int iPort,PCHAR szPlayerName,PCHAR szPass,PCHAR szNpcMode);
void Process();
};

View File

@ -3,6 +3,8 @@ class CPlayerPool // size: 41035
{
private:
int field_0[1000];
//char _gapFA0[2];
//char field_FA2[25];
char _gapFA0[25027];
int field_7163;
int field_7167[1000];
@ -11,5 +13,8 @@ private:
char gap90AB[4000];
public:
void SetLocalPlayerName(PCHAR szName) {}; // TODO: CPlayerPool::SetLocalPlayerName
CPlayerPool();
};

View File

@ -2,9 +2,17 @@
#include "RakNetworkFactory.h"
#include "RakServerInterface.h"
#include "RakServer.h"
#include "RakPeerInterface.h"
#include "RakPeer.h"
RakServerInterface* RakNetworkFactory::GetRakServerInterface( void )
{
return new RakServer;
}
RakPeerInterface* RakNetworkFactory::GetRakPeerInterface( void )
{
return new RakPeer;
}

View File

@ -7,12 +7,14 @@
#include "Export.h"
class RakServerInterface;
class RakPeerInterface;
class RAK_DLL_EXPORT RakNetworkFactory
{
public:
static RakServerInterface* GetRakServerInterface( void );
static RakPeerInterface* GetRakPeerInterface( void );
};