Skip to content

Commit

Permalink
Re-activate PAL colour-loss effect.
Browse files Browse the repository at this point in the history
 - Only activates in PAL-like modes (PAL and PAL60)
  • Loading branch information
sa666666 committed May 12, 2017
1 parent 1c9343e commit fb5daa4
Show file tree
Hide file tree
Showing 18 changed files with 187 additions and 51 deletions.
16 changes: 10 additions & 6 deletions src/emucore/Console.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,16 @@ void Console::toggleFormat(int direction)
void Console::toggleColorLoss()
{
bool colorloss = !myOSystem.settings().getBool("colorloss");
myOSystem.settings().setValue("colorloss", colorloss);
myTIA->enableColorLoss(colorloss);

string message = string("PAL color-loss ") +
(colorloss ? "enabled" : "disabled");
myOSystem.frameBuffer().showMessage(message);
if(myTIA->enableColorLoss(colorloss))
{
myOSystem.settings().setValue("colorloss", colorloss);
string message = string("PAL color-loss ") +
(colorloss ? "enabled" : "disabled");
myOSystem.frameBuffer().showMessage(message);
}
else
myOSystem.frameBuffer().showMessage(
"PAL color-loss not available in non PAL modes");
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down
2 changes: 1 addition & 1 deletion src/emucore/DefProps.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ static const char* DefProps[DEF_PROPS_SIZE][21] = {
{ "35ae903dff7389755ad4a07f2fb7400c", "", "", "Colored Wall Demo (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "35b10a248a7e67493ec43aeb9743538c", "Dor-x", "", "Defender (Dor-x) (Hack)", "Hack of Defender", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "35b43b54e83403bb3d71f519739a9549", "Parker Brothers, Dave Engman, Isabel Garret", "", "McDonald's (06-06-1983) (Parker Bros) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "35be55426c1fec32dfb503b4f0651572", "Men-A-Vision", "", "Air Raid (Men-A-Vision) (PAL)", "NTSC50 format", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "NTSC50", "", "", "YES", "" },
{ "35be55426c1fec32dfb503b4f0651572", "Men-A-Vision", "", "Air Raid (Men-A-Vision) (PAL)", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "35fa32256982774a4f134c3347882dff", "Retroactive", "", "Qb (V0.05) (Macintosh) (2001) (Retroactive)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "360ba640f6810ec902b01a09cc8ab556", "Atari, Jerome Domurat, Steve Woita", "CX2699", "Taz (06-15-1983) (Atari) (Prototype) (PAL)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "360c0dcb11506e73bd0b77207c81bc62", "Digitel", "", "Enduro (1983) (Digitel)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
Expand Down
2 changes: 1 addition & 1 deletion src/emucore/StateManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "StateManager.hxx"

#define STATE_HEADER "04090600state"
#define STATE_HEADER "04090700state"
#define MOVIE_HEADER "03030000movie"

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down
2 changes: 0 additions & 2 deletions src/emucore/stella.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4261,9 +4261,7 @@
"Cartridge.MD5" "35be55426c1fec32dfb503b4f0651572"
"Cartridge.Manufacturer" "Men-A-Vision"
"Cartridge.Name" "Air Raid (Men-A-Vision) (PAL)"
"Cartridge.Note" "NTSC50 format"
"Cartridge.Rarity" "Extremely Rare"
"Display.Format" "NTSC50"
"Display.Phosphor" "YES"
""

Expand Down
18 changes: 17 additions & 1 deletion src/emucore/tia/Background.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,24 @@ void Background::enableDebugColors(bool enabled)
applyColors();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Background::applyColorLoss()
{
myTIA->flushLineCache();
applyColors();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Background::applyColors()
{
myColor = myDebugEnabled ? myDebugColor : myObjectColor;
if (!myDebugEnabled)
{
if (myTIA->colorLossActive()) myObjectColor |= 0x01;
else myObjectColor &= 0xfe;
myColor = myObjectColor;
}
else
myColor = myDebugColor;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -95,6 +109,8 @@ bool Background::load(Serializer& in)
myObjectColor = in.getByte();
myDebugColor = in.getByte();
myDebugEnabled = in.getBool();

applyColors();
}
catch(...)
{
Expand Down
6 changes: 3 additions & 3 deletions src/emucore/tia/Background.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ class Background : public Serializable
Background();

public:
void setTIA(TIA* tia) {
myTIA = tia;
}
void setTIA(TIA* tia) { myTIA = tia; }

void reset();

void setColor(uInt8 color);
void setDebugColor(uInt8 color);
void enableDebugColors(bool enabled);

void applyColorLoss();

uInt8 getColor() const { return myColor; }

/**
Expand Down
21 changes: 17 additions & 4 deletions src/emucore/tia/Ball.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ void Ball::reset()
myRenderCounter = 0;

updateEnabled();
applyColors();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -134,7 +133,6 @@ void Ball::setColor(uInt8 color)
void Ball::setDebugColor(uInt8 color)
{
myTIA->flushLineCache();

myDebugColor = color;
applyColors();
}
Expand All @@ -143,11 +141,17 @@ void Ball::setDebugColor(uInt8 color)
void Ball::enableDebugColors(bool enabled)
{
myTIA->flushLineCache();

myDebugEnabled = enabled;
applyColors();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Ball::applyColorLoss()
{
myTIA->flushLineCache();
applyColors();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Ball::startMovement()
{
Expand Down Expand Up @@ -234,7 +238,14 @@ void Ball::updateEnabled()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Ball::applyColors()
{
myColor = myDebugEnabled ? myDebugColor : myObjectColor;
if (!myDebugEnabled)
{
if (myTIA->colorLossActive()) myObjectColor |= 0x01;
else myObjectColor &= 0xfe;
myColor = myObjectColor;
}
else
myColor = myDebugColor;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -325,6 +336,8 @@ bool Ball::load(Serializer& in)

myIsRendering = in.getBool();
myRenderCounter = in.getByte();

applyColors();
}
catch(...)
{
Expand Down
6 changes: 3 additions & 3 deletions src/emucore/tia/Ball.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ class Ball : public Serializable

public:

void setTIA(TIA* tia) {
myTIA = tia;
}
void setTIA(TIA* tia) { myTIA = tia; }

void reset();

Expand All @@ -56,6 +54,8 @@ class Ball : public Serializable
void setDebugColor(uInt8 color);
void enableDebugColors(bool enabled);

void applyColorLoss();

void startMovement();

bool movementTick(uInt32 clock, bool apply);
Expand Down
3 changes: 3 additions & 0 deletions src/emucore/tia/FrameManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ void FrameManager::finalizeFrame()
{
handleJitter(myCurrentFrameTotalLines - myCurrentFrameFinalLines);

myPreviousFrameFinalLines = myCurrentFrameFinalLines;
myCurrentFrameFinalLines = myCurrentFrameTotalLines;
myCurrentFrameTotalLines = 0;
myTotalFrames++;
Expand Down Expand Up @@ -349,6 +350,7 @@ bool FrameManager::save(Serializer& out) const
out.putInt(myLineInState);
out.putInt(myCurrentFrameTotalLines);
out.putInt(myCurrentFrameFinalLines);
out.putInt(myPreviousFrameFinalLines);
out.putInt(myVsyncLines);
out.putDouble(myFrameRate);
out.putInt(myY); out.putInt(myLastY);
Expand Down Expand Up @@ -394,6 +396,7 @@ bool FrameManager::load(Serializer& in)
myLineInState = in.getInt();
myCurrentFrameTotalLines = in.getInt();
myCurrentFrameFinalLines = in.getInt();
myPreviousFrameFinalLines = in.getInt();
myVsyncLines = in.getInt();
myFrameRate = float(in.getDouble());
myY = in.getInt(); myLastY = in.getInt();
Expand Down
5 changes: 5 additions & 0 deletions src/emucore/tia/FrameManager.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ class FrameManager : public Serializable

uInt32 missingScanlines() const;

bool scanlineCountTransitioned() const {
return (myPreviousFrameFinalLines & 0x1) != (myCurrentFrameFinalLines & 0x1);
}

uInt32 frameCount() const { return myTotalFrames; }

float frameRate() const { return myFrameRate; }
Expand Down Expand Up @@ -141,6 +145,7 @@ class FrameManager : public Serializable
uInt32 myLineInState;
uInt32 myCurrentFrameTotalLines;
uInt32 myCurrentFrameFinalLines;
uInt32 myPreviousFrameFinalLines;
uInt32 myVsyncLines;
float myFrameRate;
uInt32 myY, myLastY;
Expand Down
19 changes: 18 additions & 1 deletion src/emucore/tia/Missile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,18 @@ void Missile::setDebugColor(uInt8 color)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Missile::enableDebugColors(bool enabled)
{
myTIA->flushLineCache();
myDebugEnabled = enabled;
applyColors();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Missile::applyColorLoss()
{
myTIA->flushLineCache();
applyColors();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Missile::updateEnabled()
{
Expand All @@ -243,7 +251,14 @@ void Missile::updateEnabled()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Missile::applyColors()
{
myColor = myDebugEnabled ? myDebugColor : myObjectColor;
if (!myDebugEnabled)
{
if (myTIA->colorLossActive()) myObjectColor |= 0x01;
else myObjectColor &= 0xfe;
myColor = myObjectColor;
}
else
myColor = myDebugColor;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -334,6 +349,8 @@ bool Missile::load(Serializer& in)
myColor = in.getByte();
myObjectColor = in.getByte(); myDebugColor = in.getByte();
myDebugEnabled = in.getBool();

applyColors();
}
catch(...)
{
Expand Down
6 changes: 3 additions & 3 deletions src/emucore/tia/Missile.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ class Missile : public Serializable

public:

void setTIA(TIA* tia) {
myTIA = tia;
}
void setTIA(TIA* tia) { myTIA = tia; }

void reset();

Expand All @@ -59,6 +57,8 @@ class Missile : public Serializable
void setDebugColor(uInt8 color);
void enableDebugColors(bool enabled);

void applyColorLoss();

void toggleCollisions(bool enabled);

void toggleEnabled(bool enabled);
Expand Down
20 changes: 17 additions & 3 deletions src/emucore/tia/Player.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ void Player::setColor(uInt8 color)
void Player::setDebugColor(uInt8 color)
{
myTIA->flushLineCache();

myDebugColor = color;
applyColors();
}
Expand All @@ -240,11 +239,17 @@ void Player::setDebugColor(uInt8 color)
void Player::enableDebugColors(bool enabled)
{
myTIA->flushLineCache();

myDebugEnabled = enabled;
applyColors();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Player::applyColorLoss()
{
myTIA->flushLineCache();
applyColors();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Player::startMovement()
{
Expand Down Expand Up @@ -379,7 +384,14 @@ void Player::setDivider(uInt8 divider)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Player::applyColors()
{
myColor = myDebugEnabled ? myDebugColor : myObjectColor;
if (!myDebugEnabled)
{
if (myTIA->colorLossActive()) myObjectColor |= 0x01;
else myObjectColor &= 0xfe;
myColor = myObjectColor;
}
else
myColor = myDebugColor;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -487,6 +499,8 @@ bool Player::load(Serializer& in)

myIsReflected = in.getBool();
myIsDelaying = in.getBool();

applyColors();
}
catch(...)
{
Expand Down
6 changes: 3 additions & 3 deletions src/emucore/tia/Player.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ class Player : public Serializable

public:

void setTIA(TIA* tia) {
myTIA = tia;
}
void setTIA(TIA* tia) { myTIA = tia; }

void reset();

Expand All @@ -57,6 +55,8 @@ class Player : public Serializable
void setDebugColor(uInt8 color);
void enableDebugColors(bool enabled);

void applyColorLoss();

void startMovement();

bool movementTick(uInt32 clock, bool apply);
Expand Down

0 comments on commit fb5daa4

Please sign in to comment.