fix: issues with proton installations (#2711)
This commit is contained in:
parent
ec7735cb3a
commit
1b260f788b
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include "logger.hpp"
|
||||
|
||||
#include "memory/module.hpp"
|
||||
#include "util/is_proton.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
@ -22,8 +21,7 @@ namespace big
|
||||
m_console_handle(nullptr),
|
||||
m_file(file)
|
||||
{
|
||||
auto module = memory::module("ntdll.dll");
|
||||
if (const auto env_no_color = std::getenv("NO_COLOR"); module.get_export("wine_get_version") || (env_no_color && strlen(env_no_color)))
|
||||
if (is_proton())
|
||||
{
|
||||
LOG(VERBOSE) << "Using simple logger.";
|
||||
m_console_logger = &logger::format_console_simple;
|
||||
@ -183,4 +181,4 @@ namespace big
|
||||
m_file_out << "[" << timestamp << "]"
|
||||
<< "[" << get_level_string(level) << "/" << file << ":" << location.line() << "] " << msg->Message() << std::flush;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
19
src/main.cpp
19
src/main.cpp
@ -35,6 +35,7 @@
|
||||
#include "services/vehicle/xml_vehicles_service.hpp"
|
||||
#include "services/xml_maps/xml_map_service.hpp"
|
||||
#include "thread_pool.hpp"
|
||||
#include "util/is_proton.hpp"
|
||||
#include "version.hpp"
|
||||
|
||||
namespace big
|
||||
@ -158,10 +159,18 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
|
||||
LOG(INFO) << "Yim's Menu Initializing";
|
||||
LOGF(INFO, "Git Info\n\tBranch:\t{}\n\tHash:\t{}\n\tDate:\t{}", version::GIT_BRANCH, version::GIT_SHA1, version::GIT_DATE);
|
||||
|
||||
auto display_version = ReadRegistryKeySZ(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "DisplayVersion");
|
||||
auto current_build = ReadRegistryKeySZ(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "CurrentBuild");
|
||||
auto UBR = ReadRegistryKeyDWORD(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "UBR");
|
||||
LOG(INFO) << GetWindowsVersion() << " Version " << display_version << " (OS Build " << current_build << "." << UBR << ")";
|
||||
// more tech debt, YAY!
|
||||
if (is_proton())
|
||||
{
|
||||
LOG(INFO) << "Running on proton!";
|
||||
}
|
||||
else
|
||||
{
|
||||
auto display_version = ReadRegistryKeySZ(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "DisplayVersion");
|
||||
auto current_build = ReadRegistryKeySZ(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "CurrentBuild");
|
||||
auto UBR = ReadRegistryKeyDWORD(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "UBR");
|
||||
LOG(INFO) << GetWindowsVersion() << " Version " << display_version << " (OS Build " << current_build << "." << UBR << ")";
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
LOG(WARNING) << "Debug Build. Switch to RelWithDebInfo or Release Build for a more stable experience";
|
||||
@ -343,4 +352,4 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
13
src/util/is_proton.hpp
Normal file
13
src/util/is_proton.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "memory/module.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
inline bool is_proton()
|
||||
{
|
||||
static auto module = memory::module("ntdll.dll");
|
||||
|
||||
const auto env_no_color = std::getenv("NO_COLOR");
|
||||
return module.get_export("wine_get_version") || (env_no_color && strlen(env_no_color));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user