TV jitter recovery time can now be set through a commandline argument

(tv.jitter_recovery).  Next, this will be added to the UI.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3276 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2016-02-12 14:23:40 +00:00
parent 6a91da283f
commit 79cfdb294c
4 changed files with 36 additions and 17 deletions

View File

@ -16,8 +16,9 @@
* Improved TV 'jitter' emulation; the recovery time can now be spread
over multiple frame, to simulate a real TV taking multiple frames to
recover. Special thanks to SpiceWare of AtariAge for the initial idea
and implementation.
recover. Related to this, added new commandline argument
'tv.jitter_recovery' to set the recovery time. Special thanks to
SpiceWare of AtariAge for the initial idea and implementation.
* Fixed bug with 'Medieval Mayhem' ROMs; the paddle range was set too
low, and as a result the number of players couldn't be selected.
@ -27,6 +28,12 @@
second one. This caused the joystick mappings to be lost, since there
was only information about two controllers being saved.
* Indirectly fixed issues with Stelladaptor/2600-daptor devices and
paddles having too large of a deadzone in Linux. Currently, this
involves running an external application to set the deadzone,
since SDL does not yet expose this information. The program is
called 'evdev-joystick', and will be released separately from Stella.
* Updated internal ROM properties database to ROM-Hunter version 11
(thanks go to RomHunter for his tireless research in this area).
Related to this, updated the snapshot collection.

View File

@ -59,6 +59,7 @@ Settings::Settings(OSystem& osystem)
setInternal("tv.scanlines", "25");
setInternal("tv.scaninter", "true");
setInternal("tv.jitter", "false");
setInternal("tv.jitter_recovery", "10");
// TV options when using 'custom' mode
setInternal("tv.contrast", "0.0");
setInternal("tv.brightness", "0.0");
@ -277,6 +278,9 @@ void Settings::validate()
i = getInt("tv.filter");
if(i < 0 || i > 5) setInternal("tv.filter", "0");
i = getInt("tv.jitter_recovery");
if(i < 1 || i > 20) setInternal("tv.jitter_recovery", "10");
#ifdef SOUND_SUPPORT
i = getInt("volume");
if(i < 0 || i > 100) setInternal("volume", "100");
@ -370,6 +374,8 @@ void Settings::usage() const
<< " -tv.filter <0-5> Set TV effects off (0) or to specified mode (1-5)\n"
<< " -tv.scanlines <0-100> Set scanline intensity to percentage (0 disables completely)\n"
<< " -tv.scaninter <1|0> Enable interpolated (smooth) scanlines\n"
<< " -tv.jitter <1|0> Enable scanline jitter effect\n"
<< " -tv.jitter_recovery <number> Set recovery time for scanline jitter effect\n"
<< " -tv.contrast <value> Set TV effects custom contrast to value 1.0 - 1.0\n"
<< " -tv.brightness <value> Set TV effects custom brightness to value 1.0 - 1.0\n"
<< " -tv.hue <value> Set TV effects custom hue to value 1.0 - 1.0\n"

View File

@ -39,8 +39,6 @@
#include "TIA.hxx"
#define HBLANK 68
#define JITTER_RECOVERY 10
#define CLAMP_POS(reg) if(reg < 0) { reg += 160; } reg %= 160;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -129,6 +127,7 @@ void TIA::initialize()
myBitsEnabled = myCollisionsEnabled = true;
myJitterEnabled = mySettings.getBool("tv.jitter");
myJitterRecoveryFactor = mySettings.getInt("tv.jitter_recovery");
myNextFrameJitter = myCurrentFrameJitter = myJitterRecovery = 0;
// Make sure all TIA bits are enabled
@ -647,7 +646,8 @@ inline void TIA::endFrame()
if(myJitterEnabled && myFrameCounter > 3)
{
// Set the jitter amount for the current frame
myCurrentFrameJitter = (myNextFrameJitter + myJitterRecovery*JITTER_RECOVERY)* 160;
myCurrentFrameJitter = (myNextFrameJitter + myJitterRecovery *
myJitterRecoveryFactor) * 160;
if(myJitterRecovery < 0) myJitterRecovery++;
else if (myJitterRecovery > 0) myJitterRecovery--;
@ -659,16 +659,16 @@ inline void TIA::endFrame()
if(myNextFrameJitter < -1)
{
if(myNextFrameJitter/JITTER_RECOVERY < myJitterRecovery)
if(myNextFrameJitter / myJitterRecoveryFactor < myJitterRecovery)
{
myJitterRecovery = myNextFrameJitter/JITTER_RECOVERY;
myJitterRecovery = myNextFrameJitter / myJitterRecoveryFactor;
myNextFrameJitter = 0;
// Make sure currentFrameBuffer() doesn't return a pointer that
// results in memory being accessed outside of the 160*320 bytes
// allocated for the frame buffer
if(myJitterRecovery*JITTER_RECOVERY < -Int32(myFrameYStart))
myJitterRecovery = myFrameYStart / JITTER_RECOVERY;
if(myJitterRecovery * myJitterRecoveryFactor < -Int32(myFrameYStart))
myJitterRecovery = myFrameYStart / myJitterRecoveryFactor;
}
else
{
@ -677,22 +677,25 @@ inline void TIA::endFrame()
// Make sure currentFrameBuffer() doesn't return a pointer that
// results in memory being accessed outside of the 160*320 bytes
// allocated for the frame buffer
if(myNextFrameJitter + myJitterRecovery*JITTER_RECOVERY < -Int32(myFrameYStart))
if(myNextFrameJitter + myJitterRecovery * myJitterRecoveryFactor <
-Int32(myFrameYStart))
myNextFrameJitter = myFrameYStart;
}
}
else if(myNextFrameJitter > 1)
{
if (myNextFrameJitter/JITTER_RECOVERY > myJitterRecovery)
if (myNextFrameJitter / myJitterRecoveryFactor > myJitterRecovery)
{
myJitterRecovery = myNextFrameJitter / JITTER_RECOVERY;
myJitterRecovery = myNextFrameJitter / myJitterRecoveryFactor;
myNextFrameJitter = 0;
// Make sure currentFrameBuffer() doesn't return a pointer that
// results in memory being accessed outside of the 160*320 bytes
// allocated for the frame buffer
if(myJitterRecovery*JITTER_RECOVERY > 320 - Int32(myFrameYStart) - Int32(myFrameHeight))
myJitterRecovery = (320 - myFrameYStart - myFrameHeight)/JITTER_RECOVERY;
if(myJitterRecovery * myJitterRecoveryFactor >
320 - Int32(myFrameYStart) - Int32(myFrameHeight))
myJitterRecovery = (320 - myFrameYStart - myFrameHeight) /
myJitterRecoveryFactor;
}
else
{
@ -701,7 +704,8 @@ inline void TIA::endFrame()
// Make sure currentFrameBuffer() doesn't return a pointer that
// results in memory being accessed outside of the 160*320 bytes
// allocated for the frame buffer
if(myNextFrameJitter + myJitterRecovery*JITTER_RECOVERY > 320 - Int32(myFrameYStart) - Int32(myFrameHeight))
if(myNextFrameJitter + myJitterRecovery * myJitterRecoveryFactor >
320 - Int32(myFrameYStart) - Int32(myFrameHeight))
myNextFrameJitter = 320 - myFrameYStart - myFrameHeight;
}
}

View File

@ -314,7 +314,8 @@ class TIA : public Device
bool driveUnusedPinsRandom(uInt8 mode = 2);
/**
Enables/disable/toggle 'scanline jittering' mode.
Enables/disable/toggle 'scanline jittering' mode, and set the
recovery 'factor'.
@param mode 1/0 indicates on/off, otherwise flip from
its current state
@ -322,6 +323,7 @@ class TIA : public Device
@return Whether the mode was enabled or disabled
*/
bool toggleJitter(uInt8 mode = 2);
void setJitterRecoveryFactor(Int32 f) { myJitterRecoveryFactor = f; }
#ifdef DEBUGGER_SUPPORT
/**
@ -636,7 +638,7 @@ class TIA : public Device
Int32 myCurrentFrameJitter;
// Large jitter values will take multiple frames to recover from
Int32 myJitterRecovery;
Int32 myJitterRecovery, myJitterRecoveryFactor;
private:
// Following constructors and assignment operators not supported