mirror of
https://github.com/Thracky/GlosSI.git
synced 2024-11-03 09:40:18 +00:00
SteamTarget: Link against Win7 compatible XInput
This commit is contained in:
parent
ff4a157454
commit
8960bd99b0
@ -71,7 +71,7 @@
|
||||
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\dependencies\VigemClient\;..\dependencies\SFML-2.4.2-x64\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>qtmaind.lib;Qt5Cored.lib;Xinput.lib;dwmapi.lib;sfml-system-d.lib;sfml-window-d.lib;sfml-graphics-d.lib;Qt5Guid.lib;Qt5Widgetsd.lib;vigemclient_x64-d.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>qtmaind.lib;XInput9_1_0.lib;Qt5Cored.lib;dwmapi.lib;sfml-system-d.lib;sfml-window-d.lib;sfml-graphics-d.lib;Qt5Guid.lib;Qt5Widgetsd.lib;vigemclient_x64-d.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
@ -88,7 +88,7 @@
|
||||
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\dependencies\VigemClient\;..\dependencies\SFML-2.4.2-x86\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>qtmaind.lib;Qt5Cored.lib;Xinput.lib;dwmapi.lib;sfml-system-d.lib;sfml-window-d.lib;sfml-graphics-d.lib;Qt5Guid.lib;Qt5Widgetsd.lib;vigemclient_x86-d.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>qtmaind.lib;Qt5Cored.lib;Xinput9_1_0.lib;dwmapi.lib;sfml-system-d.lib;sfml-window-d.lib;sfml-graphics-d.lib;Qt5Guid.lib;Qt5Widgetsd.lib;vigemclient_x86-d.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
@ -106,7 +106,7 @@
|
||||
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\dependencies\VigemClient\;..\dependencies\SFML-2.4.2-x64\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<AdditionalDependencies>qtmain.lib;Qt5Core.lib;xinput.lib;dwmapi.lib;sfml-system.lib;sfml-window.lib;sfml-graphics.lib;Qt5Gui.lib;Qt5Widgets.lib;vigemclient_x64.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>qtmain.lib;Qt5Core.lib;xinput9_1_0.lib;dwmapi.lib;sfml-system.lib;sfml-window.lib;sfml-graphics.lib;Qt5Gui.lib;Qt5Widgets.lib;vigemclient_x64.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
@ -127,7 +127,7 @@
|
||||
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\dependencies\VigemClient\;..\dependencies\SFML-2.4.2-x86\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<AdditionalDependencies>qtmain.lib;Qt5Core.lib;xinput.lib;dwmapi.lib;sfml-system.lib;sfml-window.lib;sfml-graphics.lib;Qt5Gui.lib;Qt5Widgets.lib;vigemclient_x86.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>qtmain.lib;Qt5Core.lib;xinput9_1_0.lib;dwmapi.lib;sfml-system.lib;sfml-window.lib;sfml-graphics.lib;Qt5Gui.lib;Qt5Widgets.lib;vigemclient_x86.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
@ -80,6 +80,7 @@ SteamTargetRenderer::SteamTargetRenderer(int& argc, char** argv) : QApplication(
|
||||
ShowWindow(consoleHwnd, SW_HIDE);
|
||||
#endif // NDEBUG
|
||||
|
||||
|
||||
if (bEnableControllers)
|
||||
controllerThread.run();
|
||||
|
||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
||||
|
||||
VirtualControllerThread::VirtualControllerThread()
|
||||
{
|
||||
|
||||
driver = vigem_alloc();
|
||||
|
||||
if (!VIGEM_SUCCESS(vigem_connect(driver)))
|
||||
@ -32,6 +31,8 @@ VirtualControllerThread::VirtualControllerThread()
|
||||
{
|
||||
vtX360[i] = vigem_target_x360_alloc();
|
||||
}
|
||||
|
||||
seven = IsWindows7OrGreater() != IsWindows8OrGreater();
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +127,7 @@ void VirtualControllerThread::controllerLoop()
|
||||
|
||||
if (result == ERROR_SUCCESS)
|
||||
{
|
||||
if (result2 != ERROR_SUCCESS)
|
||||
if ( (result2 != ERROR_SUCCESS) == seven )
|
||||
{
|
||||
// By using VID and PID of Valve's SteamController, Steam doesn't give us ANOTHER "fake" XInput device
|
||||
// Leading to endless pain and suffering.
|
||||
@ -149,7 +150,8 @@ void VirtualControllerThread::controllerLoop()
|
||||
}
|
||||
}
|
||||
|
||||
vigem_target_x360_update(driver, vtX360[i], *reinterpret_cast<XUSB_REPORT*>(&state.Gamepad));
|
||||
if (vtX360[i] != nullptr)
|
||||
vigem_target_x360_update(driver, vtX360[i], *reinterpret_cast<XUSB_REPORT*>(&state.Gamepad));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ limitations under the License.
|
||||
|
||||
#include <Xinput.h>
|
||||
#include <ViGEmClient.h>
|
||||
#include <VersionHelpers.h>
|
||||
|
||||
class VirtualControllerThread
|
||||
{
|
||||
@ -50,8 +51,8 @@ private:
|
||||
static const uint8_t opPatchLenght = 5;
|
||||
uint8_t valveHookBytes[5];
|
||||
|
||||
// First 5 bytes are the same for XInput1_4.dll and XInput9_1_0.dll (on AMD64 at least, didn't check yet for x86, there is no ViGEm build for Win7 anway...)
|
||||
// So no change has to be made for Win7 Targets
|
||||
bool seven = false;
|
||||
|
||||
#ifdef _AMD64_
|
||||
const uint8_t realBytes[5] = {0x48, 0x89, 0x5C, 0x24, 0x08};
|
||||
#else
|
||||
@ -78,6 +79,5 @@ private:
|
||||
static DWORD XInputGetStateWrapper(DWORD dwUserIndex, XINPUT_STATE* pState); //Easier to find in x64dbg...
|
||||
|
||||
DWORD callRealXinputGetState(DWORD dwUserIndex, XINPUT_STATE* pState);
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user