Example #1
0
static bool ps3_input_set_sensor_state(void *data, unsigned port,
      enum retro_sensor_action action, unsigned event_rate)
{
   CellPadInfo2 pad_info;
   (void)event_rate;

   switch (action)
   {
      case RETRO_SENSOR_ACCELEROMETER_ENABLE:
         cellPadGetInfo2(&pad_info);
         if ((pad_info.device_capability[port] 
                  & CELL_PAD_CAPABILITY_SENSOR_MODE) 
               != CELL_PAD_CAPABILITY_SENSOR_MODE)
            return false;

         cellPadSetPortSetting(port, CELL_PAD_SETTING_SENSOR_ON);
         return true;
      case RETRO_SENSOR_ACCELEROMETER_DISABLE:
         cellPadSetPortSetting(port, 0);
         return true;

      default:
         return false;
   }
}
Example #2
0
//-----------------------------------------------------------------------------
// Purpose: Initialize libpad for controller input
//-----------------------------------------------------------------------------
bool CGameEnginePS3::BInitializeLibPad()
{
	int ret = cellPadInit( CELL_PAD_MAX_PORT_NUM );
	if ( ret != CELL_OK )
		return false;

	// We don't use pressure sensitivity or sixaxis
	for ( int i=0; i<CELL_PAD_MAX_PORT_NUM; ++i )
	{
		// May be we don't have all ports connected, but this setting will be set and persist anyway
		cellPadSetPortSetting( i, CELL_PAD_SETTING_PRESS_OFF | CELL_PAD_SETTING_SENSOR_OFF );
	}

	return true;
}