diff options
-rw-r--r-- | Manifold Garden.asl | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/Manifold Garden.asl b/Manifold Garden.asl new file mode 100644 index 0000000..227656e --- /dev/null +++ b/Manifold Garden.asl | |||
@@ -0,0 +1,143 @@ | |||
1 | // AutoSplit script for Manifold Garden 1.0.30.14704 | ||
2 | // | ||
3 | // Written by hatkirby, with a lot of help from preshing and Gelly. | ||
4 | // | ||
5 | // Automatically starts the timer ~2.4 seconds after starting a new game, and splits the timer | ||
6 | // when transitioning between game levels. You must still reset the timer manually between runs. | ||
7 | // If you accidentally backtrack through a portal, causing an unwanted split, you'll have | ||
8 | // to undo it manually (default NumPad8 in LiveSplit). | ||
9 | // | ||
10 | // To compensate for the late start, you should delay your start timer by 2.4 seconds in LiveSplit. | ||
11 | // (Right-click -> Edit Splits -> Start timer at:) | ||
12 | // | ||
13 | // A split is also triggered after being in one of the ending cutscenes for 1.1 seconds, | ||
14 | // since this is when the kaleidoscope appears. | ||
15 | // | ||
16 | // If you check "All God Cubes waypoints" in the script's Advanced settings (below), the script | ||
17 | // will only split at mandala scenes. This is useful when running "All God Cubes" categories. | ||
18 | // | ||
19 | // The pointer path to the current level often changes when a new version of Manifold Garden is | ||
20 | // released. When that happens, a new pointer path must be found using CheatEngine. If the | ||
21 | // current pointer path stops working (even for a frame or two), a message is logged to the | ||
22 | // debug output. | ||
23 | // | ||
24 | // To view debug output (print statements from this script), use DebugView: | ||
25 | // https://technet.microsoft.com/en-us/Library/bb896647.aspx | ||
26 | |||
27 | state("ManifoldGarden") { | ||
28 | // This pointer path seems to work with Manifold Garden 1.1.0.14704 (2020-11-09): | ||
29 | int level: "UnityPlayer.dll", 0x01800AB8, 0x10, 0xB8, 0x10, 0x28, 0x18, 0x60, 0x7CC; | ||
30 | |||
31 | // This pointer path seems to work with Manifold Garden 1.0.30.13294 (2020-02-25): | ||
32 | //int level: "UnityPlayer.dll", 0x014BE300, 0x60, 0xA8, 0x38, 0x30, 0xB0, 0x118, 0x5C; | ||
33 | |||
34 | // These ones also seem to work with version 13294, and can be tried as backups in case | ||
35 | // the one above stops working: | ||
36 | //int level: "UnityPlayer.dll", 0x01552858, 0x8, 0x0, 0xB8, 0x80, 0x80, 0x28, 0x5C; | ||
37 | //int level: "UnityPlayer.dll", 0x01552858, 0x28, 0x8, 0xB8, 0x80, 0x80, 0x28, 0x5C; | ||
38 | |||
39 | // This pointer path worked with Manifold Garden 1.0.29.12904 (2020-02-??) | ||
40 | // & Manifold Garden 1.0.29.12830 (2019-12-18) | ||
41 | // & Manifold Garden 1.0.29.12781 (2019-12-11): | ||
42 | //int level: "UnityPlayer.dll", 0x01507BE0, 0x0, 0x928, 0x38, 0x30, 0xB0, 0x118, 0x5C; | ||
43 | |||
44 | // This pointer path worked with older versions: | ||
45 | //int level: "UnityPlayer.dll", 0x01507C68, 0x8, 0x38, 0xA8, 0x58, 0x118, 0x5C; | ||
46 | } | ||
47 | |||
48 | startup { | ||
49 | settings.Add("allGodCubes", false, "All God Cubes waypoints"); | ||
50 | settings.Add("zero", false, "Zero% waypoints"); | ||
51 | settings.Add("norepeats",false,"Split only on the first encounter of each level"); | ||
52 | vars.waypoints = null; | ||
53 | vars.prevLevel = 0; | ||
54 | vars.seqIndex = 0; | ||
55 | vars.stopwatch = null; // Used for the final split | ||
56 | vars.prev = new List<int>(); | ||
57 | vars.prev.Add(9); | ||
58 | } | ||
59 | |||
60 | init { | ||
61 | print(String.Format("**** AUTOSPLIT: Game found, pointer path {0} ****", | ||
62 | current.level == 0 ? "DOESN'T work (this is normal at startup)" : "works")); | ||
63 | } | ||
64 | |||
65 | update { | ||
66 | // Log a message when the pointer path starts/stops working: | ||
67 | if (current.level == 0 && old.level != 0) { | ||
68 | print("**** AUTOSPLIT: Pointer path STOPPED working ****"); | ||
69 | } else if (current.level != 0 && old.level == 0) { | ||
70 | print("**** AUTOSPLIT: Pointer path STARTED working ****"); | ||
71 | } | ||
72 | } | ||
73 | |||
74 | start { | ||
75 | if (old.level == -1 && current.level == 9) { | ||
76 | print(String.Format("Level changed from {0} to {1}: START", old.level, current.level)); | ||
77 | if (settings["zero"]) { | ||
78 | vars.waypoints = new List<int>{106, 17, 110, 115, 111, 36, 44}; | ||
79 | } else { | ||
80 | vars.waypoints = null; | ||
81 | } | ||
82 | vars.prevLevel = 9; | ||
83 | vars.seqIndex = 0; | ||
84 | vars.stopwatch = Stopwatch.StartNew(); | ||
85 | vars.prev.Clear(); | ||
86 | vars.prev.Add(current.level); | ||
87 | return true; | ||
88 | } | ||
89 | } | ||
90 | |||
91 | split { | ||
92 | // Split when level index changes, but avoid splitting during a loading screen | ||
93 | // or when the pointer path stops working: | ||
94 | if (current.level != vars.prevLevel && current.level >= 0) { | ||
95 | string action = "NO SPLIT"; | ||
96 | |||
97 | // Ignore the split rules when script is reloaded mid-game: | ||
98 | if (vars.prevLevel != 0) { | ||
99 | // Split rules: | ||
100 | if (vars.waypoints == null) { | ||
101 | if (settings["allGodCubes"]) { | ||
102 | if (current.level >= 82 && current.level <= 88) { | ||
103 | action = "SPLIT"; | ||
104 | } | ||
105 | } else { | ||
106 | action = "SPLIT"; | ||
107 | } | ||
108 | } else if (vars.seqIndex < vars.waypoints.Count) { | ||
109 | if (current.level == vars.waypoints[vars.seqIndex]) { | ||
110 | vars.seqIndex++; | ||
111 | action = String.Format("SPLIT (new seqIndex = {0})", vars.seqIndex); | ||
112 | } else { | ||
113 | action = String.Format("NO SPLIT (seqIndex = {0}, {1} expected)", | ||
114 | vars.seqIndex, vars.waypoints[vars.seqIndex]); | ||
115 | } | ||
116 | } else { | ||
117 | action = String.Format("NO SPLIT (seqIndex = {0}, end of waypoint sequence)", vars.seqIndex); | ||
118 | } | ||
119 | |||
120 | print(String.Format("Level changed from {0} to {1}: {2}", vars.prevLevel, current.level, action)); | ||
121 | |||
122 | if (settings["norepeats"]) { | ||
123 | if (vars.prev.Contains(current.level)) { | ||
124 | action = "NO SPLIT"; | ||
125 | } | ||
126 | vars.prev.Add(current.level); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | vars.prevLevel = current.level; | ||
131 | vars.stopwatch = Stopwatch.StartNew(); | ||
132 | return action.StartsWith("SPLIT"); | ||
133 | } | ||
134 | |||
135 | // Final split of the game: | ||
136 | // Split after being in one of the ending cutscenes for 1.1 seconds. | ||
137 | if ((current.level == 99 || current.level == 103 || current.level == 104) | ||
138 | && vars.stopwatch != null | ||
139 | && vars.stopwatch.ElapsedMilliseconds >= 1100) { | ||
140 | vars.stopwatch = null; | ||
141 | return true; | ||
142 | } | ||
143 | } | ||