2017-01-20 08:36:52 -05:00
|
|
|
#pragma once
|
|
|
|
|
2015-12-28 20:52:31 -05:00
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class Component
|
|
|
|
{
|
|
|
|
public:
|
2022-06-13 11:32:45 -04:00
|
|
|
Component() = default;
|
|
|
|
virtual ~Component() = default;
|
2016-08-15 10:40:30 -04:00
|
|
|
|
2016-09-16 05:04:28 -04:00
|
|
|
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
2017-05-31 06:02:14 -04:00
|
|
|
virtual std::string getName()
|
|
|
|
{
|
|
|
|
std::string name = typeid(*this).name();
|
|
|
|
Utils::String::Replace(name, "class Components::", "");
|
|
|
|
return name;
|
|
|
|
};
|
2016-08-15 10:40:30 -04:00
|
|
|
#endif
|
|
|
|
|
2017-01-23 16:06:50 -05:00
|
|
|
// It's illegal to spawn threads in DLLMain, and apparently it causes problems if they are destroyed there as well.
|
|
|
|
// This method is called before DLLMain (if possible) and should to destroy threads.
|
|
|
|
// It's not 100% guaranteed that it's called outside DLLMain, as it depends on the game, but it's 100% guaranteed, that it is called at all.
|
2022-05-05 10:03:14 -04:00
|
|
|
virtual void preDestroy() {}
|
|
|
|
virtual bool unitTest() { return true; } // Unit testing entry
|
2015-12-28 20:52:31 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class Loader
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void Initialize();
|
|
|
|
static void Uninitialize();
|
2017-01-23 16:06:50 -05:00
|
|
|
static void PreDestroy();
|
2017-02-24 07:30:31 -05:00
|
|
|
static void PreDestroyNoPostGame();
|
2016-02-04 15:58:49 -05:00
|
|
|
static bool PerformUnitTests();
|
2017-07-03 09:40:32 -04:00
|
|
|
static bool IsPerformingUnitTests();
|
2015-12-28 20:52:31 -05:00
|
|
|
static void Register(Component* component);
|
|
|
|
|
2016-09-03 09:52:40 -04:00
|
|
|
static bool IsPregame();
|
2017-02-24 07:30:31 -05:00
|
|
|
static bool IsPostgame();
|
2017-06-04 07:46:50 -04:00
|
|
|
static bool IsUninitializing();
|
2016-09-03 09:52:40 -04:00
|
|
|
|
2017-05-31 06:02:14 -04:00
|
|
|
template <typename T>
|
|
|
|
static T* GetInstance()
|
|
|
|
{
|
|
|
|
for (auto& component : Loader::Components)
|
|
|
|
{
|
|
|
|
if (typeid(*component) == typeid(T))
|
|
|
|
{
|
|
|
|
return reinterpret_cast<T*>(component);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2015-12-28 20:52:31 -05:00
|
|
|
private:
|
2016-09-03 09:52:40 -04:00
|
|
|
static bool Pregame;
|
2017-01-23 16:06:50 -05:00
|
|
|
static bool Postgame;
|
2017-06-04 07:46:50 -04:00
|
|
|
static bool Uninitializing;
|
2015-12-28 20:52:31 -05:00
|
|
|
static std::vector<Component*> Components;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-05-31 09:45:12 -04:00
|
|
|
#include "Modules/Scheduler.hpp"
|
2017-01-20 08:36:52 -05:00
|
|
|
#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/D3D9Ex.hpp"
|
|
|
|
#include "Modules/Weapon.hpp"
|
|
|
|
#include "Modules/Window.hpp"
|
|
|
|
#include "Modules/Command.hpp"
|
|
|
|
#include "Modules/Console.hpp"
|
|
|
|
#include "Modules/UIScript.hpp"
|
|
|
|
#include "Modules/ModList.hpp"
|
2017-02-25 09:32:15 -05:00
|
|
|
#include "Modules/Monitor.hpp"
|
2017-01-20 08:36:52 -05:00
|
|
|
#include "Modules/Network.hpp"
|
|
|
|
#include "Modules/Theatre.hpp"
|
2017-05-15 15:57:45 -04:00
|
|
|
#include "Modules/QuickPatch.hpp"
|
2022-04-19 09:26:29 -04:00
|
|
|
#include "Modules/Security.hpp"
|
2018-10-09 04:53:15 -04:00
|
|
|
#include "Modules/Node.hpp"
|
2017-01-20 08:36:52 -05:00
|
|
|
#include "Modules/RCon.hpp"
|
|
|
|
#include "Modules/Party.hpp" // Destroys the order, but requires network classes :D
|
|
|
|
#include "Modules/Logger.hpp"
|
2017-01-25 16:39:00 -05:00
|
|
|
#include "Modules/Friends.hpp"
|
2017-02-12 13:38:56 -05:00
|
|
|
#include "Modules/IPCPipe.hpp"
|
2019-12-28 05:43:41 -05:00
|
|
|
#include "Modules/MapDump.hpp"
|
2018-10-09 04:53:15 -04:00
|
|
|
#include "Modules/Session.hpp"
|
2017-06-14 06:06:04 -04:00
|
|
|
#include "Modules/ClanTags.hpp"
|
2017-01-20 08:36:52 -05:00
|
|
|
#include "Modules/Download.hpp"
|
|
|
|
#include "Modules/Playlist.hpp"
|
|
|
|
#include "Modules/RawFiles.hpp"
|
|
|
|
#include "Modules/Renderer.hpp"
|
|
|
|
#include "Modules/UIFeeder.hpp"
|
2017-02-04 12:42:12 -05:00
|
|
|
#include "Modules/Changelog.hpp"
|
2017-01-20 08:36:52 -05:00
|
|
|
#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"
|
2017-05-30 07:45:19 -04:00
|
|
|
#include "Modules/CardTitles.hpp"
|
2017-01-20 08:36:52 -05:00
|
|
|
#include "Modules/FileSystem.hpp"
|
|
|
|
#include "Modules/ModelSurfs.hpp"
|
|
|
|
#include "Modules/PlayerName.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"
|
2017-05-30 08:29:09 -04:00
|
|
|
#include "Modules/ServerCommands.hpp"
|
2017-01-20 08:36:52 -05:00
|
|
|
#include "Modules/StructuredData.hpp"
|
|
|
|
#include "Modules/ConnectProtocol.hpp"
|
2017-01-30 21:57:31 -05:00
|
|
|
#include "Modules/StartupMessages.hpp"
|
2017-02-25 19:36:37 -05:00
|
|
|
#include "Modules/Stats.hpp"
|
2021-08-13 18:27:19 -04:00
|
|
|
#include "Modules/SoundMutexFix.hpp"
|
2021-09-19 07:13:46 -04:00
|
|
|
#include "Modules/Chat.hpp"
|
2021-09-04 20:25:24 -04:00
|
|
|
#include "Modules/TextRenderer.hpp"
|
2021-11-07 06:09:00 -05:00
|
|
|
#include "Modules/Movement.hpp"
|
2021-11-29 07:26:53 -05:00
|
|
|
#include "Modules/Elevators.hpp"
|
2021-12-09 07:01:37 -05:00
|
|
|
#include "Modules/ClientCommand.hpp"
|
2022-06-30 15:37:47 -04:00
|
|
|
#include "Modules/VisionFile.hpp"
|
2021-08-21 09:15:42 -04:00
|
|
|
#include "Modules/Gamepad.hpp"
|
2022-04-15 08:50:22 -04:00
|
|
|
#include "Modules/Branding.hpp"
|
2022-06-13 12:08:44 -04:00
|
|
|
#include "Modules/Debug.hpp"
|
2022-04-29 04:56:51 -04:00
|
|
|
#include "Modules/RawMouse.hpp"
|
2022-05-03 12:57:36 -04:00
|
|
|
#include "Modules/Bullet.hpp"
|
2022-05-25 12:03:26 -04:00
|
|
|
#include "Modules/MapRotation.hpp"
|
2022-05-27 08:15:03 -04:00
|
|
|
#include "Modules/Ceg.hpp"
|
2022-06-04 04:56:14 -04:00
|
|
|
#include "Modules/UserInfo.hpp"
|
2022-06-13 14:16:57 -04:00
|
|
|
#include "Modules/Events.hpp"
|
2022-07-06 11:48:40 -04:00
|
|
|
|
|
|
|
#include "Modules/GSC/GSC.hpp"
|