mirror of
https://github.com/EricPlayZ/EGameTools.git
synced 2025-09-19 21:16:07 +08:00
- Added a message box that warns the user of shortcut creation failure
This commit is contained in:
@ -26,7 +26,9 @@ R"(- You can now load custom mod files from "EGameTools\UserModFiles"! Please re
|
||||
|
||||
That's it for this update! The next few updates will include some more bug fixes rather than new, big features, so stay tuned!)" },
|
||||
{ "v1.1.1",
|
||||
R"(- Fixed frequent crashes when using DX12, sometimes DX11 too.
|
||||
R"(- Added a message box that warns the user of shortcut creation failure
|
||||
|
||||
- Fixed frequent crashes when using DX12, sometimes DX11 too.
|
||||
- Fixed frequent crashing at game startup
|
||||
- Fixed crashing when trying to use ".model" mods with the custom file loading system; PLEASE keep in mind that I haven't found a fix for this yet! Custom ".model" files will not get loaded from "UserModFiles"
|
||||
- Fixed Slow Motion not changing back to the original game speed when deactivated
|
||||
|
@ -66,6 +66,38 @@ namespace Core {
|
||||
}
|
||||
}
|
||||
|
||||
static bool WarnMsgSeenFileExists() {
|
||||
try {
|
||||
const std::string localAppDataDir = Utils::Files::GetLocalAppDataDir();
|
||||
if (localAppDataDir.empty())
|
||||
return false;
|
||||
const std::string finalPath = std::string(localAppDataDir) + "\\EGameTools\\" + "WarnMsgBoxSeen";
|
||||
|
||||
return std::filesystem::exists(finalPath);
|
||||
} catch (const std::exception& e) {
|
||||
spdlog::error("Exception thrown while trying to check if WarnMsgBoxSeen file exists: {}", e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
static void CreateWarnMsgSeenFile() {
|
||||
try {
|
||||
const std::string localAppDataDir = Utils::Files::GetLocalAppDataDir();
|
||||
if (localAppDataDir.empty())
|
||||
return;
|
||||
const std::string dirPath = std::string(localAppDataDir) + "\\EGameTools\\";
|
||||
std::filesystem::create_directories(dirPath);
|
||||
|
||||
const std::string finalPath = dirPath + "WarnMsgBoxSeen";
|
||||
if (!std::filesystem::exists(finalPath)) {
|
||||
std::ofstream outFile(finalPath.c_str(), std::ios::binary);
|
||||
if (!outFile.is_open())
|
||||
return;
|
||||
outFile.close();
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
spdlog::error("Exception thrown while trying to create WarnMsgBoxSeen file: {}", e.what());
|
||||
}
|
||||
}
|
||||
static void CreateSymlinkForLoadingFiles() {
|
||||
try {
|
||||
const char* userModFilesPath = "..\\..\\..\\source\\data\\EGameTools\\UserModFiles";
|
||||
@ -87,6 +119,21 @@ namespace Core {
|
||||
} catch (const std::exception& e) {
|
||||
spdlog::error("Exception thrown while trying to create folder shortcut: {}", e.what());
|
||||
spdlog::warn("This error should NOT affect any features of my mod. The shortcut is only a way for the user to easily access the folder \"Dying Light 2\\ph\\source\\data\\EGameTools\".");
|
||||
|
||||
if (WarnMsgSeenFileExists())
|
||||
return;
|
||||
|
||||
std::thread([]() {
|
||||
int msgBoxResult = MessageBoxA(nullptr, "EGameTools has failed creating a folder shortcut \"EGameTools\" inside \"Dying Light 2\\ph\\work\\bin\\x64\".\n\nIn order to install mods inside the \"UserModFiles\" folder, please manually navigate to \"Dying Light 2\\ph\\source\\data\\EGameTools\\UserModFiles\".\n\nAlternatively, run the game once as administrator from the exe and once a shortcut has been created, close the game and open up the game from Steam or whatever platform you're using.\n\nDo you want to continue seeing this warning message every game launch?", "Error creating EGameTools folder shortcut", MB_ICONWARNING | MB_YESNO | MB_SETFOREGROUND);
|
||||
|
||||
switch (msgBoxResult) {
|
||||
case IDNO:
|
||||
CreateWarnMsgSeenFile();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user