mirror of https://github.com/stella-emu/stella.git
Removed 'launcherexts' and associated LauncherFilterDialog.
Introduced 'launcherroms' argument, which specifies to show only ROMs or all files in the launcher. This functionality is tied to a RMB context menu in the launcher; eventually we may add a checkbox to the UI for it.
This commit is contained in:
parent
70ec216d1a
commit
65d23b4a6e
35
Changes.txt
35
Changes.txt
|
@ -17,19 +17,19 @@
|
|||
* Note: because of major TIA sound changes, the state file format has
|
||||
changed, and old state files will not work with this release.
|
||||
|
||||
* New cycle exact audio core based on work by Chris Brenner (crispy); greatly
|
||||
improved audio emulation accuracy (i.e. E.T., Ms. Pacman).
|
||||
* New cycle exact audio core based on work by Chris Brenner (crispy);
|
||||
greatly improved audio emulation accuracy (i.e. E.T., Ms. Pacman).
|
||||
|
||||
* Full rewrite of the audio subsystem; resample TIA output to target sample
|
||||
rate directly in Stella.
|
||||
* Full rewrite of the audio subsystem; resample TIA output to target
|
||||
sample rate directly in Stella.
|
||||
|
||||
* Added option to force stereo sound for all ROMs, or to use the setting
|
||||
on a per-ROM basis.
|
||||
* Added option to force stereo sound for all ROMs, or to use the
|
||||
setting on a per-ROM basis.
|
||||
|
||||
* Threading: decouple emulation from frame rendering.
|
||||
|
||||
* Main loop rewritten; emulating speed and timing is now much more faithful
|
||||
(i.e. speed in Pick'n'Pile).
|
||||
* Main loop rewritten; emulating speed and timing is now much more
|
||||
faithful (i.e. speed in Pick'n'Pile).
|
||||
|
||||
* Audio settings replaced with new 'audio.xxx' settings.
|
||||
|
||||
|
@ -43,10 +43,21 @@
|
|||
* UI modernization (new widget look, dialog titles added, dialogs
|
||||
refactored).
|
||||
|
||||
* Fixed excessive CPU usage while in UI modes (ROM launcher, debugger, etc).
|
||||
* Fixed excessive CPU usage while in UI modes (ROM launcher, debugger,
|
||||
etc).
|
||||
|
||||
* The bankswitch scheme can now be forced by naming the ROM with a
|
||||
specific extension (ie: .f8s for F8SC, .fe for FE, etc). The
|
||||
supported extensions are the same as the ones from HarmonyCart and
|
||||
UnoCart.
|
||||
|
||||
* The 'launcherexts' option has been replaced by a true/false option
|
||||
named 'launcherroms', which specifies to show only ROMs or all files
|
||||
in the ROM launcher.
|
||||
|
||||
* Changes in 'Game Properties' dialog
|
||||
- 'Default' button now affects only current tab like in all other dialogs.
|
||||
- 'Default' button now affects only current tab like in all other
|
||||
dialogs.
|
||||
- 'Display' and 'Console' tab changes are now immediate.
|
||||
- Fixed bug when selecting 'Auto-detect' format for 50Hz ROMs
|
||||
|
||||
|
@ -78,8 +89,8 @@
|
|||
* The UNIX builds now use the system-installed PNG and ZLIB libraries
|
||||
by default.
|
||||
|
||||
* For better compatibility, the Windows 32-bit version does not require SSE2
|
||||
anymore.
|
||||
* For better compatibility, the Windows 32-bit version does not require
|
||||
SSE2 anymore.
|
||||
|
||||
* Updated included PNG library to latest stable version.
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.5 KiB |
|
@ -42,7 +42,7 @@
|
|||
<li><a href="#ROMInfo">ROM Launcher</a></li>
|
||||
<ul>
|
||||
<li><a href="#ROMInfoViewer">ROM Launcher Viewer</a></li>
|
||||
<li><a href="#ROMLauchnerContextMenu">ROM Launcher Context Menu</a></li>
|
||||
<li><a href="#ROMLauncherContextMenu">ROM Launcher Context Menu</a></li>
|
||||
</ul>
|
||||
<li><a href="#ROMAudit">ROM Audit Mode</a></li>
|
||||
<li><a href="#Adaptor">Stelladaptor/2600-daptor Support</a></li>
|
||||
|
@ -255,8 +255,10 @@
|
|||
<li>Supports high quality TIA emulation using the TIA core from
|
||||
<a href="https://github.com/6502ts/6502.ts">6502.ts</a> by
|
||||
Christian Speckner</li>
|
||||
<li>Supports high quality sound emulation using code derived from Ron Fries'
|
||||
TIA Sound Emulation library, including stereo sound support</li>
|
||||
<li>Supports high quality sound emulation using code derived from Chris Brenner's
|
||||
Atari 2600 FPGA project, including cycle-accurate audio, analog interference
|
||||
from mixing of audio channels, as well as stereo sound support; dynamic
|
||||
sound resampling is also included</li>
|
||||
<li>Emulates the Atari 2600 Joystick Controllers using your computer's keyboard,
|
||||
joysticks or mouse</li>
|
||||
<li>Emulates the Atari 2600 Keyboard Controllers using your computer's keyboard</li>
|
||||
|
@ -287,6 +289,7 @@
|
|||
<li>Supports DPC+/CDF bankswitching schemes from the <a href="http://harmony.atariage.com">Harmony Cart</a>,
|
||||
including <a href="http://thumbulator.blogspot.ca">partial emulation of the ARM processor</a></li>
|
||||
<li>Supports cartridge autodetection for almost all bankswitching schemes</li>
|
||||
<li>Supports using ROM filename extensions to force specific bankswitching schemes</li>
|
||||
<li>Supports Supercharger single-load and multi-load games</li>
|
||||
<li>Supports ROMs stored in ZIP and GZIP format, as well as the usual raw A26/BIN/ROM formats</li>
|
||||
<li>Supports property file for setting the properties associated with games</li>
|
||||
|
@ -2227,11 +2230,9 @@
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-launcherexts <allfiles|allroms|LIST></pre></td>
|
||||
<td>Specifies which files to show in the ROM launcher
|
||||
('allfiles' is self-explanatory, 'allroms' is all files
|
||||
with valid rom extensions (currently: a26, bin, rom,
|
||||
gz, zip), 'LIST' is a ':' separated list of valid rom extensions.</td>
|
||||
<td><pre>-launcherroms <1|0></pre></td>
|
||||
<td>Specifies whether to show ROMs only (the default) or all
|
||||
files in the ROM launcher.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
@ -2901,7 +2902,7 @@
|
|||
case sensitive, so you don't need to worry about capital or lower-case
|
||||
letters.</p>
|
||||
|
||||
<h3><b><a name="ROMLauchnerContextMenu">ROM Lauchner Context Menu</a></b></h3>
|
||||
<h3><b><a name="ROMLauncherContextMenu">ROM Launcher Context Menu</a></b></h3>
|
||||
|
||||
<p>The ROM launcher also contains a context menu, selected by clicking the
|
||||
right mouse button anywhere in the current window. This context menu
|
||||
|
@ -2938,23 +2939,14 @@
|
|||
</table>
|
||||
</li>
|
||||
|
||||
<li><p><b>Filter listing</b>: Selecting this option shows a dialog whereby
|
||||
one can filter the types of files shown in the listing. The dialog is as
|
||||
follows:</p>
|
||||
<p><img src="graphics/launcher_filter.png"></p>
|
||||
<p>Currently, the choices are as follows:</p>
|
||||
<p><ul>
|
||||
<li><b>All files</b> - self explanatory, show all files in the ROM
|
||||
listing. This is the default, and emulates the behaviour of
|
||||
all previous versions of Stella.</li>
|
||||
<li><b>All roms</b> - show only files with a valid ROM extension.
|
||||
Currently, this means extensions .a26, .bin, .rom, .gz, .zip.</li>
|
||||
<li><b>ROMs ending with</b> - show only files with a ROM extension
|
||||
as selected from the checkboxes.</li>
|
||||
</ul></p>
|
||||
</li>
|
||||
|
||||
<li><b>Reload listing</b>: Selecting this performs a reload of the
|
||||
<br><li><b>Show only ROM files</b>: Selecting this reloads the current listing,
|
||||
showing only files that have a valid ROM extension.</li>
|
||||
|
||||
<br><li><b>Show all files</b>: Selecting this reloads the current listing,
|
||||
showing <i>all</i> files (with no restriction on file name).</li>
|
||||
|
||||
<br><li><b>Reload listing</b>: Selecting this performs a reload of the
|
||||
current listing. It is an alternative to pressing the Control-r
|
||||
key combo.</li>
|
||||
</ol></p>
|
||||
|
|
|
@ -115,7 +115,7 @@ Settings::Settings(OSystem& osystem)
|
|||
setInternal("exitlauncher", "false");
|
||||
setInternal("launcherres", GUI::Size(900, 600));
|
||||
setInternal("launcherfont", "medium");
|
||||
setInternal("launcherexts", "allroms");
|
||||
setInternal("launcherroms", "true");
|
||||
setInternal("romviewer", "1");
|
||||
setInternal("lastrom", "");
|
||||
|
||||
|
@ -536,10 +536,7 @@ void Settings::usage() const
|
|||
<< " -launcherres <WxH> The resolution to use in ROM launcher mode\n"
|
||||
<< " -launcherfont <small|medium| Use the specified font in the ROM launcher\n"
|
||||
<< " large>\n"
|
||||
<< " -launcherexts <allfiles| Show files with the given extensions in ROM\n"
|
||||
<< " launcher\n"
|
||||
<< " allroms| (exts is a ':' separated list of extensions)\n"
|
||||
<< " exts\n"
|
||||
<< " -launcherroms <1|0> Show only ROMs in the launcher (vs. all files)\n"
|
||||
<< " -romviewer <0|1|2> Show ROM info viewer at given zoom level in ROM\n"
|
||||
<< " launcher (0 for off)\n"
|
||||
<< " -listdelay <delay> Time to wait between keypresses in list widgets\n"
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "MD5.hxx"
|
||||
#include "OptionsDialog.hxx"
|
||||
#include "GlobalPropsDialog.hxx"
|
||||
#include "LauncherFilterDialog.hxx"
|
||||
#include "MessageBox.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
|
@ -179,7 +178,8 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
|
|||
// Create context menu for ROM list options
|
||||
VariantList l;
|
||||
VarList::push_back(l, "Power-on options" + ELLIPSIS, "override");
|
||||
VarList::push_back(l, "Filter listing" + ELLIPSIS, "filter");
|
||||
VarList::push_back(l, "Show only ROM files" + ELLIPSIS, "roms");
|
||||
VarList::push_back(l, "Show all files" + ELLIPSIS, "allfiles");
|
||||
VarList::push_back(l, "Reload listing", "reload");
|
||||
myMenu = make_unique<ContextMenu>(this, osystem.frameBuffer().font(), l);
|
||||
|
||||
|
@ -187,11 +187,8 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
|
|||
// ROM properties
|
||||
myGlobalProps = make_unique<GlobalPropsDialog>(this, osystem.frameBuffer().font());
|
||||
|
||||
// Create dialog whereby the files shown in the ROM listing can be customized
|
||||
myFilters = make_unique<LauncherFilterDialog>(this, osystem.frameBuffer().font());
|
||||
|
||||
// Figure out which filters are needed for the ROM listing
|
||||
setListFilters();
|
||||
// Do we show only ROMs or all files?
|
||||
showOnlyROMs(instance().settings().getBool("launcherroms"));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -292,16 +289,9 @@ void LauncherDialog::loadDirListing()
|
|||
bool isDir = f.isDirectory();
|
||||
const string& name = isDir ? (" [" + f.getName() + "]") : f.getName();
|
||||
|
||||
// Honour the filtering settings
|
||||
// Showing only certain ROM extensions is determined by the extension
|
||||
// that we want - if there are no extensions, it implies show all files
|
||||
// In this way, showing all files is on the 'fast code path'
|
||||
if(!isDir && myRomExts.size() > 0)
|
||||
{
|
||||
// Skip over those names we've filtered out
|
||||
if(!LauncherFilterDialog::isValidRomName(name, myRomExts))
|
||||
continue;
|
||||
}
|
||||
// Do we want to show only ROMs or all files?
|
||||
if(!isDir && myShowOnlyROMs && !Bankswitch::isValidRomName(f))
|
||||
continue;
|
||||
|
||||
// Skip over files that don't match the pattern in the 'pattern' textbox
|
||||
if(domatch && !isDir && !matchPattern(name, myPattern->getText()))
|
||||
|
@ -347,9 +337,10 @@ void LauncherDialog::handleContextMenu()
|
|||
{
|
||||
myGlobalProps->open();
|
||||
}
|
||||
else if(cmd == "filter")
|
||||
else if(cmd == "roms" || cmd == "allfiles")
|
||||
{
|
||||
myFilters->open();
|
||||
showOnlyROMs(cmd == "roms");
|
||||
updateListing();
|
||||
}
|
||||
else if(cmd == "reload")
|
||||
{
|
||||
|
@ -358,11 +349,10 @@ void LauncherDialog::handleContextMenu()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherDialog::setListFilters()
|
||||
void LauncherDialog::showOnlyROMs(bool state)
|
||||
{
|
||||
const string& exts = instance().settings().getString("launcherexts");
|
||||
myRomExts.clear();
|
||||
LauncherFilterDialog::parseExts(myRomExts, exts);
|
||||
myShowOnlyROMs = state;
|
||||
instance().settings().setValue("launcherroms", state);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -511,8 +501,8 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
updateListing();
|
||||
break;
|
||||
|
||||
case kReloadFiltersCmd:
|
||||
setListFilters();
|
||||
case kOnlyROMsCmd:
|
||||
showOnlyROMs(data); // NOTE: present for when we add a widget for this
|
||||
updateListing();
|
||||
break;
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ class GameList;
|
|||
class BrowserDialog;
|
||||
class OptionsDialog;
|
||||
class GlobalPropsDialog;
|
||||
class LauncherFilterDialog;
|
||||
class OSystem;
|
||||
class Properties;
|
||||
class EditTextWidget;
|
||||
|
@ -47,10 +46,10 @@ class LauncherDialog : public Dialog
|
|||
public:
|
||||
// These must be accessible from dialogs created by this class
|
||||
enum {
|
||||
kLoadROMCmd = 'STRT', // load currently selected ROM
|
||||
kRomDirChosenCmd = 'romc', // rom dir chosen
|
||||
kReloadRomDirCmd = 'rdrl', // reload the current listing
|
||||
kReloadFiltersCmd = 'rlfl' // reload filtering options and current listing
|
||||
kLoadROMCmd = 'STRT', // load currently selected ROM
|
||||
kRomDirChosenCmd = 'romc', // rom dir chosen
|
||||
kReloadRomDirCmd = 'rdrl', // reload the current listing
|
||||
kOnlyROMsCmd = 'rdor' // what to show has changed (ROMs vs. all files)
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -88,7 +87,7 @@ class LauncherDialog : public Dialog
|
|||
void loadDirListing();
|
||||
void loadRomInfo();
|
||||
void handleContextMenu();
|
||||
void setListFilters();
|
||||
void showOnlyROMs(bool state);
|
||||
bool matchPattern(const string& s, const string& pattern) const;
|
||||
|
||||
private:
|
||||
|
@ -96,7 +95,6 @@ class LauncherDialog : public Dialog
|
|||
unique_ptr<GameList> myGameList;
|
||||
unique_ptr<ContextMenu> myMenu;
|
||||
unique_ptr<GlobalPropsDialog> myGlobalProps;
|
||||
unique_ptr<LauncherFilterDialog> myFilters;
|
||||
unique_ptr<BrowserDialog> myRomDir;
|
||||
|
||||
ButtonWidget* myStartButton;
|
||||
|
@ -116,7 +114,7 @@ class LauncherDialog : public Dialog
|
|||
FilesystemNode myCurrentNode;
|
||||
Common::FixedStack<string> myNodeNames;
|
||||
|
||||
StringList myRomExts;
|
||||
bool myShowOnlyROMs;
|
||||
|
||||
enum {
|
||||
kPrevDirCmd = 'PRVD',
|
||||
|
|
|
@ -1,224 +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-2018 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 "bspf.hxx"
|
||||
#include "Dialog.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "FSNode.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "Font.hxx"
|
||||
#include "LauncherDialog.hxx"
|
||||
#include "LauncherFilterDialog.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LauncherFilterDialog::LauncherFilterDialog(GuiObject* boss, const GUI::Font& font)
|
||||
: Dialog(boss->instance(), boss->parent(), font, "Filter file list"),
|
||||
CommandSender(boss)
|
||||
{
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
buttonWidth = font.getStringWidth("Defaults") + 20,
|
||||
buttonHeight = font.getLineHeight() + 4;
|
||||
int xpos, ypos;
|
||||
int lwidth = font.getStringWidth("Show "),
|
||||
pwidth = font.getStringWidth("ROMs ending with");
|
||||
WidgetArray wid;
|
||||
VariantList items;
|
||||
|
||||
// Set real dimensions
|
||||
_w = 3 * buttonWidth + 20 + 4 * 8;
|
||||
|
||||
xpos = 10; ypos = 10 + _th;
|
||||
|
||||
// Types of files to show
|
||||
VarList::push_back(items, "All files", "allfiles");
|
||||
VarList::push_back(items, "All ROMs", "allroms");
|
||||
VarList::push_back(items, "ROMs ending with", "__EXTS");
|
||||
myFileType =
|
||||
new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight, items,
|
||||
"Show ", lwidth, kFileTypeChanged);
|
||||
wid.push_back(myFileType);
|
||||
ypos += lineHeight + 10;
|
||||
|
||||
// Different types of ROM extensions
|
||||
xpos += font.getStringWidth("Show ");
|
||||
myRomType[0] = new CheckboxWidget(this, font, xpos, ypos, ourRomTypes[0][0]);
|
||||
int rightcol = xpos + myRomType[0]->getWidth() + 8 * 3;
|
||||
myRomType[3] = new CheckboxWidget(this, font, rightcol, ypos, ourRomTypes[0][3]);
|
||||
ypos += lineHeight + 4;
|
||||
myRomType[1] = new CheckboxWidget(this, font, xpos, ypos, ourRomTypes[0][1]);
|
||||
myRomType[4] = new CheckboxWidget(this, font, rightcol, ypos, ourRomTypes[0][4]);
|
||||
ypos += lineHeight + 4;
|
||||
myRomType[2] = new CheckboxWidget(this, font, xpos, ypos, ourRomTypes[0][2]);
|
||||
ypos += lineHeight + 10;
|
||||
|
||||
_h = ypos + buttonHeight + 20;
|
||||
|
||||
// Add Defaults, OK and Cancel buttons
|
||||
addDefaultsOKCancelBGroup(wid, font);
|
||||
|
||||
addToFocusList(wid);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherFilterDialog::parseExts(StringList& list, const string& type)
|
||||
{
|
||||
// Assume the list is empty before this method is called
|
||||
if(type == "allroms")
|
||||
{
|
||||
for(uInt32 i = 0; i < 5; ++i)
|
||||
list.push_back(ourRomTypes[1][i]);
|
||||
}
|
||||
else if(type != "allfiles")
|
||||
{
|
||||
// Since istringstream swallows whitespace, we have to make the
|
||||
// delimiters be spaces
|
||||
string exts = type, ext;
|
||||
replace(exts.begin(), exts.end(), ':', ' ');
|
||||
istringstream buf(exts);
|
||||
|
||||
while(buf >> ext)
|
||||
{
|
||||
for(uInt32 i = 0; i < 5; ++i)
|
||||
{
|
||||
if(ourRomTypes[1][i] == ext)
|
||||
{
|
||||
list.push_back(ext);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool LauncherFilterDialog::isValidRomName(const string& name,
|
||||
const StringList& exts)
|
||||
{
|
||||
string::size_type idx = name.find_last_of('.');
|
||||
if(idx != string::npos)
|
||||
{
|
||||
const char* const ext = name.c_str() + idx + 1;
|
||||
|
||||
for(const auto& s: exts)
|
||||
if(BSPF::equalsIgnoreCase(ext, s))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherFilterDialog::loadConfig()
|
||||
{
|
||||
handleFileTypeChange(instance().settings().getString("launcherexts"));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherFilterDialog::saveConfig()
|
||||
{
|
||||
const string& type = myFileType->getSelectedTag().toString();
|
||||
if(type == "allfiles" || type == "allroms")
|
||||
instance().settings().setValue("launcherexts", type);
|
||||
else
|
||||
{
|
||||
ostringstream buf;
|
||||
for(uInt32 i = 0; i < 5; ++i)
|
||||
if(myRomType[i]->getState())
|
||||
buf << ourRomTypes[1][i] << ":";
|
||||
|
||||
// No ROMs selected means use all files
|
||||
if(buf.str() == "")
|
||||
instance().settings().setValue("launcherexts", "allfiles");
|
||||
else
|
||||
instance().settings().setValue("launcherexts", buf.str());
|
||||
}
|
||||
|
||||
// Let parent know about the changes
|
||||
sendCommand(LauncherDialog::kReloadFiltersCmd, 0, 0);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherFilterDialog::setDefaults()
|
||||
{
|
||||
handleFileTypeChange("allroms");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherFilterDialog::handleFileTypeChange(const string& type)
|
||||
{
|
||||
bool enable = (type != "allfiles" && type != "allroms");
|
||||
for(uInt32 i = 0; i < 5; ++i)
|
||||
myRomType[i]->setEnabled(enable);
|
||||
|
||||
if(enable)
|
||||
{
|
||||
myFileType->setSelected("__EXTS", "");
|
||||
|
||||
// Since istringstream swallows whitespace, we have to make the
|
||||
// delimiters be spaces
|
||||
string exts = type, ext;
|
||||
replace(exts.begin(), exts.end(), ':', ' ');
|
||||
istringstream buf(exts);
|
||||
|
||||
while(buf >> ext)
|
||||
{
|
||||
for(uInt32 i = 0; i < 5; ++i)
|
||||
{
|
||||
if(ourRomTypes[1][i] == ext)
|
||||
{
|
||||
myRomType[i]->setState(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
myFileType->setSelected(type, "");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherFilterDialog::handleCommand(CommandSender* sender, int cmd,
|
||||
int data, int id)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
case GuiObject::kOKCmd:
|
||||
saveConfig();
|
||||
close();
|
||||
break;
|
||||
|
||||
case GuiObject::kDefaultsCmd:
|
||||
setDefaults();
|
||||
break;
|
||||
|
||||
case kFileTypeChanged:
|
||||
handleFileTypeChange(myFileType->getSelectedTag().toString());
|
||||
break;
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const char* const LauncherFilterDialog::ourRomTypes[2][5] = {
|
||||
{ ".a26", ".bin", ".rom", ".zip", ".gz" },
|
||||
{ "a26", "bin", "rom", "zip", "gz" }
|
||||
};
|
|
@ -1,78 +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-2018 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 LAUNCHER_FILTER_DIALOG_HXX
|
||||
#define LAUNCHER_FILTER_DIALOG_HXX
|
||||
|
||||
class CommandSender;
|
||||
class DialogContainer;
|
||||
class FilesystemNode;
|
||||
class CheckboxWidget;
|
||||
class PopUpWidget;
|
||||
class OSystem;
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Dialog.hxx"
|
||||
#include "Settings.hxx"
|
||||
|
||||
class LauncherFilterDialog : public Dialog, public CommandSender
|
||||
{
|
||||
public:
|
||||
LauncherFilterDialog(GuiObject* boss, const GUI::Font& font);
|
||||
virtual ~LauncherFilterDialog() = default;
|
||||
|
||||
/** Add valid extensions from 'exts' to the given StringList */
|
||||
static void parseExts(StringList& list, const string& exts);
|
||||
|
||||
/**
|
||||
Is this a valid ROM filename (does it have a valid extension from
|
||||
those specified in the list of extensions).
|
||||
|
||||
@param name Filename of potential ROM file
|
||||
@param exts The list of extensions to consult
|
||||
*/
|
||||
static bool isValidRomName(const string& name, const StringList& exts);
|
||||
|
||||
private:
|
||||
void loadConfig() override;
|
||||
void saveConfig() override;
|
||||
void setDefaults() override;
|
||||
|
||||
void handleFileTypeChange(const string& type);
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
|
||||
private:
|
||||
PopUpWidget* myFileType;
|
||||
CheckboxWidget* myRomType[5];
|
||||
|
||||
enum {
|
||||
kFileTypeChanged = 'LFDc'
|
||||
};
|
||||
|
||||
// Holds static strings representing ROM types
|
||||
static const char* const ourRomTypes[2][5];
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
LauncherFilterDialog() = delete;
|
||||
LauncherFilterDialog(const LauncherFilterDialog&) = delete;
|
||||
LauncherFilterDialog(LauncherFilterDialog&&) = delete;
|
||||
LauncherFilterDialog& operator=(const LauncherFilterDialog&) = delete;
|
||||
LauncherFilterDialog& operator=(LauncherFilterDialog&&) = delete;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -27,7 +27,6 @@ MODULE_OBJS := \
|
|||
src/gui/InputTextDialog.o \
|
||||
src/gui/JoystickDialog.o \
|
||||
src/gui/LauncherDialog.o \
|
||||
src/gui/LauncherFilterDialog.o \
|
||||
src/gui/Launcher.o \
|
||||
src/gui/ListWidget.o \
|
||||
src/gui/LoggerDialog.o \
|
||||
|
|
Loading…
Reference in New Issue