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 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) { |
