Halen84 / ImGuiRDR2Hook

A Vulkan & DirectX 12 hook that allows you to create ImGui menus for Red Dead Redemption 2
MIT License
9 stars 3 forks source link

CTD after unloading script (Vulkan) #5

Open Halen84 opened 4 months ago

Halen84 commented 4 months ago

ImGuiRDR2Hook will for whatever reason CTD shortly after unloading the script.

According to x64dbg, the crash is coming from nvoglv64.dll?

I don't ever remember having this problem, must be an issue after a new update to the game, windows, or nvoglv64.dll.

Function Signature: E8 ? ? ? ? 45 33 E4 3B 05 ? ? ? ? Error Line Signature: 48 8B B0 ? ? ? ? F7 86 ? ? ? ? ? ? ? ? nvoglv64.dll version: 32.0.15.5585 (May 14th, 2024) (Not specific to this version, was also crashing all the back in version 31.0.15.5161 (February 17th, 2024) aswell)

IDA Screenshot Screenshot 2024-05-22 193537

Halen84 commented 4 months ago

Update: I was able to find a workaround for the crashing, but I'm not sure how good it is. I'm pretty sure doing this will cause a memory leak.

In CleanupDeviceVulkan() in vulkan.cpp, comment out the if (g_Instance) check. I guess the issue is the deletion of g_Instance and or calling vkDestroyInstance().

I was not able to identify the exact cause, I hooked the function described above and testing to see if anything was a nullptr and they all came back valid, so either the crash is happening somewhere else, or I did not test properly.

Side note: I was able to find an older version of nvoglv64.dll (32.0.15.4584) (October 17th, 2023) and the function is completely different from what it is now. Not sure if that has anything to deal with the crashing...