Convert ACP strings from the OS that we show to the user.

This commit is contained in:
Glenn Maynard
2006-04-04 23:44:37 +00:00
parent 05c1ab44b9
commit 0d4e8b44c2
3 changed files with 12 additions and 9 deletions
@@ -124,7 +124,7 @@ InputHandler_DInput::InputHandler_DInput()
{
LOG->Info( " %d: '%s' axes: %d, hats: %d, buttons: %d (%s)",
i,
Devices[i].JoystickInst.tszProductName,
Devices[i].m_sName.c_str(),
Devices[i].axes,
Devices[i].hats,
Devices[i].buttons,
@@ -333,7 +333,7 @@ void InputHandler_DInput::UpdatePolled( DIDevice &device, const RageTimer &tm )
break;
default: LOG->MapLog( "unknown input",
"Controller '%s' is returning an unknown joystick offset, %i",
device.JoystickInst.tszProductName, in.ofs );
device.m_sName.c_str(), in.ofs );
continue;
}
if( neg != DeviceButton_Invalid )
@@ -450,7 +450,7 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
case DIJOFS_SLIDER(1): up = JOY_AUX_3; down = JOY_AUX_4; break;
default: LOG->MapLog( "unknown input",
"Controller '%s' is returning an unknown joystick offset, %i",
device.JoystickInst.tszProductName, in.ofs );
device.m_sName.c_str(), in.ofs );
continue;
}
@@ -639,7 +639,7 @@ void InputHandler_DInput::InputThreadMain()
void InputHandler_DInput::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
{
for( unsigned i=0; i < Devices.size(); ++i )
vDevicesOut.push_back( InputDeviceInfo(Devices[i].dev, Devices[i].JoystickInst.tszProductName) );
vDevicesOut.push_back( InputDeviceInfo(Devices[i].dev, Devices[i].m_sName) );
}
/*
@@ -26,7 +26,9 @@ DIDevice::DIDevice()
bool DIDevice::Open()
{
LOG->Trace( "Opening device '%s'", JoystickInst.tszProductName );
m_sName = ConvertACPToUTF8( JoystickInst.tszProductName );
LOG->Trace( "Opening device '%s'", m_sName.c_str() );
buffered = true;
LPDIRECTINPUTDEVICE tmpdevice;
@@ -41,7 +43,7 @@ bool DIDevice::Open()
tmpdevice->Release();
if ( hr != DI_OK )
{
LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice::QueryInterface", JoystickInst.tszProductName) );
LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice::QueryInterface", m_sName.c_str()) );
return false;
}
@@ -52,14 +54,14 @@ bool DIDevice::Open()
hr = Device->SetCooperativeLevel( GraphicsWindow::GetHwnd(), coop );
if ( hr != DI_OK )
{
LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice2::SetCooperativeLevel", JoystickInst.tszProductName) );
LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice2::SetCooperativeLevel", m_sName.c_str()) );
return false;
}
hr = Device->SetDataFormat( type == JOYSTICK? &c_dfDIJoystick: &c_dfDIKeyboard );
if ( hr != DI_OK )
{
LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice2::SetDataFormat", JoystickInst.tszProductName) );
LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice2::SetDataFormat", m_sName.c_str()) );
return false;
}
@@ -100,7 +102,7 @@ bool DIDevice::Open()
}
else if ( hr != DI_OK )
{
LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice2::SetProperty", JoystickInst.tszProductName) );
LOG->Info( hr_ssprintf(hr, "OpenDevice(%s): IDirectInputDevice2::SetProperty", m_sName.c_str()) );
return false;
}
}
@@ -24,6 +24,7 @@ struct DIDevice
{
DIDEVICEINSTANCE JoystickInst;
LPDIRECTINPUTDEVICE2 Device;
RString m_sName;
enum { KEYBOARD, JOYSTICK } type;