diff options
162 files changed, 797 insertions, 724 deletions
diff --git a/src/emu/audit.c b/src/emu/audit.c index 3f0c9f261cb..0f43d69d2ed 100644 --- a/src/emu/audit.c +++ b/src/emu/audit.c @@ -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) { - 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_source *source; audit_record *record; @@ -134,7 +134,7 @@ int audit_images(core_options *options, const game_driver *gamedrv, UINT32 valid records = 0; } - machine_config_free(config); + global_free(config); 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) { - machine_config *config = machine_config_alloc(gamedrv->machine_config); + machine_config *config = global_alloc(machine_config(gamedrv->machine_config)); audit_record *record; int records = 0; int sampnum; /* count the number of sample records attached to this driver */ 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) { 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; /* 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) { 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: - machine_config_free(config); + global_free(config); return records; } diff --git a/src/emu/clifront.c b/src/emu/clifront.c index 19f49ef8d98..583217a6ed7 100644 --- a/src/emu/clifront.c +++ b/src/emu/clifront.c @@ -507,7 +507,7 @@ int cli_info_listcrc(core_options *options, const char *gamename) for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) 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_source *source; @@ -524,7 +524,7 @@ int cli_info_listcrc(core_options *options, const char *gamename) } count++; - machine_config_free(config); + global_free(config); } /* 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++) 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_source *source; @@ -595,7 +595,7 @@ int cli_info_listroms(core_options *options, const char *gamename) } count++; - machine_config_free(config); + global_free(config); } 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++) 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; /* 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) { 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++; - machine_config_free(config); + global_free(config); } 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++) 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; 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); /* 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()); @@ -681,7 +681,7 @@ int cli_info_listdevices(core_options *options, const char *gamename) } count++; - machine_config_free(config); + global_free(config); } 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 ) { /* 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 ) ) { @@ -810,7 +810,7 @@ static int info_listsoftware(core_options *options, const char *gamename) } /* 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 ) { /* 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 ) ) { @@ -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 */ 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 ) ) { @@ -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) { /* 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; 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(); 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); count++; - machine_config_free(config); + global_free(config); } if (!count) @@ -1455,7 +1455,7 @@ static void match_roms(core_options *options, const char *hash, int length, int /* iterate over drivers */ 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_source *source; @@ -1474,7 +1474,7 @@ static void match_roms(core_options *options, const char *hash, int length, int (*found)++; } - machine_config_free(config); + global_free(config); } softlist_match_roms( options, hash, length, found ); diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c index 7d00f073e06..b985502c234 100644 --- a/src/emu/debug/debugcmd.c +++ b/src/emu/debug/debugcmd.c @@ -366,7 +366,7 @@ void debug_command_init(running_machine *machine) 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 */ - machine->devicelist.debug_setup_all(); + machine->m_devicelist.debug_setup_all(); 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 */ - *result = machine->devicelist.find(CPU, cpunum); + *result = machine->m_devicelist.find(CPU, cpunum); if (*result != NULL) return TRUE; @@ -2499,7 +2499,7 @@ static void execute_snap(running_machine *machine, int ref, int params, const ch const char *filename = param[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)) { diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index 30b841e638c..7b00434fe39 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -2390,7 +2390,7 @@ static device_t *expression_get_device(running_machine *machine, const char *tag { 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) return device; diff --git a/src/emu/debug/dvdisasm.c b/src/emu/debug/dvdisasm.c index 71519698da9..3a22f0ba9b5 100644 --- a/src/emu/debug/dvdisasm.c +++ b/src/emu/debug/dvdisasm.c @@ -135,7 +135,7 @@ void debug_view_disasm::enumerate_sources() // iterate over devices with disassembly interfaces device_disasm_interface *dasm = NULL; 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()); m_source_list.append(*auto_alloc(&m_machine, debug_view_disasm_source(name, dasm->device()))); diff --git a/src/emu/debug/dvmemory.c b/src/emu/debug/dvmemory.c index 2f3e344f843..840c9c58944 100644 --- a/src/emu/debug/dvmemory.c +++ b/src/emu/debug/dvmemory.c @@ -153,7 +153,7 @@ void debug_view_memory::enumerate_sources() // first add all the devices' address spaces 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++) { const address_space *space = memintf->space(spacenum); diff --git a/src/emu/debug/dvstate.c b/src/emu/debug/dvstate.c index ad48812539d..52b04723f11 100644 --- a/src/emu/debug/dvstate.c +++ b/src/emu/debug/dvstate.c @@ -105,7 +105,7 @@ void debug_view_state::enumerate_sources() // iterate over devices that have state interfaces device_state_interface *state = NULL; 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()); m_source_list.append(*auto_alloc(&m_machine, debug_view_state_source(name, state->device()))); diff --git a/src/emu/devcpu.h b/src/emu/devcpu.h index 490d8c3f800..6a0d6352166 100644 --- a/src/emu/devcpu.h +++ b/src/emu/devcpu.h @@ -179,10 +179,10 @@ enum //************************************************************************** // device iteration helpers -#define cpu_count(config) (config)->devicelist.count(CPU) -#define cpu_first(config) (config)->devicelist.first(CPU) +#define cpu_count(config) (config)->m_devicelist.count(CPU) +#define cpu_first(config) (config)->m_devicelist.first(CPU) #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 diff --git a/src/emu/devimage.c b/src/emu/devimage.c index 750527f2fac..dcb4ea41b41 100644 --- a/src/emu/devimage.c +++ b/src/emu/devimage.c @@ -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) index = count; diff --git a/src/emu/devintrf.c b/src/emu/devintrf.c index ccf11dc242d..d3f8c960783 100644 --- a/src/emu/devintrf.c +++ b/src/emu/devintrf.c @@ -187,7 +187,7 @@ void device_list::reset_all() 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) { - 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_static_config(NULL), m_name(name), - m_tag(tag) + m_tag(tag), + m_config_complete(false) { 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), m_machine(_machine), 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_started(false), m_clock(config.m_clock), diff --git a/src/emu/devintrf.h b/src/emu/devintrf.h index f54a0550332..44398b2a784 100644 --- a/src/emu/devintrf.h +++ b/src/emu/devintrf.h @@ -224,6 +224,7 @@ class device_config { DISABLE_COPYING(device_config); + friend class machine_config; friend class device_t; friend class device_config_interface; template<class T> friend class tagged_list; @@ -300,6 +301,7 @@ protected: private: astring m_tag; // tag for this instance + bool m_config_complete; // have we completed our configuration? }; diff --git a/src/emu/diexec.c b/src/emu/diexec.c index 03d40e2a96c..16ee47f37c4 100644 --- a/src/emu/diexec.c +++ b/src/emu/diexec.c @@ -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()); 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); error = true; @@ -536,7 +536,7 @@ void device_execute_interface::execute_set_input(int linenum, int state) void device_execute_interface::interface_pre_start() { // 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_profiler = index + PROFILER_DEVICE_FIRST; m_inttrigger = index + TRIGGER_INT; @@ -699,7 +699,7 @@ void device_execute_interface::static_on_vblank(screen_device &screen, void *par if (vblank_state) { 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); } } diff --git a/src/emu/dimemory.c b/src/emu/dimemory.c index 1eaced8acc3..f076d6c87f3 100644 --- a/src/emu/dimemory.c +++ b/src/emu/dimemory.c @@ -287,8 +287,8 @@ bool device_config_memory_interface::interface_validity_check(const game_driver } // 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) || - (entry->write.type == AMH_DEVICE_HANDLER && entry->write.tag != NULL && m_machine_config.devicelist.find(entry->write.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.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); error = true; diff --git a/src/emu/disound.c b/src/emu/disound.c index 276cef295e8..fefe0953191 100644 --- a/src/emu/disound.c +++ b/src/emu/disound.c @@ -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) { // 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) { mame_printf_error("%s: %s attempting to route sound to non-existant device '%s'\n", driver.source_file, driver.name, route->m_target); diff --git a/src/emu/drawgfx.c b/src/emu/drawgfx.c index 50ab3455ccb..be4c858bb4f 100644 --- a/src/emu/drawgfx.c +++ b/src/emu/drawgfx.c @@ -81,7 +81,7 @@ INLINE INT32 normalize_yscroll(bitmap_t *bitmap, INT32 yscroll) 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; /* 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_depth = 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; diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c index 0d2b5b90447..803204f8c22 100644 --- a/src/emu/emuopts.c +++ b/src/emu/emuopts.c @@ -236,11 +236,11 @@ void image_add_device_options(core_options *opts, const game_driver *driver) const device_config_image_interface *image = NULL; /* create the configuration */ - config = machine_config_alloc(driver->machine_config); + config = global_alloc(machine_config(driver->machine_config)); /* enumerate our callback for every device */ /* 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]; 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); /* free the configuration */ - machine_config_free(config); + global_free(config); } /*------------------------------------------------- diff --git a/src/emu/emupal.c b/src/emu/emupal.c index 166cf8fe82f..a62ccd65f70 100644 --- a/src/emu/emupal.c +++ b/src/emu/emupal.c @@ -120,7 +120,7 @@ void palette_init(running_machine *machine) case BITMAP_FORMAT_INVALID: /* invalid format means no palette - or at least it should */ - assert(machine->config->total_colors == 0); + assert(machine->total_colors() == 0); return; default: @@ -129,7 +129,7 @@ void palette_init(running_machine *machine) } /* allocate all the data structures */ - if (machine->config->total_colors > 0) + if (machine->total_colors() > 0) { int numcolors; @@ -327,7 +327,7 @@ colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize) /* fill in the basics */ ctable->machine = machine; - ctable->entries = machine->config->total_colors; + ctable->entries = machine->total_colors(); ctable->palentries = palettesize; /* 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 */ numgroups = 1; - if (machine->config->video_attributes & VIDEO_HAS_SHADOWS) + if (machine->config->m_video_attributes & VIDEO_HAS_SHADOWS) 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++; - 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 */ - 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"); /* 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); /* 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))); /* 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) { /* 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); 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; 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 */ @@ -703,7 +703,7 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa } /* 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); 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; 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 */ diff --git a/src/emu/image.c b/src/emu/image.c index 29ac173117c..8e7d6233d55 100644 --- a/src/emu/image.c +++ b/src/emu/image.c @@ -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')) { - 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())) { 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 */ 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(); @@ -163,7 +163,7 @@ static void image_options_extract(running_machine *machine) int index = 0; 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(); @@ -191,7 +191,7 @@ void image_unload_all(running_machine *machine) // extract the options 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 image->unload(); @@ -208,7 +208,7 @@ void image_device_init(running_machine *machine) device_image_interface *image = NULL; /* 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 */ image_name = image_get_device_option(image); @@ -258,7 +258,7 @@ void image_postdevice_init(running_machine *machine) device_image_interface *image = NULL; /* 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(); /* did the image load fail? */ @@ -390,7 +390,7 @@ astring *image_info_astring(running_machine *machine, astring *string) } #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(); if (name != NULL) @@ -490,7 +490,7 @@ device_image_interface *image_from_absolute_index(running_machine *machine, int device_image_interface *image = NULL; int cnt = 0; /* 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; cnt++; diff --git a/src/emu/info.c b/src/emu/info.c index a9587984d4d..2cda98b9312 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -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); 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 */ 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) - machine_config_free(pconfig); + global_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; - 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) { 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; /* 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) { 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 */ 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, " 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 */ const device_config_sound_interface *sound = NULL; - if (!config->devicelist.first(sound)) + if (!config->m_devicelist.first(sound)) speakers = 0; 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 fprintf(out, " savestate=\"unsupported\""); - fprintf(out, " palettesize=\"%d\"", config->total_colors); + fprintf(out, " palettesize=\"%d\"", config->m_total_colors); 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 *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 */ 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) { - 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 ) ) { @@ -957,7 +956,7 @@ static void print_game_info(FILE *out, const game_driver *game) return; /* 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); /* 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 */ fprintf(out, "\t</" XML_TOP ">\n"); - machine_config_free(config); + global_free(config); } diff --git a/src/emu/machine/6532riot.c b/src/emu/machine/6532riot.c index 2dfbb37aff6..63ec4324ad6 100644 --- a/src/emu/machine/6532riot.c +++ b/src/emu/machine/6532riot.c @@ -432,7 +432,7 @@ static DEVICE_START( riot6532 ) /* set static values */ riot->device = device; 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 */ devcb_resolve_read8(&riot->port[0].in_func, &riot->intf->in_a_func, device); diff --git a/src/emu/machine/generic.c b/src/emu/machine/generic.c index eea222fdf38..21f131d1314 100644 --- a/src/emu/machine/generic.c +++ b/src/emu/machine/generic.c @@ -109,7 +109,7 @@ void generic_machine_init(running_machine *machine) config_register(machine, "counters", counters_load, counters_save); /* 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); 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 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; // 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) { // read data from general NVRAM handler first - if (machine->config->nvram_handler != NULL) - (*machine->config->nvram_handler)(machine, nvram_file, FALSE); + if (machine->config->m_nvram_handler != NULL) + (*machine->config->m_nvram_handler)(machine, nvram_file, FALSE); // find all devices with NVRAM handlers, and read from them next for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram)) @@ -352,8 +352,8 @@ void nvram_load(running_machine *machine) else { // initialize via the general NVRAM handler first - if (machine->config->nvram_handler != NULL) - (*machine->config->nvram_handler)(machine, NULL, FALSE); + if (machine->config->m_nvram_handler != NULL) + (*machine->config->m_nvram_handler)(machine, NULL, FALSE); // find all devices with NVRAM handlers, and read from them next 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 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; // 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) { // write data via general NVRAM handler first - if (machine->config->nvram_handler != NULL) - (*machine->config->nvram_handler)(machine, nvram_file, TRUE); + if (machine->config->m_nvram_handler != NULL) + (*machine->config->m_nvram_handler)(machine, nvram_file, TRUE); // find all devices with NVRAM handlers, and tell them to write next 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; /* initialize and then save the card */ - if (machine->config->memcard_handler) - (*machine->config->memcard_handler)(machine, file, MEMCARD_CREATE); + if (machine->config->m_memcard_handler) + (*machine->config->m_memcard_handler)(machine, file, MEMCARD_CREATE); /* close the file */ mame_fclose(file); @@ -534,8 +534,8 @@ int memcard_insert(running_machine *machine, int index) return 1; /* initialize and then load the card */ - if (machine->config->memcard_handler) - (*machine->config->memcard_handler)(machine, file, MEMCARD_INSERT); + if (machine->config->m_memcard_handler) + (*machine->config->m_memcard_handler)(machine, file, MEMCARD_INSERT); /* close the file */ mame_fclose(file); @@ -573,8 +573,8 @@ void memcard_eject(running_machine *machine) } /* initialize and then load the card */ - if (machine->config->memcard_handler) - (*machine->config->memcard_handler)(machine, file, MEMCARD_EJECT); + if (machine->config->m_memcard_handler) + (*machine->config->m_memcard_handler)(machine, file, MEMCARD_EJECT); /* close the file */ mame_fclose(file); diff --git a/src/emu/machine/ldcore.c b/src/emu/machine/ldcore.c index beb1921bf1a..be05e09c543 100644 --- a/src/emu/machine/ldcore.c +++ b/src/emu/machine/ldcore.c @@ -1125,7 +1125,7 @@ static void configuration_save(running_machine *machine, int config_type, xml_da return; /* 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_state *ld = get_safe_token(device); @@ -1215,7 +1215,7 @@ void laserdisc_overlay_enable(running_device *device, int enable) VIDEO_UPDATE( laserdisc ) { - running_device *laserdisc = screen->machine->devicelist.first(LASERDISC); + running_device *laserdisc = screen->machine->m_devicelist.first(LASERDISC); if (laserdisc != NULL) { const rectangle &visarea = screen->visible_area(); diff --git a/src/emu/mame.c b/src/emu/mame.c index 2644ef3d471..c3bdd30899c 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -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 void init_machine(running_machine *machine); static TIMER_CALLBACK( soft_reset ); static void saveload_init(running_machine *machine); @@ -248,9 +247,12 @@ int mame_execute(core_options *options) options_revert(mame_options(), OPTION_PRIORITY_INI); 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 */ - machine = global_alloc(running_machine(driver)); + machine = global_alloc(running_machine(*driver, *config)); mame = machine->mame_data; /* start in the "pre-init phase" */ @@ -277,7 +279,7 @@ int mame_execute(core_options *options) } /* then finish setting up our local machine */ - init_machine(machine); + machine->start(); /* load the configuration settings and NVRAM */ settingsloaded = config_load_settings(machine); @@ -354,8 +356,9 @@ int mame_execute(core_options *options) } exit_pending = mame->exit_pending; - /* destroy the machine */ + /* destroy the machine and the config */ global_free(machine); + global_free(config); /* reset the options */ 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 "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)) if (devconfig->screen_type() == SCREEN_TYPE_VECTOR) { parse_ini_file(options, "vector", OPTION_PRIORITY_VECTOR_INI); break; } - machine_config_free(config); + global_free(config); /* next parse "source/<sourcefile>.ini"; if that doesn't exist, try <sourcefile>.ini */ 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 -------------------------------------------------*/ -running_machine::running_machine(const game_driver *driver) - : devicelist(respool), +running_machine::running_machine(const game_driver &driver, const machine_config &_config) + : m_devicelist(respool), scheduler(*this), - config(NULL), + config(&_config), + m_config(_config), firstcpu(NULL), - gamedrv(driver), + gamedrv(&driver), + m_game(driver), basename(NULL), primary_screen(NULL), palette(NULL), @@ -1280,15 +1285,14 @@ running_machine::running_machine(const game_driver *driver) mame_data = auto_alloc_clear(this, mame_private); /* initialize the driver-related variables in the machine */ - basename = mame_strdup(driver->name); - config = machine_config_alloc(driver->machine_config); + basename = mame_strdup(driver.name); /* 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) */ - if (config->driver_data_alloc != NULL) - driver_data = (*config->driver_data_alloc)(*this); + if (m_config.m_driver_data_alloc != NULL) + driver_data = (*m_config.m_driver_data_alloc)(*this); /* find devices */ firstcpu = cpu_first(this); @@ -1305,8 +1309,6 @@ running_machine::running_machine(const game_driver *driver) { if (driver_data != NULL) auto_free(this, driver_data); - if (config != NULL) - machine_config_free((machine_config *)config); if (basename != NULL) osd_free(basename); if (mame_data != NULL) @@ -1323,8 +1325,6 @@ running_machine::~running_machine() { assert(this == global_machine); - if (config != NULL) - machine_config_free((machine_config *)config); if (basename != NULL) 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; - time_t newbase; - - /* initialize basic can't-fail systems here */ - fileio_init(machine); - config_init(machine); - input_init(machine); - 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 */ - /* this must be done before cpu_init so that CPU's can allocate timers */ - timer_init(machine); - mame->soft_reset_timer = timer_alloc(machine, soft_reset, NULL); - - /* init the osd layer */ - osd_init(machine); - - /* initialize the base time (needed for doing record/playback) */ - time(&mame->base_time); - - /* initialize the input system and input ports for the game */ - /* 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); + // initialize basic can't-fail systems here + 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 the timers and allocate a soft_reset timer + // this must be done before cpu_init so that CPU's can allocate timers + timer_init(this); + mame_data->soft_reset_timer = timer_alloc(this, soft_reset, NULL); + + // init the osd layer + osd_init(this); + + // initialize the base time (needed for doing record/playback) + time(&mame_data->base_time); + + // initialize the input system and input ports for the game + // this must be done before memory_init in order to allow specifying + // callbacks based on input port tags + time_t newbase = input_port_init(this, m_game.ipt); if (newbase != 0) - mame->base_time = newbase; + mame_data->base_time = newbase; - /* intialize UI input */ - ui_input_init(machine); + // intialize UI input + ui_input_init(this); - /* initialize the streams engine before the sound devices start */ - streams_init(machine); + // initialize the streams engine before the sound devices start + streams_init(this); - /* first load ROMs, then populate memory, and finally initialize CPUs */ - /* these operations must proceed in this order */ - rom_init(machine); - memory_init(machine); - watchdog_init(machine); + // first load ROMs, then populate memory, and finally initialize CPUs + // these operations must proceed in this order + rom_init(this); + memory_init(this); + watchdog_init(this); - /* allocate the gfx elements prior to device initialization */ - gfx_init(machine); + // allocate the gfx elements prior to device initialization + gfx_init(this); - /* initialize natural keyboard support */ - inputx_init(machine); + // initialize natural keyboard support + inputx_init(this); - /* initialize image devices */ - image_init(machine); + // initialize image devices + image_init(this); - /* start up the devices */ - machine->devicelist.start_all(); + // start up the devices + m_devicelist.start_all(); - /* finish image devices init process*/ - image_postdevice_init(machine); - - /* call the game driver's init function */ - /* this is where decryption is done and memory maps are altered */ - /* so this location in the init order is important */ - ui_set_startup_text(machine, "Initializing...", TRUE); - if (machine->gamedrv->driver_init != NULL) - (*machine->gamedrv->driver_init)(machine); - - /* start the video and audio hardware */ - video_init(machine); - tilemap_init(machine); - crosshair_init(machine); - - sound_init(machine); - - /* initialize the debugger */ - if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) - debugger_init(machine); - - /* call the driver's _START callbacks */ - if (machine->config->machine_start != NULL) - (*machine->config->machine_start)(machine); - if (machine->config->sound_start != NULL) - (*machine->config->sound_start)(machine); - if (machine->config->video_start != NULL) - (*machine->config->video_start)(machine); - - /* initialize miscellaneous systems */ - saveload_init(machine); + // finish image devices init process + image_postdevice_init(this); + + // call the game driver's init function + // this is where decryption is done and memory maps are altered + // so this location in the init order is important + ui_set_startup_text(this, "Initializing...", true); + if (m_game.driver_init != NULL) + (*m_game.driver_init)(this); + + // start the video and audio hardware + video_init(this); + tilemap_init(this); + crosshair_init(this); + + sound_init(this); + + // initialize the debugger + if ((debug_flags & DEBUG_FLAG_ENABLED) != 0) + debugger_init(this); + + // call the driver's _START callbacks + if (m_config.m_machine_start != NULL) + (*m_config.m_machine_start)(this); + if (m_config.m_sound_start != NULL) + (*m_config.m_sound_start)(this); + if (m_config.m_video_start != NULL) + (*m_config.m_video_start)(this); + + // initialize miscellaneous systems + saveload_init(this); if (options_get_bool(mame_options(), OPTION_CHEAT)) - cheat_init(machine); + cheat_init(this); - /* disallow save state registrations starting here */ - state_save_allow_registration(machine, FALSE); + // disallow save state registrations starting here + state_save_allow_registration(this, false); } @@ -1482,12 +1479,12 @@ static TIMER_CALLBACK( soft_reset ) (*cb->func.reset)(machine); /* run the driver's reset callbacks */ - if (machine->config->machine_reset != NULL) - (*machine->config->machine_reset)(machine); - if (machine->config->sound_reset != NULL) - (*machine->config->sound_reset)(machine); - if (machine->config->video_reset != NULL) - (*machine->config->video_reset)(machine); + if (machine->config->m_machine_reset != NULL) + (*machine->config->m_machine_reset)(machine); + if (machine->config->m_sound_reset != NULL) + (*machine->config->m_sound_reset)(machine); + if (machine->config->m_video_reset != NULL) + (*machine->config->m_video_reset)(machine); /* now we're running */ mame->current_phase = MAME_PHASE_RUNNING; diff --git a/src/emu/mame.h b/src/emu/mame.h index f8bccd0760a..0cf319fc03a 100644 --- a/src/emu/mame.h +++ b/src/emu/mame.h @@ -198,8 +198,7 @@ public: /* 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 */ UINT32 nvram_size; @@ -223,23 +222,29 @@ class running_machine DISABLE_COPYING(running_machine); public: - running_machine(const game_driver *driver); + running_machine(const game_driver &driver, const machine_config &config); ~running_machine(); + + void start(); inline device_t *device(const char *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 region_info *region(const char *tag); + + // configuration helpers + UINT32 total_colors() const { return m_config.m_total_colors; } const char *describe_context(); resource_pool respool; // pool of resources for this machine 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 /* configuration data */ 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 */ /* CPU information */ @@ -247,11 +252,12 @@ public: /* game-related information */ 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 */ /* video-related information */ 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-related information */ @@ -298,7 +304,7 @@ public: void * driver_data; /* drivers can hang data off of here instead of using globals */ 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) { - return devicelist.find(tag); + return m_devicelist.find(tag); } inline const input_port_config *running_machine::port(const char *tag) diff --git a/src/emu/mconfig.c b/src/emu/mconfig.c index 22a8240faa3..cdae9af9cb3 100644 --- a/src/emu/mconfig.c +++ b/src/emu/mconfig.c @@ -4,8 +4,36 @@ 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> -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - -static void machine_config_detokenize(machine_config *config, const machine_config_token *tokens, const device_config *owner); - - - -/*************************************************************************** - MACHINE CONFIGURATIONS -***************************************************************************/ - -/*------------------------------------------------- - machine_config_alloc - allocate a new - machine configuration and populate it using - the supplied constructor --------------------------------------------------*/ - -machine_config *machine_config_alloc(const machine_config_token *tokens) +//************************************************************************** +// MACHINE CONFIGURATIONS +//************************************************************************** + +//------------------------------------------------- +// machine_config - constructor +//------------------------------------------------- + +machine_config::machine_config(const machine_config_token *tokens) + : m_driver_data_alloc(NULL), + m_minimum_quantum(attotime_zero), + m_perfect_cpu_quantum(NULL), + m_watchdog_vblank_count(0), + m_watchdog_time(attotime_zero), + m_machine_start(NULL), + m_machine_reset(NULL), + m_nvram_handler(NULL), + m_memcard_handler(NULL), + m_video_attributes(0), + m_gfxdecodeinfo(NULL), + 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; - - /* 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; + // parse tokens into the config + detokenize(tokens); } -/*------------------------------------------------- - machine_config_free - release memory allocated - for a machine configuration --------------------------------------------------*/ +//------------------------------------------------- +// ~machine_config - destructor +//------------------------------------------------- -void machine_config_free(machine_config *config) +machine_config::~machine_config() { - /* release the configuration itself */ - global_free(config); } -/*------------------------------------------------- - machine_config_detokenize - detokenize a - machine config --------------------------------------------------*/ +//------------------------------------------------- +// detokenize - detokenize a 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; 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) { device_type devtype; @@ -88,26 +107,26 @@ static void machine_config_detokenize(machine_config *config, const machine_conf UINT64 data64; UINT32 clock; - /* unpack the token from the first entry */ + // unpack the token from the first entry TOKEN_GET_UINT32_UNPACK1(tokens, entrytype, 8); switch (entrytype) { - /* end */ + // end case MCONFIG_TOKEN_END: break; - /* including */ + // including case MCONFIG_TOKEN_INCLUDE: - machine_config_detokenize(config, TOKEN_GET_PTR(tokens, tokenptr), owner); + detokenize(TOKEN_GET_PTR(tokens, tokenptr), owner); break; - /* device management */ + // device management case MCONFIG_TOKEN_DEVICE_ADD: TOKEN_UNGET_UINT32(tokens); TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, clock, 32); devtype = TOKEN_GET_PTR(tokens, devtype); 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; 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); devtype = TOKEN_GET_PTR(tokens, devtype); 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; case MCONFIG_TOKEN_DEVICE_REMOVE: tag = TOKEN_GET_STRING(tokens); - config->devicelist.remove(owner->subtag(tempstring, tag)); + m_devicelist.remove(owner->subtag(tempstring, tag)); device = NULL; break; case MCONFIG_TOKEN_DEVICE_MODIFY: tag = TOKEN_GET_STRING(tokens); - device = config->devicelist.find(owner->subtag(tempstring, tag)); + device = m_devicelist.find(owner->subtag(tempstring, tag)); if (device == NULL) fatalerror("Unable to find device: tag=%s\n", tempstring.cstr()); break; @@ -164,94 +183,94 @@ static void machine_config_detokenize(machine_config *config, const machine_conf break; - /* core parameters */ + // core parameters 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; case MCONFIG_TOKEN_QUANTUM_TIME: TOKEN_EXTRACT_UINT64(tokens, data64); - config->minimum_quantum = UINT64_ATTOTIME_TO_ATTOTIME(data64); + m_minimum_quantum = UINT64_ATTOTIME_TO_ATTOTIME(data64); break; case MCONFIG_TOKEN_QUANTUM_PERFECT_CPU: - config->perfect_cpu_quantum = TOKEN_GET_STRING(tokens); + m_perfect_cpu_quantum = TOKEN_GET_STRING(tokens); break; case MCONFIG_TOKEN_WATCHDOG_VBLANK: 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; case MCONFIG_TOKEN_WATCHDOG_TIME: TOKEN_EXTRACT_UINT64(tokens, data64); - config->watchdog_time = UINT64_ATTOTIME_TO_ATTOTIME(data64); + m_watchdog_time = UINT64_ATTOTIME_TO_ATTOTIME(data64); break; - /* core functions */ + // core functions case MCONFIG_TOKEN_MACHINE_START: - config->machine_start = TOKEN_GET_PTR(tokens, machine_start); + m_machine_start = TOKEN_GET_PTR(tokens, machine_start); break; case MCONFIG_TOKEN_MACHINE_RESET: - config->machine_reset = TOKEN_GET_PTR(tokens, machine_reset); + m_machine_reset = TOKEN_GET_PTR(tokens, machine_reset); break; case MCONFIG_TOKEN_NVRAM_HANDLER: - config->nvram_handler = TOKEN_GET_PTR(tokens, nvram_handler); + m_nvram_handler = TOKEN_GET_PTR(tokens, nvram_handler); break; case MCONFIG_TOKEN_MEMCARD_HANDLER: - config->memcard_handler = TOKEN_GET_PTR(tokens, memcard_handler); + m_memcard_handler = TOKEN_GET_PTR(tokens, memcard_handler); break; - /* core video parameters */ + // core video parameters case MCONFIG_TOKEN_VIDEO_ATTRIBUTES: 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; case MCONFIG_TOKEN_GFXDECODE: - config->gfxdecodeinfo = TOKEN_GET_PTR(tokens, gfxdecode); + m_gfxdecodeinfo = TOKEN_GET_PTR(tokens, gfxdecode); break; case MCONFIG_TOKEN_PALETTE_LENGTH: 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; case MCONFIG_TOKEN_DEFAULT_LAYOUT: - config->default_layout = TOKEN_GET_STRING(tokens); + m_default_layout = TOKEN_GET_STRING(tokens); break; - /* core video functions */ + // core video functions case MCONFIG_TOKEN_PALETTE_INIT: - config->init_palette = TOKEN_GET_PTR(tokens, palette_init); + m_init_palette = TOKEN_GET_PTR(tokens, palette_init); break; case MCONFIG_TOKEN_VIDEO_START: - config->video_start = TOKEN_GET_PTR(tokens, video_start); + m_video_start = TOKEN_GET_PTR(tokens, video_start); break; case MCONFIG_TOKEN_VIDEO_RESET: - config->video_reset = TOKEN_GET_PTR(tokens, video_reset); + m_video_reset = TOKEN_GET_PTR(tokens, video_reset); break; case MCONFIG_TOKEN_VIDEO_EOF: - config->video_eof = TOKEN_GET_PTR(tokens, video_eof); + m_video_eof = TOKEN_GET_PTR(tokens, video_eof); break; case MCONFIG_TOKEN_VIDEO_UPDATE: - config->video_update = TOKEN_GET_PTR(tokens, video_update); + m_video_update = TOKEN_GET_PTR(tokens, video_update); break; - /* core sound functions */ + // core sound functions case MCONFIG_TOKEN_SOUND_START: - config->sound_start = TOKEN_GET_PTR(tokens, sound_start); + m_sound_start = TOKEN_GET_PTR(tokens, sound_start); break; case MCONFIG_TOKEN_SOUND_RESET: - config->sound_reset = TOKEN_GET_PTR(tokens, sound_reset); + m_sound_reset = TOKEN_GET_PTR(tokens, sound_reset); break; default: @@ -259,4 +278,28 @@ static void machine_config_detokenize(machine_config *config, const machine_conf 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--; } diff --git a/src/emu/mconfig.h b/src/emu/mconfig.h index 7d57dd14ae4..5fb37662f35 100644 --- a/src/emu/mconfig.h +++ b/src/emu/mconfig.h @@ -4,8 +4,36 @@ 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) -/* NULL versions */ +// NULL versions #define nvram_handler_0 NULL #define memcard_handler_0 NULL #define machine_start_0 NULL @@ -97,12 +125,12 @@ typedef void * (*driver_data_alloc_func)(running_machine &machine); 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 MAX_TAG_LENGTH 15 -/* token types */ +// token types enum { 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_AFTER_VBLANK 0x0004 -/* indicates VIDEO_UPDATE will add container bits its */ +// indicates VIDEO_UPDATE will add container bits its #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 -/* 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 -/* 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 -/* 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 -/* 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 @@ -212,35 +240,47 @@ struct gfx_decode_entry; class machine_config { + DISABLE_COPYING(machine_config); + + friend class running_machine; + 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); + + driver_data_alloc_func m_driver_data_alloc; // allocator for driver data + + attotime m_minimum_quantum; // minimum scheduling quantum + 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 - attotime minimum_quantum; /* minimum scheduling quantum */ - 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 m_machine_start; // one-time machine start callback + machine_reset_func m_machine_reset; // machine reset callback - machine_start_func machine_start; /* one-time machine start callback */ - machine_reset_func machine_reset; /* machine reset callback */ + nvram_handler_func m_nvram_handler; // NVRAM save/load callback + memcard_handler_func m_memcard_handler; // memory card save/load callback - nvram_handler_func nvram_handler; /* NVRAM save/load callback */ - memcard_handler_func memcard_handler; /* memory card save/load callback */ + UINT32 m_video_attributes; // flags describing the video system + const gfx_decode_entry *m_gfxdecodeinfo; // pointer to array of graphics decoding information + UINT32 m_total_colors; // total number of colors in the palette + const char * m_default_layout; // default layout for this machine - UINT32 video_attributes; /* flags describing the video system */ - const gfx_decode_entry *gfxdecodeinfo; /* pointer to array of graphics decoding information */ - UINT32 total_colors; /* total number of colors in the palette */ - const char * default_layout; /* default layout for this machine */ + palette_init_func m_init_palette; // one-time palette init 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 - palette_init_func init_palette; /* one-time palette init callback */ - video_start_func video_start; /* one-time video start callback */ - video_reset_func video_reset; /* video reset callback */ - video_eof_func video_eof; /* end-of-frame video callback */ - video_update_func video_update; /* video update callback */ + sound_start_func m_sound_start; // one-time sound start callback + sound_reset_func m_sound_reset; // sound reset callback - sound_start_func sound_start; /* one-time sound start callback */ - sound_reset_func sound_reset; /* sound reset callback */ + device_config_list m_devicelist; // list of device configs - device_config_list devicelist; /* list of device configs */ +private: + int m_parse_level; // nested parsing level }; @@ -249,7 +289,7 @@ public: 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 { 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 DEVCONFIG_OFFSETOF(_class, _member) \ @@ -284,7 +324,7 @@ union machine_config_token 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) \ machine_config_##_name @@ -294,21 +334,21 @@ union machine_config_token #define MACHINE_DRIVER_END \ 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) \ 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) \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_INCLUDE, 8), \ TOKEN_PTR(tokenptr, MACHINE_DRIVER_NAME(_name)), -/* core parameters */ +// core parameters #define MDRV_DRIVER_DATA(_class) \ 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) \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_QUANTUM_TIME, 8), \ @@ -326,7 +366,7 @@ union machine_config_token TOKEN_UINT64(UINT64_ATTOTIME_IN_##_time), -/* core functions */ +// core functions #define MDRV_MACHINE_START(_func) \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_MACHINE_START, 8), \ TOKEN_PTR(machine_start, MACHINE_START_NAME(_func)), @@ -344,7 +384,7 @@ union machine_config_token TOKEN_PTR(memcard_handler, MEMCARD_HANDLER_NAME(_func)), -/* core video parameters */ +// core video parameters #define MDRV_VIDEO_ATTRIBUTES(_flags) \ TOKEN_UINT32_PACK2(MCONFIG_TOKEN_VIDEO_ATTRIBUTES, 8, _flags, 24), @@ -360,7 +400,7 @@ union machine_config_token TOKEN_STRING(&(_layout)[0]), -/* core video functions */ +// core video functions #define MDRV_PALETTE_INIT(_func) \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_PALETTE_INIT, 8), \ TOKEN_PTR(palette_init, PALETTE_INIT_NAME(_func)), @@ -382,17 +422,17 @@ union machine_config_token TOKEN_PTR(video_update, VIDEO_UPDATE_NAME(_func)), -/* core sound functions */ +// core sound functions #define MDRV_SOUND_START(_func) \ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_START, 8), \ TOKEN_PTR(sound_start, SOUND_START_NAME(_func)), #define MDRV_SOUND_RESET(_func) \ 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) \ TOKEN_UINT64_PACK2(MCONFIG_TOKEN_DEVICE_ADD, 8, _clock, 32), \ TOKEN_PTR(devtype, _type), \ @@ -412,19 +452,4 @@ union machine_config_token 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__ */ diff --git a/src/emu/memory.c b/src/emu/memory.c index a9e7a417f78..18c52db8a4b 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -1691,7 +1691,7 @@ static void memory_init_spaces(running_machine *machine) /* loop over devices */ 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++) { const address_space_config *spaceconfig = memory->space_config(spacenum); diff --git a/src/emu/profiler.c b/src/emu/profiler.c index bac82b5f6e8..2be7d272457 100644 --- a/src/emu/profiler.c +++ b/src/emu/profiler.c @@ -186,7 +186,7 @@ astring &_profiler_get_text(running_machine *machine, astring &string) /* and then the text */ 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 for (nameindex = 0; nameindex < ARRAY_LENGTH(names); nameindex++) if (names[nameindex].type == curtype) diff --git a/src/emu/render.c b/src/emu/render.c index 48aae75a1b3..c306967b22c 100644 --- a/src/emu/render.c +++ b/src/emu/render.c @@ -964,7 +964,7 @@ int render_is_live_screen(device_t *screen) assert(screen->machine != 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); @@ -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) if (item->element == NULL) { - const screen_device_config *scrconfig = downcast<const screen_device_config *>(target->machine->config->devicelist.find(SCREEN, item->index)); - screen_device *screendev = downcast<screen_device *>(target->machine->devicelist.find(scrconfig->tag())); + 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->m_devicelist.find(scrconfig->tag())); const rectangle vectorvis = { 0, 639, 0, 479 }; const rectangle *visarea = NULL; 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) 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) nextfile = &(*nextfile)->next; } diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c index 5fda2726c65..2fab7342d58 100644 --- a/src/emu/rendlay.c +++ b/src/emu/rendlay.c @@ -1342,7 +1342,7 @@ static int get_variable_value(const machine_config *config, const char *string, /* screen 0 parameters */ 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 */ sprintf(temp, "~scr%dnativexaspect~", scrnum); diff --git a/src/emu/romload.c b/src/emu/romload.c index ebf18687066..3d0db9d4457 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -164,7 +164,7 @@ const rom_source *rom_first_source(const game_driver *drv, const machine_config /* otherwise, look through devices */ 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(); 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 (rom_source_is_gamedrv(drv, previous)) - devconfig = (config != NULL) ? config->devicelist.first() : NULL; + devconfig = (config != NULL) ? config->m_devicelist.first() : NULL; else devconfig = ((const device_config *)previous)->next(); diff --git a/src/emu/schedule.c b/src/emu/schedule.c index 53d68be72e6..04b6c330a26 100644 --- a/src/emu/schedule.c +++ b/src/emu/schedule.c @@ -373,22 +373,22 @@ void device_scheduler::rebuild_execute_list() if (!m_quantum_set) { // 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 (attotime_compare(min_quantum, attotime_zero) == 0) min_quantum = ATTOTIME_IN_HZ(60); // 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) - 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; 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()); 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 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 exec->m_nextexec = NULL; diff --git a/src/emu/softlist.c b/src/emu/softlist.c index 0e349f13795..0e6fac0b533 100644 --- a/src/emu/softlist.c +++ b/src/emu/softlist.c @@ -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; /* 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(); @@ -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 */ 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)) { diff --git a/src/emu/sound.c b/src/emu/sound.c index ac91ff0b813..6549f453413 100644 --- a/src/emu/sound.c +++ b/src/emu/sound.c @@ -190,7 +190,7 @@ static void route_sound(running_machine *machine) { /* iterate again over all the sound chips */ 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); @@ -233,7 +233,7 @@ static void sound_reset(running_machine *machine) device_sound_interface *sound = NULL; /* 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(); } @@ -554,7 +554,7 @@ void speaker_device::device_start() // scan all the sound devices and count our inputs int inputs = 0; 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 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; // 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 for (const device_config_sound_interface::sound_route *route = sound->sound_config().m_route_list; route != NULL; route = route->m_next) diff --git a/src/emu/sound.h b/src/emu/sound.h index feef7cf5041..67d7e6bd799 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -25,8 +25,8 @@ /* these functions are macros primarily due to include file ordering */ /* plus, they are very simple */ -#define speaker_output_count(config) (config)->devicelist.count(SPEAKER) -#define speaker_output_first(config) (config)->devicelist.first(SPEAKER) +#define speaker_output_count(config) (config)->m_devicelist.count(SPEAKER) +#define speaker_output_first(config) (config)->m_devicelist.first(SPEAKER) #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) { - 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) { - 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) { - 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) { - return downcast<speaker_device *>(machine.devicelist.first(SPEAKER)); + return downcast<speaker_device *>(machine.m_devicelist.first(SPEAKER)); } diff --git a/src/emu/sound/cdda.c b/src/emu/sound/cdda.c index 0f1b9317131..1824604bdcb 100644 --- a/src/emu/sound/cdda.c +++ b/src/emu/sound/cdda.c @@ -93,7 +93,7 @@ running_device *cdda_from_cdrom(running_machine *machine, void *file) { 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) { cdda_info *info = get_safe_token(*sound); diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c index 7ba69bef6b5..47d722ad1d4 100644 --- a/src/emu/sound/scsp.c +++ b/src/emu/sound/scsp.c @@ -1216,7 +1216,7 @@ static void dma_scsp(const address_space *space, struct _SCSP *SCSP) /*Job done,request a dma end irq*/ 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 diff --git a/src/emu/ui.c b/src/emu/ui.c index d2ba655a1fb..799eb540b89 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -1035,7 +1035,7 @@ astring &game_info_astring(running_machine *machine, astring &string) /* loop over all sound chips */ 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 */ if (!found_sound) @@ -1272,7 +1272,7 @@ void ui_image_handler_ingame(running_machine *machine) /* run display routine for devices */ 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(); } @@ -1695,7 +1695,7 @@ static slider_state *slider_init(running_machine *machine) 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(); 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) { - int ldcount = laserdisc->machine->devicelist.count(LASERDISC); + int ldcount = laserdisc->machine->m_devicelist.count(LASERDISC); static char descbuf[256]; if (ldcount > 1) diff --git a/src/emu/uigfx.c b/src/emu/uigfx.c index bbaeb48f3f6..cb3536a4899 100644 --- a/src/emu/uigfx.c +++ b/src/emu/uigfx.c @@ -155,7 +155,7 @@ UINT32 ui_gfx_ui_handler(running_machine *machine, render_container *container, ui_gfx_state *state = &ui_gfx; /* 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; /* if we're not paused, mark the bitmap dirty */ @@ -168,7 +168,7 @@ again: { case 0: /* if we have a palette, display it */ - if (machine->config->total_colors > 0) + if (machine->total_colors() > 0) { palette_handler(machine, container, state); break; @@ -235,7 +235,7 @@ cancel: 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 rgb_t *raw_color = palette_entry_list_raw(machine->palette); 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); /* 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 */ 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 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 palette_mask = ~0; int x, y; diff --git a/src/emu/uiimage.c b/src/emu/uiimage.c index 06f2752c5a7..14559c6e8b1 100644 --- a/src/emu/uiimage.c +++ b/src/emu/uiimage.c @@ -893,7 +893,7 @@ static void menu_file_manager_populate(running_machine *machine, ui_menu *menu, const char *entry_basename; /* 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 */ snprintf(buffer, ARRAY_LENGTH(buffer), diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index 57d31a0dec8..997c7fc0121 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -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); device_image_interface *image = NULL; - if (machine->devicelist.first(image)) + if (machine->m_devicelist.first(image)) { /* add image info menu */ 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); /* 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); /* add reset and exit menus */ diff --git a/src/emu/validity.c b/src/emu/validity.c index 76f81929fa7..37cb0806c40 100644 --- a/src/emu/validity.c +++ b/src/emu/validity.c @@ -418,7 +418,7 @@ static bool validate_driver(int drivnum, const machine_config *config, game_driv /* make sure sound-less drivers are flagged */ 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); error = true; @@ -602,7 +602,7 @@ static bool validate_display(int drivnum, const machine_config *config) palette_modes = true; /* 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); error = true; @@ -624,16 +624,16 @@ static bool validate_gfx(int drivnum, const machine_config *config, region_array int gfxnum; /* bail if no gfx */ - if (!config->gfxdecodeinfo) + if (!config->m_gfxdecodeinfo) return false; /* 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; - int xscale = (config->gfxdecodeinfo[gfxnum].xscale == 0) ? 1 : config->gfxdecodeinfo[gfxnum].xscale; - int yscale = (config->gfxdecodeinfo[gfxnum].yscale == 0) ? 1 : config->gfxdecodeinfo[gfxnum].yscale; + int xscale = (config->m_gfxdecodeinfo[gfxnum].xscale == 0) ? 1 : config->m_gfxdecodeinfo[gfxnum].xscale; + int yscale = (config->m_gfxdecodeinfo[gfxnum].yscale == 0) ? 1 : config->m_gfxdecodeinfo[gfxnum].yscale; const gfx_layout *gl = gfx->gfxlayout; int israw = (gl->planeoffset[0] == GFX_RAW); int planes = gl->planes; @@ -1094,14 +1094,14 @@ static bool validate_devices(int drivnum, const machine_config *config, const io bool error = false; 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 */ if (!validate_tag(driver, devconfig->name(), devconfig->tag())) error = true; /* 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) { 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 */ expansion -= get_profile_ticks(); - config = machine_config_alloc(driver->machine_config); + config = global_alloc(machine_config(driver->machine_config)); expansion += get_profile_ticks(); /* validate the driver entry */ @@ -1230,7 +1230,7 @@ bool mame_validitychecks(const game_driver *curdriver) error = validate_devices(drivnum, config, portlist, &rgninfo) || error; device_checks += get_profile_ticks(); - machine_config_free(config); + global_free(config); } #if (REPORT_TIMES) diff --git a/src/emu/video.c b/src/emu/video.c index 8dc476015be..5e3efd40e05 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -293,12 +293,12 @@ void video_init(running_machine *machine) global.seconds_to_run = options_get_int(mame_options(), OPTION_SECONDS_TO_RUN); /* 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); /* call the PALETTE_INIT function */ - if (machine->config->init_palette != NULL) - (*machine->config->init_palette)(machine, memory_region(machine, "proms")); + if (machine->config->m_init_palette != NULL) + (*machine->config->m_init_palette)(machine, memory_region(machine, "proms")); /* create a render target for snapshots */ 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(); /* 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); - (*machine->config->video_eof)(machine); + (*machine->config->m_video_eof)(machine); profiler_mark_end(); } } @@ -1131,7 +1131,7 @@ void screen_save_snapshot(running_machine *machine, device_t *screen, mame_file /* now do the actual work */ 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 */ png_free(&pnginfo); @@ -1195,7 +1195,7 @@ static void create_snapshot_bitmap(device_t *screen) /* select the appropriate view in our dummy target */ 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); 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 */ 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); if (error != PNGERR_NONE) { @@ -1881,7 +1881,7 @@ void screen_device::device_start() m_scanline0_timer = timer_alloc(machine, static_scanline0_callback, (void *)this); // 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); // 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); // 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); // 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)); // 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 (global.skipping_this_frame) @@ -2125,8 +2125,8 @@ bool screen_device::update_partial(int scanline) profiler_mark_start(PROFILER_VIDEO); LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.min_y, clip.max_y)); - if (machine->config->video_update != NULL) - flags = (*machine->config->video_update)(this, m_bitmap[m_curbitmap], &clip); + if (machine->config->m_video_update != NULL) + flags = (*machine->config->m_video_update)(this, m_bitmap[m_curbitmap], &clip); global.partial_updates_this_frame++; profiler_mark_end(); @@ -2301,7 +2301,7 @@ void screen_device::vblank_begin_callback() (*item->m_callback)(*this, item->m_param, true); // 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); // 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); // 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); // increment the frame number counter @@ -2379,7 +2379,7 @@ bool screen_device::update_quads() if (render_is_live_screen(this)) { // 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 (!global.skipping_this_frame && m_changed) diff --git a/src/emu/video.h b/src/emu/video.h index 6ef4d8e9242..1d6db728e13 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -181,7 +181,7 @@ public: 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_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 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; } @@ -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) { - 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) { - 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) { - 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) { - return downcast<screen_device *>(machine.devicelist.first(SCREEN)); + return downcast<screen_device *>(machine.m_devicelist.first(SCREEN)); } diff --git a/src/emu/video/generic.c b/src/emu/video/generic.c index ca84201e90e..da8a75d69f3 100644 --- a/src/emu/video/generic.c +++ b/src/emu/video/generic.c @@ -523,7 +523,7 @@ PALETTE_INIT( all_black ) { 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 */ } @@ -577,7 +577,7 @@ PALETTE_INIT( RRRR_GGGG_BBBB ) { 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; @@ -589,17 +589,17 @@ PALETTE_INIT( RRRR_GGGG_BBBB ) r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* green component */ - bit0 = (color_prom[i + machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[i + machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[i + machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[i + machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[i + machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[i + machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[i + machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[i + machine->total_colors()] >> 3) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* blue component */ - bit0 = (color_prom[i + 2*machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[i + 2*machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[i + 2*machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[i + 2*machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[i + 2*machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[i + 2*machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[i + 2*machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[i + 2*machine->total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine,i,MAKE_RGB(r,g,b)); diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index 38192c4981a..e2ff9976335 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -4537,7 +4537,7 @@ static DEVICE_START( voodoo ) } /* 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)); assert_always(v->screen != NULL, "Unable to find screen attached to voodoo"); v->cpu = device->machine->device(config->cputag); diff --git a/src/emu/watchdog.c b/src/emu/watchdog.c index 7fd7aaaa90a..e52282cefef 100644 --- a/src/emu/watchdog.c +++ b/src/emu/watchdog.c @@ -57,7 +57,7 @@ void watchdog_init(running_machine *machine) static void watchdog_internal_reset(running_machine *machine) { /* 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_enabled = TRUE; } @@ -90,7 +90,7 @@ static void on_vblank(screen_device &screen, void *param, bool vblank_state) if (vblank_state && watchdog_enabled) { /* 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; @@ -112,9 +112,9 @@ void watchdog_reset(running_machine *machine) timer_adjust_oneshot(watchdog_timer, attotime_never, 0); /* 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 */ if (machine->primary_screen != NULL) @@ -122,8 +122,8 @@ void watchdog_reset(running_machine *machine) } /* timer-based watchdog? */ - else if (attotime_compare(machine->config->watchdog_time, attotime_zero) != 0) - timer_adjust_oneshot(watchdog_timer, machine->config->watchdog_time, 0); + else if (attotime_compare(machine->config->m_watchdog_time, attotime_zero) != 0) + timer_adjust_oneshot(watchdog_timer, machine->config->m_watchdog_time, 0); /* default to an obscene amount of time (3 seconds) */ else diff --git a/src/ldplayer/ldplayer.c b/src/ldplayer/ldplayer.c index 958d93e103a..605544e5866 100644 --- a/src/ldplayer/ldplayer.c +++ b/src/ldplayer/ldplayer.c @@ -227,7 +227,7 @@ static void process_commands(running_device *laserdisc) static TIMER_CALLBACK( vsync_update ) { - running_device *laserdisc = machine->devicelist.first(LASERDISC); + running_device *laserdisc = machine->m_devicelist.first(LASERDISC); int vblank_scanline; attotime target; @@ -250,7 +250,7 @@ static MACHINE_START( ldplayer ) static TIMER_CALLBACK( autoplay ) { - running_device *laserdisc = machine->devicelist.first(LASERDISC); + running_device *laserdisc = machine->m_devicelist.first(LASERDISC); /* start playing */ (*execute_command)(laserdisc, CMD_PLAY); @@ -323,7 +323,7 @@ static TIMER_CALLBACK( pr8210_bit_callback ) static MACHINE_START( pr8210 ) { - running_device *laserdisc = machine->devicelist.first(LASERDISC); + running_device *laserdisc = machine->m_devicelist.first(LASERDISC); MACHINE_START_CALL(ldplayer); pr8210_bit_timer = timer_alloc(machine, pr8210_bit_callback, (void *)laserdisc); } diff --git a/src/mame/drivers/5clown.c b/src/mame/drivers/5clown.c index b688ef9d21e..27deabd8d72 100644 --- a/src/mame/drivers/5clown.c +++ b/src/mame/drivers/5clown.c @@ -527,7 +527,7 @@ static PALETTE_INIT( fclown ) 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; diff --git a/src/mame/drivers/86lions.c b/src/mame/drivers/86lions.c index dcdeeba695f..9bc3fd4a91a 100644 --- a/src/mame/drivers/86lions.c +++ b/src/mame/drivers/86lions.c @@ -333,7 +333,7 @@ static PALETTE_INIT( lions ) { 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; diff --git a/src/mame/drivers/adp.c b/src/mame/drivers/adp.c index 27cf4312fb2..cd4cfd1d61f 100644 --- a/src/mame/drivers/adp.c +++ b/src/mame/drivers/adp.c @@ -259,7 +259,7 @@ static PALETTE_INIT( adp ) { 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; diff --git a/src/mame/drivers/aristmk4.c b/src/mame/drivers/aristmk4.c index bfcce6de684..e5627df6cd4 100644 --- a/src/mame/drivers/aristmk4.c +++ b/src/mame/drivers/aristmk4.c @@ -1109,7 +1109,7 @@ static PALETTE_INIT( aristmk4 ) { 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; diff --git a/src/mame/drivers/cardline.c b/src/mame/drivers/cardline.c index 478e6de2635..6ca815adfaf 100644 --- a/src/mame/drivers/cardline.c +++ b/src/mame/drivers/cardline.c @@ -170,7 +170,7 @@ static PALETTE_INIT(cardline) { int i,r,g,b,data; 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]; diff --git a/src/mame/drivers/chanbara.c b/src/mame/drivers/chanbara.c index 05b502a7e94..e76c0f6906f 100644 --- a/src/mame/drivers/chanbara.c +++ b/src/mame/drivers/chanbara.c @@ -78,11 +78,11 @@ static PALETTE_INIT( chanbara ) { 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]; - green = color_prom[machine->config->total_colors + i]; - blue = color_prom[2 * machine->config->total_colors + i]; + green = color_prom[machine->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)); } diff --git a/src/mame/drivers/cntsteer.c b/src/mame/drivers/cntsteer.c index 5c43d251dbf..226020375ba 100644 --- a/src/mame/drivers/cntsteer.c +++ b/src/mame/drivers/cntsteer.c @@ -64,7 +64,7 @@ public: static PALETTE_INIT( zerotrgt ) { 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; diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index 86aefec79b0..a3669e2dfe2 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -805,12 +805,12 @@ static VIDEO_START(cps3) state_save_register_global_pointer(machine, cps3_char_ram, 0x800000 /4); /* 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(); /* 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; //decode_charram(); diff --git a/src/mame/drivers/dacholer.c b/src/mame/drivers/dacholer.c index df0ee0df11c..ffb8973e4a9 100644 --- a/src/mame/drivers/dacholer.c +++ b/src/mame/drivers/dacholer.c @@ -475,7 +475,7 @@ static PALETTE_INIT( dacholer ) 2, resistances_b, weights_b, 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 r, g, b; diff --git a/src/mame/drivers/darkhors.c b/src/mame/drivers/darkhors.c index c33e79df799..9e14368aa43 100644 --- a/src/mame/drivers/darkhors.c +++ b/src/mame/drivers/darkhors.c @@ -661,7 +661,7 @@ static VIDEO_START(jclub2) assert(jclub2_gfx_index != MAX_GFX_ELEMENTS); /* 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); } diff --git a/src/mame/drivers/drw80pkr.c b/src/mame/drivers/drw80pkr.c index 2c7ed32138b..2581b33c638 100644 --- a/src/mame/drivers/drw80pkr.c +++ b/src/mame/drivers/drw80pkr.c @@ -334,7 +334,7 @@ static PALETTE_INIT( drw80pkr ) { 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; diff --git a/src/mame/drivers/esh.c b/src/mame/drivers/esh.c index 8a6858e0d0a..17b591b0704 100644 --- a/src/mame/drivers/esh.c +++ b/src/mame/drivers/esh.c @@ -211,7 +211,7 @@ static PALETTE_INIT( esh ) int i; /* 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 bit0,bit1,bit2; diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c index d1a5011aee5..b4119ff0793 100644 --- a/src/mame/drivers/firebeat.c +++ b/src/mame/drivers/firebeat.c @@ -470,7 +470,7 @@ static VIDEO_UPDATE(firebeat) { int chip; - if (screen == screen->machine->devicelist.find(SCREEN, 0)) + if (screen == screen->machine->m_devicelist.find(SCREEN, 0)) chip = 0; else 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 ); 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) { diff --git a/src/mame/drivers/goldnpkr.c b/src/mame/drivers/goldnpkr.c index 2357889b6c5..3597753cb4a 100644 --- a/src/mame/drivers/goldnpkr.c +++ b/src/mame/drivers/goldnpkr.c @@ -690,7 +690,7 @@ static PALETTE_INIT( goldnpkr ) /* 0000IBGR */ 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; @@ -741,7 +741,7 @@ static PALETTE_INIT( witchcrd ) 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; diff --git a/src/mame/drivers/gottlieb.c b/src/mame/drivers/gottlieb.c index 19a648cc064..2a0902ef58a 100644 --- a/src/mame/drivers/gottlieb.c +++ b/src/mame/drivers/gottlieb.c @@ -270,7 +270,7 @@ static MACHINE_START( gottlieb ) state_save_register_global_array(machine, track); /* see if we have a laserdisc */ - laserdisc = machine->devicelist.first(LASERDISC); + laserdisc = machine->m_devicelist.first(LASERDISC); if (laserdisc != NULL) { /* attach to the I/O ports */ diff --git a/src/mame/drivers/istellar.c b/src/mame/drivers/istellar.c index f47091c12f9..f21edad8d54 100644 --- a/src/mame/drivers/istellar.c +++ b/src/mame/drivers/istellar.c @@ -260,7 +260,7 @@ static PALETTE_INIT( istellar ) int i; /* 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 bit0,bit1,bit2,bit3; diff --git a/src/mame/drivers/jangou.c b/src/mame/drivers/jangou.c index ab0c1d5ff41..55df0291aee 100644 --- a/src/mame/drivers/jangou.c +++ b/src/mame/drivers/jangou.c @@ -86,7 +86,7 @@ static PALETTE_INIT( jangou ) 2, resistances_b, weights_b, 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 r, g, b; diff --git a/src/mame/drivers/marinedt.c b/src/mame/drivers/marinedt.c index 60b7a5fe89c..3f6f1a18684 100644 --- a/src/mame/drivers/marinedt.c +++ b/src/mame/drivers/marinedt.c @@ -426,7 +426,7 @@ static PALETTE_INIT( marinedt ) { 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; diff --git a/src/mame/drivers/meijinsn.c b/src/mame/drivers/meijinsn.c index 462eaa7e049..a518c3243d7 100644 --- a/src/mame/drivers/meijinsn.c +++ b/src/mame/drivers/meijinsn.c @@ -252,7 +252,7 @@ static PALETTE_INIT( meijinsn ) 3, resistances_rg, weights_g, 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; diff --git a/src/mame/drivers/mirax.c b/src/mame/drivers/mirax.c index 88aea63a923..7b494ceeed6 100644 --- a/src/mame/drivers/mirax.c +++ b/src/mame/drivers/mirax.c @@ -346,7 +346,7 @@ static PALETTE_INIT( mirax ) { 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; diff --git a/src/mame/drivers/mpu4drvr.c b/src/mame/drivers/mpu4drvr.c index edf274bd6fa..c62ed894bb0 100644 --- a/src/mame/drivers/mpu4drvr.c +++ b/src/mame/drivers/mpu4drvr.c @@ -1014,10 +1014,10 @@ static VIDEO_START( mpu4_vid ) assert(mpu4_gfx_index != MAX_GFX_ELEMENTS); /* 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+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+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+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+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->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->total_colors() / 16, 0); scn2675_IR_pointer = 0; } diff --git a/src/mame/drivers/namcoic.c b/src/mame/drivers/namcoic.c index 45096fe44cc..af0680aa2d2 100644 --- a/src/mame/drivers/namcoic.c +++ b/src/mame/drivers/namcoic.c @@ -275,7 +275,7 @@ static void zdrawgfxzoom( { 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 UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements); int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; diff --git a/src/mame/drivers/nightgal.c b/src/mame/drivers/nightgal.c index 37e176b1b17..52fb0fa7952 100644 --- a/src/mame/drivers/nightgal.c +++ b/src/mame/drivers/nightgal.c @@ -244,7 +244,7 @@ static PALETTE_INIT( nightgal ) 2, resistances_b, weights_b, 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 r, g, b; diff --git a/src/mame/drivers/olibochu.c b/src/mame/drivers/olibochu.c index 95927ee581a..15e197cf132 100644 --- a/src/mame/drivers/olibochu.c +++ b/src/mame/drivers/olibochu.c @@ -85,7 +85,7 @@ static PALETTE_INIT( olibochu ) { int i; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { UINT8 pen; int bit0, bit1, bit2, r, g, b; diff --git a/src/mame/drivers/othello.c b/src/mame/drivers/othello.c index ca886f12f85..a380cd7ed6a 100644 --- a/src/mame/drivers/othello.c +++ b/src/mame/drivers/othello.c @@ -102,7 +102,7 @@ static MC6845_UPDATE_ROW( update_row ) static PALETTE_INIT( othello ) { 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)); } diff --git a/src/mame/drivers/peplus.c b/src/mame/drivers/peplus.c index ecc5cca852e..c0a8e993a20 100644 --- a/src/mame/drivers/peplus.c +++ b/src/mame/drivers/peplus.c @@ -288,7 +288,7 @@ static WRITE8_HANDLER( peplus_bgcolor_w ) { 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; @@ -683,7 +683,7 @@ static PALETTE_INIT( peplus ) */ 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; diff --git a/src/mame/drivers/progolf.c b/src/mame/drivers/progolf.c index 15fa98d7455..80d594e5028 100644 --- a/src/mame/drivers/progolf.c +++ b/src/mame/drivers/progolf.c @@ -401,7 +401,7 @@ static PALETTE_INIT( progolf ) { 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; diff --git a/src/mame/drivers/safarir.c b/src/mame/drivers/safarir.c index fc51bd4a111..c07f1a55b35 100644 --- a/src/mame/drivers/safarir.c +++ b/src/mame/drivers/safarir.c @@ -135,7 +135,7 @@ static PALETTE_INIT( safarir ) { 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) + 1, MAKE_RGB(pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0))); diff --git a/src/mame/drivers/sbowling.c b/src/mame/drivers/sbowling.c index 2b4c3b79079..33166f63d39 100644 --- a/src/mame/drivers/sbowling.c +++ b/src/mame/drivers/sbowling.c @@ -344,7 +344,7 @@ static PALETTE_INIT( sbowling ) 3, resistances_rg, outputs_g, 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; diff --git a/src/mame/drivers/shanghai.c b/src/mame/drivers/shanghai.c index 8b1b12403d4..fc2a5fa3e0b 100644 --- a/src/mame/drivers/shanghai.c +++ b/src/mame/drivers/shanghai.c @@ -32,7 +32,7 @@ static PALETTE_INIT( shanghai ) 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; diff --git a/src/mame/drivers/shougi.c b/src/mame/drivers/shougi.c index 59d198629be..9e4029999d9 100644 --- a/src/mame/drivers/shougi.c +++ b/src/mame/drivers/shougi.c @@ -133,7 +133,7 @@ static PALETTE_INIT( shougi ) 3, resistances_rg, weights_g, 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; diff --git a/src/mame/drivers/srmp6.c b/src/mame/drivers/srmp6.c index 5b575a26426..b0dd6ab9482 100644 --- a/src/mame/drivers/srmp6.c +++ b/src/mame/drivers/srmp6.c @@ -149,7 +149,7 @@ static VIDEO_START(srmp6) state->sprram_old = auto_alloc_array_clear(machine, UINT16, 0x80000/2); /* 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; state->brightness = 0x60; diff --git a/src/mame/drivers/superdq.c b/src/mame/drivers/superdq.c index b014480f85b..3cb060e9c83 100644 --- a/src/mame/drivers/superdq.c +++ b/src/mame/drivers/superdq.c @@ -88,7 +88,7 @@ static PALETTE_INIT( superdq ) 2, &resistances[1], bweights, 220, 0); /* 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 r, g, b; diff --git a/src/mame/drivers/tugboat.c b/src/mame/drivers/tugboat.c index 607ab2e5aa1..d6df3cb6dbd 100644 --- a/src/mame/drivers/tugboat.c +++ b/src/mame/drivers/tugboat.c @@ -42,7 +42,7 @@ static PALETTE_INIT( tugboat ) int i; - for (i = 0;i < machine->config->total_colors;i++) + for (i = 0;i < machine->total_colors();i++) { int r,g,b,brt; diff --git a/src/mame/drivers/videopkr.c b/src/mame/drivers/videopkr.c index 0112afe06ac..7565a165652 100644 --- a/src/mame/drivers/videopkr.c +++ b/src/mame/drivers/videopkr.c @@ -363,7 +363,7 @@ static PALETTE_INIT( videopkr ) { 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; @@ -389,7 +389,7 @@ static PALETTE_INIT( babypkr ) { 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; @@ -419,7 +419,7 @@ static PALETTE_INIT( fortune1 ) { 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; diff --git a/src/mame/drivers/wallc.c b/src/mame/drivers/wallc.c index c7ce9c47c51..108c8ced897 100644 --- a/src/mame/drivers/wallc.c +++ b/src/mame/drivers/wallc.c @@ -91,7 +91,7 @@ static PALETTE_INIT( wallc ) 2, resistances_rg, weights_g, 330, 0, 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; diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c index 52e92e75cdb..daf78fcbce3 100644 --- a/src/mame/machine/atarigen.c +++ b/src/mame/machine/atarigen.c @@ -876,7 +876,7 @@ static TIMER_CALLBACK( delayed_6502_sound_w ) void atarigen_set_vol(running_machine *machine, int volume, device_type type) { 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) sound_set_output_gain(*sound, ALL_OUTPUTS, volume / 100.0); } diff --git a/src/mame/machine/naomibd.c b/src/mame/machine/naomibd.c index 9756d6c21ee..d69c11b3299 100644 --- a/src/mame/machine/naomibd.c +++ b/src/mame/machine/naomibd.c @@ -1803,7 +1803,7 @@ static DEVICE_START( naomibd ) } /* 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; /* initialize some registers */ diff --git a/src/mame/video/40love.c b/src/mame/video/40love.c index 1f1aa879bcf..6e789cb8666 100644 --- a/src/mame/video/40love.c +++ b/src/mame/video/40love.c @@ -14,7 +14,7 @@ PALETTE_INIT( fortyl ) { 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; @@ -26,17 +26,17 @@ PALETTE_INIT( fortyl ) r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* green component */ - bit0 = (color_prom[machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[machine->total_colors()] >> 3) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* blue component */ - bit0 = (color_prom[2*machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[2*machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[2*machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[2*machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[2*machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[2*machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[2*machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[2*machine->total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine, i, MAKE_RGB(r,g,b)); diff --git a/src/mame/video/ambush.c b/src/mame/video/ambush.c index 2df8e9356aa..ed1e237948b 100644 --- a/src/mame/video/ambush.c +++ b/src/mame/video/ambush.c @@ -22,7 +22,7 @@ PALETTE_INIT( ambush ) { 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; diff --git a/src/mame/video/ampoker2.c b/src/mame/video/ampoker2.c index 5149c96485f..75adc0ee40e 100644 --- a/src/mame/video/ampoker2.c +++ b/src/mame/video/ampoker2.c @@ -89,7 +89,7 @@ PALETTE_INIT( ampoker2 ) 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; diff --git a/src/mame/video/appoooh.c b/src/mame/video/appoooh.c index 640a10f2c9d..f17db299da2 100644 --- a/src/mame/video/appoooh.c +++ b/src/mame/video/appoooh.c @@ -24,7 +24,7 @@ PALETTE_INIT( appoooh ) { int i; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { UINT8 pen; int bit0, bit1, bit2, r, g, b; @@ -62,7 +62,7 @@ PALETTE_INIT( robowres ) { 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; diff --git a/src/mame/video/atarigt.c b/src/mame/video/atarigt.c index 7dc356c0725..40f3c3234df 100644 --- a/src/mame/video/atarigt.c +++ b/src/mame/video/atarigt.c @@ -124,7 +124,7 @@ VIDEO_START( atarigt ) /* map pens 1:1 */ 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; machine->pens = substitute_pens; diff --git a/src/mame/video/bagman.c b/src/mame/video/bagman.c index 8f1fbb32b70..049424cb85b 100644 --- a/src/mame/video/bagman.c +++ b/src/mame/video/bagman.c @@ -63,7 +63,7 @@ PALETTE_INIT( bagman ) 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; diff --git a/src/mame/video/bking.c b/src/mame/video/bking.c index 9d71b2c95a2..399a634b34f 100644 --- a/src/mame/video/bking.c +++ b/src/mame/video/bking.c @@ -41,7 +41,7 @@ PALETTE_INIT( bking ) 3, &resistances_rg[0], gweights, 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; int bit0, bit1, bit2, r, g, b; diff --git a/src/mame/video/blueprnt.c b/src/mame/video/blueprnt.c index 1644c7908ec..d927788c70c 100644 --- a/src/mame/video/blueprnt.c +++ b/src/mame/video/blueprnt.c @@ -24,7 +24,7 @@ PALETTE_INIT( blueprnt ) { int i; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { UINT8 pen; int r, g, b; diff --git a/src/mame/video/brkthru.c b/src/mame/video/brkthru.c index 24ba12870d2..e63cf513dd8 100644 --- a/src/mame/video/brkthru.c +++ b/src/mame/video/brkthru.c @@ -36,7 +36,7 @@ PALETTE_INIT( brkthru ) { 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; @@ -50,10 +50,10 @@ PALETTE_INIT( brkthru ) bit2 = (color_prom[0] >> 6) & 0x01; bit3 = (color_prom[0] >> 7) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = (color_prom[machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[machine->total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine, i, MAKE_RGB(r,g,b)); diff --git a/src/mame/video/btime.c b/src/mame/video/btime.c index 71d336f02b2..bbbbefb09fd 100644 --- a/src/mame/video/btime.c +++ b/src/mame/video/btime.c @@ -37,7 +37,7 @@ PALETTE_INIT( btime ) /* This function is also used by Eggs. */ 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; @@ -82,7 +82,7 @@ PALETTE_INIT( lnc ) { 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; diff --git a/src/mame/video/calomega.c b/src/mame/video/calomega.c index 5828f08cd20..d8ebeb7ae60 100644 --- a/src/mame/video/calomega.c +++ b/src/mame/video/calomega.c @@ -81,7 +81,7 @@ PALETTE_INIT( calomega ) /* 00000BGR */ 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; diff --git a/src/mame/video/carjmbre.c b/src/mame/video/carjmbre.c index faab5728ada..6e33dfa3c25 100644 --- a/src/mame/video/carjmbre.c +++ b/src/mame/video/carjmbre.c @@ -12,7 +12,7 @@ PALETTE_INIT( carjmbre ) { 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 */ bit0 = (*color_prom >> 0) & 0x01; diff --git a/src/mame/video/carpolo.c b/src/mame/video/carpolo.c index 41cd1f6c3ca..7c5732d7e7b 100644 --- a/src/mame/video/carpolo.c +++ b/src/mame/video/carpolo.c @@ -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; diff --git a/src/mame/video/cave.c b/src/mame/video/cave.c index eeb152f6efa..91eeaf6b129 100644 --- a/src/mame/video/cave.c +++ b/src/mame/video/cave.c @@ -80,9 +80,9 @@ PALETTE_INIT( cave ) int pen; /* 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; } @@ -191,7 +191,7 @@ static void set_pens( running_machine *machine ) cave_state *state = (cave_state *)machine->driver_data; 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]]; @@ -468,8 +468,8 @@ static void cave_vh_start( running_machine *machine, int num ) state->row_effect_offs_n = -1; state->row_effect_offs_f = 1; - state->background_color = machine->config->gfxdecodeinfo[0].color_codes_start + - (machine->config->gfxdecodeinfo[0].total_color_codes - 1) * + state->background_color = machine->config->m_gfxdecodeinfo[0].color_codes_start + + (machine->config->m_gfxdecodeinfo[0].total_color_codes - 1) * machine->gfx[0]->color_granularity; switch (state->kludge) diff --git a/src/mame/video/cclimber.c b/src/mame/video/cclimber.c index 29279152ba1..550c14e71d5 100644 --- a/src/mame/video/cclimber.c +++ b/src/mame/video/cclimber.c @@ -69,7 +69,7 @@ PALETTE_INIT( cclimber ) 2, resistances_b, weights_b, 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 r, g, b; diff --git a/src/mame/video/centiped.c b/src/mame/video/centiped.c index 0f65e806250..fe19a16cc2d 100644 --- a/src/mame/video/centiped.c +++ b/src/mame/video/centiped.c @@ -274,7 +274,7 @@ PALETTE_INIT( warlords ) { int i; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { UINT8 pen; int r, g, b; diff --git a/src/mame/video/compgolf.c b/src/mame/video/compgolf.c index 5ac69d831dc..65223a089c9 100644 --- a/src/mame/video/compgolf.c +++ b/src/mame/video/compgolf.c @@ -13,7 +13,7 @@ PALETTE_INIT( compgolf ) { 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; bit0 = (color_prom[i] >> 0) & 0x01; diff --git a/src/mame/video/cosmic.c b/src/mame/video/cosmic.c index 9249b279da3..9b2a10e3de5 100644 --- a/src/mame/video/cosmic.c +++ b/src/mame/video/cosmic.c @@ -166,7 +166,7 @@ PALETTE_INIT( cosmicg ) cosmic_state *state = (cosmic_state *)machine->driver_data; int i; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { int r = (i > 8) ? 0xff : 0xaa * ((i >> 0) & 1); int g = 0xaa * ((i >> 1) & 1); diff --git a/src/mame/video/crbaloon.c b/src/mame/video/crbaloon.c index 4a6550511e8..2027f3577f7 100644 --- a/src/mame/video/crbaloon.c +++ b/src/mame/video/crbaloon.c @@ -36,7 +36,7 @@ PALETTE_INIT( crbaloon ) { int i; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { UINT8 pen; int h, r, g, b; diff --git a/src/mame/video/dday.c b/src/mame/video/dday.c index a61accc5b57..138d4200d4c 100644 --- a/src/mame/video/dday.c +++ b/src/mame/video/dday.c @@ -337,7 +337,7 @@ VIDEO_UPDATE( dday ) UINT16 src_pixel = *BITMAP_ADDR16(state->main_bitmap, y, x); if (*BITMAP_ADDR16(sl_bitmap, y, x) == 0xff) - src_pixel += screen->machine->config->total_colors; + src_pixel += screen->machine->total_colors(); *BITMAP_ADDR16(bitmap, y, x) = src_pixel; } diff --git a/src/mame/video/dec8.c b/src/mame/video/dec8.c index c4326d253ef..97ba81af35a 100644 --- a/src/mame/video/dec8.c +++ b/src/mame/video/dec8.c @@ -75,7 +75,7 @@ PALETTE_INIT( ghostb ) { 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; @@ -89,10 +89,10 @@ PALETTE_INIT( ghostb ) bit2 = (color_prom[i] >> 6) & 0x01; bit3 = (color_prom[i] >> 7) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = (color_prom[i + machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[i + machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[i + machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[i + machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[i + machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[i + machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[i + machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[i + machine->total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine, i, MAKE_RGB(r, g, b)); diff --git a/src/mame/video/deco16ic.c b/src/mame/video/deco16ic.c index e76ef4af41c..664e526a821 100644 --- a/src/mame/video/deco16ic.c +++ b/src/mame/video/deco16ic.c @@ -253,7 +253,7 @@ WRITE16_DEVICE_HANDLER( deco16ic_buffered_palette_w ) WRITE16_DEVICE_HANDLER( deco16ic_palette_dma_w ) { deco16ic_state *deco16ic = get_safe_token(device); - const int m = device->machine->config->total_colors; + const int m = device->machine->total_colors(); int r, g, b, i; for (i = 0; i < m; i++) diff --git a/src/mame/video/deco32.c b/src/mame/video/deco32.c index 807211c76de..a9cdf3ab545 100644 --- a/src/mame/video/deco32.c +++ b/src/mame/video/deco32.c @@ -245,7 +245,7 @@ WRITE32_HANDLER( deco32_buffered_palette_w ) WRITE32_HANDLER( deco32_palette_dma_w ) { - const int m=space->machine->config->total_colors; + const int m=space->machine->total_colors(); int r,g,b,i; for (i=0; i<m; i++) { diff --git a/src/mame/video/dynax.c b/src/mame/video/dynax.c index 93908178fd1..7644a2841d8 100644 --- a/src/mame/video/dynax.c +++ b/src/mame/video/dynax.c @@ -30,7 +30,7 @@ PALETTE_INIT( sprtmtch ) { int i; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { int x = (color_prom[i] << 8) + color_prom[0x200 + i]; /* The bits are in reverse order! */ diff --git a/src/mame/video/espial.c b/src/mame/video/espial.c index 8bb217b5054..555130510e5 100644 --- a/src/mame/video/espial.c +++ b/src/mame/video/espial.c @@ -33,7 +33,7 @@ PALETTE_INIT( espial ) { 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; @@ -44,13 +44,13 @@ PALETTE_INIT( espial ) r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; /* green component */ bit0 = (color_prom[i] >> 3) & 0x01; - bit1 = (color_prom[i + machine->config->total_colors] >> 0) & 0x01; - bit2 = (color_prom[i + machine->config->total_colors] >> 1) & 0x01; + bit1 = (color_prom[i + machine->total_colors()] >> 0) & 0x01; + bit2 = (color_prom[i + machine->total_colors()] >> 1) & 0x01; g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; /* blue component */ bit0 = 0; - bit1 = (color_prom[i + machine->config->total_colors] >> 2) & 0x01; - bit2 = (color_prom[i + machine->config->total_colors] >> 3) & 0x01; + bit1 = (color_prom[i + machine->total_colors()] >> 2) & 0x01; + bit2 = (color_prom[i + machine->total_colors()] >> 3) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; palette_set_color(machine, i, MAKE_RGB(r,g,b)); diff --git a/src/mame/video/firetrap.c b/src/mame/video/firetrap.c index c0d0589cc65..590925b97d6 100644 --- a/src/mame/video/firetrap.c +++ b/src/mame/video/firetrap.c @@ -39,7 +39,7 @@ PALETTE_INIT( firetrap ) 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; @@ -54,10 +54,10 @@ PALETTE_INIT( firetrap ) bit2 = (color_prom[i] >> 6) & 0x01; bit3 = (color_prom[i] >> 7) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = (color_prom[i + machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[i + machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[i + machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[i + machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[i + machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[i + machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[i + machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[i + machine->total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine, i, MAKE_RGB(r,g,b)); diff --git a/src/mame/video/funworld.c b/src/mame/video/funworld.c index be85d7eeb20..08b3354eba8 100644 --- a/src/mame/video/funworld.c +++ b/src/mame/video/funworld.c @@ -119,7 +119,7 @@ PALETTE_INIT(funworld) 2, resistances_g, weights_g, 100, 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; diff --git a/src/mame/video/fuukifg2.c b/src/mame/video/fuukifg2.c index 6f0dda66740..30bf61b96bc 100644 --- a/src/mame/video/fuukifg2.c +++ b/src/mame/video/fuukifg2.c @@ -83,7 +83,7 @@ PALETTE_INIT( fuuki16 ) /* The game does not initialise the palette at startup. It should be totally black */ - for (pen = 0; pen < machine->config->total_colors; pen++) + for (pen = 0; pen < machine->total_colors(); pen++) palette_set_color(machine,pen,MAKE_RGB(0,0,0)); } #endif diff --git a/src/mame/video/gomoku.c b/src/mame/video/gomoku.c index 24391eaa074..f64ff6cffc6 100644 --- a/src/mame/video/gomoku.c +++ b/src/mame/video/gomoku.c @@ -33,7 +33,7 @@ PALETTE_INIT( gomoku ) int i; int 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 */ bit0 = (*color_prom >> 0) & 0x01; diff --git a/src/mame/video/gottlieb.c b/src/mame/video/gottlieb.c index dd5cb8c28f6..9621236281d 100644 --- a/src/mame/video/gottlieb.c +++ b/src/mame/video/gottlieb.c @@ -84,7 +84,7 @@ WRITE8_HANDLER( gottlieb_video_control_w ) WRITE8_HANDLER( gottlieb_laserdisc_video_control_w ) { - running_device *laserdisc = space->machine->devicelist.first(LASERDISC); + running_device *laserdisc = space->machine->m_devicelist.first(LASERDISC); /* bit 0 works like the other games */ gottlieb_video_control_w(space, offset, data & 0x01); diff --git a/src/mame/video/gridlee.c b/src/mame/video/gridlee.c index d69488154e7..c0aaae1adf4 100644 --- a/src/mame/video/gridlee.c +++ b/src/mame/video/gridlee.c @@ -45,7 +45,7 @@ PALETTE_INIT( gridlee ) { int i; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { palette_set_color_rgb(machine,i,pal4bit(color_prom[0x0000]),pal4bit(color_prom[0x0800]),pal4bit(color_prom[0x1000])); color_prom++; diff --git a/src/mame/video/harddriv.c b/src/mame/video/harddriv.c index dd2cf8904cb..420c5f6e055 100644 --- a/src/mame/video/harddriv.c +++ b/src/mame/video/harddriv.c @@ -244,7 +244,7 @@ WRITE16_HANDLER( hdgsp_control_hi_w ) break; case 0x04: - if (space->machine->config->total_colors >= 256 * 8) + if (space->machine->total_colors() >= 256 * 8) update_palette_bank(space->machine, (state->gfx_palettebank & ~4) | (val << 2)); break; diff --git a/src/mame/video/jack.c b/src/mame/video/jack.c index 79c1881ea21..334f20a1d37 100644 --- a/src/mame/video/jack.c +++ b/src/mame/video/jack.c @@ -114,7 +114,7 @@ PALETTE_INIT( joinem ) { 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; bit0 = (color_prom[i] >> 0) & 0x01; diff --git a/src/mame/video/karnov.c b/src/mame/video/karnov.c index bca1c73b64e..46bcb4f4310 100644 --- a/src/mame/video/karnov.c +++ b/src/mame/video/karnov.c @@ -39,7 +39,7 @@ PALETTE_INIT( karnov ) { 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; @@ -53,10 +53,10 @@ PALETTE_INIT( karnov ) bit2 = (color_prom[0] >> 6) & 0x01; bit3 = (color_prom[0] >> 7) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = (color_prom[machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[machine->total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine, i, MAKE_RGB(r, g, b)); diff --git a/src/mame/video/kchamp.c b/src/mame/video/kchamp.c index c2778121918..c33342af933 100644 --- a/src/mame/video/kchamp.c +++ b/src/mame/video/kchamp.c @@ -14,11 +14,11 @@ PALETTE_INIT( kchamp ) { 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]; - green = color_prom[machine->config->total_colors + i]; - blue = color_prom[2 * machine->config->total_colors + i]; + green = color_prom[machine->total_colors() + i]; + blue = color_prom[2 * machine->total_colors() + i]; palette_set_color_rgb(machine, i, pal4bit(red), pal4bit(green), pal4bit(blue)); } diff --git a/src/mame/video/konamiic.c b/src/mame/video/konamiic.c index c83c378618b..37ec8ce7ce1 100644 --- a/src/mame/video/konamiic.c +++ b/src/mame/video/konamiic.c @@ -1216,7 +1216,7 @@ static void decode_gfx(running_machine *machine, int gfx_index, UINT8 *data, UIN memcpy(&gl, layout, sizeof(gl)); gl.total = total; - machine->gfx[gfx_index] = gfx_element_alloc(machine, &gl, data, machine->config->total_colors >> bpp, 0); + machine->gfx[gfx_index] = gfx_element_alloc(machine, &gl, data, machine->total_colors() >> bpp, 0); } @@ -2535,7 +2535,7 @@ void K051960_vh_start(running_machine *machine,const char *gfx_memory_region,int fatalerror("Unknown plane_order"); } - if (VERBOSE && !(machine->config->video_attributes & VIDEO_HAS_SHADOWS)) + if (VERBOSE && !(machine->config->m_video_attributes & VIDEO_HAS_SHADOWS)) popmessage("driver should use VIDEO_HAS_SHADOWS"); K051960_dx = K051960_dy = 0; @@ -3035,7 +3035,7 @@ void K053245_vh_start(running_machine *machine,int chip, const char *gfx_memory_ fatalerror("Unsupported plane_order"); } - if (VERBOSE && !(machine->config->video_attributes & VIDEO_HAS_SHADOWS)) + if (VERBOSE && !(machine->config->m_video_attributes & VIDEO_HAS_SHADOWS)) popmessage("driver should use VIDEO_HAS_SHADOWS"); @@ -3809,12 +3809,12 @@ void K053247_vh_start(running_machine *machine, const char *gfx_memory_region, i { if (machine->primary_screen->format() == BITMAP_FORMAT_RGB32) { - if ((machine->config->video_attributes & (VIDEO_HAS_SHADOWS|VIDEO_HAS_HIGHLIGHTS)) != VIDEO_HAS_SHADOWS+VIDEO_HAS_HIGHLIGHTS) + if ((machine->config->m_video_attributes & (VIDEO_HAS_SHADOWS|VIDEO_HAS_HIGHLIGHTS)) != VIDEO_HAS_SHADOWS+VIDEO_HAS_HIGHLIGHTS) popmessage("driver missing SHADOWS or HIGHLIGHTS flag"); } else { - if (!(machine->config->video_attributes & VIDEO_HAS_SHADOWS)) + if (!(machine->config->m_video_attributes & VIDEO_HAS_SHADOWS)) popmessage("driver should use VIDEO_HAS_SHADOWS"); } } @@ -3946,7 +3946,7 @@ void K055673_vh_start(running_machine *machine, const char *gfx_memory_region, i fatalerror("Unsupported layout"); } - if (VERBOSE && !(machine->config->video_attributes & VIDEO_HAS_SHADOWS)) + if (VERBOSE && !(machine->config->m_video_attributes & VIDEO_HAS_SHADOWS)) popmessage("driver should use VIDEO_HAS_SHADOWS"); K053247_dx = dx; @@ -4245,9 +4245,9 @@ void K053247_sprites_draw(running_machine *machine, bitmap_t *bitmap,const recta VIDEO_HAS_SHADOWS | VIDEO_HAS_HIGHLIGHTS */ - if (machine->config->video_attributes & VIDEO_HAS_SHADOWS) + if (machine->config->m_video_attributes & VIDEO_HAS_SHADOWS) { - if (bitmap->bpp == 32 && (machine->config->video_attributes & VIDEO_HAS_HIGHLIGHTS)) + if (bitmap->bpp == 32 && (machine->config->m_video_attributes & VIDEO_HAS_HIGHLIGHTS)) shdmask = 3; // enable all shadows and highlights else shdmask = 0; // enable default shadows @@ -8412,7 +8412,7 @@ void K053250_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *c linedata_offs += line_start * linedata_adv; // pre-advance line info offset for the clipped region // load physical palette base - pal_base = machine->pens + (colorbase << 4) % machine->config->total_colors; + pal_base = machine->pens + (colorbase << 4) % machine->total_colors(); // walk the target bitmap within the visible area vertically or horizontally, one line at a time for (line_pos=line_start; line_pos<=line_end; linedata_offs+=linedata_adv, line_pos++) diff --git a/src/mame/video/konicdev.c b/src/mame/video/konicdev.c index d27215ec246..27e092b9e8b 100644 --- a/src/mame/video/konicdev.c +++ b/src/mame/video/konicdev.c @@ -1239,7 +1239,7 @@ static void decode_gfx(running_machine *machine, int gfx_index, UINT8 *data, UIN memcpy(&gl, layout, sizeof(gl)); gl.total = total; - machine->gfx[gfx_index] = gfx_element_alloc(machine, &gl, data, machine->config->total_colors >> bpp, 0); + machine->gfx[gfx_index] = gfx_element_alloc(machine, &gl, data, machine->total_colors() >> bpp, 0); } @@ -3266,7 +3266,7 @@ static DEVICE_START( k051960 ) fatalerror("Unknown plane_order"); } - if (VERBOSE && !(machine->config->video_attributes & VIDEO_HAS_SHADOWS)) + if (VERBOSE && !(machine->config->m_video_attributes & VIDEO_HAS_SHADOWS)) popmessage("driver should use VIDEO_HAS_SHADOWS"); /* deinterleave the graphics, if needed */ @@ -4067,7 +4067,7 @@ static DEVICE_START( k05324x ) fatalerror("Unsupported plane_order"); } - if (VERBOSE && !(machine->config->video_attributes & VIDEO_HAS_SHADOWS)) + if (VERBOSE && !(machine->config->m_video_attributes & VIDEO_HAS_SHADOWS)) popmessage("driver should use VIDEO_HAS_SHADOWS"); /* deinterleave the graphics, if needed */ @@ -4494,9 +4494,9 @@ void k053247_sprites_draw( running_device *device, bitmap_t *bitmap, const recta VIDEO_HAS_SHADOWS | VIDEO_HAS_HIGHLIGHTS */ - if (machine->config->video_attributes & VIDEO_HAS_SHADOWS) + if (machine->config->m_video_attributes & VIDEO_HAS_SHADOWS) { - if (bitmap->bpp == 32 && (machine->config->video_attributes & VIDEO_HAS_HIGHLIGHTS)) + if (bitmap->bpp == 32 && (machine->config->m_video_attributes & VIDEO_HAS_HIGHLIGHTS)) shdmask = 3; // enable all shadows and highlights else shdmask = 0; // enable default shadows @@ -4905,12 +4905,12 @@ static DEVICE_START( k053247 ) { if (k053247->screen->format() == BITMAP_FORMAT_RGB32) { - if ((machine->config->video_attributes & (VIDEO_HAS_SHADOWS|VIDEO_HAS_HIGHLIGHTS)) != VIDEO_HAS_SHADOWS+VIDEO_HAS_HIGHLIGHTS) + if ((machine->config->m_video_attributes & (VIDEO_HAS_SHADOWS|VIDEO_HAS_HIGHLIGHTS)) != VIDEO_HAS_SHADOWS+VIDEO_HAS_HIGHLIGHTS) popmessage("driver missing SHADOWS or HIGHLIGHTS flag"); } else { - if (!(machine->config->video_attributes & VIDEO_HAS_SHADOWS)) + if (!(machine->config->m_video_attributes & VIDEO_HAS_SHADOWS)) popmessage("driver should use VIDEO_HAS_SHADOWS"); } } @@ -5038,7 +5038,7 @@ static DEVICE_START( k055673 ) fatalerror("Unsupported layout"); } - if (VERBOSE && !(machine->config->video_attributes & VIDEO_HAS_SHADOWS)) + if (VERBOSE && !(machine->config->m_video_attributes & VIDEO_HAS_SHADOWS)) popmessage("driver should use VIDEO_HAS_SHADOWS"); k053247->dx = intf->dx; @@ -8869,7 +8869,7 @@ void k053250_draw( running_device *device, bitmap_t *bitmap, const rectangle *cl linedata_offs += line_start * linedata_adv; // pre-advance line info offset for the clipped region // load physical palette base - pal_base = device->machine->pens + (colorbase << 4) % device->machine->config->total_colors; + pal_base = device->machine->pens + (colorbase << 4) % device->machine->total_colors(); // walk the target bitmap within the visible area vertically or horizontally, one line at a time for (line_pos=line_start; line_pos <= line_end; linedata_offs += linedata_adv, line_pos++) @@ -10554,8 +10554,8 @@ static DEVICE_START( k001604 ) tilemap_set_transparent_pen(k001604->layer_8x8[0], 0); tilemap_set_transparent_pen(k001604->layer_8x8[1], 0); - device->machine->gfx[k001604->gfx_index[0]] = gfx_element_alloc(device->machine, &k001604_char_layout_layer_8x8, (UINT8*)&k001604->char_ram[0], device->machine->config->total_colors / 16, 0); - device->machine->gfx[k001604->gfx_index[1]] = gfx_element_alloc(device->machine, &k001604_char_layout_layer_16x16, (UINT8*)&k001604->char_ram[0], device->machine->config->total_colors / 16, 0); + device->machine->gfx[k001604->gfx_index[0]] = gfx_element_alloc(device->machine, &k001604_char_layout_layer_8x8, (UINT8*)&k001604->char_ram[0], device->machine->total_colors() / 16, 0); + device->machine->gfx[k001604->gfx_index[1]] = gfx_element_alloc(device->machine, &k001604_char_layout_layer_16x16, (UINT8*)&k001604->char_ram[0], device->machine->total_colors() / 16, 0); state_save_register_device_item_pointer(device, 0, k001604->reg, 0x400 / 4); state_save_register_device_item_pointer(device, 0, k001604->char_ram, 0x200000 / 4); @@ -10796,7 +10796,7 @@ static DEVICE_START( k037122 ) tilemap_set_transparent_pen(k037122->layer[0], 0); tilemap_set_transparent_pen(k037122->layer[1], 0); - device->machine->gfx[k037122->gfx_index] = gfx_element_alloc(device->machine, &k037122_char_layout, (UINT8*)k037122->char_ram, device->machine->config->total_colors / 16, 0); + device->machine->gfx[k037122->gfx_index] = gfx_element_alloc(device->machine, &k037122_char_layout, (UINT8*)k037122->char_ram, device->machine->total_colors() / 16, 0); state_save_register_device_item_pointer(device, 0, k037122->reg, 0x400 / 4); state_save_register_device_item_pointer(device, 0, k037122->char_ram, 0x200000 / 4); diff --git a/src/mame/video/kopunch.c b/src/mame/video/kopunch.c index 8d0283ca0c1..a2b84ee7eb2 100644 --- a/src/mame/video/kopunch.c +++ b/src/mame/video/kopunch.c @@ -7,7 +7,7 @@ PALETTE_INIT( kopunch ) int i; color_prom += 24; /* first 24 colors are black */ - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { int bit0, bit1, bit2, r, g, b; diff --git a/src/mame/video/lvcards.c b/src/mame/video/lvcards.c index 3d7a8f6a0be..8c37ffd5865 100644 --- a/src/mame/video/lvcards.c +++ b/src/mame/video/lvcards.c @@ -16,7 +16,7 @@ PALETTE_INIT( ponttehk ) { 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; @@ -28,17 +28,17 @@ PALETTE_INIT( ponttehk ) r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* green component */ - bit0 = (color_prom[machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[machine->total_colors()] >> 3) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* blue component */ - bit0 = (color_prom[2*machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[2*machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[2*machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[2*machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[2*machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[2*machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[2*machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[2*machine->total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine,i,MAKE_RGB(r,g,b)); @@ -51,7 +51,7 @@ PALETTE_INIT( lvcards ) //Ever so slightly different, but different enough. { 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; @@ -63,17 +63,17 @@ PALETTE_INIT( lvcards ) //Ever so slightly different, but different enough. r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* green component */ - bit0 = (color_prom[machine->config->total_colors] >> 0) & 0x11; - bit1 = (color_prom[machine->config->total_colors] >> 1) & 0x11; - bit2 = (color_prom[machine->config->total_colors] >> 2) & 0x11; - bit3 = (color_prom[machine->config->total_colors] >> 3) & 0x11; + bit0 = (color_prom[machine->total_colors()] >> 0) & 0x11; + bit1 = (color_prom[machine->total_colors()] >> 1) & 0x11; + bit2 = (color_prom[machine->total_colors()] >> 2) & 0x11; + bit3 = (color_prom[machine->total_colors()] >> 3) & 0x11; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* blue component */ - bit0 = (color_prom[2*machine->config->total_colors] >> 0) & 0x11; - bit1 = (color_prom[2*machine->config->total_colors] >> 1) & 0x11; - bit2 = (color_prom[2*machine->config->total_colors] >> 2) & 0x11; - bit3 = (color_prom[2*machine->config->total_colors] >> 3) & 0x11; + bit0 = (color_prom[2*machine->total_colors()] >> 0) & 0x11; + bit1 = (color_prom[2*machine->total_colors()] >> 1) & 0x11; + bit2 = (color_prom[2*machine->total_colors()] >> 2) & 0x11; + bit3 = (color_prom[2*machine->total_colors()] >> 3) & 0x11; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine,i,MAKE_RGB(r,g,b)); diff --git a/src/mame/video/mappy.c b/src/mame/video/mappy.c index 73c9af8d821..3f2add652ce 100644 --- a/src/mame/video/mappy.c +++ b/src/mame/video/mappy.c @@ -141,7 +141,7 @@ PALETTE_INIT( mappy ) } /* sprites map to the lower 16 palette entries */ - for (i = 64*4; i < machine->config->total_colors; i++) + for (i = 64*4; i < machine->total_colors(); i++) { UINT8 ctabentry = color_prom[i] & 0x0f; colortable_entry_set_value(machine->colortable, i, ctabentry); diff --git a/src/mame/video/mitchell.c b/src/mame/video/mitchell.c index 53a04b69a6f..c7530beadf5 100644 --- a/src/mame/video/mitchell.c +++ b/src/mame/video/mitchell.c @@ -45,10 +45,10 @@ VIDEO_START( pang ) state->objram = auto_alloc_array_clear(machine, UINT8, state->videoram_size); /* Palette RAM */ - machine->generic.paletteram.u8 = auto_alloc_array_clear(machine, UINT8, 2 * machine->config->total_colors); + machine->generic.paletteram.u8 = auto_alloc_array_clear(machine, UINT8, 2 * machine->total_colors()); state_save_register_global_pointer(machine, state->objram, state->videoram_size); - state_save_register_global_pointer(machine, machine->generic.paletteram.u8, 2 * machine->config->total_colors); + state_save_register_global_pointer(machine, machine->generic.paletteram.u8, 2 * machine->total_colors()); } diff --git a/src/mame/video/mouser.c b/src/mame/video/mouser.c index 538a5efbaa3..864dcfe8b08 100644 --- a/src/mame/video/mouser.c +++ b/src/mame/video/mouser.c @@ -20,7 +20,7 @@ PALETTE_INIT( mouser ) { 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; diff --git a/src/mame/video/munchmo.c b/src/mame/video/munchmo.c index 5914e75256b..cb72a746e55 100644 --- a/src/mame/video/munchmo.c +++ b/src/mame/video/munchmo.c @@ -6,7 +6,7 @@ PALETTE_INIT( mnchmobl ) { 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; diff --git a/src/mame/video/namcona1.c b/src/mame/video/namcona1.c index 165d2a3f165..4fe73057371 100644 --- a/src/mame/video/namcona1.c +++ b/src/mame/video/namcona1.c @@ -285,9 +285,9 @@ VIDEO_START( namcona1 ) shaperam = auto_alloc_array(machine, UINT16, 0x2000*4/2 ); cgram = auto_alloc_array(machine, UINT16, 0x1000*0x40/2 ); - machine->gfx[0] = gfx_element_alloc( machine, &cg_layout_8bpp, (UINT8 *)cgram, machine->config->total_colors/256, 0 ); - machine->gfx[1] = gfx_element_alloc( machine, &cg_layout_4bpp, (UINT8 *)cgram, machine->config->total_colors/16, 0 ); - machine->gfx[2] = gfx_element_alloc( machine, &shape_layout, (UINT8 *)shaperam, machine->config->total_colors/2, 0 ); + machine->gfx[0] = gfx_element_alloc( machine, &cg_layout_8bpp, (UINT8 *)cgram, machine->total_colors()/256, 0 ); + machine->gfx[1] = gfx_element_alloc( machine, &cg_layout_4bpp, (UINT8 *)cgram, machine->total_colors()/16, 0 ); + machine->gfx[2] = gfx_element_alloc( machine, &shape_layout, (UINT8 *)shaperam, machine->total_colors()/2, 0 ); } /* namcona1_vh_start */ diff --git a/src/mame/video/naughtyb.c b/src/mame/video/naughtyb.c index be24195b82a..2238b2567a2 100644 --- a/src/mame/video/naughtyb.c +++ b/src/mame/video/naughtyb.c @@ -98,7 +98,7 @@ PALETTE_INIT( naughtyb ) 2, resistances, weights, 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; int r, g, b; diff --git a/src/mame/video/ojankohs.c b/src/mame/video/ojankohs.c index e6c9c58f803..506089374c9 100644 --- a/src/mame/video/ojankohs.c +++ b/src/mame/video/ojankohs.c @@ -22,7 +22,7 @@ PALETTE_INIT( ojankoy ) int i; int bit0, bit1, bit2, bit3, bit4, r, g, b; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { bit0 = BIT(color_prom[0], 2); bit1 = BIT(color_prom[0], 3); @@ -30,17 +30,17 @@ PALETTE_INIT( ojankoy ) bit3 = BIT(color_prom[0], 5); bit4 = BIT(color_prom[0], 6); r = 0x08 * bit0 + 0x11 * bit1 + 0x21 * bit2 + 0x43 * bit3 + 0x82 * bit4; - bit0 = BIT(color_prom[machine->config->total_colors], 5); - bit1 = BIT(color_prom[machine->config->total_colors], 6); - bit2 = BIT(color_prom[machine->config->total_colors], 7); + bit0 = BIT(color_prom[machine->total_colors()], 5); + bit1 = BIT(color_prom[machine->total_colors()], 6); + bit2 = BIT(color_prom[machine->total_colors()], 7); bit3 = BIT(color_prom[0], 0); bit4 = BIT(color_prom[0], 1); g = 0x08 * bit0 + 0x11 * bit1 + 0x21 * bit2 + 0x43 * bit3 + 0x82 * bit4; - bit0 = BIT(color_prom[machine->config->total_colors], 0); - bit1 = BIT(color_prom[machine->config->total_colors], 1); - bit2 = BIT(color_prom[machine->config->total_colors], 2); - bit3 = BIT(color_prom[machine->config->total_colors], 3); - bit4 = BIT(color_prom[machine->config->total_colors], 4); + bit0 = BIT(color_prom[machine->total_colors()], 0); + bit1 = BIT(color_prom[machine->total_colors()], 1); + bit2 = BIT(color_prom[machine->total_colors()], 2); + bit3 = BIT(color_prom[machine->total_colors()], 3); + bit4 = BIT(color_prom[machine->total_colors()], 4); b = 0x08 * bit0 + 0x11 * bit1 + 0x21 * bit2 + 0x43 * bit3 + 0x82 * bit4; palette_set_color(machine, i, MAKE_RGB(r, g, b)); diff --git a/src/mame/video/pastelg.c b/src/mame/video/pastelg.c index a46734b6b4f..f1e0c48ed68 100644 --- a/src/mame/video/pastelg.c +++ b/src/mame/video/pastelg.c @@ -36,7 +36,7 @@ PALETTE_INIT( pastelg ) int i; int bit0, bit1, bit2, bit3, r, g, b; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { bit0 = (color_prom[0] >> 0) & 0x01; bit1 = (color_prom[0] >> 1) & 0x01; @@ -48,10 +48,10 @@ PALETTE_INIT( pastelg ) bit2 = (color_prom[0] >> 6) & 0x01; bit3 = (color_prom[0] >> 7) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = (color_prom[machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[machine->total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine,i,MAKE_RGB(r,g,b)); diff --git a/src/mame/video/pcktgal.c b/src/mame/video/pcktgal.c index 5b7c06949fa..c891d4bb205 100644 --- a/src/mame/video/pcktgal.c +++ b/src/mame/video/pcktgal.c @@ -6,7 +6,7 @@ PALETTE_INIT( pcktgal ) { 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; @@ -20,10 +20,10 @@ PALETTE_INIT( pcktgal ) bit2 = (color_prom[i] >> 6) & 0x01; bit3 = (color_prom[i] >> 7) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = (color_prom[i + machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[i + machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[i + machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[i + machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[i + machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[i + machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[i + machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[i + machine->total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine,i,MAKE_RGB(r,g,b)); diff --git a/src/mame/video/plygonet.c b/src/mame/video/plygonet.c index b5666c90c34..1aba2451ac2 100644 --- a/src/mame/video/plygonet.c +++ b/src/mame/video/plygonet.c @@ -104,7 +104,7 @@ VIDEO_START( polygonet ) assert(ttl_gfx_index != MAX_GFX_ELEMENTS); /* decode the ttl layer's gfx */ - machine->gfx[ttl_gfx_index] = gfx_element_alloc(machine, &charlayout, memory_region(machine, "gfx1"), machine->config->total_colors / 16, 0); + machine->gfx[ttl_gfx_index] = gfx_element_alloc(machine, &charlayout, memory_region(machine, "gfx1"), machine->total_colors() / 16, 0); /* create the tilemap */ ttl_tilemap = tilemap_create(machine, ttl_get_tile_info, plygonet_scan, 8, 8, 64, 32); diff --git a/src/mame/video/rungun.c b/src/mame/video/rungun.c index e16608f10b9..f1b0e714712 100644 --- a/src/mame/video/rungun.c +++ b/src/mame/video/rungun.c @@ -92,7 +92,7 @@ VIDEO_START( rng ) assert(gfx_index != MAX_GFX_ELEMENTS); // decode the ttl layer's gfx - machine->gfx[gfx_index] = gfx_element_alloc(machine, &charlayout, memory_region(machine, "gfx3"), machine->config->total_colors / 16, 0); + machine->gfx[gfx_index] = gfx_element_alloc(machine, &charlayout, memory_region(machine, "gfx3"), machine->total_colors() / 16, 0); state->ttl_gfx_index = gfx_index; // create the tilemap diff --git a/src/mame/video/segaic24.c b/src/mame/video/segaic24.c index 0b34d962122..7b7b5a14f38 100644 --- a/src/mame/video/segaic24.c +++ b/src/mame/video/segaic24.c @@ -39,7 +39,7 @@ static void set_color(running_machine *machine, int color, UINT8 r, UINT8 g, UIN g = 0.6*g; b = 0.6*b; } - palette_set_color(machine,color+machine->config->total_colors/2, MAKE_RGB(r, g, b)); + palette_set_color(machine,color+machine->total_colors()/2, MAKE_RGB(r, g, b)); } // 315-5242 @@ -150,7 +150,7 @@ void sys24_tile_vh_start(running_machine *machine, UINT16 tile_mask) memset(sys24_char_ram, 0, 0x80000); memset(sys24_tile_ram, 0, 0x10000); - machine->gfx[sys24_char_gfx_index] = gfx_element_alloc(machine, &sys24_char_layout, (UINT8 *)sys24_char_ram, machine->config->total_colors / 16, 0); + machine->gfx[sys24_char_gfx_index] = gfx_element_alloc(machine, &sys24_char_layout, (UINT8 *)sys24_char_ram, machine->total_colors() / 16, 0); state_save_register_global_pointer(machine, sys24_tile_ram, 0x10000/2); state_save_register_global_pointer(machine, sys24_char_ram, 0x80000/2); diff --git a/src/mame/video/seicross.c b/src/mame/video/seicross.c index 1746440ed1f..1987f51b81a 100644 --- a/src/mame/video/seicross.c +++ b/src/mame/video/seicross.c @@ -35,7 +35,7 @@ PALETTE_INIT( seicross ) 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; diff --git a/src/mame/video/seta.c b/src/mame/video/seta.c index 022205efff5..9c40f08de78 100644 --- a/src/mame/video/seta.c +++ b/src/mame/video/seta.c @@ -739,7 +739,7 @@ static void draw_sprites_map(running_machine *machine, bitmap_t *bitmap,const re int offs, col; int xoffs, yoffs; - int total_color_codes = machine->config->gfxdecodeinfo[0].total_color_codes; + int total_color_codes = machine->config->m_gfxdecodeinfo[0].total_color_codes; int ctrl = spriteram16[ 0x600/2 ]; int ctrl2 = spriteram16[ 0x602/2 ]; @@ -843,7 +843,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan int offs; int xoffs, yoffs; - int total_color_codes = machine->config->gfxdecodeinfo[0].total_color_codes; + int total_color_codes = machine->config->m_gfxdecodeinfo[0].total_color_codes; int ctrl = spriteram16[ 0x600/2 ]; int ctrl2 = spriteram16[ 0x602/2 ]; diff --git a/src/mame/video/shootout.c b/src/mame/video/shootout.c index e7fa97ff521..5665d956a96 100644 --- a/src/mame/video/shootout.c +++ b/src/mame/video/shootout.c @@ -12,7 +12,7 @@ PALETTE_INIT( shootout ) 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; diff --git a/src/mame/video/sidepckt.c b/src/mame/video/sidepckt.c index 3aa24a8b7f4..8a79434f61f 100644 --- a/src/mame/video/sidepckt.c +++ b/src/mame/video/sidepckt.c @@ -6,7 +6,7 @@ PALETTE_INIT( sidepckt ) { 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; @@ -23,10 +23,10 @@ PALETTE_INIT( sidepckt ) bit3 = (color_prom[i] >> 3) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* blue component */ - bit0 = (color_prom[i + machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[i + machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[i + machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[i + machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[i + machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[i + machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[i + machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[i + machine->total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine,i,MAKE_RGB(r,g,b)); diff --git a/src/mame/video/snk.c b/src/mame/video/snk.c index d6b548ac22b..574f6cf2793 100644 --- a/src/mame/video/snk.c +++ b/src/mame/video/snk.c @@ -193,12 +193,12 @@ static VIDEO_START( snk_3bpp_shadow ) { int i; - if(!(machine->config->video_attributes & VIDEO_HAS_SHADOWS)) + if(!(machine->config->m_video_attributes & VIDEO_HAS_SHADOWS)) fatalerror("driver should use VIDEO_HAS_SHADOWS"); /* prepare shadow draw table */ for(i = 0; i <= 5; i++) drawmode_table[i] = DRAWMODE_SOURCE; - drawmode_table[6] = (machine->config->video_attributes & VIDEO_HAS_SHADOWS) ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; + drawmode_table[6] = (machine->config->m_video_attributes & VIDEO_HAS_SHADOWS) ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; drawmode_table[7] = DRAWMODE_NONE; for (i = 0x000;i < 0x400;i++) @@ -209,7 +209,7 @@ static VIDEO_START( snk_4bpp_shadow ) { int i; - if(!(machine->config->video_attributes & VIDEO_HAS_SHADOWS)) + if(!(machine->config->m_video_attributes & VIDEO_HAS_SHADOWS)) fatalerror("driver should use VIDEO_HAS_SHADOWS"); /* prepare shadow draw table */ diff --git a/src/mame/video/snk6502.c b/src/mame/video/snk6502.c index 67d3204c296..0f685dbecb2 100644 --- a/src/mame/video/snk6502.c +++ b/src/mame/video/snk6502.c @@ -24,7 +24,7 @@ static tilemap_t *fg_tilemap; static rgb_t palette[64]; #define TOTAL_COLORS(m,gfxn) ((m)->gfx[gfxn]->total_colors * (m)->gfx[gfxn]->color_granularity) -#define COLOR(m,gfxn,offs) ((m)->config->gfxdecodeinfo[gfxn].color_codes_start + offs) +#define COLOR(m,gfxn,offs) ((m)->config->m_gfxdecodeinfo[gfxn].color_codes_start + offs) @@ -39,7 +39,7 @@ PALETTE_INIT( snk6502 ) { 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; @@ -200,7 +200,7 @@ PALETTE_INIT( satansat ) { 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; diff --git a/src/mame/video/snookr10.c b/src/mame/video/snookr10.c index 1dc48c87686..73cf4318b99 100644 --- a/src/mame/video/snookr10.c +++ b/src/mame/video/snookr10.c @@ -73,7 +73,7 @@ PALETTE_INIT( snookr10 ) 2, resistances_g, weights_g, 100, 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; @@ -132,7 +132,7 @@ PALETTE_INIT( apple10 ) 2, resistances_g, weights_g, 100, 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; diff --git a/src/mame/video/spdodgeb.c b/src/mame/video/spdodgeb.c index a2a04a2e79c..3ec0006af5c 100644 --- a/src/mame/video/spdodgeb.c +++ b/src/mame/video/spdodgeb.c @@ -17,7 +17,7 @@ PALETTE_INIT( spdodgeb ) 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; @@ -35,10 +35,10 @@ PALETTE_INIT( spdodgeb ) bit3 = (color_prom[0] >> 7) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* blue component */ - bit0 = (color_prom[machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[machine->total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine,i,MAKE_RGB(r,g,b)); diff --git a/src/mame/video/srmp2.c b/src/mame/video/srmp2.c index 267c8654f55..e4b75cd7c14 100644 --- a/src/mame/video/srmp2.c +++ b/src/mame/video/srmp2.c @@ -14,11 +14,11 @@ PALETTE_INIT( srmp2 ) { int i; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { int col; - col = (color_prom[i] << 8) + color_prom[i + machine->config->total_colors]; + col = (color_prom[i] << 8) + color_prom[i + machine->total_colors()]; palette_set_color_rgb(machine,i ^ 0x0f,pal5bit(col >> 10),pal5bit(col >> 5),pal5bit(col >> 0)); } } @@ -28,11 +28,11 @@ PALETTE_INIT( srmp3 ) { int i; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { int col; - col = (color_prom[i] << 8) + color_prom[i + machine->config->total_colors]; + col = (color_prom[i] << 8) + color_prom[i + machine->total_colors()]; palette_set_color_rgb(machine,i,pal5bit(col >> 10),pal5bit(col >> 5),pal5bit(col >> 0)); } } @@ -285,7 +285,7 @@ static void mjyuugi_draw_sprites_map(running_machine *machine, bitmap_t *bitmap, int offs, col; int xoffs, yoffs; - int total_color_codes = machine->config->gfxdecodeinfo[0].total_color_codes; + int total_color_codes = machine->config->m_gfxdecodeinfo[0].total_color_codes; int ctrl = spriteram16[ 0x600/2 ]; int ctrl2 = spriteram16[ 0x602/2 ]; diff --git a/src/mame/video/suna16.c b/src/mame/video/suna16.c index 71cba2dac09..57c12c6535e 100644 --- a/src/mame/video/suna16.c +++ b/src/mame/video/suna16.c @@ -92,7 +92,7 @@ WRITE16_HANDLER( bestbest_flipscreen_w ) VIDEO_START( suna16 ) { - machine->generic.paletteram.u16 = auto_alloc_array(machine, UINT16, machine->config->total_colors); + machine->generic.paletteram.u16 = auto_alloc_array(machine, UINT16, machine->total_colors()); } READ16_HANDLER( suna16_paletteram16_r ) diff --git a/src/mame/video/system16.c b/src/mame/video/system16.c index 389a0b56150..b756fff450c 100644 --- a/src/mame/video/system16.c +++ b/src/mame/video/system16.c @@ -155,7 +155,7 @@ WRITE16_HANDLER( sys16_paletteram_w ) palette_set_color(space->machine, offset, MAKE_RGB(r, g, b) ); - palette_set_color(space->machine, offset + space->machine->config->total_colors/2, MAKE_RGB(rs,gs,bs)); + palette_set_color(space->machine, offset + space->machine->total_colors()/2, MAKE_RGB(rs,gs,bs)); } } #endif diff --git a/src/mame/video/tagteam.c b/src/mame/video/tagteam.c index 13cd6d937de..b92daff23d3 100644 --- a/src/mame/video/tagteam.c +++ b/src/mame/video/tagteam.c @@ -18,7 +18,7 @@ PALETTE_INIT( tagteam ) { 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; diff --git a/src/mame/video/taitojc.c b/src/mame/video/taitojc.c index 36af98fad39..96929c61280 100644 --- a/src/mame/video/taitojc.c +++ b/src/mame/video/taitojc.c @@ -194,7 +194,7 @@ VIDEO_START( taitojc ) state->tile_ram = auto_alloc_array_clear(machine, UINT32, 0x4000/4); /* create the char set (gfx will then be updated dynamically from RAM) */ - machine->gfx[state->gfx_index] = gfx_element_alloc(machine, &taitojc_char_layout, (UINT8 *)state->char_ram, machine->config->total_colors / 16, 0); + machine->gfx[state->gfx_index] = gfx_element_alloc(machine, &taitojc_char_layout, (UINT8 *)state->char_ram, machine->total_colors() / 16, 0); state->texture = auto_alloc_array(machine, UINT8, 0x400000); diff --git a/src/mame/video/timelimt.c b/src/mame/video/timelimt.c index 3d1f09fe40b..7f293e72199 100644 --- a/src/mame/video/timelimt.c +++ b/src/mame/video/timelimt.c @@ -30,7 +30,7 @@ static tilemap_t *bg_tilemap, *fg_tilemap; PALETTE_INIT( timelimt ) { 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; diff --git a/src/mame/video/tnzs.c b/src/mame/video/tnzs.c index 3ff063ecb37..69ad1080359 100644 --- a/src/mame/video/tnzs.c +++ b/src/mame/video/tnzs.c @@ -34,7 +34,7 @@ PALETTE_INIT( arknoid2 ) { int i, col; - for (i = 0; i < machine->config->total_colors; i++) + for (i = 0; i < machine->total_colors(); i++) { col = (color_prom[i] << 8) + color_prom[i + 512]; palette_set_color_rgb(machine, i, pal5bit(col >> 10), pal5bit(col >> 5), pal5bit(col >> 0)); diff --git a/src/mame/video/truco.c b/src/mame/video/truco.c index 101a66f15b0..5769869c758 100644 --- a/src/mame/video/truco.c +++ b/src/mame/video/truco.c @@ -12,7 +12,7 @@ PALETTE_INIT( truco ) { int i; - for (i = 0;i < machine->config->total_colors;i++) + for (i = 0;i < machine->total_colors();i++) { int r = ( i & 0x8 ) ? 0xff : 0x00; int g = ( i & 0x4 ) ? 0xff : 0x00; diff --git a/src/mame/video/tryout.c b/src/mame/video/tryout.c index 284a583d3c7..a7908ea2a37 100644 --- a/src/mame/video/tryout.c +++ b/src/mame/video/tryout.c @@ -16,7 +16,7 @@ PALETTE_INIT( tryout ) { 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; diff --git a/src/mame/video/tubep.c b/src/mame/video/tubep.c index f229d50950a..c30b40a56ff 100644 --- a/src/mame/video/tubep.c +++ b/src/mame/video/tubep.c @@ -725,7 +725,7 @@ PALETTE_INIT( rjammer ) 2, resistors_b, weights_b, 470, 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,r,g,b; diff --git a/src/mame/video/wiz.c b/src/mame/video/wiz.c index 0008968a718..07ab50f7879 100644 --- a/src/mame/video/wiz.c +++ b/src/mame/video/wiz.c @@ -62,7 +62,7 @@ PALETTE_INIT( wiz ) 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; @@ -72,15 +72,15 @@ PALETTE_INIT( wiz ) bit2 = (color_prom[0] >> 2) & 0x01; bit3 = (color_prom[0] >> 3) & 0x01; r = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3; - bit0 = (color_prom[machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[machine->total_colors()] >> 3) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3; - bit0 = (color_prom[2*machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[2*machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[2*machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[2*machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[2*machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[2*machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[2*machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[2*machine->total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3; palette_set_color(machine,i,MAKE_RGB(r,g,b)); diff --git a/src/mame/video/xorworld.c b/src/mame/video/xorworld.c index 97a920225b1..50c9b7d74ea 100644 --- a/src/mame/video/xorworld.c +++ b/src/mame/video/xorworld.c @@ -20,7 +20,7 @@ PALETTE_INIT( xorworld ) { int i; - for (i = 0;i < machine->config->total_colors;i++){ + for (i = 0;i < machine->total_colors();i++){ int bit0,bit1,bit2,bit3; int r,g,b; @@ -31,16 +31,16 @@ PALETTE_INIT( xorworld ) bit3 = (color_prom[0] >> 3) & 0x01; r = 0x0e*bit0 + 0x1e*bit1 + 0x44*bit2 + 0x8f*bit3; /* green component */ - bit0 = (color_prom[machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[machine->total_colors()] >> 3) & 0x01; g = 0x0e*bit0 + 0x1e*bit1 + 0x44*bit2 + 0x8f*bit3; /* blue component */ - bit0 = (color_prom[2*machine->config->total_colors] >> 0) & 0x01; - bit1 = (color_prom[2*machine->config->total_colors] >> 1) & 0x01; - bit2 = (color_prom[2*machine->config->total_colors] >> 2) & 0x01; - bit3 = (color_prom[2*machine->config->total_colors] >> 3) & 0x01; + bit0 = (color_prom[2*machine->total_colors()] >> 0) & 0x01; + bit1 = (color_prom[2*machine->total_colors()] >> 1) & 0x01; + bit2 = (color_prom[2*machine->total_colors()] >> 2) & 0x01; + bit3 = (color_prom[2*machine->total_colors()] >> 3) & 0x01; b = 0x0e*bit0 + 0x1e * bit1 + 0x44*bit2 + 0x8f*bit3; palette_set_color(machine,i,MAKE_RGB(r,g,b)); diff --git a/src/mame/video/xyonix.c b/src/mame/video/xyonix.c index 38525d9f927..d43967a9136 100644 --- a/src/mame/video/xyonix.c +++ b/src/mame/video/xyonix.c @@ -6,7 +6,7 @@ PALETTE_INIT( xyonix ) 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; diff --git a/src/mame/video/ygv608.c b/src/mame/video/ygv608.c index 56219794b67..c85fc418a0c 100644 --- a/src/mame/video/ygv608.c +++ b/src/mame/video/ygv608.c @@ -101,7 +101,7 @@ static TILEMAP_MAPPER( get_tile_offset ) } #define layout_total(x) \ -(machine->config->gfxdecodeinfo[x].gfxlayout->total) +(machine->config->m_gfxdecodeinfo[x].gfxlayout->total) static TILE_GET_INFO( get_tile_info_A_8 ) { diff --git a/src/mame/video/yiear.c b/src/mame/video/yiear.c index 0a143e210db..7f3bea875a9 100644 --- a/src/mame/video/yiear.c +++ b/src/mame/video/yiear.c @@ -32,7 +32,7 @@ PALETTE_INIT( yiear ) { 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; diff --git a/src/mame/video/zaxxon.c b/src/mame/video/zaxxon.c index 90007bb5388..8e3658a86e8 100644 --- a/src/mame/video/zaxxon.c +++ b/src/mame/video/zaxxon.c @@ -29,7 +29,7 @@ PALETTE_INIT( zaxxon ) 2, &resistances[1], bweights, 470, 0); /* 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 r, g, b; diff --git a/src/osd/sdl/video.c b/src/osd/sdl/video.c index 4a4a9c4f616..017c7f2b20a 100644 --- a/src/osd/sdl/video.c +++ b/src/osd/sdl/video.c @@ -125,7 +125,7 @@ int sdlvideo_init(running_machine *machine) if (sdlwindow_init(machine)) goto error; - tc = machine->config->total_colors; + tc = machine->total_colors(); // create the windows for (index = 0; index < video_config.numscreens; index++) |