Skip to content

Commit

Permalink
wip render cheats
Browse files Browse the repository at this point in the history
  • Loading branch information
Dregu committed May 27, 2024
1 parent dcf6c54 commit 8dd2e7d
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
12 changes: 12 additions & 0 deletions search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,18 @@ std::unordered_map<std::string_view, AddressRule> 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<std::string_view, size_t> g_cached_addresses;

Expand Down
25 changes: 25 additions & 0 deletions ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
15 changes: 15 additions & 0 deletions ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit 8dd2e7d

Please sign in to comment.