1
0
mirror of https://github.com/ValveSoftware/Proton.git synced 2025-01-26 21:48:31 +03:00

lsteamclient: Strip interface version suffixes early.

CW-Bug-Id: 
This commit is contained in:
Rémi Bernon 2023-09-20 21:22:29 +02:00
parent d1baf2d116
commit 3008287221

@ -247,6 +247,7 @@ POST_EXEC_FUNCS = {
} }
INTERFACE_NAME_VERSION = re.compile(r'^(?P<name>.+?)(?P<version>\d*)$') INTERFACE_NAME_VERSION = re.compile(r'^(?P<name>.+?)(?P<version>\d*)$')
DEFINE_INTERFACE_VERSION = re.compile(r'^#define\s*(?P<name>STEAM(?:\w*)_VERSION(?:\w*))\s*"(?P<version>.*)"')
def method_needs_manual_handling(interface_with_version, method_name): def method_needs_manual_handling(interface_with_version, method_name):
match_dict = INTERFACE_NAME_VERSION.match(interface_with_version).groupdict() match_dict = INTERFACE_NAME_VERSION.match(interface_with_version).groupdict()
@ -918,13 +919,9 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
def get_iface_version(classname): def get_iface_version(classname):
# ISteamClient -> STEAMCLIENT_INTERFACE_VERSION # ISteamClient -> STEAMCLIENT_INTERFACE_VERSION
defname = f"{classname[1:].upper()}_INTERFACE_VERSION" key = classname[1:].upper()
if defname in iface_versions.keys(): if key in iface_versions:
ver = iface_versions[defname] ver = iface_versions[key]
else:
defname = f"{classname[1:].upper()}_VERSION"
if defname in iface_versions.keys():
ver = iface_versions[defname]
else: else:
ver = "UNVERSIONED" ver = "UNVERSIONED"
if classname in class_versions.keys() and ver in class_versions[classname]: if classname in class_versions.keys() and ver in class_versions[classname]:
@ -1293,7 +1290,6 @@ def parse(sources, abi):
def load(sdkver): def load(sdkver):
prog = re.compile("^#define\s*(\w*)\s*\"(.*)\"")
sdkdir = f"steamworks_sdk_{sdkver}" sdkdir = f"steamworks_sdk_{sdkver}"
sources = {} sources = {}
@ -1303,16 +1299,15 @@ def load(sdkver):
# (typically the copyright symbol); therefore we ignore UTF-8 # (typically the copyright symbol); therefore we ignore UTF-8
# encoding errors # encoding errors
lines = open(f"{sdkdir}/{file}", "r", errors="replace").readlines() lines = open(f"{sdkdir}/{file}", "r", errors="replace").readlines()
if file == "isteammasterserverupdater.h":
if """#error "This file isn't used any more"\n""" in lines: if """#error "This file isn't used any more"\n""" in lines:
sources[f"{sdkdir}/isteammasterserverupdater.h"] = "" sources[f"{sdkdir}/{file}"] = ""
for line in lines: results = (DEFINE_INTERFACE_VERSION.match(l) for l in lines)
if "define STEAM" in line and "_VERSION" in line: for result in (r.groupdict() for r in results if r):
result = prog.match(line) name, version = result['name'], result['version']
if result: name = name.replace('_INTERFACE_VERSION', '')
iface, version = result.group(1, 2) name = name.replace('_VERSION', '')
versions[iface] = version versions[name] = version
source = [f'#if __has_include("{sdkdir}/{file}")\n' source = [f'#if __has_include("{sdkdir}/{file}")\n'
f'#include "{sdkdir}/{file}"\n' f'#include "{sdkdir}/{file}"\n'