Merge pull request #7614 from jordan-woyak/windows-gaming-input

InputCommon: Add Windows.Gaming.Input to ControllerInterface.
This commit is contained in:
Admiral H. Curtiss
2022-04-05 01:14:43 +02:00
committed by GitHub
9 changed files with 724 additions and 4 deletions
+6
View File
@@ -27,6 +27,12 @@
<Project>{41279555-f94f-4ebc-99de-af863c10c5c4}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="InputCommon\ControllerInterface\WGInput\WGInput.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="InputCommon\ControllerInterface\WGInput\WGInput.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>
+2
View File
@@ -94,6 +94,8 @@ if(WIN32)
ControllerInterface/DInput/XInputFilter.h
ControllerInterface/Win32/Win32.cpp
ControllerInterface/Win32/Win32.h
ControllerInterface/WGInput/WGInput.cpp
ControllerInterface/WGInput/WGInput.h
ControllerInterface/XInput/XInput.cpp
ControllerInterface/XInput/XInput.h
ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp
@@ -64,7 +64,7 @@ public:
std::string GetName() const override;
std::string GetSource() const override;
int GetSortPriority() const override { return -2; }
int GetSortPriority() const override { return -3; }
bool IsValid() const final override;
@@ -136,7 +136,7 @@ public:
std::string GetSource() const final override;
std::optional<int> GetPreferredId() const final override;
// Always add these at the end, given their hotplug nature
int GetSortPriority() const override { return -4; }
int GetSortPriority() const override { return -5; }
private:
void ResetPadData();
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,12 @@
// Copyright 2020 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
namespace ciface::WGInput
{
void Init();
void DeInit();
void PopulateDevices();
} // namespace ciface::WGInput
@@ -323,7 +323,7 @@ std::string Device::GetSource() const
// Always add these at the end, given their hotplug nature
int Device::GetSortPriority() const
{
return -3;
return -4;
}
void Device::RunTasks()
@@ -16,6 +16,7 @@
#include "Common/ScopeGuard.h"
#include "Common/Thread.h"
#include "InputCommon/ControllerInterface/DInput/DInput.h"
#include "InputCommon/ControllerInterface/WGInput/WGInput.h"
#include "InputCommon/ControllerInterface/XInput/XInput.h"
constexpr UINT WM_DOLPHIN_STOP = WM_USER;
@@ -42,6 +43,7 @@ static LRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARA
g_controller_interface.PlatformPopulateDevices([] {
ciface::DInput::PopulateDevices(s_hwnd);
ciface::XInput::PopulateDevices();
ciface::WGInput::PopulateDevices();
});
}
}
@@ -53,6 +55,7 @@ void ciface::Win32::Init(void* hwnd)
{
s_hwnd = static_cast<HWND>(hwnd);
XInput::Init();
WGInput::Init();
std::promise<HWND> message_window_promise;
@@ -147,6 +150,7 @@ void ciface::Win32::PopulateDevices(void* hwnd)
s_first_populate_devices_asked.Set();
ciface::DInput::PopulateDevices(s_hwnd);
ciface::XInput::PopulateDevices();
ciface::WGInput::PopulateDevices();
}
else
{
@@ -179,4 +183,5 @@ void ciface::Win32::DeInit()
s_hwnd = nullptr;
XInput::DeInit();
WGInput::DeInit();
}
@@ -31,7 +31,7 @@ public:
std::string GetName() const override;
std::string GetSource() const override;
std::optional<int> GetPreferredId() const override;
int GetSortPriority() const override { return -1; }
int GetSortPriority() const override { return -2; }
void UpdateInput() override;