2
0
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:
Peter Repukat 2018-03-18 16:31:36 +01:00
parent b39ae3b244
commit baf3d02fb2
5 changed files with 26 additions and 3 deletions

View File

@ -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();
}

View File

@ -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;

View File

@ -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_);

View File

@ -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

View File

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