From 4cb55c52e206dcfab3ee884f9d93fc238dbac4c1 Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Fri, 25 Dec 2020 21:00:36 -0500 Subject: [PATCH] Add support for loading custom dlls in the experimental build. Put them in steam_settings\load_dlls\ --- Readme_experimental.txt | 4 ++-- dll/base.cpp | 21 +++++++++++++-------- dll/common_includes.h | 2 -- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Readme_experimental.txt b/Readme_experimental.txt index 462dce6..926b337 100644 --- a/Readme_experimental.txt +++ b/Readme_experimental.txt @@ -31,5 +31,5 @@ All ips except these ranges are blocked: 224.0.0.0 - 255.255.255.255 -Luma CEG support: -If LumaCEG_Plugin_x86.dll (steam_api.dll) or LumaCEG_Plugin_x64.dll (steam_api64.dll) is present it will be loaded automatically. +Support for loading any dlls: +Any files put in the steam_settings\load_dlls\ folder will be loaded automatically using the LoadLibraryA function. diff --git a/dll/base.cpp b/dll/base.cpp index d451206..a5b3e5f 100644 --- a/dll/base.cpp +++ b/dll/base.cpp @@ -639,14 +639,19 @@ static void load_dll() } } -static void load_lumaCEG() +#include "local_storage.h" +static void load_dlls() { - std::string path = get_full_program_path(); - path += LUMA_CEG_DLL_NAME; - if (file_exists(path)) { - PRINT_DEBUG("loading luma ceg dll %s\n", path.c_str()); - if (LoadLibraryA(path.c_str())) { - PRINT_DEBUG("Loaded luma ceg dll file\n"); + std::string path = Local_Storage::get_game_settings_path(); + path += "load_dlls"; + path += PATH_SEPARATOR; + + std::vector paths = Local_Storage::get_filenames_path(path); + for (auto & p: paths) { + std::string full_path = path + p; + PRINT_DEBUG("Trying to load %s\n", full_path.c_str()); + if (LoadLibraryA(full_path.c_str())) { + PRINT_DEBUG("LOADED %s\n", full_path.c_str()); } } } @@ -765,7 +770,7 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD dwReason, LPVOID ) { network_functions_attached = true; } load_dll(); - load_lumaCEG(); + load_dlls(); break; case DLL_PROCESS_DETACH: diff --git a/dll/common_includes.h b/dll/common_includes.h index 4096a14..7214d78 100644 --- a/dll/common_includes.h +++ b/dll/common_includes.h @@ -78,10 +78,8 @@ #include "../detours/detours.h" #ifdef DETOURS_64BIT - #define LUMA_CEG_DLL_NAME "LumaCEG_Plugin_x64.dll" #define DLL_NAME "steam_api64.dll" #else - #define LUMA_CEG_DLL_NAME "LumaCEG_Plugin_x86.dll" #define DLL_NAME "steam_api.dll" #endif #endif