| 1 | //============================================================================ |
| 2 | // |
| 3 | // SSSS tt lll lll |
| 4 | // SS SS tt ll ll |
| 5 | // SS tttttt eeee ll ll aaaa |
| 6 | // SSSS tt ee ee ll ll aa |
| 7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" |
| 8 | // SS SS tt ee ll ll aa aa |
| 9 | // SSSS ttt eeeee llll llll aaaaa |
| 10 | // |
| 11 | // Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony |
| 12 | // and the Stella Team |
| 13 | // |
| 14 | // See the file "License.txt" for information on usage and redistribution of |
| 15 | // this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 16 | //============================================================================ |
| 17 | |
| 18 | #include "ColorWidget.hxx" |
| 19 | #include "DataGridWidget.hxx" |
| 20 | #include "EditTextWidget.hxx" |
| 21 | #include "FrameBuffer.hxx" |
| 22 | #include "Font.hxx" |
| 23 | #include "GuiObject.hxx" |
| 24 | #include "OSystem.hxx" |
| 25 | #include "Debugger.hxx" |
| 26 | #include "CartDebug.hxx" |
| 27 | #include "TIA.hxx" |
| 28 | #include "TIADebug.hxx" |
| 29 | #include "ToggleBitWidget.hxx" |
| 30 | #include "TogglePixelWidget.hxx" |
| 31 | #include "Widget.hxx" |
| 32 | #include "DelayQueueWidget.hxx" |
| 33 | #include "TiaWidget.hxx" |
| 34 | |
| 35 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 36 | TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, |
| 37 | const GUI::Font& nfont, |
| 38 | int x, int y, int w, int h) |
| 39 | : Widget(boss, lfont, x, y, w, h), |
| 40 | CommandSender(boss) |
| 41 | { |
| 42 | const int fontWidth = lfont.getMaxCharWidth(), |
| 43 | fontHeight = lfont.getFontHeight(), |
| 44 | lineHeight = lfont.getLineHeight(), |
| 45 | buttonW = 7 * fontWidth; |
| 46 | int xpos = 10, ypos = 10 + lineHeight, buttonX = 0, buttonY = 0; |
| 47 | StaticTextWidget* t = nullptr; |
| 48 | ButtonWidget* b = nullptr; |
| 49 | |
| 50 | // Color registers |
| 51 | const char* const regNames[] = { "COLUP0" , "COLUP1" , "COLUPF" , "COLUBK" }; |
| 52 | for(int row = 0; row < 4; ++row) |
| 53 | { |
| 54 | new StaticTextWidget(boss, lfont, xpos, ypos + row*lineHeight + 2, |
| 55 | 6*fontWidth, fontHeight, regNames[row], TextAlign::Left); |
| 56 | } |
| 57 | xpos += 6*fontWidth + 8; |
| 58 | myColorRegs = new DataGridWidget(boss, nfont, xpos, ypos, |
| 59 | 1, 4, 2, 8, Common::Base::F_16); |
| 60 | myColorRegs->setTarget(this); |
| 61 | myColorRegs->setID(kColorRegsID); |
| 62 | addFocusWidget(myColorRegs); |
| 63 | |
| 64 | xpos += myColorRegs->colWidth() + 5; |
| 65 | myCOLUP0Color = new ColorWidget(boss, nfont, xpos, ypos+2, |
| 66 | uInt32(1.5*lineHeight), lineHeight - 4); |
| 67 | myCOLUP0Color->setTarget(this); |
| 68 | |
| 69 | ypos += lineHeight; |
| 70 | myCOLUP1Color = new ColorWidget(boss, nfont, xpos, ypos+2, |
| 71 | uInt32(1.5*lineHeight), lineHeight - 4); |
| 72 | myCOLUP1Color->setTarget(this); |
| 73 | |
| 74 | ypos += lineHeight; |
| 75 | myCOLUPFColor = new ColorWidget(boss, nfont, xpos, ypos+2, |
| 76 | uInt32(1.5*lineHeight), lineHeight - 4); |
| 77 | myCOLUPFColor->setTarget(this); |
| 78 | |
| 79 | ypos += lineHeight; |
| 80 | myCOLUBKColor = new ColorWidget(boss, nfont, xpos, ypos+2, |
| 81 | uInt32(1.5*lineHeight), lineHeight - 4); |
| 82 | myCOLUBKColor->setTarget(this); |
| 83 | |
| 84 | // Fixed debug colors |
| 85 | xpos += myCOLUP0Color->getWidth() + 30; ypos = 10; |
| 86 | myFixedEnabled = new CheckboxWidget(boss, lfont, xpos, ypos, "Debug Colors" , kDbgClCmd); |
| 87 | myFixedEnabled->setTarget(this); |
| 88 | addFocusWidget(myFixedEnabled); |
| 89 | |
| 90 | const char* const dbgLabels[] = { "P0" , "P1" , "PF" , "BK" , "M0" , "M1" , "BL" , "HM" }; |
| 91 | for(uInt32 row = 0; row <= 3; ++row) |
| 92 | { |
| 93 | ypos += lineHeight; |
| 94 | t = new StaticTextWidget(boss, lfont, xpos, ypos + 2, 2*fontWidth, fontHeight, |
| 95 | dbgLabels[row], TextAlign::Left); |
| 96 | myFixedColors[row] = new ColorWidget(boss, nfont, xpos + 2 + t->getWidth() + 4, |
| 97 | ypos + 2, uInt32(1.5*lineHeight), lineHeight - 4); |
| 98 | myFixedColors[row]->setTarget(this); |
| 99 | } |
| 100 | xpos += t->getWidth() + myFixedColors[0]->getWidth() + 24; |
| 101 | ypos = 10; |
| 102 | for(uInt32 row = 4; row <= 7; ++row) |
| 103 | { |
| 104 | ypos += lineHeight; |
| 105 | t = new StaticTextWidget(boss, lfont, xpos, ypos + 2, 2*fontWidth, fontHeight, |
| 106 | dbgLabels[row], TextAlign::Left); |
| 107 | myFixedColors[row] = new ColorWidget(boss, nfont, xpos + 2 + t->getWidth() + 4, |
| 108 | ypos + 2, uInt32(1.5*lineHeight), lineHeight - 4); |
| 109 | myFixedColors[row]->setTarget(this); |
| 110 | } |
| 111 | |
| 112 | //////////////////////////// |
| 113 | // Collision register bits |
| 114 | //////////////////////////// |
| 115 | xpos += myFixedColors[0]->getWidth() + 2*fontWidth + 60; ypos = 10; |
| 116 | |
| 117 | // Add all 15 collision bits (with labels) |
| 118 | uInt32 cxclrY = 0; |
| 119 | xpos -= 2*fontWidth + 5; ypos += lineHeight; |
| 120 | const char* const rowLabel[] = { "P0" , "P1" , "M0" , "M1" , "BL" }; |
| 121 | const char* const colLabel[] = { "PF" , "BL" , "M1" , "M0" , "P1" }; |
| 122 | uInt32 lwidth = 2*fontWidth, collX = xpos + lwidth + 5, collY = ypos, idx = 0; |
| 123 | for(uInt32 row = 0; row < 5; ++row) |
| 124 | { |
| 125 | // Add vertical label |
| 126 | new StaticTextWidget(boss, lfont, xpos, ypos + row*(lineHeight+3), |
| 127 | 2*fontWidth, fontHeight, |
| 128 | rowLabel[row], TextAlign::Left); |
| 129 | |
| 130 | for(uInt32 col = 0; col < 5 - row; ++col, ++idx) |
| 131 | { |
| 132 | myCollision[idx] = new CheckboxWidget(boss, lfont, collX, collY, "" , CheckboxWidget::kCheckActionCmd); |
| 133 | myCollision[idx]->setTarget(this); |
| 134 | myCollision[idx]->setID(idx); |
| 135 | |
| 136 | // We need to know where the PF_BL register is, to properly position |
| 137 | // the CXCLR button |
| 138 | if(idx == kBL_PFID) |
| 139 | cxclrY = collY; |
| 140 | |
| 141 | // Add horizontal label |
| 142 | uInt32 labelx = collX; |
| 143 | if(lwidth > uInt32(myCollision[idx]->getWidth())) |
| 144 | labelx -= (lwidth - myCollision[idx]->getWidth()) / 2; |
| 145 | else |
| 146 | labelx += (myCollision[idx]->getWidth() - lwidth) / 2; |
| 147 | |
| 148 | new StaticTextWidget(boss, lfont, labelx, ypos-lineHeight, lwidth, fontHeight, |
| 149 | colLabel[col], TextAlign::Left); |
| 150 | |
| 151 | collX += myCollision[idx]->getWidth() + 10; |
| 152 | } |
| 153 | collX = xpos + lwidth + 5; |
| 154 | collY += lineHeight+3; |
| 155 | } |
| 156 | |
| 157 | // Clear all collision bits |
| 158 | buttonX = collX + 5*(myCollision[0]->getWidth() + 10) - buttonW - 10; |
| 159 | buttonY = lineHeight == 15 ? cxclrY : cxclrY - 4; |
| 160 | b = new ButtonWidget(boss, lfont, buttonX, buttonY, buttonW, lineHeight, |
| 161 | "CXCLR" , kCxclrCmd); |
| 162 | b->setTarget(this); |
| 163 | addFocusWidget(b); |
| 164 | |
| 165 | //////////////////////////// |
| 166 | // P0 register info |
| 167 | //////////////////////////// |
| 168 | // grP0 (new) |
| 169 | xpos = 10; ypos = collY + 4; |
| 170 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight, |
| 171 | "P0" , TextAlign::Left); |
| 172 | xpos += 2*fontWidth + 5; |
| 173 | myGRP0 = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 8, 1); |
| 174 | myGRP0->setTarget(this); |
| 175 | myGRP0->setID(kGRP0ID); |
| 176 | myGRP0->clearBackgroundColor(); |
| 177 | addFocusWidget(myGRP0); |
| 178 | |
| 179 | // posP0 |
| 180 | xpos += myGRP0->getWidth() + 12; |
| 181 | t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 4*fontWidth, fontHeight, |
| 182 | "Pos#" , TextAlign::Left); |
| 183 | xpos += t->getWidth() + 2; |
| 184 | myPosP0 = new DataGridWidget(boss, nfont, xpos, ypos, |
| 185 | 1, 1, 3, 8, Common::Base::F_10); |
| 186 | myPosP0->setTarget(this); |
| 187 | myPosP0->setID(kPosP0ID); |
| 188 | myPosP0->setRange(0, 160); |
| 189 | addFocusWidget(myPosP0); |
| 190 | |
| 191 | // hmP0 |
| 192 | xpos += myPosP0->getWidth() + fontWidth + 12; |
| 193 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight, |
| 194 | "HM" , TextAlign::Left); |
| 195 | xpos += 2*fontWidth + 5; |
| 196 | myHMP0 = new DataGridWidget(boss, nfont, xpos, ypos, |
| 197 | 1, 1, 1, 4, Common::Base::F_16_1); |
| 198 | myHMP0->setTarget(this); |
| 199 | myHMP0->setID(kHMP0ID); |
| 200 | addFocusWidget(myHMP0); |
| 201 | |
| 202 | // P0 reflect |
| 203 | xpos += myHMP0->getWidth() + 15; |
| 204 | myRefP0 = new CheckboxWidget(boss, lfont, xpos, ypos+1, |
| 205 | "Reflect" , CheckboxWidget::kCheckActionCmd); |
| 206 | myRefP0->setTarget(this); |
| 207 | myRefP0->setID(kRefP0ID); |
| 208 | addFocusWidget(myRefP0); |
| 209 | |
| 210 | // P0 reset |
| 211 | xpos += myRefP0->getWidth() + 12; |
| 212 | buttonX = xpos; |
| 213 | b = new ButtonWidget(boss, lfont, xpos, ypos, buttonW, lineHeight, |
| 214 | "RESP0" , kResP0Cmd); |
| 215 | b->setTarget(this); |
| 216 | addFocusWidget(b); |
| 217 | |
| 218 | // grP0 (old) |
| 219 | xpos = 10 + 2*fontWidth + 5; ypos += myGRP0->getHeight() + 5; |
| 220 | myGRP0Old = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 8, 1); |
| 221 | myGRP0Old->setTarget(this); |
| 222 | myGRP0Old->setID(kGRP0OldID); |
| 223 | myGRP0Old->clearBackgroundColor(); |
| 224 | addFocusWidget(myGRP0Old); |
| 225 | |
| 226 | // P0 delay |
| 227 | xpos += myGRP0Old->getWidth() + 12; |
| 228 | myDelP0 = new CheckboxWidget(boss, lfont, xpos, ypos+1, |
| 229 | "VDel" , CheckboxWidget::kCheckActionCmd); |
| 230 | myDelP0->setTarget(this); |
| 231 | myDelP0->setID(kDelP0ID); |
| 232 | addFocusWidget(myDelP0); |
| 233 | |
| 234 | // NUSIZ0 (player portion) |
| 235 | xpos += myDelP0->getWidth() + 12; |
| 236 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 5*fontWidth, fontHeight, |
| 237 | "NuSiz" , TextAlign::Left); |
| 238 | xpos += 5*fontWidth + 5; |
| 239 | myNusizP0 = new DataGridWidget(boss, nfont, xpos, ypos, |
| 240 | 1, 1, 1, 3, Common::Base::F_16_1); |
| 241 | myNusizP0->setTarget(this); |
| 242 | myNusizP0->setID(kNusizP0ID); |
| 243 | addFocusWidget(myNusizP0); |
| 244 | |
| 245 | xpos += myNusizP0->getWidth() + 5; |
| 246 | myNusizP0Text = new EditTextWidget(boss, nfont, xpos, ypos, 21*fontWidth, |
| 247 | lineHeight, "" ); |
| 248 | myNusizP0Text->setEditable(false, true); |
| 249 | |
| 250 | //////////////////////////// |
| 251 | // P1 register info |
| 252 | //////////////////////////// |
| 253 | // grP1 (new) |
| 254 | xpos = 10; ypos += lineHeight + 12; |
| 255 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight, |
| 256 | "P1" , TextAlign::Left); |
| 257 | xpos += 2*fontWidth + 5; |
| 258 | myGRP1 = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 8, 1); |
| 259 | myGRP1->setTarget(this); |
| 260 | myGRP1->setID(kGRP1ID); |
| 261 | myGRP1->clearBackgroundColor(); |
| 262 | addFocusWidget(myGRP1); |
| 263 | |
| 264 | // posP1 |
| 265 | xpos += myGRP1->getWidth() + 12; |
| 266 | t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 4*fontWidth, fontHeight, |
| 267 | "Pos#" , TextAlign::Left); |
| 268 | xpos += t->getWidth() + 2; |
| 269 | myPosP1 = new DataGridWidget(boss, nfont, xpos, ypos, |
| 270 | 1, 1, 3, 8, Common::Base::F_10); |
| 271 | myPosP1->setTarget(this); |
| 272 | myPosP1->setID(kPosP1ID); |
| 273 | myPosP1->setRange(0, 160); |
| 274 | addFocusWidget(myPosP1); |
| 275 | |
| 276 | // hmP1 |
| 277 | xpos += myPosP1->getWidth() + fontWidth + 12; |
| 278 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight, |
| 279 | "HM" , TextAlign::Left); |
| 280 | xpos += 2*fontWidth + 5; |
| 281 | myHMP1 = new DataGridWidget(boss, nfont, xpos, ypos, |
| 282 | 1, 1, 1, 4, Common::Base::F_16_1); |
| 283 | myHMP1->setTarget(this); |
| 284 | myHMP1->setID(kHMP1ID); |
| 285 | addFocusWidget(myHMP1); |
| 286 | |
| 287 | // P1 reflect |
| 288 | xpos += myHMP1->getWidth() + 15; |
| 289 | myRefP1 = new CheckboxWidget(boss, lfont, xpos, ypos+1, |
| 290 | "Reflect" , CheckboxWidget::kCheckActionCmd); |
| 291 | myRefP1->setTarget(this); |
| 292 | myRefP1->setID(kRefP1ID); |
| 293 | addFocusWidget(myRefP1); |
| 294 | |
| 295 | // P1 reset |
| 296 | xpos += myRefP1->getWidth() + 12; |
| 297 | b = new ButtonWidget(boss, lfont, xpos, ypos, buttonW, lineHeight, |
| 298 | "RESP1" , kResP1Cmd); |
| 299 | b->setTarget(this); |
| 300 | addFocusWidget(b); |
| 301 | |
| 302 | // grP1 (old) |
| 303 | xpos = 10 + 2*fontWidth + 5; ypos += myGRP1->getHeight() + 5; |
| 304 | myGRP1Old = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 8, 1); |
| 305 | myGRP1Old->setTarget(this); |
| 306 | myGRP1Old->setID(kGRP1OldID); |
| 307 | myGRP1Old->clearBackgroundColor(); |
| 308 | addFocusWidget(myGRP1Old); |
| 309 | |
| 310 | // P1 delay |
| 311 | xpos += myGRP1Old->getWidth() + 12; |
| 312 | myDelP1 = new CheckboxWidget(boss, lfont, xpos, ypos+1, |
| 313 | "VDel" , CheckboxWidget::kCheckActionCmd); |
| 314 | myDelP1->setTarget(this); |
| 315 | myDelP1->setID(kDelP1ID); |
| 316 | addFocusWidget(myDelP1); |
| 317 | |
| 318 | // NUSIZ1 (player portion) |
| 319 | xpos += myDelP1->getWidth() + 12; |
| 320 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 5*fontWidth, fontHeight, |
| 321 | "NuSiz" , TextAlign::Left); |
| 322 | xpos += 5*fontWidth + 5; |
| 323 | myNusizP1 = new DataGridWidget(boss, nfont, xpos, ypos, |
| 324 | 1, 1, 1, 3, Common::Base::F_16_1); |
| 325 | myNusizP1->setTarget(this); |
| 326 | myNusizP1->setID(kNusizP1ID); |
| 327 | addFocusWidget(myNusizP1); |
| 328 | |
| 329 | xpos += myNusizP1->getWidth() + 5; |
| 330 | myNusizP1Text = new EditTextWidget(boss, nfont, xpos, ypos, 21*fontWidth, |
| 331 | lineHeight, "" ); |
| 332 | myNusizP1Text->setEditable(false, true); |
| 333 | |
| 334 | //////////////////////////// |
| 335 | // M0 register info |
| 336 | //////////////////////////// |
| 337 | // enaM0 |
| 338 | xpos = 10; ypos += lineHeight + 12; |
| 339 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight, |
| 340 | "M0" , TextAlign::Left); |
| 341 | xpos += 2*fontWidth + 5; |
| 342 | myEnaM0 = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 1, 1); |
| 343 | myEnaM0->setTarget(this); |
| 344 | myEnaM0->setID(kEnaM0ID); |
| 345 | myEnaM0->clearBackgroundColor(); |
| 346 | addFocusWidget(myEnaM0); |
| 347 | |
| 348 | // posM0 |
| 349 | xpos += myEnaM0->getWidth() + 12; |
| 350 | t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 4*fontWidth, fontHeight, |
| 351 | "Pos#" , TextAlign::Left); |
| 352 | xpos += t->getWidth() + 2; |
| 353 | myPosM0 = new DataGridWidget(boss, nfont, xpos, ypos, |
| 354 | 1, 1, 3, 8, Common::Base::F_10); |
| 355 | myPosM0->setTarget(this); |
| 356 | myPosM0->setID(kPosM0ID); |
| 357 | myPosM0->setRange(0, 160); |
| 358 | addFocusWidget(myPosM0); |
| 359 | |
| 360 | // hmM0 |
| 361 | xpos += myPosM0->getWidth() + 12; |
| 362 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight, |
| 363 | "HM" , TextAlign::Left); |
| 364 | xpos += 2*fontWidth + 5; |
| 365 | myHMM0 = new DataGridWidget(boss, nfont, xpos, ypos, |
| 366 | 1, 1, 1, 4, Common::Base::F_16_1); |
| 367 | myHMM0->setTarget(this); |
| 368 | myHMM0->setID(kHMM0ID); |
| 369 | addFocusWidget(myHMM0); |
| 370 | |
| 371 | // NUSIZ0 (missile portion) |
| 372 | xpos += myHMM0->getWidth() + 12; |
| 373 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 4*fontWidth, fontHeight, |
| 374 | "Size" , TextAlign::Left); |
| 375 | xpos += 4*fontWidth + 5; |
| 376 | myNusizM0 = new DataGridWidget(boss, nfont, xpos, ypos, |
| 377 | 1, 1, 1, 2, Common::Base::F_16_1); |
| 378 | myNusizM0->setTarget(this); |
| 379 | myNusizM0->setID(kNusizM0ID); |
| 380 | addFocusWidget(myNusizM0); |
| 381 | |
| 382 | // M0 reset to player 0 |
| 383 | xpos += myNusizM0->getWidth() + 15; |
| 384 | myResMP0 = new CheckboxWidget(boss, lfont, xpos, ypos+1, |
| 385 | "Reset to P0" , CheckboxWidget::kCheckActionCmd); |
| 386 | myResMP0->setTarget(this); |
| 387 | myResMP0->setID(kResMP0ID); |
| 388 | addFocusWidget(myResMP0); |
| 389 | |
| 390 | // M0 reset |
| 391 | xpos = buttonX; |
| 392 | b = new ButtonWidget(boss, lfont, xpos, ypos, buttonW, lineHeight, |
| 393 | "RESM0" , kResM0Cmd); |
| 394 | b->setTarget(this); |
| 395 | addFocusWidget(b); |
| 396 | |
| 397 | //////////////////////////// |
| 398 | // M1 register info |
| 399 | //////////////////////////// |
| 400 | // enaM1 |
| 401 | xpos = 10; ypos += lineHeight + 4; |
| 402 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight, |
| 403 | "M1" , TextAlign::Left); |
| 404 | xpos += 2*fontWidth + 5; |
| 405 | myEnaM1 = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 1, 1); |
| 406 | myEnaM1->setTarget(this); |
| 407 | myEnaM1->setID(kEnaM1ID); |
| 408 | myEnaM1->clearBackgroundColor(); |
| 409 | addFocusWidget(myEnaM1); |
| 410 | |
| 411 | // posM0 |
| 412 | xpos += myEnaM1->getWidth() + 12; |
| 413 | t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 4*fontWidth, fontHeight, |
| 414 | "Pos#" , TextAlign::Left); |
| 415 | xpos += t->getWidth() + 2; |
| 416 | myPosM1 = new DataGridWidget(boss, nfont, xpos, ypos, |
| 417 | 1, 1, 3, 8, Common::Base::F_10); |
| 418 | myPosM1->setTarget(this); |
| 419 | myPosM1->setID(kPosM1ID); |
| 420 | myPosM1->setRange(0, 160); |
| 421 | addFocusWidget(myPosM1); |
| 422 | |
| 423 | // hmM0 |
| 424 | xpos += myPosM1->getWidth() + 12; |
| 425 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight, |
| 426 | "HM" , TextAlign::Left); |
| 427 | xpos += 2*fontWidth + 5; |
| 428 | myHMM1 = new DataGridWidget(boss, nfont, xpos, ypos, |
| 429 | 1, 1, 1, 4, Common::Base::F_16_1); |
| 430 | myHMM1->setTarget(this); |
| 431 | myHMM1->setID(kHMM1ID); |
| 432 | addFocusWidget(myHMM1); |
| 433 | |
| 434 | // NUSIZ1 (missile portion) |
| 435 | xpos += myHMM1->getWidth() + 12; |
| 436 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 4*fontWidth, fontHeight, |
| 437 | "Size" , TextAlign::Left); |
| 438 | xpos += 4*fontWidth + 5; |
| 439 | myNusizM1 = new DataGridWidget(boss, nfont, xpos, ypos, |
| 440 | 1, 1, 1, 2, Common::Base::F_16_1); |
| 441 | myNusizM1->setTarget(this); |
| 442 | myNusizM1->setID(kNusizM1ID); |
| 443 | addFocusWidget(myNusizM1); |
| 444 | |
| 445 | // M1 reset to player 0 |
| 446 | xpos += myNusizM1->getWidth() + 15; |
| 447 | myResMP1 = new CheckboxWidget(boss, lfont, xpos, ypos+1, |
| 448 | "Reset to P1" , CheckboxWidget::kCheckActionCmd); |
| 449 | myResMP1->setTarget(this); |
| 450 | myResMP1->setID(kResMP1ID); |
| 451 | addFocusWidget(myResMP1); |
| 452 | |
| 453 | // M1 reset |
| 454 | xpos = buttonX; |
| 455 | b = new ButtonWidget(boss, lfont, xpos, ypos, buttonW, lineHeight, |
| 456 | "RESM1" , kResM1Cmd); |
| 457 | b->setTarget(this); |
| 458 | addFocusWidget(b); |
| 459 | |
| 460 | //////////////////////////// |
| 461 | // BL register info |
| 462 | //////////////////////////// |
| 463 | // enaBL |
| 464 | xpos = 10; ypos += lineHeight + 4; |
| 465 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight, |
| 466 | "BL" , TextAlign::Left); |
| 467 | xpos += 2*fontWidth + 5; |
| 468 | myEnaBL = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 1, 1); |
| 469 | myEnaBL->setTarget(this); |
| 470 | myEnaBL->setID(kEnaBLID); |
| 471 | myEnaBL->clearBackgroundColor(); |
| 472 | addFocusWidget(myEnaBL); |
| 473 | |
| 474 | // posBL |
| 475 | xpos += myEnaBL->getWidth() + 12; |
| 476 | t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 4*fontWidth, fontHeight, |
| 477 | "Pos#" , TextAlign::Left); |
| 478 | xpos += t->getWidth() + 2; |
| 479 | myPosBL = new DataGridWidget(boss, nfont, xpos, ypos, |
| 480 | 1, 1, 3, 8, Common::Base::F_10); |
| 481 | myPosBL->setTarget(this); |
| 482 | myPosBL->setID(kPosBLID); |
| 483 | myPosBL->setRange(0, 160); |
| 484 | addFocusWidget(myPosBL); |
| 485 | |
| 486 | // hmBL |
| 487 | xpos += myPosBL->getWidth() + 12; |
| 488 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight, |
| 489 | "HM" , TextAlign::Left); |
| 490 | xpos += 2*fontWidth + 5; |
| 491 | myHMBL = new DataGridWidget(boss, nfont, xpos, ypos, |
| 492 | 1, 1, 1, 4, Common::Base::F_16_1); |
| 493 | myHMBL->setTarget(this); |
| 494 | myHMBL->setID(kHMBLID); |
| 495 | addFocusWidget(myHMBL); |
| 496 | |
| 497 | // CTRLPF (size portion) |
| 498 | xpos += myHMBL->getWidth() + 12; |
| 499 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 4*fontWidth, fontHeight, |
| 500 | "Size" , TextAlign::Left); |
| 501 | xpos += 4*fontWidth + 5; |
| 502 | mySizeBL = new DataGridWidget(boss, nfont, xpos, ypos, |
| 503 | 1, 1, 1, 2, Common::Base::F_16_1); |
| 504 | mySizeBL->setTarget(this); |
| 505 | mySizeBL->setID(kSizeBLID); |
| 506 | addFocusWidget(mySizeBL); |
| 507 | |
| 508 | // Reset ball |
| 509 | xpos = buttonX; |
| 510 | b = new ButtonWidget(boss, lfont, xpos, ypos, buttonW, lineHeight, |
| 511 | "RESBL" , kResBLCmd); |
| 512 | b->setTarget(this); |
| 513 | addFocusWidget(b); |
| 514 | |
| 515 | // Ball (old) |
| 516 | xpos = 10 + 2*fontWidth + 5; ypos += myEnaBL->getHeight() + 5; |
| 517 | myEnaBLOld = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 1, 1); |
| 518 | myEnaBLOld->setTarget(this); |
| 519 | myEnaBLOld->setID(kEnaBLOldID); |
| 520 | myEnaBLOld->clearBackgroundColor(); |
| 521 | addFocusWidget(myEnaBLOld); |
| 522 | |
| 523 | // Ball delay |
| 524 | xpos += myEnaBLOld->getWidth() + 12; |
| 525 | myDelBL = new CheckboxWidget(boss, lfont, xpos, ypos+1, |
| 526 | "VDel" , CheckboxWidget::kCheckActionCmd); |
| 527 | myDelBL->setTarget(this); |
| 528 | myDelBL->setID(kDelBLID); |
| 529 | addFocusWidget(myDelBL); |
| 530 | |
| 531 | //////////////////////////// |
| 532 | // PF 0/1/2 registers |
| 533 | //////////////////////////// |
| 534 | const GUI::Font& sf = instance().frameBuffer().smallFont(); |
| 535 | const int sfWidth = sf.getMaxCharWidth(), |
| 536 | sfHeight = sf.getFontHeight(); |
| 537 | const char* const bitNames[] = { "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" }; |
| 538 | |
| 539 | // PF0 |
| 540 | xpos = 10; ypos += lineHeight + sfHeight + 6; |
| 541 | new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight, |
| 542 | "PF" , TextAlign::Left); |
| 543 | xpos += 2*fontWidth + 5; |
| 544 | myPF[0] = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 4, 1); |
| 545 | myPF[0]->setTarget(this); |
| 546 | myPF[0]->setID(kPF0ID); |
| 547 | addFocusWidget(myPF[0]); |
| 548 | |
| 549 | // PF1 |
| 550 | xpos += myPF[0]->getWidth() + 2; |
| 551 | myPF[1] = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 8, 1); |
| 552 | myPF[1]->setTarget(this); |
| 553 | myPF[1]->setID(kPF1ID); |
| 554 | addFocusWidget(myPF[1]); |
| 555 | |
| 556 | // PF2 |
| 557 | xpos += myPF[1]->getWidth() + 2; |
| 558 | myPF[2] = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 8, 1); |
| 559 | myPF[2]->setTarget(this); |
| 560 | myPF[2]->setID(kPF2ID); |
| 561 | addFocusWidget(myPF[2]); |
| 562 | |
| 563 | // PFx bit labels |
| 564 | auto start = [&](int sw) { return (sw - sfWidth) / 2; }; |
| 565 | int colw = myPF[0]->getWidth() / 4; |
| 566 | xpos = 10 + 2*fontWidth + 5 + start(colw); |
| 567 | int _ypos = ypos - sfHeight; |
| 568 | for(int i = 4; i <= 7; ++i) |
| 569 | { |
| 570 | new StaticTextWidget(boss, sf, xpos, _ypos, sfWidth, sfHeight, |
| 571 | bitNames[i], TextAlign::Left); |
| 572 | xpos += colw; |
| 573 | } |
| 574 | xpos = 10 + 2*fontWidth + 5 + myPF[0]->getWidth() + 2 + start(colw); |
| 575 | for(int i = 7; i >= 0; --i) |
| 576 | { |
| 577 | new StaticTextWidget(boss, sf, xpos, _ypos, sfWidth, sfHeight, |
| 578 | bitNames[i], TextAlign::Left); |
| 579 | xpos += colw; |
| 580 | } |
| 581 | xpos = 10 + 2*fontWidth + 5 + myPF[0]->getWidth() + 2 + |
| 582 | myPF[1]->getWidth() + 2 + start(colw); |
| 583 | for(int i = 0; i <= 7; ++i) |
| 584 | { |
| 585 | new StaticTextWidget(boss, sf, xpos, _ypos, sfWidth, sfHeight, |
| 586 | bitNames[i], TextAlign::Left); |
| 587 | xpos += colw; |
| 588 | } |
| 589 | |
| 590 | // PF reflect, score, priority |
| 591 | xpos = 10 + 4*fontWidth; ypos += lineHeight + 6; |
| 592 | myRefPF = new CheckboxWidget(boss, lfont, xpos, ypos+1, |
| 593 | "Reflect" , CheckboxWidget::kCheckActionCmd); |
| 594 | myRefPF->setTarget(this); |
| 595 | myRefPF->setID(kRefPFID); |
| 596 | addFocusWidget(myRefPF); |
| 597 | |
| 598 | xpos += myRefPF->getWidth() + 15; |
| 599 | myScorePF = new CheckboxWidget(boss, lfont, xpos, ypos+1, |
| 600 | "Score" , CheckboxWidget::kCheckActionCmd); |
| 601 | myScorePF->setTarget(this); |
| 602 | myScorePF->setID(kScorePFID); |
| 603 | addFocusWidget(myScorePF); |
| 604 | |
| 605 | xpos += myScorePF->getWidth() + 15; |
| 606 | myPriorityPF = new CheckboxWidget(boss, lfont, xpos, ypos+1, |
| 607 | "Priority" , CheckboxWidget::kCheckActionCmd); |
| 608 | myPriorityPF->setTarget(this); |
| 609 | myPriorityPF->setID(kPriorityPFID); |
| 610 | addFocusWidget(myPriorityPF); |
| 611 | |
| 612 | xpos = 10; |
| 613 | ypos += 2 * lineHeight; |
| 614 | t = new StaticTextWidget(boss, lfont, xpos, ypos, 13*fontWidth, fontHeight, |
| 615 | "Queued Writes" , TextAlign::Left); |
| 616 | |
| 617 | xpos += t->getWidth() + 10; |
| 618 | myDelayQueueWidget = new DelayQueueWidget(boss, lfont, xpos, ypos); |
| 619 | |
| 620 | //////////////////////////// |
| 621 | // Strobe buttons |
| 622 | //////////////////////////// |
| 623 | buttonX = xpos + myDelayQueueWidget->getWidth() + 20; |
| 624 | buttonY = ypos; |
| 625 | b = new ButtonWidget(boss, lfont, buttonX, buttonY, buttonW, lineHeight, |
| 626 | "WSYNC" , kWsyncCmd); |
| 627 | b->setTarget(this); |
| 628 | addFocusWidget(b); |
| 629 | |
| 630 | buttonY += lineHeight + 3; |
| 631 | b = new ButtonWidget(boss, lfont, buttonX, buttonY, buttonW, lineHeight, |
| 632 | "RSYNC" , kRsyncCmd); |
| 633 | b->setTarget(this); |
| 634 | addFocusWidget(b); |
| 635 | |
| 636 | buttonY += lineHeight + 3; |
| 637 | b = new ButtonWidget(boss, lfont, buttonX, buttonY, buttonW, lineHeight, |
| 638 | "HMOVE" , kHmoveCmd); |
| 639 | b->setTarget(this); |
| 640 | addFocusWidget(b); |
| 641 | |
| 642 | buttonY += lineHeight + 3; |
| 643 | b = new ButtonWidget(boss, lfont, buttonX, buttonY, buttonW, lineHeight, |
| 644 | "HMCLR" , kHmclrCmd); |
| 645 | b->setTarget(this); |
| 646 | addFocusWidget(b); |
| 647 | } |
| 648 | |
| 649 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 650 | void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) |
| 651 | { |
| 652 | Debugger& dbg = instance().debugger(); |
| 653 | TIADebug& tia = dbg.tiaDebug(); |
| 654 | |
| 655 | switch(cmd) |
| 656 | { |
| 657 | case kWsyncCmd: |
| 658 | tia.strobeWsync(); |
| 659 | break; |
| 660 | |
| 661 | case kRsyncCmd: |
| 662 | tia.strobeRsync(); |
| 663 | break; |
| 664 | |
| 665 | case kResP0Cmd: |
| 666 | tia.strobeResP0(); |
| 667 | break; |
| 668 | |
| 669 | case kResP1Cmd: |
| 670 | tia.strobeResP1(); |
| 671 | break; |
| 672 | |
| 673 | case kResM0Cmd: |
| 674 | tia.strobeResM0(); |
| 675 | break; |
| 676 | |
| 677 | case kResM1Cmd: |
| 678 | tia.strobeResM1(); |
| 679 | break; |
| 680 | |
| 681 | case kResBLCmd: |
| 682 | tia.strobeResBL(); |
| 683 | break; |
| 684 | |
| 685 | case kHmoveCmd: |
| 686 | tia.strobeHmove(); |
| 687 | break; |
| 688 | |
| 689 | case kHmclrCmd: |
| 690 | tia.strobeHmclr(); |
| 691 | break; |
| 692 | |
| 693 | case kCxclrCmd: |
| 694 | tia.strobeCxclr(); |
| 695 | break; |
| 696 | |
| 697 | case kDbgClCmd: |
| 698 | myFixedEnabled->setState(tia.tia().toggleFixedColors()); |
| 699 | break; |
| 700 | |
| 701 | case DataGridWidget::kItemDataChangedCmd: |
| 702 | switch(id) |
| 703 | { |
| 704 | case kColorRegsID: |
| 705 | changeColorRegs(); |
| 706 | break; |
| 707 | |
| 708 | case kPosP0ID: |
| 709 | tia.posP0(myPosP0->getSelectedValue()); |
| 710 | break; |
| 711 | |
| 712 | case kPosP1ID: |
| 713 | tia.posP1(myPosP1->getSelectedValue()); |
| 714 | break; |
| 715 | |
| 716 | case kPosM0ID: |
| 717 | tia.posM0(myPosM0->getSelectedValue()); |
| 718 | break; |
| 719 | |
| 720 | case kPosM1ID: |
| 721 | tia.posM1(myPosM1->getSelectedValue()); |
| 722 | break; |
| 723 | |
| 724 | case kPosBLID: |
| 725 | tia.posBL(myPosBL->getSelectedValue()); |
| 726 | break; |
| 727 | |
| 728 | case kHMP0ID: |
| 729 | tia.hmP0(myHMP0->getSelectedValue()); |
| 730 | break; |
| 731 | |
| 732 | case kHMP1ID: |
| 733 | tia.hmP1(myHMP1->getSelectedValue()); |
| 734 | break; |
| 735 | |
| 736 | case kHMM0ID: |
| 737 | tia.hmM0(myHMM0->getSelectedValue()); |
| 738 | break; |
| 739 | |
| 740 | case kHMM1ID: |
| 741 | tia.hmM1(myHMM1->getSelectedValue()); |
| 742 | break; |
| 743 | |
| 744 | case kHMBLID: |
| 745 | tia.hmBL(myHMBL->getSelectedValue()); |
| 746 | break; |
| 747 | |
| 748 | case kNusizP0ID: |
| 749 | tia.nusizP0(myNusizP0->getSelectedValue()); |
| 750 | myNusizP0Text->setText(tia.nusizP0String()); |
| 751 | break; |
| 752 | |
| 753 | case kNusizP1ID: |
| 754 | tia.nusizP1(myNusizP1->getSelectedValue()); |
| 755 | myNusizP1Text->setText(tia.nusizP1String()); |
| 756 | break; |
| 757 | |
| 758 | case kNusizM0ID: |
| 759 | tia.nusizM0(myNusizM0->getSelectedValue()); |
| 760 | break; |
| 761 | |
| 762 | case kNusizM1ID: |
| 763 | tia.nusizM1(myNusizM1->getSelectedValue()); |
| 764 | break; |
| 765 | |
| 766 | case kSizeBLID: |
| 767 | tia.sizeBL(mySizeBL->getSelectedValue()); |
| 768 | break; |
| 769 | |
| 770 | default: |
| 771 | cerr << "TiaWidget DG changed\n" ; |
| 772 | break; |
| 773 | } |
| 774 | break; |
| 775 | |
| 776 | case ToggleWidget::kItemDataChangedCmd: |
| 777 | switch(id) |
| 778 | { |
| 779 | case kGRP0ID: |
| 780 | tia.grP0(myGRP0->getIntState()); |
| 781 | break; |
| 782 | |
| 783 | case kGRP0OldID: |
| 784 | tia.setGRP0Old(myGRP0Old->getIntState()); |
| 785 | break; |
| 786 | |
| 787 | case kGRP1ID: |
| 788 | tia.grP1(myGRP1->getIntState()); |
| 789 | break; |
| 790 | |
| 791 | case kGRP1OldID: |
| 792 | tia.setGRP1Old(myGRP1Old->getIntState()); |
| 793 | break; |
| 794 | |
| 795 | case kEnaM0ID: |
| 796 | tia.enaM0(myEnaM0->getIntState()); |
| 797 | break; |
| 798 | |
| 799 | case kEnaM1ID: |
| 800 | tia.enaM1(myEnaM1->getIntState()); |
| 801 | break; |
| 802 | |
| 803 | case kEnaBLID: |
| 804 | tia.enaBL(myEnaBL->getIntState()); |
| 805 | break; |
| 806 | |
| 807 | case kEnaBLOldID: |
| 808 | tia.setENABLOld(myEnaBLOld->getIntState() != 0); |
| 809 | break; |
| 810 | |
| 811 | case kPF0ID: |
| 812 | tia.pf0(myPF[0]->getIntState()); |
| 813 | break; |
| 814 | |
| 815 | case kPF1ID: |
| 816 | tia.pf1(myPF[1]->getIntState()); |
| 817 | break; |
| 818 | |
| 819 | case kPF2ID: |
| 820 | tia.pf2(myPF[2]->getIntState()); |
| 821 | break; |
| 822 | } |
| 823 | break; |
| 824 | |
| 825 | case CheckboxWidget::kCheckActionCmd: |
| 826 | switch(id) |
| 827 | { |
| 828 | case kP0_PFID: |
| 829 | tia.collision(CollisionBit::P0PF, true); |
| 830 | break; |
| 831 | |
| 832 | case kP0_BLID: |
| 833 | tia.collision(CollisionBit::P0BL, true); |
| 834 | break; |
| 835 | |
| 836 | case kP0_M1ID: |
| 837 | tia.collision(CollisionBit::M1P0, true); |
| 838 | break; |
| 839 | |
| 840 | case kP0_M0ID: |
| 841 | tia.collision(CollisionBit::M0P0, true); |
| 842 | break; |
| 843 | |
| 844 | case kP0_P1ID: |
| 845 | tia.collision(CollisionBit::P0P1, true); |
| 846 | break; |
| 847 | |
| 848 | case kP1_PFID: |
| 849 | tia.collision(CollisionBit::P1PF, true); |
| 850 | break; |
| 851 | case kP1_BLID: |
| 852 | tia.collision(CollisionBit::P1BL, true); |
| 853 | break; |
| 854 | |
| 855 | case kP1_M1ID: |
| 856 | tia.collision(CollisionBit::M1P1, true); |
| 857 | break; |
| 858 | case kP1_M0ID: |
| 859 | tia.collision(CollisionBit::M0P1, true); |
| 860 | break; |
| 861 | |
| 862 | case kM0_PFID: |
| 863 | tia.collision(CollisionBit::M0PF, true); |
| 864 | break; |
| 865 | |
| 866 | case kM0_BLID: |
| 867 | tia.collision(CollisionBit::M0BL, true); |
| 868 | break; |
| 869 | |
| 870 | case kM0_M1ID: |
| 871 | tia.collision(CollisionBit::M0M1, true); |
| 872 | break; |
| 873 | |
| 874 | case kM1_PFID: |
| 875 | tia.collision(CollisionBit::M1PF, true); |
| 876 | break; |
| 877 | |
| 878 | case kM1_BLID: |
| 879 | tia.collision(CollisionBit::M1BL, true); |
| 880 | break; |
| 881 | |
| 882 | case kBL_PFID: |
| 883 | tia.collision(CollisionBit::BLPF, true); |
| 884 | break; |
| 885 | |
| 886 | case kRefP0ID: |
| 887 | tia.refP0(myRefP0->getState() ? 1 : 0); |
| 888 | break; |
| 889 | |
| 890 | case kRefP1ID: |
| 891 | tia.refP1(myRefP1->getState() ? 1 : 0); |
| 892 | break; |
| 893 | |
| 894 | case kDelP0ID: |
| 895 | tia.vdelP0(myDelP0->getState() ? 1 : 0); |
| 896 | break; |
| 897 | |
| 898 | case kDelP1ID: |
| 899 | tia.vdelP1(myDelP1->getState() ? 1 : 0); |
| 900 | break; |
| 901 | |
| 902 | case kDelBLID: |
| 903 | tia.vdelBL(myDelBL->getState() ? 1 : 0); |
| 904 | break; |
| 905 | |
| 906 | case kResMP0ID: |
| 907 | tia.resMP0(myResMP0->getState() ? 1 : 0); |
| 908 | break; |
| 909 | |
| 910 | case kResMP1ID: |
| 911 | tia.resMP1(myResMP1->getState() ? 1 : 0); |
| 912 | break; |
| 913 | |
| 914 | case kRefPFID: |
| 915 | tia.refPF(myRefPF->getState() ? 1 : 0); |
| 916 | break; |
| 917 | |
| 918 | case kScorePFID: |
| 919 | tia.scorePF(myScorePF->getState() ? 1 : 0); |
| 920 | break; |
| 921 | |
| 922 | case kPriorityPFID: |
| 923 | tia.priorityPF(myPriorityPF->getState() ? 1 : 0); |
| 924 | break; |
| 925 | } |
| 926 | break; |
| 927 | } |
| 928 | } |
| 929 | |
| 930 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 931 | void TiaWidget::loadConfig() |
| 932 | { |
| 933 | IntArray alist; |
| 934 | IntArray vlist; |
| 935 | BoolArray blist, changed, grNew, grOld; |
| 936 | |
| 937 | Debugger& dbg = instance().debugger(); |
| 938 | TIADebug& tia = dbg.tiaDebug(); |
| 939 | const TiaState& state = static_cast<const TiaState&>(tia.getState()); |
| 940 | const TiaState& oldstate = static_cast<const TiaState&>(tia.getOldState()); |
| 941 | |
| 942 | // Color registers |
| 943 | alist.clear(); vlist.clear(); changed.clear(); |
| 944 | for(uInt32 i = 0; i < 4; ++i) |
| 945 | { |
| 946 | alist.push_back(i); |
| 947 | vlist.push_back(state.coluRegs[i]); |
| 948 | changed.push_back(state.coluRegs[i] != oldstate.coluRegs[i]); |
| 949 | } |
| 950 | myColorRegs->setList(alist, vlist, changed); |
| 951 | |
| 952 | bool fixed = tia.tia().usingFixedColors(); |
| 953 | |
| 954 | myCOLUP0Color->setColor(state.coluRegs[0]); |
| 955 | myCOLUP1Color->setColor(state.coluRegs[1]); |
| 956 | myCOLUPFColor->setColor(state.coluRegs[2]); |
| 957 | myCOLUBKColor->setColor(state.coluRegs[3]); |
| 958 | myCOLUP0Color->setCrossed(fixed); |
| 959 | myCOLUP1Color->setCrossed(fixed); |
| 960 | myCOLUPFColor->setCrossed(fixed); |
| 961 | myCOLUBKColor->setCrossed(fixed); |
| 962 | |
| 963 | // Fixed debug colors |
| 964 | myFixedEnabled->setState(fixed); |
| 965 | for(uInt32 c = 0; c < 8; ++c) |
| 966 | { |
| 967 | myFixedColors[c]->setColor(state.fixedCols[c]); |
| 968 | myFixedColors[c]->setCrossed(!fixed); |
| 969 | } |
| 970 | |
| 971 | //////////////////////////// |
| 972 | // Collision register bits |
| 973 | //////////////////////////// |
| 974 | myCollision[kP0_PFID]->setState(tia.collP0_PF(), state.cx[0] != oldstate.cx[0]); |
| 975 | myCollision[kP0_BLID]->setState(tia.collP0_BL(), state.cx[1] != oldstate.cx[1]); |
| 976 | myCollision[kP0_M1ID]->setState(tia.collM1_P0(), state.cx[2] != oldstate.cx[2]); |
| 977 | myCollision[kP0_M0ID]->setState(tia.collM0_P0(), state.cx[3] != oldstate.cx[3]); |
| 978 | myCollision[kP0_P1ID]->setState(tia.collP0_P1(), state.cx[4] != oldstate.cx[4]); |
| 979 | myCollision[kP1_PFID]->setState(tia.collP1_PF(), state.cx[5] != oldstate.cx[5]); |
| 980 | myCollision[kP1_BLID]->setState(tia.collP1_BL(), state.cx[6] != oldstate.cx[6]); |
| 981 | myCollision[kP1_M1ID]->setState(tia.collM1_P1(), state.cx[7] != oldstate.cx[7]); |
| 982 | myCollision[kP1_M0ID]->setState(tia.collM0_P1(), state.cx[8] != oldstate.cx[8]); |
| 983 | myCollision[kM0_PFID]->setState(tia.collM0_PF(), state.cx[9] != oldstate.cx[9]); |
| 984 | myCollision[kM0_BLID]->setState(tia.collM0_BL(), state.cx[10] != oldstate.cx[10]); |
| 985 | myCollision[kM0_M1ID]->setState(tia.collM0_M1(), state.cx[11] != oldstate.cx[11]); |
| 986 | myCollision[kM1_PFID]->setState(tia.collM1_PF(), state.cx[12] != oldstate.cx[12]); |
| 987 | myCollision[kM1_BLID]->setState(tia.collM1_BL(), state.cx[13] != oldstate.cx[13]); |
| 988 | myCollision[kBL_PFID]->setState(tia.collBL_PF(), state.cx[14] != oldstate.cx[14]); |
| 989 | |
| 990 | //////////////////////////// |
| 991 | // P0 register info |
| 992 | //////////////////////////// |
| 993 | // grP0 (new and old) |
| 994 | if(tia.vdelP0()) |
| 995 | { |
| 996 | myGRP0->setColor(kBGColorLo); |
| 997 | myGRP0Old->setColor(state.coluRegs[0]); |
| 998 | myGRP0Old->setCrossed(false); |
| 999 | } |
| 1000 | else |
| 1001 | { |
| 1002 | myGRP0->setColor(state.coluRegs[0]); |
| 1003 | myGRP0Old->setColor(kBGColorLo); |
| 1004 | myGRP0Old->setCrossed(true); |
| 1005 | } |
| 1006 | myGRP0->setIntState(state.gr[TiaState::P0], false); |
| 1007 | myGRP0Old->setIntState(state.gr[TiaState::P0+2], false); |
| 1008 | |
| 1009 | // posP0 |
| 1010 | myPosP0->setList(0, state.pos[TiaState::P0], |
| 1011 | state.pos[TiaState::P0] != oldstate.pos[TiaState::P0]); |
| 1012 | |
| 1013 | // hmP0 |
| 1014 | myHMP0->setList(0, state.hm[TiaState::P0], |
| 1015 | state.hm[TiaState::P0] != oldstate.hm[TiaState::P0]); |
| 1016 | |
| 1017 | // refP0 & vdelP0 |
| 1018 | myRefP0->setState(tia.refP0(), state.ref[TiaState::P0] != oldstate.ref[TiaState::P0]); |
| 1019 | myDelP0->setState(tia.vdelP0(), state.vdel[TiaState::P0] != oldstate.vdel[TiaState::P0]); |
| 1020 | |
| 1021 | // NUSIZ0 (player portion) |
| 1022 | bool nusiz0changed = state.size[TiaState::P0] != oldstate.size[TiaState::P0]; |
| 1023 | myNusizP0->setList(0, state.size[TiaState::P0], nusiz0changed); |
| 1024 | myNusizP0Text->setText(tia.nusizP0String(), nusiz0changed); |
| 1025 | |
| 1026 | //////////////////////////// |
| 1027 | // P1 register info |
| 1028 | //////////////////////////// |
| 1029 | // grP1 (new and old) |
| 1030 | if(tia.vdelP1()) |
| 1031 | { |
| 1032 | myGRP1->setColor(kBGColorLo); |
| 1033 | myGRP1Old->setColor(state.coluRegs[1]); |
| 1034 | myGRP1Old->setCrossed(false); |
| 1035 | } |
| 1036 | else |
| 1037 | { |
| 1038 | myGRP1->setColor(state.coluRegs[1]); |
| 1039 | myGRP1Old->setColor(kBGColorLo); |
| 1040 | myGRP1Old->setCrossed(true); |
| 1041 | } |
| 1042 | myGRP1->setIntState(state.gr[TiaState::P1], false); |
| 1043 | myGRP1Old->setIntState(state.gr[TiaState::P1+2], false); |
| 1044 | |
| 1045 | // posP1 |
| 1046 | myPosP1->setList(0, state.pos[TiaState::P1], |
| 1047 | state.pos[TiaState::P1] != oldstate.pos[TiaState::P1]); |
| 1048 | |
| 1049 | // hmP1 |
| 1050 | myHMP1->setList(0, state.hm[TiaState::P1], |
| 1051 | state.hm[TiaState::P1] != oldstate.hm[TiaState::P1]); |
| 1052 | |
| 1053 | // refP1 & vdelP1 |
| 1054 | myRefP1->setState(tia.refP1(), state.ref[TiaState::P1] != oldstate.ref[TiaState::P1]); |
| 1055 | myDelP1->setState(tia.vdelP1(), state.vdel[TiaState::P1] != oldstate.vdel[TiaState::P1]); |
| 1056 | |
| 1057 | // NUSIZ1 (player portion) |
| 1058 | bool nusiz1changed = state.size[TiaState::P1] != oldstate.size[TiaState::P1]; |
| 1059 | myNusizP1->setList(0, state.size[TiaState::P1], nusiz1changed); |
| 1060 | myNusizP1Text->setText(tia.nusizP1String(), nusiz1changed); |
| 1061 | |
| 1062 | //////////////////////////// |
| 1063 | // M0 register info |
| 1064 | //////////////////////////// |
| 1065 | // enaM0 |
| 1066 | myEnaM0->setColor(state.coluRegs[0]); |
| 1067 | myEnaM0->setIntState(tia.enaM0() ? 1 : 0, false); |
| 1068 | |
| 1069 | // posM0 |
| 1070 | myPosM0->setList(0, state.pos[TiaState::M0], |
| 1071 | state.pos[TiaState::M0] != oldstate.pos[TiaState::M0]); |
| 1072 | |
| 1073 | // hmM0 |
| 1074 | myHMM0->setList(0, state.hm[TiaState::M0], |
| 1075 | state.hm[TiaState::M0] != oldstate.hm[TiaState::M0]); |
| 1076 | |
| 1077 | // NUSIZ0 (missile portion) |
| 1078 | myNusizM0->setList(0, state.size[TiaState::M0], |
| 1079 | state.size[TiaState::M0] != oldstate.size[TiaState::M0]); |
| 1080 | |
| 1081 | // resMP0 |
| 1082 | myResMP0->setState(tia.resMP0(), state.res[TiaState::P0] != oldstate.res[TiaState::P0]); |
| 1083 | |
| 1084 | //////////////////////////// |
| 1085 | // M1 register info |
| 1086 | //////////////////////////// |
| 1087 | // enaM1 |
| 1088 | myEnaM1->setColor(state.coluRegs[1]); |
| 1089 | myEnaM1->setIntState(tia.enaM1() ? 1 : 0, false); |
| 1090 | |
| 1091 | // posM1 |
| 1092 | myPosM1->setList(0, state.pos[TiaState::M1], |
| 1093 | state.pos[TiaState::M1] != oldstate.pos[TiaState::M1]); |
| 1094 | |
| 1095 | // hmM1 |
| 1096 | myHMM1->setList(0, state.hm[TiaState::M1], |
| 1097 | state.hm[TiaState::M1] != oldstate.hm[TiaState::M1]); |
| 1098 | |
| 1099 | // NUSIZ1 (missile portion) |
| 1100 | myNusizM1->setList(0, state.size[TiaState::M1], |
| 1101 | state.size[TiaState::M1] != oldstate.size[TiaState::M1]); |
| 1102 | |
| 1103 | // resMP1 |
| 1104 | myResMP1->setState(tia.resMP1(),state.res[TiaState::P1] != oldstate.res[TiaState::P1]); |
| 1105 | |
| 1106 | //////////////////////////// |
| 1107 | // BL register info |
| 1108 | //////////////////////////// |
| 1109 | // enaBL (new and old) |
| 1110 | if(tia.vdelBL()) |
| 1111 | { |
| 1112 | myEnaBL->setColor(kBGColorLo); |
| 1113 | myEnaBLOld->setColor(state.coluRegs[2]); |
| 1114 | myEnaBLOld->setCrossed(false); |
| 1115 | } |
| 1116 | else |
| 1117 | { |
| 1118 | myEnaBL->setColor(state.coluRegs[2]); |
| 1119 | myEnaBLOld->setColor(kBGColorLo); |
| 1120 | myEnaBLOld->setCrossed(true); |
| 1121 | } |
| 1122 | myEnaBL->setIntState(state.gr[4], false); |
| 1123 | myEnaBLOld->setIntState(state.gr[5], false); |
| 1124 | |
| 1125 | // posBL |
| 1126 | myPosBL->setList(0, state.pos[TiaState::BL], |
| 1127 | state.pos[TiaState::BL] != oldstate.pos[TiaState::BL]); |
| 1128 | |
| 1129 | // hmBL |
| 1130 | myHMBL->setList(0, state.hm[TiaState::BL], |
| 1131 | state.hm[TiaState::BL] != oldstate.hm[TiaState::BL]); |
| 1132 | |
| 1133 | // CTRLPF (size portion) |
| 1134 | mySizeBL->setList(0, state.size[TiaState::BL], |
| 1135 | state.size[TiaState::BL] != oldstate.size[TiaState::BL]); |
| 1136 | |
| 1137 | // vdelBL |
| 1138 | myDelBL->setState(tia.vdelBL(), state.vdel[2] != oldstate.vdel[2]); |
| 1139 | |
| 1140 | //////////////////////////// |
| 1141 | // PF register info |
| 1142 | //////////////////////////// |
| 1143 | // PF0 |
| 1144 | myPF[0]->setColor(state.coluRegs[2]); |
| 1145 | myPF[0]->setIntState(state.pf[0], true); // reverse bit order |
| 1146 | |
| 1147 | // PF1 |
| 1148 | myPF[1]->setColor(state.coluRegs[2]); |
| 1149 | myPF[1]->setIntState(state.pf[1], false); |
| 1150 | |
| 1151 | // PF2 |
| 1152 | myPF[2]->setColor(state.coluRegs[2]); |
| 1153 | myPF[2]->setIntState(state.pf[2], true); // reverse bit order |
| 1154 | |
| 1155 | // Reflect |
| 1156 | myRefPF->setState(tia.refPF(), state.pf[3] != oldstate.pf[3]); |
| 1157 | |
| 1158 | // Score |
| 1159 | myScorePF->setState(tia.scorePF(), state.pf[4] != oldstate.pf[4]); |
| 1160 | |
| 1161 | // Priority |
| 1162 | myPriorityPF->setState(tia.priorityPF(), state.pf[5] != oldstate.pf[5]); |
| 1163 | |
| 1164 | myDelayQueueWidget->loadConfig(); |
| 1165 | } |
| 1166 | |
| 1167 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 1168 | void TiaWidget::changeColorRegs() |
| 1169 | { |
| 1170 | int addr = myColorRegs->getSelectedAddr(); |
| 1171 | int value = myColorRegs->getSelectedValue(); |
| 1172 | |
| 1173 | switch(addr) |
| 1174 | { |
| 1175 | case kCOLUP0Addr: |
| 1176 | instance().debugger().tiaDebug().coluP0(value); |
| 1177 | myCOLUP0Color->setColor(value); |
| 1178 | break; |
| 1179 | |
| 1180 | case kCOLUP1Addr: |
| 1181 | instance().debugger().tiaDebug().coluP1(value); |
| 1182 | myCOLUP1Color->setColor(value); |
| 1183 | break; |
| 1184 | |
| 1185 | case kCOLUPFAddr: |
| 1186 | instance().debugger().tiaDebug().coluPF(value); |
| 1187 | myCOLUPFColor->setColor(value); |
| 1188 | break; |
| 1189 | |
| 1190 | case kCOLUBKAddr: |
| 1191 | instance().debugger().tiaDebug().coluBK(value); |
| 1192 | myCOLUBKColor->setColor(value); |
| 1193 | break; |
| 1194 | } |
| 1195 | } |
| 1196 | |