summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Wilbert Pol <wilbert@jdg.info>2013-02-27 21:41:49 +0000
committer Wilbert Pol <wilbert@jdg.info>2013-02-27 21:41:49 +0000
commit3dd335f46d5427a4f4a46045f09fec12d61b02cc (patch)
treea3f8bd464ecc690ee245cb75cd170ae0043f23ec /src
parentafdbe5c65193f944ac4af55e1b8d0d99fbe768bc (diff)
(MESS) Be a bit more fine-grained in when to mark slot options as internal. (nw)
Diffstat (limited to 'src')
-rw-r--r--src/emu/dislot.c19
-rw-r--r--src/emu/dislot.h1
-rw-r--r--src/emu/emuopts.c16
-rw-r--r--src/lib/util/options.c17
-rw-r--r--src/lib/util/options.h2
5 files changed, 52 insertions, 3 deletions
diff --git a/src/emu/dislot.c b/src/emu/dislot.c
index 058e280b8cf..4190dac0bc0 100644
--- a/src/emu/dislot.c
+++ b/src/emu/dislot.c
@@ -61,6 +61,25 @@ const bool device_slot_interface::all_internal() const
return TRUE;
}
+
+bool device_slot_interface::is_internal_option(const char *option) const
+{
+ if ( !option )
+ {
+ return false;
+ }
+
+ for (int i = 0; m_slot_interfaces && m_slot_interfaces[i].name != NULL; i++)
+ {
+ if ( !strcmp(m_slot_interfaces[i].name, option) )
+ {
+ return m_slot_interfaces[i].internal;
+ }
+ }
+ return false;
+}
+
+
device_slot_card_interface::device_slot_card_interface(const machine_config &mconfig, device_t &device)
: device_interface(device)
{
diff --git a/src/emu/dislot.h b/src/emu/dislot.h
index bd5381718f2..5e87b6aea3c 100644
--- a/src/emu/dislot.h
+++ b/src/emu/dislot.h
@@ -60,6 +60,7 @@ public:
const UINT32 default_clock() const { return m_default_clock; }
const bool fixed() const { return m_fixed; }
const bool all_internal() const;
+ bool is_internal_option(const char *option) const;
device_t* get_card_device();
protected:
const char *m_default_card;
diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c
index f90b00b07c3..fd6e1e2e43b 100644
--- a/src/emu/emuopts.c
+++ b/src/emu/emuopts.c
@@ -236,7 +236,6 @@ bool emu_options::add_slot_options(bool isfirst)
for (const device_slot_interface *slot = iter.first(); slot != NULL; slot = iter.next())
{
if (slot->fixed()) continue;
- bool all_internal = slot->all_internal();
// first device? add the header as to be pretty
if (first && isfirst)
{
@@ -253,8 +252,15 @@ bool emu_options::add_slot_options(bool isfirst)
// add the option
entry[0].name = slot->device().tag() + 1;
entry[0].description = NULL;
- entry[0].flags = OPTION_STRING | OPTION_FLAG_DEVICE | ( all_internal ? OPTION_FLAG_INTERNAL : 0 );
+ entry[0].flags = OPTION_STRING | OPTION_FLAG_DEVICE;
entry[0].defvalue = (slot->get_slot_interfaces() != NULL) ? slot->get_default_card() : NULL;
+ if ( entry[0].defvalue )
+ {
+ if ( slot->is_internal_option( entry[0].defvalue ) )
+ {
+ entry[0].flags |= OPTION_FLAG_INTERNAL;
+ }
+ }
add_entries(entry, true);
added = true;
@@ -285,7 +291,11 @@ void emu_options::update_slot_options()
if (exists(slot->device().tag()+1)) {
if (slot->get_slot_interfaces() != NULL) {
const char *def = slot->get_default_card_software(config,*this);
- if (def) set_default_value(slot->device().tag()+1,def);
+ if (def)
+ {
+ set_default_value(slot->device().tag()+1,def);
+ set_flag(slot->device().tag()+1, ~OPTION_FLAG_INTERNAL, slot->is_internal_option(def) ? OPTION_FLAG_INTERNAL : 0 );
+ }
}
}
}
diff --git a/src/lib/util/options.c b/src/lib/util/options.c
index d89ef85190a..78cab4f08cf 100644
--- a/src/lib/util/options.c
+++ b/src/lib/util/options.c
@@ -153,6 +153,12 @@ void core_options::entry::set_default_value(const char *defvalue)
}
+void core_options::entry::set_flag(UINT32 mask, UINT32 flag)
+{
+ m_flags = ( m_flags & mask ) | flag;
+}
+
+
//-------------------------------------------------
// revert - revert back to our default if we are
// at or below the given priority
@@ -641,6 +647,17 @@ bool core_options::set_value(const char *name, float value, int priority, astrin
}
+void core_options::set_flag(const char *name, UINT32 mask, UINT32 flag)
+{
+ // find the entry first
+ entry *curentry = m_entrymap.find(name);
+ if ( curentry == NULL )
+ {
+ return;
+ }
+ curentry->set_flag(mask, flag);
+}
+
//-------------------------------------------------
// reset - reset the options state, removing
// everything
diff --git a/src/lib/util/options.h b/src/lib/util/options.h
index 28e478afb73..452bd5dbac1 100644
--- a/src/lib/util/options.h
+++ b/src/lib/util/options.h
@@ -122,6 +122,7 @@ public:
// setters
void set_value(const char *newvalue, int priority);
void set_default_value(const char *defvalue);
+ void set_flag(UINT32 mask, UINT32 flag);
void revert(int priority);
private:
@@ -186,6 +187,7 @@ public:
bool set_value(const char *name, const char *value, int priority, astring &error_string);
bool set_value(const char *name, int value, int priority, astring &error_string);
bool set_value(const char *name, float value, int priority, astring &error_string);
+ void set_flag(const char *name, UINT32 mask, UINT32 flags);
// misc
static const char *unadorned(int x = 0) { return s_option_unadorned[MIN(x, MAX_UNADORNED_OPTIONS)]; }