mirror of
https://github.com/holub/mame
synced 2025-06-29 23:48:56 +03:00
Merge pull request #1124 from npwoods/more_stdstring_in_softlist
Changed the softlist code to more aggressively use std::string
This commit is contained in:
commit
b868d98d32
@ -867,8 +867,7 @@ bool device_image_interface::load_software(software_list_device &swlist, const c
|
||||
while (swinfo != nullptr)
|
||||
{
|
||||
locationtag.append(swinfo->shortname()).append(breakstr);
|
||||
const char *parentname = swinfo->parentname();
|
||||
swinfo = (parentname != nullptr) ? swlist.find(parentname) : nullptr;
|
||||
swinfo = !swinfo->parentname().empty() ? swlist.find(swinfo->parentname().c_str()) : nullptr;
|
||||
}
|
||||
// strip the final '%'
|
||||
locationtag.erase(locationtag.length() - 1, 1);
|
||||
@ -1008,7 +1007,7 @@ bool device_image_interface::load_internal(const char *path, bool is_create, int
|
||||
if ( m_software_info_ptr )
|
||||
{
|
||||
// sanitize
|
||||
if (m_software_info_ptr->longname() == nullptr || m_software_info_ptr->publisher() == nullptr || m_software_info_ptr->year() == nullptr)
|
||||
if (m_software_info_ptr->longname().empty() || m_software_info_ptr->publisher().empty() || m_software_info_ptr->year().empty())
|
||||
fatalerror("Each entry in an XML list must have all of the following fields: description, publisher, year!\n");
|
||||
|
||||
// store
|
||||
@ -1352,7 +1351,7 @@ bool device_image_interface::load_software_part(const char *path, const software
|
||||
|
||||
// Load the software part
|
||||
software_list_device &swlist = swpart->info().list();
|
||||
bool result = call_softlist_load(swlist, swpart->info().shortname(), swpart->romdata());
|
||||
bool result = call_softlist_load(swlist, swpart->info().shortname().c_str(), swpart->romdata());
|
||||
|
||||
// Tell the world which part we actually loaded
|
||||
std::string full_sw_name = string_format("%s:%s:%s", swlist.list_name(), swpart->info().shortname(), swpart->name());
|
||||
|
@ -1299,8 +1299,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list
|
||||
while (swinfo != nullptr)
|
||||
{
|
||||
locationtag.append(swinfo->shortname()).append(breakstr);
|
||||
const char *parentname = swinfo->parentname();
|
||||
swinfo = (parentname != nullptr) ? swlist.find(parentname) : nullptr;
|
||||
swinfo = !swinfo->parentname().empty() ? swlist.find(swinfo->parentname().c_str()) : nullptr;
|
||||
}
|
||||
// strip the final '%'
|
||||
locationtag.erase(locationtag.length() - 1, 1);
|
||||
|
@ -44,7 +44,7 @@ private:
|
||||
|
||||
// internal parsing helpers
|
||||
const char *filename() const { return m_list.filename(); }
|
||||
const char *infoname() const { return (m_current_info != nullptr) ? m_current_info->shortname() : "???"; }
|
||||
const char *infoname() const { return (m_current_info != nullptr) ? m_current_info->shortname().c_str() : "???"; }
|
||||
int line() const { return XML_GetCurrentLineNumber(m_parser); }
|
||||
int column() const { return XML_GetCurrentColumnNumber(m_parser); }
|
||||
const char *parser_error() const { return XML_ErrorString(XML_GetErrorCode(m_parser)); }
|
||||
@ -55,7 +55,7 @@ private:
|
||||
void unknown_attribute(const char *attrname) { parse_error("Unknown attribute: %s", attrname); }
|
||||
|
||||
// internal helpers
|
||||
void parse_attributes(const char **attributes, int numattrs, const char *attrlist[], const char *outlist[]);
|
||||
std::vector<std::string> parse_attributes(const char **attributes, int numattrs, const char *attrlist[]);
|
||||
void add_rom_entry(const char *name, const char *hashdata, UINT32 offset, UINT32 length, UINT32 flags);
|
||||
|
||||
// expat callbacks
|
||||
@ -102,15 +102,12 @@ const device_type SOFTWARE_LIST = &device_creator<software_list_device>;
|
||||
// software_part - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
software_part::software_part(software_info &info, const char *name, const char *interface)
|
||||
software_part::software_part(software_info &info, std::string &&name, std::string &&interface)
|
||||
: m_next(nullptr),
|
||||
m_info(info),
|
||||
m_name(name),
|
||||
m_interface(interface)
|
||||
m_name(std::move(name)),
|
||||
m_interface(std::move(interface))
|
||||
{
|
||||
// ensure strings we are passed are in the string pool
|
||||
assert(info.list().string_pool_contains(name));
|
||||
assert(info.list().string_pool_contains(interface));
|
||||
}
|
||||
|
||||
|
||||
@ -119,14 +116,12 @@ software_part::software_part(software_info &info, const char *name, const char *
|
||||
// feature, if specified
|
||||
//-------------------------------------------------
|
||||
|
||||
const char *software_part::feature(const char *feature_name) const
|
||||
const char *software_part::feature(const std::string &feature_name) const
|
||||
{
|
||||
assert(feature_name != nullptr);
|
||||
|
||||
// scan the feature list for an entry matching feature_name and return the value
|
||||
for (const feature_list_item &feature : m_featurelist)
|
||||
if (strcmp(feature.name(), feature_name) == 0)
|
||||
return feature.value();
|
||||
if (feature.name() == feature_name)
|
||||
return feature.value().c_str();
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
@ -190,7 +185,7 @@ software_compatibility software_part::is_compatible(const software_list_device &
|
||||
bool software_part::matches_interface(const char *interface_list) const
|
||||
{
|
||||
// if we have no interface, then we match by default
|
||||
if (m_interface == nullptr)
|
||||
if (m_interface.empty())
|
||||
return true;
|
||||
|
||||
// copy the comma-delimited interface list and ensure it ends with a final comma
|
||||
@ -239,20 +234,13 @@ device_image_interface *software_part::find_mountable_image(const machine_config
|
||||
// software_info - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
software_info::software_info(software_list_device &list, const char *name, const char *parent, const char *supported)
|
||||
software_info::software_info(software_list_device &list, std::string &&name, std::string &&parent, const char *supported)
|
||||
: m_next(nullptr),
|
||||
m_list(list),
|
||||
m_supported(SOFTWARE_SUPPORTED_YES),
|
||||
m_shortname(name),
|
||||
m_longname(nullptr),
|
||||
m_parentname(parent),
|
||||
m_year(nullptr),
|
||||
m_publisher(nullptr)
|
||||
m_shortname(std::move(name)),
|
||||
m_parentname(std::move(parent))
|
||||
{
|
||||
// ensure strings we are passed are in the string pool
|
||||
assert(list.string_pool_contains(name));
|
||||
assert(list.string_pool_contains(parent));
|
||||
|
||||
// handle the supported flag if provided
|
||||
if (supported != nullptr)
|
||||
{
|
||||
@ -279,7 +267,7 @@ const software_part *software_info::find_part(const char *partname, const char *
|
||||
|
||||
// look for the part by name and match against the interface if provided
|
||||
for (const software_part &part : m_partdata)
|
||||
if (partname != nullptr && strcmp(partname, part.name()) == 0)
|
||||
if (partname != nullptr && strcmp(partname, part.name().c_str()) == 0)
|
||||
{
|
||||
if (interface == nullptr || part.matches_interface(interface))
|
||||
return ∂
|
||||
@ -325,7 +313,7 @@ software_list_device::software_list_device(const machine_config &mconfig, const
|
||||
m_filter(nullptr),
|
||||
m_parsed(false),
|
||||
m_file(mconfig.options().hash_path(), OPEN_FLAG_READ),
|
||||
m_description(nullptr)
|
||||
m_description("")
|
||||
{
|
||||
}
|
||||
|
||||
@ -390,8 +378,8 @@ void software_list_device::find_approx_matches(const char *name, int matches, co
|
||||
if ((interface == nullptr || part->matches_interface(interface)) && part->is_compatible(*this) == SOFTWARE_IS_COMPATIBLE)
|
||||
{
|
||||
// pick the best match between driver name and description
|
||||
int longpenalty = driver_list::penalty_compare(name, swinfo.longname());
|
||||
int shortpenalty = driver_list::penalty_compare(name, swinfo.shortname());
|
||||
int longpenalty = driver_list::penalty_compare(name, swinfo.longname().c_str());
|
||||
int shortpenalty = driver_list::penalty_compare(name, swinfo.shortname().c_str());
|
||||
int curpenalty = MIN(longpenalty, shortpenalty);
|
||||
|
||||
// insert into the sorted table of matches
|
||||
@ -423,10 +411,9 @@ void software_list_device::release()
|
||||
{
|
||||
osd_printf_verbose("Resetting %s\n", m_file.filename());
|
||||
m_parsed = false;
|
||||
m_description = nullptr;
|
||||
m_description.clear();
|
||||
m_errors.clear();
|
||||
m_infolist.reset();
|
||||
m_stringpool.reset();
|
||||
}
|
||||
|
||||
|
||||
@ -478,7 +465,7 @@ void software_list_device::display_matches(const machine_config &config, const c
|
||||
// print them out
|
||||
for (auto & matche : matches)
|
||||
if (matche != nullptr)
|
||||
osd_printf_error("%-18s%s\n", matche->shortname(), matche->longname());
|
||||
osd_printf_error("%-18s%s\n", matche->shortname().c_str(), matche->longname().c_str());
|
||||
|
||||
osd_printf_error("\n");
|
||||
}
|
||||
@ -502,7 +489,7 @@ const software_info *software_list_device::find(const char *look_for, const soft
|
||||
|
||||
// find a match (will cause a parse if needed when calling get_info)
|
||||
for (prev = (prev != nullptr) ? prev->next() : get_info().first(); prev != nullptr; prev = prev->next())
|
||||
if ((iswild && core_strwildcmp(look_for, prev->shortname()) == 0) || core_stricmp(look_for, prev->shortname()) == 0)
|
||||
if ((iswild && core_strwildcmp(look_for, prev->shortname().c_str()) == 0) || core_stricmp(look_for, prev->shortname().c_str()) == 0)
|
||||
break;
|
||||
|
||||
return prev;
|
||||
@ -584,30 +571,30 @@ void software_list_device::internal_validity_check(validity_checker &valid)
|
||||
// Now check if the xml data is valid:
|
||||
|
||||
// Did we lost any description?
|
||||
if (swinfo.longname() == nullptr)
|
||||
if (swinfo.longname().empty())
|
||||
{
|
||||
osd_printf_error("%s: %s has no description\n", filename(), swinfo.shortname());
|
||||
osd_printf_error("%s: %s has no description\n", filename(), swinfo.shortname().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
// Did we lost any year?
|
||||
if (swinfo.year() == nullptr)
|
||||
if (swinfo.year().empty())
|
||||
{
|
||||
osd_printf_error("%s: %s has no year\n", filename(), swinfo.shortname());
|
||||
osd_printf_error("%s: %s has no year\n", filename(), swinfo.shortname().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
// Did we lost any publisher?
|
||||
if (swinfo.publisher() == nullptr)
|
||||
if (swinfo.publisher().empty())
|
||||
{
|
||||
osd_printf_error("%s: %s has no publisher\n", filename(), swinfo.shortname());
|
||||
osd_printf_error("%s: %s has no publisher\n", filename(), swinfo.shortname().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
// Did we lost the software parts?
|
||||
if (swinfo.parts().empty())
|
||||
{
|
||||
osd_printf_error("%s: %s has no part\n", filename(), swinfo.shortname());
|
||||
osd_printf_error("%s: %s has no part\n", filename(), swinfo.shortname().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -617,57 +604,57 @@ void software_list_device::internal_validity_check(validity_checker &valid)
|
||||
if (!names.insert(std::make_pair(swinfo.shortname(), &swinfo)).second)
|
||||
{
|
||||
software_info *match = names.find(swinfo.shortname())->second;
|
||||
osd_printf_error("%s: %s is a duplicate name (%s)\n", filename(), swinfo.shortname(), match->shortname());
|
||||
osd_printf_error("%s: %s is a duplicate name (%s)\n", filename(), swinfo.shortname().c_str(), match->shortname().c_str());
|
||||
}
|
||||
|
||||
// check for duplicate descriptions
|
||||
std::string longname = std::string(swinfo.longname());
|
||||
if (!descriptions.insert(std::make_pair(strmakelower(longname), &swinfo)).second)
|
||||
osd_printf_error("%s: %s is a duplicate description (%s)\n", filename(), swinfo.longname(), swinfo.shortname());
|
||||
osd_printf_error("%s: %s is a duplicate description (%s)\n", filename(), swinfo.longname().c_str(), swinfo.shortname().c_str());
|
||||
|
||||
bool is_clone = false;
|
||||
if (swinfo.parentname() != nullptr)
|
||||
if (swinfo.parentname().empty())
|
||||
{
|
||||
is_clone = true;
|
||||
if (strcmp(swinfo.parentname(), swinfo.shortname()) == 0)
|
||||
if (swinfo.parentname() == swinfo.shortname())
|
||||
{
|
||||
osd_printf_error("%s: %s is set as a clone of itself\n", filename(), swinfo.shortname());
|
||||
osd_printf_error("%s: %s is set as a clone of itself\n", filename(), swinfo.shortname().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
// make sure the parent exists
|
||||
const software_info *swinfo2 = find(swinfo.parentname());
|
||||
const software_info *swinfo2 = find(swinfo.parentname().c_str());
|
||||
|
||||
if (swinfo2 == nullptr)
|
||||
osd_printf_error("%s: parent '%s' software for '%s' not found\n", filename(), swinfo.parentname(), swinfo.shortname());
|
||||
else if (swinfo2->parentname() != nullptr)
|
||||
osd_printf_error("%s: %s is a clone of a clone\n", filename(), swinfo.shortname());
|
||||
osd_printf_error("%s: parent '%s' software for '%s' not found\n", filename(), swinfo.parentname().c_str(), swinfo.shortname().c_str());
|
||||
else if (swinfo2->parentname().empty())
|
||||
osd_printf_error("%s: %s is a clone of a clone\n", filename(), swinfo.shortname().c_str());
|
||||
}
|
||||
|
||||
// make sure the driver name is 8 chars or less
|
||||
if ((is_clone && strlen(swinfo.shortname()) > NAME_LEN_CLONE) || (!is_clone && strlen(swinfo.shortname()) > NAME_LEN_PARENT))
|
||||
osd_printf_error("%s: %s %s driver name must be %d characters or less\n", filename(), swinfo.shortname(),
|
||||
if ((is_clone && swinfo.shortname().length() > NAME_LEN_CLONE) || (!is_clone && swinfo.shortname().length() > NAME_LEN_PARENT))
|
||||
osd_printf_error("%s: %s %s driver name must be %d characters or less\n", filename(), swinfo.shortname().c_str(),
|
||||
is_clone ? "clone" : "parent", is_clone ? NAME_LEN_CLONE : NAME_LEN_PARENT);
|
||||
|
||||
// make sure the year is only digits, '?' or '+'
|
||||
for (const char *s = swinfo.year(); *s != 0; s++)
|
||||
for (const char *s = swinfo.year().c_str(); *s != 0; s++)
|
||||
if (!isdigit((UINT8)*s) && *s != '?' && *s != '+')
|
||||
{
|
||||
osd_printf_error("%s: %s has an invalid year '%s'\n", filename(), swinfo.shortname(), swinfo.year());
|
||||
osd_printf_error("%s: %s has an invalid year '%s'\n", filename(), swinfo.shortname().c_str(), swinfo.year().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
softlist_map part_names;
|
||||
for (software_part &part : swinfo.parts())
|
||||
{
|
||||
if (part.interface() == nullptr)
|
||||
osd_printf_error("%s: %s has a part (%s) without interface\n", filename(), swinfo.shortname(), part.name());
|
||||
if (part.interface().empty())
|
||||
osd_printf_error("%s: %s has a part (%s) without interface\n", filename(), swinfo.shortname().c_str(), part.name().c_str());
|
||||
|
||||
if (part.romdata() == nullptr)
|
||||
osd_printf_error("%s: %s has a part (%s) with no data\n", filename(), swinfo.shortname(), part.name());
|
||||
osd_printf_error("%s: %s has a part (%s) with no data\n", filename(), swinfo.shortname().c_str(), part.name().c_str());
|
||||
|
||||
if (!part_names.insert(std::make_pair(part.name(), &swinfo)).second)
|
||||
osd_printf_error("%s: %s has a part (%s) whose name is duplicate\n", filename(), swinfo.shortname(), part.name());
|
||||
osd_printf_error("%s: %s has a part (%s) whose name is duplicate\n", filename(), swinfo.shortname().c_str(), part.name().c_str());
|
||||
|
||||
for (const rom_entry *data = part.romdata(); data->_name != nullptr; data++)
|
||||
if (data->_hashdata != nullptr)
|
||||
@ -675,7 +662,7 @@ void software_list_device::internal_validity_check(validity_checker &valid)
|
||||
// make sure the hash is valid
|
||||
hash_collection hashes;
|
||||
if (!hashes.from_internal_string(data->_hashdata))
|
||||
osd_printf_error("%s: %s has rom '%s' with an invalid hash string '%s'\n", filename(), swinfo.shortname(), data->_name, data->_hashdata);
|
||||
osd_printf_error("%s: %s has rom '%s' with an invalid hash string '%s'\n", filename(), swinfo.shortname().c_str(), data->_name, data->_hashdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -758,8 +745,10 @@ inline void softlist_parser::parse_error(Format &&fmt, Params &&... args)
|
||||
// attributes into a list of strings
|
||||
//-------------------------------------------------
|
||||
|
||||
void softlist_parser::parse_attributes(const char **attributes, int numattrs, const char *attrlist[], const char *outlist[])
|
||||
std::vector<std::string> softlist_parser::parse_attributes(const char **attributes, int numattrs, const char *attrlist[])
|
||||
{
|
||||
std::vector<std::string> outlist(numattrs);
|
||||
|
||||
// iterate over attribute/value pairs
|
||||
for( ; attributes[0]; attributes += 2)
|
||||
{
|
||||
@ -778,6 +767,8 @@ void softlist_parser::parse_attributes(const char **attributes, int numattrs, co
|
||||
if (index == numattrs)
|
||||
unknown_attribute(attributes[0]);
|
||||
}
|
||||
|
||||
return outlist;
|
||||
}
|
||||
|
||||
|
||||
@ -920,11 +911,10 @@ void softlist_parser::parse_root_start(const char *tagname, const char **attribu
|
||||
if (strcmp(tagname, "softwarelist") == 0)
|
||||
{
|
||||
static const char *attrnames[] = { "name", "description" };
|
||||
const char *attrvalues[ARRAY_LENGTH(attrnames)] = { nullptr };
|
||||
parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames, attrvalues);
|
||||
auto attrvalues = parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames);
|
||||
|
||||
if (attrvalues[1] != nullptr)
|
||||
m_list.m_description = m_list.add_string(attrvalues[1]);
|
||||
if (!attrvalues[1].empty())
|
||||
m_list.m_description = attrvalues[1];
|
||||
}
|
||||
else
|
||||
unknown_tag(tagname);
|
||||
@ -942,11 +932,10 @@ void softlist_parser::parse_main_start(const char *tagname, const char **attribu
|
||||
if (strcmp(tagname, "software") == 0)
|
||||
{
|
||||
static const char *attrnames[] = { "name", "cloneof", "supported" };
|
||||
const char *attrvalues[ARRAY_LENGTH(attrnames)] = { nullptr };
|
||||
parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames, attrvalues);
|
||||
auto attrvalues = parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames);
|
||||
|
||||
if (attrvalues[0] != nullptr)
|
||||
m_current_info = &m_list.m_infolist.append(*global_alloc(software_info(m_list, m_list.add_string(attrvalues[0]), m_list.add_string(attrvalues[1]), attrvalues[2])));
|
||||
if (!attrvalues[0].empty())
|
||||
m_current_info = &m_list.m_infolist.append(*global_alloc(software_info(m_list, std::move(attrvalues[0]), std::move(attrvalues[1]), attrvalues[2].c_str())));
|
||||
else
|
||||
parse_error("No name defined for item");
|
||||
}
|
||||
@ -985,11 +974,10 @@ void softlist_parser::parse_soft_start(const char *tagname, const char **attribu
|
||||
else if (strcmp(tagname, "info") == 0)
|
||||
{
|
||||
static const char *attrnames[] = { "name", "value" };
|
||||
const char *attrvalues[ARRAY_LENGTH(attrnames)] = { nullptr };
|
||||
parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames, attrvalues);
|
||||
auto attrvalues = parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames);
|
||||
|
||||
if (attrvalues[0] != nullptr && attrvalues[1] != nullptr)
|
||||
m_current_info->m_other_info.append(*global_alloc(feature_list_item(m_list.add_string(attrvalues[0]), m_list.add_string(attrvalues[1]))));
|
||||
if (!attrvalues[0].empty() && !attrvalues[1].empty())
|
||||
m_current_info->m_other_info.append(*global_alloc(feature_list_item(std::move(attrvalues[0]), std::move(attrvalues[1]))));
|
||||
else
|
||||
parse_error("Incomplete other_info definition");
|
||||
}
|
||||
@ -998,11 +986,10 @@ void softlist_parser::parse_soft_start(const char *tagname, const char **attribu
|
||||
else if (strcmp(tagname, "sharedfeat") == 0)
|
||||
{
|
||||
static const char *attrnames[] = { "name", "value" };
|
||||
const char *attrvalues[ARRAY_LENGTH(attrnames)] = { nullptr };
|
||||
parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames, attrvalues);
|
||||
auto attrvalues = parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames);
|
||||
|
||||
if (attrvalues[0] != nullptr && attrvalues[1] != nullptr)
|
||||
m_current_info->m_shared_info.append(*global_alloc(feature_list_item(m_list.add_string(attrvalues[0]), m_list.add_string(attrvalues[1]))));
|
||||
if (!attrvalues[0].empty() && !attrvalues[1].empty())
|
||||
m_current_info->m_shared_info.append(*global_alloc(feature_list_item(std::move(attrvalues[0]), std::move(attrvalues[1]))));
|
||||
else
|
||||
parse_error("Incomplete sharedfeat definition");
|
||||
}
|
||||
@ -1011,11 +998,10 @@ void softlist_parser::parse_soft_start(const char *tagname, const char **attribu
|
||||
else if (strcmp(tagname, "part" ) == 0)
|
||||
{
|
||||
static const char *attrnames[] = { "name", "interface" };
|
||||
const char *attrvalues[ARRAY_LENGTH(attrnames)] = { nullptr };
|
||||
parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames, attrvalues);
|
||||
auto attrvalues = parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames);
|
||||
|
||||
if (attrvalues[0] != nullptr && attrvalues[1] != nullptr && strcmp(attrvalues[0], "") != 0 && strcmp(attrvalues[1], "") != 0)
|
||||
m_current_part = &m_current_info->m_partdata.append(*global_alloc(software_part(*m_current_info, m_list.add_string(attrvalues[0]), m_list.add_string(attrvalues[1]))));
|
||||
if (!attrvalues[0].empty() && !attrvalues[1].empty())
|
||||
m_current_part = &m_current_info->m_partdata.append(*global_alloc(software_part(*m_current_info, std::move(attrvalues[0]), std::move(attrvalues[1]))));
|
||||
else
|
||||
parse_error("Incomplete part definition");
|
||||
}
|
||||
@ -1042,14 +1028,13 @@ void softlist_parser::parse_part_start(const char *tagname, const char **attribu
|
||||
if (strcmp(tagname, "dataarea") == 0)
|
||||
{
|
||||
static const char *attrnames[] = { "name", "size", "width", "endianness" };
|
||||
const char *attrvalues[ARRAY_LENGTH(attrnames)] = { nullptr };
|
||||
parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames, attrvalues);
|
||||
auto attrvalues = parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames);
|
||||
|
||||
if (attrvalues[0] != nullptr && attrvalues[1] != nullptr && strcmp(attrvalues[0], "") != 0 && strcmp(attrvalues[1], "") != 0)
|
||||
if (!attrvalues[0].empty() && !attrvalues[1].empty())
|
||||
{
|
||||
// handle region attributes
|
||||
const char *width = attrvalues[2];
|
||||
const char *endianness = attrvalues[3];
|
||||
const char *width = attrvalues[2].c_str();
|
||||
const char *endianness = attrvalues[3].c_str();
|
||||
UINT32 regionflags = ROMENTRYTYPE_REGION;
|
||||
|
||||
if (width != nullptr)
|
||||
@ -1075,7 +1060,7 @@ void softlist_parser::parse_part_start(const char *tagname, const char **attribu
|
||||
parse_error("Invalid dataarea endianness");
|
||||
}
|
||||
|
||||
add_rom_entry(attrvalues[0], nullptr, 0, strtol(attrvalues[1], nullptr, 0), regionflags);
|
||||
add_rom_entry(attrvalues[0].c_str(), nullptr, 0, strtol(attrvalues[1].c_str(), nullptr, 0), regionflags);
|
||||
}
|
||||
else
|
||||
parse_error("Incomplete dataarea definition");
|
||||
@ -1085,11 +1070,10 @@ void softlist_parser::parse_part_start(const char *tagname, const char **attribu
|
||||
else if (strcmp(tagname, "diskarea") == 0)
|
||||
{
|
||||
static const char *attrnames[] = { "name" };
|
||||
const char *attrvalues[ARRAY_LENGTH(attrnames)] = { nullptr };
|
||||
parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames, attrvalues);
|
||||
auto attrvalues = parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames);
|
||||
|
||||
if (attrvalues[0] != nullptr)
|
||||
add_rom_entry(attrvalues[0], nullptr, 0, 1, ROMENTRYTYPE_REGION | ROMREGION_DATATYPEDISK);
|
||||
if (!attrvalues[0].empty())
|
||||
add_rom_entry(attrvalues[0].c_str(), nullptr, 0, 1, ROMENTRYTYPE_REGION | ROMREGION_DATATYPEDISK);
|
||||
else
|
||||
parse_error("Incomplete diskarea definition");
|
||||
}
|
||||
@ -1098,11 +1082,10 @@ void softlist_parser::parse_part_start(const char *tagname, const char **attribu
|
||||
else if (strcmp(tagname, "feature") == 0)
|
||||
{
|
||||
static const char *attrnames[] = { "name", "value" };
|
||||
const char *attrvalues[ARRAY_LENGTH(attrnames)] = { nullptr };
|
||||
parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames, attrvalues);
|
||||
auto attrvalues = parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames);
|
||||
|
||||
if (attrvalues[0] != nullptr)
|
||||
m_current_part->m_featurelist.append(*global_alloc(feature_list_item(m_list.add_string(attrvalues[0]), m_list.add_string(attrvalues[1]))));
|
||||
if (!attrvalues[0].empty())
|
||||
m_current_part->m_featurelist.append(*global_alloc(feature_list_item(std::move(attrvalues[0]), std::move(attrvalues[1]))));
|
||||
else
|
||||
parse_error("Incomplete feature definition");
|
||||
}
|
||||
@ -1133,45 +1116,44 @@ void softlist_parser::parse_data_start(const char *tagname, const char **attribu
|
||||
if (strcmp(tagname, "rom") == 0)
|
||||
{
|
||||
static const char *attrnames[] = { "name", "size", "crc", "sha1", "offset", "value", "status", "loadflag" };
|
||||
const char *attrvalues[ARRAY_LENGTH(attrnames)] = { nullptr };
|
||||
parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames, attrvalues);
|
||||
auto attrvalues = parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames);
|
||||
|
||||
const char *name = attrvalues[0];
|
||||
const char *sizestr = attrvalues[1];
|
||||
const char *crc = attrvalues[2];
|
||||
const char *sha1 = attrvalues[3];
|
||||
const char *offsetstr = attrvalues[4];
|
||||
const char *value = attrvalues[5];
|
||||
const char *status = attrvalues[6];
|
||||
const char *loadflag = attrvalues[7];
|
||||
if (sizestr != nullptr && offsetstr != nullptr)
|
||||
const std::string &name = attrvalues[0];
|
||||
const std::string &sizestr = attrvalues[1];
|
||||
const std::string &crc = attrvalues[2];
|
||||
const std::string &sha1 = attrvalues[3];
|
||||
const std::string &offsetstr = attrvalues[4];
|
||||
const std::string &value = attrvalues[5];
|
||||
const std::string &status = attrvalues[6];
|
||||
const std::string &loadflag = attrvalues[7];
|
||||
if (!sizestr.empty() && !offsetstr.empty())
|
||||
{
|
||||
UINT32 length = strtol(sizestr, nullptr, 0);
|
||||
UINT32 offset = strtol(offsetstr, nullptr, 0);
|
||||
UINT32 length = strtol(sizestr.c_str(), nullptr, 0);
|
||||
UINT32 offset = strtol(offsetstr.c_str(), nullptr, 0);
|
||||
|
||||
if (loadflag != nullptr && strcmp(loadflag, "reload") == 0)
|
||||
if (loadflag == "reload")
|
||||
add_rom_entry(nullptr, nullptr, offset, length, ROMENTRYTYPE_RELOAD | ROM_INHERITFLAGS);
|
||||
else if (loadflag != nullptr && strcmp(loadflag, "reload_plain") == 0)
|
||||
else if (loadflag == "reload_plain")
|
||||
add_rom_entry(nullptr, nullptr, offset, length, ROMENTRYTYPE_RELOAD);
|
||||
else if (loadflag != nullptr && strcmp(loadflag, "continue") == 0)
|
||||
else if (loadflag == "continue")
|
||||
add_rom_entry(nullptr, nullptr, offset, length, ROMENTRYTYPE_CONTINUE | ROM_INHERITFLAGS);
|
||||
else if (loadflag != nullptr && strcmp(loadflag, "fill") == 0)
|
||||
add_rom_entry(nullptr, (const char *)(FPTR)(strtol(value, nullptr, 0) & 0xff), offset, length, ROMENTRYTYPE_FILL);
|
||||
else if (name != nullptr)
|
||||
else if (loadflag == "fill")
|
||||
add_rom_entry(nullptr, (const char *)(FPTR)(strtol(value.c_str(), nullptr, 0) & 0xff), offset, length, ROMENTRYTYPE_FILL);
|
||||
else if (!name.empty())
|
||||
{
|
||||
bool baddump = (status != nullptr && strcmp(status, "baddump") == 0);
|
||||
bool nodump = (status != nullptr && strcmp(status, "nodump") == 0);
|
||||
bool baddump = (status == "baddump");
|
||||
bool nodump = (status == "nodump");
|
||||
|
||||
std::string hashdata;
|
||||
if (nodump)
|
||||
{
|
||||
hashdata = string_format("%s", NO_DUMP);
|
||||
if (crc != nullptr && sha1 != nullptr)
|
||||
if (!crc.empty() && !sha1.empty())
|
||||
parse_error("No need for hash definition");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (crc != nullptr && sha1 != nullptr)
|
||||
if (!crc.empty() && !sha1.empty())
|
||||
hashdata = string_format("%c%s%c%s%s", hash_collection::HASH_CRC, crc, hash_collection::HASH_SHA1, sha1, (baddump ? BAD_DUMP : ""));
|
||||
else
|
||||
parse_error("Incomplete rom hash definition");
|
||||
@ -1179,25 +1161,25 @@ void softlist_parser::parse_data_start(const char *tagname, const char **attribu
|
||||
|
||||
// Handle loadflag attribute
|
||||
int romflags = 0;
|
||||
if (loadflag != nullptr && strcmp(loadflag, "load16_word_swap") == 0)
|
||||
if (loadflag == "load16_word_swap")
|
||||
romflags = ROM_GROUPWORD | ROM_REVERSE;
|
||||
else if (loadflag != nullptr && strcmp(loadflag, "load16_byte") == 0)
|
||||
else if (loadflag == "load16_byte")
|
||||
romflags = ROM_SKIP(1);
|
||||
else if (loadflag != nullptr && strcmp(loadflag, "load32_word_swap") == 0)
|
||||
else if (loadflag == "load32_word_swap")
|
||||
romflags = ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2);
|
||||
else if (loadflag != nullptr && strcmp(loadflag, "load32_word") == 0)
|
||||
else if (loadflag == "load32_word")
|
||||
romflags = ROM_GROUPWORD | ROM_SKIP(2);
|
||||
else if (loadflag != nullptr && strcmp(loadflag, "load32_byte") == 0)
|
||||
else if (loadflag == "load32_byte")
|
||||
romflags = ROM_SKIP(3);
|
||||
|
||||
add_rom_entry(name, hashdata.c_str(), offset, length, ROMENTRYTYPE_ROM | romflags);
|
||||
add_rom_entry(name.c_str(), hashdata.c_str(), offset, length, ROMENTRYTYPE_ROM | romflags);
|
||||
}
|
||||
else
|
||||
parse_error("Rom name missing");
|
||||
}
|
||||
else if (sizestr != nullptr && loadflag != nullptr && strcmp(loadflag, "ignore") == 0)
|
||||
else if (!sizestr.empty() && !loadflag.empty() && loadflag == "ignore")
|
||||
{
|
||||
UINT32 length = strtol(sizestr, nullptr, 0);
|
||||
UINT32 length = strtol(sizestr.c_str(), nullptr, 0);
|
||||
add_rom_entry(nullptr, nullptr, 0, length, ROMENTRYTYPE_IGNORE | ROM_INHERITFLAGS);
|
||||
}
|
||||
else
|
||||
@ -1208,13 +1190,12 @@ void softlist_parser::parse_data_start(const char *tagname, const char **attribu
|
||||
else if (strcmp(tagname, "disk") == 0)
|
||||
{
|
||||
static const char *attrnames[] = { "name", "sha1", "status", "writeable" };
|
||||
const char *attrvalues[ARRAY_LENGTH(attrnames)] = { nullptr };
|
||||
parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames, attrvalues);
|
||||
auto attrvalues = parse_attributes(attributes, ARRAY_LENGTH(attrnames), attrnames);
|
||||
|
||||
const char *name = attrvalues[0];
|
||||
const char *sha1 = attrvalues[1];
|
||||
const char *status = attrvalues[2];
|
||||
const char *writeablestr = attrvalues[3];
|
||||
const char *name = attrvalues[0].c_str();
|
||||
const char *sha1 = attrvalues[1].c_str();
|
||||
const char *status = attrvalues[2].c_str();
|
||||
const char *writeablestr = attrvalues[3].c_str();
|
||||
if (name != nullptr && sha1 != nullptr)
|
||||
{
|
||||
bool baddump = (status != nullptr && strcmp(status, "baddump") == 0);
|
||||
@ -1247,15 +1228,15 @@ void softlist_parser::parse_soft_end(const char *tagname)
|
||||
|
||||
// <description>
|
||||
if (strcmp(tagname, "description") == 0)
|
||||
m_current_info->m_longname = m_list.add_string(m_data_accum.c_str());
|
||||
m_current_info->m_longname = m_data_accum;
|
||||
|
||||
// <year>
|
||||
else if (strcmp(tagname, "year") == 0)
|
||||
m_current_info->m_year = m_list.add_string(m_data_accum.c_str());
|
||||
m_current_info->m_year = m_data_accum;
|
||||
|
||||
// <publisher>
|
||||
else if (strcmp(tagname, "publisher") == 0)
|
||||
m_current_info->m_publisher = m_list.add_string(m_data_accum.c_str());
|
||||
m_current_info->m_publisher = m_data_accum;
|
||||
|
||||
// </part>
|
||||
else if (strcmp(tagname, "part") == 0)
|
||||
|
@ -82,21 +82,26 @@ class feature_list_item
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
feature_list_item(const char *name = nullptr, const char *value = nullptr)
|
||||
feature_list_item(std::string &&name, std::string &&value)
|
||||
: m_next(nullptr),
|
||||
m_name(name),
|
||||
m_value(value) { }
|
||||
m_name(std::move(name)),
|
||||
m_value(std::move(value)) { }
|
||||
|
||||
feature_list_item(const std::string &name, const std::string &value)
|
||||
: m_next(nullptr),
|
||||
m_name(name),
|
||||
m_value(value) { }
|
||||
|
||||
// getters
|
||||
feature_list_item *next() const { return m_next; }
|
||||
const char *name() const { return m_name; }
|
||||
const char *value() const { return m_value; }
|
||||
const std::string &name() const { return m_name; }
|
||||
const std::string &value() const { return m_value; }
|
||||
|
||||
private:
|
||||
// internal state
|
||||
feature_list_item * m_next;
|
||||
const char * m_name;
|
||||
const char * m_value;
|
||||
std::string m_name;
|
||||
std::string m_value;
|
||||
};
|
||||
|
||||
|
||||
@ -110,30 +115,31 @@ class software_part
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
software_part(software_info &info, const char *name = nullptr, const char *interface = nullptr);
|
||||
software_part(software_info &info, std::string &&name, std::string &&interface);
|
||||
|
||||
// getters
|
||||
software_part *next() const { return m_next; }
|
||||
software_info &info() const { return m_info; }
|
||||
const char *name() const { return m_name; }
|
||||
const char *interface() const { return m_interface; }
|
||||
const std::string &name() const { return m_name; }
|
||||
const std::string &interface() const { return m_interface; }
|
||||
const simple_list<feature_list_item> &featurelist() const { return m_featurelist; }
|
||||
const rom_entry *romdata(unsigned int index = 0) const { return (index < m_romdata.size()) ? &m_romdata[index] : nullptr; }
|
||||
|
||||
// helpers
|
||||
software_compatibility is_compatible(const software_list_device &swlist) const;
|
||||
bool matches_interface(const char *interface) const;
|
||||
const char *feature(const char *feature_name) const;
|
||||
const char *feature(const std::string &feature_name) const;
|
||||
device_image_interface *find_mountable_image(const machine_config &mconfig) const;
|
||||
|
||||
private:
|
||||
// internal state
|
||||
software_part * m_next;
|
||||
software_info & m_info;
|
||||
const char * m_name;
|
||||
const char * m_interface;
|
||||
simple_list<feature_list_item> m_featurelist;
|
||||
std::vector<rom_entry> m_romdata;
|
||||
software_part * m_next;
|
||||
software_info & m_info;
|
||||
std::string m_name;
|
||||
std::string m_interface;
|
||||
simple_list<feature_list_item> m_featurelist;
|
||||
std::vector<rom_entry> m_romdata;
|
||||
std::vector<std::string> m_romdata_strings;
|
||||
};
|
||||
|
||||
|
||||
@ -147,16 +153,16 @@ class software_info
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
software_info(software_list_device &list, const char *name, const char *parent, const char *supported);
|
||||
software_info(software_list_device &list, std::string &&name, std::string &&parent, const char *supported);
|
||||
|
||||
// getters
|
||||
software_info *next() const { return m_next; }
|
||||
software_list_device &list() const { return m_list; }
|
||||
const char *shortname() const { return m_shortname; }
|
||||
const char *longname() const { return m_longname; }
|
||||
const char *parentname() const { return m_parentname; }
|
||||
const char *year() const { return m_year; }
|
||||
const char *publisher() const { return m_publisher; }
|
||||
const std::string &shortname() const { return m_shortname; }
|
||||
const std::string &longname() const { return m_longname; }
|
||||
const std::string &parentname() const { return m_parentname; }
|
||||
const std::string &year() const { return m_year; }
|
||||
const std::string &publisher() const { return m_publisher; }
|
||||
const simple_list<feature_list_item> &other_info() const { return m_other_info; }
|
||||
const simple_list<feature_list_item> &shared_info() const { return m_shared_info; }
|
||||
UINT32 supported() const { return m_supported; }
|
||||
@ -172,11 +178,11 @@ private:
|
||||
software_info * m_next;
|
||||
software_list_device & m_list;
|
||||
UINT32 m_supported;
|
||||
const char * m_shortname;
|
||||
const char * m_longname;
|
||||
const char * m_parentname;
|
||||
const char * m_year; // Copyright year on title screen, actual release dates can be tracked in external resources
|
||||
const char * m_publisher;
|
||||
std::string m_shortname;
|
||||
std::string m_longname;
|
||||
std::string m_parentname;
|
||||
std::string m_year; // Copyright year on title screen, actual release dates can be tracked in external resources
|
||||
std::string m_publisher;
|
||||
simple_list<feature_list_item> m_other_info; // Here we store info like developer, serial #, etc. which belong to the software entry as a whole
|
||||
simple_list<feature_list_item> m_shared_info; // Here we store info like TV standard compatibility, or add-on requirements, etc. which get inherited
|
||||
// by each part of this software entry (after loading these are stored in partdata->featurelist)
|
||||
@ -206,7 +212,7 @@ public:
|
||||
const char *filename() { return m_file.filename(); }
|
||||
|
||||
// getters that may trigger a parse
|
||||
const char *description() { if (!m_parsed) parse(); return m_description; }
|
||||
const char *description() { if (!m_parsed) parse(); return m_description.c_str(); }
|
||||
bool valid() { if (!m_parsed) parse(); return m_infolist.count() > 0; }
|
||||
const char *errors_string() { if (!m_parsed) parse(); return m_errors.c_str(); }
|
||||
const simple_list<software_info> &get_info() { if (!m_parsed) parse(); return m_infolist; }
|
||||
@ -218,7 +224,6 @@ public:
|
||||
|
||||
// string pool helpers
|
||||
const char *add_string(const char *string) { return m_stringpool.add(string); }
|
||||
bool string_pool_contains(const char *string) { return m_stringpool.contains(string); }
|
||||
|
||||
// static helpers
|
||||
static software_list_device *find_by_name(const machine_config &mconfig, const char *name);
|
||||
@ -241,7 +246,7 @@ protected:
|
||||
// internal state
|
||||
bool m_parsed;
|
||||
emu_file m_file;
|
||||
const char * m_description;
|
||||
std::string m_description;
|
||||
std::string m_errors;
|
||||
simple_list<software_info> m_infolist;
|
||||
const_string_pool m_stringpool;
|
||||
|
@ -159,7 +159,7 @@ media_auditor::summary media_auditor::audit_software(const char *list_name, cons
|
||||
|
||||
std::string combinedpath(util::string_format("%s;%s%s%s", swinfo->shortname(), list_name, PATH_SEPARATOR, swinfo->shortname()));
|
||||
std::string locationtag(util::string_format("%s%%%s%%", list_name, swinfo->shortname()));
|
||||
if (swinfo->parentname() != nullptr)
|
||||
if (!swinfo->parentname().empty())
|
||||
{
|
||||
locationtag.append(swinfo->parentname());
|
||||
combinedpath.append(util::string_format(";%s;%s%s%s", swinfo->parentname(), list_name, PATH_SEPARATOR, swinfo->parentname()));
|
||||
|
@ -385,7 +385,7 @@ int media_identifier::find_by_hash(const hash_collection &hashes, int length)
|
||||
// output information about the match
|
||||
if (found)
|
||||
osd_printf_info(" ");
|
||||
osd_printf_info("= %s%-20s %s:%s %s\n", baddump ? "(BAD) " : "", ROM_GETNAME(rom), swlistdev.list_name(), swinfo.shortname(), swinfo.longname());
|
||||
osd_printf_info("= %s%-20s %s:%s %s\n", baddump ? "(BAD) " : "", ROM_GETNAME(rom), swlistdev.list_name(), swinfo.shortname().c_str(), swinfo.longname().c_str());
|
||||
found++;
|
||||
}
|
||||
}
|
||||
@ -1390,31 +1390,31 @@ void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlis
|
||||
fprintf(out, "\t<softwarelist name=\"%s\" description=\"%s\">\n", swlistdev.list_name(), xml_normalize_string(swlistdev.description()));
|
||||
for (software_info &swinfo : swlistdev.get_info())
|
||||
{
|
||||
fprintf(out, "\t\t<software name=\"%s\"", swinfo.shortname());
|
||||
if (swinfo.parentname() != nullptr)
|
||||
fprintf(out, " cloneof=\"%s\"", swinfo.parentname());
|
||||
fprintf(out, "\t\t<software name=\"%s\"", swinfo.shortname().c_str());
|
||||
if (!swinfo.parentname().empty())
|
||||
fprintf(out, " cloneof=\"%s\"", swinfo.parentname().c_str());
|
||||
if (swinfo.supported() == SOFTWARE_SUPPORTED_PARTIAL)
|
||||
fprintf(out, " supported=\"partial\"");
|
||||
if (swinfo.supported() == SOFTWARE_SUPPORTED_NO)
|
||||
fprintf(out, " supported=\"no\"");
|
||||
fprintf(out, ">\n" );
|
||||
fprintf(out, "\t\t\t<description>%s</description>\n", xml_normalize_string(swinfo.longname()));
|
||||
fprintf(out, "\t\t\t<year>%s</year>\n", xml_normalize_string(swinfo.year()));
|
||||
fprintf(out, "\t\t\t<publisher>%s</publisher>\n", xml_normalize_string(swinfo.publisher()));
|
||||
fprintf(out, "\t\t\t<description>%s</description>\n", xml_normalize_string(swinfo.longname().c_str()));
|
||||
fprintf(out, "\t\t\t<year>%s</year>\n", xml_normalize_string(swinfo.year().c_str()));
|
||||
fprintf(out, "\t\t\t<publisher>%s</publisher>\n", xml_normalize_string(swinfo.publisher().c_str()));
|
||||
|
||||
for (feature_list_item &flist : swinfo.other_info())
|
||||
fprintf( out, "\t\t\t<info name=\"%s\" value=\"%s\"/>\n", flist.name(), xml_normalize_string( flist.value() ) );
|
||||
fprintf( out, "\t\t\t<info name=\"%s\" value=\"%s\"/>\n", flist.name().c_str(), xml_normalize_string( flist.value().c_str()) );
|
||||
|
||||
for (software_part &part : swinfo.parts())
|
||||
{
|
||||
fprintf(out, "\t\t\t<part name=\"%s\"", part.name());
|
||||
if (part.interface() != nullptr)
|
||||
fprintf(out, " interface=\"%s\"", part.interface());
|
||||
fprintf(out, "\t\t\t<part name=\"%s\"", part.name().c_str());
|
||||
if (!part.interface().empty())
|
||||
fprintf(out, " interface=\"%s\"", part.interface().c_str());
|
||||
|
||||
fprintf(out, ">\n");
|
||||
|
||||
for (feature_list_item &flist : part.featurelist())
|
||||
fprintf(out, "\t\t\t\t<feature name=\"%s\" value=\"%s\" />\n", flist.name(), xml_normalize_string(flist.value()));
|
||||
fprintf(out, "\t\t\t\t<feature name=\"%s\" value=\"%s\" />\n", flist.name().c_str(), xml_normalize_string(flist.value().c_str()));
|
||||
|
||||
/* TODO: display rom region information */
|
||||
for (const rom_entry *region = part.romdata(); region; region = rom_next_region(region))
|
||||
|
@ -40,9 +40,9 @@ menu_dats_view::menu_dats_view(mame_ui_manager &mui, render_container &container
|
||||
if (image.filename())
|
||||
{
|
||||
m_list = strensure(image.software_list_name());
|
||||
m_short = strensure(image.software_entry()->shortname());
|
||||
m_long = strensure(image.software_entry()->longname());
|
||||
m_parent = strensure(image.software_entry()->parentname());
|
||||
m_short = image.software_entry()->shortname();
|
||||
m_long = image.software_entry()->longname();
|
||||
m_parent = image.software_entry()->parentname();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ void menu_file_manager::fill_image_line(device_image_interface *img, std::string
|
||||
if (img->part_entry() != nullptr)
|
||||
{
|
||||
const software_part *tmp = img->part_entry();
|
||||
if (tmp->name() != nullptr)
|
||||
if (!tmp->name().empty())
|
||||
{
|
||||
filename.append(" (");
|
||||
filename.append(tmp->name());
|
||||
|
@ -192,7 +192,7 @@ void menu_control_device_image::handle()
|
||||
|
||||
case START_OTHER_PART:
|
||||
m_submenu_result.swparts = menu_software_parts::result::INVALID;
|
||||
menu::stack_push<menu_software_parts>(ui(), container(), m_swi, m_swp->interface(), &m_swp, true, m_submenu_result.swparts);
|
||||
menu::stack_push<menu_software_parts>(ui(), container(), m_swi, m_swp->interface().c_str(), &m_swp, true, m_submenu_result.swparts);
|
||||
m_state = SELECT_OTHER_PART;
|
||||
break;
|
||||
|
||||
|
@ -194,20 +194,20 @@ void favorite_manager::add_favorite_game()
|
||||
auto swinfo = image.software_entry();
|
||||
auto part = image.part_entry();
|
||||
ui_software_info tmpmatches;
|
||||
tmpmatches.shortname = strensure(swinfo->shortname());
|
||||
tmpmatches.shortname = swinfo->shortname();
|
||||
tmpmatches.longname = strensure(image.longname());
|
||||
tmpmatches.parentname = strensure(swinfo->parentname());
|
||||
tmpmatches.parentname = swinfo->parentname();
|
||||
tmpmatches.year = strensure(image.year());
|
||||
tmpmatches.publisher = strensure(image.manufacturer());
|
||||
tmpmatches.supported = image.supported();
|
||||
tmpmatches.part = strensure(part->name());
|
||||
tmpmatches.part = part->name();
|
||||
tmpmatches.driver = &machine().system();
|
||||
tmpmatches.listname = strensure(image.software_list_name());
|
||||
tmpmatches.interface = strensure(part->interface());
|
||||
tmpmatches.interface = part->interface();
|
||||
tmpmatches.instance = strensure(image.instance_name());
|
||||
tmpmatches.startempty = 0;
|
||||
tmpmatches.parentlongname.clear();
|
||||
if (swinfo->parentname())
|
||||
if (!swinfo->parentname().empty())
|
||||
{
|
||||
auto swlist = software_list_device::find_by_name(machine().config(), image.software_list_name());
|
||||
for (software_info &c_swinfo : swlist->get_info())
|
||||
@ -223,7 +223,7 @@ void favorite_manager::add_favorite_game()
|
||||
|
||||
tmpmatches.usage.clear();
|
||||
for (feature_list_item &flist : swinfo->other_info())
|
||||
if (!strcmp(flist.name(), "usage"))
|
||||
if (!strcmp(flist.name().c_str(), "usage"))
|
||||
tmpmatches.usage = flist.value();
|
||||
|
||||
tmpmatches.devicetype = strensure(image.image_type_name());
|
||||
|
@ -552,23 +552,23 @@ void menu_select_software::build_software_list()
|
||||
if (instance_name == nullptr || type_name == nullptr)
|
||||
continue;
|
||||
|
||||
tmpmatches.shortname = strensure(swinfo.shortname());
|
||||
tmpmatches.longname = strensure(swinfo.longname());
|
||||
tmpmatches.parentname = strensure(swinfo.parentname());
|
||||
tmpmatches.year = strensure(swinfo.year());
|
||||
tmpmatches.publisher = strensure(swinfo.publisher());
|
||||
tmpmatches.shortname = swinfo.shortname();
|
||||
tmpmatches.longname = swinfo.longname();
|
||||
tmpmatches.parentname = swinfo.parentname();
|
||||
tmpmatches.year = swinfo.year();
|
||||
tmpmatches.publisher = swinfo.publisher();
|
||||
tmpmatches.supported = swinfo.supported();
|
||||
tmpmatches.part = strensure(part->name());
|
||||
tmpmatches.part = part->name();
|
||||
tmpmatches.driver = m_driver;
|
||||
tmpmatches.listname = strensure(swlist.list_name());
|
||||
tmpmatches.interface = strensure(part->interface());
|
||||
tmpmatches.interface = part->interface();
|
||||
tmpmatches.startempty = 0;
|
||||
tmpmatches.parentlongname.clear();
|
||||
tmpmatches.usage.clear();
|
||||
tmpmatches.available = false;
|
||||
|
||||
for (feature_list_item &flist : swinfo.other_info())
|
||||
if (!strcmp(flist.name(), "usage"))
|
||||
if (!strcmp(flist.name().c_str(), "usage"))
|
||||
tmpmatches.usage = flist.value();
|
||||
|
||||
m_swinfo.push_back(tmpmatches);
|
||||
|
Loading…
Reference in New Issue
Block a user