mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-05-04 08:41:43 +00:00
Updated howMailDllPath is set and used
This commit is contained in:
+23
-2
@@ -114,8 +114,29 @@ void PrepareLogger()
|
||||
|
||||
if (Config::Instance()->LogToFile.value_or_default())
|
||||
{
|
||||
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(
|
||||
Config::Instance()->LogFileName.value_or_default(), true);
|
||||
auto logPath = std::filesystem::path(Config::Instance()->LogFileName.value_or_default());
|
||||
|
||||
// if just a filename is provided, log to the executable directory
|
||||
if (!logPath.has_parent_path() && !logPath.is_absolute())
|
||||
{
|
||||
// if LogFileName is just a filename, use it with the executable directory
|
||||
if (logPath.has_filename())
|
||||
logPath = Util::ExePath().parent_path() / Config::Instance()->LogFileName.value_or_default();
|
||||
else
|
||||
logPath = Util::ExePath().parent_path() / L"OptiScaler.log";
|
||||
}
|
||||
else
|
||||
{
|
||||
// if LogFileName is just a directory
|
||||
if (std::filesystem::is_directory(logPath))
|
||||
logPath = logPath / L"OptiScaler.log";
|
||||
|
||||
// if the parent folder doesn't exist, log to the executable directory instead
|
||||
if (!std::filesystem::is_directory(logPath.parent_path()))
|
||||
logPath = Util::ExePath().parent_path() / L"OptiScaler.log";
|
||||
}
|
||||
|
||||
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(logPath, true);
|
||||
file_sink->set_level(spdlog::level::level_enum::trace);
|
||||
#ifdef LOG_ASYNC
|
||||
file_sink->set_pattern("%H:%M:%S.%f\t%L\t%v");
|
||||
|
||||
+25
-3
@@ -1621,12 +1621,34 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
||||
|
||||
// Main Opti DLL path
|
||||
if (!Config::Instance()->MainDllPath.has_value())
|
||||
Config::Instance()->MainDllPath.set_volatile_value(Util::ExePath().parent_path() / L"OptiScaler");
|
||||
{
|
||||
Config::Instance()->MainDllPath.set_volatile_value(Util::ExePath().parent_path() / L".");
|
||||
|
||||
if (!Config::Instance()->PluginPath.has_value())
|
||||
Config::Instance()->MainDllPath.set_volatile_value(
|
||||
std::filesystem::absolute(Config::Instance()->MainDllPath.value()));
|
||||
}
|
||||
|
||||
// If path is not correct
|
||||
if (!std::filesystem::exists(Config::Instance()->MainDllPath.value()) ||
|
||||
!std::filesystem::is_directory(Config::Instance()->MainDllPath.value()))
|
||||
{
|
||||
LOG_ERROR("MainDllPath does not exist or wrong: {}",
|
||||
wstring_to_string(Config::Instance()->MainDllPath.value()));
|
||||
|
||||
Config::Instance()->MainDllPath.set_volatile_value(Util::ExePath().parent_path() / L".");
|
||||
}
|
||||
|
||||
// If path is not set or incorrect
|
||||
if (!Config::Instance()->PluginPath.has_value() ||
|
||||
(!std::filesystem::exists(Config::Instance()->PluginPath.value()) ||
|
||||
!std::filesystem::is_directory(Config::Instance()->PluginPath.value())))
|
||||
{
|
||||
Config::Instance()->PluginPath.set_volatile_value(
|
||||
std::filesystem::path(Config::Instance()->MainDllPath.value()) / L"plugins");
|
||||
|
||||
LOG_WARN("PluginPath updated: {}", wstring_to_string(Config::Instance()->PluginPath.value()));
|
||||
}
|
||||
|
||||
CheckForExcludedProcess();
|
||||
|
||||
if (_passThruMode)
|
||||
@@ -1658,7 +1680,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
||||
spdlog::warn("If you paid for these files, you've been scammed!");
|
||||
spdlog::warn("DO NOT USE IN MULTIPLAYER GAMES");
|
||||
spdlog::info("");
|
||||
spdlog::info("LogLevel: {0}", Config::Instance()->LogLevel.value_or_default());
|
||||
spdlog::info("LogLevel: {}", Config::Instance()->LogLevel.value_or_default());
|
||||
|
||||
spdlog::info("");
|
||||
if (Util::GetRealWindowsVersion(winVer))
|
||||
|
||||
Reference in New Issue
Block a user