Add support for loading custom dlls in the experimental build.

Put them in steam_settings\load_dlls\
This commit is contained in:
Mr_Goldberg 2020-12-25 21:00:36 -05:00
parent 147ff1b5da
commit 4cb55c52e2
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
3 changed files with 15 additions and 12 deletions

View File

@ -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.

View File

@ -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<std::string> 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:

View File

@ -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