-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathutilities.asl
More file actions
78 lines (75 loc) · 2.5 KB
/
utilities.asl
File metadata and controls
78 lines (75 loc) · 2.5 KB
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
state("witness64_d3d11") {
float x : 0x5B5528;
float y : 0x5B552C;
float z : 0x5B5530;
double t : 0x5A6C30;
// globals = 0x5B28C0;
}
init {
double oldx = 0.0;
double oldy = 0.0;
double oldz = 0.0;
double oldt = 0.0;
double INTERVAL = 1.0;
vars.printSpeed = (Action<int>)((int dimFlags) => {
if (current.t - oldt > INTERVAL) {
double dx = current.x-oldx;
double dy = current.y-oldy;
double dz = current.z-oldz;
double dt = current.t-oldt;
double norm = 0.0;
if ((dimFlags & 1) != 0) norm += dx*dx;
if ((dimFlags & 2) != 0) norm += dy*dy;
if ((dimFlags & 4) != 0) norm += dz*dz;
print("Motion ("+dimFlags+"): "+Math.Sqrt(norm)/dt);
oldx = current.x;
oldy = current.y;
oldz = current.z;
oldt = current.t;
}
});
var pointerData = new Dictionary<int, Tuple<DeepPointer, byte, byte, int>>();
int STABILITY = 1;
vars.offsetWatch = (Action<Func<int, DeepPointer>>)((Func<int, DeepPointer> getPointerAtOffset) => {
string output = "";
for (int offset=0; offset<0xFFF; offset++) {
if (!pointerData.ContainsKey(offset)) {
var pointer = getPointerAtOffset(offset);
pointerData[offset] = new Tuple<DeepPointer, byte, byte, int>(
pointer, // Reference pointer
pointer.Deref<byte>(game), // Old value
pointer.Deref<byte>(game), // Current value
STABILITY // Stability
);
continue;
}
byte val = pointerData[offset].Item1.Deref<byte>(game);
if (val != pointerData[offset].Item3) {
pointerData[offset] = new Tuple<DeepPointer, byte, byte, int>(
pointerData[offset].Item1,
pointerData[offset].Item3,
val,
0
);
} else {
pointerData[offset] = new Tuple<DeepPointer, byte, byte, int>(
pointerData[offset].Item1,
pointerData[offset].Item2,
pointerData[offset].Item3,
pointerData[offset].Item4 + 1
);
}
if (pointerData[offset].Item4 == STABILITY) {
output += "0x"+offset.ToString("X") + ": " + pointerData[offset].Item2 + " -> " + pointerData[offset].Item3 + " | ";
}
}
if (output != "") print(output);
});
}
update {
// vars.printSpeed(7); // 3D Speed
Func<int, DeepPointer> getPointerAtOffset = (offset) => {
return new DeepPointer(0x5B28C0, 0x18, 0x00A64*8, offset);
};
vars.offsetWatch(getPointerAtOffset);
}