This repository was archived by the owner on Sep 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFragmentPatcher.cds
177 lines (143 loc) · 3.95 KB
/
FragmentPatcher.cds
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
// Fragment ELF Detection and Code Loader
address $8007a228
print "_255_00._01."
lui t0, $8008
lui t1, $8007
// _255.27 < Main ELF
lw t2, $a228(t0)
// _00.ELF < Online Elf
lw t3, $a22c(t0)
// _01.ELF < Offline ELF
lw t4, $a230(t0)
// currently loaded ELF
setreg t5,$8007537C
// Load the currently loaded elf text
lw t6 zero(t5)
// if t5 doesn't get set initially, it won't show the main elf till you come back from a
// menu
beq t6 zero, :__MainElfCodeLoader
nop
//If the main elf is loaded jump to the code loader
beq t2,t6,:__MainElfCodeLoader
nop
// If the online elf is loaded jump to code loader
beq t3,t6 :__OnlineElfCodeLoader
nop
// If the offline elf is loaded jump to code loader
beq t4,t6 :__OfflineElfCodeLoader
nop
beq zero, zero :__EOF
nop
// ---------------------------------------------------------------------------
__MainElfCodeLoader:
ori t1,t1, $a340
__MainElfCodeLoaderAddress:
// Gets the address line to our code from the Code stack
lw t6,$000(t1)
// Gets the data line to our code from the Code stack
lw t7,0004(t1)
// Jump back to EOF if t6 is zero (t6 would contain the next adddress)
beq t6,zero :__EOF
nop
// Store the data line to the actual address
sw t7, zero(t6)
beq zero,zero :__MainElfCodeLoaderAddress
// We do not want to nop here for the delay slot
// Add 8 to t5 so it will grab the next address data pair
addiu t1,t1,$0008
nop
// ---------------------------------------------------------------------------
__OnlineElfCodeLoader:
ori t1,t1, $a400
__OnlineElfCodeLoaderAddress:
// Gets the address line to our code from the Code stack
lw t6,$000(t1)
// Gets the data line to our code from the Code stack
lw t7,0004(t1)
// Jump back to EOF if t6 is zero (t6 would contain the next adddress)
beq t6,zero :__EOF
nop
// Store the data line to the actual address
sw t7, zero(t6)
beq zero,zero :__OnlineElfCodeLoaderAddress
// We do not want to nop here for the delay slot
// Add 8 to t5 so it will grab the next address data pair
addiu t1,t1,$0008
nop
// ---------------------------------------------------------------------------
__OfflineElfCodeLoader:
ori t1,t1, $a700
__OfflineElfCodeLoaderAddress:
// Gets the address line to our code from the Code stack
lw t6,$000(t1)
// Gets the data line to our code from the Code stack
lw t7,0004(t1)
// Jump back to EOF if t6 is zero (t6 would contain the next adddress)
beq t6,zero :__EOF
nop
// Store the data line to the actual address
sw t7, zero(t6)
beq zero,zero :__OfflineElfCodeLoaderAddress
// We do not want to nop here for the delay slot
// Add 8 to t5 so it will grab the next address data pair
addiu t1,t1,$0008
__EOF:
jr ra
// ----------------------------- Begin of Main ELF Code stack
// Controller specific data
address $8007a340
// hexcode $0012cd14
// hexcode $0803f414
// hexcode $000fd054
// hexcode $0804b347
// hexcode $0012cd7c
// hexcode $0803f417
hexcode $00113cf0 // Skip FMV
hexcode $24020001
// ----------------------------- Begin of the Online ELF Code stack
// Controller specific data
address $8007a400
// hexcode $001317c4
// hexcode $0803f414
// hexcode $000fd054
// hexcode $0804c5f3
// hexcode $0013182c
// hexcode $0803f417
// DNAS Bypass
hexcode $002a87a8
hexcode $24020001
// DNS Change to Alk's Server
hexcode $005E03A0
hexcode $6F642E61
hexcode $005E03A4
hexcode $63616874
hexcode $005E03A8
hexcode $7372656B
hexcode $005E03AC
hexcode $67726F2E
hexcode $005E03B0
hexcode $00000000
hexcode $005E03B4
hexcode $00000000
// Disable Item loss on characters if the game isn't saved.
hexcode $00113cf0
hexcode $24020001
hexcode $00177528
hexcode $00001021
hexcode $0028733c
hexcode $00003021
hexcode $002CB9F0
hexcode $00003021
// ----------------------------- Begin of Offline ELF Code stack
address $8007a700
// DNAS Bypass
hexcode $002a87a8
hexcode $24020001
// hexcode $00128584
// hexcode $0803f414
// hexcode $000fd054
// hexcode $0804a163
// hexcode $001285ec
// hexcode $0803f417
// Other Code that isn't specific to anything. This will always be loaded
// address $8007a800