diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2021-09-24 18:54:22 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2021-09-24 18:54:22 -0400 |
commit | bad7b20434cebca369c6bf71fdbae9ed5a157119 (patch) | |
tree | 54adb230d60ee38ecfa4ef4b447c4ec366f291dc /Source/Memory.cpp | |
parent | 92461067047993a828b43afe4eb79208aaae4862 (diff) | |
download | witness-tutorializer-bad7b20434cebca369c6bf71fdbae9ed5a157119.tar.gz witness-tutorializer-bad7b20434cebca369c6bf71fdbae9ed5a157119.tar.bz2 witness-tutorializer-bad7b20434cebca369c6bf71fdbae9ed5a157119.zip |
Reverted the Sigma backport memory stuff
Diffstat (limited to 'Source/Memory.cpp')
-rw-r--r-- | Source/Memory.cpp | 168 |
1 files changed, 158 insertions, 10 deletions
diff --git a/Source/Memory.cpp b/Source/Memory.cpp index 8e755dd..8802add 100644 --- a/Source/Memory.cpp +++ b/Source/Memory.cpp | |||
@@ -6,7 +6,7 @@ | |||
6 | #undef PROCESSENTRY32 | 6 | #undef PROCESSENTRY32 |
7 | #undef Process32Next | 7 | #undef Process32Next |
8 | 8 | ||
9 | Memory::Memory(const std::wstring& processName) : _processName(processName) { Initialize(); } | 9 | Memory::Memory(const std::wstring& processName) : _processName(processName) {} |
10 | 10 | ||
11 | Memory::~Memory() { | 11 | Memory::~Memory() { |
12 | if (_threadActive) { | 12 | if (_threadActive) { |
@@ -33,7 +33,7 @@ void Memory::StartHeartbeat(HWND window, WPARAM wParam, std::chrono::millisecond | |||
33 | } | 33 | } |
34 | 34 | ||
35 | void Memory::Heartbeat(HWND window, WPARAM wParam) { | 35 | void Memory::Heartbeat(HWND window, WPARAM wParam) { |
36 | if (!_handle) { | 36 | if (!_handle && !Initialize()) { |
37 | // Couldn't initialize, definitely not running | 37 | // Couldn't initialize, definitely not running |
38 | PostMessage(window, WM_COMMAND, wParam, (LPARAM)ProcStatus::NotRunning); | 38 | PostMessage(window, WM_COMMAND, wParam, (LPARAM)ProcStatus::NotRunning); |
39 | return; | 39 | return; |
@@ -110,8 +110,7 @@ bool Memory::Initialize() { | |||
110 | return false; | 110 | return false; |
111 | } | 111 | } |
112 | 112 | ||
113 | ExecuteSigScans(); | 113 | LoadPanelOffsets(); |
114 | |||
115 | return true; | 114 | return true; |
116 | } | 115 | } |
117 | 116 | ||
@@ -188,9 +187,158 @@ void* Memory::ComputeOffset(std::vector<int> offsets) { | |||
188 | return reinterpret_cast<void*>(cumulativeAddress + final_offset); | 187 | return reinterpret_cast<void*>(cumulativeAddress + final_offset); |
189 | } | 188 | } |
190 | 189 | ||
191 | int Memory::GLOBALS = 0; | 190 | 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, RANDOMISE_ON_POWER_ON; |
192 | int Memory::globalsTests[3] = { | 191 | |
193 | 0x62D0A0, //Steam and Epic Games | 192 | void Memory::LoadPanelOffsets() { |
194 | 0x62B0A0, //Good Old Games | 193 | AddSigScan({0x74, 0x41, 0x48, 0x85, 0xC0, 0x74, 0x04, 0x48, 0x8B, 0x48, 0x10}, [sharedThis = shared_from_this()](int index){ |
195 | 0x5B28C0 //Noclip version | 194 | // (address of next line) + (value at index) |
196 | }; \ No newline at end of file | 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 | RANDOMISE_ON_POWER_ON = 0x3E0; | ||
317 | DECORATIONS = 0x418; | ||
318 | DECORATION_FLAGS = 0x420; | ||
319 | DECORATION_COLORS = 0x428; | ||
320 | NUM_DECORATIONS = 0x430; | ||
321 | REFLECTION_DATA = 0x438; | ||
322 | GRID_SIZE_X = 0x440; | ||
323 | GRID_SIZE_Y = 0x444; | ||
324 | STYLE_FLAGS = 0x448; | ||
325 | SEQUENCE_LEN = 0x454; | ||
326 | SEQUENCE = 0x458; | ||
327 | DOT_SEQUENCE_LEN = 0x460; | ||
328 | DOT_SEQUENCE = 0x468; | ||
329 | DOT_SEQUENCE_LEN_REFLECTION = 0x470; | ||
330 | DOT_SEQUENCE_REFLECTION = 0x478; | ||
331 | NUM_COLORED_REGIONS = 0x498; | ||
332 | COLORED_REGIONS = 0x4A0; | ||
333 | PANEL_TARGET = 0x4A8; | ||
334 | SPECULAR_TEXTURE = 0x4D0; | ||
335 | CABLE_TARGET_2 = 0xD0; | ||
336 | AUDIO_LOG_NAME = 0x0; | ||
337 | OPEN_RATE = 0xE0; | ||
338 | METADATA = 0x13A; // sizeof(short) | ||
339 | HOTEL_EP_NAME = 0x51E340; | ||
340 | } else { | ||
341 | assert(false); | ||
342 | return; | ||
343 | } | ||
344 | } \ No newline at end of file | ||