OpenBarnyard
 
Loading...
Searching...
No Matches
TInputDeviceController_Win.cpp
Go to the documentation of this file.
1#include "ToshiPCH.h"
3
4//-----------------------------------------------------------------------------
5// Enables memory debugging.
6// Note: Should be the last include!
7//-----------------------------------------------------------------------------
9
11
12TBOOL TInputDXDeviceController::IsDirectInputController( LPCDIDEVICEINSTANCEA a_poDeviceInstance )
13{
14 TASSERT( a_poDeviceInstance != NULL );
15 TCHAR fmtStr[ 37 ];
16
17 T2String8::Format( fmtStr, "%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX", a_poDeviceInstance->guidProduct.Data1, a_poDeviceInstance->guidProduct.Data2, a_poDeviceInstance->guidProduct.Data3, a_poDeviceInstance->guidProduct.Data4[ 0 ], a_poDeviceInstance->guidProduct.Data4[ 1 ], a_poDeviceInstance->guidProduct.Data4[ 2 ], a_poDeviceInstance->guidProduct.Data4[ 3 ], a_poDeviceInstance->guidProduct.Data4[ 4 ], a_poDeviceInstance->guidProduct.Data4[ 5 ], a_poDeviceInstance->guidProduct.Data4[ 6 ], a_poDeviceInstance->guidProduct.Data4[ 7 ] );
18
19 if ( TStringManager::String8FindString( fmtStr, (TCHAR*)"09cc054c-0000-0000-0000-504944564944" ) == TNULL && TStringManager::String8FindString( fmtStr, (TCHAR*)"05C4054C-0000-0000-0000-504944564944" ) == TNULL && TStringManager::String8FindString( fmtStr, (TCHAR*)"00050925-0000-0000-0000-504944564944" ) == TNULL && TStringManager::String8FindString( fmtStr, (TCHAR*)"0268054C-0000-0000-0000-504944564944" ) == TNULL && TStringManager::String8FindString( fmtStr, (TCHAR*)"03088888-0000-0000-0000-504944564944" ) == TNULL )
20 {
21 return TFALSE;
22 }
23
24 return TTRUE;
25}
26
27TBOOL const TInputDXDeviceController::BindToDIDevice( HWND a_mainWindow, LPCDIDEVICEINSTANCEA a_poDeviceInstance, IDirectInputDevice8A* a_poDXInputDevice )
28{
29 TASSERT( a_poDeviceInstance != NULL );
30 TASSERT( a_poDXInputDevice != NULL );
31 m_bIsXInput = IsDirectInputController( a_poDeviceInstance );
32 Initialise();
33
34 m_pDXInputDevice = a_poDXInputDevice;
35 m_pDXDiDevCaps = DIDEVCAPS();
36 m_pDXInputDevice->GetCapabilities( &m_pDXDiDevCaps );
37 HRESULT hr = m_pDXInputDevice->SetDataFormat( &c_dfDIJoystick );
38
39 if ( hr != DI_OK )
40 {
41 return TFALSE;
42 }
43
44 m_pDXInputDevice->EnumObjects( EnumerateObjectCallback, this, DIDFT_BUTTON | DIDFT_AXIS );
45 TTODO( "field_0x38C = 0" );
46 return TTRUE;
47}
48
#define TASSERT(X,...)
Definition Defines.h:138
#define TOSHI_NAMESPACE_START
Definition Defines.h:47
#define TTODO(DESC)
Definition Defines.h:134
#define TOSHI_NAMESPACE_END
Definition Defines.h:50
char TCHAR
Definition Typedefs.h:20
#define TNULL
Definition Typedefs.h:23
#define TFALSE
Definition Typedefs.h:24
#define TTRUE
Definition Typedefs.h:25
bool TBOOL
Definition Typedefs.h:6
static TINT CALLBACK EnumerateObjectCallback(LPCDIDEVICEOBJECTINSTANCEA a_poDeviceInstance, LPVOID a_pData)
TBOOL const BindToDIDevice(HWND a_mainWindow, LPCDIDEVICEINSTANCEA a_poDeviceInstance, IDirectInputDevice8A *a_poDXInputDevice)
static TBOOL IsDirectInputController(LPCDIDEVICEINSTANCEA a_poDeviceInstance)
static TINT Format(TCHAR *a_pcString, TINT size, const TCHAR *a_pcFormat,...)
Definition T2String8.cpp:41
static const TCHAR * String8FindString(const TCHAR *str, const TCHAR *substr)