[IW4MVM] Easily switch the component off

This commit is contained in:
momo5502 2017-09-03 20:31:58 +02:00
parent 5d4cd82ed1
commit c7b5d5a2b8
3 changed files with 8 additions and 1 deletions

View File

@ -49,7 +49,7 @@ namespace Components
Loader::Register(new Zones()); Loader::Register(new Zones());
Loader::Register(new Colors()); Loader::Register(new Colors());
Loader::Register(new D3D9Ex()); Loader::Register(new D3D9Ex());
#if !defined(VLD_RPTHOOK_INSTALL) || defined(VLDEnable) // IW4MVM uses detours which produces memory leaks, but those are not really relevant #if (!defined(VLD_RPTHOOK_INSTALL) || defined(VLDEnable)) && defined(COMPILE_IW4MVM) // IW4MVM uses detours which produces memory leaks, but those are not really relevant
Loader::Register(new IW4MVM()); Loader::Register(new IW4MVM());
#endif #endif
Loader::Register(new Logger()); Loader::Register(new Logger());

View File

@ -1,5 +1,8 @@
#include "STDInclude.hpp" #include "STDInclude.hpp"
#ifdef COMPILE_IW4MVM
#include <IW4MVM/client_main.h> #include <IW4MVM/client_main.h>
#endif
namespace Components namespace Components
{ {
@ -11,8 +14,10 @@ namespace Components
std::uint8_t* module = reinterpret_cast<std::uint8_t*>(GetModuleHandle(nullptr)); std::uint8_t* module = reinterpret_cast<std::uint8_t*>(GetModuleHandle(nullptr));
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READWRITE, &oldProtect); VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READWRITE, &oldProtect);
#ifdef COMPILE_IW4MVM
client_main::Init(); client_main::Init();
Scheduler::Once(client_main::PostInit); Scheduler::Once(client_main::PostInit);
#endif
Scheduler::OnFrame([]() Scheduler::OnFrame([]()
{ {
if (!Game::CL_IsCgameInitialized()) if (!Game::CL_IsCgameInitialized())

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#define COMPILE_IW4MVM
namespace Components namespace Components
{ {
class IW4MVM : public Component class IW4MVM : public Component