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;
myU = USUPP * (1 - (1 - myU / USUPP) *
exp(-(timestamp - myTimestamp) / (myValue * RPOT + R0) / C / myClockFreq));
if (myValue >= 0)
myU = USUPP * (1 - (1 - myU / USUPP) *
exp(-(timestamp - myTimestamp) / (myValue * RPOT + R0) / C / myClockFreq));
myTimestamp = timestamp;
}

View File

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