added actual ROM size to ROM info (developer mode only)

This commit is contained in:
Thomas Jentzsch 2021-09-26 10:11:17 +02:00
parent 6a9f1075d2
commit 64be78b6b7
1 changed files with 17 additions and 3 deletions

View File

@ -150,10 +150,11 @@ 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);
size_t size = 0;
try
{
ByteBuffer image;
string md5 = ""; size_t size = 0;
string md5 = "";
if(node.exists() && !node.isDirectory() &&
(image = instance().openROM(node, md5, size)) != nullptr)
@ -178,9 +179,22 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
if(left != "" && right != "")
myRomInfo.push_back("Controllers: " + (left + " (left), " + right + " (right)"));
if (bsDetected != "")
myRomInfo.push_back("Type: " + Bankswitch::typeToDesc(Bankswitch::nameToType(bsDetected)));
if(bsDetected != "")
{
ostringstream buf;
// Display actual ROM size in developer mode
if(instance().settings().getBool("dev.settings"))
{
buf << " - ";
if(size < 1_KB)
buf << size << "B";
else
buf << (std::round(size / float(1_KB))) << "K";
}
myRomInfo.push_back("Type: " + Bankswitch::typeToDesc(Bankswitch::nameToType(bsDetected))
+ buf.str());
}
setDirty();
}