mirror of https://github.com/stella-emu/stella.git
Controller/Genesis/Booster cleanup.
- Made BoosterGrip set defaults for analog pins, just like Genesis - Removed superfluous call to update an unchangeable pin in Genesis - Renamed Controller resistance constants to indicate that they are actually constants
This commit is contained in:
parent
60519dbc6a
commit
963905759e
15
Changes.txt
15
Changes.txt
|
@ -12,7 +12,7 @@
|
|||
Release History
|
||||
===========================================================================
|
||||
|
||||
5.1.2 to 5.2: (MMM d, 2018)
|
||||
5.1.3 to 5.2: (MMM d, 2018)
|
||||
|
||||
* Extra functionality for Time Machine dialog (start/stop recording;
|
||||
minor fixes; TODO button and initial key repeats...)
|
||||
|
@ -21,14 +21,23 @@
|
|||
|
||||
* UI modernization (new widget look, dialog titles added, dialogs refactored)
|
||||
|
||||
* Fixed bug in autodetecting Genesis controllers.
|
||||
|
||||
* The Linux builds now use the system-installed PNG and ZLIB libraries
|
||||
by default.
|
||||
|
||||
* Fixed configure/build scripts to work natively under OpenBSD.
|
||||
|
||||
-Have fun!
|
||||
|
||||
|
||||
5.1.2 to 5.1.3: (June 10, 2018)
|
||||
|
||||
* Fixed crash in OpenBSD when quitting the app, which can also be
|
||||
happening on other systems (no reports yet, but the problem is now
|
||||
fixed for good).
|
||||
|
||||
* Fixed configure/build scripts to work natively under OpenBSD.
|
||||
|
||||
|
||||
5.1.1 to 5.1.2: (May 20, 2018)
|
||||
|
||||
* Fixed bug with SaveKey autodetection; some ROMs were not correctly
|
||||
|
|
|
@ -85,9 +85,9 @@ void BoosterWidget::loadConfig()
|
|||
myPins[kJFire]->setState(!myController.read(ourPinNo[kJFire]));
|
||||
|
||||
myPins[kJBooster]->setState(
|
||||
myController.read(Controller::Five) == Controller::minimumResistance);
|
||||
myController.read(Controller::Five) == Controller::MIN_RESISTANCE);
|
||||
myPins[kJTrigger]->setState(
|
||||
myController.read(Controller::Nine) == Controller::minimumResistance);
|
||||
myController.read(Controller::Nine) == Controller::MIN_RESISTANCE);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -107,13 +107,13 @@ void BoosterWidget::handleCommand(
|
|||
break;
|
||||
case kJBooster:
|
||||
myController.set(Controller::Five,
|
||||
myPins[id]->getState() ? Controller::minimumResistance :
|
||||
Controller::maximumResistance);
|
||||
myPins[id]->getState() ? Controller::MIN_RESISTANCE :
|
||||
Controller::MAX_RESISTANCE);
|
||||
break;
|
||||
case kJTrigger:
|
||||
myController.set(Controller::Nine,
|
||||
myPins[id]->getState() ? Controller::minimumResistance :
|
||||
Controller::maximumResistance);
|
||||
myPins[id]->getState() ? Controller::MIN_RESISTANCE :
|
||||
Controller::MAX_RESISTANCE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ void GenesisWidget::loadConfig()
|
|||
myPins[kJBbtn]->setState(!myController.read(ourPinNo[kJBbtn]));
|
||||
|
||||
myPins[kJCbtn]->setState(
|
||||
myController.read(Controller::Five) == Controller::maximumResistance);
|
||||
myController.read(Controller::Five) == Controller::MAX_RESISTANCE);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -99,8 +99,8 @@ void GenesisWidget::handleCommand(
|
|||
break;
|
||||
case kJCbtn:
|
||||
myController.set(Controller::Five,
|
||||
myPins[id]->getState() ? Controller::maximumResistance :
|
||||
Controller::minimumResistance);
|
||||
myPins[id]->getState() ? Controller::MAX_RESISTANCE :
|
||||
Controller::MIN_RESISTANCE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,9 @@ BoosterGrip::BoosterGrip(Jack jack, const Event& event, const System& system)
|
|||
myXAxisValue = Event::SARightAxis0Value;
|
||||
myYAxisValue = Event::SARightAxis1Value;
|
||||
}
|
||||
updateAnalogPin(Five, maximumResistance);
|
||||
|
||||
updateAnalogPin(Five, MAX_RESISTANCE);
|
||||
updateAnalogPin(Nine, MAX_RESISTANCE);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -64,11 +66,11 @@ void BoosterGrip::update()
|
|||
// connected to the inputs usually used by paddles.
|
||||
updateAnalogPin(
|
||||
Five,
|
||||
(myEvent.get(myTriggerEvent) != 0) ? minimumResistance : maximumResistance
|
||||
(myEvent.get(myTriggerEvent) != 0) ? MIN_RESISTANCE : MAX_RESISTANCE
|
||||
);
|
||||
updateAnalogPin(
|
||||
Nine,
|
||||
(myEvent.get(myBoosterEvent) != 0) ? minimumResistance : maximumResistance
|
||||
(myEvent.get(myBoosterEvent) != 0) ? MIN_RESISTANCE : MAX_RESISTANCE
|
||||
);
|
||||
|
||||
// Axis events (usually generated by the Stelladaptor)
|
||||
|
@ -122,7 +124,7 @@ void BoosterGrip::update()
|
|||
if(myEvent.get(Event::MouseButtonLeftValue))
|
||||
myDigitalPinState[Six] = false;
|
||||
if(myEvent.get(Event::MouseButtonRightValue))
|
||||
updateAnalogPin(Nine, minimumResistance);
|
||||
updateAnalogPin(Nine, MIN_RESISTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,10 +32,10 @@ CompuMate::CompuMate(const Console& console, const Event& event,
|
|||
myLeftController = make_unique<CMControl>(*this, Controller::Left, event, system);
|
||||
myRightController = make_unique<CMControl>(*this, Controller::Right, event, system);
|
||||
|
||||
myLeftController->updateAnalogPin(Controller::Nine, Controller::maximumResistance);
|
||||
myLeftController->updateAnalogPin(Controller::Five, Controller::minimumResistance);
|
||||
myRightController->updateAnalogPin(Controller::Nine, Controller::minimumResistance);
|
||||
myRightController->updateAnalogPin(Controller::Five, Controller::maximumResistance);
|
||||
myLeftController->updateAnalogPin(Controller::Nine, Controller::MAX_RESISTANCE);
|
||||
myLeftController->updateAnalogPin(Controller::Five, Controller::MIN_RESISTANCE);
|
||||
myRightController->updateAnalogPin(Controller::Nine, Controller::MIN_RESISTANCE);
|
||||
myRightController->updateAnalogPin(Controller::Five, Controller::MAX_RESISTANCE);
|
||||
|
||||
enableKeyHandling(false);
|
||||
}
|
||||
|
@ -61,17 +61,17 @@ void CompuMate::update()
|
|||
Controller& lp = myConsole.leftController();
|
||||
Controller& rp = myConsole.rightController();
|
||||
|
||||
lp.myAnalogPinValue[Controller::Nine] = Controller::maximumResistance;
|
||||
lp.myAnalogPinValue[Controller::Five] = Controller::minimumResistance;
|
||||
lp.myAnalogPinValue[Controller::Nine] = Controller::MAX_RESISTANCE;
|
||||
lp.myAnalogPinValue[Controller::Five] = Controller::MIN_RESISTANCE;
|
||||
lp.myDigitalPinState[Controller::Six] = true;
|
||||
rp.myAnalogPinValue[Controller::Nine] = Controller::minimumResistance;
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::maximumResistance;
|
||||
rp.myAnalogPinValue[Controller::Nine] = Controller::MIN_RESISTANCE;
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::MAX_RESISTANCE;
|
||||
rp.myDigitalPinState[Controller::Six] = true;
|
||||
|
||||
if (myKeyTable[KBDK_LSHIFT] || myKeyTable[KBDK_RSHIFT])
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::minimumResistance;
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::MIN_RESISTANCE;
|
||||
if (myKeyTable[KBDK_LCTRL] || myKeyTable[KBDK_RCTRL])
|
||||
lp.myAnalogPinValue[Controller::Nine] = Controller::minimumResistance;
|
||||
lp.myAnalogPinValue[Controller::Nine] = Controller::MIN_RESISTANCE;
|
||||
|
||||
rp.myDigitalPinState[Controller::Three] = true;
|
||||
rp.myDigitalPinState[Controller::Four] = true;
|
||||
|
@ -89,7 +89,7 @@ void CompuMate::update()
|
|||
// Emulate the '?' character (Shift-6) with the actual question key
|
||||
if (myKeyTable[KBDK_SLASH] && (myKeyTable[KBDK_LSHIFT] || myKeyTable[KBDK_RSHIFT]))
|
||||
{
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::minimumResistance;
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::MIN_RESISTANCE;
|
||||
lp.myDigitalPinState[Controller::Six] = false;
|
||||
}
|
||||
if (myKeyTable[KBDK_Y]) rp.myDigitalPinState[Controller::Three] = false;
|
||||
|
@ -101,7 +101,7 @@ void CompuMate::update()
|
|||
// Emulate the '[' character (Shift-8) with the actual key
|
||||
if (myKeyTable[KBDK_LEFTBRACKET] && !(myKeyTable[KBDK_LSHIFT] || myKeyTable[KBDK_RSHIFT]))
|
||||
{
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::minimumResistance;
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::MIN_RESISTANCE;
|
||||
lp.myDigitalPinState[Controller::Six] = false;
|
||||
}
|
||||
if (myKeyTable[KBDK_I]) rp.myDigitalPinState[Controller::Three] = false;
|
||||
|
@ -113,7 +113,7 @@ void CompuMate::update()
|
|||
// Emulate the '-' character (Shift-2) with the actual minus key
|
||||
if (myKeyTable[KBDK_MINUS] && !(myKeyTable[KBDK_LSHIFT] || myKeyTable[KBDK_RSHIFT]))
|
||||
{
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::minimumResistance;
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::MIN_RESISTANCE;
|
||||
lp.myDigitalPinState[Controller::Six] = false;
|
||||
}
|
||||
if (myKeyTable[KBDK_W]) rp.myDigitalPinState[Controller::Three] = false;
|
||||
|
@ -131,7 +131,7 @@ void CompuMate::update()
|
|||
// Emulate the quote character (Shift-0) with the actual quote key
|
||||
if (myKeyTable[KBDK_APOSTROPHE] && (myKeyTable[KBDK_LSHIFT] || myKeyTable[KBDK_RSHIFT]))
|
||||
{
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::minimumResistance;
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::MIN_RESISTANCE;
|
||||
lp.myDigitalPinState[Controller::Six] = false;
|
||||
}
|
||||
if (myKeyTable[KBDK_P]) rp.myDigitalPinState[Controller::Three] = false;
|
||||
|
@ -141,7 +141,7 @@ void CompuMate::update()
|
|||
// Emulate Ctrl-space (aka backspace) with the actual Backspace key
|
||||
if (myKeyTable[KBDK_BACKSPACE])
|
||||
{
|
||||
lp.myAnalogPinValue[Controller::Nine] = Controller::minimumResistance;
|
||||
lp.myAnalogPinValue[Controller::Nine] = Controller::MIN_RESISTANCE;
|
||||
rp.myDigitalPinState[Controller::Four] = false;
|
||||
}
|
||||
break;
|
||||
|
@ -150,7 +150,7 @@ void CompuMate::update()
|
|||
// Emulate the ']' character (Shift-9) with the actual key
|
||||
if (myKeyTable[KBDK_RIGHTBRACKET] && !(myKeyTable[KBDK_LSHIFT] || myKeyTable[KBDK_RSHIFT]))
|
||||
{
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::minimumResistance;
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::MIN_RESISTANCE;
|
||||
lp.myDigitalPinState[Controller::Six] = false;
|
||||
}
|
||||
if (myKeyTable[KBDK_O]) rp.myDigitalPinState[Controller::Three] = false;
|
||||
|
@ -162,7 +162,7 @@ void CompuMate::update()
|
|||
// Emulate the '=' character (Shift-5) with the actual equals key
|
||||
if (myKeyTable[KBDK_EQUALS] && !(myKeyTable[KBDK_LSHIFT] || myKeyTable[KBDK_RSHIFT]))
|
||||
{
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::minimumResistance;
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::MIN_RESISTANCE;
|
||||
lp.myDigitalPinState[Controller::Six] = false;
|
||||
}
|
||||
if (myKeyTable[KBDK_T]) rp.myDigitalPinState[Controller::Three] = false;
|
||||
|
@ -174,7 +174,7 @@ void CompuMate::update()
|
|||
// Emulate the '+' character (Shift-1) with the actual plus key (Shift-=)
|
||||
if (myKeyTable[KBDK_EQUALS] && (myKeyTable[KBDK_LSHIFT] || myKeyTable[KBDK_RSHIFT]))
|
||||
{
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::minimumResistance;
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::MIN_RESISTANCE;
|
||||
lp.myDigitalPinState[Controller::Six] = false;
|
||||
}
|
||||
if (myKeyTable[KBDK_Q]) rp.myDigitalPinState[Controller::Three] = false;
|
||||
|
@ -186,7 +186,7 @@ void CompuMate::update()
|
|||
// Emulate the '/' character (Shift-4) with the actual slash key
|
||||
if (myKeyTable[KBDK_SLASH] && !(myKeyTable[KBDK_LSHIFT] || myKeyTable[KBDK_RSHIFT]))
|
||||
{
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::minimumResistance;
|
||||
rp.myAnalogPinValue[Controller::Five] = Controller::MIN_RESISTANCE;
|
||||
lp.myDigitalPinState[Controller::Six] = false;
|
||||
}
|
||||
if (myKeyTable[KBDK_R]) rp.myDigitalPinState[Controller::Three] = false;
|
||||
|
|
|
@ -36,7 +36,7 @@ Controller::Controller(Jack jack, const Event& event, const System& system,
|
|||
myDigitalPinState[Six] = true;
|
||||
|
||||
myAnalogPinValue[Five] =
|
||||
myAnalogPinValue[Nine] = maximumResistance;
|
||||
myAnalogPinValue[Nine] = MAX_RESISTANCE;
|
||||
|
||||
switch(myType)
|
||||
{
|
||||
|
|
|
@ -262,10 +262,10 @@ class Controller : public Serializable
|
|||
|
||||
public:
|
||||
/// Constant which represents maximum resistance for analog pins
|
||||
static constexpr Int32 maximumResistance = 0x7FFFFFFF;
|
||||
static constexpr Int32 MAX_RESISTANCE = 0x7FFFFFFF;
|
||||
|
||||
/// Constant which represents minimum resistance for analog pins
|
||||
static constexpr Int32 minimumResistance = 0x00000000;
|
||||
static constexpr Int32 MIN_RESISTANCE = 0x00000000;
|
||||
|
||||
protected:
|
||||
void updateAnalogPin(AnalogPin, Int32 value);
|
||||
|
|
|
@ -42,8 +42,8 @@ Genesis::Genesis(Jack jack, const Event& event, const System& system)
|
|||
myFire2Event = Event::JoystickOneFire5;
|
||||
}
|
||||
|
||||
updateAnalogPin(Five, minimumResistance);
|
||||
updateAnalogPin(Nine, minimumResistance);
|
||||
updateAnalogPin(Five, MIN_RESISTANCE);
|
||||
updateAnalogPin(Nine, MIN_RESISTANCE);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -61,9 +61,8 @@ void Genesis::update()
|
|||
// in that the logic is inverted
|
||||
updateAnalogPin(
|
||||
Five,
|
||||
(myEvent.get(myFire2Event) == 0) ? minimumResistance : maximumResistance
|
||||
(myEvent.get(myFire2Event) == 0) ? MIN_RESISTANCE : MAX_RESISTANCE
|
||||
);
|
||||
updateAnalogPin(Nine, minimumResistance);
|
||||
|
||||
// Mouse motion and button events
|
||||
if(myControlID > -1)
|
||||
|
@ -94,7 +93,7 @@ void Genesis::update()
|
|||
if(myEvent.get(Event::MouseButtonLeftValue))
|
||||
myDigitalPinState[Six] = false;
|
||||
if(myEvent.get(Event::MouseButtonRightValue))
|
||||
updateAnalogPin(Five, maximumResistance);
|
||||
updateAnalogPin(Five, MAX_RESISTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,26 +68,26 @@ void Keyboard::write(DigitalPin pin, bool value)
|
|||
if(!myDigitalPinState[Four])
|
||||
{
|
||||
myDigitalPinState[Six] = (myEvent.get(myPoundEvent) == 0);
|
||||
if(myEvent.get(myZeroEvent) != 0) resistanceFive = maximumResistance;
|
||||
if(myEvent.get(myStarEvent) != 0) resistanceNine = maximumResistance;
|
||||
if(myEvent.get(myZeroEvent) != 0) resistanceFive = MAX_RESISTANCE;
|
||||
if(myEvent.get(myStarEvent) != 0) resistanceNine = MAX_RESISTANCE;
|
||||
}
|
||||
if(!myDigitalPinState[Three])
|
||||
{
|
||||
myDigitalPinState[Six] = (myEvent.get(myNineEvent) == 0);
|
||||
if(myEvent.get(myEightEvent) != 0) resistanceFive = maximumResistance;
|
||||
if(myEvent.get(mySevenEvent) != 0) resistanceNine = maximumResistance;
|
||||
if(myEvent.get(myEightEvent) != 0) resistanceFive = MAX_RESISTANCE;
|
||||
if(myEvent.get(mySevenEvent) != 0) resistanceNine = MAX_RESISTANCE;
|
||||
}
|
||||
if(!myDigitalPinState[Two])
|
||||
{
|
||||
myDigitalPinState[Six] = (myEvent.get(mySixEvent) == 0);
|
||||
if(myEvent.get(myFiveEvent) != 0) resistanceFive = maximumResistance;
|
||||
if(myEvent.get(myFourEvent) != 0) resistanceNine = maximumResistance;
|
||||
if(myEvent.get(myFiveEvent) != 0) resistanceFive = MAX_RESISTANCE;
|
||||
if(myEvent.get(myFourEvent) != 0) resistanceNine = MAX_RESISTANCE;
|
||||
}
|
||||
if(!myDigitalPinState[One])
|
||||
{
|
||||
myDigitalPinState[Six] = (myEvent.get(myThreeEvent) == 0);
|
||||
if(myEvent.get(myTwoEvent) != 0) resistanceFive = maximumResistance;
|
||||
if(myEvent.get(myOneEvent) != 0) resistanceNine = maximumResistance;
|
||||
if(myEvent.get(myTwoEvent) != 0) resistanceFive = MAX_RESISTANCE;
|
||||
if(myEvent.get(myOneEvent) != 0) resistanceNine = MAX_RESISTANCE;
|
||||
}
|
||||
|
||||
if (resistanceFive != read(Five)) {
|
||||
|
|
|
@ -28,8 +28,8 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system,
|
|||
{
|
||||
// We must start with minimum resistance; see commit
|
||||
// 38b452e1a047a0dca38c5bcce7c271d40f76736e for more information
|
||||
updateAnalogPin(Five, minimumResistance);
|
||||
updateAnalogPin(Nine, minimumResistance);
|
||||
updateAnalogPin(Five, MIN_RESISTANCE);
|
||||
updateAnalogPin(Nine, MIN_RESISTANCE);
|
||||
|
||||
// The following logic reflects that mapping paddles to different
|
||||
// devices can be extremely complex
|
||||
|
|
|
@ -1542,7 +1542,7 @@ void TIA::updatePaddle(uInt8 idx)
|
|||
}
|
||||
|
||||
myPaddleReaders[idx].update(
|
||||
(resistance == Controller::maximumResistance) ? -1 : (double(resistance) / Paddles::MAX_RESISTANCE),
|
||||
(resistance == Controller::MAX_RESISTANCE) ? -1 : (double(resistance) / Paddles::MAX_RESISTANCE),
|
||||
myTimestamp,
|
||||
consoleTiming()
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue