diff options
148 files changed, 631 insertions, 633 deletions
diff --git a/src/emu/cheat.c b/src/emu/cheat.c index 4f668ab751c..2391b8c53a8 100644 --- a/src/emu/cheat.c +++ b/src/emu/cheat.c @@ -167,7 +167,7 @@ inline const char *number_and_format::format(astring &string) const cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node ¶mnode) : m_value(0), - m_itemlist(manager.machine().m_respool) + m_itemlist(manager.machine().respool()) { // read the core attributes m_minval = number_and_format(xml_get_attribute_int(¶mnode, "min", 0), xml_get_attribute_int_format(¶mnode, "min")); @@ -347,7 +347,7 @@ bool cheat_parameter::set_next_state() //------------------------------------------------- cheat_script::cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node &scriptnode) - : m_entrylist(manager.machine().m_respool), + : m_entrylist(manager.machine().respool()), m_state(SCRIPT_STATE_RUN) { // read the core attributes @@ -433,7 +433,7 @@ cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &s : m_next(NULL), m_condition(&symbols), m_expression(&symbols), - m_arglist(manager.machine().m_respool) + m_arglist(manager.machine().respool()) { const char *expression = NULL; try @@ -1088,7 +1088,7 @@ cheat_script *&cheat_entry::script_for_state(script_state state) cheat_manager::cheat_manager(running_machine &machine) : m_machine(machine), - m_cheatlist(machine.m_respool), + m_cheatlist(machine.respool()), m_disabled(true), m_symtable(&machine) { diff --git a/src/emu/config.c b/src/emu/config.c index 2cb5a7118ac..af7ea10f395 100644 --- a/src/emu/config.c +++ b/src/emu/config.c @@ -201,13 +201,13 @@ static int config_load_xml(running_machine *machine, emu_file &file, int which_t goto error; /* strip off all the path crap from the source filename */ - srcfile = strrchr(machine->gamedrv->source_file, '/'); + srcfile = strrchr(machine->system().source_file, '/'); if (!srcfile) - srcfile = strrchr(machine->gamedrv->source_file, '\\'); + srcfile = strrchr(machine->system().source_file, '\\'); if (!srcfile) - srcfile = strrchr(machine->gamedrv->source_file, ':'); + srcfile = strrchr(machine->system().source_file, ':'); if (!srcfile) - srcfile = machine->gamedrv->source_file; + srcfile = machine->system().source_file; else srcfile++; @@ -223,7 +223,7 @@ static int config_load_xml(running_machine *machine, emu_file &file, int which_t { case CONFIG_TYPE_GAME: /* only match on the specific game name */ - if (strcmp(name, machine->gamedrv->name) != 0) + if (strcmp(name, machine->system().name) != 0) continue; break; @@ -238,9 +238,9 @@ static int config_load_xml(running_machine *machine, emu_file &file, int which_t const game_driver *clone_of; /* match on: default, game name, source file name, parent name, grandparent name */ if (strcmp(name, "default") != 0 && - strcmp(name, machine->gamedrv->name) != 0 && + strcmp(name, machine->system().name) != 0 && strcmp(name, srcfile) != 0 && - ((clone_of = driver_get_clone(machine->gamedrv)) == NULL || strcmp(name, clone_of->name) != 0) && + ((clone_of = driver_get_clone(&machine->system())) == NULL || strcmp(name, clone_of->name) != 0) && (clone_of == NULL || ((clone_of = driver_get_clone(clone_of)) == NULL) || strcmp(name, clone_of->name) != 0)) continue; break; @@ -299,7 +299,7 @@ static int config_save_xml(running_machine *machine, emu_file &file, int which_t systemnode = xml_add_child(confignode, "system", NULL); if (!systemnode) goto error; - xml_set_attribute(systemnode, "name", (which_type == CONFIG_TYPE_DEFAULT) ? "default" : machine->gamedrv->name); + xml_set_attribute(systemnode, "name", (which_type == CONFIG_TYPE_DEFAULT) ? "default" : machine->system().name); /* create the input node and write it out */ /* loop over all registrants and call their save function */ diff --git a/src/emu/cpu/drcfe.c b/src/emu/cpu/drcfe.c index ae6cbdb5ecc..43b71385772 100644 --- a/src/emu/cpu/drcfe.c +++ b/src/emu/cpu/drcfe.c @@ -84,8 +84,8 @@ drc_frontend::drc_frontend(device_t &cpu, UINT32 window_start, UINT32 window_end m_cpudevice(downcast<cpu_device &>(cpu)), m_program(m_cpudevice.space(AS_PROGRAM)), m_pageshift(m_cpudevice.space_config(AS_PROGRAM)->m_page_shift), - m_desc_live_list(cpu.machine->m_respool), - m_desc_allocator(cpu.machine->m_respool), + m_desc_live_list(cpu.machine->respool()), + m_desc_allocator(cpu.machine->respool()), m_desc_array(auto_alloc_array_clear(cpu.machine, opcode_desc *, window_end + window_start + 2)) { } diff --git a/src/emu/cpu/drcuml.c b/src/emu/cpu/drcuml.c index a921999d2d4..1f6e48fe0d9 100644 --- a/src/emu/cpu/drcuml.c +++ b/src/emu/cpu/drcuml.c @@ -154,8 +154,8 @@ drcuml_state::drcuml_state(device_t &device, drc_cache &cache, UINT32 flags, int *static_cast<drcbe_interface *>(auto_alloc(device.machine, drcbe_c(*this, device, cache, flags, modes, addrbits, ignorebits))) : *static_cast<drcbe_interface *>(auto_alloc(device.machine, drcbe_native(*this, device, cache, flags, modes, addrbits, ignorebits)))), m_umllog(NULL), - m_blocklist(device.machine->m_respool), - m_symlist(device.machine->m_respool) + m_blocklist(device.machine->respool()), + m_symlist(device.machine->respool()) { // if we're to log, create the logfile if (flags & DRCUML_OPTION_LOG_UML) diff --git a/src/emu/crsshair.c b/src/emu/crsshair.c index e098e38ea0a..c2ed06f4233 100644 --- a/src/emu/crsshair.c +++ b/src/emu/crsshair.c @@ -169,7 +169,7 @@ static void create_bitmap(running_machine *machine, int player) { /* look for default cross?.png in crsshair\game dir */ sprintf(filename, "cross%d.png", player + 1); - global.bitmap[player] = render_load_png(crossfile, machine->gamedrv->name, filename, NULL, NULL); + global.bitmap[player] = render_load_png(crossfile, machine->system().name, filename, NULL, NULL); /* look for default cross?.png in crsshair dir */ if (global.bitmap[player] == NULL) diff --git a/src/emu/debug/debugcon.c b/src/emu/debug/debugcon.c index 58073de9f7a..f09d3cce4fb 100644 --- a/src/emu/debug/debugcon.c +++ b/src/emu/debug/debugcon.c @@ -96,7 +96,7 @@ void debug_console_init(running_machine *machine) /* print the opening lines */ debug_console_printf(machine, "MAME new debugger version %s\n", build_version); - debug_console_printf(machine, "Currently targeting %s (%s)\n", machine->gamedrv->name, machine->gamedrv->description); + debug_console_printf(machine, "Currently targeting %s (%s)\n", machine->system().name, machine->system().description); /* request callback upon exiting */ machine->add_notifier(MACHINE_NOTIFY_EXIT, debug_console_exit); diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index e8cd3830303..d530745c6ed 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -337,7 +337,7 @@ bool debug_comment_save(running_machine *machine) xml_data_node *systemnode = xml_add_child(commentnode, "system", NULL); if (systemnode == NULL) throw emu_exception(); - xml_set_attribute(systemnode, "name", machine->gamedrv->name); + xml_set_attribute(systemnode, "name", machine->system().name); // for each device bool found_comments = false; @@ -413,7 +413,7 @@ bool debug_comment_load(running_machine *machine) // check to make sure the file is applicable xml_data_node *systemnode = xml_get_sibling(commentnode->child, "system"); const char *name = xml_get_attribute_string(systemnode, "name", ""); - if (strcmp(name, machine->gamedrv->name) != 0) + if (strcmp(name, machine->system().name) != 0) throw emu_exception(); // iterate over devices diff --git a/src/emu/debug/dvmemory.c b/src/emu/debug/dvmemory.c index f7398692729..8d636999e49 100644 --- a/src/emu/debug/dvmemory.c +++ b/src/emu/debug/dvmemory.c @@ -165,7 +165,7 @@ void debug_view_memory::enumerate_sources() } // then add all the memory regions - for (const memory_region *region = m_machine.m_regionlist.first(); region != NULL; region = region->next()) + for (const memory_region *region = m_machine.first_region(); region != NULL; region = region->next()) { name.printf("Region '%s'", region->name()); m_source_list.append(*auto_alloc(&m_machine, debug_view_memory_source(name, *region))); diff --git a/src/emu/devcb.h b/src/emu/devcb.h index d252481e6ed..6940923bed8 100644 --- a/src/emu/devcb.h +++ b/src/emu/devcb.h @@ -75,7 +75,7 @@ template<class _Class, UINT8 (_Class::*_Function)(address_space &, offs_t, UINT8 UINT8 devcb_stub(device_t *device, offs_t offset) { _Class *target = downcast<_Class *>(device); - return (target->*_Function)(*device->machine->m_nonspecific_space, offset, 0xff); + return (target->*_Function)(*memory_nonspecific_space(device->machine), offset, 0xff); } // static template for a write_line stub function that calls through a given WRITE_LINE_MEMBER @@ -91,7 +91,7 @@ template<class _Class, void (_Class::*_Function)(address_space &, offs_t, UINT8, void devcb_stub(device_t *device, offs_t offset, UINT8 data) { _Class *target = downcast<_Class *>(device); - (target->*_Function)(*device->machine->m_nonspecific_space, offset, data, 0xff); + (target->*_Function)(*memory_nonspecific_space(device->machine), offset, data, 0xff); } #define DEVCB_NULL { DEVCB_TYPE_NULL } diff --git a/src/emu/devintrf.c b/src/emu/devintrf.c index 5d6026fcd82..60c217b06af 100644 --- a/src/emu/devintrf.c +++ b/src/emu/devintrf.c @@ -81,7 +81,7 @@ resource_pool &machine_get_pool(running_machine &machine) { // temporary to get around include dependencies, until CPUs // get a proper device class - return machine.m_respool; + return machine.respool(); } @@ -749,7 +749,7 @@ void device_t::start() if (state_registrations == 0 && (interface(exec) || interface(sound))) { logerror("Device '%s' did not register any state to save!\n", tag()); - if ((m_machine.gamedrv->flags & GAME_SUPPORTS_SAVE) != 0) + if ((m_machine.system().flags & GAME_SUPPORTS_SAVE) != 0) fatalerror("Device '%s' did not register any state to save!", tag()); } diff --git a/src/emu/diimage.c b/src/emu/diimage.c index b0e17c85d85..6ef5203baec 100644 --- a/src/emu/diimage.c +++ b/src/emu/diimage.c @@ -394,7 +394,7 @@ void device_image_interface::setup_working_directory() if (try_change_working_directory("software")) { /* now down to a directory for this computer */ - gamedrv = device().machine->gamedrv; + gamedrv = &device().machine->system(); while(gamedrv && !try_change_working_directory(gamedrv->name)) { gamedrv = driver_get_compatible(gamedrv); @@ -582,7 +582,7 @@ UINT32 device_image_interface::crc() -------------------------------------------------*/ void device_image_interface::battery_load(void *buffer, int length, int fill) { - astring *fname = astring_assemble_4(astring_alloc(), device().machine->gamedrv->name, PATH_SEPARATOR, m_basename_noext, ".nv"); + astring *fname = astring_assemble_4(astring_alloc(), device().machine->system().name, PATH_SEPARATOR, m_basename_noext, ".nv"); image_battery_load_by_name(device().machine->options(), astring_c(fname), buffer, length, fill); astring_free(fname); @@ -596,7 +596,7 @@ void device_image_interface::battery_load(void *buffer, int length, int fill) -------------------------------------------------*/ void device_image_interface::battery_save(const void *buffer, int length) { - astring *fname = astring_assemble_4(astring_alloc(), device().machine->gamedrv->name, PATH_SEPARATOR, m_basename_noext, ".nv"); + astring *fname = astring_assemble_4(astring_alloc(), device().machine->system().name, PATH_SEPARATOR, m_basename_noext, ".nv"); image_battery_save_by_name(device().machine->options(), astring_c(fname), buffer, length); astring_free(fname); diff --git a/src/emu/drawgfx.c b/src/emu/drawgfx.c index 3132039aa11..c5701def17e 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->m_gfxdecodeinfo; + const gfx_decode_entry *gfxdecodeinfo = machine->config().m_gfxdecodeinfo; int curgfx; /* skip if nothing to do */ diff --git a/src/emu/emupal.c b/src/emu/emupal.c index 7b705e0ce79..819c1746283 100644 --- a/src/emu/emupal.c +++ b/src/emu/emupal.c @@ -319,7 +319,6 @@ colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize) UINT32 index; assert(machine != NULL); - assert(machine->config != NULL); assert(palettesize > 0); /* allocate the colortable */ @@ -583,9 +582,9 @@ static void allocate_palette(running_machine *machine, palette_private *palette) /* determine the number of groups we need */ numgroups = 1; - if (machine->config->m_video_attributes & VIDEO_HAS_SHADOWS) + if (machine->config().m_video_attributes & VIDEO_HAS_SHADOWS) palette->shadow_group = numgroups++; - if (machine->config->m_video_attributes & VIDEO_HAS_HIGHLIGHTS) + if (machine->config().m_video_attributes & VIDEO_HAS_HIGHLIGHTS) palette->hilight_group = numgroups++; assert_always(machine->total_colors() * numgroups <= 65536, "Error: palette has more than 65536 colors."); @@ -680,7 +679,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->m_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; @@ -703,7 +702,7 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa } /* if we have hilights, allocate shadow tables */ - if (machine->config->m_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; diff --git a/src/emu/image.c b/src/emu/image.c index 1baf723183b..03cfb34e339 100644 --- a/src/emu/image.c +++ b/src/emu/image.c @@ -176,7 +176,7 @@ static void image_options_extract(running_machine *machine) /* write the config, if appropriate */ if (machine->options().write_config()) - write_config(machine->options(), NULL, machine->gamedrv); + write_config(machine->options(), NULL, &machine->system()); } /*------------------------------------------------- @@ -368,7 +368,7 @@ astring *image_info_astring(running_machine *machine, astring *string) { device_image_interface *image = NULL; - astring_printf(string, "%s\n\n", machine->gamedrv->description); + astring_printf(string, "%s\n\n", machine->system().description); #if 0 if (mess_ram_size > 0) @@ -493,22 +493,22 @@ void image_add_device_with_subdevices(device_t *owner, device_type type, const c { astring tempstring; device_list *device_list = &owner->machine->m_devicelist; - machine_config *config = (machine_config *)owner->machine->config; + machine_config &config = const_cast<machine_config &>(owner->machine->config()); - device_config *devconfig = type(*config, owner->subtag(tempstring,tag), &owner->baseconfig(), clock); + device_config *devconfig = type(config, owner->subtag(tempstring,tag), &owner->baseconfig(), clock); device_t &device = device_list->append(devconfig->tag(), *devconfig->alloc_device(*owner->machine)); machine_config_constructor machconfig = device.machine_config_additions(); if (machconfig != NULL) { - (*machconfig)(*config, devconfig); - for (const device_config *config_dev = config->m_devicelist.first(); config_dev != NULL; config_dev = config_dev->next()) + (*machconfig)(config, devconfig); + for (const device_config *config_dev = config.m_devicelist.first(); config_dev != NULL; config_dev = config_dev->next()) { if (config_dev->owner()==devconfig) { device_list->append(config_dev->tag(), *config_dev->alloc_device(*owner->machine)); } } } - config->m_devicelist.append(devconfig->tag(), *devconfig); + config.m_devicelist.append(devconfig->tag(), *devconfig); } diff --git a/src/emu/imagedev/cartslot.c b/src/emu/imagedev/cartslot.c index 5be5ae0a7ff..60e1a25820c 100644 --- a/src/emu/imagedev/cartslot.c +++ b/src/emu/imagedev/cartslot.c @@ -169,7 +169,7 @@ static int process_cartridge(device_image_interface *image, process_mode mode) const rom_entry *romrgn, *roment; int result = 0; - for (source = rom_first_source(*image->device().machine->config); source != NULL; source = rom_next_source(*source)) + for (source = rom_first_source(image->device().machine->config()); source != NULL; source = rom_next_source(*source)) { for (romrgn = rom_first_region(*source); romrgn != NULL; romrgn = rom_next_region(romrgn)) { @@ -303,7 +303,7 @@ static DEVICE_IMAGE_LOAD( cartslot ) return (*config->device_load)(image); /* try opening this as if it were a multicart */ - multicart_open(device->machine->options(), image.filename(), device->machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc); + multicart_open(device->machine->options(), image.filename(), device->machine->system().name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc); if (cart->mc == NULL) { @@ -360,7 +360,7 @@ static const cartslot_pcb_type *identify_pcb(device_image_interface &image) if (image.software_entry() == NULL && image.exists()) { /* try opening this as if it were a multicart */ - multicart_open_error me = multicart_open(image.device().machine->options(), image.filename(), image.device().machine->gamedrv->name, MULTICART_FLAGS_DONT_LOAD_RESOURCES, &mc); + multicart_open_error me = multicart_open(image.device().machine->options(), image.filename(), image.device().machine->system().name, MULTICART_FLAGS_DONT_LOAD_RESOURCES, &mc); if (me == MCERR_NONE) { /* this was a multicart - read from it */ diff --git a/src/emu/inptport.c b/src/emu/inptport.c index 3dda70c83d3..59d834634e2 100644 --- a/src/emu/inptport.c +++ b/src/emu/inptport.c @@ -4547,8 +4547,8 @@ static time_t playback_init(running_machine *machine) mame_printf_info("Recorded using %s\n", header + 0x20); /* verify the header against the current game */ - if (memcmp(machine->gamedrv->name, header + 0x14, strlen(machine->gamedrv->name) + 1) != 0) - mame_printf_info("Input file is for " GAMENOUN " '%s', not for current " GAMENOUN " '%s'\n", header + 0x14, machine->gamedrv->name); + if (memcmp(machine->system().name, header + 0x14, strlen(machine->system().name) + 1) != 0) + mame_printf_info("Input file is for " GAMENOUN " '%s', not for current " GAMENOUN " '%s'\n", header + 0x14, machine->system().name); /* enable compression */ portdata->playback_file->compress(FCOMPRESS_MEDIUM); @@ -4744,7 +4744,7 @@ static void record_init(running_machine *machine) header[0x0f] = systime.time >> 56; header[0x10] = INP_HEADER_MAJVERSION; header[0x11] = INP_HEADER_MINVERSION; - strcpy((char *)header + 0x14, machine->gamedrv->name); + strcpy((char *)header + 0x14, machine->system().name); sprintf((char *)header + 0x20, APPNAME " %s", build_version); /* write it */ diff --git a/src/emu/machine.c b/src/emu/machine.c index 8f7625d424f..2ea6772b10a 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -139,22 +139,15 @@ static char giant_string_buffer[65536] = { 0 }; //------------------------------------------------- running_machine::running_machine(const machine_config &_config, osd_interface &osd, bool exit_to_game_select) - : m_regionlist(m_respool), - m_devicelist(m_respool), - config(&_config), - m_config(_config), + : m_devicelist(m_respool), firstcpu(NULL), - gamedrv(&_config.gamedrv()), - m_game(_config.gamedrv()), primary_screen(NULL), palette(NULL), pens(NULL), colortable(NULL), shadow_table(NULL), priority_bitmap(NULL), - sample_rate(_config.options().sample_rate()), debug_flags(0), - ui_active(false), memory_data(NULL), palette_data(NULL), tilemap_data(NULL), @@ -166,11 +159,19 @@ running_machine::running_machine(const machine_config &_config, osd_interface &o generic_machine_data(NULL), generic_video_data(NULL), generic_audio_data(NULL), - m_logerror_list(NULL), + + m_config(_config), + m_system(_config.gamedrv()), + m_osd(osd), + m_regionlist(m_respool), m_state(*this), m_scheduler(*this), - m_osd(osd), - m_basename(_config.gamedrv().name), + m_cheat(NULL), + m_render(NULL), + m_sound(NULL), + m_video(NULL), + m_debug_view(NULL), + m_driver_device(NULL), m_current_phase(MACHINE_PHASE_PREINIT), m_paused(false), m_hard_reset_pending(false), @@ -178,21 +179,18 @@ running_machine::running_machine(const machine_config &_config, osd_interface &o m_exit_to_game_select(exit_to_game_select), m_new_driver_pending(NULL), m_soft_reset_timer(NULL), + m_rand_seed(0x9d14abd7), + m_ui_active(false), + m_basename(_config.gamedrv().name), + m_sample_rate(_config.options().sample_rate()), m_logfile(NULL), m_saveload_schedule(SLS_NONE), m_saveload_schedule_time(attotime::zero), m_saveload_searchpath(NULL), - m_rand_seed(0x9d14abd7), - m_driver_device(NULL), - m_cheat(NULL), - m_render(NULL), - m_sound(NULL), - m_video(NULL), - m_debug_view(NULL) + m_logerror_list(m_respool) { memset(gfx, 0, sizeof(gfx)); memset(&generic, 0, sizeof(generic)); - memset(m_notifier_list, 0, sizeof(m_notifier_list)); memset(&m_base_time, 0, sizeof(m_base_time)); // find the driver device config and tell it which game @@ -284,7 +282,7 @@ void running_machine::start() // 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, m_config.m_devicelist); + time_t newbase = input_port_init(this, m_system.ipt, m_config.m_devicelist); if (newbase != 0) m_base_time = newbase; @@ -332,7 +330,7 @@ void running_machine::start() schedule_load(savegame); // if we're in autosave mode, schedule a load - else if (options().autosave() && (m_game.flags & GAME_SUPPORTS_SAVE) != 0) + else if (options().autosave() && (m_system.flags & GAME_SUPPORTS_SAVE) != 0) schedule_load("auto"); // set up the cheat engine @@ -458,7 +456,7 @@ void running_machine::schedule_exit() m_scheduler.eat_all_cycles(); // if we're autosaving on exit, schedule a save as well - if (options().autosave() && (m_game.flags & GAME_SUPPORTS_SAVE) && this->time() > attotime::zero) + if (options().autosave() && (m_system.flags & GAME_SUPPORTS_SAVE) && this->time() > attotime::zero) schedule_save("auto"); } @@ -637,19 +635,11 @@ void running_machine::add_notifier(machine_notification event, notify_callback c // exit notifiers are added to the head, and executed in reverse order if (event == MACHINE_NOTIFY_EXIT) - { - notifier_callback_item *notifier = auto_alloc(this, notifier_callback_item(callback)); - notifier->m_next = m_notifier_list[event]; - m_notifier_list[event] = notifier; - } + m_notifier_list[event].prepend(*global_alloc(notifier_callback_item(callback))); // all other notifiers are added to the tail, and executed in the order registered else - { - notifier_callback_item **tailptr; - for (tailptr = &m_notifier_list[event]; *tailptr != NULL; tailptr = &(*tailptr)->m_next) ; - *tailptr = auto_alloc(this, notifier_callback_item(callback)); - } + m_notifier_list[event].append(*global_alloc(notifier_callback_item(callback))); } @@ -661,10 +651,7 @@ void running_machine::add_notifier(machine_notification event, notify_callback c void running_machine::add_logerror_callback(logerror_callback callback) { assert_always(m_current_phase == MACHINE_PHASE_INIT, "Can only call add_logerror_callback at init time!"); - - logerror_callback_item **tailptr; - for (tailptr = &m_logerror_list; *tailptr != NULL; tailptr = &(*tailptr)->m_next) ; - *tailptr = auto_alloc(this, logerror_callback_item(callback)); + m_logerror_list.append(*auto_alloc(this, logerror_callback_item(callback))); } @@ -675,7 +662,7 @@ void running_machine::add_logerror_callback(logerror_callback callback) void CLIB_DECL running_machine::logerror(const char *format, ...) { // process only if there is a target - if (m_logerror_list != NULL) + if (m_logerror_list.first() != NULL) { va_list arg; va_start(arg, format); @@ -692,7 +679,7 @@ void CLIB_DECL running_machine::logerror(const char *format, ...) void CLIB_DECL running_machine::vlogerror(const char *format, va_list args) { // process only if there is a target - if (m_logerror_list != NULL) + if (m_logerror_list.first() != NULL) { g_profiler.start(PROFILER_LOGERROR); @@ -700,7 +687,7 @@ void CLIB_DECL running_machine::vlogerror(const char *format, va_list args) vsnprintf(giant_string_buffer, ARRAY_LENGTH(giant_string_buffer), format, args); // log to all callbacks - for (logerror_callback_item *cb = m_logerror_list; cb != NULL; cb = cb->m_next) + for (logerror_callback_item *cb = m_logerror_list.first(); cb != NULL; cb = cb->next()) (*cb->m_func)(*this, giant_string_buffer); g_profiler.stop(); @@ -752,7 +739,7 @@ UINT32 running_machine::rand() void running_machine::call_notifiers(machine_notification which) { - for (notifier_callback_item *cb = m_notifier_list[which]; cb != NULL; cb = cb->m_next) + for (notifier_callback_item *cb = m_notifier_list[which].first(); cb != NULL; cb = cb->next()) (*cb->m_func)(*this); } @@ -814,7 +801,7 @@ void running_machine::handle_saveload() break; case STATERR_NONE: - if (!(m_game.flags & GAME_SUPPORTS_SAVE)) + if (!(m_system.flags & GAME_SUPPORTS_SAVE)) popmessage("State successfully %s.\nWarning: Save states are not officially supported for this game.", opnamed); else popmessage("State successfully %s.", opnamed); @@ -942,7 +929,7 @@ running_machine::logerror_callback_item::logerror_callback_item(logerror_callbac driver_device_config_base::driver_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner) : device_config(mconfig, type, "Driver Device", tag, owner, 0), - m_game(NULL), + m_system(NULL), m_palette_init(NULL) { memset(m_callbacks, 0, sizeof(m_callbacks)); @@ -956,7 +943,7 @@ driver_device_config_base::driver_device_config_base(const machine_config &mconf void driver_device_config_base::static_set_game(device_config *device, const game_driver *game) { - downcast<driver_device_config_base *>(device)->m_game = game; + downcast<driver_device_config_base *>(device)->m_system = game; downcast<driver_device_config_base *>(device)->m_shortname = game->name; } @@ -992,7 +979,7 @@ void driver_device_config_base::static_set_palette_init(device_config *device, p const rom_entry *driver_device_config_base::rom_region() const { - return m_game->rom; + return m_system->rom; } @@ -1146,8 +1133,8 @@ void driver_device::device_start() throw device_missing_dependencies(); // call the game-specific init - if (m_config.m_game->driver_init != NULL) - (*m_config.m_game->driver_init)(&m_machine); + if (m_config.m_system->driver_init != NULL) + (*m_config.m_system->driver_init)(&m_machine); // finish image devices init process image_postdevice_init(&m_machine); diff --git a/src/emu/machine.h b/src/emu/machine.h index 68bb12f0246..775b416cf85 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -153,11 +153,11 @@ const int DEBUG_FLAG_OSD_ENABLED = 0x00001000; // The OSD debugger is enabled // global allocation helpers -#define auto_alloc(m, t) pool_alloc(static_cast<running_machine *>(m)->m_respool, t) -#define auto_alloc_clear(m, t) pool_alloc_clear(static_cast<running_machine *>(m)->m_respool, t) -#define auto_alloc_array(m, t, c) pool_alloc_array(static_cast<running_machine *>(m)->m_respool, t, c) -#define auto_alloc_array_clear(m, t, c) pool_alloc_array_clear(static_cast<running_machine *>(m)->m_respool, t, c) -#define auto_free(m, v) pool_free(static_cast<running_machine *>(m)->m_respool, v) +#define auto_alloc(m, t) pool_alloc(static_cast<running_machine *>(m)->respool(), t) +#define auto_alloc_clear(m, t) pool_alloc_clear(static_cast<running_machine *>(m)->respool(), t) +#define auto_alloc_array(m, t, c) pool_alloc_array(static_cast<running_machine *>(m)->respool(), t, c) +#define auto_alloc_array_clear(m, t, c) pool_alloc_array_clear(static_cast<running_machine *>(m)->respool(), t, c) +#define auto_free(m, v) pool_free(static_cast<running_machine *>(m)->respool(), v) #define auto_bitmap_alloc(m, w, h, f) auto_alloc(m, bitmap_t(w, h, f)) #define auto_strdup(m, s) strcpy(auto_alloc_array(m, char, strlen(s) + 1), s) @@ -316,39 +316,58 @@ class running_machine : public bindable_object DISABLE_COPYING(running_machine); friend void debugger_init(running_machine *machine); + friend class sound_manager; typedef void (*notify_callback)(running_machine &machine); typedef void (*logerror_callback)(running_machine &machine, const char *string); + // must be at top of member variables + resource_pool m_respool; // pool of resources for this machine + public: // construction/destruction running_machine(const machine_config &config, osd_interface &osd, bool exit_to_game_select = false); ~running_machine(); - // fetch items by name - 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 memory_region *region(const char *tag); - - // configuration helpers - UINT32 total_colors() const { return m_config.m_total_colors; } - // getters - const char *basename() const { return m_basename; } - emu_options &options() const { return m_config.options(); } + const machine_config &config() const { return m_config; } + const game_driver &system() const { return m_system; } + osd_interface &osd() const { return m_osd; } + resource_pool &respool() { return m_respool; } + device_scheduler &scheduler() { return m_scheduler; } + state_manager &state() { return m_state; } + cheat_manager &cheat() const { assert(m_cheat != NULL); return *m_cheat; } + render_manager &render() const { assert(m_render != NULL); return *m_render; } + sound_manager &sound() const { assert(m_sound != NULL); return *m_sound; } + video_manager &video() const { assert(m_video != NULL); return *m_video; } + debug_view_manager &debug_view() const { assert(m_debug_view != NULL); return *m_debug_view; } + driver_device *driver_data() const { return m_driver_device; } + template<class T> T *driver_data() const { return downcast<T *>(m_driver_device); } machine_phase phase() const { return m_current_phase; } bool paused() const { return m_paused || (m_current_phase != MACHINE_PHASE_RUNNING); } - bool scheduled_event_pending() const { return m_exit_pending || m_hard_reset_pending; } - bool save_or_load_pending() const { return (m_saveload_pending_file); } bool exit_pending() const { return m_exit_pending; } bool new_driver_pending() const { return (m_new_driver_pending != NULL); } const char *new_driver_name() const { return m_new_driver_pending->name; } - state_manager &state() { return m_state; } - device_scheduler &scheduler() { return m_scheduler; } - osd_interface &osd() const { return m_osd; } + bool ui_active() const { return m_ui_active; } + const char *basename() const { return m_basename; } + int sample_rate() const { return m_sample_rate; } + bool save_or_load_pending() const { return m_saveload_pending_file; } screen_device *first_screen() const { return primary_screen; } + + // additional helpers + emu_options &options() const { return m_config.options(); } + memory_region *first_region() const { return m_regionlist.first(); } attotime time() const { return m_scheduler.time(); } + bool scheduled_event_pending() const { return m_exit_pending || m_hard_reset_pending; } + + // fetch items by name + 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 memory_region *region(const char *tag); + + // configuration helpers + UINT32 total_colors() const { return m_config.m_total_colors; } // immediate operations int run(bool firstrun); @@ -357,6 +376,7 @@ public: void add_notifier(machine_notification event, notify_callback callback); void call_notifiers(machine_notification which); void add_logerror_callback(logerror_callback callback); + void set_ui_active(bool active) { m_ui_active = active; } // scheduled operations void schedule_exit(); @@ -374,13 +394,6 @@ public: memory_region *region_alloc(const char *name, UINT32 length, UINT8 width, endianness_t endian); void region_free(const char *name); - // managers - cheat_manager &cheat() const { assert(m_cheat != NULL); return *m_cheat; } - render_manager &render() const { assert(m_render != NULL); return *m_render; } - sound_manager &sound() const { assert(m_sound != NULL); return *m_sound; } - video_manager &video() const { assert(m_video != NULL); return *m_video; } - debug_view_manager &debug_view() const { assert(m_debug_view != NULL); return *m_debug_view; } - // misc void CLIB_DECL logerror(const char *format, ...); void CLIB_DECL vlogerror(const char *format, va_list args); @@ -388,22 +401,11 @@ public: const char *describe_context(); // internals - resource_pool m_respool; // pool of resources for this machine - region_list m_regionlist; // list of memory regions device_list m_devicelist; // list of running devices - - // 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 m_portlist; // points to a list of input port configurations // CPU information cpu_device * firstcpu; // first CPU (allows for quick iteration via typenext) - address_space * m_nonspecific_space;// a dummy address_space used for legacy compatibility - - // 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 // video-related information gfx_element * gfx[MAX_GFX_ELEMENTS];// array of pointers to graphic sets (chars, sprites) @@ -416,15 +418,9 @@ public: pen_t * shadow_table; // table for looking up a shadowed pen bitmap_t * priority_bitmap; // priority bitmap - // audio-related information - int sample_rate; // the digital audio sample rate - // debugger-related information UINT32 debug_flags; // the current debug flags - // UI-related - bool ui_active; // ui active or not (useful for games / systems with keyboard inputs) - // generic pointers generic_pointers generic; // generic pointers @@ -441,56 +437,56 @@ public: generic_video_private * generic_video_data; // internal data from video/generic.c generic_audio_private * generic_audio_data; // internal data from audio/generic.c - // driver-specific information - driver_device *driver_data() const { return m_driver_device; } - - template<class T> - T *driver_data() const { return downcast<T *>(m_driver_device); } - private: + // internal helpers void start(); void set_saveload_filename(const char *filename); void fill_systime(system_time &systime, time_t t); void handle_saveload(); void soft_reset(running_machine &machine, int param = 0); + // internal callbacks static void logfile_callback(running_machine &machine, const char *buffer); + + // internal state + const machine_config & m_config; // reference to the constructed machine_config + const game_driver & m_system; // reference to the definition of the game machine + osd_interface & m_osd; // reference to OSD system - // notifier callbacks - struct notifier_callback_item - { - notifier_callback_item(notify_callback func); - notifier_callback_item * m_next; - notify_callback m_func; - }; - notifier_callback_item *m_notifier_list[MACHINE_NOTIFY_COUNT]; - - // logerror callbacks - struct logerror_callback_item - { - logerror_callback_item(logerror_callback func); - logerror_callback_item * m_next; - logerror_callback m_func; - }; - logerror_callback_item *m_logerror_list; - - state_manager m_state; // state manager - device_scheduler m_scheduler; // scheduler object - osd_interface & m_osd; - - astring m_context; // context string - astring m_basename; // basename used for game-related paths - - machine_phase m_current_phase; - bool m_paused; - bool m_hard_reset_pending; - bool m_exit_pending; - bool m_exit_to_game_select; - const game_driver * m_new_driver_pending; - emu_timer * m_soft_reset_timer; - emu_file * m_logfile; + // embedded managers and objects + region_list m_regionlist; // list of memory regions + state_manager m_state; // state manager + device_scheduler m_scheduler; // scheduler object - // load/save + // managers + cheat_manager * m_cheat; // internal data from cheat.c + render_manager * m_render; // internal data from render.c + sound_manager * m_sound; // internal data from sound.c + video_manager * m_video; // internal data from video.c + debug_view_manager * m_debug_view; // internal data from debugvw.c + + // driver state + driver_device * m_driver_device; // pointer to the current driver device + + // system state + machine_phase m_current_phase; // current execution phase + bool m_paused; // paused? + bool m_hard_reset_pending; // is a hard reset pending? + bool m_exit_pending; // is an exit pending? + bool m_exit_to_game_select; // when we exit, go we go back to the game select? + const game_driver * m_new_driver_pending; // pointer to the next pending driver + emu_timer * m_soft_reset_timer; // timer used to schedule a soft reset + + // misc state + UINT32 m_rand_seed; // current random number seed + bool m_ui_active; // ui active or not (useful for games / systems with keyboard inputs) + time_t m_base_time; // real time at initial emulation time + astring m_basename; // basename used for game-related paths + astring m_context; // context string buffer + int m_sample_rate; // the digital audio sample rate + emu_file * m_logfile; // pointer to the active log file + + // load/save management enum saveload_schedule { SLS_NONE, @@ -502,18 +498,36 @@ private: astring m_saveload_pending_file; const char * m_saveload_searchpath; - // random number seed - UINT32 m_rand_seed; + // notifier callbacks + struct notifier_callback_item + { + // construction/destruction + notifier_callback_item(notify_callback func); - // base time - time_t m_base_time; + // getters + notifier_callback_item *next() const { return m_next; } + + // state + notifier_callback_item * m_next; + notify_callback m_func; + }; + simple_list<notifier_callback_item> m_notifier_list[MACHINE_NOTIFY_COUNT]; - driver_device * m_driver_device; - cheat_manager * m_cheat; // internal data from cheat.c - render_manager * m_render; // internal data from render.c - sound_manager * m_sound; // internal data from sound.c - video_manager * m_video; // internal data from video.c - debug_view_manager * m_debug_view; // internal data from debugvw.c + // logerror callbacks + class logerror_callback_item + { + public: + // construction/destruction + logerror_callback_item(logerror_callback func); + + // getters + logerror_callback_item *next() const { return m_next; } + + // state + logerror_callback_item * m_next; + logerror_callback m_func; + }; + simple_list<logerror_callback_item> m_logerror_list; }; @@ -552,7 +566,7 @@ protected: virtual const rom_entry *rom_region() const; // internal state - const game_driver * m_game; // pointer to the game driver + const game_driver * m_system; // pointer to the game driver legacy_callback_func m_callbacks[CB_COUNT]; // generic legacy callbacks palette_init_func m_palette_init; // one-time palette init callback diff --git a/src/emu/machine/generic.c b/src/emu/machine/generic.c index c1e8a4e3455..8d595230f07 100644 --- a/src/emu/machine/generic.c +++ b/src/emu/machine/generic.c @@ -115,7 +115,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->m_memcard_handler != NULL) + if (machine->config().m_memcard_handler != NULL) { state_save_register_global(machine, state->memcard_inserted); machine->add_notifier(MACHINE_NOTIFY_EXIT, memcard_eject); @@ -319,7 +319,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->m_devicelist.first(nvram) && machine->config->m_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 @@ -327,8 +327,8 @@ void nvram_load(running_machine *machine) if (file.open(machine->basename(), ".nv") == FILERR_NONE) { // read data from general NVRAM handler first - if (machine->config->m_nvram_handler != NULL) - (*machine->config->m_nvram_handler)(machine, &file, FALSE); + if (machine->config().m_nvram_handler != NULL) + (*machine->config().m_nvram_handler)(machine, &file, FALSE); // find all devices with NVRAM handlers, and read from them next for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram)) @@ -339,8 +339,8 @@ void nvram_load(running_machine *machine) else { // initialize via the general NVRAM handler first - if (machine->config->m_nvram_handler != NULL) - (*machine->config->m_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)) @@ -357,7 +357,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->m_devicelist.first(nvram) && machine->config->m_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 @@ -365,8 +365,8 @@ void nvram_save(running_machine *machine) if (file.open(machine->basename(), ".nv") == FILERR_NONE) { // write data via general NVRAM handler first - if (machine->config->m_nvram_handler != NULL) - (*machine->config->m_nvram_handler)(machine, &file, TRUE); + if (machine->config().m_nvram_handler != NULL) + (*machine->config().m_nvram_handler)(machine, &file, TRUE); // find all devices with NVRAM handlers, and tell them to write next for (bool gotone = (nvram != NULL); gotone; gotone = nvram->next(nvram)) @@ -419,8 +419,8 @@ int memcard_create(running_machine *machine, int index, int overwrite) return 1; /* initialize and then save the card */ - if (machine->config->m_memcard_handler) - (*machine->config->m_memcard_handler)(machine, file, MEMCARD_CREATE); + if (machine->config().m_memcard_handler) + (*machine->config().m_memcard_handler)(machine, file, MEMCARD_CREATE); /* close the file */ return 0; @@ -452,8 +452,8 @@ int memcard_insert(running_machine *machine, int index) return 1; /* initialize and then load the card */ - if (machine->config->m_memcard_handler) - (*machine->config->m_memcard_handler)(machine, file, MEMCARD_INSERT); + if (machine->config().m_memcard_handler) + (*machine->config().m_memcard_handler)(machine, file, MEMCARD_INSERT); /* close the file */ state->memcard_inserted = index; @@ -485,8 +485,8 @@ void memcard_eject(running_machine &machine) return; /* initialize and then load the card */ - if (machine.m_config.m_memcard_handler) - (*machine.m_config.m_memcard_handler)(&machine, file, MEMCARD_EJECT); + if (machine.config().m_memcard_handler) + (*machine.config().m_memcard_handler)(&machine, file, MEMCARD_EJECT); /* close the file */ state->memcard_inserted = -1; diff --git a/src/emu/machine/idectrl.c b/src/emu/machine/idectrl.c index 956d71ae7c8..91e5a710dc1 100644 --- a/src/emu/machine/idectrl.c +++ b/src/emu/machine/idectrl.c @@ -1793,7 +1793,6 @@ static DEVICE_START( ide_controller ) assert(device->baseconfig().static_config() == NULL); assert(downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config() != NULL); assert(device->machine != NULL); - assert(device->machine->config != NULL); /* store a pointer back to the device */ ide->device = device; diff --git a/src/emu/machine/pci.c b/src/emu/machine/pci.c index c5fa7eed0b3..090e2fe1d85 100644 --- a/src/emu/machine/pci.c +++ b/src/emu/machine/pci.c @@ -272,7 +272,6 @@ static DEVICE_START( pci_bus ) assert(device->baseconfig().static_config() == NULL); assert(downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config() != NULL); assert(device->machine != NULL); - assert(device->machine->config != NULL); /* store a pointer back to the device */ pcibus->config = (const pci_bus_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config(); diff --git a/src/emu/machine/smc91c9x.c b/src/emu/machine/smc91c9x.c index 5232ba0a775..8e37f8f65a9 100644 --- a/src/emu/machine/smc91c9x.c +++ b/src/emu/machine/smc91c9x.c @@ -517,7 +517,6 @@ static DEVICE_START( smc91c9x ) assert(device->baseconfig().static_config() == NULL); assert(downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config() != NULL); assert(device->machine != NULL); - assert(device->machine->config != NULL); /* store a pointer back to the device */ smc->device = device; diff --git a/src/emu/memory.c b/src/emu/memory.c index a87f2e22e32..45e3772a3cd 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -1593,13 +1593,16 @@ void memory_init(running_machine *machine) // dump the final memory configuration generate_memdump(machine); - // borrow the first address space to be used as a dummy space - machine->m_nonspecific_space = memdata->spacelist.first(); - // we are now initialized memdata->initialized = true; } +address_space *memory_nonspecific_space(running_machine *machine) +{ + memory_private *memdata = machine->memory_data; + return memdata->spacelist.first(); +} + //************************************************************************** @@ -4078,7 +4081,7 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen // register for saving, but only if we're not part of a memory region const memory_region *region; - for (region = space.m_machine.m_regionlist.first(); region != NULL; region = region->next()) + for (region = space.m_machine.first_region(); region != NULL; region = region->next()) if (m_data >= region->base() && (m_data + (byteend - bytestart + 1)) < region->end()) { VPRINTF(("skipping save of this memory block as it is covered by a memory region\n")); diff --git a/src/emu/memory.h b/src/emu/memory.h index 0984472e7d7..ad163b8a4fc 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -739,6 +739,7 @@ void *memory_get_shared(running_machine &machine, const char *tag, size_t &lengt // dump the internal memory tables to the given file void memory_dump(running_machine *machine, FILE *file); +address_space *memory_nonspecific_space(running_machine *machine); //************************************************************************** diff --git a/src/emu/render.c b/src/emu/render.c index 94f8d0799a4..709e9a3d0ea 100644 --- a/src/emu/render.c +++ b/src/emu/render.c @@ -702,8 +702,8 @@ const rgb_t *render_texture::get_adjusted_palette(render_container &container) render_container::render_container(render_manager &manager, screen_device *screen) : m_next(NULL), m_manager(manager), - m_itemlist(manager.machine().m_respool), - m_item_allocator(manager.machine().m_respool), + m_itemlist(manager.machine().respool()), + m_item_allocator(manager.machine().respool()), m_screen(screen), m_overlaybitmap(NULL), m_overlaytexture(NULL), @@ -720,7 +720,7 @@ render_container::render_container(render_manager &manager, screen_device *scree if (screen != NULL) { // set the initial orientation and brightness/contrast/gamma - m_user.m_orientation = manager.machine().gamedrv->flags & ORIENTATION_MASK; + m_user.m_orientation = manager.machine().system().flags & ORIENTATION_MASK; m_user.m_brightness = manager.machine().options().brightness(); m_user.m_contrast = manager.machine().options().contrast(); m_user.m_gamma = manager.machine().options().gamma(); @@ -1051,7 +1051,7 @@ render_target::render_target(render_manager &manager, const char *layoutfile, UI : m_next(NULL), m_manager(manager), m_curview(NULL), - m_filelist(*auto_alloc(&manager.machine(), simple_list<layout_file>(manager.machine().m_respool))), + m_filelist(*auto_alloc(&manager.machine(), simple_list<layout_file>(manager.machine().respool()))), m_flags(flags), m_listindex(0), m_width(640), @@ -1063,7 +1063,7 @@ render_target::render_target(render_manager &manager, const char *layoutfile, UI m_base_orientation(ROT0), m_maxtexwidth(65536), m_maxtexheight(65536), - m_debug_containers(manager.machine().m_respool) + m_debug_containers(manager.machine().respool()) { // determine the base layer configuration based on options m_base_layerconfig.set_backdrops_enabled(manager.machine().options().use_backdrops()); @@ -1074,12 +1074,12 @@ render_target::render_target(render_manager &manager, const char *layoutfile, UI // determine the base orientation based on options m_orientation = ROT0; if (!manager.machine().options().rotate()) - m_base_orientation = orientation_reverse(manager.machine().gamedrv->flags & ORIENTATION_MASK); + m_base_orientation = orientation_reverse(manager.machine().system().flags & ORIENTATION_MASK); // rotate left/right - if (manager.machine().options().ror() || (manager.machine().options().auto_ror() && (manager.machine().gamedrv->flags & ORIENTATION_SWAP_XY))) + if (manager.machine().options().ror() || (manager.machine().options().auto_ror() && (manager.machine().system().flags & ORIENTATION_SWAP_XY))) m_base_orientation = orientation_add(ROT90, m_base_orientation); - if (manager.machine().options().rol() || (manager.machine().options().auto_rol() && (manager.machine().gamedrv->flags & ORIENTATION_SWAP_XY))) + if (manager.machine().options().rol() || (manager.machine().options().auto_rol() && (manager.machine().system().flags & ORIENTATION_SWAP_XY))) m_base_orientation = orientation_add(ROT270, m_base_orientation); // flip X/Y @@ -1631,18 +1631,18 @@ void render_target::load_layout_files(const char *layoutfile, bool singlefile) return; // try to load a file based on the driver name - const game_driver *gamedrv = m_manager.machine().gamedrv; - if (!load_layout_file(basename, gamedrv->name)) + const game_driver &system = m_manager.machine().system(); + if (!load_layout_file(basename, system.name)) load_layout_file(basename, "default"); // if a default view has been specified, use that as a fallback - if (gamedrv->default_layout != NULL) - load_layout_file(NULL, gamedrv->default_layout); - if (m_manager.machine().m_config.m_default_layout != NULL) - load_layout_file(NULL, m_manager.machine().m_config.m_default_layout); + if (system.default_layout != NULL) + load_layout_file(NULL, system.default_layout); + if (m_manager.machine().config().m_default_layout != NULL) + load_layout_file(NULL, m_manager.machine().config().m_default_layout); // try to load another file based on the parent driver name - const game_driver *cloneof = driver_get_clone(gamedrv); + const game_driver *cloneof = driver_get_clone(&system); if (cloneof != NULL) if (!load_layout_file(cloneof->name, cloneof->name)) load_layout_file(cloneof->name, "default"); @@ -1650,7 +1650,7 @@ void render_target::load_layout_files(const char *layoutfile, bool singlefile) // now do the built-in layouts for single-screen games if (m_manager.machine().m_devicelist.count(SCREEN) == 1) { - if (gamedrv->flags & ORIENTATION_SWAP_XY) + if (system.flags & ORIENTATION_SWAP_XY) load_layout_file(NULL, layout_vertical); else load_layout_file(NULL, layout_horizont); @@ -2454,12 +2454,12 @@ done: render_manager::render_manager(running_machine &machine) : m_machine(machine), - m_targetlist(machine.m_respool), + m_targetlist(machine.respool()), m_ui_target(NULL), m_live_textures(0), - m_texture_allocator(machine.m_respool), + m_texture_allocator(machine.respool()), m_ui_container(auto_alloc(&machine, render_container(*this))), - m_screen_container_list(machine.m_respool) + m_screen_container_list(machine.respool()) { // register callbacks config_register(&machine, "video", config_load_static, config_save_static); diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c index 7f71b73230c..5f99b5b8d27 100644 --- a/src/emu/rendlay.c +++ b/src/emu/rendlay.c @@ -196,9 +196,9 @@ static int get_variable_value(running_machine &machine, const char *string, char char temp[100]; // screen 0 parameters - for (const screen_device_config *devconfig = machine.m_config.first_screen(); devconfig != NULL; devconfig = devconfig->next_screen()) + for (const screen_device_config *devconfig = machine.config().first_screen(); devconfig != NULL; devconfig = devconfig->next_screen()) { - int scrnum = machine.m_config.m_devicelist.indexof(SCREEN, devconfig->tag()); + int scrnum = machine.config().m_devicelist.indexof(SCREEN, devconfig->tag()); // native X aspect factor sprintf(temp, "~scr%dnativexaspect~", scrnum); @@ -434,7 +434,7 @@ static void parse_orientation(running_machine &machine, xml_data_node *orientnod layout_element::layout_element(running_machine &machine, xml_data_node &elemnode, const char *dirname) : m_next(NULL), m_machine(machine), - m_complist(machine.m_respool), + m_complist(machine.respool()), m_defstate(0), m_maxstate(0), m_elemtex(NULL) @@ -1665,11 +1665,11 @@ layout_view::layout_view(running_machine &machine, xml_data_node &viewnode, simp : m_next(NULL), m_aspect(1.0f), m_scraspect(1.0f), - m_screens(machine.m_respool), - m_backdrop_list(machine.m_respool), - m_screen_list(machine.m_respool), - m_overlay_list(machine.m_respool), - m_bezel_list(machine.m_respool) + m_screens(machine.respool()), + m_backdrop_list(machine.respool()), + m_screen_list(machine.respool()), + m_overlay_list(machine.respool()), + m_bezel_list(machine.respool()) { // allocate a copy of the name m_name = xml_get_attribute_string_with_subst(machine, viewnode, "name", ""); @@ -1931,8 +1931,8 @@ int layout_view::item::state() const layout_file::layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname) : m_next(NULL), - m_elemlist(machine.m_respool), - m_viewlist(machine.m_respool) + m_elemlist(machine.respool()), + m_viewlist(machine.respool()) { // find the layout node xml_data_node *mamelayoutnode = xml_get_sibling(rootnode.child, "mamelayout"); diff --git a/src/emu/romload.c b/src/emu/romload.c index 4b93d7c23ce..fec47443462 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -338,7 +338,7 @@ static void determine_bios_rom(rom_load_data *romdata) romdata->system_bios = 0; - for (const rom_source *source = rom_first_source(*romdata->machine->config); source != NULL; source = rom_next_source(*source)) + for (const rom_source *source = rom_first_source(romdata->machine->config()); source != NULL; source = rom_next_source(*source)) { /* first determine the default BIOS name */ for (rom = source->rom_region(); !ROMENTRY_ISEND(rom); rom++) @@ -396,7 +396,7 @@ static void count_roms(rom_load_data *romdata) romdata->romstotalsize = 0; /* loop over regions, then over files */ - for (source = rom_first_source(*romdata->machine->config); source != NULL; source = rom_next_source(*source)) + for (source = rom_first_source(romdata->machine->config()); source != NULL; source = rom_next_source(*source)) for (region = rom_first_region(*source); region != NULL; region = rom_next_region(region)) for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom)) if (ROM_GETBIOSFLAGS(rom) == 0 || ROM_GETBIOSFLAGS(rom) == romdata->system_bios) @@ -624,7 +624,7 @@ static int open_rom_file(rom_load_data *romdata, const char *regiontag, const ro /* attempt reading up the chain through the parents. It automatically also attempts any kind of load by checksum supported by the archives. */ romdata->file = NULL; - for (drv = romdata->machine->gamedrv; romdata->file == NULL && drv != NULL; drv = driver_get_clone(drv)) + for (drv = &romdata->machine->system(); romdata->file == NULL && drv != NULL; drv = driver_get_clone(drv)) if (drv->name != NULL && *drv->name != 0) filerr = common_process_file(romdata->machine->options(), drv->name, has_crc, crc, romp, &romdata->file); @@ -1226,7 +1226,7 @@ static void process_disk_entries(rom_load_data *romdata, const char *regiontag, /* first open the source drive */ LOG(("Opening disk image: %s\n", filename.cstr())); - err = open_disk_image(romdata->machine->options(), romdata->machine->gamedrv, romp, &chd.origfile, &chd.origchd, locationtag); + err = open_disk_image(romdata->machine->options(), &romdata->machine->system(), romp, &chd.origfile, &chd.origchd, locationtag); if (err != CHDERR_NONE) { if (err == CHDERR_FILE_NOT_FOUND) @@ -1450,12 +1450,12 @@ static void process_region_list(rom_load_data *romdata) const rom_entry *region; /* loop until we hit the end */ - for (source = rom_first_source(*romdata->machine->config); source != NULL; source = rom_next_source(*source)) + for (source = rom_first_source(romdata->machine->config()); source != NULL; source = rom_next_source(*source)) for (region = rom_first_region(*source); region != NULL; region = rom_next_region(region)) { UINT32 regionlength = ROMREGION_GETLENGTH(region); - rom_region_name(regiontag, romdata->machine->gamedrv, source, region); + rom_region_name(regiontag, &romdata->machine->system(), source, region); LOG(("Processing region \"%s\" (length=%X)\n", regiontag.cstr(), regionlength)); /* the first entry must be a region */ @@ -1495,7 +1495,7 @@ static void process_region_list(rom_load_data *romdata) } /* now go back and post-process all the regions */ - for (source = rom_first_source(*romdata->machine->config); source != NULL; source = rom_next_source(*source)) + for (source = rom_first_source(romdata->machine->config()); source != NULL; source = rom_next_source(*source)) for (region = rom_first_region(*source); region != NULL; region = rom_next_region(region)) region_post_process(romdata, ROMREGION_GETTAG(region), ROMREGION_ISINVERTED(region)); } diff --git a/src/emu/schedule.c b/src/emu/schedule.c index 0eb255469a4..1630d4dfbee 100644 --- a/src/emu/schedule.c +++ b/src/emu/schedule.c @@ -331,12 +331,12 @@ device_scheduler::device_scheduler(running_machine &machine) : m_execute_list(NULL), m_basetime(attotime::zero), m_timer_list(NULL), - m_timer_allocator(machine.m_respool), + m_timer_allocator(machine.respool()), m_callback_timer(NULL), m_callback_timer_modified(false), m_callback_timer_expire_time(attotime::zero), - m_quantum_list(machine.m_respool), - m_quantum_allocator(machine.m_respool), + m_quantum_list(machine.respool()), + m_quantum_allocator(machine.respool()), m_quantum_minimum(ATTOSECONDS_IN_NSEC(1) / 1000) { // append a single never-expiring timer so there is always one in the list @@ -719,22 +719,22 @@ void device_scheduler::rebuild_execute_list() if (m_quantum_list.first() == NULL) { // set the core scheduling quantum - attotime min_quantum = m_machine.config->m_minimum_quantum; + attotime min_quantum = m_machine.config().m_minimum_quantum; // if none specified default to 60Hz if (min_quantum == attotime::zero) min_quantum = attotime::from_hz(60); // if the configuration specifies a device to make perfect, pick that as the minimum - if (m_machine.config->m_perfect_cpu_quantum != NULL) + if (m_machine.config().m_perfect_cpu_quantum != NULL) { - device_t *device = m_machine.device(m_machine.config->m_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->m_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->m_perfect_cpu_quantum); + fatalerror("Device '%s' specified for perfect interleave is not an executing device!", m_machine.config().m_perfect_cpu_quantum); min_quantum = min(attotime(0, exec->minimum_quantum()), min_quantum); } diff --git a/src/emu/screen.c b/src/emu/screen.c index 185127c699c..71e3a964524 100644 --- a/src/emu/screen.c +++ b/src/emu/screen.c @@ -378,7 +378,7 @@ void screen_device::device_start() m_scanline0_timer = machine->scheduler().timer_alloc(FUNC(static_scanline0_callback), (void *)this); // allocate a timer to generate per-scanline updates - if ((machine->config->m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0) + if ((machine->config().m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0) m_scanline_timer = machine->scheduler().timer_alloc(FUNC(static_scanline_update_callback), (void *)this); // configure the screen with the default parameters @@ -389,7 +389,7 @@ void screen_device::device_start() m_vblank_end_time = attotime(0, m_vblank_period); // start the timer to generate per-scanline updates - if ((machine->config->m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0) + if ((machine->config().m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0) m_scanline_timer->adjust(time_until_pos(0)); // create burn-in bitmap @@ -609,7 +609,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->m_video_attributes & VIDEO_ALWAYS_UPDATE)) + if (!(machine->config().m_video_attributes & VIDEO_ALWAYS_UPDATE)) { // if skipping this frame, bail if (m_machine.video().skip_this_frame()) @@ -824,7 +824,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->m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) + if (this == machine->primary_screen && !(machine->config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) machine->video().frame_update(); // reset the VBLANK start timer for the next frame @@ -850,7 +850,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->m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) + if (this == machine->primary_screen && (machine->config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) machine->video().frame_update(); // increment the frame number counter @@ -902,7 +902,7 @@ bool screen_device::update_quads() if (m_machine.render().is_live(*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->m_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 (!m_machine.video().skip_this_frame() && m_changed) @@ -1068,7 +1068,7 @@ void screen_device::finalize_burnin() // add two text entries describing the image sprintf(text, APPNAME " %s", build_version); png_add_text(&pnginfo, "Software", text); - sprintf(text, "%s %s", machine->m_game.manufacturer, machine->m_game.description); + sprintf(text, "%s %s", machine->system().manufacturer, machine->system().description); png_add_text(&pnginfo, "System", text); // now do the actual work diff --git a/src/emu/screen.h b/src/emu/screen.h index 863f27d98d2..746b7bd61f1 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -182,7 +182,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->m_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(0, m_scantime); } attotime frame_period() const { return (this == NULL || !started()) ? DEFAULT_FRAME_PERIOD : attotime(0, m_frame_period); }; UINT64 frame_number() const { return m_frame_number; } diff --git a/src/emu/softlist.c b/src/emu/softlist.c index 86b615056e9..0dc7aa57205 100644 --- a/src/emu/softlist.c +++ b/src/emu/softlist.c @@ -1445,7 +1445,7 @@ bool load_software_part(device_image_interface *image, const char *path, softwar /* If not found try to load the software list using the driver name */ if ( ! software_part_ptr ) { - swlist_name = (char *)image->device().machine->gamedrv->name; + swlist_name = (char *)image->device().machine->system().name; if ( software_list_ptr ) { @@ -2035,7 +2035,7 @@ static void ui_mess_menu_populate_software_list(running_machine *machine, ui_men bool haveCompatible = FALSE; const char *interface = image->image_config().image_interface(); - for (const device_config *dev = machine->config->m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext()) + for (const device_config *dev = machine->config().m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext()) { software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config(); @@ -2065,7 +2065,7 @@ static void ui_mess_menu_populate_software_list(running_machine *machine, ui_men } } - for (const device_config *dev = machine->config->m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext()) + for (const device_config *dev = machine->config().m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext()) { software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config(); diff --git a/src/emu/sound.c b/src/emu/sound.c index bf10bf92990..2081f41c118 100644 --- a/src/emu/sound.c +++ b/src/emu/sound.c @@ -775,7 +775,7 @@ sound_manager::sound_manager(running_machine &machine) m_attenuation(0), m_nosound_mode(!machine.options().sound()), m_wavfile(NULL), - m_stream_list(machine.m_respool), + m_stream_list(machine.respool()), m_update_attoseconds(STREAMS_UPDATE_ATTOTIME.attoseconds), m_last_update(attotime::zero) { @@ -785,19 +785,19 @@ sound_manager::sound_manager(running_machine &machine) // handle -nosound and lower sample rate if not recording WAV or AVI if (m_nosound_mode && wavfile[0] == 0 && avifile[0] == 0) - machine.sample_rate = 11025; + machine.m_sample_rate = 11025; // count the speakers VPRINTF(("total speakers = %d\n", machine.m_devicelist.count(SPEAKER))); // allocate memory for mix buffers - m_leftmix = auto_alloc_array(&machine, INT32, machine.sample_rate); - m_rightmix = auto_alloc_array(&machine, INT32, machine.sample_rate); - m_finalmix = auto_alloc_array(&machine, INT16, machine.sample_rate); + m_leftmix = auto_alloc_array(&machine, INT32, machine.sample_rate()); + m_rightmix = auto_alloc_array(&machine, INT32, machine.sample_rate()); + m_finalmix = auto_alloc_array(&machine, INT16, machine.sample_rate()); // open the output WAV file if specified if (wavfile[0] != 0) - m_wavfile = wav_open(wavfile, machine.sample_rate, 2); + m_wavfile = wav_open(wavfile, machine.sample_rate(), 2); // register callbacks config_register(&machine, "mixer", &sound_manager::config_load, &sound_manager::config_save); diff --git a/src/emu/sound/cdp1863.c b/src/emu/sound/cdp1863.c index 59984173548..29c9dac9a19 100644 --- a/src/emu/sound/cdp1863.c +++ b/src/emu/sound/cdp1863.c @@ -123,7 +123,7 @@ static STREAM_UPDATE( cdp1863_stream_update ) if (cdp1863->oe) { double frequency; - int rate = device->machine->sample_rate / 2; + int rate = device->machine->sample_rate() / 2; /* get progress through wave */ int incr = cdp1863->incr; @@ -175,7 +175,7 @@ static DEVICE_START( cdp1863 ) const cdp1863_config *config = get_safe_config(device); /* set initial values */ - cdp1863->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, cdp1863, cdp1863_stream_update); + cdp1863->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate(), cdp1863, cdp1863_stream_update); cdp1863->clock1 = device->clock(); cdp1863->clock2 = config->clock2; cdp1863->oe = 1; diff --git a/src/emu/sound/cdp1864.c b/src/emu/sound/cdp1864.c index 1496bea0aba..52fcb51368f 100644 --- a/src/emu/sound/cdp1864.c +++ b/src/emu/sound/cdp1864.c @@ -364,7 +364,7 @@ static STREAM_UPDATE( cdp1864_stream_update ) if (cdp1864->aoe) { double frequency = cdp1864->cpu->unscaled_clock() / 8 / 4 / (cdp1864->latch + 1) / 2; - int rate = device->machine->sample_rate / 2; + int rate = device->machine->sample_rate() / 2; /* get progress through wave */ int incr = cdp1864->incr; @@ -446,7 +446,7 @@ static DEVICE_START( cdp1864 ) cdp1864_init_palette(device, intf); /* create sound stream */ - cdp1864->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, cdp1864, cdp1864_stream_update); + cdp1864->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate(), cdp1864, cdp1864_stream_update); /* create the timers */ cdp1864->int_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1864_int_tick), (void *)device); diff --git a/src/emu/sound/cdp1869.c b/src/emu/sound/cdp1869.c index 4d7b8cd9870..cd3952d6604 100644 --- a/src/emu/sound/cdp1869.c +++ b/src/emu/sound/cdp1869.c @@ -434,7 +434,7 @@ void cdp1869_device::device_start() initialize_palette(); // create sound stream - m_stream = m_machine.sound().stream_alloc(*this, 0, 1, m_machine.sample_rate); + m_stream = m_machine.sound().stream_alloc(*this, 0, 1, m_machine.sample_rate()); // register for state saving save_item(NAME(m_prd)); @@ -529,7 +529,7 @@ void cdp1869_device::sound_stream_update(sound_stream &stream, stream_sample_t * double frequency = (clock() / 2) / (512 >> m_tonefreq) / (m_tonediv + 1); // double amplitude = m_toneamp * ((0.78*5) / 15); - int rate = m_machine.sample_rate / 2; + int rate = m_machine.sample_rate() / 2; /* get progress through wave */ int incr = m_incr; diff --git a/src/emu/sound/discrete.c b/src/emu/sound/discrete.c index de6dff34752..75b5671db11 100644 --- a/src/emu/sound/discrete.c +++ b/src/emu/sound/discrete.c @@ -930,7 +930,7 @@ void discrete_device::device_start() if (this->clock()) m_sample_rate = this->clock(); else - m_sample_rate = this->machine->sample_rate; + m_sample_rate = this->machine->sample_rate(); m_sample_time = 1.0 / m_sample_rate; m_neg_sample_time = - m_sample_time; diff --git a/src/emu/sound/filter.c b/src/emu/sound/filter.c index 2b5e186fce2..5aa7582fdad 100644 --- a/src/emu/sound/filter.c +++ b/src/emu/sound/filter.c @@ -134,7 +134,7 @@ filter* filter_lp_fir_alloc(double freq, int order) { void filter2_setup(device_t *device, int type, double fc, double d, double gain, filter2_context *filter2) { - int sample_rate = device->machine->sample_rate; + int sample_rate = device->machine->sample_rate(); double w; /* cutoff freq, in radians/sec */ double w_squared; double den; /* temp variable */ diff --git a/src/emu/sound/flt_rc.c b/src/emu/sound/flt_rc.c index f0af134e6ce..9f004c08cbc 100644 --- a/src/emu/sound/flt_rc.c +++ b/src/emu/sound/flt_rc.c @@ -83,7 +83,7 @@ static void set_RC_info(filter_rc_state *info, int type, double R1, double R2, d /* Cut Frequency = 1/(2*Pi*Req*C) */ /* k = (1-(EXP(-TIMEDELTA/RC))) */ - info->k = 0x10000 - 0x10000 * (exp(-1 / (Req * C) / info->device->machine->sample_rate)); + info->k = 0x10000 - 0x10000 * (exp(-1 / (Req * C) / info->device->machine->sample_rate())); } @@ -93,7 +93,7 @@ static DEVICE_START( filter_rc ) const flt_rc_config *conf = (const flt_rc_config *)device->baseconfig().static_config(); info->device = device; - info->stream = device->machine->sound().stream_alloc(*device, 1, 1, device->machine->sample_rate, info, filter_rc_update); + info->stream = device->machine->sound().stream_alloc(*device, 1, 1, device->machine->sample_rate(), info, filter_rc_update); if (conf) set_RC_info(info, conf->type, conf->R1, conf->R2, conf->R3, conf->C); else diff --git a/src/emu/sound/flt_vol.c b/src/emu/sound/flt_vol.c index 0f2c14a0a6b..2e057223f8e 100644 --- a/src/emu/sound/flt_vol.c +++ b/src/emu/sound/flt_vol.c @@ -34,7 +34,7 @@ static DEVICE_START( filter_volume ) filter_volume_state *info = get_safe_token(device); info->gain = 0x100; - info->stream = device->machine->sound().stream_alloc(*device, 1, 1, device->machine->sample_rate, info, filter_volume_update); + info->stream = device->machine->sound().stream_alloc(*device, 1, 1, device->machine->sample_rate(), info, filter_volume_update); } diff --git a/src/emu/sound/mos6560.c b/src/emu/sound/mos6560.c index 029522df475..471a4ed193d 100644 --- a/src/emu/sound/mos6560.c +++ b/src/emu/sound/mos6560.c @@ -587,7 +587,7 @@ static void mos6560_soundport_w( device_t *device, int offset, int data ) if (!(old & 0x80) && TONE1_ON) { mos6560->tone1pos = 0; - mos6560->tone1samples = device->machine->sample_rate / TONE1_FREQUENCY; + mos6560->tone1samples = device->machine->sample_rate() / TONE1_FREQUENCY; if (!mos6560->tone1samples == 0) mos6560->tone1samples = 1; } @@ -598,7 +598,7 @@ static void mos6560_soundport_w( device_t *device, int offset, int data ) if (!(old & 0x80) && TONE2_ON) { mos6560->tone2pos = 0; - mos6560->tone2samples = device->machine->sample_rate / TONE2_FREQUENCY; + mos6560->tone2samples = device->machine->sample_rate() / TONE2_FREQUENCY; if (mos6560->tone2samples == 0) mos6560->tone2samples = 1; } @@ -609,7 +609,7 @@ static void mos6560_soundport_w( device_t *device, int offset, int data ) if (!(old & 0x80) && TONE3_ON) { mos6560->tone3pos = 0; - mos6560->tone3samples = device->machine->sample_rate / TONE3_FREQUENCY; + mos6560->tone3samples = device->machine->sample_rate() / TONE3_FREQUENCY; if (mos6560->tone3samples == 0) mos6560->tone3samples = 1; } @@ -619,7 +619,7 @@ static void mos6560_soundport_w( device_t *device, int offset, int data ) mos6560->reg[offset] = data; if (NOISE_ON) { - mos6560->noisesamples = (int) ((double) NOISE_FREQUENCY_MAX * device->machine->sample_rate + mos6560->noisesamples = (int) ((double) NOISE_FREQUENCY_MAX * device->machine->sample_rate() * NOISE_BUFFER_SIZE_SEC / NOISE_FREQUENCY); DBG_LOG (1, "mos6560", ("noise %.2x %d sample:%d\n", data, NOISE_FREQUENCY, mos6560->noisesamples)); @@ -664,7 +664,7 @@ static STREAM_UPDATE( mos6560_update ) if (mos6560->tone1pos >= mos6560->tone1samples) { mos6560->tone1pos = 0; - mos6560->tone1samples = device->machine->sample_rate / TONE1_FREQUENCY; + mos6560->tone1samples = device->machine->sample_rate() / TONE1_FREQUENCY; if (mos6560->tone1samples == 0) mos6560->tone1samples = 1; } @@ -680,7 +680,7 @@ static STREAM_UPDATE( mos6560_update ) if (mos6560->tone2pos >= mos6560->tone2samples) { mos6560->tone2pos = 0; - mos6560->tone2samples = device->machine->sample_rate / TONE2_FREQUENCY; + mos6560->tone2samples = device->machine->sample_rate() / TONE2_FREQUENCY; if (mos6560->tone2samples == 0) mos6560->tone2samples = 1; } @@ -696,7 +696,7 @@ static STREAM_UPDATE( mos6560_update ) if (mos6560->tone3pos >= mos6560->tone3samples) { mos6560->tone3pos = 0; - mos6560->tone3samples = device->machine->sample_rate / TONE3_FREQUENCY; + mos6560->tone3samples = device->machine->sample_rate() / TONE3_FREQUENCY; if (mos6560->tone3samples == 0) mos6560->tone3samples = 1; } @@ -739,7 +739,7 @@ static void mos6560_sound_start( device_t *device ) mos6560_state *mos6560 = get_safe_token(device); int i; - mos6560->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, 0, mos6560_update); + mos6560->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate(), 0, mos6560_update); /* buffer for fastest played sample for 5 second so we have enough data for min 5 second */ mos6560->noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC; @@ -774,7 +774,7 @@ static void mos6560_sound_start( device_t *device ) noiseshift <<= 1; } } - mos6560->tonesize = device->machine->sample_rate / TONE_FREQUENCY_MIN; + mos6560->tonesize = device->machine->sample_rate() / TONE_FREQUENCY_MIN; if (mos6560->tonesize > 0) { diff --git a/src/emu/sound/rf5c400.c b/src/emu/sound/rf5c400.c index feaebf8dcff..e7c12f73d1e 100644 --- a/src/emu/sound/rf5c400.c +++ b/src/emu/sound/rf5c400.c @@ -264,7 +264,7 @@ static void rf5c400_init_chip(device_t *device, rf5c400_state *info) double r; // attack - r = 1.0 / (ENV_AR_SPEED * device->machine->sample_rate); + r = 1.0 / (ENV_AR_SPEED * device->machine->sample_rate()); for (i = 0; i < ENV_MIN_AR; i++) { info->env_ar_table[i] = 1.0; @@ -280,7 +280,7 @@ static void rf5c400_init_chip(device_t *device, rf5c400_state *info) } // decay - r = -1.0 / (ENV_DR_SPEED * device->machine->sample_rate); + r = -1.0 / (ENV_DR_SPEED * device->machine->sample_rate()); for (i = 0; i < ENV_MIN_DR; i++) { info->env_dr_table[i] = r; @@ -296,7 +296,7 @@ static void rf5c400_init_chip(device_t *device, rf5c400_state *info) } // release - r = -1.0 / (ENV_RR_SPEED * device->machine->sample_rate); + r = -1.0 / (ENV_RR_SPEED * device->machine->sample_rate()); for (i = 0; i < ENV_MIN_RR; i++) { info->env_rr_table[i] = r; diff --git a/src/emu/sound/s14001a.c b/src/emu/sound/s14001a.c index 0c4c96b0e75..d2d9741b658 100644 --- a/src/emu/sound/s14001a.c +++ b/src/emu/sound/s14001a.c @@ -592,7 +592,7 @@ static DEVICE_START( s14001a ) chip->SpeechRom = *device->region(); - chip->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock() ? device->clock() : device->machine->sample_rate, chip, s14001a_pcm_update); + chip->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock() ? device->clock() : device->machine->sample_rate(), chip, s14001a_pcm_update); } int s14001a_bsy_r(device_t *device) diff --git a/src/emu/sound/s2636.c b/src/emu/sound/s2636.c index 6da13b9744e..36c5c29a519 100644 --- a/src/emu/sound/s2636.c +++ b/src/emu/sound/s2636.c @@ -38,7 +38,7 @@ void s2636_soundport_w (device_t *device, int offset, int data) token->pos = 0; token->level = TRUE; // frequency 7874/(data+1) - token->size = device->machine->sample_rate * (data + 1) /7874; + token->size = device->machine->sample_rate() * (data + 1) /7874; break; } } @@ -79,7 +79,7 @@ static DEVICE_START(s2636_sound) { s2636_sound *token = get_token(device); memset(token, 0, sizeof(*token)); - token->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, 0, s2636_update); + token->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate(), 0, s2636_update); } diff --git a/src/emu/sound/samples.c b/src/emu/sound/samples.c index b4bfdd059ce..2d76933a3ed 100644 --- a/src/emu/sound/samples.c +++ b/src/emu/sound/samples.c @@ -251,7 +251,7 @@ void sample_start(device_t *device,int channel,int samplenum,int loop) chan->pos = 0; chan->frac = 0; chan->basefreq = sample->frequency; - chan->step = ((INT64)chan->basefreq << FRAC_BITS) / info->device->machine->sample_rate; + chan->step = ((INT64)chan->basefreq << FRAC_BITS) / info->device->machine->sample_rate(); chan->loop = loop; } @@ -275,7 +275,7 @@ void sample_start_raw(device_t *device,int channel,const INT16 *sampledata,int s chan->pos = 0; chan->frac = 0; chan->basefreq = frequency; - chan->step = ((INT64)chan->basefreq << FRAC_BITS) / info->device->machine->sample_rate; + chan->step = ((INT64)chan->basefreq << FRAC_BITS) / info->device->machine->sample_rate(); chan->loop = loop; } @@ -292,7 +292,7 @@ void sample_set_freq(device_t *device,int channel,int freq) /* force an update before we start */ chan->stream->update(); - chan->step = ((INT64)freq << FRAC_BITS) / info->device->machine->sample_rate; + chan->step = ((INT64)freq << FRAC_BITS) / info->device->machine->sample_rate(); } @@ -468,7 +468,7 @@ static DEVICE_START( samples ) /* read audio samples */ if (intf->samplenames) - info->samples = readsamples(device->machine, intf->samplenames,device->machine->gamedrv->name); + info->samples = readsamples(device->machine, intf->samplenames,device->machine->system().name); /* allocate channels */ info->numchannels = intf->channels; @@ -476,7 +476,7 @@ static DEVICE_START( samples ) info->channel = auto_alloc_array(device->machine, sample_channel, info->numchannels); for (i = 0; i < info->numchannels; i++) { - info->channel[i].stream = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, &info->channel[i], sample_update_sound); + info->channel[i].stream = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate(), &info->channel[i], sample_update_sound); info->channel[i].source = NULL; info->channel[i].source_num = -1; diff --git a/src/emu/sound/sid.c b/src/emu/sound/sid.c index f6afaa983b9..8aca0f283eb 100644 --- a/src/emu/sound/sid.c +++ b/src/emu/sound/sid.c @@ -151,7 +151,7 @@ int sidEmuReset(_SID6581 *This) static void filterTableInit(running_machine *machine) { - int sample_rate = machine->sample_rate; + int sample_rate = machine->sample_rate(); UINT16 uk; /* Parameter calculation has not been moved to a separate function */ /* by purpose. */ diff --git a/src/emu/sound/sid6581.c b/src/emu/sound/sid6581.c index 4960442b1fc..6596df42d6e 100644 --- a/src/emu/sound/sid6581.c +++ b/src/emu/sound/sid6581.c @@ -35,8 +35,8 @@ static void sid_start(device_t *device, SIDTYPE sidtype) const sid6581_interface *iface = (const sid6581_interface*) device->baseconfig().static_config(); sid->device = device; - sid->mixer_channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, (void *) sid, sid_update); - sid->PCMfreq = device->machine->sample_rate; + sid->mixer_channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate(), (void *) sid, sid_update); + sid->PCMfreq = device->machine->sample_rate(); sid->clock = device->clock(); sid->ad_read = iface ? iface->ad_read : NULL; sid->type = sidtype; diff --git a/src/emu/sound/sn76477.c b/src/emu/sound/sn76477.c index 689549b6a18..15852105526 100644 --- a/src/emu/sound/sn76477.c +++ b/src/emu/sound/sn76477.c @@ -253,7 +253,7 @@ struct _sn76477_state /* others */ sound_stream *channel; /* returned by stream_create() */ - int sample_rate; /* from machine->sample_rate */ + int sample_rate; /* from machine->sample_rate() */ device_t *device; wav_file *file; /* handle of the wave file to produce */ @@ -2406,7 +2406,7 @@ static DEVICE_START( sn76477 ) sn->device = device; - sn->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, sn, SN76477_update); + sn->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate(), sn, SN76477_update); if (device->clock() > 0) { @@ -2414,7 +2414,7 @@ static DEVICE_START( sn76477 ) } else { - sn->sample_rate = device->machine->sample_rate; + sn->sample_rate = device->machine->sample_rate(); } intialize_noise(sn); diff --git a/src/emu/sound/speaker.c b/src/emu/sound/speaker.c index 805cbaeb7f1..fd43eade776 100644 --- a/src/emu/sound/speaker.c +++ b/src/emu/sound/speaker.c @@ -140,7 +140,7 @@ static DEVICE_START( speaker ) int i; double x; - sp->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, sp, speaker_sound_update); + sp->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate(), sp, speaker_sound_update); if (intf != NULL) { @@ -160,7 +160,7 @@ static DEVICE_START( speaker ) sp->composed_volume[i] = 0; sp->composed_sample_index = 0; sp->last_update_time = device->machine->time(); - sp->channel_sample_period = HZ_TO_ATTOSECONDS(device->machine->sample_rate); + sp->channel_sample_period = HZ_TO_ATTOSECONDS(device->machine->sample_rate()); sp->channel_sample_period_secfrac = ATTOSECONDS_TO_DOUBLE(sp->channel_sample_period); sp->interm_sample_period = sp->channel_sample_period / RATE_MULTIPLIER; sp->interm_sample_period_secfrac = ATTOSECONDS_TO_DOUBLE(sp->interm_sample_period); diff --git a/src/emu/sound/votrax.c b/src/emu/sound/votrax.c index d8a202147ab..adfb1e212ff 100644 --- a/src/emu/sound/votrax.c +++ b/src/emu/sound/votrax.c @@ -117,7 +117,7 @@ static DEVICE_START( votrax ) votrax->frequency = 8000; votrax->volume = 230; - votrax->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, votrax, votrax_update_sound); + votrax->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate(), votrax, votrax_update_sound); votrax->sample = NULL; votrax->step = 0; @@ -144,7 +144,7 @@ WRITE8_DEVICE_HANDLER( votrax_w ) info->sample = &info->samples->sample[Phoneme]; info->pos = 0; info->frac = 0; - info->step = ((INT64)(info->sample->frequency + (256*Intonation)) << FRAC_BITS) / info->device->machine->sample_rate; + info->step = ((INT64)(info->sample->frequency + (256*Intonation)) << FRAC_BITS) / info->device->machine->sample_rate(); info->channel->set_output_gain(0, (info->volume + (8*Intonation)*100/255) / 100.0); } } diff --git a/src/emu/sound/wave.c b/src/emu/sound/wave.c index 24535e7efc0..42b7f724da3 100644 --- a/src/emu/sound/wave.c +++ b/src/emu/sound/wave.c @@ -39,7 +39,7 @@ static STREAM_UPDATE( wave_sound_update ) { cassette = cassette_get_image(&image->device()); time_index = cassette_get_position(&image->device()); - duration = ((double) samples) / image->device().machine->sample_rate; + duration = ((double) samples) / image->device().machine->sample_rate(); cassette_get_samples(cassette, 0, time_index, duration, samples, 2, left_buffer, CASSETTE_WAVEFORM_16BIT); if (speakers > 1) @@ -68,12 +68,12 @@ static DEVICE_START( wave ) assert( device != NULL ); assert( device->baseconfig().static_config() != NULL ); - int speakers = device->machine->config->m_devicelist.count(SPEAKER); + int speakers = device->machine->config().m_devicelist.count(SPEAKER); image = dynamic_cast<device_image_interface *>(device->machine->device( (const char *)device->baseconfig().static_config())); if (speakers > 1) - device->machine->sound().stream_alloc(*device, 0, 2, device->machine->sample_rate, (void *)image, wave_sound_update); + device->machine->sound().stream_alloc(*device, 0, 2, device->machine->sample_rate(), (void *)image, wave_sound_update); else - device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, (void *)image, wave_sound_update); + device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate(), (void *)image, wave_sound_update); } diff --git a/src/emu/speaker.c b/src/emu/speaker.c index 4b681acf815..924f2dab582 100644 --- a/src/emu/speaker.c +++ b/src/emu/speaker.c @@ -170,7 +170,7 @@ void speaker_device::device_start() } // allocate the mixer stream - m_mixer_stream = m_machine.sound().stream_alloc(*this, m_auto_allocated_inputs, 1, machine->sample_rate); + m_mixer_stream = m_machine.sound().stream_alloc(*this, m_auto_allocated_inputs, 1, machine->sample_rate()); } @@ -182,7 +182,7 @@ void speaker_device::device_start() void speaker_device::device_post_load() { - m_mixer_stream->set_sample_rate(m_machine.sample_rate); + m_mixer_stream->set_sample_rate(m_machine.sample_rate()); } diff --git a/src/emu/state.c b/src/emu/state.c index 728e89762fb..a56f3a25528 100644 --- a/src/emu/state.c +++ b/src/emu/state.c @@ -105,9 +105,9 @@ state_manager::state_manager(running_machine &machine) : m_machine(machine), m_reg_allowed(true), m_illegal_regs(0), - m_entry_list(machine.m_respool), - m_presave_list(machine.m_respool), - m_postload_list(machine.m_respool) + m_entry_list(machine.respool()), + m_presave_list(machine.respool()), + m_postload_list(machine.respool()) { } @@ -200,7 +200,7 @@ void state_manager::save_memory(const char *module, const char *tag, UINT32 inde if (!m_reg_allowed) { logerror("Attempt to register save state entry after state registration is closed!\nModule %s tag %s name %s\n", module, tag, name); - if (m_machine.gamedrv->flags & GAME_SUPPORTS_SAVE) + if (m_machine.system().flags & GAME_SUPPORTS_SAVE) fatalerror("Attempt to register save state entry after state registration is closed!\nModule %s tag %s name %s\n", module, tag, name); m_illegal_regs++; return; @@ -280,7 +280,7 @@ state_save_error state_manager::read_file(emu_file &file) // verify the header and report an error if it doesn't match UINT32 sig = signature(); - if (validate_header(header, m_machine.gamedrv->name, sig, popmessage, "Error: ") != STATERR_NONE) + if (validate_header(header, m_machine.system().name, sig, popmessage, "Error: ") != STATERR_NONE) return STATERR_INVALID_HEADER; // determine whether or not to flip the data when done @@ -321,7 +321,7 @@ state_save_error state_manager::write_file(emu_file &file) memcpy(&header[0], s_magic_num, 8); header[8] = SAVE_VERSION; header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST); - strncpy((char *)&header[0x0a], m_machine.gamedrv->name, 0x1c - 0x0a); + strncpy((char *)&header[0x0a], m_machine.system().name, 0x1c - 0x0a); UINT32 sig = signature(); *(UINT32 *)&header[0x1c] = LITTLE_ENDIANIZE_INT32(sig); diff --git a/src/emu/ui.c b/src/emu/ui.c index cfb9f1fc194..6fa9834c12d 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -280,7 +280,7 @@ int ui_display_startup_screens(running_machine *machine, int first_time, int sho /* disable everything if we are using -str for 300 or fewer seconds, or if we're the empty driver, or if we are debugging */ - if (!first_time || (str > 0 && str < 60*5) || machine->gamedrv == &GAME_NAME(empty) || (machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if (!first_time || (str > 0 && str < 60*5) || &machine->system() == &GAME_NAME(empty) || (machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) show_gameinfo = show_warnings = show_disclaimer = FALSE; /* initialize the on-screen display system */ @@ -305,9 +305,9 @@ int ui_display_startup_screens(running_machine *machine, int first_time, int sho if (show_warnings && warnings_string(machine, messagebox_text).len() > 0) { ui_set_handler(handler_messagebox_ok, 0); - if (machine->gamedrv->flags & (GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS | GAME_REQUIRES_ARTWORK | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NO_SOUND)) + if (machine->system().flags & (GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS | GAME_REQUIRES_ARTWORK | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NO_SOUND)) messagebox_backcolor = UI_YELLOW_COLOR; - if (machine->gamedrv->flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_MECHANICAL)) + if (machine->system().flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_MECHANICAL)) messagebox_backcolor = UI_RED_COLOR; } break; @@ -883,7 +883,7 @@ int ui_is_menu_active(void) static astring &disclaimer_string(running_machine *machine, astring &string) { string.cpy("Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.\n\n"); - string.catprintf("IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.\n\n", machine->gamedrv->description); + string.catprintf("IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.\n\n", machine->system().description); string.cat("Otherwise, type OK or move the joystick left then right to continue"); return string; } @@ -912,19 +912,19 @@ static astring &warnings_string(running_machine *machine, astring &string) string.reset(); /* if no warnings, nothing to return */ - if (rom_load_warnings(machine) == 0 && rom_load_knownbad(machine) == 0 && !(machine->gamedrv->flags & WARNING_FLAGS)) + if (rom_load_warnings(machine) == 0 && rom_load_knownbad(machine) == 0 && !(machine->system().flags & WARNING_FLAGS)) return string; /* add a warning if any ROMs were loaded with warnings */ if (rom_load_warnings(machine) > 0) { string.cat("One or more ROMs/CHDs for this game are incorrect. The " GAMENOUN " may not run correctly.\n"); - if (machine->gamedrv->flags & WARNING_FLAGS) + if (machine->system().flags & WARNING_FLAGS) string.cat("\n"); } /* if we have at least one warning flag, print the general header */ - if ((machine->gamedrv->flags & WARNING_FLAGS) || rom_load_knownbad(machine) > 0) + if ((machine->system().flags & WARNING_FLAGS) || rom_load_knownbad(machine) > 0) { string.cat("There are known problems with this " GAMENOUN "\n\n"); @@ -935,46 +935,46 @@ static astring &warnings_string(running_machine *machine, astring &string) /* add one line per warning flag */ if (input_machine_has_keyboard(machine)) string.cat("The keyboard emulation may not be 100% accurate.\n"); - if (machine->gamedrv->flags & GAME_IMPERFECT_COLORS) + if (machine->system().flags & GAME_IMPERFECT_COLORS) string.cat("The colors aren't 100% accurate.\n"); - if (machine->gamedrv->flags & GAME_WRONG_COLORS) + if (machine->system().flags & GAME_WRONG_COLORS) string.cat("The colors are completely wrong.\n"); - if (machine->gamedrv->flags & GAME_IMPERFECT_GRAPHICS) + if (machine->system().flags & GAME_IMPERFECT_GRAPHICS) string.cat("The video emulation isn't 100% accurate.\n"); - if (machine->gamedrv->flags & GAME_IMPERFECT_SOUND) + if (machine->system().flags & GAME_IMPERFECT_SOUND) string.cat("The sound emulation isn't 100% accurate.\n"); - if (machine->gamedrv->flags & GAME_NO_SOUND) + if (machine->system().flags & GAME_NO_SOUND) string.cat("The game lacks sound.\n"); - if (machine->gamedrv->flags & GAME_NO_COCKTAIL) + if (machine->system().flags & GAME_NO_COCKTAIL) string.cat("Screen flipping in cocktail mode is not supported.\n"); /* check if external artwork is present before displaying this warning? */ - if (machine->gamedrv->flags & GAME_REQUIRES_ARTWORK) + if (machine->system().flags & GAME_REQUIRES_ARTWORK) string.cat("The game requires external artwork files\n"); /* if there's a NOT WORKING, UNEMULATED PROTECTION or GAME MECHANICAL warning, make it stronger */ - if (machine->gamedrv->flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_MECHANICAL)) + if (machine->system().flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_MECHANICAL)) { const game_driver *maindrv; const game_driver *clone_of; int foundworking; /* add the strings for these warnings */ - if (machine->gamedrv->flags & GAME_UNEMULATED_PROTECTION) + if (machine->system().flags & GAME_UNEMULATED_PROTECTION) string.cat("The game has protection which isn't fully emulated.\n"); - if (machine->gamedrv->flags & GAME_NOT_WORKING) + if (machine->system().flags & GAME_NOT_WORKING) string.cat("\nTHIS " CAPGAMENOUN " DOESN'T WORK. The emulation for this game is not yet complete. " "There is nothing you can do to fix this problem except wait for the developers to improve the emulation.\n"); - if (machine->gamedrv->flags & GAME_MECHANICAL) + if (machine->system().flags & GAME_MECHANICAL) string.cat("\nCertain elements of this " GAMENOUN " cannot be emulated as it requires actual physical interaction or consists of mechanical devices. " "It is not possible to fully play this " GAMENOUN ".\n"); /* find the parent of this driver */ - clone_of = driver_get_clone(machine->gamedrv); + clone_of = driver_get_clone(&machine->system()); if (clone_of != NULL && !(clone_of->flags & GAME_IS_BIOS_ROOT)) maindrv = clone_of; else - maindrv = machine->gamedrv; + maindrv = &machine->system(); /* scan the driver list for any working clones and add them */ foundworking = FALSE; @@ -1013,7 +1013,7 @@ astring &game_info_astring(running_machine *machine, astring &string) int found_sound = FALSE; /* print description, manufacturer, and CPU: */ - string.printf("%s\n%s %s\n\nCPU:\n", machine->gamedrv->description, machine->gamedrv->year, machine->gamedrv->manufacturer); + string.printf("%s\n%s %s\n\nCPU:\n", machine->system().description, machine->system().year, machine->system().manufacturer); /* loop over all CPUs */ device_execute_interface *exec = NULL; @@ -1103,7 +1103,7 @@ astring &game_info_astring(running_machine *machine, astring &string) string.catprintf("%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n", visarea.max_x - visarea.min_x + 1, visarea.max_y - visarea.min_y + 1, - (machine->gamedrv->flags & ORIENTATION_SWAP_XY) ? "V" : "H", + (machine->system().flags & ORIENTATION_SWAP_XY) ? "V" : "H", ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds)); } } @@ -1311,7 +1311,7 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain } /* determine if we should disable the rest of the UI */ - int ui_disabled = (input_machine_has_keyboard(machine) && !machine->ui_active); + int ui_disabled = (input_machine_has_keyboard(machine) && !machine->ui_active()); /* is ScrLk UI toggling applicable here? */ if (input_machine_has_keyboard(machine)) @@ -1320,10 +1320,10 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain if (ui_input_pressed(machine, IPT_UI_TOGGLE_UI)) { /* toggle the UI */ - machine->ui_active = !machine->ui_active; + machine->set_ui_active(!machine->ui_active()); /* display a popup indicating the new status */ - if (machine->ui_active) + if (machine->ui_active()) { ui_popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n", "Keyboard Emulation Status", diff --git a/src/emu/uigfx.c b/src/emu/uigfx.c index 112b03c45b6..5b413e3fb03 100644 --- a/src/emu/uigfx.c +++ b/src/emu/uigfx.c @@ -120,12 +120,12 @@ void ui_gfx_init(running_machine *machine) /* set up the graphics state */ for (gfx = 0; gfx < MAX_GFX_ELEMENTS; gfx++) { - state->gfxset.rotate[gfx] = machine->gamedrv->flags & ORIENTATION_MASK; + state->gfxset.rotate[gfx] = machine->system().flags & ORIENTATION_MASK; state->gfxset.count[gfx] = 16; } /* set up the tilemap state */ - state->tilemap.rotate = machine->gamedrv->flags & ORIENTATION_MASK; + state->tilemap.rotate = machine->system().flags & ORIENTATION_MASK; } diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index a9fa5ec2acf..d628cd67298 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -1574,7 +1574,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->m_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/video.c b/src/emu/video.c index 9634deb1798..5cc3c54698b 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -336,7 +336,7 @@ void video_manager::save_snapshot(screen_device *screen, emu_file &file) // add two text entries describing the image astring text1(APPNAME, " ", build_version); - astring text2(m_machine.m_game.manufacturer, " ", m_machine.m_game.description); + astring text2(m_machine.system().manufacturer, " ", m_machine.system().description); png_info pnginfo = { 0 }; png_add_text(&pnginfo, "Software", text1); png_add_text(&pnginfo, "System", text2); @@ -414,12 +414,12 @@ void video_manager::begin_recording(const char *name, movie_format format) info.video_depth = 24; info.audio_format = 0; - info.audio_timescale = m_machine.sample_rate; + info.audio_timescale = m_machine.sample_rate(); info.audio_sampletime = 1; info.audio_numsamples = 0; info.audio_channels = 2; info.audio_samplebits = 16; - info.audio_samplerate = m_machine.sample_rate; + info.audio_samplerate = m_machine.sample_rate(); // create a new temporary movie file file_error filerr; @@ -1263,7 +1263,7 @@ void video_manager::record_frame() if (m_movie_frame == 0) { astring text1(APPNAME, " ", build_version); - astring text2(m_machine.m_game.manufacturer, " ", m_machine.m_game.description); + astring text2(m_machine.system().manufacturer, " ", m_machine.system().description); png_add_text(&pnginfo, "Software", text1); png_add_text(&pnginfo, "System", text2); } diff --git a/src/emu/video/generic.c b/src/emu/video/generic.c index f76c2e81dba..9b74b409f6e 100644 --- a/src/emu/video/generic.c +++ b/src/emu/video/generic.c @@ -237,7 +237,7 @@ void generic_video_init(running_machine *machine) machine->state().save_item(NAME(state->flip_screen_y)); // create spriteram buffers if necessary - if (machine->config->m_video_attributes & VIDEO_BUFFERS_SPRITERAM) + if (machine->config().m_video_attributes & VIDEO_BUFFERS_SPRITERAM) { assert_always(machine->generic.spriteram_size != 0, "Video buffers spriteram but spriteram size is 0"); diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index 13497c1527e..d275cff840b 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -4488,7 +4488,6 @@ static DEVICE_START( voodoo ) assert(device->baseconfig().static_config() == NULL); assert(downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config() != NULL); assert(device->machine != NULL); - assert(device->machine->config != NULL); /* validate configuration */ assert(config->screen != NULL); diff --git a/src/emu/watchdog.c b/src/emu/watchdog.c index e495bc39dda..130e2815378 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.m_config.m_watchdog_vblank_count != 0 || machine.m_config.m_watchdog_time != attotime::zero); + watchdog_enabled = (machine.config().m_watchdog_vblank_count != 0 || machine.config().m_watchdog_time != attotime::zero); 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->m_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) watchdog_timer->adjust(attotime::never); /* VBLANK-based watchdog? */ - else if (machine->config->m_watchdog_vblank_count != 0) + else if (machine->config().m_watchdog_vblank_count != 0) { - watchdog_counter = machine->config->m_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 (machine->config->m_watchdog_time != attotime::zero) - watchdog_timer->adjust(machine->config->m_watchdog_time); + else if (machine->config().m_watchdog_time != attotime::zero) + watchdog_timer->adjust(machine->config().m_watchdog_time); /* default to an obscene amount of time (3 seconds) */ else diff --git a/src/mame/audio/gottlieb.c b/src/mame/audio/gottlieb.c index fe9f1ca61b6..ffc76c7e6ef 100644 --- a/src/mame/audio/gottlieb.c +++ b/src/mame/audio/gottlieb.c @@ -133,7 +133,7 @@ static void trigger_sample(device_t *samples, UINT8 data) { gottlieb_state *state = samples->machine->driver_data<gottlieb_state>(); /* Reactor samples */ - if (strcmp(samples->machine->gamedrv->name, "reactor") == 0) + if (strcmp(samples->machine->system().name, "reactor") == 0) { switch (data) { @@ -186,7 +186,7 @@ static void trigger_sample(device_t *samples, UINT8 data) void gottlieb_knocker(running_machine *machine) { device_t *samples = space->machine->device("samples"); - if (!strcmp(machine->gamedrv->name,"reactor")) /* reactor */ + if (!strcmp(machine->system().name,"reactor")) /* reactor */ { } else if (samples != NULL) /* qbert */ diff --git a/src/mame/audio/gridlee.c b/src/mame/audio/gridlee.c index fa450cefc50..3bca6d87163 100644 --- a/src/mame/audio/gridlee.c +++ b/src/mame/audio/gridlee.c @@ -72,11 +72,11 @@ static DEVICE_START( gridlee_sound ) running_machine *machine = device->machine; /* allocate the stream */ - state->stream = device->machine->sound().stream_alloc(*device, 0, 1, machine->sample_rate, NULL, gridlee_stream_update); + state->stream = device->machine->sound().stream_alloc(*device, 0, 1, machine->sample_rate(), NULL, gridlee_stream_update); state->samples = device->machine->device("samples"); - state->freq_to_step = (double)(1 << 24) / (double)machine->sample_rate; + state->freq_to_step = (double)(1 << 24) / (double)machine->sample_rate(); } diff --git a/src/mame/audio/micro3d.c b/src/mame/audio/micro3d.c index ec30ae74b2c..b3ef279284e 100644 --- a/src/mame/audio/micro3d.c +++ b/src/mame/audio/micro3d.c @@ -314,8 +314,8 @@ static DEVICE_START( micro3d_sound ) noise_state *state = get_safe_token(device); /* Allocate the stream */ - state->stream = device->machine->sound().stream_alloc(*device, 0, 2, machine->sample_rate, state, micro3d_stream_update); - filter_init(machine, &state->filter, machine->sample_rate); + state->stream = device->machine->sound().stream_alloc(*device, 0, 2, machine->sample_rate(), state, micro3d_stream_update); + filter_init(machine, &state->filter, machine->sample_rate()); configure_filter(&state->noise_filters[0], 2.7e3 + 2.7e3, 1.0e-6); configure_filter(&state->noise_filters[1], 2.7e3 + 1e3, 0.30e-6); diff --git a/src/mame/audio/phoenix.c b/src/mame/audio/phoenix.c index d2cc6e7c4ea..4834e937a60 100644 --- a/src/mame/audio/phoenix.c +++ b/src/mame/audio/phoenix.c @@ -225,7 +225,7 @@ INLINE int noise(phoenix_sound_state *state, int samplerate) static STREAM_UPDATE( phoenix_sound_update ) { phoenix_sound_state *state = get_safe_token(device); - int samplerate = device->machine->sample_rate; + int samplerate = device->machine->sample_rate(); stream_sample_t *buffer = outputs[0]; while( samples-- > 0 ) @@ -566,7 +566,7 @@ static DEVICE_START( phoenix_sound ) state->poly18[i] = bits; } - state->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, 0, phoenix_sound_update); + state->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate(), 0, phoenix_sound_update); register_state(device); } diff --git a/src/mame/audio/pleiads.c b/src/mame/audio/pleiads.c index 8088b797457..50e2a59d906 100644 --- a/src/mame/audio/pleiads.c +++ b/src/mame/audio/pleiads.c @@ -409,7 +409,7 @@ INLINE int noise(pleiads_sound_state *state, int samplerate) static STREAM_UPDATE( pleiads_sound_update ) { pleiads_sound_state *state = get_safe_token(device); - int rate = device->machine->sample_rate; + int rate = device->machine->sample_rate(); stream_sample_t *buffer = outputs[0]; while( samples-- > 0 ) @@ -496,7 +496,7 @@ static DEVICE_START( common_sh_start ) state->poly18[i] = bits; } - state->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate, NULL, pleiads_sound_update); + state->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->machine->sample_rate(), NULL, pleiads_sound_update); } static DEVICE_START( pleiads_sound ) diff --git a/src/mame/audio/tx1.c b/src/mame/audio/tx1.c index d101dd03743..ec883bce3d1 100644 --- a/src/mame/audio/tx1.c +++ b/src/mame/audio/tx1.c @@ -301,8 +301,8 @@ static DEVICE_START( tx1_sound ) /* Allocate the stream */ - state->stream = device->machine->sound().stream_alloc(*device, 0, 2, machine->sample_rate, NULL, tx1_stream_update); - state->freq_to_step = (double)(1 << TX1_FRAC) / (double)machine->sample_rate; + state->stream = device->machine->sound().stream_alloc(*device, 0, 2, machine->sample_rate(), NULL, tx1_stream_update); + state->freq_to_step = (double)(1 << TX1_FRAC) / (double)machine->sample_rate(); /* Compute the engine resistor weights */ compute_resistor_weights(0, 10000, -1.0, @@ -442,7 +442,7 @@ WRITE8_DEVICE_HANDLER( bb_ym2_b_w ) state->ym2_outputb = data ^ 0xff; - if (!strcmp(device->machine->gamedrv->name, "buggyboyjr")) + if (!strcmp(device->machine->system().name, "buggyboyjr")) { coin_counter_w(device->machine, 0, data & 0x01); coin_counter_w(device->machine, 1, data & 0x02); @@ -489,7 +489,7 @@ static STREAM_UPDATE( buggyboy_stream_update ) step_0 = state->pit8253.counts[0].val ? (BUGGYBOY_PIT_CLOCK / state->pit8253.counts[0].val) * state->freq_to_step : 0; step_1 = state->pit8253.counts[1].val ? (BUGGYBOY_PIT_CLOCK / state->pit8253.counts[1].val) * state->freq_to_step : 0; - if (!strcmp(device->machine->gamedrv->name, "buggyboyjr")) + if (!strcmp(device->machine->system().name, "buggyboyjr")) gain0 = BIT(state->ym2_outputb, 3) ? 1.0 : 2.0; else gain0 = BIT(state->ym1_outputa, 3) ? 1.0 : 2.0; @@ -508,7 +508,7 @@ static STREAM_UPDATE( buggyboy_stream_update ) pit1 = state->eng_voltages[(state->step1 >> 24) & 0xf]; /* Calculate the tyre screech noise source */ - for (i = 0; i < BUGGYBOY_NOISE_CLOCK / device->machine->sample_rate; ++i) + for (i = 0; i < BUGGYBOY_NOISE_CLOCK / device->machine->sample_rate(); ++i) { /* CD4006 is a 4-4-1-4-4-1 shift register */ int p13 = BIT(state->noise_lfsra, 3); @@ -572,8 +572,8 @@ static DEVICE_START( buggyboy_sound ) state->eng_voltages[i] = combine_4_weights(aweights, BIT(tmp[i], 0), BIT(tmp[i], 1), BIT(tmp[i], 2), BIT(tmp[i], 3)); /* Allocate the stream */ - state->stream = device->machine->sound().stream_alloc(*device, 0, 2, machine->sample_rate, NULL, buggyboy_stream_update); - state->freq_to_step = (double)(1 << 24) / (double)machine->sample_rate; + state->stream = device->machine->sound().stream_alloc(*device, 0, 2, machine->sample_rate(), NULL, buggyboy_stream_update); + state->freq_to_step = (double)(1 << 24) / (double)machine->sample_rate(); } static DEVICE_RESET( buggyboy_sound ) diff --git a/src/mame/drivers/arcadia.c b/src/mame/drivers/arcadia.c index 9193d976e2a..6e8b8a512f1 100644 --- a/src/mame/drivers/arcadia.c +++ b/src/mame/drivers/arcadia.c @@ -742,7 +742,7 @@ INLINE void generic_decode(running_machine *machine, const char *tag, int bit7, FILE *fp; char filename[256]; - sprintf(filename,"decrypted_%s", machine->gamedrv->name); + sprintf(filename,"decrypted_%s", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { diff --git a/src/mame/drivers/cps2.c b/src/mame/drivers/cps2.c index 61f1612e4fd..b5a08555481 100644 --- a/src/mame/drivers/cps2.c +++ b/src/mame/drivers/cps2.c @@ -730,8 +730,8 @@ static WRITE16_HANDLER( cps2_eeprom_port_w ) device_set_input_line(state->audiocpu, INPUT_LINE_RESET, (data & 0x0008) ? CLEAR_LINE : ASSERT_LINE); coin_counter_w(space->machine, 0, data & 0x0001); - if ((strncmp(space->machine->gamedrv->name, "pzloop2", 8) == 0) || - (strncmp(space->machine->gamedrv->name, "pzloop2j", 8) == 0)) + if ((strncmp(space->machine->system().name, "pzloop2", 8) == 0) || + (strncmp(space->machine->system().name, "pzloop2j", 8) == 0)) { // Puzz Loop 2 uses coin counter 2 input to switch between stick and paddle controls state->readpaddle = data & 0x0002; @@ -741,7 +741,7 @@ static WRITE16_HANDLER( cps2_eeprom_port_w ) coin_counter_w(space->machine, 1, data & 0x0002); } - if (strncmp(space->machine->gamedrv->name, "mmatrix", 7) == 0) // Mars Matrix seems to require the coin lockout bit to be reversed + if (strncmp(space->machine->system().name, "mmatrix", 7) == 0) // Mars Matrix seems to require the coin lockout bit to be reversed { coin_lockout_w(space->machine, 0, data & 0x0010); coin_lockout_w(space->machine, 1, data & 0x0020); diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index d4b20727d57..eb1a5a97a94 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -634,7 +634,7 @@ static void cps3_decrypt_bios(running_machine *machine) /* Dump to file */ { FILE *fp; - const char *gamename = machine->gamedrv->name; + const char *gamename = machine->system().name; char filename[256]; sprintf(filename, "%s_bios.dump", gamename); @@ -2353,7 +2353,7 @@ static void copy_from_nvram(running_machine *machine) /* { FILE *fp; - const char *gamename = machine->gamedrv->name; + const char *gamename = machine->system().name; char filename[256]; sprintf(filename, "%s_bios.dump", gamename); diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c index cafa1a2e722..3f6940b9317 100644 --- a/src/mame/drivers/ddragon.c +++ b/src/mame/drivers/ddragon.c @@ -232,7 +232,7 @@ static READ8_HANDLER( darktowr_mcu_bank_r ) so just hack around the protection here. (The hacks are 'right' as I have the original source code & notes to this version of TStrike to examine). */ - if (!strcmp(space->machine->gamedrv->name, "tstrike")) + if (!strcmp(space->machine->system().name, "tstrike")) { /* Static protection checks at boot-up */ if (cpu_get_pc(space->cpu) == 0x9ace) diff --git a/src/mame/drivers/dec0.c b/src/mame/drivers/dec0.c index 27135d682b9..2ceea5f3c3f 100644 --- a/src/mame/drivers/dec0.c +++ b/src/mame/drivers/dec0.c @@ -2889,7 +2889,7 @@ static void dump_to_file(running_machine* machine, UINT8* ROM, int offset, int s { FILE *fp; char filename[256]; - sprintf(filename,"%s_%08x_%08x", machine->gamedrv->name, offset, size); + sprintf(filename,"%s_%08x_%08x", machine->system().name, offset, size); fp=fopen(filename, "w+b"); if (fp) { diff --git a/src/mame/drivers/dkong.c b/src/mame/drivers/dkong.c index 219f774d20b..8d7b9ef7449 100644 --- a/src/mame/drivers/dkong.c +++ b/src/mame/drivers/dkong.c @@ -425,7 +425,7 @@ static MACHINE_START( s2650 ) { dkong_state *state = machine->driver_data<dkong_state>(); UINT8 *p = machine->region("user1")->base(); - const char *game_name = machine->gamedrv->name; + const char *game_name = machine->system().name; int i; MACHINE_START_CALL(dkong2b); diff --git a/src/mame/drivers/eolithsp.c b/src/mame/drivers/eolithsp.c index 8604a8af9df..0c2ddc3a5d0 100644 --- a/src/mame/drivers/eolithsp.c +++ b/src/mame/drivers/eolithsp.c @@ -68,7 +68,7 @@ void init_eolith_speedup(running_machine *machine) while( eolith_speedup_table[ n_game ].s_name != NULL ) { - if( strcmp( machine->gamedrv->name, eolith_speedup_table[ n_game ].s_name ) == 0 ) + if( strcmp( machine->system().name, eolith_speedup_table[ n_game ].s_name ) == 0 ) { eolith_speedup_address = eolith_speedup_table[ n_game ].speedup_address; eolith_speedup_resume_scanline = eolith_speedup_table[ n_game ].speedup_resume_scanline; diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c index 8bb89b5659d..ecf73582a15 100644 --- a/src/mame/drivers/firebeat.c +++ b/src/mame/drivers/firebeat.c @@ -525,7 +525,7 @@ static SCREEN_UPDATE(firebeat) bitmap_fill(bitmap, cliprect, 0); - if (mame_stricmp(screen->machine->gamedrv->name, "popn7") == 0) + if (mame_stricmp(screen->machine->system().name, "popn7") == 0) { gcu_exec_display_list(screen->machine, bitmap, cliprect, chip, 0x1f80000); } diff --git a/src/mame/drivers/goldstar.c b/src/mame/drivers/goldstar.c index 2c9907a4bd8..bd496a06f04 100644 --- a/src/mame/drivers/goldstar.c +++ b/src/mame/drivers/goldstar.c @@ -9670,7 +9670,7 @@ static void dump_to_file(running_machine* machine, UINT8* ROM) { FILE *fp; char filename[256]; - sprintf(filename,"decrypted_%s", machine->gamedrv->name); + sprintf(filename,"decrypted_%s", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { diff --git a/src/mame/drivers/jangou.c b/src/mame/drivers/jangou.c index e74630e990c..a09ddc18875 100644 --- a/src/mame/drivers/jangou.c +++ b/src/mame/drivers/jangou.c @@ -1393,7 +1393,7 @@ static DRIVER_INIT (luckygrl) { FILE *fp; char filename[256]; - sprintf(filename,"decrypted_%s", machine->gamedrv->name); + sprintf(filename,"decrypted_%s", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { diff --git a/src/mame/drivers/kinst.c b/src/mame/drivers/kinst.c index b2d311e0b8f..a08dc25f914 100644 --- a/src/mame/drivers/kinst.c +++ b/src/mame/drivers/kinst.c @@ -169,7 +169,7 @@ static MACHINE_START( kinst ) device_t *ide = machine->device("ide"); UINT8 *features = ide_get_features(ide); - if (strncmp(machine->gamedrv->name, "kinst2", 6) != 0) + if (strncmp(machine->system().name, "kinst2", 6) != 0) { /* kinst: tweak the model number so we pass the check */ features[27*2+0] = 0x54; diff --git a/src/mame/drivers/konamigx.c b/src/mame/drivers/konamigx.c index 237aff5f5df..98f3ccd6abe 100644 --- a/src/mame/drivers/konamigx.c +++ b/src/mame/drivers/konamigx.c @@ -3671,12 +3671,12 @@ static MACHINE_RESET(konamigx) cputag_set_input_line(machine, "soundcpu", INPUT_LINE_HALT, ASSERT_LINE); cputag_set_input_line(machine, "dasp", INPUT_LINE_RESET, ASSERT_LINE); - if (!strcmp(machine->gamedrv->name, "tkmmpzdm")) + if (!strcmp(machine->system().name, "tkmmpzdm")) { // boost voice(chip 1 channel 3-7) for (i=3; i<=7; i++) k054539_set_gain(k054539_2, i, 2.0); } - else if ((!strcmp(machine->gamedrv->name, "dragoonj")) || (!strcmp(machine->gamedrv->name, "dragoona"))) + else if ((!strcmp(machine->system().name, "dragoonj")) || (!strcmp(machine->system().name, "dragoona"))) { // soften percussions(chip 1 channel 0-3), boost voice(chip 1 channel 4-7) for (i=0; i<=3; i++) @@ -3761,7 +3761,7 @@ static DRIVER_INIT(konamigx) i = match = 0; while ((gameDefs[i].cfgport != -1) && (!match)) { - if (!strcmp(machine->gamedrv->name, gameDefs[i].romname)) + if (!strcmp(machine->system().name, gameDefs[i].romname)) { match = 1; konamigx_cfgport = gameDefs[i].cfgport; diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c index 68be1c0c283..97d814b349d 100644 --- a/src/mame/drivers/ksys573.c +++ b/src/mame/drivers/ksys573.c @@ -1346,7 +1346,7 @@ static INTERRUPT_GEN( sys573_vblank ) update_mode(device->machine); - if( strcmp( device->machine->gamedrv->name, "ddr2ml" ) == 0 ) + if( strcmp( device->machine->system().name, "ddr2ml" ) == 0 ) { /* patch out security-plate error */ @@ -1368,7 +1368,7 @@ static INTERRUPT_GEN( sys573_vblank ) p_n_psxram[ 0x1f850 / 4 ] = 0x08007e22; } } - else if( strcmp( device->machine->gamedrv->name, "ddr2mla" ) == 0 ) + else if( strcmp( device->machine->system().name, "ddr2mla" ) == 0 ) { /* patch out security-plate error */ diff --git a/src/mame/drivers/luckgrln.c b/src/mame/drivers/luckgrln.c index f3fb3befc1b..853348efaa5 100644 --- a/src/mame/drivers/luckgrln.c +++ b/src/mame/drivers/luckgrln.c @@ -891,7 +891,7 @@ static DRIVER_INIT( luckgrln ) { FILE *fp; char filename[256]; - sprintf(filename,"decrypted_%s", machine->gamedrv->name); + sprintf(filename,"decrypted_%s", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { diff --git a/src/mame/drivers/model1.c b/src/mame/drivers/model1.c index ba4b3e7fa11..adc9bfaacd5 100644 --- a/src/mame/drivers/model1.c +++ b/src/mame/drivers/model1.c @@ -738,8 +738,8 @@ static MACHINE_RESET(model1) model1_state *state = machine->driver_data<model1_state>(); memory_set_bankptr(machine, "bank1", machine->region("maincpu")->base() + 0x1000000); irq_init(machine); - model1_tgp_reset(machine, !strcmp(machine->gamedrv->name, "swa") || !strcmp(machine->gamedrv->name, "wingwar") || !strcmp(machine->gamedrv->name, "wingwaru") || !strcmp(machine->gamedrv->name, "wingwarj")); - if (!strcmp(machine->gamedrv->name, "swa")) + model1_tgp_reset(machine, !strcmp(machine->system().name, "swa") || !strcmp(machine->system().name, "wingwar") || !strcmp(machine->system().name, "wingwaru") || !strcmp(machine->system().name, "wingwarj")); + if (!strcmp(machine->system().name, "swa")) { state->sound_irq = 0; } diff --git a/src/mame/drivers/model2.c b/src/mame/drivers/model2.c index 64cabffdcb3..841e554f8a8 100644 --- a/src/mame/drivers/model2.c +++ b/src/mame/drivers/model2.c @@ -691,15 +691,15 @@ static WRITE32_HANDLER(copro_sharc_iop_w) { model2_state *state = space->machine->driver_data<model2_state>(); /* FIXME: clean this up */ - if ((strcmp(space->machine->gamedrv->name, "schamp" ) == 0) || - (strcmp(space->machine->gamedrv->name, "sfight" ) == 0) || - (strcmp(space->machine->gamedrv->name, "fvipers" ) == 0) || - (strcmp(space->machine->gamedrv->name, "vstriker" ) == 0) || - (strcmp(space->machine->gamedrv->name, "vstrikero" ) == 0) || - (strcmp(space->machine->gamedrv->name, "gunblade" ) == 0) || - (strcmp(space->machine->gamedrv->name, "von" ) == 0) || - (strcmp(space->machine->gamedrv->name, "vonj" ) == 0) || - (strcmp(space->machine->gamedrv->name, "rchase2" ) == 0)) + if ((strcmp(space->machine->system().name, "schamp" ) == 0) || + (strcmp(space->machine->system().name, "sfight" ) == 0) || + (strcmp(space->machine->system().name, "fvipers" ) == 0) || + (strcmp(space->machine->system().name, "vstriker" ) == 0) || + (strcmp(space->machine->system().name, "vstrikero" ) == 0) || + (strcmp(space->machine->system().name, "gunblade" ) == 0) || + (strcmp(space->machine->system().name, "von" ) == 0) || + (strcmp(space->machine->system().name, "vonj" ) == 0) || + (strcmp(space->machine->system().name, "rchase2" ) == 0)) { sharc_external_iop_write(space->machine->device("dsp"), offset, data); } @@ -772,7 +772,7 @@ static WRITE32_HANDLER( geo_sharc_ctl1_w ) static READ32_HANDLER(geo_sharc_fifo_r) { - if ((strcmp(space->machine->gamedrv->name, "manxtt" ) == 0) || (strcmp(space->machine->gamedrv->name, "srallyc" ) == 0)) + if ((strcmp(space->machine->system().name, "manxtt" ) == 0) || (strcmp(space->machine->system().name, "srallyc" ) == 0)) { return 8; } @@ -801,7 +801,7 @@ static WRITE32_HANDLER(geo_sharc_fifo_w) static WRITE32_HANDLER(geo_sharc_iop_w) { model2_state *state = space->machine->driver_data<model2_state>(); - if ((strcmp(space->machine->gamedrv->name, "schamp" ) == 0)) + if ((strcmp(space->machine->system().name, "schamp" ) == 0)) { sharc_external_iop_write(space->machine->device("dsp2"), offset, data); } diff --git a/src/mame/drivers/model3.c b/src/mame/drivers/model3.c index 10639cd4c78..744353f9eaf 100644 --- a/src/mame/drivers/model3.c +++ b/src/mame/drivers/model3.c @@ -1232,9 +1232,9 @@ static void model3_init(running_machine *machine, int step) model3_tap_reset(machine); if(step < 0x20) { - if( mame_stricmp(machine->gamedrv->name, "vs215") == 0 || - mame_stricmp(machine->gamedrv->name, "vs29815") == 0 || - mame_stricmp(machine->gamedrv->name, "bass") == 0 ) + if( mame_stricmp(machine->system().name, "vs215") == 0 || + mame_stricmp(machine->system().name, "vs29815") == 0 || + mame_stricmp(machine->system().name, "bass") == 0 ) { mpc106_init(machine); } @@ -1248,8 +1248,8 @@ static void model3_init(running_machine *machine, int step) mpc106_init(machine); // some step 2+ games need the older PCI ID (obvious symptom: // vbl is enabled briefly then disabled so the game hangs) - if (mame_stricmp(machine->gamedrv->name, "magtruck") == 0 || - mame_stricmp(machine->gamedrv->name, "von254g") == 0) + if (mame_stricmp(machine->system().name, "magtruck") == 0 || + mame_stricmp(machine->system().name, "von254g") == 0) { state->real3d_device_id = 0x16c311db; /* PCI Vendor ID (11db = SEGA), Device ID (16c3 = 315-5827) */ } @@ -1717,13 +1717,13 @@ static READ64_HANDLER(model3_security_r) case 0x00/8: return 0; /* status */ case 0x1c/8: /* security board data read */ { - if (mame_stricmp(space->machine->gamedrv->name, "vs299") == 0 || - mame_stricmp(space->machine->gamedrv->name, "vs2v991") == 0) + if (mame_stricmp(space->machine->system().name, "vs299") == 0 || + mame_stricmp(space->machine->system().name, "vs2v991") == 0) { return (UINT64)vs299_prot_data[state->prot_data_ptr++] << 48; } - else if (mame_stricmp(space->machine->gamedrv->name, "swtrilgy") == 0 || - mame_stricmp(space->machine->gamedrv->name, "swtrilgya") == 0) + else if (mame_stricmp(space->machine->system().name, "swtrilgy") == 0 || + mame_stricmp(space->machine->system().name, "swtrilgya") == 0) { UINT64 data = (UINT64)swt_prot_data[state->prot_data_ptr++] << 16; if (state->prot_data_ptr > 0x38) @@ -1732,7 +1732,7 @@ static READ64_HANDLER(model3_security_r) } return data; } - else if (mame_stricmp(space->machine->gamedrv->name, "fvipers2") == 0) + else if (mame_stricmp(space->machine->system().name, "fvipers2") == 0) { UINT64 data = (UINT64)fvipers2_prot_data[state->prot_data_ptr++] << 16; if (state->prot_data_ptr >= 0x41) @@ -1741,8 +1741,8 @@ static READ64_HANDLER(model3_security_r) } return data; } - else if (mame_stricmp(space->machine->gamedrv->name, "spikeout") == 0 || - mame_stricmp(space->machine->gamedrv->name, "spikeofe") == 0) + else if (mame_stricmp(space->machine->system().name, "spikeout") == 0 || + mame_stricmp(space->machine->system().name, "spikeofe") == 0) { UINT64 data = (UINT64)spikeout_prot_data[state->prot_data_ptr++] << 16; if (state->prot_data_ptr >= 0x55) @@ -1751,8 +1751,8 @@ static READ64_HANDLER(model3_security_r) } return data; } - else if (mame_stricmp(space->machine->gamedrv->name, "eca") == 0 || - mame_stricmp(space->machine->gamedrv->name, "ecax") == 0) + else if (mame_stricmp(space->machine->system().name, "eca") == 0 || + mame_stricmp(space->machine->system().name, "ecax") == 0) { UINT64 data = (UINT64)eca_prot_data[state->prot_data_ptr++] << 16; if (state->prot_data_ptr >= 0x31) @@ -1761,7 +1761,7 @@ static READ64_HANDLER(model3_security_r) } return data; } - else if (mame_stricmp(space->machine->gamedrv->name, "oceanhun") == 0) + else if (mame_stricmp(space->machine->system().name, "oceanhun") == 0) { UINT64 data = (UINT64)oceanhun_prot_data[state->prot_data_ptr++] << 16; if (state->prot_data_ptr >= 58) diff --git a/src/mame/drivers/moo.c b/src/mame/drivers/moo.c index ab71a9337a2..4aca56cb7a4 100644 --- a/src/mame/drivers/moo.c +++ b/src/mame/drivers/moo.c @@ -916,7 +916,7 @@ ROM_END static DRIVER_INIT( moo ) { moo_state *state = machine->driver_data<moo_state>(); - state->game_type = (!strcmp(machine->gamedrv->name, "bucky") || !strcmp(machine->gamedrv->name, "buckyua")); + state->game_type = (!strcmp(machine->system().name, "bucky") || !strcmp(machine->system().name, "buckyua")); } diff --git a/src/mame/drivers/mpu4.c b/src/mame/drivers/mpu4.c index df0f3459bec..a598f891932 100644 --- a/src/mame/drivers/mpu4.c +++ b/src/mame/drivers/mpu4.c @@ -1116,7 +1116,7 @@ static WRITE8_DEVICE_HANDLER( pia_ic5_porta_w ) awp_draw_reel(2); } - if (mame_stricmp(device->machine->gamedrv->name, "m_gmball") == 0) + if (mame_stricmp(device->machine->system().name, "m_gmball") == 0) { /* The 'Gamball' device is a unique piece of mechanical equipment, designed to provide a truly fair hi-lo gamble for an AWP machine. Functionally, it consists of diff --git a/src/mame/drivers/namcoic.c b/src/mame/drivers/namcoic.c index 7c3d7220fd7..c4af9dbb7f6 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->m_video_attributes&VIDEO_HAS_SHADOWS)?gfx->machine->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/namcos11.c b/src/mame/drivers/namcos11.c index 4b42daa8842..323fe321ac5 100644 --- a/src/mame/drivers/namcos11.c +++ b/src/mame/drivers/namcos11.c @@ -586,7 +586,7 @@ static INTERRUPT_GEN( namcos11_vblank ) namcos11_state *state = device->machine->driver_data<namcos11_state>(); UINT32 *p_n_psxram = state->p_n_psxram; - if( strcmp( device->machine->gamedrv->name, "pocketrc" ) == 0 ) + if( strcmp( device->machine->system().name, "pocketrc" ) == 0 ) { if( p_n_psxram[ 0x12c74 / 4 ] == 0x1440fff9 ) { @@ -917,7 +917,7 @@ static DRIVER_INIT( namcos11 ) machine->device("c76")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x82, 0x83, FUNC(c76_speedup_r), FUNC(c76_speedup_w)); - if( strcmp( machine->gamedrv->name, "pocketrc" ) == 0 ) + if( strcmp( machine->system().name, "pocketrc" ) == 0 ) { machine->device("c76")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC0_L, FUNC(pocketrc_steer_r)); machine->device("c76")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC1_L, M37710_ADC1_L, FUNC(pocketrc_gas_r)); @@ -928,7 +928,7 @@ static DRIVER_INIT( namcos11 ) n_game = 0; while( namcos11_config_table[ n_game ].s_name != NULL ) { - if( strcmp( machine->gamedrv->name, namcos11_config_table[ n_game ].s_name ) == 0 ) + if( strcmp( machine->system().name, namcos11_config_table[ n_game ].s_name ) == 0 ) { if( namcos11_config_table[ n_game ].keycus_r != NULL ) { @@ -977,7 +977,7 @@ static DRIVER_INIT( namcos11 ) n_game++; } - if( strcmp( machine->gamedrv->name, "ptblank2a" ) == 0 ) + if( strcmp( machine->system().name, "ptblank2a" ) == 0 ) { machine->device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x1f788000, 0x1f788003, FUNC(lightgun_w) ); machine->device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler (0x1f780000, 0x1f78000f, FUNC(lightgun_r) ); diff --git a/src/mame/drivers/namcos12.c b/src/mame/drivers/namcos12.c index db2d553a1ca..241018980b5 100644 --- a/src/mame/drivers/namcos12.c +++ b/src/mame/drivers/namcos12.c @@ -1107,8 +1107,8 @@ static WRITE32_HANDLER( bankoffset_w ) namcos12_state *state = space->machine->driver_data<namcos12_state>(); // Golgo 13 has different banking (maybe the keycus controls it?) - if( strcmp( space->machine->gamedrv->name, "golgo13" ) == 0 || - strcmp( space->machine->gamedrv->name, "g13knd" ) == 0 ) + if( strcmp( space->machine->system().name, "golgo13" ) == 0 || + strcmp( space->machine->system().name, "g13knd" ) == 0 ) { if( ( data & 8 ) != 0 ) { @@ -1371,10 +1371,10 @@ static MACHINE_RESET( namcos12 ) bankoffset_w(space,0,0,0xffffffff); state->has_tektagt_dma = 0; - if( strcmp( machine->gamedrv->name, "tektagt" ) == 0 || - strcmp( machine->gamedrv->name, "tektagta" ) == 0 || - strcmp( machine->gamedrv->name, "tektagtb" ) == 0 || - strcmp( machine->gamedrv->name, "tektagtc" ) == 0 ) + if( strcmp( machine->system().name, "tektagt" ) == 0 || + strcmp( machine->system().name, "tektagta" ) == 0 || + strcmp( machine->system().name, "tektagtb" ) == 0 || + strcmp( machine->system().name, "tektagtc" ) == 0 ) { state->has_tektagt_dma = 1; space->install_legacy_readwrite_handler(0x1fb00000, 0x1fb00003, FUNC(tektagt_protection_1_r), FUNC(tektagt_protection_1_w) ); @@ -1382,24 +1382,24 @@ static MACHINE_RESET( namcos12 ) space->install_legacy_read_handler(0x1f700000, 0x1f700003, FUNC(tektagt_protection_3_r) ); } - if( strcmp( machine->gamedrv->name, "tektagt" ) == 0 || - strcmp( machine->gamedrv->name, "tektagta" ) == 0 || - strcmp( machine->gamedrv->name, "tektagtb" ) == 0 || - strcmp( machine->gamedrv->name, "tektagtc" ) == 0 || - strcmp( machine->gamedrv->name, "fgtlayer" ) == 0 || - strcmp( machine->gamedrv->name, "golgo13" ) == 0 || - strcmp( machine->gamedrv->name, "g13knd" ) == 0 || - strcmp( machine->gamedrv->name, "mrdrillr" ) == 0 || - strcmp( machine->gamedrv->name, "pacapp" ) == 0 || - strcmp( machine->gamedrv->name, "pacappsp" ) == 0 || - strcmp( machine->gamedrv->name, "pacapp2" ) == 0 || - strcmp( machine->gamedrv->name, "tenkomorj" ) == 0 || - strcmp( machine->gamedrv->name, "tenkomor" ) == 0 || - strcmp( machine->gamedrv->name, "ptblank2" ) == 0 || - strcmp( machine->gamedrv->name, "sws2000" ) == 0 || - strcmp( machine->gamedrv->name, "sws2001" ) == 0 || - strcmp( machine->gamedrv->name, "truckk" ) == 0 || - strcmp( machine->gamedrv->name, "ghlpanic" ) == 0 ) + if( strcmp( machine->system().name, "tektagt" ) == 0 || + strcmp( machine->system().name, "tektagta" ) == 0 || + strcmp( machine->system().name, "tektagtb" ) == 0 || + strcmp( machine->system().name, "tektagtc" ) == 0 || + strcmp( machine->system().name, "fgtlayer" ) == 0 || + strcmp( machine->system().name, "golgo13" ) == 0 || + strcmp( machine->system().name, "g13knd" ) == 0 || + strcmp( machine->system().name, "mrdrillr" ) == 0 || + strcmp( machine->system().name, "pacapp" ) == 0 || + strcmp( machine->system().name, "pacappsp" ) == 0 || + strcmp( machine->system().name, "pacapp2" ) == 0 || + strcmp( machine->system().name, "tenkomorj" ) == 0 || + strcmp( machine->system().name, "tenkomor" ) == 0 || + strcmp( machine->system().name, "ptblank2" ) == 0 || + strcmp( machine->system().name, "sws2000" ) == 0 || + strcmp( machine->system().name, "sws2001" ) == 0 || + strcmp( machine->system().name, "truckk" ) == 0 || + strcmp( machine->system().name, "ghlpanic" ) == 0 ) { /* this is based on guesswork, it might not even be keycus. */ space->install_read_bank (0x1fc20280, 0x1fc2028b, "bank2" ); diff --git a/src/mame/drivers/namcos22.c b/src/mame/drivers/namcos22.c index af9d7d0836f..ba1d13f3ade 100644 --- a/src/mame/drivers/namcos22.c +++ b/src/mame/drivers/namcos22.c @@ -2598,7 +2598,7 @@ static WRITE8_HANDLER( mcu_port5_w ) // bit 1 = fan // bit 2 = button light - if (!strcmp(space->machine->gamedrv->name, "propcycl")) + if (!strcmp(space->machine->system().name, "propcycl")) { output_set_value("fan0", data & 1); set_led_status(space->machine, 0, data & 2); diff --git a/src/mame/drivers/namcos23.c b/src/mame/drivers/namcos23.c index 0c250bd000c..c4c72011862 100644 --- a/src/mame/drivers/namcos23.c +++ b/src/mame/drivers/namcos23.c @@ -2001,9 +2001,9 @@ static VIDEO_START( ss23 ) tilemap_set_transparent_pen(bgtilemap, 0xf); // Gorgon's tilemap offset is 0, S23/SS23's is 860 - if ((!strcmp(machine->gamedrv->name, "rapidrvr")) || - (!strcmp(machine->gamedrv->name, "rapidrvr2")) || - (!strcmp(machine->gamedrv->name, "finlflng"))) + if ((!strcmp(machine->system().name, "rapidrvr")) || + (!strcmp(machine->system().name, "rapidrvr2")) || + (!strcmp(machine->system().name, "finlflng"))) { tilemap_set_scrolldx(bgtilemap, 0, 0); } @@ -2649,21 +2649,21 @@ static DRIVER_INIT(ss23) render_count[0] = render_count[1] = 0; render_cur = 0; - if ((!strcmp(machine->gamedrv->name, "motoxgo")) || - (!strcmp(machine->gamedrv->name, "panicprk")) || - (!strcmp(machine->gamedrv->name, "rapidrvr")) || - (!strcmp(machine->gamedrv->name, "rapidrvr2")) || - (!strcmp(machine->gamedrv->name, "finlflng")) || - (!strcmp(machine->gamedrv->name, "gunwars")) || - (!strcmp(machine->gamedrv->name, "downhill")) || - (!strcmp(machine->gamedrv->name, "finfurl2")) || - (!strcmp(machine->gamedrv->name, "finfurl2j")) || - (!strcmp(machine->gamedrv->name, "raceon")) || - (!strcmp(machine->gamedrv->name, "crszone")) || - (!strcmp(machine->gamedrv->name, "crszonea")) || - (!strcmp(machine->gamedrv->name, "crszoneb")) || - (!strcmp(machine->gamedrv->name, "timecrs2b")) || - (!strcmp(machine->gamedrv->name, "timecrs2"))) + if ((!strcmp(machine->system().name, "motoxgo")) || + (!strcmp(machine->system().name, "panicprk")) || + (!strcmp(machine->system().name, "rapidrvr")) || + (!strcmp(machine->system().name, "rapidrvr2")) || + (!strcmp(machine->system().name, "finlflng")) || + (!strcmp(machine->system().name, "gunwars")) || + (!strcmp(machine->system().name, "downhill")) || + (!strcmp(machine->system().name, "finfurl2")) || + (!strcmp(machine->system().name, "finfurl2j")) || + (!strcmp(machine->system().name, "raceon")) || + (!strcmp(machine->system().name, "crszone")) || + (!strcmp(machine->system().name, "crszonea")) || + (!strcmp(machine->system().name, "crszoneb")) || + (!strcmp(machine->system().name, "timecrs2b")) || + (!strcmp(machine->system().name, "timecrs2"))) { has_jvsio = 1; } diff --git a/src/mame/drivers/naomi.c b/src/mame/drivers/naomi.c index 931a4380f3f..4938c9de8d2 100644 --- a/src/mame/drivers/naomi.c +++ b/src/mame/drivers/naomi.c @@ -1426,7 +1426,7 @@ static NVRAM_HANDLER( naomi_eeproms ) // some games require defaults to boot (vertical, 1 player etc.) for (i=0; i<ARRAY_LENGTH(jvseeprom_default_game); i++) - if (!strcmp(machine->gamedrv->name, jvseeprom_default_game[i].name)) + if (!strcmp(machine->system().name, jvseeprom_default_game[i].name)) { jvseeprom_default = jvseeprom_default_game[i].eeprom; break; diff --git a/src/mame/drivers/nbmj9195.c b/src/mame/drivers/nbmj9195.c index 10dfb05f6c5..4279da91b0b 100644 --- a/src/mame/drivers/nbmj9195.c +++ b/src/mame/drivers/nbmj9195.c @@ -137,9 +137,9 @@ static READ8_HANDLER( tmpz84c011_pio_r ) nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); int portdata; - if ((!strcmp(space->machine->gamedrv->name, "mscoutm")) || - (!strcmp(space->machine->gamedrv->name, "imekura")) || - (!strcmp(space->machine->gamedrv->name, "mjegolf"))) + if ((!strcmp(space->machine->system().name, "mscoutm")) || + (!strcmp(space->machine->system().name, "imekura")) || + (!strcmp(space->machine->system().name, "mjegolf"))) { switch (offset) @@ -318,9 +318,9 @@ static READ8_HANDLER( tmpz84c011_pio_r ) static WRITE8_HANDLER( tmpz84c011_pio_w ) { - if ((!strcmp(space->machine->gamedrv->name, "imekura")) || - (!strcmp(space->machine->gamedrv->name, "mscoutm")) || - (!strcmp(space->machine->gamedrv->name, "mjegolf"))) + if ((!strcmp(space->machine->system().name, "imekura")) || + (!strcmp(space->machine->system().name, "mscoutm")) || + (!strcmp(space->machine->system().name, "mjegolf"))) { switch (offset) diff --git a/src/mame/drivers/nwk-tr.c b/src/mame/drivers/nwk-tr.c index d59b17afe99..88b9b0efc94 100644 --- a/src/mame/drivers/nwk-tr.c +++ b/src/mame/drivers/nwk-tr.c @@ -459,7 +459,7 @@ static WRITE32_HANDLER( lanc2_w ) } if (offset == 4) { - if (mame_stricmp(space->machine->gamedrv->name, "thrilld") == 0) + if (mame_stricmp(space->machine->system().name, "thrilld") == 0) { state->work_ram[(0x3ffed0/4) + 0] = 0x472a3731; state->work_ram[(0x3ffed0/4) + 1] = 0x33202020; diff --git a/src/mame/drivers/pinkiri8.c b/src/mame/drivers/pinkiri8.c index ab73de4d5b4..9acfeff770f 100644 --- a/src/mame/drivers/pinkiri8.c +++ b/src/mame/drivers/pinkiri8.c @@ -211,7 +211,7 @@ static SCREEN_UPDATE( pinkiri8 ) int game_type_hack = 0; - if (!strcmp(screen->machine->gamedrv->name,"janshi")) game_type_hack = 1; + if (!strcmp(screen->machine->system().name,"janshi")) game_type_hack = 1; if ( input_code_pressed_once(screen->machine, KEYCODE_W) ) { diff --git a/src/mame/drivers/psikyo.c b/src/mame/drivers/psikyo.c index 7a88dc4f65d..fdf34128a68 100644 --- a/src/mame/drivers/psikyo.c +++ b/src/mame/drivers/psikyo.c @@ -1854,7 +1854,7 @@ static DRIVER_INIT( sngkace ) /* Enable other regions */ #if 0 - if (!strcmp(machine->gamedrv->name,"sngkace")) + if (!strcmp(machine->system().name,"sngkace")) { UINT8 *ROM = machine->region("maincpu")->base(); ROM[0x995] = 0x4e; diff --git a/src/mame/drivers/r2dx_v33.c b/src/mame/drivers/r2dx_v33.c index ad903950d92..ed2ac2b9150 100644 --- a/src/mame/drivers/r2dx_v33.c +++ b/src/mame/drivers/r2dx_v33.c @@ -267,7 +267,7 @@ WRITE16_HANDLER( mcu_prog_w2 ) { char tmp[64]; FILE *fp; - sprintf(tmp,"cop3_%s.data", space->machine->gamedrv->name); + sprintf(tmp,"cop3_%s.data", space->machine->system().name); fp=fopen(tmp, "w+b"); if (fp) diff --git a/src/mame/drivers/sfbonus.c b/src/mame/drivers/sfbonus.c index 689e708acd4..b096df1496a 100644 --- a/src/mame/drivers/sfbonus.c +++ b/src/mame/drivers/sfbonus.c @@ -1031,7 +1031,7 @@ static SCREEN_UPDATE(sfbonus) state->_1800_regs[7]); #endif - ipt = screen->machine->gamedrv->ipt; + ipt = screen->machine->system().ipt; if ((ipt == INPUT_PORTS_NAME(amcoe2_reels3)) || (ipt == INPUT_PORTS_NAME(amcoe2_reels4)) || (ipt == INPUT_PORTS_NAME(amcoe2_poker))) { @@ -5526,7 +5526,7 @@ static DRIVER_INIT( sfbonus_common) { FILE *fp; char filename[256]; - sprintf(filename,"decr_%s", machine->gamedrv->name); + sprintf(filename,"decr_%s", machine->system().name); fp = fopen(filename, "w+b"); if (fp) { diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c index b46f7435811..ee413eb4511 100644 --- a/src/mame/drivers/stv.c +++ b/src/mame/drivers/stv.c @@ -822,7 +822,7 @@ static READ32_HANDLER ( stv_io_r32 ) } case 0x47: { - if ( strcmp(space->machine->gamedrv->name,"critcrsh") == 0 ) + if ( strcmp(space->machine->system().name,"critcrsh") == 0 ) { int data1 = 0, data2 = 0; @@ -844,7 +844,7 @@ static READ32_HANDLER ( stv_io_r32 ) return (input_port_read(space->machine, "P1") << 16) | (input_port_read(space->machine, "P2")); } case 0x04/4: - if ( strcmp(space->machine->gamedrv->name,"critcrsh") == 0 ) + if ( strcmp(space->machine->system().name,"critcrsh") == 0 ) return ((input_port_read(space->machine, "SYSTEM") << 16) & ((input_port_read(space->machine, "P1") & 1) ? 0xffef0000 : 0xffff0000)) | (ioga[1]); else return (input_port_read(space->machine, "SYSTEM") << 16) | (ioga[1]); diff --git a/src/mame/drivers/subsino.c b/src/mame/drivers/subsino.c index f90a4dd0213..b88512c426a 100644 --- a/src/mame/drivers/subsino.c +++ b/src/mame/drivers/subsino.c @@ -3480,7 +3480,7 @@ void dump_decrypted(running_machine* machine, UINT8* decrypt) { FILE *fp; char filename[256]; - sprintf(filename,"dat_%s", machine->gamedrv->name); + sprintf(filename,"dat_%s", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { diff --git a/src/mame/drivers/suprnova.c b/src/mame/drivers/suprnova.c index 69499bfb25d..af04f025d1c 100644 --- a/src/mame/drivers/suprnova.c +++ b/src/mame/drivers/suprnova.c @@ -648,8 +648,8 @@ static WRITE32_HANDLER( skns_io_w ) /* idle skip for vblokbrk/sarukani, i can't find a better place to put it :-( but i think it works ok unless its making the game too fast */ if (cpu_get_pc(space->cpu)==0x04013B42) { - if (!strcmp(space->machine->gamedrv->name,"vblokbrk") || - !strcmp(space->machine->gamedrv->name,"sarukani")) + if (!strcmp(space->machine->system().name,"vblokbrk") || + !strcmp(space->machine->system().name,"sarukani")) device_spin_until_interrupt(space->cpu); } diff --git a/src/mame/drivers/toaplan2.c b/src/mame/drivers/toaplan2.c index 41f8ddc5608..338eef8c139 100644 --- a/src/mame/drivers/toaplan2.c +++ b/src/mame/drivers/toaplan2.c @@ -884,22 +884,22 @@ static READ8_HANDLER( fixeight_region_r ) // this code, and the default eeproms use should be considered subject // to change - if (!strcmp(space->machine->gamedrv->name,"fixeightkt")) return 0x00; - if (!strcmp(space->machine->gamedrv->name,"fixeightk")) return 0x01; - if (!strcmp(space->machine->gamedrv->name,"fixeightht")) return 0x02; - if (!strcmp(space->machine->gamedrv->name,"fixeighth")) return 0x03; - if (!strcmp(space->machine->gamedrv->name,"fixeighttwt")) return 0x04; - if (!strcmp(space->machine->gamedrv->name,"fixeighttw")) return 0x05; - if (!strcmp(space->machine->gamedrv->name,"fixeightat")) return 0x06; - if (!strcmp(space->machine->gamedrv->name,"fixeighta")) return 0x07; - if (!strcmp(space->machine->gamedrv->name,"fixeightt")) return 0x08; - if (!strcmp(space->machine->gamedrv->name,"fixeight9")) return 0x09; - if (!strcmp(space->machine->gamedrv->name,"fixeighta")) return 0x0a; - if (!strcmp(space->machine->gamedrv->name,"fixeightu")) return 0x0b; -// if (!strcmp(space->machine->gamedrv->name,"fixeightc")) return 0x0c; // invalid -// if (!strcmp(space->machine->gamedrv->name,"fixeightd")) return 0x0d; // invalid - if (!strcmp(space->machine->gamedrv->name,"fixeightj")) return 0x0e; - if (!strcmp(space->machine->gamedrv->name,"fixeightjt")) return 0x0f; + if (!strcmp(space->machine->system().name,"fixeightkt")) return 0x00; + if (!strcmp(space->machine->system().name,"fixeightk")) return 0x01; + if (!strcmp(space->machine->system().name,"fixeightht")) return 0x02; + if (!strcmp(space->machine->system().name,"fixeighth")) return 0x03; + if (!strcmp(space->machine->system().name,"fixeighttwt")) return 0x04; + if (!strcmp(space->machine->system().name,"fixeighttw")) return 0x05; + if (!strcmp(space->machine->system().name,"fixeightat")) return 0x06; + if (!strcmp(space->machine->system().name,"fixeighta")) return 0x07; + if (!strcmp(space->machine->system().name,"fixeightt")) return 0x08; + if (!strcmp(space->machine->system().name,"fixeight9")) return 0x09; + if (!strcmp(space->machine->system().name,"fixeighta")) return 0x0a; + if (!strcmp(space->machine->system().name,"fixeightu")) return 0x0b; +// if (!strcmp(space->machine->system().name,"fixeightc")) return 0x0c; // invalid +// if (!strcmp(space->machine->system().name,"fixeightd")) return 0x0d; // invalid + if (!strcmp(space->machine->system().name,"fixeightj")) return 0x0e; + if (!strcmp(space->machine->system().name,"fixeightjt")) return 0x0f; return 0x00; } diff --git a/src/mame/drivers/tsamurai.c b/src/mame/drivers/tsamurai.c index cf1d5c0f779..c217e18656a 100644 --- a/src/mame/drivers/tsamurai.c +++ b/src/mame/drivers/tsamurai.c @@ -294,9 +294,9 @@ static INTERRUPT_GEN( vsgongf_sound_interrupt ) static READ8_HANDLER( vsgongf_a006_r ) { /* sound CPU busy? */ - if (!strcmp(space->machine->gamedrv->name,"vsgongf")) return 0x80; - if (!strcmp(space->machine->gamedrv->name,"ringfgt")) return 0x80; - if (!strcmp(space->machine->gamedrv->name,"ringfgt2")) return 0xc0; + if (!strcmp(space->machine->system().name,"vsgongf")) return 0x80; + if (!strcmp(space->machine->system().name,"ringfgt")) return 0x80; + if (!strcmp(space->machine->system().name,"ringfgt2")) return 0xc0; logerror ("unhandled read from a006\n"); return 0x00; @@ -305,9 +305,9 @@ static READ8_HANDLER( vsgongf_a006_r ) static READ8_HANDLER( vsgongf_a100_r ) { /* protection? */ - if (!strcmp(space->machine->gamedrv->name,"vsgongf")) return 0xaa; - if (!strcmp(space->machine->gamedrv->name,"ringfgt")) return 0x63; - if (!strcmp(space->machine->gamedrv->name,"ringfgt2")) return 0x6a; + if (!strcmp(space->machine->system().name,"vsgongf")) return 0xaa; + if (!strcmp(space->machine->system().name,"ringfgt")) return 0x63; + if (!strcmp(space->machine->system().name,"ringfgt2")) return 0x6a; logerror ("unhandled read from a100\n"); return 0x00; diff --git a/src/mame/drivers/vega.c b/src/mame/drivers/vega.c index de90f7ff783..60800acbea3 100644 --- a/src/mame/drivers/vega.c +++ b/src/mame/drivers/vega.c @@ -135,7 +135,7 @@ DRIVER_INIT(vegaa) { FILE *fp; char filename[256]; - sprintf(filename,"vega_%s", machine->gamedrv->name); + sprintf(filename,"vega_%s", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { diff --git a/src/mame/drivers/warpwarp.c b/src/mame/drivers/warpwarp.c index 7b1055a913d..a9e0348aa7f 100644 --- a/src/mame/drivers/warpwarp.c +++ b/src/mame/drivers/warpwarp.c @@ -198,7 +198,7 @@ static WRITE8_HANDLER( geebee_out7_w ) coin_counter_w(space->machine, 0,data & 1); break; case 4: - if (strcmp(space->machine->gamedrv->name, "geebeeb")) + if (strcmp(space->machine->system().name, "geebeeb")) coin_lockout_global_w(space->machine, ~data & 1); break; case 5: diff --git a/src/mame/drivers/xexex.c b/src/mame/drivers/xexex.c index 6df09cc1a4d..7d7cfa87ad2 100644 --- a/src/mame/drivers/xexex.c +++ b/src/mame/drivers/xexex.c @@ -691,7 +691,7 @@ static DRIVER_INIT( xexex ) state->strip_0x1a = 0; - if (!strcmp(machine->gamedrv->name, "xexex")) + if (!strcmp(machine->system().name, "xexex")) { // Invulnerability // *(UINT16 *)(machine->region("maincpu")->base() + 0x648d4) = 0x4a79; diff --git a/src/mame/drivers/zaccaria.c b/src/mame/drivers/zaccaria.c index 23341484458..7d33b6dbab9 100644 --- a/src/mame/drivers/zaccaria.c +++ b/src/mame/drivers/zaccaria.c @@ -215,7 +215,7 @@ static READ8_HANDLER( zaccaria_prot1_r ) return 0x40; /* Jack Rabbit */ case 6: - if (space->machine->gamedrv == &GAME_NAME(monymony)) + if (&space->machine->system() == &GAME_NAME(monymony)) return 0x70; /* Money Money */ return 0xa0; /* Jack Rabbit */ diff --git a/src/mame/drivers/zn.c b/src/mame/drivers/zn.c index 26c39a70a22..a93fe643d11 100644 --- a/src/mame/drivers/zn.c +++ b/src/mame/drivers/zn.c @@ -472,7 +472,7 @@ static void zn_driver_init( running_machine *machine ) n_game = 0; while( zn_config_table[ n_game ].s_name != NULL ) { - if( strcmp( machine->gamedrv->name, zn_config_table[ n_game ].s_name ) == 0 ) + if( strcmp( machine->system().name, zn_config_table[ n_game ].s_name ) == 0 ) { znsec_init( 0, zn_config_table[ n_game ].p_n_mainsec ); znsec_init( 1, zn_config_table[ n_game ].p_n_gamesec ); @@ -721,8 +721,8 @@ static DRIVER_INIT( coh1000c ) zn_driver_init(machine); - if( strcmp( machine->gamedrv->name, "glpracr" ) == 0 || - strcmp( machine->gamedrv->name, "glpracr2l" ) == 0 ) + if( strcmp( machine->system().name, "glpracr" ) == 0 || + strcmp( machine->system().name, "glpracr2l" ) == 0 ) { /* disable: the QSound CPU for glpracr as it doesn't have any roms & @@ -2156,7 +2156,7 @@ static DRIVER_INIT( coh1000a ) machine->device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fbfff00, 0x1fbfff03, FUNC(acpsx_00_w) ); machine->device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fbfff10, 0x1fbfff13, FUNC(acpsx_10_w) ); - if( strcmp( machine->gamedrv->name, "nbajamex" ) == 0 ) + if( strcmp( machine->system().name, "nbajamex" ) == 0 ) { state->nbajamex_eeprom_size = 0x8000; state->nbajamex_eeprom = auto_alloc_array( machine, UINT8, state->nbajamex_eeprom_size ); @@ -2168,8 +2168,8 @@ static DRIVER_INIT( coh1000a ) memory_set_bankptr( machine, "bank2", state->nbajamex_eeprom ); /* ram/eeprom/?? */ } - if( ( !strcmp( machine->gamedrv->name, "jdredd" ) ) || - ( !strcmp( machine->gamedrv->name, "jdreddb" ) ) ) + if( ( !strcmp( machine->system().name, "jdredd" ) ) || + ( !strcmp( machine->system().name, "jdreddb" ) ) ) { device_t *ide = machine->device("ide"); @@ -2185,8 +2185,8 @@ static MACHINE_RESET( coh1000a ) { memory_set_bankptr( machine, "bank1", machine->region( "user2" )->base() ); /* fixed game rom */ zn_machine_init(machine); - if( ( !strcmp( machine->gamedrv->name, "jdredd" ) ) || - ( !strcmp( machine->gamedrv->name, "jdreddb" ) ) ) + if( ( !strcmp( machine->system().name, "jdredd" ) ) || + ( !strcmp( machine->system().name, "jdreddb" ) ) ) { devtag_reset(machine, "ide"); } diff --git a/src/mame/includes/seta.h b/src/mame/includes/seta.h index 9d2fbdd8c5e..cd3164c8fad 100644 --- a/src/mame/includes/seta.h +++ b/src/mame/includes/seta.h @@ -57,8 +57,8 @@ public: uPD71054_state uPD71054; const game_offset *global_offsets; + bool coin_lockout_initialized; int coin_lockout; - const game_driver *driver; int sub_ctrl_data; diff --git a/src/mame/machine/atari.c b/src/mame/machine/atari.c index 9c473ae0e4e..7400f4f708a 100644 --- a/src/mame/machine/atari.c +++ b/src/mame/machine/atari.c @@ -104,12 +104,12 @@ void a600xl_mmu(running_machine *machine, UINT8 new_mmu) /* check if self-test ROM changed */ if ( new_mmu & 0x80 ) { - logerror("%s MMU SELFTEST RAM\n", machine->gamedrv->name); + logerror("%s MMU SELFTEST RAM\n", machine->system().name); machine->device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(0x5000, 0x57ff); } else { - logerror("%s MMU SELFTEST ROM\n", machine->gamedrv->name); + logerror("%s MMU SELFTEST ROM\n", machine->system().name); machine->device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5000, 0x57ff, "bank2"); machine->device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x5000, 0x57ff); memory_set_bankptr(machine, "bank2", machine->region("maincpu")->base() + 0x5000); diff --git a/src/mame/machine/cps2crpt.c b/src/mame/machine/cps2crpt.c index d033f74c9f7..abfed40517b 100644 --- a/src/mame/machine/cps2crpt.c +++ b/src/mame/machine/cps2crpt.c @@ -989,7 +989,7 @@ static const struct game_keys keys_table[] = DRIVER_INIT( cps2crpt ) { - const char *gamename = machine->gamedrv->name; + const char *gamename = machine->system().name; const struct game_keys *k = &keys_table[0]; while (k->name) diff --git a/src/mame/machine/decocass.c b/src/mame/machine/decocass.c index a8db980e1c2..4c80f42b347 100644 --- a/src/mame/machine/decocass.c +++ b/src/mame/machine/decocass.c @@ -2175,7 +2175,6 @@ static DEVICE_START( decocass_tape ) assert(device->baseconfig().static_config() == NULL); assert(downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config() == NULL); assert(device->machine != NULL); - assert(device->machine->config != NULL); /* fetch the data pointer */ tape->timer = device->machine->scheduler().timer_alloc(FUNC(tape_clock_callback), (void *)device); diff --git a/src/mame/machine/fddebug.c b/src/mame/machine/fddebug.c index ade9392fb86..88a0ff739c7 100644 --- a/src/mame/machine/fddebug.c +++ b/src/mame/machine/fddebug.c @@ -564,7 +564,7 @@ static void set_default_key_params(running_machine *machine) /* look for a matching game and set the key appropriately */ for (keynum = 0; keynum < ARRAY_LENGTH(default_keys); keynum++) - if (strcmp(machine->gamedrv->name, default_keys[keynum].gamename) == 0) + if (strcmp(machine->system().name, default_keys[keynum].gamename) == 0) { fd1094_global = default_keys[keynum].global; fd1094_seed = default_keys[keynum].seed; @@ -585,7 +585,7 @@ static void load_overlay_file(running_machine *machine) /* determine the filename and open the file */ emu_file file(OPEN_FLAG_READ); - file_error filerr = file.open(machine->gamedrv->name, ".kov"); + file_error filerr = file.open(machine->system().name, ".kov"); if (filerr == FILERR_NONE) { file.read(keystatus, keystatus_words * 2); @@ -611,7 +611,7 @@ static void save_overlay_file(running_machine *machine) /* determin the filename and open the file */ emu_file file(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE); - file_error filerr = file.open(machine->gamedrv->name, ".kov"); + file_error filerr = file.open(machine->system().name, ".kov"); if (filerr == FILERR_NONE) { /* convert to big-endian */ diff --git a/src/mame/machine/gdcrypt.c b/src/mame/machine/gdcrypt.c index 21aacff68df..5f5dfb69086 100644 --- a/src/mame/machine/gdcrypt.c +++ b/src/mame/machine/gdcrypt.c @@ -345,7 +345,7 @@ void naomi_game_decrypt(running_machine* machine, UINT64 key, UINT8* region, int { FILE *fp; char filename[256]; - sprintf(filename,"encrypted %s", machine->gamedrv->name); + sprintf(filename,"encrypted %s", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { @@ -370,7 +370,7 @@ void naomi_game_decrypt(running_machine* machine, UINT64 key, UINT8* region, int { FILE *fp; char filename[256]; - sprintf(filename,"decrypted %s", machine->gamedrv->name); + sprintf(filename,"decrypted %s", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { diff --git a/src/mame/machine/kaneko16.c b/src/mame/machine/kaneko16.c index a53fab0cb9c..8db76e273e5 100644 --- a/src/mame/machine/kaneko16.c +++ b/src/mame/machine/kaneko16.c @@ -125,7 +125,7 @@ WRITE16_HANDLER(galpanib_calc_w) WRITE16_HANDLER(bloodwar_calc_w) { - int isbrap = ( !strcmp(space->machine->gamedrv->name,"brapboysj") || !strcmp(space->machine->gamedrv->name,"brapboys")); + int isbrap = ( !strcmp(space->machine->system().name,"brapboysj") || !strcmp(space->machine->system().name,"brapboys")); /* our implementation is incomplete, b.rap boys requires some modifications */ if (isbrap) @@ -200,7 +200,7 @@ READ16_HANDLER(bloodwar_calc_r) INT16 x_coll, y_coll; /* our implementation is incomplete, b.rap boys requires some modifications */ - int isbrap = ( !strcmp(space->machine->gamedrv->name,"brapboysj") || !strcmp(space->machine->gamedrv->name,"brapboys")); + int isbrap = ( !strcmp(space->machine->system().name,"brapboysj") || !strcmp(space->machine->system().name,"brapboys")); if (isbrap) { @@ -2057,13 +2057,13 @@ DRIVER_INIT(calc3_scantables) if (calc3_blocksize_offset==3) { sprintf(filename,"data_%s_table_%04x k%02x m%02x u%02x length %04x", - machine->gamedrv->name, + machine->system().name, x, calc3_decryption_key_byte, calc3_mode, calc3_alternateswaps, length); } else { sprintf(filename,"data_%s_table_%04x k%02x (use indirect size %02x) m%02x u%02x length %04x", - machine->gamedrv->name, + machine->system().name, x, calc3_decryption_key_byte, calc3_blocksize_offset-3, calc3_mode, calc3_alternateswaps, length); } @@ -2089,7 +2089,7 @@ DRIVER_INIT(calc3_scantables) char filename[256]; sprintf(filename,"data_%s_finalblock", - machine->gamedrv->name); + machine->system().name); fp=fopen(filename, "w+b"); if (fp) @@ -2349,7 +2349,7 @@ DRIVER_INIT( decrypt_toybox_rom ) { FILE *fp; char filename[256]; - sprintf(filename,"%s.mcudata", machine->gamedrv->name); + sprintf(filename,"%s.mcudata", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { diff --git a/src/mame/machine/midwayic.c b/src/mame/machine/midwayic.c index e5cff13b359..748df91066d 100644 --- a/src/mame/machine/midwayic.c +++ b/src/mame/machine/midwayic.c @@ -109,7 +109,7 @@ static struct ioasic_state ioasic; static void generate_serial_data(running_machine *machine, int upper) { - int year = atoi(machine->gamedrv->year), month = 12, day = 11; + int year = atoi(machine->system().year), month = 12, day = 11; UINT32 serial_number, temp; UINT8 serial_digit[9]; diff --git a/src/mame/machine/namco51.c b/src/mame/machine/namco51.c index f96a6bf32c2..bed2e66f05e 100644 --- a/src/mame/machine/namco51.c +++ b/src/mame/machine/namco51.c @@ -128,9 +128,9 @@ WRITE8_DEVICE_HANDLER( namco_51xx_write ) static int namcoio_51XX_kludge = 0; /* Only compute namcoio_51XX_kludge when gamedrv changes */ - if (namcoio_51XX_driver != device->machine->gamedrv) + if (namcoio_51XX_driver != &device->machine->system()) { - namcoio_51XX_driver = device->machine->gamedrv; + namcoio_51XX_driver = &device->machine->system(); if (strcmp(namcoio_51XX_driver->name, "xevious") == 0 || strcmp(namcoio_51XX_driver->parent, "xevious") == 0) namcoio_51XX_kludge = 1; diff --git a/src/mame/machine/naomi.c b/src/mame/machine/naomi.c index 8ac5bfc3cba..740374253b1 100644 --- a/src/mame/machine/naomi.c +++ b/src/mame/machine/naomi.c @@ -149,7 +149,7 @@ static void create_pic_from_retdat(running_machine* machine) { FILE *fp; char filename[256]; - sprintf(filename,"picbin_%s", machine->gamedrv->name); + sprintf(filename,"picbin_%s", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { diff --git a/src/mame/machine/naomibd.c b/src/mame/machine/naomibd.c index fef6a438f9c..45baf3326eb 100644 --- a/src/mame/machine/naomibd.c +++ b/src/mame/machine/naomibd.c @@ -2015,7 +2015,6 @@ static DEVICE_START( naomibd ) assert(device->baseconfig().static_config() == NULL); assert(downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config() != NULL); assert(device->machine != NULL); - assert(device->machine->config != NULL); /* validate configuration */ assert(config->type >= ROM_BOARD && config->type < MAX_NAOMIBD_TYPES); @@ -2027,7 +2026,7 @@ static DEVICE_START( naomibd ) for (i=0; i<ARRAY_LENGTH(naomibd_translate_tbl); i++) { - if (!strcmp(device->machine->gamedrv->name, naomibd_translate_tbl[i].name)) + if (!strcmp(device->machine->system().name, naomibd_translate_tbl[i].name)) { v->dc_gamekey = naomibd_translate_tbl[i].m2m3_key; v->dc_dmakey = naomibd_translate_tbl[i].m1_key; diff --git a/src/mame/machine/neocrypt.c b/src/mame/machine/neocrypt.c index f8ade05116b..f51add63cb0 100644 --- a/src/mame/machine/neocrypt.c +++ b/src/mame/machine/neocrypt.c @@ -912,7 +912,7 @@ void neogeo_cmc50_m1_decrypt(running_machine *machine) #if 0 { FILE *fp; - const char *gamename = machine->gamedrv->name; + const char *gamename = machine->system().name; char filename[256]; sprintf(filename, "%s_m1.dump", gamename); @@ -929,7 +929,7 @@ void neogeo_cmc50_m1_decrypt(running_machine *machine) #if 0 { FILE *fp; - const char *gamename = machine->gamedrv->name; + const char *gamename = machine->system().name; char filename[256]; sprintf(filename, "%s_m1extra.dump", gamename); diff --git a/src/mame/machine/seicop.c b/src/mame/machine/seicop.c index 484b8fafaf3..ad48da6a477 100644 --- a/src/mame/machine/seicop.c +++ b/src/mame/machine/seicop.c @@ -1450,7 +1450,7 @@ static void copd2_set_tableoffset(running_machine *machine, UINT16 data) { FILE *fp; char filename[256]; - sprintf(filename,"copdat_%s.table2", machine->gamedrv->name); + sprintf(filename,"copdat_%s.table2", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { @@ -1461,7 +1461,7 @@ static void copd2_set_tableoffset(running_machine *machine, UINT16 data) { FILE *fp; char filename[256]; - sprintf(filename,"copdat_%s.table3", machine->gamedrv->name); + sprintf(filename,"copdat_%s.table3", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { @@ -1472,7 +1472,7 @@ static void copd2_set_tableoffset(running_machine *machine, UINT16 data) { FILE *fp; char filename[256]; - sprintf(filename,"copdat_%s.table4", machine->gamedrv->name); + sprintf(filename,"copdat_%s.table4", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { @@ -1513,7 +1513,7 @@ static void copd2_set_tabledata(running_machine *machine, UINT16 data) { FILE *fp; char filename[256]; - sprintf(filename,"copdat_%s.data", machine->gamedrv->name); + sprintf(filename,"copdat_%s.data", machine->system().name); fp=fopen(filename, "w+b"); if (fp) { diff --git a/src/mame/video/cave.c b/src/mame/video/cave.c index 6f649863641..19512eccb2d 100644 --- a/src/mame/video/cave.c +++ b/src/mame/video/cave.c @@ -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->m_gfxdecodeinfo[0].color_codes_start + - (machine->config->m_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/cps1.c b/src/mame/video/cps1.c index 9c98c39b960..3d638ee7b59 100644 --- a/src/mame/video/cps1.c +++ b/src/mame/video/cps1.c @@ -1469,7 +1469,7 @@ static void cps1_build_palette(running_machine *machine, const UINT16* const pal static MACHINE_RESET( cps ) { cps_state *state = machine->driver_data<cps_state>(); - const char *gamename = machine->gamedrv->name; + const char *gamename = machine->system().name; const struct CPS1config *pCFG = &cps1_config_table[0]; while (pCFG->name) diff --git a/src/mame/video/dbz.c b/src/mame/video/dbz.c index 135605d305d..50651935bb0 100644 --- a/src/mame/video/dbz.c +++ b/src/mame/video/dbz.c @@ -86,7 +86,7 @@ VIDEO_START( dbz ) tilemap_set_transparent_pen(state->bg1_tilemap, 0); tilemap_set_transparent_pen(state->bg2_tilemap, 0); - if (!strcmp(machine->gamedrv->name, "dbz")) + if (!strcmp(machine->system().name, "dbz")) k056832_set_layer_offs(state->k056832, 0, -34, -16); else k056832_set_layer_offs(state->k056832, 0, -35, -16); diff --git a/src/mame/video/decbac06.c b/src/mame/video/decbac06.c index 7ccffccad22..7eb29bb9ff3 100644 --- a/src/mame/video/decbac06.c +++ b/src/mame/video/decbac06.c @@ -332,7 +332,7 @@ WRITE16_DEVICE_HANDLER( deco_bac06_pf_control_0_w ) { // I don't know WHY Stadium Hero uses this as a bank but the RAM test expects it.. // I'm curious as to if anything else sets it tho - if (strcmp(dev->machine->gamedrv->name,"stadhero")) + if (strcmp(dev->machine->system().name,"stadhero")) printf("tilemap ram bank change to %d\n", newbank&1); dev->m_rambank = newbank&1; diff --git a/src/mame/video/konamigx.c b/src/mame/video/konamigx.c index 2b8a3a143d0..e126ee126fc 100644 --- a/src/mame/video/konamigx.c +++ b/src/mame/video/konamigx.c @@ -2060,7 +2060,7 @@ static void _gxcommoninit(running_machine *machine) VIDEO_START(konamigx_5bpp) { - if (!strcmp(machine->gamedrv->name,"sexyparo") || !strcmp(machine->gamedrv->name,"sexyparoa")) + if (!strcmp(machine->system().name,"sexyparo") || !strcmp(machine->system().name,"sexyparoa")) game_tile_callback = konamigx_alpha_tile_callback; else game_tile_callback = konamigx_type2_tile_callback; @@ -2072,29 +2072,29 @@ VIDEO_START(konamigx_5bpp) /* here are some hand tuned per game scroll offsets to go with the per game visible areas, i see no better way of doing this for now... */ - if (!strcmp(machine->gamedrv->name,"tbyahhoo")) + if (!strcmp(machine->system().name,"tbyahhoo")) { K056832_set_UpdateMode(1); gx_tilemode = 1; } else - if (!strcmp(machine->gamedrv->name,"puzldama")) + if (!strcmp(machine->system().name,"puzldama")) { K053247GP_set_SpriteOffset(-46, -23); konamigx_mixer_primode(5); } else - if (!strcmp(machine->gamedrv->name,"daiskiss")) + if (!strcmp(machine->system().name,"daiskiss")) { konamigx_mixer_primode(4); } else - if (!strcmp(machine->gamedrv->name,"gokuparo") || !strcmp(machine->gamedrv->name,"fantjour") || !strcmp(machine->gamedrv->name,"fantjoura")) + if (!strcmp(machine->system().name,"gokuparo") || !strcmp(machine->system().name,"fantjour") || !strcmp(machine->system().name,"fantjoura")) { K053247GP_set_SpriteOffset(-46, -23); } else - if (!strcmp(machine->gamedrv->name,"sexyparo") || !strcmp(machine->gamedrv->name,"sexyparoa")) + if (!strcmp(machine->system().name,"sexyparo") || !strcmp(machine->system().name,"sexyparoa")) { K053247GP_set_SpriteOffset(-42, -23); } @@ -2140,7 +2140,7 @@ VIDEO_START(konamigx_6bpp) _gxcommoninit(machine); - if (!strcmp(machine->gamedrv->name,"tokkae") || !strcmp(machine->gamedrv->name,"tkmmpzdm")) + if (!strcmp(machine->system().name,"tokkae") || !strcmp(machine->system().name,"tkmmpzdm")) { K053247GP_set_SpriteOffset(-46, -23); konamigx_mixer_primode(5); @@ -2285,7 +2285,7 @@ VIDEO_START(konamigx_6bpp_2) { K056832_vh_start(machine, "gfx1", K056832_BPP_6, 1, NULL, konamigx_type2_tile_callback, 0); - if (!strcmp(machine->gamedrv->name,"salmndr2") || !strcmp(machine->gamedrv->name,"salmndr2a")) + if (!strcmp(machine->system().name,"salmndr2") || !strcmp(machine->system().name,"salmndr2a")) { K055673_vh_start(machine, "gfx2", K055673_LAYOUT_GX6, -48, -23, konamigx_salmndr2_sprite_callback); diff --git a/src/mame/video/konamiic.c b/src/mame/video/konamiic.c index cee760bef43..d745485e582 100644 --- a/src/mame/video/konamiic.c +++ b/src/mame/video/konamiic.c @@ -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->m_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->m_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->m_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->m_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->m_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->m_video_attributes & VIDEO_HAS_SHADOWS) + if (machine->config().m_video_attributes & VIDEO_HAS_SHADOWS) { - if (bitmap->bpp == 32 && (machine->config->m_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 diff --git a/src/mame/video/konicdev.c b/src/mame/video/konicdev.c index 3d1addd9ece..982221cb0d2 100644 --- a/src/mame/video/konicdev.c +++ b/src/mame/video/konicdev.c @@ -3266,7 +3266,7 @@ static DEVICE_START( k051960 ) fatalerror("Unknown plane_order"); } - if (VERBOSE && !(machine->config->m_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->m_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( device_t *device, bitmap_t *bitmap, const rectangle * VIDEO_HAS_SHADOWS | VIDEO_HAS_HIGHLIGHTS */ - if (machine->config->m_video_attributes & VIDEO_HAS_SHADOWS) + if (machine->config().m_video_attributes & VIDEO_HAS_SHADOWS) { - if (bitmap->bpp == 32 && (machine->config->m_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->m_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->m_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->m_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; diff --git a/src/mame/video/lethal.c b/src/mame/video/lethal.c index c0ce3a545bc..6ea183701b5 100644 --- a/src/mame/video/lethal.c +++ b/src/mame/video/lethal.c @@ -55,7 +55,7 @@ VIDEO_START(lethalen) k056832_SetExtLinescroll(state->k056832); // the US and Japanese cabinets apparently use different mirror setups - if (!strcmp(machine->gamedrv->name, "lethalenj")) + if (!strcmp(machine->system().name, "lethalenj")) { k056832_set_layer_offs(state->k056832, 0, -196, 0); k056832_set_layer_offs(state->k056832, 1, -194, 0); diff --git a/src/mame/video/megasys1.c b/src/mame/video/megasys1.c index 8ea09e2ff42..2daefad27ac 100644 --- a/src/mame/video/megasys1.c +++ b/src/mame/video/megasys1.c @@ -267,14 +267,14 @@ VIDEO_START( megasys1 ) state->_8x8_scroll_factor[1] = 1; state->_16x16_scroll_factor[1] = 4; state->_8x8_scroll_factor[2] = 1; state->_16x16_scroll_factor[2] = 4; - if (strcmp(machine->gamedrv->name, "soldamj") == 0) + if (strcmp(machine->system().name, "soldamj") == 0) { state->_8x8_scroll_factor[1] = 4; state->_16x16_scroll_factor[1] = 4; } state->hardware_type_z = 0; - if (strcmp(machine->gamedrv->name, "lomakai") == 0 || - strcmp(machine->gamedrv->name, "makaiden") == 0) + if (strcmp(machine->system().name, "lomakai") == 0 || + strcmp(machine->system().name, "makaiden") == 0) state->hardware_type_z = 1; } @@ -766,8 +766,8 @@ PALETTE_INIT( megasys1 ) i = 0; while ( priorities[i].driver && - strcmp(priorities[i].driver, machine->gamedrv->name) != 0 && - strcmp(priorities[i].driver, machine->gamedrv->parent) != 0) + strcmp(priorities[i].driver, machine->system().name) != 0 && + strcmp(priorities[i].driver, machine->system().parent) != 0) i++; if (priorities[i].driver) diff --git a/src/mame/video/moo.c b/src/mame/video/moo.c index 4646f37c081..3de9be73d82 100644 --- a/src/mame/video/moo.c +++ b/src/mame/video/moo.c @@ -43,7 +43,7 @@ VIDEO_START(moo) state->alpha_enabled = 0; - if (!strcmp(machine->gamedrv->name, "bucky") || !strcmp(machine->gamedrv->name, "buckyua") || !strcmp(machine->gamedrv->name, "buckyaa")) + if (!strcmp(machine->system().name, "bucky") || !strcmp(machine->system().name, "buckyua") || !strcmp(machine->system().name, "buckyaa")) { // Bucky doesn't chain tilemaps k056832_set_layer_association(state->k056832, 0); diff --git a/src/mame/video/ms32.c b/src/mame/video/ms32.c index f3c6684fe6f..5408f8b4a19 100644 --- a/src/mame/video/ms32.c +++ b/src/mame/video/ms32.c @@ -103,13 +103,13 @@ VIDEO_START( ms32 ) state->reverse_sprite_order = 1; /* i hate per game patches...how should priority really work? tetrisp2.c ? i can't follow it */ - if (!strcmp(machine->gamedrv->name,"kirarast")) state->reverse_sprite_order = 0; - if (!strcmp(machine->gamedrv->name,"tp2m32")) state->reverse_sprite_order = 0; - if (!strcmp(machine->gamedrv->name,"47pie2")) state->reverse_sprite_order = 0; - if (!strcmp(machine->gamedrv->name,"47pie2o")) state->reverse_sprite_order = 0; - if (!strcmp(machine->gamedrv->name,"hayaosi3")) state->reverse_sprite_order = 0; - if (!strcmp(machine->gamedrv->name,"bnstars")) state->reverse_sprite_order = 0; - if (!strcmp(machine->gamedrv->name,"wpksocv2")) state->reverse_sprite_order = 0; + if (!strcmp(machine->system().name,"kirarast")) state->reverse_sprite_order = 0; + if (!strcmp(machine->system().name,"tp2m32")) state->reverse_sprite_order = 0; + if (!strcmp(machine->system().name,"47pie2")) state->reverse_sprite_order = 0; + if (!strcmp(machine->system().name,"47pie2o")) state->reverse_sprite_order = 0; + if (!strcmp(machine->system().name,"hayaosi3")) state->reverse_sprite_order = 0; + if (!strcmp(machine->system().name,"bnstars")) state->reverse_sprite_order = 0; + if (!strcmp(machine->system().name,"wpksocv2")) state->reverse_sprite_order = 0; // tp2m32 doesn't set the brightness registers so we need sensible defaults state->brt[0] = state->brt[1] = 0xffff; diff --git a/src/mame/video/psx.c b/src/mame/video/psx.c index 1e4464bef4b..fc6adb08313 100644 --- a/src/mame/video/psx.c +++ b/src/mame/video/psx.c @@ -637,7 +637,7 @@ static void psx_gpu_init( running_machine *machine, int n_gputype ) p_psxgpu->machine = machine; p_psxgpu->n_gputype = n_gputype; - p_psxgpu->b_need_sianniv_vblank_hack = !strcmp(machine->gamedrv->name, "sianniv"); + p_psxgpu->b_need_sianniv_vblank_hack = !strcmp(machine->system().name, "sianniv"); #if defined( MAME_DEBUG ) DebugMeshInit(p_psxgpu); diff --git a/src/mame/video/seta.c b/src/mame/video/seta.c index 1ea4ae8d19f..37dbf7d53d8 100644 --- a/src/mame/video/seta.c +++ b/src/mame/video/seta.c @@ -218,16 +218,16 @@ void seta_coin_lockout_w(running_machine *machine, int data) static const char *const seta_nolockout[8] = { "blandia", "gundhara", "kamenrid", "zingzip", "eightfrc", "extdwnhl", "sokonuke", "zombraid"}; /* Only compute seta_coin_lockout when confronted with a new gamedrv */ - if (state->driver != machine->gamedrv) + if (!state->coin_lockout_initialized) { + state->coin_lockout_initialized = true; int i; - state->driver = machine->gamedrv; state->coin_lockout = 1; for (i=0; i<ARRAY_LENGTH(seta_nolockout); i++) { - if (strcmp(state->driver->name, seta_nolockout[i]) == 0 || - strcmp(state->driver->parent, seta_nolockout[i]) == 0) + if (strcmp(machine->system().name, seta_nolockout[i]) == 0 || + strcmp(machine->system().parent, seta_nolockout[i]) == 0) { state->coin_lockout = 0; break; @@ -532,7 +532,7 @@ VIDEO_START( seta_no_layers ) state->tilemaps_flip = 0; state->global_offsets = game_offsets; - while (state->global_offsets->gamename && strcmp(machine->gamedrv->name, state->global_offsets->gamename)) + while (state->global_offsets->gamename && strcmp(machine->system().name, state->global_offsets->gamename)) state->global_offsets++; state->samples_bank = -1; // set the samples bank to an out of range value at start-up } @@ -768,7 +768,7 @@ static void draw_sprites_map(running_machine *machine, bitmap_t *bitmap, const r int offs, col; int xoffs, yoffs; - int total_color_codes = machine->config->m_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 ]; @@ -873,7 +873,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta int offs; int xoffs, yoffs; - int total_color_codes = machine->config->m_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/snk.c b/src/mame/video/snk.c index dacd05eaf73..428e02466e0 100644 --- a/src/mame/video/snk.c +++ b/src/mame/video/snk.c @@ -194,12 +194,12 @@ static VIDEO_START( snk_3bpp_shadow ) snk_state *state = machine->driver_data<snk_state>(); int i; - if(!(machine->config->m_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++) state->drawmode_table[i] = DRAWMODE_SOURCE; - state->drawmode_table[6] = (machine->config->m_video_attributes & VIDEO_HAS_SHADOWS) ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; + state->drawmode_table[6] = (machine->config().m_video_attributes & VIDEO_HAS_SHADOWS) ? DRAWMODE_SHADOW : DRAWMODE_SOURCE; state->drawmode_table[7] = DRAWMODE_NONE; for (i = 0x000;i < 0x400;i++) @@ -211,7 +211,7 @@ static VIDEO_START( snk_4bpp_shadow ) snk_state *state = machine->driver_data<snk_state>(); int i; - if(!(machine->config->m_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 ea351741258..5cac14acc13 100644 --- a/src/mame/video/snk6502.c +++ b/src/mame/video/snk6502.c @@ -11,7 +11,7 @@ #define TOTAL_COLORS(m,gfxn) ((m)->gfx[gfxn]->total_colors * (m)->gfx[gfxn]->color_granularity) -#define COLOR(m,gfxn,offs) ((m)->config->m_gfxdecodeinfo[gfxn].color_codes_start + offs) +#define COLOR(m,gfxn,offs) ((m)->config().m_gfxdecodeinfo[gfxn].color_codes_start + offs) diff --git a/src/mame/video/srmp2.c b/src/mame/video/srmp2.c index 6e3004be5b4..c65702d02cf 100644 --- a/src/mame/video/srmp2.c +++ b/src/mame/video/srmp2.c @@ -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->m_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/stvvdp1.c b/src/mame/video/stvvdp1.c index b0fc18c1441..6ac28dc1c79 100644 --- a/src/mame/video/stvvdp1.c +++ b/src/mame/video/stvvdp1.c @@ -299,7 +299,7 @@ WRITE32_HANDLER( stv_vdp1_regs_w ) } /* needed by pblbeach, it doesn't clear local coordinates in its sprite list...*/ - //if ( !strcmp(space->machine->gamedrv->name, "pblbeach") ) + //if ( !strcmp(space->machine->system().name, "pblbeach") ) //{ // stvvdp1_local_x = stvvdp1_local_y = 0; //} diff --git a/src/mame/video/ygv608.c b/src/mame/video/ygv608.c index 4994b83732b..d65b709ca2c 100644 --- a/src/mame/video/ygv608.c +++ b/src/mame/video/ygv608.c @@ -113,7 +113,7 @@ static TILEMAP_MAPPER( get_tile_offset ) } #define layout_total(x) \ -(machine->config->m_gfxdecodeinfo[x].gfxlayout->total) +(machine->config().m_gfxdecodeinfo[x].gfxlayout->total) static TILE_GET_INFO( get_tile_info_A_8 ) { diff --git a/src/osd/sdl/debugwin.c b/src/osd/sdl/debugwin.c index 218fe9e07ab..fc21b71de2d 100644 --- a/src/osd/sdl/debugwin.c +++ b/src/osd/sdl/debugwin.c @@ -471,7 +471,7 @@ static void debugmain_set_cpu(device_t *device) dv->view->set_source(*dv->view->source_list().match_device(device)); // then update the caption - title.printf("Debug: %s - %s '%s'", device->machine->gamedrv->name, device->name(), device->tag()); + title.printf("Debug: %s - %s '%s'", device->machine->system().name, device->name(), device->tag()); gtk_window_set_title(GTK_WINDOW(dmain->win), title); disasmview_update_checks(dmain); } diff --git a/src/osd/sdl/drawogl.c b/src/osd/sdl/drawogl.c index ecadb7b58b5..c2a697e2893 100644 --- a/src/osd/sdl/drawogl.c +++ b/src/osd/sdl/drawogl.c @@ -1206,7 +1206,7 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update) // figure out if we're vector scrnum = is_vector = 0; - for (screen = window->machine->config->first_screen(); screen != NULL; screen = screen->next_screen()) + for (screen = window->machine->config().first_screen(); screen != NULL; screen = screen->next_screen()) { if (scrnum == window->index) { diff --git a/src/osd/sdl/output.c b/src/osd/sdl/output.c index 0a898b447f4..02572965a96 100644 --- a/src/osd/sdl/output.c +++ b/src/osd/sdl/output.c @@ -89,7 +89,7 @@ void sdloutput_init(running_machine *machine) output = fdopen(fildes, "w"); mame_printf_verbose("ouput: opened output notifier file %s\n", SDLMAME_OUTPUT); - fprintf(output, "MAME " PID_FMT " START %s\n", osd_getpid(), machine->gamedrv->name); + fprintf(output, "MAME " PID_FMT " START %s\n", osd_getpid(), machine->system().name); fflush(output); } diff --git a/src/osd/sdl/sound.c b/src/osd/sdl/sound.c index 90d740d40ea..20baefbf7d9 100644 --- a/src/osd/sdl/sound.c +++ b/src/osd/sdl/sound.c @@ -87,7 +87,7 @@ void sdlaudio_init(running_machine *machine) sound_log = fopen(SDLMAME_SOUND_LOG, "w"); // skip if sound disabled - if (machine->sample_rate != 0) + if (machine->sample_rate() != 0) { // attempt to initialize SDL if (sdl_init(machine)) @@ -446,7 +446,7 @@ static int sdl_init(running_machine *machine) stream_loop = 0; // set up the audio specs - aspec.freq = machine->sample_rate; + aspec.freq = machine->sample_rate(); aspec.format = AUDIO_S16SYS; // keep endian independent aspec.channels = n_channels; aspec.samples = sdl_xfer_samples; @@ -477,7 +477,7 @@ static int sdl_init(running_machine *machine) } // compute the buffer sizes - stream_buffer_size = machine->sample_rate * 2 * sizeof(INT16) * audio_latency / MAX_AUDIO_LATENCY; + stream_buffer_size = machine->sample_rate() * 2 * sizeof(INT16) * audio_latency / MAX_AUDIO_LATENCY; stream_buffer_size = (stream_buffer_size / 1024) * 1024; if (stream_buffer_size < 1024) stream_buffer_size = 1024; diff --git a/src/osd/sdl/window.c b/src/osd/sdl/window.c index 63aff122574..51797564833 100644 --- a/src/osd/sdl/window.c +++ b/src/osd/sdl/window.c @@ -702,9 +702,9 @@ int sdlwindow_video_window_create(running_machine *machine, int index, sdl_monit // make the window title if (video_config.numscreens == 1) - sprintf(window->title, APPNAME ": %s [%s]", machine->gamedrv->description, machine->gamedrv->name); + sprintf(window->title, APPNAME ": %s [%s]", machine->system().description, machine->system().name); else - sprintf(window->title, APPNAME ": %s [%s] - Screen %d", machine->gamedrv->description, machine->gamedrv->name, index); + sprintf(window->title, APPNAME ": %s [%s] - Screen %d", machine->system().description, machine->system().name, index); wp->window = window; diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c index 7f99ac03033..4fcb3a367d3 100644 --- a/src/osd/windows/debugwin.c +++ b/src/osd/windows/debugwin.c @@ -1644,7 +1644,7 @@ static void generic_create_window(running_machine *machine, debug_view_type type char title[256]; // create the window - _snprintf(title, ARRAY_LENGTH(title), "Debug: %s [%s]", machine->gamedrv->description, machine->gamedrv->name); + _snprintf(title, ARRAY_LENGTH(title), "Debug: %s [%s]", machine->system().description, machine->system().name); info = debugwin_window_create(machine, title, NULL); if (info == NULL || !debugwin_view_create(info, 0, type)) return; @@ -1704,7 +1704,7 @@ static void log_create_window(running_machine *machine) RECT bounds; // create the window - _snprintf(title, ARRAY_LENGTH(title), "Errorlog: %s [%s]", machine->gamedrv->description, machine->gamedrv->name); + _snprintf(title, ARRAY_LENGTH(title), "Errorlog: %s [%s]", machine->system().description, machine->system().name); info = debugwin_window_create(machine, title, NULL); if (info == NULL || !debugwin_view_create(info, 0, DVT_LOG)) return; @@ -2588,7 +2588,7 @@ static void console_set_cpu(device_t *device) char curtitle[256]; astring title; - title.printf("Debug: %s - %s '%s'", device->machine->gamedrv->name, device->name(), device->tag()); + title.printf("Debug: %s - %s '%s'", device->machine->system().name, device->name(), device->tag()); win_get_window_text_utf8(main_console->wnd, curtitle, ARRAY_LENGTH(curtitle)); if (title.cmp(curtitle) != 0) win_set_window_text_utf8(main_console->wnd, title); diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c index 08fc6a645e8..e9f4beb548c 100644 --- a/src/osd/windows/drawd3d.c +++ b/src/osd/windows/drawd3d.c @@ -1285,7 +1285,7 @@ static void pick_best_mode(win_window_info *window) int modenum; // determine the refresh rate of the primary screen - const screen_device_config *primary_screen = window->machine->config->first_screen(); + const screen_device_config *primary_screen = window->machine->config().first_screen(); if (primary_screen != NULL) target_refresh = ATTOSECONDS_TO_HZ(primary_screen->refresh()); diff --git a/src/osd/windows/drawdd.c b/src/osd/windows/drawdd.c index 595f0b6716e..d44f6846034 100644 --- a/src/osd/windows/drawdd.c +++ b/src/osd/windows/drawdd.c @@ -1328,7 +1328,7 @@ static void pick_best_mode(win_window_info *window) // determine the refresh rate of the primary screen einfo.target_refresh = 60.0; - const screen_device_config *primary_screen = window->machine->config->first_screen(); + const screen_device_config *primary_screen = window->machine->config().first_screen(); if (primary_screen != NULL) einfo.target_refresh = ATTOSECONDS_TO_HZ(primary_screen->refresh()); printf("Target refresh = %f\n", einfo.target_refresh); diff --git a/src/osd/windows/output.c b/src/osd/windows/output.c index fe5ee23ca5e..d81643e610e 100644 --- a/src/osd/windows/output.c +++ b/src/osd/windows/output.c @@ -309,7 +309,7 @@ static LRESULT send_id_string(running_machine *machine, HWND hwnd, LPARAM id) // id 0 is the name of the game if (id == 0) - name = machine->gamedrv->name; + name = machine->system().name; else name = output_id_to_name(id); diff --git a/src/osd/windows/sound.c b/src/osd/windows/sound.c index c103062e7b3..12f5f873bbc 100644 --- a/src/osd/windows/sound.c +++ b/src/osd/windows/sound.c @@ -300,7 +300,7 @@ static HRESULT dsound_init(running_machine *machine) stream_format.wBitsPerSample = 16; stream_format.wFormatTag = WAVE_FORMAT_PCM; stream_format.nChannels = 2; - stream_format.nSamplesPerSec = machine->sample_rate; + stream_format.nSamplesPerSec = machine->sample_rate(); stream_format.nBlockAlign = stream_format.wBitsPerSample * stream_format.nChannels / 8; stream_format.nAvgBytesPerSec = stream_format.nSamplesPerSec * stream_format.nBlockAlign; diff --git a/src/osd/windows/window.c b/src/osd/windows/window.c index 998dcb6e751..10130476245 100644 --- a/src/osd/windows/window.c +++ b/src/osd/windows/window.c @@ -644,9 +644,9 @@ void winwindow_video_window_create(running_machine *machine, int index, win_moni // make the window title if (video_config.numscreens == 1) - sprintf(window->title, APPNAME ": %s [%s]", machine->gamedrv->description, machine->gamedrv->name); + sprintf(window->title, APPNAME ": %s [%s]", machine->system().description, machine->system().name); else - sprintf(window->title, APPNAME ": %s [%s] - Screen %d", machine->gamedrv->description, machine->gamedrv->name, index); + sprintf(window->title, APPNAME ": %s [%s] - Screen %d", machine->system().description, machine->system().name, index); // set the initial maximized state window->startmaximized = options.maximize(); |