SteamTarget: attempt workaround for nvidia overlay issues.

v2
Peter Repukat 7 years ago
parent b39ae3b244
commit baf3d02fb2

@ -99,6 +99,9 @@ void SteamTarget::read_ini()
if (childkey == "bEnableOverlay") { if (childkey == "bEnableOverlay") {
enable_overlay_ = settings.value(childkey).toBool(); enable_overlay_ = settings.value(childkey).toBool();
} }
if (childkey == "bEnableOverlayOnlyConfig") {
enable_overlay_only_config_ = settings.value(childkey).toBool();
}
else if (childkey == "bEnableControllers") { else if (childkey == "bEnableControllers") {
enable_controllers_ = settings.value(childkey).toBool(); enable_controllers_ = settings.value(childkey).toBool();
} }

@ -70,6 +70,7 @@ private:
//Settings from .ini file //Settings from .ini file
bool hook_steam_ = true; bool hook_steam_ = true;
bool enable_overlay_ = true; bool enable_overlay_ = true;
bool enable_overlay_only_config_ = true;
bool enable_controllers_ = true; bool enable_controllers_ = true;
bool use_desktop_conf_ = false; bool use_desktop_conf_ = false;
bool launch_game_ = false; bool launch_game_ = false;

@ -22,7 +22,7 @@ limitations under the License.
#include <iostream> #include <iostream>
#include "SteamTarget.h" #include "SteamTarget.h"
bool TargetOverlay::init(bool hidden) bool TargetOverlay::init(bool hidden, bool overlay_only_config)
{ {
const sf::VideoMode mode = sf::VideoMode::getDesktopMode(); const sf::VideoMode mode = sf::VideoMode::getDesktopMode();
window_.create(sf::VideoMode(mode.width - 16, mode.height - 32), "GloSC_OverlayWindow"); 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(); last_foreground_window_ = window_.getSystemHandle();
makeSfWindowTransparent(); makeSfWindowTransparent();
hidden_ = hidden; hidden_ = hidden;
hidden_only_config_ = overlay_only_config;
if (window_.setActive(false)) if (window_.setActive(false))
{ {
overlay_thread_ = std::thread(&TargetOverlay::overlayLoop, this); overlay_thread_ = std::thread(&TargetOverlay::overlayLoop, this);
@ -41,6 +42,7 @@ bool TargetOverlay::init(bool hidden)
return false; return false;
} }
void TargetOverlay::stop() void TargetOverlay::stop()
{ {
run_ = false; run_ = false;
@ -52,7 +54,7 @@ void TargetOverlay::overlayLoop()
if (window_.setActive(true)) if (window_.setActive(true))
{ {
if (hidden_) if (hidden_ || hidden_only_config_)
{ {
ShowWindow(window_.getSystemHandle(), SW_HIDE); ShowWindow(window_.getSystemHandle(), SW_HIDE);
window_.setFramerateLimit(1); //Window is not shown anyway, window_.setFramerateLimit(1); //Window is not shown anyway,
@ -77,6 +79,14 @@ void TargetOverlay::overlayLoop()
if (overlay_state_ == 1) if (overlay_state_ == 1)
{ {
if (hidden_only_config_)
{
ShowWindow(window_.getSystemHandle(), SW_SHOW);
window_.setFramerateLimit(30);
}
last_foreground_window_ = GetForegroundWindow(); last_foreground_window_ = GetForegroundWindow();
std::cout << "Saving current ForegorundWindow HWND: " << last_foreground_window_ << std::endl; std::cout << "Saving current ForegorundWindow HWND: " << last_foreground_window_ << std::endl;
@ -104,6 +114,13 @@ void TargetOverlay::overlayLoop()
stealFocus(last_foreground_window_); stealFocus(last_foreground_window_);
overlay_state_ = 0; overlay_state_ = 0;
draw_logo_ = false; draw_logo_ = false;
if (hidden_only_config_)
{
ShowWindow(window_.getSystemHandle(), SW_HIDE);
window_.setFramerateLimit(1); //Window is not shown anyway
}
} }
if (draw_logo_) if (draw_logo_)
window_.draw(background_sprite_); window_.draw(background_sprite_);

@ -32,7 +32,7 @@ public:
TargetOverlay& operator=(TargetOverlay&& other) noexcept = delete; TargetOverlay& operator=(TargetOverlay&& other) noexcept = delete;
~TargetOverlay() = default; ~TargetOverlay() = default;
bool init(bool hidden = false); bool init(bool hidden = false, bool overlay_only_config = false);
void stop(); void stop();
void overlayLoop(); void overlayLoop();
@ -57,6 +57,7 @@ private:
sf::RenderWindow window_; sf::RenderWindow window_;
bool run_ = true; bool run_ = true;
bool hidden_ = false; bool hidden_ = false;
bool hidden_only_config_ = false;
//Cannot have too much logic inside of overlayOpened / closed callbacks //Cannot have too much logic inside of overlayOpened / closed callbacks

@ -1,6 +1,7 @@
[BaseConf] [BaseConf]
bDrawDebugEdges=0 bDrawDebugEdges=0
bEnableOverlay=1 bEnableOverlay=1
bEnableOverlayOnlyConfig=0
bEnableControllers=1 bEnableControllers=1
bUseDesktopConfig=0 bUseDesktopConfig=0
bHookSteam=1 bHookSteam=1

Loading…
Cancel
Save