From 02327bf40bb9f6ef8d5e17fa982da70a3fe93eb4 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 21 Aug 2021 16:55:00 -0400 Subject: Implemented tutorialisation stuff --- Source/Memory.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'Source/Memory.h') 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: void AddSigScan(const std::vector& scanBytes, const std::function& scanFunc); int ExecuteSigScans(); + template + void CopyEntityData(int fromId, int toId, int offset, int size) { + WriteEntityData(toId, offset, ReadEntityData(fromId, offset, size)); + } + + template + void CopyArray(int fromId, int toId, int offset, int size) { + if (size == 0) { + WriteEntityData(toId, offset, { static_cast(0) }); + } + else { + WriteNewArray(toId, offset, ReadArray(fromId, offset, size)); + } + } + + template + void CopyArrayDynamicSize(int fromId, int toId, int arrayOffset, int sizeOffset) { + CopyArray(fromId, toId, arrayOffset, ReadEntityData(fromId, sizeOffset, sizeof(int))[0]); + } + + template + void WritePanelData(int panel, int offset, const std::vector& data) { + WriteData({ GLOBALS, 0x18, panel * 8, offset }, data); + } + private: template std::vector ReadData(const std::vector& offsets, size_t numItems) { -- cgit 1.4.1