diff options
author | 2021-10-09 12:16:17 +1100 | |
---|---|---|
committer | 2021-10-09 12:16:17 +1100 | |
commit | 38082ccbee749d650ccea886ae376a5d1dec337c (patch) | |
tree | 9ba9a900ba826bda58832834278025ced17f42f5 /src/frontend/mame/ui/inifile.cpp | |
parent | 34b3bf701098082feb9077db49987507962c1578 (diff) |
Overdue internal UI enhancements (#8674)
* frontend: Added support for message context to localisations.
* frontend: Added string_view versions of the message lookup functions.
* frontend: Added a few more folder options to the internal UI.
* emu/softlist.cpp: Use more appropriate containers.
* Switched to Python 3 by default - this will become a requirement.
* Updated msgfmt.py for message context support.
* frontend: Show all software item info in the internal UI.
* frontend: Search alternate titles in software selection menu.
* 3rdparty/utf8proc: Updated to v2.6.1 (has several fixes).
* frontend: Added software filters for common info fields.
* frontend: Allow UI manager to hold onto persistent session data.
* frontend: Cache software lists for eight machines.
* frontend: Added support for loading localised system names.
* frontend: Add UI for selecting localised system names.
Diffstat (limited to 'src/frontend/mame/ui/inifile.cpp')
-rw-r--r-- | src/frontend/mame/ui/inifile.cpp | 75 |
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); |