1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-23 06:28:59 +00:00

Flips meaning of analogue input bits, correcting most joystick titles.

Mysteriously, some functioned correctly before this. But they continue to do so.
This commit is contained in:
Thomas Harte 2018-08-05 17:36:01 -04:00
parent f7ce86fef8
commit ce14cc8677

View File

@ -289,7 +289,7 @@ template <bool is_iie> class ConcreteMachine:
std::vector<std::unique_ptr<Inputs::Joystick>> joysticks_;
bool analogue_channel_is_discharged(size_t channel) {
return static_cast<Joystick *>(joysticks_[channel >> 1].get())->axes[channel & 1] < analogue_charge_ + analogue_biases_[channel];
return (1.0f - static_cast<Joystick *>(joysticks_[channel >> 1].get())->axes[channel & 1]) < analogue_charge_ + analogue_biases_[channel];
}
// The IIe has three keys that are wired directly to the same input as the joystick buttons.
@ -492,7 +492,7 @@ template <bool is_iie> class ConcreteMachine:
case 0xc067: { // Analogue input 3.
const size_t input = address - 0xc064;
*value &= 0x7f;
if(analogue_channel_is_discharged(input)) {
if(!analogue_channel_is_discharged(input)) {
*value |= 0x80;
}
} break;