-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRiivolutionPatchGenerator.html
More file actions
909 lines (771 loc) · 53.7 KB
/
Copy pathRiivolutionPatchGenerator.html
File metadata and controls
909 lines (771 loc) · 53.7 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
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
<p><strong style="background-color: rgb(0, 0, 0); color: rgb(255, 0, 0);"><span style="font-size: 72px;"><span style="font-family: "Edwardian Script ITC", sans-serif;"><iframe frameborder="0" height="68" scrolling="no" src="https://jimkatz.github.io/menupage.html" width="777"></iframe></span></span></strong><br />
<span style="font-size:36px;"><span style="color:#FF0000;"><span style="font-family:arial,helvetica,sans-serif;"><strong>Riivolution Memory Patch + PowerPC + Gecko Code Generators</strong></span></span></span><br />
Quick and simple Riivoution Memory Patch, PowerPC and Gecko Code generators (this description is a work in progress)</p>
<pre class="result notranslate" style="box-sizing: border-box; margin-top: 1rem; margin-bottom: 1rem; padding: 15px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-variant-alternates: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: inherit; font-optical-sizing: inherit; font-kerning: inherit; font-feature-settings: inherit; font-variation-settings: inherit; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-pan-x: ; --tw-pan-y: ; --tw-pinch-zoom: ; --tw-scroll-snap-strictness: proximity; --tw-gradient-from-position: ; --tw-gradient-via-position: ; --tw-gradient-to-position: ; --tw-ordinal: ; --tw-slashed-zero: ; --tw-numeric-figure: ; --tw-numeric-spacing: ; --tw-numeric-fraction: ; --tw-ring-inset: ; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgb(59 130 246 / 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-shadow-colored: 0 0 #0000; --tw-blur: ; --tw-brightness: ; --tw-contrast: ; --tw-grayscale: ; --tw-hue-rotate: ; --tw-invert: ; --tw-saturate: ; --tw-sepia: ; --tw-drop-shadow: ; --tw-backdrop-blur: ; --tw-backdrop-brightness: ; --tw-backdrop-contrast: ; --tw-backdrop-grayscale: ; --tw-backdrop-hue-rotate: ; --tw-backdrop-invert: ; --tw-backdrop-opacity: ; --tw-backdrop-saturate: ; --tw-backdrop-sepia: ; overflow: auto; border: 0px; width: 581.609px; border-radius: 8px; background: rgb(238, 238, 238) !important;">
<span style="font-size:16px;"><span style="font-family: Verdana, sans-serif; text-align: justify;"><span style="font-family:arial,helvetica,sans-serif;"><strong><span style="color:#FF0000;">Riivolution</span></strong></span>
<span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;">1. </span><a href="#XMLPTCH"><span style="color:#FF0000;">XML Memory Patch Generator
</span></a><span style="color:#FF0000;">2. </span></span></span><a href="#B2-CODEBASE"><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;">Branch to 0x80002388</span>
</span></a><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;">3.</span><strong><span style="color:#FF0000;"> </span></strong><a href="#b-anywhere"><span style="color:#FF0000;">Branch Anywhere
</span></a><span style="color:#FF0000;">4. </span><a href="#UniversalMemoryPatch"><span style="color:#FF0000;">Universal Memory Patch
</span></a><span style="color:#FF0000;">5. </span><a href="#FULLXMLGEN"><span style="color:#FF0000;">Full XML Generator</span></a>
</span></span>
<span style="font-size:16px;"><span style="font-family: Verdana, sans-serif; text-align: justify;"><span style="color:#DAA520;"><span style="font-family: arial, helvetica, sans-serif;"><strong>ASM (PowerPC)</strong></span></span><a href="#XMLPTCH">
</a><span style="color:#DAA520;">1.</span></span><span style="font-family:arial,helvetica,sans-serif;"><span style="color:#DAA520;"> </span><span style="text-align: justify;"><a href="#ASM-GEN"><span style="color:#DAA520;">ASM Generator</span></a></span></span>
</span>
<span style="font-size:16px;"><span style="font-family: Verdana, sans-serif; text-align: justify;"><span style="color:#00cc00;"><span style="font-family: arial, helvetica, sans-serif;"><strong>Gecko Codes</strong></span></span>
<span style="font-family:arial,helvetica,sans-serif;"><span style="color:#009900;">1. </span><a href="#VPCMENT"><span style="color:#009900;">C2 and 04 Code Generator</span></a><a href="#VPCMENT"><span style="color:#009900;">
</span></a><span style="color:#009900;">2. </span></span></span><span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:18px;"><a href="#CONCODE"><span style="color:#009900;">Conditional Code</span></a></span><span style="color:#009900;">
</span><span style="text-align: justify;"><span style="color:#009900;">3. </span><a href="#button-activator"><span style="color:#009900;">Button Activator
</span></a></span></span></span><span style="color:#0000FF;"><span style="font-size: 16px;"><span style="font-family: Verdana, sans-serif; text-align: justify;"><span style="font-family: arial, helvetica, sans-serif;"><strong>GCT Files</strong></span></span></span></span>
<span style="font-size: 16px;"><span style="font-family: Verdana, sans-serif; text-align: justify;"><span style="font-family: arial, helvetica, sans-serif;"><span style="color:#0000FF;">1. <a href="#GCT_DECODER">GCT "Decoder</a>"</span></span></span></span><span style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;"><span style="text-align: justify;"><a href="#GCT_DECODER"><span style="color:#0000FF;">
</span></a></span></span></span>
<span style="font-size:16px;"><span style="font-family:arial,helvetica,sans-serif;"><span style="text-align: justify;"><span style="color:#800080;"><strong>Other</strong>
</span><a href="#C2-RII"><span style="color:#800080;"><strong>1. C2 Code to Riivolution Patch Generator</strong></span></a><span style="color:#800080;">
</span></span></span></span>
<span style="font-size: 16px;"><strong><span style="font-family: arial, helvetica, sans-serif;">Regional Things</span></strong></span>
<a href="#FindAPALAddress"><span style="color:#000000;"><span style="font-size: 16px;"><span style="font-family: Verdana, sans-serif; text-align: justify;"><span style="font-family: arial, helvetica, sans-serif;">1. How To find a PAL address</span></span></span></span></a></pre>
<p style="box-sizing: border-box; margin: 1rem 0px; padding: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-variant-alternates: inherit; font-stretch: inherit; font-size: 15px; line-height: 24px; font-family: Verdana, sans-serif; font-optical-sizing: inherit; font-kerning: inherit; font-feature-settings: inherit; font-variation-settings: inherit; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-pan-x: ; --tw-pan-y: ; --tw-pinch-zoom: ; --tw-scroll-snap-strictness: proximity; --tw-gradient-from-position: ; --tw-gradient-via-position: ; --tw-gradient-to-position: ; --tw-ordinal: ; --tw-slashed-zero: ; --tw-numeric-figure: ; --tw-numeric-spacing: ; --tw-numeric-fraction: ; --tw-ring-inset: ; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgb(59 130 246 / 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-shadow-colored: 0 0 #0000; --tw-blur: ; --tw-brightness: ; --tw-contrast: ; --tw-grayscale: ; --tw-hue-rotate: ; --tw-invert: ; --tw-saturate: ; --tw-sepia: ; --tw-drop-shadow: ; --tw-backdrop-blur: ; --tw-backdrop-brightness: ; --tw-backdrop-contrast: ; --tw-backdrop-grayscale: ; --tw-backdrop-hue-rotate: ; --tw-backdrop-invert: ; --tw-backdrop-opacity: ; --tw-backdrop-saturate: ; --tw-backdrop-sepia: ; text-align: justify; overflow-wrap: break-word;">-----</p>
<form action="test" method="get"><a id="XMLPTCH" name="XMLPTCH"><br />
<span style="font-family:arial,helvetica,sans-serif;"><strong><span style="font-size:26px;">Memory Patch Type 1:</span></strong></span></a><br />
<br />
Enter An Address in Memory: <input id="mname" maxlength="8" name="mname" type="text" /><br />
Enter the value you want to insert at that address: <input id="fname" name="fname" type="text" /><br />
Riivotion Patch Output:<br />
<input onclick="pr()" type="button" value="Submit" /> </form>
<p id="result"> </p>
<p>EXAMPLE:</p>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;">Enter An Address in Memory: <span style="font-size: 24px;"><strong>80000004</strong></span><br />
Enter the value you want to insert at that Address: <span style="font-size: 24px;"><strong>FFFFFFFF</strong></span><br />
<br />
Output:<br />
<memory value="ffffffff" offset="0x80000004" /></div>
<p> </p>
<hr />
<p><br />
<a id="B2-CODEBASE" name="B2-CODEBASE"><span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:26px;"><strong>Memory Patch Type 2: (Branch to 0x80002388)</strong></span></span></a><br />
<br />
Enter an Address in memory: <input id="mname2" maxlength="8" name="2388Patch" type="text" /><br />
<span style="color:#B22222;"><strong># 0x80002388 - Inputted Address Above</strong></span><br />
Branch Instruction Output:</p>
<p id="result2"> </p>
<p><input onclick="pr2()" type="button" value="Submit" /></p>
<p><br />
</p>
<hr />
<p> </p>
<p> </p>
<p> </p>
<p><a id="b-anywhere" name="b-anywhere" style="background-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;"><span style="font-size: 26px;"><strong>Memory Patch Type 3: (Branch Anywhere)</strong></span></span></a></p>
<form action="" method="get"><br />
Enter the address you want to branch from: <input id="branchsrc" maxlength="8" name="mname" type="text" /><br />
Enter the destination address: <input id="branchdest" name="fname" type="text" /><br />
Riivotion Patch Output:
<p id="branchoutput"> </p>
<input onclick="branchclick()" type="button" value="Submit" /> </form>
<p id="result"> </p>
<p>EXAMPLE:</p>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;"><br />
<span style="font-size: 48px; background-color: rgb(238, 238, 238);">Example #1</span><br />
<br />
Enter the address you want to branch from: <span style="font-size: 24px;"><strong>80000000</strong></span><br />
Enter the destination address: <strong style="font-size: 24px; background-color: rgb(238, 238, 238);">80000064</strong><br />
<br />
<span style="font-size: 24px;"><strong>output:</strong></span><br />
<span style="color:#FF0000;"><strong><span style="font-size:72px;"><span style="font-size:48px;">48000064</span></span></strong></span>
<hr /><br />
<span style="font-size:48px;">Example #2</span><br />
<span style="background-color: rgb(238, 238, 238);">Enter the address you want to branch from: </span><span style="font-size: 24px;"><strong>80000064</strong></span><br />
<span style="background-color: rgb(238, 238, 238);">Enter the destination address: </span><strong style="background-color: rgb(238, 238, 238); font-size: 24px;">80000000</strong><br />
<br />
<span style="font-size: 24px;"><strong>output:</strong></span><br />
<font color="#ff0000"><span style="font-size: 48px;"><b>4BFFFF9C</b></span></font><br />
<br />
<br />
</div>
<p> </p>
<p> </p>
<hr />
<p><a id="UniversalMemoryPatch" name="UniversalMemoryPatch" style="background-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;"><span style="font-size: 26px;"><strong>Memory Patch Type 4: "Universal" Memory Patch</strong></span></span></a></p>
<p>Enter the hex value of the instructions that you want to patch in (hex values, without spaces) <input name="OriginalInstructions" size="88" type="text" /><br />
Enter the hex value of at least 5 consecutive instructions (hex values, without spaces) <input name="NewBytes" size="88" type="text" /></p>
<p><input onclick="UniOutput()" type="button" value="Submit" /></p>
<p>Output:<br />
<textarea cols="99" name="UniOutput_area" rows="8"></textarea></p>
<p><span style="font-size:22px;">Regular Riivolution memory patches work by directly replacing an instruction<br />
in the game's code <strong>(although they won't work if the game writes a value to the<br />
address they replace the value of after boot. You'll need a 04 RAM Write code<br />
to keep that from happening).</strong></span></p>
<p><span style="font-size:22px;">The thing with memory patches is that you have to enter a memory address specific<br />
to the region of the game you're working with. This means that if you made a patch<br />
to replace the value at an address in the NTSC version of a game, it won't work on<br />
the PAL version since the addresses are different. </span></p>
<p><span style="font-size:22px;">Riivolution memory patches have a "search" feature. A "search patch" scans the game's<br />
memory for a specific set of bytes and replaces them with custom bytes if found.<br />
It can search for any sequence of bytes. This includes the bytes that make up the hex<br />
values of instructions in the game's code. This generator takes full advantage of that.</span></p>
<p><span style="font-size:22px;">The generator creates a search patch for you. You need to enter the exact sequence of bytes<br />
corresponding to the instructions surrounding the target instruction <strong>("target instruction" refers<br />
to the memory address you want to alter the value of, so start by entering the original hex<br />
value of that)</strong>. The generated search patch will search the game's memory for the specific<br />
sequence of bytes you entered to locate the correct function containing the target instruction.<br />
Once found, the patch replaces the instruction(s) with the custom bytes provided.<br />
This allows the memory patch to be "universal" and work across all regions. </span></p>
<p><span style="font-size:28px;"><span style="font-family:arial,helvetica,sans-serif;"><strong><span style="color:#FF0000;">It works because the game's actual code is pretty much unchanged between<br />
regions, which means that the byte sequences that make up its code are too.</span></strong></span></span></p>
<p><span style="font-size:22px;">The only issue with this type of patch is that it sometimes has trouble finding the byte<br />
values of instructions that load specific addresses into registers. It also doesn't work<br />
with function callers ("bl" instructions), but apart from that, it works perfectly!</span></p>
<p> </p>
<p><strong><span style="font-size:26px;">EXAMPLE:</span></strong></p>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;"><span style="font-size:22px;">In Wii Sports Resort there's a function at (NTSC) 0x8063358C that updates the time of day<br />
in Swordplay Showdown after you complete a stage. This is what it looks like in the code<br />
<span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:18px;"><strong><span style="color:#800000;">(I explained how this function works in the "developer's commentary" of <a href="https://gamebanana.com/mods/598288">The </a></span><a href="https://gamebanana.com/mods/598288"><span style="color:#0000FF;">Swordplay<br />
Showdown: Service and Shenanigans Pack</span></a> <span style="color:#800000;">so I'm going to refrain from doing so here)</span>:</strong></span></span></span>
<hr /><span style="font-size:18px;"><strong>NTSC_0x8063358C: </strong><br />
</span><strong>8063358c:</strong><span style="font-size:18px;"> lwz r3, -0x20E0(r13)<br />
<strong> </strong></span><strong>80633590:</strong> <span style="font-size:18px;">addi r0, r3, 0x1<br />
</span><strong>80633594:</strong><span style="font-size:18px;"> stw r0, -0x20E0(r13)<br />
<strong> </strong></span><strong>80633598:</strong><span style="font-size:18px;"> cmpwi r0, 0x3<br />
</span><strong>8063359c:</strong><span style="font-size:18px;"> bltlr- <br />
</span><strong>806335a0:</strong><span style="font-size:18px;"> li r0, 0<br />
</span><strong>806335a4:</strong> <span style="font-size:18px;">stw r0, -0x20E0(r13)<br />
</span><strong>806335a8:</strong> <span style="font-size:18px;">blr </span></div>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;"><span style="font-size:22px;">Let's say I wanted to replace the <strong>"</strong><span style="background-color: rgb(238, 238, 238);"><strong>bltlr-"</strong> instruction with <strong>"nop"</strong> (no </span>operation<span style="background-color: rgb(238, 238, 238);">)<br />
and the <strong>"li r0, 0"</strong> instruction with <strong>"li r0, 1"</strong></span></span><br />
<br />
<span style="font-size:22px;"><span style="background-color: rgb(238, 238, 238);">The hex value for "nop" is "</span>60000000"<br />
The hex value for "li r0, 1" is "38000001"<br />
<br />
<span style="background-color: rgb(238, 238, 238);">So normally, I'd just make a memory patch to replace the instructions. Like this:</span></span><br />
<br />
<span style="color:#4B0082;"><strong><span style="font-size:24px;"><memory value="60000000" offset="0x8063359C" /><br />
<memory value="38000001" offset="0x806335A0" /></span></strong></span><br />
<br />
<span style="font-size:24px;">This would work perfectly fine on the NTSC version of the game, but not the<br />
PAL version since the memory addresses are different between them.</span><br />
</div>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;"><span style="font-size:24px;">With a search patch, you can't search for one specific instruction since there's no<br />
way to narrow things down. However, you CAN use it to search for a specific function.<br />
<br />
Here's how:</span><br />
</div>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;"><span style="font-size:24px;">The function I mentioned earlier that updates the time of day... let's have a closer look at it.<br />
The values on the left are hex values. On the right are the instructions that value translates to:</span><br />
<br />
<span style="font-size:20px;"><span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:18px;">806DDF20 = lwz r3, -0x20E0(r13)<br />
38030001 = addi r0, r3, 0x1<br />
900DDF20 = stw r0, -0x20E0(r13)<br />
2C000003 = cmpwi r0, 0x3<br />
4D800020 = bltlr-<br />
38000000 = li r0, 0<br />
900DDF20 = stw r0, -0x20E0(r13)<br />
4E800020 = blr</span></span></span><br />
<br />
<span style="font-size:24px;">To search for this function in a search patch, I'd have to copy all the hex values of its<br />
instructions and arrange them in sequence without spaces.<br />
<br />
Doing so gives me this series of bytes:</span><br />
<br />
<strong><span style="font-size:28px;">806DDF2038030001900DDF202C0000034D80002038000000900DDF204E800020</span></strong><br />
<br />
<span style="font-size:24px;">This is the "original" value. It's the series of bytes the game has to check it's memory for.<br />
This is what you'd need to enter into the 2nd textbox.<br />
<br />
Right about now, the patch should look like this:<br />
<br />
<span style="font-size:28px;"><span style="font-size:26px;"><strong><span style="color:#4B0082;"><memory value="" original="806DDF2038030001900DDF202C0000034D80002038000000900DDF204E800020" offset="" align="4" search="true" /></span></strong></span></span></span><br />
<br />
<span style="font-size: 24px; background-color: rgb(238, 238, 238);">Next, let's enter the new bytes the game has to patch in...</span><br />
<br />
</div>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;"><span style="font-size: 24px; background-color: rgb(238, 238, 238);">Let's look at the function again, this time with the hex values of the instructions<br />
I want to patch in.</span><br />
<br />
<span style="font-size:18px;"><span style="font-family:arial,helvetica,sans-serif;">806DDF20 = lwz r3, -0x20E0(r13)<br />
38030001 = addi r0, r3, 0x1<br />
900DDF20 = stw r0, -0x20E0(r13)<br />
2C000003 = cmpwi r0, 0x3<br />
<span style="background-color:#FFA07A;">60000000 = nop</span><br />
<span style="background-color:#FFA07A;">38000001 = li r0, 1</span><br />
900DDF20 = stw r0, -0x20E0(r13)<br />
4E800020 = blr</span></span><br />
<br />
<span style="font-size:24px;">At this point, addresses don't matter, as the game will only be patching in<br />
the "new" bytes after it finds the original.<br />
<br />
The highlighted lines above are the new instructions I want to patch in. The same process of<br />
copying all the hex values and arranging them in sequence without spaces has to be repeated,<br />
which will then give me the following bytes:<br />
<br />
<strong><span style="font-size:28px;">806DDF2038030001900DDF202C000003<span style="background-color:#FFA07A;">6000000038000001</span>900DDF204E800020</span></strong></span><br />
<br />
<span style="font-size:24px;">Now, I have to put this value into the 1st textbox and make the patch.</span><br />
<br />
</div>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;"><span style="font-size:24px;">This is the final patch:</span><br />
<br />
<strong><span style="font-size:28px;"><span style="color:#4B0082;"><memory value="806DDF2038030001900DDF202C0000036000000038000001900DDF204E800020" original="806DDF2038030001900DDF202C0000034D80002038000000900DDF204E800020" offset="" align="4" search="true" /></span></span></strong><br />
<br />
</div>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;"><span style="font-size:24px;">What this patch does is search the game's memory for a specific set of bytes, which in this case is <strong>"806DDF2038030001900DDF202C0000034D80002038000000900DDF204E800020."</strong> Once those bytes are found, they're immediately replaced with <strong>"806DDF2038030001900DDF202C00000360000038000001900DDF204E800020."</strong> This patches my new instructions into the game's code.</span><br />
<br />
</div>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;"><br />
<br />
<span style="font-size:24px;"><strong><span style="font-size:36px;">This memory patch works on both NTSC and PAL because the<br />
original source code in the function I modified is exactly the same<br />
across both regions, meaning that <span style="color:#FF0000;">the exact set of bytes this patch<br />
searches for and replaces exists in both the NTSC and PAL version<br />
of the game.</span></span></strong></span><br />
<hr /><br />
<span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:48px;"><span style="color:#008000;"><strong>Hopefully, all of that made sense to you!</strong></span></span></span><br />
<br />
</div>
<p> </p>
<hr />
<p><span style="font-family: arial, helvetica, sans-serif;"><span style="font-size: 26px;"><strong><a id="FULLXMLGEN" name="FULLXMLGEN"></a>FULL XML GENERATOR</strong></span></span></p>
<p>Enter a Title ID (at least 3 characters of are needed): <input id="inputID" type="text" /><br />
Enter the name of your mod:<input id="inputMODNAME" type="text" /><br />
Enter an option name:<input id="inputOptionName" type="text" /><br />
Enter a patch ID:<input id="patchID" type="text" /></p>
<p><button onclick="generateMODxml()">Generate XML</button></p>
<p>Output:</p>
<p><textarea cols="44" id="outputXML" readonly="readonly" rows="30"></textarea></p>
<h1> </h1>
<script>
function generateMODxml() {
const inputID = document.getElementById('inputID').value;
const inputMODNAME = document.getElementById('inputMODNAME').value;
const inputOptionName = document.getElementById('inputOptionName').value;
const patchID = document.getElementById('patchID').value;
let outputXML = `<wiidisc version="1" root="">\n`;
outputXML += ` <id game="${inputID}" />\n`;
outputXML += ` <options>\n`;
outputXML += ` <section name="${inputMODNAME}">\n`;
outputXML += ` <option name="${inputOptionName}">\n`;
outputXML += ` <choice name="Enabled">\n`;
outputXML += ` <patch id="${patchID}" />\n`;
outputXML += ` </choice>\n`;
outputXML += ` </option>\n`;
outputXML += ` </section>\n`;
outputXML += ` </options>\n`;
outputXML += ` <patch id="${patchID}">\n`;
outputXML += ` <!-- ADD YOUR FILE/FOLDER PATCHES HERE -->\n`;
outputXML += ` </patch>\n`;
outputXML += `</wiidisc>`;
document.getElementById('outputXML').value = outputXML;
}
</script>
<p> </p>
<p> </p>
<hr />
<p><a id="ASM-GEN" name="ASM-GEN"><span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:26px;"><strong>ASM GENERATOR</strong></span></span></a><br />
<br />
Enter the Address that holds the value you want to replace: <input id="in_3_1" maxlength="8" name="Memory04" type="text" /><br />
Enter the value you want to insert at said Address: <input id="in_3_2" maxlength="8" name="Memory04Address" type="text" /><br />
Enter an empty register for said Address: <input id="in_3_3" maxlength="3" name="Memory04Reg1" type="text" /><br />
Enter another empty register for the value you want to insert at said Address: <input id="in_3_4" maxlength="3" name="Mem04Reg2" type="text" /><br />
<span style="font-family:tahoma,geneva,sans-serif;"><span style="font-size:26px;"><strong>REMOVE THE <span style="color:#FF0000;">BLR </span>INSTRUCTION IF YOU EXPERIENCE CRASHING WITH THE CODE</strong></span></span><br />
ASM Output:</p>
<p id="result3"> </p>
<p><input onclick="pr3_1()" type="button" value="Submit" /></p>
<p> </p>
<p>EXAMPLE:</p>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;">Enter the Address that holds the value you want to replace: <span style="font-size:24px;"><span style="color:#000000;"><strong>802c9210</strong></span></span><br />
Enter the value you want to insert at said Address: <span style="font-size:24px;"><strong><span style="color:#000000;">2C1811FF</span></strong></span><br />
Enter an empty register for said Address: <strong style="font-size: 24px; background-color: rgb(238, 238, 238);">r14</strong><br />
Enter another empty register for the value you want to replace at said Address: <span style="font-size:24px;"><strong>r15</strong></span></div>
<script>
function pr() {
document.getElementById("result").innerHTML = "<memory value="" + document.getElementById('fname').value + "" offset="0x" + document.getElementById('mname').value + "" />";
}
function pr2() {
let result = document.getElementById("result2");
let to = 0x80002388;
let from = parseInt(document.getElementById("mname2").value, 16);
let diff = 0x1000000 + to - from;
if(diff > 0x1000000){
result.innerText = "Jump dist must be below 0x1000000";
return;
}
if(from <= to){
result.innerText = "From addr must be > to addr";
return;
} else if (diff % 4 != 0){
result.innerText = "Jump dist is not divisible by 4";
return;
}
result.innerText = "0x4B" + diff.toString(16).toUpperCase().padStart(6, '0');
}
function pr3_1() {
let result = document.getElementById("result3");
let inputs = ['1', '2', '3', '4'].map(x => document.getElementById("in_3_" + x).value);
let out = "";
out += "lis " + inputs[2] + ", 0x" + inputs[0].substring(0, 4) + '\n';
out += "ori " + inputs[2] + ", " + inputs[2] + ", 0x" + inputs[0].substring(4, 8) + '\n';
out += "lwz " + inputs[2] + ", 0x0(" + inputs[2] + ")\n";
out += "lis " + inputs[3] + ", 0x" + inputs[1].substring(0, 4) + '\n';
out += "ori " + inputs[3] + ", " + inputs[3] + ", 0x" + inputs[1].substring(4, 8) + '\n';
out += "stw " + inputs[3] + ", 0x0(" + inputs[2] + ")\n";
out += "blr";
result.innerText = out;
}
</script>
<p> </p>
<hr /></body>
</html>
<title></title>
<style type="text/css">
</style>
<p> </p>
<p><span style="color:#00FF00;"><font face="arial, helvetica, sans-serif"><span style="font-size: 72px;"><b>Gecko Code Generators</b></span></font></span><br />
<br />
<a id="VPCMENT" name="VPCMENT"><span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:26px;"><strong>Value Replacement</strong></span></span></a></p>
<p>Enter the Address that holds the value you want to replace: <input id="in_4_1" maxlength="10" name="Memory4GeckoAddr" type="text" /><br />
Enter the value you want to insert at said Address: <input id="in_4_2" maxlength="10" name="Geck0value" type="text" /><br />
Code Type: <select id="in_4_3" name="TYPE-OF-CODE"><option value="C2">Default (C2)</option><option value="04">Force the game to replace the value (04)</option></select></p>
<p><input onclick="pr3()" type="button" value="Submit" /></p>
<p><strong>Output:</strong></p>
<p id="out_4_1"> </p>
<p> </p>
<p><strong>EXAMPLE (For C2 codes)</strong></p>
<p> </p>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;">Enter the Address that holds the value you want to replace: <span style="font-size: 24px;"><strong>80456780</strong></span><br />
Enter the value you want to insert at said Address: <span style="font-size:22px;"><strong>4E800020</strong></span><br />
<span style="background-color: rgb(238, 238, 238);">Code Type: <span style="font-size:20px;"><strong>Default (C2)</strong></span></span><br />
<br />
The output would be:<br />
<br />
<strong>C2456780 00000001<br />
4E800020 00000000</strong></div>
<p> </p>
<p><strong>EXAMPLE (For 04 codes)</strong></p>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;">Enter the Address that holds the value you want to replace: <span style="font-size: 24px;"><strong>80456780</strong></span><br />
Enter the value you want to insert at said Address: <span style="font-size: 22px;"><strong>4E800020</strong></span><br />
Code Type: <span style="font-size:20px;"><strong>Force the game to replace the value (04)</strong></span><br />
<br />
The output would be:<br />
<br />
<strong><span style="font-size:22px;">04456780 4E800020</span></strong>
<hr /><br />
<br />
<strong><span style="color:#00FF00;"><span style="font-size:28px;">If the user enters an address starting with "90" the output would be:</span></span><br />
<br />
<span style="font-size:22px;">42000000 90000000</span></strong><br />
<span style="font-size:22px;"><span style="background-color: rgb(238, 238, 238);"></span><strong>04456780 4E800020</strong></span><br />
<br />
<br />
<strong><span style="color:#00FF00;"><span style="font-size: 28px;">If the user enters an address starting with "91" the output would be:</span></span><br />
<br />
<span style="font-size: 22px;">42000000 90000000</span></strong><br />
<span style="font-size: 22px;"><span style="background-color: rgb(238, 238, 238);"></span><strong>05456780 4E800020</strong></span><br />
<br />
<strong><span style="color:#00FF00;"><span style="font-size: 28px;">If the user enters an address starting with "92" the output would be:</span></span><br />
<br />
<span style="font-size:22px;">42000000 92000000</span></strong><br />
<span style="font-size: 22px;"><span style="background-color: rgb(238, 238, 238);"></span><strong>04456780 4E800020</strong></span><br />
<br />
<strong><span style="color:#00FF00;"><span style="font-size: 28px;">If the user enters an address starting with "93" the output would be:</span></span><br />
<br />
<span style="font-size: 22px;">42000000 92000000</span></strong><br />
<span style="font-size: 22px;"><span style="background-color: rgb(238, 238, 238);"></span><strong>05456780 4E800020</strong></span><br />
</div>
<p> </p>
<hr />
<p><a id="CONCODE" name="CONCODE"><strong style="font-family: arial, helvetica, sans-serif;"><span style="font-size: 48px;">Conditional Code</span></strong></a><br />
<br />
<span style="font-size:26px;">If <input id="conaddr" maxlength="10" name="Address4CON" type="text" /> is equal to <input id="conval" maxlength="10" name="ValueEQ" type="text" />...</span></p>
<p><input onclick="conbtn()" type="button" value="Submit" /></p>
<p><strong>Output:</strong></p>
<p> </p>
<p id="conout"> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<hr />
<p><br />
<br />
<a id="button-activator" name="button-activator"><strong style="font-family: arial, helvetica, sans-serif;"><span style="font-size: 48px;">Button Activator</span></strong></a><br />
<br />
<span style="font-size: 26px;">Game</span> <select id="btngame"><option value="2040E158">Wii Sports</option><option value="2086E024">Wii Sports Resort</option><option selected="selected" value="20317bb0">Super Mario Sluggers</option></select> <span style="font-size: 26px;">Button </span> <select id="btnselected" name=" ButtonList"><option value="0001">Left</option><option value="0002">Right</option><option value="0004">Down</option><option value="0008">Up</option><option value="0010">+</option><option value="0100">2</option><option value="0200">1</option><option value="0400">B</option><option value="0800">A</option><option value="1000">-</option><option value="8000">Home</option></select><br />
<br />
<input onclick="btnbtn()" type="button" value="Submit" /></p>
<p><strong>Output:</strong><br />
<br />
</p>
<p id="btnoutput"> </p>
<p><strong>EXAMPLE:</strong></p>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;">
<p><span style="color:#00FF00;"><span style="font-size: 28px;"><b>The first line of the code will change based on what the user sets the Game to</b></span></span><br />
<br />
<span style="font-size:20px;"><b>Wii Sports: </b></span><span style="font-size:26px;">2040E158</span><br />
<b style="font-size: 20px; background-color: rgb(238, 238, 238);">Super Mario Sluggers: </b><span style="font-size: 26px; background-color: rgb(238, 238, 238);">20</span><span style="font-size:26px;">317bb0</span><br />
<br />
</p>
<p><span style="font-size: 26px;">If the (A) Button is pressed in Super Mario Sluggers... the output would be</span><br />
<br />
<span style="font-size:20px;"><strong>20317BB0 00000800<br />
<span style="color:#808080;"># Your code here (This message is included in the output)</span></strong><br />
<strong style="font-size: 22px; background-color: rgb(238, 238, 238);">e0000000 80008000</strong></span><br />
</p>
</div>
<p> </p>
<p> </p>
<hr />
<p><b style="color: rgb(0, 255, 0); font-family: arial, helvetica, sans-serif; font-size: 72px;"><span style="color:#0000FF;">GCT Files</span></b></p>
<p><span style="font-size: 48px;"><span style="font-family: arial, helvetica, sans-serif;"><strong><a id="GCT_DECODER" name="GCT_DECODER"></a>GCT "Decoder"<br />
<span style="font-size:22px;">This is more of a formatter but "decoder" sounds a lot cooler.</span></strong></span></span><br />
Enter the hex bytes of your GCT file <strong>(with spaces, including the<br />
"00 D0 C0 DE 00 D0 C0 DE" header).</strong><br />
<br />
<textarea cols="33" id="GCT_DATA_INPUT" rows="10"></textarea></p>
<p><input onclick="
{
let output = (document.getElementById('GCT_DATA_INPUT').value).toUpperCase();
output = output.replace(/\s+/g, '').match(/.{16}/g).map(s => s.slice(0,8)+' '+s.slice(8)).join('\n');
document.getElementById('GCT_DATA_OUTPUT').value = output;
}" type="button" value="Submit" /></p>
<p><span style="font-size: 22px;">Output:</span><br />
<br />
<textarea cols="33" id="GCT_DATA_OUTPUT" rows="22"></textarea></p>
<p> </p>
<p><br />
</p>
<hr />
<p><br />
<b style="color: rgb(128, 0, 128); font-family: arial, helvetica, sans-serif; font-size: 72px;">Other</b><br />
<a id="C2-RII" name="C2-RII" style="background-size: 16px;"><strong style="font-family: arial, helvetica, sans-serif;"><span style="font-size: 48px;">C2 --> Riivolution Memory Patch</span></strong></a><br />
<span style="font-size:28px;">Enter a C2 Code:</span><br />
<br />
<textarea cols="48" id="c2input" rows="10"></textarea> </p>
<p><input onclick="c2torvlclick()" type="button" value="Submit" /></p>
<p><span style="font-size:22px;">Output:</span><br />
<br />
<textarea cols="48" id="rvloutput" rows="8"></textarea> <br />
<br />
<br />
</p>
<p><strong>EXAMPLE:</strong></p>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;">
<p><span style="font-size:26px;"><span style="color:#000000;"><b>The following C2 code will be used as an example:</b></span></span></p>
<p><span style="background-color: rgb(238, 238, 238);">C2000004 00000003</span><br style="background-color: rgb(238, 238, 238);" />
<span style="background-color: rgb(238, 238, 238);">38A00000 7CC43378</span><br style="background-color: rgb(238, 238, 238);" />
<span style="background-color: rgb(238, 238, 238);">38A00006 38A00007</span><br style="background-color: rgb(238, 238, 238);" />
<span style="background-color: rgb(238, 238, 238);">60000000 00000000</span></p>
<hr />
<p><span style="font-size: 22px; background-color: rgb(238, 238, 238);"><span style="font-size:26px;"><strong>The output would be the following:</strong></span></span></p>
<p><memory value="48002334" offset="0x80000004" /><br />
<memory value="38A00000" offset="0x80002338" /><br />
<memory value="7CC43378" offset="0x8000233c" /><br />
<memory value="38A00006" offset="0x80002340" /><br />
<memory value="38A00007" offset="0x80002344" /><br />
<memory value="4bffdcc0" offset="0x80002348" /></p>
<p> </p>
<hr />
<p><span style="color:#FF0000;"><strong><span style="font-size:48px;">Explanation</span></strong></span><br />
C2000004<strong> --> </strong><span style="color:#0000FF;"><memory value="48002334" offset="0x80000004" /></span> --> <strong><span style="color:#FF0000;">The insertio</span></strong><strong><span style="color:#FF0000;">n address. 0x80000004 in this code. This instruction makes it branch to 0x80002338. It will do this for every insertion address</span></strong><strong><span style="color:#FF0000;">.</span></strong></p>
<p>00000003 ---><span style="color:#FF0000;"> <strong>Number of lines the code has. Not important.</strong></span></p>
<p><br />
38A00000 ---> <span style="color:#0000FF;"><memory value="38A00000" offset="0x80002338" /></span> ---> <span style="color:#FF0000;"><strong>The first line in the code. Always inserted at 0x<span style="background-color: rgb(238, 238, 238);">80002338</span></strong></span></p>
<p><br />
7CC43378 ---> <span style="color:#0000FF;"><memory value="7CC43378" offset="0x8000233c" /></span></p>
<p><br />
38A00006 ---> <span style="color:#0000FF;"><memory value="38A00006" offset="0x80002340" /></span></p>
<p><br />
38A00007 ---> <span style="color:#0000FF;"><memory value="38A00007" offset="0x80002344" /></span></p>
<p><br />
60000000 00000000 ---> <strong><span style="color:#FF0000;">If the very next line in the C2 code is "00000000" with nothing after it or "60000000 00000000," it will not be converted and will be replaced with a branch instruction to the insertion address + 0x4.</span></strong></p>
<p><br />
<span style="color:#0000FF;"><memory value="4bffdcc0" offset="0x80002348" /></span> <strong><span style="color:#FF0000;">---> Branches from 0x80002348 to 0x80000008 (Insertion address + 0x4)</span></strong><br />
</p>
</div>
<p> </p>
<p> </p>
<hr />
<p><b style="color: rgb(128, 0, 128); font-family: arial, helvetica, sans-serif; font-size: 72px;"><span style="color:#000000;">Regional Things</span></b><br />
<a id="FindAPALAddress" name="FindAPALAddress"><span style="font-size:36px;"><strong style="font-family: arial, helvetica, sans-serif;">How to find a PAL address</strong></span></a></p>
<p><span style="font-size:28px;"><span style="font-family:times new roman,times,serif;"><strong>First, I'd like to mention that this method will only work if<br />
you're making C2 codes or memory patches. It also won't<br />
work correctly if the instruction at the address you want to port<br />
is in between "bl" instructions.</strong></span><br />
<br />
<span style="font-size:18px;"><span style="font-size:20px;">Let's assume that I wanted to make the following memory patch:</span></span></span><br />
<br />
<span style="font-size:36px;"><span style="color:#4B0082;"><strong><memory value="12345678" offset="0x8056ED38" /></strong></span></span><br />
<br />
<span style="font-size: 20px;">This memory patch replaces the value at<strong> 0x8056ED38 </strong>with <strong>"12345678"</strong></span><br />
</p>
<p><span style="font-size: 20px;">But that's only the NTSC Address. This wouldn't work on the PAL version<br />
of the game I'm working with.<br />
<br />
That means I'd have to find the PAL address and make a seperate patch for it.<br />
<br />
<span style="font-size:36px;">So here's how I'd go about doing it...</span></span><br />
<br />
<br />
<span style="font-size:20px;"><span style="font-family:arial,helvetica,sans-serif;"><strong><span style="font-size:48px;">1. FINDING THE ORIGINAL INSTRUCTION:</span></strong><br />
<br />
In dolphin debug mode, I'd enter <strong>"</strong></span><strong>8056ED38</strong></span><span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:20px;"><strong>"</strong> in the "code" tab.<br />
This will highlight exactly what instruction is at that address.<br />
<br />
In the game I'm working with, the instruction is <strong><span style="font-size:36px;">"</span></strong></span><strong><span style="font-size:36px;">stw<span style="white-space:pre"> </span>r29, 0x01A8 (r31)"</span></strong></span><br />
<span style="font-family: arial, helvetica, sans-serif; font-size: 20px;">Here's a small snippet of what that area of memory looks like:</span><br />
<br />
<span style="font-family:tahoma,geneva,sans-serif;"><span style="font-size:18px;">8056ed38: stw r29, 0x01A8 (r31)<br />
8056ed3c: lwz r5, -0x25A8 (r13)<br />
8056ed40: mtctr r0<br />
8056ed44: addi r4, r6, 1<br />
8056ed48: addi r6, r6, 1</span></span></p>
<p><strong style="font-family: arial, helvetica, sans-serif; font-size: 20px;"><span style="font-size: 48px;">2. COPYING THE HEX VALUES</span></strong></p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 20px;">I'd then right click on the <strong><span style="font-size: 36px;">"</span></strong></span><strong style="font-family: arial, helvetica, sans-serif;"><span style="font-size: 36px;">stw<span style="white-space: pre;"> </span>r29, 0x01A8 (r31)" </span></strong><span style="font-family: arial, helvetica, sans-serif; font-size: 20px;">instruction<br />
and select "copy hex" which would give me the value <strong><span style="font-size:22px;">"</span></strong></span><strong><span style="font-size:22px;">93BF01A8."</span></strong><br />
<br />
<span style="font-size:22px;"><span style="font-family:arial,helvetica,sans-serif;">I'll have to repeat this process 4 more times (sometimes it's less if the function<br />
is unique).<br />
<br />
The hex values for each instruction would be the following:</span></span><br />
<br />
<span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:26px;">stw r29, 0x01A8 (r31) = <strong>93BF01A8</strong><br />
lwz r5, -0x25A8 (r13) = <strong>80ADDA58</strong><br />
mtctr r0 = <strong>7C0903A6</strong><br />
addi r4, r6, 1 = <strong>38860001</strong><br />
addi r6, r6, 1 = <strong>38C60001</strong></span></span></p>
<p><strong style="font-family: arial, helvetica, sans-serif; font-size: 20px;"><span style="font-size: 48px;">3. PUTTING THE VALUES TOGETHER</span></strong></p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 22px;">Next, I have to put all those values together and remove the spaces.<br />
Doing so gives me the following set of bytes:</span><br />
<br />
<span style="font-family:arial,helvetica,sans-serif;"><span style="color:#FF0000;"><strong><span style="font-size:36px;">"93BF01A880ADDA587C0903A63886000138C60001"</span></strong></span></span><br />
<br />
<span style="font-size:22px;"><span style="font-family:arial,helvetica,sans-serif;">I'd copy this and then open the PAL version of the game.</span></span><br />
<br />
<strong style="font-family: arial, helvetica, sans-serif; font-size: 20px;"><span style="font-size: 48px;">4. FINALE</span></strong></p>
<p><span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:22px;">In the PAL version of the game, I'd go into the "Memory" tab in Dolphin,<br />
look for the "Value" textbox, and then paste in the long set of bytes I copied.<br />
Then I'd hit "Find Next."<br />
<br />
This would bring up a match in Memory. It'll be highlighted in blue.<br />
<br />
Right Clicking on it and selecting "view in code" would show me<br />
that the PAL address of the original instruction I was searching for<br />
is <span style="color:#FF0000;"><span style="font-size:48px;"><span style="background-color:#FFA07A;">0x8056F058</span></span></span></span></span><br />
<br />
<span style="font-family: arial, helvetica, sans-serif; font-size: 22px;"> So now I have the address needed to make a PAL version of the memory patch</span><br />
<strong style="color: rgb(75, 0, 130); font-size: 36px;"><memory value="12345678" offset=<span style="background-color:#FFA07A;">"0x8056F058" </span>/></strong><br />
<br />
<br />
<br />
<strong><span style="font-size:48px;"><span style="font-family:arial,helvetica,sans-serif;">THE REASON THIS METHOD WORKS<br />
IS BECAUSE THE ACTUAL CODE OF<br />
THE GAME IS ALMOST ENTIRELY<br />
THE SAME BETWEEN REGIONS.<br />
<br />
MEANING THAT THE BYTE SEQUENCES<br />
MAKING UP ITS CODE ARE AS WELL.</span></span></strong></p>
<p><br />
</p>
<hr />
<p><br />
<span style="font-size:26px;">Coded by LlamaTrauma and JimmyKazakhstan</span></p>
<script>
function fourByteHex (val) {
var str = val.toString(16);
var len = str.length;
if (len > 8) {
str = str.substring(len - 8, len);
} else {
str = '0'.repeat(8 - len) + str;
}
return str.toUpperCase();
}
function getValue (elem, type) {
var val = elem.value;
var out = 0;
var newVal = '0';
switch (type) {
case 'hex':
if (val.substring(0, 2) == '0x') {
val = val.substring(2);
}
out = parseInt(val, 16);
newVal = '0x' + out.toString(16);
break;
default:
out = 0;
newVal = '0';
}
elem.value = newVal;
return out;
}
var replacement = {
address: function () {
return getValue(document.getElementById('in_4_1'), 'hex');
},
value: function () {
return getValue(document.getElementById('in_4_2'), 'hex');
},
writeOutput: function (output) {
document.getElementById('out_4_1').innerText = output;
},
type: function () {
return document.getElementById('in_4_3').value;
}
}
var conditional = {
address: function () {
return getValue(document.getElementById('conaddr'), 'hex');
},
value: function () {
return getValue(document.getElementById('conval'), 'hex');
},
writeOutput: function (output) {
document.getElementById('conout').innerText = output;
},
}
var button = {
game: function () {
return document.getElementById('btngame').value;
},
button: function () {
return document.getElementById('btnselected').value;
},
writeOutput: function (output) {
document.getElementById('btnoutput').innerText = output;
},
}
var branch = {
source: function () {
return getValue(document.getElementById('branchsrc'), 'hex');
},
dest: function () {
return getValue(document.getElementById('branchdest'), 'hex');
},
writeOutput: function (output) {
document.getElementById('branchoutput').innerText = output;
},
}
var c2torvl = {
input: function () {
return document.getElementById('c2input').value;
},
writeOutput: function (output) {
document.getElementById('rvloutput').value = output;
}
}
function addOne (address) {
return ((address >> 24) & 0xF) % 2;
}
function baseAddr (address) {
return parseInt(address.toString(16).substring(0, 2) + '000000', 16);
}
function pr3 () {
var address = replacement.address();
var value = replacement.value();
if (address < 0x80000000 || address >= 0x94000000) {
console.log(address);
replacement.writeOutput('Address ' + address.toString(16) + ' out of range');
return;
}
var addOne = ((address >> 24) & 0xF) % 2;
var baseAddr = parseInt(address.toString(16).substring(0, 2) + '000000', 16);
if (baseAddr % 0x02000000 != 0) {
baseAddr -= 0x01000000;
}
var output = '';
if (replacement.type() == '04') {
if (address >= 0x90000000) {
output += '42000000 ' + fourByteHex(baseAddr) + '\n';
}
var byte1 = '0' + (4 + addOne) + fourByteHex(address).substring(2);
var byte2 = fourByteHex(replacement.value());
output += byte1 + ' ' + byte2;
} else if (replacement.type() == 'C2') {
if (address >= 0x90000000) {
output = 'Invalid address for C2 codes';
} else {
output += 'C' + (2 + addOne) + fourByteHex(address).substring(2) + ' 00000001\n';
output += fourByteHex(value) + ' 00000000';
}
}
replacement.writeOutput(output);
}
function conbtn () {
var address = conditional.address();
var value = conditional.value();
var code = "";
code += '2' + (0 + addOne(address)) + fourByteHex(address).substring(2) + ' ';
code += fourByteHex(value) + '\n';
code += '# Your code here\n';
code += 'e0000000 80008000';
conditional.writeOutput(code);
}
function btnbtn () {
var game = button.game();
var btn = button.button();
var code = "";
code += game + ' 0000' + btn + '\n';
code += '# Your code here\n';
code += 'e0000000 80008000';
button.writeOutput(code);
}
function branchCode (source, dest) {
var code = "";
var diff = dest - source;
var dir = diff >= 0;
var prefix;
var jump;
if (dir) {
prefix = '48';
jump = fourByteHex(diff).substring(2);
} else {
prefix = '4B';
jump = fourByteHex(0x1000000 + diff).substring(2);
}
return prefix + jump;
};
function branchclick () {
var source = branch.source();
var dest = branch.dest();
branch.writeOutput(`<memory value="${branchCode(branch.source(), branch.dest())}" offset="${document.getElementById('branchsrc').value}" />`);
}
function c2torvlclick () {
var input = c2torvl.input();
var dwords = input.split(/ |\n/);
dwords = dwords.map((x) => parseInt(x, 16));
outputs = [];
first = dwords.shift();
first = first - 0xC2000000 + 0x80000000;
outputs.push([branchCode(first, 0x80002338), + first]);
dwords.shift();
for (var i = 0; i < dwords.length; i ++) {
var dword = dwords[i];
if (dword == 0 && i == dwords.length - 1) {
break;
}
if (dword == 0x60000000 && i == dwords.length - 2 && dwords[i + 1] == 0) {
break;
}
outputs.push([dword, 0x80002338 + i * 4]);
}
outputs.push([branchCode(0x80002338 + i * 4, first + 4), 0x80002338 + i * 4]);
code = "";
for (output of outputs) {
code += '<memory value="' + fourByteHex(output[0]) + '" offset="0x' + fourByteHex(output[1]) + '" />\n';
}
c2torvl.writeOutput(code);
}
function UniOutput() {
const og_bytes = document.getElementsByName('OriginalInstructions')[0].value;
const new_bytes = document.getElementsByName('NewBytes')[0].value;
const outputText = `<memory value="${og_bytes}" original="${new_bytes}" offset="" align="4" search="true" />`;
document.getElementsByName('UniOutput_area')[0].value = outputText;
}
</script>