2017-07-05 11:57:52 -04:00
|
|
|
#include "STDInclude.hpp"
|
2017-09-03 14:31:58 -04:00
|
|
|
|
|
|
|
#ifdef COMPILE_IW4MVM
|
2017-07-05 11:57:52 -04:00
|
|
|
#include <IW4MVM/client_main.h>
|
2017-09-03 14:31:58 -04:00
|
|
|
#endif
|
2017-07-05 11:57:52 -04:00
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
IW4MVM::IW4MVM()
|
|
|
|
{
|
2017-07-05 15:37:54 -04:00
|
|
|
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled() || Monitor::IsEnabled() || Loader::IsPerformingUnitTests()) return;
|
|
|
|
|
2017-07-05 11:57:52 -04:00
|
|
|
DWORD oldProtect;
|
2020-12-19 18:00:07 -05:00
|
|
|
std::uint8_t* _module = reinterpret_cast<std::uint8_t*>(GetModuleHandle(nullptr));
|
|
|
|
VirtualProtect(_module + 0x1000, 0x2D6000, PAGE_EXECUTE_READWRITE, &oldProtect);
|
2017-07-05 11:57:52 -04:00
|
|
|
|
2017-09-03 14:31:58 -04:00
|
|
|
#ifdef COMPILE_IW4MVM
|
2017-07-05 11:57:52 -04:00
|
|
|
client_main::Init();
|
|
|
|
Scheduler::Once(client_main::PostInit);
|
2017-09-03 14:31:58 -04:00
|
|
|
#endif
|
2017-07-08 19:54:02 -04:00
|
|
|
Scheduler::OnFrame([]()
|
|
|
|
{
|
|
|
|
if (!Game::CL_IsCgameInitialized())
|
|
|
|
{
|
2021-08-29 11:41:21 -04:00
|
|
|
Dvar::Var("com_timescale").set(1.0f);
|
2017-07-08 19:54:02 -04:00
|
|
|
}
|
|
|
|
});
|
2017-07-05 11:57:52 -04:00
|
|
|
|
2020-12-19 18:00:07 -05:00
|
|
|
VirtualProtect(_module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect);
|
2017-07-05 11:57:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
IW4MVM::~IW4MVM()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|