mirror of
https://github.com/Thracky/GlosSI.git
synced 2024-11-03 09:40:18 +00:00
SteamTarget: attempt workaround for nvidia overlay issues.
This commit is contained in:
parent
b39ae3b244
commit
baf3d02fb2
@ -99,6 +99,9 @@ void SteamTarget::read_ini()
|
||||
if (childkey == "bEnableOverlay") {
|
||||
enable_overlay_ = settings.value(childkey).toBool();
|
||||
}
|
||||
if (childkey == "bEnableOverlayOnlyConfig") {
|
||||
enable_overlay_only_config_ = settings.value(childkey).toBool();
|
||||
}
|
||||
else if (childkey == "bEnableControllers") {
|
||||
enable_controllers_ = settings.value(childkey).toBool();
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ private:
|
||||
//Settings from .ini file
|
||||
bool hook_steam_ = true;
|
||||
bool enable_overlay_ = true;
|
||||
bool enable_overlay_only_config_ = true;
|
||||
bool enable_controllers_ = true;
|
||||
bool use_desktop_conf_ = false;
|
||||
bool launch_game_ = false;
|
||||
|
@ -22,7 +22,7 @@ limitations under the License.
|
||||
#include <iostream>
|
||||
#include "SteamTarget.h"
|
||||
|
||||
bool TargetOverlay::init(bool hidden)
|
||||
bool TargetOverlay::init(bool hidden, bool overlay_only_config)
|
||||
{
|
||||
const sf::VideoMode mode = sf::VideoMode::getDesktopMode();
|
||||
window_.create(sf::VideoMode(mode.width - 16, mode.height - 32), "GloSC_OverlayWindow");
|
||||
@ -33,6 +33,7 @@ bool TargetOverlay::init(bool hidden)
|
||||
last_foreground_window_ = window_.getSystemHandle();
|
||||
makeSfWindowTransparent();
|
||||
hidden_ = hidden;
|
||||
hidden_only_config_ = overlay_only_config;
|
||||
if (window_.setActive(false))
|
||||
{
|
||||
overlay_thread_ = std::thread(&TargetOverlay::overlayLoop, this);
|
||||
@ -41,6 +42,7 @@ bool TargetOverlay::init(bool hidden)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void TargetOverlay::stop()
|
||||
{
|
||||
run_ = false;
|
||||
@ -52,7 +54,7 @@ void TargetOverlay::overlayLoop()
|
||||
if (window_.setActive(true))
|
||||
{
|
||||
|
||||
if (hidden_)
|
||||
if (hidden_ || hidden_only_config_)
|
||||
{
|
||||
ShowWindow(window_.getSystemHandle(), SW_HIDE);
|
||||
window_.setFramerateLimit(1); //Window is not shown anyway,
|
||||
@ -77,6 +79,14 @@ void TargetOverlay::overlayLoop()
|
||||
|
||||
if (overlay_state_ == 1)
|
||||
{
|
||||
|
||||
if (hidden_only_config_)
|
||||
{
|
||||
ShowWindow(window_.getSystemHandle(), SW_SHOW);
|
||||
window_.setFramerateLimit(30);
|
||||
}
|
||||
|
||||
|
||||
last_foreground_window_ = GetForegroundWindow();
|
||||
|
||||
std::cout << "Saving current ForegorundWindow HWND: " << last_foreground_window_ << std::endl;
|
||||
@ -104,6 +114,13 @@ void TargetOverlay::overlayLoop()
|
||||
stealFocus(last_foreground_window_);
|
||||
overlay_state_ = 0;
|
||||
draw_logo_ = false;
|
||||
|
||||
if (hidden_only_config_)
|
||||
{
|
||||
ShowWindow(window_.getSystemHandle(), SW_HIDE);
|
||||
window_.setFramerateLimit(1); //Window is not shown anyway
|
||||
}
|
||||
|
||||
}
|
||||
if (draw_logo_)
|
||||
window_.draw(background_sprite_);
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
TargetOverlay& operator=(TargetOverlay&& other) noexcept = delete;
|
||||
~TargetOverlay() = default;
|
||||
|
||||
bool init(bool hidden = false);
|
||||
bool init(bool hidden = false, bool overlay_only_config = false);
|
||||
void stop();
|
||||
|
||||
void overlayLoop();
|
||||
@ -57,6 +57,7 @@ private:
|
||||
sf::RenderWindow window_;
|
||||
bool run_ = true;
|
||||
bool hidden_ = false;
|
||||
bool hidden_only_config_ = false;
|
||||
|
||||
|
||||
//Cannot have too much logic inside of overlayOpened / closed callbacks
|
||||
|
@ -1,6 +1,7 @@
|
||||
[BaseConf]
|
||||
bDrawDebugEdges=0
|
||||
bEnableOverlay=1
|
||||
bEnableOverlayOnlyConfig=0
|
||||
bEnableControllers=1
|
||||
bUseDesktopConfig=0
|
||||
bHookSteam=1
|
||||
|
Loading…
Reference in New Issue
Block a user