summaryrefslogtreecommitdiffstats
path: root/src/core/re3.cpp
diff options
context:
space:
mode:
authorFire_Head <Fire-Head@users.noreply.github.com>2020-03-29 17:39:47 +0200
committerGitHub <noreply@github.com>2020-03-29 17:39:47 +0200
commita0b077574e95e49ad845a6c9dc1af906b17277f9 (patch)
treede9f8dbd0e3c06ffbb95b13c0637dfc3db3873c1 /src/core/re3.cpp
parentstyle & cosmetic fixes (diff)
parentMerge pull request #367 from Sergeanur/wrappers_cleanup (diff)
downloadre3-a0b077574e95e49ad845a6c9dc1af906b17277f9.tar
re3-a0b077574e95e49ad845a6c9dc1af906b17277f9.tar.gz
re3-a0b077574e95e49ad845a6c9dc1af906b17277f9.tar.bz2
re3-a0b077574e95e49ad845a6c9dc1af906b17277f9.tar.lz
re3-a0b077574e95e49ad845a6c9dc1af906b17277f9.tar.xz
re3-a0b077574e95e49ad845a6c9dc1af906b17277f9.tar.zst
re3-a0b077574e95e49ad845a6c9dc1af906b17277f9.zip
Diffstat (limited to 'src/core/re3.cpp')
-rw-r--r--src/core/re3.cpp58
1 files changed, 4 insertions, 54 deletions
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 137a890c..500bf230 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -22,62 +22,8 @@
#include "Console.h"
#include "Debug.h"
-#include <algorithm>
-#include <vector>
#include <list>
-std::vector<int32> usedAddresses;
-
-static DWORD protect[2];
-static uint32 protect_address;
-static uint32 protect_size;
-
-void
-Protect_internal(uint32 address, uint32 size)
-{
- protect_address = address;
- protect_size = size;
- VirtualProtect((void*)address, size, PAGE_EXECUTE_READWRITE, &protect[0]);
-}
-
-void
-Unprotect_internal(void)
-{
- VirtualProtect((void*)protect_address, protect_size, protect[0], &protect[1]);
-}
-
-void
-InjectHook_internal(uint32 address, uint32 hook, int type)
-{
- if(std::any_of(usedAddresses.begin(), usedAddresses.end(),
- [address](uint32 value) { return (int32)value == address; })) {
- debug("Used address %#06x twice when injecting hook\n", address);
- }
-
- usedAddresses.push_back((int32)address);
-
-
- switch(type){
- case PATCH_JUMP:
- VirtualProtect((void*)address, 5, PAGE_EXECUTE_READWRITE, &protect[0]);
- *(uint8*)address = 0xE9;
- break;
- case PATCH_CALL:
- VirtualProtect((void*)address, 5, PAGE_EXECUTE_READWRITE, &protect[0]);
- *(uint8*)address = 0xE8;
- break;
- default:
- VirtualProtect((void*)((uint32)address + 1), 4, PAGE_EXECUTE_READWRITE, &protect[0]);
- break;
- }
-
- *(ptrdiff_t*)(address + 1) = hook - address - 5;
- if(type == PATCH_NOTHING)
- VirtualProtect((void*)(address + 1), 4, protect[0], &protect[1]);
- else
- VirtualProtect((void*)address, 5, protect[0], &protect[1]);
-}
-
void **rwengine = *(void***)0x5A10E1;
DebugMenuAPI gDebugMenuAPI;
@@ -426,6 +372,10 @@ DebugMenuPopulate(void)
extern bool PrintDebugCode;
extern int16 &DebugCamMode;
+#ifdef FREE_CAM
+ extern bool bFreeCam;
+ DebugMenuAddVarBool8("Cam", "Free Cam", (int8*)&bFreeCam, nil);
+#endif
DebugMenuAddVarBool8("Cam", "Print Debug Code", (int8*)&PrintDebugCode, nil);
DebugMenuAddVar("Cam", "Cam Mode", &DebugCamMode, nil, 1, 0, CCam::MODE_EDITOR, nil);
DebugMenuAddCmd("Cam", "Normal", []() { DebugCamMode = 0; });