From a828620c6447e8c51f6e9d1767eabe0fc5ade0a0 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Mon, 5 Nov 2018 08:15:23 -0800 Subject: moving stuff so I can test --- Source/Main.cpp | 193 -------------------------------------------------------- 1 file changed, 193 deletions(-) delete mode 100644 Source/Main.cpp (limited to 'Source/Main.cpp') diff --git a/Source/Main.cpp b/Source/Main.cpp deleted file mode 100644 index ce0e550..0000000 --- a/Source/Main.cpp +++ /dev/null @@ -1,193 +0,0 @@ -#include "windows.h" -#include - -#include - -#include "Randomizer.h" -#include "Version.h" -#include "Random.h" -#include "Panel.h" - -#define IDC_RANDOMIZE 0x401 -#define IDC_TOGGLESPEED 0x402 -#define IDC_SPEEDRUNNER 0x403 -#define IDC_HARDMODE 0x404 -#define IDC_READ 0x405 -#define IDC_RANDOM 0x406 -#define IDC_WRITE 0x407 -#define IDC_DUMP 0x408 - -HWND hwndSeed, hwndRandomize; -// int panel = 0x18AF; -int panel = 0x33D4; -std::shared_ptr _panel; - -LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - static bool wasSeedRandomlyGenerated; - - if (message == WM_DESTROY) { - PostQuitMessage(0); - } else if (message == WM_COMMAND) { - switch (LOWORD(wParam)) { - // Speed checkbox - case IDC_TOGGLESPEED: - if (IsDlgButtonChecked(hwnd, IDC_TOGGLESPEED)) { - CheckDlgButton(hwnd, IDC_TOGGLESPEED, BST_UNCHECKED); - } else { - CheckDlgButton(hwnd, IDC_TOGGLESPEED, BST_CHECKED); - } - break; - - // Randomize button - case IDC_RANDOMIZE: - { - std::wstring text(100, '\0'); - GetWindowText(hwndSeed, &text[0], 100); - int seed = 0; - if (wasSeedRandomlyGenerated || wcslen(text.c_str()) == 0) { - seed = Random::RandInt(0, 100000); - wasSeedRandomlyGenerated = true; - } else { - seed = _wtoi(text.c_str()); - wasSeedRandomlyGenerated = false; - } - - Randomizer randomizer; - short metadata = randomizer.Randomize(seed); - if (metadata & 0x1) break; // Was already randomized - - std::wstring seedString = std::to_wstring(seed); - SetWindowText(hwndSeed, seedString.c_str()); - if (IsDlgButtonChecked(hwnd, IDC_TOGGLESPEED)) { - randomizer.AdjustSpeed(); - } - SetWindowText(hwndRandomize, L"Randomized!"); - break; - } - case IDC_READ: - _panel = std::make_shared(panel); - break; - case IDC_RANDOM: - _panel->Random(); - break; - case IDC_WRITE: - _panel->Write(panel); - break; - case IDC_DUMP: - _panel->Serialize(); - break; - } - } - return DefWindowProc(hwnd, message, wParam, lParam); -} - -int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) -{ - LoadLibrary(L"Msftedit.dll"); - - WNDCLASSW wndClass = { - CS_HREDRAW | CS_VREDRAW, - WndProc, - 0, - 0, - hInstance, - NULL, - LoadCursor(nullptr, IDC_ARROW), - (HBRUSH)(COLOR_WINDOW+1), - WINDOW_CLASS, - WINDOW_CLASS, - }; - RegisterClassW(&wndClass); - - RECT rect; - GetClientRect(GetDesktopWindow(), &rect); - HWND hwnd = CreateWindow(WINDOW_CLASS, PRODUCT_NAME, WS_OVERLAPPEDWINDOW, - rect.right - 550, 200, 500, 500, nullptr, nullptr, hInstance, nullptr); - - CreateWindow(L"STATIC", L"Version: " VERSION_STR, - WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT, - 390, 15, 90, 16, hwnd, NULL, hInstance, NULL); - - CreateWindow(L"STATIC", L"Enter a seed:", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT, - 10, 15, 90, 16, hwnd, NULL, hInstance, NULL); - hwndSeed = CreateWindow(MSFTEDIT_CLASS, L"", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER, - 100, 10, 50, 26, hwnd, NULL, hInstance, NULL); - hwndRandomize = CreateWindow(L"BUTTON", L"Randomize", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, - 160, 10, 100, 26, hwnd, (HMENU)IDC_RANDOMIZE, hInstance, NULL); - -#if GLOBALS == 0x5B28C0 - CreateWindow(L"BUTTON", L"READ", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, - 160, 100, 100, 26, hwnd, (HMENU)IDC_READ, hInstance, NULL); - CreateWindow(L"BUTTON", L"RANDOM", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, - 160, 130, 100, 26, hwnd, (HMENU)IDC_RANDOM, hInstance, NULL); - CreateWindow(L"BUTTON", L"WRITE", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, - 160, 160, 100, 26, hwnd, (HMENU)IDC_WRITE, hInstance, NULL); - CreateWindow(L"BUTTON", L"DUMP", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, - 160, 190, 100, 26, hwnd, (HMENU)IDC_DUMP, hInstance, NULL); -#endif - - CreateWindow(L"BUTTON", L"", - WS_VISIBLE | WS_CHILD | BS_CHECKBOX, - 10, 52, 12, 12, hwnd, (HMENU)IDC_TOGGLESPEED, hInstance, NULL); - CreateWindow(L"STATIC", L"Speed up various autoscrollers", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT, - 27, 50, 205, 16, hwnd, NULL, hInstance, NULL); - - /* - CreateWindow(L"BUTTON", L"", - WS_VISIBLE | WS_CHILD | BS_CHECKBOX, - 10, 52, 12, 12, hwnd, (HMENU)IDC_SPEEDRUNNER, hInstance, NULL); - CreateWindow(L"STATIC", L"Allow hard-to-identify panels to be shuffled", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT, - 27, 50, 205, 16, hwnd, NULL, hInstance, NULL); - - CreateWindow(L"BUTTON", L"", - WS_VISIBLE | WS_CHILD | BS_CHECKBOX, - 10, 52, 12, 12, hwnd, (HMENU)IDC_HARDMODE, hInstance, NULL); - CreateWindow(L"STATIC", L"Place harder puzzles in annoying spots", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT, - 27, 50, 205, 16, hwnd, NULL, hInstance, NULL); - - CreateWindow(L"BUTTON", L"", - WS_VISIBLE | WS_CHILD | BS_CHECKBOX, - 10, 52, 12, 12, hwnd, (HMENU)IDC_NORANDOMIZE, hInstance, NULL); - CreateWindow(L"STATIC", L"Do not randomize any puzzles", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT, - 27, 50, 205, 16, hwnd, NULL, hInstance, NULL); - - CreateWindow(L"BUTTON", L"", - WS_VISIBLE | WS_CHILD | BS_CHECKBOX, - 10, 52, 12, 12, hwnd, (HMENU)IDC_CASUAL, hInstance, NULL); - CreateWindow(L"STATIC", L"Don't randomize context-based puzzles", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT, - 27, 50, 205, 16, hwnd, NULL, hInstance, NULL); - - CreateWindow(L"BUTTON", L"", - WS_VISIBLE | WS_CHILD | BS_CHECKBOX, - 10, 52, 12, 12, hwnd, (HMENU)IDC_BANSNIPES, hInstance, NULL); - CreateWindow(L"STATIC", L"Prevent sniping certain puzzles", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT, - 27, 50, 205, 16, hwnd, NULL, hInstance, NULL); - -*/ - - ShowWindow(hwnd, nCmdShow); - UpdateWindow(hwnd); - - MSG msg; - while (!GetMessage(&msg, nullptr, 0, 0) == 0) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return (int) msg.wParam; -} -- cgit 1.4.1