fix TiaInfoWidget display

This commit is contained in:
Thomas Jentzsch 2019-08-10 22:39:02 +02:00
parent 0b2ca6572a
commit b965842975
3 changed files with 14 additions and 4 deletions

View File

@ -56,10 +56,18 @@ string Base::toString(int value, Common::Base::Format outputBase)
std::snprintf(vToS_buf, 3, "%02d", value); std::snprintf(vToS_buf, 3, "%02d", value);
break; break;
case Base::F_10_3: // base 10: 3 digits
std::snprintf(vToS_buf, 4, "%3d", value);
break;
case Base::F_10_4: // base 10: 4 digits case Base::F_10_4: // base 10: 4 digits
std::snprintf(vToS_buf, 5, "%4d", value); std::snprintf(vToS_buf, 5, "%4d", value);
break; break;
case Base::F_10_5: // base 10: 5 digits
std::snprintf(vToS_buf, 6, "%5d", value);
break;
case Base::F_16_1: // base 16: 1 byte wide case Base::F_16_1: // base 16: 1 byte wide
std::snprintf(vToS_buf, 2, hexUppercase() ? "%1X" : "%1x", value); std::snprintf(vToS_buf, 2, hexUppercase() ? "%1X" : "%1x", value);
break; break;

View File

@ -48,7 +48,9 @@ class Base
F_16_8, // base 16: 8 bytes wide F_16_8, // base 16: 8 bytes wide
F_10, // base 10: 3 or 5 bytes (depending on value) F_10, // base 10: 3 or 5 bytes (depending on value)
F_10_02, // base 10: 02 digits F_10_02, // base 10: 02 digits
F_10_3, // base 10: 3 digits
F_10_4, // base 10: 4 digits F_10_4, // base 10: 4 digits
F_10_5, // base 10: 5 digits
F_2, // base 2: 8 or 16 bits (depending on value) F_2, // base 2: 8 or 16 bits (depending on value)
F_2_8, // base 2: 1 byte (8 bits) wide F_2_8, // base 2: 1 byte (8 bits) wide
F_2_16, // base 2: 2 bytes (16 bits) wide F_2_16, // base 2: 2 bytes (16 bits) wide

View File

@ -129,19 +129,19 @@ void TiaInfoWidget::loadConfig()
TIADebug& tia = dbg.tiaDebug(); TIADebug& tia = dbg.tiaDebug();
const TiaState& oldTia = static_cast<const TiaState&>(tia.getOldState()); const TiaState& oldTia = static_cast<const TiaState&>(tia.getOldState());
myFrameCount->setText(" " + Common::Base::toString(tia.frameCount(), Common::Base::F_10), myFrameCount->setText(Common::Base::toString(tia.frameCount(), Common::Base::F_10_5),
tia.frameCount() != oldTia.info[0]); tia.frameCount() != oldTia.info[0]);
myFrameCycles->setText(" " + Common::Base::toString(tia.frameCycles(), Common::Base::F_10), myFrameCycles->setText(Common::Base::toString(tia.frameCycles(), Common::Base::F_10_5),
tia.frameCycles() != oldTia.info[1]); tia.frameCycles() != oldTia.info[1]);
myVSync->setState(tia.vsync(), tia.vsyncAsInt() != oldTia.info[2]); myVSync->setState(tia.vsync(), tia.vsyncAsInt() != oldTia.info[2]);
myVBlank->setState(tia.vblank(), tia.vblankAsInt() != oldTia.info[3]); myVBlank->setState(tia.vblank(), tia.vblankAsInt() != oldTia.info[3]);
int clk = tia.clocksThisLine(); int clk = tia.clocksThisLine();
myScanlineCount->setText(Common::Base::toString(tia.scanlines(), Common::Base::F_10), myScanlineCount->setText(Common::Base::toString(tia.scanlines(), Common::Base::F_10_3),
tia.scanlines() != oldTia.info[4]); tia.scanlines() != oldTia.info[4]);
myScanlineCountLast->setText( myScanlineCountLast->setText(
Common::Base::toString(tia.scanlinesLastFrame(), Common::Base::F_10), Common::Base::toString(tia.scanlinesLastFrame(), Common::Base::F_10_3),
tia.scanlinesLastFrame() != oldTia.info[5]); tia.scanlinesLastFrame() != oldTia.info[5]);
myScanlineCycles->setText(Common::Base::toString(clk/3, Common::Base::F_10), myScanlineCycles->setText(Common::Base::toString(clk/3, Common::Base::F_10),
clk != oldTia.info[6]); clk != oldTia.info[6]);