mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
Merge branch 'dashr9230:main' into main
This commit is contained in:
commit
070bc7b5b5
@ -1,6 +1,16 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
CConsole::CConsole()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CConsole::~CConsole()
|
||||
{
|
||||
ConsoleVariables.clear();
|
||||
}
|
||||
|
||||
ConsoleVariable_s* CConsole::FindVariable(char* pVarName)
|
||||
{
|
||||
char VarName[256];
|
||||
@ -176,3 +186,7 @@ void CConsole::SetBoolVariable(char* pVarName, bool bBool)
|
||||
}
|
||||
}
|
||||
|
||||
void CConsole::Execute(char* pExecLine)
|
||||
{
|
||||
// TODO: CConsole::Execute W: 0048B610 L: 0809FBD0
|
||||
}
|
||||
|
@ -21,6 +21,9 @@ class CConsole
|
||||
public:
|
||||
StringConvarMap ConsoleVariables;
|
||||
|
||||
CConsole();
|
||||
~CConsole();
|
||||
|
||||
ConsoleVariable_s* FindVariable(char* pVarName);
|
||||
|
||||
void AddVariable(char* pVarName, CON_VARTYPE VarType, DWORD VarFlags, void* VarPtr,
|
||||
@ -42,6 +45,7 @@ public:
|
||||
bool GetBoolVariable(char* pVarName);
|
||||
void SetBoolVariable(char* pVarName, bool bBool);
|
||||
|
||||
void Execute(char* pExecLine);
|
||||
};
|
||||
|
||||
#endif
|
189
server/main.cpp
189
server/main.cpp
@ -1,15 +1,85 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
CConsole *pConsole = NULL;
|
||||
CNetGame *pNetGame = NULL;
|
||||
CConsole *pConsole = NULL;
|
||||
CPlugins *pPlugins = NULL;
|
||||
|
||||
FILE *pLogFile;
|
||||
|
||||
bool bLogQueries;
|
||||
int iMaxNpc = 0;
|
||||
int iMinConnectionTime;
|
||||
int iDbLogging;
|
||||
int iDbLogQueries;
|
||||
|
||||
int unnamed_2; // W: 004F5FE8 L: 081AA8A8
|
||||
int unnamed_3; // W: 004F5FEC L: 081AA8A4
|
||||
int unnamed_4; // W: 004F5FF0 L: 081AA8A0
|
||||
|
||||
int iOnFootRate = 30;
|
||||
int iInCarRate = 30;
|
||||
int iWeaponRate = 30;
|
||||
int unnamed_1 = 2; // TODO: unnamed_1 W: 004E5888 L: 08197DDC
|
||||
float fStreamDistance = 200.0;
|
||||
int iStreamRate = 1000;
|
||||
int iSleep = 5;
|
||||
int iChatLogging = 1;
|
||||
int iMessageHoleLimit = 3000;
|
||||
int iMessagesLimit = 500;
|
||||
int iAcksLimit = 3000;
|
||||
int iPlayerTimeout = 10000;
|
||||
int iLagCompMode = 1;
|
||||
int iConnSeedTime = 300000;
|
||||
int iConnCookies = 1;
|
||||
int iCookieLogging = 1;
|
||||
|
||||
#ifdef WIN32
|
||||
extern LONG WINAPI exc_handler(_EXCEPTION_POINTERS* exc_inf);
|
||||
#endif
|
||||
|
||||
int sub_44E9D0()
|
||||
{
|
||||
// TODO: sub_44E9D0 W: 0044E9D0 L: 0805FBE0
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void ServerPasswordChanged()
|
||||
{
|
||||
// TODO: ServerPasswordChanged
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void ServerMaxPlayersChanged()
|
||||
{
|
||||
// TODO: ServerMaxPlayersChanged
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void ServerStreamRateChanged()
|
||||
{
|
||||
int stream_rate = pConsole->GetIntVariable("stream_rate");
|
||||
if (stream_rate < 500)
|
||||
pConsole->SetIntVariable("stream_rate", 500);
|
||||
if ( stream_rate > 5000)
|
||||
pConsole->SetIntVariable("stream_rate", 5000);
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void ServerStreamDistanceChanged()
|
||||
{
|
||||
float stream_distance = pConsole->GetFloatVariable("stream_distance");
|
||||
if (stream_distance < 50.0f)
|
||||
pConsole->SetFloatVariable("stream_distance", 50.0f);
|
||||
if (stream_distance > 400.0f)
|
||||
pConsole->SetFloatVariable("stream_distance", 400.0f);
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void LoadLogFile()
|
||||
@ -55,6 +125,20 @@ char* strlwr(char* str)
|
||||
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
// TODO: main
|
||||
|
||||
#ifdef LINUX
|
||||
bool bOutputEnable = false;
|
||||
#endif
|
||||
|
||||
bool bEnableAnnounce = true;
|
||||
int iMaxPlayers = DEFAULT_MAX_PLAYERS;
|
||||
int iListenPort = DEFAULT_LISTEN_PORT;
|
||||
bool bLanModeEnable = false;
|
||||
bool bEnableTimestamp = true;
|
||||
bool bGameMod = false;
|
||||
bool bAllowQuery = true;
|
||||
bool bAllowRcon = true;
|
||||
|
||||
// Open the log file
|
||||
LoadLogFile();
|
||||
@ -66,16 +150,117 @@ int main (int argc, char** argv)
|
||||
logprintf("v" SAMP_VERSION ", (C)2005-2015 SA-MP Team\n");
|
||||
|
||||
srand(time(NULL));
|
||||
unnamed_2 = rand();
|
||||
unnamed_3 = rand();
|
||||
unnamed_4 = sub_44E9D0();
|
||||
|
||||
// Create the Console
|
||||
pConsole = new CConsole();
|
||||
|
||||
pConsole->AddVariable("announce", CON_VARTYPE_BOOL, 0, &bEnableAnnounce);
|
||||
pConsole->AddVariable("maxplayers", CON_VARTYPE_INT, 0, &iMaxPlayers, ServerMaxPlayersChanged);
|
||||
pConsole->AddVariable("port", CON_VARTYPE_INT, 0, &iListenPort);
|
||||
pConsole->AddVariable("lanmode", CON_VARTYPE_BOOL, 0, &bLanModeEnable);
|
||||
pConsole->AddVariable("query", CON_VARTYPE_BOOL, 0, &bAllowQuery);
|
||||
pConsole->AddVariable("rcon", CON_VARTYPE_BOOL, 0, &bAllowRcon);
|
||||
pConsole->AddVariable("logqueries", CON_VARTYPE_BOOL, 0, &bLogQueries);
|
||||
pConsole->AddVariable("stream_rate", CON_VARTYPE_INT, 0, &iStreamRate, ServerStreamRateChanged);
|
||||
pConsole->AddVariable("stream_distance", CON_VARTYPE_FLOAT, 0, &fStreamDistance, ServerStreamDistanceChanged);
|
||||
pConsole->AddVariable("sleep", CON_VARTYPE_INT, 0, &iSleep);
|
||||
pConsole->AddVariable("maxnpc", CON_VARTYPE_INT, 0, &iMaxNpc);
|
||||
pConsole->AddVariable("onfoot_rate", CON_VARTYPE_INT, 0, &iOnFootRate);
|
||||
pConsole->AddVariable("incar_rate", CON_VARTYPE_INT, 0, &iInCarRate);
|
||||
pConsole->AddVariable("weapon_rate", CON_VARTYPE_INT, 0, &iWeaponRate);
|
||||
pConsole->AddVariable("chatlogging", CON_VARTYPE_INT, 0, &iChatLogging);
|
||||
|
||||
#ifdef LINUX
|
||||
pConsole->AddVariable("output", CON_VARTYPE_BOOL, 0, &bOutputEnable);
|
||||
#endif
|
||||
|
||||
pConsole->AddVariable("timestamp", CON_VARTYPE_BOOL, 0, &bEnableTimestamp);
|
||||
pConsole->AddStringVariable("bind", 0, NULL);
|
||||
pConsole->AddStringVariable("password", 0, NULL, ServerPasswordChanged);
|
||||
pConsole->AddStringVariable("hostname", 0, "SA-MP Server");
|
||||
pConsole->AddStringVariable("language", 0, NULL);
|
||||
pConsole->AddStringVariable("mapname", 4, "San Andreas");
|
||||
pConsole->AddStringVariable("weburl", 4, "www.sa-mp.com");
|
||||
pConsole->AddStringVariable("rcon_password", 0, "changeme");
|
||||
pConsole->AddStringVariable("gravity", 0, "0.008");
|
||||
pConsole->AddStringVariable("weather", 4, "10");
|
||||
pConsole->AddStringVariable("gamemodetext", 0, "Unknown");
|
||||
pConsole->AddStringVariable("filterscripts", 0, "");
|
||||
pConsole->AddStringVariable("plugins", 0, "");
|
||||
pConsole->AddStringVariable("nosign", 0, "");
|
||||
pConsole->AddStringVariable("logtimeformat", 0, "[%H:%M:%S]");
|
||||
pConsole->AddVariable("messageholelimit", CON_VARTYPE_INT, 0, &iMessageHoleLimit);
|
||||
pConsole->AddVariable("messageslimit", CON_VARTYPE_INT, 0, &iMessagesLimit);
|
||||
pConsole->AddVariable("ackslimit", CON_VARTYPE_INT, 0, &iAcksLimit);
|
||||
pConsole->AddVariable("playertimeout", CON_VARTYPE_INT, 0, &iPlayerTimeout);
|
||||
pConsole->AddVariable("minconnectiontime", CON_VARTYPE_INT, 0, &iMinConnectionTime);
|
||||
pConsole->AddVariable("myriad", CON_VARTYPE_BOOL, 0, &bGameMod);
|
||||
pConsole->AddVariable("lagcompmode", CON_VARTYPE_INT, 0, &iLagCompMode);
|
||||
pConsole->AddVariable("connseedtime", CON_VARTYPE_INT, 0, &iConnSeedTime);
|
||||
pConsole->AddVariable("db_logging", CON_VARTYPE_INT, 0, &iDbLogging);
|
||||
pConsole->AddVariable("db_log_queries", CON_VARTYPE_INT, 0, &iDbLogQueries);
|
||||
pConsole->AddVariable("conncookies", CON_VARTYPE_INT, 0, &iConnCookies);
|
||||
pConsole->AddVariable("cookielogging", CON_VARTYPE_INT, 0, &iCookieLogging);
|
||||
|
||||
// Add 16 gamemode variables.
|
||||
int x=0;
|
||||
char t[64];
|
||||
while(x!=16) {
|
||||
sprintf(t,"gamemode%u",x);
|
||||
pConsole->AddStringVariable(t,0,"");
|
||||
x++;
|
||||
}
|
||||
|
||||
// Exec the server config!
|
||||
pConsole->Execute("exec server");
|
||||
|
||||
if ( !memcmp(pConsole->GetStringVariable("rcon_password"), "changeme", 9 ) )
|
||||
{
|
||||
logprintf("Error: Your password must be changed from the default password, please change it.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Change some var flags to read-only (can only be accessed from server.cfg).
|
||||
pConsole->ModifyVariableFlags("maxplayers", 2);
|
||||
pConsole->ModifyVariableFlags("bind", 2);
|
||||
pConsole->ModifyVariableFlags("port", 2);
|
||||
pConsole->ModifyVariableFlags("rcon_bind", 2);
|
||||
pConsole->ModifyVariableFlags("rcon_port", 2);
|
||||
pConsole->ModifyVariableFlags("filterscripts", 2);
|
||||
pConsole->ModifyVariableFlags("plugins", 2);
|
||||
pConsole->ModifyVariableFlags("nosign", 2);
|
||||
pConsole->ModifyVariableFlags("onfoot_rate", 2);
|
||||
pConsole->ModifyVariableFlags("incar_rate", 2);
|
||||
pConsole->ModifyVariableFlags("weapon_rate", 2);
|
||||
pConsole->ModifyVariableFlags("logtimeformat", 2);
|
||||
pConsole->ModifyVariableFlags("lagcompmode", 2);
|
||||
|
||||
if(pConsole->GetIntVariable("lagcompmode") <= 0)
|
||||
pConsole->AddStringVariable("lagcomp", 6, "Off");
|
||||
else
|
||||
pConsole->AddStringVariable("lagcomp", 6, "On");
|
||||
|
||||
// Add the version as a rule
|
||||
pConsole->AddStringVariable("version", 6, SAMP_VERSION);
|
||||
|
||||
#ifdef WIN32
|
||||
// Setup the exception handler on windows
|
||||
SetUnhandledExceptionFilter(exc_handler);
|
||||
#endif
|
||||
|
||||
// TODO: main
|
||||
// Load up the plugins
|
||||
pPlugins = new CPlugins();
|
||||
pPlugins->LoadPlugins("plugins");
|
||||
|
||||
// Create the NetGame.
|
||||
pNetGame = new CNetGame();
|
||||
pNetGame->Init(true);
|
||||
|
||||
|
||||
delete pConsole;
|
||||
|
||||
fclose(pLogFile);
|
||||
|
||||
|
@ -2,6 +2,9 @@
|
||||
#ifndef SAMPSRV_MAIN_H
|
||||
#define SAMPSRV_MAIN_H
|
||||
|
||||
#define DEFAULT_MAX_PLAYERS 50
|
||||
#define DEFAULT_LISTEN_PORT 8192
|
||||
|
||||
// ------------
|
||||
// VERSION INFO
|
||||
// ------------
|
||||
@ -33,6 +36,8 @@
|
||||
#include <string>
|
||||
|
||||
#include "console.h"
|
||||
#include "netgame.h"
|
||||
#include "plugins.h"
|
||||
|
||||
void logprintf(char* format, ...);
|
||||
|
||||
|
487
server/netgame.cpp
Normal file
487
server/netgame.cpp
Normal file
@ -0,0 +1,487 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
CNetGame::CNetGame()
|
||||
{
|
||||
// TODO: CNetGame::CNetGame W: 0048EEE0 L: 080AF360
|
||||
|
||||
/*_this = this;
|
||||
this->field_8 = 0;
|
||||
this->field_C = 0;
|
||||
this->field_0 = 0;
|
||||
this->field_10 = 0;
|
||||
this->field_14 = 0;
|
||||
this->field_18 = 0;
|
||||
this->field_1C = 0;
|
||||
this->field_77 = 1;
|
||||
this->field_24 = 0;
|
||||
this->field_20 = 0;
|
||||
this->field_28 = 0;
|
||||
this->field_50 = 0;
|
||||
this->field_6B = 1;
|
||||
dword_515CF8 = 0;
|
||||
this->field_5A = 0;
|
||||
this->field_59 = 12;
|
||||
this->field_5D = 1;
|
||||
this->field_5B = 1;
|
||||
LODWORD(this->field_62) = 1006834287;
|
||||
this->field_66 = 0;
|
||||
this->field_6A = 0;
|
||||
this->field_7E = 0;
|
||||
this->field_6C = 0;
|
||||
LODWORD(this->field_6E) = 1176256512;
|
||||
this->field_79 = 0;
|
||||
LODWORD(this->field_7A) = 1176256512;
|
||||
LODWORD(this->field_72) = 1116471296;
|
||||
this->field_76 = 0;
|
||||
this->field_5C = 0;
|
||||
this->field_2C = 0;
|
||||
this->field_30 = 0;
|
||||
this->field_34 = 0;
|
||||
v2 = operator new(0x10u);
|
||||
v26 = 0;
|
||||
if ( v2 )
|
||||
v3 = sub_482BF0(v2);
|
||||
else
|
||||
v3 = 0;
|
||||
_this->field_3C = v3;
|
||||
v4 = operator new(0x320u);
|
||||
v26 = 1;
|
||||
if ( v4 )
|
||||
v5 = sub_4809D0(v4);
|
||||
else
|
||||
v5 = 0;
|
||||
_this->field_38 = v5;
|
||||
v26 = -1;
|
||||
if ( CConsole::GetIntVariable(pConsole, "maxplayers") > 1000 )
|
||||
CConsole::SetIntVariable(pConsole, "maxplayers", 1000);
|
||||
v6 = CConsole::GetStringVariable(pConsole, "bind");
|
||||
v7 = v6;
|
||||
v21 = v6;
|
||||
if ( v6 && !*v6 )
|
||||
{
|
||||
v21 = 0;
|
||||
v7 = 0;
|
||||
}
|
||||
v8 = CConsole::GetIntVariable(pConsole, "port");
|
||||
v19 = CConsole::GetIntVariable(pConsole, "maxplayers");
|
||||
v20 = CConsole::GetBoolVariable(pConsole, "lanmode");
|
||||
v9 = RakNetworkFactory::GetRakServerInterface();
|
||||
_this->field_40 = v9;
|
||||
sub_496D10(v9);
|
||||
dword_515CFC = sub_44E9D0();
|
||||
_this->field_44 = sub_48DBD0(_this);
|
||||
_this->field_48 = 0;
|
||||
_this->field_4C = 0;
|
||||
sub_46A7B0(v8);
|
||||
if ( (unsigned __int8)(*(int (__stdcall **)(int, _DWORD, int, int, char *))(*(_DWORD *)_this->field_40 + 4))(
|
||||
v19,
|
||||
0,
|
||||
iSleep,
|
||||
v8,
|
||||
v7) )
|
||||
{
|
||||
sub_48EAE0(_this);
|
||||
if ( !sub_48DD50(0) )
|
||||
{
|
||||
logprintf("I couldn't load any gamemode scripts. Please verify your server.cfg");
|
||||
logprintf("It needs a gamemode0 line at the very least.");
|
||||
_fcloseall();
|
||||
exit(1);
|
||||
}
|
||||
(*(void (**)(void))(*(_DWORD *)_this->field_40 + 84))();
|
||||
v10 = CConsole::GetStringVariable(pConsole, "password");
|
||||
if ( v10 && *v10 )
|
||||
(*(void (__stdcall **)(char *))(*(_DWORD *)_this->field_40 + 16))(v10);
|
||||
sprintf(&pInitStr, "%02d:%02d", _this->field_59, 0);
|
||||
CConsole::AddStringVariable(pConsole, "worldtime", 4u, &pInitStr, 0);
|
||||
if ( v20 )
|
||||
_this->field_50 = 1;
|
||||
GetCurrentDirectoryA(0x200u, &Value);
|
||||
v11 = strlen(&Value);
|
||||
if ( *((_BYTE *)&v22 + v11 + 3) != 92 )
|
||||
{
|
||||
*(&Value + v11) = 92;
|
||||
v24[v11] = 0;
|
||||
}
|
||||
v12 = (char *)&v22 + 3;
|
||||
do
|
||||
v13 = (v12++)[1];
|
||||
while ( v13 );
|
||||
*(_DWORD *)v12 = 1769104243;
|
||||
*((_DWORD *)v12 + 1) = 1768322160;
|
||||
*((_DWORD *)v12 + 2) = 1551066476;
|
||||
v12[12] = 0;
|
||||
SetEnvironmentVariableA("AMXFILE", &Value);
|
||||
v14 = operator new(0x1034u);
|
||||
v22 = v14;
|
||||
v26 = 2;
|
||||
if ( v14 )
|
||||
v15 = sub_46A7C0(v14);
|
||||
else
|
||||
v15 = 0;
|
||||
_this->field_4 = v15;
|
||||
if ( v21 )
|
||||
{
|
||||
v16 = (int (__stdcall **)(int, int, int))"ON";
|
||||
if ( !v20 )
|
||||
v16 = &off_4B9C04;
|
||||
printf(
|
||||
"\nStarted server on %s:%d, with maxplayers: %d lanmode is %s.\n\n",
|
||||
v21,
|
||||
(unsigned __int16)v8,
|
||||
(unsigned __int16)v19,
|
||||
v16);
|
||||
}
|
||||
else
|
||||
{
|
||||
v17 = (int (__stdcall **)(int, int, int))"ON";
|
||||
if ( !v20 )
|
||||
v17 = &off_4B9C04;
|
||||
printf(
|
||||
"\nStarted server on port: %d, with maxplayers: %d lanmode is %s.\n\n",
|
||||
(unsigned __int16)v8,
|
||||
(unsigned __int16)v19,
|
||||
v17);
|
||||
}
|
||||
_this->field_5E = 0;
|
||||
}
|
||||
else if ( v7 )
|
||||
{
|
||||
logprintf("Unable to start server on %s:%d. Port in use?", v7, (unsigned __int16)v8);
|
||||
}
|
||||
else
|
||||
{
|
||||
logprintf("Unable to start server on port: %d. Port in use?", (unsigned __int16)v8);
|
||||
}*/
|
||||
}
|
||||
|
||||
CNetGame::~CNetGame()
|
||||
{
|
||||
// TODO: CNetGame::~CNetGame W: 0048F2B0 L: 080AB260
|
||||
|
||||
/*
|
||||
_this = this;
|
||||
logprintf("--- Server Shutting Down.");
|
||||
v2 = (void *)_this->field_0;
|
||||
if ( _this->field_0 )
|
||||
{
|
||||
sub_46F550(_this->field_0);
|
||||
operator_delete(v2);
|
||||
_this->field_0 = 0;
|
||||
}
|
||||
v3 = (void *)_this->field_4;
|
||||
if ( v3 )
|
||||
{
|
||||
sub_46CF60(_this->field_4);
|
||||
operator_delete(v3);
|
||||
_this->field_4 = 0;
|
||||
}
|
||||
v4 = (void *)_this->field_3C;
|
||||
if ( v4 )
|
||||
{
|
||||
sub_482B00(_this->field_3C);
|
||||
operator_delete(v4);
|
||||
_this->field_3C = 0;
|
||||
}
|
||||
if ( _this->field_38 )
|
||||
{
|
||||
operator_delete((void *)_this->field_38);
|
||||
_this->field_38 = 0;
|
||||
}
|
||||
v5 = (void *)_this->field_20;
|
||||
if ( v5 )
|
||||
{
|
||||
sub_464510(_this->field_20);
|
||||
operator_delete(v5);
|
||||
_this->field_20 = 0;
|
||||
}
|
||||
v6 = (void *)_this->field_C;
|
||||
if ( v6 )
|
||||
{
|
||||
sub_467B30();
|
||||
operator_delete(v6);
|
||||
_this->field_C = 0;
|
||||
}
|
||||
v7 = (void *)_this->field_8;
|
||||
if ( v7 )
|
||||
{
|
||||
sub_466A90(_this->field_8);
|
||||
operator_delete(v7);
|
||||
_this->field_8 = 0;
|
||||
}
|
||||
v8 = (void *)_this->field_14;
|
||||
if ( v8 )
|
||||
{
|
||||
sub_465810(_this->field_14);
|
||||
operator_delete(v8);
|
||||
_this->field_14 = 0;
|
||||
}
|
||||
if ( _this->field_10 )
|
||||
{
|
||||
operator_delete((void *)_this->field_10);
|
||||
_this->field_10 = 0;
|
||||
}
|
||||
v9 = (void *)_this->field_18;
|
||||
if ( v9 )
|
||||
{
|
||||
sub_4652A0(_this->field_18);
|
||||
operator_delete(v9);
|
||||
_this->field_18 = 0;
|
||||
}
|
||||
v10 = (void *)_this->field_1C;
|
||||
if ( v10 )
|
||||
{
|
||||
sub_466AE0(_this->field_1C);
|
||||
operator_delete(v10);
|
||||
_this->field_1C = 0;
|
||||
}
|
||||
if ( _this->field_24 )
|
||||
{
|
||||
operator_delete((void *)_this->field_24);
|
||||
_this->field_24 = 0;
|
||||
}
|
||||
v11 = (void *)_this->field_28;
|
||||
if ( v11 )
|
||||
{
|
||||
sub_464920(_this->field_28);
|
||||
operator_delete(v11);
|
||||
_this->field_28 = 0;
|
||||
}
|
||||
(*(void (__stdcall **)(signed int, _DWORD))(*(_DWORD *)_this->field_40 + 24))(100, 0);
|
||||
sub_4916E0(_this->field_40);
|
||||
return sub_44FB30(_this->field_40);
|
||||
*/
|
||||
}
|
||||
|
||||
void CNetGame::Init(BOOL bFirst)
|
||||
{
|
||||
// TODO: CNetGame::Init W: 0048DE20 L: 080AB7E0
|
||||
|
||||
/*
|
||||
this->field_8A = 0;
|
||||
v2 = this->field_8;
|
||||
if ( v2 )
|
||||
{
|
||||
memset((void *)(v2 + 4012), 0, 0xFA0u);
|
||||
memset((void *)(v2 + 8012), 0, 0xFA0u);
|
||||
memset((void *)v2, 0, 0xFA0u);
|
||||
}
|
||||
else
|
||||
{
|
||||
v3 = operator new(0x30970u);
|
||||
sub_80D04F0(v3);
|
||||
this->field_8 = v3;
|
||||
}
|
||||
if ( !this->field_C )
|
||||
{
|
||||
v10 = (void *)operator new(0x5E98u);
|
||||
sub_814CAB0(v10);
|
||||
this->field_C = (int)v10;
|
||||
}
|
||||
if ( !this->field_10 )
|
||||
{
|
||||
v8 = operator new(0x1C004u);
|
||||
v9 = 0;
|
||||
do
|
||||
{
|
||||
*(_DWORD *)(v8 + 4 * v9 + 81920) = 0;
|
||||
*(_DWORD *)(v8 + 4 * v9++ + 98304) = 0;
|
||||
}
|
||||
while ( v9 <= 4095 );
|
||||
this->field_10 = v8;
|
||||
*(_DWORD *)(v8 + 114688) = 0;
|
||||
}
|
||||
if ( !this->field_14 )
|
||||
{
|
||||
v7 = operator new(0x7A40E0u);
|
||||
sub_80C8560(v7);
|
||||
this->field_14 = v7;
|
||||
}
|
||||
if ( !this->field_18 )
|
||||
{
|
||||
v6 = operator new(0x7E8u);
|
||||
sub_80AAD20(v6);
|
||||
this->field_18 = v6;
|
||||
}
|
||||
if ( !this->field_1C )
|
||||
{
|
||||
v15 = operator new(0x1FA000u);
|
||||
sub_814A210(v15);
|
||||
this->field_1C = v15;
|
||||
}
|
||||
if ( !this->field_24 )
|
||||
{
|
||||
v14 = operator new(0x5000u);
|
||||
sub_80A7570(v14);
|
||||
this->field_24 = v14;
|
||||
}
|
||||
if ( !this->field_20 )
|
||||
{
|
||||
v13 = operator new(0x9400u);
|
||||
sub_804BED0(v13);
|
||||
this->field_20 = v13;
|
||||
}
|
||||
if ( !this->field_28 )
|
||||
{
|
||||
v12 = operator new(0x2EE4u);
|
||||
sub_8094A80(v12);
|
||||
this->field_28 = v12;
|
||||
}
|
||||
v4 = (void *)this->field_0;
|
||||
if ( !this->field_0 )
|
||||
{
|
||||
v11 = operator new(0x6Eu);
|
||||
sub_80A4DA0(v11);
|
||||
this->field_0 = v11;
|
||||
v4 = (void *)v11;
|
||||
}
|
||||
this->field_59 = 12;
|
||||
this->field_5D = 1;
|
||||
LODWORD(this->field_6E) = 1176256512;
|
||||
LODWORD(this->field_7A) = 1176256512;
|
||||
LODWORD(this->field_72) = 1116471296;
|
||||
this->gap54[4] = 1;
|
||||
*(_DWORD *)&this->gap54[0] = 1;
|
||||
this->field_77 = 1;
|
||||
*(&this->field_6C + 1) = 0;
|
||||
this->field_6C = 0;
|
||||
this->field_79 = 0;
|
||||
this->field_76 = 0;
|
||||
this->gap78[0] = 0;
|
||||
if ( bFirst )
|
||||
{
|
||||
sub_80AB570(this);
|
||||
v4 = (void *)this->field_0;
|
||||
}
|
||||
sub_80A4E90(v4, byte_81CA500);
|
||||
v5 = sub_814D170(this->field_C);
|
||||
logprintf("Number of vehicle models: %d", v5);
|
||||
this->field_5E = 1;*/
|
||||
}
|
||||
|
||||
void CNetGame::ShutdownForGameModeRestart()
|
||||
{
|
||||
// TODO: CNetGame::ShutdownForGameModeRestart W: 0048F430 L: 080ABBE0
|
||||
|
||||
/*
|
||||
sub_804C8A0(&v8);
|
||||
sub_80ABAD0(this, "(", &v8, -1, 2);
|
||||
sub_80D1690(this->field_8);
|
||||
v1 = (void *)this->field_0;
|
||||
if ( this->field_0 )
|
||||
{
|
||||
sub_80A5060(this->field_0);
|
||||
operator delete(v1);
|
||||
this->field_0 = 0;
|
||||
}
|
||||
v2 = (void *)this->field_C;
|
||||
if ( v2 )
|
||||
{
|
||||
sub_814CCA0(this->field_C);
|
||||
operator delete(v2);
|
||||
this->field_C = 0;
|
||||
}
|
||||
if ( this->field_10 )
|
||||
{
|
||||
operator delete((void *)this->field_10);
|
||||
this->field_10 = 0;
|
||||
}
|
||||
v3 = (void *)this->field_14;
|
||||
if ( v3 )
|
||||
{
|
||||
sub_80C8A20(this->field_14);
|
||||
operator delete(v3);
|
||||
this->field_14 = 0;
|
||||
}
|
||||
v4 = (void *)this->field_18;
|
||||
if ( v4 )
|
||||
{
|
||||
sub_80AADA0(this->field_18);
|
||||
operator delete(v4);
|
||||
this->field_18 = 0;
|
||||
}
|
||||
v5 = (void *)this->field_1C;
|
||||
if ( v5 )
|
||||
{
|
||||
sub_814A2D0(this->field_1C);
|
||||
operator delete(v5);
|
||||
this->field_1C = 0;
|
||||
}
|
||||
if ( this->field_24 )
|
||||
{
|
||||
operator delete((void *)this->field_24);
|
||||
this->field_24 = 0;
|
||||
}
|
||||
v6 = (void *)this->field_20;
|
||||
if ( v6 )
|
||||
{
|
||||
sub_804C1E0(this->field_20);
|
||||
operator delete(v6);
|
||||
this->field_20 = 0;
|
||||
}
|
||||
v7 = (void *)this->field_28;
|
||||
if ( v7 )
|
||||
{
|
||||
sub_8094C00(this->field_28);
|
||||
operator delete(v7);
|
||||
this->field_28 = 0;
|
||||
}
|
||||
this->field_5A = 0;
|
||||
dword_81CA600 = 0;
|
||||
this->field_59 = 12;
|
||||
this->field_5D = 1;
|
||||
LODWORD(this->field_62) = 1006834287;
|
||||
this->field_66 = 0;
|
||||
this->field_6A = 0;
|
||||
this->gap78[0] = 0;
|
||||
this->field_5E = 2;
|
||||
sub_804CCB0(&v8);
|
||||
*/
|
||||
}
|
||||
|
||||
void CNetGame::Process()
|
||||
{
|
||||
// TODO: CNetGame::Process W: 00491240 L: 080AEEE0
|
||||
|
||||
/*
|
||||
v4 = sub_80AA3D0();
|
||||
sub_80ABF00(this);
|
||||
sub_80AECE0((int)this);
|
||||
v1 = this->field_5E;
|
||||
if ( v1 == 1 )
|
||||
{
|
||||
if ( this->field_8 )
|
||||
sub_80D0DF0(this->field_8, v4);
|
||||
if ( this->field_C )
|
||||
sub_814CD00(this->field_C, v4);
|
||||
if ( this->field_14 )
|
||||
sub_80C8760(this->field_14, v4);
|
||||
if ( this->field_0 )
|
||||
sub_80A5080(this->field_0, v4);
|
||||
v2 = this->field_3C;
|
||||
if ( v2 )
|
||||
sub_80EBAF0(v2, (signed __int64)(v4 * 1000.0));
|
||||
if ( this->field_38 )
|
||||
sub_80EA2E0(this->field_38);
|
||||
}
|
||||
else if ( v1 == 2 )
|
||||
{
|
||||
v3 = v4 + *(float *)&dword_81CA600;
|
||||
*(float *)&dword_81CA600 = v3;
|
||||
if ( v3 > 12.0 )
|
||||
sub_80AE530(this);
|
||||
}
|
||||
if ( CConsole::GetBoolVariable(pConsole, "announce") )
|
||||
{
|
||||
sub_80ABDE0((int)this, v4);
|
||||
sub_80D1CA0(pPlugins);
|
||||
this->field_82 = this->field_82 + v4;
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_80D1CA0(pPlugins);
|
||||
this->field_82 = this->field_82 + v4;
|
||||
}
|
||||
*/
|
||||
}
|
64
server/netgame.h
Normal file
64
server/netgame.h
Normal file
@ -0,0 +1,64 @@
|
||||
|
||||
#ifndef SAMPSRV_NETGAME_H
|
||||
#define SAMPSRV_NETGAME_H
|
||||
|
||||
class CNetGame // size: W: 14808 L: 14816
|
||||
{
|
||||
private:
|
||||
int field_0;
|
||||
int field_4;
|
||||
int field_8;
|
||||
int field_C;
|
||||
int field_10;
|
||||
int field_14;
|
||||
int field_18;
|
||||
int field_1C;
|
||||
int field_20;
|
||||
int field_24;
|
||||
int field_28;
|
||||
int field_2C;
|
||||
int field_30;
|
||||
int field_34;
|
||||
int field_38;
|
||||
int field_3C;
|
||||
int field_40;
|
||||
int field_44;
|
||||
int field_48;
|
||||
int field_4C;
|
||||
int field_50;
|
||||
char gap54[5];
|
||||
char field_59;
|
||||
char field_5A;
|
||||
char field_5B;
|
||||
char field_5C;
|
||||
char field_5D;
|
||||
int field_5E;
|
||||
float field_62;
|
||||
int field_66;
|
||||
char field_6A;
|
||||
char field_6B;
|
||||
char field_6C;
|
||||
float field_6E;
|
||||
float field_72;
|
||||
char field_76;
|
||||
char field_77;
|
||||
char gap78[1];
|
||||
char field_79;
|
||||
float field_7A;
|
||||
int field_7E;
|
||||
#ifndef WIN32
|
||||
double field_82;
|
||||
#endif
|
||||
int field_8A;
|
||||
char gap8A[14674];
|
||||
|
||||
public:
|
||||
CNetGame();
|
||||
~CNetGame();
|
||||
|
||||
void Init(BOOL bFirst);
|
||||
void ShutdownForGameModeRestart();
|
||||
void Process();
|
||||
};
|
||||
|
||||
#endif
|
17
server/plugins.cpp
Normal file
17
server/plugins.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
CPlugins::CPlugins()
|
||||
{
|
||||
// TODO: CPlugins::CPlugins W: 0046A1D0 L: constructor
|
||||
}
|
||||
|
||||
CPlugins::~CPlugins()
|
||||
{
|
||||
// TODO: CPlugins::~CPlugins W: 00469DB0 L: 080D20E0
|
||||
}
|
||||
|
||||
void CPlugins::LoadPlugins(char *szSearchPath)
|
||||
{
|
||||
// TODO: CPlugins::LoadPlugins W: 0046A570 L: 080D29E0
|
||||
}
|
15
server/plugins.h
Normal file
15
server/plugins.h
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
#ifndef _PLUGINS_H_INCLUDED
|
||||
#define _PLUGINS_H_INCLUDED
|
||||
|
||||
class CPlugins // size: W: 1216 L: 1212
|
||||
{
|
||||
private:
|
||||
public:
|
||||
CPlugins();
|
||||
~CPlugins();
|
||||
|
||||
void LoadPlugins(char *szSearchPath);
|
||||
};
|
||||
|
||||
#endif
|
@ -123,6 +123,18 @@
|
||||
<File
|
||||
RelativePath=".\main.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\netgame.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\netgame.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\plugins.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\plugins.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\resource.h">
|
||||
</File>
|
||||
|
Loading…
Reference in New Issue
Block a user