Skip to content

Commit

Permalink
load_dynamic_library performance improvement.
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranDMC committed Nov 30, 2024
1 parent 91dec23 commit e81bffa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cleo_plugins/MemoryOperations/MemoryOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,13 @@ class MemoryOperations
CLEO_ResolvePath(thread, buff.data(), buff.size());
buff.resize(strlen(buff.data()));

// ModLoader's hooks require relative paths in LoadLibrary to work
FilepathRemoveParent(buff, CLEO_GetGameDirectory());
if (std::filesystem::is_regular_file(buff))
{
// ModLoader's hooks require relative paths in LoadLibrary to work
FilepathRemoveParent(buff, CLEO_GetGameDirectory());

ptr = LoadLibrary(buff.c_str());
ptr = LoadLibrary(buff.c_str());
}

// in case of just filename let LoadLibrary resolve it itself
if (ptr == nullptr && !std::filesystem::path(path).has_parent_path())
Expand Down

0 comments on commit e81bffa

Please sign in to comment.