diff --git a/db/names.tsv b/db/names.tsv index afc8be2..f8277ef 100644 --- a/db/names.tsv +++ b/db/names.tsv @@ -1447,3 +1447,5 @@ 006fd3f0 Game::interpolate_update Manager::Update odd frames: entity Interpolate (vtable +0x10) and the BeastArena half-step scroll (beast.md) 009432f0 Camera::get_clamp_bounds ? room bounds -> camera min/max with the 0.65 scale; Beast room zeroes the extra margins (beast.md) 00839b80 BeastArena::init ? no Ghidra function; called by Room::Init with ECX=Room+0x776c: active if stage 35 type 16, loads gfx/backdrop/hell/background.anm2, zeroes scroll (beast.md) +007fe220 Room::card_against_humanity_fill Room::Update calls it while flag 0x11f4 (Room::SetCardAgainstHumanity) is set; it clears the flag and puts a poop (33% black with Meconium) on every free interior cell not under an entity; 1 in 8 an effect 1000.33 at a player (trinkets-cards) +006b5e20 Entity_NPC::hold_set NPC field 0x3f0 = max(it, ticks), 0x3f4/0x3f8 = spot: holds it in place (Emergency Contact, 150) (trinkets-cards) diff --git a/scripts/fix_offsets.py b/scripts/fix_offsets.py deleted file mode 100644 index b5abf33..0000000 --- a/scripts/fix_offsets.py +++ /dev/null @@ -1,33 +0,0 @@ -# REPENTOGON's struct offsets target an older exe; fields drift as the game adds members. -# Re-anchors zhl_fields.tsv using trivial getters in the decompiled corpus ("Class::GetFoo" returning *(this+N) -# anchors field "_foo" at N); every field shifts by the delta of the nearest anchor at or below it. -# Usage: fix_offsets.py all.c zhl_fields.tsv out.tsv [names.tsv: addr \t Class::Member, overrides corpus names] -import re, sys -src, fin, fout = sys.argv[1:4] -rename = dict(l.split('\t')[:2] for l in open(sys.argv[4])) if len(sys.argv) > 4 else {} -norm = lambda s: re.sub(r'^(get|is|has)', '', s.lower().lstrip('_')) -getters = {} # (class, normname) -> exe offset -name, n = None, 0 -for line in open(src, errors='replace'): - if line.startswith('//@@ '): name, n = rename.get(line.split()[1], line.split()[2]), 0; continue - n += 1 - m = n < 14 and name and re.search(r'return (?:\*\([\w ]+\*\)\(\w+ \+ (0x[0-9a-f]+)\)|\w+->(\w+));', line) - if m and '::' in name and m.group(1): - cls, meth = name.rsplit('::', 1) - cls = {'EntityPlayer': 'Entity_Player', 'EntityNPC': 'Entity_NPC'}.get(cls, cls) - getters[(cls, norm(meth))] = int(m.group(1), 16) -rows = [l.rstrip('\n').split('\t') for l in open(fin)] -anchors = {} -for r in rows: - if r[1] == 'base': continue - key = (r[0], norm(r[2].split()[-1])) - if key in getters: anchors.setdefault(r[0], []).append((int(r[1], 16), getters[key] - int(r[1], 16))) -with open(fout, 'w') as o: - for r in rows: - if r[1] != 'base' and r[0] in anchors: - off = int(r[1], 16) - below = [d for a, d in sorted(anchors[r[0]]) if a <= off] - r[1] = '0x%x' % (off + (below[-1] if below else 0)) - o.write('\t'.join(r) + '\n') -for c, a in sorted(anchors.items()): - print(c, ' '.join('%x%+d' % x for x in sorted(a) if x[1]))