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 * Improved TV 'jitter' emulation; the recovery time can now be spread
over multiple frame, to simulate a real TV taking multiple frames to over multiple frame, to simulate a real TV taking multiple frames to
recover. Special thanks to SpiceWare of AtariAge for the initial idea recover. Related to this, added new commandline argument
and implementation. '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 * 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. 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 second one. This caused the joystick mappings to be lost, since there
was only information about two controllers being saved. 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 * Updated internal ROM properties database to ROM-Hunter version 11
(thanks go to RomHunter for his tireless research in this area). (thanks go to RomHunter for his tireless research in this area).
Related to this, updated the snapshot collection. Related to this, updated the snapshot collection.

View File

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

View File

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

View File

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