mirror of
https://github.com/holub/mame
synced 2025-07-02 08:39:21 +03:00
(MESS) Be a bit more fine-grained in when to mark slot options as internal. (nw)
This commit is contained in:
parent
afdbe5c651
commit
3dd335f46d
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)]; }
|
||||
|
Loading…
Reference in New Issue
Block a user