mirror of
https://github.com/clearlinux/linux-steam-integration.git
synced 2026-09-06 22:01:27 +00:00
intercept: Add workaround for games loading invalid ".dll.so"
Some games are attempting (and failing) to load .dll.so and should be loading the ".dll" directly (i.e. Mono games) Signed-off-by: Ikey Doherty <ikey@solus-project.com>
This commit is contained in:
@@ -239,6 +239,42 @@ static const char *vendor_transmute_target[] = {
|
||||
"libSDL2_gfx-1.0.so.0",
|
||||
};
|
||||
|
||||
/**
|
||||
* Every so often a game comes along that does the following:
|
||||
*
|
||||
* open("path") ? dlopen("path").
|
||||
* Except: path = "*.dll", dlopen() is transformed to ".dll.so"
|
||||
*
|
||||
* This is unrelated to the ".la" errors
|
||||
*/
|
||||
static bool lsi_override_dll_fail(const char *orig_name, const char **soname)
|
||||
{
|
||||
size_t len = strlen(orig_name);
|
||||
static char path_lookup[PATH_MAX];
|
||||
|
||||
if (len < 7) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strncmp(orig_name + (len - 7), ".dll.so", 7) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!strncpy(path_lookup, orig_name, len - 3)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!lsi_file_exists(path_lookup)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*soname = path_lookup;
|
||||
lsi_log_debug("fixed invalid suffix dlopen() \033[31;1m%s\033[0m -> \033[34;1m%s\033[0m",
|
||||
orig_name,
|
||||
path_lookup);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mono games might try looking for /x86/ plugin directory for a 64-bit process,
|
||||
* as seen with testing with Project Highrise.
|
||||
@@ -316,6 +352,10 @@ static bool lsi_override_dlopen(const char *orig_name, const char **soname)
|
||||
#endif
|
||||
};
|
||||
|
||||
if (lsi_override_dll_fail(orig_name, soname)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!lsi_file_exists(orig_name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user