set level, not down param
This commit is contained in:
@@ -31,7 +31,7 @@ void InputHandler_Carbon::QueueCallBack( void *target, int result, void *refcon,
|
||||
while( (result = CALL(queue, getNextEvent, &event, zeroTime, 0)) == kIOReturnSuccess )
|
||||
dev->GetButtonPresses( vPresses, int(event.elementCookie), int(event.value), now );
|
||||
FOREACH_CONST( DeviceInput, vPresses, i )
|
||||
This->ButtonPressed( *i, i->level > 0.5f );
|
||||
This->ButtonPressed( *i );
|
||||
}
|
||||
|
||||
static void RunLoopStarted( CFRunLoopObserverRef o, CFRunLoopActivity a, void *sem )
|
||||
|
||||
@@ -155,15 +155,16 @@ void InputHandler_Linux_Joystick::InputThread()
|
||||
// In 2.6.11 using an EMS USB2, the event number for P1 Tri (the first button)
|
||||
// is being reported as 32 instead of 0. Correct for this.
|
||||
wrap( iNum, 32 ); // max number of joystick buttons. Make this a constant?
|
||||
ButtonPressed( DeviceInput(id, enum_add2(JOY_BUTTON_1, iNum), 0, now), event.value );
|
||||
ButtonPressed( DeviceInput(id, enum_add2(JOY_BUTTON_1, iNum), event.value, now) );
|
||||
break;
|
||||
}
|
||||
|
||||
case JS_EVENT_AXIS: {
|
||||
DeviceButton neg = enum_add2(JOY_LEFT, 2*event.number);
|
||||
DeviceButton pos = enum_add2(JOY_RIGHT, 2*event.number);
|
||||
ButtonPressed(DeviceInput(id, neg, 0, now), event.value < -16000);
|
||||
ButtonPressed(DeviceInput(id, pos, 0, now), event.value > +16000);
|
||||
float l = SCALE( int(event.value), 0.0f, 32767, 0.0f, 1.0f );
|
||||
ButtonPressed(DeviceInput(id, neg, max(-l,0), now), event.value < -16000);
|
||||
ButtonPressed(DeviceInput(id, pos, max(+l,0), now), event.value > +16000);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ void InputHandler_Linux_tty::Update()
|
||||
const int butno = keys[key];
|
||||
const bool pressed = !(keybuf[i] & 0x80);
|
||||
|
||||
ButtonPressed(DeviceInput(DEVICE_KEYBOARD, butno), pressed);
|
||||
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, butno, pressed) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,12 +89,9 @@ static void CALLBACK midiCallback( HMIDIIN device, UINT status, DWORD instancePt
|
||||
|
||||
if( iType == 144 )
|
||||
{
|
||||
DeviceInput di = DeviceInput( DEVICE_MIDI, enum_add2(MIDI_FIRST, iChannel) );
|
||||
DeviceInput di = DeviceInput( DEVICE_MIDI, enum_add2(MIDI_FIRST, iChannel), iValue > 0 );
|
||||
di.ts.Touch();
|
||||
if( iValue > 0 )
|
||||
((InputHandler_Win32_MIDI *)instancePtr)->SetDev( di, true );
|
||||
else
|
||||
((InputHandler_Win32_MIDI *)instancePtr)->SetDev( di, false );
|
||||
((InputHandler_Win32_MIDI *)instancePtr)->SetDev( di );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
|
||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||
|
||||
void SetDev( DeviceInput key, bool pressed ) { ButtonPressed( key, pressed ); }
|
||||
void SetDev( DeviceInput key ) { ButtonPressed( key ); }
|
||||
|
||||
private:
|
||||
bool m_bFoundDevice;
|
||||
|
||||
@@ -20,7 +20,7 @@ InputHandler_Win32_Pump::InputHandler_Win32_Pump()
|
||||
bool bFoundOnePad = false;
|
||||
for( int i = 0; i < NUM_PUMPS; ++i )
|
||||
{
|
||||
if( m_pDevice[i].Open(pump_usb_vid, pump_usb_pid, sizeof(long), i, NULL) )
|
||||
if( m_pDevice[i].Open(pump_usb_vid, pump_usb_pid, sizeof(long), i) )
|
||||
{
|
||||
bFoundOnePad = true;
|
||||
LOG->Info( "Found Pump pad %i", i );
|
||||
@@ -60,13 +60,13 @@ void InputHandler_Win32_Pump::HandleInput( int iDevice, int iEvent )
|
||||
|
||||
for( int iButton = 0; iButton < ARRAYLEN(bits); ++iButton )
|
||||
{
|
||||
DeviceInput di( id, enum_add2(JOY_BUTTON_1, iButton) );
|
||||
DeviceInput di( id, enum_add2(JOY_BUTTON_1, iButton), !(iEvent & bits[iButton]) );
|
||||
|
||||
/* If we're in a thread, our timestamp is accurate. */
|
||||
if( InputThread.IsCreated() )
|
||||
di.ts.Touch();
|
||||
|
||||
ButtonPressed( di, !(iEvent & bits[iButton]) );
|
||||
ButtonPressed( di );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ void InputHandler_X11::Update()
|
||||
continue;
|
||||
}
|
||||
// This is a new event so the last release was not a repeat.
|
||||
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB), false );
|
||||
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB, 0) );
|
||||
lastEvent.type = 0;
|
||||
}
|
||||
// Why only the zero index?
|
||||
@@ -179,13 +179,13 @@ void InputHandler_X11::Update()
|
||||
if( lastDB == DeviceButton_Invalid )
|
||||
continue;
|
||||
if( bPress )
|
||||
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB), true );
|
||||
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB, 1) );
|
||||
else
|
||||
lastEvent = event;
|
||||
}
|
||||
// Handle any last releases.
|
||||
if( lastEvent.type != 0 )
|
||||
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB), false );
|
||||
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB, 0) );
|
||||
InputHandler::UpdateTimer();
|
||||
}
|
||||
|
||||
|
||||
@@ -109,8 +109,8 @@ void InputHandler_Xbox::Update()
|
||||
LOG->Warn("Ignored joystick event (button too high)");
|
||||
continue;
|
||||
}
|
||||
DeviceInput di(inputDevice, Button);
|
||||
ButtonPressed(di, nowPressed != 0);
|
||||
DeviceInput di(inputDevice, Button, nowPressed != 0);
|
||||
ButtonPressed(di);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -129,8 +129,8 @@ void InputHandler_Xbox::Update()
|
||||
LOG->Warn("Ignored joystick event (button too high)");
|
||||
continue;
|
||||
}
|
||||
DeviceInput di(inputDevice, Button);
|
||||
ButtonPressed(di, nowPressed);
|
||||
DeviceInput di(inputDevice, Button, nowPressed);
|
||||
ButtonPressed(di);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -149,8 +149,8 @@ void InputHandler_Xbox::Update()
|
||||
DeviceButton neg = (DeviceButton)(JOY_LEFT + (2 * j));
|
||||
DeviceButton pos = (DeviceButton)(JOY_RIGHT + (2 * j));
|
||||
float l = SCALE( axes[j], 0.0f, 32768.0f, 0.0f, 1.0f );
|
||||
ButtonPressed(DeviceInput(inputDevice, neg,max(-l,0),RageZeroTimer), axes[j] > -16000);
|
||||
ButtonPressed(DeviceInput(inputDevice, pos,max(+l,0),RageZeroTimer), axes[j] < +16000);
|
||||
ButtonPressed(DeviceInput(inputDevice, neg,max(-l,0),RageZeroTimer));
|
||||
ButtonPressed(DeviceInput(inputDevice, pos,max(+l,0),RageZeroTimer));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user