-
-
Save bbayles/8c43d62fe9031c088e5a5b1714f43097 to your computer and use it in GitHub Desktop.
Recover the cheat codes for Kinetica (PlayStation 2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from itertools import product | |
| BUTTON_MAP = { | |
| 0x0001: "L2", | |
| 0x0002: "R2", | |
| 0x0004: "L1", | |
| 0x0008: "R1", | |
| 0x0010: "Triangle", | |
| 0x0020: "Circle", | |
| 0x0040: "X", | |
| 0x0080: "Square", | |
| 0x0100: "Select", | |
| 0x0200: "L3", | |
| 0x0400: "R3", | |
| 0x0800: "Start", | |
| 0x1000: "Up", | |
| 0x2000: "Right", | |
| 0x4000: "Down", | |
| 0x8000: "Left", | |
| } | |
| def find_target(target_val): | |
| for size in range(1, 8 + 1): | |
| for prod in product(BUTTON_MAP, repeat=size): | |
| acc = 0 | |
| for pattern in prod: | |
| acc = ((acc << 3) | pattern) & 0xFFFFFFFF | |
| if acc == target_val: | |
| return ', '.join(BUTTON_MAP[p] for p in prod) | |
| raise RuntimeError('Not found') | |
| for target_val in (0x2108840, 0x860004): | |
| buttons = find_target(target_val) | |
| print(buttons) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment