From 8dd2e7d78153191f31457561f4fdfabec7eeb05b Mon Sep 17 00:00:00 2001 From: Dregu Date: Mon, 27 May 2024 13:39:25 +0300 Subject: [PATCH] wip render cheats --- search.cpp | 12 ++++++++++++ ui.cpp | 25 +++++++++++++++++++++++++ ui.h | 15 +++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/search.cpp b/search.cpp index c695bbe..1e985f0 100644 --- a/search.cpp +++ b/search.cpp @@ -538,6 +538,18 @@ std::unordered_map g_address_rules{ .at_exe() .function_start(), }, + { + // RE: L"Visibility", 7E -> EB + "darkness"sv, PatternCommandBuffer{}.from_exe_base(0x12ae73), // TODO + }, + { + // RE: L"Visibility", 7F 0E -> EB 0E + "gameboy"sv, PatternCommandBuffer{}.from_exe_base(0x12c11a), // TODO + }, + { + // RE: L"Visibility", 7E 19 -> EB 19 + "hud"sv, PatternCommandBuffer{}.from_exe_base(0x12c40d), // TODO + }, }; std::unordered_map g_cached_addresses; diff --git a/ui.cpp b/ui.cpp index 6274b6f..4275d04 100644 --- a/ui.cpp +++ b/ui.cpp @@ -362,6 +362,12 @@ bool UI::Keys() { options["cheat_godmode"].value ^= true; else if (ImGui::IsKeyChordPressed(keys["toggle_damage"])) options["cheat_damage"].value ^= true; + else if (ImGui::IsKeyChordPressed(keys["toggle_darkness"])) + options["cheat_darkness"].value ^= true; + else if (ImGui::IsKeyChordPressed(keys["toggle_gameboy"])) + options["cheat_gameboy"].value ^= true; + else if (ImGui::IsKeyChordPressed(keys["toggle_hud"])) + options["cheat_hud"].value ^= true; else if (ImGui::IsKeyChordPressed(keys["warp"])) doWarp = true; else @@ -502,6 +508,25 @@ void UI::Draw() { recover_mem("god"); } + if (options["cheat_darkness"].value) { + write_mem_recoverable("darkness", get_address("darkness"), "\xEB\x19", + true); + } else { + recover_mem("darkness"); + } + + if (options["cheat_gameboy"].value) { + write_mem_recoverable("gameboy", get_address("gameboy"), "\xEB\x0E", true); + } else { + recover_mem("gameboy"); + } + + if (options["cheat_hud"].value) { + write_mem_recoverable("hud", get_address("hud"), "\xEB\x19", true); + } else { + recover_mem("hud"); + } + if (options["cheat_noclip"].value) { *Max::get().player_state() = 18; } diff --git a/ui.h b/ui.h index 89c2ac1..979b799 100644 --- a/ui.h +++ b/ui.h @@ -40,6 +40,9 @@ class UI { {"toggle_noclip", ImGuiMod_Ctrl | ImGuiKey_F}, {"toggle_godmode", ImGuiMod_Ctrl | ImGuiKey_G}, {"toggle_damage", ImGuiMod_Ctrl | ImGuiKey_D}, + {"toggle_darkness", ImGuiMod_Ctrl | ImGuiKey_L}, + {"toggle_gameboy", ImGuiMod_Ctrl | ImGuiKey_K}, + {"toggle_hud", ImGuiMod_Ctrl | ImGuiKey_H}, {"warp", ImGuiMod_Ctrl | ImGuiKey_W}, }; // TODO: Save to ini @@ -56,6 +59,18 @@ class UI { {"cheat_noclip", {false, "Noclip", "Do the cring thing without the cring.", "toggle_noclip"}}, + {"cheat_darkness", + {false, "Remove darkness", + "Removes the fog of war effect, see through walls.", + "toggle_darkness"}}, + {"cheat_gameboy", + {false, "Gameboy mode", + "Party like it's 1989! Enable the B&W death screen shader all the " + "time.", + "toggle_gameboy"}}, + {"cheat_hud", + {false, "Hide ingame HUD", + "Removes all HUD elements, including the menus.", "toggle_hud"}}, {"input_block", {true, "Block game input on UI input", "Blocks keyboard input from game\n"