[Monitor] Correctly load stored nodes
This commit is contained in:
parent
bc544748cc
commit
89ef10b789
@ -257,7 +257,7 @@ namespace Components
|
||||
|
||||
void Auth::StoreKey()
|
||||
{
|
||||
if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled() && Auth::GuidKey.isValid())
|
||||
if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled() && !Monitor::IsEnabled() && Auth::GuidKey.isValid())
|
||||
{
|
||||
Proto::Auth::Certificate cert;
|
||||
cert.set_token(Auth::GuidToken.toString());
|
||||
|
@ -534,7 +534,7 @@ namespace Components
|
||||
{
|
||||
Friends::LoggedOn = false;
|
||||
|
||||
if (Dedicated::IsEnabled() ||ZoneBuilder::IsEnabled()) return;
|
||||
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled() || Monitor::IsEnabled()) return;
|
||||
|
||||
Dvar::Register<bool>("cl_anonymous", false, Game::DVAR_FLAG_SAVED, "");
|
||||
Dvar::Register<int>("cl_notifyFriendState", 1, -1, 1, Game::DVAR_FLAG_SAVED, "");
|
||||
@ -691,7 +691,7 @@ namespace Components
|
||||
|
||||
Friends::~Friends()
|
||||
{
|
||||
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled()) return;
|
||||
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled() || Monitor::IsEnabled()) return;
|
||||
|
||||
Friends::StoreFriendsList();
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace Components
|
||||
Utils::Time::Interval interval;
|
||||
while(!interval.elapsed(15s))
|
||||
{
|
||||
Utils::Hook::Call<void()>(0x49F0B0)(); // Com_EventLoop
|
||||
Utils::Hook::Call<void()>(0x49F0B0)(); // Com_ClientPacketEvent
|
||||
Node::FrameHandler();
|
||||
ServerList::Frame();
|
||||
|
||||
|
@ -25,8 +25,17 @@ namespace Components
|
||||
void Node::LoadNodePreset()
|
||||
{
|
||||
Proto::Node::List list;
|
||||
FileSystem::File defaultNodes("nodes_default.dat");
|
||||
if (!defaultNodes.exists() || !list.ParseFromString(Utils::Compression::ZLib::Decompress(defaultNodes.getBuffer()))) return;
|
||||
|
||||
if (Monitor::IsEnabled())
|
||||
{
|
||||
std::string nodes = Utils::IO::ReadFile("players/nodes_default.dat");
|
||||
if (nodes.empty() || !list.ParseFromString(Utils::Compression::ZLib::Decompress(nodes))) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
FileSystem::File defaultNodes("nodes_default.dat");
|
||||
if (!defaultNodes.exists() || !list.ParseFromString(Utils::Compression::ZLib::Decompress(defaultNodes.getBuffer()))) return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.address_size(); ++i)
|
||||
{
|
||||
@ -384,11 +393,14 @@ namespace Components
|
||||
Node::SignatureKey = Utils::Cryptography::ECC::GenerateKey(512);
|
||||
|
||||
// Load stored nodes
|
||||
Dvar::OnInit([] ()
|
||||
auto loadNodes = []()
|
||||
{
|
||||
Node::LoadNodePreset();
|
||||
Node::LoadNodes();
|
||||
});
|
||||
};
|
||||
|
||||
if (Monitor::IsEnabled()) Network::OnStart(loadNodes);
|
||||
else Dvar::OnInit(loadNodes);
|
||||
|
||||
// Send deadline when shutting down
|
||||
if (Dedicated::IsEnabled())
|
||||
|
Loading…
Reference in New Issue
Block a user