mirror of
https://github.com/Thracky/GlosSI.git
synced 2024-11-17 03:26:02 +00:00
Clang-tidy fixes
This commit is contained in:
parent
9f61d9fb3f
commit
7b4ff0388d
@ -28,6 +28,10 @@ class SteamTarget : public QApplication
|
||||
|
||||
public:
|
||||
SteamTarget(int& argc, char** argv);
|
||||
SteamTarget(const SteamTarget& other) = delete;
|
||||
SteamTarget(SteamTarget&& other) noexcept = delete;
|
||||
SteamTarget& operator=(const SteamTarget& other) = delete;
|
||||
SteamTarget& operator=(SteamTarget&& other) noexcept = delete;
|
||||
~SteamTarget() = default;
|
||||
|
||||
void init();
|
||||
|
@ -23,7 +23,11 @@ class TargetOverlay
|
||||
{
|
||||
public:
|
||||
TargetOverlay() = default;
|
||||
|
||||
TargetOverlay(const TargetOverlay& other) = delete;
|
||||
TargetOverlay(TargetOverlay&& other) noexcept = delete;
|
||||
TargetOverlay& operator=(const TargetOverlay& other) = delete;
|
||||
TargetOverlay& operator=(TargetOverlay&& other) noexcept = delete;
|
||||
~TargetOverlay() = default;
|
||||
|
||||
bool init(bool hidden = false);
|
||||
void stop();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2018 Peter Repukat - FlatspotSoftware
|
||||
Copyright 2016 Peter Repukat - FlatspotSoftware
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -24,7 +24,7 @@ VirtualControllerThread::VirtualControllerThread()
|
||||
{
|
||||
std::cout << "Error initializing ViGem!" << std::endl;
|
||||
MessageBoxW(NULL, L"Error initializing ViGem!", L"GloSC-SteamTarget", MB_OK);
|
||||
bShouldRun = false;
|
||||
b_should_run_ = false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < XUSER_MAX_COUNT; i++)
|
||||
@ -45,13 +45,13 @@ VirtualControllerThread::~VirtualControllerThread()
|
||||
|
||||
void VirtualControllerThread::run()
|
||||
{
|
||||
bShouldRun = true;
|
||||
b_should_run_ = true;
|
||||
controller_thread_ = std::thread(&VirtualControllerThread::controllerLoop, this);
|
||||
}
|
||||
|
||||
void VirtualControllerThread::stop()
|
||||
{
|
||||
bShouldRun = false;
|
||||
b_should_run_ = false;
|
||||
for (int i = 0; i < XUSER_MAX_COUNT; i++)
|
||||
{
|
||||
vigem_target_remove(driver_, vt_x360_[i]);
|
||||
@ -61,13 +61,13 @@ void VirtualControllerThread::stop()
|
||||
|
||||
bool VirtualControllerThread::isRunning() const
|
||||
{
|
||||
return bShouldRun;
|
||||
return b_should_run_;
|
||||
}
|
||||
|
||||
void VirtualControllerThread::controllerLoop()
|
||||
{
|
||||
sf::Clock waitForHookTimer;
|
||||
while (bShouldRun)
|
||||
while (b_should_run_)
|
||||
{
|
||||
sf_clock_.restart();
|
||||
|
||||
@ -189,17 +189,16 @@ DWORD VirtualControllerThread::XInputGetStateWrapper(DWORD dwUserIndex, XINPUT_S
|
||||
|
||||
DWORD VirtualControllerThread::callRealXinputGetState(DWORD dwUserIndex, XINPUT_STATE* pState)
|
||||
{
|
||||
DWORD ret;
|
||||
DWORD dwOldProtect, dwBkup;
|
||||
|
||||
BYTE* Address = reinterpret_cast<BYTE*>(x_get_state_);
|
||||
auto* Address = reinterpret_cast<BYTE*>(x_get_state_);
|
||||
VirtualProtect(Address, op_patch_lenght, PAGE_EXECUTE_READWRITE, &dwOldProtect); //Change permissions of memory..
|
||||
for (DWORD i = 0; i < op_patch_lenght; i++) //unpatch Valve's hook
|
||||
{
|
||||
*(Address + i) = real_bytes_[i];
|
||||
}
|
||||
|
||||
ret = x_get_state_(dwUserIndex, pState); //Cal REAL XInputGetState...
|
||||
const DWORD ret = x_get_state_(dwUserIndex, pState); //Cal REAL XInputGetState...
|
||||
|
||||
for (int i = 0; i < op_patch_lenght; i++) //repatch Valve's hook
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ limitations under the License.
|
||||
#include <vector>
|
||||
|
||||
#include <Windows.h>
|
||||
#include <psapi.h>
|
||||
#include <Psapi.h>
|
||||
|
||||
#include <SFML/System.hpp>
|
||||
|
||||
@ -34,6 +34,10 @@ class VirtualControllerThread
|
||||
{
|
||||
public:
|
||||
VirtualControllerThread();
|
||||
VirtualControllerThread(const VirtualControllerThread& other) = delete;
|
||||
VirtualControllerThread(VirtualControllerThread&& other) noexcept = delete;
|
||||
VirtualControllerThread& operator=(const VirtualControllerThread& other) = delete;
|
||||
VirtualControllerThread& operator=(VirtualControllerThread&& other) noexcept = delete;
|
||||
~VirtualControllerThread();
|
||||
|
||||
void run();
|
||||
@ -43,13 +47,11 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
std::atomic<bool> bShouldRun = false;
|
||||
|
||||
|
||||
std::atomic<bool> b_should_run_ = false;
|
||||
typedef DWORD(WINAPI* XInputGetState_t)(DWORD dwUserIndex, XINPUT_STATE* pState);
|
||||
|
||||
static const uint8_t op_patch_lenght = 5;
|
||||
uint8_t valve_hook_bytes_[5];
|
||||
uint8_t valve_hook_bytes_[5]{};
|
||||
|
||||
bool seven_ = false;
|
||||
|
||||
@ -64,7 +66,7 @@ private:
|
||||
XInputGetState_t x_get_state_ = nullptr;
|
||||
|
||||
PVIGEM_CLIENT driver_;
|
||||
PVIGEM_TARGET vt_x360_[XUSER_MAX_COUNT];
|
||||
PVIGEM_TARGET vt_x360_[XUSER_MAX_COUNT]{};
|
||||
|
||||
std::thread controller_thread_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user