summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/lib/osdobj_common.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2023-01-28 08:00:27 +1100
committer Vas Crabb <vas@vastheman.com>2023-01-28 08:16:53 +1100
commit2498f2b7cfb77f6a6d8d08f07075b7fa1c3ab63b (patch)
tree07f72639213d6ada8dd143be21e11178160a4894 /src/osd/modules/lib/osdobj_common.cpp
parent536c6eeb55a7d5b69ef61cb79ec35c3e09a1458e (diff)
Miscellaneous fixes and refactoring:
ui/analogipt.cpp: Fixed bar graph display for fields with ranges that wrap through zero. emu/inputdev.cpp: Separateed analog axis deadzone and switch threshold settings, reduced default deadzone, and fixed a potential division by zero if the deadzone and saturation settings are equal. emu/ioport.cpp: Fixed behaviour of absolute analog fields where range passes through zero - it previously only worked for specific combinations of mask, minimum and default. Removed a workaround from universal/getaway.cpp that is no longer necessary. emu/input.cpp: Fixed unintuitive behaviour when an absolute field is assigned an OR combination of a relative control folled by an absolute control (e.g. Mouse X or Joy 1 LSX). Also fixed reading axis input sequences where an axis code is followed by a switch code (these can only be produced by manually editing configuration files, not through MAME's UI), and fixed the returned type when multiple relative axes sum to zero. osd/modules/input_dinput.cpp: Fixed hat switches being stuck in up position when input is suspended in the background taito/taitoio_yoke.cpp: Give throttle control a distinct type, and don't auto-centre. osd: Added option to select MIDI provider module (currently only PortMidi and the dummy module are available). Also put various things in namespaces, and fixed builds including SDL sound module with native Windows OSD. emu/validity.cpp: Added check to catch I/O port fields using UI input types. emu/inpttype.ipp: Renamed inputs that were causing confusion. "Bill" and "Track" were causing confusion for translators and hence likely causing confusion for many users, especially those who are not native English speakers. "Track" as an abbreviation for "Trackball" was frequently being mistranslated, e.g. in the sense of a CD track selection button or even in the sense of a railway track. There's no reason to abbreviate it. "Bill" in the US English sense as a banknote is too ambiguous and was causing confusion for translators. It's better to use the less ambiguous "Banknote". Corrected Greek translations of "Trackball". Don't run GitHub Actions on issue template changes.
Diffstat (limited to 'src/osd/modules/lib/osdobj_common.cpp')
-rw-r--r--src/osd/modules/lib/osdobj_common.cpp88
1 files changed, 17 insertions, 71 deletions
diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp
index 9aab7f1dec0..3cde2b3d2aa 100644
--- a/src/osd/modules/lib/osdobj_common.cpp
+++ b/src/osd/modules/lib/osdobj_common.cpp
@@ -166,6 +166,9 @@ const options_entry osd_options::s_option_entries[] =
{ OSDOPTION_AUDIO_EFFECT "9", OSDOPTVAL_NONE, core_options::option_type::STRING, "AudioUnit effect 9" },
#endif
+ { nullptr, nullptr, core_options::option_type::HEADER, "OSD MIDI OPTIONS" },
+ { OSDOPTION_MIDI_PROVIDER, OSDOPTVAL_AUTO, core_options::option_type::STRING, "MIDI I/O method: " },
+
{ nullptr, nullptr, core_options::option_type::HEADER, "BGFX POST-PROCESSING OPTIONS" },
{ OSDOPTION_BGFX_PATH, "bgfx", core_options::option_type::PATH, "path to BGFX-related files" },
{ OSDOPTION_BGFX_BACKEND, "auto", core_options::option_type::STRING, "BGFX backend to use (d3d9, d3d11, d3d12, metal, opengl, gles, vulkan)" },
@@ -221,7 +224,7 @@ osd_common_t::~osd_common_t()
osd_output::pop(this);
}
-#define REGISTER_MODULE(_O, _X ) { extern const module_type _X; _O . register_module( _X ); }
+#define REGISTER_MODULE(O, X) { extern const module_type X; O.register_module(X); }
void osd_common_t::register_options()
{
@@ -301,72 +304,16 @@ void osd_common_t::register_options()
// after initialization we know which modules are supported
- const char *names[20];
- int num;
- std::vector<const char *> dnames;
-
- m_mod_man.get_module_names(OSD_MONITOR_PROVIDER, 20, num, names);
- for (int i = 0; i < num; i++)
- dnames.push_back(names[i]);
- update_option(OSD_MONITOR_PROVIDER, dnames);
-
- m_mod_man.get_module_names(OSD_FONT_PROVIDER, 20, num, names);
- dnames.clear();
- for (int i = 0; i < num; i++)
- dnames.push_back(names[i]);
- update_option(OSD_FONT_PROVIDER, dnames);
-
- m_mod_man.get_module_names(OSD_KEYBOARDINPUT_PROVIDER, 20, num, names);
- dnames.clear();
- for (int i = 0; i < num; i++)
- dnames.push_back(names[i]);
- update_option(OSD_KEYBOARDINPUT_PROVIDER, dnames);
-
- m_mod_man.get_module_names(OSD_MOUSEINPUT_PROVIDER, 20, num, names);
- dnames.clear();
- for (int i = 0; i < num; i++)
- dnames.push_back(names[i]);
- update_option(OSD_MOUSEINPUT_PROVIDER, dnames);
-
- m_mod_man.get_module_names(OSD_LIGHTGUNINPUT_PROVIDER, 20, num, names);
- dnames.clear();
- for (int i = 0; i < num; i++)
- dnames.push_back(names[i]);
- update_option(OSD_LIGHTGUNINPUT_PROVIDER, dnames);
-
- m_mod_man.get_module_names(OSD_JOYSTICKINPUT_PROVIDER, 20, num, names);
- dnames.clear();
- for (int i = 0; i < num; i++)
- dnames.push_back(names[i]);
- update_option(OSD_JOYSTICKINPUT_PROVIDER, dnames);
-
- m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, num, names);
- dnames.clear();
- for (int i = 0; i < num; i++)
- dnames.push_back(names[i]);
- update_option(OSD_SOUND_PROVIDER, dnames);
-
-#if 0
- // Register midi options and update options
- m_mod_man.get_module_names(OSD_MIDI_PROVIDER, 20, num, names);
- dnames.clear();
- for (int i = 0; i < num; i++)
- dnames.push_back(names[i]);
- update_option(OSD_MIDI_PROVIDER, dnames);
-#endif
-
- // Register debugger options and update options
- m_mod_man.get_module_names(OSD_DEBUG_PROVIDER, 20, num, names);
- dnames.clear();
- for (int i = 0; i < num; i++)
- dnames.push_back(names[i]);
- update_option(OSD_DEBUG_PROVIDER, dnames);
-
- m_mod_man.get_module_names(OSD_OUTPUT_PROVIDER, 20, num, names);
- dnames.clear();
- for (int i = 0; i < num; i++)
- dnames.push_back(names[i]);
- update_option(OSD_OUTPUT_PROVIDER, dnames);
+ update_option(OSD_MONITOR_PROVIDER, m_mod_man.get_module_names(OSD_MONITOR_PROVIDER));
+ update_option(OSD_FONT_PROVIDER, m_mod_man.get_module_names(OSD_FONT_PROVIDER));
+ update_option(OSD_KEYBOARDINPUT_PROVIDER, m_mod_man.get_module_names(OSD_KEYBOARDINPUT_PROVIDER));
+ update_option(OSD_MOUSEINPUT_PROVIDER, m_mod_man.get_module_names(OSD_MOUSEINPUT_PROVIDER));
+ update_option(OSD_LIGHTGUNINPUT_PROVIDER, m_mod_man.get_module_names(OSD_LIGHTGUNINPUT_PROVIDER));
+ update_option(OSD_JOYSTICKINPUT_PROVIDER, m_mod_man.get_module_names(OSD_JOYSTICKINPUT_PROVIDER));
+ update_option(OSD_SOUND_PROVIDER, m_mod_man.get_module_names(OSD_SOUND_PROVIDER));
+ update_option(OSD_MIDI_PROVIDER, m_mod_man.get_module_names(OSD_MIDI_PROVIDER));
+ update_option(OSD_DEBUG_PROVIDER, m_mod_man.get_module_names(OSD_DEBUG_PROVIDER));
+ update_option(OSD_OUTPUT_PROVIDER, m_mod_man.get_module_names(OSD_OUTPUT_PROVIDER));
// Register video options and update options
video_options_add("none", nullptr);
@@ -374,21 +321,20 @@ void osd_common_t::register_options()
update_option(OSDOPTION_VIDEO, m_video_names);
}
-void osd_common_t::update_option(const std::string &key, std::vector<const char *> &values)
+void osd_common_t::update_option(const std::string &key, std::vector<std::string_view> const &values)
{
std::string current_value(m_options.description(key.c_str()));
std::string new_option_value("");
for (unsigned int index = 0; index < values.size(); index++)
{
- std::string t(values[index]);
if (new_option_value.length() > 0)
{
- if( index != (values.size()-1))
+ if (index != (values.size() - 1))
new_option_value.append(", ");
else
new_option_value.append(" or ");
}
- new_option_value.append(t);
+ new_option_value.append(values[index]);
}
m_option_descs[key] = current_value + new_option_value;