iw4x-client/src/Components/Modules/IW4MVM.cpp

32 lines
721 B
C++
Raw Normal View History

2017-07-05 11:57:52 -04:00
#include "STDInclude.hpp"
#include <IW4MVM/client_main.h>
namespace Components
{
IW4MVM::IW4MVM()
{
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled() || Monitor::IsEnabled() || Loader::IsPerformingUnitTests()) return;
2017-07-05 11:57:52 -04:00
DWORD oldProtect;
std::uint8_t* module = reinterpret_cast<std::uint8_t*>(GetModuleHandle(nullptr));
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READWRITE, &oldProtect);
client_main::Init();
Scheduler::Once(client_main::PostInit);
Scheduler::OnFrame([]()
{
if (!Game::CL_IsCgameInitialized())
{
Dvar::Var("com_timescale").setRaw(1.0f);
}
});
2017-07-05 11:57:52 -04:00
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect);
}
IW4MVM::~IW4MVM()
{
}
}