Update to spice2x-25-04-25 (pre-apply)
> broken commit
This commit is contained in:
+45
-19
@@ -7,6 +7,7 @@
|
||||
#include "logging.h"
|
||||
#include "utils.h"
|
||||
#include "peb.h"
|
||||
#include "util/fileutils.h"
|
||||
|
||||
std::filesystem::path libutils::module_file_name(HMODULE module) {
|
||||
std::wstring buf;
|
||||
@@ -29,25 +30,18 @@ std::filesystem::path libutils::module_file_name(HMODULE module) {
|
||||
static inline void load_library_fail(const std::string &file_name, bool fatal) {
|
||||
std::string info_str { fmt::format(
|
||||
"\n\nPlease check if {} exists and the permissions are fine.\n"
|
||||
"If the problem still persists, try installing:\n"
|
||||
"* DirectX End-User Runtimes (June 2010) \n"
|
||||
" https://www.microsoft.com/en-us/download/details.aspx?id=8109 \n"
|
||||
"* Microsoft Visual C++ Redistributable Runtimes (*all* versions, x86 *AND* x64)\n"
|
||||
" https://github.com/abbodi1406/vcredist (recommended All-In-One installer)\n"
|
||||
" You may need to run the installer *multiple times* and reboot after each install\n"
|
||||
"* Running Windows 10 \"N\" or \"KN\" Editions?\n"
|
||||
" Grab: https://www.microsoft.com/en-us/software-download/mediafeaturepack \n"
|
||||
" Check: https://support.microsoft.com/en-us/help/4562569/media-feature-pack-for-windows-10-n-may-2020 \n"
|
||||
"* Running Windows 7 \"N\" or \"KN\" Editions?\n"
|
||||
" x86: https://web.archive.org/web/20190810145509/https://download.microsoft.com/download/B/9/B/B9BED058-8669-490E-BA61-D502E4E8BEB1/Windows6.1-KB968211-x86-RefreshPkg.msu \n"
|
||||
" x64: https://web.archive.org/web/20190810145509/https://download.microsoft.com/download/B/9/B/B9BED058-8669-490E-BA61-D502E4E8BEB1/Windows6.1-KB968211-x64-RefreshPkg.msu \n"
|
||||
"* Still have problems after installing above?\n"
|
||||
" Ensure you do NOT have multiple copies of the game DLLs\n"
|
||||
" Ensure the game DLLs are in the correct place, and double check -modules parameter\n"
|
||||
" Certain games require specific NVIDIA DLLs when running with AMD GPUs\n"
|
||||
" Find the missing dependency using:\n"
|
||||
" https://github.com/lucasg/Dependencies (recommended for most) \n"
|
||||
" http://www.dependencywalker.com/ (for old OS) \n"
|
||||
"\n"
|
||||
"* If the problem still persists, try installing things on this list:\n"
|
||||
" https://github.com/spice2x/spice2x.github.io/wiki/DLL-Dependencies \n"
|
||||
"\n"
|
||||
"* Still have problems after installing from above and rebooting PC?\n"
|
||||
" Avoid manually specifying DLL path (-exec) and module directory (-modules); let spice2x auto-detect unless you have a good reason not to\n"
|
||||
" Ensure you do NOT have multiple copies of the game DLLs (e.g., in contents and in contents\\modules)\n"
|
||||
" Certain games require specific NVIDIA DLLs when running with AMD/Intel GPUs (hint: look inside stub directory for DLLs)\n"
|
||||
"\n"
|
||||
"* (For advanced users) if none of the above helps, find the missing dependency using:\n"
|
||||
" https://github.com/lucasg/Dependencies (recommended for most) \n"
|
||||
" http://www.dependencywalker.com/ (for old OS) \n"
|
||||
, file_name) };
|
||||
if (fatal) {
|
||||
log_fatal("libutils", "{}", info_str);
|
||||
@@ -330,3 +324,35 @@ intptr_t libutils::offset2rva(const std::filesystem::path &path, intptr_t offset
|
||||
|
||||
return rva;
|
||||
}
|
||||
|
||||
void libutils::check_duplicate_dlls() {
|
||||
const auto &spice_bin_path = libutils::module_file_name(nullptr).parent_path();
|
||||
if (MODULE_PATH == spice_bin_path) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto &file : std::filesystem::directory_iterator(MODULE_PATH)) {
|
||||
const auto &filename = file.path().filename();
|
||||
const auto extension = strtolower(filename.extension().string());
|
||||
|
||||
if (extension == ".dll" &&
|
||||
fileutils::file_exists(spice_bin_path / filename)) {
|
||||
log_warning(
|
||||
"libutils",
|
||||
"DLL CONFLICT WARNING\n\n\n"
|
||||
"-------------------------------------------------------------------\n"
|
||||
"WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING\n"
|
||||
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
||||
"{} exists in BOTH of these directories:\n\n"
|
||||
" 1. {}\n"
|
||||
" 2. {}\n\n"
|
||||
"due to Windows DLL load order rules, #1 will load instead of #2.\n"
|
||||
"this has unintended consequences and may crash your game!\n"
|
||||
"resolve the conflict by deleting the stale copy of the DLL\n"
|
||||
"-------------------------------------------------------------------\n\n\n",
|
||||
filename.string(),
|
||||
(spice_bin_path / filename).string(),
|
||||
(MODULE_PATH / filename).string());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user