summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-05-04 03:01:32 +1000
committer Vas Crabb <vas@vastheman.com>2018-05-04 03:01:32 +1000
commit32a73f450da82c345b0f694bee311af34a5e717d (patch)
treede6259ee4c0120e992f348afcc9078e16bbe49d4 /src/frontend
parentaa96f47092f764f089c2ce9e0f26d756197150e8 (diff)
Make MCFG_DEVICE_ADD and callable device types more flexible:
* Allows defaulted clocks (see subtle example with vboy) * Allows additional constructors (see RS232 port in tranz330) * Allows use of device finder in place of tag in MCFG_DEVICE_ADD * Requires out-of-line destructor for devices using incomplete types * Requires XTAL or explicit u32 for clocks for devices with private types Devices must still define the standard constructor. When writing additional constructors, be aware that the constructor runs before device_add_mconfig in the context of the existing device, not the new device. See osborne1, zorba, tranz330, and vboy for examples of this in use. Compilation is a bit slower, but this is temporary while refactoring is in progress. Eliminated the need for MCFG_SOUND_ROUTE_EX. Removed macros from slot option configuration - they just obfuscated code and slowed it down with needless dynamic casts, but didn't actually simplify it.
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/clifront.cpp6
-rw-r--r--src/frontend/mame/ui/devopt.cpp2
-rw-r--r--src/frontend/mame/ui/devopt.h4
-rw-r--r--src/frontend/mame/ui/slotopt.cpp10
-rw-r--r--src/frontend/mame/ui/slotopt.h2
5 files changed, 12 insertions, 12 deletions
diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp
index 937d07b5ab6..a5f186dec7f 100644
--- a/src/frontend/mame/clifront.cpp
+++ b/src/frontend/mame/clifront.cpp
@@ -860,13 +860,13 @@ void cli_frontend::listslots(const std::vector<std::string> &args)
if (slot.fixed()) continue;
// build a list of user-selectable options
- std::vector<device_slot_option *> option_list;
+ std::vector<device_slot_interface::slot_option const *> option_list;
for (auto &option : slot.option_list())
if (option.second->selectable())
option_list.push_back(option.second.get());
// sort them by name
- std::sort(option_list.begin(), option_list.end(), [](device_slot_option *opt1, device_slot_option *opt2) {
+ std::sort(option_list.begin(), option_list.end(), [](device_slot_interface::slot_option const *opt1, device_slot_interface::slot_option const *opt2) {
return strcmp(opt1->name(), opt2->name()) < 0;
});
@@ -877,7 +877,7 @@ void cli_frontend::listslots(const std::vector<std::string> &args)
bool first_option = true;
// get the options and print them
- for (device_slot_option *opt : option_list)
+ for (device_slot_interface::slot_option const *opt : option_list)
{
if (first_option)
printf("%-16s %s\n", opt->name(), opt->devtype().fullname());
diff --git a/src/frontend/mame/ui/devopt.cpp b/src/frontend/mame/ui/devopt.cpp
index c546a4548a7..ac9a721e455 100644
--- a/src/frontend/mame/ui/devopt.cpp
+++ b/src/frontend/mame/ui/devopt.cpp
@@ -19,7 +19,7 @@ namespace ui {
menu
-------------------------------------------------*/
-menu_device_config::menu_device_config(mame_ui_manager &mui, render_container &container, device_slot_interface *slot, device_slot_option *option) : menu(mui, container)
+menu_device_config::menu_device_config(mame_ui_manager &mui, render_container &container, device_slot_interface *slot, device_slot_interface::slot_option const *option) : menu(mui, container)
{
m_option = option;
m_owner = slot;
diff --git a/src/frontend/mame/ui/devopt.h b/src/frontend/mame/ui/devopt.h
index 1bd3fafb627..2bb4e24c6c0 100644
--- a/src/frontend/mame/ui/devopt.h
+++ b/src/frontend/mame/ui/devopt.h
@@ -19,7 +19,7 @@ namespace ui {
class menu_device_config : public menu
{
public:
- menu_device_config(mame_ui_manager &mui, render_container &container, device_slot_interface *slot, device_slot_option *option);
+ menu_device_config(mame_ui_manager &mui, render_container &container, device_slot_interface *slot, device_slot_interface::slot_option const *option);
virtual ~menu_device_config() override;
private:
@@ -27,7 +27,7 @@ private:
virtual void handle() override;
device_slot_interface *m_owner;
- device_slot_option *m_option;
+ device_slot_interface::slot_option const *m_option;
bool m_mounted;
};
diff --git a/src/frontend/mame/ui/slotopt.cpp b/src/frontend/mame/ui/slotopt.cpp
index d61246a7661..b41e7f4c935 100644
--- a/src/frontend/mame/ui/slotopt.cpp
+++ b/src/frontend/mame/ui/slotopt.cpp
@@ -61,7 +61,7 @@ menu_slot_devices::~menu_slot_devices()
// slot option
//-------------------------------------------------
-device_slot_option *menu_slot_devices::get_current_option(device_slot_interface &slot) const
+device_slot_interface::slot_option const *menu_slot_devices::get_current_option(device_slot_interface &slot) const
{
std::string current;
@@ -184,7 +184,7 @@ void menu_slot_devices::populate(float &customtop, float &custombottom)
// name this option
std::string opt_name(DIVIDER);
- const device_slot_option *option = get_current_option(slot);
+ device_slot_interface::slot_option const *option = get_current_option(slot);
if (option)
{
opt_name = has_selectable_options
@@ -216,7 +216,7 @@ void menu_slot_devices::custom_render(void *selectedref, float top, float bottom
if (selectedref && (ITEMREF_RESET != selectedref))
{
device_slot_interface *const slot(reinterpret_cast<device_slot_interface *>(selectedref));
- device_slot_option const *const option(get_current_option(*slot));
+ device_slot_interface::slot_option const *const option(get_current_option(*slot));
char const *const text[] = { option ? option->devtype().fullname() : _("[empty slot]") };
draw_text_box(
std::begin(text), std::end(text),
@@ -251,7 +251,7 @@ void menu_slot_devices::handle()
else if (menu_event->iptkey == IPT_UI_SELECT)
{
device_slot_interface *slot = (device_slot_interface *)menu_event->itemref;
- device_slot_option *option = get_current_option(*slot);
+ device_slot_interface::slot_option const *const option = get_current_option(*slot);
if (option)
menu::stack_push<menu_device_config>(ui(), container(), slot, option);
}
@@ -268,7 +268,7 @@ void menu_slot_devices::rotate_slot_device(device_slot_interface &slot, menu_slo
// first, we need to make sure our cache of options is up to date
if (m_current_option_list_slot_tag != slot.device().tag())
{
- device_slot_option *current = get_current_option(slot);
+ device_slot_interface::slot_option const *current = get_current_option(slot);
// build the option list, including the blank option
m_current_option_list.clear();
diff --git a/src/frontend/mame/ui/slotopt.h b/src/frontend/mame/ui/slotopt.h
index 1a4421520d4..703b9b16f23 100644
--- a/src/frontend/mame/ui/slotopt.h
+++ b/src/frontend/mame/ui/slotopt.h
@@ -34,7 +34,7 @@ private:
virtual void custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual void handle() override;
- device_slot_option *get_current_option(device_slot_interface &slot) const;
+ device_slot_interface::slot_option const *get_current_option(device_slot_interface &slot) const;
void set_slot_device(device_slot_interface &slot, const char *val);
void record_current_options();
bool try_refresh_current_options();