-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpatch_ags.py
More file actions
78 lines (68 loc) · 2.53 KB
/
patch_ags.py
File metadata and controls
78 lines (68 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"""
Since I have done so much research into the AGS test, and I know that there are disabled tests, I thought I'd write
something to patch your AGS ROM!
AGS ROM md5: 9f74b2ad1d33e08e8a570ffe4564cbc3
The ROM holds a copy of what it copies over to WRAM starting at 081421a0. At 081421a0 a bunch of structs of the form
struct {
uint enabled;
uint executed;
uint result;
uint (*test)();
char* name;
}
start, holding the info for the tests. This patch basically edits the "test" field in these to point to the unused test functions.
"""
with open("AGS.gba", "rb") as f:
AGS = list(f.read())
for i in range(4):
# AGS[i + 0x4c0] = 0 # uncomment to enable the advanced KEYINPUT test
# AGS[i + 0x4c6] = 0 # uncomment to enable test class 4 (COM)
# ALWAYS WIN!!
# AGS[i + 0x4d2] = 0 # call to error screen
# SET_PHI_OUTPUT_CONTROL
AGS[i + 0x1421b0] = [0xa9, 0x30, 0x00, 0x08][i]
# DISPLAY test (cant click this away)
# AGS[i + 0x1421c4] = [0xf5, 0x3d, 0x00, 0x08][i]
# PLAY_SOUND test
AGS[i + 0x1421d8] = [0xdd, 0x8a, 0x00, 0x08][i]
# CARTRIDGE_INTR test
AGS[i + 0x1421ec] = [0x3d, 0xcd, 0x00, 0x08][i]
# EXECUTE_STOP_FUNCTION test (probably freezes it up if you implement STOP in your emulator)
# AGS[i + 0x142200] = [0x05, 0xce, 0x00, 0x08][i]
# EXECUTE_HALT_FUNCTION test (freezes it up)
# AGS[i + 0x142214] = [0x3d, 0xce, 0x00, 0x08][i]
# EXTENDED SIO
# NORMAL SIO
AGS[i + 0x14232c] = [0xa5, 0xac, 0x00, 0x08][i]
# MULTI PLAY SIO
AGS[i + 0x142340] = [0xf1, 0xae, 0x00, 0x08][i]
# UART RECV SIO
AGS[i + 0x142354] = [0xed, 0xb2, 0x00, 0x08][i]
# UART SEND SIO
AGS[i + 0x142368] = [0x0d, 0xb5, 0x00, 0x08][i]
# DIRECT
AGS[i + 0x14237c] = [0x25, 0xb7, 0x00, 0x08][i]
# JOY BUS RESET
AGS[i + 0x142390] = [0xdd, 0xb7, 0x00, 0x08][i]
# JOY BUS STATUS
AGS[i + 0x1423a4] = [0xd1, 0xb8, 0x00, 0x08][i]
# JOY BUS WRITE
AGS[i + 0x1423b8] = [0x1d, 0xb9, 0x00, 0x08][i]
# JOY BUS READ
AGS[i + 0x1423cc] = [0x65, 0xba, 0x00, 0x08][i]
# DISABLE ALL
# addr = 0x1421a4
# while addr < 0x14249b:
# AGS[addr] = 0
# addr += 0x14
# for i in range(4):
# AGS[0x4b8 + i] = 0 # call to enable_all_tests
# AGS[0xade + i] = 0 # call to clear_test_classes
for char in range(6):
AGS[0x186fc + char] = ord("PATCH\0"[char])
for char in range(3):
AGS[0x186ec + char] = ord("SIO"[char])
for char in range(14):
AGS[0x182d8 + char] = ord("YOUR EMU SUCKS"[char])
with open("AGS_patched.gba", "wb+") as f:
f.write(bytes(AGS))