-
Notifications
You must be signed in to change notification settings - Fork 0
/
FinalFantasy9.asl
238 lines (215 loc) · 9.32 KB
/
FinalFantasy9.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
state("FF9")
{
int sceneId: "FF9.exe", 0x01071080, 0x28, 0x10, 0x0, 0x120, 0x30, 0x28, 0x10, 0x10, 0x5C;
int sceneType: "FF9.exe", 0x0115BEA8, 0x48, 0x10, 0x98, 0x270, 0x10, 0x140; // Bundle = 0, Field = 1, World = 2, Battle = 3, Title = 4, QuadMist = 5, Pure = 6, Ending = 7, EndGame = 8, None = 9
string50 focusedElement: "FF9.exe", 0x01116790, 0x10, 0x0, 0x10, 0x58, 0x0;
bool buttonPressed: "mono.dll", 0x002635B8, 0x0, 0x38, 0x100, 0xB8, 0x138;
byte csrBreakFlag: "FF9.exe", 0x0106EBB8, 0x38, 0x20, 0x80, 0x230, 0x20, 0x1FF;
}
startup
{
vars.FindComponentByLeftText = (Func<string, dynamic>)(
text => timer.Layout.Components.FirstOrDefault((dynamic x) => x.GetType().Name == "TextComponent" && x.Settings.Text1 == text)
);
vars.splits = new List<string>();
vars.splitsOldSceneId = new Dictionary<string, int>();
vars.splitsCurrentSceneId = new Dictionary<string, int>();
vars.executedSplits = new List<string>();
Action<string, string, string, int, int> AddSplit = (discId, splitId, splitDescription, oldSceneId, currentSceneId) => {
splitId = discId + "." + splitId;
vars.splits.Add(splitId);
vars.splitsOldSceneId.Add(splitId, oldSceneId);
vars.splitsCurrentSceneId.Add(splitId, currentSceneId);
settings.Add(splitId, true, splitDescription, discId);
};
settings.Add("disc1", true, "Disc 1 Splits");
AddSplit("disc1", "magemasher", "Mage Masher", 336, 50);
AddSplit("disc1", "kingleo", "King Leo", 338, 63);
AddSplit("disc1", "steiner1", "Steiner 1", 337, 58);
AddSplit("disc1", "steiner2", "Steiner 2", 335, 67);
AddSplit("disc1", "steiner3", "Steiner 3", 334, 60);
AddSplit("disc1", "prisoncage", "Prison Cage", 301, 251);
AddSplit("disc1", "baku", "Baku", 295, 202);
AddSplit("disc1", "plantbrain", "Plant Brain", 303, 257);
AddSplit("disc1", "evilforest", "Evil Forest Done", 259, 260);
AddSplit("disc1", "sealion", "Sealion", 21, 309);
AddSplit("disc1", "dali", "Enter Dali", 9011, 359);
AddSplit("disc1", "blackwaltz2", "Black Waltz 2", 294, 453);
AddSplit("disc1", "blackwaltz3", "Black Waltz 3", 296, 501);
AddSplit("disc1", "mu", "Mu", 13, 566);
AddSplit("disc1", "entergizamaluke", "Enter Gizamaluke's", 9000, 701);
AddSplit("disc1", "gizamaluke", "Gizamaluke", 326, 707);
AddSplit("disc1", "burmercia", "Enter Burmercia", 9000, 750);
AddSplit("disc1", "beatrix1", "Beatrix 1", 4, 768);
AddSplit("disc1", "eod1", "End of Disc 1", 70, 800);
settings.Add("disc2", true, "Disc 2 Splits");
AddSplit("disc2", "blackwaltz32", "Black Waltz 3 2", 52, 811);
AddSplit("disc2", "ralvurahva", "Ralvurahva", 76, 956);
AddSplit("disc2", "cleyra", "Cleyra Settlement", 1050, 1051);
AddSplit("disc2", "antlion", "Antlion", 300, 1052);
AddSplit("disc2", "beatrix2", "Beatrix 2", 299, 1108);
AddSplit("disc2", "guards", "Guards", 1209, 1211);
AddSplit("disc2", "tantarian", "Tantarian", 930, 1216);
AddSplit("disc2", "zornandthorn", "Zorn & Thorn", 74, 1205);
AddSplit("disc2", "beatrix3", "Beatrix 3", 73, 1225);
AddSplit("disc2", "ralvuimago", "Ralvuimago", 75, 955);
AddSplit("disc2", "lani", "Lani", 83, 1424);
AddSplit("disc2", "fossilroo", "Exit Fossil Roo", 1425, 9003);
AddSplit("disc2", "blackmagevillage", "Exit Black Mage Village", 1450, 9003);
AddSplit("disc2", "hilgigars", "Hilgigars", 107, 1555);
AddSplit("disc2", "enteriifatree", "Enter Iifa Tree", 9003, 1650);
AddSplit("disc2", "soulcage", "Soulcage", 116, 1756);
AddSplit("disc2", "amarant", "Amarant", 132, 1605);
AddSplit("disc2", "iifatreedone", "Iifa Tree Done", 1655, 1656);
AddSplit("disc2", "eod2", "End of Disc 2", 1800, 1812);
settings.Add("disc3", true, "Disc 3 Splits");
AddSplit("disc3", "cards", "Card Tournament", 1903, 2054);
AddSplit("disc3", "mistodons", "Mistodons", 915, 1807);
AddSplit("disc3", "bluenarciss", "Blue Narciss", 2173, 2855);
AddSplit("disc3", "sand", "Sand", 9003, 2200);
AddSplit("disc3", "oeilvert", "Enter Oeilvert", 9005, 2250);
AddSplit("disc3", "ark", "Ark", 0, 2260);
AddSplit("disc3", "dpstart", "Desert Palace Start", 2206, 2213);
AddSplit("disc3", "valiapira", "Valia Pira", 525, 2222);
AddSplit("disc3", "estogaza", "Enter Esto Gaza", 9003, 2300);
AddSplit("disc3", "reddragons", "Red Dragons", 195, 2361);
AddSplit("disc3", "meltigemini", "Meltigemini", 200, 2364);
AddSplit("disc3", "ipsencastle", "Enter Ipsen's Castle", 9007, 2500);
AddSplit("disc3", "taharka", "Taharka", 871, 2510);
AddSplit("disc3", "earthshrine", "Enter Earth Shrine", 9007, 2550);
AddSplit("disc3", "earthguardian", "Earth Guardian", 2, 2553);
AddSplit("disc3", "branbal", "Enter Bran Bal", 2650, 2651);
AddSplit("disc3", "amdusias", "Amdusias", 155, 2706);
AddSplit("disc3", "abadon", "Abadon", 160, 2707);
AddSplit("disc3", "shelldragon", "Shell Dragon", 163, 2708);
AddSplit("disc3", "silverdragon", "Silver Dragon", 889, 2715);
AddSplit("disc3", "garland", "Garland", 890, 2715);
AddSplit("disc3", "kuja", "Kuja", 891, 2720);
AddSplit("disc3", "eod3", "End of Disc 3", 2750, 3052);
settings.Add("disc4", true, "Disc 4 Splits");
AddSplit("disc4", "novadragon", "Nova Dragon", 931, 2753);
AddSplit("disc4", "maliris", "Maliris", 932, 2904);
AddSplit("disc4", "tiamat", "Tiamat", 933, 2908);
AddSplit("disc4", "kraken", "Kraken", 934, 2915);
AddSplit("disc4", "lich", "Lich", 935, 2919);
AddSplit("disc4", "deathguise", "Deathguise", 936, 2926);
AddSplit("disc4", "trancekuja", "Trance Kuja", 937, 2928);
settings.Add("debug", false, "Debug Stuff");
settings.SetToolTip("debug", "Add a TextComponent with \"SceneId:\" or \"SceneType:\" on the left text to show the variables' values. Used only to debug problems in the auto splitter.");
vars.newGameButtonFocused = false;
vars.isFightingArk = false;
}
update
{
if (current.sceneType == 4)
{
if (current.focusedElement == "New Game Button Pointer")
{
vars.newGameButtonFocused = true;
}
else if (current.focusedElement == "Continue Button Pointer" || current.focusedElement == "Load Game Button Pointer" || current.focusedElement == "Cloud Button Pointer")
{
vars.newGameButtonFocused = false;
}
}
else
{
vars.newGameButtonFocused = false;
}
// Both Ark fight and title screen have sceneId equals 0.
// Because of that, we need to track whether we were on the title screen or a battle when sceneId is 0,
// so we don't split by accident after continuing a game over on Ark.
if (current.sceneId == 0)
{
if (current.sceneType == 4)
{
vars.isFightingArk = false;
}
else if (current.sceneType == 3)
{
vars.isFightingArk = true;
}
}
if (settings["debug"])
{
if (old.sceneId != current.sceneId)
{
var componentSceneId = vars.FindComponentByLeftText("SceneId:");
if (componentSceneId != null)
{
componentSceneId.Settings.Text2 = current.sceneId.ToString();
}
}
if (old.sceneType != current.sceneType)
{
var componentSceneType = vars.FindComponentByLeftText("SceneType:");
if (componentSceneType != null)
{
componentSceneType.Settings.Text2 = current.sceneType.ToString();
}
}
}
}
start
{
if (vars.newGameButtonFocused && current.buttonPressed)
{
vars.executedSplits.Clear();
return true;
}
}
split
{
foreach (var split in vars.splits)
{
if (!settings[split] || vars.executedSplits.Contains(split))
{
continue;
}
var shouldSplit = false;
if (split == "disc1.prisoncage" && old.sceneId == 251 && current.sceneId == 252) // If you skip Prison Cage, split
{
shouldSplit = true;
}
else if (split == "disc4.maliris" && old.sceneId == 2904 && current.sceneId == 2905) // If you skip Maliris, split
{
shouldSplit = true;
}
else if (split == "disc4.tiamat" && old.sceneId == 2908 && current.sceneId == 2909) // If you skip Tiamat, split
{
shouldSplit = true;
}
else if (split == "disc4.kraken" && old.sceneId == 2915 && current.sceneId == 2916) // If you skip Kraken, split
{
shouldSplit = true;
}
else if (split == "disc4.lich" && old.sceneId == 2919 && current.sceneId == 2920) // If you skip Lich, split
{
shouldSplit = true;
}
else if (split == "disc4.deathguise" && old.sceneId == 2926 && current.sceneId == 2927) // If you skip Deathguise, split
{
shouldSplit = true;
}
else if (old.sceneId == vars.splitsOldSceneId[split] && current.sceneId == vars.splitsCurrentSceneId[split])
{
if (split == "disc3.ark")
{
shouldSplit = vars.isFightingArk;
}
else
{
shouldSplit = true;
}
}
if (shouldSplit)
{
vars.executedSplits.Add(split);
return true;
}
}
}
isLoading
{
return (current.sceneType == 9 || current.csrBreakFlag == 100);
}