-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdishonored2.asl
195 lines (167 loc) · 6.88 KB
/
dishonored2.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
state("Dishonored2")
{
// default unknown version
}
state("Dishonored2", "1.3")
{
// 1.75.0.12
// 166068224
bool isLoading : 0x26BD368; // 26BD374
float x : 0x26BD688, 0x1E8960, 0xE50, 0x540, 0x10, 0x40, 0x0, 0x3C;
float y : 0x26BD688, 0x1E8960, 0xE50, 0x540, 0x10, 0x40, 0x0, 0x40;
float z : 0x26BD688, 0x1E8960, 0xE50, 0x540, 0x10, 0x40, 0x0, 0x44;
string128 levelName : 0x3E04E50;
float screenFade : 0x2518A50, 0xEEF38, 0x34;
uint interaction : 0x2566CA8, 0x1F6EB0, 0x88, 0x80, 0x4;
uint canInteract : 0x2566CA8, 0x1F6EB0, 0xE90, 0x0;
}
state("Dishonored2", "1.4")
{
// 1.76.0.18
// 163115008
bool isLoading : 0x26DF8E8; // 26DF8F4
float x : 0x26DFC08, 0x1E8960, 0xE50, 0x540, 0x10, 0x40, 0x0, 0x3C;
float y : 0x26DFC08, 0x1E8960, 0xE50, 0x540, 0x10, 0x40, 0x0, 0x40;
float z : 0x26DFC08, 0x1E8960, 0xE50, 0x540, 0x10, 0x40, 0x0, 0x44;
string128 levelName : 0x3E69FF0;
float screenFade : 0x253B0D0, 0xEEF38, 0x34;
uint interaction : 0x26DFC08, 0x1F6EC0, 0x88, 0x80, 0x4;
uint canInteract : 0x26DFC08, 0x1F6EC0, 0xE90, 0x0;
}
state("Dishonored2", "1.9")
{
// 1.77.9.0
// 70369280
bool isLoading : 0x288D2E8;// Alternatively 0x3BDA0A8
float x : 0x288D608, 0x1E8960, 0xE58, 0x540, 0x10, 0x40, 0x0, 0x3C;
float y : 0x288D608, 0x1E8960, 0xE58, 0x540, 0x10, 0x40, 0x0, 0x40;
float z : 0x288D608, 0x1E8960, 0xE58, 0x540, 0x10, 0x40, 0x0, 0x44;
string128 levelName : 0x4025C50;
float screenFade : 0x26C2B10, 0xEEF38, 0x34;
uint interaction : 0x288D608, 0x1F6EE8, 0x88, 0x80, 0x4;
uint canInteract : 0x288D608, 0x1F6EE8, 0x13B0, 0x0;
}
state("Dishonored2_x64ShippingRetail", "1.9ms")
{
// 1.77.9.0
// 113065984
bool isLoading : 0x4A685A8;
//float x : 0x51f57d4; //camx
//float y : 0x51f57d8; //camy
//float z : 0x51f57dc; //camz
float x : 0x48A3318, 0x10, 0x330, 0x78; //player pos from arkPlayer object
float y : 0x48A3318, 0x10, 0x330, 0x7c;
float z : 0x48A3318, 0x10, 0x330, 0x80;
string128 levelName : 0x5841040;
float screenFade : 0x61c7b50, 0, 8, 0x7DC;
uint interaction : 0x4A10448, 0x6D0, 0x10, 0xa0, 0x88, 0x80, 4;
uint canInteract : 0x4A10448, 0x6D0, 0x10, 0xa0, 0x13b0, 0;
}
startup {
// "campaign/bunker/bunker_p_lowchaos" is used before killing/darting stilton regardless of chaos
// "campaign/bunker/bunker_p_highchaos" is used after regardless of chaos
vars.autoSplits = new Tuple<string,string,bool>[]{
Tuple.Create("A Strange Visit" ,"campaign/void/void_01/void_01_p" ,true ),
Tuple.Create("Edge of the World" ,"campaign/boat/edge_of_the_world/boat_eotw_p" ,false),
Tuple.Create("The Good Doctor" ,"campaign/institute/institute_p_" ,true ),
Tuple.Create("The Lockwork Mansion" ,"campaign/boat/madinventor/boat_madinventor_p" ,true ),
Tuple.Create("Another Strange Visit" ,"campaign/void/void_02/void_02_p" ,true ),
Tuple.Create("The Royal Conservatory","campaign/boat/curator/boat_curator_p" ,false),
Tuple.Create("Dust District" ,"campaign/boat/dust/boat_dust_p" ,true ),
Tuple.Create("A Crack in the Slab" ,"campaign/bunker/bunker_p_lowchaos" ,true ),
Tuple.Create("The Grand Palace" ,"campaign/boat/duke_palace/boat_palace_p" ,true ),
Tuple.Create("Death to the Empress" ,"campaign/boat/dunwall_return/boat_dunwall_return_p",true ),
};
int i = 0;
foreach (var autoSplit in vars.autoSplits) {
settings.Add("autosplit_"+i.ToString(),autoSplit.Item3,"Split on \""+autoSplit.Item1+"\" start");
++i;
}
settings.Add("autosplit_end",true,"Split on run end");
vars.autoSplitIndex = -1;
}
init
{
switch (modules.First().ModuleMemorySize) {
case 113065984: version = "1.9ms"; break; // Windows Store
case 70369280: version = "1.9"; break;
case 163115008: version = "1.4"; break;
case 166068224: version = "1.3"; break;
default: version = ""; break;
}
// print(modules.First().FileVersionInfo.FileVersion);
// print(modules.First().ModuleMemorySize.ToString());
if (vars.autoSplitIndex == -1) {
for (vars.autoSplitIndex = 0;vars.autoSplitIndex < vars.autoSplits.Length;++vars.autoSplitIndex) {
if (settings["autosplit_"+vars.autoSplitIndex.ToString()]) {
break;
}
}
}
}
exit
{
timer.IsGameTimePaused = true;
}
isLoading
{
return current.isLoading;
}
update
{
const float posX = -28.09f,
posY = -153.96f,
posZ = 66.40f,
delta = 0.005f;
if (old.isLoading || current.isLoading) {
vars.runStarting =
current.levelName.Equals("campaign/dunwall/escape/tower/dunwall_escape_tower_p") &&
// Check if inside starting area.
posX-delta < current.x && current.x < posX+delta &&
posY-delta < current.y && current.y < posY+delta &&
posZ-delta < current.z && current.z < posZ+delta;
if(vars.runStarting){
for (vars.autoSplitIndex = 0;vars.autoSplitIndex < vars.autoSplits.Length;++vars.autoSplitIndex) {
if (settings["autosplit_"+vars.autoSplitIndex.ToString()]) {
break;
}
}
}
} else {
vars.runStarting = false;
}
}
reset
{
return current.isLoading && vars.runStarting;
}
start
{
return !current.isLoading && vars.runStarting;
}
split
{
if (vars.autoSplitIndex < vars.autoSplits.Length) {
if (current.isLoading && current.levelName.StartsWith(vars.autoSplits[vars.autoSplitIndex].Item2)) {
for (++vars.autoSplitIndex;vars.autoSplitIndex < vars.autoSplits.Length;++vars.autoSplitIndex) {
if (settings["autosplit_"+vars.autoSplitIndex.ToString()]) {
break;
}
}
return true;
}
} else if(vars.autoSplitIndex == vars.autoSplits.Length && settings["autosplit_end"]) {
bool isFadingOut = (old.screenFade < current.screenFade && current.screenFade < 1.0f);
// For some reason 0x4B indicates that we can interact with something.
// Also, if it just changed, we assume the user can interact.
// This is necessary since `canInteract` is only updated on the second frame.
bool canInteract = (current.canInteract == 0x4B || old.interaction != current.interaction);
// 0x9C673C93 is the id (possibly a hash) for "Revive your father", 0xA2674605 is for "Revive your daughter".
bool isFinalInteraction = (current.interaction == 0x9C673C93 || current.interaction == 0xA2674605);
if(isFadingOut && canInteract && isFinalInteraction) {
++vars.autoSplitIndex;
return true;
}
}
return false;
}