m_bThreadedMovieDecode ( "ThreadedMovieDecode", true ),
m_bScreenTestMode ( "ScreenTestMode", false ),
m_bDebugUSBInput ( "DebugUSBInput", false ),
+ m_bITGIOBitFlip ( "ITGIOBitFlip", false ),
m_bDebugLights ( "DebugLights", false ),
m_bMonkeyInput ( "MonkeyInput", false ),
m_sMachineName ( "MachineName", "" ),
Preference<bool> m_bThreadedMovieDecode;
Preference<bool> m_bScreenTestMode;
Preference<bool> m_bDebugUSBInput;
+ Preference<bool> m_bITGIOBitFlip;
Preference<bool> m_bDebugLights;
Preference<bool> m_bMonkeyInput;
Preference<CString> m_sMachineName;
IOBoard.Write( m_iWriteData );
IOBoard.Read( &m_iInputData );
+
+ if( PREFSMAN->m_bITGIOBitFlip )
+ m_iInputData = ~m_iInputData;
+
HandleInput();
// give up 0.01 sec for other events -
/* Thanks, ITG-IO documentation! <3 */
void InputHandler_Linux_Iow::HandleInput()
{
- uint32_t i = 1; // convenience hack
+ uint16_t i = 1; // convenience hack
if( PREFSMAN->m_bDebugUSBInput && (m_iInputData != 0) && (m_iInputData != m_iLastInput) )
{
- LOG->Info( "Input: %i", m_iInputData );
+ if( LOG )
+ LOG->Info( "Input: %i", m_iInputData );
CString sInputs;
- for( unsigned x = 0; x < 32; x++ )
+ for( unsigned x = 0; x < 16; x++ )
{
/* the bit we expect isn't in the data */
if( !(m_iInputData & (i << x)) )
FOREACH_ENUM( GameButton, 4, gb )
if( g_LightsState.m_bGameButtonLights[gc][gb] )
m_iWriteData |= iPadBits[gc][gb];
-
- CString sBits;
-
- for( int x = 0; x < 16; x++ )
- sBits += (m_iWriteData & (1 << (16-x))) ? "1" : "0";
-
- LOG->Trace( "%s", sBits.c_str() );
}
bool m_bFoundDevice;
bool m_bShutdown;
- uint32_t m_iInputData;
- uint32_t m_iLastInput;
+ uint16_t m_iInputData;
+ uint16_t m_iLastInput;
- uint32_t m_iWriteData;
- uint32_t m_iLastWrite;
+ uint16_t m_iWriteData;
+ uint16_t m_iLastWrite;
static int InputThread_Start( void *p );
return false;\r
}\r
\r
-bool ITGIO::Read( uint32_t *pData )\r
+bool ITGIO::Read( uint16_t *pData )\r
{\r
int iResult;\r
\r
while( 1 )\r
{\r
/* XXX: I hate magic values. What do these mean? -- Vyhd */\r
- iResult = usb_control_msg(m_pHandle, 161, 1, 256, 0, (char *)pData, 4, 1000);\r
- if( iResult == 4 ) // all data read\r
+ iResult = usb_control_msg(m_pHandle, 161, 1, 256, 0, (char *)pData, 2, 1000);\r
+ if( iResult == 2 ) // all data read\r
break;\r
\r
// all data not read\r
return true;\r
}\r
\r
-bool ITGIO::Write( uint32_t iData )\r
+bool ITGIO::Write( uint16_t iData )\r
{\r
int iResult;\r
\r
while( 1 )\r
{\r
- iResult = usb_control_msg(m_pHandle, 33, 9, 512, 0, (char *)&iData, 4, 1000 );\r
+ iResult = usb_control_msg(m_pHandle, 33, 9, 512, 0, (char *)&iData, 2, 1000 );\r
\r
- if( iResult == 4 ) // all data read\r
+ if( iResult == 2 ) // all data read\r
break;\r
\r
Reconnect();\r
// all in one place. It's not important right now, though. - Vyhd
// static bool DeviceMatches( int idVendor, int idProduct );
- bool Read( uint32_t *pData );
- bool Write( uint32_t iData );
+ bool Read( uint16_t *pData );
+ bool Write( uint16_t iData );
/* Globally accessible. */
static int m_iInputErrorCount;