Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion GeneralsMD/Code/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,7 @@ set(GAMEENGINE_SRC
Include/GameNetwork/GeneralsOnline/OnlineServices_StatsInterface.h
Include/GameNetwork/GeneralsOnline/OnlineServices_SocialInterface.h
Include/GameNetwork/GeneralsOnline/OnlineServices_MatchmakingInterface.h
Include/GameNetwork/GeneralsOnline/AnticheatPluginResolver.h
Include/GameNetwork/GeneralsOnline/GeneralsOnline_Settings.h
Include/GameNetwork/GeneralsOnline/HTTP/HTTPManager.h
Include/GameNetwork/GeneralsOnline/HTTP/HTTPRequest.h
Expand Down Expand Up @@ -1184,6 +1185,7 @@ set(GAMEENGINE_SRC
Include/GameNetwork/GeneralsOnline/Vendor/libcurl/websockets.h
Source/GameNetwork/GeneralsOnline/NGMP_Helpers.cpp
Source/GameNetwork/GeneralsOnline/NGMPGame.cpp
Source/GameNetwork/GeneralsOnline/AnticheatPluginResolver.cpp
Source/GameNetwork/GeneralsOnline/GeneralsOnline_Settings.cpp
Source/GameNetwork/GeneralsOnline/HTTP/HTTPManager.cpp
Source/GameNetwork/GeneralsOnline/HTTP/HTTPRequest.cpp
Expand Down Expand Up @@ -1250,4 +1252,4 @@ target_precompile_headers(z_gameengine PRIVATE


add_compile_definitions(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
add_compile_definitions(GENERALS_ONLINE)
add_compile_definitions(GENERALS_ONLINE)
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include <filesystem>
#include <string>
#include <vector>

struct AnticheatPluginResolutionResult
{
bool found = false;
bool usedDefault = false;
bool settingsUsedDefault = false;

std::string configuredValue;
std::string normalizedPluginName;

std::filesystem::path selectedPath;
std::vector<std::filesystem::path> triedPaths;
std::vector<std::string> notes;

std::string ToLogString() const;
std::string ToUserFacingString() const;
};

class AnticheatPluginResolver final
{
public:
static constexpr const char* DefaultPluginName = "easyanticheat";

static AnticheatPluginResolutionResult Resolve(
const std::string& configuredValue,
bool settingsUsedDefault = false);
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once
#include "libcurl/curl.h"
#pragma once
#include "libcurl/curl.h"

#include <string>

enum EHTTPVersion
{
Expand All @@ -12,8 +14,10 @@ enum EHTTPVersion

class GenOnlineSettings
{
public:
GenOnlineSettings();
public:
GenOnlineSettings();

static constexpr const char* DEFAULT_ANTICHEAT_PLUGIN = "easyanticheat";

float Camera_MoveSpeedRatio() const { return m_Camera_MoveSpeedRatio; }
float Camera_GetMinHeight() const { return m_Camera_MinHeight; }
Expand Down Expand Up @@ -49,7 +53,33 @@ class GenOnlineSettings
return m_Render_FramerateLimit_FPSVal;
}

std::string GetAnticheatPlugin() const { return m_Plugins_Anticheat; }
void EnsureInitialized()
{
if (!m_bInitialized)
{
Initialize();
}
}

bool IsInitialized() const
{
return m_bInitialized;
}

bool WasAnticheatPluginDefaulted() const
{
return m_bAnticheatPluginDefaulted;
}

std::string GetAnticheatPlugin() const
{
if (m_Plugins_Anticheat.empty())
{
return DEFAULT_ANTICHEAT_PLUGIN;
}

return m_Plugins_Anticheat;
}

bool Social_Notifications_FriendComesOnline_Menus() { return m_Social_Notification_FriendComesOnline_Menus; }
bool Social_Notifications_FriendComesOnline_Gameplay() { return m_Social_Notification_FriendComesOnline_Gameplay; }
Expand Down Expand Up @@ -122,7 +152,8 @@ class GenOnlineSettings

bool m_bInitialized = false;

bool m_bVerbose = false;
bool m_bVerbose = false;
bool m_bAnticheatPluginDefaulted = false;

bool m_Render_DrawStatsOverlay = true;
bool m_Render_LimitFramerate = true;
Expand All @@ -138,7 +169,7 @@ class GenOnlineSettings
bool m_Social_Notification_PlayerSendsRequest_Menus = true;
bool m_Social_Notification_PlayerSendsRequest_Gameplay = true;

std::string m_Plugins_Anticheat = std::string();
std::string m_Plugins_Anticheat = DEFAULT_ANTICHEAT_PLUGIN;

EHTTPVersion m_Network_HTTPVersion = EHTTPVersion::HTTP_VERSION_AUTO;
bool m_Network_UseAlternativeEndpoint = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <string>

enum class EAnticheatActionType : int32_t
{
Expand Down Expand Up @@ -41,7 +42,7 @@ class AnticheatPlugInterface

static int GetAnticheatIdentifier();

static void LoadPlugin(const char* szPluginName);
static bool LoadPlugin(const char* szPluginPath, std::string* outFailureReason = nullptr);
static void Authenticate();
static void UnloadPlugin();
static void Tick();
Expand Down Expand Up @@ -111,6 +112,8 @@ class AnticheatPlugInterface
// Module
static HMODULE g_hACPluginModule;
static bool m_bPluginLoadFailed;
static DWORD m_lastLoadError;
static std::string m_lastLoadPath;

static int64_t m_tokenCreationTime;
};
Expand Down
Loading