about summary refs log tree commit diff stats
path: root/Source/Memory.cpp
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 /Source/Memory.cpp
parent38060c54f9f923d49b019fcf90f3494fd5469b74 (diff)
downloadwitness-tutorializer-e77cfa1596f996cc50c1601ee29891a7fb7eb62d.tar.gz
witness-tutorializer-e77cfa1596f996cc50c1601ee29891a7fb7eb62d.tar.bz2
witness-tutorializer-e77cfa1596f996cc50c1601ee29891a7fb7eb62d.zip
Clean up globals to be more dynamic
Diffstat (limited to 'Source/Memory.cpp')
-rw-r--r--Source/Memory.cpp171
1 files changed, 166 insertions, 5 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