Previous 199869 Revisions Next

r21473 Wednesday 27th February, 2013 at 21:41:49 UTC by Wilbert Pol
(MESS) Be a bit more fine-grained in when to mark slot options as internal. (nw)
[src/emu]dislot.c dislot.h emuopts.c
[src/lib/util]options.c options.h

trunk/src/emu/dislot.c
r21472r21473
6161   return TRUE;
6262}
6363
64
65bool device_slot_interface::is_internal_option(const char *option) const
66{
67   if ( !option )
68   {
69      return false;
70   }
71
72   for (int i = 0; m_slot_interfaces && m_slot_interfaces[i].name != NULL; i++)
73   {
74      if ( !strcmp(m_slot_interfaces[i].name, option) )
75      {
76         return m_slot_interfaces[i].internal;
77      }
78   }
79   return false;
80}
81
82
6483device_slot_card_interface::device_slot_card_interface(const machine_config &mconfig, device_t &device)
6584   : device_interface(device)
6685{
trunk/src/emu/dislot.h
r21472r21473
6060   const UINT32 default_clock() const { return m_default_clock; }
6161   const bool fixed() const { return m_fixed; }
6262   const bool all_internal() const;
63   bool is_internal_option(const char *option) const;
6364   device_t* get_card_device();
6465protected:
6566   const char *m_default_card;
trunk/src/emu/emuopts.c
r21472r21473
236236   for (const device_slot_interface *slot = iter.first(); slot != NULL; slot = iter.next())
237237   {
238238      if (slot->fixed()) continue;
239      bool all_internal = slot->all_internal();
240239      // first device? add the header as to be pretty
241240      if (first && isfirst)
242241      {
r21472r21473
253252         // add the option
254253         entry[0].name = slot->device().tag() + 1;
255254         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;
257256         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         }
258264         add_entries(entry, true);
259265
260266         added = true;
r21472r21473
285291      if (exists(slot->device().tag()+1)) {
286292         if (slot->get_slot_interfaces() != NULL) {
287293            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            }
289299         }
290300      }
291301   }
trunk/src/lib/util/options.c
r21472r21473
153153}
154154
155155
156void core_options::entry::set_flag(UINT32 mask, UINT32 flag)
157{
158   m_flags = ( m_flags & mask ) | flag;
159}
160
161
156162//-------------------------------------------------
157163//  revert - revert back to our default if we are
158164//  at or below the given priority
r21472r21473
641647}
642648
643649
650void 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
644661//-------------------------------------------------
645662//  reset - reset the options state, removing
646663//  everything
trunk/src/lib/util/options.h
r21472r21473
122122      // setters
123123      void set_value(const char *newvalue, int priority);
124124      void set_default_value(const char *defvalue);
125      void set_flag(UINT32 mask, UINT32 flag);
125126      void revert(int priority);
126127
127128   private:
r21472r21473
186187   bool set_value(const char *name, const char *value, int priority, astring &error_string);
187188   bool set_value(const char *name, int value, int priority, astring &error_string);
188189   bool set_value(const char *name, float value, int priority, astring &error_string);
190   void set_flag(const char *name, UINT32 mask, UINT32 flags);
189191
190192   // misc
191193   static const char *unadorned(int x = 0) { return s_option_unadorned[MIN(x, MAX_UNADORNED_OPTIONS)]; }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team