[Scheduler] Fix errors

This commit is contained in:
momo5502 2017-05-31 16:09:41 +02:00
parent fe6cb2d737
commit 7dbfdb8a79
13 changed files with 46 additions and 17 deletions

View File

@ -213,7 +213,7 @@ namespace Components
});
// Invocation handler
QuickPatch::OnReady(ConnectProtocol::Invocation);
Scheduler::OnReady(ConnectProtocol::Invocation);
ConnectProtocol::InstallProtocol();
ConnectProtocol::EvaluateProtocol();

View File

@ -572,7 +572,7 @@ namespace Components
if (Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled())
{
Dedicated::OnFrame(Console::RefreshStatus);
Scheduler::OnFrame(Console::RefreshStatus);
}
// Code below is not necessary when performing unit tests!

View File

@ -380,7 +380,7 @@ namespace Components
Utils::Hook(0x60BFBF, Dedicated::PostInitializationStub, HOOK_JUMP).install()->quick();
// Transmit custom data
Dedicated::OnFrame([]()
Scheduler::OnFrame([]()
{
static std::uint64_t LastUpdate = 0;
@ -396,7 +396,7 @@ namespace Components
#ifdef USE_LEGACY_SERVER_LIST
// Heartbeats
Dedicated::OnFrame([] ()
Scheduler::OnFrame([] ()
{
static int LastHeartbeat = 0;

View File

@ -142,7 +142,7 @@ namespace Components
Dvar::RegistrationSignal();
// Name watcher
Renderer::OnFrame([] ()
Scheduler::OnFrame([] ()
{
static std::string lastValidName = "Unknown Soldier";
std::string name = Dvar::Var("name").get<char*>();

View File

@ -640,7 +640,7 @@ namespace Components
UIFeeder::Add(61.0f, Friends::GetFriendCount, Friends::GetFriendText, Friends::SelectFriend);
QuickPatch::OnShutdown([]()
Scheduler::OnShutdown([]()
{
Friends::ClearPresence("iw4x_server");
Friends::ClearPresence("iw4x_playing");

View File

@ -1003,7 +1003,7 @@ namespace Components
Command::Add("delayReconnect", [](Command::Params*)
{
Renderer::OnDelay([]()
Scheduler::OnDelay([]()
{
Command::Execute("closemenu popup_reconnectingtoparty", false);
Command::Execute("reconnect", false);
@ -1077,7 +1077,7 @@ namespace Components
// Allow hiding specific smodels
Utils::Hook(0x50E67C, Maps::HideModelStub, HOOK_CALL).install()->quick();
Renderer::OnFrame([]()
Scheduler::OnFrame([]()
{
Game::GfxWorld*& gameWorld = *reinterpret_cast<Game::GfxWorld**>(0x66DEE94);
if (!Game::CL_IsCgameInitialized() || !gameWorld || !Dvar::Var("r_listSModels").get<bool>()) return;

View File

@ -405,7 +405,7 @@ namespace Components
// Send deadline when shutting down
if (Dedicated::IsEnabled())
{
QuickPatch::OnShutdown([] ()
Scheduler::OnShutdown([] ()
{
if (Dvar::Var("sv_lanOnly").get<bool>()) return;

View File

@ -271,7 +271,7 @@ namespace Components
Party::Connect(Party::Container.target);
});
Renderer::OnFrame([] ()
Scheduler::OnFrame([] ()
{
if (Party::Container.valid)
{

View File

@ -334,8 +334,6 @@ namespace Components
Utils::Hook::Set<char*>(0x60B279, CLIENT_CONFIG);
Utils::Hook::Set<char*>(0x60BBD4, CLIENT_CONFIG);
Utils::Hook(0x4D697A, QuickPatch::ShutdownStub, HOOK_CALL).install()->quick();
// Disable profile system
// Utils::Hook::Nop(0x60BEB1, 5); // GamerProfile_InitAllProfiles - Causes an error, when calling a harrier killstreak.
// Utils::Hook::Nop(0x60BEB8, 5); // GamerProfile_LogInProfile
@ -657,7 +655,7 @@ namespace Components
// Constantly draw the mini console
Utils::Hook::Set<BYTE>(0x412A45, 0xEB);
Renderer::OnFrame([] ()
Scheduler::OnFrame([] ()
{
if (*reinterpret_cast<Game::Font**>(0x62E4BAC))
{

View File

@ -15,14 +15,28 @@ namespace Components
Scheduler::FrameOnceSignal.connect(callback);
}
void Scheduler::OnShutdown(Utils::Slot<Scheduler::Callback> callback)
{
Scheduler::ShutdownSignal.connect(callback);
}
void Scheduler::OnFrame(Utils::Slot<Scheduler::Callback> callback)
{
Scheduler::FrameSignal.connect(callback);
}
void Scheduler::OnReady(Utils::Slot<Scheduler::Callback> callback)
{
if (Scheduler::ReadyPassed) Scheduler::Once(callback);
else Scheduler::ReadySignal.connect(callback);
}
void Scheduler::ReadyHandler()
{
if (!FastFiles::Ready()) Scheduler::Once(Scheduler::ReadyHandler);
if (!FastFiles::Ready())
{
Scheduler::Once(Scheduler::ReadyHandler);
}
else
{
Scheduler::ReadyPassed = true;
@ -69,15 +83,30 @@ namespace Components
signal();
}
void Scheduler::ShutdownStub(int num)
{
Scheduler::ShutdownSignal();
Utils::Hook::Call<void(int)>(0x46B370)(num);
}
Scheduler::Scheduler()
{
Scheduler::ReadyPassed = false;
Scheduler::Once(Scheduler::ReadyHandler);
Utils::Hook(0x4D697A, Scheduler::ShutdownStub, HOOK_CALL).install()->quick();
}
Scheduler::~Scheduler()
{
Scheduler::FrameOnceSignal.clear();
Scheduler::ReadySignal.clear();
Scheduler::ShutdownSignal.clear();
Scheduler::FrameSignal.clear();
Scheduler::FrameOnceSignal.clear();
Scheduler::DelayedSlots.clear();
Scheduler::ReadyPassed = false;
}
}

View File

@ -37,5 +37,7 @@ namespace Components
static void ReadyHandler();
static void DelaySignal();
static void ShutdownStub(int num);
};
}

View File

@ -853,7 +853,7 @@ namespace Components
// This is placed here in case the anticheat has been disabled!
#if !defined(DEBUG) && !defined(DISABLE_ANTICHEAT) && defined(PROCTECT_PROCESS)
Scheduler::OnFrame(AntiCheat::ReadIntegrityCheck);
if(!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled()) Scheduler::OnFrame(AntiCheat::ReadIntegrityCheck);
#endif
}

View File

@ -157,7 +157,7 @@ namespace Components
WinToastLib::WinToast::instance()->initialize();
}
QuickPatch::OnReady([]()
Scheduler::OnReady([]()
{
Scheduler::OnFrame(Toast::Handler);
});