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 )
|
while( (result = CALL(queue, getNextEvent, &event, zeroTime, 0)) == kIOReturnSuccess )
|
||||||
dev->GetButtonPresses( vPresses, int(event.elementCookie), int(event.value), now );
|
dev->GetButtonPresses( vPresses, int(event.elementCookie), int(event.value), now );
|
||||||
FOREACH_CONST( DeviceInput, vPresses, i )
|
FOREACH_CONST( DeviceInput, vPresses, i )
|
||||||
This->ButtonPressed( *i, i->level > 0.5f );
|
This->ButtonPressed( *i );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RunLoopStarted( CFRunLoopObserverRef o, CFRunLoopActivity a, void *sem )
|
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)
|
// 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.
|
// is being reported as 32 instead of 0. Correct for this.
|
||||||
wrap( iNum, 32 ); // max number of joystick buttons. Make this a constant?
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case JS_EVENT_AXIS: {
|
case JS_EVENT_AXIS: {
|
||||||
DeviceButton neg = enum_add2(JOY_LEFT, 2*event.number);
|
DeviceButton neg = enum_add2(JOY_LEFT, 2*event.number);
|
||||||
DeviceButton pos = enum_add2(JOY_RIGHT, 2*event.number);
|
DeviceButton pos = enum_add2(JOY_RIGHT, 2*event.number);
|
||||||
ButtonPressed(DeviceInput(id, neg, 0, now), event.value < -16000);
|
float l = SCALE( int(event.value), 0.0f, 32767, 0.0f, 1.0f );
|
||||||
ButtonPressed(DeviceInput(id, pos, 0, now), event.value > +16000);
|
ButtonPressed(DeviceInput(id, neg, max(-l,0), now), event.value < -16000);
|
||||||
|
ButtonPressed(DeviceInput(id, pos, max(+l,0), now), event.value > +16000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ void InputHandler_Linux_tty::Update()
|
|||||||
const int butno = keys[key];
|
const int butno = keys[key];
|
||||||
const bool pressed = !(keybuf[i] & 0x80);
|
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 )
|
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();
|
di.ts.Touch();
|
||||||
if( iValue > 0 )
|
((InputHandler_Win32_MIDI *)instancePtr)->SetDev( di );
|
||||||
((InputHandler_Win32_MIDI *)instancePtr)->SetDev( di, true );
|
|
||||||
else
|
|
||||||
((InputHandler_Win32_MIDI *)instancePtr)->SetDev( di, false );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public:
|
|||||||
|
|
||||||
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
|
||||||
|
|
||||||
void SetDev( DeviceInput key, bool pressed ) { ButtonPressed( key, pressed ); }
|
void SetDev( DeviceInput key ) { ButtonPressed( key ); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_bFoundDevice;
|
bool m_bFoundDevice;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ InputHandler_Win32_Pump::InputHandler_Win32_Pump()
|
|||||||
bool bFoundOnePad = false;
|
bool bFoundOnePad = false;
|
||||||
for( int i = 0; i < NUM_PUMPS; ++i )
|
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;
|
bFoundOnePad = true;
|
||||||
LOG->Info( "Found Pump pad %i", i );
|
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 )
|
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 we're in a thread, our timestamp is accurate. */
|
||||||
if( InputThread.IsCreated() )
|
if( InputThread.IsCreated() )
|
||||||
di.ts.Touch();
|
di.ts.Touch();
|
||||||
|
|
||||||
ButtonPressed( di, !(iEvent & bits[iButton]) );
|
ButtonPressed( di );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ void InputHandler_X11::Update()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// This is a new event so the last release was not a repeat.
|
// 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;
|
lastEvent.type = 0;
|
||||||
}
|
}
|
||||||
// Why only the zero index?
|
// Why only the zero index?
|
||||||
@@ -179,13 +179,13 @@ void InputHandler_X11::Update()
|
|||||||
if( lastDB == DeviceButton_Invalid )
|
if( lastDB == DeviceButton_Invalid )
|
||||||
continue;
|
continue;
|
||||||
if( bPress )
|
if( bPress )
|
||||||
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB), true );
|
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB, 1) );
|
||||||
else
|
else
|
||||||
lastEvent = event;
|
lastEvent = event;
|
||||||
}
|
}
|
||||||
// Handle any last releases.
|
// Handle any last releases.
|
||||||
if( lastEvent.type != 0 )
|
if( lastEvent.type != 0 )
|
||||||
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB), false );
|
ButtonPressed( DeviceInput(DEVICE_KEYBOARD, lastDB, 0) );
|
||||||
InputHandler::UpdateTimer();
|
InputHandler::UpdateTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ void InputHandler_Xbox::Update()
|
|||||||
LOG->Warn("Ignored joystick event (button too high)");
|
LOG->Warn("Ignored joystick event (button too high)");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DeviceInput di(inputDevice, Button);
|
DeviceInput di(inputDevice, Button, nowPressed != 0);
|
||||||
ButtonPressed(di, nowPressed != 0);
|
ButtonPressed(di);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,8 +129,8 @@ void InputHandler_Xbox::Update()
|
|||||||
LOG->Warn("Ignored joystick event (button too high)");
|
LOG->Warn("Ignored joystick event (button too high)");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DeviceInput di(inputDevice, Button);
|
DeviceInput di(inputDevice, Button, nowPressed);
|
||||||
ButtonPressed(di, nowPressed);
|
ButtonPressed(di);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,8 +149,8 @@ void InputHandler_Xbox::Update()
|
|||||||
DeviceButton neg = (DeviceButton)(JOY_LEFT + (2 * j));
|
DeviceButton neg = (DeviceButton)(JOY_LEFT + (2 * j));
|
||||||
DeviceButton pos = (DeviceButton)(JOY_RIGHT + (2 * j));
|
DeviceButton pos = (DeviceButton)(JOY_RIGHT + (2 * j));
|
||||||
float l = SCALE( axes[j], 0.0f, 32768.0f, 0.0f, 1.0f );
|
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, neg,max(-l,0),RageZeroTimer));
|
||||||
ButtonPressed(DeviceInput(inputDevice, pos,max(+l,0),RageZeroTimer), axes[j] < +16000);
|
ButtonPressed(DeviceInput(inputDevice, pos,max(+l,0),RageZeroTimer));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user