Skip to content

Commit

Permalink
Merge branch 'praydog:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyhodge authored May 24, 2024
2 parents ae09a28 + c0b8849 commit 2250af9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(bddisasm)

message(STATUS "Fetching kananlib (ccf2e5a32cf4c85a90641ae7a35c2b1d636c7636)...")
message(STATUS "Fetching kananlib (cca66766b139994f478ea48befd67a179b7310ab)...")
FetchContent_Declare(
kananlib
GIT_REPOSITORY
https://github.com/cursey/kananlib
GIT_TAG
ccf2e5a32cf4c85a90641ae7a35c2b1d636c7636
cca66766b139994f478ea48befd67a179b7310ab
)
FetchContent_MakeAvailable(kananlib)

Expand Down
2 changes: 1 addition & 1 deletion cmake.toml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ tag = "v1.34.10"

[fetch-content.kananlib]
git = "https://github.com/cursey/kananlib"
tag = "ccf2e5a32cf4c85a90641ae7a35c2b1d636c7636"
tag = "cca66766b139994f478ea48befd67a179b7310ab"

[target.utility]
type = "static"
Expand Down
6 changes: 5 additions & 1 deletion src/HookManager.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <ranges>

#include <hde64.h>
#include <spdlog/spdlog.h>

Expand Down Expand Up @@ -127,7 +129,9 @@ void HookManager::HookedFn::on_post_hook() {
auto& ret_val = storage->ret_val;
//auto& ret_addr = storage->ret_addr_post;

for (const auto& cb : cbs) {
// Iterate in reverse because it helps with the hook storage we use in Lua
// It should help with any other system that wants to use a stack-based storage system.
for (const auto& cb : cbs | std::views::reverse) {
if (cb.post_fn) {
// Valid return address in recursion scenario is no longer supported with this API.
// We just pass ret_addr_pre for now, even though it's not accurate.
Expand Down
4 changes: 2 additions & 2 deletions src/mods/ScriptRunner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class ScriptState {
auto it = m_hook_storage.find(thread_hash);
if (it != m_hook_storage.end()) {
if (!it->second.empty()) {
it->second.pop_front();
it->second.pop_back();
}
}

Expand All @@ -196,7 +196,7 @@ class ScriptState {
auto it = m_hook_storage.find(thread_hash);
if (it != m_hook_storage.end()) {
if (!it->second.empty()) {
return it->second.front();
return it->second.back();
}
}

Expand Down

0 comments on commit 2250af9

Please sign in to comment.