Skip to content

Commit

Permalink
Merge branch 'master' into patch-1435
Browse files Browse the repository at this point in the history
  • Loading branch information
tederis authored Jan 9, 2025
2 parents f83d21a + ef9829f commit 94e3193
Show file tree
Hide file tree
Showing 292 changed files with 23,474 additions and 30,278 deletions.
7 changes: 7 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaNetworkDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,26 @@
*****************************************************************************/

#include "StdInc.h"
#include "CScriptArgReader.h"

#define MIN_CLIENT_REQ_CALLREMOTE_QUEUE_NAME "1.5.3-9.11270"
#define MIN_CLIENT_REQ_FETCHREMOTE_CONNECT_TIMEOUT "1.3.5"
#define MIN_CLIENT_REQ_CALLREMOTE_OPTIONS_TABLE "1.5.4-9.11342"
#define MIN_CLIENT_REQ_CALLREMOTE_OPTIONS_FORMFIELDS "1.5.4-9.11413"

static auto GetServerIp(std::optional<bool> includePort) -> const char*
{
return g_pNet->GetConnectedServer(includePort.value_or(false));
}

void CLuaNetworkDefs::LoadFunctions()
{
constexpr static const std::pair<const char*, lua_CFunction> functions[]{
{"fetchRemote", FetchRemote},
{"getRemoteRequests", GetRemoteRequests},
{"getRemoteRequestInfo", GetRemoteRequestInfo},
{"abortRemoteRequest", AbortRemoteRequest},
{"getServerIp", ArgumentParser<GetServerIp>},
};

// Add functions
Expand Down
12 changes: 3 additions & 9 deletions Server/mods/deathmatch/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,17 @@
// SQL variable placeholder (replaces with actual variable content)
#define SQL_VARIABLE_PLACEHOLDER '?'

// Security script path
#define LUA_SECURITY_SCRIPT "security.lua"

// Server FPS limit (in milliseconds)
#define FPS_LIMIT 16

// Max garages
#define MAX_GARAGES 50

// Game-monitor.com query URL (use %u for port input)
#define QUERY_URL_GAME_MONITOR "http://master.game-monitor.com/heartbeat.php?p=%ASE%&e=3"

// MTA master server query URL (Inputs: game port, ase port, http port, version, extra, serverip)
#define QUERY_URL_MTA_MASTER_SERVER "http://master.mtasa.com/ase/add.php?g=%GAME%&a=%ASE%&h=%HTTP%&v=%VER%&x=%EXTRA%&ip=%IP%"
#define QUERY_URL_MTA_MASTER_SERVER "https://master.mtasa.com/ase/add.php?g=%GAME%&a=%ASE%&h=%HTTP%&v=%VER%&x=%EXTRA%&ip=%IP%"

// MTA port tester URL
#define PORT_TESTER_URL "http://nightly.mtasa.com/ports/"
#define PORT_TESTER_URL "https://nightly.mtasa.com/ports/"

// MTA minclientversion auto update and others
#define HQCOMMS_URL "http://updatesa.multitheftauto.com/sa/server/hqcomms/"
#define HQCOMMS_URL "https://updatesa.multitheftauto.com/sa/server/hqcomms/"
7 changes: 7 additions & 0 deletions Server/mods/deathmatch/logic/luadefs/CLuaGenericDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
#include "CLuaGenericDefs.h"
#include "CStaticFunctionDefinitions.h"
#include "CScriptArgReader.h"
#include "CMasterServerAnnouncer.h"

static auto GetServerIpFromMasterServer() -> std::string
{
return g_pGame->GetMasterServerAnnouncer()->GetRemoteAddress();
}

void CLuaGenericDefs::LoadFunctions()
{
Expand All @@ -24,6 +30,7 @@ void CLuaGenericDefs::LoadFunctions()
{"outputConsole", ArgumentParserWarn<false, OutputConsole>},
{"outputDebugString", ArgumentParserWarn<false, OutputScriptDebugLog>},
{"outputServerLog", ArgumentParserWarn<false, OutputServerLog>},
{"getServerIpFromMasterServer", ArgumentParser<GetServerIpFromMasterServer>},
{"getServerName", ArgumentParserWarn<nullptr, GetServerName>},
{"getServerHttpPort", ArgumentParserWarn<nullptr, GetServerHttpPort>},
{"getServerPassword", ArgumentParserWarn<nullptr, GetServerPassword>},
Expand Down
29 changes: 27 additions & 2 deletions Server/mods/deathmatch/utils/CMasterServerAnnouncer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#pragma once

#include "ASE.h"
#include "version.h"

struct SMasterServerDefinition
Expand Down Expand Up @@ -129,10 +130,15 @@ class CMasterServer : public CRefCountable
if (m_Stage < ANNOUNCE_STAGE_REMINDER)
{
m_Stage = ANNOUNCE_STAGE_REMINDER;

CArgMap argMap;
argMap.SetFromString(result.pData);

if (result.iErrorCode == 200)
m_remoteAddress = argMap.Get("remote_addr");

if (!m_Definition.bHideSuccess)
{
CArgMap argMap;
argMap.SetFromString(result.pData);
SString strOkMessage = argMap.Get("ok_message");

// Log successful initial announcement
Expand Down Expand Up @@ -178,6 +184,9 @@ class CMasterServer : public CRefCountable

const SMasterServerDefinition& GetDefinition() const { return m_Definition; }

bool HasRemoteAddress() const noexcept { return !m_remoteAddress.empty(); }
const std::string& GetRemoteAddress() const noexcept { return m_remoteAddress; }

//
// Get http downloader used for master server comms etc.
//
Expand All @@ -192,6 +201,7 @@ class CMasterServer : public CRefCountable
long long m_llLastAnnounceTime;
long long m_llLastPushTime;
const SMasterServerDefinition m_Definition;
std::string m_remoteAddress;
};

////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -270,6 +280,21 @@ class CMasterServerAnnouncer
}
}

/*
* @brief Get remote address of the first master server that has it.
*/
const std::string& GetRemoteAddress() const noexcept
{
for (CMasterServer* masterServer : m_MasterServerList)
{
if (masterServer->HasRemoteAddress())
return masterServer->GetRemoteAddress();
}

static std::string empty;
return empty;
}

protected:
std::vector<CMasterServer*> m_MasterServerList;
};
Binary file modified Shared/data/MTA San Andreas/server/arm64/libcrypto-3-arm64.dll
Binary file not shown.
Binary file modified Shared/data/MTA San Andreas/server/arm64/libmysql.dll
Binary file not shown.
Binary file modified Shared/data/MTA San Andreas/server/arm64/libssl-3-arm64.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Shared/data/MTA San Andreas/server/mods/deathmatch/libssl-3.dll
Binary file not shown.
Binary file modified Shared/data/MTA San Andreas/server/x64/libcrypto-3-x64.dll
Binary file not shown.
Binary file modified Shared/data/MTA San Andreas/server/x64/libmysql.dll
Binary file not shown.
Binary file modified Shared/data/MTA San Andreas/server/x64/libssl-3-x64.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Shared/sdk/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

#define _ASE_VERSION QUOTE_DEFINE(MTASA_VERSION_MAJOR) "." QUOTE_DEFINE(MTASA_VERSION_MINOR)
#define _NETCODE_VERSION_BRANCH_ID 0x4 // Use 0x1 - 0xF to indicate an incompatible branch is being used (0x0 is reserved, 0x4 is trunk)
#define _CLIENT_NET_MODULE_VERSION 0x0B0 // (0x000 - 0xfff) Lvl9 wizards only
#define _CLIENT_NET_MODULE_VERSION 0x0B1 // (0x000 - 0xfff) Lvl9 wizards only
#define _SERVER_NET_MODULE_VERSION 0x0AB // (0x000 - 0xfff) Lvl9 wizards only
#define _NETCODE_VERSION 0x1DA // (0x000 - 0xfff) Increment when net messages change (pre-release)

Expand Down
Loading

0 comments on commit 94e3193

Please sign in to comment.