about summary refs log tree commit diff stats
path: root/Source/Memory.cpp
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2019-11-06 09:19:21 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2019-11-06 09:19:21 -0800
commit3a03f478e407f35bfafd192c22f82bc8c6e25a38 (patch)
tree0af1c7ec125b098d5cf3c0e19ccf03b511f6d5b9 /Source/Memory.cpp
parent66b2bc177853d33f4559eb240fbbca354b173fa2 (diff)
downloadwitness-tutorializer-3a03f478e407f35bfafd192c22f82bc8c6e25a38.tar.gz
witness-tutorializer-3a03f478e407f35bfafd192c22f82bc8c6e25a38.tar.bz2
witness-tutorializer-3a03f478e407f35bfafd192c22f82bc8c6e25a38.zip
And... it works?
Diffstat (limited to 'Source/Memory.cpp')
-rw-r--r--Source/Memory.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/Source/Memory.cpp b/Source/Memory.cpp index 7b4b9c7..c3b89d0 100644 --- a/Source/Memory.cpp +++ b/Source/Memory.cpp
@@ -59,6 +59,8 @@ void Memory::Heartbeat(HWND window) {
59 int frameDelta = currentFrame - _previousFrame; 59 int frameDelta = currentFrame - _previousFrame;
60 _previousFrame = currentFrame; 60 _previousFrame = currentFrame;
61 if (frameDelta < 0 && currentFrame < 250) { 61 if (frameDelta < 0 && currentFrame < 250) {
62 // Some addresses (e.g. Entity Manager) may get re-allocated on newgame.
63 _computedAddresses.clear();
62 PostMessage(window, WM_COMMAND, HEARTBEAT, (LPARAM)ProcStatus::NewGame); 64 PostMessage(window, WM_COMMAND, HEARTBEAT, (LPARAM)ProcStatus::NewGame);
63 return; 65 return;
64 } 66 }
@@ -171,9 +173,6 @@ void* Memory::ComputeOffset(std::vector<int> offsets) {
171 // If the address is not yet computed, then compute it. 173 // If the address is not yet computed, then compute it.
172 uintptr_t computedAddress = 0; 174 uintptr_t computedAddress = 0;
173 if (bool result = !ReadProcessMemory(_handle, reinterpret_cast<LPVOID>(cumulativeAddress), &computedAddress, sizeof(uintptr_t), NULL)) { 175 if (bool result = !ReadProcessMemory(_handle, reinterpret_cast<LPVOID>(cumulativeAddress), &computedAddress, sizeof(uintptr_t), NULL)) {
174 if (GetLastError() == ERROR_PARTIAL_COPY) {
175 int k = 1;
176 }
177 ThrowError(); 176 ThrowError();
178 } 177 }
179 _computedAddresses[cumulativeAddress] = computedAddress; 178 _computedAddresses[cumulativeAddress] = computedAddress;