[IW4MVM] Include IW4MVM
This commit is contained in:
parent
33d15d96cc
commit
bbc28a0a8b
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -29,3 +29,6 @@
|
|||||||
[submodule "deps/udis86"]
|
[submodule "deps/udis86"]
|
||||||
path = deps/udis86
|
path = deps/udis86
|
||||||
url = ../udis86.git
|
url = ../udis86.git
|
||||||
|
[submodule "deps/iw4mvm"]
|
||||||
|
path = deps/iw4mvm
|
||||||
|
url = ../../luckyy/IW4MVM_IW4X.git
|
||||||
|
1
deps/iw4mvm
vendored
Submodule
1
deps/iw4mvm
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit b46e28f4cf044699433ff2dff459f498e418a430
|
54
premake/iw4mvm.lua
Normal file
54
premake/iw4mvm.lua
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
iw4mvm = {
|
||||||
|
settings = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
function iw4mvm.setup(settings)
|
||||||
|
if not settings.source then error("Missing source.") end
|
||||||
|
|
||||||
|
iw4mvm.settings = settings
|
||||||
|
|
||||||
|
if not iw4mvm.settings.defines then iw4mvm.settings.defines = {} end
|
||||||
|
end
|
||||||
|
|
||||||
|
function iw4mvm.import()
|
||||||
|
if not iw4mvm.settings then error("You need to call iw4mvm.setup first") end
|
||||||
|
|
||||||
|
links { "iw4mvm" }
|
||||||
|
iw4mvm.includes()
|
||||||
|
end
|
||||||
|
|
||||||
|
function iw4mvm.includes()
|
||||||
|
if not iw4mvm.settings then error("You need to call iw4mvm.setup first") end
|
||||||
|
|
||||||
|
includedirs { iw4mvm.settings.source }
|
||||||
|
libdirs { path.join(iw4mvm.settings.source, "IW4MVM") }
|
||||||
|
defines(iw4mvm.settings.defines)
|
||||||
|
end
|
||||||
|
|
||||||
|
function iw4mvm.project()
|
||||||
|
if not iw4mvm.settings then error("You need to call iw4mvm.setup first") end
|
||||||
|
|
||||||
|
project "iw4mvm"
|
||||||
|
language "C++"
|
||||||
|
|
||||||
|
characterset ("MBCS")
|
||||||
|
|
||||||
|
defines("_CRT_SECURE_NO_WARNINGS")
|
||||||
|
|
||||||
|
iw4mvm.includes()
|
||||||
|
files
|
||||||
|
{
|
||||||
|
path.join(iw4mvm.settings.source, "IW4MVM/*.h"),
|
||||||
|
path.join(iw4mvm.settings.source, "IW4MVM/*.cpp"),
|
||||||
|
}
|
||||||
|
|
||||||
|
removefiles
|
||||||
|
{
|
||||||
|
--path.join(iw4mvm.settings.source, "IW4MVM/detours.cpp"),
|
||||||
|
path.join(iw4mvm.settings.source, "IW4MVM/DllMain.cpp"),
|
||||||
|
}
|
||||||
|
|
||||||
|
-- not our code, ignore POSIX usage warnings for now
|
||||||
|
warnings "Off"
|
||||||
|
kind "StaticLib"
|
||||||
|
end
|
@ -21,7 +21,6 @@ function zlib.includes()
|
|||||||
if not zlib.settings then error("You need to call zlib.setup first") end
|
if not zlib.settings then error("You need to call zlib.setup first") end
|
||||||
|
|
||||||
includedirs { zlib.settings.source }
|
includedirs { zlib.settings.source }
|
||||||
defines { "ssize_t=int" }
|
|
||||||
defines(zlib.settings.defines)
|
defines(zlib.settings.defines)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -46,9 +45,5 @@ function zlib.project()
|
|||||||
-- not our code, ignore POSIX usage warnings for now
|
-- not our code, ignore POSIX usage warnings for now
|
||||||
warnings "Off"
|
warnings "Off"
|
||||||
|
|
||||||
kind "SharedLib"
|
kind "StaticLib"
|
||||||
--configuration "*Static"
|
|
||||||
defines { "_LIB" }
|
|
||||||
removedefines { "_USRDLL", "_DLL", "ZLIB_DLL" }
|
|
||||||
kind "StaticLib"
|
|
||||||
end
|
end
|
13
premake5.lua
13
premake5.lua
@ -181,6 +181,7 @@ require "premake/pdcurses"
|
|||||||
require "premake/protobuf"
|
require "premake/protobuf"
|
||||||
require "premake/zlib"
|
require "premake/zlib"
|
||||||
require "premake/udis86"
|
require "premake/udis86"
|
||||||
|
require "premake/iw4mvm"
|
||||||
|
|
||||||
json11.setup
|
json11.setup
|
||||||
{
|
{
|
||||||
@ -218,6 +219,7 @@ zlib.setup
|
|||||||
{
|
{
|
||||||
defines = {
|
defines = {
|
||||||
"ZLIB_CONST",
|
"ZLIB_CONST",
|
||||||
|
"ssize_t=int"
|
||||||
},
|
},
|
||||||
source = path.join(depsBasePath, "zlib"),
|
source = path.join(depsBasePath, "zlib"),
|
||||||
}
|
}
|
||||||
@ -225,6 +227,15 @@ udis86.setup
|
|||||||
{
|
{
|
||||||
source = path.join(depsBasePath, "udis86"),
|
source = path.join(depsBasePath, "udis86"),
|
||||||
}
|
}
|
||||||
|
iw4mvm.setup
|
||||||
|
{
|
||||||
|
defines = {
|
||||||
|
"IW4X",
|
||||||
|
"DETOURS_X86",
|
||||||
|
"DETOURS_32BIT",
|
||||||
|
},
|
||||||
|
source = path.join(depsBasePath, "iw4mvm"),
|
||||||
|
}
|
||||||
|
|
||||||
workspace "iw4x"
|
workspace "iw4x"
|
||||||
location "./build"
|
location "./build"
|
||||||
@ -312,6 +323,7 @@ workspace "iw4x"
|
|||||||
protobuf.import()
|
protobuf.import()
|
||||||
zlib.import()
|
zlib.import()
|
||||||
udis86.import()
|
udis86.import()
|
||||||
|
iw4mvm.import()
|
||||||
|
|
||||||
-- fix vpaths for protobuf sources
|
-- fix vpaths for protobuf sources
|
||||||
vpaths
|
vpaths
|
||||||
@ -424,6 +436,7 @@ workspace "iw4x"
|
|||||||
protobuf.project()
|
protobuf.project()
|
||||||
zlib.project()
|
zlib.project()
|
||||||
udis86.project()
|
udis86.project()
|
||||||
|
iw4mvm.project()
|
||||||
|
|
||||||
rule "ProtobufCompiler"
|
rule "ProtobufCompiler"
|
||||||
display "Protobuf compiler"
|
display "Protobuf compiler"
|
||||||
|
@ -49,6 +49,9 @@ 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
|
||||||
|
Loader::Register(new IW4MVM());
|
||||||
|
#endif
|
||||||
Loader::Register(new Logger());
|
Loader::Register(new Logger());
|
||||||
Loader::Register(new Script());
|
Loader::Register(new Script());
|
||||||
Loader::Register(new Weapon());
|
Loader::Register(new Weapon());
|
||||||
|
@ -89,6 +89,7 @@ namespace Components
|
|||||||
#include "Modules/Node.hpp"
|
#include "Modules/Node.hpp"
|
||||||
#include "Modules/RCon.hpp"
|
#include "Modules/RCon.hpp"
|
||||||
#include "Modules/Party.hpp" // Destroys the order, but requires network classes :D
|
#include "Modules/Party.hpp" // Destroys the order, but requires network classes :D
|
||||||
|
#include "Modules/IW4MVM.hpp"
|
||||||
#include "Modules/Logger.hpp"
|
#include "Modules/Logger.hpp"
|
||||||
#include "Modules/Friends.hpp"
|
#include "Modules/Friends.hpp"
|
||||||
#include "Modules/IPCPipe.hpp"
|
#include "Modules/IPCPipe.hpp"
|
||||||
|
22
src/Components/Modules/IW4MVM.cpp
Normal file
22
src/Components/Modules/IW4MVM.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include "STDInclude.hpp"
|
||||||
|
#include <IW4MVM/client_main.h>
|
||||||
|
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
IW4MVM::IW4MVM()
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect);
|
||||||
|
}
|
||||||
|
|
||||||
|
IW4MVM::~IW4MVM()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
src/Components/Modules/IW4MVM.hpp
Normal file
11
src/Components/Modules/IW4MVM.hpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
class IW4MVM : public Component
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IW4MVM();
|
||||||
|
~IW4MVM();
|
||||||
|
};
|
||||||
|
}
|
@ -70,7 +70,6 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*l
|
|||||||
|
|
||||||
DWORD oldProtect;
|
DWORD oldProtect;
|
||||||
std::uint8_t* module = reinterpret_cast<std::uint8_t*>(GetModuleHandle(nullptr));
|
std::uint8_t* module = reinterpret_cast<std::uint8_t*>(GetModuleHandle(nullptr));
|
||||||
//VirtualProtect(module, 0x6C73000, PAGE_EXECUTE_READWRITE, &oldProtect); // Unprotect the entire process
|
|
||||||
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect); // Protect the .text segment
|
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect); // Protect the .text segment
|
||||||
|
|
||||||
// Install entry point hook
|
// Install entry point hook
|
||||||
|
Loading…
Reference in New Issue
Block a user