[Scheduler] Distinguish between dedi and client interface
This commit is contained in:
parent
38e4f75411
commit
fe3e37347d
@ -582,7 +582,7 @@ namespace Components
|
|||||||
Utils::Hook(0x60BE9D, AntiCheat::SoundInitStub, HOOK_CALL).install()->quick();
|
Utils::Hook(0x60BE9D, AntiCheat::SoundInitStub, HOOK_CALL).install()->quick();
|
||||||
Utils::Hook(0x60BE8E, AntiCheat::SoundInitDriverStub, HOOK_CALL).install()->quick();
|
Utils::Hook(0x60BE8E, AntiCheat::SoundInitDriverStub, HOOK_CALL).install()->quick();
|
||||||
Utils::Hook(0x418204, AntiCheat::SoundInitDriverStub, HOOK_CALL).install()->quick();
|
Utils::Hook(0x418204, AntiCheat::SoundInitDriverStub, HOOK_CALL).install()->quick();
|
||||||
if(!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled()) Scheduler::OnFrame(AntiCheat::PerformScan);
|
Scheduler::OnFrame(AntiCheat::PerformScan, true);
|
||||||
|
|
||||||
// Detect aimbots
|
// Detect aimbots
|
||||||
Utils::Hook(0x426580, AntiCheat::DObjGetWorldTagPosStub, HOOK_JUMP).install()->quick();
|
Utils::Hook(0x426580, AntiCheat::DObjGetWorldTagPosStub, HOOK_JUMP).install()->quick();
|
||||||
|
@ -161,7 +161,7 @@ namespace Components
|
|||||||
lastValidName = name;
|
lastValidName = name;
|
||||||
Friends::UpdateName();
|
Friends::UpdateName();
|
||||||
}
|
}
|
||||||
});
|
}, true);
|
||||||
|
|
||||||
std::string username = "Unknown Soldier";
|
std::string username = "Unknown Soldier";
|
||||||
|
|
||||||
|
@ -174,23 +174,21 @@ namespace Components
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// Display DEBUG branding, so we know we're on a debug build
|
// Display DEBUG branding, so we know we're on a debug build
|
||||||
if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled()) {
|
Scheduler::OnFrame([]()
|
||||||
Scheduler::OnFrame([]()
|
{
|
||||||
|
Game::Font* font = Game::R_RegisterFont("fonts/normalFont", 0);
|
||||||
|
float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
|
|
||||||
|
// Change the color when attaching a debugger
|
||||||
|
if (IsDebuggerPresent())
|
||||||
{
|
{
|
||||||
Game::Font* font = Game::R_RegisterFont("fonts/normalFont", 0);
|
color[0] = 0.6588f;
|
||||||
float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
color[1] = 1.0000f;
|
||||||
|
color[2] = 0.0000f;
|
||||||
|
}
|
||||||
|
|
||||||
// Change the color when attaching a debugger
|
Game::R_AddCmdDrawText("DEBUG-BUILD", 0x7FFFFFFF, font, 15.0f, 10.0f + Game::R_TextHeight(font), 1.0f, 1.0f, 0.0f, color, Game::ITEM_TEXTSTYLE_SHADOWED);
|
||||||
if (IsDebuggerPresent())
|
}, true);
|
||||||
{
|
|
||||||
color[0] = 0.6588f;
|
|
||||||
color[1] = 1.0000f;
|
|
||||||
color[2] = 0.0000f;
|
|
||||||
}
|
|
||||||
|
|
||||||
Game::R_AddCmdDrawText("DEBUG-BUILD", 0x7FFFFFFF, font, 15.0f, 10.0f + Game::R_TextHeight(font), 1.0f, 1.0f, 0.0f, color, Game::ITEM_TEXTSTYLE_SHADOWED);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#if !defined(DEBUG) || defined(FORCE_EXCEPTION_HANDLER)
|
#if !defined(DEBUG) || defined(FORCE_EXCEPTION_HANDLER)
|
||||||
Exception::SetFilterHook.initialize(SetUnhandledExceptionFilter, Exception::SetUnhandledExceptionFilterStub, HOOK_JUMP);
|
Exception::SetFilterHook.initialize(SetUnhandledExceptionFilter, Exception::SetUnhandledExceptionFilterStub, HOOK_JUMP);
|
||||||
|
@ -568,7 +568,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
if (FastFiles::Current().empty() || !Dvar::Var("ui_zoneDebug").get<bool>()) return;
|
if (FastFiles::Current().empty() || !Dvar::Var("ui_zoneDebug").get<bool>()) return;
|
||||||
|
|
||||||
Game::Font* font = Game::R_RegisterFont("fonts/consoleFont", 0); // Inlining that seems to skip xpos, no idea why xD
|
Game::Font* font = Game::R_RegisterFont("fonts/consoleFont", 0);
|
||||||
float color[4] = { 1.0f, 1.0f, 1.0f, (Game::CL_IsCgameInitialized() ? 0.3f : 1.0f) };
|
float color[4] = { 1.0f, 1.0f, 1.0f, (Game::CL_IsCgameInitialized() ? 0.3f : 1.0f) };
|
||||||
|
|
||||||
std::uint32_t FFTotalSize = *reinterpret_cast<std::uint32_t*>(0x10AA5D8);
|
std::uint32_t FFTotalSize = *reinterpret_cast<std::uint32_t*>(0x10AA5D8);
|
||||||
@ -585,7 +585,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
Game::R_AddCmdDrawText(Utils::String::VA("Loading FastFile: %s [%0.1f%%]", FastFiles::Current().data(), fastfileLoadProgress), 0x7FFFFFFF, font, 5.0f, static_cast<float>(Renderer::Height() - 5), 1.0f, 1.0f, 0.0f, color, Game::ITEM_TEXTSTYLE_NORMAL);
|
Game::R_AddCmdDrawText(Utils::String::VA("Loading FastFile: %s [%0.1f%%]", FastFiles::Current().data(), fastfileLoadProgress), 0x7FFFFFFF, font, 5.0f, static_cast<float>(Renderer::Height() - 5), 1.0f, 1.0f, 0.0f, color, Game::ITEM_TEXTSTYLE_NORMAL);
|
||||||
});
|
}, true);
|
||||||
|
|
||||||
Command::Add("loadzone", [] (Command::Params* params)
|
Command::Add("loadzone", [] (Command::Params* params)
|
||||||
{
|
{
|
||||||
|
@ -1007,7 +1007,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
Command::Execute("closemenu popup_reconnectingtoparty", false);
|
Command::Execute("closemenu popup_reconnectingtoparty", false);
|
||||||
Command::Execute("reconnect", false);
|
Command::Execute("reconnect", false);
|
||||||
}, 6s);
|
}, 6s, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
if(Dedicated::IsEnabled())
|
if(Dedicated::IsEnabled())
|
||||||
@ -1104,7 +1104,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
Game::R_AddCmdDrawText(Utils::String::VA("%d %s", model.second, model.first.data()), 0x7FFFFFFF, font, 15.0f, (height * scale + 1) * (i++ + 1) + 15.0f, scale, scale, 0.0f, color, Game::ITEM_TEXTSTYLE_NORMAL);
|
Game::R_AddCmdDrawText(Utils::String::VA("%d %s", model.second, model.first.data()), 0x7FFFFFFF, font, 15.0f, (height * scale + 1) * (i++ + 1) + 15.0f, scale, scale, 0.0f, color, Game::ITEM_TEXTSTYLE_NORMAL);
|
||||||
}
|
}
|
||||||
});
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Maps::~Maps()
|
Maps::~Maps()
|
||||||
|
@ -193,7 +193,7 @@ namespace Components
|
|||||||
// float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
// float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
//
|
//
|
||||||
// Game::R_AddCmdDrawText("test^==preview_mp_rustzob", 0x7FFFFFFF, font, 500.0f, 150.0f, 1.0f, 1.0f, 0.0f, color, Game::ITEM_TEXTSTYLE_SHADOWED);
|
// Game::R_AddCmdDrawText("test^==preview_mp_rustzob", 0x7FFFFFFF, font, 500.0f, 150.0f, 1.0f, 1.0f, 0.0f, color, Game::ITEM_TEXTSTYLE_SHADOWED);
|
||||||
// });
|
// }, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Materials::~Materials()
|
Materials::~Materials()
|
||||||
|
@ -290,7 +290,7 @@ namespace Components
|
|||||||
Party::ConnectError("Playlist request timed out.");
|
Party::ConnectError("Playlist request timed out.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}, true);
|
||||||
|
|
||||||
// Basic info handler
|
// Basic info handler
|
||||||
Network::Handle("getInfo", [] (Network::Address address, std::string data)
|
Network::Handle("getInfo", [] (Network::Address address, std::string data)
|
||||||
|
@ -656,15 +656,13 @@ namespace Components
|
|||||||
// Constantly draw the mini console
|
// Constantly draw the mini console
|
||||||
Utils::Hook::Set<BYTE>(0x412A45, 0xEB);
|
Utils::Hook::Set<BYTE>(0x412A45, 0xEB);
|
||||||
|
|
||||||
if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled()) {
|
Scheduler::OnFrame([]()
|
||||||
Scheduler::OnFrame([]()
|
{
|
||||||
|
if (*reinterpret_cast<Game::Font**>(0x62E4BAC))
|
||||||
{
|
{
|
||||||
if (*reinterpret_cast<Game::Font**>(0x62E4BAC))
|
Game::Con_DrawMiniConsole(0, 2, 4, (Game::CL_IsCgameInitialized() ? 1.0f : 0.4f));
|
||||||
{
|
}
|
||||||
Game::Con_DrawMiniConsole(0, 2, 4, (Game::CL_IsCgameInitialized() ? 1.0f : 0.4f));
|
}, true);
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
// Remove missing tag message
|
// Remove missing tag message
|
||||||
Utils::Hook::Nop(0x4EBF1A, 5);
|
Utils::Hook::Nop(0x4EBF1A, 5);
|
||||||
|
@ -10,8 +10,9 @@ namespace Components
|
|||||||
Utils::Signal<Scheduler::Callback> Scheduler::FrameOnceSignal;
|
Utils::Signal<Scheduler::Callback> Scheduler::FrameOnceSignal;
|
||||||
std::vector<Scheduler::DelayedSlot> Scheduler::DelayedSlots;
|
std::vector<Scheduler::DelayedSlot> Scheduler::DelayedSlots;
|
||||||
|
|
||||||
void Scheduler::Once(Utils::Slot<Scheduler::Callback> callback)
|
void Scheduler::Once(Utils::Slot<Scheduler::Callback> callback, bool clientOnly)
|
||||||
{
|
{
|
||||||
|
if (clientOnly && (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled())) return;
|
||||||
Scheduler::FrameOnceSignal.connect(callback);
|
Scheduler::FrameOnceSignal.connect(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,13 +21,15 @@ namespace Components
|
|||||||
Scheduler::ShutdownSignal.connect(callback);
|
Scheduler::ShutdownSignal.connect(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scheduler::OnFrame(Utils::Slot<Scheduler::Callback> callback)
|
void Scheduler::OnFrame(Utils::Slot<Scheduler::Callback> callback, bool clientOnly)
|
||||||
{
|
{
|
||||||
|
if (clientOnly && (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled())) return;
|
||||||
Scheduler::FrameSignal.connect(callback);
|
Scheduler::FrameSignal.connect(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scheduler::OnReady(Utils::Slot<Scheduler::Callback> callback)
|
void Scheduler::OnReady(Utils::Slot<Scheduler::Callback> callback, bool clientOnly)
|
||||||
{
|
{
|
||||||
|
if (clientOnly && (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled())) return;
|
||||||
if (Scheduler::ReadyPassed) Scheduler::Once(callback);
|
if (Scheduler::ReadyPassed) Scheduler::Once(callback);
|
||||||
else Scheduler::ReadySignal.connect(callback);
|
else Scheduler::ReadySignal.connect(callback);
|
||||||
}
|
}
|
||||||
@ -57,8 +60,10 @@ namespace Components
|
|||||||
copy();
|
copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scheduler::OnDelay(Utils::Slot<Scheduler::Callback> callback, std::chrono::nanoseconds delay)
|
void Scheduler::OnDelay(Utils::Slot<Scheduler::Callback> callback, std::chrono::nanoseconds delay, bool clientOnly)
|
||||||
{
|
{
|
||||||
|
if (clientOnly && (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled())) return;
|
||||||
|
|
||||||
Scheduler::DelayedSlot slot;
|
Scheduler::DelayedSlot slot;
|
||||||
slot.callback = callback;
|
slot.callback = callback;
|
||||||
slot.delay = delay;
|
slot.delay = delay;
|
||||||
|
@ -11,10 +11,10 @@ namespace Components
|
|||||||
~Scheduler();
|
~Scheduler();
|
||||||
|
|
||||||
static void OnShutdown(Utils::Slot<Callback> callback);
|
static void OnShutdown(Utils::Slot<Callback> callback);
|
||||||
static void OnFrame(Utils::Slot<Callback> callback);
|
static void OnFrame(Utils::Slot<Callback> callback, bool clientOnly = false);
|
||||||
static void OnReady(Utils::Slot<Callback> callback);
|
static void OnReady(Utils::Slot<Callback> callback, bool clientOnly = false);
|
||||||
static void Once(Utils::Slot<Callback> callback);
|
static void Once(Utils::Slot<Callback> callback, bool clientOnly = false);
|
||||||
static void OnDelay(Utils::Slot<Callback> callback, std::chrono::nanoseconds delay);
|
static void OnDelay(Utils::Slot<Callback> callback, std::chrono::nanoseconds delay, bool clientOnly = false);
|
||||||
|
|
||||||
static void FrameHandler();
|
static void FrameHandler();
|
||||||
|
|
||||||
|
@ -853,7 +853,7 @@ namespace Components
|
|||||||
|
|
||||||
// This is placed here in case the anticheat has been disabled!
|
// This is placed here in case the anticheat has been disabled!
|
||||||
#if !defined(DEBUG) && !defined(DISABLE_ANTICHEAT) && defined(PROCTECT_PROCESS)
|
#if !defined(DEBUG) && !defined(DISABLE_ANTICHEAT) && defined(PROCTECT_PROCESS)
|
||||||
if(!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled()) Scheduler::OnFrame(AntiCheat::ReadIntegrityCheck);
|
Scheduler::OnFrame(AntiCheat::ReadIntegrityCheck, true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user