Remove unnecessary includes and fix steamauth exploit

This commit is contained in:
momo5502 2016-07-22 12:12:11 +02:00
parent 23571e899c
commit b2a9e7af81
30 changed files with 957 additions and 953 deletions

2
deps/fmt vendored

@ -1 +1 @@
Subproject commit 0d5ef5c2a66026409b0cfbafa1d2f46cdc5aa4d0 Subproject commit d5893c9a133382e1862c929c1d50ccaef2a6d2fc

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit 68dd8d277d7b5bb26daf04f08bef3030ad2d7725 Subproject commit b987df197436b8581a7a5a9e00c1d341f81fdb30

2
deps/protobuf vendored

@ -1 +1 @@
Subproject commit 042993b3dd8c52f979870c91ea7fcbcf0dcf94a0 Subproject commit 2ba058c66c10781d57a332987be23e3fed0f9e1c

View File

@ -101,9 +101,9 @@ namespace Components
static uint8_t loadLibAStr[] = { 0xB3, 0x90, 0x9E, 0x9B, 0xB3, 0x96, 0x9D, 0x8D, 0x9E, 0x8D, 0x86, 0xBE }; // LoadLibraryA static uint8_t loadLibAStr[] = { 0xB3, 0x90, 0x9E, 0x9B, 0xB3, 0x96, 0x9D, 0x8D, 0x9E, 0x8D, 0x86, 0xBE }; // LoadLibraryA
static uint8_t loadLibWStr[] = { 0xB3, 0x90, 0x9E, 0x9B, 0xB3, 0x96, 0x9D, 0x8D, 0x9E, 0x8D, 0x86, 0xA8 }; // LoadLibraryW static uint8_t loadLibWStr[] = { 0xB3, 0x90, 0x9E, 0x9B, 0xB3, 0x96, 0x9D, 0x8D, 0x9E, 0x8D, 0x86, 0xA8 }; // LoadLibraryW
HMODULE kernel32 = GetModuleHandleA(Utils::String::XORString(std::string(reinterpret_cast<char*>(kernel32Str), sizeof kernel32Str), -1).data()); HMODULE kernel32 = GetModuleHandleA(Utils::String::XOR(std::string(reinterpret_cast<char*>(kernel32Str), sizeof kernel32Str), -1).data());
FARPROC loadLibA = GetProcAddress(kernel32, Utils::String::XORString(std::string(reinterpret_cast<char*>(loadLibAStr), sizeof loadLibAStr), -1).data()); FARPROC loadLibA = GetProcAddress(kernel32, Utils::String::XOR(std::string(reinterpret_cast<char*>(loadLibAStr), sizeof loadLibAStr), -1).data());
FARPROC loadLibW = GetProcAddress(kernel32, Utils::String::XORString(std::string(reinterpret_cast<char*>(loadLibWStr), sizeof loadLibWStr), -1).data()); FARPROC loadLibW = GetProcAddress(kernel32, Utils::String::XOR(std::string(reinterpret_cast<char*>(loadLibWStr), sizeof loadLibWStr), -1).data());
AntiCheat::LoadLibHook[0].Initialize(loadLibA, loadLibStub, HOOK_JUMP); AntiCheat::LoadLibHook[0].Initialize(loadLibA, loadLibStub, HOOK_JUMP);
AntiCheat::LoadLibHook[1].Initialize(loadLibW, loadLibStub, HOOK_JUMP); AntiCheat::LoadLibHook[1].Initialize(loadLibW, loadLibStub, HOOK_JUMP);

View File

@ -145,7 +145,7 @@ namespace Components
void Auth::StoreKey() void Auth::StoreKey()
{ {
if (!Dedicated::IsDedicated() && !ZoneBuilder::IsEnabled()) if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled())
{ {
Proto::Auth::Certificate cert; Proto::Auth::Certificate cert;
cert.set_token(Auth::GuidToken.ToString()); cert.set_token(Auth::GuidToken.ToString());
@ -158,7 +158,7 @@ namespace Components
void Auth::LoadKey(bool force) void Auth::LoadKey(bool force)
{ {
if (Dedicated::IsDedicated() || ZoneBuilder::IsEnabled()) return; if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled()) return;
if (!force && Auth::GuidKey.IsValid()) return; if (!force && Auth::GuidKey.IsValid()) return;
Proto::Auth::Certificate cert; Proto::Auth::Certificate cert;
@ -292,7 +292,7 @@ namespace Components
Auth::LoadKey(true); Auth::LoadKey(true);
// Only clients receive the auth request // Only clients receive the auth request
if (!Dedicated::IsDedicated()) if (!Dedicated::IsEnabled())
{ {
Network::Handle("xuidAuthReq", [] (Network::Address address, std::string data) Network::Handle("xuidAuthReq", [] (Network::Address address, std::string data)
{ {

View File

@ -34,7 +34,7 @@ namespace Components
void Command::Add(const char* name, Command::Callback* callback) void Command::Add(const char* name, Command::Callback* callback)
{ {
std::string command = Utils::String::StrToLower(name); std::string command = Utils::String::ToLower(name);
if (Command::FunctionMap.find(command) == Command::FunctionMap.end()) if (Command::FunctionMap.find(command) == Command::FunctionMap.end())
{ {
@ -46,7 +46,7 @@ namespace Components
void Command::AddSV(const char* name, Command::Callback* callback) void Command::AddSV(const char* name, Command::Callback* callback)
{ {
std::string command = Utils::String::StrToLower(name); std::string command = Utils::String::ToLower(name);
if (Command::FunctionMapSV.find(command) == Command::FunctionMapSV.end()) if (Command::FunctionMapSV.find(command) == Command::FunctionMapSV.end())
{ {
@ -98,7 +98,7 @@ namespace Components
{ {
Command::Params params(false, *Game::cmd_id); Command::Params params(false, *Game::cmd_id);
std::string command = Utils::String::StrToLower(params[0]); std::string command = Utils::String::ToLower(params[0]);
if (Command::FunctionMap.find(command) != Command::FunctionMap.end()) if (Command::FunctionMap.find(command) != Command::FunctionMap.end())
{ {
@ -110,7 +110,7 @@ namespace Components
{ {
Command::Params params(true, *Game::cmd_id_sv); Command::Params params(true, *Game::cmd_id_sv);
std::string command = Utils::String::StrToLower(params[0]); std::string command = Utils::String::ToLower(params[0]);
if (Command::FunctionMapSV.find(command) != Command::FunctionMapSV.end()) if (Command::FunctionMapSV.find(command) != Command::FunctionMapSV.end())
{ {

View File

@ -523,7 +523,7 @@ namespace Components
Console::LastRefresh = Game::Sys_Milliseconds(); Console::LastRefresh = Game::Sys_Milliseconds();
}); });
} }
else if (Dedicated::IsDedicated()/* || ZoneBuilder::IsEnabled()*/) else if (Dedicated::IsEnabled()/* || ZoneBuilder::IsEnabled()*/)
{ {
Utils::Hook::Nop(0x60BB58, 11); Utils::Hook::Nop(0x60BB58, 11);

View File

@ -7,7 +7,7 @@ namespace Components
bool Dedicated::SendChat; bool Dedicated::SendChat;
bool Dedicated::IsDedicated() bool Dedicated::IsEnabled()
{ {
return Flags::HasFlag("dedicated"); return Flags::HasFlag("dedicated");
} }
@ -118,7 +118,7 @@ namespace Components
void Dedicated::MapRotate() void Dedicated::MapRotate()
{ {
if (!Dedicated::IsDedicated() && Dvar::Var("sv_dontrotate").Get<bool>()) if (!Dedicated::IsEnabled() && Dvar::Var("sv_dontrotate").Get<bool>())
{ {
Dvar::Var("sv_dontrotate").SetRaw(0); Dvar::Var("sv_dontrotate").SetRaw(0);
return; return;
@ -226,7 +226,7 @@ namespace Components
Utils::Hook::Set(0x4152E8, Dedicated::MapRotate); Utils::Hook::Set(0x4152E8, Dedicated::MapRotate);
Dvar::Register<bool>("sv_dontrotate", false, Game::dvar_flag::DVAR_FLAG_CHEAT, ""); Dvar::Register<bool>("sv_dontrotate", false, Game::dvar_flag::DVAR_FLAG_CHEAT, "");
if (Dedicated::IsDedicated() || ZoneBuilder::IsEnabled()) // Run zonebuilder as dedi :P if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled()) // Run zonebuilder as dedi :P
{ {
Dvar::Register<bool>("sv_lanOnly", false, Game::dvar_flag::DVAR_FLAG_NONE, "Don't act as node"); Dvar::Register<bool>("sv_lanOnly", false, Game::dvar_flag::DVAR_FLAG_NONE, "Don't act as node");

View File

@ -9,7 +9,7 @@ namespace Components
~Dedicated(); ~Dedicated();
const char* GetName() { return "Dedicated"; }; const char* GetName() { return "Dedicated"; };
static bool IsDedicated(); static bool IsEnabled();
static void Heartbeat(); static void Heartbeat();

View File

@ -285,7 +285,7 @@ namespace Components
Download::Download() Download::Download()
{ {
if (Dedicated::IsDedicated()) if (Dedicated::IsEnabled())
{ {
mg_mgr_init(&Download::Mgr, NULL); mg_mgr_init(&Download::Mgr, NULL);
@ -319,7 +319,7 @@ namespace Components
Download::~Download() Download::~Download()
{ {
if (Dedicated::IsDedicated()) if (Dedicated::IsEnabled())
{ {
mg_mgr_free(&Download::Mgr); mg_mgr_free(&Download::Mgr);
} }

View File

@ -8,7 +8,7 @@ namespace Components
{ {
for (auto entry : Flags::EnabledFlags) for (auto entry : Flags::EnabledFlags)
{ {
if (Utils::String::StrToLower(entry) == Utils::String::StrToLower(flag)) if (Utils::String::ToLower(entry) == Utils::String::ToLower(flag))
{ {
return true; return true;
} }

View File

@ -208,7 +208,7 @@ namespace Components
IPCPipe::IPCPipe() IPCPipe::IPCPipe()
{ {
if (Dedicated::IsDedicated()) return; if (Dedicated::IsEnabled()) return;
// Server pipe // Server pipe
IPCPipe::ServerPipe = new Pipe(); IPCPipe::ServerPipe = new Pipe();

View File

@ -8,7 +8,7 @@ namespace Components
bool Logger::IsConsoleReady() bool Logger::IsConsoleReady()
{ {
return (IsWindow(*reinterpret_cast<HWND*>(0x64A3288)) != FALSE || (Dedicated::IsDedicated() && !Flags::HasFlag("console"))); return (IsWindow(*reinterpret_cast<HWND*>(0x64A3288)) != FALSE || (Dedicated::IsEnabled() && !Flags::HasFlag("console")));
} }
void Logger::Print(const char* message, ...) void Logger::Print(const char* message, ...)

View File

@ -609,7 +609,7 @@ namespace Components
Menus::Menus() Menus::Menus()
{ {
if (Dedicated::IsDedicated()) return; if (Dedicated::IsEnabled()) return;
// Ensure everything is zero'ed // Ensure everything is zero'ed
Menus::FreeEverything(); Menus::FreeEverything();

View File

@ -6,14 +6,14 @@ namespace Components
void MusicalTalent::Replace(std::string sound, const char* file) void MusicalTalent::Replace(std::string sound, const char* file)
{ {
MusicalTalent::SoundAliasList[Utils::String::StrToLower(sound)] = file; MusicalTalent::SoundAliasList[Utils::String::ToLower(sound)] = file;
} }
Game::XAssetHeader MusicalTalent::ModifyAliases(Game::XAssetType type, std::string filename) Game::XAssetHeader MusicalTalent::ModifyAliases(Game::XAssetType type, std::string filename)
{ {
Game::XAssetHeader header = { 0 }; Game::XAssetHeader header = { 0 };
if (MusicalTalent::SoundAliasList.find(Utils::String::StrToLower(filename)) != MusicalTalent::SoundAliasList.end()) if (MusicalTalent::SoundAliasList.find(Utils::String::ToLower(filename)) != MusicalTalent::SoundAliasList.end())
{ {
Game::snd_alias_list_t* aliases = Game::DB_FindXAssetHeader(type, filename.data()).aliasList; Game::snd_alias_list_t* aliases = Game::DB_FindXAssetHeader(type, filename.data()).aliasList;
@ -21,7 +21,7 @@ namespace Components
{ {
if (aliases->aliases->stream->type == 2) if (aliases->aliases->stream->type == 2)
{ {
aliases->aliases->stream->file = MusicalTalent::SoundAliasList[Utils::String::StrToLower(filename)]; aliases->aliases->stream->file = MusicalTalent::SoundAliasList[Utils::String::ToLower(filename)];
} }
header.aliasList = aliases; header.aliasList = aliases;
@ -33,6 +33,8 @@ namespace Components
MusicalTalent::MusicalTalent() MusicalTalent::MusicalTalent()
{ {
if (ZoneBuilder::IsEnabled()) return;
AssetHandler::OnFind(Game::XAssetType::ASSET_TYPE_SOUND, MusicalTalent::ModifyAliases); AssetHandler::OnFind(Game::XAssetType::ASSET_TYPE_SOUND, MusicalTalent::ModifyAliases);
MusicalTalent::Replace("music_mainmenu_mp", "hz_t_menumusic.mp3"); MusicalTalent::Replace("music_mainmenu_mp", "hz_t_menumusic.mp3");

View File

@ -125,7 +125,7 @@ namespace Components
void Network::Handle(std::string packet, Network::Callback* callback) void Network::Handle(std::string packet, Network::Callback* callback)
{ {
Network::PacketHandlers[Utils::String::StrToLower(packet)] = callback; Network::PacketHandlers[Utils::String::ToLower(packet)] = callback;
} }
void Network::OnStart(Network::CallbackRaw* callback) void Network::OnStart(Network::CallbackRaw* callback)
@ -228,12 +228,12 @@ namespace Components
packetCommand = packetCommand.substr(0, pos); packetCommand = packetCommand.substr(0, pos);
} }
packetCommand = Utils::String::StrToLower(packetCommand); packetCommand = Utils::String::ToLower(packetCommand);
// Check if custom handler exists // Check if custom handler exists
for (auto i = Network::PacketHandlers.begin(); i != Network::PacketHandlers.end(); ++i) for (auto i = Network::PacketHandlers.begin(); i != Network::PacketHandlers.end(); ++i)
{ {
if (Utils::String::StrToLower(i->first) == packetCommand) if (Utils::String::ToLower(i->first) == packetCommand)
{ {
Network::SelectedPacket = i->first; Network::SelectedPacket = i->first;
return 0; return 0;

View File

@ -37,7 +37,7 @@ namespace Components
} }
void Node::StoreNodes(bool force) void Node::StoreNodes(bool force)
{ {
if (Dedicated::IsDedicated() && Dvar::Var("sv_lanOnly").Get<bool>()) return; if (Dedicated::IsEnabled() && Dvar::Var("sv_lanOnly").Get<bool>()) return;
static int lastStorage = 0; static int lastStorage = 0;
@ -141,7 +141,7 @@ namespace Components
if (address.IsSelf()) return; if (address.IsSelf()) return;
Proto::Node::List list; Proto::Node::List list;
list.set_is_dedi(Dedicated::IsDedicated()); list.set_is_dedi(Dedicated::IsEnabled());
list.set_protocol(PROTOCOL); list.set_protocol(PROTOCOL);
list.set_version(NODE_VERSION); list.set_version(NODE_VERSION);
@ -222,7 +222,7 @@ namespace Components
entry->lastTime = Game::Sys_Milliseconds(); entry->lastTime = Game::Sys_Milliseconds();
if (Dedicated::IsDedicated()) if (Dedicated::IsEnabled())
{ {
entry->challenge = fmt::sprintf("%X", Utils::Cryptography::Rand::GenerateInt()); entry->challenge = fmt::sprintf("%X", Utils::Cryptography::Rand::GenerateInt());
@ -245,7 +245,7 @@ namespace Components
void Node::FrameHandler() void Node::FrameHandler()
{ {
if (Dedicated::IsDedicated() && Dvar::Var("sv_lanOnly").Get<bool>()) return; if (Dedicated::IsEnabled() && Dvar::Var("sv_lanOnly").Get<bool>()) return;
// Frame limit // Frame limit
static int lastFrame = 0; static int lastFrame = 0;
@ -302,7 +302,7 @@ namespace Components
node.lastTime = Game::Sys_Milliseconds(); node.lastTime = Game::Sys_Milliseconds();
node.lastListQuery = Game::Sys_Milliseconds(); node.lastListQuery = Game::Sys_Milliseconds();
if (Dedicated::IsDedicated()) if (Dedicated::IsEnabled())
{ {
Network::SendCommand(node.address, "nodeListRequest"); Network::SendCommand(node.address, "nodeListRequest");
} }
@ -361,7 +361,7 @@ namespace Components
}); });
// Send deadline when shutting down // Send deadline when shutting down
if (Dedicated::IsDedicated()) if (Dedicated::IsEnabled())
{ {
QuickPatch::OnShutdown([] () QuickPatch::OnShutdown([] ()
{ {
@ -692,7 +692,7 @@ namespace Components
entry->state = Node::STATE_VALID; entry->state = Node::STATE_VALID;
entry->lastTime = Game::Sys_Milliseconds(); entry->lastTime = Game::Sys_Milliseconds();
if (!Dedicated::IsDedicated() && entry->isDedi && ServerList::IsOnlineList() && entry->protocol == PROTOCOL) if (!Dedicated::IsEnabled() && entry->isDedi && ServerList::IsOnlineList() && entry->protocol == PROTOCOL)
{ {
ServerList::InsertRequest(entry->address, true); ServerList::InsertRequest(entry->address, true);
} }
@ -739,7 +739,7 @@ namespace Components
// So we either have to register as node, or register a remote session // So we either have to register as node, or register a remote session
Network::Handle("nodeListError", [] (Network::Address address, std::string data) Network::Handle("nodeListError", [] (Network::Address address, std::string data)
{ {
if (Dedicated::IsDedicated()) if (Dedicated::IsEnabled())
{ {
Node::NodeEntry* entry = Node::FindNode(address); Node::NodeEntry* entry = Node::FindNode(address);
if (entry) if (entry)

View File

@ -115,7 +115,7 @@ namespace Components
Party::Party() Party::Party()
{ {
static Game::dvar_t* partyEnable = Dvar::Register<bool>("party_enable", Dedicated::IsDedicated(), Game::dvar_flag::DVAR_FLAG_NONE, "Enable party system").Get<Game::dvar_t*>(); static Game::dvar_t* partyEnable = Dvar::Register<bool>("party_enable", Dedicated::IsEnabled(), Game::dvar_flag::DVAR_FLAG_NONE, "Enable party system").Get<Game::dvar_t*>();
Dvar::Register<bool>("xblive_privatematch", true, Game::dvar_flag::DVAR_FLAG_WRITEPROTECTED, "").Get<Game::dvar_t*>(); Dvar::Register<bool>("xblive_privatematch", true, Game::dvar_flag::DVAR_FLAG_WRITEPROTECTED, "").Get<Game::dvar_t*>();
// various changes to SV_DirectConnect-y stuff to allow non-party joinees // various changes to SV_DirectConnect-y stuff to allow non-party joinees

View File

@ -11,7 +11,7 @@ namespace Components
if (Utils::Hook::Get<bool>(0x1AD3680)) return; if (Utils::Hook::Get<bool>(0x1AD3680)) return;
// Don't load playlists when dedi and no party // Don't load playlists when dedi and no party
if (Dedicated::IsDedicated() && !Dvar::Var("party_enable").Get<bool>()) if (Dedicated::IsEnabled() && !Dvar::Var("party_enable").Get<bool>())
{ {
Utils::Hook::Set<bool>(0x1AD3680, true); // Set received to true Utils::Hook::Set<bool>(0x1AD3680, true); // Set received to true
Dvar::Var("xblive_privateserver").Set(true); Dvar::Var("xblive_privateserver").Set(true);

View File

@ -23,7 +23,7 @@ namespace Components
void QuickPatch::OnFrame(QuickPatch::Callback* callback) void QuickPatch::OnFrame(QuickPatch::Callback* callback)
{ {
if (Dedicated::IsDedicated() || ZoneBuilder::IsEnabled()) if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled())
{ {
Dedicated::OnFrame(callback); Dedicated::OnFrame(callback);
} }
@ -35,7 +35,7 @@ namespace Components
void QuickPatch::Once(QuickPatch::Callback* callback) void QuickPatch::Once(QuickPatch::Callback* callback)
{ {
if (Dedicated::IsDedicated() || ZoneBuilder::IsEnabled()) if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled())
{ {
Dedicated::Once(callback); Dedicated::Once(callback);
} }
@ -157,7 +157,7 @@ namespace Components
{ {
Utils::Hook::Set<char*>(0x4289E8, "IW4x (r" REVISION_STR REVISION_SUFFIX "): ZoneBuilder"); Utils::Hook::Set<char*>(0x4289E8, "IW4x (r" REVISION_STR REVISION_SUFFIX "): ZoneBuilder");
} }
else if (Dedicated::IsDedicated()) else if (Dedicated::IsEnabled())
{ {
Utils::Hook::Set<char*>(0x4289E8, "IW4x (r" REVISION_STR REVISION_SUFFIX "): Dedicated"); Utils::Hook::Set<char*>(0x4289E8, "IW4x (r" REVISION_STR REVISION_SUFFIX "): Dedicated");
} }
@ -322,8 +322,9 @@ namespace Components
//Utils::Hook::Set<BYTE>(0x68323A, 0xEB); //Utils::Hook::Set<BYTE>(0x68323A, 0xEB);
// Exploit fixes // Exploit fixes
Utils::Hook(0x414D92, QuickPatch::MsgReadBitsCompressCheckSV, HOOK_CALL).Install()->Quick(); Utils::Hook::Set<BYTE>(0x412370, 0xC3); // SV_SteamAuthClient
Utils::Hook(0x4A9F56, QuickPatch::MsgReadBitsCompressCheckCL, HOOK_CALL).Install()->Quick(); Utils::Hook(0x414D92, QuickPatch::MsgReadBitsCompressCheckSV, HOOK_CALL).Install()->Quick(); // SV_ExecuteClientCommands
Utils::Hook(0x4A9F56, QuickPatch::MsgReadBitsCompressCheckCL, HOOK_CALL).Install()->Quick(); // CL_ParseServerMessage
Command::Add("unlockstats", [] (Command::Params params) Command::Add("unlockstats", [] (Command::Params params)
{ {

View File

@ -46,7 +46,7 @@ namespace Components
}); });
// TODO: Maybe execute that for clients as well, when we use triangular natting. // TODO: Maybe execute that for clients as well, when we use triangular natting.
if (!Dedicated::IsDedicated()) return; if (!Dedicated::IsEnabled()) return;
// Load public key // Load public key
static uint8_t publicKey[] = static uint8_t publicKey[] =

View File

@ -17,7 +17,7 @@ namespace Components
ExitProcess(0); ExitProcess(0);
} }
if (Dedicated::IsDedicated() || ZoneBuilder::IsEnabled()) return; if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled()) return;
Singleton::FirstInstance = (CreateMutexA(NULL, FALSE, "iw4x_mutex") && GetLastError() != ERROR_ALREADY_EXISTS); Singleton::FirstInstance = (CreateMutexA(NULL, FALSE, "iw4x_mutex") && GetLastError() != ERROR_ALREADY_EXISTS);

View File

@ -366,7 +366,7 @@ namespace Components
UIFeeder::Add(10.0f, Theatre::GetDemoCount, Theatre::GetDemoText, Theatre::SelectDemo); UIFeeder::Add(10.0f, Theatre::GetDemoCount, Theatre::GetDemoText, Theatre::SelectDemo);
// set the configstrings stuff to load the default (empty) string table; this should allow demo recording on all gametypes/maps // set the configstrings stuff to load the default (empty) string table; this should allow demo recording on all gametypes/maps
if(!Dedicated::IsDedicated()) Utils::Hook::Set<char*>(0x47440B, "mp/defaultStringTable.csv"); if(!Dedicated::IsEnabled()) Utils::Hook::Set<char*>(0x47440B, "mp/defaultStringTable.csv");
// Change font size // Change font size
Utils::Hook::Set<BYTE>(0x5AC854, 2); Utils::Hook::Set<BYTE>(0x5AC854, 2);

View File

@ -95,7 +95,7 @@ namespace Components
// Text // Text
float leftText = width / 2 - bWidth / 2 - cornerSize + iOffsetLeft * 2 + imgDim; float leftText = width / 2 - bWidth / 2 - cornerSize + iOffsetLeft * 2 + imgDim;
float rightText = width / 2 + bWidth / 2 - cornerSize - iOffsetLeft; float rightText = width / 2 + bWidth / 2 - cornerSize - iOffsetLeft;
Game::R_AddCmdDrawText(Utils::String::StrToUpper(toast->Title).data(), 0x7FFFFFFF, font, static_cast<float>(leftText + (rightText - leftText) / 2 - titleSize / 2 + cornerSize), static_cast<float>(height - bHeight / 2 + cornerSize * 2 + 7), fontSize, fontSize, 0, wColor, Game::ITEM_TEXTSTYLE_SHADOWED); // Title Game::R_AddCmdDrawText(Utils::String::ToUpper(toast->Title).data(), 0x7FFFFFFF, font, static_cast<float>(leftText + (rightText - leftText) / 2 - titleSize / 2 + cornerSize), static_cast<float>(height - bHeight / 2 + cornerSize * 2 + 7), fontSize, fontSize, 0, wColor, Game::ITEM_TEXTSTYLE_SHADOWED); // Title
Game::R_AddCmdDrawText(toast->Desc.data(), 0x7FFFFFFF, descfont, leftText + (rightText - leftText) / 2 - descrSize / 2 + cornerSize, static_cast<float>(height - bHeight / 2 + cornerSize * 2 + 33), descSize, descSize, 0, wColor, Game::ITEM_TEXTSTYLE_SHADOWED); // Description Game::R_AddCmdDrawText(toast->Desc.data(), 0x7FFFFFFF, descfont, leftText + (rightText - leftText) / 2 - descrSize / 2 + cornerSize, static_cast<float>(height - bHeight / 2 + cornerSize * 2 + 33), descSize, descSize, 0, wColor, Game::ITEM_TEXTSTYLE_SHADOWED); // Description
} }

View File

@ -441,7 +441,7 @@ namespace Components
bool ZoneBuilder::IsEnabled() bool ZoneBuilder::IsEnabled()
{ {
return (Flags::HasFlag("zonebuilder") && !Dedicated::IsDedicated()); return (Flags::HasFlag("zonebuilder") && !Dedicated::IsEnabled());
} }
void ZoneBuilder::BeginAssetTrace(std::string zone) void ZoneBuilder::BeginAssetTrace(std::string zone)

View File

@ -12,32 +12,32 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <stdio.h> //#include <stdio.h>
#include <string.h> //#include <string.h>
#include <wincrypt.h> //#include <wincrypt.h>
#include <time.h> //#include <time.h>
#include <timeapi.h> #include <timeapi.h>
#include <shellapi.h> #include <shellapi.h>
#include <shlwapi.h> //#include <shlwapi.h>
#include <WinSock2.h> //#include <WinSock2.h>
#include <Wininet.h> #include <Wininet.h>
#include <Urlmon.h> //#include <Urlmon.h>
#include <d3d9.h> #include <d3d9.h>
#include <map> //#include <map>
#include <mutex> //#include <mutex>
#include <string> //#include <string>
#include <vector> //#include <vector>
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
#include <utility> //#include <utility>
#include <algorithm> //#include <algorithm>
#include <functional> //#include <functional>
#include <cctype> #include <cctype>
#include <locale> //#include <locale>
#include <regex> #include <regex>
#include <thread> #include <thread>
#include <chrono> //#include <chrono>
#include <future> #include <future>
#include <queue> #include <queue>

View File

@ -20,7 +20,7 @@ namespace Steam
if (!subId) if (!subId)
{ {
if (Components::Dedicated::IsDedicated() || Components::ZoneBuilder::IsEnabled()) // Dedi guid if (Components::Dedicated::IsEnabled() || Components::ZoneBuilder::IsEnabled()) // Dedi guid
{ {
subId = ~0xDED1CA7E; subId = ~0xDED1CA7E;
} }

View File

@ -4,13 +4,13 @@ namespace Utils
{ {
namespace String namespace String
{ {
std::string StrToLower(std::string input) std::string ToLower(std::string input)
{ {
std::transform(input.begin(), input.end(), input.begin(), ::tolower); std::transform(input.begin(), input.end(), input.begin(), ::tolower);
return input; return input;
} }
std::string StrToUpper(std::string input) std::string ToUpper(std::string input)
{ {
std::transform(input.begin(), input.end(), input.begin(), ::toupper); std::transform(input.begin(), input.end(), input.begin(), ::toupper);
return input; return input;
@ -38,7 +38,7 @@ namespace Utils
return result; return result;
} }
std::string XORString(std::string str, char value) std::string XOR(std::string str, char value)
{ {
for (unsigned int i = 0; i < str.size(); ++i) for (unsigned int i = 0; i < str.size(); ++i)
{ {

View File

@ -19,8 +19,8 @@ namespace Utils
return buffer; return buffer;
} }
std::string StrToLower(std::string input); std::string ToLower(std::string input);
std::string StrToUpper(std::string input); std::string ToUpper(std::string input);
bool EndsWith(std::string haystack, std::string needle); bool EndsWith(std::string haystack, std::string needle);
std::vector<std::string> Explode(const std::string& str, char delim); std::vector<std::string> Explode(const std::string& str, char delim);
void Replace(std::string &string, std::string find, std::string replace); void Replace(std::string &string, std::string find, std::string replace);
@ -33,6 +33,6 @@ namespace Utils
std::string DumpHex(std::string data, std::string separator = " "); std::string DumpHex(std::string data, std::string separator = " ");
std::string XORString(std::string str, char value); std::string XOR(std::string str, char value);
} }
} }

View File

@ -1,4 +1,5 @@
#include "STDInclude.hpp" #include "STDInclude.hpp"
#include <shlwapi.h>
namespace Utils namespace Utils
{ {