summaryrefslogtreecommitdiffstats
path: root/src/frontend/mame/ui/inifile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/mame/ui/inifile.cpp')
-rw-r--r--src/frontend/mame/ui/inifile.cpp75
1 files changed, 29 insertions, 46 deletions
diff --git a/src/frontend/mame/ui/inifile.cpp b/src/frontend/mame/ui/inifile.cpp
index 000ea922a4a..317df1c637a 100644
--- a/src/frontend/mame/ui/inifile.cpp
+++ b/src/frontend/mame/ui/inifile.cpp
@@ -219,48 +219,48 @@ favorite_manager::favorite_manager(ui_options &options)
if (!file.open(FAVORITE_FILENAME))
{
char readbuf[1024];
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
while (readbuf[0] == '[')
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
- while (file.gets(readbuf, 1024))
+ while (file.gets(readbuf, std::size(readbuf)))
{
ui_software_info tmpmatches;
tmpmatches.shortname = chartrimcarriage(readbuf);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.longname = chartrimcarriage(readbuf);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.parentname = chartrimcarriage(readbuf);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.year = chartrimcarriage(readbuf);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.publisher = chartrimcarriage(readbuf);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.supported = software_support(atoi(readbuf));
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.part = chartrimcarriage(readbuf);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
chartrimcarriage(readbuf);
auto dx = driver_list::find(readbuf);
if (0 > dx)
continue;
tmpmatches.driver = &driver_list::driver(dx);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.listname = chartrimcarriage(readbuf);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.interface = chartrimcarriage(readbuf);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.instance = chartrimcarriage(readbuf);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.startempty = atoi(readbuf);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.parentlongname = chartrimcarriage(readbuf);
- file.gets(readbuf, 1024);
- tmpmatches.usage = chartrimcarriage(readbuf);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
+ //tmpmatches.usage = chartrimcarriage(readbuf); TODO: recover multi-line info
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.devicetype = chartrimcarriage(readbuf);
- file.gets(readbuf, 1024);
+ file.gets(readbuf, std::size(readbuf));
tmpmatches.available = atoi(readbuf);
m_favorites.emplace(std::move(tmpmatches));
}
@@ -292,25 +292,18 @@ void favorite_manager::add_favorite(running_machine &machine)
if (imagedev)
{
// creating this is fairly expensive, but we'll assume this usually succeeds
- ui_software_info info;
software_part const *const part(imagedev->part_entry());
assert(software);
assert(part);
-
- // start with simple stuff that can just be copied
- info.shortname = software->shortname();
- info.longname = software->longname();
- info.parentname = software->parentname();
- info.year = software->year();
- info.publisher = software->publisher();
- info.supported = software->supported();
- info.part = part->name();
- info.driver = &driver;
- info.listname = imagedev->software_list_name();
- info.interface = part->interface();
- info.instance = imagedev->instance_name();
- info.startempty = 0;
- info.devicetype = strensure(imagedev->image_type_name());
+ ui_software_info info(
+ *software,
+ *part,
+ driver,
+ imagedev->software_list_name(),
+ imagedev->instance_name(),
+ strensure(imagedev->image_type_name()));
+
+ // assume it's available if it's mounted
info.available = true;
// look up the parent in the list if necessary (eugh, O(n) walk)
@@ -328,16 +321,6 @@ void favorite_manager::add_favorite(running_machine &machine)
}
}
- // fill in with the first usage entry we find
- for (feature_list_item const &feature : software->other_info())
- {
- if (feature.name() == "usage")
- {
- info.usage = feature.value();
- break;
- }
- }
-
// hooray for move semantics!
add_impl(std::move(info));
}
@@ -567,7 +550,7 @@ void favorite_manager::save_favorites()
buf << info.instance << '\n';
util::stream_format(buf, "%d\n", info.startempty);
buf << info.parentlongname << '\n';
- buf << info.usage << '\n';
+ buf << '\n'; //buf << info.usage << '\n'; TODO: store multi-line info in a recoverable format
buf << info.devicetype << '\n';
util::stream_format(buf, "%d\n", info.available);