Skip to content

Commit

Permalink
Use template for GetCapabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Jun 15, 2024
1 parent a031fe5 commit 6776db1
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 62
#define BUILD_NUMBER 63
8 changes: 5 additions & 3 deletions IDirectInputDeviceX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ ULONG m_IDirectInputDeviceX::Release()
return ref;
}

HRESULT m_IDirectInputDeviceX::GetCapabilities(LPDIDEVCAPS lpDIDevCaps)
template HRESULT m_IDirectInputDeviceX::GetCapabilities<LPDIDEVCAPS, DIDEVICEINSTANCEA>(LPDIDEVCAPS);
template HRESULT m_IDirectInputDeviceX::GetCapabilities<LPDIDEVCAPS, DIDEVICEINSTANCEW>(LPDIDEVCAPS);
template <class T, class D>
HRESULT m_IDirectInputDeviceX::GetCapabilities(T lpDIDevCaps)
{
Logging::LogDebug() << __FUNCTION__ << " (" << this << ")";

Expand All @@ -276,8 +279,7 @@ HRESULT m_IDirectInputDeviceX::GetCapabilities(LPDIDEVCAPS lpDIDevCaps)

if (SUCCEEDED(hr))
{
DIDEVICEINSTANCE didi;
ZeroMemory(&didi, sizeof(didi));
D didi = {};
didi.dwSize = sizeof(DIDEVICEINSTANCE);

hr = GetDeviceInfo(&didi);
Expand Down
3 changes: 2 additions & 1 deletion IDirectInputDeviceX.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ class m_IDirectInputDeviceX : public AddressLookupTableDinputObject
STDMETHOD_(ULONG, Release)(THIS);

/*** IDirectInputDevice methods ***/
STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS);
template <class T, class D>
HRESULT GetCapabilities(T lpDIDevCaps);
STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags)
{
return EnumObjectsX<IDirectInputDevice8A, LPDIENUMDEVICEOBJECTSCALLBACKA, DIDEVICEOBJECTINSTANCEA, DIDEVICEOBJECTINSTANCE_DX3A>(lpCallback, pvRef, dwFlags);
Expand Down
2 changes: 1 addition & 1 deletion Versions/IDirectInputDevice2A.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ULONG m_IDirectInputDevice2A::Release()

HRESULT m_IDirectInputDevice2A::GetCapabilities(LPDIDEVCAPS lpDIDevCaps)
{
return ProxyInterface->GetCapabilities(lpDIDevCaps);
return ProxyInterface->GetCapabilities<LPDIDEVCAPS, DIDEVICEINSTANCEA>(lpDIDevCaps);
}

HRESULT m_IDirectInputDevice2A::EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags)
Expand Down
2 changes: 1 addition & 1 deletion Versions/IDirectInputDevice2W.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ULONG m_IDirectInputDevice2W::Release()

HRESULT m_IDirectInputDevice2W::GetCapabilities(LPDIDEVCAPS lpDIDevCaps)
{
return ProxyInterface->GetCapabilities(lpDIDevCaps);
return ProxyInterface->GetCapabilities<LPDIDEVCAPS, DIDEVICEINSTANCEW>(lpDIDevCaps);
}

HRESULT m_IDirectInputDevice2W::EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags)
Expand Down
2 changes: 1 addition & 1 deletion Versions/IDirectInputDevice7A.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ULONG m_IDirectInputDevice7A::Release()

HRESULT m_IDirectInputDevice7A::GetCapabilities(LPDIDEVCAPS lpDIDevCaps)
{
return ProxyInterface->GetCapabilities(lpDIDevCaps);
return ProxyInterface->GetCapabilities<LPDIDEVCAPS, DIDEVICEINSTANCEA>(lpDIDevCaps);
}

HRESULT m_IDirectInputDevice7A::EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags)
Expand Down
2 changes: 1 addition & 1 deletion Versions/IDirectInputDevice7W.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ULONG m_IDirectInputDevice7W::Release()

HRESULT m_IDirectInputDevice7W::GetCapabilities(LPDIDEVCAPS lpDIDevCaps)
{
return ProxyInterface->GetCapabilities(lpDIDevCaps);
return ProxyInterface->GetCapabilities<LPDIDEVCAPS, DIDEVICEINSTANCEW>(lpDIDevCaps);
}

HRESULT m_IDirectInputDevice7W::EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags)
Expand Down
2 changes: 1 addition & 1 deletion Versions/IDirectInputDeviceA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ULONG m_IDirectInputDeviceA::Release()

HRESULT m_IDirectInputDeviceA::GetCapabilities(LPDIDEVCAPS lpDIDevCaps)
{
return ProxyInterface->GetCapabilities(lpDIDevCaps);
return ProxyInterface->GetCapabilities<LPDIDEVCAPS, DIDEVICEINSTANCEA>(lpDIDevCaps);
}

HRESULT m_IDirectInputDeviceA::EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, LPVOID pvRef, DWORD dwFlags)
Expand Down
2 changes: 1 addition & 1 deletion Versions/IDirectInputDeviceW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ULONG m_IDirectInputDeviceW::Release()

HRESULT m_IDirectInputDeviceW::GetCapabilities(LPDIDEVCAPS lpDIDevCaps)
{
return ProxyInterface->GetCapabilities(lpDIDevCaps);
return ProxyInterface->GetCapabilities<LPDIDEVCAPS, DIDEVICEINSTANCEW>(lpDIDevCaps);
}

HRESULT m_IDirectInputDeviceW::EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags)
Expand Down

0 comments on commit 6776db1

Please sign in to comment.