mirror of https://github.com/stella-emu/stella.git
added PlusROM detection display
simplified PlusROM id generation logic shortened QuadTari.name()
This commit is contained in:
parent
793b554f53
commit
208e7e3075
|
@ -807,3 +807,12 @@ bool CartDetector::isProbablyX07(const ByteBuffer& image, size_t size)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartDetector::isProbablyPlusROM(const ByteBuffer& image, size_t size)
|
||||
{
|
||||
// PlusCart uses this pattern to detect a PlusROM
|
||||
uInt8 signature[3] = {0x8d, 0xf0, 0x1f}; // STA $1FF0
|
||||
|
||||
return searchForBytes(image, size, signature, 3);
|
||||
}
|
||||
|
|
|
@ -47,6 +47,11 @@ class CartDetector
|
|||
*/
|
||||
static size_t isProbablyMVC(const FilesystemNode& rom);
|
||||
|
||||
/**
|
||||
Returns true if the image is probably a HSC PlusROM
|
||||
*/
|
||||
static bool isProbablyPlusROM(const ByteBuffer& image, size_t size);
|
||||
|
||||
private:
|
||||
/**
|
||||
Search the image for the specified byte signature
|
||||
|
|
|
@ -505,6 +505,7 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
|
|||
|
||||
msg << myConsole->leftController().name() << "/" << myConsole->rightController().name()
|
||||
<< " - " << myConsole->cartridge().detectedType()
|
||||
<< (myConsole->cartridge().isPlusROM() ? " PlusROM " : "")
|
||||
<< " - " << myConsole->getFormatString();
|
||||
myFrameBuffer->showTextMessage(msg.str());
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ void QuadTari::update()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string QuadTari::name() const
|
||||
{
|
||||
return "QuadTari (" + myFirstController->name() + "/" + mySecondController->name() + ")";
|
||||
return "QT(" + myFirstController->name() + "/" + mySecondController->name() + ")";
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -39,33 +39,43 @@ PlusRomsSetupDialog::PlusRomsSetupDialog(OSystem& osystem, DialogContainer& pare
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PlusRomsSetupDialog::loadConfig()
|
||||
{
|
||||
setText(instance().settings().getString("plusroms.nick"), 0);
|
||||
setText(instance().settings().getString("plusroms.nick"));
|
||||
|
||||
// Make sure there always is an id
|
||||
if(instance().settings().getString("plusroms.id") == EmptyString)
|
||||
{
|
||||
const char* HEX_DIGITS = "0123456789ABCDEF";
|
||||
char id_chr[ID_LEN];
|
||||
|
||||
srand(time(NULL));
|
||||
for(int i = 0; i < ID_LEN; i++)
|
||||
id_chr[i] = HEX_DIGITS[(rand() % 16)];
|
||||
|
||||
std::string id_str(id_chr, ID_LEN);
|
||||
instance().settings().setValue("plusroms.id", id_str);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PlusRomsSetupDialog::saveConfig()
|
||||
{
|
||||
instance().settings().setValue("plusroms.nick", getResult(0));
|
||||
instance().settings().setValue("plusroms.nick", getResult());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PlusRomsSetupDialog::handleCommand(CommandSender* sender, int cmd,
|
||||
int data, int id)
|
||||
{
|
||||
bool exit = false;
|
||||
|
||||
switch(cmd)
|
||||
{
|
||||
case GuiObject::kOKCmd:
|
||||
case EditableWidget::kAcceptCmd:
|
||||
saveConfig();
|
||||
instance().eventHandler().leaveMenuMode();
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case kCloseCmd:
|
||||
instance().eventHandler().leaveMenuMode();
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case EditableWidget::kCancelCmd:
|
||||
|
@ -75,20 +85,4 @@ void PlusRomsSetupDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
InputTextDialog::handleCommand(sender, cmd, data, id);
|
||||
break;
|
||||
}
|
||||
// Make sure there always is an id
|
||||
if(exit)
|
||||
{
|
||||
if(instance().settings().getString("plusroms.id") == EmptyString)
|
||||
{
|
||||
const char* HEX_DIGITS = "0123456789ABCDEF";
|
||||
char id_chr[ID_LEN];
|
||||
|
||||
srand(time(NULL));
|
||||
for(int i = 0; i < ID_LEN; i++)
|
||||
id_chr[i] = HEX_DIGITS[(rand() % 16)];
|
||||
|
||||
std::string id_str(id_chr, ID_LEN);
|
||||
instance().settings().setValue("plusroms.id", id_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,6 +150,7 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
|
|||
Controller::Type leftType = Controller::getType(left);
|
||||
Controller::Type rightType = Controller::getType(right);
|
||||
string bsDetected = myProperties.get(PropType::Cart_Type);
|
||||
bool isPlusCart = false;
|
||||
size_t size = 0;
|
||||
try
|
||||
{
|
||||
|
@ -168,6 +169,8 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
|
|||
instance().settings());
|
||||
if (bsDetected == "AUTO")
|
||||
bsDetected = Bankswitch::typeToName(CartDetector::autodetectType(image, size));
|
||||
|
||||
isPlusCart = CartDetector::isProbablyPlusROM(image, size);
|
||||
}
|
||||
}
|
||||
catch(const runtime_error&)
|
||||
|
@ -193,6 +196,7 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
|
|||
buf << (std::round(size / float(1_KB))) << "K";
|
||||
}
|
||||
myRomInfo.push_back("Type: " + Bankswitch::typeToDesc(Bankswitch::nameToType(bsDetected))
|
||||
+ (isPlusCart ? " - PlusROM" : "")
|
||||
+ buf.str());
|
||||
}
|
||||
setDirty();
|
||||
|
|
Loading…
Reference in New Issue