MCPcopy Create free account
hub / github.com/Svxy/The-Simpsons-Hit-and-Run / EnumerateControllers

Method EnumerateControllers

game/code/input/inputmanager.cpp:432–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430}
431
432void InputManager::EnumerateControllers( void )
433{
434 // on the console the controller device and all the mappables are
435 // preallocated. So we don't have to create new associations.
436 //
437#ifndef RAD_WIN32
438 ref< IRadController > xIC2;
439#else
440 ref< IRadController > radController[ NUM_CONTROLLERTYPES ];
441#endif
442
443 ReleaseAllControllers( );
444
445 bool somethingPluggedIn0 = false;
446 bool somethingPluggedIn1 = false;
447
448 unsigned int slot = 0;
449 unsigned int port = 0;
450 for ( port = 0; port < Input::MaxPorts; ++port )
451 {
452 for ( slot = 0; slot < Input::MaxSlots; ++slot )
453 {
454 unsigned int i = port * Input::MaxSlots + slot;
455
456 char szLocation[ 256 ];
457
458#if defined(RAD_XBOX) || defined( RAD_PS2 )
459 sprintf( szLocation, "Port%d\\Slot%d", port, slot );
460#elif defined(RAD_WIN32)
461 char szJoystickLoc[ 256 ];
462 char szMouseLoc[ 256 ];
463 char szWheelLoc[ 256 ];
464
465 sprintf( szLocation, "Keyboard%d", 0);
466 sprintf( szJoystickLoc, "Joystick%d", i);
467 sprintf( szMouseLoc, "Mouse%d", i);
468 sprintf( szWheelLoc, "SteeringWheel%d", i);
469#else //This is GC
470 sprintf( szLocation, "Channel%d", i );
471#endif
472
473#ifndef RAD_WIN32
474 xIC2 = mxIControllerSystem2->GetControllerAtLocation( szLocation );
475#else
476 radController[KEYBOARD] = mxIControllerSystem2->GetControllerAtLocation( szLocation );
477 radController[GAMEPAD] = mxIControllerSystem2->GetControllerAtLocation( szJoystickLoc );
478 radController[MOUSE] = mxIControllerSystem2->GetControllerAtLocation( szMouseLoc );
479 radController[STEERINGWHEEL] = mxIControllerSystem2->GetControllerAtLocation( szWheelLoc );
480
481 //Check to see if the steering wheel is on controller 0.
482
483#endif
484
485 //
486 // Grab the controller device associated with the foundation controller.
487 //
488 UserController* controller = &mControllerArray[ i ];
489

Callers

nothing calls this directly

Calls 7

IsConnectedMethod · 0.45
NotifyDisconnectMethod · 0.45
InitializeMethod · 0.45
NotifyConnectMethod · 0.45
GetTypeMethod · 0.45
SetRumbleMethod · 0.45

Tested by

no test coverage detected