silence warning spew if no hid devices plugged in
This commit is contained in:
@@ -65,7 +65,7 @@ static int GetNumUsbHidDevices()
|
|||||||
// The "Enum" key doesn't exist if no hid devices are attached, so it's expected that GetRegValue will sometimes fail.
|
// The "Enum" key doesn't exist if no hid devices are attached, so it's expected that GetRegValue will sometimes fail.
|
||||||
// TODO: Does this work in Win98 and Win2K?
|
// TODO: Does this work in Win98 and Win2K?
|
||||||
int i = 0;
|
int i = 0;
|
||||||
RegistryAccess::GetRegValue( "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\HidUsb\\Enum", "Count", i );
|
RegistryAccess::GetRegValue( "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\HidUsb\\Enum", "Count", i, false ); // don't warn on error
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,7 +384,28 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
|
|||||||
switch( in.type )
|
switch( in.type )
|
||||||
{
|
{
|
||||||
case in.KEY:
|
case in.KEY:
|
||||||
ButtonPressed( DeviceInput(dev, (DeviceButton) in.num, -1, tm), !!(evtbuf[i].dwData & 0x80)) ;
|
/* // "Joystick with keyboard" hack
|
||||||
|
switch( in.num )
|
||||||
|
{
|
||||||
|
case 115: //s
|
||||||
|
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_UP, -1, tm), !!(evtbuf[i].dwData & 0x80) );
|
||||||
|
break;
|
||||||
|
case 120: //x
|
||||||
|
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_DOWN, -1, tm), !!(evtbuf[i].dwData & 0x80) );
|
||||||
|
break;
|
||||||
|
case 122: //z
|
||||||
|
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_LEFT, -1, tm), !!(evtbuf[i].dwData & 0x80) );
|
||||||
|
break;
|
||||||
|
case 99: //c
|
||||||
|
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_RIGHT, -1, tm), !!(evtbuf[i].dwData & 0x80) );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
*/
|
||||||
|
ButtonPressed( DeviceInput(dev, (DeviceButton) in.num, -1, tm), !!(evtbuf[i].dwData & 0x80)) ;
|
||||||
|
/*
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case in.BUTTON:
|
case in.BUTTON:
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ static bool GetRegKeyType( const RString &sIn, RString &sOut, HKEY &key )
|
|||||||
|
|
||||||
/* Given a full key, eg. "HKEY_LOCAL_MACHINE\hardware\foo", open it and return it.
|
/* Given a full key, eg. "HKEY_LOCAL_MACHINE\hardware\foo", open it and return it.
|
||||||
* On error, return NULL. */
|
* On error, return NULL. */
|
||||||
static HKEY OpenRegKey( const RString &sKey )
|
static HKEY OpenRegKey( const RString &sKey, bool bWarnOnError = true )
|
||||||
{
|
{
|
||||||
RString sSubkey;
|
RString sSubkey;
|
||||||
HKEY hType;
|
HKEY hType;
|
||||||
@@ -47,7 +47,8 @@ static HKEY OpenRegKey( const RString &sKey )
|
|||||||
LONG retval = RegOpenKeyEx( hType, sSubkey, 0, KEY_READ, &hRetKey );
|
LONG retval = RegOpenKeyEx( hType, sSubkey, 0, KEY_READ, &hRetKey );
|
||||||
if ( retval != ERROR_SUCCESS )
|
if ( retval != ERROR_SUCCESS )
|
||||||
{
|
{
|
||||||
LOG->Warn( werr_ssprintf(retval, "RegOpenKeyEx(%x,%s) error", hType, sSubkey.c_str()) );
|
if( bWarnOnError )
|
||||||
|
LOG->Warn( werr_ssprintf(retval, "RegOpenKeyEx(%x,%s) error", hType, sSubkey.c_str()) );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,9 +81,9 @@ bool RegistryAccess::GetRegValue( const RString &sKey, const RString &sName, RSt
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RegistryAccess::GetRegValue( const RString &sKey, const RString &sName, int &iVal )
|
bool RegistryAccess::GetRegValue( const RString &sKey, const RString &sName, int &iVal, bool bWarnOnError )
|
||||||
{
|
{
|
||||||
HKEY hKey = OpenRegKey( sKey );
|
HKEY hKey = OpenRegKey( sKey, bWarnOnError );
|
||||||
if( hKey == NULL )
|
if( hKey == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
namespace RegistryAccess
|
namespace RegistryAccess
|
||||||
{
|
{
|
||||||
bool GetRegValue( const RString &sKey, const RString &sName, RString &val );
|
bool GetRegValue( const RString &sKey, const RString &sName, RString &val );
|
||||||
bool GetRegValue( const RString &sKey, const RString &sName, int &val );
|
bool GetRegValue( const RString &sKey, const RString &sName, int &val, bool bWarnOnError = true );
|
||||||
bool GetRegValue( const RString &sKey, const RString &sName, bool &val );
|
bool GetRegValue( const RString &sKey, const RString &sName, bool &val );
|
||||||
|
|
||||||
bool GetRegSubKeys( const RString &sKey, vector<RString> &asList, const RString &sRegex = ".*", bool bReturnPathToo = true );
|
bool GetRegSubKeys( const RString &sKey, vector<RString> &asList, const RString &sRegex = ".*", bool bReturnPathToo = true );
|
||||||
|
|||||||
Reference in New Issue
Block a user