-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
premake5.lua
107 lines (95 loc) · 3.72 KB
/
premake5.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
newoption {
trigger = "with-version",
value = "STRING",
description = "Current version",
default = "1.0",
}
workspace "MaxPayne3.FusionFix"
configurations { "Release", "Debug" }
architecture "x86"
location "build"
cppdialect "C++latest"
kind "SharedLib"
language "C++"
targetdir "bin/%{cfg.buildcfg}"
targetextension ".asi"
buildoptions { "/dxifcInlineFunctions-" }
defines { "rsc_CompanyName=\"MaxPayne3.FusionFix\"" }
defines { "rsc_LegalCopyright=\"MaxPayne3.FusionFix\""}
defines { "rsc_InternalName=\"%{prj.name}\"", "rsc_ProductName=\"%{prj.name}\"", "rsc_OriginalFilename=\"%{prj.name}.dll\"" }
defines { "rsc_FileDescription=\"MaxPayne3.FusionFix\"" }
defines { "rsc_UpdateUrl=\"https://github.com/ThirteenAG/MaxPayne3.FusionFix\"" }
local major = 1
local minor = 0
local build = 0
local revision = 0
if(_OPTIONS["with-version"]) then
local t = {}
for i in _OPTIONS["with-version"]:gmatch("([^.]+)") do
t[#t + 1], _ = i:gsub("%D+", "")
end
while #t < 4 do t[#t + 1] = 0 end
major = math.min(tonumber(t[1]), 255)
minor = math.min(tonumber(t[2]), 255)
build = math.min(tonumber(t[3]), 65535)
revision = math.min(tonumber(t[4]), 65535)
end
defines { "rsc_FileVersion_MAJOR=" .. major }
defines { "rsc_FileVersion_MINOR=" .. minor }
defines { "rsc_FileVersion_BUILD=" .. build }
defines { "rsc_FileVersion_REVISION=" .. revision }
defines { "rsc_FileVersion=\"" .. major .. "." .. minor .. "." .. build .. "\"" }
defines { "rsc_ProductVersion=\"" .. major .. "." .. minor .. "." .. build .. "\"" }
defines { "_CRT_SECURE_NO_WARNINGS" }
includedirs { "source" }
includedirs { "source/includes" }
includedirs { "source/ledsdk" }
includedirs { "source/dxsdk" }
libdirs { "source/ledsdk" }
libdirs { "source/dxsdk" }
files { "source/*.h", "source/*.hpp", "source/*.cpp", "source/*.hxx", "source/*.ixx" }
files { "source/resources/Versioninfo.rc" }
links { "LogitechLEDLib.lib" }
includedirs { "external/hooking" }
includedirs { "external/injector/include" }
includedirs { "external/injector/safetyhook/include" }
includedirs { "external/injector/zydis" }
includedirs { "external/inireader" }
files { "external/hooking/Hooking.Patterns.h", "external/hooking/Hooking.Patterns.cpp" }
files { "external/injector/safetyhook/include/**.hpp", "external/injector/safetyhook/src/**.cpp" }
files { "external/injector/zydis/**.h", "external/injector/zydis/**.c" }
characterset ("Unicode")
pbcommands = {
"setlocal EnableDelayedExpansion",
--"set \"path=" .. (gamepath) .. "\"",
"set file=$(TargetPath)",
"FOR %%i IN (\"%file%\") DO (",
"set filename=%%~ni",
"set fileextension=%%~xi",
"set target=!path!!filename!!fileextension!",
"if exist \"!target!\" copy /y \"!file!\" \"!target!\"",
")" }
function setpaths (gamepath, exepath, scriptspath)
scriptspath = scriptspath or "scripts/"
if (gamepath) then
cmdcopy = { "set \"path=" .. gamepath .. scriptspath .. "\"" }
table.insert(cmdcopy, pbcommands)
postbuildcommands (cmdcopy)
debugdir (gamepath)
if (exepath) then
debugcommand (gamepath .. exepath)
dir, file = exepath:match'(.*/)(.*)'
debugdir (gamepath .. (dir or ""))
end
end
targetdir ("bin")
end
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
staticruntime "On"
project "MaxPayne3.FusionFix"
setpaths("Z:/WFP/Games/Max Payne/Max Payne 3/", "MaxPayne3.exe", "plugins/")