minor fix and some cleanup to Developer Dialog

This commit is contained in:
thrust26 2017-11-23 12:00:18 +01:00
parent e18474a5e9
commit b7794c6e64
2 changed files with 12 additions and 58 deletions

View File

@ -47,31 +47,18 @@ DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent,
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = font.getMaxCharWidth(),
buttonHeight = font.getLineHeight() + 4; buttonHeight = font.getLineHeight() + 4;
const int VBORDER = 4;
//const int HBORDER = 8;
int xpos, ypos, tabID; int xpos, ypos, tabID;
StringList actions;
// Set real dimensions // Set real dimensions
_w = std::min(51 * fontWidth + 10, max_w); _w = std::min(51 * fontWidth + 10, max_w);
_h = std::min(15 * (lineHeight + 4) + 14, max_h); _h = std::min(15 * (lineHeight + 4) + 14, max_h);
WidgetArray wid;
/*ypos = VBORDER;
myDevSettings = new CheckboxWidget(this, font, HBORDER, ypos, "Enable developer settings", kDevSettings);
wid.push_back(myDevSettings);
addToFocusList(wid);*/
// The tab widget // The tab widget
//ypos += lineHeight + 2; xpos = 2; ypos = 4;
xpos = 2; ypos = VBORDER;
myTab = new TabWidget(this, font, xpos, ypos, _w - 2 * xpos, _h - buttonHeight - 16 - ypos); myTab = new TabWidget(this, font, xpos, ypos, _w - 2 * xpos, _h - buttonHeight - 16 - ypos);
addTabWidget(myTab); addTabWidget(myTab);
addEmulationTab(font); addEmulationTab(font);
//addVideoTab(font);
//addUITab(font);
addStatesTab(font); addStatesTab(font);
addDebuggerTab(font); addDebuggerTab(font);
addDefaultOKCancelButtons(font); addDefaultOKCancelButtons(font);
@ -87,23 +74,18 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
const int INDENT = 16; const int INDENT = 16;
const int VBORDER = 8; const int VBORDER = 8;
const int VGAP = 4; const int VGAP = 4;
int ypos = VBORDER;
int ypos, tabID;
int lineHeight = font.getLineHeight(); int lineHeight = font.getLineHeight();
StringList actions; int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight();
WidgetArray wid; WidgetArray wid;
VariantList items; VariantList items;
int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight(); int tabID = myTab->addTab(" Emulation ");
tabID = myTab->addTab(" Emulation ");
ypos = VBORDER;
myDevSettings = new CheckboxWidget(myTab, font, HBORDER, ypos, "Enable developer settings", kDevSettings); myDevSettings = new CheckboxWidget(myTab, font, HBORDER, ypos, "Enable developer settings", kDevSettings);
wid.push_back(myDevSettings); wid.push_back(myDevSettings);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myFrameStats = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos, "Show frame statistics");
myFrameStats = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos, "Show frame statistics", kFrameStats);
wid.push_back(myFrameStats); wid.push_back(myFrameStats);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
@ -144,18 +126,11 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
{ {
myRandomizeCPU[i] = new CheckboxWidget(myTab, font, xpos, ypos + 2, myRandomizeCPU[i] = new CheckboxWidget(myTab, font, xpos, ypos + 2,
cpuregs[i], kRandCPUID); cpuregs[i], kRandCPUID);
//myRandomizeCPU[i]->setID(kRandCPUID);
//myRandomizeCPU[i]->setTarget(this);
//addFocusWidget(myRandomizeCPU[i]);
wid.push_back(myRandomizeCPU[i]); wid.push_back(myRandomizeCPU[i]);
xpos += CheckboxWidget::boxSize() + font.getStringWidth("XX") + 20; xpos += CheckboxWidget::boxSize() + font.getStringWidth("XX") + 20;
} }
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
/*myThumbException = new CheckboxWidget(myTab, font, HBORDER + INDENT, ypos + 1, "Thumb ARM emulation can throw an exception");
wid.push_back(myThumbException);*/
//ypos += (lineHeight + VGAP) * 2;
// debug colors // debug colors
myDebugColors = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1, "Debug colors"); myDebugColors = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1, "Debug colors");
wid.push_back(myDebugColors); wid.push_back(myDebugColors);
@ -198,20 +173,12 @@ void DeveloperDialog::addStatesTab(const GUI::Font& font)
const int INDENT = 16; const int INDENT = 16;
const int VBORDER = 8; const int VBORDER = 8;
const int VGAP = 4; const int VGAP = 4;
int ypos = VBORDER;
int ypos;
int lineHeight = font.getLineHeight(); int lineHeight = font.getLineHeight();
StringList actions;
WidgetArray wid;
int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight(); int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight();
WidgetArray wid;
int tabID = myTab->addTab("States"); int tabID = myTab->addTab("States");
ypos = VBORDER;
/*myDevSettings1 = new CheckboxWidget(myTab, font, HBORDER, ypos, "Enable developer settings", kDevSettings1);
wid.push_back(myDevSettings1);
ypos += lineHeight + VGAP*4;*/
myContinuousRewind = new CheckboxWidget(myTab, font, HBORDER, ypos + 1, "Continuous rewind", kRewind); myContinuousRewind = new CheckboxWidget(myTab, font, HBORDER, ypos + 1, "Continuous rewind", kRewind);
wid.push_back(myContinuousRewind); wid.push_back(myContinuousRewind);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
@ -385,7 +352,6 @@ void DeveloperDialog::loadConfig()
const char* const cpuregs[] = { "S", "A", "X", "Y", "P" }; const char* const cpuregs[] = { "S", "A", "X", "Y", "P" };
for(int i = 0; i < 5; ++i) for(int i = 0; i < 5; ++i)
myRandomizeCPU[i]->setState(BSPF::containsIgnoreCase(cpurandom, cpuregs[i])); myRandomizeCPU[i]->setState(BSPF::containsIgnoreCase(cpurandom, cpuregs[i]));
//myThumbException->setState(instance().settings().getBool("dev.thumb.trapfatal"));
// PAL color-loss effect // PAL color-loss effect
myColorLoss->setState(instance().settings().getBool("dev.colorloss")); myColorLoss->setState(instance().settings().getBool("dev.colorloss"));
@ -439,14 +405,11 @@ void DeveloperDialog::loadConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::saveConfig() void DeveloperDialog::saveConfig()
{ {
//TODO
// - thumbexception (commandline only yet)
bool devSettings = myDevSettings->getState(); bool devSettings = myDevSettings->getState();
instance().settings().setValue("dev.settings", devSettings); instance().settings().setValue("dev.settings", devSettings);
instance().settings().setValue("dev.stats", myFrameStats->getState()); instance().settings().setValue("dev.stats", myFrameStats->getState());
instance().frameBuffer().showFrameStats(myFrameStats->getState()); instance().frameBuffer().showFrameStats(devSettings && myFrameStats->getState());
bool is7800 = myConsole->getSelected() == 1; bool is7800 = myConsole->getSelected() == 1;
instance().settings().setValue("dev.console", is7800 ? "7800" : "2600"); instance().settings().setValue("dev.console", is7800 ? "7800" : "2600");
@ -460,7 +423,6 @@ void DeveloperDialog::saveConfig()
if(myRandomizeCPU[i]->getState()) if(myRandomizeCPU[i]->getState())
cpurandom += cpuregs[i]; cpurandom += cpuregs[i];
instance().settings().setValue("dev.cpurandom", cpurandom); instance().settings().setValue("dev.cpurandom", cpurandom);
//instance().settings().setValue("dev.thumb.trapfatal", myThumbException->getState());
// jitter // jitter
instance().settings().setValue("dev.tv.jitter", myTVJitter->getState()); instance().settings().setValue("dev.tv.jitter", myTVJitter->getState());
@ -500,6 +462,7 @@ void DeveloperDialog::saveConfig()
instance().settings().setValue("dev.rewind.size", myStateSize->getValue()); instance().settings().setValue("dev.rewind.size", myStateSize->getValue());
instance().settings().setValue("dev.rewind.interval", myStateInterval->getValue()); instance().settings().setValue("dev.rewind.interval", myStateInterval->getValue());
instance().settings().setValue("dev.rewind.horizon", myStateHorizon->getValue()); instance().settings().setValue("dev.rewind.horizon", myStateHorizon->getValue());
// TODO: update RewindManager
// define interval growth factor // define interval growth factor
uInt32 size = myStateSize->getValue(); uInt32 size = myStateSize->getValue();
@ -560,7 +523,6 @@ void DeveloperDialog::setDefaults()
myRandomizeRAM->setState(true); myRandomizeRAM->setState(true);
for(int i = 0; i < 5; ++i) for(int i = 0; i < 5; ++i)
myRandomizeCPU[i]->setState(true); myRandomizeCPU[i]->setState(true);
//myThumbException->setState(false);
// PAL color-loss effect // PAL color-loss effect
myColorLoss->setState(true); myColorLoss->setState(true);
@ -615,13 +577,8 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in
switch(cmd) switch(cmd)
{ {
case kDevSettings: case kDevSettings:
//myDevSettings1->setState(myDevSettings->getState());
handleDeveloperOptions(); handleDeveloperOptions();
break; break;
/*case kDevSettings1:
myDevSettings->setState(myDevSettings1->getState());
handleDeveloperOptions();
break;*/
case kConsole: case kConsole:
handleConsole(); handleConsole();
@ -702,7 +659,6 @@ void DeveloperDialog::handleDeveloperOptions()
myRandomizeCPULabel->setEnabled(enable); myRandomizeCPULabel->setEnabled(enable);
for(int i = 0; i < 5; ++i) for(int i = 0; i < 5; ++i)
myRandomizeCPU[i]->setEnabled(enable); myRandomizeCPU[i]->setEnabled(enable);
//myThumbException->setEnabled(enable);
handleConsole(); handleConsole();
// TIA // TIA

View File

@ -53,7 +53,6 @@ class DeveloperDialog : public Dialog
enum enum
{ {
kDevSettings = 'DVst', kDevSettings = 'DVst',
kFrameStats = 'DVfs',
kConsole = 'DVco', kConsole = 'DVco',
kRandRAMID = 'DVrm', kRandRAMID = 'DVrm',
kRandCPUID = 'DVcp', kRandCPUID = 'DVcp',
@ -72,6 +71,7 @@ class DeveloperDialog : public Dialog
}; };
static const int NUM_INTERVALS = 6; static const int NUM_INTERVALS = 6;
// TODO: check for intervals shorter than 1 frame (adjust horizon too!)
const string INTERVALS[NUM_INTERVALS] = { "1 scanline", "50 scanlines", "1 frame", "10 frames", const string INTERVALS[NUM_INTERVALS] = { "1 scanline", "50 scanlines", "1 frame", "10 frames",
"1 second", "10 seconds" }; "1 second", "10 seconds" };
const uInt32 INTERVAL_CYCLES[NUM_INTERVALS] = { 76, 76 * 50, 76 * 262, 76 * 262 * 10, const uInt32 INTERVAL_CYCLES[NUM_INTERVALS] = { 76, 76 * 50, 76 * 262, 76 * 262 * 10,
@ -92,7 +92,6 @@ class DeveloperDialog : public Dialog
CheckboxWidget* myRandomizeRAM; CheckboxWidget* myRandomizeRAM;
StaticTextWidget* myRandomizeCPULabel; StaticTextWidget* myRandomizeCPULabel;
CheckboxWidget* myRandomizeCPU[5]; CheckboxWidget* myRandomizeCPU[5];
//CheckboxWidget* myThumbException;
CheckboxWidget* myColorLoss; CheckboxWidget* myColorLoss;
CheckboxWidget* myTVJitter; CheckboxWidget* myTVJitter;
SliderWidget* myTVJitterRec; SliderWidget* myTVJitterRec;
@ -109,7 +108,7 @@ class DeveloperDialog : public Dialog
StaticTextWidget* myStateHorizonLabel; StaticTextWidget* myStateHorizonLabel;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
// Debugger options // Debugger UI
SliderWidget* myDebuggerWidthSlider; SliderWidget* myDebuggerWidthSlider;
StaticTextWidget* myDebuggerWidthLabel; StaticTextWidget* myDebuggerWidthLabel;
SliderWidget* myDebuggerHeightSlider; SliderWidget* myDebuggerHeightSlider;
@ -135,8 +134,7 @@ class DeveloperDialog : public Dialog
void handleRewind(); void handleRewind();
void handleSize(); void handleSize();
void handleInterval(); void handleInterval();
void handleHorizon(); void handleHorizon();
void handleFontSize(); void handleFontSize();
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported