From a53925a333c6208113db710a07d1ff6e520bf912 Mon Sep 17 00:00:00 2001 From: Dregu Date: Sat, 4 Nov 2023 21:56:34 +0200 Subject: [PATCH] remove old patch watermark code --- src/game_api/bucket.hpp | 2 ++ src/game_api/state.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/game_api/bucket.hpp b/src/game_api/bucket.hpp index 92087a25c..4babaf4a7 100644 --- a/src/game_api/bucket.hpp +++ b/src/game_api/bucket.hpp @@ -44,4 +44,6 @@ class Bucket std::unordered_map data; /// Access Overlunky options here, nil if Overlunky is not loaded. Overlunky* overlunky{nullptr}; + // Used by state.cpp to determine if patches should still be applied. + bool patches_applied{false}; }; diff --git a/src/game_api/state.cpp b/src/game_api/state.cpp index dc22c7092..55e6dff5a 100644 --- a/src/game_api/state.cpp +++ b/src/game_api/state.cpp @@ -9,6 +9,7 @@ #include // for allocator, operator""sv, operator""s #include // for move +#include "bucket.hpp" // for Bucket #include "containers/custom_allocator.hpp" // #include "entities_chars.hpp" // for Player #include "entity.hpp" // for to_id, Entity, HookWithId, EntityDB @@ -296,11 +297,9 @@ State& State::get() strings_init(); init_state_update_hook(); - auto watermark_offset = get_address("destroy_game_manager") - 8; // pulled this out of a hat, its just a random place with some CCCC hopefully - auto watermark = memory_read(watermark_offset); - if (watermark != 0x4C4F4C4F) + auto bucket = Bucket::get(); + if (!bucket->patches_applied) { - write_mem_prot(watermark_offset, "\x4F\x4C\x4F\x4C", true); DEBUG("Applying patches"); patch_tiamat_kill_crash(); patch_orbs_limit(); @@ -308,6 +307,7 @@ State& State::get() patch_liquid_OOB(); patch_ushabti_error(); patch_entering_closed_door_crash(); + bucket->patches_applied = true; } else {