fix: issues with proton installations (#2711)
This commit is contained in:
parent
ec7735cb3a
commit
1b260f788b
@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "logger.hpp"
|
#include "logger.hpp"
|
||||||
|
#include "util/is_proton.hpp"
|
||||||
#include "memory/module.hpp"
|
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
@ -22,8 +21,7 @@ namespace big
|
|||||||
m_console_handle(nullptr),
|
m_console_handle(nullptr),
|
||||||
m_file(file)
|
m_file(file)
|
||||||
{
|
{
|
||||||
auto module = memory::module("ntdll.dll");
|
if (is_proton())
|
||||||
if (const auto env_no_color = std::getenv("NO_COLOR"); module.get_export("wine_get_version") || (env_no_color && strlen(env_no_color)))
|
|
||||||
{
|
{
|
||||||
LOG(VERBOSE) << "Using simple logger.";
|
LOG(VERBOSE) << "Using simple logger.";
|
||||||
m_console_logger = &logger::format_console_simple;
|
m_console_logger = &logger::format_console_simple;
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "services/vehicle/xml_vehicles_service.hpp"
|
#include "services/vehicle/xml_vehicles_service.hpp"
|
||||||
#include "services/xml_maps/xml_map_service.hpp"
|
#include "services/xml_maps/xml_map_service.hpp"
|
||||||
#include "thread_pool.hpp"
|
#include "thread_pool.hpp"
|
||||||
|
#include "util/is_proton.hpp"
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
@ -158,10 +159,18 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
|
|||||||
LOG(INFO) << "Yim's Menu Initializing";
|
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);
|
LOGF(INFO, "Git Info\n\tBranch:\t{}\n\tHash:\t{}\n\tDate:\t{}", version::GIT_BRANCH, version::GIT_SHA1, version::GIT_DATE);
|
||||||
|
|
||||||
|
// 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 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 current_build = ReadRegistryKeySZ(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "CurrentBuild");
|
||||||
auto UBR = ReadRegistryKeyDWORD(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "UBR");
|
auto UBR = ReadRegistryKeyDWORD(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "UBR");
|
||||||
LOG(INFO) << GetWindowsVersion() << " Version " << display_version << " (OS Build " << current_build << "." << UBR << ")";
|
LOG(INFO) << GetWindowsVersion() << " Version " << display_version << " (OS Build " << current_build << "." << UBR << ")";
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
LOG(WARNING) << "Debug Build. Switch to RelWithDebInfo or Release Build for a more stable experience";
|
LOG(WARNING) << "Debug Build. Switch to RelWithDebInfo or Release Build for a more stable experience";
|
||||||
|
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