diff options
Diffstat (limited to 'Source/Memory.h')
-rw-r--r-- | Source/Memory.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/Memory.h b/Source/Memory.h index 53fa1e0..310c971 100644 --- a/Source/Memory.h +++ b/Source/Memory.h | |||
@@ -3,6 +3,9 @@ | |||
3 | #include <map> | 3 | #include <map> |
4 | #include <windows.h> | 4 | #include <windows.h> |
5 | 5 | ||
6 | #define GLOBALS 0x5B28C0 | ||
7 | //#define GLOBALS 0x62A080 | ||
8 | |||
6 | // https://github.com/erayarslan/WriteProcessMemory-Example | 9 | // https://github.com/erayarslan/WriteProcessMemory-Example |
7 | // http://stackoverflow.com/q/32798185 | 10 | // http://stackoverflow.com/q/32798185 |
8 | // http://stackoverflow.com/q/36018838 | 11 | // http://stackoverflow.com/q/36018838 |
@@ -16,6 +19,27 @@ public: | |||
16 | Memory(const Memory& memory) = delete; | 19 | Memory(const Memory& memory) = delete; |
17 | Memory& operator=(const Memory& other) = delete; | 20 | Memory& operator=(const Memory& other) = delete; |
18 | 21 | ||
22 | |||
23 | template <class T> | ||
24 | std::vector<T> ReadArray(int panel, int offset, int size) { | ||
25 | return ReadData<T>({GLOBALS, 0x18, panel*8, offset, 0}, size); | ||
26 | } | ||
27 | |||
28 | template <class T> | ||
29 | void WriteArray(int panel, int offset, const std::vector<T>& data) { | ||
30 | WriteData<T>({GLOBALS, 0x18, panel*8, offset, 0}, data); | ||
31 | } | ||
32 | |||
33 | template <class T> | ||
34 | std::vector<T> ReadPanelData(int panel, int offset, size_t size) { | ||
35 | return ReadData<T>({GLOBALS, 0x18, panel*8, offset}, size); | ||
36 | } | ||
37 | |||
38 | template <class T> | ||
39 | void WritePanelData(int panel, int offset, const std::vector<T>& data) { | ||
40 | WriteData<T>({GLOBALS, 0x18, panel*8, offset}, data); | ||
41 | } | ||
42 | |||
19 | template<class T> | 43 | template<class T> |
20 | std::vector<T> ReadData(const std::vector<int>& offsets, size_t numItems) { | 44 | std::vector<T> ReadData(const std::vector<int>& offsets, size_t numItems) { |
21 | std::vector<T> data; | 45 | std::vector<T> data; |
@@ -41,6 +65,7 @@ public: | |||
41 | } | 65 | } |
42 | 66 | ||
43 | private: | 67 | private: |
68 | |||
44 | void ThrowError(); | 69 | void ThrowError(); |
45 | 70 | ||
46 | void* ComputeOffset(std::vector<int> offsets); | 71 | void* ComputeOffset(std::vector<int> offsets); |