about summary refs log tree commit diff stats
path: root/data/maps/the_between/rooms/Control Center Side.txtpb
Commit message (Collapse)AuthorAgeFilesLines
* Added display names to portsStar Rauchenberger2025-09-281-0/+2
|
* [Data] Annotate shuffleable portsStar Rauchenberger2025-09-211-2/+4
|
* Changed how door location names are formattedStar Rauchenberger2025-08-301-1/+0
| | | | | | | | | | | | | | | | | | STANDARD type doors with at most four panels in the same map area and no other trigger objects will have their location names generated from the names of the panels used to open the door, similar to Lingo 1. Other door types will use the door's name. In either case, the name can be overridden using the new location_name field. Rooms can also set a panel_display_name field, which will be used in location names for doors, and is used to group panels into areas. Panels themselves can set display names, which differentiates their locations from other panels in the same area. Many maps were updated for this, but note that the_symbolic and the_unyielding have validator failures because of duplicate panel names. This won't matter until panelsanity is implemented.
* Added the_betweenStar Rauchenberger2025-08-091-0/+24
, but I can read/write decorations & dots.' href='/witness-tutorializer/commit/Source/Memory.h?h=tutorial-v0.4.0&id=5de975b03c7200cc66188a4b1a76e1213524975d'>5de975b ^
66b2bc1 ^
e3758a1 ^





d5d5868 ^



66b2bc1 ^
d5d5868 ^
66b2bc1 ^
d5d5868 ^
66b2bc1 ^
d5d5868 ^
1f20774 ^


5de975b ^



















4ad724e ^

f485927 ^
5ad08f6 ^
d5d5868 ^
1f20774 ^
d5d5868 ^

922dbb0 ^
1f20774 ^
922dbb0 ^


d5d5868 ^
922dbb0 ^
4edd6ab ^
d5d5868 ^


922dbb0 ^

1f20774 ^
922dbb0 ^

d5d5868 ^
922dbb0 ^
d5d5868 ^
5fb764e ^
66b2bc1 ^

d5d5868 ^
1f20774 ^
2473736 ^
66b2bc1 ^



1d4763b ^
1f20774 ^

4ad724e ^




1501b17 ^

c10b73f ^
f485927 ^
d5d5868 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
            
                     
              
                 
                 

                    
                           
                        
 
                       





                       



                                                           
                                                                  
       
                                                
                  
                                                                                                       
 


                                                        



















                                                                                

                                                                                                            
 
        
                         
                                                                                   

                                      
                                         
                                                                                                                        


                                            
                 
                             
                          


                          

                                                                                     
                                                                                                                              

                                       
                 
                             
         
 

                                
                          
                                                      
 



                               
                                                          

                                   




                                                       

                          
                                         
                                
 
#pragma once
#include <functional>
#include <map>
#include <thread>
#include <vector>
#include <windows.h>

// #define GLOBALS 0x5B28C0
#define GLOBALS 0x62D0A0

#define HEARTBEAT 0x401
enum class ProcStatus {
    NotRunning,
    Running,
    NewGame
};

// https://github.com/erayarslan/WriteProcessMemory-Example
// http://stackoverflow.com/q/32798185
// http://stackoverflow.com/q/36018838
// http://stackoverflow.com/q/1387064
class Memory final : public std::enable_shared_from_this<Memory> {
public:
	Memory(const std::wstring& processName);
	~Memory();
    void StartHeartbeat(HWND window, std::chrono::milliseconds beat = std::chrono::milliseconds(1000));

	Memory(const Memory& memory) = delete;
	Memory& operator=(const Memory& other) = delete;

	template <class T>
	std::vector<T> ReadArray(int panel, int offset, int size) {
		return ReadData<T>({GLOBALS, 0x18, panel*8, offset, 0}, size);
	}

	template <class T>
	void WriteArray(int panel, int offset, const std::vector<T>& data) {
		WriteData<T>({GLOBALS, 0x18, panel*8, offset, 0}, data);
	}

	template <class T>
	std::vector<T> ReadPanelData(int panel, int offset, size_t size) {
		return ReadData<T>({GLOBALS, 0x18, panel*8, offset}, size);
	}

	template <class T>
	void WritePanelData(int panel, int offset, const std::vector<T>& data) {
		WriteData<T>({GLOBALS, 0x18, panel*8, offset}, data);
	}

	void AddSigScan(const std::vector<byte>& scanBytes, const std::function<void(int index)>& scanFunc);
	int ExecuteSigScans();

private:
	template<class T>
	std::vector<T> ReadData(const std::vector<int>& offsets, size_t numItems) {
		std::vector<T> data;
		data.resize(numItems);
		for (int i=0; i<5; i++) {
			if (ReadProcessMemory(_handle, ComputeOffset(offsets), &data[0], sizeof(T) * numItems, nullptr))
			{
				return data;
			}
		}
		ThrowError();
		return {};
	}

	template <class T>
	void WriteData(const std::vector<int>& offsets, const std::vector<T>& data) {
		for (int i=0; i<5; i++) {
			if (WriteProcessMemory(_handle, ComputeOffset(offsets), &data[0], sizeof(T) * data.size(), nullptr)) {
				return;
			}
		}
		ThrowError();
	}

    void Heartbeat(HWND window);
	bool Initialize();
	void ThrowError();
	void* ComputeOffset(std::vector<int> offsets);

    int _previousFrame = 0;
    bool _threadActive = false;
    std::thread _thread;
    std::wstring _processName;
	std::map<uintptr_t, uintptr_t> _computedAddresses;
	uintptr_t _baseAddress = 0;
	HANDLE _handle = nullptr;
	struct SigScan {
		std::function<void(int)> scanFunc;
		bool found;
	};
	std::map<std::vector<byte>, SigScan> _sigScans;

	friend class Temp;
	friend class ChallengeRandomizer;
	friend class Randomizer;
};