Make things build on clang-21

This commit is contained in:
Will Toohey 2026-02-23 09:14:42 +10:00
parent 2416c68614
commit e74b841909
7 changed files with 60 additions and 39 deletions

View File

@ -64,12 +64,15 @@ ignore_functions = [
b"RtlLookupFunctionEntry",
b"RtlUnwindEx",
b"RtlVirtualUnwind",
b"RtlRestoreContext",
b"__C_specific_handler",
]
exceptions = []
for dll_name, imports in needed_functions.items():
if (dll := available_functions.get(dll_name)) is None:
raise MissingDLL(f"Need {dll_name} but it's not in the XP DLLs folder")
exceptions.append(MissingDLL(f"Need {dll_name} but it's not in the XP DLLs folder"))
continue
for name, ordinal in imports:
if name is not None:
@ -77,13 +80,18 @@ for dll_name, imports in needed_functions.items():
continue
if next((fn for fn in dll if fn[0] == name), None) is None:
raise MissingFunction(f'Function "{name}" not present in XP {dll_name}')
exceptions.append(MissingFunction(f'Function "{name}" not present in XP {dll_name}'))
continue
elif ordinal is not None:
if next((fn for fn in dll if fn[1] == ordinal), None) is None:
raise MissingFunction(
exceptions.append(MissingFunction(
f"Function with ordinal {ordinal} not present in XP {dll_name}"
)
))
continue
else:
raise RuntimeError("Import with no name or ordinal???")
if exceptions:
raise ExceptionGroup("Failures", exceptions)
print("All functions present!")

View File

@ -1,6 +1,6 @@
project('layeredfs', 'c', 'cpp', version: '3.10',
default_options: [
'cpp_std=c++20',
'cpp_std=c++23',
'buildtype=release',
'strip=true',
'werror=true',
@ -193,33 +193,35 @@ foreach cfg : injector_cfgs
)
endforeach
gtest_proj = subproject('gtest', required: false, default_options: {'default_library': 'static'})
gtest_main_dep = gtest_proj.get_variable('gtest_main_dep')
gmock_dep = gtest_proj.get_variable('gmock_dep')
if host_machine.cpu_family() == 'x86_64'
gtest_proj = subproject('gtest', required: false, default_options: {'default_library': 'static'})
gtest_main_dep = gtest_proj.get_variable('gtest_main_dep')
gmock_dep = gtest_proj.get_variable('gmock_dep')
test('unit tests', executable('tests_bin',
sources: 'src/tests.cpp',
link_with: [layeredfs_lib, texbin_lib, avs_standalone_lib],
dependencies: [layeredfs_cfg_dep, gtest_main_dep, gmock_dep],
build_by_default: false,
),
workdir: meson.current_source_dir(),
)
test('unit tests', executable('tests_bin',
sources: 'src/tests.cpp',
link_with: [layeredfs_lib, texbin_lib, avs_standalone_lib],
dependencies: [layeredfs_cfg_dep, gtest_main_dep, gmock_dep],
build_by_default: false,
),
workdir: meson.current_source_dir(),
)
test('commandline parsing test', executable('test_commandline',
sources: 'src/test_commandline.cpp',
link_with: [layeredfs_lib, texbin_lib, avs_standalone_lib],
dependencies: [layeredfs_cfg_dep, gtest_main_dep, gmock_dep],
build_by_default: false,
),
workdir: meson.current_source_dir(),
args: [
'--layered-disable',
'--layered-verbose',
'--layered-devmode',
'--layered-allowlist=allowed,these folders',
'--layered-blocklist=blocked,these folders',
'--layered-logfile=some logfile.log',
'--layered-data-mods-folder=./some modfolder',
]
)
test('commandline parsing test', executable('test_commandline',
sources: 'src/test_commandline.cpp',
link_with: [layeredfs_lib, texbin_lib, avs_standalone_lib],
dependencies: [layeredfs_cfg_dep, gtest_main_dep, gmock_dep],
build_by_default: false,
),
workdir: meson.current_source_dir(),
args: [
'--layered-disable',
'--layered-verbose',
'--layered-devmode',
'--layered-allowlist=allowed,these folders',
'--layered-blocklist=blocked,these folders',
'--layered-logfile=some logfile.log',
'--layered-data-mods-folder=./some modfolder',
]
)
endif

View File

@ -10,6 +10,10 @@
#include "hde32.h"
#include "table32.h"
#ifdef _MSC_VER
#include <intrin.h>
#endif
unsigned int hde32_disasm(const void *code, hde32s *hs)
{
uint8_t x, c, *p = (uint8_t *)code, cflags, opcode, pref = 0;

View File

@ -28,6 +28,10 @@
#include <windows.h>
#ifdef _MSC_VER
#include <intrin.h>
#endif
#ifndef ARRAYSIZE
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
#endif

View File

@ -1,4 +1,5 @@
#include <stdint.h>
#include <windows.h>
#include <winternl.h>
#include "hook.h"

View File

@ -9,6 +9,8 @@
#include "3rd_party/md5.h"
#define strcasecmp _stricmp
#define lenof(x) (sizeof(x) / sizeof(*x))
char* snprintf_auto(const char* fmt, ...);

View File

@ -2,12 +2,12 @@ EXPORTS
; These are used by windows internals, don't hook them.
; Specifically, @17 is called when "Disable fullscreen optimizations" is checked,
; and this is done with the loader lock held, so the real system DLL loading fails
__ord16 = "C:\Windows\System32\d3d9.#16" @16,NONAME
__ord17 = "C:\Windows\System32\d3d9.#17" @17,NONAME
__ord18 = "C:\Windows\System32\d3d9.#18" @18,NONAME
__ord19 = "C:\Windows\System32\d3d9.#19" @19,NONAME
__ord22 = "C:\Windows\System32\d3d9.#22" @22,NONAME
__ord23 = "C:\Windows\System32\d3d9.#23" @23,NONAME
__ord16 = "C:\Windows\System32\d3d9.#16" @16 NONAME
__ord17 = "C:\Windows\System32\d3d9.#17" @17 NONAME
__ord18 = "C:\Windows\System32\d3d9.#18" @18 NONAME
__ord19 = "C:\Windows\System32\d3d9.#19" @19 NONAME
__ord22 = "C:\Windows\System32\d3d9.#22" @22 NONAME
__ord23 = "C:\Windows\System32\d3d9.#23" @23 NONAME
Direct3DCreate9On12 @20
Direct3DCreate9On12Ex @21
Direct3DShaderValidatorCreate9 @24