Previous 15994 Revisions Next

r13351 Wednesday 23rd November, 2011 at 09:00:04 UTC by Miodrag Milanović
Fixed handling slot/image options so it's possible to override slot setting by softlist (no whatsnew)
[src/emu]dislot.h emuopts.c emuopts.h softlist.c softlist.h
[src/mess/machine]c64exp.c c64exp.h cococart.c cococart.h iq151cart.c iq151cart.h kcexp.c kcexp.h

src/emu/emuopts.c
r13350r13351
263263}
264264
265265//-------------------------------------------------
266//  update_slot_options - update slot values
267//  depending of image mounted
268//-------------------------------------------------
269
270void emu_options::update_slot_options()
271{
272   // look up the system configured by name; if no match, do nothing
273   const game_driver *cursystem = system();
274   if (cursystem == NULL)
275      return;
276
277   // iterate through all slot devices
278   const device_slot_interface *slot = NULL;
279   // create the configuration
280   machine_config config(*cursystem, *this);
281   for (bool gotone = config.devicelist().first(slot); gotone; gotone = slot->next(slot))
282   {
283      // retrieve info about the device instance
284      astring option_name;
285      option_name.printf("%s;%s", slot->device().tag(), slot->device().tag());
286
287      if (exists(slot->device().tag())) {
288         if (slot->get_slot_interfaces() != NULL) {
289            const char *def = slot->get_default_card_software(config.devicelist(),*this);
290            if (def) set_default_value(slot->device().tag(),def);
291         }
292      }
293   }
294}
295//-------------------------------------------------
266296//  add_device_options - add all of the device
267297//  options for the configured system
268298//-------------------------------------------------
r13350r13351
348378      set_value(name, value, OPTION_PRIORITY_CMDLINE, error_string);
349379   }
350380   result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
381   update_slot_options();
351382   return result;
352383}
353384
r13350r13351
473504      }
474505      // then add the options
475506      add_device_options(true);
507      update_slot_options();
476508   }
477509}
478510
src/emu/emuopts.h
r13350r13351
357357   // device-specific option handling
358358   void add_device_options(bool isfirst);
359359   bool add_slot_options(bool isfirst);
360   void update_slot_options();
360361
361362   // INI parsing helper
362363   bool parse_one_ini(const char *basename, int priority, astring *error_string = NULL);
src/emu/softlist.c
r13350r13351
16331633    software_get_default_slot
16341634 -------------------------------------------------*/
16351635
1636 const char *software_get_default_slot(const device_list &devlist, emu_options &options, const device_image_interface *image, const char *default_card, const char* default_card_slot)
1636 const char *software_get_default_slot(const device_list &devlist, emu_options &options, const device_image_interface *image, const char* default_card_slot)
16371637{
1638   const char* retVal = default_card;
1638   const char* retVal = NULL;
16391639   const char* path = options.value(image->instance_name());
16401640   software_list *software_list_ptr = NULL;
16411641   software_info *software_info_ptr = NULL;
src/emu/softlist.h
r13350r13351
116116
117117void software_display_matches(const device_list &devlist, emu_options &options,const char *interface,const char *swname_bckp);
118118
119const char *software_get_default_slot(const device_list &devlist, emu_options &options, const device_image_interface *image, const char *default_card, const char* default_card_slot);
119const char *software_get_default_slot(const device_list &devlist, emu_options &options, const device_image_interface *image, const char* default_card_slot);
120120
121121/*********************************************************************
122122
src/emu/dislot.h
r13350r13351
4848
4949   static void static_set_slot_info(device_t &device, const slot_interface *slots_info, const char *default_card,const input_device_default *default_input);
5050   const slot_interface* get_slot_interfaces() const { return m_slot_interfaces; };
51   virtual const char * get_default_card(const device_list &devlist, emu_options &options) const { return m_default_card; };
51   const char * get_default_card(const device_list &devlist, emu_options &options) const { return m_default_card; };
52   virtual const char * get_default_card_software(const device_list &devlist, emu_options &options) const { return m_default_card; };
5253   const input_device_default *input_ports_defaults() const { return m_input_defaults; }
5354   device_t* get_card_device();
5455protected:
src/mess/machine/cococart.h
r13350r13351
9595   virtual const option_guide *create_option_guide() const { return NULL; }
9696
9797   // slot interface overrides
98   virtual const char * get_default_card(const device_list &devlist, emu_options &options) const;
98   virtual const char * get_default_card_software(const device_list &devlist, emu_options &options) const;
9999
100100   /* reading and writing to $FF40-$FF7F */
101101   DECLARE_READ8_MEMBER(read);
src/mess/machine/kcexp.c
r13350r13351
325325}
326326
327327/*-------------------------------------------------
328    get default card
328    get default card software
329329-------------------------------------------------*/
330330
331const char * kccart_slot_device::get_default_card(const device_list &devlist, emu_options &options) const
331const char * kccart_slot_device::get_default_card_software(const device_list &devlist, emu_options &options) const
332332{
333   return software_get_default_slot(devlist, options, this, m_default_card, "standard");
333   return software_get_default_slot(devlist, options, this, "standard");
334334}
src/mess/machine/iq151cart.c
r13350r13351
211211}
212212
213213/*-------------------------------------------------
214    get default card
214    get default card software
215215-------------------------------------------------*/
216216
217const char * iq151cart_slot_device::get_default_card(const device_list &devlist, emu_options &options) const
217const char * iq151cart_slot_device::get_default_card_software(const device_list &devlist, emu_options &options) const
218218{
219   return software_get_default_slot(devlist, options, this, m_default_card, NULL);
219   return software_get_default_slot(devlist, options, this, NULL);
220220}
src/mess/machine/iq151cart.h
r13350r13351
111111   virtual const option_guide *create_option_guide() const { return NULL; }
112112
113113   // slot interface overrides
114   virtual const char * get_default_card(const device_list &devlist, emu_options &options) const;
114   virtual const char * get_default_card_software(const device_list &devlist, emu_options &options) const;
115115
116116   // reading and writing
117117   virtual void read(offs_t offset, UINT8 &data);
src/mess/machine/kcexp.h
r13350r13351
110110   virtual const option_guide *create_option_guide() const { return NULL; }
111111
112112   // slot interface overrides
113   virtual const char * get_default_card(const device_list &devlist, emu_options &options) const;
113   virtual const char * get_default_card_software(const device_list &devlist, emu_options &options) const;
114114};
115115
116116// device type definition
src/mess/machine/c64exp.c
r13350r13351
174174
175175
176176//-------------------------------------------------
177//  get_default_card -
177//  get_default_card_software -
178178//-------------------------------------------------
179179
180const char * c64_expansion_slot_device::get_default_card(const device_list &devlist, emu_options &options) const
180const char * c64_expansion_slot_device::get_default_card_software(const device_list &devlist, emu_options &options) const
181181{
182   return software_get_default_slot(devlist, options, this, m_default_card, "standard");
182   return software_get_default_slot(devlist, options, this, "standard");
183183}
184184
185185
src/mess/machine/c64exp.h
r13350r13351
161161   virtual const option_guide *create_option_guide() const { return NULL; }
162162
163163   // slot interface overrides
164   virtual const char * get_default_card(const device_list &devlist, emu_options &options) const;
164   virtual const char * get_default_card_software(const device_list &devlist, emu_options &options) const;
165165
166166   virtual UINT8* get_cart_base();
167167
src/mess/machine/cococart.c
r13350r13351
336336   return TRUE;
337337}
338338
339const char * cococart_slot_device::get_default_card(const device_list &devlist, emu_options &options) const
339const char * cococart_slot_device::get_default_card_software(const device_list &devlist, emu_options &options) const
340340{
341   return software_get_default_slot(devlist, options, this, m_default_card, "pak");
341   return software_get_default_slot(devlist, options, this, "pak");
342342}
343343
344344//**************************************************************************

Previous 15994 Revisions Next


© 1998-2018 The MESS Team