forked from PeachyPeachSM64/sm64ex-omm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
omm.asl
75 lines (70 loc) · 2.87 KB
/
omm.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
// -------------------------------------------------------------------- //
// LiveSplit Auto-Splitter script for Odyssey Mario's Moveset speedruns //
// By PeachyPeach //
// -------------------------------------------------------------------- //
// - Starts when the player selects a file; //
// - Splits each time a certain amount of stars is collected; //
// - Stops when the Grand Star is grabbed; //
// - Resets when the game returns to the main menu. //
// -------------------------------------------------------------------- //
// - Start LiveSplit, load your splits, and save them as a file named //
// "splits.lss" next to the "sm64.us.f3dex2e.exe" executable. //
// - Then, start the game, the auto-splits will be generated from //
// the provided "splits.lss" file. //
// -------------------------------------------------------------------- //
// - You need OMM v6.1.0 or later to make it work. //
// - Make sure the executable you play is named "sm64.us.f3dex2e.exe". //
// - For star splits, you must indicate the amount of stars needed in //
// brackets or parentheses like this: "[20]" or "(20)". //
// - If a split has "Bowser" in its name but no star amount, it is //
// interpreted as a Bowser key split or a Grand Star split. //
// - If the final split has no star amount, it is interpreted as //
// a Grand Star split (i.e. after defeating the last Bowser). //
// -------------------------------------------------------------------- //
state("sm64.us.f3dex2e") {
}
init {
refreshRate = 30;
vars.splitNum = 0;
vars.splitPtr = 0;
byte[] buffer = memory.ReadBytes(modules.First().BaseAddress, modules.First().ModuleMemorySize);
for (int i = 0; i != -1;) {
i = Array.IndexOf(buffer, (byte) 0x4F, i + 1);
if (buffer[i + 0x1] == 0x4D &&
buffer[i + 0x2] == 0x4D &&
buffer[i + 0x3] == 0x41 &&
buffer[i + 0x4] == 0x55 &&
buffer[i + 0x5] == 0x54 &&
buffer[i + 0x6] == 0x4F &&
buffer[i + 0x7] == 0x53 &&
buffer[i + 0x8] == 0x50 &&
buffer[i + 0x9] == 0x4C &&
buffer[i + 0xA] == 0x49 &&
buffer[i + 0xB] == 0x54) {
vars.splitPtr = i + 0xC;
break;
}
}
}
start {
if (memory.ReadValue<int>((IntPtr) ((long) modules.First().BaseAddress + (long) vars.splitPtr)) == -2) {
vars.splitNum = 0;
return true;
}
return false;
}
split {
int curSplitNum = memory.ReadValue<int>((IntPtr) ((long) modules.First().BaseAddress + (long) vars.splitPtr));
if (curSplitNum > vars.splitNum) {
vars.splitNum = curSplitNum;
return true;
}
return false;
}
reset {
if (memory.ReadValue<int>((IntPtr) ((long) modules.First().BaseAddress + (long) vars.splitPtr)) == -1) {
vars.splitNum = 0;
return true;
}
return false;
}