summaryrefslogtreecommitdiffstats
path: root/docs/release/src/frontend/mame/ui/inifile.cpp
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2021-10-27 14:57:10 +1100
committer Robbbert <Robbbert@users.noreply.github.com>2021-10-27 14:57:10 +1100
commit7963e94b66da5ae455d99e1cb700604006df5221 (patch)
tree7bb1e5b6f99f83bbbf7d30eafb5cd30dc5a04944 /docs/release/src/frontend/mame/ui/inifile.cpp
parent94b51d9776fe0f3bdd0878b710d4b6bccf17cd47 (diff)
Files for 0.237tag237
Diffstat (limited to 'docs/release/src/frontend/mame/ui/inifile.cpp')
-rw-r--r--docs/release/src/frontend/mame/ui/inifile.cpp90
1 files changed, 43 insertions, 47 deletions
diff --git a/docs/release/src/frontend/mame/ui/inifile.cpp b/docs/release/src/frontend/mame/ui/inifile.cpp
index 9e43de79623..02713cd5f57 100644
--- a/docs/release/src/frontend/mame/ui/inifile.cpp
+++ b/docs/release/src/frontend/mame/ui/inifile.cpp
@@ -13,10 +13,13 @@
#include "ui/moptions.h"
-#include "corestr.h"
+#include "language.h"
+
#include "drivenum.h"
#include "softlist_dev.h"
+#include "corestr.h"
+
#include <algorithm>
#include <cstring>
#include <iterator>
@@ -227,49 +230,59 @@ 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);
+
+ // need to populate this, it isn't displayed anywhere else
+ tmpmatches.infotext.append(tmpmatches.longname);
+ tmpmatches.infotext.append(1, '\n');
+ tmpmatches.infotext.append(_("swlist-info", "Software list/item"));
+ tmpmatches.infotext.append(1, '\n');
+ tmpmatches.infotext.append(tmpmatches.listname);
+ tmpmatches.infotext.append(1, ':');
+ tmpmatches.infotext.append(tmpmatches.shortname);
+
m_favorites.emplace(std::move(tmpmatches));
}
file.close();
@@ -300,25 +313,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)
@@ -336,16 +342,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));
}
@@ -575,7 +571,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);