summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2020-01-27 21:35:50 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2020-01-27 21:35:50 -0800
commite77cfa1596f996cc50c1601ee29891a7fb7eb62d (patch)
tree55f7c84099c3995954729bb32ff945c69e0fe78a
parent38060c54f9f923d49b019fcf90f3494fd5469b74 (diff)
downloadwitness-tutorializer-e77cfa1596f996cc50c1601ee29891a7fb7eb62d.tar.gz
witness-tutorializer-e77cfa1596f996cc50c1601ee29891a7fb7eb62d.tar.bz2
witness-tutorializer-e77cfa1596f996cc50c1601ee29891a7fb7eb62d.zip
Clean up globals to be more dynamic
-rw-r--r--Source/Memory.cpp171
-rw-r--r--Source/Memory.h144
2 files changed, 168 insertions, 147 deletions
diff --git a/Source/Memory.cpp b/Source/Memory.cpp index 3121d20..4a4cb63 100644 --- a/Source/Memory.cpp +++ b/Source/Memory.cpp
@@ -50,11 +50,16 @@ void Memory::Heartbeat(HWND window, WPARAM wParam) {
50 return; 50 return;
51 } 51 }
52 52
53#if GLOBALS == 0x5B28C0 53 int currentFrame = 0;
54 int currentFrame = ReadData<int>({0x5BE3B0}, 1)[0]; 54 if (GLOBALS == 0x5B28C0) {
55#elif GLOBALS == 0x62D0A0 55 int currentFrame = ReadData<int>({0x5BE3B0}, 1)[0];
56 int currentFrame = ReadData<int>({0x63954C}, 1)[0]; 56 } else if (GLOBALS == 0x62D0A0) {
57#endif 57 int currentFrame = ReadData<int>({0x63954C}, 1)[0];
58 } else {
59 assert(false);
60 return;
61 }
62
58 int frameDelta = currentFrame - _previousFrame; 63 int frameDelta = currentFrame - _previousFrame;
59 _previousFrame = currentFrame; 64 _previousFrame = currentFrame;
60 if (frameDelta < 0 && currentFrame < 250) { 65 if (frameDelta < 0 && currentFrame < 250) {
@@ -105,6 +110,7 @@ bool Memory::Initialize() {
105 return false; 110 return false;
106 } 111 }
107 112
113 LoadPanelOffsets();
108 return true; 114 return true;
109} 115}
110 116
@@ -180,3 +186,158 @@ void* Memory::ComputeOffset(std::vector<int> offsets) {
180 } 186 }
181 return reinterpret_cast<void*>(cumulativeAddress + final_offset); 187 return reinterpret_cast<void*>(cumulativeAddress + final_offset);
182} 188}
189
190int GLOBALS, POSITION, ORIENTATION, PATH_COLOR, REFLECTION_PATH_COLOR, DOT_COLOR, ACTIVE_COLOR, BACKGROUND_REGION_COLOR, SUCCESS_COLOR_A, SUCCESS_COLOR_B, STROBE_COLOR_A, STROBE_COLOR_B, ERROR_COLOR, PATTERN_POINT_COLOR, PATTERN_POINT_COLOR_A, PATTERN_POINT_COLOR_B, SYMBOL_A, SYMBOL_B, SYMBOL_C, SYMBOL_D, SYMBOL_E, PUSH_SYMBOL_COLORS, OUTER_BACKGROUND, OUTER_BACKGROUND_MODE, TRACED_EDGES, AUDIO_PREFIX, POWER, TARGET, POWER_OFF_ON_FAIL, IS_CYLINDER, CYLINDER_Z0, CYLINDER_Z1, CYLINDER_RADIUS, CURSOR_SPEED_SCALE, NEEDS_REDRAW, SPECULAR_ADD, SPECULAR_POWER, PATH_WIDTH_SCALE, STARTPOINT_SCALE, NUM_DOTS, NUM_CONNECTIONS, MAX_BROADCAST_DISTANCE, DOT_POSITIONS, DOT_FLAGS, DOT_CONNECTION_A, DOT_CONNECTION_B, DECORATIONS, DECORATION_FLAGS, DECORATION_COLORS, NUM_DECORATIONS, REFLECTION_DATA, GRID_SIZE_X, GRID_SIZE_Y, STYLE_FLAGS, SEQUENCE_LEN, SEQUENCE, DOT_SEQUENCE_LEN, DOT_SEQUENCE, DOT_SEQUENCE_LEN_REFLECTION, DOT_SEQUENCE_REFLECTION, NUM_COLORED_REGIONS, COLORED_REGIONS, PANEL_TARGET, SPECULAR_TEXTURE, CABLE_TARGET_2, AUDIO_LOG_NAME, OPEN_RATE, METADATA, HOTEL_EP_NAME;
191
192void Memory::LoadPanelOffsets() {
193 AddSigScan({0x74, 0x41, 0x48, 0x85, 0xC0, 0x74, 0x04, 0x48, 0x8B, 0x48, 0x10}, [sharedThis = shared_from_this()](int index){
194 // (address of next line) + (value at index)
195 GLOBALS = index + 0x14 + 0x4 + sharedThis->ReadData<int>({index+0x14}, 1)[0];
196 });
197 ExecuteSigScans();
198
199 if (GLOBALS == 0x5B28C0) {
200 POSITION = 0x24;
201 ORIENTATION = 0x34;
202 PATH_COLOR = 0xC8;
203 REFLECTION_PATH_COLOR = 0xD8;
204 DOT_COLOR = 0xF8;
205 ACTIVE_COLOR = 0x108;
206 BACKGROUND_REGION_COLOR = 0x118;
207 SUCCESS_COLOR_A = 0x128;
208 SUCCESS_COLOR_B = 0x138;
209 STROBE_COLOR_A = 0x148;
210 STROBE_COLOR_B = 0x158;
211 ERROR_COLOR = 0x168;
212 PATTERN_POINT_COLOR = 0x188;
213 PATTERN_POINT_COLOR_A = 0x198;
214 PATTERN_POINT_COLOR_B = 0x1A8;
215 SYMBOL_A = 0x1B8;
216 SYMBOL_B = 0x1C8;
217 SYMBOL_C = 0x1D8;
218 SYMBOL_D = 0x1E8;
219 SYMBOL_E = 0x1F8;
220 PUSH_SYMBOL_COLORS = 0x208;
221 OUTER_BACKGROUND = 0x20C;
222 OUTER_BACKGROUND_MODE = 0x21C;
223 TRACED_EDGES = 0x230;
224 AUDIO_PREFIX = 0x278;
225 POWER = 0x2A8;
226 TARGET = 0x2BC;
227 POWER_OFF_ON_FAIL = 0x2C0;
228 IS_CYLINDER = 0x2FC;
229 CYLINDER_Z0 = 0x300;
230 CYLINDER_Z1 = 0x304;
231 CYLINDER_RADIUS = 0x308;
232 CURSOR_SPEED_SCALE = 0x358;
233 NEEDS_REDRAW = 0x384;
234 SPECULAR_ADD = 0x398;
235 SPECULAR_POWER = 0x39C;
236 PATH_WIDTH_SCALE = 0x3A4;
237 STARTPOINT_SCALE = 0x3A8;
238 NUM_DOTS = 0x3B8;
239 NUM_CONNECTIONS = 0x3BC;
240 MAX_BROADCAST_DISTANCE = 0x3C0;
241 DOT_POSITIONS = 0x3C8;
242 DOT_FLAGS = 0x3D0;
243 DOT_CONNECTION_A = 0x3D8;
244 DOT_CONNECTION_B = 0x3E0;
245 DECORATIONS = 0x420;
246 DECORATION_FLAGS = 0x428;
247 DECORATION_COLORS = 0x430;
248 NUM_DECORATIONS = 0x438;
249 REFLECTION_DATA = 0x440;
250 GRID_SIZE_X = 0x448;
251 GRID_SIZE_Y = 0x44C;
252 STYLE_FLAGS = 0x450;
253 SEQUENCE_LEN = 0x45C;
254 SEQUENCE = 0x460;
255 DOT_SEQUENCE_LEN = 0x468;
256 DOT_SEQUENCE = 0x470;
257 DOT_SEQUENCE_LEN_REFLECTION = 0x478;
258 DOT_SEQUENCE_REFLECTION = 0x480;
259 NUM_COLORED_REGIONS = 0x4A0;
260 COLORED_REGIONS = 0x4A8;
261 PANEL_TARGET = 0x4B0;
262 SPECULAR_TEXTURE = 0x4D8;
263 CABLE_TARGET_2 = 0xD8;
264 AUDIO_LOG_NAME = 0xC8;
265 OPEN_RATE = 0xE8;
266 METADATA = 0xF2; // sizeof(short)
267 HOTEL_EP_NAME = 0x4BC640;
268 } else if (GLOBALS == 0x62B0A0) {
269 // TODO:
270 } else if (GLOBALS == 0x62D0A0) {
271 POSITION = 0x24;
272 ORIENTATION = 0x34;
273 PATH_COLOR = 0xC0;
274 REFLECTION_PATH_COLOR = 0xD0;
275 DOT_COLOR = 0xF0;
276 ACTIVE_COLOR = 0x100;
277 BACKGROUND_REGION_COLOR = 0x110;
278 SUCCESS_COLOR_A = 0x120;
279 SUCCESS_COLOR_B = 0x130;
280 STROBE_COLOR_A = 0x140;
281 STROBE_COLOR_B = 0x150;
282 ERROR_COLOR = 0x160;
283 PATTERN_POINT_COLOR = 0x180;
284 PATTERN_POINT_COLOR_A = 0x190;
285 PATTERN_POINT_COLOR_B = 0x1A0;
286 SYMBOL_A = 0x1B0;
287 SYMBOL_B = 0x1C0;
288 SYMBOL_C = 0x1D0;
289 SYMBOL_D = 0x1E0;
290 SYMBOL_E = 0x1F0;
291 PUSH_SYMBOL_COLORS = 0x200;
292 OUTER_BACKGROUND = 0x204;
293 OUTER_BACKGROUND_MODE = 0x214;
294 TRACED_EDGES = 0x228;
295 AUDIO_PREFIX = 0x270;
296 POWER = 0x2A0;
297 TARGET = 0x2B4;
298 POWER_OFF_ON_FAIL = 0x2B8;
299 IS_CYLINDER = 0x2F4;
300 CYLINDER_Z0 = 0x2F8;
301 CYLINDER_Z1 = 0x2FC;
302 CYLINDER_RADIUS = 0x300;
303 CURSOR_SPEED_SCALE = 0x350;
304 NEEDS_REDRAW = 0x37C;
305 SPECULAR_ADD = 0x38C;
306 SPECULAR_POWER = 0x390;
307 PATH_WIDTH_SCALE = 0x39C;
308 STARTPOINT_SCALE = 0x3A0;
309 NUM_DOTS = 0x3B4;
310 NUM_CONNECTIONS = 0x3B8;
311 MAX_BROADCAST_DISTANCE = 0x3BC;
312 DOT_POSITIONS = 0x3C0;
313 DOT_FLAGS = 0x3C8;
314 DOT_CONNECTION_A = 0x3D0;
315 DOT_CONNECTION_B = 0x3D8;
316 DECORATIONS = 0x418;
317 DECORATION_FLAGS = 0x420;
318 DECORATION_COLORS = 0x428;
319 NUM_DECORATIONS = 0x430;
320 REFLECTION_DATA = 0x438;
321 GRID_SIZE_X = 0x440;
322 GRID_SIZE_Y = 0x444;
323 STYLE_FLAGS = 0x448;
324 SEQUENCE_LEN = 0x454;
325 SEQUENCE = 0x458;
326 DOT_SEQUENCE_LEN = 0x460;
327 DOT_SEQUENCE = 0x468;
328 DOT_SEQUENCE_LEN_REFLECTION = 0x470;
329 DOT_SEQUENCE_REFLECTION = 0x478;
330 NUM_COLORED_REGIONS = 0x498;
331 COLORED_REGIONS = 0x4A0;
332 PANEL_TARGET = 0x4A8;
333 SPECULAR_TEXTURE = 0x4D0;
334 CABLE_TARGET_2 = 0xD0;
335 AUDIO_LOG_NAME = 0x0;
336 OPEN_RATE = 0xE0;
337 METADATA = 0x13A; // sizeof(short)
338 HOTEL_EP_NAME = 0x51E340;
339 } else {
340 assert(false);
341 return;
342 }
343} \ No newline at end of file
diff --git a/Source/Memory.h b/Source/Memory.h index 82d1293..1724251 100644 --- a/Source/Memory.h +++ b/Source/Memory.h
@@ -1,7 +1,6 @@
1#pragma once 1#pragma once
2 2
3#define GLOBALS 0x5B28C0 3extern int GLOBALS, POSITION, ORIENTATION, PATH_COLOR, REFLECTION_PATH_COLOR, DOT_COLOR, ACTIVE_COLOR, BACKGROUND_REGION_COLOR, SUCCESS_COLOR_A, SUCCESS_COLOR_B, STROBE_COLOR_A, STROBE_COLOR_B, ERROR_COLOR, PATTERN_POINT_COLOR, PATTERN_POINT_COLOR_A, PATTERN_POINT_COLOR_B, SYMBOL_A, SYMBOL_B, SYMBOL_C, SYMBOL_D, SYMBOL_E, PUSH_SYMBOL_COLORS, OUTER_BACKGROUND, OUTER_BACKGROUND_MODE, TRACED_EDGES, AUDIO_PREFIX, POWER, TARGET, POWER_OFF_ON_FAIL, IS_CYLINDER, CYLINDER_Z0, CYLINDER_Z1, CYLINDER_RADIUS, CURSOR_SPEED_SCALE, NEEDS_REDRAW, SPECULAR_ADD, SPECULAR_POWER, PATH_WIDTH_SCALE, STARTPOINT_SCALE, NUM_DOTS, NUM_CONNECTIONS, MAX_BROADCAST_DISTANCE, DOT_POSITIONS, DOT_FLAGS, DOT_CONNECTION_A, DOT_CONNECTION_B, DECORATIONS, DECORATION_FLAGS, DECORATION_COLORS, NUM_DECORATIONS, REFLECTION_DATA, GRID_SIZE_X, GRID_SIZE_Y, STYLE_FLAGS, SEQUENCE_LEN, SEQUENCE, DOT_SEQUENCE_LEN, DOT_SEQUENCE, DOT_SEQUENCE_LEN_REFLECTION, DOT_SEQUENCE_REFLECTION, NUM_COLORED_REGIONS, COLORED_REGIONS, PANEL_TARGET, SPECULAR_TEXTURE, CABLE_TARGET_2, AUDIO_LOG_NAME, OPEN_RATE, METADATA, HOTEL_EP_NAME;
4// #define GLOBALS 0x62D0A0
5 4
6enum class ProcStatus { 5enum class ProcStatus {
7 NotRunning, 6 NotRunning,
@@ -79,6 +78,7 @@ private:
79 void Heartbeat(HWND window, WPARAM wParam); 78 void Heartbeat(HWND window, WPARAM wParam);
80 bool Initialize(); 79 bool Initialize();
81 void* ComputeOffset(std::vector<int> offsets); 80 void* ComputeOffset(std::vector<int> offsets);
81 void LoadPanelOffsets();
82 82
83 int _previousFrame = 0; 83 int _previousFrame = 0;
84 bool _threadActive = false; 84 bool _threadActive = false;
@@ -98,143 +98,3 @@ private:
98 friend class ChallengeRandomizer; 98 friend class ChallengeRandomizer;
99 friend class Randomizer; 99 friend class Randomizer;
100}; 100};
101
102#if GLOBALS == 0x5B28C0
103#define POSITION 0x24
104#define ORIENTATION 0x34
105#define PATH_COLOR 0xC8
106#define REFLECTION_PATH_COLOR 0xD8
107#define DOT_COLOR 0xF8
108#define ACTIVE_COLOR 0x108
109#define BACKGROUND_REGION_COLOR 0x118
110#define SUCCESS_COLOR_A 0x128
111#define SUCCESS_COLOR_B 0x138
112#define STROBE_COLOR_A 0x148
113#define STROBE_COLOR_B 0x158
114#define ERROR_COLOR 0x168
115#define PATTERN_POINT_COLOR 0x188
116#define PATTERN_POINT_COLOR_A 0x198
117#define PATTERN_POINT_COLOR_B 0x1A8
118#define SYMBOL_A 0x1B8
119#define SYMBOL_B 0x1C8
120#define SYMBOL_C 0x1D8
121#define SYMBOL_D 0x1E8
122#define SYMBOL_E 0x1F8
123#define PUSH_SYMBOL_COLORS 0x208
124#define OUTER_BACKGROUND 0x20C
125#define OUTER_BACKGROUND_MODE 0x21C
126#define TRACED_EDGES 0x230
127#define AUDIO_PREFIX 0x278
128#define POWER 0x2A8
129#define TARGET 0x2BC
130#define POWER_OFF_ON_FAIL 0x2C0
131#define IS_CYLINDER 0x2FC
132#define CYLINDER_Z0 0x300
133#define CYLINDER_Z1 0x304
134#define CYLINDER_RADIUS 0x308
135#define CURSOR_SPEED_SCALE 0x358
136#define NEEDS_REDRAW 0x384
137#define SPECULAR_ADD 0x398
138#define SPECULAR_POWER 0x39C
139#define PATH_WIDTH_SCALE 0x3A4
140#define STARTPOINT_SCALE 0x3A8
141#define NUM_DOTS 0x3B8
142#define NUM_CONNECTIONS 0x3BC
143#define MAX_BROADCAST_DISTANCE 0x3C0
144#define DOT_POSITIONS 0x3C8
145#define DOT_FLAGS 0x3D0
146#define DOT_CONNECTION_A 0x3D8
147#define DOT_CONNECTION_B 0x3E0
148#define DECORATIONS 0x420
149#define DECORATION_FLAGS 0x428
150#define DECORATION_COLORS 0x430
151#define NUM_DECORATIONS 0x438
152#define REFLECTION_DATA 0x440
153#define GRID_SIZE_X 0x448
154#define GRID_SIZE_Y 0x44C
155#define STYLE_FLAGS 0x450
156#define SEQUENCE_LEN 0x45C
157#define SEQUENCE 0x460
158#define DOT_SEQUENCE_LEN 0x468
159#define DOT_SEQUENCE 0x470
160#define DOT_SEQUENCE_LEN_REFLECTION 0x478
161#define DOT_SEQUENCE_REFLECTION 0x480
162#define NUM_COLORED_REGIONS 0x4A0
163#define COLORED_REGIONS 0x4A8
164#define PANEL_TARGET 0x4B0
165#define SPECULAR_TEXTURE 0x4D8
166#define CABLE_TARGET_2 0xD8
167#define AUDIO_LOG_NAME 0xC8
168#define OPEN_RATE 0xE8
169#define METADATA 0xF2 // sizeof(short)
170#define HOTEL_EP_NAME 0x4BC640
171#elif GLOBALS == 0x62D0A0
172#define POSITION 0x24
173#define ORIENTATION 0x34
174#define PATH_COLOR 0xC0
175#define REFLECTION_PATH_COLOR 0xD0
176#define DOT_COLOR 0xF0
177#define ACTIVE_COLOR 0x100
178#define BACKGROUND_REGION_COLOR 0x110
179#define SUCCESS_COLOR_A 0x120
180#define SUCCESS_COLOR_B 0x130
181#define STROBE_COLOR_A 0x140
182#define STROBE_COLOR_B 0x150
183#define ERROR_COLOR 0x160
184#define PATTERN_POINT_COLOR 0x180
185#define PATTERN_POINT_COLOR_A 0x190
186#define PATTERN_POINT_COLOR_B 0x1A0
187#define SYMBOL_A 0x1B0
188#define SYMBOL_B 0x1C0
189#define SYMBOL_C 0x1D0
190#define SYMBOL_D 0x1E0
191#define SYMBOL_E 0x1F0
192#define PUSH_SYMBOL_COLORS 0x200
193#define OUTER_BACKGROUND 0x204
194#define OUTER_BACKGROUND_MODE 0x214
195#define TRACED_EDGES 0x228
196#define AUDIO_PREFIX 0x270
197#define POWER 0x2A0
198#define TARGET 0x2B4
199#define POWER_OFF_ON_FAIL 0x2B8
200#define IS_CYLINDER 0x2F4
201#define CYLINDER_Z0 0x2F8
202#define CYLINDER_Z1 0x2FC
203#define CYLINDER_RADIUS 0x300
204#define CURSOR_SPEED_SCALE 0x350
205#define NEEDS_REDRAW 0x37C
206#define SPECULAR_ADD 0x38C
207#define SPECULAR_POWER 0x390
208#define PATH_WIDTH_SCALE 0x39C
209#define STARTPOINT_SCALE 0x3A0
210#define NUM_DOTS 0x3B4
211#define NUM_CONNECTIONS 0x3B8
212#define MAX_BROADCAST_DISTANCE 0x3BC
213#define DOT_POSITIONS 0x3C0
214#define DOT_FLAGS 0x3C8
215#define DOT_CONNECTION_A 0x3D0
216#define DOT_CONNECTION_B 0x3D8
217#define DECORATIONS 0x418
218#define DECORATION_FLAGS 0x420
219#define DECORATION_COLORS 0x428
220#define NUM_DECORATIONS 0x430
221#define REFLECTION_DATA 0x438
222#define GRID_SIZE_X 0x440
223#define GRID_SIZE_Y 0x444
224#define STYLE_FLAGS 0x448
225#define SEQUENCE_LEN 0x454
226#define SEQUENCE 0x458
227#define DOT_SEQUENCE_LEN 0x460
228#define DOT_SEQUENCE 0x468
229#define DOT_SEQUENCE_LEN_REFLECTION 0x470
230#define DOT_SEQUENCE_REFLECTION 0x478
231#define NUM_COLORED_REGIONS 0x498
232#define COLORED_REGIONS 0x4A0
233#define PANEL_TARGET 0x4A8
234#define SPECULAR_TEXTURE 0x4D0
235#define CABLE_TARGET_2 0xD0
236#define AUDIO_LOG_NAME 0x0
237#define OPEN_RATE 0xE0
238#define METADATA 0x13A // sizeof(short)
239#define HOTEL_EP_NAME 0x51E340
240#endif \ No newline at end of file