[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(0x60BE8E, 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
|
||||
Utils::Hook(0x426580, AntiCheat::DObjGetWorldTagPosStub, HOOK_JUMP).install()->quick();
|
||||
|
@ -161,7 +161,7 @@ namespace Components
|
||||
lastValidName = name;
|
||||
Friends::UpdateName();
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
|
||||
std::string username = "Unknown Soldier";
|
||||
|
||||
|
@ -174,23 +174,21 @@ namespace Components
|
||||
|
||||
#ifdef DEBUG
|
||||
// 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);
|
||||
float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
color[0] = 0.6588f;
|
||||
color[1] = 1.0000f;
|
||||
color[2] = 0.0000f;
|
||||
}
|
||||
|
||||
// Change the color when attaching a debugger
|
||||
if (IsDebuggerPresent())
|
||||
{
|
||||
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);
|
||||
});
|
||||
}
|
||||
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);
|
||||
}, true);
|
||||
#endif
|
||||
#if !defined(DEBUG) || defined(FORCE_EXCEPTION_HANDLER)
|
||||
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;
|
||||
|
||||
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) };
|
||||
|
||||
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);
|
||||
});
|
||||
}, true);
|
||||
|
||||
Command::Add("loadzone", [] (Command::Params* params)
|
||||
{
|
||||
|
@ -1007,7 +1007,7 @@ namespace Components
|
||||
{
|
||||
Command::Execute("closemenu popup_reconnectingtoparty", false);
|
||||
Command::Execute("reconnect", false);
|
||||
}, 6s);
|
||||
}, 6s, true);
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
}
|
||||
|
||||
Maps::~Maps()
|
||||
|
@ -193,7 +193,7 @@ namespace Components
|
||||
// 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);
|
||||
// });
|
||||
// }, true);
|
||||
}
|
||||
|
||||
Materials::~Materials()
|
||||
|
@ -290,7 +290,7 @@ namespace Components
|
||||
Party::ConnectError("Playlist request timed out.");
|
||||
}
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
|
||||
// Basic info handler
|
||||
Network::Handle("getInfo", [] (Network::Address address, std::string data)
|
||||
|
@ -656,15 +656,13 @@ namespace Components
|
||||
// Constantly draw the mini console
|
||||
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
|
||||
// Remove missing tag message
|
||||
Utils::Hook::Nop(0x4EBF1A, 5);
|
||||
|
@ -10,8 +10,9 @@ namespace Components
|
||||
Utils::Signal<Scheduler::Callback> Scheduler::FrameOnceSignal;
|
||||
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);
|
||||
}
|
||||
|
||||
@ -20,13 +21,15 @@ namespace Components
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
else Scheduler::ReadySignal.connect(callback);
|
||||
}
|
||||
@ -57,8 +60,10 @@ namespace Components
|
||||
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;
|
||||
slot.callback = callback;
|
||||
slot.delay = delay;
|
||||
|
@ -11,10 +11,10 @@ namespace Components
|
||||
~Scheduler();
|
||||
|
||||
static void OnShutdown(Utils::Slot<Callback> callback);
|
||||
static void OnFrame(Utils::Slot<Callback> callback);
|
||||
static void OnReady(Utils::Slot<Callback> callback);
|
||||
static void Once(Utils::Slot<Callback> callback);
|
||||
static void OnDelay(Utils::Slot<Callback> callback, std::chrono::nanoseconds delay);
|
||||
static void OnFrame(Utils::Slot<Callback> callback, bool clientOnly = false);
|
||||
static void OnReady(Utils::Slot<Callback> callback, bool clientOnly = false);
|
||||
static void Once(Utils::Slot<Callback> callback, bool clientOnly = false);
|
||||
static void OnDelay(Utils::Slot<Callback> callback, std::chrono::nanoseconds delay, bool clientOnly = false);
|
||||
|
||||
static void FrameHandler();
|
||||
|
||||
|
@ -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)
|
||||
if(!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled()) Scheduler::OnFrame(AntiCheat::ReadIntegrityCheck);
|
||||
Scheduler::OnFrame(AntiCheat::ReadIntegrityCheck, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user