1
+ -- Local Usage:
2
+ --
3
+ -- add_deps("commonlibsf")
4
+ -- add_rules("commonlibsf.plugin", {
5
+ -- name = "Plugin Name",
6
+ -- author = "Author Name",
7
+ -- description = "Plugin Description",
8
+
9
+ -- options = {
10
+ -- -- disable all compatibility checks completely
11
+ -- sig_scanning = true,
12
+ -- no_struct_use = true
13
+ -- }
14
+ -- })
15
+
1
16
local PLUGIN_FILE = [[
2
17
#include <SFSE/SFSE.h>
18
+ #include <REL/Relocation.h>
19
+
20
+ using namespace std::literals;
3
21
4
22
extern "C" __declspec(dllexport)
5
23
constinit auto SFSEPlugin_Version = []() noexcept {
6
24
SFSE::PluginVersionData v{};
7
25
v.PluginVersion({ ${PLUGIN_VERSION_MAJOR}, ${PLUGIN_VERSION_MINOR}, ${PLUGIN_VERSION_PATCH} });
8
26
v.PluginName("${PLUGIN_NAME}");
9
27
v.AuthorName("${PLUGIN_AUTHOR}");
10
- v.UsesAddressLibrary(true);
11
- v.IsLayoutDependent(true);
28
+ v.UsesSigScanning(${OPTION_SIG_SCANNING});
29
+ v.UsesAddressLibrary(${OPTION_ADDRESS_LIBRARY});
30
+ v.HasNoStructUse(${OPTION_NO_STRUCT_USE});
31
+ v.IsLayoutDependent(${OPTION_LAYOUT_DEPENDENT});
12
32
return v;
13
33
}();]]
14
34
46
66
END
47
67
END]]
48
68
49
- -- Local Usage:
50
- --
51
- -- add_deps("commonlibsf")
52
- -- add_rules("commonlibsf.plugin", {
53
- -- name = "Plugin Name",
54
- -- author = "Author Name",
55
- -- description = "Plugin Description"
56
- -- })
57
-
58
69
rule (" commonlibsf.plugin" )
59
70
add_deps (" win.sdk.resource" )
60
71
@@ -68,21 +79,52 @@ rule("commonlibsf.plugin")
68
79
69
80
local conf = target :extraconf (" rules" , " commonlibsf.plugin" )
70
81
local conf_dir = path .join (target :autogendir (), " rules" , " commonlibsf" , " plugin" )
82
+
83
+ if conf .options then
84
+ if conf .options .sig_scanning then
85
+ conf .options .address_library = false
86
+ else
87
+ conf .options .sig_scanning = false
88
+ if conf .options .address_library == nil then
89
+ conf .options .address_library = true
90
+ end
91
+ end
92
+ if conf .options .no_struct_use then
93
+ conf .options .layout_dependent = false
94
+ else
95
+ conf .options .no_struct_use = false
96
+ if conf .options .layout_dependent == nil then
97
+ conf .options .layout_dependent = true
98
+ end
99
+ end
100
+ else
101
+ conf .options = {
102
+ sig_scanning = false ,
103
+ address_library = true ,
104
+ no_struct_use = false ,
105
+ layout_dependent = true
106
+ }
107
+ end
71
108
72
109
local conf_map = {
73
- PLUGIN_AUTHOR = conf .author or " " ,
74
- PLUGIN_DESCRIPTION = conf .description or " " ,
75
- PLUGIN_LICENSE = (target :license () or " Unknown" ) .. " License" ,
76
- PLUGIN_NAME = conf .name or target :name (),
77
- PLUGIN_VERSION = target :version () or " 0.0.0" ,
78
- PLUGIN_VERSION_MAJOR = semver .new (target :version () or " 0.0.0" ):major (),
79
- PLUGIN_VERSION_MINOR = semver .new (target :version () or " 0.0.0" ):minor (),
80
- PLUGIN_VERSION_PATCH = semver .new (target :version () or " 0.0.0" ):patch (),
81
- PROJECT_NAME = project .name () or " " ,
82
- PROJECT_VERSION = project .version () or " 0.0.0" ,
83
- PROJECT_VERSION_MAJOR = semver .new (project .version () or " 0.0.0" ):major (),
84
- PROJECT_VERSION_MINOR = semver .new (project .version () or " 0.0.0" ):minor (),
85
- PROJECT_VERSION_PATCH = semver .new (project .version () or " 0.0.0" ):patch (),
110
+ PLUGIN_AUTHOR = conf .author or " " ,
111
+ PLUGIN_DESCRIPTION = conf .description or " " ,
112
+ PLUGIN_EMAIL = conf .email or " " ,
113
+ PLUGIN_LICENSE = (target :license () or " Unknown" ) .. " License" ,
114
+ PLUGIN_NAME = conf .name or target :name (),
115
+ PLUGIN_VERSION = target :version () or " 0.0.0" ,
116
+ PLUGIN_VERSION_MAJOR = semver .new (target :version () or " 0.0.0" ):major (),
117
+ PLUGIN_VERSION_MINOR = semver .new (target :version () or " 0.0.0" ):minor (),
118
+ PLUGIN_VERSION_PATCH = semver .new (target :version () or " 0.0.0" ):patch (),
119
+ PROJECT_NAME = project .name () or " " ,
120
+ PROJECT_VERSION = project .version () or " 0.0.0" ,
121
+ PROJECT_VERSION_MAJOR = semver .new (project .version () or " 0.0.0" ):major (),
122
+ PROJECT_VERSION_MINOR = semver .new (project .version () or " 0.0.0" ):minor (),
123
+ PROJECT_VERSION_PATCH = semver .new (project .version () or " 0.0.0" ):patch (),
124
+ OPTION_SIG_SCANNING = conf .options .sig_scanning ,
125
+ OPTION_ADDRESS_LIBRARY = conf .options .address_library ,
126
+ OPTION_NO_STRUCT_USE = conf .options .no_struct_use ,
127
+ OPTION_LAYOUT_DEPENDENT = conf .options .layout_dependent
86
128
}
87
129
88
130
local conf_parse = function (a_str )
0 commit comments