From 1501b173c058f11e53507532ad583a6ac9c061cc Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Sat, 17 Nov 2018 14:02:28 -0800 Subject: 4.0.5 --- App/App.vcxproj | 5 +++++ App/Main.cpp | 3 ++- App/Version.h | 2 +- Installer/Installer.vdproj | 8 ++++---- Source/Memory.h | 6 ++++-- Source/Randomizer.cpp | 2 ++ Source/Source.vcxproj | 1 + Test/Temp.cpp | 31 ++++++++++++++++++++++++++++++- WitnessRandomizer.sln | 16 ++++++++-------- 9 files changed, 57 insertions(+), 17 deletions(-) diff --git a/App/App.vcxproj b/App/App.vcxproj index 1633837..2597b8d 100644 --- a/App/App.vcxproj +++ b/App/App.vcxproj @@ -72,15 +72,19 @@ true + WitnessRandomizer true + WitnessRandomizer false + WitnessRandomizer false + WitnessRandomizer @@ -151,6 +155,7 @@ stdcpp17 ..\Source;%(AdditionalIncludeDirectories) true + MultiThreaded Windows diff --git a/App/Main.cpp b/App/Main.cpp index 6ebef7e..7a8e7f3 100644 --- a/App/Main.cpp +++ b/App/Main.cpp @@ -54,7 +54,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) GetWindowText(hwndSeed, &text[0], 100); int seed = _wtoi(text.c_str()); - if (seedIsRNG || text.empty()) { + // TODO: text needs to be resized! + if (seedIsRNG || wcslen(text.c_str()) == 0) { seed = Random::RandInt(0, 100000); seedIsRNG = true; } diff --git a/App/Version.h b/App/Version.h index 8029020..04b6d2b 100644 --- a/App/Version.h +++ b/App/Version.h @@ -5,7 +5,7 @@ #define MAJOR 4 #define MINOR 0 -#define PATCH 4 +#define PATCH 5 #define VERSION_STR TO_STRING(MAJOR) L"." TO_STRING(MINOR) L"." TO_STRING(PATCH) #define VERSION MAJOR, MINOR, PATCH diff --git a/Installer/Installer.vdproj b/Installer/Installer.vdproj index 19d6036..c53cdfb 100644 --- a/Installer/Installer.vdproj +++ b/Installer/Installer.vdproj @@ -162,15 +162,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:Witness Randomizer" - "ProductCode" = "8:{7DD620CA-9593-4E32-9D60-9D12069DA33C}" - "PackageCode" = "8:{BBA8F7F1-52D8-44B0-BC53-9AC3F0181E3D}" + "ProductCode" = "8:{4CD5A308-B14D-48BA-A677-08026664CC30}" + "PackageCode" = "8:{9E5B2E28-1FE1-41FF-ADCD-4C86649EFB9F}" "UpgradeCode" = "8:{4CB5496B-A47E-41D3-B4A7-677E29AB7513}" "AspNetVersion" = "8:2.0.50727.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:FALSE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:4.0.4" + "ProductVersion" = "8:4.0.5" "Manufacturer" = "8:jbzdarkid" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:https://www.github.com/jbzdarkid/witness-randomizer/issues" @@ -698,7 +698,7 @@ { "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_F4835D5BBF3E437390127C4C49888F07" { - "SourcePath" = "8:..\\x64\\Debug\\App.exe" + "SourcePath" = "8:..\\x64\\Release\\WitnessRandomizer.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_8E9D847124D34D9D9008762077D816DE" diff --git a/Source/Memory.h b/Source/Memory.h index d14d58d..23f6388 100644 --- a/Source/Memory.h +++ b/Source/Memory.h @@ -3,8 +3,8 @@ #include #include -#define GLOBALS 0x5B28C0 -// #define GLOBALS 0x62A080 +// #define GLOBALS 0x5B28C0 +#define GLOBALS 0x62A080 // https://github.com/erayarslan/WriteProcessMemory-Example // http://stackoverflow.com/q/32798185 @@ -75,4 +75,6 @@ private: std::map _computedAddresses; uintptr_t _baseAddress = 0; HANDLE _handle = nullptr; + + friend class Temp; }; \ No newline at end of file diff --git a/Source/Randomizer.cpp b/Source/Randomizer.cpp index a21b928..6f9c12b 100644 --- a/Source/Randomizer.cpp +++ b/Source/Randomizer.cpp @@ -8,6 +8,8 @@ * Randomize audio logs -- Hard, seem to be unloaded some times? * Swap sounds in jungle (along with panels) -- maybe impossible * Make orange 7 (all of oranges?) hard. Like big = hard. (See: HARD_MODE) + * Add a setting for "disable wonkavator and hotel", so that 100% runs are possible + * Try to stabilize challenge/doors RNG */ #include "Memory.h" #include "Randomizer.h" diff --git a/Source/Source.vcxproj b/Source/Source.vcxproj index 545753d..85ce6e1 100644 --- a/Source/Source.vcxproj +++ b/Source/Source.vcxproj @@ -147,6 +147,7 @@ true stdcpp17 true + MultiThreaded Windows diff --git a/Test/Temp.cpp b/Test/Temp.cpp index c847c6b..6ccaeff 100644 --- a/Test/Temp.cpp +++ b/Test/Temp.cpp @@ -1,7 +1,21 @@ #include "gtest/gtest.h" #include "Randomizer.h" +#include +#include -GTEST_TEST(SwapTests, Shipwreck) { +class Temp : public testing::Test +{ +protected: + std::vector ReadSubtitles(int size) { + Memory memory("witness64_d3d11.exe"); + std::vector data; + data.resize(size); + ReadProcessMemory(memory._handle, (LPVOID)0x3D89F000, &data[0], sizeof(char) * size, nullptr); + return data; + } +}; + +TEST(SwapTests, Shipwreck) { Randomizer randomizer; int shipwreck = 0xAFB; int thEntry = 0x288C; @@ -17,3 +31,18 @@ GTEST_TEST(SwapTests, Shipwreck) { randomizer.SwapPanels(ypp, mill_upper_7, Randomizer::SWAP::LINES); } + +TEST_F(Temp, Extract) { +// std::vector data = ReadSubtitles(166480); + std::vector data = ReadSubtitles(166480); + std::ofstream file("raw.txt"); + ASSERT_TRUE(file.is_open()); + + std::string hex = "0123456789ABCDEF"; + for (int i=0; i