mirror of https://github.com/stella-emu/stella.git
Handle case where a ROM doesn't have a name in its properties entry.
This commit is contained in:
parent
99872a3b35
commit
8e1791b801
|
@ -540,6 +540,10 @@ unique_ptr<Console> OSystem::openConsole(const FilesystemNode& romfile, string&
|
||||||
unique_ptr<Cartridge> cart =
|
unique_ptr<Cartridge> cart =
|
||||||
CartDetector::create(romfile, image, size, cartmd5, type, *mySettings);
|
CartDetector::create(romfile, image, size, cartmd5, type, *mySettings);
|
||||||
|
|
||||||
|
// Some properties may not have a name set; we can't leave it blank
|
||||||
|
if(props.get(PropType::Cart_Name) == EmptyString)
|
||||||
|
props.set(PropType::Cart_Name, romfile.getNameWithExt(""));
|
||||||
|
|
||||||
// It's possible that the cart created was from a piece of the image,
|
// It's possible that the cart created was from a piece of the image,
|
||||||
// and that the md5 (and hence the cart) has changed
|
// and that the md5 (and hence the cart) has changed
|
||||||
if(props.get(PropType::Cart_MD5) != cartmd5)
|
if(props.get(PropType::Cart_MD5) != cartmd5)
|
||||||
|
|
|
@ -121,14 +121,20 @@ bool PropertiesSet::getMD5(const string& md5, Properties& properties,
|
||||||
void PropertiesSet::getMD5WithInsert(const FilesystemNode& rom,
|
void PropertiesSet::getMD5WithInsert(const FilesystemNode& rom,
|
||||||
const string& md5, Properties& properties)
|
const string& md5, Properties& properties)
|
||||||
{
|
{
|
||||||
|
bool toInsert = false;
|
||||||
|
|
||||||
if(!getMD5(md5, properties))
|
if(!getMD5(md5, properties))
|
||||||
{
|
{
|
||||||
properties.set(PropType::Cart_MD5, md5);
|
properties.set(PropType::Cart_MD5, md5);
|
||||||
// Create a name suitable for using in properties
|
toInsert = true;
|
||||||
properties.set(PropType::Cart_Name, rom.getNameWithExt(""));
|
|
||||||
|
|
||||||
insert(properties, false);
|
|
||||||
}
|
}
|
||||||
|
if(toInsert || properties.get(PropType::Cart_Name) == EmptyString)
|
||||||
|
{
|
||||||
|
properties.set(PropType::Cart_Name, rom.getNameWithExt(""));
|
||||||
|
toInsert = true;
|
||||||
|
}
|
||||||
|
if(toInsert)
|
||||||
|
insert(properties, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
Loading…
Reference in New Issue