import gdb import struct # address for all platforms (us only atm) TG_MENU_ID_ADDR = { 'us': 0x0036b1e8 } tg_lang = 'us' # TODO: maybe symbolize common states STATE_NAME_TABLE = { 0: 'Invalid', 1: 'Pause (Underground)', 2: 'Pause (Arcade)', 3: 'Pause (Unknown?)', # dunno bout these ones 4: 'Pause (Unknown 2?)', 5: 'Invalid', 6: 'Rerun Ended', 0x7: 'Confirm Quit', 0x8: 'Confirm Restart', # dups? 0x9: 'Confirm Restart', 0xa: 'Save Game', 0xb: 'Overwrite Game', 0xc: 'Debug Menu', 0xd: 'Other Debug Settings', 0xe: 'Camera Debug', 0xf: 'Invalid', # maybe another debug options if I had to guess 0x10: 'Rendering Options', 0x11: 'Controller Configuration', 0x12: 'Arcade High Scores', 0x14: 'Audio Settings', 0x15: 'Preferences', 0x18: 'Debug Shell', 0x19: 'Shell', 0x1a: 'Stats Debug', 0x1b: 'Check Poly Totals', 0x1c: 'Memory/Polygon Budget', 0x1d: 'Permanent Allocation', 0x1e: 'Shell Allocation', 0x1f: 'Game Allocation', 0x20: 'Win', 0x21: 'Failed', 0x22: 'Survived', 0x23: 'Dead', 0x24: 'Won', 0x25: 'Lost', 0x26: 'Won dupe', 0x27: 'Lost dupe', 0x28: 'Rerun Finished', 0x29: 'Time Up', 0x30: 'Arcade' } def read_4b_value(address): inferior = gdb.selected_inferior() data = inferior.read_memory(address, 4) return struct.unpack('