mirror of
https://github.com/ivall/xcl.git
synced 2026-11-24 05:14:57 +01:00
576b4db5d8
- Persistent local storage was passed to the PC runtime, which fails it for an unpackaged process: now XCL's own. - XSystemGetDeviceType is computed by the thunk library from HKLM\...\OEM ConsoleMode (mapping read from the game's XCurl.dll): kernelx answers that registry key (0x64 Series X, 0x60 Series S); advapi32 imports go through kernelx. - gdk_table.rs: the GDK runtime's 396 functions with class, interface and slot as the public PC GDK's thunk library calls them. XCL's objects are built from it by function name: the interface versions of a class share a vtable, unknown versions get the main one, and unimplemented functions are reported by name. Agrees with the slots the game's own thunks use (test) and fixes two guessed XPackage slots. - New: XUser devices and the remaining XUser calls, XPackage (locale, chunks, install, MountWithUi, EnumeratePackages), XSystem, analytics, runtime features, XDisplay, XGameEvent (offline); XAppBroadcast / XAppCapture refused. - Pipelines: releasing a stand-in releases its background-built pipeline and forgets the address; PSO tests work with a cold DXIL cache.
25 lines
1.5 KiB
Python
25 lines
1.5 KiB
Python
"""Generate crates/xcl/src/hle/xgameruntime/gdk_table.rs from a table of the GDK runtime's
|
||
functions: every function with the class, interface and vtable slot its thunk uses
|
||
(QueryApiImpl protocol), as extracted from the public PC GDK's xgameruntime.lib. Input lines:
|
||
`NAME(function, "class guid", "interface guid", slot)`.
|
||
|
||
usage: python scripts/gen_gdk_table.py <table file>"""
|
||
import io, os, re, sys
|
||
|
||
src = io.open(sys.argv[1], encoding='utf-8').read()
|
||
origin = re.search(r'Source\s*:\s*(\S+)', src)
|
||
rows = re.findall(r'\w+\((\w+), "([0-9A-Fa-f-]{36})", "([0-9A-Fa-f-]{36})", (\d+)\)', src)
|
||
assert rows, 'no rows'
|
||
hexg = lambda g: '0x' + g.replace('-', '').lower()
|
||
OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'crates', 'xcl', 'src', 'hle', 'xgameruntime', 'gdk_table.rs')
|
||
with io.open(OUT, 'w', encoding='utf-8', newline='\n') as f:
|
||
f.write('//! Generated by scripts/gen_gdk_table.py – do not edit.\n')
|
||
f.write(f'//! The GDK runtime\'s functions as the public PC GDK\'s xgameruntime.lib ({origin.group(1) if origin else "?"}) calls them:\n')
|
||
f.write('//! the (class, interface) its thunk asks QueryApiImpl for and the vtable slot it calls.\n\n')
|
||
f.write('/// (function, class id, interface id, slot)\n')
|
||
f.write('pub static API: &[(&str, u128, u128, u8)] = &[\n')
|
||
for name, c, i, slot in sorted(rows, key=lambda r: (r[1], r[2], int(r[3]))):
|
||
f.write(f' ("{name}", {hexg(c)}, {hexg(i)}, {slot}),\n')
|
||
f.write('];\n')
|
||
print(len(rows), 'rows ->', os.path.normpath(OUT))
|