about summary refs log tree commit diff stats
path: root/Lingo 2.asl
diff options
context:
space:
mode:
Diffstat (limited to 'Lingo 2.asl')
-rw-r--r--Lingo 2.asl80
1 files changed, 66 insertions, 14 deletions
diff --git a/Lingo 2.asl b/Lingo 2.asl index 9c59387..6616ac8 100644 --- a/Lingo 2.asl +++ b/Lingo 2.asl
@@ -26,9 +26,11 @@ startup
26 settings.Add("graves", false, "Split on completing a gravestone"); 26 settings.Add("graves", false, "Split on completing a gravestone");
27 settings.Add("masteries", false, "Split on collecting a mastery"); 27 settings.Add("masteries", false, "Split on collecting a mastery");
28 28
29 vars.prevPanelMap = ""; 29 vars.prevPanel = null;
30 vars.prevPanelPath = ""; 30 vars.lastPanel = null;
31 vars.solvedPanels = new HashSet<string>();
31 vars.prevMap = ""; 32 vars.prevMap = "";
33 vars.visitedMaps = new HashSet<string>();
32 vars.collectedKeys = new HashSet<string>(); 34 vars.collectedKeys = new HashSet<string>();
33 vars.latestKeyKey = null; 35 vars.latestKeyKey = null;
34 36
@@ -48,14 +50,17 @@ init
48 // [94-134]: Map name of latest solved panel (null terminated, truncated at 40 chars excluding null) 50 // [94-134]: Map name of latest solved panel (null terminated, truncated at 40 chars excluding null)
49 // [135-235]: Full nodepath of latest solved panel (null terminated, truncated at 100 chars excluding null) 51 // [135-235]: Full nodepath of latest solved panel (null terminated, truncated at 100 chars excluding null)
50 IntPtr ptr = IntPtr.Zero; 52 IntPtr ptr = IntPtr.Zero;
51 foreach (var page in game.MemoryPages(true).Reverse()) { 53 foreach (var page in game.MemoryPages(true).Reverse())
54 {
52 var scanner = new SignatureScanner(game, page.BaseAddress, (int)page.RegionSize); 55 var scanner = new SignatureScanner(game, page.BaseAddress, (int)page.RegionSize);
53 ptr = scanner.Scan(new SigScanTarget(0, "9c 46 9f b0 4b 6a e0 8d")); 56 ptr = scanner.Scan(new SigScanTarget(0, "9c 46 9f b0 4b 6a e0 8d"));
54 if (ptr != IntPtr.Zero) { 57 if (ptr != IntPtr.Zero)
58 {
55 break; 59 break;
56 } 60 }
57 } 61 }
58 if (ptr == IntPtr.Zero) { 62 if (ptr == IntPtr.Zero)
63 {
59 throw new Exception("Could not find magic autosplitter array!"); 64 throw new Exception("Could not find magic autosplitter array!");
60 } 65 }
61 vars.loading = new MemoryWatcher<byte>(ptr + 8); 66 vars.loading = new MemoryWatcher<byte>(ptr + 8);
@@ -81,6 +86,11 @@ update
81 vars.lastPanelMap.Update(game); 86 vars.lastPanelMap.Update(game);
82 vars.lastPanelPath.Update(game); 87 vars.lastPanelPath.Update(game);
83 88
89 if (vars.lastPanelMap.Current != "")
90 {
91 vars.lastPanel = string.Format("{0}/{1}", vars.lastPanelMap.Current, vars.lastPanelPath.Current);
92 }
93
84 if (vars.latestKeyLevel.Current > 0) 94 if (vars.latestKeyLevel.Current > 0)
85 { 95 {
86 vars.latestKeyKey = string.Format("{0}{1}", (char)vars.latestKey.Current, vars.latestKeyLevel.Current); 96 vars.latestKeyKey = string.Format("{0}{1}", (char)vars.latestKey.Current, vars.latestKeyLevel.Current);
@@ -94,9 +104,14 @@ start
94 104
95onStart 105onStart
96{ 106{
97 vars.prevPanelMap = vars.lastPanelMap.Current; 107 vars.prevPanel = vars.lastPanel;
98 vars.prevPanelPath = vars.lastPanelPath.Current;
99 vars.prevMap = vars.currentMap.Current; 108 vars.prevMap = vars.currentMap.Current;
109 vars.lastPanel = null;
110 vars.solvedPanels.Clear();
111 vars.visitedMaps.Clear();
112 vars.visitedMaps.Add(vars.currentMap.Current);
113 vars.collectedKeys.Clear();
114 vars.latestKeyKey = null;
100} 115}
101 116
102reset 117reset
@@ -113,19 +128,55 @@ split
113{ 128{
114 bool should_split = false; 129 bool should_split = false;
115 130
116 if (vars.lastPanelMap.Current != vars.prevPanelMap || vars.lastPanelPath.Current != vars.prevPanelPath) { 131 if (vars.lastPanel != vars.prevPanel)
117 if (settings["panels"]) { 132 {
133 if (settings["panels"])
134 {
118 should_split = true; 135 should_split = true;
119 vars.log("Split on any panel: " + vars.lastPanelMap.Current + " / " + vars.lastPanelPath.Current);
120 } 136 }
121 137
122 vars.prevPanelMap = vars.lastPanelMap.Current; 138 if (settings["panels_first"])
123 vars.prevPanelPath = vars.lastPanelPath.Current; 139 {
140 if (vars.solvedPanels.Contains(vars.lastPanel))
141 {
142 should_split = false;
143 vars.log("Already solved panel: " + vars.lastPanel);
144 }
145 else
146 {
147 vars.solvedPanels.Add(vars.lastPanel);
148 }
149 }
150
151 if (should_split)
152 {
153 vars.log("Split on panel: " + vars.lastPanel);
154 }
155
156 vars.prevPanel = vars.lastPanel;
124 } 157 }
125 else if (vars.currentMap.Current != vars.prevMap) 158 else if (vars.currentMap.Current != vars.prevMap)
126 { 159 {
127 if (settings["maps"]) { 160 if (settings["maps"])
161 {
128 should_split = true; 162 should_split = true;
163 }
164
165 if (settings["maps_first"])
166 {
167 if (vars.visitedMaps.Contains(vars.currentMap.Current))
168 {
169 should_split = false;
170 vars.log("Already visited map: " + vars.currentMap.Current);
171 }
172 else
173 {
174 vars.visitedMaps.Add(vars.currentMap.Current);
175 }
176 }
177
178 if (should_split)
179 {
129 vars.log("Split on map change: " + vars.currentMap.Current); 180 vars.log("Split on map change: " + vars.currentMap.Current);
130 } 181 }
131 182
@@ -133,7 +184,8 @@ split
133 } 184 }
134 else if (vars.latestKeyKey != null && !vars.collectedKeys.Contains(vars.latestKeyKey)) 185 else if (vars.latestKeyKey != null && !vars.collectedKeys.Contains(vars.latestKeyKey))
135 { 186 {
136 if (settings["keys"]) { 187 if (settings["keys"])
188 {
137 should_split = true; 189 should_split = true;
138 vars.log("Split on collected key: " + vars.latestKeyKey); 190 vars.log("Split on collected key: " + vars.latestKeyKey);
139 } 191 }