Added --wiimote-debug command line option to print raw values read
from a wiimote. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12773 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
879e0248aa
commit
6d097b6ad5
@ -425,7 +425,11 @@ namespace UserConfigParams
|
|||||||
// ---- Debug - not saved to config file
|
// ---- Debug - not saved to config file
|
||||||
/** If gamepad debugging is enabled. */
|
/** If gamepad debugging is enabled. */
|
||||||
PARAM_PREFIX bool m_gamepad_debug PARAM_DEFAULT( false );
|
PARAM_PREFIX bool m_gamepad_debug PARAM_DEFAULT( false );
|
||||||
|
|
||||||
|
/** Wiimote debugging. */
|
||||||
|
PARAM_PREFIX bool m_wiimote_debug PARAM_DEFAULT( false );
|
||||||
|
|
||||||
|
/** Debug gamepads by visualising their values. */
|
||||||
PARAM_PREFIX bool m_gamepad_visualisation PARAM_DEFAULT( false );
|
PARAM_PREFIX bool m_gamepad_visualisation PARAM_DEFAULT( false );
|
||||||
|
|
||||||
/** If material debugging (printing terrain specific slowdown)
|
/** If material debugging (printing terrain specific slowdown)
|
||||||
|
@ -162,18 +162,17 @@ void Wiimote::updateIrrEvent()
|
|||||||
|
|
||||||
// Simulate an Irrlicht joystick event
|
// Simulate an Irrlicht joystick event
|
||||||
resetIrrEvent(&m_irr_event, wiimoteIdToIrrId(m_wiimote_id));
|
resetIrrEvent(&m_irr_event, wiimoteIdToIrrId(m_wiimote_id));
|
||||||
|
#ifdef DEBUG
|
||||||
// --------------------- Wiimote accelerometers --------------------
|
if(UserConfigParams::m_wiimote_debug)
|
||||||
//printf("yaw: %f\n", m_wiimote_handle->orient.yaw);
|
{
|
||||||
//printf("pitch: %f\n", m_wiimote_handle->orient.pitch);
|
Log::verbose("wiimote", "pitch: %f yaw %f roll %f",
|
||||||
//printf("roll: %f\n", m_wiimote_handle->orient.roll);
|
m_wiimote_handle->orient.pitch,
|
||||||
|
m_wiimote_handle->orient.yaw,
|
||||||
// --- Linear response version ---
|
m_wiimote_handle->orient.roll);
|
||||||
//const float wiimote_to_joystick = -JOYSTICK_ABS_MAX_ANGLE / float(UserConfigParams::m_wiimote_max);
|
}
|
||||||
//const float angle = wiimote_to_joystick * m_wiimote_handle->orient.pitch;
|
#endif
|
||||||
|
|
||||||
// --- Quadratic response version ---
|
float normalized_angle = -m_wiimote_handle->orient.pitch / UserConfigParams::m_wiimote_max;
|
||||||
float normalized_angle = -m_wiimote_handle->orient.pitch / UserConfigParams::m_wiimote_max;
|
|
||||||
if(normalized_angle<-1.0f)
|
if(normalized_angle<-1.0f)
|
||||||
normalized_angle = -1.0f;
|
normalized_angle = -1.0f;
|
||||||
else if(normalized_angle>1.0f)
|
else if(normalized_angle>1.0f)
|
||||||
@ -202,10 +201,13 @@ void Wiimote::updateIrrEvent()
|
|||||||
{
|
{
|
||||||
if(IS_PRESSED(m_wiimote_handle, wiimote_actions[i].wiimote_action_id))
|
if(IS_PRESSED(m_wiimote_handle, wiimote_actions[i].wiimote_action_id))
|
||||||
{
|
{
|
||||||
//printf("wiimote %d: pressed button %s -> button id: %d\n",
|
#ifdef DEBUG
|
||||||
// m_wiimote_id,
|
if(UserConfigParams::m_wiimote_debug)
|
||||||
// wiimote_actions[i].wiimote_action_name,
|
Log::verbose("wiimote", "%d: pressed button %s -> button id: %d\n",
|
||||||
// wiimote_actions[i].button_id);
|
m_wiimote_id,
|
||||||
|
wiimote_actions[i].wiimote_action_name,
|
||||||
|
wiimote_actions[i].button_id);
|
||||||
|
#endif
|
||||||
m_irr_event.JoystickEvent.ButtonStates |= (1<<(wiimote_actions[i].button_id));
|
m_irr_event.JoystickEvent.ButtonStates |= (1<<(wiimote_actions[i].button_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,9 +268,10 @@ WiimoteManager::~WiimoteManager()
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Launch wiimote detection and add the corresponding gamepad devices to the device manager
|
* Launch wiimote detection and add the corresponding gamepad devices to the
|
||||||
* TODO: this should be done in a separate thread, to not block the UI...
|
* device manager.
|
||||||
*/
|
* TODO: this should be done in a separate thread, to not block the UI...
|
||||||
|
*/
|
||||||
void WiimoteManager::launchDetection(int timeout)
|
void WiimoteManager::launchDetection(int timeout)
|
||||||
{
|
{
|
||||||
// Stop WiiUse, remove wiimotes, gamepads, gamepad configs.
|
// Stop WiiUse, remove wiimotes, gamepads, gamepad configs.
|
||||||
|
@ -622,6 +622,10 @@ int handleCmdLine(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
UserConfigParams::m_gamepad_debug=true;
|
UserConfigParams::m_gamepad_debug=true;
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(argv[i], "--wiimote-debug"))
|
||||||
|
{
|
||||||
|
UserConfigParams::m_wiimote_debug = true;
|
||||||
|
}
|
||||||
else if (!strcmp(argv[i], "--tutorial-debug"))
|
else if (!strcmp(argv[i], "--tutorial-debug"))
|
||||||
{
|
{
|
||||||
UserConfigParams::m_tutorial_debug = true;
|
UserConfigParams::m_tutorial_debug = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user