From 075c34e8cc96b55fa12a4148104ccb64b5f56acb Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 8 Oct 2003 20:40:41 +0000 Subject: [PATCH] Fix assertion failure when joysticks with more than one hat are attached --- .../InputHandler/InputHandler_DirectInput.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/stepmania/src/arch/InputHandler/InputHandler_DirectInput.cpp b/stepmania/src/arch/InputHandler/InputHandler_DirectInput.cpp index dded3e470c..d2789d49bf 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_DirectInput.cpp +++ b/stepmania/src/arch/InputHandler/InputHandler_DirectInput.cpp @@ -307,18 +307,17 @@ void InputHandler_DInput::UpdatePolled(DIDevice &device, const RageTimer &tm) } case in.HAT: - { - ASSERT( in.num == 0 ); // XXX - - const int pos = TranslatePOV(state.rgdwPOV[in.ofs - DIJOFS_POV(0)]); - ButtonPressed(DeviceInput(dev, JOY_HAT_UP, tm), !!(pos & SDL_HAT_UP)); - ButtonPressed(DeviceInput(dev, JOY_HAT_DOWN, tm), !!(pos & SDL_HAT_DOWN)); - ButtonPressed(DeviceInput(dev, JOY_HAT_LEFT, tm), !!(pos & SDL_HAT_LEFT)); - ButtonPressed(DeviceInput(dev, JOY_HAT_RIGHT, tm), !!(pos & SDL_HAT_RIGHT)); + if( in.num == 0 ) + { + const int pos = TranslatePOV(state.rgdwPOV[in.ofs - DIJOFS_POV(0)]); + ButtonPressed(DeviceInput(dev, JOY_HAT_UP, tm), !!(pos & SDL_HAT_UP)); + ButtonPressed(DeviceInput(dev, JOY_HAT_DOWN, tm), !!(pos & SDL_HAT_DOWN)); + ButtonPressed(DeviceInput(dev, JOY_HAT_LEFT, tm), !!(pos & SDL_HAT_LEFT)); + ButtonPressed(DeviceInput(dev, JOY_HAT_RIGHT, tm), !!(pos & SDL_HAT_RIGHT)); + } break; } - } } }