GlosSITarget: Add cli-switches:

-disableuwpoverlay
-disablewatchdog
pull/192/head
Peter Repukat 2 years ago
parent 9e08309a1a
commit f9c993dc50

@ -59,6 +59,11 @@ inline struct Controller {
bool emulateDS4 = false; bool emulateDS4 = false;
} controller; } controller;
inline struct Cli {
bool no_uwp_overlay = false;
bool disable_watchdog = false;
} cli;
inline bool extendedLogging = false; inline bool extendedLogging = false;
inline std::filesystem::path settings_path_ = ""; inline std::filesystem::path settings_path_ = "";
@ -114,14 +119,29 @@ inline void checkWinVer()
} }
#endif #endif
inline void Parse(std::wstring arg1) inline void Parse(const std::vector<std::wstring>& args)
{ {
const auto config_specified = !std::views::filter(arg1, [](const auto& ch) { std::wstring configName;
return ch != ' '; for (const auto& arg : args) {
}).empty(); if (arg.empty()) {
if (config_specified) { continue;
if (!arg1.ends_with(L".json")) { }
arg1 += L".json"; if (arg[0] != L'-') {
configName = std::wstring(arg.begin(), arg.end());
}
if (arg[0] == L'-') {
if (arg == L"-disableuwpoverlay") {
cli.no_uwp_overlay = true;
}
if (arg == L"-disablewatchdog") {
cli.disable_watchdog = true;
}
}
}
if (!configName.empty()) {
if (!configName.ends_with(L".json")) {
configName += L".json";
} }
} }
wchar_t* localAppDataFolder; wchar_t* localAppDataFolder;
@ -135,9 +155,9 @@ inline void Parse(std::wstring arg1)
path /= "Roaming"; path /= "Roaming";
path /= "GlosSI"; path /= "GlosSI";
if (config_specified) { if (!configName.empty()) {
path /= "Targets"; path /= "Targets";
path /= arg1; path /= configName;
} }
else { else {
spdlog::info("No config file specified, using default"); spdlog::info("No config file specified, using default");

@ -48,14 +48,11 @@ SteamTarget::SteamTarget()
{ {
target_window_handle_ = window_.getSystemHandle(); target_window_handle_ = window_.getSystemHandle();
#ifdef _WIN32 #ifdef _WIN32
//if (Settings::launch.isUWP) { if (Settings::cli.no_uwp_overlay) {
// UWPOverlayEnabler::EnableUwpOverlay(); UWPOverlayEnabler::AddUwpOverlayOvWidget();
//} } else {
//else { UWPOverlayEnabler::EnableUwpOverlay();
// UWPOverlayEnabler::AddUwpOverlayOvWidget(); }
//}
UWPOverlayEnabler::EnableUwpOverlay();
#endif #endif
} }
@ -78,12 +75,14 @@ Application will not function!");
steam_overlay_present_ = true; steam_overlay_present_ = true;
#ifdef WIN32 #ifdef WIN32
wchar_t buff[MAX_PATH]; if (!Settings::cli.disable_watchdog) {
GetModuleFileName(GetModuleHandle(NULL), buff, MAX_PATH); wchar_t buff[MAX_PATH];
std::wstring watchDogPath(buff); GetModuleFileName(GetModuleHandle(NULL), buff, MAX_PATH);
watchDogPath = watchDogPath.substr(0, 1 + watchDogPath.find_last_of(L'\\')) + L"GlosSIWatchdog.dll"; std::wstring watchDogPath(buff);
watchDogPath = watchDogPath.substr(0, 1 + watchDogPath.find_last_of(L'\\')) + L"GlosSIWatchdog.dll";
DllInjector::injectDllInto(watchDogPath, L"explorer.exe"); DllInjector::injectDllInto(watchDogPath, L"explorer.exe");
}
#endif #endif
} }
getXBCRebindingEnabled(); getXBCRebindingEnabled();

@ -164,10 +164,11 @@ int main(int argc, char* argv[])
#ifdef _WIN32 #ifdef _WIN32
int numArgs; int numArgs;
LPWSTR* args = CommandLineToArgvW(GetCommandLine(), &numArgs); LPWSTR* args = CommandLineToArgvW(GetCommandLine(), &numArgs);
std::wstring argsv = L""; std::vector<std::wstring> argsv;
argsv.reserve(numArgs);
if (numArgs > 1) { if (numArgs > 1) {
for (int i = 1; i < numArgs; i++) for (int i = 1; i < numArgs; i++)
argsv += i == 1 ? args[i] : std::wstring(L" ") + args[i]; argsv.emplace_back(args[i]);
} }
Settings::Parse(argsv); Settings::Parse(argsv);
Settings::checkWinVer(); Settings::checkWinVer();

Loading…
Cancel
Save