mirror of https://github.com/stella-emu/stella.git
re-enabled mouse and Stelladaptor input for Driving Controller (fixes #951)
This commit is contained in:
parent
dd5b16f997
commit
9d46bb614f
|
@ -114,6 +114,7 @@ void Driving::updateControllerAxes()
|
||||||
{
|
{
|
||||||
// Digital events (from keyboard or joystick hats & buttons)
|
// Digital events (from keyboard or joystick hats & buttons)
|
||||||
const int d_axis = myEvent.get(myXAxisValue);
|
const int d_axis = myEvent.get(myXAxisValue);
|
||||||
|
uInt32 oldCounterHires = myCounterHires;
|
||||||
|
|
||||||
if(myEvent.get(myCCWEvent) != 0 && myLastCCWEvent == 0)
|
if(myEvent.get(myCCWEvent) != 0 && myLastCCWEvent == 0)
|
||||||
myCounterHires = ((myGrayIndex + 4) * 256.0F) / SENSITIVITY - 1; // set to end of previous counter interval
|
myCounterHires = ((myGrayIndex + 4) * 256.0F) / SENSITIVITY - 1; // set to end of previous counter interval
|
||||||
|
@ -136,16 +137,17 @@ void Driving::updateControllerAxes()
|
||||||
range as digital inputs.
|
range as digital inputs.
|
||||||
*/
|
*/
|
||||||
myCounterHires += (a_axis/512) + (a_axis >= 0);
|
myCounterHires += (a_axis/512) + (a_axis >= 0);
|
||||||
cerr << "! ";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only consider the lower-most bits (corresponding to pins 1 & 2)
|
if(oldCounterHires != myCounterHires)
|
||||||
myGrayIndex = static_cast<Int32>((myCounterHires / 256.0F) * SENSITIVITY) & 0b11;
|
// Only consider the lower-most bits (corresponding to pins 1 & 2)
|
||||||
|
myGrayIndex = static_cast<Int32>((myCounterHires / 256.0F) * SENSITIVITY) & 0b11;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Driving::updateMouseAxes()
|
void Driving::updateMouseAxes()
|
||||||
{
|
{
|
||||||
|
Int32 oldCounter = myCounter;
|
||||||
static constexpr int MJ_Threshold = 2;
|
static constexpr int MJ_Threshold = 2;
|
||||||
|
|
||||||
// Mouse motion and button events
|
// Mouse motion and button events
|
||||||
|
@ -178,6 +180,8 @@ void Driving::updateMouseAxes()
|
||||||
++myCounter;
|
++myCounter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(myCounter != oldCounter)
|
||||||
|
myGrayIndex = (myCounter >> 2) & 0b11;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -206,6 +210,7 @@ void Driving::updateStelladaptorAxes()
|
||||||
// simulated gray codes generated by PC keyboard or PC joystick
|
// simulated gray codes generated by PC keyboard or PC joystick
|
||||||
// Must be rounded into the middle of the myCounter interval!
|
// Must be rounded into the middle of the myCounter interval!
|
||||||
myCounter = (myGrayIndex + 0.5F) * 4.0F / SENSITIVITY;
|
myCounter = (myGrayIndex + 0.5F) * 4.0F / SENSITIVITY;
|
||||||
|
myCounterHires = myCounter * 256.0F / 4.0F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue