And the process starts again.

Added shortcut key to toggle TV scanline jittering, and have it default
to off.  I'd really like to enable it again eventually, or perhaps use some
of the code in the case where scanline jumps are *really* large (since it
seems to emulate the output for every TV I've ever seen).

Bumped version #.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3221 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2015-09-29 21:14:12 +00:00
parent f367b3a9a6
commit f5eca188ce
9 changed files with 66 additions and 6 deletions

View File

@ -12,6 +12,15 @@
Release History
===========================================================================
4.6.5 to 4.6.6: (October xx, 2015)
* Added 'Alt/Cmd + j' shortcut key and 'tv.jitter' commandline argument
to toggle the TV scanline jittering emulation added in the last
release. Also, this jittering now defaults to off.
-Have fun!
4.6.1 to 4.6.5: (September 26, 2015)
* Added mappable events for toggling TV color/BW, left difficulty A/B
@ -50,8 +59,6 @@
* Updated included PNG library to latest stable version.
-Have fun!
4.6 to 4.6.1: (April 22, 2015)

View File

@ -1447,6 +1447,12 @@
<td>Shift-Alt + .</td>
<td>Shift-Cmd + .</td>
</tr>
<tr>
<td>Toggle TV scanline 'jitter'</td>
<td>Shift-Alt + j</td>
<td>Shift-Cmd + j</td>
</tr>
</table>
<p><b>Other Keys (cannot be remapped, except those marked with '*')</b></p>

View File

@ -22,7 +22,7 @@
#include <cstdlib>
#define STELLA_VERSION "4.6.5"
#define STELLA_VERSION "4.6.6_svn"
#define STELLA_BUILD atoi("$Rev$" + 6)
#endif

View File

@ -891,6 +891,14 @@ void Console::toggleFixedColors() const
myOSystem.frameBuffer().showMessage("Fixed debug colors disabled");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::toggleJitter() const
{
bool enabled = myTIA->toggleJitter();
string message = string("TV scanline jitter") + (enabled ? " enabled" : " disabled");
myOSystem.frameBuffer().showMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::attachDebugger(Debugger& dbg)
{

View File

@ -280,6 +280,11 @@ class Console : public Serializable
*/
void toggleFixedColors() const;
/**
Toggles the TIA 'scanline jitter' mode.
*/
void toggleJitter() const;
private:
/**
Sets various properties of the TIA (YStart, Height, etc) based on

View File

@ -424,6 +424,10 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
myOSystem.console().togglePhosphor();
break;
case KBDK_J: // Alt-j toggles scanline jitter
myOSystem.console().toggleJitter();
break;
case KBDK_L:
myOSystem.frameBuffer().toggleFrameStats();
break;

View File

@ -58,6 +58,7 @@ Settings::Settings(OSystem& osystem)
setInternal("tv.filter", "0");
setInternal("tv.scanlines", "25");
setInternal("tv.scaninter", "true");
setInternal("tv.jitter", "false");
// TV options when using 'custom' mode
setInternal("tv.contrast", "0.0");
setInternal("tv.brightness", "0.0");

View File

@ -58,6 +58,7 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
myPALFrameCounter(0),
myBitsEnabled(true),
myCollisionsEnabled(true),
myJitterEnabled(false),
myNextFrameJitter(0),
myCurrentFrameJitter(0)
@ -80,6 +81,9 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
// Should undriven pins be randomly pulled high or low?
myTIAPinsDriven = mySettings.getBool("tiadriven");
// Enable scanline jittering
myJitterEnabled = mySettings.getBool("tv.jitter");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -657,7 +661,7 @@ inline void TIA::endFrame()
}
// Account for frame jitter, skipping the first few frames
if(myFrameCounter > 3)
if(myJitterEnabled && myFrameCounter > 3)
{
// Set the jitter amount for the current frame
myCurrentFrameJitter = myNextFrameJitter * 160;
@ -901,6 +905,19 @@ bool TIA::driveUnusedPinsRandom(uInt8 mode)
return myTIAPinsDriven;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool TIA::toggleJitter(uInt8 mode)
{
// If mode is 0 or 1, use it as a boolean (off or on)
// Otherwise, flip the state
bool on = (mode == 0 || mode == 1) ? bool(mode) :
myJitterEnabled = !myJitterEnabled;
myJitterEnabled = on;
mySettings.setValue("tv.jitter", myJitterEnabled);
return myJitterEnabled;
}
#ifdef DEBUGGER_SUPPORT
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::updateScanline()
@ -909,8 +926,7 @@ void TIA::updateScanline()
if(!myPartialFrameFlag)
startFrame();
// true either way:
myPartialFrameFlag = true;
myPartialFrameFlag = true; // true either way
int totalClocks = (mySystem->cycles() * 3) - myClockWhenFrameStarted;
int endClock = ((totalClocks + 228) / 228) * 228;

View File

@ -317,6 +317,16 @@ class TIA : public Device
*/
bool driveUnusedPinsRandom(uInt8 mode = 2);
/**
Enables/disable/toggle 'scanline jittering' mode.
@param mode 1/0 indicates on/off, otherwise flip from
its current state
@return Whether the mode was enabled or disabled
*/
bool toggleJitter(uInt8 mode = 2);
#ifdef DEBUGGER_SUPPORT
/**
This method should be called to update the TIA with a new scanline.
@ -616,6 +626,9 @@ class TIA : public Device
// Whether TIA bits/collisions are currently enabled/disabled
bool myBitsEnabled, myCollisionsEnabled;
// Whether to enable jitter emulation
bool myJitterEnabled;
// Derived from the difference between the scanline counts of the
// current and prior frames. If non-zero the next frame should jitter.
Int32 myNextFrameJitter;