Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
Add AKOpenMode enum to make the wwise hook more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
vswarte committed Jan 13, 2024
1 parent 8a857f8 commit fb2044a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/modengine/ext/mod_loader/wwise_file_overrides.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ std::optional<std::wstring> normalize_filename(const std::wstring path) {

ScannedHook<decltype(&ak_file_location_resolver_open)> hooked_ak_file_location_resolver_open;

void* __cdecl ak_file_location_resolver_open(UINT64 p1, wchar_t* path, UINT64 openMode, UINT64 p4, UINT64 p5, UINT64 p6)
void* __cdecl ak_file_location_resolver_open(UINT64 p1, wchar_t* path, AKOpenMode openMode, UINT64 p4, UINT64 p5, UINT64 p6)
{
std::wstring lookup(path);
debug(L"sd.bhd entry requested: {}", lookup);
Expand All @@ -114,7 +114,7 @@ void* __cdecl ak_file_location_resolver_open(UINT64 p1, wchar_t* path, UINT64 op
}

auto override_path_string = override.value().wstring();
return hooked_ak_file_location_resolver_open.original(p1, override_path_string.data(), 0, p4, p5, p6);
return hooked_ak_file_location_resolver_open.original(p1, override_path_string.data(), AKOpenMode::READ, p4, p5, p6);
}

}
14 changes: 12 additions & 2 deletions src/modengine/ext/mod_loader/wwise_file_overrides.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@

namespace modengine::ext {

void* __cdecl ak_file_location_resolver_open(UINT64 p1, wchar_t* path, UINT64 p3, UINT64 p4, UINT64 p5, UINT64 p6);
enum AKOpenMode : uint32_t {
READ = 0,
WRITE = 1,
WRITE_OVERWRITE = 2,
READ_WRITE = 3,

// Custom mode specific to From Software's implementation
READ_EBL = 9,
};

void* __cdecl ak_file_location_resolver_open(UINT64 p1, wchar_t* path, AKOpenMode openMode, UINT64 p4, UINT64 p5, UINT64 p6);

extern ScannedHook<decltype(&ak_file_location_resolver_open)> hooked_ak_file_location_resolver_open;

}
}

0 comments on commit fb2044a

Please sign in to comment.