Skip to content

Commit

Permalink
Fix avs/pkfs stepping on each others toes
Browse files Browse the repository at this point in the history
  • Loading branch information
mon committed Sep 14, 2023
1 parent ad71b27 commit 5c126e6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,7 @@ class PkfsHookFile : public HookFile {

uint32_t call_real() override {
log_if_modfile();
// note that this also hides the avs_fs_open of the pakfile holding a
// particular file - acceptable compromise IMO
inside_pkfs_hook = true;
auto ret = pkfs_fs_open(get_path_to_open().c_str());
inside_pkfs_hook = false;
return ret;
}

Expand Down Expand Up @@ -398,6 +394,10 @@ unsigned int hook_pkfs_open(const char *name) {
// unpack success
PkfsHookFile file(path, *norm_path);

// note that this also hides the avs_fs_open of the pakfile holding a
// particular file - acceptable compromise IMO
inside_pkfs_hook = true;

#ifdef UNPAK
string pakdump_loc = "./data_unpak/" + file.norm_path;
if(!file_exists(pakdump_loc.c_str())) {
Expand All @@ -422,7 +422,9 @@ unsigned int hook_pkfs_open(const char *name) {
}
#endif

return handle_file_open(file);
auto ret = handle_file_open(file);
inside_pkfs_hook = false;
return ret;
}

extern "C" {
Expand Down

0 comments on commit 5c126e6

Please sign in to comment.