about summary refs log tree commit diff stats
path: root/Source/Memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Memory.h')
-rw-r--r--Source/Memory.h38
1 files changed, 37 insertions, 1 deletions
diff --git a/Source/Memory.h b/Source/Memory.h index 1724251..e093960 100644 --- a/Source/Memory.h +++ b/Source/Memory.h
@@ -1,6 +1,6 @@
1#pragma once 1#pragma once
2 2
3extern int GLOBALS, POSITION, ORIENTATION, PATH_COLOR, REFLECTION_PATH_COLOR, DOT_COLOR, ACTIVE_COLOR, BACKGROUND_REGION_COLOR, SUCCESS_COLOR_A, SUCCESS_COLOR_B, STROBE_COLOR_A, STROBE_COLOR_B, ERROR_COLOR, PATTERN_POINT_COLOR, PATTERN_POINT_COLOR_A, PATTERN_POINT_COLOR_B, SYMBOL_A, SYMBOL_B, SYMBOL_C, SYMBOL_D, SYMBOL_E, PUSH_SYMBOL_COLORS, OUTER_BACKGROUND, OUTER_BACKGROUND_MODE, TRACED_EDGES, AUDIO_PREFIX, POWER, TARGET, POWER_OFF_ON_FAIL, IS_CYLINDER, CYLINDER_Z0, CYLINDER_Z1, CYLINDER_RADIUS, CURSOR_SPEED_SCALE, NEEDS_REDRAW, SPECULAR_ADD, SPECULAR_POWER, PATH_WIDTH_SCALE, STARTPOINT_SCALE, NUM_DOTS, NUM_CONNECTIONS, MAX_BROADCAST_DISTANCE, DOT_POSITIONS, DOT_FLAGS, DOT_CONNECTION_A, DOT_CONNECTION_B, DECORATIONS, DECORATION_FLAGS, DECORATION_COLORS, NUM_DECORATIONS, REFLECTION_DATA, GRID_SIZE_X, GRID_SIZE_Y, STYLE_FLAGS, SEQUENCE_LEN, SEQUENCE, DOT_SEQUENCE_LEN, DOT_SEQUENCE, DOT_SEQUENCE_LEN_REFLECTION, DOT_SEQUENCE_REFLECTION, NUM_COLORED_REGIONS, COLORED_REGIONS, PANEL_TARGET, SPECULAR_TEXTURE, CABLE_TARGET_2, AUDIO_LOG_NAME, OPEN_RATE, METADATA, HOTEL_EP_NAME; 3extern int GLOBALS, POSITION, ORIENTATION, PATH_COLOR, REFLECTION_PATH_COLOR, DOT_COLOR, ACTIVE_COLOR, BACKGROUND_REGION_COLOR, SUCCESS_COLOR_A, SUCCESS_COLOR_B, STROBE_COLOR_A, STROBE_COLOR_B, ERROR_COLOR, PATTERN_POINT_COLOR, PATTERN_POINT_COLOR_A, PATTERN_POINT_COLOR_B, SYMBOL_A, SYMBOL_B, SYMBOL_C, SYMBOL_D, SYMBOL_E, PUSH_SYMBOL_COLORS, OUTER_BACKGROUND, OUTER_BACKGROUND_MODE, TRACED_EDGES, AUDIO_PREFIX, POWER, TARGET, POWER_OFF_ON_FAIL, IS_CYLINDER, CYLINDER_Z0, CYLINDER_Z1, CYLINDER_RADIUS, CURSOR_SPEED_SCALE, NEEDS_REDRAW, SPECULAR_ADD, SPECULAR_POWER, PATH_WIDTH_SCALE, STARTPOINT_SCALE, NUM_DOTS, NUM_CONNECTIONS, MAX_BROADCAST_DISTANCE, DOT_POSITIONS, DOT_FLAGS, DOT_CONNECTION_A, DOT_CONNECTION_B, DECORATIONS, DECORATION_FLAGS, DECORATION_COLORS, NUM_DECORATIONS, REFLECTION_DATA, GRID_SIZE_X, GRID_SIZE_Y, STYLE_FLAGS, SEQUENCE_LEN, SEQUENCE, DOT_SEQUENCE_LEN, DOT_SEQUENCE, DOT_SEQUENCE_LEN_REFLECTION, DOT_SEQUENCE_REFLECTION, NUM_COLORED_REGIONS, COLORED_REGIONS, PANEL_TARGET, SPECULAR_TEXTURE, CABLE_TARGET_2, AUDIO_LOG_NAME, OPEN_RATE, METADATA, HOTEL_EP_NAME, RANDOMISE_ON_POWER_ON;
4 4
5enum class ProcStatus { 5enum class ProcStatus {
6 NotRunning, 6 NotRunning,
@@ -55,6 +55,42 @@ 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
83 template <class T>
84 T ReadPanelData(int panel, int offset) {
85 return ReadData<T>({ GLOBALS, 0x18, panel * 8, offset }, 1)[0];
86 }
87
88 template <class T>
89 std::vector<T> ReadPanelData(int panel, int offset, size_t size) {
90 if (size == 0) return std::vector<T>();
91 return ReadData<T>({ GLOBALS, 0x18, panel * 8, offset }, size);
92 }
93
58private: 94private:
59 template<class T> 95 template<class T>
60 std::vector<T> ReadData(const std::vector<int>& offsets, size_t numItems) { 96 std::vector<T> ReadData(const std::vector<int>& offsets, size_t numItems) {