From ce14cc8677b6d885a5f6c1a372a552f6ce2263e4 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 5 Aug 2018 17:36:01 -0400 Subject: [PATCH] Flips meaning of analogue input bits, correcting most joystick titles. Mysteriously, some functioned correctly before this. But they continue to do so. --- Machines/AppleII/AppleII.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Machines/AppleII/AppleII.cpp b/Machines/AppleII/AppleII.cpp index c8228009e..28dee33a1 100644 --- a/Machines/AppleII/AppleII.cpp +++ b/Machines/AppleII/AppleII.cpp @@ -289,7 +289,7 @@ template class ConcreteMachine: std::vector> joysticks_; bool analogue_channel_is_discharged(size_t channel) { - return static_cast(joysticks_[channel >> 1].get())->axes[channel & 1] < analogue_charge_ + analogue_biases_[channel]; + return (1.0f - static_cast(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 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;