Skip to content

Commit

Permalink
Always load the bundled VC++ DLLs
Browse files Browse the repository at this point in the history
  • Loading branch information
dextercd committed Jun 19, 2024
1 parent 67ed3af commit b7053f0
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions NoitaDearImGui/load.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ return function(path, name)
]])

local function loadlib_with_vs(vc_path, dll_path)
local old_dll_dir_buf = ffi.new("char[256]")
local old_dll_dir_buf = ffi.new("char[1024]")
local old_dll_dir_sz = C.GetDllDirectoryA(ffi.sizeof(old_dll_dir_buf), old_dll_dir_buf)
local old_dll_dir = nil
if old_dll_dir_sz ~= 0 then
Expand Down Expand Up @@ -85,14 +85,7 @@ return function(path, name)
--
-- Without this, Noita crashes in JIT-ed Lua code when you use the "New Game"
-- option, probably because some Lua states are preserved across new runs.
local hmodule = C.LoadLibraryA(imgui_dll_path)

if hmodule == nil then
-- Couldn't load the dll. This could be because they don't have the VC++
-- redistributables installed globally. Try again but with our copy
-- added to the search path.
hmodule = loadlib_with_vs(path, imgui_dll_path)
end
local hmodule = loadlib_with_vs(path, imgui_dll_path)

if hmodule == nil then
local err = C.GetLastError()
Expand Down

0 comments on commit b7053f0

Please sign in to comment.