Curation round 2, wave A: anm2 (Anm2Ed JSON), text, config as idiomatic classes; SDL3 platform opens a window
- anm2.h/.cpp take over ANM2, AnimationState, LayerState, AnmCache and the frame data. They read Anm2Ed's JSON documents with simdjson and play them as the game does (interpolation baked at load). src/anm2/ and msvc.h are retired. - font, formatted_text, string_table and rich_text take over the text classes. FormattedText::parse is still bit-exact against its assembly. - options_config and challenge_params take over OptionsConfig, ChallengeParams and the .ini helpers. The tests include Save's exact bytes. - platform.h/.cpp and main.cpp run IsaacMain on SDL3: the window and GL context open, and the run stops at the first built-in shader (FUN_00a13fa0). - source_tree.py: a taken-over parent stays bytes, taken-over methods are not re-emitted as a namespace, and every address in a (a, b, c to d) list on a comment counts as taken over. - log.h: reconstruction_missing() for a taken-over class's methods that are not written yet. 206 functions taken over, boot path 89/615. The full build waits for wave B: item_config, entity_config and mod_manager still use the old APIs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d6e1ca7c6c
commit
780767f5e1
161 files changed
+8646
-21919
No files matched your search
+15
-4
@@ -363,7 +363,7 @@ stubs, dataStubs = [], [] # (owner, declaration, address): everything src/ has
|
||||
def class_emit(cls, stack=()):
|
||||
if cls in done or cls in stack or cls in PRELUDE_TYPES: return
|
||||
if cls in curatedClasses: return # declared by src/, only forward-declared here
|
||||
parent = base.get(cls) if base.get(cls) in names else None
|
||||
parent = base.get(cls) if base.get(cls) in names and base.get(cls) not in curatedClasses else None # a src/ parent stays bytes
|
||||
if parent: class_emit(parent, stack + (cls,))
|
||||
namespace, _, shortName = cls.rpartition('::')
|
||||
isNested = namespace in names # Cutscene::ANM2Part: declared inside Cutscene, defined after it
|
||||
@@ -449,7 +449,7 @@ def intrinsic_define(name): # CONCAT412: x=4, y=12; ZEXT1632: x=16, y=32 (a le
|
||||
# Everything that is not a method of a class above: free functions (FUN_ too) and namespace functions, as declared
|
||||
free, freeSeen = collections.defaultdict(list), set()
|
||||
for addr, (cls, method, ret, cc, params, thisParam, _) in sorted(funcs.items()):
|
||||
if cls in done or not IDENT.match(method) or (cls and not QUALIFIED.match(cls)) or (cls, method) in freeSeen or (not cls and method in STD_NAMES): continue
|
||||
if cls in done or cls in curatedClasses or not IDENT.match(method) or (cls and not QUALIFIED.match(cls)) or (cls, method) in freeSeen or (not cls and method in STD_NAMES): continue
|
||||
freeSeen.add((cls, method))
|
||||
if thisParam: params = [re.sub(r'\bthis$', 'self', thisParam)] + params
|
||||
free[cls].append(f'{ret} {method}({", ".join(params)}); // {addr:08x}')
|
||||
@@ -512,8 +512,19 @@ with open(outDir + '/classes.h', 'w') as o:
|
||||
# One .cpp per class: each body under the declaration it was declared with; a renamed `this` gets an alias.
|
||||
members = {f'{f[0]}::{f[1]}' for f in funcs.values() if f[3] == '__thiscall' and f[0] in done}
|
||||
spans, files = collections.defaultdict(list), {}
|
||||
curated = {int(a, 16) for root, _, names_ in os.walk(srcDir) for n in names_ if n.endswith(('.cpp', '.h'))
|
||||
for a in re.findall(r'//\s*([0-9a-f]{8})\b', open(os.path.join(root, n), errors='replace').read())}
|
||||
def curated_load(): # addresses src/ took over: the one starting a comment, and every one in a (a, b, c to d) list on it
|
||||
found, addresses = set(), sorted(funcs)
|
||||
for root, _, files_ in os.walk(srcDir):
|
||||
for name in [f for f in files_ if f.endswith(('.cpp', '.h'))]:
|
||||
for comment in re.findall(r'//(.*)', open(os.path.join(root, name), errors='replace').read()):
|
||||
lists = re.findall(r'\(((?:[0-9a-f]{8}(?:\s*(?:,|to)\s*)?)+)\)', comment)
|
||||
lead = re.match(r'\s*([0-9a-f]{8})\b', comment)
|
||||
for item in lists + ([lead[1]] if lead else []):
|
||||
for low, high in re.findall(r'([0-9a-f]{8})(?:\s*to\s*([0-9a-f]{8}))?', item):
|
||||
high = high or low
|
||||
found |= {a for a in addresses if int(low, 16) <= a <= int(high, 16)} | {int(low, 16)}
|
||||
return found
|
||||
curated = curated_load()
|
||||
for cls in [c for c in done if not LIBRARY.match(c)]:
|
||||
parts, line = ['#include "classes.h"\n'], 2
|
||||
for addr, (_, method, ret, cc, params) in methods.get(cls, []):
|
||||
|
||||
Reference in new issue
Block a user