about summary refs log tree commit diff stats
path: root/Source/Memory.cpp
diff options
context:
space:
mode:
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;