UE4SS v4.0.0 (commit 30afe5ff) is the first official release since the 1195 build this mod was made for. The two are 36 commits apart, and none of them touches the C++ mod interface: the pinned SDK headers are byte-identical at both commits, and all 17 UE4SS functions the mod imports exist in both DLLs. So one DLL serves both builds. - build_profile.hpp: the single UE4SS hash becomes a list of verified builds, v4.0.0 (3843d81a..., the official release zip) and v3.0.1-1195-g1ceefac8 (e1fb9a7e...). - compatibility.cpp: the startup check accepts a DLL from that list, logs "Verified UE4SS <build>", and still refuses any other UE4SS.dll. - verify_build.py: checks the given UE4SS.dll against the list and records which build it is. - prepare_sdk.py: pinned to v4.0.0; the regenerated headers are unchanged, only PROVENANCE.txt names the new commit. - Version 1.2; README, mod.json and the openmods files name both builds. Built with warnings as errors; the native hook test passes; verify_build.py passes against the game's PBZ.exe with either UE4SS.dll and refuses a wrong one. Not yet tested in game on v4.0.0.
53 lines
2.8 KiB
Python
53 lines
2.8 KiB
Python
"""Create a small, ABI-preserving SDK include set from UE4SS v4.0.0 (the same files as build 1195)."""
|
|
from pathlib import Path
|
|
import argparse
|
|
import subprocess
|
|
import sys
|
|
sys.path.insert(0, str(Path(__file__).parent / 'python'))
|
|
import pefile
|
|
|
|
PIN = '30afe5fff94a94c2313e220b2002059a080da9a0' # tag v4.0.0; these files equal build 1195's (1ceefac8)
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('repo', type=Path)
|
|
parser.add_argument('dll', type=Path)
|
|
args = parser.parse_args()
|
|
root = Path(__file__).resolve().parents[1]
|
|
output = root / 'tools/vendor/ue4ss-sdk'
|
|
files = {
|
|
'UE4SS/include/Mod/CppUserModBase.hpp': 'Mod/CppUserModBase.hpp',
|
|
'UE4SS/include/Common.hpp': 'Common.hpp',
|
|
'UE4SS/include/LibBoundaryWrappers.hpp': 'LibBoundaryWrappers.hpp',
|
|
'deps/first/File/include/File/Macros.hpp': 'File/Macros.hpp',
|
|
'deps/first/String/include/String/StringType.hpp': 'String/StringType.hpp',
|
|
'deps/first/Input/include/Input/Handler.hpp': 'Input/Handler.hpp',
|
|
'deps/first/Input/include/Input/Common.hpp': 'Input/Common.hpp',
|
|
'deps/first/Input/include/Input/KeyDef.hpp': 'Input/KeyDef.hpp',
|
|
'LICENSE': 'LICENSE',
|
|
}
|
|
for source, destination in files.items():
|
|
raw = subprocess.check_output(['git', '-c', f'safe.directory={args.repo.resolve().as_posix()}',
|
|
'-C', str(args.repo), 'show', f'{PIN}:{source}'])
|
|
text = raw.decode('utf-8')
|
|
if destination == 'Mod/CppUserModBase.hpp':
|
|
# GUITab is used only through shared_ptr and a callback typedef. Keep all
|
|
# fields, virtual slots and function types; avoid pulling in the GUI SDK.
|
|
text = text.replace('#include <GUI/GUITab.hpp>',
|
|
'namespace RC::GUI { class GUITab; }')
|
|
text = text.replace('GUI::GUITab::RenderFunctionType', 'void (*)(CppUserModBase*)')
|
|
target = output / destination
|
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
target.write_text(text, encoding='utf-8')
|
|
|
|
pe = pefile.PE(str(args.dll), fast_load=True)
|
|
pe.parse_data_directories(directories=[pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_EXPORT']])
|
|
exports = [s.name.decode('ascii') for s in pe.DIRECTORY_ENTRY_EXPORT.symbols if s.name]
|
|
(root/'build/UE4SS.def').write_text('LIBRARY UE4SS.dll\nEXPORTS\n' +
|
|
'\n'.join(exports) + '\n', encoding='ascii')
|
|
(output/'PROVENANCE.txt').write_text(
|
|
f'UE4SS-RE/RE-UE4SS commit {PIN} (tag v4.0.0)\n'
|
|
'The same files are byte-identical at commit 1ceefac8b8c286f0fb3eb62b4aae075ff81df0bd (build 1195).\n'
|
|
'CppUserModBase.hpp: GUI include replaced with a forward declaration;\n'
|
|
'register_tab callback typedef expanded to its identical function-pointer type.\n'
|
|
'No object fields or virtual methods changed. Other headers unchanged.\n', encoding='utf-8')
|
|
print('Prepared pinned SDK headers and import-library definition.')
|