This commit is contained in:
Glenn Maynard
2005-12-28 23:33:11 +00:00
parent 88fb796c6b
commit b73fe69ff2
@@ -150,7 +150,7 @@ InputHandler_DInput::~InputHandler_DInput()
Devices[i].Close(); Devices[i].Close();
Devices.clear(); Devices.clear();
IDirectInput_Release(dinput); dinput->Release();
dinput = NULL; dinput = NULL;
} }
@@ -276,7 +276,7 @@ void InputHandler_DInput::UpdatePolled(DIDevice &device, const RageTimer &tm)
{ {
case in.BUTTON: case in.BUTTON:
{ {
DeviceInput di(dev, (DeviceButton) (JOY_BUTTON_1 + in.num), -1, tm); DeviceInput di( dev, enum_add2(JOY_BUTTON_1, in.num), -1, tm );
ButtonPressed( di, !!state.rgbButtons[in.ofs - DIJOFS_BUTTON0] ); ButtonPressed( di, !!state.rgbButtons[in.ofs - DIJOFS_BUTTON0] );
break; break;
} }
@@ -352,7 +352,7 @@ void InputHandler_DInput::UpdateBuffered(DIDevice &device, const RageTimer &tm)
DIDEVICEOBJECTDATA evtbuf[INPUT_QSIZE]; DIDEVICEOBJECTDATA evtbuf[INPUT_QSIZE];
numevents = INPUT_QSIZE; numevents = INPUT_QSIZE;
HRESULT hr = IDirectInputDevice2_GetDeviceData( device.Device, sizeof(DIDEVICEOBJECTDATA), evtbuf, &numevents, 0); HRESULT hr = device.Device->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), evtbuf, &numevents, 0);
if( hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED ) if( hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED )
return; return;
@@ -438,11 +438,11 @@ void InputHandler_DInput::PollAndAcquireDevices( bool bBuffered )
{ {
/* This will fail with "access denied" on the keyboard if we don't /* This will fail with "access denied" on the keyboard if we don't
* have focus. */ * have focus. */
hr = IDirectInputDevice2_Acquire( Devices[i].Device ); hr = Devices[i].Device->Acquire();
if( hr != DI_OK ) if( hr != DI_OK )
continue; continue;
IDirectInputDevice2_Poll( Devices[i].Device ); Devices[i].Device->Poll();
} }
} }
} }
@@ -497,11 +497,11 @@ void InputHandler_DInput::InputThreadMain()
BufferedDevices.push_back( &Devices[i] ); BufferedDevices.push_back( &Devices[i] );
IDirectInputDevice2_Unacquire(Devices[i].Device); Devices[i].Device->Unacquire();
HRESULT hr = IDirectInputDevice2_SetEventNotification(Devices[i].Device, Handle); HRESULT hr = Devices[i].Device->SetEventNotification( Handle );
if( FAILED(hr) ) if( FAILED(hr) )
LOG->Warn( "IDirectInputDevice2_SetEventNotification failed on %i", i ); LOG->Warn( "IDirectInputDevice2_SetEventNotification failed on %i", i );
IDirectInputDevice2_Acquire(Devices[i].Device); Devices[i].Device->Acquire();
} }
while( !m_bShutdown ) while( !m_bShutdown )
@@ -540,8 +540,8 @@ void InputHandler_DInput::InputThreadMain()
if( !Devices[i].buffered ) if( !Devices[i].buffered )
continue; continue;
IDirectInputDevice2_Unacquire(Devices[i].Device); Devices[i].Device->IDirectInputDevice2_Unacquire();
IDirectInputDevice2_SetEventNotification( Devices[i].Device, NULL ); Devices[i].Device->SetEventNotification( NULL );
} }
CloseHandle(Handle); CloseHandle(Handle);
@@ -549,7 +549,7 @@ void InputHandler_DInput::InputThreadMain()
void InputHandler_DInput::GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut ) void InputHandler_DInput::GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut )
{ {
for( unsigned i=0; i < Devices.size(); i++ ) for( unsigned i=0; i < Devices.size(); ++i )
{ {
vDevicesOut.push_back( Devices[i].dev ); vDevicesOut.push_back( Devices[i].dev );
vDescriptionsOut.push_back( Devices[i].JoystickInst.tszProductName ); vDescriptionsOut.push_back( Devices[i].JoystickInst.tszProductName );