about summary refs log tree commit diff stats
path: root/App
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2021-09-24 18:54:22 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2021-09-24 18:54:22 -0400
commitbad7b20434cebca369c6bf71fdbae9ed5a157119 (patch)
tree54adb230d60ee38ecfa4ef4b447c4ec366f291dc /App
parent92461067047993a828b43afe4eb79208aaae4862 (diff)
downloadwitness-tutorializer-bad7b20434cebca369c6bf71fdbae9ed5a157119.tar.gz
witness-tutorializer-bad7b20434cebca369c6bf71fdbae9ed5a157119.tar.bz2
witness-tutorializer-bad7b20434cebca369c6bf71fdbae9ed5a157119.zip
Reverted the Sigma backport memory stuff
Diffstat (limited to 'App')
-rw-r--r--App/Main.cpp58
1 files changed, 0 insertions, 58 deletions
diff --git a/App/Main.cpp b/App/Main.cpp index 54d876d..f0f770a 100644 --- a/App/Main.cpp +++ b/App/Main.cpp
@@ -1,7 +1,6 @@
1#include "pch.h" 1#include "pch.h"
2#include "Richedit.h" 2#include "Richedit.h"
3#include "Version.h" 3#include "Version.h"
4#include <fstream>
5 4
6#include "Memory.h" 5#include "Memory.h"
7#include "Random.h" 6#include "Random.h"
@@ -125,29 +124,6 @@ HWND CreateCheckbox(int x, int y, int message) {
125} 124}
126#pragma warning(pop) 125#pragma warning(pop)
127 126
128int findGlobals() {
129 int address = 0;
130 for (int i = 0x620000; i < 0x660000; i += 4) {
131 Memory::GLOBALS = i;
132 try {
133 if ((address = g_witnessProc->ReadPanelData<int>(0x17E52, STYLE_FLAGS, 1)[0]) == 0x0000A040) {
134 return i;
135 }
136 }
137 catch (std::exception) {}
138 }
139 for (int i = 0x600000; i < 0x620000; i += 4) {
140 Memory::GLOBALS = i;
141 try {
142 if ((address = g_witnessProc->ReadPanelData<int>(0x17E52, STYLE_FLAGS, 1)[0]) == 0x0000A040) {
143 return i;
144 }
145 }
146 catch (std::exception) {}
147 }
148 return 0;
149}
150
151int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) { 127int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) {
152 LoadLibrary(L"Msftedit.dll"); 128 LoadLibrary(L"Msftedit.dll");
153 WNDCLASSW wndClass = { 129 WNDCLASSW wndClass = {
@@ -164,40 +140,6 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
164 }; 140 };
165 RegisterClassW(&wndClass); 141 RegisterClassW(&wndClass);
166 142
167 //Initialize memory globals constant depending on game version
168 for (int g : Memory::globalsTests) {
169 try {
170 Memory::GLOBALS = g;
171 if (g_witnessProc->ReadPanelData<int>(0x17E52, STYLE_FLAGS) != 0xA040) throw std::exception();
172 break;
173 }
174 catch (std::exception) { Memory::GLOBALS = 0; }
175 }
176 if (!Memory::GLOBALS) {
177 std::ifstream file("globals.txt");
178 if (file.is_open()) {
179 file >> std::hex >> Memory::GLOBALS;
180 }
181 else {
182 std::string str = "Globals ptr not found. Press OK to search for globals ptr. It will probably take around 5 minutes. This popup will close and the calculation will run in the background. Please keep The Witness open during this time.";
183 if (MessageBox(GetActiveWindow(), std::wstring(str.begin(), str.end()).c_str(), NULL, MB_OK) != IDOK) return 0;
184 int address = findGlobals();
185 if (address) {
186 std::stringstream ss; ss << std::hex << "Address found: 0x" << address << ". This address wil be automatically loaded next time. Please post an issue on Github with this address so that it can be added in the future.";
187 std::string str = ss.str();
188 MessageBox(GetActiveWindow(), std::wstring(str.begin(), str.end()).c_str(), NULL, MB_OK);
189 std::ofstream ofile("globals.txt", std::ofstream::app);
190 ofile << std::hex << address << std::endl;
191 }
192 else {
193 str = "Address could not be found. Please post an issue on the Github page.";
194 MessageBox(GetActiveWindow(), std::wstring(str.begin(), str.end()).c_str(), NULL, MB_OK);
195 return 0;
196 }
197 }
198 }
199
200
201 g_hInstance = hInstance; 143 g_hInstance = hInstance;
202 144
203 RECT rect; 145 RECT rect;