#!/usr/bin/env python3 """Locate FMinimalViewInfo::CalculateProjectionMatrixGivenView in GB4-Win64-Shipping.exe. Fingerprint: the function computes max(0.001f, FOV) * (PI/360) — so it references both float constants 0.001f and pi/360 within a short span. We find all RIP-relative references to those constants and cluster them. """ import pefile, struct, math, sys EXE = sys.argv[1] if len(sys.argv) > 1 else \ "/media/ckoch/Data/steam/steamapps/common/GBBBB/GB4/Binaries/Win64/GB4-Win64-Shipping.exe" pe = pefile.PE(EXE, fast_load=True) base = pe.OPTIONAL_HEADER.ImageBase sections = {} for s in pe.sections: name = s.Name.rstrip(b"\0").decode() sections[name] = (s.VirtualAddress, s.SizeOfRawData, s.get_data()) print(f"section {name:8s} va=0x{base+s.VirtualAddress:x} rawsize=0x{s.SizeOfRawData:x}") text_rva, _, text = sections[".text"] # --- find constant locations anywhere outside .text (rdata usually) --- consts = { "0.001f": struct.pack("