[Scheduler]: Use enum class & more (#669)

This commit is contained in:
Edo 2022-12-26 13:07:24 +01:00 committed by GitHub
parent 0539fe3e24
commit f70c02b42e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 205 additions and 222 deletions

View File

@ -1,5 +1,55 @@
#include <STDInclude.hpp>
#include "Modules/Bans.hpp"
#include "Modules/Bots.hpp"
#include "Modules/Branding.hpp"
#include "Modules/Bullet.hpp"
#include "Modules/CardTitles.hpp"
#include "Modules/Ceg.hpp"
#include "Modules/Changelog.hpp"
#include "Modules/Chat.hpp"
#include "Modules/ClanTags.hpp"
#include "Modules/ClientCommand.hpp"
#include "Modules/ConnectProtocol.hpp"
#include "Modules/Console.hpp"
#include "Modules/D3D9Ex.hpp"
#include "Modules/Debug.hpp"
#include "Modules/Discovery.hpp"
#include "Modules/Download.hpp"
#include "Modules/Elevators.hpp"
#include "Modules/Gamepad.hpp"
#include "Modules/Lean.hpp"
#include "Modules/MapDump.hpp"
#include "Modules/MapRotation.hpp"
#include "Modules/NetworkDebug.hpp"
#include "Modules/News.hpp"
#include "Modules/PlayerMovement.hpp"
#include "Modules/PlayerName.hpp"
#include "Modules/Playlist.hpp"
#include "Modules/QuickPatch.hpp"
#include "Modules/RawFiles.hpp"
#include "Modules/RawMouse.hpp"
#include "Modules/RCon.hpp"
#include "Modules/Security.hpp"
#include "Modules/ServerCommands.hpp"
#include "Modules/ServerInfo.hpp"
#include "Modules/ServerList.hpp"
#include "Modules/Session.hpp"
#include "Modules/SlowMotion.hpp"
#include "Modules/SoundMutexFix.hpp"
#include "Modules/StartupMessages.hpp"
#include "Modules/Stats.hpp"
#include "Modules/StringTable.hpp"
#include "Modules/StructuredData.hpp"
#include "Modules/Theatre.hpp"
#include "Modules/Threading.hpp"
#include "Modules/UIFeeder.hpp"
#include "Modules/UserInfo.hpp"
#include "Modules/VisionFile.hpp"
#include "Modules/Voice.hpp"
#include "Modules/Vote.hpp"
#include "Modules/Weapon.hpp"
namespace Components
{
bool Loader::Pregame = true;
@ -65,7 +115,6 @@ namespace Components
Register(new FileSystem());
Register(new Friends());
Register(new Gamepad());
Register(new Gametypes());
Register(new IPCPipe());
Register(new Lean());
Register(new Localization());
@ -84,9 +133,9 @@ namespace Components
Register(new PlayerName());
Register(new Playlist());
Register(new QuickPatch());
Register(new RCon());
Register(new RawFiles());
Register(new RawMouse());
Register(new RCon());
Register(new Renderer());
Register(new Scheduler());
Register(new Security());

View File

@ -75,74 +75,24 @@ namespace Components
#include "Modules/ArenaLength.hpp"
#include "Modules/AssetHandler.hpp"
#include "Modules/Bans.hpp"
#include "Modules/Bots.hpp"
#include "Modules/Branding.hpp"
#include "Modules/Bullet.hpp"
#include "Modules/CardTitles.hpp"
#include "Modules/Ceg.hpp"
#include "Modules/Changelog.hpp"
#include "Modules/Chat.hpp"
#include "Modules/ClanTags.hpp"
#include "Modules/ClientCommand.hpp"
#include "Modules/ConnectProtocol.hpp"
#include "Modules/Console.hpp"
#include "Modules/D3D9Ex.hpp"
#include "Modules/Debug.hpp"
#include "Modules/Dedicated.hpp"
#include "Modules/Discovery.hpp"
#include "Modules/Download.hpp"
#include "Modules/Elevators.hpp"
#include "Modules/Events.hpp"
#include "Modules/FastFiles.hpp"
#include "Modules/FileSystem.hpp"
#include "Modules/Friends.hpp"
#include "Modules/Gamepad.hpp"
#include "Modules/Gametypes.hpp"
#include "Modules/IPCPipe.hpp"
#include "Modules/Lean.hpp"
#include "Modules/Localization.hpp"
#include "Modules/MapDump.hpp"
#include "Modules/MapRotation.hpp"
#include "Modules/Maps.hpp"
#include "Modules/Materials.hpp"
#include "Modules/Menus.hpp"
#include "Modules/ModList.hpp"
#include "Modules/ModelSurfs.hpp"
#include "Modules/NetworkDebug.hpp"
#include "Modules/News.hpp"
#include "Modules/Node.hpp"
#include "Modules/Party.hpp"
#include "Modules/PlayerMovement.hpp"
#include "Modules/PlayerName.hpp"
#include "Modules/Playlist.hpp"
#include "Modules/QuickPatch.hpp"
#include "Modules/RCon.hpp"
#include "Modules/RawFiles.hpp"
#include "Modules/RawMouse.hpp"
#include "Modules/Renderer.hpp"
#include "Modules/Scheduler.hpp"
#include "Modules/Security.hpp"
#include "Modules/ServerCommands.hpp"
#include "Modules/ServerInfo.hpp"
#include "Modules/ServerList.hpp"
#include "Modules/Session.hpp"
#include "Modules/SlowMotion.hpp"
#include "Modules/SoundMutexFix.hpp"
#include "Modules/StartupMessages.hpp"
#include "Modules/Stats.hpp"
#include "Modules/StringTable.hpp"
#include "Modules/StructuredData.hpp"
#include "Modules/TextRenderer.hpp"
#include "Modules/Theatre.hpp"
#include "Modules/Threading.hpp"
#include "Modules/Toast.hpp"
#include "Modules/UIFeeder.hpp"
#include "Modules/UserInfo.hpp"
#include "Modules/VisionFile.hpp"
#include "Modules/Voice.hpp"
#include "Modules/Vote.hpp"
#include "Modules/Weapon.hpp"
#include "Modules/Window.hpp"
#include "Modules/Zones.hpp"

View File

@ -1,4 +1,5 @@
#include <STDInclude.hpp>
#include "Weapon.hpp"
#include "AssetInterfaces/IFont_s.hpp"
#include "AssetInterfaces/IWeapon.hpp"

View File

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

View File

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

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "Bots.hpp"
#include "GSC/Script.hpp"
namespace Components

View File

@ -1,4 +1,5 @@
#include <STDInclude.hpp>
#include "Branding.hpp"
#include <version.hpp>

View File

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

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "CardTitles.hpp"
#include "ServerCommands.hpp"
namespace Components
{

View File

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

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "Changelog.hpp"
#include "UIFeeder.hpp"
namespace Components
{
@ -54,6 +56,6 @@ namespace Components
if (Dedicated::IsEnabled()) return;
// Changelog
UIFeeder::Add(62.0f, Changelog::GetChangelogCount, Changelog::GetChangelogText, Changelog::SelectChangelog);
UIFeeder::Add(62.0f, GetChangelogCount, GetChangelogText, SelectChangelog);
}
}

View File

@ -1,4 +1,8 @@
#include <STDInclude.hpp>
#include "Chat.hpp"
#include "PlayerName.hpp"
#include "Voice.hpp"
#include "GSC/Script.hpp"
namespace Components

View File

@ -1,4 +1,7 @@
#include <STDInclude.hpp>
#include "ClanTags.hpp"
#include "PlayerName.hpp"
#include "ServerCommands.hpp"
namespace Components
{

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "ClientCommand.hpp"
#include "GSC/Script.hpp"
using namespace Utils::String;

View File

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

View File

@ -1,4 +1,5 @@
#include <STDInclude.hpp>
#include "Console.hpp"
#include <version.hpp>

View File

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

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "Debug.hpp"
#include "Game/Engine/ScopedCriticalSection.hpp"
namespace Components
@ -6,7 +8,7 @@ namespace Components
const Game::dvar_t* Debug::DebugOverlay;
const Game::dvar_t* Debug::BugName;
Game::dvar_t** Debug::PlayerDebugHealth = reinterpret_cast<Game::dvar_t**>(0x7A9F7C);
const Game::dvar_t* Debug::PlayerDebugHealth;
const char* Debug::PMFlagsValues[] =
{
@ -182,7 +184,7 @@ namespace Components
constexpr float color1[] = {0.0f, 0.0f, 0.0f, 1.0f};
constexpr float color2[] = {0.0f, 1.0f, 0.0f, 1.0f};
assert((*PlayerDebugHealth)->current.enabled);
assert(PlayerDebugHealth->current.enabled);
const auto* cgameGlob = Game::cgArray;
if (cgameGlob->predictedPlayerState.stats[0] && cgameGlob->predictedPlayerState.stats[2])
@ -254,7 +256,7 @@ namespace Components
break;
}
if ((*PlayerDebugHealth)->current.enabled)
if (PlayerDebugHealth->current.enabled)
{
CG_DrawDebugPlayerHealth(localClientNum);
}
@ -348,6 +350,12 @@ namespace Components
Game::DVAR_CHEAT | Game::DVAR_CODINFO, "Name appended to the copied console log");
}
const Game::dvar_t* Debug::Dvar_Register_PlayerDebugHealth(const char* name, bool value, [[maybe_unused]] std::uint16_t flags, const char* description)
{
PlayerDebugHealth = Game::Dvar_RegisterBool(name, value, Game::DVAR_NONE, description);
return PlayerDebugHealth;
}
Debug::Debug()
{
Scheduler::Once(CL_InitDebugDvars, Scheduler::Pipeline::MAIN);
@ -357,6 +365,8 @@ namespace Components
Utils::Hook::Set<void(*)()>(0x60BCEA, Com_Assert_f);
Utils::Hook(0x4487F7, Dvar_Register_PlayerDebugHealth, HOOK_CALL).install()->quick();
#ifdef _DEBUG
Command::Add("bug", Com_Bug_f);
Command::Add("bug_name_inc", Com_BugNameInc_f);

View File

@ -12,7 +12,7 @@ namespace Components
static const Game::dvar_t* BugName;
// Game dvars
static Game::dvar_t** PlayerDebugHealth;
static const Game::dvar_t* PlayerDebugHealth;
static const char* PMFlagsValues[];
static const char* POFlagsValues[];
@ -46,5 +46,6 @@ namespace Components
static void Com_BugNameInc_f();
static void CL_InitDebugDvars();
static const Game::dvar_t* Dvar_Register_PlayerDebugHealth(const char* name, bool value, std::uint16_t flags, const char* description);
};
}

View File

@ -1,4 +1,7 @@
#include <STDInclude.hpp>
#include "CardTitles.hpp"
#include "ClanTags.hpp"
#include "ServerCommands.hpp"
namespace Components
{

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "Discovery.hpp"
#include "ServerList.hpp"
namespace Components
{

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "Download.hpp"
#include "ServerInfo.hpp"
#include <mongoose.h>

View File

@ -230,7 +230,7 @@ namespace Components
if (name == lastValidName) return;
Utils::String::Trim(name);
std::string saneName = TextRenderer::StripAllTextIcons(TextRenderer::StripColors(name));
auto saneName = TextRenderer::StripAllTextIcons(TextRenderer::StripColors(name));
if (saneName.size() < 3 || (saneName[0] == '[' && saneName[1] == '{'))
{
Logger::PrintError(Game::CON_CHANNEL_ERROR, "Username '{}' is invalid. It must at least be 3 characters long and not appear empty!\n", name);
@ -241,7 +241,7 @@ namespace Components
lastValidName = name;
Friends::UpdateName();
}
}, Scheduler::CLIENT, 3s); // Don't need to do this every frame
}, Scheduler::Pipeline::CLIENT, 3s); // Don't need to do this every frame
}
std::string username = "Unknown Soldier";
@ -393,13 +393,19 @@ namespace Components
// un-cheat cg_fovscale and add archive flags
Utils::Hook::Xor<std::uint8_t>(0x4F8E68, Game::DVAR_CHEAT | Game::DVAR_ARCHIVE);
// un-cheat cg_fovMin and add archive flags
Utils::Hook::Xor<std::uint8_t>(0x4F8E9D, Game::DVAR_CHEAT | Game::DVAR_ARCHIVE);
// un-cheat cg_debugInfoCornerOffset and add archive flags
Utils::Hook::Xor<std::uint8_t>(0x4F8FC2, Game::DVAR_CHEAT | Game::DVAR_ARCHIVE);
// un-cheat cg_drawGun
Utils::Hook::Set<std::uint8_t>(0x4F8DC6, Game::DVAR_NONE);
// remove archive flags for cg_hudchatposition
// un-cheat cg_draw2D
Utils::Hook::Set<std::uint8_t>(0x4F8EEE, Game::DVAR_NONE);
// remove archive flags for cg_hudChatPosition
Utils::Hook::Xor<std::uint8_t>(0x4F9992, Game::DVAR_ARCHIVE);
// remove write protection from fs_game

View File

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

View File

@ -1,4 +1,5 @@
#include <STDInclude.hpp>
#include "Console.hpp"
#include <version.hpp>

View File

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

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "Gamepad.hpp"
#include "RawMouse.hpp"
namespace Components
{

View File

@ -1,102 +0,0 @@
#include <STDInclude.hpp>
namespace Components
{
unsigned int Gametypes::GetGametypeCount()
{
return *Game::gameTypeCount;
}
const char* Gametypes::GetGametypeText(unsigned int index, int)
{
if (static_cast<unsigned int>(*Game::gameTypeCount) > index)
{
return Game::SEH_StringEd_GetString(Game::gameTypes[index].uiName);
}
return "";
}
void Gametypes::SelectGametype(unsigned int index)
{
if (!*Game::gameTypeCount) return;
if (static_cast<unsigned int>(*Game::gameTypeCount) <= index) index = 0;
std::string gametype = Game::gameTypes[index].gameType;
Dvar::Var("ui_gametype").set(gametype);
//Dvar::Var("g_gametype").set(gametype);
}
void* Gametypes::BuildGametypeList(const char*, void* buffer, size_t size)
{
std::vector<std::string> gametypes;
auto pushGametype = [&](std::string gametype)
{
auto pos = gametype.find_last_of("/\\");
if (pos != std::string::npos)
{
gametype = gametype.substr(pos + 1);
}
if (Utils::String::EndsWith(gametype, ".txt"))
{
gametype = gametype.substr(0, gametype.size() - 4);
}
// No need for that :)
if (gametype == "_gametypes") return;
if (std::find(gametypes.begin(), gametypes.end(), gametype) == gametypes.end())
{
gametypes.push_back(gametype);
}
};
// Get the gametypes we can find in the filesystem
std::vector<std::string> rawGametypes = FileSystem::GetFileList("maps/mp/gametypes/", "txt");
// Get the gametypes we can find in the database
Game::DB_EnumXAssets(Game::XAssetType::ASSET_TYPE_RAWFILE, [](Game::XAssetHeader header, void* data)
{
std::string name = header.rawfile->name;
std::vector<std::string>* rawGametypes = reinterpret_cast<std::vector<std::string>*>(data);
if (Utils::String::StartsWith(name, "maps/mp/gametypes/") && Utils::String::EndsWith(name, ".txt"))
{
if (std::count(name.begin(), name.end(), '/') == 3 && std::count(name.begin(), name.end(), '\\') == 0)
{
rawGametypes->push_back(name);
}
}
}, &rawGametypes, false);
std::for_each(rawGametypes.begin(), rawGametypes.end(), pushGametype);
std::string data;
for (auto& gametype : gametypes)
{
if (Game::Scr_AddSourceBuffer(nullptr, Utils::String::Format("maps/mp/gametypes/{}.txt", gametype), nullptr, false))
{
data.append(gametype);
data.append("\r\n");
}
}
// Copy to the actual buffer
std::memcpy(buffer, data.data(), std::min(size, data.size() + 1));
return (data.empty() ? nullptr : buffer);
}
Gametypes::Gametypes()
{
UIFeeder::Add(29.0f, Gametypes::GetGametypeCount, Gametypes::GetGametypeText, Gametypes::SelectGametype);
// Dynamically grab gametypes
Utils::Hook(0x5FA46C, Gametypes::BuildGametypeList, HOOK_CALL).install()->quick(); // Scr_UpdateGameTypeList
Utils::Hook(0x632155, Gametypes::BuildGametypeList, HOOK_CALL).install()->quick(); // UI_UpdateGameTypesList
}
}

View File

@ -1,17 +0,0 @@
#pragma once
namespace Components
{
class Gametypes : public Component
{
public:
Gametypes();
private:
static unsigned int GetGametypeCount();
static const char* GetGametypeText(unsigned int index, int column);
static void SelectGametype(unsigned int index);
static void* BuildGametypeList(const char* file, void* buffer, size_t size);
};
}

View File

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

View File

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

View File

@ -1,4 +1,5 @@
#include <STDInclude.hpp>
#include "MapDump.hpp"
namespace Components
{
@ -362,27 +363,8 @@ namespace Components
return image;
}
// TODO: This is still wrong.
if (image->mapType == 5 && false)
{
for (auto i = 0; i < 6; ++i)
{
IDirect3DSurface9* surface = nullptr;
image->texture.cubemap->GetCubeMapSurface(D3DCUBEMAP_FACES(i), 0, &surface);
if (surface)
{
std::string _name = Utils::String::VA("raw/mapdump/%s/textures/%s_%i.png", this->world_->baseName, image->name, i);
D3DXSaveSurfaceToFileA(_name.data(), D3DXIFF_PNG, surface, nullptr, nullptr);
surface->Release();
}
}
}
else
{
std::string _name = Utils::String::VA("raw/mapdump/%s/textures/%s.png", this->world_->baseName, image->name);
D3DXSaveTextureToFileA(_name.data(), D3DXIFF_PNG, image->texture.map, nullptr);
}
std::string _name = Utils::String::VA("raw/mapdump/%s/textures/%s.png", this->world_->baseName, image->name);
D3DXSaveTextureToFileA(_name.data(), D3DXIFF_PNG, image->texture.map, nullptr);
return image;
}

View File

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

View File

@ -1,4 +1,8 @@
#include <STDInclude.hpp>
#include "RawFiles.hpp"
#include "StartupMessages.hpp"
#include "Theatre.hpp"
#include "UIFeeder.hpp"
namespace Components
{

View File

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

View File

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

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "Changelog.hpp"
#include "News.hpp"
#include <version.hpp>

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "ServerList.hpp"
#include "Session.hpp"
namespace Components
{

View File

@ -1,4 +1,9 @@
#include <STDInclude.hpp>
#include "Download.hpp"
#include "Gamepad.hpp"
#include "ServerList.hpp"
#include "Stats.hpp"
#include "Voice.hpp"
#include <version.hpp>

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "PlayerMovement.hpp"
#include "GSC/Script.hpp"
namespace Components

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "ClanTags.hpp"
#include "PlayerName.hpp"
namespace Components
{

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "Gamepad.hpp"
#include "RawMouse.hpp"
namespace Components
{
@ -80,7 +82,9 @@ namespace Components
if (GetForegroundWindow() == Window::GetWindow())
{
if (r_fullscreen.get<bool>())
{
IN_ClampMouseMove();
}
static auto oldX = 0, oldY = 0;
@ -109,7 +113,7 @@ namespace Components
void RawMouse::IN_RawMouse_Init()
{
if (Window::GetWindow() && RawMouse::M_RawInput.get<bool>())
if (Window::GetWindow() && M_RawInput.get<bool>())
{
Logger::Debug("Raw Mouse Init");
@ -131,7 +135,7 @@ namespace Components
void RawMouse::IN_MouseMove()
{
if (RawMouse::M_RawInput.get<bool>())
if (M_RawInput.get<bool>())
{
IN_RawMouseMove();
}
@ -143,15 +147,15 @@ namespace Components
RawMouse::RawMouse()
{
Utils::Hook(0x475E65, RawMouse::IN_MouseMove, HOOK_JUMP).install()->quick();
Utils::Hook(0x475E8D, RawMouse::IN_MouseMove, HOOK_JUMP).install()->quick();
Utils::Hook(0x475E65, IN_MouseMove, HOOK_JUMP).install()->quick();
Utils::Hook(0x475E8D, IN_MouseMove, HOOK_JUMP).install()->quick();
Utils::Hook(0x467C03, RawMouse::IN_Init, HOOK_CALL).install()->quick();
Utils::Hook(0x64D095, RawMouse::IN_Init, HOOK_JUMP).install()->quick();
Utils::Hook(0x467C03, IN_Init, HOOK_CALL).install()->quick();
Utils::Hook(0x64D095, IN_Init, HOOK_JUMP).install()->quick();
RawMouse::M_RawInput = Dvar::Register<bool>("m_rawinput", true, Game::DVAR_ARCHIVE, "Use raw mouse input, Improves accuracy & has better support for higher polling rates. Use in_restart to take effect if not enabled.");
M_RawInput = Dvar::Register<bool>("m_rawinput", true, Game::DVAR_ARCHIVE, "Use raw mouse input, Improves accuracy & has better support for higher polling rates");
Window::OnWndMessage(WM_INPUT, RawMouse::OnRawInput);
Window::OnCreate(RawMouse::IN_RawMouse_Init);
Window::OnWndMessage(WM_INPUT, OnRawInput);
Window::OnCreate(IN_RawMouse_Init);
}
}

View File

@ -7,7 +7,7 @@ namespace Components
{
std::thread Scheduler::Thread;
volatile bool Scheduler::Kill = false;
Scheduler::TaskPipeline Scheduler::Pipelines[Pipeline::COUNT];
Scheduler::TaskPipeline Scheduler::Pipelines[static_cast<std::underlying_type_t<Pipeline>>(Pipeline::COUNT)];
void Scheduler::TaskPipeline::add(Task&& task)
{
@ -64,7 +64,8 @@ namespace Components
void Scheduler::Execute(Pipeline type)
{
assert(type < Pipeline::COUNT);
Pipelines[type].execute();
const auto index = static_cast<std::underlying_type_t<Pipeline>>(type);
Pipelines[index].execute();
}
void Scheduler::ScrPlace_EndFrame_Hk()
@ -107,7 +108,8 @@ namespace Components
task.interval = delay;
task.lastCall = std::chrono::high_resolution_clock::now();
Pipelines[type].add(std::move(task));
const auto index = static_cast<std::underlying_type_t<Pipeline>>(type);
Pipelines[index].add(std::move(task));
}
void Scheduler::Loop(const std::function<void()>& callback, const Pipeline type,

View File

@ -5,7 +5,7 @@ namespace Components
class Scheduler : public Component
{
public:
enum Pipeline
enum class Pipeline : int
{
ASYNC,
RENDERER,

View File

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

View File

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

View File

@ -1,4 +1,9 @@
#include <STDInclude.hpp>
#include "Gamepad.hpp"
#include "ServerInfo.hpp"
#include "ServerList.hpp"
#include "UIFeeder.hpp"
#include "Voice.hpp"
#include <version.hpp>

View File

@ -1,4 +1,7 @@
#include <STDInclude.hpp>
#include "Discovery.hpp"
#include "ServerList.hpp"
#include "UIFeeder.hpp"
#include <version.hpp>

View File

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

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "ConnectProtocol.hpp"
#include "Console.hpp"
#include <version.hpp>

View File

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

View File

@ -1,4 +1,5 @@
#include <STDInclude.hpp>
#include "SoundMutexFix.hpp"
namespace Components
{
@ -26,7 +27,7 @@ namespace Components
void __stdcall SoundMutexFix::LockSoundMutex(int unk)
{
std::lock_guard lock(SoundMutexFix::SNDMutex);
std::lock_guard lock(SNDMutex);
DWORD funcPtr = *reinterpret_cast<DWORD*>(0x6D7554); // AIL_close_stream
Utils::Hook::Call<void __stdcall(int)>(funcPtr)(unk);
@ -34,6 +35,6 @@ namespace Components
SoundMutexFix::SoundMutexFix()
{
Utils::Hook(0x689EFE, &SoundMutexFix::LockSoundMutex, HOOK_JUMP).install()->quick();
Utils::Hook(0x689EFE, &LockSoundMutex, HOOK_JUMP).install()->quick();
}
}

View File

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

View File

@ -1,4 +1,7 @@
#include <STDInclude.hpp>
#include "ServerCommands.hpp"
#include "Stats.hpp"
#include "GSC/Script.hpp"
namespace Components

View File

@ -1,4 +1,5 @@
#include <STDInclude.hpp>
#include "StringTable.hpp"
namespace Components
{
@ -22,8 +23,8 @@ namespace Components
if (table)
{
table->name = allocator->duplicateString(filename);
table->columnCount = parsedTable.getColumns();
table->rowCount = parsedTable.getRows();
table->columnCount = static_cast<int>(parsedTable.getColumns());
table->rowCount = static_cast<int>(parsedTable.getRows());
table->values = allocator->allocateArray<Game::StringTableCell>(table->columnCount * table->rowCount);
@ -45,12 +46,12 @@ namespace Components
}
}
StringTable::StringTableMap[filename] = table;
StringTableMap[filename] = table;
}
}
else
{
StringTable::StringTableMap[filename] = nullptr;
StringTableMap[filename] = nullptr;
}
return table;
@ -64,13 +65,13 @@ namespace Components
std::string filename = Utils::String::ToLower(_filename);
if (StringTable::StringTableMap.contains(filename))
if (StringTableMap.contains(filename))
{
header.stringTable = StringTable::StringTableMap[filename];
header.stringTable = StringTableMap[filename];
}
else
{
header.stringTable = StringTable::LoadObject(filename);
header.stringTable = LoadObject(filename);
}
return header;

View File

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

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "Theatre.hpp"
#include "UIFeeder.hpp"
namespace Components
{

View File

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

View File

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

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "UserInfo.hpp"
#include "GSC/Script.hpp"
namespace Components

View File

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

View File

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

View File

@ -1,4 +1,7 @@
#include <STDInclude.hpp>
#include "ClientCommand.hpp"
#include "MapRotation.hpp"
#include "Vote.hpp"
using namespace Utils::String;

View File

@ -1,4 +1,6 @@
#include <STDInclude.hpp>
#include "Weapon.hpp"
#include "GSC/Script.hpp"
namespace Components

View File

@ -1,4 +1,5 @@
#include <STDInclude.hpp>
#include "Console.hpp"
#include <version.hpp>

View File

@ -1,4 +1,5 @@
#include <STDInclude.hpp>
#include "Components/Modules/StartupMessages.hpp"
namespace Steam
{