diff --git a/src/InputFilter.cpp b/src/InputFilter.cpp index 83f9caf0b0..2e98820b3f 100644 --- a/src/InputFilter.cpp +++ b/src/InputFilter.cpp @@ -397,6 +397,11 @@ void InputFilter::GetPressedButtons( vector &array ) const array = g_CurrentState; } +void InputFilter::UpdateCursorLocation() +{ + // todo +} + /* * (c) 2001-2004 Chris Danford * All rights reserved. diff --git a/src/InputFilter.h b/src/InputFilter.h index b71a3b0e46..7f6c010a2e 100644 --- a/src/InputFilter.h +++ b/src/InputFilter.h @@ -7,15 +7,15 @@ enum InputEventType { - /* The device was just pressed. */ + // The device was just pressed. IET_FIRST_PRESS, - /* The device is auto-repeating. This event is guaranteed to be sent only between - * IET_FIRST_PRESS and IET_RELEASE pairs. */ + /* The device is auto-repeating. This event is guaranteed to be sent only + * between IET_FIRST_PRESS and IET_RELEASE pairs. */ IET_REPEAT, - /* The device is no longer pressed. Exactly one IET_RELEASE event will be sent - * for each IET_FIRST_PRESS. */ + /* The device is no longer pressed. Exactly one IET_RELEASE event will be + * sent for each IET_FIRST_PRESS. */ IET_RELEASE, NUM_InputEventType, @@ -29,7 +29,7 @@ struct InputEvent DeviceInput di; InputEventType type; - /* A list of all buttons that were pressed at the time of this event: */ + // A list of all buttons that were pressed at the time of this event: DeviceInputList m_ButtonState; }; @@ -62,6 +62,9 @@ public: void GetInputEvents( vector &aEventOut ); void GetPressedButtons( vector &array ) const; + // cursor + void UpdateCursorLocation(); + private: void CheckButtonChange( ButtonState &bs, DeviceInput di, const RageTimer &now ); void ReportButtonChange( const DeviceInput &di, InputEventType t ); @@ -71,10 +74,8 @@ private: RageMutex *queuemutex; }; - extern InputFilter* INPUTFILTER; // global and accessable from anywhere in our program - #endif /* diff --git a/src/InputMapper.cpp b/src/InputMapper.cpp index e0eb9c88b7..3e495b9efc 100644 --- a/src/InputMapper.cpp +++ b/src/InputMapper.cpp @@ -34,7 +34,6 @@ InputMapper::InputMapper() m_pInputScheme = NULL; } - InputMapper::~InputMapper() { SaveMappingsToDisk(); diff --git a/src/InputMapper.h b/src/InputMapper.h index 992b89b7a0..3397f49b44 100644 --- a/src/InputMapper.h +++ b/src/InputMapper.h @@ -100,9 +100,9 @@ struct AutoMappings #undef PUSH } - /* Strings used by automatic joystick mappings. */ - RString m_sGame; // only used - RString m_sDriverRegex; // reported by InputHandler + // Strings used by automatic joystick mappings. + RString m_sGame; // only used + RString m_sDriverRegex; // reported by InputHandler RString m_sControllerName; // the product name of the controller vector m_vMaps; @@ -118,7 +118,7 @@ public: const char *m_szName; // The name used by the button graphics system. e.g. "left", "right", "middle C", "snare" GameButton m_SecondaryMenuButton; }; - /* Data for each Game-specific GameButton. This starts at GAME_BUTTON_NEXT. */ + // Data for each Game-specific GameButton. This starts at GAME_BUTTON_NEXT. GameButtonInfo m_GameButtonInfo[NUM_GameButton]; const AutoMappings *m_pAutoMappings; @@ -211,10 +211,8 @@ protected: const InputScheme *m_pInputScheme; }; - extern InputMapper* INPUTMAPPER; // global and accessable from anywhere in our program - #endif /* diff --git a/src/arch/InputHandler/InputHandler.h b/src/arch/InputHandler/InputHandler.h index 42c8803bc1..4282ffddd1 100644 --- a/src/arch/InputHandler/InputHandler.h +++ b/src/arch/InputHandler/InputHandler.h @@ -1,25 +1,21 @@ #ifndef INPUT_HANDLER_H #define INPUT_HANDLER_H -/* - * This is a simple class to handle special input devices. Update() - * will be called during the input update; the derived class should - * send appropriate events to InputHandler. - * - * Note that, if the underlying device is capable of it, you're free to - * start a blocking thread; just store inputs in your class and send them - * off in a batch on the next Update. This gets much more accurate timestamps; - * we get events more quickly and timestamp them, instead of having a rough - * timing granularity due to the framerate. - * - * Send input events for a specific type of device. Only one driver - * for a given set of InputDevice types should be loaded for a given - * arch. For example, any number of drivers may produce DEVICE_PUMPn - * events, but only one may be loaded at a time. (This will be inconvenient - * if, for example, we have two completely distinct methods of getting - * input for the same device; we have no method to allocate device numbers. - * We don't need this now; I'll write it if it becomes needed.) - */ +/* This is a simple class to handle special input devices. Update() will be + * called during the input update; the derived class should send appropriate + * events to InputHandler. + * Note that, if the underlying device is capable of it, you're free to start + * a blocking thread; just store inputs in your class and send them off in a + * batch on the next Update. This gets much more accurate timestamps; we get + * events more quickly and timestamp them, instead of having a rough timing + * granularity due to the framerate. + * Send input events for a specific type of device. Only one driver for a given + * set of InputDevice types should be loaded for a given arch. For example, + * any number of drivers may produce DEVICE_PUMPn events, but only one may be + * loaded at a time. (This will be inconvenient if, for example, we have two + * completely distinct methods of getting input for the same device; we have no + * method to allocate device numbers. We don't need this now; I'll write it + * if it becomes needed.) */ #include "RageInputDevice.h" // for InputDevice #include "arch/RageDriver.h" diff --git a/src/arch/InputHandler/InputHandler_DirectInput.cpp b/src/arch/InputHandler/InputHandler_DirectInput.cpp index 125c4723b5..4991b52adb 100644 --- a/src/arch/InputHandler/InputHandler_DirectInput.cpp +++ b/src/arch/InputHandler/InputHandler_DirectInput.cpp @@ -425,7 +425,8 @@ void InputHandler_DInput::UpdatePolled( DIDevice &device, const RageTimer &tm ) if( neg != DeviceButton_Invalid ) { - float l = SCALE( int(val), 0.0f, 100.0f, 0.0f, 1.0f ); + //float l = SCALE( int(val), 0.0f, 100.0f, 0.0f, 1.0f ); + float l = val; ButtonPressed( DeviceInput(dev, neg, max(-l,0), tm) ); ButtonPressed( DeviceInput(dev, pos, max(+l,0), tm) ); } @@ -509,11 +510,14 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm { case DIMOFS_X: LOG->Trace("mouse X axis changed (buffered)"); + // todo: update cursor position -aj up = MOUSE_X_LEFT; down = MOUSE_X_RIGHT; break; case DIMOFS_Y: LOG->Trace("mouse Y axis changed (buffered)"); + // todo: update cursor position -aj up = MOUSE_Y_UP; down = MOUSE_Y_DOWN; + //INPUTFILTER->UpdateCursorLocation(0, evtbuf[i].dwData); break; case DIMOFS_Z: LOG->Trace("mouse Z axis changed (buffered)"); @@ -524,6 +528,9 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm device.m_sName.c_str(), in.ofs ); continue; } + float l = SCALE( int(evtbuf[i].dwData), 0.0f, 100.0f, 0.0f, 1.0f ); + ButtonPressed( DeviceInput(dev, up, max(-l,0), tm) ); + ButtonPressed( DeviceInput(dev, down, max(+l,0), tm) ); } else { @@ -532,7 +539,7 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm // joystick case DIJOFS_X: up = JOY_LEFT; down = JOY_RIGHT; break; case DIJOFS_Y: up = JOY_UP; down = JOY_DOWN; break; - case DIJOFS_Z: up = JOY_Z_UP; down = JOY_Z_DOWN; break; + case DIJOFS_Z: up = JOY_Z_UP; down = JOY_Z_DOWN; break; case DIJOFS_RX: up = JOY_ROT_UP; down = JOY_ROT_DOWN; break; case DIJOFS_RY: up = JOY_ROT_LEFT; down = JOY_ROT_RIGHT; break; case DIJOFS_RZ: up = JOY_ROT_Z_UP; down = JOY_ROT_Z_DOWN; break; @@ -543,11 +550,10 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm device.m_sName.c_str(), in.ofs ); continue; } + float l = SCALE( int(evtbuf[i].dwData), 0.0f, 100.0f, 0.0f, 1.0f ); + ButtonPressed( DeviceInput(dev, up, max(-l,0), tm) ); + ButtonPressed( DeviceInput(dev, down, max(+l,0), tm) ); } - - float l = SCALE( int(evtbuf[i].dwData), 0.0f, 100.0f, 0.0f, 1.0f ); - ButtonPressed( DeviceInput(dev, up, max(-l,0), tm) ); - ButtonPressed( DeviceInput(dev, down, max(+l,0), tm) ); break; } case in.HAT: diff --git a/src/archutils/Win32/DirectXHelpers.cpp b/src/archutils/Win32/DirectXHelpers.cpp index 3af1927673..aaf4767906 100644 --- a/src/archutils/Win32/DirectXHelpers.cpp +++ b/src/archutils/Win32/DirectXHelpers.cpp @@ -22,7 +22,7 @@ RString hr_ssprintf( int hr, const char *fmt, ... ) #ifdef _XBOX char szError[1024] = ""; D3DXGetErrorString( hr, szError, sizeof(szError) ); -#else +#else const char *szError = DXGetErrorString8( hr ); #endif