mirror of https://github.com/stella-emu/stella.git
added optional filtering of Game Properties/Emulation/Types using ROM size (TODO: doc)
This commit is contained in:
parent
ba51197927
commit
c4443d6bb5
|
@ -136,7 +136,7 @@ Bankswitch::BSList = {{
|
|||
{ "F8" , "F8 (8K Atari)" },
|
||||
{ "F8SC" , "F8SC (8K Atari + RAM)" },
|
||||
{ "FA" , "FA (CBS RAM Plus)" },
|
||||
{ "FA2" , "FA2 (CBS RAM Plus 24/28K)" },
|
||||
{ "FA2" , "FA2 (CBS RAM Plus 24-32K)" },
|
||||
{ "FC" , "FC (32K Amiga)" },
|
||||
{ "FE" , "FE (8K Activision)" },
|
||||
{ "MDM" , "MDM (Menu Driven Megacart)" },
|
||||
|
@ -153,6 +153,69 @@ Bankswitch::BSList = {{
|
|||
#endif
|
||||
}};
|
||||
|
||||
#ifdef GUI_SUPPORT
|
||||
const std::array<Bankswitch::SizesType, static_cast<int>(Bankswitch::Type::NumSchemes)>
|
||||
Bankswitch::Sizes = {{
|
||||
{ Bankswitch::any_KB, Bankswitch::any_KB }, // _AUTO
|
||||
{ 8_KB, 8_KB }, // _0840
|
||||
{ 8_KB, 8_KB }, // _0FA0
|
||||
{ 4_KB, 64_KB }, // _2IN1
|
||||
{ 8_KB, 64_KB }, // _4IN1
|
||||
{ 16_KB, 64_KB }, // _8IN1
|
||||
{ 32_KB, 128_KB }, // _16IN1
|
||||
{ 64_KB, 128_KB }, // _32IN1
|
||||
{ 128_KB, 256_KB }, // _64IN1
|
||||
{ 256_KB, 512_KB }, // _128IN1
|
||||
{ 0_KB, 4_KB }, // _2K
|
||||
{ 8_KB, 512_KB }, // _3E
|
||||
{ 8_KB, 512_KB }, // _3EX
|
||||
{ 8_KB, 64_KB }, // _3EP
|
||||
{ 8_KB, 512_KB }, // _3F
|
||||
{ 64_KB, 64_KB }, // _4A50
|
||||
{ 4_KB, 4_KB }, // _4K
|
||||
{ 4_KB, 4_KB }, // _4KSC
|
||||
{ 6_KB, 33_KB }, // _AR
|
||||
{ 256_KB, 256_KB }, // _BF
|
||||
{ 256_KB, 256_KB }, // _BFSC
|
||||
{ 32_KB, 32_KB }, // _BUS
|
||||
{ 32_KB, 512_KB }, // _CDF
|
||||
{ 16_KB, 16_KB }, // _CM
|
||||
{ 32_KB, 32_KB }, // _CTY
|
||||
{ 2_KB, 4_KB }, // _CV
|
||||
{ 128_KB, 128_KB }, // _DF
|
||||
{ 128_KB, 128_KB }, // _DFSC
|
||||
{ 10_KB, 11_KB }, // _DPC
|
||||
{ 16_KB, 64_KB }, // _DPCP
|
||||
{ 8_KB, 8_KB }, // _E0
|
||||
{ 8_KB, 16_KB }, // _E7
|
||||
{ 64_KB, 64_KB }, // _EF
|
||||
{ 64_KB, 64_KB }, // _EFSC
|
||||
{ 64_KB, 64_KB }, // _F0
|
||||
{ 32_KB, 32_KB }, // _F4
|
||||
{ 32_KB, 32_KB }, // _F4SC
|
||||
{ 16_KB, 16_KB }, // _F6
|
||||
{ 16_KB, 16_KB }, // _F6SC
|
||||
{ 8_KB, 8_KB }, // _F8
|
||||
{ 8_KB, 8_KB }, // _F8SC
|
||||
{ 12_KB, 12_KB }, // _FA
|
||||
{ 24_KB, 32_KB }, // _FA2
|
||||
{ 32_KB, 32_KB }, // _FC
|
||||
{ 8_KB, 8_KB }, // _FE
|
||||
{ 8_KB, Bankswitch::any_KB }, // _MDM
|
||||
{ 1024_KB, Bankswitch::any_KB }, // _MVC
|
||||
{ 128_KB, 256_KB }, // _SB
|
||||
{ 512_KB, 512_KB }, // _TVBOY
|
||||
{ 8_KB, 8_KB }, // _UA
|
||||
{ 8_KB, 8_KB }, // _UASW
|
||||
{ 8_KB, 8_KB }, // _WD
|
||||
{ 8_KB, 8_KB+5 }, // _WDSW
|
||||
{ 64_KB, 64_KB }, // _X07
|
||||
#if defined(CUSTOM_ARM)
|
||||
{ Bankswitch::any_KB, Bankswitch::any_KB } }
|
||||
#endif
|
||||
}};
|
||||
#endif
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Bankswitch::ExtensionMap Bankswitch::ourExtensions = {
|
||||
// Normal file extensions that don't actually tell us anything
|
||||
|
|
|
@ -51,6 +51,16 @@ class Bankswitch
|
|||
NumSchemes
|
||||
};
|
||||
|
||||
#ifdef GUI_SUPPORT
|
||||
struct SizesType {
|
||||
size_t minSize;
|
||||
size_t maxSize;
|
||||
};
|
||||
static constexpr size_t any_KB = 0;
|
||||
|
||||
static const std::array<SizesType, static_cast<uInt32>(Type::NumSchemes)> Sizes;
|
||||
#endif
|
||||
|
||||
// Info about the various bankswitch schemes, useful for displaying
|
||||
// in GUI dropdown boxes, etc
|
||||
struct Description {
|
||||
|
|
|
@ -206,6 +206,7 @@ Settings::Settings()
|
|||
setPermanent("plusroms.nick", "");
|
||||
setTemporary("plusroms.id", "");
|
||||
setPermanent("plusroms.fixedid", "");
|
||||
setPermanent("filterbstypes", "true");
|
||||
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
// Debugger/disassembly options
|
||||
|
@ -685,6 +686,7 @@ void Settings::usage() const
|
|||
<< " by attempting to use the application directory\n"
|
||||
<< " -plusroms.nick <nick> Define a nickname for the PlusROMs backends.\n"
|
||||
<< " -plusroms.id <id> Define a temporary ID for the PlusROMs backends.\n"
|
||||
<< " -filterbstypes <0|1> Filter bankswitch type list by ROM size.\n"
|
||||
<< " -help Show the text you're now reading\n"
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
<< endl
|
||||
|
|
|
@ -122,11 +122,13 @@ void GameInfoDialog::addEmulationTab()
|
|||
t = new StaticTextWidget(myTab, _font, HBORDER, ypos + 1, "Type (*) ");
|
||||
int pwidth = _font.getStringWidth("CM (SpectraVideo CompuMate)");
|
||||
items.clear();
|
||||
for(uInt32 i = 0; i < static_cast<uInt32>(Bankswitch::Type::NumSchemes); ++i)
|
||||
VarList::push_back(items, Bankswitch::BSList[i].desc, Bankswitch::BSList[i].name);
|
||||
myBSType = new PopUpWidget(myTab, _font, t->getRight() + fontWidth, ypos,
|
||||
pwidth, lineHeight, items);
|
||||
wid.push_back(myBSType);
|
||||
myBSFilter = new CheckboxWidget(myTab, _font, myBSType->getRight()+ fontWidth, ypos + 1,
|
||||
"Filter", kBSFilterChanged);
|
||||
myBSFilter->setToolTip("Enable to filter types by ROM size");
|
||||
wid.push_back(myBSFilter);
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
myTypeDetected = new StaticTextWidget(myTab, ifont, t->getRight() + fontWidth, ypos,
|
||||
|
@ -719,6 +721,10 @@ void GameInfoDialog::loadConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void GameInfoDialog::loadEmulationProperties(const Properties& props)
|
||||
{
|
||||
myBSFilter->setState(instance().settings().getBool("filterbstypes"));
|
||||
updateBSTypes();
|
||||
|
||||
VariantList items;
|
||||
string bsDetected = "";
|
||||
|
||||
myBSType->setSelected(props.get(PropType::Cart_Type), "AUTO");
|
||||
|
@ -735,14 +741,12 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props)
|
|||
}
|
||||
else
|
||||
{
|
||||
const FSNode& node = FSNode(instance().launcher().selectedRom());
|
||||
ByteBuffer image;
|
||||
string md5 = props.get(PropType::Cart_MD5);
|
||||
size_t size = 0;
|
||||
|
||||
// try to load the image for auto detection
|
||||
if(!instance().hasConsole() &&
|
||||
node.exists() && !node.isDirectory() && (image = instance().openROM(node, md5, size)) != nullptr)
|
||||
if(myGameFile.exists() && !myGameFile.isDirectory() && (image = instance().openROM(myGameFile, md5, size)) != nullptr)
|
||||
{
|
||||
bsDetected = Bankswitch::typeToDesc(CartDetector::autodetectType(image, size)) + " detected";
|
||||
}
|
||||
|
@ -751,8 +755,6 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props)
|
|||
myTypeDetected->setLabel(bsDetected);
|
||||
|
||||
// Start bank
|
||||
VariantList items;
|
||||
|
||||
VarList::push_back(items, "Auto", "AUTO");
|
||||
if(instance().hasConsole())
|
||||
{
|
||||
|
@ -930,6 +932,8 @@ void GameInfoDialog::loadHighScoresProperties(const Properties& props)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void GameInfoDialog::saveProperties()
|
||||
{
|
||||
instance().settings().setValue("filterbstypes", myBSFilter->getState());
|
||||
|
||||
// Emulation properties
|
||||
myGameProperties.set(PropType::Cart_Type, myBSType->getSelectedTag().toString());
|
||||
myGameProperties.set(PropType::Cart_StartBank, myStartBank->getSelectedTag().toString());
|
||||
|
@ -1097,6 +1101,7 @@ void GameInfoDialog::setDefaults()
|
|||
{
|
||||
case 0: // Emulation properties
|
||||
loadEmulationProperties(defaultProperties);
|
||||
myBSFilter->setState(true);
|
||||
break;
|
||||
|
||||
case 1: // Console properties
|
||||
|
@ -1120,6 +1125,22 @@ void GameInfoDialog::setDefaults()
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void GameInfoDialog::updateBSTypes()
|
||||
{
|
||||
VariantList items;
|
||||
|
||||
// Bankswitching type
|
||||
for(uInt32 i = 0; i < static_cast<uInt32>(Bankswitch::Type::NumSchemes); ++i)
|
||||
if(!myBSFilter->getState() ||
|
||||
((Bankswitch::Sizes[i].minSize == Bankswitch::any_KB || myGameFile.getSize() >= Bankswitch::Sizes[i].minSize) &&
|
||||
(Bankswitch::Sizes[i].maxSize == Bankswitch::any_KB || myGameFile.getSize() <= Bankswitch::Sizes[i].maxSize)))
|
||||
{
|
||||
VarList::push_back(items, Bankswitch::BSList[i].desc, Bankswitch::BSList[i].name);
|
||||
}
|
||||
myBSType->addItems(items);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void GameInfoDialog::updateControllerStates()
|
||||
{
|
||||
|
@ -1455,6 +1476,10 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
eraseEEPROM();
|
||||
break;
|
||||
|
||||
case kBSFilterChanged:
|
||||
updateBSTypes();
|
||||
break;
|
||||
|
||||
case kPhosphorChanged:
|
||||
{
|
||||
const bool status = myPhosphor->getState();
|
||||
|
|
|
@ -68,6 +68,8 @@ class GameInfoDialog : public Dialog, public CommandSender
|
|||
// save properties from all tabs into the local properties object
|
||||
void saveProperties();
|
||||
|
||||
// update 'BS Type' list
|
||||
void updateBSTypes();
|
||||
// update 'Controller' tab widgets
|
||||
void updateControllerStates();
|
||||
// erase SaveKey/AtariVox pages for current game
|
||||
|
@ -86,6 +88,7 @@ class GameInfoDialog : public Dialog, public CommandSender
|
|||
|
||||
// Emulation properties
|
||||
PopUpWidget* myBSType{nullptr};
|
||||
CheckboxWidget* myBSFilter{nullptr};
|
||||
StaticTextWidget* myTypeDetected{nullptr};
|
||||
StaticTextWidget* myStartBankLabel{nullptr};
|
||||
PopUpWidget* myStartBank{nullptr};
|
||||
|
@ -173,6 +176,7 @@ class GameInfoDialog : public Dialog, public CommandSender
|
|||
EditTextWidget* myHighScoreNotes{nullptr};
|
||||
|
||||
enum {
|
||||
kBSFilterChanged = 'Bfch',
|
||||
kVCenterChanged = 'Vcch',
|
||||
kPhosphorChanged = 'PPch',
|
||||
kPPBlendChanged = 'PBch',
|
||||
|
|
Loading…
Reference in New Issue