forked from AmazingAmpharos/OoT-Randomizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRom.py
1127 lines (984 loc) · 55.3 KB
/
Rom.py
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
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import io
import json
import logging
import os
import platform
import struct
import subprocess
import random
from Hints import buildGossipHints, buildBossRewardHints, buildGanonText
from Utils import local_path, output_path
from Items import ItemFactory, item_data
from TextArray import text_array
class LocalRom(object):
def __init__(self, file, patch=True):
validCRC = []
validCRC.append(bytearray([0xEC, 0x70, 0x11, 0xB7, 0x76, 0x16, 0xD7, 0x2B])) # Compressed
validCRC.append(bytearray([0x70, 0xEC, 0xB7, 0x11, 0x16, 0x76, 0x2B, 0xD7])) # Byteswap compressed
validCRC.append(bytearray([0x93, 0x52, 0x2E, 0x7B, 0xE5, 0x06, 0xD4, 0x27])) # Decompressed
os.chdir(os.path.dirname(os.path.realpath(__file__)))
#os.chdir(output_path(os.path.dirname(os.path.realpath(__file__))))
with open(file, 'rb') as stream:
self.buffer = read_rom(stream)
file_name = os.path.splitext(file)
romCRC = self.buffer[0x10:0x18]
if romCRC not in validCRC:
raise RuntimeError('ROM is not a valid OoT 1.0 US ROM.')
if len(self.buffer) < 33554432 or len(self.buffer) > 67108864 or file_name[1] not in ['.z64', '.n64']:
raise RuntimeError('ROM is not a valid OoT 1.0 ROM.')
if len(self.buffer) == 33554432:
if platform.system() == 'Windows':
subprocess.call(["Decompress\Decompress.exe", file, output_path('ZOOTDEC.z64')])
with open((output_path('ZOOTDEC.z64')), 'rb') as stream:
self.buffer = read_rom(stream)
elif platform.system() == 'Linux':
subprocess.call(["Decompress/Decompress", file])
with open(("ZOOTDEC.z64"), 'rb') as stream:
self.buffer = read_rom(stream)
elif platform.system() == 'Darwin':
subprocess.call(["Decompress/Decompress.out", file])
with open(("ZOOTDEC.z64"), 'rb') as stream:
self.buffer = read_rom(stream)
else:
raise RuntimeError('Unsupported operating system for decompression. Please supply an already decompressed ROM.')
# extend to 64MB
self.buffer.extend(bytearray([0x00] * (67108864 - len(self.buffer))))
def write_byte(self, address, value):
self.buffer[address] = value
def write_bytes(self, startaddress, values):
for i, value in enumerate(values):
self.write_byte(startaddress + i, value)
def write_int16_to_rom(self, address, value):
self.write_bytes(address, int16_as_bytes(value))
def write_int32_to_rom(self, address, value):
self.write_bytes(address, int32_as_bytes(value))
def write_to_file(self, file):
with open(file, 'wb') as outfile:
outfile.write(self.buffer)
def read_rom(stream):
"Reads rom into bytearray"
buffer = bytearray(stream.read())
return buffer
def int16_as_bytes(value):
value = value & 0xFFFF
return [value & 0xFF, (value >> 8) & 0xFF]
def int32_as_bytes(value):
value = value & 0xFFFFFFFF
return [value & 0xFF, (value >> 8) & 0xFF, (value >> 16) & 0xFF, (value >> 24) & 0xFF]
def patch_rom(world, rom):
with open(local_path('data/base2current.json'), 'r') as stream:
patches = json.load(stream)
for patch in patches:
if isinstance(patch, dict):
for baseaddress, values in patch.items():
rom.write_bytes(int(baseaddress), values)
# Can always return to youth
rom.write_byte(0xCB6844, 0x35)
rom.write_byte(0x253C0E2, 0x03) # Moves sheik from pedestal
# Fix child shooting gallery reward to be static
rom.write_bytes(0xD35EFC, [0x00, 0x00, 0x00, 0x00])
# Fix target in woods reward to be static
rom.write_bytes(0xE59CD4, [0x00, 0x00, 0x00, 0x00])
# Fix GS rewards to be static
rom.write_bytes(0xEA3934, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xEA3940 , [0x10, 0x00])
# Fix horseback archery rewards to be static
rom.write_byte(0xE12BA5, 0x00)
rom.write_byte(0xE12ADD, 0x00)
# Fix adult shooting gallery reward to be static
rom.write_byte(0xD35F55, 0x00)
# Fix deku theater rewards to be static
rom.write_bytes(0xEC9A7C, [0x00, 0x00, 0x00, 0x00]) #Sticks
rom.write_byte(0xEC9CD5, 0x00) #Nuts
# Fix deku scrub who sells stick upgrade
rom.write_bytes(0xDF8060, [0x00, 0x00, 0x00, 0x00])
# Fix deku scrub who sells nut upgrade
rom.write_bytes(0xDF80D4, [0x00, 0x00, 0x00, 0x00])
# Fix rolling goron as child reward to be static
rom.write_bytes(0xED2960, [0x00, 0x00, 0x00, 0x00])
# Fix proximity text boxes (Navi) (Part 1)
rom.write_bytes(0xDF8B84, [0x00, 0x00, 0x00, 0x00])
# Fix final magic bean to cost 99
rom.write_byte(0xE20A0F, 0x63)
rom.write_bytes(0x94FCDD, [0x08, 0x39, 0x39])
# Remove intro cutscene
rom.write_bytes(0xB06BBA, [0x00, 0x00])
# Remove locked door to Boss Key Chest in Fire Temple
rom.write_byte(0x22D82B7, 0x3F)
# Change Bombchu Shop check to Bomb Bag
rom.write_bytes(0xC6CEDA, [0x00, 0xA2])
rom.write_byte(0xC6CEDF, 0x18)
# Change Bowling Alley check to Bomb Bag (Part 1)
rom.write_bytes(0x00E2D716, [0xA6, 0x72])
rom.write_byte(0x00E2D723, 0x18)
# Change Bowling Alley check to Bomb Bag (Part 2)
rom.write_bytes(0x00E2D892, [0xA6, 0x72])
rom.write_byte(0x00E2D897, 0x18)
# Change Bazaar check to Bomb Bag (Child?)
rom.write_bytes(0x00C0082A, [0x00, 0x18])
rom.write_bytes(0x00C0082C, [0x00, 0x0E, 0X74, 0X02])
rom.write_byte(0x00C00833, 0xA0)
# Change Bazaar check to Bomb Bag (Adult?)
rom.write_bytes(0x00DF7A8E, [0x00, 0x18])
rom.write_bytes(0x00DF7A90, [0x00, 0x0E, 0X74, 0X02])
rom.write_byte(0x00DF7A97, 0xA0)
# Change Goron Shop check to Bomb Bag
rom.write_bytes(0x00C6ED86, [0x00, 0xA2])
rom.write_bytes(0x00C6ED8A, [0x00, 0x18])
# Change graveyard graves to not allow grabbing on to the ledge
rom.write_byte(0x0202039D, 0x20)
rom.write_byte(0x0202043C, 0x24)
# Fix Link the Goron to always work
rom.write_bytes(0xED2FAC, [0x80, 0x6E, 0x0F, 0x18])
rom.write_bytes(0xED2FEC, [0x24, 0x0A, 0x00, 0x00])
rom.write_bytes(0xAE74D8, [0x24, 0x0E, 0x00, 0x00])
# Fix King Zora Thawed to always work
rom.write_bytes(0xE55C4C, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xE56290, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xE56298, [0x00, 0x00, 0x00, 0x00])
# Fix Castle Courtyard to check for meeting Zelda, not Zelda fleeing, to block you
rom.write_bytes(0xCD5E76, [0x0E, 0xDC])
rom.write_bytes(0xCD5E12, [0x0E, 0xDC])
# Cutscene for all medallions never triggers when leaving shadow or spirit temples(hopefully stops warp to colossus on shadow completion with boss reward shuffle)
rom.write_byte(0xACA409, 0xAD)
rom.write_byte(0xACA49D, 0xCE)
# Speed Zelda's Letter scene
rom.write_bytes(0x290E08E, [0x05, 0xF0])
rom.write_byte(0xEFCBA7, 0x08)
rom.write_byte(0xEFE7C7, 0x05)
#rom.write_byte(0xEFEAF7, 0x08)
#rom.write_byte(0xEFE7C7, 0x05)
rom.write_bytes(0xEFE938, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xEFE948, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xEFE950, [0x00, 0x00, 0x00, 0x00])
# Speed Zelda escaping from Hyrule Castle
Block_code = [0x00, 0x00, 0x00, 0x01, 0x00, 0x21, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02]
rom.write_bytes(0x1FC0CF8, Block_code)
# Speed learning Zelda's Lullaby
Block_code = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0xE8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x73, 0x00, 0x3B,
0x00, 0x3C, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0C,
0x00, 0x17, 0x00, 0x00, 0x00, 0x10, 0x00, 0x02, 0x08, 0x8B, 0xFF, 0xFF,
0x00, 0xD4, 0x00, 0x11, 0x00, 0x20, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x2E8E900, Block_code)
# Speed learning Sun's Song
rom.write_bytes(0x332A4A6, [0x00, 0x3C])
Block_code = [0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00,
0x00, 0x10, 0x00, 0x02, 0x08, 0x8B, 0xFF, 0xFF, 0x00, 0xD3, 0x00, 0x11,
0x00, 0x20, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x332A868, Block_code)
# Speed learning Saria's Song
rom.write_bytes(0x20B1736, [0x00, 0x3C])
Block_code = [0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x15, 0x00, 0x00,
0x00, 0x10, 0x00, 0x02, 0x08, 0x8B, 0xFF, 0xFF, 0x00, 0xD1, 0x00, 0x11,
0x00, 0x20, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x20B1DA8, Block_code)
rom.write_bytes(0x20B19C8, [0x00, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00])
Block_code = [0x00, 0x3E, 0x00, 0x11, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xD4, 0xFF, 0xFF, 0xF7, 0x31,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xD4]
rom.write_bytes(0x20B19F8, Block_code)
# Speed learning Epona's Song
rom.write_bytes(0x29BEF68, [0x00, 0x5E, 0x00, 0x0A, 0x00, 0x0B, 0x00, 0x0B])
Block_code = [0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0xD2, 0x00, 0x00,
0x00, 0x09, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0A,
0x00, 0x3C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x29BECB0, Block_code)
# Speed learning Song of Time
Block_code = [0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x19, 0x00, 0x00,
0x00, 0x10, 0x00, 0x02, 0x08, 0x8B, 0xFF, 0xFF, 0x00, 0xD5, 0x00, 0x11,
0x00, 0x20, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x252FC80, Block_code)
rom.write_bytes(0x252FBA0, [0x00, 0x35, 0x00, 0x3B, 0x00, 0x3C, 0x00, 0x3C])
rom.write_bytes(0x1FC3B84, [0xFF, 0xFF, 0xFF, 0xFF])
# Speed learning Song of Storms
Block_code = [0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02,
0x00, 0xD6, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x00, 0xBE, 0x00, 0xC8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x3041084, Block_code)
# Speed learning Minuet of Forest
rom.write_bytes(0x20AFF86, [0x00, 0x3C])
Block_code = [0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x0F, 0x00, 0x00,
0x00, 0x10, 0x00, 0x02, 0x08, 0x8B, 0xFF, 0xFF, 0x00, 0x73, 0x00, 0x11,
0x00, 0x20, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x20B0800, Block_code)
rom.write_bytes(0x20AFF90, [0x00, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00])
rom.write_bytes(0x20AFFC1, [0x00, 0x3E, 0x00, 0x11, 0x00, 0x20, 0x00, 0x00])
rom.write_bytes(0x20B0492, [0x00, 0x21, 0x00, 0x22])
rom.write_bytes(0x20B04CA, [0x00, 0x00, 0x00, 0x00])
# Speed learning Bolero of Fire
rom.write_bytes(0x224B5D6, [0x00, 0x3C])
Block_code = [0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00,
0x00, 0x10, 0x00, 0x02, 0x08, 0x8B, 0xFF, 0xFF, 0x00, 0x74, 0x00, 0x11,
0x00, 0x20, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x224D7E8, Block_code)
rom.write_bytes(0x224B5E0, [0x00, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00])
rom.write_bytes(0x224B611, [0x00, 0x3E, 0x00, 0x11, 0x00, 0x20, 0x00, 0x00])
rom.write_bytes(0x224B7F8, [0x00, 0x00])
rom.write_bytes(0x224B828, [0x00, 0x00])
rom.write_bytes(0x224B858, [0x00, 0x00])
rom.write_bytes(0x224B888, [0x00, 0x00])
# Speed learning Serenade of Water
rom.write_bytes(0x2BEB256, [0x00, 0x3C])
Block_code = [0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x10, 0x00, 0x11, 0x00, 0x00,
0x00, 0x10, 0x00, 0x02, 0x08, 0x8B, 0xFF, 0xFF, 0x00, 0x75, 0x00, 0x11,
0x00, 0x20, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x2BEC880, Block_code)
rom.write_bytes(0x2BEB260, [0x00, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00])
rom.write_bytes(0x2BEB290, [0x00, 0x3E, 0x00, 0x11, 0x00, 0x20, 0x00, 0x00])
rom.write_bytes(0x2BEB538, [0x00, 0x00])
rom.write_bytes(0x2BEB548, [0x80, 0x00])
rom.write_bytes(0x2BEB554, [0x80, 0x00])
rom.write_bytes(0x2BEC852, [0x00, 0x21, 0x00, 0x22])
# Speed learning Nocturne of Shadow
rom.write_bytes(0x1FFE460, [0x00, 0x2F, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02])
rom.write_bytes(0x1FFFDF6, [0x00, 0x3C])
Block_code = [0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x13, 0x00, 0x00,
0x00, 0x10, 0x00, 0x02, 0x08, 0x8B, 0xFF, 0xFF, 0x00, 0x77, 0x00, 0x11,
0x00, 0x20, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x2000FD8, Block_code)
rom.write_bytes(0x2000130, [0x00, 0x32, 0x00, 0x3A, 0x00, 0x3B, 0x00, 0x3B])
# Speed learning Requiem of Spirit
rom.write_bytes(0x218AF16, [0x00, 0x3C])
Block_code = [0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x08, 0x00, 0x12, 0x00, 0x00,
0x00, 0x10, 0x00, 0x02, 0x08, 0x8B, 0xFF, 0xFF, 0x00, 0x76, 0x00, 0x11,
0x00, 0x20, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x218C574, Block_code)
rom.write_bytes(0x218B480, [0x00, 0x30, 0x00, 0x3A, 0x00, 0x3B, 0x00, 0x3B])
Block_code = [0x00, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFA, 0xF9, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
0xFF, 0xFF, 0xFA, 0xF9, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
0x0F, 0x67, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]
rom.write_bytes(0x218AF20, Block_code)
rom.write_bytes(0x218AF50, [0x00, 0x3E, 0x00, 0x11, 0x00, 0x20, 0x00, 0x00])
# Speed learning Prelude of Light
rom.write_bytes(0x252FD26, [0x00, 0x3C])
Block_code = [0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x00,
0x00, 0x10, 0x00, 0x02, 0x08, 0x8B, 0xFF, 0xFF, 0x00, 0x78, 0x00, 0x11,
0x00, 0x20, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x2531320, Block_code)
rom.write_byte(0x252FF1D, 0x00)
rom.write_bytes(0x25313DA, [0x00, 0x21, 0x00, 0x22])
# Speed scene after Deku Tree
rom.write_bytes(0x2077E20, [0x00, 0x07, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02])
rom.write_bytes(0x2078A10, [0x00, 0x0E, 0x00, 0x1F, 0x00, 0x20, 0x00, 0x20])
Block_code = [0x00, 0x80, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x00, 0x1E, 0x00, 0x28, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
rom.write_bytes(0x2079570, Block_code)
# Speed scene after Dodongo's Cavern
rom.write_bytes(0x2221E88, [0x00, 0x0C, 0x00, 0x3B, 0x00, 0x3C, 0x00, 0x3C])
rom.write_bytes(0x2223308, [0x00, 0x81, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x00])
# Speed scene after Jabu Jabu's Belly
rom.write_bytes(0xCA3530, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0x2113340, [0x00, 0x0D, 0x00, 0x3B, 0x00, 0x3C, 0x00, 0x3C])
rom.write_bytes(0x2113C18, [0x00, 0x82, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x00])
rom.write_bytes(0x21131D0, [0x00, 0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x3C])
# Speed scene after Forest Temple
rom.write_bytes(0xD4ED68, [0x00, 0x45, 0x00, 0x3B, 0x00, 0x3C, 0x00, 0x3C])
rom.write_bytes(0xD4ED78, [0x00, 0x3E, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x00])
rom.write_bytes(0x207B9D4, [0xFF, 0xFF, 0xFF, 0xFF])
# Speed scene after Fire Temple
rom.write_bytes(0x2001848, [0x00, 0x1E, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02])
rom.write_bytes(0xD100B4, [0x00, 0x62, 0x00, 0x3B, 0x00, 0x3C, 0x00, 0x3C])
rom.write_bytes(0xD10134, [0x00, 0x3C, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x00])
# Speed scene after Water Temple
rom.write_bytes(0xD5A458, [0x00, 0x15, 0x00, 0x3B, 0x00, 0x3C, 0x00, 0x3C])
rom.write_bytes(0xD5A3A8, [0x00, 0x3D, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x00])
rom.write_bytes(0x20D0D20, [0x00, 0x29, 0x00, 0xC7, 0x00, 0xC8, 0x00, 0xC8])
# Speed scene after Shadow Temple
rom.write_bytes(0xD13EC8, [0x00, 0x61, 0x00, 0x3B, 0x00, 0x3C, 0x00, 0x3C])
rom.write_bytes(0xD13E18, [0x00, 0x41, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x00])
# Speed scene after Spirit Temple
rom.write_bytes(0xD3A0A8, [0x00, 0x60, 0x00, 0x3B, 0x00, 0x3C, 0x00, 0x3C])
rom.write_bytes(0xD39FF0, [0x00, 0x3F, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x00])
# Speed Nabooru defeat scene
rom.write_bytes(0x2F5AF84, [0x00, 0x00, 0x00, 0x05])
rom.write_bytes(0x2F5C7DA, [0x00, 0x01, 0x00, 0x02])
rom.write_bytes(0x2F5C7A2, [0x00, 0x03, 0x00, 0x04])
rom.write_byte(0x2F5B369, 0x09)
rom.write_byte(0x2F5B491, 0x04)
rom.write_byte(0x2F5B559, 0x04)
rom.write_byte(0x2F5B621, 0x04)
rom.write_byte(0x2F5B761, 0x07)
# Speed scene with all medallions
rom.write_bytes(0x2512680, [0x00, 0x74, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02])
# Speed collapse of Ganon's Tower
rom.write_bytes(0x33FB328, [0x00, 0x76, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02])
# Speed Phantom Ganon defeat scene
rom.write_bytes(0xC944D8, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xC94548, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xC94730, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xC945A8, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xC94594, [0x00, 0x00, 0x00, 0x00])
# Speed Twinrova defeat scene
rom.write_bytes(0xD678CC, [0x24, 0x01, 0x03, 0xA2, 0xA6, 0x01, 0x01, 0x42])
rom.write_bytes(0xD67BA4, [0x10, 0x00])
# Speed scenes during final battle
# Ganondorf battle end
rom.write_byte(0xD82047, 0x09)
# Zelda descends
rom.write_byte(0xD82AB3, 0x66)
rom.write_byte(0xD82FAF, 0x65)
rom.write_bytes(0xD82D2E, [0x04, 0x1F])
rom.write_bytes(0xD83142, [0x00, 0x6B])
rom.write_bytes(0xD82DD8, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xD82ED4, [0x00, 0x00, 0x00, 0x00])
rom.write_byte(0xD82FDF, 0x33)
# After tower collapse
rom.write_byte(0xE82E0F, 0x04)
# Ganon intro
rom.write_bytes(0xE83D28, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xE83B5C, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xE84C80, [0x10, 0x00])
# Speed completion of the trials in Ganon's Castle
rom.write_bytes(0x31A8090, [0x00, 0x6B, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02]) #Forest
rom.write_bytes(0x31A9E00, [0x00, 0x6E, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02]) #Fire
rom.write_bytes(0x31A8B18, [0x00, 0x6C, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02]) #Water
rom.write_bytes(0x31A9430, [0x00, 0x6D, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02]) #Shadow
rom.write_bytes(0x31AB200, [0x00, 0x70, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02]) #Spirit
rom.write_bytes(0x31AA830, [0x00, 0x6F, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02]) #Light
# Speed obtaining Fairy Ocarina
rom.write_bytes(0x2151230, [0x00, 0x72, 0x00, 0x3C, 0x00, 0x3D, 0x00, 0x3D])
Block_code = [0x00, 0x4A, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x00, 0x3C, 0x00, 0x81, 0xFF, 0xFF]
rom.write_bytes(0x2151240, Block_code)
rom.write_bytes(0x2150E20, [0xFF, 0xFF, 0xFA, 0x4C])
# Speed Zelda Light Arrow cutscene
rom.write_bytes(0x2531B40, [0x00, 0x28, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02])
rom.write_bytes(0x2532FBC, [0x00, 0x75])
rom.write_bytes(0x2532FEA, [0x00, 0x75, 0x00, 0x80])
rom.write_byte(0x2533115, 0x05)
rom.write_bytes(0x2533141, [0x06, 0x00, 0x06, 0x00, 0x10])
rom.write_bytes(0x2533171, [0x0F, 0x00, 0x11, 0x00, 0x40])
rom.write_bytes(0x25331A1, [0x07, 0x00, 0x41, 0x00, 0x65])
rom.write_bytes(0x2533642, [0x00, 0x50])
rom.write_byte(0x253389D, 0x74)
rom.write_bytes(0x25338A4, [0x00, 0x72, 0x00, 0x75, 0x00, 0x79])
rom.write_bytes(0x25338BC, [0xFF, 0xFF])
rom.write_bytes(0x25338C2, [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF])
rom.write_bytes(0x25339C2, [0x00, 0x75, 0x00, 0x76])
rom.write_bytes(0x2533830, [0x00, 0x31, 0x00, 0x81, 0x00, 0x82, 0x00, 0x82])
# Speed Bridge of Light cutscene
rom.write_bytes(0x292D644, [0x00, 0x00, 0x00, 0xA0])
rom.write_bytes(0x292D680, [0x00, 0x02, 0x00, 0x0A, 0x00, 0x6C, 0x00, 0x00])
rom.write_bytes(0x292D6E8, [0x00, 0x27])
rom.write_bytes(0x292D718, [0x00, 0x32])
rom.write_bytes(0x292D810, [0x00, 0x02, 0x00, 0x3C])
rom.write_bytes(0x292D924, [0xFF, 0xFF, 0x00, 0x14, 0x00, 0x96, 0xFF, 0xFF])
# Remove remaining owls
rom.write_bytes(0x1FE30CE, [0x01, 0x4B])
rom.write_bytes(0x1FE30DE, [0x01, 0x4B])
rom.write_bytes(0x1FE30EE, [0x01, 0x4B])
rom.write_bytes(0x205909E, [0x00, 0x3F])
rom.write_byte(0x2059094, 0x80)
# Darunia won't dance
rom.write_bytes(0x22769E4, [0xFF, 0xFF, 0xFF, 0xFF])
# Zora moves quickly
rom.write_bytes(0xE56924, [0x00, 0x00, 0x00, 0x00])
# Speed Jabu Jabu swallowing Link
rom.write_bytes(0xCA0784, [0x00, 0x18, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02])
# Ruto no longer points to Zora Sapphire
rom.write_bytes(0xD03BAC, [0xFF, 0xFF, 0xFF, 0xFF])
# Ruto never disappears from Jabu Jabu's Belly
rom.write_byte(0xD01EA3, 0x00)
# Speed up Epona race start
rom.write_bytes(0x29BE984, [0x00, 0x00, 0x00, 0x02])
rom.write_bytes(0x29BE9CA, [0x00, 0x01, 0x00, 0x02])
# Speed start of Horseback Archery
#rom.write_bytes(0x21B2064, [0x00, 0x00, 0x00, 0x02])
#rom.write_bytes(0x21B20AA, [0x00, 0x01, 0x00, 0x02])
# Speed up Epona escape
rom.write_bytes(0x1FC8B36, [0x00, 0x2A])
# Speed up draining the well
rom.write_bytes(0xE0A010, [0x00, 0x2A, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02])
rom.write_bytes(0x2001110, [0x00, 0x2B, 0x00, 0xB7, 0x00, 0xB8, 0x00, 0xB8])
# Speed up opening the royal tomb for both child and adult
rom.write_bytes(0x2025026, [0x00, 0x01])
rom.write_bytes(0x2023C86, [0x00, 0x01])
rom.write_byte(0x2025159, 0x02)
rom.write_byte(0x2023E19, 0x02)
#Speed opening of Door of Time
rom.write_bytes(0xE0A176, [0x00, 0x02])
rom.write_bytes(0xE0A35A, [0x00, 0x01, 0x00, 0x02])
# Poacher's Saw no longer messes up Deku Theater
rom.write_bytes(0xAE72CC, [0x00, 0x00, 0x00, 0x00])
# Learning Serenade tied to opening chest in room
Block_code = [0x3C, 0x0F, 0x80, 0x1D, 0x81, 0xE8, 0xA1, 0xDB, 0x24, 0x19, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0xA2, 0x1C, 0x44,
0x00, 0x00, 0x00, 0x00]
rom.write_bytes(0xC7BCF0, Block_code)
# Dampe Chest spawn condition looks at chest flag instead of having obtained hookshot
Block_code = [0x93, 0x18, 0xAE, 0x7E, 0x27, 0xA5, 0x00, 0x24, 0x33, 0x19, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00]
rom.write_bytes(0xDFEC40, Block_code)
# Darunia sets an event flag and checks for it
Block_code = [0x24, 0x19, 0x00, 0x40, 0x8F, 0x09, 0xB4, 0xA8, 0x01, 0x39, 0x40, 0x24,
0x01, 0x39, 0xC8, 0x25, 0xAF, 0x19, 0xB4, 0xA8, 0x24, 0x09, 0x00, 0x06]
rom.write_bytes(0xCF1AB8, Block_code)
# Change Prelude CS to check for medallion
rom.write_bytes(0x00C805E6, [0x00, 0xA6])
rom.write_bytes(0x00C805F2, [0x00, 0x01])
# Change Nocturne CS to check for medallions
rom.write_bytes(0x00ACCD8E, [0x00, 0xA6])
rom.write_bytes(0x00ACCD92, [0x00, 0x01])
rom.write_bytes(0x00ACCD9A, [0x00, 0x02])
rom.write_bytes(0x00ACCDA2, [0x00, 0x04])
# Change King Zora to move even if Zora Sapphire is in inventory
rom.write_bytes(0x00E55BB0, [0x85, 0xCE, 0x8C, 0x3C])
rom.write_bytes(0x00E55BB4, [0x84, 0x4F, 0x0E, 0xDA])
# Remove extra Forest Temple medallions
rom.write_bytes(0x00D4D37C, [0x00, 0x00, 0x00, 0x00])
# Remove extra Fire Temple medallions
rom.write_bytes(0x00AC9754, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0x00D0DB8C, [0x00, 0x00, 0x00, 0x00])
# Remove extra Water Temple medallions
rom.write_bytes(0x00D57F94, [0x00, 0x00, 0x00, 0x00])
# Remove extra Spirit Temple medallions
rom.write_bytes(0x00D370C4, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0x00D379C4, [0x00, 0x00, 0x00, 0x00])
# Remove extra Shadow Temple medallions
rom.write_bytes(0x00D116E0, [0x00, 0x00, 0x00, 0x00])
# Change Mido, Saria, and Kokiri to check for Deku Tree complete flag
# bitwise pointer for 0x80
kokiriAddresses = [0xE52836, 0xE53A56, 0xE51D4E, 0xE51F3E, 0xE51D96, 0xE51E1E, 0xE51E7E, 0xE51EDE, 0xE51FC6, 0xE51F96, 0xE293B6, 0xE29B8E, 0xE62EDA, 0xE630D6, 0xE62642, 0xE633AA, 0xE6369E]
for kokiri in kokiriAddresses:
rom.write_bytes(kokiri, [0x8C, 0x0C])
# Kokiri
rom.write_bytes(0xE52838, [0x94, 0x48, 0x0E, 0xD4])
rom.write_bytes(0xE53A58, [0x94, 0x49, 0x0E, 0xD4])
rom.write_bytes(0xE51D50, [0x94, 0x58, 0x0E, 0xD4])
rom.write_bytes(0xE51F40, [0x94, 0x4B, 0x0E, 0xD4])
rom.write_bytes(0xE51D98, [0x94, 0x4B, 0x0E, 0xD4])
rom.write_bytes(0xE51E20, [0x94, 0x4A, 0x0E, 0xD4])
rom.write_bytes(0xE51E80, [0x94, 0x59, 0x0E, 0xD4])
rom.write_bytes(0xE51EE0, [0x94, 0x4E, 0x0E, 0xD4])
rom.write_bytes(0xE51FC8, [0x94, 0x49, 0x0E, 0xD4])
rom.write_bytes(0xE51F98, [0x94, 0x58, 0x0E, 0xD4])
# Saria
rom.write_bytes(0xE293B8, [0x94, 0x78, 0x0E, 0xD4])
rom.write_bytes(0xE29B90, [0x94, 0x68, 0x0E, 0xD4])
# Mido
rom.write_bytes(0xE62EDC, [0x94, 0x6F, 0x0E, 0xD4])
rom.write_bytes(0xE630D8, [0x94, 0x4F, 0x0E, 0xD4])
rom.write_bytes(0xE62644, [0x94, 0x6F, 0x0E, 0xD4])
rom.write_bytes(0xE633AC, [0x94, 0x68, 0x0E, 0xD4])
rom.write_bytes(0xE636A0, [0x94, 0x48, 0x0E, 0xD4])
# Change adult Kokiri Forest to check for Forest Temple complete flag
rom.write_bytes(0xE5369E, [0xB4, 0xAC])
rom.write_bytes(0xD5A83C, [0x80, 0x49, 0x0E, 0xDC])
# Change adult Goron City to check for Fire Temple complete flag
rom.write_bytes(0xED59DC, [0x80, 0xC9, 0x0E, 0xDC])
# Change Pokey to check DT complete flag
rom.write_bytes(0xE5400A, [0x8C, 0x4C])
rom.write_bytes(0xE5400E, [0xB4, 0xA4])
if world.open_forest:
rom.write_bytes(0xE5401C, [0x14, 0x0B])
# Fix Shadow Temple to check for different rewards for scene
rom.write_bytes(0xCA3F32, [0x00, 0x00, 0x25, 0x4A, 0x00, 0x10])
# Fix Spirit Temple to check for different rewards for scene
rom.write_bytes(0xCA3EA2, [0x00, 0x00, 0x25, 0x4A, 0x00, 0x08])
# Fire Arrows now in a chest, always spawn
rom.write_bytes(0xE9E202, [0x00, 0x0A])
rom.write_bytes(0xE9E1F2, [0x5B, 0x08])
rom.write_bytes(0xE9E1D8, [0x00, 0x00, 0x00, 0x00])
# Fix Biggoron to check a different flag.
rom.write_byte(0xED329B, 0x72)
rom.write_byte(0xED43E7, 0x72)
rom.write_bytes(0xED3370, [0x3C, 0x0D, 0x80, 0x12])
rom.write_bytes(0xED3378, [0x91, 0xB8, 0xA6, 0x42, 0xA1, 0xA8, 0xA6, 0x42])
rom.write_bytes(0xED6574, [0x00, 0x00, 0x00, 0x00])
# Remove the check on the number of days that passed for claim check.
rom.write_bytes(0xED4470, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xED4498, [0x00, 0x00, 0x00, 0x00])
# Fixed reward order for Bombchu Bowling
rom.write_bytes(0xE2E698, [0x80, 0xAA, 0xE2, 0x64])
rom.write_bytes(0xE2E6A0, [0x80, 0xAA, 0xE2, 0x4C])
rom.write_bytes(0xE2D440, [0x24, 0x19, 0x00, 0x00])
# Make fishing less obnoxious
Block_code = [0x3C, 0x0A, 0x80, 0x12, 0x8D, 0x4A, 0xA5, 0xD4, 0x14, 0x0A, 0x00, 0x06,
0x31, 0x78, 0x00, 0x01, 0x14, 0x18, 0x00, 0x02, 0x3c, 0x18, 0x42, 0x30,
0x3C, 0x18, 0x42, 0x50, 0x03, 0xe0, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x14, 0x18, 0x00, 0x02, 0x3C, 0x18, 0x42, 0x10, 0x3C, 0x18, 0x42, 0x38,
0x03, 0xE0, 0x00, 0x08]
rom.write_bytes(0x3480C00, Block_code)
rom.write_bytes(0xDBF434, [0x44, 0x98, 0x90, 0x00, 0xE6, 0x52, 0x01, 0x9C])
rom.write_bytes(0xDBF484, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xDBF4A8, [0x00, 0x00, 0x00, 0x00])
rom.write_bytes(0xDCBEAA, [0x42, 0x48]) #set adult fish size requirement
rom.write_bytes(0xDCBF26, [0x42, 0x48]) #set adult fish size requirement
rom.write_bytes(0xDCBF32, [0x42, 0x30]) #set child fish size requirement
rom.write_bytes(0xDCBF9E, [0x42, 0x30]) #set child fish size requirement
# Dampe always digs something up and first dig is always the Piece of Heart
rom.write_bytes(0xCC3FA8, [0xA2, 0x01, 0x01, 0xF8])
rom.write_bytes(0xCC4024, [0x00, 0x00, 0x00, 0x00])
# Allow owl to always carry the kid down Death Mountain
rom.write_bytes(0xE304F0, [0x24, 0x0E, 0x00, 0x01])
# Forbid Sun's Song from a bunch of cutscenes
Suns_scenes = [0x2016FC9, 0x2017219, 0x20173D9, 0x20174C9, 0x2017679, 0x20C1539, 0x20C15D9, 0x21A0719, 0x21A07F9, 0x2E90129, 0x2E901B9, 0x2E90249, 0x225E829, 0x225E939, 0x306D009]
for address in Suns_scenes:
rom.write_byte(address,0x01)
# Remove forcible text triggers
Wonder_text = [0x27C00C6, 0x27C00D6, 0x27C00E6, 0x27C00F6, 0x27C0106, 0x27C0116, 0x27C0126, 0x27C0136]
for address in Wonder_text:
rom.write_byte(address, 0x02)
rom.write_byte(0x27CE08A, 0x09)
rom.write_byte(0x27CE09A, 0x0F)
Wonder_text = [0x288707A, 0x288708A, 0x288709A, 0x289707A, 0x28C713E, 0x28D91C6]
for address in Wonder_text:
rom.write_byte(address, 0x0C)
Wonder_text = [0x28A60FE, 0x28AE08E, 0x28B917E, 0x28BF172, 0x28BF182, 0x28BF192]
for address in Wonder_text:
rom.write_byte(address, 0x0D)
rom.write_byte(0x28A114E, 0x0E)
rom.write_byte(0x28A610E, 0x0E)
Wonder_text = [0x9367F6, 0x93673D, 0x93679D]
for address in Wonder_text:
rom.write_byte(address, 0x08)
Wonder_text = [0x289707B, 0x28AE08F, 0x28C713F]
for address in Wonder_text:
rom.write_byte(address, 0xAF)
rom.write_byte(0x28A114F, 0x6F)
rom.write_byte(0x28B917F, 0x6F)
rom.write_byte(0x28A60FF, 0xEF)
rom.write_byte(0x28D91C7, 0xEF)
Wonder_text = [0x28A610F, 0x28BF173, 0x28BF183, 0x28BF193]
for address in Wonder_text:
rom.write_byte(address, 0x2F)
Wonder_text = [0x27CE08B, 0x27C00C7, 0x27C00D7, 0x27C0117, 0x27C0127]
for address in Wonder_text:
rom.write_byte(address, 0x3D)
rom.write_byte(0x27C00E7, 0x7D)
rom.write_byte(0x27C00F7, 0x7D)
rom.write_byte(0x27C0107, 0xBD)
rom.write_byte(0x27C0137, 0xBD)
Wonder_text = [0x27C00BC, 0x27C00CC, 0x27C00DC, 0x27C00EC, 0x27C00FC, 0x27C010C, 0x27C011C, 0x27C012C, 0x27CE080, 0x27CE090, 0x2887070, 0x2887080, 0x2887090, 0x2897070, 0x28C7134, 0x28D91BC, 0x28A60F4, 0x28AE084, 0x28B9174, 0x28BF168, 0x28BF178, 0x28BF188, 0x28A1144, 0x28A6104]
for address in Wonder_text:
rom.write_byte(address, 0xFE)
# Speed text
for address in text_array:
rom.write_byte(address, 0x08)
# Speed Happy Mask shop text
rom.write_bytes(0x9602E4, [0x08, 0x48, 0x69, 0x79, 0x65, 0x65, 0x21, 0x01])
rom.write_bytes(0x960344, [0x08, 0x08, 0x08, 0x08, 0x57])
Block_code = [0x6D, 0x6F, 0x6E, 0x65, 0x79, 0x20, 0x05, 0x40, 0x62, 0x61, 0x63, 0x6B,
0x20, 0x68, 0x65, 0x72, 0x65, 0x2E, 0x04, 0x08, 0x08]
rom.write_bytes(0x9603AB, Block_code)
Block_code = [0x73, 0x69, 0x67, 0x6E, 0x20, 0x01, 0x05, 0x40, 0x72, 0x69, 0x67, 0x68,
0x74, 0x20, 0x6F, 0x76, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65,
0x2E, 0x04, 0x08, 0x08]
rom.write_bytes(0x9603F8, Block_code)
rom.write_bytes(0x961160, [0x08, 0x08, 0x08, 0x08])
rom.write_bytes(0x9611AF, [0x08, 0x08, 0x08, 0x08, 0x44])
rom.write_bytes(0x9609F0, [0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x54])
rom.write_bytes(0x960459, [0x08, 0x08])
rom.write_bytes(0x9604C4, [0x08, 0x08, 0x41, 0x20, 0x6D, 0x61, 0x73, 0x6B, 0x20, 0x08, 0x08])
rom.write_bytes(0x960513, [0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x54])
Block_code = [0x08, 0x53, 0x6F, 0x6D, 0x65, 0x6F, 0x6E, 0x65, 0x20, 0x6D, 0x61, 0x79,
0x20, 0x77, 0x61, 0x6E, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x01, 0x6D,
0x61, 0x73, 0x6B, 0x2E, 0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08]
rom.write_bytes(0x960555, Block_code)
rom.write_bytes(0x9605F5, [0x08, 0x08])
Block_code = [0x08, 0x50, 0x61, 0x79, 0x6D, 0x65, 0x6E, 0x74, 0x20, 0x72, 0x65, 0x63,
0x65, 0x69, 0x76, 0x65, 0x64, 0x21, 0x0B, 0x02]
rom.write_bytes(0x960718, Block_code)
Block_code = [0x08, 0x56, 0x65, 0x72, 0x79, 0x20, 0x77, 0x65, 0x6C, 0x6C, 0x20, 0x64,
0x6F, 0x6E, 0x65, 0x21, 0x01, 0x41, 0x6C, 0x6C, 0x20, 0x74, 0x68, 0x65,
0x20, 0x6D, 0x61, 0x73, 0x6B, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x73,
0x6F, 0x6C, 0x64, 0x20, 0x6F, 0x75, 0x74, 0x2E, 0x01, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08]
rom.write_bytes(0x96078C, Block_code)
rom.write_bytes(0x960913, [0x04, 0x08, 0x08])
Block_code = [0x08, 0x46, 0x72, 0x6F, 0x6D, 0x20, 0x6E, 0x6F, 0x77, 0x20, 0x6F, 0x6E,
0x20, 0x79, 0x6F, 0x75, 0x20, 0x63, 0x61, 0x6E, 0x20, 0x62, 0x6F, 0x72,
0x72, 0x6F, 0x77, 0x20, 0x61, 0x6E, 0x79, 0x01, 0x6D, 0x61, 0x73, 0x6B,
0x20, 0x79, 0x6F, 0x75, 0x20, 0x77, 0x61, 0x6E, 0x74, 0x2E, 0x01, 0x4A,
0x75, 0x73, 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x66, 0x61, 0x69,
0x74, 0x68, 0x2E, 0x2E, 0x2E, 0x0B, 0x02]
rom.write_bytes(0x960924, Block_code)
Block_code = [0x08, 0x08, 0x08, 0x57, 0x65, 0x6C, 0x63, 0x6F, 0x6D, 0x65, 0x21, 0x01,
0x57, 0x68, 0x69, 0x63, 0x68, 0x20, 0x6D, 0x61, 0x73, 0x6B, 0x20, 0x63,
0x61, 0x6E, 0x20, 0x49, 0x20, 0x6C, 0x65, 0x6E, 0x64, 0x20, 0x79, 0x6F,
0x75, 0x3F, 0x0B, 0x02]
rom.write_bytes(0x960968, Block_code)
Block_code = [0x08, 0x57, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6D,
0x61, 0x73, 0x6B, 0x20, 0x79, 0x6F, 0x75, 0x20, 0x63, 0x61, 0x6E, 0x20,
0x73, 0x65, 0x65, 0x20, 0x69, 0x6E, 0x74, 0x6F, 0x20, 0x01, 0x08, 0x08,
0x08, 0x20, 0x70, 0x65, 0x6F, 0x70, 0x6C, 0x65, 0x27, 0x73, 0x20, 0x6D,
0x69, 0x6E, 0x64, 0x73, 0x2E, 0x20, 0x49, 0x74, 0x27, 0x73, 0x20, 0x75,
0x73, 0x65, 0x66, 0x75, 0x6C, 0x2C, 0x01, 0x62, 0x75, 0x74, 0x20, 0x73,
0x63, 0x61, 0x72, 0x79, 0x21, 0x04, 0x08]
rom.write_bytes(0x960A44, Block_code)
rom.write_byte(0x960AA3, 0x01)
rom.write_byte(0x960AC6, 0x01)
Happy_mask_turn_ins = [0x96066C, 0x961064, 0x9610B8, 0x96110C] #addresses with the same fix for lines upon returning profits from a sold mask
for address in Happy_mask_turn_ins:
rom.write_bytes(address, [0x08, 0x08, 0x08, 0x08, 0x47])
# Speed up various shops
rom.write_bytes(0x9550D0, [0x08, 0x48, 0x65, 0x79, 0x21, 0x08, 0x08, 0x08, 0x08])
rom.write_bytes(0x93189C, [0x08, 0x4D, 0x79, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08])
rom.write_bytes(0x95EC04, [0x08, 0x49, 0x74, 0x27, 0x73, 0x08, 0x08])
Block_code = [0x08, 0x08, 0x08, 0x08, 0x57, 0x65, 0x20, 0x73, 0x65, 0x6C, 0x6C, 0x20,
0x73, 0x68, 0x69, 0x65, 0x6C, 0x64, 0x73, 0x2C]
rom.write_bytes(0x941734, Block_code)
rom.write_bytes(0x949A94, [0x08, 0x59, 0x6F, 0x75, 0x27, 0x72, 0x65])
rom.write_bytes(0x949B04, [0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x4F])
rom.write_bytes(0x949B6A, [0x08, 0x08, 0x08, 0x08, 0x08, 0x4C])
rom.write_bytes(0x949BC0, [0x08, 0x08, 0x08, 0x57])
Block_code = [0x08, 0x08, 0x08, 0x08, 0x08, 0x57, 0x61, 0x6E, 0x74, 0x20, 0x74, 0x6F,
0x20, 0x62, 0x79, 0x20, 0x66, 0x69, 0x73, 0x68, 0x3F, 0x20, 0x59, 0x6F,
0x75, 0x27, 0x6C, 0x6C]
rom.write_bytes(0x94E57C, Block_code)
Block_code = [0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x54, 0x68, 0x61, 0x6E, 0x6B, 0x73,
0x20, 0x74, 0x6F, 0x20, 0x79, 0x6F, 0x75, 0x2C, 0x20, 0x49, 0x27, 0x6D,
0x20, 0x4F, 0x4B, 0x21]
rom.write_bytes(0x9498C8, Block_code)
rom.write_bytes(0x927E38, Block_code)
Block_code = [0x59, 0x6F, 0x75, 0x20, 0x68, 0x65, 0x61, 0x72, 0x64, 0x20, 0x61, 0x62,
0x6F, 0x75, 0x74, 0x20, 0x75, 0x73, 0x20, 0x66, 0x72, 0x6F, 0x6D, 0x20,
0x74, 0x68, 0x65, 0x01, 0x67, 0x75, 0x61, 0x72, 0x64, 0x20, 0x61, 0x74,
0x20, 0x44, 0x65, 0x61, 0x74, 0x68, 0x20, 0x4D, 0x6F, 0x75, 0x6E, 0x74,
0x61, 0x69, 0x6E, 0x20, 0x67, 0x61, 0x74, 0x65, 0x3F, 0x01, 0x08, 0x08,
0x08, 0x08, 0x08]
rom.write_bytes(0x9650BC, Block_code)
Block_code = [0x08, 0x08, 0x08, 0x08, 0x57, 0x65, 0x20, 0x6D, 0x6F, 0x76, 0x65, 0x64,
0x20, 0x68, 0x65, 0x72, 0x65, 0x20, 0x66, 0x72, 0x6F, 0x6D, 0x20, 0x43,
0x61, 0x73, 0x74, 0x6C, 0x65, 0x20, 0x01, 0x54]
rom.write_bytes(0x9318F8, Block_code)
Block_code = [0x08, 0x41, 0x6E, 0x20, 0x6F, 0x6C, 0x64, 0x20, 0x77, 0x69, 0x74, 0x63,
0x68, 0x20, 0x72, 0x75, 0x6E, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x50,
0x6F, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x53, 0x68, 0x6F, 0x70, 0x01, 0x62,
0x65, 0x68, 0x69, 0x6E, 0x64, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6F,
0x6E, 0x65, 0x2E, 0x20, 0x59, 0x6F, 0x75, 0x20, 0x63, 0x61, 0x6E, 0x20,
0x67, 0x65, 0x74, 0x20, 0x74, 0x6F, 0x01]
rom.write_bytes(0x954DA0, Block_code)
Block_code = [0x08, 0x45, 0x76, 0x65, 0x72, 0x79, 0x62, 0x6F, 0x64, 0x79, 0x20, 0x68,
0x61, 0x73, 0x20, 0x63, 0x6F, 0x6D, 0x65, 0x20, 0x62, 0x61, 0x63, 0x6B,
0x21, 0x01, 0x49, 0x74, 0x27, 0x73, 0x20, 0x62, 0x75, 0x73, 0x69, 0x6E,
0x65, 0x73, 0x73, 0x20, 0x61, 0x73, 0x20, 0x75, 0x73, 0x75, 0x61, 0x6C,
0x21, 0x0B, 0x02]
rom.write_bytes(0x94B57C, Block_code)
rom.write_bytes(0x94B3AC, [0x08, 0x4F, 0x68, 0x20, 0x6E, 0x6F, 0x21, 0x20])
Block_code = [0x08, 0x08, 0x08, 0x08, 0x08, 0x44, 0x6F]
rom.write_bytes(0x94E5BC, Block_code)
rom.write_bytes(0x92CB2C, Block_code)
Block_code = [0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08]
rom.write_bytes(0x94E639, Block_code)
rom.write_bytes(0x92CBA9, Block_code)
rom.write_bytes(0x9650BC, [0x08, 0x08, 0x08, 0x08, 0x48])
# Speed dig text for Dampe
rom.write_bytes(0x9532F8, [0x08, 0x08, 0x08, 0x59])
# Make item descriptions into a single box
Short_item_descriptions = [0x92EC84, 0x92F9E3, 0x92F2B4, 0x92F37A, 0x92F513, 0x92F5C6, 0x92E93B, 0x92EA12]
for address in Short_item_descriptions:
rom.write_byte(address,0x02)
# Fix text for Pocket Cucco.
rom.write_byte(0xBEEF45, 0x0B)
rom.write_byte(0x92D41A, 0x2E)
Block_code = [0x59, 0x6f, 0x75, 0x20, 0x67, 0x6f, 0x74, 0x20, 0x61, 0x20, 0x05, 0x41,
0x50, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x20, 0x43, 0x75, 0x63, 0x63, 0x6f,
0x2c, 0x20, 0x05, 0x40, 0x6f, 0x6e, 0x65, 0x01, 0x6f, 0x66, 0x20, 0x41,
0x6e, 0x6a, 0x75, 0x27, 0x73, 0x20, 0x70, 0x72, 0x69, 0x7a, 0x65, 0x64,
0x20, 0x68, 0x65, 0x6e, 0x73, 0x21, 0x20, 0x49, 0x74, 0x20, 0x66, 0x69,
0x74, 0x73, 0x20, 0x01, 0x69, 0x6e, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20,
0x70, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x02]
rom.write_bytes(0x92D41C, Block_code)
# DMA in extra code
Block_code = [0xAF, 0xBF, 0x00, 0x1C, 0xAF, 0xA4, 0x01, 0x40, 0x3C, 0x05, 0x03, 0x48,
0x3C, 0x04, 0x80, 0x40, 0x0C, 0x00, 0x03, 0x7C, 0x24, 0x06, 0x50, 0x00,
0x0C, 0x10, 0x02, 0x00]
rom.write_bytes(0xB17BB4, Block_code)
Block_code = [0x3C, 0x02, 0x80, 0x12, 0x24, 0x42, 0xD2, 0xA0, 0x24, 0x0E, 0x01, 0x40,
0xAC, 0x2E, 0xE5, 0x00, 0x03, 0xE0, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00]
rom.write_bytes(0x3480800, Block_code)
rom.write_bytes(0xD270, [0x03, 0x48, 0x00, 0x00, 0x03, 0x48, 0x50, 0x00, 0x03, 0x48, 0x00, 0x00])
# Fix checksum (Thanks Nintendo)
Block_code = [0x93, 0x5E, 0x8E, 0x5B, 0xD0, 0x9C, 0x5A, 0x58]
rom.write_bytes(0x10, Block_code)
# Set hooks for various code
# rom.write_bytes(0xBD6C94, ...) #Progressive Items Object Hook, unsure where this case is called
rom.write_bytes(0xB06C2C, [0x0C, 0x10, 0x01, 0x80]) #Save Writing Hook
rom.write_bytes(0xDBF428, [0x0C, 0x10, 0x03, 0x00]) #Set Fishing Hook
# Write Initial Save File
Block_code = [0xA2, 0x28, 0x80, 0x20, 0x24, 0x05, 0x80, 0x02, 0x24, 0x0F, 0x00, 0x84,
0x24, 0x18, 0x00, 0x01, 0x24, 0x19, 0x00, 0x08, 0x24, 0x08, 0x00, 0x80,
0xA6, 0x25, 0x00, 0xD8, 0xA2, 0x2F, 0x00, 0xDA, 0xA2, 0x38, 0x01, 0x65,
0xA2, 0x39, 0x09, 0xB6, 0xA2, 0x28, 0x0A, 0x24, 0xA2, 0x38, 0x0A, 0xCE,
0xA2, 0x28, 0x0A, 0xCF, 0xA2, 0x28, 0x0A, 0xE8, 0x24, 0x05, 0x00, 0x20,
0xA2, 0x25, 0x0B, 0x3F, 0xA2, 0x28, 0x0E, 0xDC, 0xA2, 0x25, 0x0E, 0xDD,
0xA2, 0x25, 0x0E, 0xED, 0xA2, 0x38, 0x0E, 0xF9, 0xA2, 0x39, 0x0E, 0xDA,
0xA2, 0x28, 0x0E, 0xE0, 0xA2, 0x38, 0x02, 0x0E, 0xA2, 0x39, 0x01, 0x49,
0xA2, 0x39, 0x0E, 0xD6, 0x24, 0x05, 0x01, 0xFF, 0x24, 0x0F, 0x01, 0xFB,
0x24, 0x18, 0x07, 0xFF, 0x24, 0x19, 0x00, 0x04, 0x24, 0x08, 0x00, 0x30,
0xA6, 0x25, 0x0E, 0xE2, 0xA6, 0x2F, 0x0E, 0xE8, 0xA6, 0x38, 0x0E, 0xEA,
0xA2, 0x28, 0x0E, 0xE7, 0xA2, 0x39, 0x0F, 0x1A, 0x24, 0x08, 0x10, 0x20,
0x24, 0x19, 0x00, 0x2C, 0x24, 0x18, 0x00, 0x49, 0x24, 0x0F, 0x00, 0x02,
0x24, 0x05, 0x00, 0x40, 0xA6, 0x28, 0x0E, 0xD4, 0x00, 0x00, 0x00, 0x00,
0xA2, 0x38, 0x00, 0xF6, 0xA2, 0x2F, 0x00, 0x3F, 0xA2, 0x25, 0x0A, 0x42,
0x92, 0x25, 0x0E, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xA2, 0x25, 0x0E, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x24, 0x08, 0x0F, 0x01, 0x24, 0x19, 0x00, 0x09,
0x24, 0x18, 0x00, 0x03, 0x24, 0x0F, 0x00, 0x04, 0x24, 0x05, 0x00, 0x06,
0xA6, 0x28, 0x01, 0x10, 0xA2, 0x39, 0x01, 0x2C, 0xA2, 0x38, 0x01, 0x2E,
0xA2, 0x2F, 0x0F, 0x0A, 0xA2, 0x25, 0x0F, 0x21, 0x24, 0x05, 0x00, 0x00,
0xA2, 0x25, 0x00, 0xA7, 0x24, 0x0F, 0x00, 0x21, 0xA2, 0x2F, 0x0E, 0xED,
0x24, 0x0F, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x03, 0xE0, 0x00, 0x08]
rom.write_bytes(0x3480600, Block_code)
# Set up for Rainbow Bridge dungeons condition
Block_code = [0x15, 0x41, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x80, 0xEA, 0x00, 0xA5,
0x24, 0x01, 0x00, 0x1C, 0x31, 0x4A, 0x00, 0x1C, 0x08, 0x07, 0x88, 0xD9]
rom.write_bytes(0x3480820, Block_code)
# Gossip stones resond to stone of agony
Block_code = [0x3C, 0x01, 0x80, 0x12, 0x80, 0x21, 0xA6, 0x75, 0x30, 0x21, 0x00, 0x20,
0x03, 0xE0, 0x00, 0x08]
rom.write_bytes(0x3480840, Block_code)
# Set up Rainbow Bridge conditions
if world.bridge == 'medallions':
Block_code = [0x80, 0xEA, 0x00, 0xA7, 0x24, 0x01, 0x00, 0x3F,
0x31, 0x4A, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00]
rom.write_bytes(0xE2B454, Block_code)
elif world.bridge == 'open':
rom.write_bytes(0x34806B8, [0x34, 0xA5, 0x00, 0x20])
elif world.bridge == 'dungeons':
Block_code = [0x80, 0xEA, 0x00, 0xA7, 0x24, 0x01, 0x00, 0x3F,
0x08, 0x10, 0x02, 0x08, 0x31, 0x4A, 0x00, 0x3F]
rom.write_bytes(0xE2B454, Block_code)
if world.open_forest:
#rom.write_byte(0x2081148, 0x80)
rom.write_bytes(0x34806C4, [0x92, 0x25, 0x0E, 0xD5, 0x34, 0xA5, 0x00, 0x10, 0xA2, 0x25, 0x0E, 0xD5])
if world.open_door_of_time:
rom.write_bytes(0x34806BC, [0x34, 0xA5, 0x00, 0x08])
if world.fast_ganon:
rom.write_bytes(0xD82A12, [0x05, 0x17]) # Sets exit from Ganondorf fight to entrance to Ganon fight
rom.write_byte(0x348066A, 0x21) # Flag Spirit Trial as clear
rom.write_byte(0x348066E, 0xFF) # Flag the other five trials as clear
rom.write_byte(0x3480703, 0x29) # The barrier is dispelled.
rom.write_bytes(0x348070C, [0xA2, 0x2F, 0x01, 0xF1]) # Remove Ganon's Castle Boss Key door
# Sets hooks for gossip stone changes
if world.hints:
rom.write_bytes(0xEE7B84, [0x0C, 0x10, 0x02, 0x10])
rom.write_bytes(0xEE7B8C, [0x24, 0x02, 0x00, 0x20])
address = 0xB85B11
offset = 0xBE4C
for i in range(0,33):
offset_high = offset >> 8
offset_low = offset & 0x00FF
rom.write_bytes(address, [0x00, offset_high, offset_low])
offset = offset + 0x5C
address = address + 0x08
buildGossipHints(world, rom)
# Set hints for boss reward shuffle
rom.write_bytes(0xE2ADB2, [0x70, 0x7A])
rom.write_bytes(0xE2ADB6, [0x70, 0x57])
rom.write_byte(0xB8811E, 0x20)
rom.write_byte(0xB88236, 0x20)
buildBossRewardHints(world, rom)
# build silly ganon lines
buildGanonText(world, rom)
# Write item overrides
rom.write_bytes(0x3481000, get_override_table(world))
# Patch songs and boss rewards
for location in world.get_locations():
item = location.item
itemid = item.code
locationaddress = location.address
secondaryaddress = location.address2
if itemid is None or location.address is None:
continue
if location.type == 'Song':
rom.write_byte(locationaddress, itemid)
itemid = itemid + 0x0D
rom.write_byte(secondaryaddress, itemid)
if location.name == 'Impa at Castle':
impa_fix = 0x65 - item.index
rom.write_byte(0xD12ECB, impa_fix)
impa_fix = 0x8C34 - (item.index * 4)
impa_fix_high = impa_fix >> 8
impa_fix_low = impa_fix & 0x00FF
rom.write_bytes(0xB063FE, [impa_fix_high, impa_fix_low])
rom.write_byte(0x2E8E931, item_data[item.name]) #Fix text box
elif location.name == 'Song from Malon':
if item.name == 'Suns Song':
rom.write_byte(locationaddress, itemid)
malon_fix = 0x8C34 - (item.index * 4)
malon_fix_high = malon_fix >> 8
malon_fix_low = malon_fix & 0x00FF
rom.write_bytes(0xD7E142, [malon_fix_high, malon_fix_low])
#rom.write_bytes(0xD7E8D6, [malon_fix_high, malon_fix_low]) # I don't know what this does, may be useful?
rom.write_bytes(0xD7E786, [malon_fix_high, malon_fix_low])
rom.write_byte(0x29BECB9, item_data[item.name]) #Fix text box
elif location.name == 'Song from Composer Grave':
sun_fix = 0x8C34 - (item.index * 4)
sun_fix_high = sun_fix >> 8
sun_fix_low = sun_fix & 0x00FF
rom.write_bytes(0xE09F66, [sun_fix_high, sun_fix_low])
rom.write_byte(0x332A87D, item_data[item.name]) #Fix text box
elif location.name == 'Song from Saria':
saria_fix = 0x65 - item.index
rom.write_byte(0xE2A02B, saria_fix)
saria_fix = 0x8C34 - (item.index * 4)
saria_fix_high = saria_fix >> 8
saria_fix_low = saria_fix & 0x00FF
rom.write_bytes(0xE29382, [saria_fix_high, saria_fix_low])
rom.write_byte(0x20B1DBD, item_data[item.name]) #Fix text box
elif location.name == 'Song from Ocarina of Time':
rom.write_byte(0x252FC95, item_data[item.name]) #Fix text box
elif location.name == 'Song at Windmill':
windmill_fix = 0x65 - item.index
rom.write_byte(0xE42ABF, windmill_fix)
rom.write_byte(0x3041091, item_data[item.name]) #Fix text box
elif location.name == 'Sheik Forest Song':
minuet_fix = 0x65 - item.index
rom.write_byte(0xC7BAA3, minuet_fix)
rom.write_byte(0x20B0815, item_data[item.name]) #Fix text box
elif location.name == 'Sheik at Temple':
prelude_fix = 0x65 - item.index
rom.write_byte(0xC805EF, prelude_fix)
rom.write_byte(0x2531335, item_data[item.name]) #Fix text box
elif location.name == 'Sheik in Crater':
bolero_fix = 0x65 - item.index
rom.write_byte(0xC7BC57, bolero_fix)
rom.write_byte(0x224D7FD, item_data[item.name]) #Fix text box
elif location.name == 'Sheik in Ice Cavern':
serenade_fix = 0x65 - item.index
rom.write_byte(0xC7BD77, serenade_fix)
rom.write_byte(0x2BEC895, item_data[item.name]) #Fix text box
elif location.name == 'Sheik in Kakariko':
nocturne_fix = 0x65 - item.index
rom.write_byte(0xAC9A5B, nocturne_fix)
rom.write_byte(0x2000FED, item_data[item.name]) #Fix text box
elif location.name == 'Sheik at Colossus':
rom.write_byte(0x218C589, item_data[item.name]) #Fix text box
elif location.type == 'Boss':
if location.name == 'Links Pocket':
rom.write_byte(locationaddress, item_data[item.name][0])
rom.write_byte(secondaryaddress, item_data[item.name][1])
else:
rom.write_byte(locationaddress, itemid)
rom.write_byte(secondaryaddress, item_data[item.name][2])
if location.name == 'Bongo Bongo':
rom.write_bytes(0xCA3F32, [item_data[item.name][3][0], item_data[item.name][3][1]])