diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2021-08-21 16:55:00 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2021-08-21 16:55:00 -0400 |
commit | 02327bf40bb9f6ef8d5e17fa982da70a3fe93eb4 (patch) | |
tree | 35cbc1452dc1f6d45b26a179474f5c4732e18bb5 /Source/Memory.h | |
parent | b8d472ff024ad5b13dfe0c33ae10d5fdf8a2c4cc (diff) | |
download | witness-tutorializer-02327bf40bb9f6ef8d5e17fa982da70a3fe93eb4.tar.gz witness-tutorializer-02327bf40bb9f6ef8d5e17fa982da70a3fe93eb4.tar.bz2 witness-tutorializer-02327bf40bb9f6ef8d5e17fa982da70a3fe93eb4.zip |
Implemented tutorialisation stuff
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 1724251..e924bb9 100644 --- a/Source/Memory.h +++ b/Source/Memory.h | |||
@@ -55,6 +55,31 @@ public: | |||
55 | void AddSigScan(const std::vector<byte>& scanBytes, const std::function<void(int index)>& scanFunc); | 55 | void AddSigScan(const std::vector<byte>& scanBytes, const std::function<void(int index)>& scanFunc); |
56 | int ExecuteSigScans(); | 56 | int ExecuteSigScans(); |
57 | 57 | ||
58 | template <typename T> | ||
59 | void CopyEntityData(int fromId, int toId, int offset, int size) { | ||
60 | WriteEntityData<T>(toId, offset, ReadEntityData<T>(fromId, offset, size)); | ||
61 | } | ||
62 | |||
63 | template <typename T> | ||
64 | void CopyArray(int fromId, int toId, int offset, int size) { | ||
65 | if (size == 0) { | ||
66 | WriteEntityData<uintptr_t>(toId, offset, { static_cast<uintptr_t>(0) }); | ||
67 | } | ||
68 | else { | ||
69 | WriteNewArray<T>(toId, offset, ReadArray<T>(fromId, offset, size)); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | template <typename T> | ||
74 | void CopyArrayDynamicSize(int fromId, int toId, int arrayOffset, int sizeOffset) { | ||
75 | CopyArray<T>(fromId, toId, arrayOffset, ReadEntityData<int>(fromId, sizeOffset, sizeof(int))[0]); | ||
76 | } | ||
77 | |||
78 | template <class T> | ||
79 | void WritePanelData(int panel, int offset, const std::vector<T>& data) { | ||
80 | WriteData<T>({ GLOBALS, 0x18, panel * 8, offset }, data); | ||
81 | } | ||
82 | |||
58 | private: | 83 | private: |
59 | template<class T> | 84 | template<class T> |
60 | std::vector<T> ReadData(const std::vector<int>& offsets, size_t numItems) { | 85 | std::vector<T> ReadData(const std::vector<int>& offsets, size_t numItems) { |