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;
} controller;
inline struct Cli {
bool no_uwp_overlay = false;
bool disable_watchdog = false;
} cli;
inline bool extendedLogging = false;
inline std::filesystem::path settings_path_ = "";
@ -114,14 +119,29 @@ inline void checkWinVer()
}
#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) {
return ch != ' ';
}).empty();
if (config_specified) {
if (!arg1.ends_with(L".json")) {
arg1 += L".json";
std::wstring configName;
for (const auto& arg : args) {
if (arg.empty()) {
continue;
}
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;
@ -135,9 +155,9 @@ inline void Parse(std::wstring arg1)
path /= "Roaming";
path /= "GlosSI";
if (config_specified) {
if (!configName.empty()) {
path /= "Targets";
path /= arg1;
path /= configName;
}
else {
spdlog::info("No config file specified, using default");

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

@ -164,10 +164,11 @@ int main(int argc, char* argv[])
#ifdef _WIN32
int numArgs;
LPWSTR* args = CommandLineToArgvW(GetCommandLine(), &numArgs);
std::wstring argsv = L"";
std::vector<std::wstring> argsv;
argsv.reserve(numArgs);
if (numArgs > 1) {
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::checkWinVer();

Loading…
Cancel
Save