mirror of https://github.com/stella-emu/stella.git
make startup bank available in GameInfoDialog
add bankswitching type detection in GameInfoDialog when started from launcher
This commit is contained in:
parent
b99c7e1678
commit
28c3d126be
|
@ -2498,6 +2498,11 @@
|
|||
<td>Same as using -bs.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-startbank <bank></pre></td>
|
||||
<td>Set "Cartridge.StartBank" property.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-channels <Mono|Stereo></pre></td>
|
||||
<td>Set "Cartridge.Sound" property.</td>
|
||||
|
|
|
@ -49,6 +49,16 @@ class CartDetector
|
|||
const ByteBuffer& image, uInt32 size, string& md5,
|
||||
const string& dtype, Settings& settings);
|
||||
|
||||
/**
|
||||
Try to auto-detect the bankswitching type of the cartridge
|
||||
|
||||
@param image A pointer to the ROM image
|
||||
@param size The size of the ROM image
|
||||
|
||||
@return The "best guess" for the cartridge type
|
||||
*/
|
||||
static Bankswitch::Type autodetectType(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
private:
|
||||
/**
|
||||
Create a cartridge from a multi-cart image pointer; internally this
|
||||
|
@ -84,16 +94,6 @@ class CartDetector
|
|||
createFromImage(const ByteBuffer& image, uInt32 size, Bankswitch::Type type,
|
||||
const string& md5, Settings& settings);
|
||||
|
||||
/**
|
||||
Try to auto-detect the bankswitching type of the cartridge
|
||||
|
||||
@param image A pointer to the ROM image
|
||||
@param size The size of the ROM image
|
||||
|
||||
@return The "best guess" for the cartridge type
|
||||
*/
|
||||
static Bankswitch::Type autodetectType(const ByteBuffer& image, uInt32 size);
|
||||
|
||||
/**
|
||||
Search the image for the specified byte signature
|
||||
|
||||
|
|
|
@ -538,6 +538,7 @@ unique_ptr<Console> OSystem::openConsole(const FilesystemNode& romfile, string&
|
|||
|
||||
CMDLINE_PROPS_UPDATE("bs", PropType::Cart_Type);
|
||||
CMDLINE_PROPS_UPDATE("type", PropType::Cart_Type);
|
||||
CMDLINE_PROPS_UPDATE("startbank", PropType::Cart_StartBank);
|
||||
|
||||
// Now create the cartridge
|
||||
string cartmd5 = md5;
|
||||
|
|
|
@ -532,6 +532,7 @@ void Settings::usage() const
|
|||
<< endl
|
||||
<< " -bs <arg> Sets the 'Cartridge.Type' (bankswitch) property\n"
|
||||
<< " -type <arg> Same as using -bs\n"
|
||||
<< " -startbank <bank> Sets the ROM's startup bank\n"
|
||||
<< " -channels <arg> Sets the 'Cartridge.Sound' property\n"
|
||||
<< " -ld <arg> Sets the 'Console.LeftDifficulty' property\n"
|
||||
<< " -rd <arg> Sets the 'Console.RightDifficulty' property\n"
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "RadioButtonWidget.hxx"
|
||||
#include "Launcher.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "CartDetector.hxx"
|
||||
#include "ControllerDetector.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "Props.hxx"
|
||||
|
@ -373,19 +374,36 @@ void GameInfoDialog::loadConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void GameInfoDialog::loadEmulationProperties(const Properties& props)
|
||||
{
|
||||
myBSType->setSelected(props.get(PropType::Cart_Type), "AUTO");
|
||||
string bsDetected = "";
|
||||
|
||||
if(instance().hasConsole() && myBSType->getSelectedTag().toString() == "AUTO")
|
||||
myBSType->setSelected(props.get(PropType::Cart_Type), "AUTO");
|
||||
if(myBSType->getSelectedTag().toString() == "AUTO")
|
||||
{
|
||||
string bs = instance().console().about().BankSwitch;
|
||||
size_t pos = bs.find_first_of('*');
|
||||
// remove '*':
|
||||
if(pos != string::npos)
|
||||
bs = bs.substr(0, pos) + bs.substr(pos + 1);
|
||||
myTypeDetected->setLabel(bs + "detected");
|
||||
if(instance().hasConsole())
|
||||
{
|
||||
string bs = instance().console().about().BankSwitch;
|
||||
size_t pos = bs.find_first_of('*');
|
||||
// remove '*':
|
||||
if(pos != string::npos)
|
||||
bs = bs.substr(0, pos) + bs.substr(pos + 1);
|
||||
bsDetected = bs + "detected";
|
||||
}
|
||||
else
|
||||
{
|
||||
const FilesystemNode& node = FilesystemNode(instance().launcher().selectedRom());
|
||||
ByteBuffer image;
|
||||
string md5 = props.get(PropType::Cart_MD5);
|
||||
uInt32 size = 0;
|
||||
|
||||
// try to load the image for auto detection
|
||||
if(!instance().hasConsole() &&
|
||||
node.exists() && !node.isDirectory() && (image = instance().openROM(node, md5, size)) != nullptr)
|
||||
{
|
||||
bsDetected = Bankswitch::typeToName(CartDetector::autodetectType(image, size)) + " detected";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
myTypeDetected->setLabel("");
|
||||
myTypeDetected->setLabel(bsDetected);
|
||||
|
||||
// Start bank
|
||||
VariantList items;
|
||||
|
@ -454,13 +472,14 @@ void GameInfoDialog::loadControllerProperties(const Properties& props)
|
|||
ByteBuffer image;
|
||||
string md5 = props.get(PropType::Cart_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;
|
||||
if(!instance().hasConsole())
|
||||
{
|
||||
const FilesystemNode& node = FilesystemNode(instance().launcher().selectedRom());
|
||||
|
||||
autoDetect = node.exists() && !node.isDirectory() && (image = instance().openROM(node, md5, size)) != nullptr;
|
||||
}
|
||||
string label = "";
|
||||
string controller = props.get(PropType::Controller_Left);
|
||||
|
||||
|
|
Loading…
Reference in New Issue