"""Check what files the game needs and whether they exist, then show more code context.""" import re, struct, os print("=== Files present in game directory ===") game_dir = "." for f in sorted(os.listdir(game_dir)): full = os.path.join(game_dir, f) if os.path.isfile(full): print(f" {f:30s} {os.path.getsize(full):>10d} bytes") elif os.path.isdir(full): print(f" {f}/ [dir]") print("\n=== Checking expected files ===") needed = ['MUSIC.FF','INTRFACE.FF','BIGFILE.DAT','STRDATA.DAT','HAVOC.INI','WORLDS'] for n in needed: exists = os.path.exists(n) info = "" if exists: if os.path.isdir(n): contents = os.listdir(n) info = f" [dir, {len(contents)} files]" else: info = f" [{os.path.getsize(n)} bytes]" print(f" {'OK' if exists else 'MISSING':<6} {n}{info}") exe = open("HAVOC_NOCD.EXE", "rb").read() pe_off = struct.unpack_from(' fo=0x{target_fo:06x} (VA=0x{target_va:08x}): ...{exe[fo-3:fo+6].hex()}...") # Also look for ALL the path strings still in the binary print("\n=== All path/filename strings in data section (0x069400-0x06EC00) ===") data_sec = exe[0x069400:0x06ec00] for m in re.finditer(rb'[A-Za-z0-9][A-Za-z0-9_. \\:]{2,39}(?=\x00)', data_sec): s = m.group().decode('latin1', errors='replace') if any(c in s for c in ['.', '\\', ':']): fo = 0x069400 + m.start() print(f" 0x{fo:06x}: {s!r}")