-
Notifications
You must be signed in to change notification settings - Fork 0
/
SS-autosplitter-nyutie.asl
280 lines (254 loc) · 11.1 KB
/
SS-autosplitter-nyutie.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
// autosplitter and layout by nyutie
// first time doin any of this :3_:
state("ThankYouVeryCool-Win64-Shipping", "epic patch 5.5") {
// float levelTimer: 0x5E33E00, 0x118, 0xB64;
float fullTimer: 0x5E33E00, 0x118, 0xB68;
bool isOnMainMenu: 0x5BFE7B8, 0x460, 0x3F0, 0x320;
}
state("ThankYouVeryCool-Win64-Shipping", "gog patch 5.5") {
// float levelTimer: 0x5B7E1C0, 0x118, 0xB64;
float fullTimer: 0x5B7E1C0, 0x118, 0xB68;
bool isOnMainMenu: 0x5B7A860, 0x8, 0x8, 0x1F0, 0x18;
}
state("ThankYouVeryCool-Win64-Shipping", "steam oldleaderboards") {
// float levelTimer: 0x5B0F540, 0x118, 0xB54;
float fullTimer: 0x5B0F540, 0x118, 0xB58;
bool isOnMainMenu: 0x59C7EE0, 0x8D0, 0x0, 0x16B0, 0xD8;
}
state("ThankYouVeryCool-Win64-Shipping", "steam patch 5.0") {
// float levelTimer: 0x5B19140, 0x118, 0xB64;
float fullTimer: 0x5B19140, 0x118, 0xB68;
bool isOnMainMenu: 0x59D1AE0, 0x2190, 0x0, 0xEA0, 0x27C;
}
state("ThankYouVeryCool-Win64-Shipping", "steam patch 5.1") {
// float levelTimer: 0x5B1A2C0, 0x118, 0xB64;
float fullTimer: 0x5B1A2C0, 0x118, 0xB68;
bool isOnMainMenu: 0x59D2C60, 0x2190, 0x0, 0xEA0, 0x27C; // better pointer. is actually 8 bytes, makes it easier to find, gonna search for 8 bytes in the future
}
state("ThankYouVeryCool-Win64-Shipping", "steam patch 5.2") {
// float levelTimer: 0x5B1A300, 0x118, 0xB64;
float fullTimer: 0x5B1A300, 0x118, 0xB68;
bool isOnMainMenu: 0x59D2CA0, 0x8F0, 0xA0, 0x3E0, 0x320;
}
state("ThankYouVeryCool-Win64-Shipping", "steam patch 5.3") {
// float levelTimer: 0x5B28C00, 0x118, 0xB64;
float fullTimer: 0x5B28C00, 0x118, 0xB68;
bool isOnMainMenu: 0x59E15A0, 0xF70, 0xA0, 0x3E0, 0x320;
}
state("ThankYouVeryCool-Win64-Shipping", "steam patch 5.3.1") {
// float levelTimer: 0x5B28C80, 0x118, 0xB64;
float fullTimer: 0x5B28C80, 0x118, 0xB68;
bool isOnMainMenu: 0x59E1620, 0xF70, 0xA0, 0x3E0, 0x320;
}
state("ThankYouVeryCool-Win64-Shipping", "steam patch 5.3.2") {
// float levelTimer: 0x5B1E480, 0x118, 0xB64;
float fullTimer: 0x5B1E480, 0x118, 0xB68;
bool isOnMainMenu: 0x59D6E20, 0x8F0, 0xA0, 0x3E0, 0x320;
}
state("ThankYouVeryCool-Win64-Shipping", "steam patch 5.4") {
// float levelTimer: 0x5B1A0B8, 0x118, 0xB64;
float fullTimer: 0x5B1A0B8, 0x118, 0xB68;
bool isOnMainMenu: 0x5B16D10, 0xE10, 0xE60, 0x320; // couldn't find old value. this is shorter though
}
state("ThankYouVeryCool-Win64-Shipping", "steam patch 5.5") {
// float levelTimer: 0x5B831C0, 0x118, 0xB64;
float fullTimer: 0x5B831C0, 0x118, 0xB68;
bool isOnMainMenu: 0x5A3BB60, 0xF70, 0xA0, 0x3F0, 0x320; // guh
}
startup
{
if(timer.CurrentTimingMethod == TimingMethod.RealTime) // copied this from somewhere lmao
{
var timingMessage = MessageBox.Show
(
"This game uses Game Time (time without loads) as the main timing method.\n"+
"LiveSplit is currently set to show Real Time (time INCLUDING loads).\n"+
"Would you like the timing method to be set to Game Time for you?",
"SS-autosplitter | LiveSplit",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question
);
if (timingMessage == DialogResult.Yes) timer.CurrentTimingMethod = TimingMethod.GameTime;
}
vars.MapReferences = new List<string>()
{
"/Game/Campaign/Trash/CDA_Trash.CDA_Trash_C",
"/Game/Campaign/TrashDiveTut/CDA_TrashDive.CDA_TrashDive_C",
"/Game/Campaign/AboveTrash/CDA_AboveTrash.CDA_AboveTrash_C",
"/Game/Campaign/Trash_turrets/CDA_Turrets.CDA_Turrets_C",
"/Game/Campaign/trash_combat/CDA_TrashCombat.CDA_TrashCombat_C",
"/Game/Campaign/TrashControlRoom/CDA_WasteManagement.CDA_WasteManagement_C",
"/Game/Campaign/MeatPlant/CDA_RedHouse.CDA_RedHouse_C",
"/Game/Campaign/MeatProc/CDA_RedProc.CDA_RedProc_C",
"/Game/Campaign/HospitlCafe/CDA_Cafeteria.CDA_Cafeteria_C",
"/Game/Campaign/Labs/CDA_Labs.CDA_Labs_C",
"/Game/Campaign/LabBasement/CDA_LabBasement.CDA_LabBasement_C",
"/Game/Campaign/HospitalCare/CDA_CyberHospital.CDA_CyberHospital_C",
"/Game/Campaign/Corridor/CDA_Corridor.CDA_Corridor_C",
"/Game/Campaign/Vents1/CDA_Vents1.CDA_Vents1_C",
"/Game/Campaign/Vents_two/CDA_Vents2.CDA_Vents2_C",
"/Game/Campaign/Oxygenate/CDA_Oxygenate.CDA_Oxygenate_C",
"/Game/Campaign/TrainStation/CDA_SubwayStation.CDA_SubwayStation_C",
"/Game/Campaign/Train0/CDA_Train0.CDA_Train0_C",
"/Game/Campaign/TrainOne/CDA_TrainOne.CDA_TrainOne_C",
"/Game/Campaign/Checkpoint/CDA_Checkoint.CDA_Checkoint_C",
"/Game/Campaign/Intelligence/CDA_Intel.CDA_Intel_C",
"/Game/Campaign/DataPrism/CDA_DataPrism.CDA_DataPrism_C",
"/Game/Campaign/ServerRoom/CDA_Serveroom.CDA_Serveroom_C",
"/Game/Campaign/Armory/CDA_Armory.CDA_Armory_C",
"/Game/Campaign/Prison/CDA_Prison.CDA_Prison_C",
"/Game/Campaign/Vents3/CDA_Vents3.CDA_Vents3_C",
"/Game/Campaign/Anxiety/CDA_Anxiety.CDA_Anxiety_C",
"/Game/Campaign/Reception/CDA_Reception.CDA_Reception_C",
"/Game/Campaign/LowerAdmin/CDA_LowerAdmin.CDA_LowerAdmin_C",
"/Game/Campaign/MiddleAdmin/CDA_MiddleAdmin2.CDA_MiddleAdmin2_C",
"/Game/Campaign/UpperAdmin/CDA_UpperAdmin.CDA_UpperAdmin_C",
"/Game/Campaign/TeleportingLab/CDA_Teleporter.CDA_Teleporter_C",
"/Game/Campaign/Barraks/CDA_Barracks.CDA_Barracks_C",
"/Game/Campaign/Apartments/CDA_Apartments.CDA_Apartments_C",
"/Game/Campaign/Mall/CDA_Mall.CDA_Mall_C",
"/Game/Campaign/Asention/CDA_Asention.CDA_Asention_C",
"/Game/Campaign/GlassMoon/CDA_GlassMoon.CDA_GlassMoon_C",
"/Game/Campaign/Nightclub/CDA_Nightclub.CDA_Nightclub_C",
"/Game/Campaign/ceooffice/CDA_ceooffice.CDA_ceooffice_C",
"/Game/Campaign/Penthouse/CDA_Penthouse.CDA_Penthouse_C",
"/Game/Campaign/Museum1/CDA_Gallery.CDA_Gallery_C",
"/Game/Campaign/Museum/CDA_Museum.CDA_Museum_C",
"/Game/Campaign/Garden/CDA_Garden.CDA_Garden_C",
"/Game/Campaign/Mansion/CDA_Mansion.CDA_Mansion_C",
"/Game/Campaign/TheWall/CDA_TheWall.CDA_TheWall_C",
"/Game/Campaign/Cage/CDA_Cage.CDA_Cage_C",
"/Game/Campaign/Escapism/CDA_Escapism.CDA_Escapism_C"
};
}
init
{
string MD5Hash;
using (var md5 = System.Security.Cryptography.MD5.Create())
using (var s = File.Open(modules.First().FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
MD5Hash = md5.ComputeHash(s).Select(x => x.ToString("X2")).Aggregate((a, b) => a + b);
switch (MD5Hash)
{
case "F26391C54743E1C276663BE1B292338A":
version = "epic patch 5.5";
vars.SaveOffsetPath = new DeepPointer(0x5E2FA38, 0x130, 0x38, 0x70, 0x459);
break;
case "2760F4F5197D180FEAC859A4D6A07719":
version = "gog patch 5.5";
vars.SaveOffsetPath = new DeepPointer(0x5B79DF8, 0x130, 0x38, 0x70, 0x459);
break;
case "90CD08A8C58714C6A35EEBE954212C19":
version = "steam oldleaderboards";
vars.SaveOffsetPath = new DeepPointer(0x5B0B178, 0x130, 0x38, 0x70, 0x459);
break;
case "65EA646701B96E86BD38254C7AB606EF":
version = "steam patch 5.0";
vars.SaveOffsetPath = new DeepPointer(0x5B14D78, 0x130, 0x38, 0x70, 0x459);
break;
case "A8C57AD035ED26B6E1DCED0499EBFA22":
version = "steam patch 5.1";
vars.SaveOffsetPath = new DeepPointer(0x5B15EF8, 0x130, 0x38, 0x70, 0x459);
break;
case "76EAB92EF3754360BAB05B7D535C6956":
version = "steam patch 5.2";
vars.SaveOffsetPath = new DeepPointer(0x5B15F38, 0x130, 0x38, 0x70, 0x459);
break;
case "5CB50DA54A0E6718DDE1E1767261E1E1":
version = "steam patch 5.3";
vars.SaveOffsetPath = new DeepPointer(0x5B24838, 0x130, 0x38, 0x70, 0x459);
break;
case "A2A6EF0B983BC581FB7BEF6CA712DF93":
version = "steam patch 5.3.1";
vars.SaveOffsetPath = new DeepPointer(0x5B248B8, 0x130, 0x38, 0x70, 0x459);
break;
case "E07998E54FE179C0BD9B6FA8B47A37D9":
version = "steam patch 5.3.2";
vars.SaveOffsetPath = new DeepPointer(0x5B1A0B8, 0x130, 0x38, 0x70, 0x459);
break;
case "D6B612D7A26C563461AAAA9DB064E822":
version = "steam patch 5.4";
vars.SaveOffsetPath = new DeepPointer(0x5B25978, 0x130, 0x38, 0x70, 0x459);
break;
case "8EAA5F06FAA6B53ECA2BB39B18C13F99":
version = "steam patch 5.5";
vars.SaveOffsetPath = new DeepPointer(0x5B7EDF8, 0x130, 0x38, 0x70, 0x459);
break;
default:
MessageBox.Show
(
"Unsupported version of the game! If you're on GOG, sorry, I don't have it.\n" +
"If you're on Steam/Epic, I'm probably already working on the update!\n\n" +
"If you have any questions you can find me on the official Greylock Discord server, or the official SS/EPN speedrun Discord server.\n\n" +
"modules.first().ModuleMemorySize: 0x" + modules.First().ModuleMemorySize.ToString("X") + "\n" +
"new FileInfo(modules.First().FileName).Length): 0x" + new FileInfo(modules.First().FileName).Length.ToString("X") + "\n" +
"MD5Hash: " + MD5Hash,
"SS-autosplitter | LiveSplit",
MessageBoxButtons.OK,
MessageBoxIcon.Warning
);
print("Hash is: " + MD5Hash);
return false;
}
timer.IsGameTimePaused = false;
vars.CurrentMapIndex = -2;
}
update
{
if (version == "") {
return false; // stops update
}
IntPtr resolvedSavePath = IntPtr.Zero;
vars.SaveOffsetPath.DerefOffsets(game, out resolvedSavePath);
vars.SaveOffset = resolvedSavePath;
IntPtr saveOffset = vars.SaveOffset;
int campaignLevelReferenceStringLength = game.ReadValue<int>(saveOffset + 0x82);
vars.CampaignLevelReferenceString = game.ReadString(saveOffset + 0x82 + 0x4, campaignLevelReferenceStringLength);
}
start
{
if (!current.isOnMainMenu && vars.CampaignLevelReferenceString == vars.MapReferences[0] && current.fullTimer > 0f)
{
vars.CurrentMapIndex = 0;
return true;
}
}
split
{
int nowCurrentMapIndex = vars.MapReferences.IndexOf(vars.CampaignLevelReferenceString);
if (nowCurrentMapIndex == vars.CurrentMapIndex + 1)
{
vars.CurrentMapIndex = nowCurrentMapIndex;
return true;
}
else if (nowCurrentMapIndex == vars.MapReferences.Count - 1 && current.fullTimer == 0f) // last map
{
return true;
}
}
reset
{
if (current.isOnMainMenu || old.fullTimer > current.fullTimer)
{
return true;
}
}
isLoading
{
if (!current.isOnMainMenu && current.fullTimer == old.fullTimer)
{
return true;
}
return false;
}
gameTime
{
return TimeSpan.FromSeconds(current.fullTimer != 0f ? current.fullTimer : old.fullTimer);
}
onReset
{
vars.CurrentMapIndex = -2;
}
exit
{
timer.IsGameTimePaused = true;
}