Skip to content

Commit 2250af9

Browse files
authored
Merge branch 'praydog:master' into master
2 parents ae09a28 + c0b8849 commit 2250af9

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ FetchContent_Declare(
134134
)
135135
FetchContent_MakeAvailable(bddisasm)
136136

137-
message(STATUS "Fetching kananlib (ccf2e5a32cf4c85a90641ae7a35c2b1d636c7636)...")
137+
message(STATUS "Fetching kananlib (cca66766b139994f478ea48befd67a179b7310ab)...")
138138
FetchContent_Declare(
139139
kananlib
140140
GIT_REPOSITORY
141141
https://github.com/cursey/kananlib
142142
GIT_TAG
143-
ccf2e5a32cf4c85a90641ae7a35c2b1d636c7636
143+
cca66766b139994f478ea48befd67a179b7310ab
144144
)
145145
FetchContent_MakeAvailable(kananlib)
146146

cmake.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ tag = "v1.34.10"
175175

176176
[fetch-content.kananlib]
177177
git = "https://github.com/cursey/kananlib"
178-
tag = "ccf2e5a32cf4c85a90641ae7a35c2b1d636c7636"
178+
tag = "cca66766b139994f478ea48befd67a179b7310ab"
179179

180180
[target.utility]
181181
type = "static"

src/HookManager.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <ranges>
2+
13
#include <hde64.h>
24
#include <spdlog/spdlog.h>
35

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

130-
for (const auto& cb : cbs) {
132+
// Iterate in reverse because it helps with the hook storage we use in Lua
133+
// It should help with any other system that wants to use a stack-based storage system.
134+
for (const auto& cb : cbs | std::views::reverse) {
131135
if (cb.post_fn) {
132136
// Valid return address in recursion scenario is no longer supported with this API.
133137
// We just pass ret_addr_pre for now, even though it's not accurate.

src/mods/ScriptRunner.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class ScriptState {
178178
auto it = m_hook_storage.find(thread_hash);
179179
if (it != m_hook_storage.end()) {
180180
if (!it->second.empty()) {
181-
it->second.pop_front();
181+
it->second.pop_back();
182182
}
183183
}
184184

@@ -196,7 +196,7 @@ class ScriptState {
196196
auto it = m_hook_storage.find(thread_hash);
197197
if (it != m_hook_storage.end()) {
198198
if (!it->second.empty()) {
199-
return it->second.front();
199+
return it->second.back();
200200
}
201201
}
202202

0 commit comments

Comments
 (0)