mirror of https://github.com/stella-emu/stella.git
a litte code cleanup
This commit is contained in:
parent
6011a0823d
commit
b6cb1734ea
|
@ -192,15 +192,12 @@ void StellaSettingsDialog::loadConfig()
|
||||||
myTVMode->setSelected(
|
myTVMode->setSelected(
|
||||||
settings.getString("tv.filter"), "0");
|
settings.getString("tv.filter"), "0");
|
||||||
|
|
||||||
// TV scanline intensity and interpolation
|
// TV scanline intensity
|
||||||
myTVScanIntense->setValue(valueToLevel(settings.getInt("tv.scanlines")));
|
myTVScanIntense->setValue(valueToLevel(settings.getInt("tv.scanlines")));
|
||||||
handleTVModeChange();
|
handleTVModeChange();
|
||||||
|
|
||||||
// TV phosphor mode
|
|
||||||
//myTVPhosphor->setState(settings.getString("tv.phosphor") == "always");
|
|
||||||
// TV phosphor blend
|
// TV phosphor blend
|
||||||
myTVPhosLevel->setValue(valueToLevel(settings.getInt("tv.phosblend")));
|
myTVPhosLevel->setValue(valueToLevel(settings.getInt("tv.phosblend")));
|
||||||
handlePhosphorChange();
|
|
||||||
|
|
||||||
// Controllers
|
// Controllers
|
||||||
Properties props;
|
Properties props;
|
||||||
|
@ -232,15 +229,15 @@ void StellaSettingsDialog::saveConfig()
|
||||||
myTVMode->getSelectedTag().toString());
|
myTVMode->getSelectedTag().toString());
|
||||||
|
|
||||||
// TV phosphor mode
|
// TV phosphor mode
|
||||||
//instance().settings().setValue("tv.phosphor",
|
|
||||||
// myTVPhosphor->getState() ? "always" : "byrom");
|
|
||||||
instance().settings().setValue("tv.phosphor",
|
instance().settings().setValue("tv.phosphor",
|
||||||
myTVPhosLevel->getValue() > 0 ? "always" : "byrom");
|
myTVPhosLevel->getValue() > 0 ? "always" : "byrom");
|
||||||
// TV phosphor blend
|
// TV phosphor blend
|
||||||
instance().settings().setValue("tv.phosblend", levelToValue(myTVPhosLevel->getValue()));
|
instance().settings().setValue("tv.phosblend",
|
||||||
|
levelToValue(myTVPhosLevel->getValue()));
|
||||||
|
|
||||||
// TV scanline intensity and interpolation
|
// TV scanline intensity and interpolation
|
||||||
instance().settings().setValue("tv.scanlines", levelToValue(myTVScanIntense->getValue()));
|
instance().settings().setValue("tv.scanlines",
|
||||||
|
levelToValue(myTVScanIntense->getValue()));
|
||||||
|
|
||||||
// Controller properties
|
// Controller properties
|
||||||
myGameProperties.set(Controller_Left, myLeftPort->getSelectedTag().toString());
|
myGameProperties.set(Controller_Left, myLeftPort->getSelectedTag().toString());
|
||||||
|
@ -268,15 +265,12 @@ void StellaSettingsDialog::setDefaults()
|
||||||
|
|
||||||
// TV effects
|
// TV effects
|
||||||
myTVMode->setSelected("0", "0");
|
myTVMode->setSelected("0", "0");
|
||||||
|
|
||||||
// TV scanline intensity
|
// TV scanline intensity
|
||||||
myTVScanIntense->setValue(4); // = 26%
|
myTVScanIntense->setValue(4); // = 26%
|
||||||
|
|
||||||
// TV phosphor blend
|
// TV phosphor blend
|
||||||
myTVPhosLevel->setValue(6); // = 45%
|
myTVPhosLevel->setValue(6); // = 45%
|
||||||
|
|
||||||
handleTVModeChange();
|
handleTVModeChange();
|
||||||
handlePhosphorChange();
|
|
||||||
|
|
||||||
// Load the default game properties
|
// Load the default game properties
|
||||||
Properties defaultProperties;
|
Properties defaultProperties;
|
||||||
|
@ -303,14 +297,9 @@ void StellaSettingsDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kTVModeChanged:
|
case kTVModeChanged:
|
||||||
case kScanlinesChanged:
|
|
||||||
handleTVModeChange();
|
handleTVModeChange();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kPhosphorChanged:
|
|
||||||
handlePhosphorChange();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Dialog::handleCommand(sender, cmd, data, 0);
|
Dialog::handleCommand(sender, cmd, data, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -411,19 +400,13 @@ void StellaSettingsDialog::handleTVModeChange()
|
||||||
myTVScanIntense->setEnabled(scanenable);
|
myTVScanIntense->setEnabled(scanenable);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void StellaSettingsDialog::handlePhosphorChange()
|
|
||||||
{
|
|
||||||
//myTVPhosLevel->setEnabled(myTVPhosphor->getState());
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
int StellaSettingsDialog::levelToValue(int level)
|
int StellaSettingsDialog::levelToValue(int level)
|
||||||
{
|
{
|
||||||
const int NUM_LEVELS = 11;
|
const int NUM_LEVELS = 11;
|
||||||
uInt8 values[NUM_LEVELS] = { 0, 5, 11, 18, 26, 35, 45, 56, 68, 81, 95 };
|
uInt8 values[NUM_LEVELS] = { 0, 5, 11, 18, 26, 35, 45, 56, 68, 81, 95 };
|
||||||
|
|
||||||
return values[level];
|
return values[std::min(level, NUM_LEVELS - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -44,7 +44,6 @@ class StellaSettingsDialog : public Dialog
|
||||||
|
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||||
void handleTVModeChange();
|
void handleTVModeChange();
|
||||||
void handlePhosphorChange();
|
|
||||||
|
|
||||||
// load the properties for the controller settings
|
// load the properties for the controller settings
|
||||||
void loadControllerProperties(const Properties& props);
|
void loadControllerProperties(const Properties& props);
|
||||||
|
@ -78,9 +77,7 @@ class StellaSettingsDialog : public Dialog
|
||||||
StaticTextWidget* myRightPortDetected;
|
StaticTextWidget* myRightPortDetected;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kTVModeChanged = 'VDtv',
|
kTVModeChanged = 'SStv',
|
||||||
kScanlinesChanged = 'VDsc',
|
|
||||||
kPhosphorChanged = 'VDph',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Game properties for currently loaded ROM
|
// Game properties for currently loaded ROM
|
||||||
|
|
Loading…
Reference in New Issue