diff options
author | jbzdarkid <jbzdarkid@gmail.com> | 2019-11-09 12:04:19 -0800 |
---|---|---|
committer | jbzdarkid <jbzdarkid@gmail.com> | 2019-11-09 12:04:19 -0800 |
commit | ecbcb91e95a08201fbf90476ee4a18526cfc80bb (patch) | |
tree | 2a45b8c8785d022eac1d84a3bb004f3aaeb1d200 /App | |
parent | 4d55d7d9aad8d3c2bedec371c165bbb848c3786b (diff) | |
download | witness-tutorializer-ecbcb91e95a08201fbf90476ee4a18526cfc80bb.tar.gz witness-tutorializer-ecbcb91e95a08201fbf90476ee4a18526cfc80bb.tar.bz2 witness-tutorializer-ecbcb91e95a08201fbf90476ee4a18526cfc80bb.zip |
Commit early, commit often
Diffstat (limited to 'App')
-rw-r--r-- | App/Main.cpp | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/App/Main.cpp b/App/Main.cpp index 535a18e..d7e3abd 100644 --- a/App/Main.cpp +++ b/App/Main.cpp | |||
@@ -21,14 +21,13 @@ | |||
21 | #define SPEED_UP_AUTOSCROLLERS 0x408 | 21 | #define SPEED_UP_AUTOSCROLLERS 0x408 |
22 | 22 | ||
23 | /* ------- Temp ------- */ | 23 | /* ------- Temp ------- */ |
24 | #include "Panel.h" | ||
25 | #include <sstream> | ||
26 | |||
24 | #define TMP1 0x501 | 27 | #define TMP1 0x501 |
25 | #define TMP2 0x502 | 28 | #define TMP2 0x502 |
26 | #define TMP3 0x503 | ||
27 | #define TMP4 0x504 | ||
28 | 29 | ||
29 | #include "Panel.h" | 30 | HWND g_panelId; |
30 | // int panel = 0x33D4; // Tutorial vault | ||
31 | int panel = 0x0005D; // Outside Tutorial Dots Tutorial 1 | ||
32 | Puzzle g_puzzle; | 31 | Puzzle g_puzzle; |
33 | /* ------- Temp ------- */ | 32 | /* ------- Temp ------- */ |
34 | 33 | ||
@@ -132,10 +131,28 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) | |||
132 | CheckDlgButton(hwnd, SPEED_UP_AUTOSCROLLERS, !IsDlgButtonChecked(hwnd, SPEED_UP_AUTOSCROLLERS)); | 131 | CheckDlgButton(hwnd, SPEED_UP_AUTOSCROLLERS, !IsDlgButtonChecked(hwnd, SPEED_UP_AUTOSCROLLERS)); |
133 | break; | 132 | break; |
134 | case TMP1: | 133 | case TMP1: |
135 | g_puzzle = PuzzleSerializer(g_witnessProc).ReadPuzzle(panel); | 134 | { |
135 | std::wstring text(128, L'\0'); | ||
136 | int length = GetWindowText(g_panelId, text.data(), static_cast<int>(text.size())); | ||
137 | text.resize(length); | ||
138 | std::wstringstream s; | ||
139 | int panelId; | ||
140 | s << text; | ||
141 | s >> std::hex >> panelId; | ||
142 | g_puzzle = PuzzleSerializer(g_witnessProc).ReadPuzzle(panelId); | ||
143 | } | ||
136 | break; | 144 | break; |
137 | case TMP2: | 145 | case TMP2: |
138 | PuzzleSerializer(g_witnessProc).WritePuzzle(g_puzzle, panel); | 146 | { |
147 | std::wstring text(128, L'\0'); | ||
148 | int length = GetWindowText(g_panelId, text.data(), static_cast<int>(text.size())); | ||
149 | text.resize(length); | ||
150 | std::wstringstream s; | ||
151 | int panelId; | ||
152 | s << text; | ||
153 | s >> std::hex >> panelId; | ||
154 | PuzzleSerializer(g_witnessProc).WritePuzzle(g_puzzle, panelId); | ||
155 | } | ||
139 | break; | 156 | break; |
140 | } | 157 | } |
141 | } | 158 | } |
@@ -219,9 +236,9 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance | |||
219 | CreateCheckbox(10, 340, SPEED_UP_AUTOSCROLLERS); | 236 | CreateCheckbox(10, 340, SPEED_UP_AUTOSCROLLERS); |
220 | CreateLabel(30, 340, 205, L"Speed up various autoscrollers"); | 237 | CreateLabel(30, 340, 205, L"Speed up various autoscrollers"); |
221 | 238 | ||
222 | CreateButton(200, 100, 100, L"Read", TMP1); | 239 | g_panelId = CreateText(200, 100, 100, L"A3B2"); |
223 | CreateButton(200, 130, 100, L"Write", TMP2); | 240 | CreateButton(200, 130, 100, L"Read", TMP1); |
224 | CreateButton(200, 190, 100, L"Dump", TMP4); | 241 | CreateButton(200, 160, 100, L"Write", TMP2); |
225 | 242 | ||
226 | g_witnessProc->StartHeartbeat(g_hwnd); | 243 | g_witnessProc->StartHeartbeat(g_hwnd); |
227 | 244 | ||