[General] Basic refactoring

This commit is contained in:
momo5502 2017-01-20 14:36:52 +01:00
parent 76fd8a65f5
commit 079bc920a8
145 changed files with 447 additions and 252 deletions

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Component
@ -30,62 +32,62 @@ namespace Components
};
}
#include "Modules\Auth.hpp"
#include "Modules\Bans.hpp"
#include "Modules\Bots.hpp"
#include "Modules\Dvar.hpp"
#include "Modules\Lean.hpp"
#include "Modules\Maps.hpp"
#include "Modules\News.hpp"
#include "Modules\Flags.hpp"
#include "Modules\Menus.hpp"
#include "Modules\Toast.hpp"
#include "Modules\Zones.hpp"
#include "Modules\Colors.hpp"
#include "Modules\D3D9Ex.hpp"
#include "Modules\Script.hpp"
#include "Modules\Weapon.hpp"
#include "Modules\Window.hpp"
#include "Modules\Command.hpp"
#include "Modules\Console.hpp"
#include "Modules\IPCPipe.hpp"
#include "Modules\UIScript.hpp"
#include "Modules\ModList.hpp"
#include "Modules\Network.hpp"
#include "Modules\Theatre.hpp"
#include "Modules\Node.hpp"
#include "Modules\RCon.hpp"
#include "Modules\Party.hpp" // Destroys the order, but requires network classes :D
#include "Modules\Logger.hpp"
#include "Modules\Download.hpp"
#include "Modules\Playlist.hpp"
#include "Modules\RawFiles.hpp"
#include "Modules\Renderer.hpp"
#include "Modules\UIFeeder.hpp"
#include "Modules\AntiCheat.hpp"
#include "Modules\Dedicated.hpp"
#include "Modules\Discovery.hpp"
#include "Modules\Exception.hpp"
#include "Modules\FastFiles.hpp"
#include "Modules\FrameTime.hpp"
#include "Modules\Gametypes.hpp"
#include "Modules\Materials.hpp"
#include "Modules\Singleton.hpp"
#include "Modules\Threading.hpp"
#include "Modules\BitMessage.hpp"
#include "Modules\FileSystem.hpp"
#include "Modules\ModelSurfs.hpp"
#include "Modules\PlayerName.hpp"
#include "Modules\QuickPatch.hpp"
#include "Modules\ServerInfo.hpp"
#include "Modules\ServerList.hpp"
#include "Modules\SlowMotion.hpp"
#include "Modules\ArenaLength.hpp"
#include "Modules\StringTable.hpp"
#include "Modules\ZoneBuilder.hpp"
#include "Modules\AssetHandler.hpp"
#include "Modules\Localization.hpp"
#include "Modules\MusicalTalent.hpp"
#include "Modules\MinidumpUpload.hpp"
#include "Modules\StructuredData.hpp"
#include "Modules\ConnectProtocol.hpp"
#include "Modules/Auth.hpp"
#include "Modules/Bans.hpp"
#include "Modules/Bots.hpp"
#include "Modules/Dvar.hpp"
#include "Modules/Lean.hpp"
#include "Modules/Maps.hpp"
#include "Modules/News.hpp"
#include "Modules/Flags.hpp"
#include "Modules/Menus.hpp"
#include "Modules/Toast.hpp"
#include "Modules/Zones.hpp"
#include "Modules/Colors.hpp"
#include "Modules/D3D9Ex.hpp"
#include "Modules/Script.hpp"
#include "Modules/Weapon.hpp"
#include "Modules/Window.hpp"
#include "Modules/Command.hpp"
#include "Modules/Console.hpp"
#include "Modules/IPCPipe.hpp"
#include "Modules/UIScript.hpp"
#include "Modules/ModList.hpp"
#include "Modules/Network.hpp"
#include "Modules/Theatre.hpp"
#include "Modules/Node.hpp"
#include "Modules/RCon.hpp"
#include "Modules/Party.hpp" // Destroys the order, but requires network classes :D
#include "Modules/Logger.hpp"
#include "Modules/Download.hpp"
#include "Modules/Playlist.hpp"
#include "Modules/RawFiles.hpp"
#include "Modules/Renderer.hpp"
#include "Modules/UIFeeder.hpp"
#include "Modules/AntiCheat.hpp"
#include "Modules/Dedicated.hpp"
#include "Modules/Discovery.hpp"
#include "Modules/Exception.hpp"
#include "Modules/FastFiles.hpp"
#include "Modules/FrameTime.hpp"
#include "Modules/Gametypes.hpp"
#include "Modules/Materials.hpp"
#include "Modules/Singleton.hpp"
#include "Modules/Threading.hpp"
#include "Modules/BitMessage.hpp"
#include "Modules/FileSystem.hpp"
#include "Modules/ModelSurfs.hpp"
#include "Modules/PlayerName.hpp"
#include "Modules/QuickPatch.hpp"
#include "Modules/ServerInfo.hpp"
#include "Modules/ServerList.hpp"
#include "Modules/SlowMotion.hpp"
#include "Modules/ArenaLength.hpp"
#include "Modules/StringTable.hpp"
#include "Modules/ZoneBuilder.hpp"
#include "Modules/AssetHandler.hpp"
#include "Modules/Localization.hpp"
#include "Modules/MusicalTalent.hpp"
#include "Modules/MinidumpUpload.hpp"
#include "Modules/StructuredData.hpp"
#include "Modules/ConnectProtocol.hpp"

View File

@ -33,7 +33,7 @@ namespace Components
{
#ifdef DEBUG_DETECTIONS
Logger::Flush();
MessageBoxA(0, "Check the log for more information!", "AntiCheat triggered", MB_ICONERROR);
MessageBoxA(nullptr, "Check the log for more information!", "AntiCheat triggered", MB_ICONERROR);
ExitProcess(0xFFFFFFFF);
#else
static std::thread triggerThread;
@ -200,7 +200,7 @@ namespace Components
MessageBoxA(0, Utils::String::VA("Loading library %s via %s %X", std::string(library.begin(), library.end()).data(), buffer, reinterpret_cast<uint32_t>(callee)), 0, 0);
return LoadLibraryExW(library.data(), NULL, 0);
return LoadLibraryExW(library.data(), nullptr, 0);
}
HANDLE WINAPI AntiCheat::LoadLibaryAStub(const char* library)
@ -357,7 +357,7 @@ namespace Components
DWORD dwSize = 0;
PVOID pTokenInfo = nullptr;
if (GetTokenInformation(hToken, TokenUser, NULL, 0, &dwSize) || GetLastError() != ERROR_INSUFFICIENT_BUFFER) return GetLastError();
if (GetTokenInformation(hToken, TokenUser, nullptr, 0, &dwSize) || GetLastError() != ERROR_INSUFFICIENT_BUFFER) return GetLastError();
if (dwSize)
{
@ -458,9 +458,9 @@ namespace Components
SE_KERNEL_OBJECT, // process object
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
psidCurUser, // NULL, // Owner SID
NULL, // Group SID
nullptr, // Group SID
pDacl,
NULL // SACL
nullptr // SACL
);
}

View File

@ -1,3 +1,5 @@
#pragma once
#ifndef DEBUG
// Hide AntiCheat in embeded symbol names
#define AntiCheat SubComponent
@ -12,7 +14,7 @@ namespace Components
~AntiCheat();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "AntiCheat"; };
const char* getName() override { return "AntiCheat"; };
#endif
static void CrashClient();

View File

@ -6,7 +6,7 @@ namespace Components
ArenaLength();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "ArenaLength"; };
const char* getName() override { return "ArenaLength"; };
#endif
static Game::newMapArena_t NewArenas[128];

View File

@ -276,7 +276,7 @@ namespace Components
Game::XAssetHeader AssetHandler::FindAssetForZone(Game::XAssetType type, std::string filename, ZoneBuilder::Zone* builder, bool isSubAsset)
{
Game::XAssetHeader header = { 0 };
Game::XAssetHeader header = { nullptr };
if (type >= Game::XAssetType::ASSET_TYPE_COUNT) return header;
auto tempPool = &AssetHandler::TemporaryAssets[type];

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class AssetHandler : public Component
@ -21,7 +23,7 @@ namespace Components
~AssetHandler();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "AssetHandler"; };
const char* getName() override { return "AssetHandler"; };
#endif
static void OnFind(Game::XAssetType type, Utils::Slot<Callback> callback);
@ -70,30 +72,30 @@ namespace Components
};
}
#include "AssetInterfaces\IXModel.hpp"
#include "AssetInterfaces\IFxWorld.hpp"
#include "AssetInterfaces\IMapEnts.hpp"
#include "AssetInterfaces\IRawFile.hpp"
#include "AssetInterfaces\IComWorld.hpp"
#include "AssetInterfaces\IGfxImage.hpp"
#include "AssetInterfaces\IGfxWorld.hpp"
#include "AssetInterfaces\IMaterial.hpp"
#include "AssetInterfaces\ISndCurve.hpp"
#include "AssetInterfaces\IclipMap_t.hpp"
#include "AssetInterfaces\IPhysPreset.hpp"
#include "AssetInterfaces\IXAnimParts.hpp"
#include "AssetInterfaces\IFxEffectDef.hpp"
#include "AssetInterfaces\IGameWorldMp.hpp"
#include "AssetInterfaces\IGameWorldSp.hpp"
#include "AssetInterfaces\IGfxLightDef.hpp"
#include "AssetInterfaces\ILoadedSound.hpp"
#include "AssetInterfaces\IPhysCollmap.hpp"
#include "AssetInterfaces\IStringTable.hpp"
#include "AssetInterfaces\IXModelSurfs.hpp"
#include "AssetInterfaces\ILocalizeEntry.hpp"
#include "AssetInterfaces\Isnd_alias_list_t.hpp"
#include "AssetInterfaces\IMaterialPixelShader.hpp"
#include "AssetInterfaces\IMaterialTechniqueSet.hpp"
#include "AssetInterfaces\IMaterialVertexShader.hpp"
#include "AssetInterfaces\IStructuredDataDefSet.hpp"
#include "AssetInterfaces\IMaterialVertexDeclaration.hpp"
#include "AssetInterfaces/IXModel.hpp"
#include "AssetInterfaces/IFxWorld.hpp"
#include "AssetInterfaces/IMapEnts.hpp"
#include "AssetInterfaces/IRawFile.hpp"
#include "AssetInterfaces/IComWorld.hpp"
#include "AssetInterfaces/IGfxImage.hpp"
#include "AssetInterfaces/IGfxWorld.hpp"
#include "AssetInterfaces/IMaterial.hpp"
#include "AssetInterfaces/ISndCurve.hpp"
#include "AssetInterfaces/IclipMap_t.hpp"
#include "AssetInterfaces/IPhysPreset.hpp"
#include "AssetInterfaces/IXAnimParts.hpp"
#include "AssetInterfaces/IFxEffectDef.hpp"
#include "AssetInterfaces/IGameWorldMp.hpp"
#include "AssetInterfaces/IGameWorldSp.hpp"
#include "AssetInterfaces/IGfxLightDef.hpp"
#include "AssetInterfaces/ILoadedSound.hpp"
#include "AssetInterfaces/IPhysCollmap.hpp"
#include "AssetInterfaces/IStringTable.hpp"
#include "AssetInterfaces/IXModelSurfs.hpp"
#include "AssetInterfaces/ILocalizeEntry.hpp"
#include "AssetInterfaces/Isnd_alias_list_t.hpp"
#include "AssetInterfaces/IMaterialPixelShader.hpp"
#include "AssetInterfaces/IMaterialTechniqueSet.hpp"
#include "AssetInterfaces/IMaterialVertexShader.hpp"
#include "AssetInterfaces/IStructuredDataDefSet.hpp"
#include "AssetInterfaces/IMaterialVertexDeclaration.hpp"

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IComWorld : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IFxEffectDef : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <StdInclude.hpp>
#include "StdInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IFxWorld : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IGameWorldMp : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IGameWorldSp : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
#define IW4X_IMG_VERSION "0"

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IGfxImage : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IGfxLightDef : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
#define IW4X_GFXMAP_VERSION 1

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IGfxWorld : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class ILoadedSound : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class ILocalizeEntry : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IMapEnts : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
#define IW4X_MAT_VERSION "0"

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IMaterial : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IMaterialPixelShader : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IMaterialTechniqueSet : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IMaterialVertexDeclaration : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IMaterialVertexShader : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IPhysCollmap : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IPhysPreset : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IRawFile : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class ISndCurve : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IStringTable : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IStructuredDataDefSet : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
#define IW4X_ANIM_VERSION 1

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IXAnimParts : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
#define IW4X_MODEL_VERSION 4

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IXModel : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IXModelSurfs : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <StdInclude.hpp>
#include "StdInclude.hpp"
#define IW4X_CLIPMAP_VERSION 1

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class IclipMap_t : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include "STDInclude.hpp"
namespace Assets
{

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets
{
class Isnd_alias_list_t : public Components::AssetHandler::IAsset

View File

@ -109,12 +109,10 @@ namespace Components
return;
}
if (address.isLoopback()
// Simply connect, if we're in debug mode, we ignore all security checks
#ifdef DEBUG
|| true
// Simply connect, if we're in debug mode, we ignore all security checks
#ifndef DEBUG
if (address.isLoopback())
#endif
)
{
if (!connectData.infostring().empty())
{
@ -127,6 +125,7 @@ namespace Components
Network::Send(address, "error\nInvalid infostring data!");
}
}
#ifndef DEBUG
else
{
// Validate proto data
@ -204,6 +203,7 @@ namespace Components
Logger::Print("Verified XUID %llX (%d) from %s\n", xuid, userLevel, address.getCString());
Game::SV_DirectConnect(*address.get());
}
#endif
}
__declspec(naked) void Auth::DirectConnectStub()

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Auth : public Component
@ -7,10 +9,10 @@ namespace Components
~Auth();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Auth"; };
const char* getName() override { return "Auth"; };
#endif
bool unitTest();
bool unitTest() override;
static void StoreKey();
static void LoadKey(bool force = false);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Bans : public Component
@ -9,7 +11,7 @@ namespace Components
~Bans();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Bans"; };
const char* getName() override { return "Bans"; };
#endif
static void BanClientNum(int num, std::string reason);

View File

@ -2,10 +2,6 @@
#ifndef DISABLE_BITMESSAGE
#include <Shlwapi.h>
using namespace Utils;
namespace Components
{
std::thread BitMessage::ShutDownThread;
@ -110,6 +106,9 @@ namespace Components
case 3: // Reconnecting
Logger::Print("%s: Reconnecting\n", node->Ip.data());
break;
default:
break;
}
}

View File

@ -2,8 +2,8 @@
#ifndef DISABLE_BITMESSAGE
#define BITMESSAGE_KEYS_FILENAME std::string("players/bmk.dat")
#define BITMESSAGE_OBJECT_STORAGE_FILENAME std::string("players/storage.dat")
#define BITMESSAGE_KEYS_FILENAME "players/bmk.dat"s
#define BITMESSAGE_OBJECT_STORAGE_FILENAME "players/storage.dat"s
namespace Components
{
@ -14,7 +14,7 @@ namespace Components
~BitMessage();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "BitMessage"; };
const char* getName() override { return "BitMessage"; };
#endif
static void SetDefaultTTL(time_t ttl);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Bots : public Component
@ -7,7 +9,7 @@ namespace Components
~Bots();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Bots"; };
const char* getName() override { return "Bots"; };
#endif
private:

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Colors : public Component
@ -7,7 +9,7 @@ namespace Components
~Colors();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Colors"; };
const char* getName() override { return "Colors"; };
#endif
static void Strip(const char* in, char* out, int max);

View File

@ -62,7 +62,7 @@ namespace Components
{
if (Loader::IsPregame())
{
MessageBoxA(0, "Registering server commands in pregamestate is illegal!", 0, MB_ICONERROR);
MessageBoxA(0, "Registering server commands in pregamestate is illegal!", nullptr, MB_ICONERROR);
#ifdef DEBUG
__debugbreak();
@ -237,14 +237,14 @@ namespace Components
float pos[3] = { 0.0f, 0.0f, 0.0f };
float orientation[3] = { 0.0f, 0.0f, 0.0f };
pos[0] = strtof(params->get(1), NULL);
pos[1] = strtof(params->get(2), NULL);
pos[2] = strtof(params->get(3), NULL);
pos[0] = strtof(params->get(1), nullptr);
pos[1] = strtof(params->get(2), nullptr);
pos[2] = strtof(params->get(3), nullptr);
if(params->length() == 6)
{
orientation[0] = strtof(params->get(4), NULL);
orientation[1] = strtof(params->get(5), NULL);
orientation[0] = strtof(params->get(4), nullptr);
orientation[1] = strtof(params->get(5), nullptr);
}
Game::TeleportPlayer(&Game::g_entities[clientNum], pos, orientation);
@ -258,7 +258,7 @@ namespace Components
{
if (params->length() > 1)
{
ShellExecuteA(NULL, "open", params->get(1), 0, 0, SW_SHOWNORMAL);
ShellExecuteA(nullptr, "open", params->get(1), nullptr, nullptr, SW_SHOWNORMAL);
}
});
}

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Command : public Component
@ -49,7 +51,7 @@ namespace Components
~Command();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Command"; };
const char* getName() override { return "Command"; };
#endif
static Game::cmd_function_t* Allocate();

View File

@ -22,16 +22,16 @@ namespace Components
bool ConnectProtocol::InstallProtocol()
{
HKEY hKey = NULL;
HKEY hKey = nullptr;
std::string data;
char ownPth[MAX_PATH] = { 0 };
char workdir[MAX_PATH] = { 0 };
DWORD dwsize = MAX_PATH;
HMODULE hModule = GetModuleHandle(NULL);
HMODULE hModule = GetModuleHandle(nullptr);
if (hModule != NULL)
if (hModule != nullptr)
{
if (GetModuleFileNameA(hModule, ownPth, MAX_PATH) == ERROR)
{
@ -45,7 +45,7 @@ namespace Components
else
{
char* endPtr = strstr(workdir, "iw4x.exe");
if (endPtr != NULL)
if (endPtr != nullptr)
{
*endPtr = 0;
}
@ -68,7 +68,7 @@ namespace Components
char regred[MAX_PATH] = { 0 };
// Check if the game has been moved.
openRes = RegQueryValueExA(hKey, 0, 0, 0, reinterpret_cast<BYTE*>(regred), &dwsize);
openRes = RegQueryValueExA(hKey, nullptr, 0, 0, reinterpret_cast<BYTE*>(regred), &dwsize);
if (openRes == ERROR_SUCCESS)
{
char* endPtr = strstr(regred, "\" \"%1\"");
@ -84,7 +84,7 @@ namespace Components
RegCloseKey(hKey);
if (strcmp(regred + 1, ownPth))
{
openRes = RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
}
else
{
@ -93,12 +93,12 @@ namespace Components
}
else
{
openRes = RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
}
}
else
{
openRes = RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
}
// Open SOFTWARE\\Classes

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class ConnectProtocol : public Component
@ -6,7 +8,7 @@ namespace Components
ConnectProtocol();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "ConnectProtocol"; };
const char* getName() override { return "ConnectProtocol"; };
#endif
static bool IsEvaluated();

View File

@ -1,3 +1,5 @@
#pragma once
#define OUTPUT_HEIGHT 250
#define OUTPUT_MAX_TOP (OUTPUT_HEIGHT - (Console::Height - 2))
@ -10,7 +12,7 @@ namespace Components
~Console();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Console"; };
const char* getName() override { return "Console"; };
#endif
static void SetSkipShutdown();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class D3D9Ex : public Component
@ -6,7 +8,7 @@ namespace Components
D3D9Ex();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "D3D9Ex"; };
const char* getName() override { return "D3D9Ex"; };
#endif
private:

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Dedicated : public Component
@ -9,7 +11,7 @@ namespace Components
~Dedicated();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Dedicated"; };
const char* getName() override { return "Dedicated"; };
#endif
static bool IsEnabled();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Discovery : public Component
@ -7,7 +9,7 @@ namespace Components
~Discovery();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Discovery"; };
const char* getName() override { return "Discovery"; };
#endif
static void Perform();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Download : public Component
@ -7,7 +9,7 @@ namespace Components
~Download();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Download"; };
const char* getName() override { return "Download"; };
#endif
static void InitiateClientDownload(std::string mod);
@ -16,7 +18,7 @@ namespace Components
class ClientDownload
{
public:
ClientDownload() : valid(false), running(false), terminateThread(false), totalBytes(0), downBytes(0), lastTimeStamp(0), timeStampBytes(0) {}
ClientDownload() : running(false), valid(false), terminateThread(false), totalBytes(0), downBytes(0), lastTimeStamp(0), timeStampBytes(0) {}
~ClientDownload() { this->clear(); }
bool running;

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Dvar : public Component
@ -43,7 +45,7 @@ namespace Components
~Dvar();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Dvar"; };
const char* getName() override { return "Dvar"; };
#endif
static void OnInit(Utils::Slot<Callback> callback);

View File

@ -1,4 +1,4 @@
#pragma once
namespace Components
{
@ -9,7 +9,7 @@ namespace Components
~Exception();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Exception"; };
const char* getName() override { return "Exception"; };
#endif
static LPTOP_LEVEL_EXCEPTION_FILTER Hook();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class FastFiles : public Component
@ -7,7 +9,7 @@ namespace Components
~FastFiles();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "FastFiles"; };
const char* getName() override { return "FastFiles"; };
#endif
static void AddZonePath(std::string path);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class FileSystem : public Component
@ -19,9 +21,9 @@ namespace Components
File() {};
File(std::string file) : filePath(file) { this->read(); };
bool exists() { return !this->buffer.empty(); };
std::string getName() { return this->filePath; };
std::string& getBuffer() { return this->buffer; };
bool exists() override { return !this->buffer.empty(); };
std::string getName() override { return this->filePath; };
std::string& getBuffer() override { return this->buffer; };
private:
std::string filePath;
@ -36,9 +38,9 @@ namespace Components
RawFile() {};
RawFile(std::string file) : filePath(file) { this->read(); };
bool exists() { return !this->buffer.empty(); };
std::string getName() { return this->filePath; };
std::string& getBuffer() { return this->buffer; };
bool exists() override { return !this->buffer.empty(); };
std::string getName() override { return this->filePath; };
std::string& getBuffer() override { return this->buffer; };
private:
std::string filePath;
@ -87,7 +89,7 @@ namespace Components
~FileSystem();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "FileSystem"; };
const char* getName() override { return "FileSystem"; };
#endif
static std::vector<std::string> GetFileList(std::string path, std::string extension);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Flags : public Component
@ -7,7 +9,7 @@ namespace Components
~Flags();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Flags"; };
const char* getName() override { return "Flags"; };
#endif
static bool HasFlag(std::string flag);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class FrameTime : public Component
@ -6,7 +8,7 @@ namespace Components
FrameTime();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "FrameTime"; };
const char* getName() override { return "FrameTime"; };
#endif
private:

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Gametypes : public Component
@ -6,7 +8,7 @@ namespace Components
Gametypes();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Gametypes"; };
const char* getName() override { return "Gametypes"; };
#endif
private:

View File

@ -7,7 +7,7 @@ namespace Components
#pragma region Pipe
Pipe::Pipe() : type(IPCTYPE_NONE), reconnectAttempt(0), pipe(INVALID_HANDLE_VALUE), connectCallback(0), threadAttached(false)
Pipe::Pipe() : connectCallback(0), pipe(INVALID_HANDLE_VALUE), threadAttached(false), type(IPCTYPE_NONE), reconnectAttempt(0)
{
this->destroy();
}

View File

@ -1,3 +1,5 @@
#pragma once
#define IPC_MAX_RECONNECTS 3
#define IPC_COMMAND_SIZE 100
#define IPC_BUFFER_SIZE 0x2000
@ -63,7 +65,7 @@ namespace Components
IPCPipe();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "IPCPipe"; };
const char* getName() override { return "IPCPipe"; };
#endif
static bool Write(std::string command, std::string data);

View File

@ -1,3 +1,5 @@
#pragma once
#define BUTTON_FLAG_LEANLEFT 0x40
#define BUTTON_FLAG_LEANRIGHT 0x80
@ -9,7 +11,7 @@ namespace Components
Lean();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Lean"; };
const char* getName() override { return "Lean"; };
#endif
private:

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Localization : public Component
@ -7,7 +9,7 @@ namespace Components
~Localization();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Localization"; };
const char* getName() override { return "Localization"; };
#endif
static void Set(std::string key, std::string value);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Logger : public Component
@ -7,7 +9,7 @@ namespace Components
~Logger();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Logger"; };
const char* getName() override { return "Logger"; };
#endif
static void MessagePrint(int channel, std::string message);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Maps : public Component
@ -7,7 +9,7 @@ namespace Components
~Maps();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Maps"; };
const char* getName() override { return "Maps"; };
#endif
static void HandleAsSPMap();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Materials : public Component
@ -7,7 +9,7 @@ namespace Components
~Materials();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Materials"; };
const char* getName() override { return "Materials"; };
#endif
static int FormatImagePath(char* buffer, size_t size, int, int, const char* image);

View File

@ -1,3 +1,5 @@
#pragma once
#define MAX_SOURCEFILES 64
#undef LoadMenu
@ -10,7 +12,7 @@ namespace Components
~Menus();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Menus"; };
const char* getName() override { return "Menus"; };
#endif
static void FreeEverything();

View File

@ -37,7 +37,7 @@ namespace Components
{
public:
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "MinidumpUpload"; };
const char* getName() override { return "MinidumpUpload"; };
#endif
MinidumpUpload();
~MinidumpUpload();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class ModList : public Component
@ -7,7 +9,7 @@ namespace Components
~ModList();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "ModList"; };
const char* getName() override { return "ModList"; };
#endif
static void RunMod(std::string mod);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class ModelSurfs : public Component
@ -7,7 +9,7 @@ namespace Components
~ModelSurfs();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "ModelSurfs"; };
const char* getName() override { return "ModelSurfs"; };
#endif
private:

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class MusicalTalent : public Component
@ -7,7 +9,7 @@ namespace Components
~MusicalTalent();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "MusicalTalent"; };
const char* getName() override { return "MusicalTalent"; };
#endif
static void Replace(std::string sound, const char* file);

View File

@ -1,3 +1,5 @@
#pragma once
#define NETWORK_MAX_PACKETS_PER_SECOND 100'000
namespace Components
@ -57,7 +59,7 @@ namespace Components
~Network();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Network"; };
const char* getName() override { return "Network"; };
#endif
static void Handle(std::string packet, Utils::Slot<Callback> callback);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class News : public Component
@ -7,10 +9,10 @@ namespace Components
~News();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "News"; };
const char* getName() override { return "News"; };
#endif
bool unitTest();
bool unitTest() override;
private:
static std::thread Thread;

View File

@ -1,3 +1,5 @@
#pragma once
#define NODE_QUERY_INTERVAL 1000 * 60 * 2 // Query nodelist from nodes evry 2 minutes
#define NODE_QUERY_TIMEOUT 1000 * 30 * 1 // Invalidate nodes after 30 seconds without query response
#define NODE_INVALID_DELETE 1000 * 60 * 10 // Delete invalidated nodes after 10 minutes
@ -18,10 +20,10 @@ namespace Components
~Node();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Node"; };
const char* getName() override { return "Node"; };
#endif
bool unitTest();
bool unitTest() override;
static void SyncNodeList();
static void AddNode(Network::Address address);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class Party : public Component
@ -7,7 +9,7 @@ namespace Components
~Party();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Party"; };
const char* getName() override { return "Party"; };
#endif
static Network::Address Target();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components
{
class PlayerName : public Component
@ -7,7 +9,7 @@ namespace Components
~PlayerName();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "PlayerName"; };
const char* getName() override { return "PlayerName"; };
#endif
private:

Some files were not shown because too many files have changed in this diff Show More