Made the machine_config a proper object. Added detokenize method to

this object which can be called multiple times to append new devices
after the initial machine configuration is set up. Updated member
variables to match new naming convention.

Changed the running_machine to take a constructed machine_config
object in the constructor, instead of creating one itself, for
consistency. Also added machine->total_colors() as a shortcut to 
machine->config->m_total_colors.
This commit is contained in:
Aaron Giles 2010-06-28 06:40:44 +00:00
parent f9a3aaf5c8
commit 41b9dbb9ac
162 changed files with 785 additions and 712 deletions

View File

@ -56,7 +56,7 @@ INLINE void set_status(audit_record *record, UINT8 status, UINT8 substatus)
int audit_images(core_options *options, const game_driver *gamedrv, UINT32 validation, audit_record **audit) int audit_images(core_options *options, const game_driver *gamedrv, UINT32 validation, audit_record **audit)
{ {
machine_config *config = machine_config_alloc(gamedrv->machine_config); machine_config *config = global_alloc(machine_config(gamedrv->machine_config));
const rom_entry *region, *rom; const rom_entry *region, *rom;
const rom_source *source; const rom_source *source;
audit_record *record; audit_record *record;
@ -134,7 +134,7 @@ int audit_images(core_options *options, const game_driver *gamedrv, UINT32 valid
records = 0; records = 0;
} }
machine_config_free(config); global_free(config);
return records; return records;
} }
@ -146,14 +146,14 @@ int audit_images(core_options *options, const game_driver *gamedrv, UINT32 valid
int audit_samples(core_options *options, const game_driver *gamedrv, audit_record **audit) int audit_samples(core_options *options, const game_driver *gamedrv, audit_record **audit)
{ {
machine_config *config = machine_config_alloc(gamedrv->machine_config); machine_config *config = global_alloc(machine_config(gamedrv->machine_config));
audit_record *record; audit_record *record;
int records = 0; int records = 0;
int sampnum; int sampnum;
/* count the number of sample records attached to this driver */ /* count the number of sample records attached to this driver */
const device_config_sound_interface *sound = NULL; const device_config_sound_interface *sound = NULL;
for (bool gotone = config->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
if (sound->devconfig().type() == SOUND_SAMPLES) if (sound->devconfig().type() == SOUND_SAMPLES)
{ {
const samples_interface *intf = (const samples_interface *)sound->devconfig().static_config(); const samples_interface *intf = (const samples_interface *)sound->devconfig().static_config();
@ -176,7 +176,7 @@ int audit_samples(core_options *options, const game_driver *gamedrv, audit_recor
record = *audit; record = *audit;
/* now iterate over sample entries */ /* now iterate over sample entries */
for (bool gotone = config->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
if (sound->devconfig().type() == SOUND_SAMPLES) if (sound->devconfig().type() == SOUND_SAMPLES)
{ {
const samples_interface *intf = (const samples_interface *)sound->devconfig().static_config(); const samples_interface *intf = (const samples_interface *)sound->devconfig().static_config();
@ -219,7 +219,7 @@ int audit_samples(core_options *options, const game_driver *gamedrv, audit_recor
} }
skip: skip:
machine_config_free(config); global_free(config);
return records; return records;
} }

View File

@ -507,7 +507,7 @@ int cli_info_listcrc(core_options *options, const char *gamename)
for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) for (drvindex = 0; drivers[drvindex] != NULL; drvindex++)
if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0)
{ {
machine_config *config = machine_config_alloc(drivers[drvindex]->machine_config); machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config));
const rom_entry *region, *rom; const rom_entry *region, *rom;
const rom_source *source; const rom_source *source;
@ -524,7 +524,7 @@ int cli_info_listcrc(core_options *options, const char *gamename)
} }
count++; count++;
machine_config_free(config); global_free(config);
} }
/* return an error if none found */ /* return an error if none found */
@ -545,7 +545,7 @@ int cli_info_listroms(core_options *options, const char *gamename)
for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) for (drvindex = 0; drivers[drvindex] != NULL; drvindex++)
if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0)
{ {
machine_config *config = machine_config_alloc(drivers[drvindex]->machine_config); machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config));
const rom_entry *region, *rom; const rom_entry *region, *rom;
const rom_source *source; const rom_source *source;
@ -595,7 +595,7 @@ int cli_info_listroms(core_options *options, const char *gamename)
} }
count++; count++;
machine_config_free(config); global_free(config);
} }
return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME;
@ -616,11 +616,11 @@ int cli_info_listsamples(core_options *options, const char *gamename)
for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) for (drvindex = 0; drivers[drvindex] != NULL; drvindex++)
if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0)
{ {
machine_config *config = machine_config_alloc(drivers[drvindex]->machine_config); machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config));
const device_config_sound_interface *sound = NULL; const device_config_sound_interface *sound = NULL;
/* find samples interfaces */ /* find samples interfaces */
for (bool gotone = config->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
if (sound->devconfig().type() == SOUND_SAMPLES) if (sound->devconfig().type() == SOUND_SAMPLES)
{ {
const char *const *samplenames = ((const samples_interface *)sound->devconfig().static_config())->samplenames; const char *const *samplenames = ((const samples_interface *)sound->devconfig().static_config())->samplenames;
@ -633,7 +633,7 @@ int cli_info_listsamples(core_options *options, const char *gamename)
} }
count++; count++;
machine_config_free(config); global_free(config);
} }
return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME;
@ -655,7 +655,7 @@ int cli_info_listdevices(core_options *options, const char *gamename)
for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) for (drvindex = 0; drivers[drvindex] != NULL; drvindex++)
if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0)
{ {
machine_config *config = machine_config_alloc(drivers[drvindex]->machine_config); machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config));
const device_config *devconfig; const device_config *devconfig;
if (count != 0) if (count != 0)
@ -663,7 +663,7 @@ int cli_info_listdevices(core_options *options, const char *gamename)
printf("Driver %s (%s):\n", drivers[drvindex]->name, drivers[drvindex]->description); printf("Driver %s (%s):\n", drivers[drvindex]->name, drivers[drvindex]->description);
/* iterate through devices */ /* iterate through devices */
for (devconfig = config->devicelist.first(); devconfig != NULL; devconfig = devconfig->next()) for (devconfig = config->m_devicelist.first(); devconfig != NULL; devconfig = devconfig->next())
{ {
printf(" %s ('%s')", devconfig->name(), devconfig->tag()); printf(" %s ('%s')", devconfig->name(), devconfig->tag());
@ -681,7 +681,7 @@ int cli_info_listdevices(core_options *options, const char *gamename)
} }
count++; count++;
machine_config_free(config); global_free(config);
} }
return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME;
@ -793,9 +793,9 @@ static int info_listsoftware(core_options *options, const char *gamename)
if ( mame_strwildcmp( gamename, drivers[drvindex]->name ) == 0 ) if ( mame_strwildcmp( gamename, drivers[drvindex]->name ) == 0 )
{ {
/* allocate the machine config */ /* allocate the machine config */
machine_config *config = machine_config_alloc( drivers[drvindex]->machine_config ); machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config));
for (const device_config *dev = config->devicelist.first(); dev != NULL; dev = dev->next()) for (const device_config *dev = config->m_devicelist.first(); dev != NULL; dev = dev->next())
{ {
if ( ! strcmp( dev->tag(), __SOFTWARE_LIST_TAG ) ) if ( ! strcmp( dev->tag(), __SOFTWARE_LIST_TAG ) )
{ {
@ -810,7 +810,7 @@ static int info_listsoftware(core_options *options, const char *gamename)
} }
/* free the machine config */ /* free the machine config */
machine_config_free( config ); global_free(config);
} }
} }
@ -857,9 +857,9 @@ static int info_listsoftware(core_options *options, const char *gamename)
if ( mame_strwildcmp( gamename, drivers[drvindex]->name ) == 0 ) if ( mame_strwildcmp( gamename, drivers[drvindex]->name ) == 0 )
{ {
/* allocate the machine config */ /* allocate the machine config */
machine_config *config = machine_config_alloc( drivers[drvindex]->machine_config ); machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config));
for (const device_config *dev = config->devicelist.first(); dev != NULL; dev = dev->next()) for (const device_config *dev = config->m_devicelist.first(); dev != NULL; dev = dev->next())
{ {
if ( ! strcmp( dev->tag(), __SOFTWARE_LIST_TAG ) ) if ( ! strcmp( dev->tag(), __SOFTWARE_LIST_TAG ) )
{ {
@ -970,7 +970,7 @@ static int info_listsoftware(core_options *options, const char *gamename)
} }
} }
machine_config_free( config ); global_free(config);
} }
} }
@ -993,9 +993,9 @@ static void softlist_match_roms(core_options *options, const char *hash, int len
/* iterate over drivers */ /* iterate over drivers */
for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) for (drvindex = 0; drivers[drvindex] != NULL; drvindex++)
{ {
machine_config *config = machine_config_alloc(drivers[drvindex]->machine_config); machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config));
for (const device_config *dev = config->devicelist.first(); dev != NULL; dev = dev->next()) for (const device_config *dev = config->m_devicelist.first(); dev != NULL; dev = dev->next())
{ {
if ( ! strcmp( dev->tag(), __SOFTWARE_LIST_TAG ) ) if ( ! strcmp( dev->tag(), __SOFTWARE_LIST_TAG ) )
{ {
@ -1036,7 +1036,7 @@ static void softlist_match_roms(core_options *options, const char *hash, int len
} }
} }
machine_config_free(config); global_free(config);
} }
} }
@ -1066,13 +1066,13 @@ static int info_listmedia(core_options *options, const char *gamename)
if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0)
{ {
/* allocate the machine config */ /* allocate the machine config */
config = machine_config_alloc(drivers[drvindex]->machine_config); config = global_alloc(machine_config(drivers[drvindex]->machine_config));
driver_name = drivers[drvindex]->name; driver_name = drivers[drvindex]->name;
devcount = 0; devcount = 0;
for (bool gotone = config->devicelist.first(dev); gotone; gotone = dev->next(dev)) for (bool gotone = config->m_devicelist.first(dev); gotone; gotone = dev->next(dev))
{ {
src = downcast<const legacy_image_device_config_base *>(dev)->file_extensions(); src = downcast<const legacy_image_device_config_base *>(dev)->file_extensions();
name = downcast<const legacy_image_device_config_base *>(dev)->instance_name(); name = downcast<const legacy_image_device_config_base *>(dev)->instance_name();
@ -1097,7 +1097,7 @@ static int info_listmedia(core_options *options, const char *gamename)
printf("%-13s(none)\n",driver_name); printf("%-13s(none)\n",driver_name);
count++; count++;
machine_config_free(config); global_free(config);
} }
if (!count) if (!count)
@ -1455,7 +1455,7 @@ static void match_roms(core_options *options, const char *hash, int length, int
/* iterate over drivers */ /* iterate over drivers */
for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) for (drvindex = 0; drivers[drvindex] != NULL; drvindex++)
{ {
machine_config *config = machine_config_alloc(drivers[drvindex]->machine_config); machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config));
const rom_entry *region, *rom; const rom_entry *region, *rom;
const rom_source *source; const rom_source *source;
@ -1474,7 +1474,7 @@ static void match_roms(core_options *options, const char *hash, int length, int
(*found)++; (*found)++;
} }
machine_config_free(config); global_free(config);
} }
softlist_match_roms( options, hash, length, found ); softlist_match_roms( options, hash, length, found );

View File

@ -366,7 +366,7 @@ void debug_command_init(running_machine *machine)
debug_console_register_command(machine, "hardreset", CMDFLAG_NONE, 0, 0, 1, execute_hardreset); debug_console_register_command(machine, "hardreset", CMDFLAG_NONE, 0, 0, 1, execute_hardreset);
/* ask all the devices if they would like to register functions or symbols */ /* ask all the devices if they would like to register functions or symbols */
machine->devicelist.debug_setup_all(); machine->m_devicelist.debug_setup_all();
add_exit_callback(machine, debug_command_exit); add_exit_callback(machine, debug_command_exit);
@ -536,7 +536,7 @@ int debug_command_parameter_cpu(running_machine *machine, const char *param, dev
} }
/* if we got a valid one, return */ /* if we got a valid one, return */
*result = machine->devicelist.find(CPU, cpunum); *result = machine->m_devicelist.find(CPU, cpunum);
if (*result != NULL) if (*result != NULL)
return TRUE; return TRUE;
@ -2499,7 +2499,7 @@ static void execute_snap(running_machine *machine, int ref, int params, const ch
const char *filename = param[0]; const char *filename = param[0];
int scrnum = (params > 1) ? atoi(param[1]) : 0; int scrnum = (params > 1) ? atoi(param[1]) : 0;
device_t *screen = machine->devicelist.find(SCREEN, scrnum); device_t *screen = machine->m_devicelist.find(SCREEN, scrnum);
if ((screen == NULL) || !render_is_live_screen(screen)) if ((screen == NULL) || !render_is_live_screen(screen))
{ {

View File

@ -2390,7 +2390,7 @@ static device_t *expression_get_device(running_machine *machine, const char *tag
{ {
device_t *device; device_t *device;
for (device = machine->devicelist.first(); device != NULL; device = device->next()) for (device = machine->m_devicelist.first(); device != NULL; device = device->next())
if (mame_stricmp(device->tag(), tag) == 0) if (mame_stricmp(device->tag(), tag) == 0)
return device; return device;

View File

@ -135,7 +135,7 @@ void debug_view_disasm::enumerate_sources()
// iterate over devices with disassembly interfaces // iterate over devices with disassembly interfaces
device_disasm_interface *dasm = NULL; device_disasm_interface *dasm = NULL;
astring name; astring name;
for (bool gotone = m_machine.devicelist.first(dasm); gotone; gotone = dasm->next(dasm)) for (bool gotone = m_machine.m_devicelist.first(dasm); gotone; gotone = dasm->next(dasm))
{ {
name.printf("%s '%s'", dasm->device().name(), dasm->device().tag()); name.printf("%s '%s'", dasm->device().name(), dasm->device().tag());
m_source_list.append(*auto_alloc(&m_machine, debug_view_disasm_source(name, dasm->device()))); m_source_list.append(*auto_alloc(&m_machine, debug_view_disasm_source(name, dasm->device())));

View File

@ -153,7 +153,7 @@ void debug_view_memory::enumerate_sources()
// first add all the devices' address spaces // first add all the devices' address spaces
device_memory_interface *memintf = NULL; device_memory_interface *memintf = NULL;
for (bool gotone = m_machine.devicelist.first(memintf); gotone; gotone = memintf->next(memintf)) for (bool gotone = m_machine.m_devicelist.first(memintf); gotone; gotone = memintf->next(memintf))
for (int spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++) for (int spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{ {
const address_space *space = memintf->space(spacenum); const address_space *space = memintf->space(spacenum);

View File

@ -105,7 +105,7 @@ void debug_view_state::enumerate_sources()
// iterate over devices that have state interfaces // iterate over devices that have state interfaces
device_state_interface *state = NULL; device_state_interface *state = NULL;
astring name; astring name;
for (bool gotone = m_machine.devicelist.first(state); gotone; gotone = state->next(state)) for (bool gotone = m_machine.m_devicelist.first(state); gotone; gotone = state->next(state))
{ {
name.printf("%s '%s'", state->device().name(), state->device().tag()); name.printf("%s '%s'", state->device().name(), state->device().tag());
m_source_list.append(*auto_alloc(&m_machine, debug_view_state_source(name, state->device()))); m_source_list.append(*auto_alloc(&m_machine, debug_view_state_source(name, state->device())));

View File

@ -179,10 +179,10 @@ enum
//************************************************************************** //**************************************************************************
// device iteration helpers // device iteration helpers
#define cpu_count(config) (config)->devicelist.count(CPU) #define cpu_count(config) (config)->m_devicelist.count(CPU)
#define cpu_first(config) (config)->devicelist.first(CPU) #define cpu_first(config) (config)->m_devicelist.first(CPU)
#define cpu_next(previous) (previous)->typenext() #define cpu_next(previous) (previous)->typenext()
#define cpu_get_index(cpu) (cpu)->machine->devicelist.index(CPU, (cpu)->tag()) #define cpu_get_index(cpu) (cpu)->machine->m_devicelist.index(CPU, (cpu)->tag())
// CPU interface functions // CPU interface functions

View File

@ -112,7 +112,7 @@ void legacy_image_device_config_base::device_config_complete()
} }
} }
for (bool gotone = device_config_interface::m_machine_config.devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = device_config::m_machine_config.m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
if (this == image) if (this == image)
index = count; index = count;

View File

@ -187,7 +187,7 @@ void device_list::reset_all()
void device_list::static_reset(running_machine *machine) void device_list::static_reset(running_machine *machine)
{ {
machine->devicelist.reset_all(); machine->m_devicelist.reset_all();
} }
@ -197,7 +197,7 @@ void device_list::static_reset(running_machine *machine)
void device_list::static_exit(running_machine *machine) void device_list::static_exit(running_machine *machine)
{ {
machine->devicelist.reset(); machine->m_devicelist.reset();
} }
@ -310,7 +310,8 @@ device_config::device_config(const machine_config &mconfig, device_type type, co
m_machine_config(mconfig), m_machine_config(mconfig),
m_static_config(NULL), m_static_config(NULL),
m_name(name), m_name(name),
m_tag(tag) m_tag(tag),
m_config_complete(false)
{ {
memset(m_inline_data, 0, sizeof(m_inline_data)); memset(m_inline_data, 0, sizeof(m_inline_data));
@ -683,7 +684,7 @@ device_t::device_t(running_machine &_machine, const device_config &config)
: machine(&_machine), : machine(&_machine),
m_machine(_machine), m_machine(_machine),
m_next(NULL), m_next(NULL),
m_owner((config.m_owner != NULL) ? _machine.devicelist.find(config.m_owner->tag()) : NULL), m_owner((config.m_owner != NULL) ? _machine.m_devicelist.find(config.m_owner->tag()) : NULL),
m_interface_list(NULL), m_interface_list(NULL),
m_started(false), m_started(false),
m_clock(config.m_clock), m_clock(config.m_clock),

View File

@ -224,6 +224,7 @@ class device_config
{ {
DISABLE_COPYING(device_config); DISABLE_COPYING(device_config);
friend class machine_config;
friend class device_t; friend class device_t;
friend class device_config_interface; friend class device_config_interface;
template<class T> friend class tagged_list; template<class T> friend class tagged_list;
@ -300,6 +301,7 @@ protected:
private: private:
astring m_tag; // tag for this instance astring m_tag; // tag for this instance
bool m_config_complete; // have we completed our configuration?
}; };

View File

@ -217,7 +217,7 @@ bool device_config_execute_interface::interface_validity_check(const game_driver
mame_printf_error("%s: %s device '%s' has a new VBLANK interrupt handler with >1 interrupts!\n", driver.source_file, driver.name, devconfig->tag()); mame_printf_error("%s: %s device '%s' has a new VBLANK interrupt handler with >1 interrupts!\n", driver.source_file, driver.name, devconfig->tag());
error = true; error = true;
} }
else if (m_vblank_interrupt_screen != NULL && m_machine_config.devicelist.find(m_vblank_interrupt_screen) == NULL) else if (m_vblank_interrupt_screen != NULL && m_machine_config.m_devicelist.find(m_vblank_interrupt_screen) == NULL)
{ {
mame_printf_error("%s: %s device '%s' VBLANK interrupt with a non-existant screen tag (%s)!\n", driver.source_file, driver.name, devconfig->tag(), m_vblank_interrupt_screen); mame_printf_error("%s: %s device '%s' VBLANK interrupt with a non-existant screen tag (%s)!\n", driver.source_file, driver.name, devconfig->tag(), m_vblank_interrupt_screen);
error = true; error = true;
@ -536,7 +536,7 @@ void device_execute_interface::execute_set_input(int linenum, int state)
void device_execute_interface::interface_pre_start() void device_execute_interface::interface_pre_start()
{ {
// fill in the initial states // fill in the initial states
int index = m_machine.devicelist.index(&m_device); int index = m_machine.m_devicelist.index(&m_device);
m_suspend = SUSPEND_REASON_RESET; m_suspend = SUSPEND_REASON_RESET;
m_profiler = index + PROFILER_DEVICE_FIRST; m_profiler = index + PROFILER_DEVICE_FIRST;
m_inttrigger = index + TRIGGER_INT; m_inttrigger = index + TRIGGER_INT;
@ -699,7 +699,7 @@ void device_execute_interface::static_on_vblank(screen_device &screen, void *par
if (vblank_state) if (vblank_state)
{ {
device_execute_interface *exec = NULL; device_execute_interface *exec = NULL;
for (bool gotone = screen.machine->devicelist.first(exec); gotone; gotone = exec->next(exec)) for (bool gotone = screen.machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec))
exec->on_vblank_start(screen); exec->on_vblank_start(screen);
} }
} }

View File

@ -287,8 +287,8 @@ bool device_config_memory_interface::interface_validity_check(const game_driver
} }
// make sure all devices exist // make sure all devices exist
if ((entry->read.type == AMH_DEVICE_HANDLER && entry->read.tag != NULL && m_machine_config.devicelist.find(entry->read.tag) == NULL) || if ((entry->read.type == AMH_DEVICE_HANDLER && entry->read.tag != NULL && m_machine_config.m_devicelist.find(entry->read.tag) == NULL) ||
(entry->write.type == AMH_DEVICE_HANDLER && entry->write.tag != NULL && m_machine_config.devicelist.find(entry->write.tag) == NULL)) (entry->write.type == AMH_DEVICE_HANDLER && entry->write.tag != NULL && m_machine_config.m_devicelist.find(entry->write.tag) == NULL))
{ {
mame_printf_error("%s: %s device '%s' %s space memory map entry references nonexistant device '%s'\n", driver.source_file, driver.name, devconfig->tag(), spaceconfig->m_name, entry->write.tag); mame_printf_error("%s: %s device '%s' %s space memory map entry references nonexistant device '%s'\n", driver.source_file, driver.name, devconfig->tag(), spaceconfig->m_name, entry->write.tag);
error = true; error = true;

View File

@ -120,7 +120,7 @@ bool device_config_sound_interface::interface_validity_check(const game_driver &
for (const sound_route *route = m_route_list; route != NULL; route = route->m_next) for (const sound_route *route = m_route_list; route != NULL; route = route->m_next)
{ {
// find a device with the requested tag // find a device with the requested tag
const device_config *target = m_machine_config.devicelist.find(route->m_target); const device_config *target = m_machine_config.m_devicelist.find(route->m_target);
if (target == NULL) if (target == NULL)
{ {
mame_printf_error("%s: %s attempting to route sound to non-existant device '%s'\n", driver.source_file, driver.name, route->m_target); mame_printf_error("%s: %s attempting to route sound to non-existant device '%s'\n", driver.source_file, driver.name, route->m_target);

View File

@ -81,7 +81,7 @@ INLINE INT32 normalize_yscroll(bitmap_t *bitmap, INT32 yscroll)
void gfx_init(running_machine *machine) void gfx_init(running_machine *machine)
{ {
const gfx_decode_entry *gfxdecodeinfo = machine->config->gfxdecodeinfo; const gfx_decode_entry *gfxdecodeinfo = machine->config->m_gfxdecodeinfo;
int curgfx; int curgfx;
/* skip if nothing to do */ /* skip if nothing to do */
@ -368,7 +368,7 @@ void gfx_element_build_temporary(gfx_element *gfx, running_machine *machine, UIN
gfx->color_base = color_base; gfx->color_base = color_base;
gfx->color_depth = color_granularity; gfx->color_depth = color_granularity;
gfx->color_granularity = color_granularity; gfx->color_granularity = color_granularity;
gfx->total_colors = (machine->config->total_colors - color_base) / color_granularity; gfx->total_colors = (machine->total_colors() - color_base) / color_granularity;
gfx->pen_usage = NULL; gfx->pen_usage = NULL;

View File

@ -236,11 +236,11 @@ void image_add_device_options(core_options *opts, const game_driver *driver)
const device_config_image_interface *image = NULL; const device_config_image_interface *image = NULL;
/* create the configuration */ /* create the configuration */
config = machine_config_alloc(driver->machine_config); config = global_alloc(machine_config(driver->machine_config));
/* enumerate our callback for every device */ /* enumerate our callback for every device */
/* loop on each device instance */ /* loop on each device instance */
for (bool gotone = config->devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = config->m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
options_entry entry[2]; options_entry entry[2];
astring dev_full_name; astring dev_full_name;
@ -269,7 +269,7 @@ void image_add_device_options(core_options *opts, const game_driver *driver)
options_set_bool(opts, OPTION_ADDED_DEVICE_OPTIONS, TRUE, OPTION_PRIORITY_CMDLINE); options_set_bool(opts, OPTION_ADDED_DEVICE_OPTIONS, TRUE, OPTION_PRIORITY_CMDLINE);
/* free the configuration */ /* free the configuration */
machine_config_free(config); global_free(config);
} }
/*------------------------------------------------- /*-------------------------------------------------

View File

@ -120,7 +120,7 @@ void palette_init(running_machine *machine)
case BITMAP_FORMAT_INVALID: case BITMAP_FORMAT_INVALID:
/* invalid format means no palette - or at least it should */ /* invalid format means no palette - or at least it should */
assert(machine->config->total_colors == 0); assert(machine->total_colors() == 0);
return; return;
default: default:
@ -129,7 +129,7 @@ void palette_init(running_machine *machine)
} }
/* allocate all the data structures */ /* allocate all the data structures */
if (machine->config->total_colors > 0) if (machine->total_colors() > 0)
{ {
int numcolors; int numcolors;
@ -327,7 +327,7 @@ colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize)
/* fill in the basics */ /* fill in the basics */
ctable->machine = machine; ctable->machine = machine;
ctable->entries = machine->config->total_colors; ctable->entries = machine->total_colors();
ctable->palentries = palettesize; ctable->palentries = palettesize;
/* allocate the raw colortable */ /* allocate the raw colortable */
@ -583,14 +583,14 @@ static void allocate_palette(running_machine *machine, palette_private *palette)
/* determine the number of groups we need */ /* determine the number of groups we need */
numgroups = 1; numgroups = 1;
if (machine->config->video_attributes & VIDEO_HAS_SHADOWS) if (machine->config->m_video_attributes & VIDEO_HAS_SHADOWS)
palette->shadow_group = numgroups++; palette->shadow_group = numgroups++;
if (machine->config->video_attributes & VIDEO_HAS_HIGHLIGHTS) if (machine->config->m_video_attributes & VIDEO_HAS_HIGHLIGHTS)
palette->hilight_group = numgroups++; palette->hilight_group = numgroups++;
assert_always(machine->config->total_colors * numgroups <= 65536, "Error: palette has more than 65536 colors."); assert_always(machine->total_colors() * numgroups <= 65536, "Error: palette has more than 65536 colors.");
/* allocate a palette object containing all the colors and groups */ /* allocate a palette object containing all the colors and groups */
machine->palette = palette_alloc(machine->config->total_colors, numgroups); machine->palette = palette_alloc(machine->total_colors(), numgroups);
assert_always(machine->palette != NULL, "Failed to allocate system palette"); assert_always(machine->palette != NULL, "Failed to allocate system palette");
/* configure the groups */ /* configure the groups */
@ -600,7 +600,7 @@ static void allocate_palette(running_machine *machine, palette_private *palette)
palette_group_set_contrast(machine->palette, palette->hilight_group, (float)PALETTE_DEFAULT_HIGHLIGHT_FACTOR); palette_group_set_contrast(machine->palette, palette->hilight_group, (float)PALETTE_DEFAULT_HIGHLIGHT_FACTOR);
/* set the initial colors to a standard rainbow */ /* set the initial colors to a standard rainbow */
for (index = 0; index < machine->config->total_colors; index++) for (index = 0; index < machine->total_colors(); index++)
palette_entry_set_color(machine->palette, index, MAKE_RGB(pal1bit(index >> 0), pal1bit(index >> 1), pal1bit(index >> 2))); palette_entry_set_color(machine->palette, index, MAKE_RGB(pal1bit(index >> 0), pal1bit(index >> 1), pal1bit(index >> 2)));
/* switch off the color mode */ /* switch off the color mode */
@ -680,7 +680,7 @@ static void allocate_color_tables(running_machine *machine, palette_private *pal
static void allocate_shadow_tables(running_machine *machine, palette_private *palette) static void allocate_shadow_tables(running_machine *machine, palette_private *palette)
{ {
/* if we have shadows, allocate shadow tables */ /* if we have shadows, allocate shadow tables */
if (machine->config->video_attributes & VIDEO_HAS_SHADOWS) if (machine->config->m_video_attributes & VIDEO_HAS_SHADOWS)
{ {
pen_t *table = auto_alloc_array(machine, pen_t, 65536); pen_t *table = auto_alloc_array(machine, pen_t, 65536);
int i; int i;
@ -690,7 +690,7 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa
{ {
palette->shadow_table[0].base = palette->shadow_table[2].base = table; palette->shadow_table[0].base = palette->shadow_table[2].base = table;
for (i = 0; i < 65536; i++) for (i = 0; i < 65536; i++)
table[i] = (i < machine->config->total_colors) ? (i + machine->config->total_colors) : i; table[i] = (i < machine->total_colors()) ? (i + machine->total_colors()) : i;
} }
/* RGB mode gets two 32k tables in slots 0 and 2 */ /* RGB mode gets two 32k tables in slots 0 and 2 */
@ -703,7 +703,7 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa
} }
/* if we have hilights, allocate shadow tables */ /* if we have hilights, allocate shadow tables */
if (machine->config->video_attributes & VIDEO_HAS_HIGHLIGHTS) if (machine->config->m_video_attributes & VIDEO_HAS_HIGHLIGHTS)
{ {
pen_t *table = auto_alloc_array(machine, pen_t, 65536); pen_t *table = auto_alloc_array(machine, pen_t, 65536);
int i; int i;
@ -713,7 +713,7 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa
{ {
palette->shadow_table[1].base = palette->shadow_table[3].base = table; palette->shadow_table[1].base = palette->shadow_table[3].base = table;
for (i = 0; i < 65536; i++) for (i = 0; i < 65536; i++)
table[i] = (i < machine->config->total_colors) ? (i + 2 * machine->config->total_colors) : i; table[i] = (i < machine->total_colors()) ? (i + 2 * machine->total_colors()) : i;
} }
/* RGB mode gets two 32k tables in slots 1 and 3 */ /* RGB mode gets two 32k tables in slots 1 and 3 */

View File

@ -77,7 +77,7 @@ static void image_dirs_load(running_machine *machine, int config_type, xml_data_
if ((dev_instance != NULL) && (dev_instance[0] != '\0')) if ((dev_instance != NULL) && (dev_instance[0] != '\0'))
{ {
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
if (!strcmp(dev_instance, image->image_config().instance_name())) { if (!strcmp(dev_instance, image->image_config().instance_name())) {
working_directory = xml_get_attribute_string(node, "directory", NULL); working_directory = xml_get_attribute_string(node, "directory", NULL);
@ -106,7 +106,7 @@ static void image_dirs_save(running_machine *machine, int config_type, xml_data_
/* only care about game-specific data */ /* only care about game-specific data */
if (config_type == CONFIG_TYPE_GAME) if (config_type == CONFIG_TYPE_GAME)
{ {
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
dev_instance = image->image_config().instance_name(); dev_instance = image->image_config().instance_name();
@ -163,7 +163,7 @@ static void image_options_extract(running_machine *machine)
int index = 0; int index = 0;
device_image_interface *image = NULL; device_image_interface *image = NULL;
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
const char *filename = image->filename(); const char *filename = image->filename();
@ -191,7 +191,7 @@ void image_unload_all(running_machine *machine)
// extract the options // extract the options
image_options_extract(machine); image_options_extract(machine);
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
// unload this image // unload this image
image->unload(); image->unload();
@ -208,7 +208,7 @@ void image_device_init(running_machine *machine)
device_image_interface *image = NULL; device_image_interface *image = NULL;
/* make sure that any required devices have been allocated */ /* make sure that any required devices have been allocated */
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
/* is an image specified for this image */ /* is an image specified for this image */
image_name = image_get_device_option(image); image_name = image_get_device_option(image);
@ -258,7 +258,7 @@ void image_postdevice_init(running_machine *machine)
device_image_interface *image = NULL; device_image_interface *image = NULL;
/* make sure that any required devices have been allocated */ /* make sure that any required devices have been allocated */
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
int result = image->finish_load(); int result = image->finish_load();
/* did the image load fail? */ /* did the image load fail? */
@ -390,7 +390,7 @@ astring *image_info_astring(running_machine *machine, astring *string)
} }
#endif #endif
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
const char *name = image->filename(); const char *name = image->filename();
if (name != NULL) if (name != NULL)
@ -490,7 +490,7 @@ device_image_interface *image_from_absolute_index(running_machine *machine, int
device_image_interface *image = NULL; device_image_interface *image = NULL;
int cnt = 0; int cnt = 0;
/* make sure that any required devices have been allocated */ /* make sure that any required devices have been allocated */
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
if (cnt==absolute_index) return image; if (cnt==absolute_index) return image;
cnt++; cnt++;

View File

@ -433,7 +433,7 @@ static void print_game_rom(FILE *out, const game_driver *game, const machine_con
{ {
const game_driver *clone_of = driver_get_clone(game); const game_driver *clone_of = driver_get_clone(game);
int rom_type; int rom_type;
machine_config *pconfig = (clone_of != NULL) ? machine_config_alloc(clone_of->machine_config) : NULL; machine_config *pconfig = (clone_of != NULL) ? global_alloc(machine_config(clone_of->machine_config)) : NULL;
/* iterate over 3 different ROM "types": BIOS, ROMs, DISKs */ /* iterate over 3 different ROM "types": BIOS, ROMs, DISKs */
for (rom_type = 0; rom_type < 3; rom_type++) for (rom_type = 0; rom_type < 3; rom_type++)
@ -550,8 +550,7 @@ static void print_game_rom(FILE *out, const game_driver *game, const machine_con
} }
} }
if (pconfig != NULL) global_free(pconfig);
machine_config_free(pconfig);
} }
@ -564,7 +563,7 @@ static void print_game_sampleof(FILE *out, const game_driver *game, const machin
{ {
const device_config_sound_interface *sound = NULL; const device_config_sound_interface *sound = NULL;
for (bool gotone = config->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
if (sound->devconfig().type() == SOUND_SAMPLES) if (sound->devconfig().type() == SOUND_SAMPLES)
{ {
const char *const *samplenames = ((const samples_interface *)sound->devconfig().static_config())->samplenames; const char *const *samplenames = ((const samples_interface *)sound->devconfig().static_config())->samplenames;
@ -596,7 +595,7 @@ static void print_game_sample(FILE *out, const game_driver *game, const machine_
const device_config_sound_interface *sound = NULL; const device_config_sound_interface *sound = NULL;
/* iterate over sound chips looking for samples */ /* iterate over sound chips looking for samples */
for (bool gotone = config->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
if (sound->devconfig().type() == SOUND_SAMPLES) if (sound->devconfig().type() == SOUND_SAMPLES)
{ {
const char *const *samplenames = ((const samples_interface *)sound->devconfig().static_config())->samplenames; const char *const *samplenames = ((const samples_interface *)sound->devconfig().static_config())->samplenames;
@ -651,7 +650,7 @@ static void print_game_chips(FILE *out, const game_driver *game, const machine_c
/* iterate over sound chips */ /* iterate over sound chips */
const device_config_sound_interface *sound = NULL; const device_config_sound_interface *sound = NULL;
for (bool gotone = config->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
{ {
fprintf(out, "\t\t<chip"); fprintf(out, "\t\t<chip");
fprintf(out, " type=\"audio\""); fprintf(out, " type=\"audio\"");
@ -759,7 +758,7 @@ static void print_game_sound(FILE *out, const game_driver *game, const machine_c
/* if we have no sound, zero out the speaker count */ /* if we have no sound, zero out the speaker count */
const device_config_sound_interface *sound = NULL; const device_config_sound_interface *sound = NULL;
if (!config->devicelist.first(sound)) if (!config->m_devicelist.first(sound))
speakers = 0; speakers = 0;
fprintf(out, "\t\t<sound channels=\"%d\"/>\n", speakers); fprintf(out, "\t\t<sound channels=\"%d\"/>\n", speakers);
@ -824,7 +823,7 @@ static void print_game_driver(FILE *out, const game_driver *game, const machine_
else else
fprintf(out, " savestate=\"unsupported\""); fprintf(out, " savestate=\"unsupported\"");
fprintf(out, " palettesize=\"%d\"", config->total_colors); fprintf(out, " palettesize=\"%d\"", config->m_total_colors);
fprintf(out, "/>\n"); fprintf(out, "/>\n");
} }
@ -874,7 +873,7 @@ static void print_game_images(FILE *out, const game_driver *game, const machine_
const char *name; const char *name;
const char *shortname; const char *shortname;
for (bool gotone = config->devicelist.first(dev); gotone; gotone = dev->next(dev)) for (bool gotone = config->m_devicelist.first(dev); gotone; gotone = dev->next(dev))
{ {
/* print out device type */ /* print out device type */
fprintf(out, "\t\t<device type=\"%s\"", xml_normalize_string(dev->image_type_name())); fprintf(out, "\t\t<device type=\"%s\"", xml_normalize_string(dev->image_type_name()));
@ -923,7 +922,7 @@ static void print_game_images(FILE *out, const game_driver *game, const machine_
static void print_game_software_list(FILE *out, const game_driver *game, const machine_config *config) static void print_game_software_list(FILE *out, const game_driver *game, const machine_config *config)
{ {
for (const device_config *dev = config->devicelist.first(); dev != NULL; dev = dev->next()) for (const device_config *dev = config->m_devicelist.first(); dev != NULL; dev = dev->next())
{ {
if ( ! strcmp( dev->tag(), __SOFTWARE_LIST_TAG ) ) if ( ! strcmp( dev->tag(), __SOFTWARE_LIST_TAG ) )
{ {
@ -957,7 +956,7 @@ static void print_game_info(FILE *out, const game_driver *game)
return; return;
/* start tracking resources and allocate the machine and input configs */ /* start tracking resources and allocate the machine and input configs */
config = machine_config_alloc(game->machine_config); config = global_alloc(machine_config(game->machine_config));
input_port_list_init(portlist, game->ipt, NULL, 0, FALSE); input_port_list_init(portlist, game->ipt, NULL, 0, FALSE);
/* print the header and the game name */ /* print the header and the game name */
@ -1023,7 +1022,7 @@ static void print_game_info(FILE *out, const game_driver *game)
/* close the topmost tag */ /* close the topmost tag */
fprintf(out, "\t</" XML_TOP ">\n"); fprintf(out, "\t</" XML_TOP ">\n");
machine_config_free(config); global_free(config);
} }

View File

@ -432,7 +432,7 @@ static DEVICE_START( riot6532 )
/* set static values */ /* set static values */
riot->device = device; riot->device = device;
riot->intf = (riot6532_interface *)device->baseconfig().static_config(); riot->intf = (riot6532_interface *)device->baseconfig().static_config();
riot->index = device->machine->devicelist.index(RIOT6532, device->tag()); riot->index = device->machine->m_devicelist.index(RIOT6532, device->tag());
/* configure the ports */ /* configure the ports */
devcb_resolve_read8(&riot->port[0].in_func, &riot->intf->in_a_func, device); devcb_resolve_read8(&riot->port[0].in_func, &riot->intf->in_a_func, device);

View File

@ -109,7 +109,7 @@ void generic_machine_init(running_machine *machine)
config_register(machine, "counters", counters_load, counters_save); config_register(machine, "counters", counters_load, counters_save);
/* for memory cards, request save state and an exit callback */ /* for memory cards, request save state and an exit callback */
if (machine->config->memcard_handler != NULL) if (machine->config->m_memcard_handler != NULL)
{ {
state_save_register_global(machine, state->memcard_inserted); state_save_register_global(machine, state->memcard_inserted);
add_exit_callback(machine, memcard_eject); add_exit_callback(machine, memcard_eject);
@ -329,7 +329,7 @@ void nvram_load(running_machine *machine)
{ {
// only need to do something if we have an NVRAM device or an nvram_handler // only need to do something if we have an NVRAM device or an nvram_handler
device_nvram_interface *nvram = NULL; device_nvram_interface *nvram = NULL;
if (!machine->devicelist.first(nvram) && machine->config->nvram_handler == NULL) if (!machine->m_devicelist.first(nvram) && machine->config->m_nvram_handler == NULL)
return; return;
// open the file; if it exists, call everyone to read from it // open the file; if it exists, call everyone to read from it
@ -337,8 +337,8 @@ void nvram_load(running_machine *machine)
if (nvram_file != NULL) if (nvram_file != NULL)
{ {
// read data from general NVRAM handler first // read data from general NVRAM handler first
if (machine->config->nvram_handler != NULL) if (machine->config->m_nvram_handler != NULL)
(*machine->config->nvram_handler)(machine, nvram_file, FALSE); (*machine->config->m_nvram_handler)(machine, nvram_file, FALSE);
// find all devices with NVRAM handlers, and read from them next // find all devices with NVRAM handlers, and read from them next
for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram)) for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram))
@ -352,8 +352,8 @@ void nvram_load(running_machine *machine)
else else
{ {
// initialize via the general NVRAM handler first // initialize via the general NVRAM handler first
if (machine->config->nvram_handler != NULL) if (machine->config->m_nvram_handler != NULL)
(*machine->config->nvram_handler)(machine, NULL, FALSE); (*machine->config->m_nvram_handler)(machine, NULL, FALSE);
// find all devices with NVRAM handlers, and read from them next // find all devices with NVRAM handlers, and read from them next
for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram)) for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram))
@ -370,7 +370,7 @@ void nvram_save(running_machine *machine)
{ {
// only need to do something if we have an NVRAM device or an nvram_handler // only need to do something if we have an NVRAM device or an nvram_handler
device_nvram_interface *nvram = NULL; device_nvram_interface *nvram = NULL;
if (!machine->devicelist.first(nvram) && machine->config->nvram_handler == NULL) if (!machine->m_devicelist.first(nvram) && machine->config->m_nvram_handler == NULL)
return; return;
// open the file; if it exists, call everyone to read from it // open the file; if it exists, call everyone to read from it
@ -378,8 +378,8 @@ void nvram_save(running_machine *machine)
if (nvram_file != NULL) if (nvram_file != NULL)
{ {
// write data via general NVRAM handler first // write data via general NVRAM handler first
if (machine->config->nvram_handler != NULL) if (machine->config->m_nvram_handler != NULL)
(*machine->config->nvram_handler)(machine, nvram_file, TRUE); (*machine->config->m_nvram_handler)(machine, nvram_file, TRUE);
// find all devices with NVRAM handlers, and tell them to write next // find all devices with NVRAM handlers, and tell them to write next
for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram)) for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram))
@ -498,8 +498,8 @@ int memcard_create(running_machine *machine, int index, int overwrite)
return 1; return 1;
/* initialize and then save the card */ /* initialize and then save the card */
if (machine->config->memcard_handler) if (machine->config->m_memcard_handler)
(*machine->config->memcard_handler)(machine, file, MEMCARD_CREATE); (*machine->config->m_memcard_handler)(machine, file, MEMCARD_CREATE);
/* close the file */ /* close the file */
mame_fclose(file); mame_fclose(file);
@ -534,8 +534,8 @@ int memcard_insert(running_machine *machine, int index)
return 1; return 1;
/* initialize and then load the card */ /* initialize and then load the card */
if (machine->config->memcard_handler) if (machine->config->m_memcard_handler)
(*machine->config->memcard_handler)(machine, file, MEMCARD_INSERT); (*machine->config->m_memcard_handler)(machine, file, MEMCARD_INSERT);
/* close the file */ /* close the file */
mame_fclose(file); mame_fclose(file);
@ -573,8 +573,8 @@ void memcard_eject(running_machine *machine)
} }
/* initialize and then load the card */ /* initialize and then load the card */
if (machine->config->memcard_handler) if (machine->config->m_memcard_handler)
(*machine->config->memcard_handler)(machine, file, MEMCARD_EJECT); (*machine->config->m_memcard_handler)(machine, file, MEMCARD_EJECT);
/* close the file */ /* close the file */
mame_fclose(file); mame_fclose(file);

View File

@ -1125,7 +1125,7 @@ static void configuration_save(running_machine *machine, int config_type, xml_da
return; return;
/* iterate over disc devices */ /* iterate over disc devices */
for (device = machine->devicelist.first(LASERDISC); device != NULL; device = device->typenext()) for (device = machine->m_devicelist.first(LASERDISC); device != NULL; device = device->typenext())
{ {
laserdisc_config *origconfig = (laserdisc_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config(); laserdisc_config *origconfig = (laserdisc_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config();
laserdisc_state *ld = get_safe_token(device); laserdisc_state *ld = get_safe_token(device);
@ -1215,7 +1215,7 @@ void laserdisc_overlay_enable(running_device *device, int enable)
VIDEO_UPDATE( laserdisc ) VIDEO_UPDATE( laserdisc )
{ {
running_device *laserdisc = screen->machine->devicelist.first(LASERDISC); running_device *laserdisc = screen->machine->m_devicelist.first(LASERDISC);
if (laserdisc != NULL) if (laserdisc != NULL)
{ {
const rectangle &visarea = screen->visible_area(); const rectangle &visarea = screen->visible_area();

View File

@ -186,7 +186,6 @@ static char giant_string_buffer[65536] = { 0 };
static int parse_ini_file(core_options *options, const char *name, int priority); static int parse_ini_file(core_options *options, const char *name, int priority);
static void init_machine(running_machine *machine);
static TIMER_CALLBACK( soft_reset ); static TIMER_CALLBACK( soft_reset );
static void saveload_init(running_machine *machine); static void saveload_init(running_machine *machine);
@ -248,9 +247,12 @@ int mame_execute(core_options *options)
options_revert(mame_options(), OPTION_PRIORITY_INI); options_revert(mame_options(), OPTION_PRIORITY_INI);
mame_parse_ini_files(mame_options(), driver); mame_parse_ini_files(mame_options(), driver);
} }
// create the machine configuration
const machine_config *config = global_alloc(machine_config(driver->machine_config));
/* create the machine structure and driver */ /* create the machine structure and driver */
machine = global_alloc(running_machine(driver)); machine = global_alloc(running_machine(*driver, *config));
mame = machine->mame_data; mame = machine->mame_data;
/* start in the "pre-init phase" */ /* start in the "pre-init phase" */
@ -277,7 +279,7 @@ int mame_execute(core_options *options)
} }
/* then finish setting up our local machine */ /* then finish setting up our local machine */
init_machine(machine); machine->start();
/* load the configuration settings and NVRAM */ /* load the configuration settings and NVRAM */
settingsloaded = config_load_settings(machine); settingsloaded = config_load_settings(machine);
@ -354,8 +356,9 @@ int mame_execute(core_options *options)
} }
exit_pending = mame->exit_pending; exit_pending = mame->exit_pending;
/* destroy the machine */ /* destroy the machine and the config */
global_free(machine); global_free(machine);
global_free(config);
/* reset the options */ /* reset the options */
mame_opts = NULL; mame_opts = NULL;
@ -1173,14 +1176,14 @@ void mame_parse_ini_files(core_options *options, const game_driver *driver)
parse_ini_file(options, "horizont", OPTION_PRIORITY_ORIENTATION_INI); parse_ini_file(options, "horizont", OPTION_PRIORITY_ORIENTATION_INI);
/* parse "vector.ini" for vector games */ /* parse "vector.ini" for vector games */
config = machine_config_alloc(driver->machine_config); config = global_alloc(machine_config(driver->machine_config));
for (const screen_device_config *devconfig = screen_first(*config); devconfig != NULL; devconfig = screen_next(devconfig)) for (const screen_device_config *devconfig = screen_first(*config); devconfig != NULL; devconfig = screen_next(devconfig))
if (devconfig->screen_type() == SCREEN_TYPE_VECTOR) if (devconfig->screen_type() == SCREEN_TYPE_VECTOR)
{ {
parse_ini_file(options, "vector", OPTION_PRIORITY_VECTOR_INI); parse_ini_file(options, "vector", OPTION_PRIORITY_VECTOR_INI);
break; break;
} }
machine_config_free(config); global_free(config);
/* next parse "source/<sourcefile>.ini"; if that doesn't exist, try <sourcefile>.ini */ /* next parse "source/<sourcefile>.ini"; if that doesn't exist, try <sourcefile>.ini */
astring sourcename; astring sourcename;
@ -1234,12 +1237,14 @@ static int parse_ini_file(core_options *options, const char *name, int priority)
object and initialize it based on options object and initialize it based on options
-------------------------------------------------*/ -------------------------------------------------*/
running_machine::running_machine(const game_driver *driver) running_machine::running_machine(const game_driver &driver, const machine_config &_config)
: devicelist(respool), : m_devicelist(respool),
scheduler(*this), scheduler(*this),
config(NULL), config(&_config),
m_config(_config),
firstcpu(NULL), firstcpu(NULL),
gamedrv(driver), gamedrv(&driver),
m_game(driver),
basename(NULL), basename(NULL),
primary_screen(NULL), primary_screen(NULL),
palette(NULL), palette(NULL),
@ -1280,15 +1285,14 @@ running_machine::running_machine(const game_driver *driver)
mame_data = auto_alloc_clear(this, mame_private); mame_data = auto_alloc_clear(this, mame_private);
/* initialize the driver-related variables in the machine */ /* initialize the driver-related variables in the machine */
basename = mame_strdup(driver->name); basename = mame_strdup(driver.name);
config = machine_config_alloc(driver->machine_config);
/* attach this machine to all the devices in the configuration */ /* attach this machine to all the devices in the configuration */
devicelist.import_config_list(config->devicelist, *this); m_devicelist.import_config_list(m_config.m_devicelist, *this);
/* allocate the driver data (after devices) */ /* allocate the driver data (after devices) */
if (config->driver_data_alloc != NULL) if (m_config.m_driver_data_alloc != NULL)
driver_data = (*config->driver_data_alloc)(*this); driver_data = (*m_config.m_driver_data_alloc)(*this);
/* find devices */ /* find devices */
firstcpu = cpu_first(this); firstcpu = cpu_first(this);
@ -1305,8 +1309,6 @@ running_machine::running_machine(const game_driver *driver)
{ {
if (driver_data != NULL) if (driver_data != NULL)
auto_free(this, driver_data); auto_free(this, driver_data);
if (config != NULL)
machine_config_free((machine_config *)config);
if (basename != NULL) if (basename != NULL)
osd_free(basename); osd_free(basename);
if (mame_data != NULL) if (mame_data != NULL)
@ -1323,8 +1325,6 @@ running_machine::~running_machine()
{ {
assert(this == global_machine); assert(this == global_machine);
if (config != NULL)
machine_config_free((machine_config *)config);
if (basename != NULL) if (basename != NULL)
osd_free(basename); osd_free(basename);
@ -1357,108 +1357,105 @@ const char *running_machine::describe_context()
/*------------------------------------------------- //-------------------------------------------------
init_machine - initialize the emulated machine // start - initialize the emulated machine
-------------------------------------------------*/ //-------------------------------------------------
static void init_machine(running_machine *machine) void running_machine::start()
{ {
mame_private *mame = machine->mame_data; // initialize basic can't-fail systems here
time_t newbase; fileio_init(this);
config_init(this);
input_init(this);
output_init(this);
state_init(this);
state_save_allow_registration(this, true);
palette_init(this);
render_init(this);
ui_init(this);
generic_machine_init(this);
generic_video_init(this);
generic_sound_init(this);
mame_data->rand_seed = 0x9d14abd7;
/* initialize basic can't-fail systems here */ // initialize the timers and allocate a soft_reset timer
fileio_init(machine); // this must be done before cpu_init so that CPU's can allocate timers
config_init(machine); timer_init(this);
input_init(machine); mame_data->soft_reset_timer = timer_alloc(this, soft_reset, NULL);
output_init(machine);
state_init(machine);
state_save_allow_registration(machine, TRUE);
palette_init(machine);
render_init(machine);
ui_init(machine);
generic_machine_init(machine);
generic_video_init(machine);
generic_sound_init(machine);
mame->rand_seed = 0x9d14abd7;
/* initialize the timers and allocate a soft_reset timer */ // init the osd layer
/* this must be done before cpu_init so that CPU's can allocate timers */ osd_init(this);
timer_init(machine);
mame->soft_reset_timer = timer_alloc(machine, soft_reset, NULL);
/* init the osd layer */ // initialize the base time (needed for doing record/playback)
osd_init(machine); time(&mame_data->base_time);
/* initialize the base time (needed for doing record/playback) */ // initialize the input system and input ports for the game
time(&mame->base_time); // this must be done before memory_init in order to allow specifying
// callbacks based on input port tags
/* initialize the input system and input ports for the game */ time_t newbase = input_port_init(this, m_game.ipt);
/* this must be done before memory_init in order to allow specifying */
/* callbacks based on input port tags */
newbase = input_port_init(machine, machine->gamedrv->ipt);
if (newbase != 0) if (newbase != 0)
mame->base_time = newbase; mame_data->base_time = newbase;
/* intialize UI input */ // intialize UI input
ui_input_init(machine); ui_input_init(this);
/* initialize the streams engine before the sound devices start */ // initialize the streams engine before the sound devices start
streams_init(machine); streams_init(this);
/* first load ROMs, then populate memory, and finally initialize CPUs */ // first load ROMs, then populate memory, and finally initialize CPUs
/* these operations must proceed in this order */ // these operations must proceed in this order
rom_init(machine); rom_init(this);
memory_init(machine); memory_init(this);
watchdog_init(machine); watchdog_init(this);
/* allocate the gfx elements prior to device initialization */ // allocate the gfx elements prior to device initialization
gfx_init(machine); gfx_init(this);
/* initialize natural keyboard support */ // initialize natural keyboard support
inputx_init(machine); inputx_init(this);
/* initialize image devices */ // initialize image devices
image_init(machine); image_init(this);
/* start up the devices */ // start up the devices
machine->devicelist.start_all(); m_devicelist.start_all();
/* finish image devices init process*/ // finish image devices init process
image_postdevice_init(machine); image_postdevice_init(this);
/* call the game driver's init function */ // call the game driver's init function
/* this is where decryption is done and memory maps are altered */ // this is where decryption is done and memory maps are altered
/* so this location in the init order is important */ // so this location in the init order is important
ui_set_startup_text(machine, "Initializing...", TRUE); ui_set_startup_text(this, "Initializing...", true);
if (machine->gamedrv->driver_init != NULL) if (m_game.driver_init != NULL)
(*machine->gamedrv->driver_init)(machine); (*m_game.driver_init)(this);
/* start the video and audio hardware */ // start the video and audio hardware
video_init(machine); video_init(this);
tilemap_init(machine); tilemap_init(this);
crosshair_init(machine); crosshair_init(this);
sound_init(machine); sound_init(this);
/* initialize the debugger */ // initialize the debugger
if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) if ((debug_flags & DEBUG_FLAG_ENABLED) != 0)
debugger_init(machine); debugger_init(this);
/* call the driver's _START callbacks */ // call the driver's _START callbacks
if (machine->config->machine_start != NULL) if (m_config.m_machine_start != NULL)
(*machine->config->machine_start)(machine); (*m_config.m_machine_start)(this);
if (machine->config->sound_start != NULL) if (m_config.m_sound_start != NULL)
(*machine->config->sound_start)(machine); (*m_config.m_sound_start)(this);
if (machine->config->video_start != NULL) if (m_config.m_video_start != NULL)
(*machine->config->video_start)(machine); (*m_config.m_video_start)(this);
/* initialize miscellaneous systems */ // initialize miscellaneous systems
saveload_init(machine); saveload_init(this);
if (options_get_bool(mame_options(), OPTION_CHEAT)) if (options_get_bool(mame_options(), OPTION_CHEAT))
cheat_init(machine); cheat_init(this);
/* disallow save state registrations starting here */ // disallow save state registrations starting here
state_save_allow_registration(machine, FALSE); state_save_allow_registration(this, false);
} }
@ -1482,12 +1479,12 @@ static TIMER_CALLBACK( soft_reset )
(*cb->func.reset)(machine); (*cb->func.reset)(machine);
/* run the driver's reset callbacks */ /* run the driver's reset callbacks */
if (machine->config->machine_reset != NULL) if (machine->config->m_machine_reset != NULL)
(*machine->config->machine_reset)(machine); (*machine->config->m_machine_reset)(machine);
if (machine->config->sound_reset != NULL) if (machine->config->m_sound_reset != NULL)
(*machine->config->sound_reset)(machine); (*machine->config->m_sound_reset)(machine);
if (machine->config->video_reset != NULL) if (machine->config->m_video_reset != NULL)
(*machine->config->video_reset)(machine); (*machine->config->m_video_reset)(machine);
/* now we're running */ /* now we're running */
mame->current_phase = MAME_PHASE_RUNNING; mame->current_phase = MAME_PHASE_RUNNING;

View File

@ -198,8 +198,7 @@ public:
/* this structure holds generic pointers that are commonly used */ /* this structure holds generic pointers that are commonly used */
typedef struct _generic_pointers generic_pointers; struct generic_pointers
struct _generic_pointers
{ {
generic_ptr nvram; /* generic NVRAM */ generic_ptr nvram; /* generic NVRAM */
UINT32 nvram_size; UINT32 nvram_size;
@ -223,23 +222,29 @@ class running_machine
DISABLE_COPYING(running_machine); DISABLE_COPYING(running_machine);
public: public:
running_machine(const game_driver *driver); running_machine(const game_driver &driver, const machine_config &config);
~running_machine(); ~running_machine();
void start();
inline device_t *device(const char *tag); inline device_t *device(const char *tag);
template<class T> inline T *device(const char *tag) { return downcast<T *>(device(tag)); } template<class T> inline T *device(const char *tag) { return downcast<T *>(device(tag)); }
inline const input_port_config *port(const char *tag); inline const input_port_config *port(const char *tag);
inline const region_info *region(const char *tag); inline const region_info *region(const char *tag);
// configuration helpers
UINT32 total_colors() const { return m_config.m_total_colors; }
const char *describe_context(); const char *describe_context();
resource_pool respool; // pool of resources for this machine resource_pool respool; // pool of resources for this machine
region_list regionlist; // list of memory regions region_list regionlist; // list of memory regions
device_list devicelist; // list of running devices device_list m_devicelist; // list of running devices
device_scheduler scheduler; // scheduler object device_scheduler scheduler; // scheduler object
/* configuration data */ /* configuration data */
const machine_config * config; /* points to the constructed machine_config */ const machine_config * config; /* points to the constructed machine_config */
const machine_config & m_config; /* points to the constructed machine_config */
ioport_list portlist; /* points to a list of input port configurations */ ioport_list portlist; /* points to a list of input port configurations */
/* CPU information */ /* CPU information */
@ -247,11 +252,12 @@ public:
/* game-related information */ /* game-related information */
const game_driver * gamedrv; /* points to the definition of the game machine */ const game_driver * gamedrv; /* points to the definition of the game machine */
const game_driver & m_game; /* points to the definition of the game machine */
char * basename; /* basename used for game-related paths */ char * basename; /* basename used for game-related paths */
/* video-related information */ /* video-related information */
gfx_element * gfx[MAX_GFX_ELEMENTS];/* array of pointers to graphic sets (chars, sprites) */ gfx_element * gfx[MAX_GFX_ELEMENTS];/* array of pointers to graphic sets (chars, sprites) */
screen_device * primary_screen; /* the primary screen device, or NULL if screenless */ screen_device * primary_screen; /* the primary screen device, or NULL if screenless */
palette_t * palette; /* global palette object */ palette_t * palette; /* global palette object */
/* palette-related information */ /* palette-related information */
@ -298,7 +304,7 @@ public:
void * driver_data; /* drivers can hang data off of here instead of using globals */ void * driver_data; /* drivers can hang data off of here instead of using globals */
private: private:
astring m_context; // context string astring m_context; // context string
}; };
@ -482,7 +488,7 @@ void mame_get_current_datetime(running_machine *machine, mame_system_time *systi
inline device_t *running_machine::device(const char *tag) inline device_t *running_machine::device(const char *tag)
{ {
return devicelist.find(tag); return m_devicelist.find(tag);
} }
inline const input_port_config *running_machine::port(const char *tag) inline const input_port_config *running_machine::port(const char *tag)

View File

@ -4,8 +4,36 @@
Machine configuration macros and functions. Machine configuration macros and functions.
Copyright Nicola Salmoria and the MAME Team. ****************************************************************************
Visit http://mamedev.org for licensing and usage restrictions.
Copyright Aaron Giles
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.
***************************************************************************/ ***************************************************************************/
@ -13,74 +41,65 @@
#include <ctype.h> #include <ctype.h>
/*************************************************************************** //**************************************************************************
FUNCTION PROTOTYPES // MACHINE CONFIGURATIONS
***************************************************************************/ //**************************************************************************
static void machine_config_detokenize(machine_config *config, const machine_config_token *tokens, const device_config *owner); //-------------------------------------------------
// machine_config - constructor
//-------------------------------------------------
machine_config::machine_config(const machine_config_token *tokens)
: m_driver_data_alloc(NULL),
/*************************************************************************** m_minimum_quantum(attotime_zero),
MACHINE CONFIGURATIONS m_perfect_cpu_quantum(NULL),
***************************************************************************/ m_watchdog_vblank_count(0),
m_watchdog_time(attotime_zero),
/*------------------------------------------------- m_machine_start(NULL),
machine_config_alloc - allocate a new m_machine_reset(NULL),
machine configuration and populate it using m_nvram_handler(NULL),
the supplied constructor m_memcard_handler(NULL),
-------------------------------------------------*/ m_video_attributes(0),
m_gfxdecodeinfo(NULL),
machine_config *machine_config_alloc(const machine_config_token *tokens) m_total_colors(0),
m_default_layout(NULL),
m_init_palette(NULL),
m_video_start(NULL),
m_video_reset(NULL),
m_video_eof(NULL),
m_video_update(NULL),
m_sound_start(NULL),
m_sound_reset(NULL),
m_parse_level(0)
{ {
machine_config *config; // parse tokens into the config
detokenize(tokens);
/* allocate a new configuration object */
config = global_alloc_clear(machine_config);
/* parse tokens into the config */
machine_config_detokenize(config, tokens, NULL);
/* process any device-specific machine configurations */
for (const device_config *device = config->devicelist.first(); device != NULL; device = device->next())
{
tokens = device->machine_config_tokens();
if (tokens != NULL)
machine_config_detokenize(config, tokens, device);
}
// then notify all devices that their configuration is complete
for (device_config *device = config->devicelist.first(); device != NULL; device = device->next())
device->config_complete();
return config;
} }
/*------------------------------------------------- //-------------------------------------------------
machine_config_free - release memory allocated // ~machine_config - destructor
for a machine configuration //-------------------------------------------------
-------------------------------------------------*/
void machine_config_free(machine_config *config) machine_config::~machine_config()
{ {
/* release the configuration itself */
global_free(config);
} }
/*------------------------------------------------- //-------------------------------------------------
machine_config_detokenize - detokenize a // detokenize - detokenize a machine config
machine config //-------------------------------------------------
-------------------------------------------------*/
static void machine_config_detokenize(machine_config *config, const machine_config_token *tokens, const device_config *owner) void machine_config::detokenize(const machine_config_token *tokens, const device_config *owner)
{ {
UINT32 entrytype = MCONFIG_TOKEN_INVALID;
device_config *device = NULL; device_config *device = NULL;
astring tempstring; astring tempstring;
// increase the parse level
m_parse_level++;
/* loop over tokens until we hit the end */ // loop over tokens until we hit the end
UINT32 entrytype = MCONFIG_TOKEN_INVALID;
while (entrytype != MCONFIG_TOKEN_END) while (entrytype != MCONFIG_TOKEN_END)
{ {
device_type devtype; device_type devtype;
@ -88,26 +107,26 @@ static void machine_config_detokenize(machine_config *config, const machine_conf
UINT64 data64; UINT64 data64;
UINT32 clock; UINT32 clock;
/* unpack the token from the first entry */ // unpack the token from the first entry
TOKEN_GET_UINT32_UNPACK1(tokens, entrytype, 8); TOKEN_GET_UINT32_UNPACK1(tokens, entrytype, 8);
switch (entrytype) switch (entrytype)
{ {
/* end */ // end
case MCONFIG_TOKEN_END: case MCONFIG_TOKEN_END:
break; break;
/* including */ // including
case MCONFIG_TOKEN_INCLUDE: case MCONFIG_TOKEN_INCLUDE:
machine_config_detokenize(config, TOKEN_GET_PTR(tokens, tokenptr), owner); detokenize(TOKEN_GET_PTR(tokens, tokenptr), owner);
break; break;
/* device management */ // device management
case MCONFIG_TOKEN_DEVICE_ADD: case MCONFIG_TOKEN_DEVICE_ADD:
TOKEN_UNGET_UINT32(tokens); TOKEN_UNGET_UINT32(tokens);
TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, clock, 32); TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, clock, 32);
devtype = TOKEN_GET_PTR(tokens, devtype); devtype = TOKEN_GET_PTR(tokens, devtype);
tag = owner->subtag(tempstring, TOKEN_GET_STRING(tokens)); tag = owner->subtag(tempstring, TOKEN_GET_STRING(tokens));
device = config->devicelist.append(tag, (*devtype)(*config, tag, owner, clock)); device = m_devicelist.append(tag, (*devtype)(*this, tag, owner, clock));
break; break;
case MCONFIG_TOKEN_DEVICE_REPLACE: case MCONFIG_TOKEN_DEVICE_REPLACE:
@ -115,18 +134,18 @@ static void machine_config_detokenize(machine_config *config, const machine_conf
TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, clock, 32); TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, clock, 32);
devtype = TOKEN_GET_PTR(tokens, devtype); devtype = TOKEN_GET_PTR(tokens, devtype);
tag = owner->subtag(tempstring, TOKEN_GET_STRING(tokens)); tag = owner->subtag(tempstring, TOKEN_GET_STRING(tokens));
device = config->devicelist.replace(tag, (*devtype)(*config, tag, owner, clock)); device = m_devicelist.replace(tag, (*devtype)(*this, tag, owner, clock));
break; break;
case MCONFIG_TOKEN_DEVICE_REMOVE: case MCONFIG_TOKEN_DEVICE_REMOVE:
tag = TOKEN_GET_STRING(tokens); tag = TOKEN_GET_STRING(tokens);
config->devicelist.remove(owner->subtag(tempstring, tag)); m_devicelist.remove(owner->subtag(tempstring, tag));
device = NULL; device = NULL;
break; break;
case MCONFIG_TOKEN_DEVICE_MODIFY: case MCONFIG_TOKEN_DEVICE_MODIFY:
tag = TOKEN_GET_STRING(tokens); tag = TOKEN_GET_STRING(tokens);
device = config->devicelist.find(owner->subtag(tempstring, tag)); device = m_devicelist.find(owner->subtag(tempstring, tag));
if (device == NULL) if (device == NULL)
fatalerror("Unable to find device: tag=%s\n", tempstring.cstr()); fatalerror("Unable to find device: tag=%s\n", tempstring.cstr());
break; break;
@ -164,94 +183,94 @@ static void machine_config_detokenize(machine_config *config, const machine_conf
break; break;
/* core parameters */ // core parameters
case MCONFIG_TOKEN_DRIVER_DATA: case MCONFIG_TOKEN_DRIVER_DATA:
config->driver_data_alloc = TOKEN_GET_PTR(tokens, driver_data_alloc); m_driver_data_alloc = TOKEN_GET_PTR(tokens, driver_data_alloc);
break; break;
case MCONFIG_TOKEN_QUANTUM_TIME: case MCONFIG_TOKEN_QUANTUM_TIME:
TOKEN_EXTRACT_UINT64(tokens, data64); TOKEN_EXTRACT_UINT64(tokens, data64);
config->minimum_quantum = UINT64_ATTOTIME_TO_ATTOTIME(data64); m_minimum_quantum = UINT64_ATTOTIME_TO_ATTOTIME(data64);
break; break;
case MCONFIG_TOKEN_QUANTUM_PERFECT_CPU: case MCONFIG_TOKEN_QUANTUM_PERFECT_CPU:
config->perfect_cpu_quantum = TOKEN_GET_STRING(tokens); m_perfect_cpu_quantum = TOKEN_GET_STRING(tokens);
break; break;
case MCONFIG_TOKEN_WATCHDOG_VBLANK: case MCONFIG_TOKEN_WATCHDOG_VBLANK:
TOKEN_UNGET_UINT32(tokens); TOKEN_UNGET_UINT32(tokens);
TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, config->watchdog_vblank_count, 24); TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, m_watchdog_vblank_count, 24);
break; break;
case MCONFIG_TOKEN_WATCHDOG_TIME: case MCONFIG_TOKEN_WATCHDOG_TIME:
TOKEN_EXTRACT_UINT64(tokens, data64); TOKEN_EXTRACT_UINT64(tokens, data64);
config->watchdog_time = UINT64_ATTOTIME_TO_ATTOTIME(data64); m_watchdog_time = UINT64_ATTOTIME_TO_ATTOTIME(data64);
break; break;
/* core functions */ // core functions
case MCONFIG_TOKEN_MACHINE_START: case MCONFIG_TOKEN_MACHINE_START:
config->machine_start = TOKEN_GET_PTR(tokens, machine_start); m_machine_start = TOKEN_GET_PTR(tokens, machine_start);
break; break;
case MCONFIG_TOKEN_MACHINE_RESET: case MCONFIG_TOKEN_MACHINE_RESET:
config->machine_reset = TOKEN_GET_PTR(tokens, machine_reset); m_machine_reset = TOKEN_GET_PTR(tokens, machine_reset);
break; break;
case MCONFIG_TOKEN_NVRAM_HANDLER: case MCONFIG_TOKEN_NVRAM_HANDLER:
config->nvram_handler = TOKEN_GET_PTR(tokens, nvram_handler); m_nvram_handler = TOKEN_GET_PTR(tokens, nvram_handler);
break; break;
case MCONFIG_TOKEN_MEMCARD_HANDLER: case MCONFIG_TOKEN_MEMCARD_HANDLER:
config->memcard_handler = TOKEN_GET_PTR(tokens, memcard_handler); m_memcard_handler = TOKEN_GET_PTR(tokens, memcard_handler);
break; break;
/* core video parameters */ // core video parameters
case MCONFIG_TOKEN_VIDEO_ATTRIBUTES: case MCONFIG_TOKEN_VIDEO_ATTRIBUTES:
TOKEN_UNGET_UINT32(tokens); TOKEN_UNGET_UINT32(tokens);
TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, config->video_attributes, 24); TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, m_video_attributes, 24);
break; break;
case MCONFIG_TOKEN_GFXDECODE: case MCONFIG_TOKEN_GFXDECODE:
config->gfxdecodeinfo = TOKEN_GET_PTR(tokens, gfxdecode); m_gfxdecodeinfo = TOKEN_GET_PTR(tokens, gfxdecode);
break; break;
case MCONFIG_TOKEN_PALETTE_LENGTH: case MCONFIG_TOKEN_PALETTE_LENGTH:
TOKEN_UNGET_UINT32(tokens); TOKEN_UNGET_UINT32(tokens);
TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, config->total_colors, 24); TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, m_total_colors, 24);
break; break;
case MCONFIG_TOKEN_DEFAULT_LAYOUT: case MCONFIG_TOKEN_DEFAULT_LAYOUT:
config->default_layout = TOKEN_GET_STRING(tokens); m_default_layout = TOKEN_GET_STRING(tokens);
break; break;
/* core video functions */ // core video functions
case MCONFIG_TOKEN_PALETTE_INIT: case MCONFIG_TOKEN_PALETTE_INIT:
config->init_palette = TOKEN_GET_PTR(tokens, palette_init); m_init_palette = TOKEN_GET_PTR(tokens, palette_init);
break; break;
case MCONFIG_TOKEN_VIDEO_START: case MCONFIG_TOKEN_VIDEO_START:
config->video_start = TOKEN_GET_PTR(tokens, video_start); m_video_start = TOKEN_GET_PTR(tokens, video_start);
break; break;
case MCONFIG_TOKEN_VIDEO_RESET: case MCONFIG_TOKEN_VIDEO_RESET:
config->video_reset = TOKEN_GET_PTR(tokens, video_reset); m_video_reset = TOKEN_GET_PTR(tokens, video_reset);
break; break;
case MCONFIG_TOKEN_VIDEO_EOF: case MCONFIG_TOKEN_VIDEO_EOF:
config->video_eof = TOKEN_GET_PTR(tokens, video_eof); m_video_eof = TOKEN_GET_PTR(tokens, video_eof);
break; break;
case MCONFIG_TOKEN_VIDEO_UPDATE: case MCONFIG_TOKEN_VIDEO_UPDATE:
config->video_update = TOKEN_GET_PTR(tokens, video_update); m_video_update = TOKEN_GET_PTR(tokens, video_update);
break; break;
/* core sound functions */ // core sound functions
case MCONFIG_TOKEN_SOUND_START: case MCONFIG_TOKEN_SOUND_START:
config->sound_start = TOKEN_GET_PTR(tokens, sound_start); m_sound_start = TOKEN_GET_PTR(tokens, sound_start);
break; break;
case MCONFIG_TOKEN_SOUND_RESET: case MCONFIG_TOKEN_SOUND_RESET:
config->sound_reset = TOKEN_GET_PTR(tokens, sound_reset); m_sound_reset = TOKEN_GET_PTR(tokens, sound_reset);
break; break;
default: default:
@ -259,4 +278,28 @@ static void machine_config_detokenize(machine_config *config, const machine_conf
break; break;
} }
} }
// if we started at parse level 0 (and are thus at level 1), do post-processing
if (m_parse_level == 1)
{
// process any device-specific machine configurations
for (const device_config *devconfig = m_devicelist.first(); devconfig != NULL; devconfig = devconfig->next())
if (!devconfig->m_config_complete)
{
tokens = devconfig->machine_config_tokens();
if (tokens != NULL)
detokenize(tokens, devconfig);
}
// then notify all devices that their configuration is complete
for (device_config *devconfig = m_devicelist.first(); devconfig != NULL; devconfig = devconfig->next())
if (!devconfig->m_config_complete)
{
devconfig->config_complete();
devconfig->m_config_complete = true;
}
}
// bump down the parse level
m_parse_level--;
} }

View File

@ -4,8 +4,36 @@
Machine configuration macros and functions. Machine configuration macros and functions.
Copyright Nicola Salmoria and the MAME Team. ****************************************************************************
Visit http://mamedev.org for licensing and usage restrictions.
Copyright Aaron Giles
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.
***************************************************************************/ ***************************************************************************/
@ -64,7 +92,7 @@
#define VIDEO_UPDATE_CALL(name) VIDEO_UPDATE_NAME(name)(screen, bitmap, cliprect) #define VIDEO_UPDATE_CALL(name) VIDEO_UPDATE_NAME(name)(screen, bitmap, cliprect)
/* NULL versions */ // NULL versions
#define nvram_handler_0 NULL #define nvram_handler_0 NULL
#define memcard_handler_0 NULL #define memcard_handler_0 NULL
#define machine_start_0 NULL #define machine_start_0 NULL
@ -97,12 +125,12 @@ typedef void * (*driver_data_alloc_func)(running_machine &machine);
CONSTANTS CONSTANTS
***************************************************************************/ ***************************************************************************/
/* by convention, tags should all lowercase and between 2-15 characters */ // by convention, tags should all lowercase and between 2-15 characters
#define MIN_TAG_LENGTH 2 #define MIN_TAG_LENGTH 2
#define MAX_TAG_LENGTH 15 #define MAX_TAG_LENGTH 15
/* token types */ // token types
enum enum
{ {
MCONFIG_TOKEN_INVALID, MCONFIG_TOKEN_INVALID,
@ -176,28 +204,28 @@ enum
}; };
/* ----- flags for video_attributes ----- */ // ----- flags for video_attributes -----
/* should VIDEO_UPDATE by called at the start of VBLANK or at the end? */ // should VIDEO_UPDATE by called at the start of VBLANK or at the end?
#define VIDEO_UPDATE_BEFORE_VBLANK 0x0000 #define VIDEO_UPDATE_BEFORE_VBLANK 0x0000
#define VIDEO_UPDATE_AFTER_VBLANK 0x0004 #define VIDEO_UPDATE_AFTER_VBLANK 0x0004
/* indicates VIDEO_UPDATE will add container bits its */ // indicates VIDEO_UPDATE will add container bits its
#define VIDEO_SELF_RENDER 0x0008 #define VIDEO_SELF_RENDER 0x0008
/* automatically extend the palette creating a darker copy for shadows */ // automatically extend the palette creating a darker copy for shadows
#define VIDEO_HAS_SHADOWS 0x0010 #define VIDEO_HAS_SHADOWS 0x0010
/* automatically extend the palette creating a brighter copy for highlights */ // automatically extend the palette creating a brighter copy for highlights
#define VIDEO_HAS_HIGHLIGHTS 0x0020 #define VIDEO_HAS_HIGHLIGHTS 0x0020
/* Mish 181099: See comments in video/generic.c for details */ // Mish 181099: See comments in video/generic.c for details
#define VIDEO_BUFFERS_SPRITERAM 0x0040 #define VIDEO_BUFFERS_SPRITERAM 0x0040
/* force VIDEO_UPDATE to be called even for skipped frames */ // force VIDEO_UPDATE to be called even for skipped frames
#define VIDEO_ALWAYS_UPDATE 0x0080 #define VIDEO_ALWAYS_UPDATE 0x0080
/* calls VIDEO_UPDATE for every visible scanline, even for skipped frames */ // calls VIDEO_UPDATE for every visible scanline, even for skipped frames
#define VIDEO_UPDATE_SCANLINE 0x0100 #define VIDEO_UPDATE_SCANLINE 0x0100
@ -212,35 +240,47 @@ struct gfx_decode_entry;
class machine_config class machine_config
{ {
DISABLE_COPYING(machine_config);
friend class running_machine;
public: public:
driver_data_alloc_func driver_data_alloc; /* allocator for driver data */ machine_config(const machine_config_token *tokens);
~machine_config();
void detokenize(const machine_config_token *tokens, const device_config *owner = NULL);
attotime minimum_quantum; /* minimum scheduling quantum */ driver_data_alloc_func m_driver_data_alloc; // allocator for driver data
const char * perfect_cpu_quantum; /* tag of CPU to use for "perfect" scheduling */
INT32 watchdog_vblank_count; /* number of VBLANKs until the watchdog kills us */
attotime watchdog_time; /* length of time until the watchdog kills us */
machine_start_func machine_start; /* one-time machine start callback */ attotime m_minimum_quantum; // minimum scheduling quantum
machine_reset_func machine_reset; /* machine reset callback */ const char * m_perfect_cpu_quantum; // tag of CPU to use for "perfect" scheduling
INT32 m_watchdog_vblank_count; // number of VBLANKs until the watchdog kills us
attotime m_watchdog_time; // length of time until the watchdog kills us
nvram_handler_func nvram_handler; /* NVRAM save/load callback */ machine_start_func m_machine_start; // one-time machine start callback
memcard_handler_func memcard_handler; /* memory card save/load callback */ machine_reset_func m_machine_reset; // machine reset callback
UINT32 video_attributes; /* flags describing the video system */ nvram_handler_func m_nvram_handler; // NVRAM save/load callback
const gfx_decode_entry *gfxdecodeinfo; /* pointer to array of graphics decoding information */ memcard_handler_func m_memcard_handler; // memory card save/load callback
UINT32 total_colors; /* total number of colors in the palette */
const char * default_layout; /* default layout for this machine */
palette_init_func init_palette; /* one-time palette init callback */ UINT32 m_video_attributes; // flags describing the video system
video_start_func video_start; /* one-time video start callback */ const gfx_decode_entry *m_gfxdecodeinfo; // pointer to array of graphics decoding information
video_reset_func video_reset; /* video reset callback */ UINT32 m_total_colors; // total number of colors in the palette
video_eof_func video_eof; /* end-of-frame video callback */ const char * m_default_layout; // default layout for this machine
video_update_func video_update; /* video update callback */
sound_start_func sound_start; /* one-time sound start callback */ palette_init_func m_init_palette; // one-time palette init callback
sound_reset_func sound_reset; /* sound reset callback */ video_start_func m_video_start; // one-time video start callback
video_reset_func m_video_reset; // video reset callback
video_eof_func m_video_eof; // end-of-frame video callback
video_update_func m_video_update; // video update callback
device_config_list devicelist; /* list of device configs */ sound_start_func m_sound_start; // one-time sound start callback
sound_reset_func m_sound_reset; // sound reset callback
device_config_list m_devicelist; // list of device configs
private:
int m_parse_level; // nested parsing level
}; };
@ -249,7 +289,7 @@ public:
MACROS FOR BUILDING MACHINE DRIVERS MACROS FOR BUILDING MACHINE DRIVERS
***************************************************************************/ ***************************************************************************/
/* this type is used to encode machine configuration definitions */ // this type is used to encode machine configuration definitions
union machine_config_token union machine_config_token
{ {
TOKEN_COMMON_FIELDS TOKEN_COMMON_FIELDS
@ -274,7 +314,7 @@ union machine_config_token
}; };
/* helper macro for returning the size of a field within a struct; similar to offsetof() */ // helper macro for returning the size of a field within a struct; similar to offsetof()
#define structsizeof(_struct, _field) sizeof(((_struct *)NULL)->_field) #define structsizeof(_struct, _field) sizeof(((_struct *)NULL)->_field)
#define DEVCONFIG_OFFSETOF(_class, _member) \ #define DEVCONFIG_OFFSETOF(_class, _member) \
@ -284,7 +324,7 @@ union machine_config_token
sizeof(reinterpret_cast<_class *>(NULL)->_member) sizeof(reinterpret_cast<_class *>(NULL)->_member)
/* start/end tags for the machine driver */ // start/end tags for the machine driver
#define MACHINE_DRIVER_NAME(_name) \ #define MACHINE_DRIVER_NAME(_name) \
machine_config_##_name machine_config_##_name
@ -294,21 +334,21 @@ union machine_config_token
#define MACHINE_DRIVER_END \ #define MACHINE_DRIVER_END \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_END, 8) }; TOKEN_UINT32_PACK1(MCONFIG_TOKEN_END, 8) };
/* use this to declare external references to a machine driver */ // use this to declare external references to a machine driver
#define MACHINE_DRIVER_EXTERN(_name) \ #define MACHINE_DRIVER_EXTERN(_name) \
extern const machine_config_token MACHINE_DRIVER_NAME(_name)[] extern const machine_config_token MACHINE_DRIVER_NAME(_name)[]
/* importing data from other machine drivers */ // importing data from other machine drivers
#define MDRV_IMPORT_FROM(_name) \ #define MDRV_IMPORT_FROM(_name) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_INCLUDE, 8), \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_INCLUDE, 8), \
TOKEN_PTR(tokenptr, MACHINE_DRIVER_NAME(_name)), TOKEN_PTR(tokenptr, MACHINE_DRIVER_NAME(_name)),
/* core parameters */ // core parameters
#define MDRV_DRIVER_DATA(_class) \ #define MDRV_DRIVER_DATA(_class) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DRIVER_DATA, 8), \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DRIVER_DATA, 8), \
TOKEN_PTR(driver_data_alloc, _class::alloc), TOKEN_PTR(m_driver_data_alloc, _class::alloc),
#define MDRV_QUANTUM_TIME(_time) \ #define MDRV_QUANTUM_TIME(_time) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_QUANTUM_TIME, 8), \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_QUANTUM_TIME, 8), \
@ -326,7 +366,7 @@ union machine_config_token
TOKEN_UINT64(UINT64_ATTOTIME_IN_##_time), TOKEN_UINT64(UINT64_ATTOTIME_IN_##_time),
/* core functions */ // core functions
#define MDRV_MACHINE_START(_func) \ #define MDRV_MACHINE_START(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MACHINE_START, 8), \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MACHINE_START, 8), \
TOKEN_PTR(machine_start, MACHINE_START_NAME(_func)), TOKEN_PTR(machine_start, MACHINE_START_NAME(_func)),
@ -344,7 +384,7 @@ union machine_config_token
TOKEN_PTR(memcard_handler, MEMCARD_HANDLER_NAME(_func)), TOKEN_PTR(memcard_handler, MEMCARD_HANDLER_NAME(_func)),
/* core video parameters */ // core video parameters
#define MDRV_VIDEO_ATTRIBUTES(_flags) \ #define MDRV_VIDEO_ATTRIBUTES(_flags) \
TOKEN_UINT32_PACK2(MCONFIG_TOKEN_VIDEO_ATTRIBUTES, 8, _flags, 24), TOKEN_UINT32_PACK2(MCONFIG_TOKEN_VIDEO_ATTRIBUTES, 8, _flags, 24),
@ -360,7 +400,7 @@ union machine_config_token
TOKEN_STRING(&(_layout)[0]), TOKEN_STRING(&(_layout)[0]),
/* core video functions */ // core video functions
#define MDRV_PALETTE_INIT(_func) \ #define MDRV_PALETTE_INIT(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_PALETTE_INIT, 8), \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_PALETTE_INIT, 8), \
TOKEN_PTR(palette_init, PALETTE_INIT_NAME(_func)), TOKEN_PTR(palette_init, PALETTE_INIT_NAME(_func)),
@ -382,17 +422,17 @@ union machine_config_token
TOKEN_PTR(video_update, VIDEO_UPDATE_NAME(_func)), TOKEN_PTR(video_update, VIDEO_UPDATE_NAME(_func)),
/* core sound functions */ // core sound functions
#define MDRV_SOUND_START(_func) \ #define MDRV_SOUND_START(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_START, 8), \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_START, 8), \
TOKEN_PTR(sound_start, SOUND_START_NAME(_func)), TOKEN_PTR(sound_start, SOUND_START_NAME(_func)),
#define MDRV_SOUND_RESET(_func) \ #define MDRV_SOUND_RESET(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_RESET, 8), \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_RESET, 8), \
TOKEN_PTR(sound_start, SOUND_RESET_NAME(_func)), TOKEN_PTR(sound_reset, SOUND_RESET_NAME(_func)),
/* add/remove devices */ // add/remove devices
#define MDRV_DEVICE_ADD(_tag, _type, _clock) \ #define MDRV_DEVICE_ADD(_tag, _type, _clock) \
TOKEN_UINT64_PACK2(MCONFIG_TOKEN_DEVICE_ADD, 8, _clock, 32), \ TOKEN_UINT64_PACK2(MCONFIG_TOKEN_DEVICE_ADD, 8, _clock, 32), \
TOKEN_PTR(devtype, _type), \ TOKEN_PTR(devtype, _type), \
@ -412,19 +452,4 @@ union machine_config_token
TOKEN_STRING(_tag), TOKEN_STRING(_tag),
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
/* ----- machine configurations ----- */
/* allocate a new machine configuration and populate it using the supplied constructor */
machine_config *machine_config_alloc(const machine_config_token *tokens);
/* release memory allocated for a machine configuration */
void machine_config_free(machine_config *config);
#endif /* __MCONFIG_H__ */ #endif /* __MCONFIG_H__ */

View File

@ -1691,7 +1691,7 @@ static void memory_init_spaces(running_machine *machine)
/* loop over devices */ /* loop over devices */
device_memory_interface *memory = NULL; device_memory_interface *memory = NULL;
for (bool gotone = machine->devicelist.first(memory); gotone; gotone = memory->next(memory)) for (bool gotone = machine->m_devicelist.first(memory); gotone; gotone = memory->next(memory))
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++) for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{ {
const address_space_config *spaceconfig = memory->space_config(spacenum); const address_space_config *spaceconfig = memory->space_config(spacenum);

View File

@ -186,7 +186,7 @@ astring &_profiler_get_text(running_machine *machine, astring &string)
/* and then the text */ /* and then the text */
if (curtype >= PROFILER_DEVICE_FIRST && curtype <= PROFILER_DEVICE_MAX) if (curtype >= PROFILER_DEVICE_FIRST && curtype <= PROFILER_DEVICE_MAX)
string.catprintf("'%s'", machine->devicelist.find(curtype - PROFILER_DEVICE_FIRST)->tag()); string.catprintf("'%s'", machine->m_devicelist.find(curtype - PROFILER_DEVICE_FIRST)->tag());
else else
for (nameindex = 0; nameindex < ARRAY_LENGTH(names); nameindex++) for (nameindex = 0; nameindex < ARRAY_LENGTH(names); nameindex++)
if (names[nameindex].type == curtype) if (names[nameindex].type == curtype)

View File

@ -964,7 +964,7 @@ int render_is_live_screen(device_t *screen)
assert(screen->machine != NULL); assert(screen->machine != NULL);
assert(screen->machine->config != NULL); assert(screen->machine->config != NULL);
screen_index = screen->machine->devicelist.index(SCREEN, screen->tag()); screen_index = screen->machine->m_devicelist.index(SCREEN, screen->tag());
assert(screen_index != -1); assert(screen_index != -1);
@ -1467,8 +1467,8 @@ void render_target_get_minimum_size(render_target *target, INT32 *minwidth, INT3
for (item = target->curview->itemlist[layer]; item != NULL; item = item->next) for (item = target->curview->itemlist[layer]; item != NULL; item = item->next)
if (item->element == NULL) if (item->element == NULL)
{ {
const screen_device_config *scrconfig = downcast<const screen_device_config *>(target->machine->config->devicelist.find(SCREEN, item->index)); const screen_device_config *scrconfig = downcast<const screen_device_config *>(target->machine->config->m_devicelist.find(SCREEN, item->index));
screen_device *screendev = downcast<screen_device *>(target->machine->devicelist.find(scrconfig->tag())); screen_device *screendev = downcast<screen_device *>(target->machine->m_devicelist.find(scrconfig->tag()));
const rectangle vectorvis = { 0, 639, 0, 479 }; const rectangle vectorvis = { 0, 639, 0, 479 };
const rectangle *visarea = NULL; const rectangle *visarea = NULL;
render_container *container = get_screen_container_by_index(item->index); render_container *container = get_screen_container_by_index(item->index);
@ -1831,9 +1831,9 @@ static int load_layout_files(render_target *target, const char *layoutfile, int
if (*nextfile != NULL) if (*nextfile != NULL)
nextfile = &(*nextfile)->next; nextfile = &(*nextfile)->next;
} }
if (config->default_layout != NULL) if (config->m_default_layout != NULL)
{ {
*nextfile = layout_file_load(config, NULL, config->default_layout); *nextfile = layout_file_load(config, NULL, config->m_default_layout);
if (*nextfile != NULL) if (*nextfile != NULL)
nextfile = &(*nextfile)->next; nextfile = &(*nextfile)->next;
} }

View File

@ -1342,7 +1342,7 @@ static int get_variable_value(const machine_config *config, const char *string,
/* screen 0 parameters */ /* screen 0 parameters */
for (devconfig = screen_first(*config); devconfig != NULL; devconfig = screen_next(devconfig)) for (devconfig = screen_first(*config); devconfig != NULL; devconfig = screen_next(devconfig))
{ {
int scrnum = config->devicelist.index(SCREEN, devconfig->tag()); int scrnum = config->m_devicelist.index(SCREEN, devconfig->tag());
/* native X aspect factor */ /* native X aspect factor */
sprintf(temp, "~scr%dnativexaspect~", scrnum); sprintf(temp, "~scr%dnativexaspect~", scrnum);

View File

@ -164,7 +164,7 @@ const rom_source *rom_first_source(const game_driver *drv, const machine_config
/* otherwise, look through devices */ /* otherwise, look through devices */
if (config != NULL) if (config != NULL)
for (devconfig = config->devicelist.first(); devconfig != NULL; devconfig = devconfig->next()) for (devconfig = config->m_devicelist.first(); devconfig != NULL; devconfig = devconfig->next())
{ {
const rom_entry *devromp = devconfig->rom_region(); const rom_entry *devromp = devconfig->rom_region();
if (devromp != NULL) if (devromp != NULL)
@ -185,7 +185,7 @@ const rom_source *rom_next_source(const game_driver *drv, const machine_config *
/* if the previous was the driver, we want the first device */ /* if the previous was the driver, we want the first device */
if (rom_source_is_gamedrv(drv, previous)) if (rom_source_is_gamedrv(drv, previous))
devconfig = (config != NULL) ? config->devicelist.first() : NULL; devconfig = (config != NULL) ? config->m_devicelist.first() : NULL;
else else
devconfig = ((const device_config *)previous)->next(); devconfig = ((const device_config *)previous)->next();

View File

@ -373,22 +373,22 @@ void device_scheduler::rebuild_execute_list()
if (!m_quantum_set) if (!m_quantum_set)
{ {
// set the core scheduling quantum // set the core scheduling quantum
attotime min_quantum = m_machine.config->minimum_quantum; attotime min_quantum = m_machine.config->m_minimum_quantum;
// if none specified default to 60Hz // if none specified default to 60Hz
if (attotime_compare(min_quantum, attotime_zero) == 0) if (attotime_compare(min_quantum, attotime_zero) == 0)
min_quantum = ATTOTIME_IN_HZ(60); min_quantum = ATTOTIME_IN_HZ(60);
// if the configuration specifies a device to make perfect, pick that as the minimum // if the configuration specifies a device to make perfect, pick that as the minimum
if (m_machine.config->perfect_cpu_quantum != NULL) if (m_machine.config->m_perfect_cpu_quantum != NULL)
{ {
device_t *device = m_machine.device(m_machine.config->perfect_cpu_quantum); device_t *device = m_machine.device(m_machine.config->m_perfect_cpu_quantum);
if (device == NULL) if (device == NULL)
fatalerror("Device '%s' specified for perfect interleave is not present!", m_machine.config->perfect_cpu_quantum); fatalerror("Device '%s' specified for perfect interleave is not present!", m_machine.config->m_perfect_cpu_quantum);
device_execute_interface *exec; device_execute_interface *exec;
if (!device->interface(exec)) if (!device->interface(exec))
fatalerror("Device '%s' specified for perfect interleave is not an executing device!", m_machine.config->perfect_cpu_quantum); fatalerror("Device '%s' specified for perfect interleave is not an executing device!", m_machine.config->m_perfect_cpu_quantum);
attotime cpu_quantum = attotime_make(0, exec->minimum_quantum()); attotime cpu_quantum = attotime_make(0, exec->minimum_quantum());
min_quantum = attotime_min(cpu_quantum, min_quantum); min_quantum = attotime_min(cpu_quantum, min_quantum);
@ -411,7 +411,7 @@ if (TEMPLOG) printf("Setting quantum: %08X%08X\n", (UINT32)(min_quantum.attoseco
// iterate over all devices // iterate over all devices
device_execute_interface *exec = NULL; device_execute_interface *exec = NULL;
for (bool gotone = m_machine.devicelist.first(exec); gotone; gotone = exec->next(exec)) for (bool gotone = m_machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec))
{ {
// append to the appropriate list // append to the appropriate list
exec->m_nextexec = NULL; exec->m_nextexec = NULL;

View File

@ -1373,7 +1373,7 @@ void ui_mess_menu_software_list(running_machine *machine, ui_menu *menu, void *p
software_entry_state *entry = (software_entry_state *) event->itemref; software_entry_state *entry = (software_entry_state *) event->itemref;
/* search for a device with the right interface */ /* search for a device with the right interface */
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
const char *interface = image->image_config().image_interface(); const char *interface = image->image_config().image_interface();
@ -1397,7 +1397,7 @@ void ui_mess_menu_software_list(running_machine *machine, ui_menu *menu, void *p
/* list of available software lists - i.e. cartridges, floppies */ /* list of available software lists - i.e. cartridges, floppies */
static void ui_mess_menu_populate_software_list(running_machine *machine, ui_menu *menu) static void ui_mess_menu_populate_software_list(running_machine *machine, ui_menu *menu)
{ {
for (const device_config *dev = machine->config->devicelist.first(); dev != NULL; dev = dev->next()) for (const device_config *dev = machine->config->m_devicelist.first(); dev != NULL; dev = dev->next())
{ {
if (!strcmp(dev->tag(), __SOFTWARE_LIST_TAG)) if (!strcmp(dev->tag(), __SOFTWARE_LIST_TAG))
{ {

View File

@ -190,7 +190,7 @@ static void route_sound(running_machine *machine)
{ {
/* iterate again over all the sound chips */ /* iterate again over all the sound chips */
device_sound_interface *sound = NULL; device_sound_interface *sound = NULL;
for (bool gotone = machine->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
{ {
int numoutputs = stream_get_device_outputs(*sound); int numoutputs = stream_get_device_outputs(*sound);
@ -233,7 +233,7 @@ static void sound_reset(running_machine *machine)
device_sound_interface *sound = NULL; device_sound_interface *sound = NULL;
/* reset all the sound chips */ /* reset all the sound chips */
for (bool gotone = machine->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
sound->device().reset(); sound->device().reset();
} }
@ -554,7 +554,7 @@ void speaker_device::device_start()
// scan all the sound devices and count our inputs // scan all the sound devices and count our inputs
int inputs = 0; int inputs = 0;
device_sound_interface *sound = NULL; device_sound_interface *sound = NULL;
for (bool gotone = machine->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
{ {
// scan each route on the device // scan each route on the device
for (const device_config_sound_interface::sound_route *route = sound->sound_config().m_route_list; route != NULL; route = route->m_next) for (const device_config_sound_interface::sound_route *route = sound->sound_config().m_route_list; route != NULL; route = route->m_next)
@ -586,7 +586,7 @@ void speaker_device::device_start()
m_inputs = 0; m_inputs = 0;
// iterate again over all the sound devices // iterate again over all the sound devices
for (bool gotone = machine->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
{ {
// scan each route on the device // scan each route on the device
for (const device_config_sound_interface::sound_route *route = sound->sound_config().m_route_list; route != NULL; route = route->m_next) for (const device_config_sound_interface::sound_route *route = sound->sound_config().m_route_list; route != NULL; route = route->m_next)

View File

@ -25,8 +25,8 @@
/* these functions are macros primarily due to include file ordering */ /* these functions are macros primarily due to include file ordering */
/* plus, they are very simple */ /* plus, they are very simple */
#define speaker_output_count(config) (config)->devicelist.count(SPEAKER) #define speaker_output_count(config) (config)->m_devicelist.count(SPEAKER)
#define speaker_output_first(config) (config)->devicelist.first(SPEAKER) #define speaker_output_first(config) (config)->m_devicelist.first(SPEAKER)
#define speaker_output_next(previous) (previous)->typenext() #define speaker_output_next(previous) (previous)->typenext()
@ -187,7 +187,7 @@ void sound_set_output_gain(device_t *device, int output, float gain);
inline int speaker_count(const machine_config &config) inline int speaker_count(const machine_config &config)
{ {
return config.devicelist.count(SPEAKER); return config.m_devicelist.count(SPEAKER);
} }
@ -198,7 +198,7 @@ inline int speaker_count(const machine_config &config)
inline const speaker_device_config *speaker_first(const machine_config &config) inline const speaker_device_config *speaker_first(const machine_config &config)
{ {
return downcast<speaker_device_config *>(config.devicelist.first(SPEAKER)); return downcast<speaker_device_config *>(config.m_devicelist.first(SPEAKER));
} }
@ -220,7 +220,7 @@ inline const speaker_device_config *speaker_next(const speaker_device_config *pr
inline int speaker_count(running_machine &machine) inline int speaker_count(running_machine &machine)
{ {
return machine.devicelist.count(SPEAKER); return machine.m_devicelist.count(SPEAKER);
} }
@ -231,7 +231,7 @@ inline int speaker_count(running_machine &machine)
inline speaker_device *speaker_first(running_machine &machine) inline speaker_device *speaker_first(running_machine &machine)
{ {
return downcast<speaker_device *>(machine.devicelist.first(SPEAKER)); return downcast<speaker_device *>(machine.m_devicelist.first(SPEAKER));
} }

View File

@ -93,7 +93,7 @@ running_device *cdda_from_cdrom(running_machine *machine, void *file)
{ {
device_sound_interface *sound = NULL; device_sound_interface *sound = NULL;
for (bool gotone = machine->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
if (sound->device().type() == SOUND_CDDA) if (sound->device().type() == SOUND_CDDA)
{ {
cdda_info *info = get_safe_token(*sound); cdda_info *info = get_safe_token(*sound);

View File

@ -1216,7 +1216,7 @@ static void dma_scsp(const address_space *space, struct _SCSP *SCSP)
/*Job done,request a dma end irq*/ /*Job done,request a dma end irq*/
if(scsp_regs[0x1e/2] & 0x10) if(scsp_regs[0x1e/2] & 0x10)
cpu_set_input_line(space->machine->devicelist.find(CPU, 2),dma_transfer_end,HOLD_LINE); cpu_set_input_line(space->machine->m_devicelist.find(CPU, 2),dma_transfer_end,HOLD_LINE);
} }
#ifdef UNUSED_FUNCTION #ifdef UNUSED_FUNCTION

View File

@ -1035,7 +1035,7 @@ astring &game_info_astring(running_machine *machine, astring &string)
/* loop over all sound chips */ /* loop over all sound chips */
device_sound_interface *sound = NULL; device_sound_interface *sound = NULL;
for (bool gotone = machine->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
{ {
/* append the Sound: string */ /* append the Sound: string */
if (!found_sound) if (!found_sound)
@ -1272,7 +1272,7 @@ void ui_image_handler_ingame(running_machine *machine)
/* run display routine for devices */ /* run display routine for devices */
if (mame_get_phase(machine) == MAME_PHASE_RUNNING) if (mame_get_phase(machine) == MAME_PHASE_RUNNING)
{ {
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
image->call_display(); image->call_display();
} }
@ -1695,7 +1695,7 @@ static slider_state *slider_init(running_machine *machine)
tailptr = &(*tailptr)->next; tailptr = &(*tailptr)->next;
} }
for (device = machine->devicelist.first(LASERDISC); device != NULL; device = device->typenext()) for (device = machine->m_devicelist.first(LASERDISC); device != NULL; device = device->typenext())
{ {
const laserdisc_config *config = (const laserdisc_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config(); const laserdisc_config *config = (const laserdisc_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config();
if (config->overupdate != NULL) if (config->overupdate != NULL)
@ -2149,7 +2149,7 @@ static char *slider_get_screen_desc(screen_device &screen)
static char *slider_get_laserdisc_desc(device_t *laserdisc) static char *slider_get_laserdisc_desc(device_t *laserdisc)
{ {
int ldcount = laserdisc->machine->devicelist.count(LASERDISC); int ldcount = laserdisc->machine->m_devicelist.count(LASERDISC);
static char descbuf[256]; static char descbuf[256];
if (ldcount > 1) if (ldcount > 1)

View File

@ -155,7 +155,7 @@ UINT32 ui_gfx_ui_handler(running_machine *machine, render_container *container,
ui_gfx_state *state = &ui_gfx; ui_gfx_state *state = &ui_gfx;
/* if we have nothing, implicitly cancel */ /* if we have nothing, implicitly cancel */
if (machine->config->total_colors == 0 && machine->colortable == NULL && machine->gfx[0] == NULL && tilemap_count(machine) == 0) if (machine->total_colors() == 0 && machine->colortable == NULL && machine->gfx[0] == NULL && tilemap_count(machine) == 0)
goto cancel; goto cancel;
/* if we're not paused, mark the bitmap dirty */ /* if we're not paused, mark the bitmap dirty */
@ -168,7 +168,7 @@ again:
{ {
case 0: case 0:
/* if we have a palette, display it */ /* if we have a palette, display it */
if (machine->config->total_colors > 0) if (machine->total_colors() > 0)
{ {
palette_handler(machine, container, state); palette_handler(machine, container, state);
break; break;
@ -235,7 +235,7 @@ cancel:
static void palette_handler(running_machine *machine, render_container *container, ui_gfx_state *state) static void palette_handler(running_machine *machine, render_container *container, ui_gfx_state *state)
{ {
int total = state->palette.which ? colortable_palette_get_size(machine->colortable) : machine->config->total_colors; int total = state->palette.which ? colortable_palette_get_size(machine->colortable) : machine->total_colors();
const char *title = state->palette.which ? "COLORTABLE" : "PALETTE"; const char *title = state->palette.which ? "COLORTABLE" : "PALETTE";
const rgb_t *raw_color = palette_entry_list_raw(machine->palette); const rgb_t *raw_color = palette_entry_list_raw(machine->palette);
render_font *ui_font = ui_get_font(); render_font *ui_font = ui_get_font();
@ -383,7 +383,7 @@ static void palette_handle_keys(running_machine *machine, ui_gfx_state *state)
state->palette.which = (int)(machine->colortable != NULL); state->palette.which = (int)(machine->colortable != NULL);
/* cache some info in locals */ /* cache some info in locals */
total = state->palette.which ? colortable_palette_get_size(machine->colortable) : machine->config->total_colors; total = state->palette.which ? colortable_palette_get_size(machine->colortable) : machine->total_colors();
/* determine number of entries per row and total */ /* determine number of entries per row and total */
rowcount = state->palette.count; rowcount = state->palette.count;
@ -769,7 +769,7 @@ static void gfxset_draw_item(running_machine *machine, const gfx_element *gfx, i
}; };
int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width; int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width;
int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height; int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height;
const rgb_t *palette = (machine->config->total_colors != 0) ? palette_entry_list_raw(machine->palette) : NULL; const rgb_t *palette = (machine->total_colors() != 0) ? palette_entry_list_raw(machine->palette) : NULL;
UINT32 rowpixels = bitmap->rowpixels; UINT32 rowpixels = bitmap->rowpixels;
UINT32 palette_mask = ~0; UINT32 palette_mask = ~0;
int x, y; int x, y;

View File

@ -893,7 +893,7 @@ static void menu_file_manager_populate(running_machine *machine, ui_menu *menu,
const char *entry_basename; const char *entry_basename;
/* cycle through all devices for this system */ /* cycle through all devices for this system */
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image)) for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{ {
/* get the image type/id */ /* get the image type/id */
snprintf(buffer, ARRAY_LENGTH(buffer), snprintf(buffer, ARRAY_LENGTH(buffer),

View File

@ -1532,7 +1532,7 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st
ui_menu_item_append(menu, CAPSTARTGAMENOUN " Information", NULL, 0, (void *)menu_game_info); ui_menu_item_append(menu, CAPSTARTGAMENOUN " Information", NULL, 0, (void *)menu_game_info);
device_image_interface *image = NULL; device_image_interface *image = NULL;
if (machine->devicelist.first(image)) if (machine->m_devicelist.first(image))
{ {
/* add image info menu */ /* add image info menu */
ui_menu_item_append(menu, "Image Information", NULL, 0, (void*)ui_image_menu_image_info); ui_menu_item_append(menu, "Image Information", NULL, 0, (void*)ui_image_menu_image_info);
@ -1567,7 +1567,7 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st
ui_menu_item_append(menu, "Cheat", NULL, 0, (void *)menu_cheat); ui_menu_item_append(menu, "Cheat", NULL, 0, (void *)menu_cheat);
/* add memory card menu */ /* add memory card menu */
if (machine->config->memcard_handler != NULL) if (machine->config->m_memcard_handler != NULL)
ui_menu_item_append(menu, "Memory Card", NULL, 0, (void *)menu_memory_card); ui_menu_item_append(menu, "Memory Card", NULL, 0, (void *)menu_memory_card);
/* add reset and exit menus */ /* add reset and exit menus */

View File

@ -418,7 +418,7 @@ static bool validate_driver(int drivnum, const machine_config *config, game_driv
/* make sure sound-less drivers are flagged */ /* make sure sound-less drivers are flagged */
const device_config_sound_interface *sound; const device_config_sound_interface *sound;
if ((driver->flags & GAME_IS_BIOS_ROOT) == 0 && !config->devicelist.first(sound) && (driver->flags & GAME_NO_SOUND) == 0 && (driver->flags & GAME_NO_SOUND_HW) == 0) if ((driver->flags & GAME_IS_BIOS_ROOT) == 0 && !config->m_devicelist.first(sound) && (driver->flags & GAME_NO_SOUND) == 0 && (driver->flags & GAME_NO_SOUND_HW) == 0)
{ {
mame_printf_error("%s: %s missing GAME_NO_SOUND flag\n", driver->source_file, driver->name); mame_printf_error("%s: %s missing GAME_NO_SOUND flag\n", driver->source_file, driver->name);
error = true; error = true;
@ -602,7 +602,7 @@ static bool validate_display(int drivnum, const machine_config *config)
palette_modes = true; palette_modes = true;
/* check for empty palette */ /* check for empty palette */
if (palette_modes && config->total_colors == 0) if (palette_modes && config->m_total_colors == 0)
{ {
mame_printf_error("%s: %s has zero palette entries\n", driver->source_file, driver->name); mame_printf_error("%s: %s has zero palette entries\n", driver->source_file, driver->name);
error = true; error = true;
@ -624,16 +624,16 @@ static bool validate_gfx(int drivnum, const machine_config *config, region_array
int gfxnum; int gfxnum;
/* bail if no gfx */ /* bail if no gfx */
if (!config->gfxdecodeinfo) if (!config->m_gfxdecodeinfo)
return false; return false;
/* iterate over graphics decoding entries */ /* iterate over graphics decoding entries */
for (gfxnum = 0; gfxnum < MAX_GFX_ELEMENTS && config->gfxdecodeinfo[gfxnum].gfxlayout != NULL; gfxnum++) for (gfxnum = 0; gfxnum < MAX_GFX_ELEMENTS && config->m_gfxdecodeinfo[gfxnum].gfxlayout != NULL; gfxnum++)
{ {
const gfx_decode_entry *gfx = &config->gfxdecodeinfo[gfxnum]; const gfx_decode_entry *gfx = &config->m_gfxdecodeinfo[gfxnum];
const char *region = gfx->memory_region; const char *region = gfx->memory_region;
int xscale = (config->gfxdecodeinfo[gfxnum].xscale == 0) ? 1 : config->gfxdecodeinfo[gfxnum].xscale; int xscale = (config->m_gfxdecodeinfo[gfxnum].xscale == 0) ? 1 : config->m_gfxdecodeinfo[gfxnum].xscale;
int yscale = (config->gfxdecodeinfo[gfxnum].yscale == 0) ? 1 : config->gfxdecodeinfo[gfxnum].yscale; int yscale = (config->m_gfxdecodeinfo[gfxnum].yscale == 0) ? 1 : config->m_gfxdecodeinfo[gfxnum].yscale;
const gfx_layout *gl = gfx->gfxlayout; const gfx_layout *gl = gfx->gfxlayout;
int israw = (gl->planeoffset[0] == GFX_RAW); int israw = (gl->planeoffset[0] == GFX_RAW);
int planes = gl->planes; int planes = gl->planes;
@ -1094,14 +1094,14 @@ static bool validate_devices(int drivnum, const machine_config *config, const io
bool error = false; bool error = false;
const game_driver *driver = drivers[drivnum]; const game_driver *driver = drivers[drivnum];
for (const device_config *devconfig = config->devicelist.first(); devconfig != NULL; devconfig = devconfig->next()) for (const device_config *devconfig = config->m_devicelist.first(); devconfig != NULL; devconfig = devconfig->next())
{ {
/* validate the device tag */ /* validate the device tag */
if (!validate_tag(driver, devconfig->name(), devconfig->tag())) if (!validate_tag(driver, devconfig->name(), devconfig->tag()))
error = true; error = true;
/* look for duplicates */ /* look for duplicates */
for (const device_config *scanconfig = config->devicelist.first(); scanconfig != devconfig; scanconfig = scanconfig->next()) for (const device_config *scanconfig = config->m_devicelist.first(); scanconfig != devconfig; scanconfig = scanconfig->next())
if (strcmp(scanconfig->tag(), devconfig->tag()) == 0) if (strcmp(scanconfig->tag(), devconfig->tag()) == 0)
{ {
mame_printf_warning("%s: %s has multiple devices with the tag '%s'\n", driver->source_file, driver->name, devconfig->tag()); mame_printf_warning("%s: %s has multiple devices with the tag '%s'\n", driver->source_file, driver->name, devconfig->tag());
@ -1197,7 +1197,7 @@ bool mame_validitychecks(const game_driver *curdriver)
/* expand the machine driver */ /* expand the machine driver */
expansion -= get_profile_ticks(); expansion -= get_profile_ticks();
config = machine_config_alloc(driver->machine_config); config = global_alloc(machine_config(driver->machine_config));
expansion += get_profile_ticks(); expansion += get_profile_ticks();
/* validate the driver entry */ /* validate the driver entry */
@ -1230,7 +1230,7 @@ bool mame_validitychecks(const game_driver *curdriver)
error = validate_devices(drivnum, config, portlist, &rgninfo) || error; error = validate_devices(drivnum, config, portlist, &rgninfo) || error;
device_checks += get_profile_ticks(); device_checks += get_profile_ticks();
machine_config_free(config); global_free(config);
} }
#if (REPORT_TIMES) #if (REPORT_TIMES)

View File

@ -293,12 +293,12 @@ void video_init(running_machine *machine)
global.seconds_to_run = options_get_int(mame_options(), OPTION_SECONDS_TO_RUN); global.seconds_to_run = options_get_int(mame_options(), OPTION_SECONDS_TO_RUN);
/* create spriteram buffers if necessary */ /* create spriteram buffers if necessary */
if (machine->config->video_attributes & VIDEO_BUFFERS_SPRITERAM) if (machine->config->m_video_attributes & VIDEO_BUFFERS_SPRITERAM)
init_buffered_spriteram(machine); init_buffered_spriteram(machine);
/* call the PALETTE_INIT function */ /* call the PALETTE_INIT function */
if (machine->config->init_palette != NULL) if (machine->config->m_init_palette != NULL)
(*machine->config->init_palette)(machine, memory_region(machine, "proms")); (*machine->config->m_init_palette)(machine, memory_region(machine, "proms"));
/* create a render target for snapshots */ /* create a render target for snapshots */
viewname = options_get_string(mame_options(), OPTION_SNAPVIEW); viewname = options_get_string(mame_options(), OPTION_SNAPVIEW);
@ -489,10 +489,10 @@ void video_frame_update(running_machine *machine, int debug)
machine->primary_screen->scanline0_callback(); machine->primary_screen->scanline0_callback();
/* otherwise, call the video EOF callback */ /* otherwise, call the video EOF callback */
else if (machine->config->video_eof != NULL) else if (machine->config->m_video_eof != NULL)
{ {
profiler_mark_start(PROFILER_VIDEO); profiler_mark_start(PROFILER_VIDEO);
(*machine->config->video_eof)(machine); (*machine->config->m_video_eof)(machine);
profiler_mark_end(); profiler_mark_end();
} }
} }
@ -1131,7 +1131,7 @@ void screen_save_snapshot(running_machine *machine, device_t *screen, mame_file
/* now do the actual work */ /* now do the actual work */
palette = (machine->palette != NULL) ? palette_entry_list_adjusted(machine->palette) : NULL; palette = (machine->palette != NULL) ? palette_entry_list_adjusted(machine->palette) : NULL;
error = png_write_bitmap(mame_core_file(fp), &pnginfo, global.snap_bitmap, machine->config->total_colors, palette); error = png_write_bitmap(mame_core_file(fp), &pnginfo, global.snap_bitmap, machine->total_colors(), palette);
/* free any data allocated */ /* free any data allocated */
png_free(&pnginfo); png_free(&pnginfo);
@ -1195,7 +1195,7 @@ static void create_snapshot_bitmap(device_t *screen)
/* select the appropriate view in our dummy target */ /* select the appropriate view in our dummy target */
if (global.snap_native && screen != NULL) if (global.snap_native && screen != NULL)
{ {
view_index = screen->machine->devicelist.index(SCREEN, screen->tag()); view_index = screen->machine->m_devicelist.index(SCREEN, screen->tag());
assert(view_index != -1); assert(view_index != -1);
render_target_set_view(global.snap_target, view_index); render_target_set_view(global.snap_target, view_index);
} }
@ -1397,7 +1397,7 @@ static void video_mng_record_frame(running_machine *machine)
/* write the next frame */ /* write the next frame */
palette = (machine->palette != NULL) ? palette_entry_list_adjusted(machine->palette) : NULL; palette = (machine->palette != NULL) ? palette_entry_list_adjusted(machine->palette) : NULL;
error = mng_capture_frame(mame_core_file(global.mngfile), &pnginfo, global.snap_bitmap, machine->config->total_colors, palette); error = mng_capture_frame(mame_core_file(global.mngfile), &pnginfo, global.snap_bitmap, machine->total_colors(), palette);
png_free(&pnginfo); png_free(&pnginfo);
if (error != PNGERR_NONE) if (error != PNGERR_NONE)
{ {
@ -1881,7 +1881,7 @@ void screen_device::device_start()
m_scanline0_timer = timer_alloc(machine, static_scanline0_callback, (void *)this); m_scanline0_timer = timer_alloc(machine, static_scanline0_callback, (void *)this);
// allocate a timer to generate per-scanline updates // allocate a timer to generate per-scanline updates
if ((machine->config->video_attributes & VIDEO_UPDATE_SCANLINE) != 0) if ((machine->config->m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0)
m_scanline_timer = timer_alloc(machine, static_scanline_update_callback, (void *)this); m_scanline_timer = timer_alloc(machine, static_scanline_update_callback, (void *)this);
// configure the screen with the default parameters // configure the screen with the default parameters
@ -1892,7 +1892,7 @@ void screen_device::device_start()
m_vblank_end_time = attotime_make(0, m_vblank_period); m_vblank_end_time = attotime_make(0, m_vblank_period);
// start the timer to generate per-scanline updates // start the timer to generate per-scanline updates
if ((machine->config->video_attributes & VIDEO_UPDATE_SCANLINE) != 0) if ((machine->config->m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0)
timer_adjust_oneshot(m_scanline_timer, time_until_pos(0), 0); timer_adjust_oneshot(m_scanline_timer, time_until_pos(0), 0);
// create burn-in bitmap // create burn-in bitmap
@ -2085,7 +2085,7 @@ bool screen_device::update_partial(int scanline)
LOG_PARTIAL_UPDATES(("Partial: update_partial(%s, %d): ", tag(), scanline)); LOG_PARTIAL_UPDATES(("Partial: update_partial(%s, %d): ", tag(), scanline));
// these two checks only apply if we're allowed to skip frames // these two checks only apply if we're allowed to skip frames
if (!(machine->config->video_attributes & VIDEO_ALWAYS_UPDATE)) if (!(machine->config->m_video_attributes & VIDEO_ALWAYS_UPDATE))
{ {
// if skipping this frame, bail // if skipping this frame, bail
if (global.skipping_this_frame) if (global.skipping_this_frame)
@ -2125,8 +2125,8 @@ bool screen_device::update_partial(int scanline)
profiler_mark_start(PROFILER_VIDEO); profiler_mark_start(PROFILER_VIDEO);
LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.min_y, clip.max_y)); LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.min_y, clip.max_y));
if (machine->config->video_update != NULL) if (machine->config->m_video_update != NULL)
flags = (*machine->config->video_update)(this, m_bitmap[m_curbitmap], &clip); flags = (*machine->config->m_video_update)(this, m_bitmap[m_curbitmap], &clip);
global.partial_updates_this_frame++; global.partial_updates_this_frame++;
profiler_mark_end(); profiler_mark_end();
@ -2301,7 +2301,7 @@ void screen_device::vblank_begin_callback()
(*item->m_callback)(*this, item->m_param, true); (*item->m_callback)(*this, item->m_param, true);
// if this is the primary screen and we need to update now // if this is the primary screen and we need to update now
if (this == machine->primary_screen && !(machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) if (this == machine->primary_screen && !(machine->config->m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK))
video_frame_update(machine, FALSE); video_frame_update(machine, FALSE);
// reset the VBLANK start timer for the next frame // reset the VBLANK start timer for the next frame
@ -2327,7 +2327,7 @@ void screen_device::vblank_end_callback()
(*item->m_callback)(*this, item->m_param, false); (*item->m_callback)(*this, item->m_param, false);
// if this is the primary screen and we need to update now // if this is the primary screen and we need to update now
if (this == machine->primary_screen && (machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) if (this == machine->primary_screen && (machine->config->m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK))
video_frame_update(machine, FALSE); video_frame_update(machine, FALSE);
// increment the frame number counter // increment the frame number counter
@ -2379,7 +2379,7 @@ bool screen_device::update_quads()
if (render_is_live_screen(this)) if (render_is_live_screen(this))
{ {
// only update if empty and not a vector game; otherwise assume the driver did it directly // only update if empty and not a vector game; otherwise assume the driver did it directly
if (m_config.m_type != SCREEN_TYPE_VECTOR && (machine->config->video_attributes & VIDEO_SELF_RENDER) == 0) if (m_config.m_type != SCREEN_TYPE_VECTOR && (machine->config->m_video_attributes & VIDEO_SELF_RENDER) == 0)
{ {
// if we're not skipping the frame and if the screen actually changed, then update the texture // if we're not skipping the frame and if the screen actually changed, then update the texture
if (!global.skipping_this_frame && m_changed) if (!global.skipping_this_frame && m_changed)

View File

@ -181,7 +181,7 @@ public:
attotime time_until_pos(int vpos, int hpos = 0) const; attotime time_until_pos(int vpos, int hpos = 0) const;
attotime time_until_vblank_start() const { return time_until_pos(m_visarea.max_y + 1); } attotime time_until_vblank_start() const { return time_until_pos(m_visarea.max_y + 1); }
attotime time_until_vblank_end() const; attotime time_until_vblank_end() const;
attotime time_until_update() const { return (machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK) ? time_until_vblank_end() : time_until_vblank_start(); } attotime time_until_update() const { return (machine->config->m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK) ? time_until_vblank_end() : time_until_vblank_start(); }
attotime scan_period() const { return attotime_make(0, m_scantime); } attotime scan_period() const { return attotime_make(0, m_scantime); }
attotime frame_period() const { return (this == NULL || !started()) ? k_default_frame_period : attotime_make(0, m_frame_period); }; attotime frame_period() const { return (this == NULL || !started()) ? k_default_frame_period : attotime_make(0, m_frame_period); };
UINT64 frame_number() const { return m_frame_number; } UINT64 frame_number() const { return m_frame_number; }
@ -413,7 +413,7 @@ void video_assert_out_of_range_pixels(running_machine *machine, bitmap_t *bitmap
inline int screen_count(const machine_config &config) inline int screen_count(const machine_config &config)
{ {
return config.devicelist.count(SCREEN); return config.m_devicelist.count(SCREEN);
} }
@ -424,7 +424,7 @@ inline int screen_count(const machine_config &config)
inline const screen_device_config *screen_first(const machine_config &config) inline const screen_device_config *screen_first(const machine_config &config)
{ {
return downcast<screen_device_config *>(config.devicelist.first(SCREEN)); return downcast<screen_device_config *>(config.m_devicelist.first(SCREEN));
} }
@ -446,7 +446,7 @@ inline const screen_device_config *screen_next(const screen_device_config *previ
inline int screen_count(running_machine &machine) inline int screen_count(running_machine &machine)
{ {
return machine.devicelist.count(SCREEN); return machine.m_devicelist.count(SCREEN);
} }
@ -457,7 +457,7 @@ inline int screen_count(running_machine &machine)
inline screen_device *screen_first(running_machine &machine) inline screen_device *screen_first(running_machine &machine)
{ {
return downcast<screen_device *>(machine.devicelist.first(SCREEN)); return downcast<screen_device *>(machine.m_devicelist.first(SCREEN));
} }

View File

@ -523,7 +523,7 @@ PALETTE_INIT( all_black )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
palette_set_color(machine,i,RGB_BLACK); /* black */ palette_set_color(machine,i,RGB_BLACK); /* black */
} }
@ -577,7 +577,7 @@ PALETTE_INIT( RRRR_GGGG_BBBB )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0,bit1,bit2,bit3,r,g,b; int bit0,bit1,bit2,bit3,r,g,b;
@ -589,17 +589,17 @@ PALETTE_INIT( RRRR_GGGG_BBBB )
r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
/* green component */ /* green component */
bit0 = (color_prom[i + machine->config->total_colors] >> 0) & 0x01; bit0 = (color_prom[i + machine->total_colors()] >> 0) & 0x01;
bit1 = (color_prom[i + machine->config->total_colors] >> 1) & 0x01; bit1 = (color_prom[i + machine->total_colors()] >> 1) & 0x01;
bit2 = (color_prom[i + machine->config->total_colors] >> 2) & 0x01; bit2 = (color_prom[i + machine->total_colors()] >> 2) & 0x01;
bit3 = (color_prom[i + machine->config->total_colors] >> 3) & 0x01; bit3 = (color_prom[i + machine->total_colors()] >> 3) & 0x01;
g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
/* blue component */ /* blue component */
bit0 = (color_prom[i + 2*machine->config->total_colors] >> 0) & 0x01; bit0 = (color_prom[i + 2*machine->total_colors()] >> 0) & 0x01;
bit1 = (color_prom[i + 2*machine->config->total_colors] >> 1) & 0x01; bit1 = (color_prom[i + 2*machine->total_colors()] >> 1) & 0x01;
bit2 = (color_prom[i + 2*machine->config->total_colors] >> 2) & 0x01; bit2 = (color_prom[i + 2*machine->total_colors()] >> 2) & 0x01;
bit3 = (color_prom[i + 2*machine->config->total_colors] >> 3) & 0x01; bit3 = (color_prom[i + 2*machine->total_colors()] >> 3) & 0x01;
b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette_set_color(machine,i,MAKE_RGB(r,g,b)); palette_set_color(machine,i,MAKE_RGB(r,g,b));

View File

@ -4537,7 +4537,7 @@ static DEVICE_START( voodoo )
} }
/* set the type, and initialize the chip mask */ /* set the type, and initialize the chip mask */
v->index = device->machine->devicelist.index(device->type(), device->tag()); v->index = device->machine->m_devicelist.index(device->type(), device->tag());
v->screen = downcast<screen_device *>(device->machine->device(config->screen)); v->screen = downcast<screen_device *>(device->machine->device(config->screen));
assert_always(v->screen != NULL, "Unable to find screen attached to voodoo"); assert_always(v->screen != NULL, "Unable to find screen attached to voodoo");
v->cpu = device->machine->device(config->cputag); v->cpu = device->machine->device(config->cputag);

View File

@ -57,7 +57,7 @@ void watchdog_init(running_machine *machine)
static void watchdog_internal_reset(running_machine *machine) static void watchdog_internal_reset(running_machine *machine)
{ {
/* set up the watchdog timer; only start off enabled if explicitly configured */ /* set up the watchdog timer; only start off enabled if explicitly configured */
watchdog_enabled = (machine->config->watchdog_vblank_count != 0 || attotime_compare(machine->config->watchdog_time, attotime_zero) != 0); watchdog_enabled = (machine->config->m_watchdog_vblank_count != 0 || attotime_compare(machine->config->m_watchdog_time, attotime_zero) != 0);
watchdog_reset(machine); watchdog_reset(machine);
watchdog_enabled = TRUE; watchdog_enabled = TRUE;
} }
@ -90,7 +90,7 @@ static void on_vblank(screen_device &screen, void *param, bool vblank_state)
if (vblank_state && watchdog_enabled) if (vblank_state && watchdog_enabled)
{ {
/* check the watchdog */ /* check the watchdog */
if (screen.machine->config->watchdog_vblank_count != 0) if (screen.machine->config->m_watchdog_vblank_count != 0)
{ {
watchdog_counter = watchdog_counter - 1; watchdog_counter = watchdog_counter - 1;
@ -112,9 +112,9 @@ void watchdog_reset(running_machine *machine)
timer_adjust_oneshot(watchdog_timer, attotime_never, 0); timer_adjust_oneshot(watchdog_timer, attotime_never, 0);
/* VBLANK-based watchdog? */ /* VBLANK-based watchdog? */
else if (machine->config->watchdog_vblank_count != 0) else if (machine->config->m_watchdog_vblank_count != 0)
{ {
watchdog_counter = machine->config->watchdog_vblank_count; watchdog_counter = machine->config->m_watchdog_vblank_count;
/* register a VBLANK callback for the primary screen */ /* register a VBLANK callback for the primary screen */
if (machine->primary_screen != NULL) if (machine->primary_screen != NULL)
@ -122,8 +122,8 @@ void watchdog_reset(running_machine *machine)
} }
/* timer-based watchdog? */ /* timer-based watchdog? */
else if (attotime_compare(machine->config->watchdog_time, attotime_zero) != 0) else if (attotime_compare(machine->config->m_watchdog_time, attotime_zero) != 0)
timer_adjust_oneshot(watchdog_timer, machine->config->watchdog_time, 0); timer_adjust_oneshot(watchdog_timer, machine->config->m_watchdog_time, 0);
/* default to an obscene amount of time (3 seconds) */ /* default to an obscene amount of time (3 seconds) */
else else

View File

@ -227,7 +227,7 @@ static void process_commands(running_device *laserdisc)
static TIMER_CALLBACK( vsync_update ) static TIMER_CALLBACK( vsync_update )
{ {
running_device *laserdisc = machine->devicelist.first(LASERDISC); running_device *laserdisc = machine->m_devicelist.first(LASERDISC);
int vblank_scanline; int vblank_scanline;
attotime target; attotime target;
@ -250,7 +250,7 @@ static MACHINE_START( ldplayer )
static TIMER_CALLBACK( autoplay ) static TIMER_CALLBACK( autoplay )
{ {
running_device *laserdisc = machine->devicelist.first(LASERDISC); running_device *laserdisc = machine->m_devicelist.first(LASERDISC);
/* start playing */ /* start playing */
(*execute_command)(laserdisc, CMD_PLAY); (*execute_command)(laserdisc, CMD_PLAY);
@ -323,7 +323,7 @@ static TIMER_CALLBACK( pr8210_bit_callback )
static MACHINE_START( pr8210 ) static MACHINE_START( pr8210 )
{ {
running_device *laserdisc = machine->devicelist.first(LASERDISC); running_device *laserdisc = machine->m_devicelist.first(LASERDISC);
MACHINE_START_CALL(ldplayer); MACHINE_START_CALL(ldplayer);
pr8210_bit_timer = timer_alloc(machine, pr8210_bit_callback, (void *)laserdisc); pr8210_bit_timer = timer_alloc(machine, pr8210_bit_callback, (void *)laserdisc);
} }

View File

@ -527,7 +527,7 @@ static PALETTE_INIT( fclown )
if (color_prom == 0) return; if (color_prom == 0) return;
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0, bit1, bit2, bit3, r, g, b, bk; int bit0, bit1, bit2, bit3, r, g, b, bk;

View File

@ -333,7 +333,7 @@ static PALETTE_INIT( lions )
{ {
int i; int i;
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0,bit1,bit2,r,g,b; int bit0,bit1,bit2,r,g,b;

View File

@ -259,7 +259,7 @@ static PALETTE_INIT( adp )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;

View File

@ -1109,7 +1109,7 @@ static PALETTE_INIT( aristmk4 )
{ {
int i; int i;
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0,bit1,bit2,r,g,b; int bit0,bit1,bit2,r,g,b;

View File

@ -170,7 +170,7 @@ static PALETTE_INIT(cardline)
{ {
int i,r,g,b,data; int i,r,g,b,data;
int bit0,bit1,bit2; int bit0,bit1,bit2;
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
data=color_prom[i]; data=color_prom[i];

View File

@ -78,11 +78,11 @@ static PALETTE_INIT( chanbara )
{ {
int i, red, green, blue; int i, red, green, blue;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
red = color_prom[i]; red = color_prom[i];
green = color_prom[machine->config->total_colors + i]; green = color_prom[machine->total_colors() + i];
blue = color_prom[2 * machine->config->total_colors + i]; blue = color_prom[2 * machine->total_colors() + i];
palette_set_color_rgb(machine, i, pal4bit(red << 1), pal4bit(green << 1), pal4bit(blue << 1)); palette_set_color_rgb(machine, i, pal4bit(red << 1), pal4bit(green << 1), pal4bit(blue << 1));
} }

View File

@ -64,7 +64,7 @@ public:
static PALETTE_INIT( zerotrgt ) static PALETTE_INIT( zerotrgt )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;

View File

@ -805,12 +805,12 @@ static VIDEO_START(cps3)
state_save_register_global_pointer(machine, cps3_char_ram, 0x800000 /4); state_save_register_global_pointer(machine, cps3_char_ram, 0x800000 /4);
/* create the char set (gfx will then be updated dynamically from RAM) */ /* create the char set (gfx will then be updated dynamically from RAM) */
machine->gfx[0] = gfx_element_alloc(machine, &cps3_tiles8x8_layout, (UINT8 *)cps3_ss_ram, machine->config->total_colors / 16, 0); machine->gfx[0] = gfx_element_alloc(machine, &cps3_tiles8x8_layout, (UINT8 *)cps3_ss_ram, machine->total_colors() / 16, 0);
//decode_ssram(); //decode_ssram();
/* create the char set (gfx will then be updated dynamically from RAM) */ /* create the char set (gfx will then be updated dynamically from RAM) */
machine->gfx[1] = gfx_element_alloc(machine, &cps3_tiles16x16_layout, (UINT8 *)cps3_char_ram, machine->config->total_colors / 64, 0); machine->gfx[1] = gfx_element_alloc(machine, &cps3_tiles16x16_layout, (UINT8 *)cps3_char_ram, machine->total_colors() / 64, 0);
machine->gfx[1]->color_granularity = 64; machine->gfx[1]->color_granularity = 64;
//decode_charram(); //decode_charram();

View File

@ -475,7 +475,7 @@ static PALETTE_INIT( dacholer )
2, resistances_b, weights_b, 0, 0, 2, resistances_b, weights_b, 0, 0,
0, 0, 0, 0, 0); 0, 0, 0, 0, 0);
for (i = 0;i < machine->config->total_colors; i++) for (i = 0;i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2; int bit0, bit1, bit2;
int r, g, b; int r, g, b;

View File

@ -661,7 +661,7 @@ static VIDEO_START(jclub2)
assert(jclub2_gfx_index != MAX_GFX_ELEMENTS); assert(jclub2_gfx_index != MAX_GFX_ELEMENTS);
/* create the char set (gfx will then be updated dynamically from RAM) */ /* create the char set (gfx will then be updated dynamically from RAM) */
machine->gfx[jclub2_gfx_index] = gfx_element_alloc(machine, &layout_16x16x8_jclub2, (UINT8 *)jclub2_tileram, machine->config->total_colors / 16, 0); machine->gfx[jclub2_gfx_index] = gfx_element_alloc(machine, &layout_16x16x8_jclub2, (UINT8 *)jclub2_tileram, machine->total_colors() / 16, 0);
} }

View File

@ -334,7 +334,7 @@ static PALETTE_INIT( drw80pkr )
{ {
int j; int j;
for (j = 0; j < machine->config->total_colors; j++) for (j = 0; j < machine->total_colors(); j++)
{ {
int r, g, b, tr, tg, tb, i; int r, g, b, tr, tg, tb, i;

View File

@ -211,7 +211,7 @@ static PALETTE_INIT( esh )
int i; int i;
/* Oddly enough, the top 4 bits of each byte is 0 */ /* Oddly enough, the top 4 bits of each byte is 0 */
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int r,g,b; int r,g,b;
int bit0,bit1,bit2; int bit0,bit1,bit2;

View File

@ -470,7 +470,7 @@ static VIDEO_UPDATE(firebeat)
{ {
int chip; int chip;
if (screen == screen->machine->devicelist.find(SCREEN, 0)) if (screen == screen->machine->m_devicelist.find(SCREEN, 0))
chip = 0; chip = 0;
else else
chip = 1; chip = 1;
@ -599,7 +599,7 @@ static void GCU_w(running_machine *machine, int chip, UINT32 offset, UINT32 data
COMBINE_DATA( &gcu[chip].visible_area ); COMBINE_DATA( &gcu[chip].visible_area );
if (ACCESSING_BITS_0_15) if (ACCESSING_BITS_0_15)
{ {
screen_device *screen = downcast<screen_device *>(machine->devicelist.find(SCREEN, chip)); screen_device *screen = downcast<screen_device *>(machine->m_devicelist.find(SCREEN, chip));
if (screen != NULL) if (screen != NULL)
{ {

View File

@ -690,7 +690,7 @@ static PALETTE_INIT( goldnpkr )
/* 0000IBGR */ /* 0000IBGR */
if (color_prom == 0) return; if (color_prom == 0) return;
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0, bit1, bit2, r, g, b, inten, intenmin, intenmax; int bit0, bit1, bit2, r, g, b, inten, intenmin, intenmax;
@ -741,7 +741,7 @@ static PALETTE_INIT( witchcrd )
if (color_prom == 0) return; if (color_prom == 0) return;
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0, bit1, bit2, bit3, r, g, b, bk; int bit0, bit1, bit2, bit3, r, g, b, bk;

View File

@ -270,7 +270,7 @@ static MACHINE_START( gottlieb )
state_save_register_global_array(machine, track); state_save_register_global_array(machine, track);
/* see if we have a laserdisc */ /* see if we have a laserdisc */
laserdisc = machine->devicelist.first(LASERDISC); laserdisc = machine->m_devicelist.first(LASERDISC);
if (laserdisc != NULL) if (laserdisc != NULL)
{ {
/* attach to the I/O ports */ /* attach to the I/O ports */

View File

@ -260,7 +260,7 @@ static PALETTE_INIT( istellar )
int i; int i;
/* Oddly enough, the top 4 bits of each byte is 0 */ /* Oddly enough, the top 4 bits of each byte is 0 */
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int r,g,b; int r,g,b;
int bit0,bit1,bit2,bit3; int bit0,bit1,bit2,bit3;

View File

@ -86,7 +86,7 @@ static PALETTE_INIT( jangou )
2, resistances_b, weights_b, 0, 0, 2, resistances_b, weights_b, 0, 0,
0, 0, 0, 0, 0); 0, 0, 0, 0, 0);
for (i = 0;i < machine->config->total_colors; i++) for (i = 0;i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2; int bit0, bit1, bit2;
int r, g, b; int r, g, b;

View File

@ -426,7 +426,7 @@ static PALETTE_INIT( marinedt )
{ {
int i,r,b,g; int i,r,b,g;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2; int bit0, bit1, bit2;

View File

@ -252,7 +252,7 @@ static PALETTE_INIT( meijinsn )
3, resistances_rg, weights_g, 0, 1000+1000, 3, resistances_rg, weights_g, 0, 1000+1000,
2, resistances_b, weights_b, 0, 1000+1000); 2, resistances_b, weights_b, 0, 1000+1000);
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;

View File

@ -346,7 +346,7 @@ static PALETTE_INIT( mirax )
{ {
int i; int i;
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0,bit1,bit2,r,g,b; int bit0,bit1,bit2,r,g,b;

View File

@ -1014,10 +1014,10 @@ static VIDEO_START( mpu4_vid )
assert(mpu4_gfx_index != MAX_GFX_ELEMENTS); assert(mpu4_gfx_index != MAX_GFX_ELEMENTS);
/* create the char set (gfx will then be updated dynamically from RAM) */ /* create the char set (gfx will then be updated dynamically from RAM) */
machine->gfx[mpu4_gfx_index+0] = gfx_element_alloc(machine, &mpu4_vid_char_8x8_layout, (UINT8 *)mpu4_vid_vidram, machine->config->total_colors / 16, 0); machine->gfx[mpu4_gfx_index+0] = gfx_element_alloc(machine, &mpu4_vid_char_8x8_layout, (UINT8 *)mpu4_vid_vidram, machine->total_colors() / 16, 0);
machine->gfx[mpu4_gfx_index+1] = gfx_element_alloc(machine, &mpu4_vid_char_8x16_layout, (UINT8 *)mpu4_vid_vidram, machine->config->total_colors / 16, 0); machine->gfx[mpu4_gfx_index+1] = gfx_element_alloc(machine, &mpu4_vid_char_8x16_layout, (UINT8 *)mpu4_vid_vidram, machine->total_colors() / 16, 0);
machine->gfx[mpu4_gfx_index+2] = gfx_element_alloc(machine, &mpu4_vid_char_16x8_layout, (UINT8 *)mpu4_vid_vidram, machine->config->total_colors / 16, 0); machine->gfx[mpu4_gfx_index+2] = gfx_element_alloc(machine, &mpu4_vid_char_16x8_layout, (UINT8 *)mpu4_vid_vidram, machine->total_colors() / 16, 0);
machine->gfx[mpu4_gfx_index+3] = gfx_element_alloc(machine, &mpu4_vid_char_16x16_layout, (UINT8 *)mpu4_vid_vidram, machine->config->total_colors / 16, 0); machine->gfx[mpu4_gfx_index+3] = gfx_element_alloc(machine, &mpu4_vid_char_16x16_layout, (UINT8 *)mpu4_vid_vidram, machine->total_colors() / 16, 0);
scn2675_IR_pointer = 0; scn2675_IR_pointer = 0;
} }

View File

@ -275,7 +275,7 @@ static void zdrawgfxzoom(
{ {
if( gfx ) if( gfx )
{ {
int shadow_offset = (gfx->machine->config->video_attributes&VIDEO_HAS_SHADOWS)?gfx->machine->config->total_colors:0; int shadow_offset = (gfx->machine->config->m_video_attributes&VIDEO_HAS_SHADOWS)?gfx->machine->total_colors():0;
const pen_t *pal = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; const pen_t *pal = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements); const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; int sprite_screen_height = (scaley*gfx->height+0x8000)>>16;

View File

@ -244,7 +244,7 @@ static PALETTE_INIT( nightgal )
2, resistances_b, weights_b, 0, 0, 2, resistances_b, weights_b, 0, 0,
0, 0, 0, 0, 0); 0, 0, 0, 0, 0);
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2; int bit0, bit1, bit2;
int r, g, b; int r, g, b;

View File

@ -85,7 +85,7 @@ static PALETTE_INIT( olibochu )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
UINT8 pen; UINT8 pen;
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;

View File

@ -102,7 +102,7 @@ static MC6845_UPDATE_ROW( update_row )
static PALETTE_INIT( othello ) static PALETTE_INIT( othello )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
palette_set_color(machine, i, MAKE_RGB(0xff, 0x00, 0xff)); palette_set_color(machine, i, MAKE_RGB(0xff, 0x00, 0xff));
} }

View File

@ -288,7 +288,7 @@ static WRITE8_HANDLER( peplus_bgcolor_w )
{ {
int i; int i;
for (i = 0; i < space->machine->config->total_colors; i++) for (i = 0; i < space->machine->total_colors(); i++)
{ {
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;
@ -683,7 +683,7 @@ static PALETTE_INIT( peplus )
*/ */
int i; int i;
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;

View File

@ -401,7 +401,7 @@ static PALETTE_INIT( progolf )
{ {
int i; int i;
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0,bit1,bit2,r,g,b; int bit0,bit1,bit2,r,g,b;

View File

@ -135,7 +135,7 @@ static PALETTE_INIT( safarir )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors / 2; i++) for (i = 0; i < machine->total_colors() / 2; i++)
{ {
palette_set_color(machine, (i * 2) + 0, RGB_BLACK); palette_set_color(machine, (i * 2) + 0, RGB_BLACK);
palette_set_color(machine, (i * 2) + 1, MAKE_RGB(pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0))); palette_set_color(machine, (i * 2) + 1, MAKE_RGB(pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0)));

View File

@ -344,7 +344,7 @@ static PALETTE_INIT( sbowling )
3, resistances_rg, outputs_g, 0, 100, 3, resistances_rg, outputs_g, 0, 100,
2, resistances_b, outputs_b, 0, 100); 2, resistances_b, outputs_b, 0, 100);
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0,bit1,bit2,r,g,b; int bit0,bit1,bit2,r,g,b;

View File

@ -32,7 +32,7 @@ static PALETTE_INIT( shanghai )
int i; int i;
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0,bit1,bit2,r,g,b; int bit0,bit1,bit2,r,g,b;

View File

@ -133,7 +133,7 @@ static PALETTE_INIT( shougi )
3, resistances_rg, weights_g, 1000, 0, 3, resistances_rg, weights_g, 1000, 0,
2, resistances_b, weights_b, 1000, 0); 2, resistances_b, weights_b, 1000, 0);
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0,bit1,bit2,r,g,b; int bit0,bit1,bit2,r,g,b;

View File

@ -149,7 +149,7 @@ static VIDEO_START(srmp6)
state->sprram_old = auto_alloc_array_clear(machine, UINT16, 0x80000/2); state->sprram_old = auto_alloc_array_clear(machine, UINT16, 0x80000/2);
/* create the char set (gfx will then be updated dynamically from RAM) */ /* create the char set (gfx will then be updated dynamically from RAM) */
machine->gfx[0] = gfx_element_alloc(machine, &tiles8x8_layout, (UINT8*)state->tileram, machine->config->total_colors / 256, 0); machine->gfx[0] = gfx_element_alloc(machine, &tiles8x8_layout, (UINT8*)state->tileram, machine->total_colors() / 256, 0);
machine->gfx[0]->color_granularity=256; machine->gfx[0]->color_granularity=256;
state->brightness = 0x60; state->brightness = 0x60;

View File

@ -88,7 +88,7 @@ static PALETTE_INIT( superdq )
2, &resistances[1], bweights, 220, 0); 2, &resistances[1], bweights, 220, 0);
/* initialize the palette with these colors */ /* initialize the palette with these colors */
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2; int bit0, bit1, bit2;
int r, g, b; int r, g, b;

View File

@ -42,7 +42,7 @@ static PALETTE_INIT( tugboat )
int i; int i;
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int r,g,b,brt; int r,g,b,brt;

View File

@ -363,7 +363,7 @@ static PALETTE_INIT( videopkr )
{ {
int j; int j;
for (j = 0; j < machine->config->total_colors; j++) for (j = 0; j < machine->total_colors(); j++)
{ {
int r, g, b, tr, tg, tb, i; int r, g, b, tr, tg, tb, i;
@ -389,7 +389,7 @@ static PALETTE_INIT( babypkr )
{ {
int j; int j;
for (j = 0; j < machine->config->total_colors; j++) for (j = 0; j < machine->total_colors(); j++)
{ {
int r, g, b, tr, tg, tb, i, top; int r, g, b, tr, tg, tb, i, top;
@ -419,7 +419,7 @@ static PALETTE_INIT( fortune1 )
{ {
int j; int j;
for (j = 0; j < machine->config->total_colors; j++) for (j = 0; j < machine->total_colors(); j++)
{ {
int r, g, b, tr, tg, tb, i, c; int r, g, b, tr, tg, tb, i, c;

View File

@ -91,7 +91,7 @@ static PALETTE_INIT( wallc )
2, resistances_rg, weights_g, 330, 0, 2, resistances_rg, weights_g, 330, 0,
3, resistances_b, weights_b, 330, 655+220); 3, resistances_b, weights_b, 330, 655+220);
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0,bit1,bit7,r,g,b; int bit0,bit1,bit7,r,g,b;

View File

@ -876,7 +876,7 @@ static TIMER_CALLBACK( delayed_6502_sound_w )
void atarigen_set_vol(running_machine *machine, int volume, device_type type) void atarigen_set_vol(running_machine *machine, int volume, device_type type)
{ {
device_sound_interface *sound = NULL; device_sound_interface *sound = NULL;
for (bool gotone = machine->devicelist.first(sound); gotone; gotone = sound->next(sound)) for (bool gotone = machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound))
if (sound->device().type() == type) if (sound->device().type() == type)
sound_set_output_gain(*sound, ALL_OUTPUTS, volume / 100.0); sound_set_output_gain(*sound, ALL_OUTPUTS, volume / 100.0);
} }

View File

@ -1803,7 +1803,7 @@ static DEVICE_START( naomibd )
} }
/* set the type */ /* set the type */
v->index = device->machine->devicelist.index(device->type(), device->tag()); v->index = device->machine->m_devicelist.index(device->type(), device->tag());
v->type = config->type; v->type = config->type;
/* initialize some registers */ /* initialize some registers */

View File

@ -14,7 +14,7 @@ PALETTE_INIT( fortyl )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2, bit3, r, g, b; int bit0, bit1, bit2, bit3, r, g, b;
@ -26,17 +26,17 @@ PALETTE_INIT( fortyl )
r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
/* green component */ /* green component */
bit0 = (color_prom[machine->config->total_colors] >> 0) & 0x01; bit0 = (color_prom[machine->total_colors()] >> 0) & 0x01;
bit1 = (color_prom[machine->config->total_colors] >> 1) & 0x01; bit1 = (color_prom[machine->total_colors()] >> 1) & 0x01;
bit2 = (color_prom[machine->config->total_colors] >> 2) & 0x01; bit2 = (color_prom[machine->total_colors()] >> 2) & 0x01;
bit3 = (color_prom[machine->config->total_colors] >> 3) & 0x01; bit3 = (color_prom[machine->total_colors()] >> 3) & 0x01;
g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
/* blue component */ /* blue component */
bit0 = (color_prom[2*machine->config->total_colors] >> 0) & 0x01; bit0 = (color_prom[2*machine->total_colors()] >> 0) & 0x01;
bit1 = (color_prom[2*machine->config->total_colors] >> 1) & 0x01; bit1 = (color_prom[2*machine->total_colors()] >> 1) & 0x01;
bit2 = (color_prom[2*machine->config->total_colors] >> 2) & 0x01; bit2 = (color_prom[2*machine->total_colors()] >> 2) & 0x01;
bit3 = (color_prom[2*machine->config->total_colors] >> 3) & 0x01; bit3 = (color_prom[2*machine->total_colors()] >> 3) & 0x01;
b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette_set_color(machine, i, MAKE_RGB(r,g,b)); palette_set_color(machine, i, MAKE_RGB(r,g,b));

View File

@ -22,7 +22,7 @@ PALETTE_INIT( ambush )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;

View File

@ -89,7 +89,7 @@ PALETTE_INIT( ampoker2 )
2, resistances_b, weights_b, 0, 0); 2, resistances_b, weights_b, 0, 0);
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;

View File

@ -24,7 +24,7 @@ PALETTE_INIT( appoooh )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
UINT8 pen; UINT8 pen;
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;
@ -62,7 +62,7 @@ PALETTE_INIT( robowres )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;

View File

@ -124,7 +124,7 @@ VIDEO_START( atarigt )
/* map pens 1:1 */ /* map pens 1:1 */
substitute_pens = auto_alloc_array(machine, pen_t, 65536); substitute_pens = auto_alloc_array(machine, pen_t, 65536);
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
substitute_pens[i] = i; substitute_pens[i] = i;
machine->pens = substitute_pens; machine->pens = substitute_pens;

View File

@ -63,7 +63,7 @@ PALETTE_INIT( bagman )
2, resistances_b, weights_b, 470, 0); 2, resistances_b, weights_b, 470, 0);
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;

View File

@ -41,7 +41,7 @@ PALETTE_INIT( bking )
3, &resistances_rg[0], gweights, 0, 0, 3, &resistances_rg[0], gweights, 0, 0,
2, &resistances_b[0], bweights, 0, 0); 2, &resistances_b[0], bweights, 0, 0);
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
UINT16 pen; UINT16 pen;
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;

View File

@ -24,7 +24,7 @@ PALETTE_INIT( blueprnt )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
UINT8 pen; UINT8 pen;
int r, g, b; int r, g, b;

View File

@ -36,7 +36,7 @@ PALETTE_INIT( brkthru )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2, bit3, r, g, b; int bit0, bit1, bit2, bit3, r, g, b;
@ -50,10 +50,10 @@ PALETTE_INIT( brkthru )
bit2 = (color_prom[0] >> 6) & 0x01; bit2 = (color_prom[0] >> 6) & 0x01;
bit3 = (color_prom[0] >> 7) & 0x01; bit3 = (color_prom[0] >> 7) & 0x01;
g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = (color_prom[machine->config->total_colors] >> 0) & 0x01; bit0 = (color_prom[machine->total_colors()] >> 0) & 0x01;
bit1 = (color_prom[machine->config->total_colors] >> 1) & 0x01; bit1 = (color_prom[machine->total_colors()] >> 1) & 0x01;
bit2 = (color_prom[machine->config->total_colors] >> 2) & 0x01; bit2 = (color_prom[machine->total_colors()] >> 2) & 0x01;
bit3 = (color_prom[machine->config->total_colors] >> 3) & 0x01; bit3 = (color_prom[machine->total_colors()] >> 3) & 0x01;
b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette_set_color(machine, i, MAKE_RGB(r,g,b)); palette_set_color(machine, i, MAKE_RGB(r,g,b));

View File

@ -37,7 +37,7 @@ PALETTE_INIT( btime )
/* This function is also used by Eggs. */ /* This function is also used by Eggs. */
if (color_prom == 0) return; if (color_prom == 0) return;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;
@ -82,7 +82,7 @@ PALETTE_INIT( lnc )
{ {
int i; int i;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;

View File

@ -81,7 +81,7 @@ PALETTE_INIT( calomega )
/* 00000BGR */ /* 00000BGR */
if (color_prom == 0) return; if (color_prom == 0) return;
for (i = 0;i < machine->config->total_colors;i++) for (i = 0;i < machine->total_colors();i++)
{ {
int bit0, bit1, bit2, r, g, b; int bit0, bit1, bit2, r, g, b;

View File

@ -12,7 +12,7 @@ PALETTE_INIT( carjmbre )
{ {
int i, bit0, bit1, bit2, r, g, b; int i, bit0, bit1, bit2, r, g, b;
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
/* red component */ /* red component */
bit0 = (*color_prom >> 0) & 0x01; bit0 = (*color_prom >> 0) & 0x01;

View File

@ -99,7 +99,7 @@ PALETTE_INIT( carpolo )
}; };
for (i = 0; i < machine->config->total_colors; i++) for (i = 0; i < machine->total_colors(); i++)
{ {
UINT8 pen, r, g, b; UINT8 pen, r, g, b;

View File

@ -80,9 +80,9 @@ PALETTE_INIT( cave )
int pen; int pen;
/* create a 1:1 palette map covering everything */ /* create a 1:1 palette map covering everything */
state->palette_map = auto_alloc_array(machine, UINT16, machine->config->total_colors); state->palette_map = auto_alloc_array(machine, UINT16, machine->total_colors());
for (pen = 0; pen < machine->config->total_colors; pen++) for (pen = 0; pen < machine->total_colors(); pen++)
state->palette_map[pen] = pen % maxpen; state->palette_map[pen] = pen % maxpen;
} }
@ -191,7 +191,7 @@ static void set_pens( running_machine *machine )
cave_state *state = (cave_state *)machine->driver_data; cave_state *state = (cave_state *)machine->driver_data;
int pen; int pen;
for (pen = 0; pen < machine->config->total_colors; pen++) for (pen = 0; pen < machine->total_colors(); pen++)
{ {
UINT16 data = state->paletteram[state->palette_map[pen]]; UINT16 data = state->paletteram[state->palette_map[pen]];
@ -468,8 +468,8 @@ static void cave_vh_start( running_machine *machine, int num )
state->row_effect_offs_n = -1; state->row_effect_offs_n = -1;
state->row_effect_offs_f = 1; state->row_effect_offs_f = 1;
state->background_color = machine->config->gfxdecodeinfo[0].color_codes_start + state->background_color = machine->config->m_gfxdecodeinfo[0].color_codes_start +
(machine->config->gfxdecodeinfo[0].total_color_codes - 1) * (machine->config->m_gfxdecodeinfo[0].total_color_codes - 1) *
machine->gfx[0]->color_granularity; machine->gfx[0]->color_granularity;
switch (state->kludge) switch (state->kludge)

Some files were not shown because too many files have changed in this diff Show More