Convert ACP strings from the OS that we show to the user.
This commit is contained in:
@@ -124,7 +124,7 @@ InputHandler_DInput::InputHandler_DInput()
|
|||||||
{
|
{
|
||||||
LOG->Info( " %d: '%s' axes: %d, hats: %d, buttons: %d (%s)",
|
LOG->Info( " %d: '%s' axes: %d, hats: %d, buttons: %d (%s)",
|
||||||
i,
|
i,
|
||||||
Devices[i].JoystickInst.tszProductName,
|
Devices[i].m_sName.c_str(),
|
||||||
Devices[i].axes,
|
Devices[i].axes,
|
||||||
Devices[i].hats,
|
Devices[i].hats,
|
||||||
Devices[i].buttons,
|
Devices[i].buttons,
|
||||||
@@ -333,7 +333,7 @@ void InputHandler_DInput::UpdatePolled( DIDevice &device, const RageTimer &tm )
|
|||||||
break;
|
break;
|
||||||
default: LOG->MapLog( "unknown input",
|
default: LOG->MapLog( "unknown input",
|
||||||
"Controller '%s' is returning an unknown joystick offset, %i",
|
"Controller '%s' is returning an unknown joystick offset, %i",
|
||||||
device.JoystickInst.tszProductName, in.ofs );
|
device.m_sName.c_str(), in.ofs );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if( neg != DeviceButton_Invalid )
|
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;
|
case DIJOFS_SLIDER(1): up = JOY_AUX_3; down = JOY_AUX_4; break;
|
||||||
default: LOG->MapLog( "unknown input",
|
default: LOG->MapLog( "unknown input",
|
||||||
"Controller '%s' is returning an unknown joystick offset, %i",
|
"Controller '%s' is returning an unknown joystick offset, %i",
|
||||||
device.JoystickInst.tszProductName, in.ofs );
|
device.m_sName.c_str(), in.ofs );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -639,7 +639,7 @@ void InputHandler_DInput::InputThreadMain()
|
|||||||
void InputHandler_DInput::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
|
void InputHandler_DInput::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i < Devices.size(); ++i )
|
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()
|
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;
|
buffered = true;
|
||||||
|
|
||||||
LPDIRECTINPUTDEVICE tmpdevice;
|
LPDIRECTINPUTDEVICE tmpdevice;
|
||||||
@@ -41,7 +43,7 @@ bool DIDevice::Open()
|
|||||||
tmpdevice->Release();
|
tmpdevice->Release();
|
||||||
if ( hr != DI_OK )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,14 +54,14 @@ bool DIDevice::Open()
|
|||||||
hr = Device->SetCooperativeLevel( GraphicsWindow::GetHwnd(), coop );
|
hr = Device->SetCooperativeLevel( GraphicsWindow::GetHwnd(), coop );
|
||||||
if ( hr != DI_OK )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = Device->SetDataFormat( type == JOYSTICK? &c_dfDIJoystick: &c_dfDIKeyboard );
|
hr = Device->SetDataFormat( type == JOYSTICK? &c_dfDIJoystick: &c_dfDIKeyboard );
|
||||||
if ( hr != DI_OK )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +102,7 @@ bool DIDevice::Open()
|
|||||||
}
|
}
|
||||||
else if ( hr != DI_OK )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ struct DIDevice
|
|||||||
{
|
{
|
||||||
DIDEVICEINSTANCE JoystickInst;
|
DIDEVICEINSTANCE JoystickInst;
|
||||||
LPDIRECTINPUTDEVICE2 Device;
|
LPDIRECTINPUTDEVICE2 Device;
|
||||||
|
RString m_sName;
|
||||||
|
|
||||||
enum { KEYBOARD, JOYSTICK } type;
|
enum { KEYBOARD, JOYSTICK } type;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user