trunk/src/emu/emuopts.c
| r21472 | r21473 | |
| 236 | 236 | for (const device_slot_interface *slot = iter.first(); slot != NULL; slot = iter.next()) |
| 237 | 237 | { |
| 238 | 238 | if (slot->fixed()) continue; |
| 239 | | bool all_internal = slot->all_internal(); |
| 240 | 239 | // first device? add the header as to be pretty |
| 241 | 240 | if (first && isfirst) |
| 242 | 241 | { |
| r21472 | r21473 | |
| 253 | 252 | // add the option |
| 254 | 253 | entry[0].name = slot->device().tag() + 1; |
| 255 | 254 | entry[0].description = NULL; |
| 256 | | entry[0].flags = OPTION_STRING | OPTION_FLAG_DEVICE | ( all_internal ? OPTION_FLAG_INTERNAL : 0 ); |
| 255 | entry[0].flags = OPTION_STRING | OPTION_FLAG_DEVICE; |
| 257 | 256 | entry[0].defvalue = (slot->get_slot_interfaces() != NULL) ? slot->get_default_card() : NULL; |
| 257 | if ( entry[0].defvalue ) |
| 258 | { |
| 259 | if ( slot->is_internal_option( entry[0].defvalue ) ) |
| 260 | { |
| 261 | entry[0].flags |= OPTION_FLAG_INTERNAL; |
| 262 | } |
| 263 | } |
| 258 | 264 | add_entries(entry, true); |
| 259 | 265 | |
| 260 | 266 | added = true; |
| r21472 | r21473 | |
| 285 | 291 | if (exists(slot->device().tag()+1)) { |
| 286 | 292 | if (slot->get_slot_interfaces() != NULL) { |
| 287 | 293 | const char *def = slot->get_default_card_software(config,*this); |
| 288 | | if (def) set_default_value(slot->device().tag()+1,def); |
| 294 | if (def) |
| 295 | { |
| 296 | set_default_value(slot->device().tag()+1,def); |
| 297 | set_flag(slot->device().tag()+1, ~OPTION_FLAG_INTERNAL, slot->is_internal_option(def) ? OPTION_FLAG_INTERNAL : 0 ); |
| 298 | } |
| 289 | 299 | } |
| 290 | 300 | } |
| 291 | 301 | } |
trunk/src/lib/util/options.c
| r21472 | r21473 | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
| 156 | void core_options::entry::set_flag(UINT32 mask, UINT32 flag) |
| 157 | { |
| 158 | m_flags = ( m_flags & mask ) | flag; |
| 159 | } |
| 160 | |
| 161 | |
| 156 | 162 | //------------------------------------------------- |
| 157 | 163 | // revert - revert back to our default if we are |
| 158 | 164 | // at or below the given priority |
| r21472 | r21473 | |
| 641 | 647 | } |
| 642 | 648 | |
| 643 | 649 | |
| 650 | void core_options::set_flag(const char *name, UINT32 mask, UINT32 flag) |
| 651 | { |
| 652 | // find the entry first |
| 653 | entry *curentry = m_entrymap.find(name); |
| 654 | if ( curentry == NULL ) |
| 655 | { |
| 656 | return; |
| 657 | } |
| 658 | curentry->set_flag(mask, flag); |
| 659 | } |
| 660 | |
| 644 | 661 | //------------------------------------------------- |
| 645 | 662 | // reset - reset the options state, removing |
| 646 | 663 | // everything |
trunk/src/lib/util/options.h
| r21472 | r21473 | |
| 122 | 122 | // setters |
| 123 | 123 | void set_value(const char *newvalue, int priority); |
| 124 | 124 | void set_default_value(const char *defvalue); |
| 125 | void set_flag(UINT32 mask, UINT32 flag); |
| 125 | 126 | void revert(int priority); |
| 126 | 127 | |
| 127 | 128 | private: |
| r21472 | r21473 | |
| 186 | 187 | bool set_value(const char *name, const char *value, int priority, astring &error_string); |
| 187 | 188 | bool set_value(const char *name, int value, int priority, astring &error_string); |
| 188 | 189 | bool set_value(const char *name, float value, int priority, astring &error_string); |
| 190 | void set_flag(const char *name, UINT32 mask, UINT32 flags); |
| 189 | 191 | |
| 190 | 192 | // misc |
| 191 | 193 | static const char *unadorned(int x = 0) { return s_option_unadorned[MIN(x, MAX_UNADORNED_OPTIONS)]; } |