Fix paddle input if no paddles are not connected.

Don't charge cap if resistance is maxed.
This commit is contained in:
Christian Speckner 2017-02-20 00:49:54 +01:00
parent 75bd732525
commit 39f756f821
2 changed files with 9 additions and 4 deletions

View File

@ -97,8 +97,9 @@ void PaddleReader::updateCharge(double timestamp)
{ {
if (myIsDumped) return; if (myIsDumped) return;
myU = USUPP * (1 - (1 - myU / USUPP) * if (myValue >= 0)
exp(-(timestamp - myTimestamp) / (myValue * RPOT + R0) / C / myClockFreq)); myU = USUPP * (1 - (1 - myU / USUPP) *
exp(-(timestamp - myTimestamp) / (myValue * RPOT + R0) / C / myClockFreq));
myTimestamp = timestamp; myTimestamp = timestamp;
} }

View File

@ -18,6 +18,7 @@
#include "TIA.hxx" #include "TIA.hxx"
#include "M6502.hxx" #include "M6502.hxx"
#include "Console.hxx" #include "Console.hxx"
#include "Control.hxx"
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
#include "CartDebug.hxx" #include "CartDebug.hxx"
@ -1291,8 +1292,11 @@ void TIA::updatePaddle(uInt8 idx)
throw runtime_error("invalid paddle index"); throw runtime_error("invalid paddle index");
} }
myPaddleReaders[idx].update(double(resistance) / MAX_RESISTANCE, myPaddleReaders[idx].update(
myTimestamp, myFrameManager.tvMode()); (resistance == Controller::maximumResistance ? -1 : double(resistance)) / MAX_RESISTANCE,
myTimestamp,
myFrameManager.tvMode()
);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -