From ab5652329d3e6bbaaf338e47fb3d84d89bf9b7b1 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Tue, 19 Nov 2019 09:59:59 -0800 Subject: shrug --- App/Main.cpp | 32 +++++++++++++++++++++++++------- Source/Memory.h | 8 ++++---- Source/Randomizer2.cpp | 2 ++ 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/App/Main.cpp b/App/Main.cpp index f780069..f5409ff 100644 --- a/App/Main.cpp +++ b/App/Main.cpp @@ -10,6 +10,7 @@ #include "Memory.h" #include "Random.h" #include "Randomizer.h" +#include "Randomizer2.h" // Heartbeat is defined to 0x401 by Memory.h #define RANDOMIZE_READY 0x402 @@ -23,7 +24,6 @@ /* ------- Temp ------- */ #include "Puzzle.h" #include "Solver.h" -#include "Randomizer2.h" #include "PuzzleSerializer.h" #include @@ -34,7 +34,9 @@ HWND g_panelId; Puzzle g_puzzle; -std::shared_ptr g_randomizer2; + +HWND g_rngDebug; +#define TMP5 0x505 /* ------- Temp ------- */ // Globals @@ -44,6 +46,7 @@ HWND g_randomizerStatus; HINSTANCE g_hInstance; auto g_witnessProc = std::make_shared(L"witness64_d3d11.exe"); std::shared_ptr g_randomizer; +std::shared_ptr g_randomizer2; void SetRandomSeed(); LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { @@ -168,6 +171,16 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case TMP4: SetRandomSeed(); g_randomizer2->Randomize(); + case TMP5: + { + std::wstring text; + for (int i=0; i<10; i++) { + Random::SetSeed(i); + int rng = Random::RandInt(0, 999999); + text += std::to_wstring(rng) + L"\n"; + } + SetWindowText(g_rngDebug, text.c_str()); + } } } return DefWindowProc(hwnd, message, wParam, lParam); @@ -250,11 +263,16 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance CreateCheckbox(10, 340, SPEED_UP_AUTOSCROLLERS); CreateLabel(30, 340, 205, L"Speed up various autoscrollers"); - g_panelId = CreateText(200, 100, 100, L"A3B2"); - CreateButton(200, 130, 100, L"Read", TMP1); - CreateButton(200, 160, 100, L"Write", TMP2); - CreateButton(200, 190, 100, L"Solve", TMP3); - CreateButton(200, 220, 100, L"Randomize2", TMP4); + CreateButton(200, 50, 200, L"Test RNG", TMP5); + g_rngDebug = CreateWindow(L"STATIC", L"", + WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT, + 200, 80, 200, 200, g_hwnd, NULL, g_hInstance, NULL); + + // g_panelId = CreateText(200, 100, 100, L"A3B2"); + // CreateButton(200, 130, 100, L"Read", TMP1); + // CreateButton(200, 160, 100, L"Write", TMP2); + // CreateButton(200, 190, 100, L"Solve", TMP3); + // CreateButton(200, 220, 100, L"Randomize2", TMP4); g_witnessProc->StartHeartbeat(g_hwnd); diff --git a/Source/Memory.h b/Source/Memory.h index 79fbaba..5332cc3 100644 --- a/Source/Memory.h +++ b/Source/Memory.h @@ -5,8 +5,8 @@ #include #include -#define GLOBALS 0x5B28C0 -// #define GLOBALS 0x62D0A0 +// #define GLOBALS 0x5B28C0 +#define GLOBALS 0x62D0A0 #define HEARTBEAT 0x401 enum class ProcStatus { @@ -188,8 +188,8 @@ private: #define METADATA 0xF2 // sizeof(short) #define HOTEL_EP_NAME 0x4BC640 #elif GLOBALS == 0x62D0A0 -#define POSITION #error -#define ORIENTATION #error +#define POSITION 0x24 +#define ORIENTATION 0x34 #define PATH_COLOR 0xC0 #define REFLECTION_PATH_COLOR 0xD0 #define DOT_COLOR 0xF0 diff --git a/Source/Randomizer2.cpp b/Source/Randomizer2.cpp index adf8eb6..00b584e 100644 --- a/Source/Randomizer2.cpp +++ b/Source/Randomizer2.cpp @@ -34,6 +34,7 @@ void Randomizer2::RandomizeTutorial() { Puzzle p; p.NewGrid(6, 6); + // @Bug: Mid-segment endpoints are not yet supported. switch (Random::RandInt(1, 4)) { case 1: p.grid[Random::RandInt(0, p.width-1)][0].end = Cell::Dir::UP; @@ -93,6 +94,7 @@ void Randomizer2::RandomizeTutorial() { p.grid[12][12].start = true; p.grid[6][0].end = Cell::Dir::UP; + // @Cleanup std::vector cuts; bool toTheRight; // Start by generating a cut line, to ensure one of the two startpoints is inaccessible -- cgit 1.4.1