summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2010-06-16 09:07:30 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2010-06-16 09:07:30 +0000
commit16e4f383facef9b7d8d1c0c5e1bd6f8f92ec1935 (patch)
tree164c62c1fe64b138331fcf4385e26627afa3c4a9 /src
parent932199cb47609a201ba73499c0b599440c926e4c (diff)
Image device cleanup (no whatsnew)
Diffstat (limited to 'src')
-rw-r--r--src/emu/clifront.c7
-rw-r--r--src/emu/devlegcy.c222
-rw-r--r--src/emu/devlegcy.h128
-rw-r--r--src/emu/diimage.h40
-rw-r--r--src/emu/info.c29
5 files changed, 230 insertions, 196 deletions
diff --git a/src/emu/clifront.c b/src/emu/clifront.c
index 2ee3009c421..dae94680f7f 100644
--- a/src/emu/clifront.c
+++ b/src/emu/clifront.c
@@ -820,10 +820,11 @@ static int info_listmedia(core_options *options, const char *gamename)
printf("%-13s%-12s%-8s ", driver_name, name, paren_shortname);
driver_name = " ";
- while (src && *src)
+ char *ext = strtok((char*)src,",");
+ while (ext != NULL)
{
- printf(".%-5s", src);
- src += strlen(src) + 1;
+ printf(".%-5s",ext);
+ ext = strtok (NULL, ",");
devcount++;
}
printf("\n");
diff --git a/src/emu/devlegcy.c b/src/emu/devlegcy.c
index 19a8579cc25..297a229aeee 100644
--- a/src/emu/devlegcy.c
+++ b/src/emu/devlegcy.c
@@ -348,69 +348,35 @@ void legacy_nvram_device_base::nvram_write(mame_file &file)
//**************************************************************************
// LEGACY IMAGE DEVICE CONFIGURATION
//**************************************************************************
-
-typedef struct _image_device_type_info image_device_type_info;
-struct _image_device_type_info
-{
- iodevice_t type;
- const char *name;
- const char *shortname;
-};
-
-static const image_device_type_info device_info_array[] =
-{
- { IO_CARTSLOT, "cartridge", "cart" }, /* 0 */
- { IO_FLOPPY, "floppydisk", "flop" }, /* 1 */
- { IO_HARDDISK, "harddisk", "hard" }, /* 2 */
- { IO_CYLINDER, "cylinder", "cyln" }, /* 3 */
- { IO_CASSETTE, "cassette", "cass" }, /* 4 */
- { IO_PUNCHCARD, "punchcard", "pcrd" }, /* 5 */
- { IO_PUNCHTAPE, "punchtape", "ptap" }, /* 6 */
- { IO_PRINTER, "printer", "prin" }, /* 7 */
- { IO_SERIAL, "serial", "serl" }, /* 8 */
- { IO_PARALLEL, "parallel", "parl" }, /* 9 */
- { IO_SNAPSHOT, "snapshot", "dump" }, /* 10 */
- { IO_QUICKLOAD, "quickload", "quik" }, /* 11 */
- { IO_MEMCARD, "memcard", "memc" }, /* 12 */
- { IO_CDROM, "cdrom", "cdrm" }, /* 13 */
- { IO_MAGTAPE, "magtape", "magt" }, /* 14 */
-};
-
-static const image_device_type_info *find_device_type(iodevice_t type)
-{
- int i;
- for (i = 0; i < ARRAY_LENGTH(device_info_array); i++)
+const image_device_type_info legacy_image_device_config_base::m_device_info_array[] =
{
- if (device_info_array[i].type == type)
- return &device_info_array[i];
- }
- return NULL;
-}
-
-static const char *device_typename(iodevice_t type)
-{
- const image_device_type_info *info = find_device_type(type);
- return (info != NULL) ? info->name : NULL;
-}
-
-
-
-static const char *device_brieftypename(iodevice_t type)
-{
- const image_device_type_info *info = find_device_type(type);
- return (info != NULL) ? info->shortname : NULL;
-}
-
+ { IO_CARTSLOT, "cartridge", "cart" }, /* 0 */
+ { IO_FLOPPY, "floppydisk", "flop" }, /* 1 */
+ { IO_HARDDISK, "harddisk", "hard" }, /* 2 */
+ { IO_CYLINDER, "cylinder", "cyln" }, /* 3 */
+ { IO_CASSETTE, "cassette", "cass" }, /* 4 */
+ { IO_PUNCHCARD, "punchcard", "pcrd" }, /* 5 */
+ { IO_PUNCHTAPE, "punchtape", "ptap" }, /* 6 */
+ { IO_PRINTER, "printer", "prin" }, /* 7 */
+ { IO_SERIAL, "serial", "serl" }, /* 8 */
+ { IO_PARALLEL, "parallel", "parl" }, /* 9 */
+ { IO_SNAPSHOT, "snapshot", "dump" }, /* 10 */
+ { IO_QUICKLOAD, "quickload", "quik" }, /* 11 */
+ { IO_MEMCARD, "memcard", "memc" }, /* 12 */
+ { IO_CDROM, "cdrom", "cdrm" }, /* 13 */
+ { IO_MAGTAPE, "magtape", "magt" }, /* 14 */
+ };
+
//-------------------------------------------------
// legacy_image_device_config_base - constructor
//-------------------------------------------------
legacy_image_device_config_base::legacy_image_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config)
: legacy_device_config_base(mconfig, type, tag, owner, clock, get_config),
- device_config_image_interface(mconfig, *this)
+ device_config_image_interface(mconfig, *this),
+ m_create_option_guide(NULL),
+ m_formatlist(NULL)
{
- memset(&m_config, 0, sizeof(m_config));
- m_mconfig = &mconfig;
}
//-------------------------------------------------
@@ -420,39 +386,34 @@ legacy_image_device_config_base::legacy_image_device_config_base(const machine_c
void legacy_image_device_config_base::device_config_complete()
{
- char buffer[64];
- const device_config_image_interface *that_device;
+ const device_config_image_interface *image;
int count = 0;
int index = -1;
image_device_format **formatptr;
image_device_format *format;
- formatptr = &m_config.m_formatlist;
+ formatptr = &m_formatlist;
int cnt = 0;
- m_config.m_type = static_cast<iodevice_t>(get_legacy_config_int(DEVINFO_INT_IMAGE_TYPE));
- m_config.m_readable = get_legacy_config_int(DEVINFO_INT_IMAGE_READABLE)!=0;
- m_config.m_writeable = get_legacy_config_int(DEVINFO_INT_IMAGE_WRITEABLE)!=0;
- m_config.m_creatable = get_legacy_config_int(DEVINFO_INT_IMAGE_CREATABLE)!=0;
- m_config.m_must_be_loaded = get_legacy_config_int(DEVINFO_INT_IMAGE_MUST_BE_LOADED)!=0;
- m_config.m_reset_on_load = get_legacy_config_int(DEVINFO_INT_IMAGE_RESET_ON_LOAD)!=0;
- m_config.m_has_partial_hash = get_legacy_config_int(DEVINFO_FCT_IMAGE_PARTIAL_HASH)!=0;
+ m_type = static_cast<iodevice_t>(get_legacy_config_int(DEVINFO_INT_IMAGE_TYPE));
+ m_readable = get_legacy_config_int(DEVINFO_INT_IMAGE_READABLE)!=0;
+ m_writeable = get_legacy_config_int(DEVINFO_INT_IMAGE_WRITEABLE)!=0;
+ m_creatable = get_legacy_config_int(DEVINFO_INT_IMAGE_CREATABLE)!=0;
+ m_must_be_loaded = get_legacy_config_int(DEVINFO_INT_IMAGE_MUST_BE_LOADED)!=0;
+ m_reset_on_load = get_legacy_config_int(DEVINFO_INT_IMAGE_RESET_ON_LOAD)!=0;
+ m_has_partial_hash = get_legacy_config_int(DEVINFO_FCT_IMAGE_PARTIAL_HASH)!=0;
- m_config.m_interface_name = core_strdup(get_legacy_config_string(DEVINFO_STR_IMAGE_INTERFACE));
- char *s = global_alloc_array_clear(char,strlen(get_legacy_config_string(DEVINFO_STR_IMAGE_FILE_EXTENSIONS))+2);
- strcpy(s,get_legacy_config_string(DEVINFO_STR_IMAGE_FILE_EXTENSIONS));
- m_config.m_file_extensions = s;
- /* convert the comma delimited list to a NUL delimited list */
- while((s = strchr(s, ',')) != NULL)
- *(s++) = '\0';
+ m_interface_name = get_legacy_config_string(DEVINFO_STR_IMAGE_INTERFACE);
- m_config.load = reinterpret_cast<device_image_load_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_LOAD));
- m_config.create = reinterpret_cast<device_image_create_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_CREATE));
- m_config.unload = reinterpret_cast<device_image_unload_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_UNLOAD));
- m_config.display = reinterpret_cast<device_image_display_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_DISPLAY));
- m_config.partialhash = reinterpret_cast<device_image_partialhash_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_PARTIAL_HASH));
- m_config.get_devices = reinterpret_cast<device_image_get_devices_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_GET_DEVICES));
+ m_file_extensions = get_legacy_config_string(DEVINFO_STR_IMAGE_FILE_EXTENSIONS);
- m_config.m_create_option_guide = reinterpret_cast<const option_guide *>(get_legacy_config_ptr(DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE));
+ load = reinterpret_cast<device_image_load_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_LOAD));
+ create = reinterpret_cast<device_image_create_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_CREATE));
+ unload = reinterpret_cast<device_image_unload_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_UNLOAD));
+ display = reinterpret_cast<device_image_display_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_DISPLAY));
+ partialhash = reinterpret_cast<device_image_partialhash_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_PARTIAL_HASH));
+ get_devices = reinterpret_cast<device_image_get_devices_func>(get_legacy_config_fct(DEVINFO_FCT_IMAGE_GET_DEVICES));
+
+ m_create_option_guide = reinterpret_cast<const option_guide *>(get_legacy_config_ptr(DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE));
int format_count = get_legacy_config_int(DEVINFO_INT_IMAGE_CREATE_OPTCOUNT);
@@ -464,66 +425,121 @@ void legacy_image_device_config_base::device_config_complete()
format = global_alloc_clear(image_device_format);
// populate it
- format->index = cnt;
- format->name = core_strdup(get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTNAME + i));
- format->description = core_strdup(get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTDESC + i));
- format->extensions = core_strdup(get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTEXTS + i));
- format->optspec = core_strdup(get_legacy_config_string(DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i));
+ format->m_index = cnt;
+ format->m_name = get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTNAME + i);
+ format->m_description = get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTDESC + i);
+ format->m_extensions = get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTEXTS + i);
+ format->m_optspec = get_legacy_config_string(DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i);
// and append it to the list
*formatptr = format;
- formatptr = &format->next;
+ formatptr = &format->m_next;
cnt++;
}
}
- for (bool gotone = m_mconfig->devicelist.first(that_device); gotone; gotone = that_device->next(that_device))
+ for (bool gotone = device_config_interface::m_machine_config.devicelist.first(image); gotone; gotone = image->next(image))
{
- if (this == that_device)
+ if (this == image)
index = count;
- if (downcast<const legacy_image_device_config_base *>(that_device)->image_type_direct() == m_config.m_type)
+ if (image->image_type_direct() == m_type)
count++;
}
if (count > 1) {
- snprintf(buffer, 64, "%s%d", device_typename(m_config.m_type), index + 1);
- m_config.m_instance_name = core_strdup(buffer);
- snprintf(buffer, 64, "%s%d", device_brieftypename(m_config.m_type), index + 1);
- m_config.m_brief_instance_name = core_strdup(buffer);
+ m_instance_name.printf("%s%d", device_typename(m_type), index + 1);
+ m_brief_instance_name.printf("%s%d", device_brieftypename(m_type), index + 1);
}
else
{
- m_config.m_instance_name = core_strdup(device_typename(m_config.m_type));
- m_config.m_brief_instance_name = core_strdup(device_brieftypename(m_config.m_type));
+ m_instance_name = device_typename(m_type);
+ m_brief_instance_name = device_brieftypename(m_type);
}
// Override in case of hardcoded values
if (strlen(get_legacy_config_string(DEVINFO_STR_IMAGE_INSTANCE_NAME))>0) {
- m_config.m_instance_name = core_strdup(get_legacy_config_string(DEVINFO_STR_IMAGE_INSTANCE_NAME));
+ m_instance_name = get_legacy_config_string(DEVINFO_STR_IMAGE_INSTANCE_NAME);
}
if (strlen(get_legacy_config_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME))>0) {
- m_config.m_brief_instance_name = core_strdup(get_legacy_config_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME));
+ m_brief_instance_name = get_legacy_config_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME);
}
}
-const char *legacy_image_device_config_base::image_type_name() const
+//-------------------------------------------------
+// find_device_type - search trough list of
+// device types to extact data
+//-------------------------------------------------
+
+const image_device_type_info *legacy_image_device_config_base::find_device_type(iodevice_t type)
{
- return device_typename(m_config.m_type);
+ int i;
+ for (i = 0; i < ARRAY_LENGTH(legacy_image_device_config_base::m_device_info_array); i++)
+ {
+ if (m_device_info_array[i].m_type == type)
+ return &m_device_info_array[i];
+ }
+ return NULL;
+}
+
+//-------------------------------------------------
+// device_typename - retrieves device type name
+//-------------------------------------------------
+
+const char *legacy_image_device_config_base::device_typename(iodevice_t type)
+{
+ const image_device_type_info *info = find_device_type(type);
+ return (info != NULL) ? info->m_name : NULL;
}
+
+//-------------------------------------------------
+// device_brieftypename - retrieves device
+// brief type name
+//-------------------------------------------------
+
+const char *legacy_image_device_config_base::device_brieftypename(iodevice_t type)
+{
+ const image_device_type_info *info = find_device_type(type);
+ return (info != NULL) ? info->m_shortname : NULL;
+}
+
+//-------------------------------------------------
+// uses_file_extension - update configuration
+// based on completed device setup
+//-------------------------------------------------
+
+bool legacy_image_device_config_base::uses_file_extension(const char *file_extension) const
+{
+ bool result = FALSE;
+
+ if (file_extension[0] == '.')
+ file_extension++;
+
+ /* find the extensions */
+ char *ext = strtok((char*)m_file_extensions.cstr(),",");
+ while (ext != NULL)
+ {
+ if (!mame_stricmp(ext, file_extension))
+ {
+ result = TRUE;
+ break;
+ }
+ ext = strtok (NULL, ",");
+ }
+ return result;
+}
+
//-------------------------------------------------
// ~legacy_device_config_base - destructor
//-------------------------------------------------
legacy_image_device_config_base::~legacy_image_device_config_base()
{
- global_free(m_config.m_file_extensions);
- image_device_format **formatptr = &m_config.m_formatlist;
-
+ image_device_format **formatptr = &m_formatlist;
/* free all entries */
while (*formatptr != NULL)
{
image_device_format *entry = *formatptr;
- *formatptr = entry->next;
- global_free(entry);
+ *formatptr = entry->m_next;
+ global_free(entry);
}
}
diff --git a/src/emu/devlegcy.h b/src/emu/devlegcy.h
index d393d89478f..c4305f44d96 100644
--- a/src/emu/devlegcy.h
+++ b/src/emu/devlegcy.h
@@ -173,29 +173,6 @@ enum
DEVINFO_STR_IMAGE_LAST = DEVINFO_STR_IMAGE_FIRST + 0x0fff
};
-typedef enum
-{
- /* List of all supported devices. Refer to the device by these names only */
- IO_UNKNOWN,
- IO_CARTSLOT, /* 1 - Cartridge Port, as found on most console and on some computers */
- IO_FLOPPY, /* 2 - Floppy Disk unit */
- IO_HARDDISK, /* 3 - Hard Disk unit */
- IO_CYLINDER, /* 4 - Magnetically-Coated Cylinder */
- IO_CASSETTE, /* 5 - Cassette Recorder (common on early home computers) */
- IO_PUNCHCARD, /* 6 - Card Puncher/Reader */
- IO_PUNCHTAPE, /* 7 - Tape Puncher/Reader (reels instead of punchcards) */
- IO_PRINTER, /* 8 - Printer device */
- IO_SERIAL, /* 9 - Generic Serial Port */
- IO_PARALLEL, /* 10 - Generic Parallel Port */
- IO_SNAPSHOT, /* 11 - Complete 'snapshot' of the state of the computer */
- IO_QUICKLOAD, /* 12 - Allow to load program/data into memory, without matching any actual device */
- IO_MEMCARD, /* 13 - Memory card */
- IO_CDROM, /* 14 - optical CD-ROM disc */
- IO_MAGTAPE, /* 15 - Magentic tape */
- IO_COUNT /* 16 - Total Number of IO_devices for searching */
-} iodevice_t;
-
-
//**************************************************************************
// MACROS
//**************************************************************************
@@ -410,12 +387,12 @@ typedef void (*device_reset_func)(device_t *device);
typedef void (*device_nvram_func)(device_t *device, mame_file *file, int read_or_write);
// device image interface function types
-typedef int (*device_image_load_func)(running_device *image);
-typedef int (*device_image_create_func)(running_device *image, int format_type, option_resolution *format_options);
-typedef void (*device_image_unload_func)(running_device *image);
-typedef void (*device_image_display_func)(running_device *image);
+typedef int (*device_image_load_func)(device_t *image);
+typedef int (*device_image_create_func)(device_t *image, int format_type, option_resolution *format_options);
+typedef void (*device_image_unload_func)(device_t *image);
+typedef void (*device_image_display_func)(device_t *image);
typedef void (*device_image_partialhash_func)(char *, const unsigned char *, unsigned long, unsigned int);
-typedef void (*device_image_get_devices_func)(running_device *device);
+typedef void (*device_image_get_devices_func)(device_t *device);
// the actual deviceinfo union
union deviceinfo
@@ -601,19 +578,56 @@ protected:
};
// ======================> legacy_image_device_config
-typedef struct _image_device_format image_device_format;
-struct _image_device_format
+struct image_device_format
{
- image_device_format *next;
- int index;
- const char *name;
- const char *description;
- const char *extensions;
- const char *optspec;
+ image_device_format *m_next;
+ int m_index;
+ astring m_name;
+ astring m_description;
+ astring m_extensions;
+ astring m_optspec;
};
-struct image_config
+struct image_device_type_info
+{
+ iodevice_t m_type;
+ astring m_name;
+ astring m_shortname;
+};
+
+// legacy_image_device_config is a device_config with a image interface
+class legacy_image_device_config_base : public legacy_device_config_base,
+ public device_config_image_interface
{
+public:
+ virtual iodevice_t image_type() const { return m_type; }
+ virtual const char *image_type_name() const { return device_typename(m_type); }
+ virtual iodevice_t image_type_direct() const { return static_cast<iodevice_t>(get_legacy_config_int(DEVINFO_INT_IMAGE_TYPE)); }
+ virtual bool is_readable() const { return m_readable; }
+ virtual bool is_writeable() const { return m_writeable; }
+ virtual bool is_creatable() const { return m_creatable; }
+ virtual bool must_be_loaded() const { return m_must_be_loaded; }
+ virtual bool is_reset_on_load() const { return m_reset_on_load; }
+ virtual bool has_partial_hash() const { return m_has_partial_hash; }
+ virtual const char *image_interface() const { return m_interface_name; }
+ virtual const char *file_extensions() const { return m_file_extensions; }
+ virtual const char *instance_name() const { return m_instance_name; }
+ virtual const char *brief_instance_name() const { return m_brief_instance_name; }
+ virtual bool uses_file_extension(const char *file_extension) const;
+ static const char *device_typename(iodevice_t type);
+ static const char *device_brieftypename(iodevice_t type);
+protected:
+ // construction/destruction
+ legacy_image_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config);
+ virtual ~legacy_image_device_config_base();
+
+ // device_config overrides
+ virtual void device_config_complete();
+
+ static const image_device_type_info *find_device_type(iodevice_t type);
+
+ static const image_device_type_info m_device_info_array[];
+
iodevice_t m_type;
bool m_readable;
bool m_writeable;
@@ -621,10 +635,10 @@ struct image_config
bool m_must_be_loaded;
bool m_reset_on_load;
bool m_has_partial_hash;
- const char *m_file_extensions;
- const char *m_instance_name;
- const char *m_brief_instance_name;
- const char *m_interface_name;
+ astring m_file_extensions;
+ astring m_instance_name;
+ astring m_brief_instance_name;
+ astring m_interface_name;
device_image_load_func load;
device_image_create_func create;
@@ -635,37 +649,7 @@ struct image_config
/* creation info */
const option_guide *m_create_option_guide;
- image_device_format *m_formatlist;
-};
-// legacy_image_device_config is a device_config with a image interface
-class legacy_image_device_config_base : public legacy_device_config_base,
- public device_config_image_interface
-{
-public:
- virtual iodevice_t image_type() const { return m_config.m_type; }
- virtual const char *image_type_name() const;
- virtual iodevice_t image_type_direct() const { return static_cast<iodevice_t>(get_legacy_config_int(DEVINFO_INT_IMAGE_TYPE)); }
- virtual bool is_readable() const { return m_config.m_readable; }
- virtual bool is_writeable() const { return m_config.m_writeable; }
- virtual bool is_creatable() const { return m_config.m_creatable; }
- virtual bool must_be_loaded() const { return m_config.m_must_be_loaded; }
- virtual bool is_reset_on_load() const { return m_config.m_reset_on_load; }
- virtual bool has_partiah_hash() const { return m_config.m_has_partial_hash; }
- virtual const char *image_interface() const { return m_config.m_interface_name; }
- virtual const char *file_extensions() const { return m_config.m_file_extensions; }
- virtual const char *file_extensions_list() const { return core_strdup(get_legacy_config_string(DEVINFO_STR_IMAGE_FILE_EXTENSIONS)); }
- virtual const char *instance_name() const { return m_config.m_instance_name; }
- virtual const char *brief_instance_name() const { return m_config.m_brief_instance_name; }
-protected:
- // construction/destruction
- legacy_image_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config);
- virtual ~legacy_image_device_config_base();
-
- // device_config overrides
- virtual void device_config_complete();
-
- image_config m_config;
- const machine_config *m_mconfig;
+ image_device_format *m_formatlist;
};
diff --git a/src/emu/diimage.h b/src/emu/diimage.h
index 5ad80884070..dee31d9fb66 100644
--- a/src/emu/diimage.h
+++ b/src/emu/diimage.h
@@ -51,6 +51,28 @@
// TYPE DEFINITIONS
//**************************************************************************
+enum iodevice_t
+{
+ /* List of all supported devices. Refer to the device by these names only */
+ IO_UNKNOWN,
+ IO_CARTSLOT, /* 1 - Cartridge Port, as found on most console and on some computers */
+ IO_FLOPPY, /* 2 - Floppy Disk unit */
+ IO_HARDDISK, /* 3 - Hard Disk unit */
+ IO_CYLINDER, /* 4 - Magnetically-Coated Cylinder */
+ IO_CASSETTE, /* 5 - Cassette Recorder (common on early home computers) */
+ IO_PUNCHCARD, /* 6 - Card Puncher/Reader */
+ IO_PUNCHTAPE, /* 7 - Tape Puncher/Reader (reels instead of punchcards) */
+ IO_PRINTER, /* 8 - Printer device */
+ IO_SERIAL, /* 9 - Generic Serial Port */
+ IO_PARALLEL, /* 10 - Generic Parallel Port */
+ IO_SNAPSHOT, /* 11 - Complete 'snapshot' of the state of the computer */
+ IO_QUICKLOAD, /* 12 - Allow to load program/data into memory, without matching any actual device */
+ IO_MEMCARD, /* 13 - Memory card */
+ IO_CDROM, /* 14 - optical CD-ROM disc */
+ IO_MAGTAPE, /* 15 - Magentic tape */
+ IO_COUNT /* 16 - Total Number of IO_devices for searching */
+};
+
// ======================> device_config_image_interface
@@ -61,6 +83,22 @@ public:
// construction/destruction
device_config_image_interface(const machine_config &mconfig, device_config &device);
virtual ~device_config_image_interface();
+
+ // public accessors... for now
+ virtual iodevice_t image_type() const = 0;
+ virtual const char *image_type_name() const = 0;
+ virtual iodevice_t image_type_direct() const = 0;
+ virtual bool is_readable() const = 0;
+ virtual bool is_writeable() const = 0;
+ virtual bool is_creatable() const = 0;
+ virtual bool must_be_loaded() const = 0;
+ virtual bool is_reset_on_load() const = 0;
+ virtual bool has_partial_hash() const = 0;
+ virtual const char *image_interface() const = 0;
+ virtual const char *file_extensions() const = 0;
+ virtual const char *instance_name() const = 0;
+ virtual const char *brief_instance_name() const = 0;
+ virtual bool uses_file_extension(const char *file_extension) const = 0;
};
@@ -78,8 +116,6 @@ public:
// configuration access
const device_config_image_interface &image_config() const { return m_image_config; }
- // public accessors... for now
-
protected:
// derived class overrides
diff --git a/src/emu/info.c b/src/emu/info.c
index 85d6d3b64d0..eaec1591e2b 100644
--- a/src/emu/info.c
+++ b/src/emu/info.c
@@ -877,45 +877,42 @@ static void print_game_images(FILE *out, const game_driver *game, const machine_
const device_config_image_interface *dev;
const char *name;
const char *shortname;
- const char *ext;
for (bool gotone = config->devicelist.first(dev); gotone; gotone = dev->next(dev))
{
- const legacy_image_device_config_base *info = downcast<const legacy_image_device_config_base *>(dev);
-
/* print out device type */
- fprintf(out, "\t\t<device type=\"%s\"", xml_normalize_string(info->image_type_name()));
+ fprintf(out, "\t\t<device type=\"%s\"", xml_normalize_string(dev->image_type_name()));
/* does this device have a tag? */
- if (info->tag())
- fprintf(out, " tag=\"%s\"", xml_normalize_string(info->tag()));
+ if (dev->devconfig().tag())
+ fprintf(out, " tag=\"%s\"", xml_normalize_string(dev->devconfig().tag()));
/* is this device mandatory? */
- if (info->must_be_loaded())
+ if (dev->must_be_loaded())
fprintf(out, " mandatory=\"1\"");
- if (info->image_interface()[0] )
- fprintf(out, " interface=\"%s\"", xml_normalize_string(info->image_interface()));
+ if (dev->image_interface()[0] )
+ fprintf(out, " interface=\"%s\"", xml_normalize_string(dev->image_interface()));
/* close the XML tag */
fprintf(out, ">\n");
- name = info->instance_name();
- shortname = info->brief_instance_name();
+ name = dev->instance_name();
+ shortname = dev->brief_instance_name();
fprintf(out, "\t\t\t<instance");
fprintf(out, " name=\"%s\"", xml_normalize_string(name));
fprintf(out, " briefname=\"%s\"", xml_normalize_string(shortname));
fprintf(out, "/>\n");
-
- ext = info->file_extensions();
- while (*ext)
+
+ char *ext = strtok((char*)dev->file_extensions(),",");
+ while (ext != NULL)
{
fprintf(out, "\t\t\t<extension");
fprintf(out, " name=\"%s\"", xml_normalize_string(ext));
fprintf(out, "/>\n");
- ext += strlen(ext) + 1;
- }
+ ext = strtok (NULL, ",");
+ }
fprintf(out, "\t\t</device>\n");
}