Removed legacy image devices and related code (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2012-03-06 12:57:06 +00:00
parent 6a0b6fbc3b
commit 95b451277d
6 changed files with 1 additions and 278 deletions

1
.gitattributes vendored
View File

@ -656,7 +656,6 @@ src/emu/devcpu.c svneol=native#text/plain
src/emu/devcpu.h svneol=native#text/plain
src/emu/device.c svneol=native#text/plain
src/emu/device.h svneol=native#text/plain
src/emu/devimage.c svneol=native#text/plain
src/emu/devlegcy.c svneol=native#text/plain
src/emu/devlegcy.h svneol=native#text/plain
src/emu/devtempl.h svneol=native#text/plain

View File

@ -1,176 +0,0 @@
/***************************************************************************
devimage.c
Legacy image device helpers.
****************************************************************************
Copyright Miodrag Milanovic
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name 'MAME' nor the names of its contributors may be
used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
#include "emu.h"
#include "devlegcy.h"
//**************************************************************************
// LEGACY IMAGE DEVICE CONFIGURATION
//**************************************************************************
//-------------------------------------------------
// legacy_device_base - destructor
//-------------------------------------------------
legacy_image_device_base::~legacy_image_device_base()
{
}
//**************************************************************************
// LIVE LEGACY IMAGE DEVICE
//**************************************************************************
//-------------------------------------------------
// legacy_image_device_base - constructor
//-------------------------------------------------
legacy_image_device_base::legacy_image_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config)
: legacy_device_base(mconfig, type, tag, owner, clock, get_config),
device_image_interface(mconfig, *this)
{
}
//-------------------------------------------------
// device_config_complete - update configuration
// based on completed device setup
//-------------------------------------------------
void legacy_image_device_base::device_config_complete()
{
image_device_format **formatptr;
image_device_format *format;
formatptr = &m_formatlist;
int cnt = 0;
int format_count = get_legacy_int(DEVINFO_INT_IMAGE_CREATE_OPTCOUNT);
for (int i = 0; i < format_count; i++)
{
// only add if creatable
if (get_legacy_string(DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i)) {
// allocate a new format
format = global_alloc_clear(image_device_format);
// populate it
format->m_index = cnt;
format->m_name = get_legacy_string(DEVINFO_STR_IMAGE_CREATE_OPTNAME + i);
format->m_description = get_legacy_string(DEVINFO_STR_IMAGE_CREATE_OPTDESC + i);
format->m_extensions = get_legacy_string(DEVINFO_STR_IMAGE_CREATE_OPTEXTS + i);
format->m_optspec = get_legacy_string(DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i);
// and append it to the list
*formatptr = format;
formatptr = &format->m_next;
cnt++;
}
}
update_names();
// Override in case of hardcoded values
if (strlen(get_legacy_string(DEVINFO_STR_IMAGE_INSTANCE_NAME))>0) {
m_instance_name = get_legacy_string(DEVINFO_STR_IMAGE_INSTANCE_NAME);
}
if (strlen(get_legacy_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME))>0) {
m_brief_instance_name = get_legacy_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME);
}
}
bool legacy_image_device_base::call_load()
{
device_image_load_func func = reinterpret_cast<device_image_load_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_LOAD));
if (func) {
return (*func)(*this);
} else {
return FALSE;
}
}
bool legacy_image_device_base::call_softlist_load(char *swlist, char *swname, rom_entry *start_entry)
{
device_image_softlist_load_func func = reinterpret_cast<device_image_softlist_load_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_SOFTLIST_LOAD));
if (func) {
return (*func)(*this,swlist,swname,start_entry);
} else {
return FALSE;
}
}
bool legacy_image_device_base::call_create(int format_type, option_resolution *format_options)
{
device_image_create_func func = reinterpret_cast<device_image_create_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_CREATE));
if (func) {
return (*func)(*this,format_type,format_options);
} else {
return FALSE;
}
}
void legacy_image_device_base::call_unload()
{
device_image_unload_func func = reinterpret_cast<device_image_unload_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_UNLOAD));
if (func) (*func)(*this);
}
void legacy_image_device_base::call_display()
{
device_image_display_func func = reinterpret_cast<device_image_display_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_DISPLAY));
if (func) (*func)(*this);
}
void legacy_image_device_base::call_display_info()
{
device_image_display_info_func func = reinterpret_cast<device_image_display_info_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_DISPLAY_INFO));
if (func) (*func)(*this);
}
void legacy_image_device_base::call_get_devices()
{
device_image_get_devices_func func = reinterpret_cast<device_image_get_devices_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_GET_DEVICES));
if (func) (*func)(*this);
}
device_image_partialhash_func legacy_image_device_base::get_partial_hash() const
{
return reinterpret_cast<device_image_partialhash_func>(get_legacy_fct(DEVINFO_FCT_IMAGE_PARTIAL_HASH));
}

View File

@ -134,47 +134,7 @@ enum
DEVINFO_STR_CLASS_SPECIFIC = 0x34000, // R/W: device-specific values start here
DEVINFO_STR_DEVICE_SPECIFIC = 0x38000, // R/W: device-specific values start here
DEVINFO_STR_LAST = 0x3ffff,
/* --- image device related --- */
/* --- the following bits of info are returned as integers --- */
DEVINFO_INT_IMAGE_FIRST = DEVINFO_INT_FIRST + 0x7000,
DEVINFO_INT_IMAGE_TYPE,
DEVINFO_INT_IMAGE_READABLE,
DEVINFO_INT_IMAGE_WRITEABLE,
DEVINFO_INT_IMAGE_CREATABLE,
DEVINFO_INT_IMAGE_MUST_BE_LOADED,
DEVINFO_INT_IMAGE_RESET_ON_LOAD,
DEVINFO_INT_IMAGE_CREATE_OPTCOUNT,
DEVINFO_INT_IMAGE_LAST = DEVINFO_INT_IMAGE_FIRST + 0x0fff,
/* --- the following bits of info are returned as pointers --- */
DEVINFO_PTR_IMAGE_FIRST = DEVINFO_PTR_FIRST + 0x7000,
DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE,
DEVINFO_PTR_IMAGE_CREATE_OPTSPEC,
/* --- the following bits of info are returned as pointers to functions --- */
DEVINFO_FCT_IMAGE_FIRST = DEVINFO_FCT_FIRST + 0x7000,
DEVINFO_FCT_IMAGE_LOAD, /* R/O: device_image_load_func */
DEVINFO_FCT_IMAGE_CREATE, /* R/O: device_image_create_func */
DEVINFO_FCT_IMAGE_UNLOAD, /* R/O: device_image_unload_func */
DEVINFO_FCT_IMAGE_DISPLAY, /* R/O: device_image_display_func */
DEVINFO_FCT_IMAGE_PARTIAL_HASH, /* R/O: device_image_partialhash_func */
DEVINFO_FCT_IMAGE_DISPLAY_INFO, /* R/O: device_image_display_info_func */
DEVINFO_FCT_IMAGE_GET_DEVICES, /* R/O: device_image_get_devices_func */
DEVINFO_FCT_IMAGE_SOFTLIST_LOAD, /* R/O: device_image_softlist_load_func */
DEVINFO_FCT_IMAGE_LAST = DEVINFO_FCT_FIRST + 0x0fff,
/* --- the following bits of info are returned as NULL-terminated strings --- */
DEVINFO_STR_IMAGE_FIRST = DEVINFO_STR_FIRST + 0x7000,
DEVINFO_STR_IMAGE_FILE_EXTENSIONS,
DEVINFO_STR_IMAGE_INSTANCE_NAME,
DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME,
DEVINFO_STR_IMAGE_CREATE_OPTNAME,
DEVINFO_STR_IMAGE_CREATE_OPTDESC = DEVINFO_STR_IMAGE_CREATE_OPTNAME + DEVINFO_IMAGE_CREATE_OPTMAX,
DEVINFO_STR_IMAGE_CREATE_OPTEXTS = DEVINFO_STR_IMAGE_CREATE_OPTDESC + DEVINFO_IMAGE_CREATE_OPTMAX,
DEVINFO_STR_IMAGE_INTERFACE,
DEVINFO_STR_IMAGE_LAST = DEVINFO_STR_IMAGE_FIRST + 0x0fff
DEVINFO_STR_LAST = 0x3ffff
};
//**************************************************************************
@ -215,11 +175,9 @@ device_t *legacy_device_creator(const machine_config &mconfig, const char *tag,
// reduced macros that are easier to use, and map to the above two macros
#define DECLARE_LEGACY_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_device_base)
#define DECLARE_LEGACY_SOUND_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_sound_device_base)
#define DECLARE_LEGACY_IMAGE_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_image_device_base)
#define DEFINE_LEGACY_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_device_base)
#define DEFINE_LEGACY_SOUND_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_sound_device_base)
#define DEFINE_LEGACY_IMAGE_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_image_device_base)
// macros to wrap legacy device functions
@ -457,40 +415,4 @@ protected:
// ======================> legacy_image_device
// legacy_image_device is a legacy_device_base with a image interface
class legacy_image_device_base : public legacy_device_base,
public device_image_interface
{
public:
virtual bool call_load();
virtual bool call_softlist_load(char *swlist, char *swname, rom_entry *start_entry);
virtual bool call_create(int format_type, option_resolution *format_options);
virtual void call_unload();
virtual void call_display();
virtual void call_display_info();
virtual device_image_partialhash_func get_partial_hash() const;
virtual void call_get_devices();
virtual iodevice_t image_type() const { return static_cast<iodevice_t>(get_legacy_int(DEVINFO_INT_IMAGE_TYPE)); }
virtual bool is_readable() const { return get_legacy_int(DEVINFO_INT_IMAGE_READABLE)!=0; }
virtual bool is_writeable() const { return get_legacy_int(DEVINFO_INT_IMAGE_WRITEABLE)!=0; }
virtual bool is_creatable() const { return get_legacy_int(DEVINFO_INT_IMAGE_CREATABLE)!=0; }
virtual bool must_be_loaded() const { return get_legacy_int(DEVINFO_INT_IMAGE_MUST_BE_LOADED)!=0; }
virtual bool is_reset_on_load() const { return get_legacy_int(DEVINFO_INT_IMAGE_RESET_ON_LOAD)!=0; }
virtual const char *image_interface() const { return get_legacy_string(DEVINFO_STR_IMAGE_INTERFACE); }
virtual const char *file_extensions() const { return get_legacy_string(DEVINFO_STR_IMAGE_FILE_EXTENSIONS); }
virtual const option_guide *create_option_guide() const { return reinterpret_cast<const option_guide *>(get_legacy_ptr(DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE)); }
protected:
// device overrides
virtual void device_config_complete();
// construction/destruction
legacy_image_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config);
~legacy_image_device_base();
};
#endif /* __DEVLEGCY_H__ */

View File

@ -108,12 +108,8 @@ struct software_info;
// device image interface function types
typedef int (*device_image_load_func)(device_image_interface &image);
typedef int (*device_image_create_func)(device_image_interface &image, int format_type, option_resolution *format_options);
typedef void (*device_image_unload_func)(device_image_interface &image);
typedef void (*device_image_display_func)(device_image_interface &image);
typedef void (*device_image_partialhash_func)(hash_collection &, const unsigned char *, unsigned long, const char *);
typedef void (*device_image_get_devices_func)(device_image_interface &device);
typedef bool (*device_image_softlist_load_func)(device_image_interface &image, char *swlist, char *swname, rom_entry *start_entry);
typedef void (*device_image_display_info_func)(device_image_interface &image);
//**************************************************************************
@ -128,26 +124,12 @@ typedef void (*device_image_display_info_func)(device_image_interface &image);
#define DEVICE_IMAGE_LOAD_NAME(name) device_load_##name
#define DEVICE_IMAGE_LOAD(name) int DEVICE_IMAGE_LOAD_NAME(name)(device_image_interface &image)
#define DEVICE_IMAGE_CREATE_NAME(name) device_create_##name
#define DEVICE_IMAGE_CREATE(name) int DEVICE_IMAGE_CREATE_NAME(name)(device_image_interface &image, int create_format, option_resolution *create_args)
#define DEVICE_IMAGE_UNLOAD_NAME(name) device_unload_##name
#define DEVICE_IMAGE_UNLOAD(name) void DEVICE_IMAGE_UNLOAD_NAME(name)(device_image_interface &image)
#define DEVICE_IMAGE_DISPLAY_NAME(name) device_image_display_func##name
#define DEVICE_IMAGE_DISPLAY(name) void DEVICE_IMAGE_DISPLAY_NAME(name)(device_image_interface &image)
#define DEVICE_IMAGE_DISPLAY_INFO_NAME(name) device_image_display_info_func##name
#define DEVICE_IMAGE_DISPLAY_INFO(name) void DEVICE_IMAGE_DISPLAY_INFO_NAME(name)(device_image_interface &image)
#define DEVICE_IMAGE_GET_DEVICES_NAME(name) device_image_get_devices_##name
#define DEVICE_IMAGE_GET_DEVICES(name) void DEVICE_IMAGE_GET_DEVICES_NAME(name)(device_image_interface &image)
#define DEVICE_IMAGE_SOFTLIST_LOAD_NAME(name) device_softlist_load_##name
#define DEVICE_IMAGE_SOFTLIST_LOAD(name) bool DEVICE_IMAGE_SOFTLIST_LOAD_NAME(name)(device_image_interface &image, char *swlist, char *swname, rom_entry *start_entry)
// ======================> device_image_interface
// class representing interface-specific live image
@ -170,7 +152,6 @@ public:
virtual void call_unload() { }
virtual void call_display() { }
virtual void call_display_info() { }
virtual void call_get_devices() { }
virtual device_image_partialhash_func get_partial_hash() const { return NULL; }
virtual iodevice_t image_type() const = 0;
virtual bool is_readable() const = 0;

View File

@ -57,7 +57,6 @@ EMUOBJS = \
$(EMUOBJ)/devcb.o \
$(EMUOBJ)/devcpu.o \
$(EMUOBJ)/device.o \
$(EMUOBJ)/devimage.o \
$(EMUOBJ)/devlegcy.o \
$(EMUOBJ)/didisasm.o \
$(EMUOBJ)/diexec.o \

View File

@ -251,8 +251,6 @@ void image_device_init(running_machine &machine)
fatalerror_exitcode(machine, MAMERR_DEVICE, "Driver requires that device \"%s\" must have an image to load", image->instance_name());
}
}
image->call_get_devices();
}
}