diff --git a/src/Components/Modules/FastFiles.cpp b/src/Components/Modules/FastFiles.cpp index 9197571d..77c33c2c 100644 --- a/src/Components/Modules/FastFiles.cpp +++ b/src/Components/Modules/FastFiles.cpp @@ -20,14 +20,6 @@ namespace Components data.push_back({ "weapons_mp", 1, 0 }); Game::DB_LoadXAssets(data.data(), data.size(), sync); - -#ifdef DEBUG - if (!ZoneBuilder::IsEnabled()) - { - info = { "penis", 1, 0 }; - Game::DB_LoadXAssets(&info, 1, 1); - } -#endif } const char* FastFiles::GetZoneLocation(const char* file) diff --git a/src/Components/Modules/News.cpp b/src/Components/Modules/News.cpp index d152fd28..30cf5dac 100644 --- a/src/Components/Modules/News.cpp +++ b/src/Components/Modules/News.cpp @@ -2,27 +2,34 @@ namespace Components { - std::string News::Motd; - - const char* News::GetMotd() - { - return News::Motd.data(); - } + std::thread* News::Thread = 0; News::News() { Localization::Set("MPUI_CHANGELOG_TEXT", ""); + Localization::Set("MPUI_MOTD_TEXT", "Welcome to ReactIW4x Multiplayer!"); - News::Motd = Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/motd.txt").SetTimeout(1000)->Get(); - - if (!News::Motd.size()) + News::Thread = new std::thread([] () { - News::Motd = "Welcome to ReactIW4x Multiplayer!"; + Localization::Set("MPUI_CHANGELOG_TEXT", Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/changelog.txt").Get().data()); + + std::string data = Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/motd.txt").Get(); + + if (data.size()) + { + Localization::Set("MPUI_MOTD_TEXT", data.data()); + } + + // TODO: Implement update checks here! + }); + } + + News::~News() + { + if (News::Thread) + { + News::Thread->join(); + delete News::Thread; } - - Localization::Set("MPUI_CHANGELOG_TEXT", Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/changelog.txt").SetTimeout(1000)->Get().data()); - - // Patch motd setting - Utils::Hook(0x60BF19, News::GetMotd, HOOK_CALL).Install()->Quick(); } } diff --git a/src/Components/Modules/News.hpp b/src/Components/Modules/News.hpp index aefd38cc..4dd994c2 100644 --- a/src/Components/Modules/News.hpp +++ b/src/Components/Modules/News.hpp @@ -4,10 +4,10 @@ namespace Components { public: News(); + ~News(); const char* GetName() { return "News"; }; private: - static std::string Motd; - static const char* GetMotd(); + static std::thread* Thread; }; }