-
Notifications
You must be signed in to change notification settings - Fork 0
/
MetalGearSolid2Substance.asl
executable file
·2134 lines (1913 loc) · 93.3 KB
/
MetalGearSolid2Substance.asl
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
/*
Autosplitter for Metal Gear Solid 2: Substance (PC)
*/
state("mgs2_sse") {
uint GameTime: 0xD8AEF8;
int RoomTimer: 0x3E315E, 0x17;
string10 GameSection: 0xD8C374;
string10 RoomCode: 0x601F34, 0x2C;
ushort ProgressTanker: 0xD8D93C;
ushort ProgressPlant: 0xD8D912;
short Shots: 0x3E315E, 0x73;
short Alerts: 0x3E315E, 0x75;
short Continues: 0x3E315E, 0x65;
short Rations: 0xF80DB, 0x4C3;
short Kills: 0x3E315E, 0x77;
short Damage: 0x3E315E, 0x79;
short Saves: 0x3E315E, 0x69;
short Mechs: 0x3E315E, 0x8B;
short Clearings: 0xD8C352;
byte SeaLouce: 0x615B1C;
ushort Extra: 0x601F34, 0x1596; // & 0x2000 = radar, & 0x20 = sp item
short DogTagsSnake: 0xD8AFEE;
short DogTagsRaiden: 0xD8B13E;
short StrengthRaiden: 0x3E315E, 0x63;
short StrengthSnake: 0xD8AEEE;
byte CurrentHealth: 0x3E315E, 0x2D;
byte MaxHealth: 0x3E315E, 0x2F;
short CurrentChaff: 0xB6DE4C;
short CurrentO2: 0x3E315E, 0x31;
short CurrentGrip: 0x618BAC, 0x80;
short MaxGrip: 0x618BAC, 0x82;
short CurrentCaution: 0x6160C8;
short MaxCaution: 0xD8F508; // D8D908 B60000
int CurrentPentazemin: 0x618B40;
short GripMultiplier: 0xD8F500; // This is meant to be 1800 for Snake, 3600 for Raiden, but isn't?
byte Difficulty: 0x601F34, 0x10; // 10 = VE, 60 = EEx, increments in 10s
ushort Level: 0x601F34, 0x158A; // 0x1800 + 0xD (Tanker), 0xE (Plant), 0xF (T-P)
short Options: 0x601F34, 0x6; // 1 = Vibration OFF, 4 = No Radar or Radar 2, 8 = Blood OFF, 0x20 = Radar 2, 0x40 = Reverse view, 0x80 = Linear menu, 0x200 = Previous equip
int ResultsComplete: 0x65397C; // & 0x200 == 0x200 when ready to split on results
int PadInput: 0xADAD3C;
byte OlgaStamina: 0xAD4F6C, 0x0, 0x1E0, 0x44, 0x1F8, 0x13C;
byte OlgaRushStamina: 0xAD4F6C, 0x2C4;
byte MerylHealth: 0xB6DEC4, 0x284;
short FatmanHealth: 0xB6DEC4, 0x24E;
int FatmanStamina: 0x664E78, 0x88;
byte FatmanBombsActive: 0x664E7C, 0x280;
short HarrierHealth: 0x619BB0, 0x5C;
short VampStamina: 0x664EA0, 0x15A;
short VampHealth: 0x664EA0, 0x158;
byte SolidusHealth: 0x664E7C, 0xB8;
byte SolidusStamina: 0x664E78, 0xC8;
short Vamp2Health: 0x61FBB8, 0x2AE;
short Vamp2Stamina: 0x664E7C, 0x48;
short Tengus2Defeated: 0x618E0C;
short RaysHealth: 0xAD4EA4, 0x54, 0x10, 0x10, 0x170, 0x7E0;
short RaysTalesHealth: 0x652F30, 0x490;
short ChokeTimer: 0xAD4F6C, 0x40;
byte AscendingColonActive: 0xD8E105;
short AscendingColonTimer: 0xAD4F08, 0x40;
byte CartwheelCode: 0xB6095E;
short EmmaO2: 0x618300, 0x930;
short EmmaMaxO2: 0x618300, 0x932;
byte EmmaHealth: 0x61FDA8, 0x2CE;
short VRMissionID: 0xB60C1C;
int VRCurrentScore: 0x5ADC48;
}
isLoading {
return true;
}
gameTime {
if (settings["aslvv"]) vars.UpdateASLVars();
return TimeSpan.FromMilliseconds((current.GameTime) * 1000 / 60);
}
reset {
try {
string CurrentRoomName, OldRoomName;
if (!settings["resets"]) return false; // resets not enabled anyway!
if (vars.ResetNextFrame) return true;
if (current.RoomCode == old.RoomCode) return false; // room is unchanged
// reset right away if we're going to main menu from missions
if ( (current.RoomCode == "n_title") && (old.RoomCode == "mselect") ) return true;
// otherwise... was the old room NOT a menu?
if (vars.Menus.TryGetValue(old.RoomCode, out OldRoomName)) return false;
// is the new room a menu?
if (!vars.Menus.TryGetValue(current.RoomCode, out CurrentRoomName)) return false;
// just to be sure, we didn't just complete a Snake Tales mission, did we?
if (old.RoomCode == "tales") return false;
// and we're not currently on the missions menu?
if (current.RoomCode == "mselect") return false;
OldRoomName = vars.GetRoomName(old.RoomCode);
if (CurrentRoomName == "") CurrentRoomName = vars.GetRoomName(current.RoomCode);
vars.Debug("In-game [" + old.RoomCode + "] " + OldRoomName + " > Menu [" + current.RoomCode + "] " + CurrentRoomName);
vars.ClearASLVariables();
vars.ResetNextFrame = true;
return false;
}
catch (Exception e) {
vars.LogException(e, "reset");
return false;
}
}
start {
try {
int i;
string CurrentRoomName, OldRoomName;
// split if going into a VR mission
//if ( (current.RoomCode == "mselect") && (current.VRMenuState == 26) ) return true;
if ( (old.RoomCode == null) || (old.RoomCode == "") ) return false;
if (current.RoomCode == old.RoomCode) return false; // room is unchanged
// was the old room a menu (or the "this is a fictional story" screen)?
if ( (!vars.Menus.TryGetValue(old.RoomCode, out OldRoomName)) && (old.RoomCode != "ending") ) return false;
// is the new room NOT a menu (and not that screen)?
if ( (vars.Menus.TryGetValue(current.RoomCode, out CurrentRoomName)) || (current.RoomCode == "ending") ) return false;
// starting a VR mission
if (old.RoomCode == "mselect") return true;
CurrentRoomName = vars.GetRoomName(current.RoomCode);
if (OldRoomName == "") OldRoomName = vars.GetRoomName(old.RoomCode);
vars.Debug("Menu [" + old.RoomCode + "] " + OldRoomName + " > In-game [" + current.RoomCode + "] " + CurrentRoomName);
// Enable Boss Rush mode if going into the boss screen (necessary for Olga's different memaddress)
if (current.RoomCode == "boss") {
vars.Debug("Starting Boss Rush");
vars.BossRush = true;
}
else if (vars.BossRush) vars.BossRush = false;
// Might as well!
vars.ResetData(); // resetting on an unbeaten boss can cause some really bad things to happen in insta
vars.ClearASLVariables();
return true;
}
catch (Exception e) {
vars.LogException(e, "start");
return false;
}
}
startup {
// Init ASL variables
Action ClearASLVariables = delegate() {
vars.ASL_VAR_VIEWER_VARIABLES = "";
vars.ASL_Alerts = 0;
vars.ASL_AlertAllowance = 0;
vars.ASL_AmesLocation = "";
vars.ASL_Cartwheels = 0;
vars.ASL_Character = "";
vars.ASL_ClearingEscapes = 0;
vars.ASL_CodeName = "";
vars.ASL_CodeNameStatus = "";
vars.ASL_Continues = 0;
vars.ASL_CurrentRoom = "";
vars.ASL_CurrentRoomCode = "";
vars.ASL_DamageTaken = 0;
vars.ASL_Debug = "";
vars.ASL_Difficulty = "";
vars.ASL_DogTags = "";
vars.ASL_DogTags_Snake = "";
vars.ASL_DogTags_Raiden = "";
vars.ASL_Info = "";
vars.ASL_Kills = 0;
vars.ASL_LastDamage = 0;
vars.ASL_Level = "";
vars.ASL_MechsDestroyed = 0;
vars.ASL_Minutes = 0;
vars.ASL_QuickEquipMode = "";
vars.ASL_Rations = 0;
vars.ASL_RoomTimer = 0;
vars.ASL_Saves = 0;
vars.ASL_SeaLouce = 0;
vars.ASL_Shots = 0;
vars.ASL_SpecialItems = false;
vars.ASL_Strength = 0;
vars.ASL_VRMission = "";
vars.INTERNAL_VARIABLES = "";
};
ClearASLVariables();
vars.ClearASLVariables = ClearASLVariables;
vars.Initialised = false;
print("Beginning startup initialisation...");
/* MAIN CONFIGURATION STARTS */
vars.Menus = new Dictionary<string, string> {
{ "init", "init" }, // TODO define
{ "select", "select" },
{ "n_title", "Main Menu" },
{ "mselect", "VR Mission select" },
{ "sselect", "Snake Tales episode select" }
};
// Note to self: T[] is preferable over List<T> when not modifying afterwards or doing random access
var Areas = new string[] {
"tanker", "Tanker",
"plant", "Plant",
"snaketales", "Snake Tales"
};
// The room codes and names are done in this weird way for a mix of performance
// (after the slower initial load) and ease of editing.
// The dictionary vars.Rooms will be auto-populated from this
// and should be used by other parts of the script
var Rooms = new Dictionary<string, string[]> {
{ "tanker", new[] {
"w00a", "Aft Deck",
"w00b", "Navigational Deck, port wing (vs Olga)",
"d05t", "Navigational Deck, port wing cutscenes",
"w00c", "Navigational Deck, wing",
"w01a", "Deck-A, crew's quarters",
"w01b", "Deck-B, crew's quarters",
"w01c", "Deck-C, crew's quarters, port",
"w01d", "Deck-D, crew's quarters",
"d04t", "Deck-E cutscene",
"w01e", "Deck-E, the bridge",
"w01f", "Deck-A, crew's lounge",
"w02a", "Engine Room",
"w03a", "Deck-2, port",
"w03b", "Deck-2, starboard",
"d10t", "Hold No.1 cutscene", // this isn't a great guard rush split as the 1st cutscene isn't splittable
"w04a", "Hold No.1",
"w04b", "Hold No.2",
"d11t", "Hold No.3 cutscene",
"w04c", "Hold No.3",
"d12t", "Tanker ending: confrontation" // ending 1
} },
{ "plant", new[] {
"w11a", "Strut A Deep Sea Dock",
"d005p01", "Strut A elevator cutscene",
"w11b", "Strut A Deep Sea Dock (with bomb)",
"w11c", "Strut A Deep Sea Dock (vs Fortune)",
"w12a", "Strut A roof (before Stillman)",
"w12c", "Strut A roof",
"w12b", "Strut A Pump Room",
"w13a", "AB connecting bridge (before Stillman)",
"w13b", "AB connecting bridge",
"w14a", "Strut B Transformer Room",
"d012p01", "BC connecting bridge cutscene",
"w15a", "BC connecting bridge (before Stillman)",
"w15b", "BC connecting bridge",
"w16a", "Strut C Dining Hall (before Stillman)",
"w16b", "Strut C Dining Hall",
"w17a", "CD connecting bridge",
"w18a", "Strut D Sediment Pool",
"w19a", "DE connecting bridge",
"w20a", "Strut E Parcel Room",
"w20b", "Strut E heliport",
"w20c", "Strut E heliport (vs Fatman)",
"d021p01", "Strut E heliport cutscenes",
"w20d", "Strut E heliport (after Ninja)",
"w21a", "EF connecting bridge",
"w21b", "EF connecting bridge (finale)",
"w22a", "Strut F warehouse",
"w23a", "FA connecting bridge",
"w23b", "FA connecting bridge",
"w24a", "Shell 1 Core, 1F",
"d070p01", "Shell 1 Core B2 cutscenes",
"w24b", "Shell 1 Core, B1",
"d036p03", "Shell 1 Core, B1 Hall cutscenes",
"w24d", "Shell 1 Core, B2 Computer Room",
"w24c", "Shell 1 Core, B1 Hall",
"w25a", "Shell 1-2 connecting bridge",
"d045p01", "Shell 1-2 connecting bridge Harrier intro",
"d046p01", "Shell 1-2 connecting bridge Harrier outro",
"w25b", "Shell 1-2 connecting bridge (after Harrier)",
"w25c", "KL connecting bridge", // "Strut L perimeter" in-game
"w25d", "KL connecting bridge",
"d063p01", "KL connecting bridge cutscene",
"w28a", "Strut L Sewage Treatment Facility",
"d065p02", "Strut L Oil Fence cutscene",
"w31a", "Shell 2 Core, 1F Air Purification Room",
"w31b", "Shell 2 Core, B1 Filtration Chamber No.1",
"d055p01", "Shell 2 Core, B1 Filtration Chamber No.2 cutscenes",
"w31c", "Shell 2 Core, B1 Filtration Chamber No.2 (vs Vamp)",
"w31d", "Shell 2 Core, 1F Air Purification Room (with Emma)",
"w31f", "Shell 2 Core, B1 Filtration Chamber No.2",
"d053p01", "Strut 2 Core, B1 Filtration Chamber No.1 cutscenes",
"w32a", "Strut L Oil Fence",
"w32b", "Strut L Oil Fence (vs Vamp 2)",
"w41a", "Arsenal Gear - Stomach",
"w42a", "Arsenal Gear - Jejunum",
"w43a", "Arsenal Gear - Ascending Colon",
"w44a", "Arsenal Gear - Ileum (vs Tengus 1)",
"w45a", "Arsenal Gear - Sigmoid Colon (vs Tengus 2)",
"d078p01", "Arsenal Gear - Sigmoid Colon cutscene",
"w46a", "Arsenal Gear - Rectum (vs Rays)",
"d080p01", "Arsenal Gear - Rectum cutscene",
"w51a", "Arsenal Gear (after Rays)",
"w61a", "Federal Hall (vs Solidus)",
"d082p01", "Plant ending"
} },
{ "snaketales", new[] {
// Tanker
"a00a", "Aft Deck",
"a01f", "Deck-A, crew's quarters",
"a01a", "Deck-A, crew's lounge",
"a01b", "Deck-B, crew's quarters, starboard",
"a01c", "Deck-C, crew's quarters",
"a01d", "Deck-D, crew's quarters",
"a01e", "Deck-E, the bridge",
"a02a", "Engine Room",
"a03a", "Deck-2, port",
"a03b", "Deck-2, starboard",
"a00b", "Navigational Deck, port wing (vs Meryl)",
// Plant
"a12a", "Strut A roof",
"a12b", "Strut A Pump Room",
"a13b", "AB connecting bridge",
"a13c", "AB connecting bridge", // EG
"a14a", "Strut B Transformer Room", // BSE & EG
"a14b", "Strut B Transformer Room", // AW & DMW
"a15b", "BC connecting bridge",
"a16a", "Strut C Dining Hall",
"a17a", "CD connecting bridge",
"a18a", "Strut D Sediment Pool",
"a19a", "DE connecting bridge",
"a20a", "Strut E Parcel Room, 1F", // AW
"a20b", "Strut E heliport (BSE)",
"a20c", "Strut E heliport",
"a20e", "Strut E Parcel Room, 1F", // BSE
"a21a", "EF connecting bridge",
"a22a", "Strut F warehouse", // AM & DMW
"a22b", "Strut F warehouse", // BSE
"a23b", "FA connecting bridge",
"a24a", "Shell 1 Core, 1F",
"a24b", "Shell 1 Core, B1",
"a24c", "Shell 1 Core, B1 Hall",
"a24d", "Shell 1 Core, B2 Computer Room",
"a25a", "Shell 1-2 connecting bridge (vs Harrier)",
"a25d", "Strut L Sewage Treatment Facility",
"a28a", "KL connecting bridge",
"a31a", "Shell 2 Core, 1F Air Purification Room",
"a31c", "Shell 2 Core, B1 Filtration Chamber No.2 (vs Vamp)",
"a46a", "Arsenal Gear - Rectum (vs Rays)",
"a61a", "Federal Hall (vs Solidus)",
// External Gazer VR missions
"tsp03a", "Gurlugon",
"tvs03a", "Snake Sneaking Level 3",
"twp03a", "Snake Handgun Level 3",
"tvs05a", "Snake Sneaking Level 5",
"tvs08a", "Snake Sneaking Level 8"
} }
};
// Old rooms to exclude splitting (typically cutscenes)
// Even if not necessary (more cutscenes immediately after, for example) this also keeps them out of the settings
var ExcludeOldRoom = new string[] {
"d04t", // Deck E
"d05t", // Post-Olga
"d10t", // Post-Guard Rush
"d11t", // Hold 3
"d12t", // Tanker ending
"d005p01", // Strut A elevator
"d012p01", // fortune bridge cutscene
"d021p01", // fatman cutscenes
"d036p03", // hostage room
"d045p01", // harrier intro
"d046p01", // harrier outro
"d055p01", // vamp intro
"d053p01", // before emma swim 2
"d063p01", // emma with card
"d065p02", // emma climbing
"d070p01", // emma ded
"d078p01", // after tengus 2
"d080p01", // after rays
"d082p01" // after solidus
};
// and new
var ExcludeCurrentRoom = new string[] {
};
// Old rooms to explicitly include a split at, even when the next room is unknown
var IncludeOldRoom = new string[] {
};
// and new
var IncludeCurrentRoom = new string[] {
"museum", // end of tanker in tanker-plant
};
// Rooms not considered for immediate splits (mostly cutscenes)
var OtherRooms = new Dictionary<string, string> {
// Menus
{ "init", "init" },
{ "select", "select" },
{ "n_title", "Main Menu" },
{ "mselect", "VR Mission select" },
{ "sselect", "Snake Tales episode select" },
{ "ending", "Results" }, // also for the "not real people honest" message, but eh
// Tanker
{ "d00t", "George Washington Bridge" }, // intro 1
{ "d01t", "Aft Deck cutscenes" }, // intro 2
{ "d14t", "Marine capture cutscene" },
{ "d12t3", "Tanker ending: explosion" }, // ending 2
{ "d12t4", "Tanker ending: combat" }, // ending 3
{ "d13t", "Tanker ending: outside" }, // ending 4
// Plant
{ "wmovie", "FMV cutscenes" },
{ "museum", "Plant intro vignette" },
{ "d001p01", "Plant intro" },
{ "d001p02", "Strut A Deep Sea Dock cutscenes" },
{ "d005p01", "Plant overview 1" },
{ "d010p01", "Strut B Transformer Room cutscenes" },
{ "d014p01", "Strut C Dining Hall cutscenes" },
{ "d005p03", "Plant overview 2" },
{ "d036p05", "Shell 1 Core, 1F cutscenes" },
{ "w24c", "Shell 1 Core, B1 Hall (after Ames)" },
{ "w24e", "Shell 1 Core, B1 Hall (with Ames)" },
{ "d070p09", "Arsenal Gear launch cutscene" },
{ "d070px9", "Arsenal Gear - Stomach cutscenes" },
{ "d080p06", "Arsenal Gear cutscenes" },
{ "d080p07", "Arsenal Gear entering Manhattan cutscene" },
{ "d080p08", "Federal Hall cutscenes" },
// External Gazer
{ "ta02a", "Snake Bomb Disposal 2" },
{ "ta24a", "Snake Elimination Level 6" },
{ "ta31a", "Raiden Bomb Disposal Level 1" },
// VR Missions
{ "vs01a", "Sneaking Mode 1" },
{ "vs02a", "Sneaking Mode 2" },
{ "vs03a", "Sneaking Mode 3" },
{ "vs04a", "Sneaking Mode 4" },
{ "vs05a", "Sneaking Mode 5" },
{ "vs06a", "Sneaking Mode 6" },
{ "vs07a", "Sneaking Mode 7" },
{ "vs08a", "Sneaking Mode 8" },
{ "vs09a", "Sneaking Mode 9" },
{ "vs10a", "Sneaking Mode 10" },
{ "wp01a", "Handgun 1"},
{ "wp02a", "Handgun 2"},
{ "wp03a", "Handgun 3"},
{ "wp04a", "Handgun 4"},
{ "wp05a", "Handgun 5"},
{ "wp11a", "Assault Rifle 1"},
{ "wp12a", "Assault Rifle 2"},
{ "wp13a", "Assault Rifle 3"},
{ "wp14a", "Assault Rifle 4"},
{ "wp15a", "Assault Rifle 5"},
{ "wp21a", "C4/Claymore 1"},
{ "wp22a", "C4/Claymore 2"},
{ "wp23a", "C4/Claymore 3"},
{ "wp24a", "C4/Claymore 4"},
{ "wp25a", "C4/Claymore 5"},
{ "wp31a", "Grenade 1"},
{ "wp32a", "Grenade 2"},
{ "wp33a", "Grenade 3"},
{ "wp34a", "Grenade 4"},
{ "wp35a", "Grenade 5"},
{ "wp41a", "PSG-1 1"},
{ "wp42a", "PSG-1 2"},
{ "wp43a", "PSG-1 3"},
{ "wp44a", "PSG-1 4"},
{ "wp45a", "PSG-1 5"},
{ "wp51a", "Stinger 1"},
{ "wp52a", "Stinger 2"},
{ "wp53a", "Stinger 3"},
{ "wp54a", "Stinger 4"},
{ "wp55a", "Stinger 5"},
{ "wp61a", "Nikita 1"},
{ "wp62a", "Nikita 2"},
{ "wp63a", "Nikita 3"},
{ "wp64a", "Nikita 4"},
{ "wp65a", "Nikita 5"},
{ "wp71a", "HF Blade/No Weapon 1"},
{ "wp72a", "HF Blade/No Weapon 2"},
{ "wp73a", "HF Blade/No Weapon 3"},
{ "wp74a", "HF Blade/No Weapon 4"},
{ "wp75a", "HF Blade/No Weapon 5"},
{ "sp21a", "First Person View 1"},
{ "sp22a", "First Person View 2"},
{ "sp23a", "First Person View 3"},
{ "sp24a", "First Person View 4"},
{ "sp25a", "First Person View 5"},
{ "sp01a", "Variety Mode room 1"},
{ "sp02a", "Variety Mode room 2"},
{ "sp03a", "Variety Mode room 3"},
{ "sp06a", "Variety Mode room 6"},
{ "sp07a", "Variety Mode room 7"},
{ "sp08a", "Variety Mode room 8"},
{ "st01a", "Streaking Mode 1" },
{ "st02a", "Streaking Mode 2" },
{ "st03a", "Streaking Mode 3" },
{ "st04a", "Streaking Mode 4" },
{ "st05a", "Streaking Mode 5" }
};
// Big Boss values
vars.DifficultyHealth = new Dictionary<int, string> {
{ 200, "Very Easy" },
{ 120, "Easy" },
{ 100, "Normal" },
{ 75, "Hard" },
{ 50, "Extreme" },
{ 30, "European Extreme" }
};
// Dog tag counts
vars.MaxDogTags = new Dictionary<int, int[]> {
{ 200, new[] { 24, 43, 67 } },
{ 120, new[] { 25, 44, 69 } }, // Nice
{ 100, new[] { 33, 49, 82 } },
{ 75, new[] { 35, 52, 87 } },
{ 50, new[] { 34, 54, 88 } }
};
// Tengus 2 counts
vars.Tengus2Total = new Dictionary<int, int> {
{ 200, 48 },
{ 120, 48 },
{ 100, 64 },
{ 75, 96 },
{ 50, 128 },
{ 30, 128 }
};
/* MAIN CONFIGURATION ENDS */
// Special case dictionaries:
vars.SpecialRoomChange = new Dictionary< string, Dictionary<string, string> >();
vars.SpecialNewRoom = new Dictionary< string, Dictionary<string, string> >();
vars.SpecialWatchCallback = new Dictionary<string, Delegate>();
vars.SpecialRoomChangeCallback = new Dictionary<string, Delegate>();
vars.SpecialNewRoomCallback = new Dictionary<string, Delegate>();
vars.DontWatch = false;
vars.BlockNextRoom = false;
vars.SplitNextRoom = false;
vars.SplitRightNow = false;
vars.VRSplitOnExit = false;
// Add main settings
settings.Add("options", true, "Advanced Options");
settings.Add("debug_file", true, "Save debug information to LiveSplit program directory", "options");
settings.Add("resets", true, "Reset the timer when returning to menu", "options");
settings.Add("vr_split_level_insta", false, "Split in VR instantly upon hitting the goal", "options");
settings.SetToolTip("vr_split_level_insta", "If disabled, this will split when leaving the level instead");
settings.Add("dogtag_insta", false, "Split when a dog tag is collected", "options");
settings.SetToolTip("dogtag_insta", "The setting \"Enable ASL Var Viewer Integration\" below must also be enabled");
settings.Add("boss_insta", true, "Split instantly when a boss is defeated", "options");
settings.Add("emma_singlesplit", true, "Split only once in areas where Emma can fall out of bounds", "options");
settings.SetToolTip("emma_singlesplit", "This avoids repeat splits when Chelsporting Emma");
settings.Add("aslvv", true, "Enable ASL Var Viewer integration", "options");
settings.SetToolTip("aslvv", "Disabling this may slightly improve performance");
settings.Add("aslvv_info", true, "ASL_Info (contextual information)", "aslvv");
settings.Add("aslvv_info_vars", true, "Display these values:", "aslvv_info");
settings.Add("aslvv_info_codename", true, "Codename changes", "aslvv_info_vars");
settings.Add("aslvv_info_room", false, "Current location", "aslvv_info_vars");
settings.SetToolTip("aslvv_info_room", "Use ASL_CurrentRoom if you only want the location");
settings.Add("aslvv_info_tags", true, "Dog tag progress", "aslvv_info_vars");
settings.SetToolTip("aslvv_info_tags", "Also see the options for ASL_DogTags");
settings.Add("aslvv_info_tags_onlycurrent", false, "Show total only for the current character", "aslvv_info_tags");
settings.Add("aslvv_info_o2", true, "O2", "aslvv_info_vars");
settings.Add("aslvv_info_o2_emma", true, "Show Emma's O2 instead when relevant", "aslvv_info_o2");
settings.Add("aslvv_info_grip", true, "Grip", "aslvv_info_vars");
settings.Add("aslvv_info_chaff", true, "Chaff", "aslvv_info_vars");
settings.Add("aslvv_info_caution", true, "Caution", "aslvv_info_vars");
settings.Add("aslvv_info_pentaz", true, "Pentazemin", "aslvv_info_vars");
settings.Add("aslvv_info_boss", true, "Boss health", "aslvv_info_vars");
settings.SetToolTip("aslvv_info_boss", "The setting \"Split instantly when a boss is defeated\" above must also be enabled");
settings.Add("aslvv_info_boss_dmg_together", false, "Group hits done within a few frames", "aslvv_info_boss");
settings.SetToolTip("aslvv_info_boss_dmg_together", "This will accurately show double-damage hits vs Harrier");
settings.Add("aslvv_info_boss_dmg_flurry", true, "Group hits done within a short time", "aslvv_info_boss");
settings.SetToolTip("aslvv_info_boss_dmg_flurry", "Shows the sum damage for flurries of attacks (Fatman, Vamp, Vamp 2)");
settings.Add("aslvv_info_boss_dmg_full", false, "Group all hits done during the battle", "aslvv_info_boss");
settings.SetToolTip("aslvv_info_boss_dmg_full", "A simple damage increment that never resets");
settings.Add("aslvv_info_boss_combo", true, "Add a combo counter", "aslvv_info_boss");
settings.SetToolTip("aslvv_info_boss_combo", "This uses the same timing as grouped attacks above");
settings.Add("aslvv_info_choke", true, "Choke torture progress", "aslvv_info_vars");
settings.Add("aslvv_info_colon", true, "Ascending Colon tutorial progress", "aslvv_info_vars");
settings.Add("aslvv_info_max", true, "Also show the maximum value for raw values", "aslvv_info");
settings.Add("aslvv_info_percent", true, "Show percentages instead of raw values", "aslvv_info");
settings.Add("aslvv_boss", true, "ASL_CodeNameStatus (Perfect Stats attempt tracking)", "aslvv");
settings.Add("aslvv_boss_specific", true, "Also show the top-rank-specific stats if they are broken", "aslvv_boss");
settings.SetToolTip("aslvv_boss_specific", "Disable this if you're going for Perfect Stats rather than a top rank such as Big Boss");
settings.Add("aslvv_boss_short", false, "Show single letters for stats instead of full titles", "aslvv_boss");
settings.SetToolTip("aslvv_boss_short", "Enable this if the full stat names make the message too long");
settings.Add("aslvv_tags", true, "ASL_DogTags (dog tag collection stats)", "aslvv");
settings.Add("aslvv_tags_max", true, "Also show the total number of available dog tags", "aslvv_tags");
settings.Add("aslvv_cartwheels", true, "ASL_Cartwheels (running counter of rolls and cartwheels)", "aslvv");
settings.Add("aslvv_cartwheels_resetplant", false, "Reset counter when going from Tanker to Plant", "aslvv_cartwheels");
settings.Add("aslvv_cartwheels_resetfirst", false, "Reset counter on Raiden's first cartwheel", "aslvv_cartwheels");
settings.Add("aslvv_ames", true, "ASL_AmesLocation (Ames' randomised location in Shell 1 Core B1 Hall)", "aslvv");
settings.SetToolTip("aslvv_ames", "This value appears only once Ames has been found");
settings.Add("aslvv_ames_code", true, "Include the game's internal location ID", "aslvv_ames");
settings.Add("major", false, "Major Splits Only");
settings.SetToolTip("major", "The setting \"Split instantly when a boss is defeated\" above must also be enabled");
settings.Add("major_w00b", true, "Olga", "major");
settings.Add("major_new_d10t", true, "Guard Rush", "major");
settings.Add("major_new_museum", true, "Tanker complete (Tanker/Plant)", "major");
settings.Add("major_new_d014p01", false, "Stillman", "major");
settings.SetToolTip("major_new_d014p01", "Also enable Specific Splits > Optional Splits > Plant > Stillman");
settings.Add("major_w11c", true, "Fortune", "major");
settings.Add("major_fatman", true, "Fatman", "major");
settings.Add("major_w24c", true, "Ames", "major");
settings.Add("major_harrier", true, "Harrier", "major");
settings.Add("major_new_wmovie", false, "Prez", "major");
settings.SetToolTip("major_new_wmovie", "Also enable Specific Splits > Optional Splits > Plant > Prez");
settings.Add("major_w31c", true, "Vamp 1", "major");
settings.Add("major_w32b", true, "Vamp 2", "major");
settings.Add("major_w44a", true, "Tengus 1", "major");
settings.Add("major_w45a", true, "Tengus 2", "major");
settings.Add("major_w46a", true, "Rays", "major");
settings.Add("major_w61a", true, "Solidus", "major");
settings.Add("major_new_ending", true, "Plant complete (also Tanker complete in Tanker-only)", "major");
settings.Add("special", false, "Strategy Testing Mode");
settings.SetToolTip("special", "Split behaviours suited to route/strategy testing. Ideally use with a large set of unnamed splits, with a layout showing time between splits and without deltas.");
settings.Add("special_allroomstarts", false, "Split on every screen load", "special");
settings.SetToolTip("special_allroomstarts", "This will usually split multiple times during cutscenes");
settings.Add("special_allroomchanges", false, "Split on every area change", "special");
settings.SetToolTip("special_allroomchanges", "This will usually split multiple times during cutscenes");
settings.Add("special_startbutton", false, "Split when START is pressed", "special");
settings.Add("special_r3button", false, "Split when R3 is pressed", "special");
settings.Add("special_disabledefault", true, "Disable the default autosplitter behaviour", "special");
settings.Add("optional", true, "Enable Optional Splits");
settings.Add("options_tanker", true, "Tanker", "optional");
settings.Add("w03b_enterrush", false, "Split when entering Guard Rush", "options_tanker");
settings.SetToolTip("w03b_enterrush", "You will need two Deck 2 starboard splits if this is enabled");
settings.Add("options_plant", true, "Plant", "optional");
settings.Add("options_snaketales", true, "Snake Tales", "optional");
settings.Add("snaketales_a", true, "A Wrongdoing", "options_snaketales");
settings.Add("snaketales_b", true, "Big Shell Evil", "options_snaketales");
settings.Add("snaketales_c", true, "Confidential Legacy", "options_snaketales");
settings.Add("snaketales_d", true, "Dead Man Whispers", "options_snaketales");
settings.Add("snaketales_e", true, "External Gazer", "options_snaketales");
settings.Add("options_vr", true, "VR Missions", "optional");
settings.Add("vr_variety_ninja", false, "Enable splits for Variety (Ninja)", "options_vr");
settings.Add("vr_variety_pliskin", false, "Enable splits for Variety (Pliskin/Tuxedo)", "options_vr");
settings.Add("vr_variety_mgs1", false, "Enable splits for Variety (MGS1)", "options_vr");
string Tooltip = "The rules for these modes can accidentally trigger Variety splits for other characters. Only enable if you are playing this character.";
settings.SetToolTip("vr_variety_ninja", Tooltip);
settings.SetToolTip("vr_variety_pliskin", Tooltip);
settings.SetToolTip("vr_variety_mgs1", Tooltip);
settings.Add("splits", true, "Enable Specific Split Locations");
settings.SetToolTip("splits", "Enable or disable splitting when leaving these areas");
// Build the old/current room exclusion/inclusion dictionaries
vars.ExcludeOldRoom = new Dictionary<string, bool>();
vars.IncludeOldRoom = new Dictionary<string, bool>();
vars.ExcludeCurrentRoom = new Dictionary<string, bool>();
vars.IncludeCurrentRoom = new Dictionary<string, bool>();
foreach (string code in ExcludeOldRoom) {
vars.ExcludeOldRoom.Add(code, true);
}
foreach (string code in IncludeOldRoom) {
vars.IncludeOldRoom.Add(code, true);
}
foreach (string code in ExcludeCurrentRoom) {
vars.ExcludeCurrentRoom.Add(code, true);
}
foreach (string code in IncludeCurrentRoom) {
vars.IncludeCurrentRoom.Add(code, true);
}
// Populate the area/room settings
// vars.Rooms is the format e.g. { "w00a": "Aft Deck", "w00b": "Nav Deck... }
// i.e. it's a room name lookup table
vars.Rooms = new Dictionary<string, string>() {
{ "tales", "Snake Tales storyline" }
};
// This is a lot of setup, but it's worth it for O(1) room lookups
int alen = Areas.Count();
for (int i = 0; i < alen; i = i+2) { // for every area...
string akey = Areas[i];
string aval = Areas[i + 1];
settings.Add(akey, true, aval, "splits"); // add area setting
int rlen = Rooms[akey].Count();
for (int j = 0; j < rlen; j = j+2) { // and for every room in the area...
string rkey = Rooms[akey][j];
string rval = Rooms[akey][j + 1];
vars.Rooms.Add(rkey, rval); // add the room to vars.Rooms
if (!vars.ExcludeOldRoom.ContainsKey(rkey)) { // and if not already excluded...
settings.Add(rkey, true, rval, akey); // add room to the settings split list
}
}
}
// General-purpose room identifier
Func<string, string> GetRoomName = delegate(string RoomCode) {
string output = "";
if (vars.Rooms.TryGetValue(RoomCode, out output)) return output;
if (OtherRooms.TryGetValue(RoomCode, out output)) return output;
return "Undefined room";
};
vars.GetRoomName = GetRoomName;
// Build the VR Missions mission list
var VRCharacters = new string[] { "Raiden", "Ninja Raiden", "X Raiden", "Snake", "Pliskin", "Tuxedo Snake", "MGS1 Snake" };
var VRMissionList = new List< KeyValuePair<string, int[]> > {
new KeyValuePair<string, int[]>("Sneaking", new int[] { 10, 10, 0, 10, 10, 10, 10 }),
new KeyValuePair<string, int[]>("Eliminate All", new int[] { 10, 10, 0, 10, 10, 10, 10 }),
new KeyValuePair<string, int[]>("Handgun", new int[] { 5, 0, 0, 5, 5, 5, 5 }),
new KeyValuePair<string, int[]>("Assault Rifle", new int[] { 5, 0, 0, 5, 5, 5, 5 }),
new KeyValuePair<string, int[]>("C4/Claymore", new int[] { 5, 0, 0, 5, 5, 5, 5 }),
new KeyValuePair<string, int[]>("Grenade", new int[] { 5, 0, 0, 5, 5, 5, 5 }),
new KeyValuePair<string, int[]>("PSG-1", new int[] { 5, 0, 0, 5, 5, 5, 5 }),
new KeyValuePair<string, int[]>("Stinger", new int[] { 5, 0, 0, 5, 5, 5, 5 }),
new KeyValuePair<string, int[]>("Nikita", new int[] { 5, 0, 0, 5, 5, 5, 5 }),
new KeyValuePair<string, int[]>("HF.Blade/No Weapon", new int[] { 5, 5, 0, 5, 5, 5, 5 }),
new KeyValuePair<string, int[]>("First Person View", new int[] { 5, 0, 0, 5, 0, 0, 0 }),
new KeyValuePair<string, int[]>("Variety", new int[] { 7, 7, 0, 7, 7, 7, 7 }),
new KeyValuePair<string, int[]>("Streaking", new int[] { 0, 0, 1, 0, 0, 0, 0}),
new KeyValuePair<string, int[]>("Bomb Disposal", new int[] { 5, 5, 0, 5, 5, 5, 5 }),
new KeyValuePair<string, int[]>("Elimination", new int[] { 10, 10, 0, 10, 10, 10, 10 }),
new KeyValuePair<string, int[]>("Hold Up", new int[] { 10, 0, 0, 10, 10, 10, 10 }),
new KeyValuePair<string, int[]>("Photograph", new int[] { 7, 0, 0, 7, 0, 0, 0 })
};
var tmp = new Dictionary<int, string>();
int curmissionid = 0;
foreach (KeyValuePair<string, int[]> kvp in VRMissionList) {
for (int i = 1; i <= 10; i++) {
int c = 0;
foreach (int count in kvp.Value) {
if (count >= i) {
int num = ( (kvp.Key == "Variety") && (c != 0) && (c != 3) ) ? (i - 3) : i;
string number = (kvp.Key == "Streaking") ? "" : " " + num;
tmp.Add( curmissionid++, VRCharacters[c] + " " + kvp.Key + number );
}
c++;
}
}
}
vars.VRMissionList = tmp;
// Plant
string TempCategory = "options_plant";
// Option to split when meeting Stillman in Strut C
string TempSetting = "d014p01";
settings.Add(TempSetting, false, "Split when meeting Stillman", TempCategory);
settings.SetToolTip(TempSetting, "You will need two Strut C splits if this is enabled");
vars.SpecialNewRoom.Add(TempSetting, new Dictionary<string, string> {
{ "old", "w16a" },
{ "setting", TempSetting }
});
// Never split when meeting Olga in Strut E heliport
vars.SpecialNewRoom.Add("d021p01", new Dictionary<string, string> {
{ "old", "w20b" },
{ "no_split", "true" }
});
// Option to split when meeting Prez in Shell 2 Core
TempSetting = "w31a_prez";
settings.Add(TempSetting, false, "Split when meeting Prez", TempCategory);
settings.SetToolTip(TempSetting, "You will need two Shell 2 Core 1F splits if this is enabled");
vars.SpecialRoomChange.Add("w31a", new Dictionary<string, string> {
{ "current", "wmovie" },
{ "setting", TempSetting }
});
// Never split when opening the underwater hatch in Shell 2 Core B1
TempSetting = "d053p01";
settings.Add(TempSetting, false, "Split when opening the underwater hatch in Shell 2 Core B1", TempCategory);
settings.SetToolTip(TempSetting, "You will need two Shell 2 Core B1 splits if this is enabled");
vars.SpecialNewRoom.Add("d053p01", new Dictionary<string, string> { // B1 No.1 cutscenes
{ "old", "w31b" },
{ "setting_false", TempSetting },
{ "no_split", "true" }
});
// Never split immediately when starting Plant on it's own!
vars.SpecialRoomChange.Add("museum", new Dictionary<string, string> {
{ "old", "ending" },
{ "no_split", "true" }
});
// Option to split when completing codecs in Ascending Colon
TempSetting = "w43a_codecscompleted";
settings.Add(TempSetting, false, "Split when answering Rose in Ascending Colon", TempCategory);
settings.SetToolTip(TempSetting, "You will need two Arsenal Gear - Ascending Colon splits if this is enabled");
// Option to split when entering Tengus 2
TempSetting = "w45a_entertengus2";
settings.Add(TempSetting, false, "Split when entering Tengus 2", TempCategory);
settings.SetToolTip(TempSetting, "You will need an Arsenal Gear - Sigmoid Colon split before Tengus 2 if this is enabled");
// A Wrongdoing: Option to split when meeting Ames in Strut F
TempSetting = "snaketales_a_ames";
settings.Add(TempSetting, false, "Split when meeting Ames", "snaketales_a");
settings.SetToolTip(TempSetting, "You will need two Strut F splits if this is enabled");
vars.SpecialRoomChange.Add("a22a", new Dictionary<string, string> {
{ "current", "tales" },
{ "setting_false", TempSetting },
{ "no_split", "true" }
});
// Big Shell Evil
TempCategory = "snaketales_b";
// Option to split when meeting Emma in Strut C - details in update
TempSetting = "snaketales_b_pantry";
settings.Add(TempSetting, false, "Split when meeting Emma in Strut C", TempCategory);
settings.SetToolTip(TempSetting, "You will need a Strut C split before Guard Rush if this is enabled");
// Option to split when accessing the node in Strut B - again, details in update
TempSetting = "snaketales_b_node";
settings.Add(TempSetting, false, "Split when accessing the node", TempCategory);
settings.SetToolTip(TempSetting, "You will need two Strut B splits if this is enabled");
// Option to split when meeting Emma in Strut F
TempSetting = "snaketales_b_emma";
settings.Add(TempSetting, false, "Split when meeting Emma in Strut F", TempCategory);
settings.SetToolTip(TempSetting, "You will need two Strut F splits if this is enabled");
vars.SpecialRoomChange.Add("a22b", new Dictionary<string, string> {
{ "current", "tales" },
{ "setting_false", TempSetting },
{ "no_split", "true" }
});
// Confidential Legacy: Never split when meeting Meryl in Deck E
vars.SpecialRoomChange.Add("a01e", new Dictionary<string, string> {
{ "current", "tales" },
{ "no_split", "true" }
});
// External Gazer: Option to split after first AB connecting bridge (1st area) - possible???
print("Startup complete");
}
update {
try {
vars.old = old;
// Callbacks go here - they need access to current and old so startup won't do the job
if (!vars.Initialised) {
print("Beginning update initialisation...");
vars.Initialised = true;
var Vars = (IDictionary<string, object>)vars;
int MaxVal = 99999;
int Counter = 0;
bool BossActive = false;
bool NoBoss = false;
int Continues = -1;
bool BossDefeated = false;
int BossCounter = MaxVal;
int BossHealth = MaxVal;
int BossStamina = MaxVal;
int BossMaxHealth = -1;
int BossMaxStamina = -1;
uint BossLastDamage = 0;
int BossLatestDamage = 0;
int BossCombo = 0;
bool BigBossFailed = false;
int BigBossAlertState = 0;
int RoomTrackerInt = 0;
uint RoomTrackerUint = 0;
bool RoomTrackerT = false;
bool RoomTrackerP = false;
bool RoomTrackerA = false;
bool RoomTrackerB = false;
bool RoomTrackerC = false;
bool RoomTrackerD = false;
bool RoomTrackerE = false;
bool Cartwheeling = false;
vars.PreviousTagsSnake = 0;
vars.PreviousTagsRaiden = 0;
vars.PrevInfo = "";
vars.BossRush = false;
vars.ResetNextFrame = false;
vars.AllRoomStartsTimeout = 0;
vars.CharacterId = 0;
vars.ResetCartwheelsNext = false;
var ExceptionCount = new Dictionary<string, int> {
{ "reset", 0 },
{ "start", 0 },
{ "update", 0 },
{ "split", 0 }
};
var ValidMaxHealth = new Dictionary<string, int[]> {
{ "Olga", new[] {128, MaxVal} },
{ "Meryl", new[] {128, MaxVal} },
{ "Fatman", new[] {256, 384, 312} },
{ "Harrier", new[] {2250, 3250, 3500, 4000, 4750, MaxVal} },
{ "Vamp", new[] {100, 128} },
{ "Rays", new[] {3072, 5120, 7168, 10240, 20480, MaxVal} },
{ "Solidus", new[] {75, 95, 100} }
};
// Input checker
var Button = new Dictionary<string, int> {
{ "l1", 1 },
{ "r1", 1 << 1 },
{ "l2", 1 << 2 },
{ "r2", 1 << 3 },
{ "triangle", 1 << 4 },
{ "circle", 1 << 5 },
{ "x", 1 << 6 },
{ "square", 1 << 7 },
{ "select", 1 << 8 },
{ "r3", 1 << 10 },
{ "start", 1 << 11 },
{ "up", 1 << 12 },
{ "right", 1 << 13 },
{ "down", 1 << 14 },
{ "left", 1 << 15 },
{ "l3", 0x60000 }
};
Func<string, int, int, bool> TestInput = delegate(string ToCheck, int CurrentInput, int PreviousInput) {
bool cur = ((CurrentInput & Button[ToCheck]) == Button[ToCheck]);
bool prev = ((PreviousInput & Button[ToCheck]) == Button[ToCheck]);
return ( (cur) && (cur != prev) );
};
vars.TestInput = TestInput;
// Debug message handler
string DebugPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\mgs2_sse_debug.log";
vars.DebugTimer = 0;
vars.InfoTimer = 0;
vars.DebugTimerStart = 120;
Action<string> Debug = delegate(string message) {
message = "[" + current.GameTime + "] " + message;
if (settings["debug_file"]) {
using(System.IO.StreamWriter stream = new System.IO.StreamWriter(DebugPath, true)) {
stream.WriteLine(message);
stream.Close();
}
}
print("[MGS2AS] " + message);
vars.ASL_Debug = message;
// also overwrite the previous message if we're already showing the "splitting now" message
if (vars.DebugTimer != vars.DebugTimerStart) vars.PrevDebug = message;
};
vars.Debug = Debug;
Action<Exception, string> LogException = delegate(Exception e, string source) {
if (ExceptionCount[source] < 10) { // only log the first 10 of a particular type per run
ExceptionCount[source] = ExceptionCount[source] + 1;
Debug("Error in " + source + ":\n" + e.ToString());
if (ExceptionCount[source] == 10) Debug("Reached error limit for " + source + ", will not log again until next run");
}
print(e.ToString());
};
vars.LogException = LogException;
Action<string> Info = delegate(string message) {
vars.ASL_Info = message;
};
vars.Info = Info;
Action<string> DebugInfo = delegate(string message) {
Debug(message);
Info(message);
};
vars.DebugInfo = DebugInfo;
// Show debug a list of rooms
/*
string RoomNames = string.Join("\n ", vars.Rooms);
Debug("List of rooms: " + "{\n " + RoomNames + "\n}");
*/
// Shortened name for the byte[]-to-int converter
Func<byte[], int> C = delegate(byte[] input) {