Previous 15994 Revisions Next

r6931 Tuesday 5th January, 2010 at 10:40:45 UTC by Wilbert Pol
Added software list support to src/mess/image
[src/mess]image.c image.h

src/mess/image.c
r6930r6931
2323#include "ui.h"
2424#include "device.h"
2525#include "zippath.h"
26#include "softlist.h"
2627
2728
2829
r6930r6931
6465    unsigned int created : 1;
6566    unsigned int is_loading : 1;
6667
68   /* Software list and software entry information */
69   const software_list *software_list;
70   const software_entry *software_entry;
71
6772    /* info read from the hash file */
6873    char *longname;
6974    char *manufacturer;
r6930r6931
242247        slot->unload = (device_image_unload_func) device_get_info_fct(slot->dev, DEVINFO_FCT_IMAGE_UNLOAD);
243248        slot->verify = (device_image_verify_func) device_get_info_fct(slot->dev, DEVINFO_FCT_IMAGE_VERIFY);
244249
250      /* sodftware list and entry */
251      slot->software_list = software_list_get_by_name( device_get_info_string(slot->dev, DEVINFO_STR_SOFTWARE_LIST) );
252      slot->software_entry = NULL;
253
245254        /* creation option guide */
246255        slot->create_option_guide = (const option_guide *) device_get_info_ptr(slot->dev, DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE);
247256
r6930r6931
693702
694703static int is_loaded(image_slot_data *image)
695704{
696    return (image->file != NULL) || (image->ptr != NULL);
705    return (image->file != NULL) || (image->ptr != NULL) || (image->software_entry != NULL);
697706}
698707
699708
r6930r6931
838847    if ((attotime_compare(timer_get_time(machine), attotime_zero) > 0) && slot->info.reset_on_load)
839848        mame_schedule_hard_reset(machine);
840849
850   /* Check if there's a software list defined for this device and use that if we're not creating an image */
851/* This piece below is commented out until load_region_list or something better is available in src/emu/romload */
852#if 0
853   if ( !is_create && slot->software_list )
854   {
855      slot->software_entry = software_get_by_name( slot->software_list, path );
856
857      if ( slot->software_entry )
858      {
859         load_region_list(slot->dev, slot->software_list->name, slot->software_entry->name, slot->software_entry->rom_info );
860
861         /* call device load or create */
862         if (image->token != NULL)
863         {
864            err = image_finish_load(image);
865            if (err)
866               goto done;
867         }
868
869         goto done;
870      }
871   }
872#endif
873
841874    /* determine open plan */
842875    determine_open_plan(slot, is_create, open_plan);
843876
r6930r6931
14101443
14111444
14121445/*-------------------------------------------------
1446    image_software_entry
1447-------------------------------------------------*/
1448
1449const software_entry *image_software_entry(const device_config *image)
1450{
1451   image_slot_data *slot = find_image_slot(image);
1452
1453   return slot->software_entry;
1454}
1455
1456
1457
1458/*-------------------------------------------------
1459    image_get_software_region
1460-------------------------------------------------*/
1461
1462UINT8 *image_get_software_region(const device_config *image, const char *tag)
1463{
1464   char full_tag[256];
1465
1466   sprintf( full_tag, "%s:%s:%s", image->tag, image_software_entry(image)->name, tag );
1467   return memory_region( image->machine, full_tag );
1468}
1469
1470
1471/*-------------------------------------------------
14131472    image_is_writable
14141473-------------------------------------------------*/
14151474
src/mess/image.h
r6930r6931
1515#include "utils.h"
1616#include "opresolv.h"
1717#include "osdmess.h"
18#include "softlist.h"
1819
1920
2021/***************************************************************************
r6930r6931
144145    DEVINFO_STR_IMAGE_CREATE_OPTNAME,
145146    DEVINFO_STR_IMAGE_CREATE_OPTDESC = DEVINFO_STR_IMAGE_CREATE_OPTNAME + DEVINFO_CREATE_OPTMAX,
146147    DEVINFO_STR_IMAGE_CREATE_OPTEXTS = DEVINFO_STR_IMAGE_CREATE_OPTDESC + DEVINFO_CREATE_OPTMAX,
148   DEVINFO_STR_SOFTWARE_LIST,
147149    DEVINFO_STR_IMAGE_LAST = DEVINFO_STR_IMAGE_FIRST + 0x0fff
148150};
149151
r6930r6931
264266void *image_ptr(const device_config *image);
265267
266268
269UINT8 *image_get_software_region(const device_config *image, const char *tag);
270const software_entry *image_software_entry(const device_config *image);
267271
272
273
268274/****************************************************************************
269275  Memory allocators
270276

Previous 15994 Revisions Next


© 1998-2018 The MESS Team