This commit is contained in:
thrust26 2018-08-09 15:39:54 +02:00
parent ae96406fd4
commit efb998129b
4 changed files with 75 additions and 46 deletions

View File

@ -49,15 +49,17 @@ const DebuggerState& TIADebug::getState()
myState.coluRegs.push_back(coluBK());
// Debug Colors
int mode = myTIA.frameLayout() == FrameLayout::ntsc ? 0 : 1;
int timing = myTIA.consoleTiming() == ConsoleTiming::ntsc ? 0
: myTIA.consoleTiming() == ConsoleTiming::pal ? 1 : 2;
myState.fixedCols.clear();
myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::P0]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::P1]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::PF]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::BK]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::M0]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::M1]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::BL]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[timing][TIA::P0]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[timing][TIA::P1]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[timing][TIA::PF]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[timing][TIA::BK]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[timing][TIA::M0]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[timing][TIA::M1]);
myState.fixedCols.push_back(myTIA.myFixedColorPalette[timing][TIA::BL]);
myState.fixedCols.push_back(TIA::FixedColor::HBLANK_WHITE);
// Collisions
@ -1012,20 +1014,22 @@ string TIADebug::debugColors() const
{
ostringstream buf;
int mode = myTIA.frameLayout() == FrameLayout::ntsc ? 0 : 1;
buf << " " << myTIA.myFixedColorNames[TIA::P0] << " " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::P0])
int timing = myTIA.consoleTiming() == ConsoleTiming::ntsc ? 0
: myTIA.consoleTiming() == ConsoleTiming::pal ? 1 : 2;
buf << " " << myTIA.myFixedColorNames[TIA::P0] << " " << colorSwatch(myTIA.myFixedColorPalette[timing][TIA::P0])
<< " Player 0\n"
<< " " << myTIA.myFixedColorNames[TIA::M0] << " " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::M0])
<< " " << myTIA.myFixedColorNames[TIA::M0] << " " << colorSwatch(myTIA.myFixedColorPalette[timing][TIA::M0])
<< " Missile 0\n"
<< " " << myTIA.myFixedColorNames[TIA::P1] << " " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::P1])
<< " " << myTIA.myFixedColorNames[TIA::P1] << " " << colorSwatch(myTIA.myFixedColorPalette[timing][TIA::P1])
<< " Player 1\n"
<< " " << myTIA.myFixedColorNames[TIA::M1] << " " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::M1])
<< " " << myTIA.myFixedColorNames[TIA::M1] << " " << colorSwatch(myTIA.myFixedColorPalette[timing][TIA::M1])
<< " Missile 1\n"
<< " " << myTIA.myFixedColorNames[TIA::PF] << " " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::PF])
<< " " << myTIA.myFixedColorNames[TIA::PF] << " " << colorSwatch(myTIA.myFixedColorPalette[timing][TIA::PF])
<< " Playfield\n"
<< " " << myTIA.myFixedColorNames[TIA::BL] << " " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::BL])
<< " " << myTIA.myFixedColorNames[TIA::BL] << " " << colorSwatch(myTIA.myFixedColorPalette[timing][TIA::BL])
<< " Ball\n"
<< " Grey " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::BK])
<< " Grey " << colorSwatch(myTIA.myFixedColorPalette[timing][TIA::BK])
<< " Background\n"
<< " White " << colorSwatch(TIA::FixedColor::HBLANK_WHITE)
<< " HMOVE\n";

View File

@ -973,7 +973,8 @@ bool TIA::toggleCollisions()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool TIA::enableFixedColors(bool enable)
{
int timing = consoleTiming() == ConsoleTiming::pal ? 1 : 0;
int timing = consoleTiming() == ConsoleTiming::ntsc ? 0
: consoleTiming() == ConsoleTiming::pal ? 1 : 2;
myMissile0.setDebugColor(myFixedColorPalette[timing][FixedObject::M0]);
myMissile1.setDebugColor(myFixedColorPalette[timing][FixedObject::M1]);
@ -1010,38 +1011,44 @@ bool TIA::setFixedColorPalette(const string& colors)
case 'r':
myFixedColorPalette[0][i] = FixedColor::NTSC_RED;
myFixedColorPalette[1][i] = FixedColor::PAL_RED;
myFixedColorPalette[2][i] = FixedColor::SECAM_RED;
myFixedColorNames[i] = "Red ";
break;
case 'o':
myFixedColorPalette[0][i] = FixedColor::NTSC_ORANGE;
myFixedColorPalette[1][i] = FixedColor::PAL_ORANGE;
myFixedColorPalette[2][i] = FixedColor::SECAM_ORANGE;
myFixedColorNames[i] = "Orange";
break;
case 'y':
myFixedColorPalette[0][i] = FixedColor::NTSC_YELLOW;
myFixedColorPalette[1][i] = FixedColor::PAL_YELLOW;
myFixedColorPalette[2][i] = FixedColor::SECAM_YELLOW;
myFixedColorNames[i] = "Yellow";
break;
case 'g':
myFixedColorPalette[0][i] = FixedColor::NTSC_GREEN;
myFixedColorPalette[1][i] = FixedColor::PAL_GREEN;
myFixedColorPalette[2][i] = FixedColor::SECAM_GREEN;
myFixedColorNames[i] = "Green ";
break;
case 'b':
myFixedColorPalette[0][i] = FixedColor::NTSC_BLUE;
myFixedColorPalette[1][i] = FixedColor::PAL_BLUE;
myFixedColorPalette[2][i] = FixedColor::SECAM_BLUE;
myFixedColorNames[i] = "Blue ";
break;
case 'p':
myFixedColorPalette[0][i] = FixedColor::NTSC_PURPLE;
myFixedColorPalette[1][i] = FixedColor::PAL_PURPLE;
myFixedColorPalette[2][i] = FixedColor::SECAM_PURPLE;
myFixedColorNames[i] = "Purple";
break;
}
}
myFixedColorPalette[0][TIA::BK] = FixedColor::NTSC_GREY;
myFixedColorPalette[1][TIA::BK] = FixedColor::PAL_GREY;
myFixedColorPalette[2][TIA::BK] = FixedColor::SECAM_GREY;
// If already in fixed debug colours mode, update the current palette
if(usingFixedColors())

View File

@ -89,6 +89,14 @@ class TIA : public Device
PAL_PURPLE = 0xa6,
PAL_GREY = 0x06,
SECAM_RED = 0x04,
SECAM_ORANGE = 0x06, // purple
SECAM_YELLOW = 0x0c,
SECAM_GREEN = 0x08,
SECAM_BLUE = 0x02,
SECAM_PURPLE = 0x0a, // cyan
SECAM_GREY = 0x00,
HBLANK_WHITE = 0x0e
};
@ -502,7 +510,7 @@ class TIA : public Device
* Palette and indices for fixed debug colors.
*/
enum FixedObject { P0, M0, P1, M1, PF, BL, BK };
FixedColor myFixedColorPalette[2][7];
FixedColor myFixedColorPalette[3][7];
string myFixedColorNames[7];
private:

View File

@ -1090,7 +1090,7 @@ void DeveloperDialog::handleDebugColours(int idx, int color)
return;
}
static constexpr ColorId dbg_color[2][DEBUG_COLORS] = {
static constexpr ColorId dbg_color[3][DEBUG_COLORS] = {
{
TIA::FixedColor::NTSC_RED,
TIA::FixedColor::NTSC_ORANGE,
@ -1106,11 +1106,21 @@ void DeveloperDialog::handleDebugColours(int idx, int color)
TIA::FixedColor::PAL_GREEN,
TIA::FixedColor::PAL_PURPLE,
TIA::FixedColor::PAL_BLUE
},
{
TIA::FixedColor::SECAM_RED,
TIA::FixedColor::SECAM_ORANGE,
TIA::FixedColor::SECAM_YELLOW,
TIA::FixedColor::SECAM_GREEN,
TIA::FixedColor::SECAM_PURPLE,
TIA::FixedColor::SECAM_BLUE
}
};
int mode = instance().console().tia().frameLayout() == FrameLayout::ntsc ? 0 : 1;
myDbgColourSwatch[idx]->setColor(dbg_color[mode][color]);
int timing = instance().console().tia().consoleTiming() == ConsoleTiming::ntsc ? 0
: instance().console().tia().consoleTiming() == ConsoleTiming::pal ? 1 : 2;
myDbgColourSwatch[idx]->setColor(dbg_color[timing][color]);
myDbgColour[idx]->setSelectedIndex(color);
// make sure the selected debug colors are all different
@ -1122,7 +1132,7 @@ void DeveloperDialog::handleDebugColours(int idx, int color)
usedCol[i] = false;
for(int j = 0; j < DEBUG_COLORS; ++j)
{
if(myDbgColourSwatch[j]->getColor() == dbg_color[mode][i])
if(myDbgColourSwatch[j]->getColor() == dbg_color[timing][i])
{
usedCol[i] = true;
break;
@ -1132,14 +1142,14 @@ void DeveloperDialog::handleDebugColours(int idx, int color)
// check if currently changed color was used somewhere else
for(int i = 0; i < DEBUG_COLORS; ++i)
{
if (i != idx && myDbgColourSwatch[i]->getColor() == dbg_color[mode][color])
if (i != idx && myDbgColourSwatch[i]->getColor() == dbg_color[timing][color])
{
// if already used, change the other color to an unused one
for(int j = 0; j < DEBUG_COLORS; ++j)
{
if(!usedCol[j])
{
myDbgColourSwatch[i]->setColor(dbg_color[mode][j]);
myDbgColourSwatch[i]->setColor(dbg_color[timing][j]);
myDbgColour[i]->setSelectedIndex(j);
break;
}