diff options
author | Vas Crabb <vas@vastheman.com> | 2021-12-09 07:42:12 +1100 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2021-12-09 07:42:12 +1100 |
commit | 7d8c657fadc2a7b49a413eec9f4d3e7f7b34f6e4 (patch) | |
tree | 7d797bb486332e6a8dab5b0018a87e21bb5bb6dd /src/frontend/mame | |
parent | a435da6f9bd16871e5e7c562bd3ce591e0a04379 (diff) |
Moved localised I/O port name lookup into I/O port manager.
Added pseudo format specifiers to controller port names: %p for player
and %% for literal percent symbol. This lets you get the localised
player identifier in overridden input names (see NES and Neo-Geo for
examples), and reduces the number of messages to translate.
For translators, the new messages are mostly previously existing
messages with wording adjusted for clarity (e.g. referring to "media"
rather than "ROMs" in several places, as things like disk and tape
images are included). It's also possible to localise the "???"
dipslayed for an input without a valid name, but that should never
actually appear in practice.
Diffstat (limited to 'src/frontend/mame')
-rw-r--r-- | src/frontend/mame/infoxml.cpp | 14 | ||||
-rw-r--r-- | src/frontend/mame/ui/auditmenu.cpp | 6 | ||||
-rw-r--r-- | src/frontend/mame/ui/inputmap.cpp | 44 | ||||
-rw-r--r-- | src/frontend/mame/ui/inputmap.h | 2 | ||||
-rw-r--r-- | src/frontend/mame/ui/mainmenu.cpp | 6 | ||||
-rw-r--r-- | src/frontend/mame/ui/selmenu.cpp | 10 | ||||
-rw-r--r-- | src/frontend/mame/ui/submenu.cpp | 12 | ||||
-rw-r--r-- | src/frontend/mame/ui/ui.cpp | 2 |
8 files changed, 50 insertions, 46 deletions
diff --git a/src/frontend/mame/infoxml.cpp b/src/frontend/mame/infoxml.cpp index 8ff033194bf..6adb5f5e588 100644 --- a/src/frontend/mame/infoxml.cpp +++ b/src/frontend/mame/infoxml.cpp @@ -110,7 +110,7 @@ void output_footer(std::ostream &out); void output_one(std::ostream &out, driver_enumerator &drivlist, const game_driver &driver, device_type_set *devtypes); void output_sampleof(std::ostream &out, device_t &device); void output_bios(std::ostream &out, device_t const &device); -void output_rom(std::ostream &out, machine_config &config, driver_enumerator *drivlist, const game_driver *driver, device_t &device); +void output_rom(std::ostream &out, machine_config &config, driver_list const *drivlist, const game_driver *driver, device_t &device); void output_device_refs(std::ostream &out, device_t &root); void output_sample(std::ostream &out, device_t &device); void output_chips(std::ostream &out, device_t &device, const char *root_tag); @@ -131,7 +131,7 @@ void output_ramoptions(std::ostream &out, device_t &root); void output_one_device(std::ostream &out, machine_config &config, device_t &device, const char *devtag); void output_devices(std::ostream &out, emu_options &lookup_options, device_type_set const *filter); -char const *get_merge_name(driver_enumerator &drivlist, game_driver const &driver, util::hash_collection const &romhashes); +char const *get_merge_name(driver_list const &drivlist, game_driver const &driver, util::hash_collection const &romhashes); char const *get_merge_name(machine_config &config, device_t const &device, util::hash_collection const &romhashes); char const *get_merge_name(tiny_rom_entry const *roms, util::hash_collection const &romhashes); @@ -982,7 +982,7 @@ void output_bios(std::ostream &out, device_t const &device) // the XML output //------------------------------------------------- -void output_rom(std::ostream &out, machine_config &config, driver_enumerator *drivlist, const game_driver *driver, device_t &device) +void output_rom(std::ostream &out, machine_config &config, driver_list const *drivlist, const game_driver *driver, device_t &device) { enum class type { BIOS, NORMAL, DISK }; std::map<u32, char const *> biosnames; @@ -1053,7 +1053,7 @@ void output_rom(std::ostream &out, machine_config &config, driver_enumerator *dr if ((type::DISK == pass) != is_disk) continue; - // BIOS ROMs only apply to bioses + // BIOS ROMs only apply to BIOSes // FIXME: disk images associated with a system BIOS will never be listed u32 const biosno(ROM_GETBIOSFLAGS(rom)); if ((type::BIOS == pass) != bool(biosno)) @@ -1824,7 +1824,7 @@ void output_switches(std::ostream &out, const ioport_list &portlist, const char newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length()); // output the switch name information - std::string const normalized_field_name(normalize_string(field.name())); + std::string const normalized_field_name(normalize_string(field.specific_name())); std::string const normalized_newtag(normalize_string(newtag)); util::stream_format(out, "\t\t<%s name=\"%s\" tag=\"%s\" mask=\"%u\">\n", outertag, normalized_field_name, normalized_newtag, field.mask()); if (!field.condition().none()) @@ -1894,7 +1894,7 @@ void output_adjusters(std::ostream &out, const ioport_list &portlist) for (ioport_field const &field : port.second->fields()) if (field.type() == IPT_ADJUSTER) { - util::stream_format(out, "\t\t<adjuster name=\"%s\" default=\"%d\"/>\n", normalize_string(field.name()), field.defvalue()); + util::stream_format(out, "\t\t<adjuster name=\"%s\" default=\"%d\"/>\n", normalize_string(field.specific_name()), field.defvalue()); } } @@ -2169,7 +2169,7 @@ void output_ramoptions(std::ostream &out, device_t &root) // parent set //------------------------------------------------- -char const *get_merge_name(driver_enumerator &drivlist, game_driver const &driver, util::hash_collection const &romhashes) +char const *get_merge_name(driver_list const &drivlist, game_driver const &driver, util::hash_collection const &romhashes) { char const *result = nullptr; diff --git a/src/frontend/mame/ui/auditmenu.cpp b/src/frontend/mame/ui/auditmenu.cpp index aaad0967f00..a5cb46fc4d8 100644 --- a/src/frontend/mame/ui/auditmenu.cpp +++ b/src/frontend/mame/ui/auditmenu.cpp @@ -95,7 +95,7 @@ void menu_audit::custom_render(void *selectedref, float top, float bottom, float std::size_t const total(m_fast ? m_unavailable : m_availablesorted.size()); std::ostringstream text; util::stream_format(text, - _("Auditing ROMs for machine %2$u of %3$u...\n%1$s"), + _("Auditing media for machine %2$u of %3$u...\n%1$s"), system ? std::string_view(system->description) : std::string_view(), (std::min)(audited + 1, total), total); @@ -133,8 +133,8 @@ bool menu_audit::custom_ui_cancel() void menu_audit::populate(float &customtop, float &custombottom) { if (m_unavailable && (m_availablesorted.size() != m_unavailable)) - item_append(util::string_format(_("Audit ROMs for %1$u machines marked unavailable"), m_unavailable), 0, ITEMREF_START_FAST); - item_append(util::string_format(_("Audit ROMs for all %1$u machines"), m_availablesorted.size()), 0, ITEMREF_START_FULL); + item_append(util::string_format(_("Audit media for %1$u machines marked unavailable"), m_unavailable), 0, ITEMREF_START_FAST); + item_append(util::string_format(_("Audit media for all %1$u machines"), m_availablesorted.size()), 0, ITEMREF_START_FULL); item_append(menu_item_type::SEPARATOR, 0); custombottom = (ui().get_line_height() * 1.0f) + (ui().box_tb_border() * 3.0f); } diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp index ada0d087505..38dd73111be 100644 --- a/src/frontend/mame/ui/inputmap.cpp +++ b/src/frontend/mame/ui/inputmap.cpp @@ -78,26 +78,30 @@ void menu_input_general::populate(float &customtop, float &custombottom) for (const input_type_entry &entry : machine().ioport().types()) { // add if we match the group and we have a valid name - if ((entry.group() == group) && entry.name() && entry.name()[0]) + if (entry.group() == group) { - // loop over all sequence types - for (input_seq_type seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; ++seqtype) + std::string name = entry.name(); + if (!name.empty()) { - // build an entry for the standard sequence - input_item_data &item(data.emplace_back()); - item.ref = &entry; - item.seqtype = seqtype; - item.seq = machine().ioport().type_seq(entry.type(), entry.player(), seqtype); - item.defseq = &entry.defseq(seqtype); - item.group = entry.group(); - item.type = ioport_manager::type_is_analog(entry.type()) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; - item.is_optional = false; - item.name = _("input-name", entry.name()); - item.owner = nullptr; - - // stop after one, unless we're analog - if (item.type == INPUT_TYPE_DIGITAL) - break; + // loop over all sequence types + for (input_seq_type seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; ++seqtype) + { + // build an entry for the standard sequence + input_item_data &item(data.emplace_back()); + item.ref = &entry; + item.seqtype = seqtype; + item.seq = machine().ioport().type_seq(entry.type(), entry.player(), seqtype); + item.defseq = &entry.defseq(seqtype); + item.group = entry.group(); + item.type = ioport_manager::type_is_analog(entry.type()) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; + item.is_optional = false; + item.name = name; + item.owner = nullptr; + + // stop after one, unless we're analog + if (item.type == INPUT_TYPE_DIGITAL) + break; + } } } } @@ -165,7 +169,7 @@ void menu_input_specific::populate(float &customtop, float &custombottom) item.group = machine().ioport().type_group(field.type(), field.player()); item.type = field.is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; item.is_optional = field.optional(); - item.name = _("input-name", field.name()); + item.name = field.name(); item.owner = &field.device(); // stop after one, unless we're analog @@ -203,7 +207,7 @@ void menu_input_specific::populate(float &customtop, float &custombottom) return true; if (!codes2.empty() && (codes1.empty() || codes1[0] > codes2[0])) return false; - cmp = strcmp(i1.name, i2.name); + cmp = i1.name.compare(i2.name); if (cmp < 0) return true; if (cmp > 0) diff --git a/src/frontend/mame/ui/inputmap.h b/src/frontend/mame/ui/inputmap.h index 841382daf21..a43a6829b06 100644 --- a/src/frontend/mame/ui/inputmap.h +++ b/src/frontend/mame/ui/inputmap.h @@ -54,7 +54,7 @@ protected: input_seq_type seqtype = SEQ_TYPE_INVALID; // sequence type input_seq seq; // copy of the live sequence const input_seq * defseq = nullptr; // pointer to the default sequence - const char * name = nullptr; // pointer to the base name of the item + std::string name; // base name of the item const device_t * owner = nullptr; // pointer to the owner of the item ioport_group group = IPG_INVALID; // group type uint8_t type = 0U; // type of port diff --git a/src/frontend/mame/ui/mainmenu.cpp b/src/frontend/mame/ui/mainmenu.cpp index 0de7d7ca4d3..74f0060b6df 100644 --- a/src/frontend/mame/ui/mainmenu.cpp +++ b/src/frontend/mame/ui/mainmenu.cpp @@ -120,7 +120,7 @@ void menu_main::populate(float &customtop, float &custombottom) item_append(_("Input (general)"), 0, (void *)INPUT_GROUPS); - item_append(_("Input (this Machine)"), 0, (void *)INPUT_SPECIFIC); + item_append(_("Input (this machine)"), 0, (void *)INPUT_SPECIFIC); if (ui().machine_info().has_analog()) item_append(_("Analog Controls"), 0, (void *)ANALOG); @@ -152,7 +152,7 @@ void menu_main::populate(float &customtop, float &custombottom) item_append(_("Tape Control"), 0, (void *)TAPE_CONTROL); if (pty_interface_enumerator(machine().root_device()).first() != nullptr) - item_append(_("Pseudo terminals"), 0, (void *)PTY_INFO); + item_append(_("Pseudo Terminals"), 0, (void *)PTY_INFO); if (ui().machine_info().has_bioses()) item_append(_("BIOS Selection"), 0, (void *)BIOS_SELECTION); @@ -197,7 +197,7 @@ void menu_main::populate(float &customtop, float &custombottom) item_append(menu_item_type::SEPARATOR); - item_append(string_format(_("About %s"), emulator_info::get_appname()), 0, (void *)ABOUT); + item_append(string_format(_("About %1$s"), emulator_info::get_appname()), 0, (void *)ABOUT); item_append(menu_item_type::SEPARATOR); diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp index 1b393edc91a..3c16f83f112 100644 --- a/src/frontend/mame/ui/selmenu.cpp +++ b/src/frontend/mame/ui/selmenu.cpp @@ -2768,7 +2768,7 @@ void menu_select_launch::infos_render(float origx1, float origy1, float origx2, } else { - m_info_buffer = ""; + m_info_buffer.clear(); mame_machine_manager::instance()->lua()->call_plugin("data", m_info_view - 1, m_info_buffer); } } @@ -3057,9 +3057,9 @@ void menu_select_launch::general_info(ui_system_info const *system, game_driver // if everything looks good, schedule the new driver if (audit_passed(summary)) - str << _("ROM Audit Result\tOK\n"); + str << _("Media Audit Result\tOK\n"); else - str << _("ROM Audit Result\tBAD\n"); + str << _("Media Audit Result\tBAD\n"); if (summary_samples == media_auditor::NONE_NEEDED) str << _("Samples Audit Result\tNone Needed\n"); @@ -3070,10 +3070,10 @@ void menu_select_launch::general_info(ui_system_info const *system, game_driver } else { - str << _("ROM Audit \tDisabled\nSamples Audit \tDisabled\n"); + str << _("Media Audit\tDisabled\nSamples Audit\tDisabled\n"); } - buffer = str.str(); + buffer = std::move(str).str(); } } // namespace ui diff --git a/src/frontend/mame/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp index c36f837ce5c..496201c1cc4 100644 --- a/src/frontend/mame/ui/submenu.cpp +++ b/src/frontend/mame/ui/submenu.cpp @@ -36,12 +36,12 @@ std::vector<submenu::option> submenu::misc_options() { option_type::UI, N_("Enlarge images in the right panel"), OPTION_ENLARGE_SNAPS }, { option_type::EMU, N_("Cheats"), OPTION_CHEAT }, { option_type::EMU, N_("Show mouse pointer"), OPTION_UI_MOUSE }, - { option_type::EMU, N_("Confirm quit from machines"), OPTION_CONFIRM_QUIT }, - { option_type::EMU, N_("Skip information screen at startup"), OPTION_SKIP_GAMEINFO }, + { option_type::EMU, N_("Confirm quit from emulation"), OPTION_CONFIRM_QUIT }, + { option_type::EMU, N_("Skip system information screen"), OPTION_SKIP_GAMEINFO }, { option_type::UI, N_("Force 4:3 aspect for snapshot display"), OPTION_FORCED4X3 }, { option_type::UI, N_("Use image as background"), OPTION_USE_BACKGROUND }, { option_type::UI, N_("Skip BIOS selection menu"), OPTION_SKIP_BIOS_MENU }, - { option_type::UI, N_("Skip software parts selection menu"), OPTION_SKIP_PARTS_MENU }, + { option_type::UI, N_("Skip software part selection menu"), OPTION_SKIP_PARTS_MENU }, { option_type::UI, N_("Info auto audit"), OPTION_INFO_AUTO_AUDIT }, { option_type::UI, N_("Hide romless machine from available list"),OPTION_HIDE_ROMLESS } }; } @@ -88,11 +88,11 @@ std::vector<submenu::option> submenu::advanced_options() { option_type::EMU, N_("Multi-mouse"), OPTION_MULTIMOUSE }, { option_type::EMU, N_("Steadykey"), OPTION_STEADYKEY }, { option_type::EMU, N_("UI active"), OPTION_UI_ACTIVE }, - { option_type::EMU, N_("Offscreen reload"), OPTION_OFFSCREEN_RELOAD }, + { option_type::EMU, N_("Off-screen reload"), OPTION_OFFSCREEN_RELOAD }, { option_type::EMU, N_("Joystick deadzone"), OPTION_JOYSTICK_DEADZONE }, { option_type::EMU, N_("Joystick saturation"), OPTION_JOYSTICK_SATURATION }, { option_type::EMU, N_("Natural keyboard"), OPTION_NATURAL_KEYBOARD }, - { option_type::EMU, N_("Simultaneous contradictory"), OPTION_JOYSTICK_CONTRADICTORY }, + { option_type::EMU, N_("Allow contradictory joystick inputs"), OPTION_JOYSTICK_CONTRADICTORY }, { option_type::EMU, N_("Coin impulse"), OPTION_COIN_IMPULSE } }; } @@ -103,7 +103,7 @@ std::vector<submenu::option> submenu::control_options() { option_type::EMU, N_("Lightgun Device Assignment"), OPTION_LIGHTGUN_DEVICE }, { option_type::EMU, N_("Trackball Device Assignment"), OPTION_TRACKBALL_DEVICE }, { option_type::EMU, N_("Pedal Device Assignment"), OPTION_PEDAL_DEVICE }, - { option_type::EMU, N_("Adstick Device Assignment"), OPTION_ADSTICK_DEVICE }, + { option_type::EMU, N_("AD Stick Device Assignment"), OPTION_ADSTICK_DEVICE }, { option_type::EMU, N_("Paddle Device Assignment"), OPTION_PADDLE_DEVICE }, { option_type::EMU, N_("Dial Device Assignment"), OPTION_DIAL_DEVICE }, { option_type::EMU, N_("Positional Device Assignment"), OPTION_POSITIONAL_DEVICE }, diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index 663354420d2..f5978f9c1ea 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -351,7 +351,7 @@ void mame_ui_manager::initialize(running_machine &machine) const char *const service_mode_dipname = ioport_configurer::string_from_token(DEF_STR(Service_Mode)); for (auto &port : machine.ioport().ports()) for (ioport_field &field : port.second->fields()) - if (field.type() == IPT_DIPSWITCH && strcmp(field.name(), service_mode_dipname) == 0) + if ((field.type() == IPT_DIPSWITCH) && (field.name() == service_mode_dipname)) // FIXME: probably breaks with localisation, also issues with multiple devices field.set_defseq(machine.ioport().type_seq(IPT_SERVICE)); } |