mirror of https://github.com/stella-emu/stella.git
renamed and refined StellaSettingsDialog
added to OptionsDialog for testing
This commit is contained in:
parent
785f7dc4b0
commit
6f51b6039d
|
@ -60,6 +60,7 @@ class OSystem
|
|||
{
|
||||
friend class EventHandler;
|
||||
friend class VideoDialog;
|
||||
friend class StellaSettingsDialog;
|
||||
friend class DeveloperDialog;
|
||||
|
||||
public:
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "GameInfoDialog.hxx"
|
||||
#include "LoggerDialog.hxx"
|
||||
#include "DeveloperDialog.hxx"
|
||||
#include "StellaSettingsDialog.hxx"
|
||||
#include "HelpDialog.hxx"
|
||||
#include "AboutDialog.hxx"
|
||||
#include "OptionsDialog.hxx"
|
||||
|
@ -88,7 +89,11 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
|
|||
b = ADD_OD_BUTTON("Snapshots" + ELLIPSIS, kSnapCmd);
|
||||
wid.push_back(b);
|
||||
|
||||
yoffset += rowHeight;
|
||||
//yoffset += rowHeight;
|
||||
// R77 TEST
|
||||
b = ADD_OD_BUTTON("Stella Options" + ELLIPSIS, kStellaOptionsCmd);
|
||||
wid.push_back(b);
|
||||
|
||||
|
||||
b = ADD_OD_BUTTON("Developer" + ELLIPSIS, kDevelopCmd);
|
||||
wid.push_back(b);
|
||||
|
@ -127,6 +132,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
|
|||
myInputDialog = make_unique<InputDialog>(osystem, parent, _font, max_w, max_h);
|
||||
myUIDialog = make_unique<UIDialog>(osystem, parent, _font, boss, max_w, max_h);
|
||||
mySnapshotDialog = make_unique<SnapshotDialog>(osystem, parent, _font, max_w, max_h);
|
||||
myStellaOptionsDialog = make_unique<StellaSettingsDialog>(osystem, parent, _font, max_w, max_h);
|
||||
myDeveloperDialog = make_unique<DeveloperDialog>(osystem, parent, _font, max_w, max_h);
|
||||
myGameInfoDialog = make_unique<GameInfoDialog>(osystem, parent, _font, this, max_w, max_h);
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
|
@ -251,6 +257,21 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
}
|
||||
|
||||
case kStellaOptionsCmd:
|
||||
{
|
||||
// This dialog is resizable under certain conditions, so we need
|
||||
// to re-create it as necessary
|
||||
uInt32 w = 0, h = 0;
|
||||
|
||||
if (myStellaOptionsDialog == nullptr || myStellaOptionsDialog->shouldResize(w, h))
|
||||
{
|
||||
myStellaOptionsDialog = make_unique<StellaSettingsDialog>(instance(), parent(),
|
||||
instance().frameBuffer().font(), w, h);
|
||||
}
|
||||
myStellaOptionsDialog->open();
|
||||
break;
|
||||
}
|
||||
|
||||
case kInfoCmd:
|
||||
{
|
||||
// This dialog is resizable under certain conditions, so we need
|
||||
|
|
|
@ -39,6 +39,7 @@ class LoggerDialog;
|
|||
#include "Dialog.hxx"
|
||||
|
||||
class DeveloperDialog;
|
||||
class StellaSettingsDialog;
|
||||
|
||||
class OptionsDialog : public Dialog
|
||||
{
|
||||
|
@ -61,6 +62,7 @@ class OptionsDialog : public Dialog
|
|||
unique_ptr<UIDialog> myUIDialog;
|
||||
unique_ptr<SnapshotDialog> mySnapshotDialog;
|
||||
unique_ptr<DeveloperDialog> myDeveloperDialog;
|
||||
unique_ptr<StellaSettingsDialog> myStellaOptionsDialog;
|
||||
unique_ptr<GameInfoDialog> myGameInfoDialog;
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
unique_ptr<CheatCodeDialog> myCheatCodeDialog;
|
||||
|
@ -88,6 +90,7 @@ class OptionsDialog : public Dialog
|
|||
kCheatCmd = 'CHET',
|
||||
kLoggerCmd = 'LOGG',
|
||||
kDevelopCmd = 'DEVL',
|
||||
kStellaOptionsCmd = 'STOP',
|
||||
kHelpCmd = 'HELP',
|
||||
kAboutCmd = 'ABOU',
|
||||
kExitCmd = 'EXIM'
|
||||
|
|
|
@ -1,163 +0,0 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "NTSCFilter.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
|
||||
#include "StellaOptionsDialog.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
StellaOptionsDialog::StellaOptionsDialog(OSystem& osystem, DialogContainer& parent,
|
||||
const GUI::Font& font, int max_w, int max_h)
|
||||
: Dialog(osystem, parent, font, "Stella options")
|
||||
{
|
||||
const int VGAP = 4;
|
||||
const int VBORDER = 8*2;
|
||||
const int HBORDER = 10*2;
|
||||
const int INDENT = 20;
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontWidth = font.getMaxCharWidth(),
|
||||
buttonHeight = font.getLineHeight() + 4;
|
||||
int xpos, ypos;
|
||||
|
||||
WidgetArray wid;
|
||||
VariantList items;
|
||||
|
||||
// Set real dimensions
|
||||
setSize(33 * fontWidth + HBORDER * 2, 11 * (lineHeight + VGAP) + _th, max_w, max_h);
|
||||
|
||||
xpos = HBORDER;
|
||||
ypos = VBORDER + _th;
|
||||
|
||||
addUIOptions(wid, xpos, ypos, font);
|
||||
ypos += VGAP * 5;
|
||||
addVideoOptions(wid, xpos, ypos, font);
|
||||
ypos += VGAP * 4;
|
||||
addSoundOptions(wid, xpos, ypos, font);
|
||||
|
||||
addToFocusList(wid);
|
||||
|
||||
wid.clear();
|
||||
addDefaultsOKCancelBGroup(wid, font);
|
||||
addBGroupToFocusList(wid);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaOptionsDialog::addUIOptions(WidgetArray wid, int& xpos, int& ypos, const GUI::Font& font)
|
||||
{
|
||||
const int VGAP = 4;
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontWidth = font.getMaxCharWidth();
|
||||
VariantList items;
|
||||
int pwidth = font.getStringWidth("Bad adjust");
|
||||
|
||||
ypos += 1;
|
||||
VarList::push_back(items, "Standard", "standard");
|
||||
VarList::push_back(items, "Classic", "classic");
|
||||
VarList::push_back(items, "Light", "light");
|
||||
myThemePopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight, items, "UI Theme ");
|
||||
wid.push_back(myThemePopup);
|
||||
ypos += lineHeight;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaOptionsDialog::addVideoOptions(WidgetArray wid, int& xpos, int& ypos, const GUI::Font& font)
|
||||
{
|
||||
const int VGAP = 4;
|
||||
const int INDENT = 20;
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontWidth = font.getMaxCharWidth();
|
||||
VariantList items;
|
||||
|
||||
// TV effects options
|
||||
int swidth = font.getMaxCharWidth() * 8 - 4;
|
||||
|
||||
// TV Mode
|
||||
items.clear();
|
||||
VarList::push_back(items, "Disabled", NTSCFilter::PRESET_OFF);
|
||||
VarList::push_back(items, "RGB", NTSCFilter::PRESET_RGB);
|
||||
VarList::push_back(items, "S-Video", NTSCFilter::PRESET_SVIDEO);
|
||||
VarList::push_back(items, "Composite", NTSCFilter::PRESET_COMPOSITE);
|
||||
VarList::push_back(items, "Bad adjust", NTSCFilter::PRESET_BAD);
|
||||
int lwidth = font.getStringWidth("TV Mode ");
|
||||
int pwidth = font.getStringWidth("Bad adjust");
|
||||
|
||||
myTVMode = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
||||
items, "TV mode ", lwidth, kTVModeChanged);
|
||||
wid.push_back(myTVMode);
|
||||
ypos += lineHeight + VGAP * 2;
|
||||
|
||||
#define CREATE_CUSTOM_SLIDERS(obj, desc) \
|
||||
myTV ## obj = \
|
||||
new SliderWidget(this, font, xpos, ypos-1, swidth, lineHeight, \
|
||||
desc, lwidth, 0, fontWidth*4, "%"); \
|
||||
myTV ## obj->setMinValue(0); myTV ## obj->setMaxValue(100); \
|
||||
myTV ## obj->setTickmarkInterval(2); \
|
||||
myTV ## obj->setStepValue(10); \
|
||||
wid.push_back(myTV ## obj); \
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
lwidth = font.getStringWidth("Intensity ");
|
||||
swidth = font.getMaxCharWidth() * 10;
|
||||
|
||||
// Scanline intensity
|
||||
myTVScanlines = new CheckboxWidget(this, font, xpos, ypos + 1, "Scanlines", kScanlinesChanged);
|
||||
ypos += lineHeight;
|
||||
xpos += INDENT;
|
||||
CREATE_CUSTOM_SLIDERS(ScanIntense, "Intensity ")
|
||||
xpos -= INDENT;
|
||||
|
||||
// TV Phosphor effect
|
||||
myTVPhosphor = new CheckboxWidget(this, font, xpos, ypos + 1, "Phosphor effect", kPhosphorChanged);
|
||||
wid.push_back(myTVPhosphor);
|
||||
ypos += lineHeight;
|
||||
// TV Phosphor blend level
|
||||
xpos += INDENT;
|
||||
CREATE_CUSTOM_SLIDERS(PhosLevel, "Blend ")
|
||||
xpos -= INDENT;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaOptionsDialog::addSoundOptions(WidgetArray wid, int& xpos, int& ypos, const GUI::Font& font)
|
||||
{
|
||||
const int VGAP = 4;
|
||||
const int lineHeight = font.getLineHeight();
|
||||
|
||||
// Stereo sound
|
||||
myStereoSoundCheckbox = new CheckboxWidget(this, font, xpos, ypos + 1,
|
||||
"Stereo sound");
|
||||
wid.push_back(myStereoSoundCheckbox);
|
||||
ypos += lineHeight;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaOptionsDialog::loadConfig()
|
||||
{
|
||||
|
||||
//myTab->loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaOptionsDialog::saveConfig()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaOptionsDialog::setDefaults()
|
||||
{
|
||||
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#ifndef STELLA_OPTIONS_DIALOG_HXX
|
||||
#define STELLA_OPTIONS_DIALOG_HXX
|
||||
|
||||
class PopUpWidget;
|
||||
|
||||
#include "Dialog.hxx"
|
||||
|
||||
namespace GUI {
|
||||
class Font;
|
||||
}
|
||||
|
||||
class StellaOptionsDialog :
|
||||
public Dialog
|
||||
{
|
||||
public:
|
||||
StellaOptionsDialog(OSystem& osystem, DialogContainer& parent,
|
||||
const GUI::Font& font, int max_w, int max_h);
|
||||
virtual ~StellaOptionsDialog() = default;
|
||||
|
||||
private:
|
||||
void loadConfig() override;
|
||||
void saveConfig() override;
|
||||
void setDefaults() override;
|
||||
|
||||
void addVideoOptions(WidgetArray wid, int& xpos, int& ypos, const GUI::Font& font);
|
||||
void addSoundOptions(WidgetArray wid, int& xpos, int& ypos, const GUI::Font& font);
|
||||
void addUIOptions(WidgetArray wid, int& xpos, int& ypos, const GUI::Font& font);
|
||||
|
||||
TabWidget* myTab;
|
||||
|
||||
// TV effects adjustables (custom mode)
|
||||
PopUpWidget* myTVMode;
|
||||
SliderWidget* myTVSharp;
|
||||
SliderWidget* myTVHue;
|
||||
SliderWidget* myTVRes;
|
||||
SliderWidget* myTVArtifacts;
|
||||
SliderWidget* myTVFringe;
|
||||
SliderWidget* myTVBleed;
|
||||
SliderWidget* myTVBright;
|
||||
SliderWidget* myTVContrast;
|
||||
SliderWidget* myTVSatur;
|
||||
SliderWidget* myTVGamma;
|
||||
|
||||
// TV phosphor effect
|
||||
CheckboxWidget* myTVPhosphor;
|
||||
SliderWidget* myTVPhosLevel;
|
||||
|
||||
// TV scanline intensity and interpolation
|
||||
CheckboxWidget* myTVScanlines;
|
||||
SliderWidget* myTVScanIntense;
|
||||
|
||||
// TV effects adjustables presets (custom mode)
|
||||
ButtonWidget* myCloneComposite;
|
||||
ButtonWidget* myCloneSvideo;
|
||||
ButtonWidget* myCloneRGB;
|
||||
ButtonWidget* myCloneBad;
|
||||
ButtonWidget* myCloneCustom;
|
||||
|
||||
// Audio options
|
||||
CheckboxWidget* myStereoSoundCheckbox;
|
||||
|
||||
// UI theme
|
||||
PopUpWidget* myThemePopup;
|
||||
|
||||
enum {
|
||||
kTVModeChanged = 'VDtv',
|
||||
kCloneCompositeCmd = 'CLcp',
|
||||
kCloneSvideoCmd = 'CLsv',
|
||||
kCloneRGBCmd = 'CLrb',
|
||||
kCloneBadCmd = 'CLbd',
|
||||
kCloneCustomCmd = 'CLcu',
|
||||
kPhosphorChanged = 'VDph',
|
||||
kScanlinesChanged = 'VDsc',
|
||||
|
||||
kSoundEnableChanged = 'ADse',
|
||||
};
|
||||
|
||||
// Following constructors and assignment operators not supported
|
||||
StellaOptionsDialog() = delete;
|
||||
StellaOptionsDialog(const StellaOptionsDialog&) = delete;
|
||||
StellaOptionsDialog(StellaOptionsDialog&&) = delete;
|
||||
StellaOptionsDialog& operator=(const StellaOptionsDialog&) = delete;
|
||||
StellaOptionsDialog& operator=(StellaOptionsDialog&&) = delete;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,425 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "Console.hxx"
|
||||
#include "EventHandler.hxx"
|
||||
#include "Launcher.hxx"
|
||||
#include "PropsSet.hxx"
|
||||
#include "ControllerDetector.hxx"
|
||||
#include "NTSCFilter.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
|
||||
#include "StellaSettingsDialog.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
|
||||
const GUI::Font& font, int max_w, int max_h)
|
||||
: Dialog(osystem, parent, font, "Stella settings")
|
||||
{
|
||||
const int VGAP = 4;
|
||||
const int VBORDER = 8;
|
||||
const int HBORDER = 10;
|
||||
const int INDENT = 20;
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontWidth = font.getMaxCharWidth();
|
||||
int xpos, ypos;
|
||||
|
||||
WidgetArray wid;
|
||||
VariantList items;
|
||||
|
||||
// Set real dimensions
|
||||
setSize(33 * fontWidth + HBORDER * 2, 15 * (lineHeight + VGAP) + _th, max_w, max_h);
|
||||
|
||||
xpos = HBORDER;
|
||||
ypos = VBORDER + _th;
|
||||
|
||||
new StaticTextWidget(this, font, xpos, ypos + 1, "Global settings:");
|
||||
xpos += INDENT;
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
addUIOptions(wid, xpos, ypos, font);
|
||||
ypos += VGAP * 4;
|
||||
addVideoOptions(wid, xpos, ypos, font);
|
||||
ypos += VGAP * 4;
|
||||
|
||||
xpos -= INDENT;
|
||||
myGameSettings = new StaticTextWidget(this, font, xpos, ypos + 1, "Game settings:");
|
||||
xpos += INDENT;
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
addGameOptions(wid, xpos, ypos, font);
|
||||
|
||||
// Add Defaults, OK and Cancel buttons
|
||||
addDefaultsOKCancelBGroup(wid, font);
|
||||
|
||||
addToFocusList(wid);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaSettingsDialog::addUIOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font)
|
||||
{
|
||||
const int VGAP = 4;
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontWidth = font.getMaxCharWidth();
|
||||
VariantList items;
|
||||
int pwidth = font.getStringWidth("Bad adjust");
|
||||
|
||||
ypos += 1;
|
||||
VarList::push_back(items, "Standard", "standard");
|
||||
VarList::push_back(items, "Classic", "classic");
|
||||
VarList::push_back(items, "Light", "light");
|
||||
myThemePopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight, items, "UI theme ");
|
||||
wid.push_back(myThemePopup);
|
||||
ypos += lineHeight + VGAP;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaSettingsDialog::addVideoOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font)
|
||||
{
|
||||
const int VGAP = 4;
|
||||
const int INDENT = 20;
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontWidth = font.getMaxCharWidth();
|
||||
VariantList items;
|
||||
|
||||
// TV effects options
|
||||
int swidth = font.getMaxCharWidth() * 8 - 4;
|
||||
|
||||
// TV Mode
|
||||
items.clear();
|
||||
VarList::push_back(items, "Disabled", NTSCFilter::PRESET_OFF);
|
||||
VarList::push_back(items, "RGB", NTSCFilter::PRESET_RGB);
|
||||
VarList::push_back(items, "S-Video", NTSCFilter::PRESET_SVIDEO);
|
||||
VarList::push_back(items, "Composite", NTSCFilter::PRESET_COMPOSITE);
|
||||
VarList::push_back(items, "Bad adjust", NTSCFilter::PRESET_BAD);
|
||||
int lwidth = font.getStringWidth("TV mode ");
|
||||
int pwidth = font.getStringWidth("Bad adjust");
|
||||
|
||||
myTVMode = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
||||
items, "TV mode ", lwidth, kTVModeChanged);
|
||||
wid.push_back(myTVMode);
|
||||
ypos += lineHeight + VGAP * 2;
|
||||
|
||||
#define CREATE_CUSTOM_SLIDERS(obj, desc) \
|
||||
myTV ## obj = \
|
||||
new SliderWidget(this, font, xpos, ypos-1, swidth, lineHeight, \
|
||||
desc, lwidth, 0, fontWidth*4, "%"); \
|
||||
myTV ## obj->setMinValue(0); myTV ## obj->setMaxValue(100); \
|
||||
myTV ## obj->setTickmarkInterval(2); \
|
||||
myTV ## obj->setStepValue(10); \
|
||||
wid.push_back(myTV ## obj); \
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
lwidth = font.getStringWidth("Intensity ");
|
||||
swidth = font.getMaxCharWidth() * 10;
|
||||
|
||||
// Scanline intensity
|
||||
myTVScanlines = new StaticTextWidget(this, font, xpos, ypos + 1, "Scanlines:");
|
||||
ypos += lineHeight;
|
||||
xpos += INDENT;
|
||||
CREATE_CUSTOM_SLIDERS(ScanIntense, "Intensity ")
|
||||
xpos -= INDENT;
|
||||
|
||||
// TV Phosphor effect
|
||||
myTVPhosphor = new CheckboxWidget(this, font, xpos, ypos + 1, "Phosphor effect", kPhosphorChanged);
|
||||
wid.push_back(myTVPhosphor);
|
||||
ypos += lineHeight;
|
||||
// TV Phosphor blend level
|
||||
xpos += INDENT;
|
||||
CREATE_CUSTOM_SLIDERS(PhosLevel, "Blend ")
|
||||
xpos -= INDENT;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaSettingsDialog::addGameOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font)
|
||||
{
|
||||
const int VGAP = 4;
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontWidth = font.getMaxCharWidth();
|
||||
const GUI::Font& ifont = instance().frameBuffer().infoFont();
|
||||
VariantList ctrls;
|
||||
|
||||
ctrls.clear();
|
||||
VarList::push_back(ctrls, "Auto-detect", "AUTO");
|
||||
VarList::push_back(ctrls, "Joystick", "JOYSTICK");
|
||||
VarList::push_back(ctrls, "Paddles", "PADDLES");
|
||||
VarList::push_back(ctrls, "BoosterGrip", "BOOSTERGRIP");
|
||||
VarList::push_back(ctrls, "Driving", "DRIVING");
|
||||
VarList::push_back(ctrls, "Keyboard", "KEYBOARD");
|
||||
VarList::push_back(ctrls, "AmigaMouse", "AMIGAMOUSE");
|
||||
VarList::push_back(ctrls, "AtariMouse", "ATARIMOUSE");
|
||||
VarList::push_back(ctrls, "Trakball", "TRAKBALL");
|
||||
VarList::push_back(ctrls, "Sega Genesis", "GENESIS");
|
||||
|
||||
int pwidth = font.getStringWidth("Sega Genesis");
|
||||
myLeftPortLabel = new StaticTextWidget(this, font, xpos, ypos + 1, "Left port ");
|
||||
myLeftPort = new PopUpWidget(this, font, myLeftPortLabel->getRight(),
|
||||
myLeftPortLabel->getTop() - 1, pwidth, lineHeight, ctrls, "");
|
||||
wid.push_back(myLeftPort);
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
myLeftPortDetected = new StaticTextWidget(this, ifont, myLeftPort->getLeft(), ypos,
|
||||
"Sega Genesis detected");
|
||||
ypos += ifont.getLineHeight() + VGAP;
|
||||
|
||||
myRightPortLabel = new StaticTextWidget(this, font, xpos, ypos + 1, "Right port ");
|
||||
myRightPort = new PopUpWidget(this, font, myRightPortLabel->getRight(),
|
||||
myRightPortLabel->getTop() - 1, pwidth, lineHeight, ctrls, "");
|
||||
wid.push_back(myRightPort);
|
||||
ypos += lineHeight + VGAP;
|
||||
myRightPortDetected = new StaticTextWidget(this, ifont, myRightPort->getLeft(), ypos,
|
||||
"Sega Genesis detected");
|
||||
ypos += ifont.getLineHeight() + VGAP;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaSettingsDialog::loadConfig()
|
||||
{
|
||||
const Settings& settings = instance().settings();
|
||||
|
||||
// UI palette
|
||||
const string& theme = settings.getString("uipalette");
|
||||
myThemePopup->setSelected(theme, "standard");
|
||||
|
||||
// TV Mode
|
||||
myTVMode->setSelected(
|
||||
settings.getString("tv.filter"), "0");
|
||||
|
||||
// TV scanline intensity and interpolation
|
||||
myTVScanIntense->setValue(settings.getInt("tv.scanlines"));
|
||||
handleTVModeChange();
|
||||
|
||||
// TV phosphor mode
|
||||
myTVPhosphor->setState(settings.getString("tv.phosphor") == "always");
|
||||
// TV phosphor blend
|
||||
myTVPhosLevel->setValue(settings.getInt("tv.phosblend"));
|
||||
handlePhosphorChange();
|
||||
|
||||
// Controllers
|
||||
Properties props;
|
||||
|
||||
if (instance().hasConsole())
|
||||
{
|
||||
myGameProperties = instance().console().properties();
|
||||
}
|
||||
else
|
||||
{
|
||||
const string& md5 = instance().launcher().selectedRomMD5();
|
||||
instance().propSet().getMD5(md5, myGameProperties);
|
||||
}
|
||||
loadControllerProperties(myGameProperties);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaSettingsDialog::saveConfig()
|
||||
{
|
||||
Settings& settings = instance().settings();
|
||||
|
||||
// UI palette
|
||||
settings.setValue("uipalette",
|
||||
myThemePopup->getSelectedTag().toString());
|
||||
instance().frameBuffer().setUIPalette();
|
||||
|
||||
// TV Mode
|
||||
instance().settings().setValue("tv.filter",
|
||||
myTVMode->getSelectedTag().toString());
|
||||
|
||||
// TV phosphor mode
|
||||
instance().settings().setValue("tv.phosphor",
|
||||
myTVPhosphor->getState() ? "always" : "byrom");
|
||||
// TV phosphor blend
|
||||
instance().settings().setValue("tv.phosblend", myTVPhosLevel->getValueLabel());
|
||||
|
||||
// TV scanline intensity and interpolation
|
||||
instance().settings().setValue("tv.scanlines", myTVScanIntense->getValueLabel());
|
||||
|
||||
// Controller properties
|
||||
myGameProperties.set(Controller_Left, myLeftPort->getSelectedTag().toString());
|
||||
myGameProperties.set(Controller_Right, myRightPort->getSelectedTag().toString());
|
||||
|
||||
// Always insert; if the properties are already present, nothing will happen
|
||||
instance().propSet().insert(myGameProperties);
|
||||
instance().saveConfig();
|
||||
|
||||
// In any event, inform the Console
|
||||
if (instance().hasConsole())
|
||||
{
|
||||
instance().console().setProperties(myGameProperties);
|
||||
}
|
||||
|
||||
// Finally, issue a complete framebuffer re-initialization
|
||||
instance().createFrameBuffer();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaSettingsDialog::setDefaults()
|
||||
{
|
||||
// UI Theme
|
||||
myThemePopup->setSelected("standard");
|
||||
|
||||
// TV effects
|
||||
myTVMode->setSelected("0", "0");
|
||||
|
||||
// TV scanline intensity
|
||||
myTVScanIntense->setValue(20);
|
||||
|
||||
// TV phosphor mode
|
||||
myTVPhosphor->setState(false);
|
||||
// TV phosphor blend
|
||||
myTVPhosLevel->setValue(50);
|
||||
|
||||
handleTVModeChange();
|
||||
handlePhosphorChange();
|
||||
|
||||
// Load the default game properties
|
||||
Properties defaultProperties;
|
||||
const string& md5 = myGameProperties.get(Cartridge_MD5);
|
||||
|
||||
instance().propSet().getMD5(md5, defaultProperties, true);
|
||||
|
||||
loadControllerProperties(defaultProperties);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaSettingsDialog::handleCommand(CommandSender* sender, int cmd,
|
||||
int data, int id)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
case GuiObject::kOKCmd:
|
||||
saveConfig();
|
||||
close();
|
||||
break;
|
||||
|
||||
case GuiObject::kDefaultsCmd:
|
||||
setDefaults();
|
||||
break;
|
||||
|
||||
case kTVModeChanged:
|
||||
case kScanlinesChanged:
|
||||
handleTVModeChange();
|
||||
break;
|
||||
|
||||
case kPhosphorChanged:
|
||||
handlePhosphorChange();
|
||||
break;
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaSettingsDialog::loadControllerProperties(const Properties& props)
|
||||
{
|
||||
// Determine whether we should enable the "Game settings:"
|
||||
// We always enable it in emulation mode, or if a valid ROM is selected
|
||||
// in launcher mode
|
||||
bool enable = false;
|
||||
|
||||
// Note: The state returned seems not consistent here
|
||||
switch (instance().eventHandler().state())
|
||||
{
|
||||
case EventHandlerState::OPTIONSMENU: // game is running!
|
||||
enable = true;
|
||||
break;
|
||||
case EventHandlerState::LAUNCHER:
|
||||
enable = (instance().launcher().selectedRomMD5() != "");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
myGameSettings->setEnabled(enable);
|
||||
myLeftPort->setEnabled(enable);
|
||||
myLeftPortLabel->setEnabled(enable);
|
||||
myLeftPortDetected->setEnabled(enable);
|
||||
myRightPort->setEnabled(enable);
|
||||
myRightPortLabel->setEnabled(enable);
|
||||
myRightPortDetected->setEnabled(enable);
|
||||
|
||||
if (enable)
|
||||
{
|
||||
bool autoDetect = false;
|
||||
BytePtr image;
|
||||
string md5 = props.get(Cartridge_MD5);
|
||||
uInt32 size = 0;
|
||||
const FilesystemNode& node = FilesystemNode(instance().launcher().selectedRom());
|
||||
|
||||
// try to load the image for auto detection
|
||||
if (!instance().hasConsole() &&
|
||||
node.exists() && !node.isDirectory() && (image = instance().openROM(node, md5, size)) != nullptr)
|
||||
autoDetect = true;
|
||||
|
||||
string label = "";
|
||||
string controller = props.get(Controller_Left);
|
||||
bool swapPorts = props.get(Console_SwapPorts) == "YES";
|
||||
|
||||
myLeftPort->setSelected(controller, "AUTO");
|
||||
if (myLeftPort->getSelectedTag().toString() == "AUTO")
|
||||
{
|
||||
if (instance().hasConsole())
|
||||
label = (!swapPorts ? instance().console().leftController().name()
|
||||
: instance().console().rightController().name()) + " detected";
|
||||
else if (autoDetect)
|
||||
label = ControllerDetector::detectName(image.get(), size, controller,
|
||||
!swapPorts ? Controller::Jack::Left : Controller::Jack::Right,
|
||||
instance().settings()) + " detected";
|
||||
}
|
||||
myLeftPortDetected->setLabel(label);
|
||||
|
||||
label = "";
|
||||
controller = props.get(Controller_Right);
|
||||
|
||||
myRightPort->setSelected(controller, "AUTO");
|
||||
if (myRightPort->getSelectedTag().toString() == "AUTO")
|
||||
{
|
||||
if (instance().hasConsole())
|
||||
label = (!swapPorts ? instance().console().rightController().name()
|
||||
: instance().console().leftController().name()) + " detected";
|
||||
else if (autoDetect)
|
||||
label = ControllerDetector::detectName(image.get(), size, controller,
|
||||
!swapPorts ? Controller::Jack::Right : Controller::Jack::Left,
|
||||
instance().settings()) + " detected";
|
||||
}
|
||||
myRightPortDetected->setLabel(label);
|
||||
}
|
||||
else
|
||||
{
|
||||
myLeftPort->clearSelection();
|
||||
myRightPort->clearSelection();
|
||||
myLeftPortDetected->setLabel("");
|
||||
myRightPortDetected->setLabel("");
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaSettingsDialog::handleTVModeChange()
|
||||
{
|
||||
NTSCFilter::Preset preset = NTSCFilter::Preset(myTVMode->getSelectedTag().toInt());
|
||||
bool scanenable = preset != NTSCFilter::PRESET_OFF;
|
||||
|
||||
myTVScanlines->setEnabled(scanenable);
|
||||
myTVScanIntense->setEnabled(scanenable);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaSettingsDialog::handlePhosphorChange()
|
||||
{
|
||||
myTVPhosLevel->setEnabled(myTVPhosphor->getState());
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#ifndef STELLA_OPTIONS_DIALOG_HXX
|
||||
#define STELLA_OPTIONS_DIALOG_HXX
|
||||
|
||||
class PopUpWidget;
|
||||
|
||||
#include "Dialog.hxx"
|
||||
|
||||
namespace GUI {
|
||||
class Font;
|
||||
}
|
||||
|
||||
class StellaSettingsDialog : public Dialog
|
||||
{
|
||||
public:
|
||||
StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
|
||||
const GUI::Font& font, int max_w, int max_h);
|
||||
virtual ~StellaSettingsDialog() = default;
|
||||
|
||||
private:
|
||||
void loadConfig() override;
|
||||
void saveConfig() override;
|
||||
void setDefaults() override;
|
||||
|
||||
void addVideoOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font);
|
||||
void addUIOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font);
|
||||
void addGameOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font);
|
||||
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
void handleTVModeChange();
|
||||
void handlePhosphorChange();
|
||||
|
||||
// load the properties for the controller settings
|
||||
void loadControllerProperties(const Properties& props);
|
||||
|
||||
private:
|
||||
// UI theme
|
||||
PopUpWidget* myThemePopup;
|
||||
|
||||
// TV effects
|
||||
PopUpWidget* myTVMode;
|
||||
|
||||
// TV scanline intensity
|
||||
StaticTextWidget* myTVScanlines;
|
||||
SliderWidget* myTVScanIntense;
|
||||
|
||||
// TV phosphor effect
|
||||
CheckboxWidget* myTVPhosphor;
|
||||
SliderWidget* myTVPhosLevel;
|
||||
|
||||
// Controller properties
|
||||
StaticTextWidget* myGameSettings;
|
||||
|
||||
StaticTextWidget* myLeftPortLabel;
|
||||
StaticTextWidget* myRightPortLabel;
|
||||
PopUpWidget* myLeftPort;
|
||||
StaticTextWidget* myLeftPortDetected;
|
||||
PopUpWidget* myRightPort;
|
||||
StaticTextWidget* myRightPortDetected;
|
||||
|
||||
enum {
|
||||
kTVModeChanged = 'VDtv',
|
||||
kScanlinesChanged = 'VDsc',
|
||||
kPhosphorChanged = 'VDph',
|
||||
};
|
||||
|
||||
// Game properties for currently loaded ROM
|
||||
Properties myGameProperties;
|
||||
|
||||
// Following constructors and assignment operators not supported
|
||||
StellaSettingsDialog() = delete;
|
||||
StellaSettingsDialog(const StellaSettingsDialog&) = delete;
|
||||
StellaSettingsDialog(StellaSettingsDialog&&) = delete;
|
||||
StellaSettingsDialog& operator=(const StellaSettingsDialog&) = delete;
|
||||
StellaSettingsDialog& operator=(StellaSettingsDialog&&) = delete;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -39,6 +39,7 @@ MODULE_OBJS := \
|
|||
src/gui/RomInfoWidget.o \
|
||||
src/gui/ScrollBarWidget.o \
|
||||
src/gui/SnapshotDialog.o \
|
||||
src/gui/StellaSettingsDialog.o \
|
||||
src/gui/StringListWidget.o \
|
||||
src/gui/TabWidget.o \
|
||||
src/gui/TimeLineWidget.o \
|
||||
|
|
|
@ -500,7 +500,7 @@
|
|||
<ClCompile Include="..\gui\LoggerDialog.cxx" />
|
||||
<ClCompile Include="..\gui\RadioButtonWidget.cxx" />
|
||||
<ClCompile Include="..\gui\SnapshotDialog.cxx" />
|
||||
<ClCompile Include="..\gui\StellaOptionsDialog.cxx" />
|
||||
<ClCompile Include="..\gui\StellaSettingsDialog.cxx" />
|
||||
<ClCompile Include="..\gui\TimeLineWidget.cxx" />
|
||||
<ClCompile Include="..\gui\TimeMachine.cxx" />
|
||||
<ClCompile Include="..\gui\TimeMachineDialog.cxx" />
|
||||
|
@ -1218,7 +1218,7 @@
|
|||
<ClInclude Include="..\gui\LoggerDialog.hxx" />
|
||||
<ClInclude Include="..\gui\RadioButtonWidget.hxx" />
|
||||
<ClInclude Include="..\gui\SnapshotDialog.hxx" />
|
||||
<ClInclude Include="..\gui\StellaOptionsDialog.hxx" />
|
||||
<ClInclude Include="..\gui\StellaSettingsDialog.hxx" />
|
||||
<ClInclude Include="..\gui\TimeLineWidget.hxx" />
|
||||
<ClInclude Include="..\gui\TimeMachine.hxx" />
|
||||
<ClInclude Include="..\gui\TimeMachineDialog.hxx" />
|
||||
|
|
|
@ -957,7 +957,7 @@
|
|||
<ClCompile Include="..\debugger\gui\CartCDFInfoWidget.cxx">
|
||||
<Filter>Source Files\debugger</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\gui\StellaOptionsDialog.cxx">
|
||||
<ClCompile Include="..\gui\StellaSettingsDialog.cxx">
|
||||
<Filter>Source Files\gui</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -1958,7 +1958,7 @@
|
|||
<ClInclude Include="..\debugger\gui\CartCDFInfoWidget.hxx">
|
||||
<Filter>Header Files\debugger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\gui\StellaOptionsDialog.hxx">
|
||||
<ClInclude Include="..\gui\StellaSettingsDialog.hxx">
|
||||
<Filter>Header Files\gui</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue