Fields: 325 identified from the most-used unnamed offsets; bracketing is no longer evidence; '-' rows delete wrong fields

Entity _mass (0x2d4) and _depthOffset (0x2b0) were REPENTOGON fields kept by bracketing and both wrong
(Lua getters read 0x37c / 0x358). Bracketed fields now need direct confirmation; 155 are being re-verified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-24 23:40:33 -04:00
1 parent 962ec27869
commit 134ab40589
7 files changed
+2306 -2104

No files matched your search

+3 -5
View File
@@ -1,8 +1,8 @@
# REPENTOGON's struct offsets target an older exe (1.9.7.12); fields drift as the game adds members, so they are only
# kept where THIS exe confirms them. Evidence ("anchors"): a trivial getter in the corpus ("Class::GetFoo" returning
# this+N anchors field "_foo" at N) or the game's Lua field table (lua_bindings.tsv: "EntityNPC State field+0xb64").
# A field is kept when it is anchored, or lies between two anchors of its class with the same shift; everything else
# is dropped (the decompiler then shows field_0xNNN) until db/fields.tsv confirms it. Base-class rows are always kept.
# A field is kept only when it is anchored; everything else is dropped (the decompiler then shows field_0xNNN) until
# db/fields.tsv confirms it. Base-class rows are always kept.
# Usage: zhl_fields.py all.c zhl_dir lua_bindings.tsv out.tsv [names.tsv: addr \t Class::Member, overrides corpus names]
# Prints per class: kept/total and the shifts seen.
import collections, glob, os, re, sys
@@ -49,9 +49,7 @@ with open(fout, 'w') as o:
shifts = sorted((off, anchor[(c, norm(d.split()[-1]))] - off) for off, d in fields if (c, norm(d.split()[-1])) in anchor)
kept = 0
for off, d in fields:
lo = [s for a, s in shifts if a <= off]; hi = [s for a, s in shifts if a >= off]
if (c, norm(d.split()[-1])) in anchor: new = anchor[(c, norm(d.split()[-1]))]
elif lo and hi and lo[-1] == hi[0]: new = off + lo[-1]
else: continue
else: continue # not confirmed: being between two anchors with the same shift is not proof (Entity _mass, _depthOffset)
o.write(f'{c}\t0x{new:x}\t{d}\n'); kept += 1
if shifts: print(f'{c}: kept {kept}/{len(fields)}, shifts ' + ' '.join(f'{a:x}{s:+#x}' for a, s in shifts if s))