diff options
Diffstat (limited to 'Manifold Garden.asl')
-rw-r--r-- | Manifold Garden.asl | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/Manifold Garden.asl b/Manifold Garden.asl index c076972..3968955 100644 --- a/Manifold Garden.asl +++ b/Manifold Garden.asl | |||
@@ -29,6 +29,15 @@ | |||
29 | state("ManifoldGarden") {} | 29 | state("ManifoldGarden") {} |
30 | 30 | ||
31 | startup { | 31 | startup { |
32 | // Relative to Livesplit.exe | ||
33 | vars.logFilePath = Directory.GetCurrentDirectory() + "\\autosplitter_manifold.log"; | ||
34 | vars.log = (Action<string>)((string logLine) => { | ||
35 | print("[Manifold Garden ASL] " + logLine); | ||
36 | string time = System.DateTime.Now.ToString("dd/MM/yy hh:mm:ss.fff"); | ||
37 | // AppendAllText will create the file if it doesn't exist. | ||
38 | System.IO.File.AppendAllText(vars.logFilePath, time + ": " + logLine + "\r\n"); | ||
39 | }); | ||
40 | |||
32 | var bytes = File.ReadAllBytes(@"Components\LiveSplit.ASLHelper.bin"); | 41 | var bytes = File.ReadAllBytes(@"Components\LiveSplit.ASLHelper.bin"); |
33 | var type = Assembly.Load(bytes).GetType("ASLHelper.Unity"); | 42 | var type = Assembly.Load(bytes).GetType("ASLHelper.Unity"); |
34 | vars.Helper = Activator.CreateInstance(type, timer, this); | 43 | vars.Helper = Activator.CreateInstance(type, timer, this); |
@@ -105,12 +114,12 @@ startup { | |||
105 | var findConfigFiles = (Action<string>)((string folder) => { | 114 | var findConfigFiles = (Action<string>)((string folder) => { |
106 | var files = new List<string>(); | 115 | var files = new List<string>(); |
107 | if (folder != null) { | 116 | if (folder != null) { |
108 | print("Searching for config files in '" + folder + "'"); | 117 | vars.log("Searching for config files in '" + folder + "'"); |
109 | files.AddRange(System.IO.Directory.GetFiles(folder, "*.mg_config")); | 118 | files.AddRange(System.IO.Directory.GetFiles(folder, "*.mg_config")); |
110 | files.AddRange(System.IO.Directory.GetFiles(folder, "*.mg_config.txt")); | 119 | files.AddRange(System.IO.Directory.GetFiles(folder, "*.mg_config.txt")); |
111 | files.AddRange(System.IO.Directory.GetFiles(folder, "*.mg_conf")); | 120 | files.AddRange(System.IO.Directory.GetFiles(folder, "*.mg_conf")); |
112 | files.AddRange(System.IO.Directory.GetFiles(folder, "*.mg_confi")); | 121 | files.AddRange(System.IO.Directory.GetFiles(folder, "*.mg_confi")); |
113 | print("Found " + files.Count + " config files"); | 122 | vars.log("Found " + files.Count + " config files"); |
114 | } | 123 | } |
115 | 124 | ||
116 | // Only add the parent setting the first time we call this function | 125 | // Only add the parent setting the first time we call this function |
@@ -132,6 +141,8 @@ startup { | |||
132 | findConfigFiles(System.IO.Path.GetDirectoryName(timer.Layout.FilePath)); | 141 | findConfigFiles(System.IO.Path.GetDirectoryName(timer.Layout.FilePath)); |
133 | // Search for config files relative to the current splits | 142 | // Search for config files relative to the current splits |
134 | findConfigFiles(System.IO.Path.GetDirectoryName(timer.Run.FilePath)); | 143 | findConfigFiles(System.IO.Path.GetDirectoryName(timer.Run.FilePath)); |
144 | |||
145 | vars.log("Autosplitter loaded"); | ||
135 | } | 146 | } |
136 | 147 | ||
137 | init { | 148 | init { |
@@ -159,8 +170,8 @@ init { | |||
159 | if (settings[configFile]) { | 170 | if (settings[configFile]) { |
160 | // Full path is saved in the dictionary. | 171 | // Full path is saved in the dictionary. |
161 | vars.configWaypoints = System.IO.File.ReadAllLines(vars.configFiles[configFile]); | 172 | vars.configWaypoints = System.IO.File.ReadAllLines(vars.configFiles[configFile]); |
162 | print("Selected config file: " + configFile); | 173 | vars.log("Selected config file: " + configFile); |
163 | print("Config contains " + vars.configWaypoints.Length + " lines"); | 174 | vars.log("Config contains " + vars.configWaypoints.Length + " lines"); |
164 | break; | 175 | break; |
165 | } | 176 | } |
166 | } | 177 | } |
@@ -176,7 +187,7 @@ update { | |||
176 | 187 | ||
177 | if (!vars.doneFirstLook) { | 188 | if (!vars.doneFirstLook) { |
178 | vars.doneFirstLook = true; | 189 | vars.doneFirstLook = true; |
179 | print(String.Format("Connected to Manifold Garden version {0}", vars.Helper["version"].Current)); | 190 | vars.log(String.Format("Connected to Manifold Garden version {0}", vars.Helper["version"].Current)); |
180 | 191 | ||
181 | current.onStartScreen = vars.startScreens.Contains(vars.Helper.Scenes.Active.Name); | 192 | current.onStartScreen = vars.startScreens.Contains(vars.Helper.Scenes.Active.Name); |
182 | 193 | ||
@@ -208,25 +219,24 @@ start { | |||
208 | // moment you click a save slot to start a new game in, although it will | 219 | // moment you click a save slot to start a new game in, although it will |
209 | // also start if you just load a file). This boolean is set to true during | 220 | // also start if you just load a file). This boolean is set to true during |
210 | // the studio logo when the game starts up, so we check for that as well. | 221 | // the studio logo when the game starts up, so we check for that as well. |
211 | return (vars.studioScreenDone && current.isLoadingGameFromUI); | 222 | if (vars.studioScreenDone && current.isLoadingGameFromUI) { |
212 | } | 223 | vars.log("START based on file load"); |
213 | 224 | if (settings["zero"]) { | |
214 | onStart { | 225 | vars.waypoints = vars.zeroPercentPoints; |
215 | print("START based on file load"); | 226 | } else if (settings["allGodCubes"]) { |
216 | if (settings["zero"]) { | 227 | vars.waypoints = vars.mandalaScenes; |
217 | vars.waypoints = vars.zeroPercentPoints; | 228 | } else if (settings["configs"] && vars.configWaypoints != null) { |
218 | } else if (settings["allGodCubes"]) { | 229 | vars.waypoints = new List<string>(vars.configWaypoints); |
219 | vars.waypoints = vars.mandalaScenes; | 230 | } else { |
220 | } else if (settings["configs"] && vars.configWaypoints != null) { | 231 | vars.waypoints = null; |
221 | vars.waypoints = new List<string>(vars.configWaypoints); | 232 | } |
222 | } else { | 233 | vars.prevLevel = current.level; |
223 | vars.waypoints = null; | 234 | vars.stopwatch = Stopwatch.StartNew(); |
235 | vars.prev.Clear(); | ||
236 | vars.firstRoom = false; | ||
237 | vars.inEnding = false; | ||
238 | return true; | ||
224 | } | 239 | } |
225 | vars.prevLevel = current.level; | ||
226 | vars.stopwatch = Stopwatch.StartNew(); | ||
227 | vars.prev.Clear(); | ||
228 | vars.firstRoom = false; | ||
229 | vars.inEnding = false; | ||
230 | } | 240 | } |
231 | 241 | ||
232 | split { | 242 | split { |
@@ -237,7 +247,7 @@ split { | |||
237 | && current.level != vars.prevLevel | 247 | && current.level != vars.prevLevel |
238 | && current.level > 0 | 248 | && current.level > 0 |
239 | && !vars.noSplitScenes.Contains(vars.Helper.Scenes.Active.Name)) { | 249 | && !vars.noSplitScenes.Contains(vars.Helper.Scenes.Active.Name)) { |
240 | print(String.Format("{0}: '{1}'", current.level, vars.Helper.Scenes.Active.Name)); | 250 | vars.log(String.Format("{0}: '{1}'", current.level, vars.Helper.Scenes.Active.Name)); |
241 | 251 | ||
242 | string action = "NO SPLIT"; | 252 | string action = "NO SPLIT"; |
243 | 253 | ||
@@ -260,7 +270,7 @@ split { | |||
260 | vars.prev.Add(current.level); | 270 | vars.prev.Add(current.level); |
261 | } | 271 | } |
262 | 272 | ||
263 | print(String.Format("Level changed from {0} to {1}: {2}", vars.prevLevel, current.level, action)); | 273 | vars.log(String.Format("Level changed from {0} to {1}: {2}", vars.prevLevel, current.level, action)); |
264 | } | 274 | } |
265 | 275 | ||
266 | if (vars.endings.Contains(vars.Helper.Scenes.Active.Name)) { | 276 | if (vars.endings.Contains(vars.Helper.Scenes.Active.Name)) { |
@@ -282,7 +292,7 @@ split { | |||
282 | && vars.inEnding | 292 | && vars.inEnding |
283 | && vars.stopwatch != null | 293 | && vars.stopwatch != null |
284 | && vars.stopwatch.ElapsedMilliseconds >= 1100) { | 294 | && vars.stopwatch.ElapsedMilliseconds >= 1100) { |
285 | print("SPLIT on Raymarchitecture"); | 295 | vars.log("SPLIT on Raymarchitecture"); |
286 | vars.stopwatch = null; | 296 | vars.stopwatch = null; |
287 | return true; | 297 | return true; |
288 | } | 298 | } |