Skip to content

Commit

Permalink
D3D12Hook: Fix deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Jun 3, 2024
1 parent 445e521 commit 1c81214
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/D3D12Hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ void D3D12Hook::hook_streamline(HMODULE dlssg_module) try {
return;
}

std::scoped_lock _{g_framework->get_hook_monitor_mutex()};
std::scoped_lock _{D3D12Hook::s_streamline.hook_mutex};

if (D3D12Hook::s_streamline.setup) {
return;
}

spdlog::info("[Streamline] Hooking Streamline");

Expand Down
1 change: 1 addition & 0 deletions src/D3D12Hook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class D3D12Hook
static void* link_swapchain_to_cmd_queue(void* rcx, void* rdx, void* r8, void* r9);

std::unique_ptr<FunctionHook> link_swapchain_to_cmd_queue_hook{};
std::mutex hook_mutex{};
bool setup{ false };
};

Expand Down
2 changes: 1 addition & 1 deletion src/REFramework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ try {
std::wstring base_dll_name = NotificationData->Loaded.BaseDllName->Buffer;
spdlog::info("LdrRegisterDllNotification: Loaded: {}", utility::narrow(base_dll_name));

if (std::wstring_view{base_dll_name}.find(L"sl.dlss_g.dll") != std::wstring_view::npos) {
if (base_dll_name.find(L"sl.dlss_g.dll") != std::wstring::npos) {
spdlog::info("LdrRegisterDllNotification: Detected DLSS DLL loaded");

D3D12Hook::hook_streamline((HMODULE)NotificationData->Loaded.DllBase);
Expand Down

0 comments on commit 1c81214

Please sign in to comment.