2
0
mirror of https://github.com/Thracky/GlosSI.git synced 2024-11-03 09:40:18 +00:00

SteamTarget: Unhook Steam from Target

Previously was done via GloSC_GameLauncher
Let's leave unhooking in GloSC_GameLauncher too, just to be safe.
This commit is contained in:
Peter Repukat 2017-02-15 20:13:41 +01:00
parent 209126ea17
commit 7d02ef4e6f
2 changed files with 29 additions and 1 deletions

View File

@ -17,12 +17,15 @@ limitations under the License.
std::atomic<bool> SteamTargetRenderer::overlayOpen = false;
HHOOK SteamTargetRenderer::hook = nullptr;
std::atomic<bool> SteamTargetRenderer::bHookSteam = false;
SteamTargetRenderer::SteamTargetRenderer(int& argc, char** argv) : QApplication(argc, argv)
{
getSteamOverlay();
loadLogo();
SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(ConsoleCtrlCallback), true);
QSettings settings(".\\TargetConfig.ini", QSettings::IniFormat);
settings.beginGroup("BaseConf");
const QStringList childKeys = settings.childKeys();
@ -365,6 +368,28 @@ LRESULT WINAPI SteamTargetRenderer::HookCallback(int nCode, WPARAM wParam, LPARA
return CallNextHookEx(hook, nCode, wParam, lParam);
}
BOOL SteamTargetRenderer::ConsoleCtrlCallback(DWORD dwCtrlType)
{
if (dwCtrlType == CTRL_CLOSE_EVENT || dwCtrlType == CTRL_BREAK_EVENT || dwCtrlType == CTRL_C_EVENT)
{
if (bHookSteam)
{
QString dir = QDir::toNativeSeparators(QCoreApplication::applicationDirPath());
dir = dir.mid(0, dir.lastIndexOf("\\"));
QProcess proc;
proc.setNativeArguments(" --eject ");
proc.setWorkingDirectory(dir);
proc.start("..\\Injector.exe", QIODevice::ReadOnly);
proc.waitForStarted();
proc.waitForFinished();
}
return true;
}
return false;
}
void SteamTargetRenderer::launchApp()
{
bool launchGame = false;

View File

@ -36,6 +36,7 @@ limitations under the License.
#include <psapi.h>
#include "VirtualControllerThread.h"
#include <atomic>
class SteamTargetRenderer : public QApplication
{
@ -91,13 +92,15 @@ private:
bool bEnableControllers = true;
bool bHookSteam = false;
static std::atomic<bool> bHookSteam;
QTimer updateTimer;
std::unique_ptr<sf::Texture> spriteTexture;
sf::Sprite backgroundSprite;
static BOOL WINAPI ConsoleCtrlCallback(_In_ DWORD dwCtrlType);
const QString LaunchGame = "LaunchGame";
const QString LaunchedProcessFinished = "LaunchedProcessFinished";
const QString IsSteamHooked = "IsSteamHooked";