Skip to content

Commit

Permalink
remove old patch watermark code
Browse files Browse the repository at this point in the history
  • Loading branch information
Dregu committed Nov 4, 2023
1 parent 793fd73 commit a53925a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/game_api/bucket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ class Bucket
std::unordered_map<std::string, BucketItem> 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};
};
8 changes: 4 additions & 4 deletions src/game_api/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <string> // for allocator, operator""sv, operator""s
#include <type_traits> // 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
Expand Down Expand Up @@ -296,18 +297,17 @@ 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<uint32_t>(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();
patch_olmec_kill_crash();
patch_liquid_OOB();
patch_ushabti_error();
patch_entering_closed_door_crash();
bucket->patches_applied = true;
}
else
{
Expand Down

0 comments on commit a53925a

Please sign in to comment.