-
Notifications
You must be signed in to change notification settings - Fork 2
/
menu_events.html
1134 lines (1110 loc) · 32 KB
/
menu_events.html
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
<html>
<head>
<title>Main Menu Event Calculator - Donkey Kong 64 Speedruns</title>
<link rel="stylesheet" href="style/nav.css">
<link rel="stylesheet" href="style/main.css">
<link rel="stylesheet" href="style/home.css">
<link rel="stylesheet" href="style/mj.css">
<link rel="stylesheet" href="style/event.css">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<meta name="description" content="" />
</head>
<body>
<nav id="navigation"></nav>
<nav id="navigation"></nav>
<div class="v_spacer">
</div>
<div class="flexsplitter">
<div class="homebox">
<div class="header master_header">
<strong>Main Menu Events Calculator</strong>
</div>
</div>
</div>
<div class="flexsplitter">
<div class="homebox" style="padding: 20px">
<div class="flexsplitter eventMasterContainer">
<div class="flex40 eventText">
<div class="flexsplitter eventContainer">
<div class="flex40">
<div class="leg_shake eventImage"></div>
</div>
<div class="flex40 eventStats">
<strong class="head">Leg Shake</strong>
<div class="sub bad">Bad Event</div>
<div class="innerStats">
<table class="eventTable">
<tr>
<td>
Overall:
</td>
<td class="eventCount" indic="legshake">
0
</td>
<td class="eventPercent" indic="legshake">
0%
</td>
</tr>
<tr>
<td>
Value 0:
</td>
<td class="eventCount" indic="0">
0
</td>
<td class="eventPercent" indic="0">
0%
</td>
</tr>
<tr>
<td>
Value A:
</td>
<td class="eventCount" indic="a">
0
</td>
<td class="eventPercent" indic="a">
0%
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="flex40 eventText">
<div class="flexsplitter eventContainer">
<div class="flex40">
<div class="bullies eventImage"></div>
</div>
<div class="flex40 eventStats">
<strong class="head">Kremling Bullies</strong>
<div class="sub good">Good Event</div>
<div class="innerStats">
<table class="eventTable">
<tr>
<td>
Overall:
</td>
<td class="eventCount" indic="3">
0
</td>
<td class="eventPercent" indic="3">
0%
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="flexsplitter eventMasterContainer">
<div class="flex40 eventText">
<div class="flexsplitter eventContainer">
<div class="flex40">
<div class="rambi_beavers eventImage"></div>
</div>
<div class="flex40 eventStats">
<strong class="head">Rambi Beavers</strong>
<div class="sub good">Good Event</div>
<div class="innerStats">
<table class="eventTable">
<tr>
<td>
Overall:
</td>
<td class="eventCount" indic="d">
0
</td>
<td class="eventPercent" indic="d">
0%
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="flex40 eventText">
<div class="flexsplitter eventContainer">
<div class="flex40">
<div class="rambi_barrel eventImage"></div>
</div>
<div class="flex40 eventStats">
<strong class="head">Rambi Barrel</strong>
<div class="sub good">Good Event</div>
<div class="innerStats">
<table class="eventTable">
<tr>
<td>
Overall:
</td>
<td class="eventCount" indic="12">
0
</td>
<td class="eventPercent" indic="12">
0%
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="flexsplitter eventMasterContainer">
<div class="flex40 eventText">
<div class="flexsplitter eventContainer">
<div class="flex40">
<div class="kremling_leg_shake eventImage"></div>
</div>
<div class="flex40 eventStats">
<strong class="head">Kremling Leg Shake</strong>
<div class="sub good">Good Event</div>
<div class="innerStats">
<table class="eventTable">
<tr>
<td>
Overall:
</td>
<td class="eventCount" indic="17">
0
</td>
<td class="eventPercent" indic="17">
0%
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="flex40 eventText">
<div class="flexsplitter eventContainer">
<div class="flex40">
<div class="beaver_stack eventImage"></div>
</div>
<div class="flex40 eventStats">
<strong class="head">Beaver Stack</strong>
<div class="sub good">Good Event</div>
<div class="innerStats">
<table class="eventTable">
<tr>
<td>
Overall:
</td>
<td class="eventCount" indic="1a">
0
</td>
<td class="eventPercent" indic="1a">
0%
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="flexsplitter eventMasterContainer">
<div class="flex40 eventText">
<div class="flexsplitter eventContainer">
<div class="flex40">
<div class="mini_beavers eventImage"></div>
</div>
<div class="flex40 eventStats">
<strong class="head">Mini Beavers</strong>
<div class="sub good">Good Event</div>
<div class="innerStats">
<table class="eventTable">
<tr>
<td>
Overall:
</td>
<td class="eventCount" indic="1f">
0
</td>
<td class="eventPercent" indic="1f">
0%
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="flex40 eventText">
<div class="flexsplitter eventContainer">
<div class="flex40">
<div class="butterflies eventImage"></div>
</div>
<div class="flex40 eventStats">
<strong class="head">Butterflies</strong>
<div class="sub good">Good Event</div>
<div class="innerStats">
<table class="eventTable">
<tr>
<td>
Overall:
</td>
<td class="eventCount" indic="26">
0
</td>
<td class="eventPercent" indic="26">
0%
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="flexsplitter eventMasterContainer">
<div class="flex40 eventText">
<div class="flexsplitter eventContainer">
<div class="flex40">
<div class="night_cycle eventImage"></div>
</div>
<div class="flex40 eventStats">
<strong class="head">Night Cycle</strong>
<div class="sub bad">Bad Event</div>
<div class="innerStats">
<table class="eventTable">
<tr>
<td>
Overall:
</td>
<td class="eventCount" indic="2d">
0
</td>
<td class="eventPercent" indic="2d">
0%
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="flex40 eventText">
<div class="flexsplitter eventContainer">
<div class="flex40">
<div class="rain_cycle eventImage"></div>
</div>
<div class="flex40 eventStats">
<strong class="head">Rain Cycle</strong>
<div class="sub bad">Bad Event</div>
<div class="innerStats">
<table class="eventTable">
<tr>
<td>
Overall:
</td>
<td class="eventCount" indic="34">
0
</td>
<td class="eventPercent" indic="34">
0%
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="homebox">
<div class="input_info">
<div class="mj_calc_desc">
<h2>The Calculator</h2>
</div>
<!-- RNG -->
<h4 class="label">
RNG
</h4>
<div class="flexsplitter">
<div class="flex40">
<span class="label">Starting RNG (Hex): 0x</span>
<input type="text" maxlength="8" placeholder="E32B6F7" id="startingHex" oninput="checkForHex()">
<div class="hint">(Default is 0xE32B6F7 as this is what is set upon entering DKTV)</div>
</div>
<div class="flex40">
<span class="label">How many cycles to search: </span>
<input type="number" maxlength="8" min="10" max="10000000" id="checkCount">
</div>
</div>
<br><br>
<!-- Viewed Events -->
<div class="flexsplitter">
<div class="flex40">
<h4 class="label">
Viewed Events
</h4>
</div>
<div class="flex40" style="text-align: right">
<button style="width: fit-content;width:-moz-fit-content; font-size: 14px" onclick="selectAll()">
Select All
</button>
<button style="width: fit-content;width:-moz-fit-content; font-size: 14px" onclick="deselectAll()">
Deselect All
</button>
</div>
</div>
<div class="flexsplitter">
<div class="flex40">
<table>
<tr>
<td>
<span class="label">Leg Shake (0): </span>
</td>
<td>
<input type="checkbox" id="legShake0" class="eventCheckbox" setV="0" idx="0">
</td>
</tr>
<tr>
<td>
<span class="label">Leg Shake (A): </span>
</td>
<td>
<input type="checkbox" id="legShakeA" class="eventCheckbox" setV="A" idx="2">
</td>
</tr>
<tr>
<td>
<span class="label">Rambi Barrel: </span>
</td>
<td>
<input type="checkbox" id="rambiBarrel" class="eventCheckbox" setV="12" idx="4">
</td>
</tr>
</table>
</div>
<div class="flex40">
<table>
<tr>
<td>
<span class="label">Beaver Stack: </span>
</td>
<td>
<input type="checkbox" id="beaverStack" class="eventCheckbox" setV="1A" idx="6">
</td>
</tr>
<tr>
<td>
<span class="label">Mini Beavers: </span>
</td>
<td>
<input type="checkbox" id="miniBeavers" class="eventCheckbox" setV="1F" idx="7">
</td>
</tr>
<tr>
<td>
<span class="label">Night Cycle: </span>
</td>
<td>
<input type="checkbox" id="nightCycle" class="eventCheckbox" setV="2D" idx="9">
</td>
</tr>
</table>
</div>
<div class="flex40">
<table>
<tr>
<td>
<span class="label">Kremling Bullies: </span>
</td>
<td>
<input type="checkbox" id="kremBullies" class="eventCheckbox" setV="3" idx="1">
</td>
</tr>
<tr>
<td>
<span class="label">Kremling Leg Shake: </span>
</td>
<td>
<input type="checkbox" id="legShakeA" class="eventCheckbox" setV="17" idx="5">
</td>
</tr>
<tr>
<td>
<span class="label">Rain Cycle: </span>
</td>
<td>
<input type="checkbox" id="rainCycle" class="eventCheckbox" setV="34" idx="10">
</td>
</tr>
</table>
</div>
<div class="flex40">
<table>
<tr>
<td>
<span class="label">Rambi Beavers: </span>
</td>
<td>
<input type="checkbox" id="rambiBeavers" class="eventCheckbox" setV="D" idx="3">
</td>
</tr>
<tr>
<td>
<span class="label">Butterflies: </span>
</td>
<td>
<input type="checkbox" id="butterflies" class="eventCheckbox" setV="26" idx="8">
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="button_container">
<button class="start_button" onclick="start()">
Start
</button>
</div>
<div class="mj_calc_desc">
<h2>
What is this?
</h2>
<div class="desc">
This tool displays the chance of the various "events" on the main menu. What event you get depends on an algorithm based on the RNG value. The game cannot repeat an event (Note that "Leg Shake" can be repeated once since there are two different "Leg Shake" values) until all 11 events have played. Once all 11 have played, the game resets the watch flags, permitting any event to play again. Exiting the main menu map will cause the watch flags to also reset.
<br><br>
This tool starts from a specified RNG Value and calculates based on the in-game algorithm where the switches would appear. From here, it takes that initial RNG value and goes to the next RNG value in the cycle (based on the in-game cycle RNG algorithm). This does this a specified amount of times and displays the chances of each event based on those outcomes.
</div>
<h2>
How to use
</h2>
<div class="desc">
Enter the RNG value in Hex (Accepts only A-F, a-f and 0-9 as input characters). Enter the amount of cycles you want and then select any events you want to have already watched before this.
<br>
Once done, click start to begin the brute-force process.
</div>
<br><br>
</div>
</div>
</div>
</div>
</body>
<script src="script/nav.js"></script>
<script>
document.getElementById("startingHex").value = "E32B6F7";
document.getElementById("checkCount").value = "10000";
// document.getElementById("startingHex").value = "45085764";
// document.getElementById("checkCount").value = "1";
var devLogBool = false;
function checkForHex() {
var startingHex = document.getElementById("startingHex").value;
var startingHexArray = startingHex.split("");
startingHexArray.forEach((character,index) => {
var focusedUnicode = startingHex.charCodeAt(index)
if (focusedUnicode < 48) {
startingHexArray[index] = "";
} else if (focusedUnicode > 57 && focusedUnicode < 65) {
startingHexArray[index] = "";
} else if (focusedUnicode > 70 && focusedUnicode < 97) {
startingHexArray[index] = "";
} else if (focusedUnicode > 102) {
startingHexArray[index] = "";
}
})
var newHex = startingHexArray.join("");
document.getElementById("startingHex").value = newHex;
}
var RNG = parseInt(document.getElementById("startingHex").value, 16);
function start() {
var checkboxes = document.getElementsByClassName("eventCheckbox");
var searchCount = parseInt(document.getElementById("checkCount").value);
RNG = parseInt(document.getElementById("startingHex").value, 16);
var binString = [];
for (i = 0; i < 16; i++) {
binString.push("0")
}
for (i = 0; i < checkboxes.length; i++) {
var bindex = parseInt(checkboxes[i].getAttribute("idx"));
var set = checkboxes[i].checked;
if (set) {
binString[bindex] = 1;
} else {
binString[bindex] = 0;
}
}
var binary = parseInt(binString.reverse().join(""),2);
eventsWatched = binary
console.log(binary)
var counts = []
for (searchIndex = 0; searchIndex < searchCount; searchIndex++) {
var storedRNG = RNG;
process1();
RNG = storedRNG;
if (counts.find(event => event.value == currentEvent.toString(16))) {
counts.find(event => event.value == currentEvent.toString(16)).count += 1;
} else {
counts.push({
"value": currentEvent.toString(16),
"count": 1
})
}
cycleRNG();
}
var dom_counts = document.getElementsByClassName("eventCount");
var dom_percent = document.getElementsByClassName("eventPercent");
for (c = 0; c < dom_counts.length; c++) {
dom_counts[c].innerText = "0"
}
for (p = 0; p < dom_percent.length; p++) {
dom_percent[p].innerText = "0%"
}
// console.log(counts)
displayResults(counts)
}
function displayResults(counts) {
var legshake0 = 0;
var legshakeA = 0;
if (counts.find(event => event.value == "0")) {
legshake0 = counts.find(event => event.value == "0").count
}
if (counts.find(event => event.value == "a")) {
legshakeA = counts.find(event => event.value == "a").count
}
counts.push({
"value": "legshake",
"count": legshake0 + legshakeA
})
var dom_counts = document.getElementsByClassName("eventCount");
var dom_percent = document.getElementsByClassName("eventPercent");
counts.forEach(event => {
var total_iterations = parseInt(document.getElementById("checkCount").value);
for (c = 0; c < dom_counts.length; c++) {
var selected_indic = dom_counts[c].getAttribute("indic")
if (event.value == selected_indic) {
dom_counts[c].innerText = event.count
}
}
for (p = 0; p < dom_percent.length; p++) {
var selected_indic = dom_percent[p].getAttribute("indic")
if (event.value == selected_indic) {
console.log(Math.floor(event.count / total_iterations))
dom_percent[p].innerText = (Math.floor((event.count / total_iterations) * 10000) / 100) + "%"
}
}
})
console.log(counts)
}
var eventDataTape = [
"FF","F6","00","96",
"FF","FF","00","09",
"00","5A","FF","F9",
"00","AA","FF","FA",
"00","96","FF","FF",
"FF","F6","00","96",
"FF","FF","00","01",
"00","37","FF","F3",
"01","C2","FF","FF",
"00","02","00","19",
"FF","F3","01","86",
"FF","FF","00","03",
"01","2C","FF","FF",
"00","04","01","18",
"FF","F3","01","4A",
"FF","FF","00","05",
"00","D2","FF","F7",
"00","A5","FF","F3",
"01","C2","FF","FF",
"00","06","00","50",
"FF","F3","00","5F",
"FF","F5","01","A4",
"FF","FF","FF","FC",
"00","B4","FF","F4",
"02","5C","FF","FB",
"00","96","FF","FF",
"FF","FE","00","1E",
"FF","F8","01","2C",
"FF","FD","00","96",
"FF","FF","FF","FF",
"FF","FF","FF","FF",
"FF","FF","00","00",
"03","4B","03","4C",
"03","4D","03","4E",
"03","4F","03","50",
"03","51","03","52",
"00","00","00","00",
"15","00","00","00",
"00","00","00","00",
"42","C8","00","00",
"42","7E","19","9C",
"41","20","00","00",
"42","C8","00","00",
"42","AA","00","00",
"41","20","00","00",
"C2","70","00","00",
"42","AA","00","00",
"C2","AA","00","00",
"C2","70","00","00",
"C2","70","00","00",
"C2","AA","00","00",
"C2","C8","00","00",
"C2","70","00","00",
"41","20","00","00",
"C2","C8","00","00",
"00","00","00","00",
"41","20","00","00",
"42","7E","19","9C",
"C2","7E","19","9C",
"C1","20","00","00",
"00","00","00","00",
"42","C8","00","00",
"C1","20","00","00",
"42","70","00","00",
"42","C8","00","00"
];
var detailsData = [
"00","00","00","2F",
"00","00","00","00",
"00","00","00","30",
"00","00","00","31",
"00","00","00","29",
"00","00","00","2A",
"00","00","00","2B",
"00","00","00","2C",
"00","00","00","2D",
"00","00","00","00",
"00","00","00","00",
"00","00","00","33",
"00","00","00","00",
"00","00","00","34",
"FF","FF","FF","FF",
"FF","FF","FF","FF",
"00","00","00","00",
"00","00","00","00",
"00","00","00","00",
"00","00","00","00",
"03","E8","00","00",
"00","00","00","00",
"BC","A3","D7","0A",
"3D","23","D7","0A",
"BD","23","D7","0A",
"3D","75","C2","8F",
"3D","75","C2","8F",
"BD","75","C2","8F",
"BD","75","C2","8F",
"00","00","00","00",
"00","00","00","00",
"02","00","00","00",
"FF","F6","00","96",
"FF","FF","00","09",
"00","5A","FF","F9",
"00","AA","FF","FA",
"00","96","FF","FF",
"FF","F6","00","96",
"FF","FF","00","01",
"00","37","FF","F3",
"01","C2","FF","FF",
"00","02","00","19",
"FF","F3","01","86",
"FF","FF","00","03",
"01","2C","FF","FF",
"00","04","01","18",
"FF","F3","01","4A",
"FF","FF","00","05",
"00","D2","FF","F7",
"00","A5","FF","F3",
"01","C2","FF","FF",
"00","06","00","50",
"FF","F3","00","5F",
"FF","F5","01","A4",
"FF","FF","FF","FC",
"00","B4","FF","F4",
"02","5C","FF","FB",
"00","96","FF","FF",
"FF","FE","00","1E",
"FF","F8","01","2C",
"FF","FD","00","96",
"FF","FF","FF","FF",
"FF","FF","FF","FF",
"FF","FF","00","00",
// Addr is next readout, offset 256
"03","4B","03","4C",
"03","4D","03","4E",
"03","4F","03","50",
"03","51","03","52",
"00","00","00","00",
"15","00","00","00",
"00","00","00","00",
"42","C8","00","00",
"42","7E","19","9C",
"41","20","00","00",
"42","C8","00","00",
"42","AA","00","00",
"41","20","00","00",
"C2","70","00","00",
"42","AA","00","00",
"C2","AA","00","00",
"C2","70","00","00",
"C2","70","00","00",
"C2","AA","00","00",
"C2","C8","00","00",
"C2","70","00","00",
"41","20","00","00",
"C2","C8","00","00",
"00","00","00","00",
"41","20","00","00",
"42","7E","19","9C",
"C2","7E","19","9C",
"C1","20","00","00",
"00","00","00","00",
"42","C8","00","00",
"C1","20","00","00",
"42","70","00","00",
"42","C8","00","00",
"42","AA","00","00",
"42","70","00","00",
"42","70","00","00",
"42","AA","00","00",
"C2","AA","00","00",
"42","70","00","00",
"C1","20","00","00",
"C2","AA","00","00",
"C2","C8","00","00",
"C1","20","00","00",
"C2","7E","19","9C",
"C2","C8","00","00",
"00","00","00","00",
"FF","00","00","FF",
"FF","00","00","FF",
"16","99","FF","FF",
"B0","45","FF","FF",
"41","FF","25","FF",
"01","00","00","00",
"00","00","00","00",
"00","00","00","00",
"00","03","FF","FF",
"00","C8","00","00",
"01","00","00","00",
"00","00","00","00",
"00","00","00","00",
"00","00","00","00",
"00","00","00","00",
"00","00","00","00",
"08","00","02","00",
"08","00","04","00",
];
function selectAll() {
var checkboxes = document.getElementsByClassName("eventCheckbox");
for (i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = true;
}
}
function deselectAll() {
var checkboxes = document.getElementsByClassName("eventCheckbox");
for (i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = false;
}
}
function readMemoryTape(tapeArray,offset,byteSize) {
var hex = "";
for (i = 0; i < byteSize; i++) {
hex = hex + tapeArray[offset + i]
}
return hex
}
function intToHexFloat(int) {
const getHex = i => ('00' + i.toString(16)).slice(-2);
var view = new DataView(new ArrayBuffer(4)),
result;
view.setFloat32(0, int);
result = Array
.apply(null, { length: 4 })
.map((_, i) => getHex(view.getUint8(i)))
.join('');
return parseInt(result,16)
}
function intToFloat(int) {
var binary = "00000000000000000000000000000000" + int.toString(2);
var binaryArray = binary.split("").filter((bit, index) => index >= binary.length - 32)
var sign = parseInt(binaryArray[0],2)
var exponent = parseInt(binaryArray.filter((bit, index) => {
if (index > 0) {
if (index < 9) {
return true
}
}
return false
}).join(""),2);
var mantissaBinArr = binaryArray.filter((bit, index) => index > 8);
var mantissa = parseInt(mantissaBinArr.join(""),2)
var mantissaSum = 1;
for (i = 0; i < mantissaBinArr.length; i++) {
var bit = mantissaBinArr[i];
var exp = Math.pow(2,(0 - (i + 1)));
mantissaSum = mantissaSum + (bit * exp)
}
var float = Math.pow(-1,sign) * Math.pow(2,exponent - 127) * mantissaSum
return float
}
function hexToSigned(hex,forcedBytes) {
var bytes = Math.round(hex.length / 2);
if (bytes == 3) {
bytes = 4;
}
if (forcedBytes != undefined) {
bytes = forcedBytes
}
var textLength = bytes * 2;
var interprettedHex = hex.split("").filter((digit, index) => index >= hex.length - textLength).join("");
var unsigned = parseInt(interprettedHex, 16);
var signed = unsigned;
if (unsigned >= Math.pow(2,(bytes * 8) - 1)) {
signed = unsigned - Math.pow(2,bytes * 8);
}
return signed
}
function devLog(str) {
if (devLogBool) {
console.log(str)
}
}
var timer = 1;
var currentEvent = 2;
var focusedArraySlot, slotValue, newEvent, prop033F56;
var eventDataArray = 0; // 0x800336A4 in normal code
var throwingAnimTimer = 0;
var eventsWatched = 0;
function process1() {
currentEvent = 2;
timer = 1;
devLog("Process Part 1")
timer = timer - 1;
// T6 = mem8[stack + 0x4F]
if (timer <= 0) {
focusedArraySlot = eventDataArray + (currentEvent * 2);
slotValue = hexToSigned(readMemoryTape(eventDataTape, focusedArraySlot, 2));
devLog(slotValue)
newEvent = currentEvent + 2;
if (slotValue == -5) {
process2()
return null;
}
if (slotValue != -4) {
// newEvent = currentEvent + 2;
if (slotValue != 3) {
if (slotValue != 2) {
process3()
return null
}
currentEvent = newEvent;
// mem8[stack + 0x4F = 1]
timer = parseInt(readMemoryTape(eventDataTape, focusedArraySlot + 2, 2),16);
return null
}
currentEvent = newEvent;
// mem8[stack + 0x4F] = -1
timer = parseInt(readMemoryTape(eventDataTape, focusedArraySlot + 2, 2),16);
return null;
}
currentEvent = newEvent;
timer = parseInt(readMemoryTape(eventDataTape, focusedArraySlot + 2, 2),16);
return null;
}
prop033F56 = 1;
process2()
}
function process2() {
devLog("Process Part 2")
currentEvent = newEvent;
timer = parseInt(readMemoryTape(eventDataTape, focusedArraySlot + 2, 2),16);
prop033F56 = 0;
process3();
return null;
}
function process3() {
devLog("Process Part 3")
// T6 = -6
var focusedSlotDetails = slotValue;
if (slotValue < -5) {
throwingAnimTimer = 0; // Can be more than 0 if you start throwing
var loweredSlotValue = -6 - slotValue;
var loweredSlotValueAsS16 = hexToSigned(convertMultToHex(loweredSlotValue),2); // I don't think this can exceed the S16 Bounds normally
if (throwingAnimTimer == 0) {
// PlayerPointer = mem32[0x807FBB4C]
// renderingSomething()
detailsDataHeader = 0; // 0x80033724 normally
focusedSlotDetails = hexToSigned(readMemoryTape(detailsData,detailsDataHeader + 256 + (loweredSlotValueAsS16 * 2), 2));
console.log(focusedSlotDetails)
}
currentEvent = currentEvent + 2;
timer = parseInt(readMemoryTape(eventDataTape, focusedArraySlot + 2, 2),16);
}
// A0 = 0
if (focusedSlotDetails >= 0) {
// Intro Story Something()
//A2 = 1
devLog("trap")
focusedArraySlot = eventDataArray + (currentEvent * 2);
currentEvent = currentEvent + 2;
timer = parseInt(readMemoryTape(eventDataTape, focusedArraySlot + 2, 2),16);
return null
}
RNG = cycleRNG();
var interprettedRNG = RNG;
if (RNG < 0) {
interprettedRNG = RNG + 0xFFFFFFFF
}
var RNGAsFloat = intToHexFloat(interprettedRNG) - 0x10000000
var F10 = intToFloat(RNGAsFloat)
var F6 = F10 * 10;
var F8 = Math.floor(F6)
devLog(RNG.toString(16))
devLog(F10)
devLog(F8)
RNG = cycleRNG();
// mem16[stack + 0x3C] = F8
var randomIndex = F8;
var eventIndex = randomIndex;
var delayOffset = RNG & 0x7F;
var delay = 300 + delayOffset;
var bool_indicator = false;
if (randomIndex < 0xB) {
var bool_indicator = true;
};
timer = delay;
var stack40 = 0; // A0 = mem16[SP + 40]