Skip to content

Instantly share code, notes, and snippets.

@bbayles
Created November 15, 2024 02:54
Show Gist options
  • Select an option

  • Save bbayles/789520502cb6fcaf5fee87c9c18cce7c to your computer and use it in GitHub Desktop.

Select an option

Save bbayles/789520502cb6fcaf5fee87c9c18cce7c to your computer and use it in GitHub Desktop.
Mat Hoffman Pro BMX - cheat code generator
from itertools import product
button_map = {
'Up': 0x1234567,
'Down': 0x776643d1,
'Left': 0x93fe1682,
'Right': 0xab432901,
'A': 0xb87610db,
'B': 0xdeadbeef,
'X': 0x3185332,
'Y': 0x31415926,
}
targets = {
0x8e675ec5: None,
0x1b086aaa: None,
0x6ca00b4: None,
0x33b2a591: None,
0x5a2a02c4: None,
0xa93bdb04: None,
0x95a75504: None,
0xc8488025: None,
0xe6aa0b15: None,
}
found = 0
n = 0
while found < len(targets):
n += 1
for code_buttons in product(button_map, repeat=n):
value = 0x0
for button in code_buttons:
x = button_map[button]
value = (((value ^ x) * 2 ^ (value ^ x) >> 0x1f) * 0x209) & 0xffffffff
if (value in targets) and (targets[value] is None):
targets[value] = ', '.join(code_buttons)
print(
', '.join(code_buttons),
format(value, '08x'),
)
found += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment