2
0
mirror of https://github.com/Thracky/GlosSI.git synced 2024-11-19 03:25:29 +00:00

Fix crash when no config supplied

This commit is contained in:
Peter Repukat 2017-05-31 15:01:38 +02:00
parent 2cc770f41f
commit 9ebe3896af
2 changed files with 63 additions and 53 deletions

View File

@ -30,8 +30,13 @@ SteamTargetRenderer::SteamTargetRenderer(int& argc, char** argv) : QApplication(
{ {
std::cerr << "Target configuration file must be specified!" << std::endl; std::cerr << "Target configuration file must be specified!" << std::endl;
MessageBoxW(NULL, L"Target configuration file must be specified!", L"GloSC-SteamTarget", MB_OK); MessageBoxW(NULL, L"Target configuration file must be specified!", L"GloSC-SteamTarget", MB_OK);
QTimer::singleShot(0, this, []()
{
QApplication::exit(1); QApplication::exit(1);
} }); //call after ctor
} else {
QSettings settings(this->arguments().at(1), QSettings::IniFormat); QSettings settings(this->arguments().at(1), QSettings::IniFormat);
settings.beginGroup("BaseConf"); settings.beginGroup("BaseConf");
const QStringList childKeys = settings.childKeys(); const QStringList childKeys = settings.childKeys();
@ -40,11 +45,14 @@ SteamTargetRenderer::SteamTargetRenderer(int& argc, char** argv) : QApplication(
if (childkey == "bDrawDebugEdges") if (childkey == "bDrawDebugEdges")
{ {
bDrawDebugEdges = settings.value(childkey).toBool(); bDrawDebugEdges = settings.value(childkey).toBool();
} else if (childkey == "bEnableOverlay") { }
else if (childkey == "bEnableOverlay") {
bDrawOverlay = settings.value(childkey).toBool(); bDrawOverlay = settings.value(childkey).toBool();
} else if (childkey == "bEnableControllers") { }
else if (childkey == "bEnableControllers") {
bEnableControllers = settings.value(childkey).toBool(); bEnableControllers = settings.value(childkey).toBool();
} else if (childkey == "bHookSteam") { }
else if (childkey == "bHookSteam") {
bHookSteam = settings.value(childkey).toBool(); bHookSteam = settings.value(childkey).toBool();
} }
else if (childkey == "bUseDesktopConfig") { else if (childkey == "bUseDesktopConfig") {
@ -60,7 +68,7 @@ SteamTargetRenderer::SteamTargetRenderer(int& argc, char** argv) : QApplication(
sfCshape.setFillColor(sf::Color(128, 128, 128, 128)); sfCshape.setFillColor(sf::Color(128, 128, 128, 128));
sfCshape.setOrigin(sf::Vector2f(100, 100)); sfCshape.setOrigin(sf::Vector2f(100, 100));
sf::VideoMode mode = sf::VideoMode::getDesktopMode(); sf::VideoMode mode = sf::VideoMode::getDesktopMode();
sfWindow.create(sf::VideoMode(mode.width-16, mode.height-32), "GloSC_OverlayWindow"); //Window is too large ; always 16 and 32 pixels? - sf::Style::None breaks transparency! sfWindow.create(sf::VideoMode(mode.width - 16, mode.height - 32), "GloSC_OverlayWindow"); //Window is too large ; always 16 and 32 pixels? - sf::Style::None breaks transparency!
sfWindow.setFramerateLimit(iRefreshRate); sfWindow.setFramerateLimit(iRefreshRate);
sfWindow.setPosition(sf::Vector2i(0, 0)); sfWindow.setPosition(sf::Vector2i(0, 0));
makeSfWindowTransparent(sfWindow); makeSfWindowTransparent(sfWindow);
@ -95,6 +103,7 @@ SteamTargetRenderer::SteamTargetRenderer(int& argc, char** argv) : QApplication(
SetForegroundWindow(taskbar); SetForegroundWindow(taskbar);
}); });
} }
}
} }

View File

@ -35,6 +35,7 @@ VirtualControllerThread::VirtualControllerThread()
VirtualControllerThread::~VirtualControllerThread() VirtualControllerThread::~VirtualControllerThread()
{ {
if (controllerThread.joinable())
controllerThread.join(); controllerThread.join();
vigem_shutdown(); vigem_shutdown();
} }