#pragma once #include #include #include #include #include #include #include class SteamVRWatch { public: struct RunningApp { std::wstring processName; std::wstring windowTitle; }; void StartWatch(); void EndWatch(); bool StartAlignmentProcess(); bool CloseAlignmentProcess(); bool WatchRunning() const { return watchRunning.load(); }; bool SteamVRActive() const { return steamvrActive.load(); }; std::vector GetRunningApps() const { return runningApps; }; bool BlockFromSteamVRAbsent(); void UpdateRunningApps(); private: void FindSteamVR(); bool IsHelperRunning(); void CleanupHelperProcessLocked(); static bool IsProcessRunningByName(const std::wstring& processNameNoExtension); static std::wstring GetExecutableDirectory(); std::thread steamVrMonitor_; std::atomic stopRequested_{ false }; HANDLE wakeEvent_{ nullptr }; std::mutex stateMutex_; PROCESS_INFORMATION helperProcessInfo_{}; bool helperProcessValid_ = false; static constexpr const wchar_t* kTargetProcess = L"vrserver"; static constexpr const wchar_t* kAlignmentProcess = L"ETCalOverlay"; const int loop_delay = 6000; std::atomic watchRunning{ false }; std::atomic steamvrActive{ false }; std::atomic selectedAppsActive{ false }; std::vector runningApps; }; extern SteamVRWatch steamvrWatch;