GlosSITarget: Settings: move extendedLogging and cli-opts to common-struct

pull/192/head
Peter Repukat 2 years ago
parent 31ce36095f
commit 1b2b8b759a

@ -147,7 +147,7 @@ void AppLauncher::getChildPids(DWORD parent_pid)
do { do {
if (pe.th32ParentProcessID == parent_pid) { if (pe.th32ParentProcessID == parent_pid) {
if (std::ranges::find(pids_, pe.th32ProcessID) == pids_.end()) { if (std::ranges::find(pids_, pe.th32ProcessID) == pids_.end()) {
if (Settings::extendedLogging) { if (Settings::common.extendedLogging) {
spdlog::info("Found new child process with PID \"{}\"", pe.th32ProcessID); spdlog::info("Found new child process with PID \"{}\"", pe.th32ProcessID);
} }
pids_.push_back(pe.th32ProcessID); pids_.push_back(pe.th32ProcessID);

@ -122,7 +122,7 @@ void HidHide::hideDevices(const std::filesystem::path& steam_path)
whitelist.push_back(path); whitelist.push_back(path);
} }
} }
if (Settings::extendedLogging) { if (Settings::common.extendedLogging) {
std::ranges::for_each(whitelist, [](const auto& exe) { std::ranges::for_each(whitelist, [](const auto& exe) {
spdlog::trace(L"Whitelisted executable: {}", exe); spdlog::trace(L"Whitelisted executable: {}", exe);
}); });
@ -130,7 +130,7 @@ void HidHide::hideDevices(const std::filesystem::path& steam_path)
setAppWhiteList(whitelist); setAppWhiteList(whitelist);
avail_devices_ = GetHidDeviceList(); avail_devices_ = GetHidDeviceList();
if (Settings::extendedLogging) { if (Settings::common.extendedLogging) {
std::ranges::for_each(avail_devices_, [](const auto& dev) { std::ranges::for_each(avail_devices_, [](const auto& dev) {
spdlog::trace(L"AvailDevice device: {}", dev.name); spdlog::trace(L"AvailDevice device: {}", dev.name);
}); });
@ -157,7 +157,7 @@ void HidHide::hideDevices(const std::filesystem::path& steam_path)
setBlacklistDevices(blacklisted_devices_); setBlacklistDevices(blacklisted_devices_);
setActive(true); setActive(true);
spdlog::info("Hid Gaming Devices; Enabling Overlay element..."); spdlog::info("Hid Gaming Devices; Enabling Overlay element...");
if (Settings::extendedLogging) { if (Settings::common.extendedLogging) {
std::ranges::for_each(blacklisted_devices_, [](const auto& dev) { std::ranges::for_each(blacklisted_devices_, [](const auto& dev) {
spdlog::trace(L"Blacklisted device: {}", dev); spdlog::trace(L"Blacklisted device: {}", dev);
}); });
@ -205,14 +205,14 @@ void HidHide::enableOverlayElement()
// UnPatchValveHooks(); // UnPatchValveHooks();
openCtrlDevice(); openCtrlDevice();
bool hidehide_state_store = hidhide_active_; bool hidehide_state_store = hidhide_active_;
if (Settings::extendedLogging) { if (Settings::common.extendedLogging) {
spdlog::debug("Refreshing HID devices"); spdlog::debug("Refreshing HID devices");
} }
if (hidhide_active_) { if (hidhide_active_) {
setActive(false); setActive(false);
} }
avail_devices_ = GetHidDeviceList(); avail_devices_ = GetHidDeviceList();
if (Settings::extendedLogging) { if (Settings::common.extendedLogging) {
std::ranges::for_each(avail_devices_, [](const auto& dev) { std::ranges::for_each(avail_devices_, [](const auto& dev) {
spdlog::trace(L"AvailDevice device: {}", dev.name); spdlog::trace(L"AvailDevice device: {}", dev.name);
}); });
@ -248,7 +248,7 @@ void HidHide::enableOverlayElement()
blacklisted_devices_.end()); blacklisted_devices_.end());
} }
setBlacklistDevices(blacklisted_devices_); setBlacklistDevices(blacklisted_devices_);
if (Settings::extendedLogging) { if (Settings::common.extendedLogging) {
std::ranges::for_each(blacklisted_devices_, [](const auto& dev) { std::ranges::for_each(blacklisted_devices_, [](const auto& dev) {
spdlog::trace(L"Blacklisted device: {}", dev); spdlog::trace(L"Blacklisted device: {}", dev);
}); });
@ -355,7 +355,7 @@ void HidHide::setActive(bool active)
return; return;
} }
hidhide_active_ = active; hidhide_active_ = active;
if (Settings::extendedLogging) { if (Settings::common.extendedLogging) {
spdlog::debug("HidHide State set to {}", active); spdlog::debug("HidHide State set to {}", active);
} }
} }

@ -199,7 +199,7 @@ void Overlay::update()
Settings::StoreSettings(); Settings::StoreSettings();
} }
} }
ImGui::Checkbox("Extended logging", &Settings::extendedLogging); ImGui::Checkbox("Extended logging", &Settings::common.extendedLogging);
ImGuiID dockspace_id = ImGui::GetID("GlosSI-DockSpace"); ImGuiID dockspace_id = ImGui::GetID("GlosSI-DockSpace");
ImGui::DockSpace(dockspace_id); ImGui::DockSpace(dockspace_id);

@ -59,12 +59,12 @@ inline struct Controller {
bool emulateDS4 = false; bool emulateDS4 = false;
} controller; } controller;
inline struct Cli { inline struct Common {
bool no_uwp_overlay = false; bool no_uwp_overlay = false;
bool disable_watchdog = false; bool disable_watchdog = false;
} cli;
inline bool extendedLogging = false; bool extendedLogging = false;
} common;
inline std::filesystem::path settings_path_ = ""; inline std::filesystem::path settings_path_ = "";

@ -47,7 +47,7 @@ void SteamOverlayDetector::update()
if (PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE)) { if (PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE)) {
// filter out some messages as not all get altered by steam... // filter out some messages as not all get altered by steam...
if (Settings::extendedLogging && msg.message != 512 && msg.message != 5374) { if (Settings::common.extendedLogging && msg.message != 512 && msg.message != 5374) {
spdlog::trace("PeekMessage: Window msg: {}", msg.message); spdlog::trace("PeekMessage: Window msg: {}", msg.message);
} }

@ -50,7 +50,7 @@ SteamTarget::SteamTarget()
{ {
target_window_handle_ = window_.getSystemHandle(); target_window_handle_ = window_.getSystemHandle();
#ifdef _WIN32 #ifdef _WIN32
if (Settings::cli.no_uwp_overlay) { if (Settings::common.no_uwp_overlay) {
UWPOverlayEnabler::AddUwpOverlayOvWidget(); UWPOverlayEnabler::AddUwpOverlayOvWidget();
} }
else { else {
@ -78,7 +78,7 @@ Application will not function!");
steam_overlay_present_ = true; steam_overlay_present_ = true;
#ifdef WIN32 #ifdef WIN32
if (!Settings::cli.disable_watchdog) { if (!Settings::common.disable_watchdog) {
wchar_t buff[MAX_PATH]; wchar_t buff[MAX_PATH];
GetModuleFileName(GetModuleHandle(NULL), buff, MAX_PATH); GetModuleFileName(GetModuleHandle(NULL), buff, MAX_PATH);
std::wstring watchDogPath(buff); std::wstring watchDogPath(buff);

Loading…
Cancel
Save