Previous 199869 Revisions Next

r20211 Saturday 12th January, 2013 at 04:46:30 UTC by R. Belmont
diimage: allow image devices to skip core fopen() of the image's filename and handle themselves in call_load() [R. Belmont]
[src/emu]diimage.c diimage.h

trunk/src/emu/diimage.c
r20210r20211
936936   if (m_err)
937937      goto done;
938938
939   /* Check if there's a software list defined for this device and use that if we're not creating an image */
940   if (!filename_has_period && !just_load)
939   if (core_opens_image_file())
941940   {
942      softload = load_software_part( device().machine().options(), this, path, &m_software_info_ptr, &m_software_part_ptr, &m_full_software_name, &m_software_list_name );
943      // if we had launched from softlist with a specified part, e.g. "shortname:part"
944      // we would have recorded the wrong name, so record it again based on software_info
945      if (m_software_info_ptr && m_full_software_name)
946         m_err = set_image_filename(m_full_software_name);
941      /* Check if there's a software list defined for this device and use that if we're not creating an image */
942      if (!filename_has_period && !just_load)
943      {
944         softload = load_software_part( device().machine().options(), this, path, &m_software_info_ptr, &m_software_part_ptr, &m_full_software_name, &m_software_list_name );
945         // if we had launched from softlist with a specified part, e.g. "shortname:part"
946         // we would have recorded the wrong name, so record it again based on software_info
947         if (m_software_info_ptr && m_full_software_name)
948            m_err = set_image_filename(m_full_software_name);
947949
948      m_from_swlist = TRUE;
949   }
950         m_from_swlist = TRUE;
951      }
950952
951   if (is_create || filename_has_period)
952   {
953      /* determine open plan */
954      determine_open_plan(is_create, open_plan);
953      if (is_create || filename_has_period)
954      {
955         /* determine open plan */
956         determine_open_plan(is_create, open_plan);
955957
956      /* attempt to open the file in various ways */
957      for (i = 0; !m_file && open_plan[i]; i++)
958         /* attempt to open the file in various ways */
959         for (i = 0; !m_file && open_plan[i]; i++)
960         {
961            /* open the file */
962            m_err = load_image_by_path(open_plan[i], path);
963            if (m_err && (m_err != IMAGE_ERROR_FILENOTFOUND))
964               goto done;
965         }
966      }
967
968      /* Copy some image information when we have been loaded through a software list */
969      if ( m_software_info_ptr )
958970      {
959         /* open the file */
960         m_err = load_image_by_path(open_plan[i], path);
961         if (m_err && (m_err != IMAGE_ERROR_FILENOTFOUND))
962            goto done;
971         m_longname = m_software_info_ptr->longname;
972         m_manufacturer = m_software_info_ptr->publisher;
973         m_year = m_software_info_ptr->year;
974         //m_playable = m_software_info_ptr->supported;
963975      }
964   }
965976
966   /* Copy some image information when we have been loaded through a software list */
967   if ( m_software_info_ptr )
968   {
969      m_longname = m_software_info_ptr->longname;
970      m_manufacturer = m_software_info_ptr->publisher;
971      m_year = m_software_info_ptr->year;
972      //m_playable = m_software_info_ptr->supported;
977      /* did we fail to find the file? */
978      if (!is_loaded() && !softload)
979      {
980         m_err = IMAGE_ERROR_FILENOTFOUND;
981         goto done;
982      }
973983   }
974984
975   /* did we fail to find the file? */
976   if (!is_loaded() && !softload)
977   {
978      m_err = IMAGE_ERROR_FILENOTFOUND;
979      goto done;
980   }
981
982985   /* call device load or create */
983986   m_create_format = create_format;
984987   m_create_args = create_args;
trunk/src/emu/diimage.h
r20210r20211
154154   virtual void call_display() { }
155155   virtual void call_display_info() { }
156156   virtual device_image_partialhash_func get_partial_hash() const { return NULL; }
157   virtual bool core_opens_image_file() const { return TRUE; }
157158   virtual iodevice_t image_type()  const = 0;
158159   virtual bool is_readable()  const = 0;
159160   virtual bool is_writeable() const = 0;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team