mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
Changed device interfaces to pass the device_config * rather
than tokens and individual bits to the device callbacks. Updated all existing devices accordingly. Removed machine from the parameters of some of the device_get_info and device_set_info calls because that information is stored with the device now.
This commit is contained in:
parent
9c172be162
commit
befcee37ad
@ -63,9 +63,9 @@ INLINE char *get_temp_string_buffer(void)
|
||||
effect?
|
||||
-------------------------------------------------*/
|
||||
|
||||
INLINE int device_matches_type(const device_config *config, device_type type)
|
||||
INLINE int device_matches_type(const device_config *device, device_type type)
|
||||
{
|
||||
return (type == DEVICE_TYPE_WILDCARD) ? TRUE : (config->type == type);
|
||||
return (type == DEVICE_TYPE_WILDCARD) ? TRUE : (device->type == type);
|
||||
}
|
||||
|
||||
|
||||
@ -116,19 +116,19 @@ device_config *device_list_add(device_config **listheadptr, device_type type, co
|
||||
|
||||
/* fetch function pointers to the core functions */
|
||||
info.set_info = NULL;
|
||||
(*type)(NULL, NULL, DEVINFO_FCT_SET_INFO, &info);
|
||||
(*type)(NULL, DEVINFO_FCT_SET_INFO, &info);
|
||||
device->set_info = info.set_info;
|
||||
|
||||
info.start = NULL;
|
||||
(*type)(NULL, NULL, DEVINFO_FCT_START, &info);
|
||||
(*type)(NULL, DEVINFO_FCT_START, &info);
|
||||
device->start = info.start;
|
||||
|
||||
info.stop = NULL;
|
||||
(*type)(NULL, NULL, DEVINFO_FCT_STOP, &info);
|
||||
(*type)(NULL, DEVINFO_FCT_STOP, &info);
|
||||
device->stop = info.stop;
|
||||
|
||||
info.reset = NULL;
|
||||
(*type)(NULL, NULL, DEVINFO_FCT_RESET, &info);
|
||||
(*type)(NULL, DEVINFO_FCT_RESET, &info);
|
||||
device->reset = info.reset;
|
||||
|
||||
/* link us to the end and return */
|
||||
@ -432,27 +432,27 @@ const device_config *device_list_class_find_by_index(const device_config *listhe
|
||||
|
||||
void device_list_start(running_machine *machine)
|
||||
{
|
||||
device_config *config;
|
||||
device_config *device;
|
||||
|
||||
/* add an exit callback for cleanup */
|
||||
add_reset_callback(machine, device_list_reset);
|
||||
add_exit_callback(machine, device_list_stop);
|
||||
|
||||
/* iterate over devices and start them */
|
||||
for (config = (device_config *)machine->config->devicelist; config != NULL; config = config->next)
|
||||
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
|
||||
{
|
||||
assert(config->token == NULL);
|
||||
assert(config->type != NULL);
|
||||
assert(config->start != NULL);
|
||||
assert(device->token == NULL);
|
||||
assert(device->type != NULL);
|
||||
assert(device->start != NULL);
|
||||
|
||||
/* call the start function */
|
||||
config->machine = machine;
|
||||
config->token = (*config->start)(machine, config->tag, config->static_config, config->inline_config);
|
||||
assert(config->token != NULL);
|
||||
device->machine = machine;
|
||||
device->token = (*device->start)(device);
|
||||
assert(device->token != NULL);
|
||||
|
||||
/* fatal error if this fails */
|
||||
if (config->token == NULL)
|
||||
fatalerror("Error starting device: type=%s tag=%s\n", devtype_name(config->type), config->tag);
|
||||
if (device->token == NULL)
|
||||
fatalerror("Error starting device: type=%s tag=%s\n", devtype_name(device->type), device->tag);
|
||||
}
|
||||
}
|
||||
|
||||
@ -464,21 +464,21 @@ void device_list_start(running_machine *machine)
|
||||
|
||||
static void device_list_stop(running_machine *machine)
|
||||
{
|
||||
device_config *config;
|
||||
device_config *device;
|
||||
|
||||
/* iterate over devices and stop them */
|
||||
for (config = (device_config *)machine->config->devicelist; config != NULL; config = config->next)
|
||||
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
|
||||
{
|
||||
assert(config->token != NULL);
|
||||
assert(config->type != NULL);
|
||||
assert(device->token != NULL);
|
||||
assert(device->type != NULL);
|
||||
|
||||
/* if we have a stop function, call it */
|
||||
if (config->stop != NULL)
|
||||
(*config->stop)(machine, config->token);
|
||||
if (device->stop != NULL)
|
||||
(*device->stop)(device);
|
||||
|
||||
/* clear the token to indicate we are finished */
|
||||
config->token = NULL;
|
||||
config->machine = NULL;
|
||||
device->token = NULL;
|
||||
device->machine = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -490,11 +490,11 @@ static void device_list_stop(running_machine *machine)
|
||||
|
||||
static void device_list_reset(running_machine *machine)
|
||||
{
|
||||
const device_config *config;
|
||||
const device_config *device;
|
||||
|
||||
/* iterate over devices and stop them */
|
||||
for (config = (device_config *)machine->config->devicelist; config != NULL; config = config->next)
|
||||
device_reset(machine, config);
|
||||
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
|
||||
device_reset(device);
|
||||
}
|
||||
|
||||
|
||||
@ -503,23 +503,23 @@ static void device_list_reset(running_machine *machine)
|
||||
allocated device_config
|
||||
-------------------------------------------------*/
|
||||
|
||||
void device_reset(running_machine *machine, const device_config *config)
|
||||
void device_reset(const device_config *device)
|
||||
{
|
||||
assert(config->token != NULL);
|
||||
assert(config->type != NULL);
|
||||
assert(device->token != NULL);
|
||||
assert(device->type != NULL);
|
||||
|
||||
/* if we have a reset function, call it */
|
||||
if (config->reset != NULL)
|
||||
(*config->reset)(machine, config->token);
|
||||
if (device->reset != NULL)
|
||||
(*device->reset)(device);
|
||||
}
|
||||
|
||||
|
||||
void devtag_reset(running_machine *machine, device_type type, const char *tag)
|
||||
{
|
||||
const device_config *config = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (config == NULL)
|
||||
const device_config *device = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (device == NULL)
|
||||
fatalerror("devtag_reset failed to find device: type=%s tag=%s\n", devtype_name(type), tag);
|
||||
device_reset(machine, config);
|
||||
device_reset(device);
|
||||
}
|
||||
|
||||
|
||||
@ -535,10 +535,10 @@ void devtag_reset(running_machine *machine, device_type type, const char *tag)
|
||||
|
||||
void *devtag_get_token(running_machine *machine, device_type type, const char *tag)
|
||||
{
|
||||
const device_config *config = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (config == NULL)
|
||||
const device_config *device = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (device == NULL)
|
||||
fatalerror("devtag_get_token failed to find device: type=%s tag=%s\n", devtype_name(type), tag);
|
||||
return config->token;
|
||||
return device->token;
|
||||
}
|
||||
|
||||
|
||||
@ -550,10 +550,10 @@ void *devtag_get_token(running_machine *machine, device_type type, const char *t
|
||||
|
||||
const void *devtag_get_static_config(running_machine *machine, device_type type, const char *tag)
|
||||
{
|
||||
const device_config *config = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (config == NULL)
|
||||
const device_config *device = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (device == NULL)
|
||||
fatalerror("devtag_get_static_config failed to find device: type=%s tag=%s\n", devtype_name(type), tag);
|
||||
return config->static_config;
|
||||
return device->static_config;
|
||||
}
|
||||
|
||||
|
||||
@ -565,10 +565,10 @@ const void *devtag_get_static_config(running_machine *machine, device_type type,
|
||||
|
||||
const void *devtag_get_inline_config(running_machine *machine, device_type type, const char *tag)
|
||||
{
|
||||
const device_config *config = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (config == NULL)
|
||||
const device_config *device = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (device == NULL)
|
||||
fatalerror("devtag_get_inline_config failed to find device: type=%s tag=%s\n", devtype_name(type), tag);
|
||||
return config->inline_config;
|
||||
return device->inline_config;
|
||||
}
|
||||
|
||||
|
||||
@ -577,27 +577,27 @@ const void *devtag_get_inline_config(running_machine *machine, device_type type,
|
||||
value from an allocated device
|
||||
-------------------------------------------------*/
|
||||
|
||||
INT64 device_get_info_int(running_machine *machine, const device_config *config, UINT32 state)
|
||||
INT64 device_get_info_int(const device_config *device, UINT32 state)
|
||||
{
|
||||
deviceinfo info;
|
||||
|
||||
assert(config->token != NULL);
|
||||
assert(config->type != NULL);
|
||||
assert(device->token != NULL);
|
||||
assert(device->type != NULL);
|
||||
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
|
||||
|
||||
/* retrieve the value */
|
||||
info.i = 0;
|
||||
(*config->type)(machine, config->token, state, &info);
|
||||
(*device->type)(device, state, &info);
|
||||
return info.i;
|
||||
}
|
||||
|
||||
|
||||
INT64 devtag_get_info_int(running_machine *machine, device_type type, const char *tag, UINT32 state)
|
||||
{
|
||||
const device_config *config = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (config == NULL)
|
||||
const device_config *device = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (device == NULL)
|
||||
fatalerror("devtag_get_info_int failed to find device: type=%s tag=%s\n", devtype_name(type), tag);
|
||||
return device_get_info_int(machine, config, state);
|
||||
return device_get_info_int(device, state);
|
||||
}
|
||||
|
||||
|
||||
@ -606,27 +606,27 @@ INT64 devtag_get_info_int(running_machine *machine, device_type type, const char
|
||||
value from an allocated device
|
||||
-------------------------------------------------*/
|
||||
|
||||
void *device_get_info_ptr(running_machine *machine, const device_config *config, UINT32 state)
|
||||
void *device_get_info_ptr(const device_config *device, UINT32 state)
|
||||
{
|
||||
deviceinfo info;
|
||||
|
||||
assert(config->token != NULL);
|
||||
assert(config->type != NULL);
|
||||
assert(device->token != NULL);
|
||||
assert(device->type != NULL);
|
||||
assert(state >= DEVINFO_PTR_FIRST && state <= DEVINFO_PTR_LAST);
|
||||
|
||||
/* retrieve the value */
|
||||
info.p = NULL;
|
||||
(*config->type)(machine, config->token, state, &info);
|
||||
(*device->type)(device, state, &info);
|
||||
return info.p;
|
||||
}
|
||||
|
||||
|
||||
void *devtag_get_info_ptr(running_machine *machine, device_type type, const char *tag, UINT32 state)
|
||||
{
|
||||
const device_config *config = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (config == NULL)
|
||||
const device_config *device = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (device == NULL)
|
||||
fatalerror("devtag_get_info_ptr failed to find device: type=%s tag=%s\n", devtype_name(type), tag);
|
||||
return device_get_info_ptr(machine, config, state);
|
||||
return device_get_info_ptr(device, state);
|
||||
}
|
||||
|
||||
|
||||
@ -635,27 +635,27 @@ void *devtag_get_info_ptr(running_machine *machine, device_type type, const char
|
||||
pointer state value from an allocated device
|
||||
-------------------------------------------------*/
|
||||
|
||||
genf *device_get_info_fct(running_machine *machine, const device_config *config, UINT32 state)
|
||||
genf *device_get_info_fct(const device_config *device, UINT32 state)
|
||||
{
|
||||
deviceinfo info;
|
||||
|
||||
assert(config->token != NULL);
|
||||
assert(config->type != NULL);
|
||||
assert(device->token != NULL);
|
||||
assert(device->type != NULL);
|
||||
assert(state >= DEVINFO_FCT_FIRST && state <= DEVINFO_FCT_LAST);
|
||||
|
||||
/* retrieve the value */
|
||||
info.f = 0;
|
||||
(*config->type)(machine, config->token, state, &info);
|
||||
(*device->type)(device, state, &info);
|
||||
return info.f;
|
||||
}
|
||||
|
||||
|
||||
genf *devtag_get_info_fct(running_machine *machine, device_type type, const char *tag, UINT32 state)
|
||||
{
|
||||
const device_config *config = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (config == NULL)
|
||||
const device_config *device = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (device == NULL)
|
||||
fatalerror("device_get_info_fct failed to find device: type=%s tag=%s\n", devtype_name(type), tag);
|
||||
return device_get_info_fct(machine, config, state);
|
||||
return device_get_info_fct(device, state);
|
||||
}
|
||||
|
||||
|
||||
@ -664,27 +664,27 @@ genf *devtag_get_info_fct(running_machine *machine, device_type type, const char
|
||||
from an allocated device
|
||||
-------------------------------------------------*/
|
||||
|
||||
const char *device_get_info_string(running_machine *machine, const device_config *config, UINT32 state)
|
||||
const char *device_get_info_string(const device_config *device, UINT32 state)
|
||||
{
|
||||
deviceinfo info;
|
||||
|
||||
assert(config->token != NULL);
|
||||
assert(config->type != NULL);
|
||||
assert(device->token != NULL);
|
||||
assert(device->type != NULL);
|
||||
assert(state >= DEVINFO_STR_FIRST && state <= DEVINFO_STR_LAST);
|
||||
|
||||
/* retrieve the value */
|
||||
info.s = get_temp_string_buffer();
|
||||
(*config->type)(machine, config->token, state, &info);
|
||||
(*device->type)(device, state, &info);
|
||||
return info.s;
|
||||
}
|
||||
|
||||
|
||||
const char *devtag_get_info_string(running_machine *machine, device_type type, const char *tag, UINT32 state)
|
||||
{
|
||||
const device_config *config = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (config == NULL)
|
||||
const device_config *device = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (device == NULL)
|
||||
fatalerror("device_get_info_string failed to find device: type=%s tag=%s\n", devtype_name(type), tag);
|
||||
return device_get_info_string(machine, config, state);
|
||||
return device_get_info_string(device, state);
|
||||
}
|
||||
|
||||
|
||||
@ -708,7 +708,7 @@ INT64 devtype_get_info_int(device_type type, UINT32 state)
|
||||
|
||||
/* retrieve the value */
|
||||
info.i = 0;
|
||||
(*type)(NULL, NULL, state, &info);
|
||||
(*type)(NULL, state, &info);
|
||||
return info.i;
|
||||
}
|
||||
|
||||
@ -728,7 +728,7 @@ const char *devtype_get_info_string(device_type type, UINT32 state)
|
||||
|
||||
/* retrieve the value */
|
||||
info.s = get_temp_string_buffer();
|
||||
(*type)(NULL, NULL, state, &info);
|
||||
(*type)(NULL, state, &info);
|
||||
return info.s;
|
||||
}
|
||||
|
||||
@ -743,26 +743,26 @@ const char *devtype_get_info_string(device_type type, UINT32 state)
|
||||
value for an allocated device
|
||||
-------------------------------------------------*/
|
||||
|
||||
void device_set_info_int(running_machine *machine, const device_config *config, UINT32 state, INT64 data)
|
||||
void device_set_info_int(const device_config *device, UINT32 state, INT64 data)
|
||||
{
|
||||
deviceinfo info;
|
||||
|
||||
assert(config->token != NULL);
|
||||
assert(config->type != NULL);
|
||||
assert(device->token != NULL);
|
||||
assert(device->type != NULL);
|
||||
assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
|
||||
|
||||
/* set the value */
|
||||
info.i = data;
|
||||
(*config->set_info)(machine, config->token, state, &info);
|
||||
(*device->set_info)(device, state, &info);
|
||||
}
|
||||
|
||||
|
||||
void devtag_set_info_int(running_machine *machine, device_type type, const char *tag, UINT32 state, INT64 data)
|
||||
{
|
||||
const device_config *config = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (config == NULL)
|
||||
const device_config *device = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (device == NULL)
|
||||
fatalerror("devtag_set_info_int failed to find device: type=%s tag=%s\n", devtype_name(type), tag);
|
||||
device_set_info_int(machine, config, state, data);
|
||||
device_set_info_int(device, state, data);
|
||||
}
|
||||
|
||||
|
||||
@ -771,26 +771,26 @@ void devtag_set_info_int(running_machine *machine, device_type type, const char
|
||||
value for an allocated device
|
||||
-------------------------------------------------*/
|
||||
|
||||
void device_set_info_ptr(running_machine *machine, const device_config *config, UINT32 state, void *data)
|
||||
void device_set_info_ptr(const device_config *device, UINT32 state, void *data)
|
||||
{
|
||||
deviceinfo info;
|
||||
|
||||
assert(config->token != NULL);
|
||||
assert(config->type != NULL);
|
||||
assert(device->token != NULL);
|
||||
assert(device->type != NULL);
|
||||
assert(state >= DEVINFO_PTR_FIRST && state <= DEVINFO_PTR_LAST);
|
||||
|
||||
/* set the value */
|
||||
info.p = data;
|
||||
(*config->set_info)(machine, config->token, state, &info);
|
||||
(*device->set_info)(device, state, &info);
|
||||
}
|
||||
|
||||
|
||||
void devtag_set_info_ptr(running_machine *machine, device_type type, const char *tag, UINT32 state, void *data)
|
||||
{
|
||||
const device_config *config = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (config == NULL)
|
||||
const device_config *device = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (device == NULL)
|
||||
fatalerror("devtag_set_info_ptr failed to find device: type=%s tag=%s\n", devtype_name(type), tag);
|
||||
device_set_info_ptr(machine, config, state, data);
|
||||
device_set_info_ptr(device, state, data);
|
||||
}
|
||||
|
||||
|
||||
@ -799,24 +799,24 @@ void devtag_set_info_ptr(running_machine *machine, device_type type, const char
|
||||
state value for an allocated device
|
||||
-------------------------------------------------*/
|
||||
|
||||
void device_set_info_fct(running_machine *machine, const device_config *config, UINT32 state, genf *data)
|
||||
void device_set_info_fct(const device_config *device, UINT32 state, genf *data)
|
||||
{
|
||||
deviceinfo info;
|
||||
|
||||
assert(config->token != NULL);
|
||||
assert(config->type != NULL);
|
||||
assert(device->token != NULL);
|
||||
assert(device->type != NULL);
|
||||
assert(state >= DEVINFO_FCT_FIRST && state <= DEVINFO_FCT_LAST);
|
||||
|
||||
/* set the value */
|
||||
info.f = data;
|
||||
(*config->set_info)(machine, config->token, state, &info);
|
||||
(*device->set_info)(device, state, &info);
|
||||
}
|
||||
|
||||
|
||||
void devtag_set_info_fct(running_machine *machine, device_type type, const char *tag, UINT32 state, genf *data)
|
||||
{
|
||||
const device_config *config = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (config == NULL)
|
||||
const device_config *device = device_list_find_by_tag(machine->config->devicelist, type, tag);
|
||||
if (device == NULL)
|
||||
fatalerror("devtag_set_info_fct failed to find device: type=%s tag=%s\n", devtype_name(type), tag);
|
||||
device_set_info_fct(machine, config, state, data);
|
||||
device_set_info_fct(device, state, data);
|
||||
}
|
||||
|
@ -92,24 +92,24 @@ enum
|
||||
***************************************************************************/
|
||||
|
||||
#define DEVICE_GET_INFO_NAME(name) device_get_info_##name
|
||||
#define DEVICE_GET_INFO(name) void DEVICE_GET_INFO_NAME(name)(running_machine *machine, void *token, UINT32 state, deviceinfo *info)
|
||||
#define DEVICE_GET_INFO_CALL(name) DEVICE_GET_INFO_NAME(name)(machine, token, state, info)
|
||||
#define DEVICE_GET_INFO(name) void DEVICE_GET_INFO_NAME(name)(const device_config *device, UINT32 state, deviceinfo *info)
|
||||
#define DEVICE_GET_INFO_CALL(name) DEVICE_GET_INFO_NAME(name)(device, state, info)
|
||||
|
||||
#define DEVICE_SET_INFO_NAME(name) device_set_info_##name
|
||||
#define DEVICE_SET_INFO(name) void DEVICE_SET_INFO_NAME(name)(running_machine *machine, void *token, UINT32 state, const deviceinfo *info)
|
||||
#define DEVICE_SET_INFO_CALL(name) DEVICE_SET_INFO_NAME(name)(machine, token, state, info)
|
||||
#define DEVICE_SET_INFO(name) void DEVICE_SET_INFO_NAME(name)(const device_config *device, UINT32 state, const deviceinfo *info)
|
||||
#define DEVICE_SET_INFO_CALL(name) DEVICE_SET_INFO_NAME(name)(device, state, info)
|
||||
|
||||
#define DEVICE_START_NAME(name) device_start_##name
|
||||
#define DEVICE_START(name) void *DEVICE_START_NAME(name)(running_machine *machine, const char *tag, const void *static_config, const void *inline_config)
|
||||
#define DEVICE_START_CALL(name) DEVICE_START_NAME(name)(machine, tag, static_config, inline_config)
|
||||
#define DEVICE_START(name) void *DEVICE_START_NAME(name)(const device_config *device)
|
||||
#define DEVICE_START_CALL(name) DEVICE_START_NAME(name)(device)
|
||||
|
||||
#define DEVICE_STOP_NAME(name) device_stop_##name
|
||||
#define DEVICE_STOP(name) void DEVICE_STOP_NAME(name)(running_machine *machine, void *token)
|
||||
#define DEVICE_STOP_CALL(name) DEVICE_STOP_NAME(name)(machine, token)
|
||||
#define DEVICE_STOP(name) void DEVICE_STOP_NAME(name)(const device_config *device)
|
||||
#define DEVICE_STOP_CALL(name) DEVICE_STOP_NAME(name)(device)
|
||||
|
||||
#define DEVICE_RESET_NAME(name) device_reset_##name
|
||||
#define DEVICE_RESET(name) void DEVICE_RESET_NAME(name)(running_machine *machine, void *token)
|
||||
#define DEVICE_RESET_CALL(name) DEVICE_RESET_NAME(name)(machine, token)
|
||||
#define DEVICE_RESET(name) void DEVICE_RESET_NAME(name)(const device_config *device)
|
||||
#define DEVICE_RESET_CALL(name) DEVICE_RESET_NAME(name)(device)
|
||||
|
||||
|
||||
|
||||
@ -117,16 +117,17 @@ enum
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* forward-declare this type */
|
||||
/* forward-declare these types */
|
||||
typedef union _deviceinfo deviceinfo;
|
||||
typedef struct _device_config device_config;
|
||||
|
||||
|
||||
/* device interface function types */
|
||||
typedef void (*device_get_info_func)(running_machine *machine, void *token, UINT32 state, deviceinfo *info);
|
||||
typedef void (*device_set_info_func)(running_machine *machine, void *token, UINT32 state, const deviceinfo *info);
|
||||
typedef void *(*device_start_func)(running_machine *machine, const char *tag, const void *static_config, const void *inline_config);
|
||||
typedef void (*device_stop_func)(running_machine *machine, void *token);
|
||||
typedef void (*device_reset_func)(running_machine *machine, void *token);
|
||||
typedef void (*device_get_info_func)(const device_config *device, UINT32 state, deviceinfo *info);
|
||||
typedef void (*device_set_info_func)(const device_config *device, UINT32 state, const deviceinfo *info);
|
||||
typedef void *(*device_start_func)(const device_config *device);
|
||||
typedef void (*device_stop_func)(const device_config *device);
|
||||
typedef void (*device_reset_func)(const device_config *device);
|
||||
|
||||
|
||||
/* a device_type is simply a pointer to its get_info function */
|
||||
@ -149,7 +150,6 @@ union _deviceinfo
|
||||
|
||||
|
||||
/* the configuration for a general device */
|
||||
typedef struct _device_config device_config;
|
||||
struct _device_config
|
||||
{
|
||||
device_config * next; /* next device */
|
||||
@ -236,7 +236,7 @@ const device_config *device_list_class_find_by_index(const device_config *listhe
|
||||
void device_list_start(running_machine *machine);
|
||||
|
||||
/* reset a device based on an allocated device_config */
|
||||
void device_reset(running_machine *machine, const device_config *config);
|
||||
void device_reset(const device_config *device);
|
||||
void devtag_reset(running_machine *machine, device_type type, const char *tag);
|
||||
|
||||
|
||||
@ -253,19 +253,19 @@ const void *devtag_get_static_config(running_machine *machine, device_type type,
|
||||
const void *devtag_get_inline_config(running_machine *machine, device_type type, const char *tag);
|
||||
|
||||
/* return an integer state value from an allocated device */
|
||||
INT64 device_get_info_int(running_machine *machine, const device_config *config, UINT32 state);
|
||||
INT64 device_get_info_int(const device_config *device, UINT32 state);
|
||||
INT64 devtag_get_info_int(running_machine *machine, device_type type, const char *tag, UINT32 state);
|
||||
|
||||
/* return a pointer state value from an allocated device */
|
||||
void *device_get_info_ptr(running_machine *machine, const device_config *config, UINT32 state);
|
||||
void *device_get_info_ptr(const device_config *device, UINT32 state);
|
||||
void *devtag_get_info_ptr(running_machine *machine, device_type type, const char *tag, UINT32 state);
|
||||
|
||||
/* return a function pointer state value from an allocated device */
|
||||
genf *device_get_info_fct(running_machine *machine, const device_config *config, UINT32 state);
|
||||
genf *device_get_info_fct(const device_config *device, UINT32 state);
|
||||
genf *devtag_get_info_fct(running_machine *machine, device_type type, const char *tag, UINT32 state);
|
||||
|
||||
/* return a string value from an allocated device */
|
||||
const char *device_get_info_string(running_machine *machine, const device_config *config, UINT32 state);
|
||||
const char *device_get_info_string(const device_config *device, UINT32 state);
|
||||
const char *devtag_get_info_string(running_machine *machine, device_type type, const char *tag, UINT32 state);
|
||||
|
||||
|
||||
@ -283,15 +283,15 @@ const char *devtype_get_info_string(device_type type, UINT32 state);
|
||||
/* ----- device information setters ----- */
|
||||
|
||||
/* set an integer state value for an allocated device */
|
||||
void device_set_info_int(running_machine *machine, const device_config *config, UINT32 state, INT64 data);
|
||||
void device_set_info_int(const device_config *device, UINT32 state, INT64 data);
|
||||
void devtag_set_info_int(running_machine *machine, device_type type, const char *tag, UINT32 state, INT64 data);
|
||||
|
||||
/* set a pointer state value for an allocated device */
|
||||
void device_set_info_ptr(running_machine *machine, const device_config *config, UINT32 state, void *data);
|
||||
void device_set_info_ptr(const device_config *device, UINT32 state, void *data);
|
||||
void devtag_set_info_ptr(running_machine *machine, device_type type, const char *tag, UINT32 state, void *data);
|
||||
|
||||
/* set a function pointer state value for an allocated device */
|
||||
void device_set_info_fct(running_machine *machine, const device_config *config, UINT32 state, genf *data);
|
||||
void device_set_info_fct(const device_config *device, UINT32 state, genf *data);
|
||||
void devtag_set_info_fct(running_machine *machine, device_type type, const char *tag, UINT32 state, genf *data);
|
||||
|
||||
|
||||
|
@ -411,21 +411,21 @@ static DEVICE_START( z80dma )
|
||||
char unique_tag[30];
|
||||
|
||||
/* validate arguments */
|
||||
assert(machine != NULL);
|
||||
assert(tag != NULL);
|
||||
assert(strlen(tag) < 20);
|
||||
assert(device != NULL);
|
||||
assert(device->tag != NULL);
|
||||
assert(strlen(device->tag) < 20);
|
||||
|
||||
/* allocate the object that holds the state */
|
||||
z80dma = auto_malloc(sizeof(*z80dma));
|
||||
memset(z80dma, 0, sizeof(*z80dma));
|
||||
|
||||
//z80dma->device_type = device_type;
|
||||
z80dma->machine = machine;
|
||||
z80dma->intf = static_config;
|
||||
z80dma->machine = device->machine;
|
||||
z80dma->intf = device->static_config;
|
||||
|
||||
z80dma->timer = timer_alloc(z80dma_timerproc, z80dma);
|
||||
|
||||
state_save_combine_module_and_tag(unique_tag, "z80dma", tag);
|
||||
state_save_combine_module_and_tag(unique_tag, "z80dma", device->tag);
|
||||
|
||||
state_save_register_item_array(unique_tag, 0, z80dma->regs);
|
||||
state_save_register_item_array(unique_tag, 0, z80dma->regs_follow);
|
||||
@ -448,7 +448,7 @@ static DEVICE_START( z80dma )
|
||||
|
||||
static DEVICE_RESET( z80dma )
|
||||
{
|
||||
z80dma_t *z80dma = token;
|
||||
z80dma_t *z80dma = device->token;
|
||||
|
||||
z80dma->status = 0;
|
||||
z80dma->rdy = 0;
|
||||
|
@ -794,8 +794,8 @@ static DEVICE_START( speaker_output )
|
||||
memset(info, 0, sizeof(*info));
|
||||
|
||||
/* copy in all the relevant info */
|
||||
info->speaker = inline_config;
|
||||
info->tag = tag;
|
||||
info->speaker = device->inline_config;
|
||||
info->tag = device->tag;
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -1158,8 +1158,8 @@ void video_screen_register_vbl_cb(running_machine *machine, void *screen, vblank
|
||||
|
||||
static DEVICE_START( video_screen )
|
||||
{
|
||||
int scrindex = device_list_index(machine->config->devicelist, VIDEO_SCREEN, tag);
|
||||
return &machine->screen[scrindex];
|
||||
int scrindex = device_list_index(device->machine->config->devicelist, VIDEO_SCREEN, device->tag);
|
||||
return &device->machine->screen[scrindex];
|
||||
}
|
||||
|
||||
|
||||
|
@ -628,23 +628,23 @@ void mc6845_update(mc6845_t *mc6845, bitmap_t *bitmap, const rectangle *cliprect
|
||||
|
||||
|
||||
/* device interface */
|
||||
static void *common_start(running_machine *machine, const char *tag, const void *static_config, const void *inline_config, int device_type)
|
||||
static void *common_start(const device_config *device, int device_type)
|
||||
{
|
||||
mc6845_t *mc6845;
|
||||
char unique_tag[30];
|
||||
|
||||
/* validate arguments */
|
||||
assert(machine != NULL);
|
||||
assert(tag != NULL);
|
||||
assert(strlen(tag) < 20);
|
||||
assert(device != NULL);
|
||||
assert(device->tag != NULL);
|
||||
assert(strlen(device->tag) < 20);
|
||||
|
||||
/* allocate the object that holds the state */
|
||||
mc6845 = auto_malloc(sizeof(*mc6845));
|
||||
memset(mc6845, 0, sizeof(*mc6845));
|
||||
|
||||
mc6845->device_type = device_type;
|
||||
mc6845->machine = machine;
|
||||
mc6845->intf = static_config;
|
||||
mc6845->machine = device->machine;
|
||||
mc6845->intf = device->static_config;
|
||||
|
||||
/* create the timers */
|
||||
if (mc6845->intf != NULL)
|
||||
@ -668,7 +668,7 @@ static void *common_start(running_machine *machine, const char *tag, const void
|
||||
mc6845->light_pen_latch_timer = timer_alloc(light_pen_latch_timer_cb, mc6845);
|
||||
|
||||
/* register for state saving */
|
||||
state_save_combine_module_and_tag(unique_tag, device_tags[device_type], tag);
|
||||
state_save_combine_module_and_tag(unique_tag, device_tags[device_type], device->tag);
|
||||
|
||||
state_save_register_func_postload_ptr(mc6845_state_save_postload, mc6845);
|
||||
|
||||
@ -697,35 +697,35 @@ static void *common_start(running_machine *machine, const char *tag, const void
|
||||
|
||||
static DEVICE_START( mc6845 )
|
||||
{
|
||||
return common_start(machine, tag, static_config, inline_config, TYPE_MC6845);
|
||||
return common_start(device, TYPE_MC6845);
|
||||
}
|
||||
|
||||
static DEVICE_START( c6545_1 )
|
||||
{
|
||||
return common_start(machine, tag, static_config, inline_config, TYPE_C6545_1);
|
||||
return common_start(device, TYPE_C6545_1);
|
||||
}
|
||||
|
||||
static DEVICE_START( r6545_1 )
|
||||
{
|
||||
return common_start(machine, tag, static_config, inline_config, TYPE_R6545_1);
|
||||
return common_start(device, TYPE_R6545_1);
|
||||
}
|
||||
|
||||
|
||||
static DEVICE_RESET( mc6845 )
|
||||
{
|
||||
mc6845_t *mc6845 = token;
|
||||
mc6845_t *mc6845 = device->token;
|
||||
|
||||
/* internal registers other than status remain unchanged, all outputs go low */
|
||||
if (mc6845->intf != NULL)
|
||||
{
|
||||
if (mc6845->intf->on_de_changed != NULL)
|
||||
mc6845->intf->on_de_changed(machine, mc6845, FALSE);
|
||||
mc6845->intf->on_de_changed(device->machine, mc6845, FALSE);
|
||||
|
||||
if (mc6845->intf->on_hsync_changed != NULL)
|
||||
mc6845->intf->on_hsync_changed(machine, mc6845, FALSE);
|
||||
mc6845->intf->on_hsync_changed(device->machine, mc6845, FALSE);
|
||||
|
||||
if (mc6845->intf->on_vsync_changed != NULL)
|
||||
mc6845->intf->on_vsync_changed(machine, mc6845, FALSE);
|
||||
mc6845->intf->on_vsync_changed(device->machine, mc6845, FALSE);
|
||||
}
|
||||
|
||||
mc6845->light_pen_latched = FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user