GlosSITarget: parse and use "ignoreEGS" setting

pull/192/head
Peter Repukat 2 years ago
parent fc03e91c2b
commit 18a960abab

@ -25,7 +25,6 @@ limitations under the License.
#include <propkey.h>
#include <shellapi.h>
#pragma comment(lib, "Shell32.lib")
#endif
#include "Settings.h"
@ -76,10 +75,9 @@ void AppLauncher::launchApp(const std::wstring& path, const std::wstring& args)
glossi_util::KillProcess(pid);
}
});
ImGui::EndChild();
ImGui::EndChild();
}
ImGui::End();
});
#endif
}
@ -118,21 +116,22 @@ void AppLauncher::update()
});
auto filtered_pids = pids_ | std::ranges::views::filter([](DWORD pid) {
return std::ranges::find(EGS_LAUNCHER_PROCNAMES_, glossi_util::GetProcName(pid)) == EGS_LAUNCHER_PROCNAMES_.end();
});
if (was_egs_launch_ && !filtered_pids.empty()) {
return std::ranges::find(EGS_LAUNCHER_PROCNAMES_, glossi_util::GetProcName(pid)) == EGS_LAUNCHER_PROCNAMES_.end();
});
if (was_egs_launch_ && !filtered_pids.empty()) {
egs_has_launched_game_ = true;
}
if (Settings::launch.closeOnExit && Settings::launch.launch) {
if (was_egs_launch_) {
if (was_egs_launch_ && Settings::common.ignoreEGS) {
if (egs_has_launched_game_ && filtered_pids.empty()) {
spdlog::info("Configured to close on all children exit. Shutting down after game launched via EGS quit...");
shutdown_();
shutdown_();
}
} else {
}
else {
if (pids_.empty()) {
spdlog::info("Configured to close on all children exit. Shutting down...");
shutdown_();
shutdown_();
}
}
}
@ -159,8 +158,20 @@ std::vector<DWORD> AppLauncher::launchedPids()
pid_mutex_.lock();
std::vector<DWORD> res;
res.reserve(pids_.size());
std::ranges::copy(pids_.begin(), pids_.end(),
std::back_inserter(res));
if (Settings::common.ignoreEGS) {
for (const auto& pid : pids_ | std::ranges::views::filter(
[](DWORD pid) {
return std::ranges::find(
EGS_LAUNCHER_PROCNAMES_,
glossi_util::GetProcName(pid)) == EGS_LAUNCHER_PROCNAMES_.end();
})) {
res.push_back(pid);
}
}
else {
std::ranges::copy(pids_.begin(), pids_.end(),
std::back_inserter(res));
}
pid_mutex_.unlock();
return res;
}

@ -63,6 +63,7 @@ inline struct Common {
bool no_uwp_overlay = false;
bool disable_watchdog = false;
bool extendedLogging = false;
bool ignoreEGS = true;
std::wstring name;
std::wstring icon;
int version;
@ -194,6 +195,7 @@ inline void Parse(const nlohmann::basic_json<>& json)
safeWStringParse(json, "name", common.name);
safeWStringParse(json, "icon", common.icon);
safeParseValue(json, "version", common.version);
safeParseValue(json, "ignoreEGS", common.ignoreEGS);
if (launch.launch) {
launch.isUWP = checkIsUwp(launch.launchPath);
@ -213,6 +215,9 @@ inline void Parse(const std::vector<std::wstring>& args)
else if (arg == L"-disablewatchdog") {
common.disable_watchdog = true;
}
else if (arg == L"-ignoreegs") {
common.ignoreEGS = true;
}
else {
configName += L" " + std::wstring(arg.begin(), arg.end());
}

Loading…
Cancel
Save