input/input_dinput.h: Work around inability to have stdcall non-capturing lambdas (fixes 32-bit MinGW build).

This commit is contained in:
Vas Crabb 2023-03-26 16:35:20 +11:00
parent e79f5257b0
commit 8ae9024b19

View File

@ -87,12 +87,16 @@ public:
template <typename T>
HRESULT enum_attached_devices(int devclass, T &&callback) const
{
struct helper
{
static BOOL CALLBACK callback(LPCDIDEVICEINSTANCE instance, LPVOID ref)
{
return (*reinterpret_cast<T *>(ref))(instance);
}
};
return m_dinput->EnumDevices(
devclass,
[] (LPCDIDEVICEINSTANCE instance, LPVOID ref) -> BOOL
{
return (*reinterpret_cast<T *>(ref))(instance);
},
&helper::callback,
reinterpret_cast<LPVOID>(&callback),
DIEDFL_ATTACHEDONLY);
}