GlosSITarget: Update experimental "stand-alone"-mode

pull/239/head
Peter Repukat 1 year ago
parent 10b65a1a9b
commit 70187090e7

@ -73,6 +73,8 @@ inline struct Common {
int version; int version;
std::wstring steamPath; std::wstring steamPath;
std::wstring steamUserId; std::wstring steamUserId;
std::wstring standaloneModeGameId; /* = L"12605636929694728192"; */
bool standaloneUseGamepadUI = false;
} common; } common;
inline std::filesystem::path settings_path_ = ""; inline std::filesystem::path settings_path_ = "";
@ -209,6 +211,9 @@ inline void Parse(const nlohmann::basic_json<>& json)
safeWStringParse(json, "steamPath", common.steamPath); safeWStringParse(json, "steamPath", common.steamPath);
safeWStringParse(json, "steamUserId", common.steamUserId); safeWStringParse(json, "steamUserId", common.steamUserId);
safeWStringParse(json, "standaloneModeGameId", common.standaloneModeGameId);
safeParseValue(json, "standaloneUseGamepadUI", common.standaloneUseGamepadUI);
} }
catch (const nlohmann::json::exception& e) { catch (const nlohmann::json::exception& e) {
spdlog::warn("Err parsing config: {}", e.what()); spdlog::warn("Err parsing config: {}", e.what());

@ -62,44 +62,46 @@ SteamTarget::SteamTarget()
int SteamTarget::run() int SteamTarget::run()
{ {
auto closeBPM = false;
// CEFInject::InjectJs(L"Steam Shared Context presented by Valve", L"console.log('FUCK YEAH!')"); auto closeBPMTimer = sf::Clock{};
if (!SteamOverlayDetector::IsSteamInjected()) { if (!SteamOverlayDetector::IsSteamInjected()) {
spdlog::warn("Steam-overlay not detected. Showing GlosSI-overlay!\n\
Application will not function!");
window_.setClickThrough(false);
if (!overlay_.expired())
overlay_.lock()->setEnabled(true);
steam_overlay_present_ = false;
spdlog::warn("GlosSI not launched via Steam.\nEnabling EXPERIMENTAL global controller and overlay..."); spdlog::warn("GlosSI not launched via Steam.\nEnabling EXPERIMENTAL global controller and overlay...");
//SetEnvironmentVariable(L"SteamAppId", L"2934978560"); if (Settings::common.standaloneModeGameId == L"") {
SetEnvironmentVariable(L"SteamTenfoot", L"1"); spdlog::error("No game id set for standalone mode. Controller will use desktop-config!");
SetEnvironmentVariable(L"SteamTenfootHybrid", L"1"); }
SetEnvironmentVariable(L"SteamGamepadUI", L"1");
//SetEnvironmentVariable(L"SteamGameId", L"12605636929694728192");
//SetEnvironmentVariable(L"SteamOverlayGameId", L"12605636929694728192"); SetEnvironmentVariable(L"SteamAppId", L"0");
//SetEnvironmentVariable(L"SteamGameId", L"2934978560"); SetEnvironmentVariable(L"SteamClientLaunch", L"0");
//SetEnvironmentVariable(L"SteamOverlayGameId", L"2934978560"); SetEnvironmentVariable(L"SteamEnv", L"1");
SetEnvironmentVariable(L"SteamPath", getSteamPath().wstring().c_str());
system("start steam://open/bigpicture"); SetEnvironmentVariable(L"SteamTenfoot", Settings::common.standaloneUseGamepadUI ? L"1" : L"0");
auto steamwindow = FindWindow(L"SDL_app", nullptr); //SetEnvironmentVariable(L"SteamTenfootHybrid", L"1");
int bla = 0; SetEnvironmentVariable(L"SteamGamepadUI", Settings::common.standaloneUseGamepadUI ? L"1" : L"0");
while (!steamwindow && bla < 50) { SetEnvironmentVariable(L"SteamGameId", Settings::common.standaloneModeGameId.c_str());
Sleep(100); SetEnvironmentVariable(L"SteamOverlayGameId", Settings::common.standaloneModeGameId.c_str());
steamwindow = FindWindow(L"SDL_app", nullptr); SetEnvironmentVariable(L"EnableConfiguratorSupport", L"15");
bla++; SetEnvironmentVariable(L"SteamStreamingForceWindowedD3D9", L"1");
if (Settings::common.standaloneUseGamepadUI) {
system("start steam://open/bigpicture");
auto steamwindow = FindWindow(L"Steam Big Picture Mode", nullptr);
auto timer = sf::Clock{};
while (!steamwindow && timer.getElapsedTime().asSeconds() < 2) {
steamwindow = FindWindow(L"Steam Big Picture Mode", nullptr);
Sleep(50);
}
Sleep(6000); // DIRTY HACK to wait until BPM (GamepadUI) is initialized
// TODO: find way to force BPM even if BPM is not active
LoadLibrary((getSteamPath() / "GameOverlayRenderer64.dll").wstring().c_str());
// Overlay switches back to desktop one, once BPM is closed... Disable closing BPM for now.
// TODO: find way to force BPM even if BPM is not active
// closeBPM = true;
closeBPMTimer.restart();
} }
if (steamwindow) { else {
LoadLibrary(L"C:\\Program Files (x86)\\Steam\\GameOverlayRenderer64.dll"); LoadLibrary( (getSteamPath() / "GameOverlayRenderer64.dll").wstring().c_str());
SendMessage(steamwindow, WM_CLOSE, 0, 0);
SendMessage(steamwindow, WM_QUIT, 0, 0);
SendMessage(steamwindow, WM_DESTROY, 0, 0);
} else {
spdlog::warn("Steam window not found!");
} }
window_.setClickThrough(true); window_.setClickThrough(true);
@ -172,6 +174,12 @@ Application will not function!");
detector_.update(); detector_.update();
overlayHotkeyWorkaround(); overlayHotkeyWorkaround();
window_.update(); window_.update();
if (closeBPM && closeBPMTimer.getElapsedTime().asSeconds() >= 3) {
system("start steam://close/bigpicture");
closeBPM = false;
}
// Wait on shutdown; User might get confused if window closes to fast if anything with launchApp get's borked. // Wait on shutdown; User might get confused if window closes to fast if anything with launchApp get's borked.
if (delayed_shutdown_) { if (delayed_shutdown_) {
if (delay_shutdown_clock_.getElapsedTime().asSeconds() >= 3) { if (delay_shutdown_clock_.getElapsedTime().asSeconds() >= 3) {

Loading…
Cancel
Save