From 2c9f48c22db1911e77b10ea5ee04ed565c5441e0 Mon Sep 17 00:00:00 2001
From: Fernando Rocha <34967844+Fernando-A-Rocha@users.noreply.github.com>
Date: Tue, 29 Oct 2024 22:47:37 +0000
Subject: [PATCH] Add `resource_client_file_checks` setting to disable corrupt
PNG/TXD/DFF warnings (#3822)
---
Server/mods/deathmatch/editor.conf | 4 ++++
Server/mods/deathmatch/local.conf | 4 ++++
Server/mods/deathmatch/logic/CMainConfig.cpp | 1 +
Server/mods/deathmatch/logic/CMainConfig.h | 2 ++
Server/mods/deathmatch/logic/CResourceChecker.cpp | 8 +++++++-
Server/mods/deathmatch/mtaserver.conf | 4 ++++
Server/mods/deathmatch/mtaserver.conf.template | 4 ++++
7 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/Server/mods/deathmatch/editor.conf b/Server/mods/deathmatch/editor.conf
index f72486a6cb..3b2b75fa80 100644
--- a/Server/mods/deathmatch/editor.conf
+++ b/Server/mods/deathmatch/editor.conf
@@ -263,6 +263,10 @@
*NOTE* This only protects resources which use dbConnect with mysql
Values: 0 - Off, 1 - Enabled. Default - 1 -->
1
+
+
+ 1
diff --git a/Server/mods/deathmatch/local.conf b/Server/mods/deathmatch/local.conf
index ec3defd37d..99b97bee07 100644
--- a/Server/mods/deathmatch/local.conf
+++ b/Server/mods/deathmatch/local.conf
@@ -263,6 +263,10 @@
*NOTE* This only protects resources which use dbConnect with mysql
Values: 0 - Off, 1 - Enabled. Default - 1 -->
1
+
+
+ 1
diff --git a/Server/mods/deathmatch/logic/CMainConfig.cpp b/Server/mods/deathmatch/logic/CMainConfig.cpp
index d47950e73e..4e6b84ce3f 100644
--- a/Server/mods/deathmatch/logic/CMainConfig.cpp
+++ b/Server/mods/deathmatch/logic/CMainConfig.cpp
@@ -1468,6 +1468,7 @@ const std::vector& CMainConfig::GetIntSettingList()
{false, false, 0, 0, 1, "fakelag", &m_bFakeLagCommandEnabled, NULL},
{true, true, 50, 1000, 5000, "player_triggered_event_interval", &m_iPlayerTriggeredEventIntervalMs, &CMainConfig::OnPlayerTriggeredEventIntervalChange},
{true, true, 1, 100, 1000, "max_player_triggered_events_per_interval", &m_iMaxPlayerTriggeredEventsPerInterval, &CMainConfig::OnPlayerTriggeredEventIntervalChange},
+ {true, true, 0, 1, 1, "resource_client_file_checks", &m_checkResourceClientFiles, nullptr},
};
static std::vector settingsList;
diff --git a/Server/mods/deathmatch/logic/CMainConfig.h b/Server/mods/deathmatch/logic/CMainConfig.h
index b52733229a..1ddb0c8645 100644
--- a/Server/mods/deathmatch/logic/CMainConfig.h
+++ b/Server/mods/deathmatch/logic/CMainConfig.h
@@ -126,6 +126,7 @@ class CMainConfig : public CXMLConfig
const std::vector& GetOwnerEmailAddressList() const { return m_OwnerEmailAddressList; }
bool IsDatabaseCredentialsProtectionEnabled() const { return m_bDatabaseCredentialsProtectionEnabled != 0; }
bool IsFakeLagCommandEnabled() const { return m_bFakeLagCommandEnabled != 0; }
+ bool IsCheckResourceClientFilesEnabled() const noexcept { return m_checkResourceClientFiles != 0; }
SString GetSetting(const SString& configSetting);
bool GetSetting(const SString& configSetting, SString& strValue);
@@ -227,4 +228,5 @@ class CMainConfig : public CXMLConfig
int m_bFakeLagCommandEnabled;
int m_iPlayerTriggeredEventIntervalMs;
int m_iMaxPlayerTriggeredEventsPerInterval;
+ int m_checkResourceClientFiles;
};
diff --git a/Server/mods/deathmatch/logic/CResourceChecker.cpp b/Server/mods/deathmatch/logic/CResourceChecker.cpp
index db2909cb1c..07f433f34f 100644
--- a/Server/mods/deathmatch/logic/CResourceChecker.cpp
+++ b/Server/mods/deathmatch/logic/CResourceChecker.cpp
@@ -13,6 +13,8 @@
#include "CResourceChecker.h"
#include "CResourceChecker.Data.h"
#include "CResource.h"
+#include "CMainConfig.h"
+#include "CGame.h"
#include "CLogger.h"
#include "CStaticFunctionDefinitions.h"
#include
@@ -28,6 +30,7 @@
extern CNetServer* g_pRealNetServer;
extern CServerInterface* g_pServerInterface;
+extern CGame* g_pGame;
///////////////////////////////////////////////////////////////
//
@@ -48,6 +51,9 @@ void CResourceChecker::CheckResourceForIssues(CResource* pResource, const string
m_ulDeprecatedWarningCount = 0;
m_upgradedFullPathList.clear();
+ // Checking certain resource client files is optional
+ bool checkResourceClientFiles = g_pGame->GetConfig()->IsCheckResourceClientFilesEnabled();
+
// Check each file in the resource
std::list::iterator iterf = pResource->IterBegin();
for (; iterf != pResource->IterEnd(); iterf++)
@@ -73,7 +79,7 @@ void CResourceChecker::CheckResourceForIssues(CResource* pResource, const string
bScript = true;
bClient = true;
}
- else if (type == CResourceFile::RESOURCE_FILE_TYPE_CLIENT_FILE)
+ else if (type == CResourceFile::RESOURCE_FILE_TYPE_CLIENT_FILE && checkResourceClientFiles)
{
bScript = false;
bClient = true;
diff --git a/Server/mods/deathmatch/mtaserver.conf b/Server/mods/deathmatch/mtaserver.conf
index 19fe4a05d8..31faba9112 100644
--- a/Server/mods/deathmatch/mtaserver.conf
+++ b/Server/mods/deathmatch/mtaserver.conf
@@ -274,6 +274,10 @@
Max events per interval range: 1 to 1000. Default: 100 -->
1000
100
+
+
+ 1
diff --git a/Server/mods/deathmatch/mtaserver.conf.template b/Server/mods/deathmatch/mtaserver.conf.template
index faf1c71a6d..73986c0695 100644
--- a/Server/mods/deathmatch/mtaserver.conf.template
+++ b/Server/mods/deathmatch/mtaserver.conf.template
@@ -275,4 +275,8 @@
Max events per interval range: 1 to 1000. Default: 100 -->
1000
100
+
+
+ 1