summary refs log tree commit diff stats
path: root/App2
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2021-01-17 16:15:37 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2021-01-17 16:15:37 -0800
commitfa5c27c9b5991f2daf526eb5fdd3e41200afa63e (patch)
treef33b1822bcd756b53ddcfcccdcefe07c4654c32e /App2
parent6b11e2530eaaecb1e4ab75821b12521fbb44062c (diff)
downloadwitness-tutorializer-fa5c27c9b5991f2daf526eb5fdd3e41200afa63e.tar.gz
witness-tutorializer-fa5c27c9b5991f2daf526eb5fdd3e41200afa63e.tar.bz2
witness-tutorializer-fa5c27c9b5991f2daf526eb5fdd3e41200afa63e.zip
Try adding app2
Diffstat (limited to 'App2')
-rw-r--r--App2/App2.vcxproj168
-rw-r--r--App2/App2.vcxproj.filters27
-rw-r--r--App2/Main.cpp313
-rw-r--r--App2/Version.h14
4 files changed, 522 insertions, 0 deletions
diff --git a/App2/App2.vcxproj b/App2/App2.vcxproj new file mode 100644 index 0000000..5b8923a --- /dev/null +++ b/App2/App2.vcxproj
@@ -0,0 +1,168 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <ItemGroup Label="ProjectConfigurations">
4 <ProjectConfiguration Include="Debug|Win32">
5 <Configuration>Debug</Configuration>
6 <Platform>Win32</Platform>
7 </ProjectConfiguration>
8 <ProjectConfiguration Include="Release|Win32">
9 <Configuration>Release</Configuration>
10 <Platform>Win32</Platform>
11 </ProjectConfiguration>
12 <ProjectConfiguration Include="Debug|x64">
13 <Configuration>Debug</Configuration>
14 <Platform>x64</Platform>
15 </ProjectConfiguration>
16 <ProjectConfiguration Include="Release|x64">
17 <Configuration>Release</Configuration>
18 <Platform>x64</Platform>
19 </ProjectConfiguration>
20 </ItemGroup>
21 <PropertyGroup Label="Globals">
22 <VCProjectVersion>16.0</VCProjectVersion>
23 <Keyword>Win32Proj</Keyword>
24 <ProjectGuid>{5a4e859a-9756-463e-86e6-6eadbba23021}</ProjectGuid>
25 <RootNamespace>App2</RootNamespace>
26 <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
27 </PropertyGroup>
28 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30 <ConfigurationType>Application</ConfigurationType>
31 <UseDebugLibraries>true</UseDebugLibraries>
32 <PlatformToolset>v142</PlatformToolset>
33 <CharacterSet>Unicode</CharacterSet>
34 </PropertyGroup>
35 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36 <ConfigurationType>Application</ConfigurationType>
37 <UseDebugLibraries>false</UseDebugLibraries>
38 <PlatformToolset>v142</PlatformToolset>
39 <WholeProgramOptimization>true</WholeProgramOptimization>
40 <CharacterSet>Unicode</CharacterSet>
41 </PropertyGroup>
42 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43 <ConfigurationType>Application</ConfigurationType>
44 <UseDebugLibraries>true</UseDebugLibraries>
45 <PlatformToolset>v142</PlatformToolset>
46 <CharacterSet>Unicode</CharacterSet>
47 </PropertyGroup>
48 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49 <ConfigurationType>Application</ConfigurationType>
50 <UseDebugLibraries>false</UseDebugLibraries>
51 <PlatformToolset>v142</PlatformToolset>
52 <WholeProgramOptimization>true</WholeProgramOptimization>
53 <CharacterSet>Unicode</CharacterSet>
54 </PropertyGroup>
55 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56 <ImportGroup Label="ExtensionSettings">
57 </ImportGroup>
58 <ImportGroup Label="Shared">
59 </ImportGroup>
60 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62 </ImportGroup>
63 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65 </ImportGroup>
66 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68 </ImportGroup>
69 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71 </ImportGroup>
72 <PropertyGroup Label="UserMacros" />
73 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74 <LinkIncremental>true</LinkIncremental>
75 <TargetName>ChallengeRandomizer</TargetName>
76 </PropertyGroup>
77 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
78 <LinkIncremental>false</LinkIncremental>
79 <TargetName>ChallengeRandomizer</TargetName>
80 </PropertyGroup>
81 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
82 <LinkIncremental>true</LinkIncremental>
83 <TargetName>ChallengeRandomizer</TargetName>
84 </PropertyGroup>
85 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
86 <LinkIncremental>false</LinkIncremental>
87 <TargetName>ChallengeRandomizer</TargetName>
88 </PropertyGroup>
89 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
90 <ClCompile>
91 <WarningLevel>Level3</WarningLevel>
92 <SDLCheck>true</SDLCheck>
93 <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
94 <ConformanceMode>true</ConformanceMode>
95 <LanguageStandard>stdcpp17</LanguageStandard>
96 <AdditionalIncludeDirectories>..\Source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
97 <TreatWarningAsError>true</TreatWarningAsError>
98 </ClCompile>
99 <Link>
100 <SubSystem>Console</SubSystem>
101 <GenerateDebugInformation>true</GenerateDebugInformation>
102 </Link>
103 </ItemDefinitionGroup>
104 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
105 <ClCompile>
106 <WarningLevel>Level3</WarningLevel>
107 <FunctionLevelLinking>true</FunctionLevelLinking>
108 <IntrinsicFunctions>true</IntrinsicFunctions>
109 <SDLCheck>true</SDLCheck>
110 <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
111 <ConformanceMode>true</ConformanceMode>
112 <LanguageStandard>stdcpp17</LanguageStandard>
113 <AdditionalIncludeDirectories>..\Source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
114 <TreatWarningAsError>true</TreatWarningAsError>
115 </ClCompile>
116 <Link>
117 <SubSystem>Console</SubSystem>
118 <EnableCOMDATFolding>true</EnableCOMDATFolding>
119 <OptimizeReferences>true</OptimizeReferences>
120 <GenerateDebugInformation>true</GenerateDebugInformation>
121 </Link>
122 </ItemDefinitionGroup>
123 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
124 <ClCompile>
125 <WarningLevel>Level3</WarningLevel>
126 <SDLCheck>true</SDLCheck>
127 <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
128 <ConformanceMode>true</ConformanceMode>
129 <LanguageStandard>stdcpp17</LanguageStandard>
130 <AdditionalIncludeDirectories>..\Source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
131 <TreatWarningAsError>true</TreatWarningAsError>
132 <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
133 </ClCompile>
134 <Link>
135 <SubSystem>Console</SubSystem>
136 <GenerateDebugInformation>true</GenerateDebugInformation>
137 </Link>
138 </ItemDefinitionGroup>
139 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
140 <ClCompile>
141 <WarningLevel>Level3</WarningLevel>
142 <FunctionLevelLinking>true</FunctionLevelLinking>
143 <IntrinsicFunctions>true</IntrinsicFunctions>
144 <SDLCheck>true</SDLCheck>
145 <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
146 <ConformanceMode>true</ConformanceMode>
147 <LanguageStandard>stdcpp17</LanguageStandard>
148 <AdditionalIncludeDirectories>..\Source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
149 <TreatWarningAsError>true</TreatWarningAsError>
150 <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
151 </ClCompile>
152 <Link>
153 <SubSystem>Console</SubSystem>
154 <EnableCOMDATFolding>true</EnableCOMDATFolding>
155 <OptimizeReferences>true</OptimizeReferences>
156 <GenerateDebugInformation>true</GenerateDebugInformation>
157 </Link>
158 </ItemDefinitionGroup>
159 <ItemGroup>
160 <ClInclude Include="Version.h" />
161 </ItemGroup>
162 <ItemGroup>
163 <ClCompile Include="Main.cpp" />
164 </ItemGroup>
165 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
166 <ImportGroup Label="ExtensionTargets">
167 </ImportGroup>
168</Project> \ No newline at end of file
diff --git a/App2/App2.vcxproj.filters b/App2/App2.vcxproj.filters new file mode 100644 index 0000000..a121d06 --- /dev/null +++ b/App2/App2.vcxproj.filters
@@ -0,0 +1,27 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <ItemGroup>
4 <Filter Include="Source Files">
5 <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6 <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7 </Filter>
8 <Filter Include="Header Files">
9 <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10 <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
11 </Filter>
12 <Filter Include="Resource Files">
13 <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14 <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15 </Filter>
16 </ItemGroup>
17 <ItemGroup>
18 <ClInclude Include="Version.h">
19 <Filter>Header Files</Filter>
20 </ClInclude>
21 </ItemGroup>
22 <ItemGroup>
23 <ClCompile Include="Main.cpp">
24 <Filter>Source Files</Filter>
25 </ClCompile>
26 </ItemGroup>
27</Project> \ No newline at end of file
diff --git a/App2/Main.cpp b/App2/Main.cpp new file mode 100644 index 0000000..30deff2 --- /dev/null +++ b/App2/Main.cpp
@@ -0,0 +1,313 @@
1#include "pch.h"
2#include "Richedit.h"
3#include "Version.h"
4
5#include "Memory.h"
6#include "Random.h"
7#include "Randomizer.h"
8#include "Randomizer2.h"
9#include "Panels_.h"
10
11#define HEARTBEAT 0x401
12#define RANDOMIZE_READY 0x402
13#define RANDOMIZING 0403
14#define RANDOMIZE_DONE 0x404
15#define RANDOMIZE_CHALLENGE_DONE 0x405
16#define CHALLENGE_ONLY 0x406
17#define DISABLE_SNIPES 0x407
18#define SPEED_UP_AUTOSCROLLERS 0x408
19
20/* ------- Temp ------- */
21#include "Solver.h"
22#include "PuzzleSerializer.h"
23#include <sstream>
24#include <iomanip>
25
26#define TMP1 0x501
27#define TMP2 0x502
28#define TMP3 0x503
29#define TMP4 0x504
30
31HWND g_panelId;
32Puzzle g_puzzle;
33
34HWND g_rngDebug;
35#define TMP5 0x505
36/* ------- Temp ------- */
37
38// Globals
39HWND g_hwnd;
40HWND g_seed;
41HWND g_randomizerStatus;
42HINSTANCE g_hInstance;
43auto g_witnessProc = std::make_shared<Memory>(L"witness64_d3d11.exe");
44std::shared_ptr<Randomizer> g_randomizer;
45std::shared_ptr<Randomizer2> g_randomizer2;
46void SetRandomSeed();
47
48LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
49 if (message == WM_DESTROY) {
50 PostQuitMessage(0);
51 } else if (message == WM_NOTIFY) {
52 MSGFILTER* m = (MSGFILTER *)lParam;
53 if (m->msg == WM_KEYDOWN && m->wParam == VK_RETURN) {
54 if (IsWindowEnabled(g_randomizerStatus) == TRUE) {
55 PostMessage(g_hwnd, WM_COMMAND, RANDOMIZING, NULL);
56 return 1; // Non-zero to indicate that message was handled
57 }
58 }
59 } else if (message == WM_COMMAND || message == WM_TIMER || message == WM_NOTIFY) {
60 switch (LOWORD(wParam)) {
61 case HEARTBEAT:
62 switch ((ProcStatus)lParam) {
63 case ProcStatus::NotRunning:
64 // Shut down randomizer, wait for startup
65 if (g_randomizer) {
66 g_randomizer = nullptr;
67 g_randomizer2 = nullptr;
68 EnableWindow(g_randomizerStatus, FALSE);
69 }
70 break;
71 case ProcStatus::Running:
72 if (!g_randomizer) {
73 g_randomizer = std::make_shared<Randomizer>(g_witnessProc);
74 g_randomizer2 = std::make_shared<Randomizer2>(g_witnessProc);
75 PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_READY, NULL);
76 }
77 break;
78 case ProcStatus::NewGame: // This status will fire only once per new game
79 SetWindowText(g_seed, L"");
80 PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_READY, NULL);
81 break;
82 }
83 break;
84 case RANDOMIZE_READY:
85 EnableWindow(g_randomizerStatus, TRUE);
86 if (IsDlgButtonChecked(hwnd, CHALLENGE_ONLY)) {
87 SetWindowText(g_randomizerStatus, L"Randomize Challenge");
88 } else {
89 SetWindowText(g_randomizerStatus, L"Randomize");
90 }
91 break;
92 case RANDOMIZING:
93 if (!g_randomizer) break; // E.g. an enter press at the wrong time
94 EnableWindow(g_randomizerStatus, FALSE);
95
96 SetRandomSeed();
97 std::thread([]{
98 if (IsDlgButtonChecked(g_hwnd, DISABLE_SNIPES)) {
99 MEMORY_CATCH(g_randomizer->PreventSnipes());
100 }
101 if (IsDlgButtonChecked(g_hwnd, SPEED_UP_AUTOSCROLLERS)) {
102 MEMORY_CATCH(g_randomizer->AdjustSpeed());
103 }
104 if (IsDlgButtonChecked(g_hwnd, CHALLENGE_ONLY)) {
105 SetWindowText(g_randomizerStatus, L"Randomizing Challenge...");
106 MEMORY_CATCH(g_randomizer->RandomizeChallenge());
107 PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_CHALLENGE_DONE, NULL);
108 } else {
109 SetWindowText(g_randomizerStatus, L"Randomizing...");
110 MEMORY_CATCH(g_randomizer->Randomize());
111 PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_DONE, NULL);
112 }
113 }).detach();
114 break;
115 case RANDOMIZE_DONE:
116 EnableWindow(g_randomizerStatus, FALSE);
117 SetWindowText(g_randomizerStatus, L"Randomized!");
118 break;
119 case RANDOMIZE_CHALLENGE_DONE:
120 EnableWindow(g_randomizerStatus, FALSE);
121 SetWindowText(g_randomizerStatus, L"Randomized Challenge!");
122 std::thread([]{
123 // Allow re-randomization for challenge -- it doesn't break the rest of the game.
124 std::this_thread::sleep_for(std::chrono::seconds(10));
125 PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_READY, NULL);
126 }).detach();
127 break;
128 case CHALLENGE_ONLY:
129 CheckDlgButton(hwnd, CHALLENGE_ONLY, !IsDlgButtonChecked(hwnd, CHALLENGE_ONLY));
130 if (IsWindowEnabled(g_randomizerStatus)) {
131 PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_READY, NULL);
132 }
133 break;
134 case DISABLE_SNIPES:
135 CheckDlgButton(hwnd, DISABLE_SNIPES, !IsDlgButtonChecked(hwnd, DISABLE_SNIPES));
136 break;
137 case SPEED_UP_AUTOSCROLLERS:
138 CheckDlgButton(hwnd, SPEED_UP_AUTOSCROLLERS, !IsDlgButtonChecked(hwnd, SPEED_UP_AUTOSCROLLERS));
139 break;
140 case TMP1:
141 {
142 std::wstring text(128, L'\0');
143 int length = GetWindowText(g_panelId, text.data(), static_cast<int>(text.size()));
144 text.resize(length);
145 std::wstringstream s;
146 int panelId;
147 s << text;
148 s >> std::hex >> panelId;
149 g_puzzle = PuzzleSerializer(g_witnessProc).ReadPuzzle(panelId);
150 }
151 break;
152 case TMP2:
153 {
154 std::wstring text(128, L'\0');
155 int length = GetWindowText(g_panelId, text.data(), static_cast<int>(text.size()));
156 text.resize(length);
157 std::wstringstream s;
158 int panelId;
159 s << text;
160 s >> std::hex >> panelId;
161 PuzzleSerializer(g_witnessProc).WritePuzzle(g_puzzle, panelId);
162 }
163 break;
164 case TMP3:
165 {
166 for (auto [key, value] : PANELS) {
167 std::stringstream out;
168 std::string name(value);
169 out << " {'id': 0x" << std::hex << std::uppercase << std::setfill('0') << std::setw(5) << key << ", 'area':'";
170 int k;
171 for (k=0; name[k] != ' '; k++) out << name[k];
172 if (name[k+2] == ' ') {
173 out << name[k] << name[k+1];
174 k += 2;
175 }
176 out << "', 'name':'";
177 k++;
178 for (k; k < name.size(); k++) out << name[k];
179 out << "', 'data':'";
180 auto puzzle = PuzzleSerializer(g_witnessProc).ReadPuzzle(key);
181 out << puzzle.Serialize();
182 out << "'},\r\n";
183 DebugPrint(out.str());
184 }
185 }
186
187 // Solver::Solve(g_puzzle);
188 break;
189 case TMP4:
190 SetRandomSeed();
191 g_randomizer2->Randomize();
192 case TMP5:
193 {
194 std::wstring text;
195 for (int i=0; i<10; i++) {
196 Random::SetSeed(i);
197 int rng = Random::RandInt(0, 999999);
198 text += std::to_wstring(rng) + L"\n";
199 }
200 SetWindowText(g_rngDebug, text.c_str());
201 }
202 }
203 }
204 return DefWindowProc(hwnd, message, wParam, lParam);
205}
206
207void SetRandomSeed() {
208 std::wstring text(128, L'\0');
209 int length = GetWindowText(g_seed, text.data(), static_cast<int>(text.size()));
210 if (length > 0) { // Set seed
211 text.resize(length);
212 Random::SetSeed(_wtoi(text.c_str()));
213 } else { // Random seed
214 int seed = Random::RandInt(0, 999999);
215
216 text = std::to_wstring(seed);
217 SetWindowText(g_seed, text.c_str());
218 CHARRANGE range = {0, static_cast<long>(text.length())};
219 PostMessage(g_seed, EM_EXSETSEL, NULL, (LPARAM)&range);
220 SetFocus(g_seed);
221
222 Random::SetSeed(seed);
223 }
224}
225
226HWND CreateLabel(int x, int y, int width, LPCWSTR text) {
227 return CreateWindow(L"STATIC", text,
228 WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT,
229 x, y, width, 16, g_hwnd, NULL, g_hInstance, NULL);
230}
231
232HWND CreateText(int x, int y, int width, LPCWSTR defaultText = L"") {
233 return CreateWindow(MSFTEDIT_CLASS, defaultText,
234 WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER,
235 x, y, width, 26, g_hwnd, NULL, g_hInstance, NULL);
236}
237
238#pragma warning(push)
239#pragma warning(disable: 4312)
240HWND CreateButton(int x, int y, int width, LPCWSTR text, int message) {
241 return CreateWindow(L"BUTTON", text,
242 WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
243 x, y, width, 26, g_hwnd, (HMENU)message, g_hInstance, NULL);
244}
245
246HWND CreateCheckbox(int x, int y, int message) {
247 return CreateWindow(L"BUTTON", L"",
248 WS_VISIBLE | WS_CHILD | BS_CHECKBOX,
249 x, y, 12, 12, g_hwnd, (HMENU)message, g_hInstance, NULL);
250}
251#pragma warning(pop)
252
253int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) {
254 LoadLibrary(L"Msftedit.dll");
255 WNDCLASSW wndClass = {
256 CS_HREDRAW | CS_VREDRAW,
257 WndProc,
258 0,
259 0,
260 hInstance,
261 NULL,
262 LoadCursor(nullptr, IDC_ARROW),
263 (HBRUSH)(COLOR_WINDOW+1),
264 WINDOW_CLASS,
265 WINDOW_CLASS,
266 };
267 RegisterClassW(&wndClass);
268
269 g_hInstance = hInstance;
270
271 RECT rect;
272 GetClientRect(GetDesktopWindow(), &rect);
273 g_hwnd = CreateWindow(WINDOW_CLASS, PRODUCT_NAME, WS_OVERLAPPEDWINDOW,
274 rect.right - 550, 200, 500, 500, nullptr, nullptr, hInstance, nullptr);
275
276 CreateLabel(390, 15, 90, L"Version: " VERSION_STR);
277 g_seed = CreateText(10, 10, 100, L"21581");
278 PostMessage(g_seed, EM_SETEVENTMASK, 0, ENM_KEYEVENTS);
279 g_randomizerStatus = CreateButton(120, 10, 180, L"Randomize", RANDOMIZING);
280 EnableWindow(g_randomizerStatus, FALSE);
281 CreateCheckbox(10, 300, CHALLENGE_ONLY);
282 CreateLabel(30, 300, 200, L"Randomize the challenge only");
283 CreateCheckbox(10, 320, DISABLE_SNIPES);
284 CheckDlgButton(g_hwnd, DISABLE_SNIPES, TRUE);
285 CreateLabel(30, 320, 240, L"Disable Swamp and Shadows snipes");
286 CreateCheckbox(10, 340, SPEED_UP_AUTOSCROLLERS);
287 CreateLabel(30, 340, 205, L"Speed up various autoscrollers");
288
289 // CreateButton(200, 50, 200, L"Test RNG", TMP5);
290 // g_rngDebug = CreateWindow(L"STATIC", L"",
291 // WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT,
292 // 200, 80, 200, 200, g_hwnd, NULL, g_hInstance, NULL);
293//#ifndef NDEBUG
294// g_panelId = CreateText(200, 100, 100, L"59");
295// CreateButton(200, 130, 100, L"Read", TMP1);
296// CreateButton(200, 160, 100, L"Write", TMP2);
297 CreateButton(200, 190, 100, L"Solve", TMP3);
298// CreateButton(200, 220, 100, L"Randomize2", TMP4);
299//#endif
300
301 g_witnessProc->StartHeartbeat(g_hwnd, HEARTBEAT);
302
303 ShowWindow(g_hwnd, nCmdShow);
304 UpdateWindow(g_hwnd);
305
306 MSG msg;
307 while (GetMessage(&msg, nullptr, 0, 0) == TRUE) {
308 TranslateMessage(&msg);
309 DispatchMessage(&msg);
310 }
311
312 return (int) msg.wParam;
313}
diff --git a/App2/Version.h b/App2/Version.h new file mode 100644 index 0000000..0afb03f --- /dev/null +++ b/App2/Version.h
@@ -0,0 +1,14 @@
1#pragma once
2
3#define TO_STRING2(s) L#s
4#define TO_STRING(s) TO_STRING2(s)
5
6#define MAJOR 0
7#define MINOR 0
8#define PATCH 1
9
10#define VERSION_STR TO_STRING(MAJOR) L"." TO_STRING(MINOR) L"." TO_STRING(PATCH)
11#define VERSION MAJOR, MINOR, PATCH
12
13#define PRODUCT_NAME L"Witness Challenge Randomizer"
14#define WINDOW_CLASS L"WitnessChallengeRandomizer"