diff options
author | 2011-03-29 15:50:04 +0000 | |
---|---|---|
committer | 2011-03-29 15:50:04 +0000 | |
commit | 2ad50720237fdd19cf5ab45b8cb6bb21119c00b8 (patch) | |
tree | db21eee69668a06abc3f310ebbd51f5dbadf2de7 /src/emu | |
parent | b72cf3c5702b749c7bf26383ff05a9ab55022d31 (diff) |
BIG update.
Remove redundant machine items from address_space and device_t.
Neither machine nor m_machine are directly accessible anymore.
Instead a new getter machine() is available which returns a
machine reference. So:
space->machine->xxx ==> space->machine().xxx
device->machine->yyy ==> device->machine().yyy
Globally changed all running_machine pointers to running_machine
references. Any function/method that takes a running_machine takes
it as a required parameter (1 or 2 exceptions). Being consistent
here gets rid of a lot of odd &machine or *machine, but it does
mean a very large bulk change across the project.
Structs which have a running_machine * now have that variable
renamed to m_machine, and now have a shiny new machine() method
that works like the space and device methods above. Since most of
these are things that should eventually be devices anyway, consider
this a step in that direction.
98% of the update was done with regex searches. The changes are
architected such that the compiler will catch the remaining
errors:
// find things that use an embedded machine directly and replace
// with a machine() getter call
S: ->machine->
R: ->machine\(\)\.
// do the same if via a reference
S: \.machine->
R: \.machine\(\)\.
// convert function parameters to running_machine &
S: running_machine \*machine([^;])
R: running_machine \&machine\1
// replace machine-> with machine.
S: machine->
R: machine\.
// replace &machine() with machine()
S: \&([()->a-z0-9_]+machine\(\))
R: \1
// sanity check: look for this used as a cast
(running_machine &)
// and change to this:
*(running_machine *)
Diffstat (limited to 'src/emu')
391 files changed, 3903 insertions, 3892 deletions
diff --git a/src/emu/audio/generic.c b/src/emu/audio/generic.c index fc2919d9e54..a40474d9da2 100644 --- a/src/emu/audio/generic.c +++ b/src/emu/audio/generic.c @@ -35,11 +35,11 @@ struct _generic_audio_private register for save states -------------------------------------------------*/ -int generic_sound_init(running_machine *machine) +int generic_sound_init(running_machine &machine) { generic_audio_private *state; - state = machine->generic_audio_data = auto_alloc_clear(machine, generic_audio_private); + state = machine.generic_audio_data = auto_alloc_clear(machine, generic_audio_private); /* register globals with the save state system */ state_save_register_global_array(machine, state->latched_value); @@ -67,7 +67,7 @@ int generic_sound_init(running_machine *machine) static TIMER_CALLBACK( latch_callback ) { - generic_audio_private *state = machine->generic_audio_data; + generic_audio_private *state = machine.generic_audio_data; UINT16 value = param >> 8; int which = param & 0xff; @@ -87,7 +87,7 @@ static TIMER_CALLBACK( latch_callback ) INLINE void latch_w(address_space *space, int which, UINT16 value) { - space->machine->scheduler().synchronize(FUNC(latch_callback), which | (value << 8)); + space->machine().scheduler().synchronize(FUNC(latch_callback), which | (value << 8)); } @@ -97,7 +97,7 @@ INLINE void latch_w(address_space *space, int which, UINT16 value) INLINE UINT16 latch_r(address_space *space, int which) { - generic_audio_private *state = space->machine->generic_audio_data; + generic_audio_private *state = space->machine().generic_audio_data; state->latch_read[which] = 1; return state->latched_value[which]; } @@ -109,7 +109,7 @@ INLINE UINT16 latch_r(address_space *space, int which) INLINE void latch_clear(address_space *space, int which) { - generic_audio_private *state = space->machine->generic_audio_data; + generic_audio_private *state = space->machine().generic_audio_data; state->latched_value[which] = state->latch_clear_value; } @@ -160,9 +160,9 @@ WRITE8_HANDLER( soundlatch4_clear_w ) { latch_clear(space, 3); } value for all sound latches -------------------------------------------------*/ -void soundlatch_setclearedvalue(running_machine *machine, int value) +void soundlatch_setclearedvalue(running_machine &machine, int value) { - generic_audio_private *state = machine->generic_audio_data; - assert_always(machine->phase() == MACHINE_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!"); + generic_audio_private *state = machine.generic_audio_data; + assert_always(machine.phase() == MACHINE_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!"); state->latch_clear_value = value; } diff --git a/src/emu/audio/generic.h b/src/emu/audio/generic.h index 319eb2d450f..d693e723d40 100644 --- a/src/emu/audio/generic.h +++ b/src/emu/audio/generic.h @@ -22,7 +22,7 @@ ***************************************************************************/ -int generic_sound_init(running_machine *machine); +int generic_sound_init(running_machine &machine); /* latch readers */ READ8_HANDLER( soundlatch_r ); @@ -53,7 +53,7 @@ WRITE8_HANDLER( soundlatch4_clear_w ); /* If you're going to use soundlatchX_clear_w, and the cleared value is something other than 0x00, use this function from machine_init. Note that this one call effects all 4 latches */ -void soundlatch_setclearedvalue(running_machine *machine, int value); +void soundlatch_setclearedvalue(running_machine &machine, int value); #endif /* __SOUND_GENERIC_H__ */ diff --git a/src/emu/cheat.c b/src/emu/cheat.c index 2391b8c53a8..e26b1ad0af6 100644 --- a/src/emu/cheat.c +++ b/src/emu/cheat.c @@ -190,7 +190,7 @@ cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, int format = xml_get_attribute_int_format(itemnode, "value"); // allocate and append a new item - item &curitem = m_itemlist.append(*auto_alloc(&manager.machine(), item(itemnode->value, value, format))); + item &curitem = m_itemlist.append(*auto_alloc(manager.machine(), item(itemnode->value, value, format))); // ensure the maximum expands to suit m_maxval = MAX(m_maxval, curitem.value()); @@ -366,11 +366,11 @@ cheat_script::cheat_script(cheat_manager &manager, symbol_table &symbols, const { // handle action nodes if (strcmp(entrynode->name, "action") == 0) - m_entrylist.append(*auto_alloc(&manager.machine(), script_entry(manager, symbols, filename, *entrynode, true))); + m_entrylist.append(*auto_alloc(manager.machine(), script_entry(manager, symbols, filename, *entrynode, true))); // handle output nodes else if (strcmp(entrynode->name, "output") == 0) - m_entrylist.append(*auto_alloc(&manager.machine(), script_entry(manager, symbols, filename, *entrynode, false))); + m_entrylist.append(*auto_alloc(manager.machine(), script_entry(manager, symbols, filename, *entrynode, false))); // anything else is ignored else @@ -476,7 +476,7 @@ cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &s int totalargs = 0; for (xml_data_node *argnode = xml_get_sibling(entrynode.child, "argument"); argnode != NULL; argnode = xml_get_sibling(argnode->next, "argument")) { - output_argument &curarg = m_arglist.append(*auto_alloc(&manager.machine(), output_argument(manager, symbols, filename, *argnode))); + output_argument &curarg = m_arglist.append(*auto_alloc(manager.machine(), output_argument(manager, symbols, filename, *argnode))); // verify we didn't overrun the argument count totalargs += curarg.count(); @@ -766,7 +766,7 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons if (paramnode != NULL) { // load this parameter - m_parameter = auto_alloc(&manager.machine(), cheat_parameter(manager, m_symbols, filename, *paramnode)); + m_parameter = auto_alloc(manager.machine(), cheat_parameter(manager, m_symbols, filename, *paramnode)); // only one parameter allowed paramnode = xml_get_sibling(paramnode->next, "parameter"); @@ -778,7 +778,7 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons for (xml_data_node *scriptnode = xml_get_sibling(cheatnode.child, "script"); scriptnode != NULL; scriptnode = xml_get_sibling(scriptnode->next, "script")) { // load this entry - cheat_script *curscript = auto_alloc(&manager.machine(), cheat_script(manager, m_symbols, filename, *scriptnode)); + cheat_script *curscript = auto_alloc(manager.machine(), cheat_script(manager, m_symbols, filename, *scriptnode)); // if we have a script already for this slot, it is an error cheat_script *&slot = script_for_state(curscript->state()); @@ -803,11 +803,11 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons cheat_entry::~cheat_entry() { - auto_free(&m_manager.machine(), m_on_script); - auto_free(&m_manager.machine(), m_off_script); - auto_free(&m_manager.machine(), m_change_script); - auto_free(&m_manager.machine(), m_run_script); - auto_free(&m_manager.machine(), m_parameter); + auto_free(m_manager.machine(), m_on_script); + auto_free(m_manager.machine(), m_off_script); + auto_free(m_manager.machine(), m_change_script); + auto_free(m_manager.machine(), m_run_script); + auto_free(m_manager.machine(), m_parameter); } @@ -1107,7 +1107,7 @@ cheat_manager::cheat_manager(running_machine &machine) // we rely on the debugger expression callbacks; if the debugger isn't // enabled, we must jumpstart them manually if ((machine.debug_flags & DEBUG_FLAG_ENABLED) == 0) - debug_cpu_init(&machine); + debug_cpu_init(machine); // configure for memory access (shared with debugger) debug_cpu_configure_memory(machine, m_symtable); @@ -1446,7 +1446,7 @@ void cheat_manager::load_cheats(const char *filename) for (xml_data_node *cheatnode = xml_get_sibling(mamecheatnode->child, "cheat"); cheatnode != NULL; cheatnode = xml_get_sibling(cheatnode->next, "cheat")) { // load this entry - cheat_entry *curcheat = auto_alloc(&m_machine, cheat_entry(*this, m_symtable, filename, *cheatnode)); + cheat_entry *curcheat = auto_alloc(m_machine, cheat_entry(*this, m_symtable, filename, *cheatnode)); // make sure we're not a duplicate cheat_entry *scannode = NULL; @@ -1462,7 +1462,7 @@ void cheat_manager::load_cheats(const char *filename) if (scannode == NULL) m_cheatlist.append(*curcheat); else - auto_free(&m_machine, curcheat); + auto_free(m_machine, curcheat); } // free the file and loop for the next one diff --git a/src/emu/config.c b/src/emu/config.c index af7ea10f395..3f1b7e18d93 100644 --- a/src/emu/config.c +++ b/src/emu/config.c @@ -46,8 +46,8 @@ static config_type *typelist; FUNCTION PROTOTYPES ***************************************************************************/ -static int config_load_xml(running_machine *machine, emu_file &file, int type); -static int config_save_xml(running_machine *machine, emu_file &file, int type); +static int config_load_xml(running_machine &machine, emu_file &file, int type); +static int config_save_xml(running_machine &machine, emu_file &file, int type); @@ -61,7 +61,7 @@ static int config_save_xml(running_machine *machine, emu_file &file, int type); * *************************************/ -void config_init(running_machine *machine) +void config_init(running_machine &machine) { typelist = NULL; } @@ -75,7 +75,7 @@ void config_init(running_machine *machine) * *************************************/ -void config_register(running_machine *machine, const char *nodename, config_callback_func load, config_callback_func save) +void config_register(running_machine &machine, const char *nodename, config_callback_func load, config_callback_func save) { config_type *newtype; config_type **ptype; @@ -100,9 +100,9 @@ void config_register(running_machine *machine, const char *nodename, config_call * *************************************/ -int config_load_settings(running_machine *machine) +int config_load_settings(running_machine &machine) { - const char *controller = machine->options().ctrlr(); + const char *controller = machine.options().ctrlr(); config_type *type; int loaded = 0; @@ -114,7 +114,7 @@ int config_load_settings(running_machine *machine) if (controller[0] != 0) { /* open the config file */ - emu_file file(machine->options().ctrlr_path(), OPEN_FLAG_READ); + emu_file file(machine.options().ctrlr_path(), OPEN_FLAG_READ); file_error filerr = file.open(controller, ".cfg"); if (filerr != FILERR_NONE) @@ -126,13 +126,13 @@ int config_load_settings(running_machine *machine) } /* next load the defaults file */ - emu_file file(machine->options().cfg_directory(), OPEN_FLAG_READ); + emu_file file(machine.options().cfg_directory(), OPEN_FLAG_READ); file_error filerr = file.open("default.cfg"); if (filerr == FILERR_NONE) config_load_xml(machine, file, CONFIG_TYPE_DEFAULT); /* finally, load the game-specific file */ - filerr = file.open(machine->basename(), ".cfg"); + filerr = file.open(machine.basename(), ".cfg"); if (filerr == FILERR_NONE) loaded = config_load_xml(machine, file, CONFIG_TYPE_GAME); @@ -146,7 +146,7 @@ int config_load_settings(running_machine *machine) } -void config_save_settings(running_machine *machine) +void config_save_settings(running_machine &machine) { config_type *type; @@ -155,13 +155,13 @@ void config_save_settings(running_machine *machine) (*type->save)(machine, CONFIG_TYPE_INIT, NULL); /* save the defaults file */ - emu_file file(machine->options().cfg_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine.options().cfg_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); file_error filerr = file.open("default.cfg"); if (filerr == FILERR_NONE) config_save_xml(machine, file, CONFIG_TYPE_DEFAULT); /* finally, save the game-specific file */ - filerr = file.open(machine->basename(), ".cfg"); + filerr = file.open(machine.basename(), ".cfg"); if (filerr == FILERR_NONE) config_save_xml(machine, file, CONFIG_TYPE_GAME); @@ -178,7 +178,7 @@ void config_save_settings(running_machine *machine) * *************************************/ -static int config_load_xml(running_machine *machine, emu_file &file, int which_type) +static int config_load_xml(running_machine &machine, emu_file &file, int which_type) { xml_data_node *root, *confignode, *systemnode; config_type *type; @@ -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->system().source_file, '/'); + srcfile = strrchr(machine.system().source_file, '/'); if (!srcfile) - srcfile = strrchr(machine->system().source_file, '\\'); + srcfile = strrchr(machine.system().source_file, '\\'); if (!srcfile) - srcfile = strrchr(machine->system().source_file, ':'); + srcfile = strrchr(machine.system().source_file, ':'); if (!srcfile) - srcfile = machine->system().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->system().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->system().name) != 0 && + strcmp(name, machine.system().name) != 0 && strcmp(name, srcfile) != 0 && - ((clone_of = driver_get_clone(&machine->system())) == 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; @@ -279,7 +279,7 @@ error: * *************************************/ -static int config_save_xml(running_machine *machine, emu_file &file, int which_type) +static int config_save_xml(running_machine &machine, emu_file &file, int which_type) { xml_data_node *root = xml_file_create(); xml_data_node *confignode, *systemnode; @@ -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->system().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/config.h b/src/emu/config.h index c34bb1bea6b..4dc13486b6c 100644 --- a/src/emu/config.h +++ b/src/emu/config.h @@ -43,7 +43,7 @@ enum * *************************************/ -typedef void (*config_callback_func)(running_machine *machine, int config_type, xml_data_node *parentnode); +typedef void (*config_callback_func)(running_machine &machine, int config_type, xml_data_node *parentnode); @@ -53,9 +53,9 @@ typedef void (*config_callback_func)(running_machine *machine, int config_type, * *************************************/ -void config_init(running_machine *machine); -void config_register(running_machine *machine, const char *nodename, config_callback_func load, config_callback_func save); -int config_load_settings(running_machine *machine); -void config_save_settings(running_machine *machine); +void config_init(running_machine &machine); +void config_register(running_machine &machine, const char *nodename, config_callback_func load, config_callback_func save); +int config_load_settings(running_machine &machine); +void config_save_settings(running_machine &machine); #endif /* __CONFIG_H__ */ diff --git a/src/emu/cpu/adsp2100/adsp2100.c b/src/emu/cpu/adsp2100/adsp2100.c index 2b4804cd13e..fb38ee505da 100644 --- a/src/emu/cpu/adsp2100/adsp2100.c +++ b/src/emu/cpu/adsp2100/adsp2100.c @@ -211,17 +211,17 @@ device_config *adsp2181_device_config::static_alloc_device_config(const machine_ device_t *adsp2100_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, adsp2100_device(machine, *this)); + return auto_alloc(machine, adsp2100_device(machine, *this)); } device_t *adsp2101_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, adsp2101_device(machine, *this)); + return auto_alloc(machine, adsp2101_device(machine, *this)); } device_t *adsp2181_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, adsp2181_device(machine, *this)); + return auto_alloc(machine, adsp2181_device(machine, *this)); } diff --git a/src/emu/cpu/alph8201/alph8201.c b/src/emu/cpu/alph8201/alph8201.c index b947f79ac6f..fb95ddf6c10 100644 --- a/src/emu/cpu/alph8201/alph8201.c +++ b/src/emu/cpu/alph8201/alph8201.c @@ -298,7 +298,7 @@ INLINE void M_UNDEFINED(alpha8201_state *cpustate) mame_printf_debug("alpha8201: cpustate->PC = %03x, Unimplemented opcode = %02x\n", cpustate->PC-1, M_RDMEM(cpustate->PC-1)); #endif #if BREAK_ON_UNKNOWN_OPCODE - debugger_break(cpustate->device->machine); + debugger_break(cpustate->device->machine()); #endif } @@ -311,7 +311,7 @@ INLINE void M_UNDEFINED2(alpha8201_state *cpustate) mame_printf_debug("alpha8201: cpustate->PC = %03x, Unimplemented opcode = %02x,%02x\n", cpustate->PC-2, op,imm); #endif #if BREAK_ON_UNKNOWN_OPCODE - debugger_break(cpustate->device->machine); + debugger_break(cpustate->device->machine()); #endif } diff --git a/src/emu/cpu/am29000/am29000.c b/src/emu/cpu/am29000/am29000.c index 6dc4efcae5c..cbaf9a238fb 100644 --- a/src/emu/cpu/am29000/am29000.c +++ b/src/emu/cpu/am29000/am29000.c @@ -388,7 +388,7 @@ INLINE void fetch_decode(am29000_state *am29000) static CPU_EXECUTE( am29000 ) { am29000_state *am29000 = get_safe_token(device); - UINT32 call_debugger = (device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0; + UINT32 call_debugger = (device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0; external_irq_check(am29000); diff --git a/src/emu/cpu/asap/asap.c b/src/emu/cpu/asap/asap.c index ee9f35ce217..adaed749d75 100644 --- a/src/emu/cpu/asap/asap.c +++ b/src/emu/cpu/asap/asap.c @@ -194,7 +194,7 @@ device_config *asap_device_config::static_alloc_device_config(const machine_conf device_t *asap_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, asap_device(machine, *this)); + return auto_alloc(machine, asap_device(machine, *this)); } diff --git a/src/emu/cpu/cop400/cop400.c b/src/emu/cpu/cop400/cop400.c index fc2240c8f96..3a0c74a10aa 100644 --- a/src/emu/cpu/cop400/cop400.c +++ b/src/emu/cpu/cop400/cop400.c @@ -886,14 +886,14 @@ static void cop400_init(legacy_cpu_device *device, UINT8 g_mask, UINT8 d_mask, U /* allocate serial timer */ - cpustate->serial_timer = device->machine->scheduler().timer_alloc(FUNC(serial_tick), cpustate); + cpustate->serial_timer = device->machine().scheduler().timer_alloc(FUNC(serial_tick), cpustate); cpustate->serial_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock() / 16)); /* allocate counter timer */ if (has_counter) { - cpustate->counter_timer = device->machine->scheduler().timer_alloc(FUNC(counter_tick), cpustate); + cpustate->counter_timer = device->machine().scheduler().timer_alloc(FUNC(counter_tick), cpustate); cpustate->counter_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock() / 16 / 4)); } @@ -901,7 +901,7 @@ static void cop400_init(legacy_cpu_device *device, UINT8 g_mask, UINT8 d_mask, U if (has_inil) { - cpustate->inil_timer = device->machine->scheduler().timer_alloc(FUNC(inil_tick), cpustate); + cpustate->inil_timer = device->machine().scheduler().timer_alloc(FUNC(inil_tick), cpustate); cpustate->inil_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock() / 16)); } @@ -909,7 +909,7 @@ static void cop400_init(legacy_cpu_device *device, UINT8 g_mask, UINT8 d_mask, U if (cpustate->intf->microbus == COP400_MICROBUS_ENABLED) { - cpustate->microbus_timer = device->machine->scheduler().timer_alloc(FUNC(microbus_tick), cpustate); + cpustate->microbus_timer = device->machine().scheduler().timer_alloc(FUNC(microbus_tick), cpustate); cpustate->microbus_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock() / 16)); } diff --git a/src/emu/cpu/cosmac/cosmac.c b/src/emu/cpu/cosmac/cosmac.c index fa65160de7b..b7cbbfc17d6 100644 --- a/src/emu/cpu/cosmac/cosmac.c +++ b/src/emu/cpu/cosmac/cosmac.c @@ -214,7 +214,7 @@ device_config *cosmac_device_config::static_alloc_device_config(const machine_co device_t *cosmac_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, cosmac_device(machine, *this)); + return auto_alloc(machine, cosmac_device(machine, *this)); } diff --git a/src/emu/cpu/cubeqcpu/cubeqcpu.c b/src/emu/cpu/cubeqcpu/cubeqcpu.c index e4b5c8d2f16..963eaec21bb 100644 --- a/src/emu/cpu/cubeqcpu/cubeqcpu.c +++ b/src/emu/cpu/cubeqcpu/cubeqcpu.c @@ -275,7 +275,7 @@ static void cquestsnd_state_register(device_t *device) device->save_item(NAME(cpustate->prev_ipram)); device->save_item(NAME(cpustate->prev_ipwrt)); - device->machine->state().register_postload(cquestsnd_postload, (void *)device); + device->machine().state().register_postload(cquestsnd_postload, (void *)device); } static CPU_INIT( cquestsnd ) @@ -286,14 +286,14 @@ static CPU_INIT( cquestsnd ) memset(cpustate, 0, sizeof(*cpustate)); cpustate->dac_w = _config->dac_w; - cpustate->sound_data = (UINT16*)device->machine->region(_config->sound_data_region)->base(); + cpustate->sound_data = (UINT16*)device->machine().region(_config->sound_data_region)->base(); cpustate->device = device; cpustate->program = device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); /* Allocate RAM shared with 68000 */ - cpustate->sram = auto_alloc_array(device->machine, UINT16, 4096/2); + cpustate->sram = auto_alloc_array(device->machine(), UINT16, 4096/2); cquestsnd_state_register(device); } @@ -349,7 +349,7 @@ static void cquestrot_state_register(device_t *device) device->save_pointer(NAME(cpustate->dram), 16384); device->save_pointer(NAME(cpustate->sram), 2048); - device->machine->state().register_postload(cquestrot_postload, (void *)device); + device->machine().state().register_postload(cquestrot_postload, (void *)device); } static CPU_INIT( cquestrot ) @@ -359,11 +359,11 @@ static CPU_INIT( cquestrot ) memset(cpustate, 0, sizeof(*cpustate)); /* Allocate RAM */ - cpustate->dram = auto_alloc_array(device->machine, UINT16, 16384); /* Shared with 68000 */ - cpustate->sram = auto_alloc_array(device->machine, UINT16, 2048); /* Private */ + cpustate->dram = auto_alloc_array(device->machine(), UINT16, 16384); /* Shared with 68000 */ + cpustate->sram = auto_alloc_array(device->machine(), UINT16, 2048); /* Private */ cpustate->device = device; - cpustate->lindevice = device->machine->device<legacy_cpu_device>(rotconfig->lin_cpu_tag); + cpustate->lindevice = device->machine().device<legacy_cpu_device>(rotconfig->lin_cpu_tag); cpustate->program = device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); @@ -433,7 +433,7 @@ static void cquestlin_state_register(device_t *device) device->save_pointer(NAME(cpustate->e_stack), 32768); device->save_pointer(NAME(cpustate->o_stack), 32768); - device->machine->state().register_postload(cquestlin_postload, (void *)device); + device->machine().state().register_postload(cquestlin_postload, (void *)device); } static CPU_INIT( cquestlin ) @@ -443,13 +443,13 @@ static CPU_INIT( cquestlin ) memset(cpustate, 0, sizeof(*cpustate)); /* Allocate RAM */ - cpustate->sram = auto_alloc_array(device->machine, UINT16, 4096); /* Shared with rotate CPU */ - cpustate->ptr_ram = auto_alloc_array(device->machine, UINT8, 1024); /* Pointer RAM */ - cpustate->e_stack = auto_alloc_array(device->machine, UINT32, 32768); /* Stack DRAM: 32kx20 */ - cpustate->o_stack = auto_alloc_array(device->machine, UINT32, 32768); /* Stack DRAM: 32kx20 */ + cpustate->sram = auto_alloc_array(device->machine(), UINT16, 4096); /* Shared with rotate CPU */ + cpustate->ptr_ram = auto_alloc_array(device->machine(), UINT8, 1024); /* Pointer RAM */ + cpustate->e_stack = auto_alloc_array(device->machine(), UINT32, 32768); /* Stack DRAM: 32kx20 */ + cpustate->o_stack = auto_alloc_array(device->machine(), UINT32, 32768); /* Stack DRAM: 32kx20 */ cpustate->device = device; - cpustate->rotdevice = device->machine->device<legacy_cpu_device>(linconfig->rot_cpu_tag); + cpustate->rotdevice = device->machine().device<legacy_cpu_device>(linconfig->rot_cpu_tag); cpustate->program = device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); @@ -503,7 +503,7 @@ static int do_sndjmp(cquestsnd_state *cpustate, int jmp) static CPU_EXECUTE( cquestsnd ) { cquestsnd_state *cpustate = get_safe_token_snd(device); - int calldebugger = ((device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0); + int calldebugger = ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0); /* Core execution loop */ do @@ -764,7 +764,7 @@ static CPU_EXECUTE( cquestrot ) { cquestrot_state *cpustate = get_safe_token_rot(device); cquestlin_state *lincpustate = get_safe_token_lin(cpustate->lindevice); - int calldebugger = ((device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0); + int calldebugger = ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0); /* Core execution loop */ do @@ -1177,7 +1177,7 @@ static CPU_EXECUTE( cquestlin ) cquestlin_state *cpustate = get_safe_token_lin(device); cquestrot_state *rotcpustate = get_safe_token_rot(cpustate->rotdevice); - int calldebugger = ((device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0); + int calldebugger = ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0); UINT32 *stack_ram; UINT8 *ptr_ram; diff --git a/src/emu/cpu/drcbex64.c b/src/emu/cpu/drcbex64.c index 54aa38f9526..cd72fbb6943 100644 --- a/src/emu/cpu/drcbex64.c +++ b/src/emu/cpu/drcbex64.c @@ -2781,13 +2781,13 @@ void drcbe_x64::op_debug(x86code *&dst, const instruction &inst) assert_no_condition(inst); assert_no_flags(inst); - if ((m_device.machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((m_device.machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) { // normalize parameters be_parameter pcp(*this, inst.param(0), PTYPE_MRI); // test and branch - emit_mov_r64_imm(dst, REG_RAX, (FPTR)&m_device.machine->debug_flags); // mov rax,&debug_flags + emit_mov_r64_imm(dst, REG_RAX, (FPTR)m_device.machine().debug_flags); // mov rax,&debug_flags emit_test_m32_imm(dst, MBD(REG_RAX, 0), DEBUG_FLAG_CALL_HOOK); // test [debug_flags],DEBUG_FLAG_CALL_HOOK emit_link skip = { 0 }; emit_jcc_short_link(dst, x64emit::COND_Z, skip); // jz skip diff --git a/src/emu/cpu/drcbex86.c b/src/emu/cpu/drcbex86.c index 3419a988125..ad62f3c3338 100644 --- a/src/emu/cpu/drcbex86.c +++ b/src/emu/cpu/drcbex86.c @@ -3012,13 +3012,13 @@ void drcbe_x86::op_debug(x86code *&dst, const instruction &inst) assert_no_condition(inst); assert_no_flags(inst); - if ((m_device.machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((m_device.machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) { // normalize parameters be_parameter pcp(*this, inst.param(0), PTYPE_MRI); // test and branch - emit_test_m32_imm(dst, MABS(&m_device.machine->debug_flags), DEBUG_FLAG_CALL_HOOK); // test [debug_flags],DEBUG_FLAG_CALL_HOOK + emit_test_m32_imm(dst, MABS(&m_device.machine().debug_flags), DEBUG_FLAG_CALL_HOOK); // test [debug_flags],DEBUG_FLAG_CALL_HOOK emit_link skip = { 0 }; emit_jcc_short_link(dst, x86emit::COND_Z, skip); // jz skip diff --git a/src/emu/cpu/drcfe.c b/src/emu/cpu/drcfe.c index 43b71385772..03000e151a9 100644 --- a/src/emu/cpu/drcfe.c +++ b/src/emu/cpu/drcfe.c @@ -84,9 +84,9 @@ 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->respool()), - m_desc_allocator(cpu.machine->respool()), - m_desc_array(auto_alloc_array_clear(cpu.machine, opcode_desc *, window_end + window_start + 2)) + 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)) { } @@ -101,7 +101,7 @@ drc_frontend::~drc_frontend() release_descriptions(); // free the description array - auto_free(m_cpudevice.machine, m_desc_array); + auto_free(m_cpudevice.machine(), m_desc_array); } diff --git a/src/emu/cpu/drcuml.c b/src/emu/cpu/drcuml.c index 1f6e48fe0d9..b19ff71f555 100644 --- a/src/emu/cpu/drcuml.c +++ b/src/emu/cpu/drcuml.c @@ -151,11 +151,11 @@ drcuml_state::drcuml_state(device_t &device, drc_cache &cache, UINT32 flags, int : m_device(device), m_cache(cache), m_beintf((flags & DRCUML_OPTION_USE_C) ? - *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)))), + *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->respool()), - m_symlist(device.machine->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) @@ -170,7 +170,7 @@ drcuml_state::drcuml_state(device_t &device, drc_cache &cache, UINT32 flags, int drcuml_state::~drcuml_state() { // free the back-end - auto_free(m_device.machine, &m_beintf); + auto_free(m_device.machine(), &m_beintf); // close any files if (m_umllog != NULL) @@ -230,7 +230,7 @@ drcuml_block *drcuml_state::begin_block(UINT32 maxinst) // if we failed to find one, allocate a new one if (bestblock == NULL) - bestblock = &m_blocklist.append(*auto_alloc(m_device.machine, drcuml_block(*this, maxinst * 3/2))); + bestblock = &m_blocklist.append(*auto_alloc(m_device.machine(), drcuml_block(*this, maxinst * 3/2))); // start the block bestblock->begin(); @@ -245,7 +245,7 @@ drcuml_block *drcuml_state::begin_block(UINT32 maxinst) code_handle *drcuml_state::handle_alloc(const char *name) { // allocate the handle, add it to our list, and return it - return &m_handlelist.append(*auto_alloc(m_device.machine, code_handle(*this, name))); + return &m_handlelist.append(*auto_alloc(m_device.machine(), code_handle(*this, name))); } @@ -256,7 +256,7 @@ code_handle *drcuml_state::handle_alloc(const char *name) void drcuml_state::symbol_add(void *base, UINT32 length, const char *name) { - m_symlist.append(*auto_alloc(m_device.machine, symbol(base, length, name))); + m_symlist.append(*auto_alloc(m_device.machine(), symbol(base, length, name))); } @@ -323,7 +323,7 @@ drcuml_block::drcuml_block(drcuml_state &drcuml, UINT32 maxinst) m_next(NULL), m_nextinst(0), m_maxinst(maxinst * 3/2), - m_inst(auto_alloc_array(drcuml.device().machine, instruction, m_maxinst)), + m_inst(auto_alloc_array(drcuml.device().machine(), instruction, m_maxinst)), m_inuse(false) { } @@ -336,7 +336,7 @@ drcuml_block::drcuml_block(drcuml_state &drcuml, UINT32 maxinst) drcuml_block::~drcuml_block() { // free the instruction list - auto_free(m_drcuml.device().machine, m_inst); + auto_free(m_drcuml.device().machine(), m_inst); } @@ -951,31 +951,31 @@ static void bevalidate_execute(drcuml_state *drcuml, code_handle **handles, cons static void bevalidate_initialize_random_state(drcuml_state *drcuml, drcuml_block *block, drcuml_machine_state *state) { - running_machine *machine = drcuml->device->machine; + running_machine &machine = drcuml->device->machine(); int regnum; // initialize core state to random values - state->fmod = machine->rand() & 0x03; - state->flags = machine->rand() & 0x1f; - state->exp = machine->rand(); + state->fmod = machine.rand() & 0x03; + state->flags = machine.rand() & 0x1f; + state->exp = machine.rand(); // initialize integer registers to random values for (regnum = 0; regnum < ARRAY_LENGTH(state->r); regnum++) { - state->r[regnum].w.h = machine->rand(); - state->r[regnum].w.l = machine->rand(); + state->r[regnum].w.h = machine.rand(); + state->r[regnum].w.l = machine.rand(); } // initialize float registers to random values for (regnum = 0; regnum < ARRAY_LENGTH(state->f); regnum++) { - *(UINT32 *)&state->f[regnum].s.h = machine->rand(); - *(UINT32 *)&state->f[regnum].s.l = machine->rand(); + *(UINT32 *)&state->f[regnum].s.h = machine.rand(); + *(UINT32 *)&state->f[regnum].s.l = machine.rand(); } // initialize map variables to random values for (regnum = 0; regnum < MAPVAR_COUNT; regnum++) - UML_MAPVAR(block, MVAR(regnum), machine->rand()); + UML_MAPVAR(block, MVAR(regnum), machine.rand()); } diff --git a/src/emu/cpu/dsp16/dsp16.c b/src/emu/cpu/dsp16/dsp16.c index f3dfa3d074a..5ee8f991faf 100644 --- a/src/emu/cpu/dsp16/dsp16.c +++ b/src/emu/cpu/dsp16/dsp16.c @@ -45,7 +45,7 @@ device_config *dsp16_device_config::static_alloc_device_config(const machine_con device_t *dsp16_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, dsp16_device(machine, *this)); + return auto_alloc(machine, dsp16_device(machine, *this)); } diff --git a/src/emu/cpu/dsp32/dsp32.c b/src/emu/cpu/dsp32/dsp32.c index 19859c26586..8c61ac81546 100644 --- a/src/emu/cpu/dsp32/dsp32.c +++ b/src/emu/cpu/dsp32/dsp32.c @@ -202,7 +202,7 @@ device_config *dsp32c_device_config::static_alloc_device_config(const machine_co device_t *dsp32c_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, dsp32c_device(machine, *this)); + return auto_alloc(machine, dsp32c_device(machine, *this)); } diff --git a/src/emu/cpu/dsp56k/dsp56k.c b/src/emu/cpu/dsp56k/dsp56k.c index 93ed7708691..f919578fb03 100644 --- a/src/emu/cpu/dsp56k/dsp56k.c +++ b/src/emu/cpu/dsp56k/dsp56k.c @@ -238,7 +238,7 @@ static CPU_INIT( dsp56k ) /* Setup the direct memory handler for this CPU */ /* NOTE: Be sure to grab this guy and call him if you ever install another direct_update_hander in a driver! */ - const_cast<address_space *>(cpustate->program)->set_direct_update_handler(direct_update_delegate_create_static(dsp56k_direct_handler, *device->machine)); + const_cast<address_space *>(cpustate->program)->set_direct_update_handler(direct_update_delegate_create_static(dsp56k_direct_handler, device->machine())); } diff --git a/src/emu/cpu/e132xs/e132xs.c b/src/emu/cpu/e132xs/e132xs.c index 7cd6a29a443..d93620aba96 100644 --- a/src/emu/cpu/e132xs/e132xs.c +++ b/src/emu/cpu/e132xs/e132xs.c @@ -1546,7 +1546,7 @@ static void hyperstone_init(legacy_cpu_device *device, device_irq_callback irqca cpustate->program = device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); cpustate->io = device->space(AS_IO); - cpustate->timer = device->machine->scheduler().timer_alloc(FUNC(e132xs_timer_callback), (void *)device); + cpustate->timer = device->machine().scheduler().timer_alloc(FUNC(e132xs_timer_callback), (void *)device); cpustate->clock_scale_mask = scale_mask; } diff --git a/src/emu/cpu/esrip/esrip.c b/src/emu/cpu/esrip/esrip.c index 9b983566760..a69939fa430 100644 --- a/src/emu/cpu/esrip/esrip.c +++ b/src/emu/cpu/esrip/esrip.c @@ -116,8 +116,8 @@ typedef struct read16_device_func fdt_r; write16_device_func fdt_w; - UINT8 (*status_in)(running_machine *machine); - int (*draw)(running_machine *machine, int l, int r, int fig, int attr, int addr, int col, int x_scale, int bank); + UINT8 (*status_in)(running_machine &machine); + int (*draw)(running_machine &machine, int l, int r, int fig, int attr, int addr, int col, int x_scale, int bank); } esrip_state; @@ -256,19 +256,19 @@ static CPU_INIT( esrip ) /* Register configuration structure callbacks */ cpustate->fdt_r = _config->fdt_r; cpustate->fdt_w = _config->fdt_w; - cpustate->lbrm = (UINT8*)device->machine->region(_config->lbrm_prom)->base(); + cpustate->lbrm = (UINT8*)device->machine().region(_config->lbrm_prom)->base(); cpustate->status_in = _config->status_in; cpustate->draw = _config->draw; /* Allocate image pointer table RAM */ - cpustate->ipt_ram = auto_alloc_array(device->machine, UINT16, IPT_RAM_SIZE/2); + cpustate->ipt_ram = auto_alloc_array(device->machine(), UINT16, IPT_RAM_SIZE/2); cpustate->device = device; cpustate->program = device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); /* Create the instruction decode lookup table */ - cpustate->optable = auto_alloc_array(device->machine, UINT8, 65536); + cpustate->optable = auto_alloc_array(device->machine(), UINT8, 65536); make_ops(cpustate); /* Register stuff for state saving */ @@ -354,9 +354,9 @@ static CPU_EXIT( esrip ) PRIVATE FUNCTIONS ***************************************************************************/ -static int get_hblank(running_machine *machine) +static int get_hblank(running_machine &machine) { - return machine->primary_screen->hblank(); + return machine.primary_screen->hblank(); } /* Return the state of the LBRM line (Y-scaling related) */ @@ -384,7 +384,7 @@ INLINE int check_jmp(esrip_state *cpustate, UINT8 jmp_ctrl) /* T3 */ case 6: ret = BIT(cpustate->t, 2); break; /* T4 */ case 1: ret = BIT(cpustate->t, 3); break; /* /LBRM */ case 5: ret = !get_lbrm(cpustate); break; - /* /HBLANK */ case 3: ret = !get_hblank(cpustate->device->machine); break; + /* /HBLANK */ case 3: ret = !get_hblank(cpustate->device->machine()); break; /* JMP */ case 7: ret = 0; break; } @@ -1664,11 +1664,11 @@ INLINE void am29116_execute(esrip_state *cpustate, UINT16 inst, int _sre) static CPU_EXECUTE( esrip ) { esrip_state *cpustate = get_safe_token(device); - int calldebugger = (device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0; + int calldebugger = (device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0; UINT8 status; /* I think we can get away with placing this outside of the loop */ - status = cpustate->status_in(device->machine); + status = cpustate->status_in(device->machine()); /* Core execution loop */ do @@ -1811,7 +1811,7 @@ static CPU_EXECUTE( esrip ) cpustate->attr_latch = x_bus; cpustate->fig = 1; - cpustate->fig_cycles = cpustate->draw(device->machine, cpustate->adl_latch, cpustate->adr_latch, cpustate->fig_latch, cpustate->attr_latch, cpustate->iaddr_latch, cpustate->c_latch, cpustate->x_scale, cpustate->img_bank); + cpustate->fig_cycles = cpustate->draw(device->machine(), cpustate->adl_latch, cpustate->adr_latch, cpustate->fig_latch, cpustate->attr_latch, cpustate->iaddr_latch, cpustate->c_latch, cpustate->x_scale, cpustate->img_bank); } /* X-scale */ @@ -1943,7 +1943,7 @@ CPU_GET_INFO( esrip ) cpustate->status & 0x04 ? 'N' : '.', cpustate->status & 0x02 ? 'C' : '.', cpustate->status & 0x01 ? 'Z' : '.', - get_hblank(device->machine) ? 'H' : '.'); break; + get_hblank(device->machine()) ? 'H' : '.'); break; case CPUINFO_STR_REGISTER + ESRIP_PC: sprintf(info->s, "PC: %04X", RIP_PC); break; case CPUINFO_STR_REGISTER + ESRIP_ACC: sprintf(info->s, "ACC: %04X", cpustate->acc); break; diff --git a/src/emu/cpu/esrip/esrip.h b/src/emu/cpu/esrip/esrip.h index 8935136b689..7a06e88bea2 100644 --- a/src/emu/cpu/esrip/esrip.h +++ b/src/emu/cpu/esrip/esrip.h @@ -85,8 +85,8 @@ struct _esrip_config_ { read16_device_func fdt_r; write16_device_func fdt_w; - UINT8 (*status_in)(running_machine *machine); - int (*draw)(running_machine *machine, int l, int r, int fig, int attr, int addr, int col, int x_scale, int bank); + UINT8 (*status_in)(running_machine &machine); + int (*draw)(running_machine &machine, int l, int r, int fig, int attr, int addr, int col, int x_scale, int bank); const char* const lbrm_prom; }; diff --git a/src/emu/cpu/g65816/g65816.c b/src/emu/cpu/g65816/g65816.c index 30d58b3ddcc..3d7782dc9e5 100644 --- a/src/emu/cpu/g65816/g65816.c +++ b/src/emu/cpu/g65816/g65816.c @@ -365,7 +365,7 @@ static CPU_INIT( g65816 ) device->save_item(NAME(cpustate->irq_delay)); device->save_item(NAME(cpustate->stopped)); - device->machine->state().register_postload(g65816_restore_state, cpustate); + device->machine().state().register_postload(g65816_restore_state, cpustate); } /************************************************************************** diff --git a/src/emu/cpu/h83002/h8_16.c b/src/emu/cpu/h83002/h8_16.c index 9b5fb48ee47..d6fdcafc590 100644 --- a/src/emu/cpu/h83002/h8_16.c +++ b/src/emu/cpu/h83002/h8_16.c @@ -237,7 +237,7 @@ static CPU_INIT(h8) device->save_item(NAME(h8->h8TSTR)); device->save_item(NAME(h8->h8TCNT)); - device->machine->state().register_postload(h8_onstateload, h8); + device->machine().state().register_postload(h8_onstateload, h8); h8_itu_init(h8); } diff --git a/src/emu/cpu/h83002/h8_8.c b/src/emu/cpu/h83002/h8_8.c index ce7cd1a4f63..e95d5602c5c 100644 --- a/src/emu/cpu/h83002/h8_8.c +++ b/src/emu/cpu/h83002/h8_8.c @@ -241,10 +241,10 @@ static CPU_INIT(h8bit) h8->direct = &h8->program->direct(); h8->io = device->space(AS_IO); - h8->timer[0] = h8->device->machine->scheduler().timer_alloc(FUNC(h8_timer_0_cb), h8); - h8->timer[1] = h8->device->machine->scheduler().timer_alloc(FUNC(h8_timer_1_cb), h8); - h8->timer[2] = h8->device->machine->scheduler().timer_alloc(FUNC(h8_timer_2_cb), h8); - h8->timer[3] = h8->device->machine->scheduler().timer_alloc(FUNC(h8_timer_3_cb), h8); + h8->timer[0] = h8->device->machine().scheduler().timer_alloc(FUNC(h8_timer_0_cb), h8); + h8->timer[1] = h8->device->machine().scheduler().timer_alloc(FUNC(h8_timer_1_cb), h8); + h8->timer[2] = h8->device->machine().scheduler().timer_alloc(FUNC(h8_timer_2_cb), h8); + h8->timer[3] = h8->device->machine().scheduler().timer_alloc(FUNC(h8_timer_3_cb), h8); device->save_item(NAME(h8->h8err)); device->save_item(NAME(h8->regs)); @@ -259,7 +259,7 @@ static CPU_INIT(h8bit) device->save_item(NAME(h8->h8TSTR)); device->save_item(NAME(h8->h8TCNT)); - h8->device->machine->state().register_postload(h8_onstateload, h8); + h8->device->machine().state().register_postload(h8_onstateload, h8); } static CPU_RESET(h8bit) diff --git a/src/emu/cpu/h83002/h8periph.c b/src/emu/cpu/h83002/h8periph.c index 50ff0143cb2..644471f94ea 100644 --- a/src/emu/cpu/h83002/h8periph.c +++ b/src/emu/cpu/h83002/h8periph.c @@ -766,20 +766,20 @@ void h8_3007_register1_write8(h83xx_state *h8, UINT32 address, UINT8 val) void h8_3007_itu_init(h83xx_state *h8) { - h8->timer[0] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_3007_timer_0_cb), h8); - h8->timer[1] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_3007_timer_1_cb), h8); - h8->timer[2] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_3007_timer_2_cb), h8); + h8->timer[0] = h8->device->machine().scheduler().timer_alloc(FUNC(h8itu_3007_timer_0_cb), h8); + h8->timer[1] = h8->device->machine().scheduler().timer_alloc(FUNC(h8itu_3007_timer_1_cb), h8); + h8->timer[2] = h8->device->machine().scheduler().timer_alloc(FUNC(h8itu_3007_timer_2_cb), h8); h8_itu_reset(h8); } void h8_itu_init(h83xx_state *h8) { - h8->timer[0] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_0_cb), h8); - h8->timer[1] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_1_cb), h8); - h8->timer[2] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_2_cb), h8); - h8->timer[3] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_3_cb), h8); - h8->timer[4] = h8->device->machine->scheduler().timer_alloc(FUNC(h8itu_timer_4_cb), h8); + h8->timer[0] = h8->device->machine().scheduler().timer_alloc(FUNC(h8itu_timer_0_cb), h8); + h8->timer[1] = h8->device->machine().scheduler().timer_alloc(FUNC(h8itu_timer_1_cb), h8); + h8->timer[2] = h8->device->machine().scheduler().timer_alloc(FUNC(h8itu_timer_2_cb), h8); + h8->timer[3] = h8->device->machine().scheduler().timer_alloc(FUNC(h8itu_timer_3_cb), h8); + h8->timer[4] = h8->device->machine().scheduler().timer_alloc(FUNC(h8itu_timer_4_cb), h8); h8_itu_reset(h8); } diff --git a/src/emu/cpu/hd6309/hd6309.c b/src/emu/cpu/hd6309/hd6309.c index d931748a568..87746628c6e 100644 --- a/src/emu/cpu/hd6309/hd6309.c +++ b/src/emu/cpu/hd6309/hd6309.c @@ -541,7 +541,7 @@ static CPU_INIT( hd6309 ) device->save_item(NAME(DP)); device->save_item(NAME(CC)); device->save_item(NAME(MD)); - device->machine->state().register_postload(hd6309_postload, (void *) device); + device->machine().state().register_postload(hd6309_postload, (void *) device); device->save_item(NAME(m68_state->int_state)); device->save_item(NAME(m68_state->nmi_state)); device->save_item(NAME(m68_state->irq_state[0])); diff --git a/src/emu/cpu/i386/i386.c b/src/emu/cpu/i386/i386.c index 963cf8bf467..62a39490969 100644 --- a/src/emu/cpu/i386/i386.c +++ b/src/emu/cpu/i386/i386.c @@ -418,7 +418,7 @@ INLINE void CYCLES_RM(i386_state *cpustate,int modrm, int r, int m) } } -static void build_cycle_table(running_machine *machine) +static void build_cycle_table(running_machine &machine) { int i, j; for (j=0; j < X86_NUM_CPUS; j++) @@ -534,7 +534,7 @@ static CPU_INIT( i386 ) static const int regs32[8] = {EAX,ECX,EDX,EBX,ESP,EBP,ESI,EDI}; i386_state *cpustate = get_safe_token(device); - build_cycle_table(device->machine); + build_cycle_table(device->machine()); for( i=0; i < 256; i++ ) { int c=0; @@ -614,7 +614,7 @@ static CPU_INIT( i386 ) device->save_item(NAME(cpustate->ldtr.flags)); device->save_item(NAME(cpustate->irq_state)); device->save_item(NAME(cpustate->performed_intersegment_jump)); - device->machine->state().register_postload(i386_postload, (void *)device); + device->machine().state().register_postload(i386_postload, (void *)device); } static void build_opcode_table(i386_state *cpustate, UINT32 features) diff --git a/src/emu/cpu/jaguar/jaguar.c b/src/emu/cpu/jaguar/jaguar.c index 5811cd8dc65..6d88c701e24 100644 --- a/src/emu/cpu/jaguar/jaguar.c +++ b/src/emu/cpu/jaguar/jaguar.c @@ -430,7 +430,7 @@ static void init_common(int isdsp, legacy_cpu_device *device, device_irq_callbac device->save_item(NAME(jaguar->a)); device->save_item(NAME(jaguar->ctrl)); device->save_item(NAME(jaguar->ppc)); - device->machine->state().register_postload(jaguar_postload, (void *)device); + device->machine().state().register_postload(jaguar_postload, (void *)device); } diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c index ad5ced6347c..d385094425b 100644 --- a/src/emu/cpu/m37710/m37710.c +++ b/src/emu/cpu/m37710/m37710.c @@ -906,7 +906,7 @@ static CPU_INIT( m37710 ) cpustate->destination = 0; for (i = 0; i < 8; i++) - cpustate->timers[i] = device->machine->scheduler().timer_alloc(FUNC(m37710_timer_cb), cpustate); + cpustate->timers[i] = device->machine().scheduler().timer_alloc(FUNC(m37710_timer_cb), cpustate); device->save_item(NAME(cpustate->a)); device->save_item(NAME(cpustate->b)); @@ -949,7 +949,7 @@ static CPU_INIT( m37710 ) device->save_item(NAME(cpustate->reload[6])); device->save_item(NAME(cpustate->reload[7])); - device->machine->state().register_postload(m37710_restore_state, cpustate); + device->machine().state().register_postload(m37710_restore_state, cpustate); } /************************************************************************** diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c index 23e68c92d03..700fb0a633e 100644 --- a/src/emu/cpu/m6800/m6800.c +++ b/src/emu/cpu/m6800/m6800.c @@ -1204,7 +1204,7 @@ static CPU_INIT( m6801 ) cpustate->io = device->space(AS_IO); cpustate->clock = device->clock() / 4; - cpustate->sci_timer = device->machine->scheduler().timer_alloc(FUNC(sci_tick), cpustate); + cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate); state_register(cpustate, "m6801"); @@ -1254,7 +1254,7 @@ static CPU_INIT( m6803 ) cpustate->io = device->space(AS_IO); cpustate->clock = device->clock() / 4; - cpustate->sci_timer = device->machine->scheduler().timer_alloc(FUNC(sci_tick), cpustate); + cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate); state_register(cpustate, "m6803"); @@ -1312,7 +1312,7 @@ static CPU_INIT( hd6301 ) cpustate->io = device->space(AS_IO); cpustate->clock = device->clock() / 4; - cpustate->sci_timer = device->machine->scheduler().timer_alloc(FUNC(sci_tick), cpustate); + cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate); state_register(cpustate, "hd6301"); } @@ -1336,7 +1336,7 @@ static CPU_INIT( hd63701 ) cpustate->io = device->space(AS_IO); cpustate->clock = device->clock() / 4; - cpustate->sci_timer = device->machine->scheduler().timer_alloc(FUNC(sci_tick), cpustate); + cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate); state_register(cpustate, "hd63701"); } diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c index 94f3b4a2e41..1b900f5d7e8 100644 --- a/src/emu/cpu/m68000/m68kcpu.c +++ b/src/emu/cpu/m68000/m68kcpu.c @@ -538,7 +538,7 @@ static void set_irq_line(m68ki_cpu_core *m68k, int irqline, int state) m68k->nmi_pending = TRUE; } -static void m68k_presave(running_machine *machine, void *param) +static void m68k_presave(running_machine &machine, void *param) { m68ki_cpu_core *m68k = (m68ki_cpu_core *)param; m68k->save_sr = m68ki_get_sr(m68k); @@ -546,7 +546,7 @@ static void m68k_presave(running_machine *machine, void *param) m68k->save_halted = (m68k->stopped & STOP_LEVEL_HALT) != 0; } -static void m68k_postload(running_machine *machine, void *param) +static void m68k_postload(running_machine &machine, void *param) { m68ki_cpu_core *m68k = (m68ki_cpu_core *)param; m68ki_set_sr_noint_nosp(m68k, m68k->save_sr); @@ -762,8 +762,8 @@ static CPU_INIT( m68k ) device->save_item(NAME(m68k->save_halted)); device->save_item(NAME(m68k->pref_addr)); device->save_item(NAME(m68k->pref_data)); - device->machine->state().register_presave(m68k_presave, m68k); - device->machine->state().register_postload(m68k_postload, m68k); + device->machine().state().register_presave(m68k_presave, m68k); + device->machine().state().register_postload(m68k_postload, m68k); } /* Pulse the RESET line on the CPU */ diff --git a/src/emu/cpu/mb86233/mb86233.c b/src/emu/cpu/mb86233/mb86233.c index 64c0483995a..3150b447b48 100644 --- a/src/emu/cpu/mb86233/mb86233.c +++ b/src/emu/cpu/mb86233/mb86233.c @@ -121,13 +121,13 @@ static CPU_INIT( mb86233 ) cpustate->fifo_write_cb = _config->fifo_write_cb; } - cpustate->RAM = auto_alloc_array(device->machine, UINT32, 2 * 0x200); /* 2x 2KB */ + cpustate->RAM = auto_alloc_array(device->machine(), UINT32, 2 * 0x200); /* 2x 2KB */ memset( cpustate->RAM, 0, 2 * 0x200 * sizeof(UINT32) ); cpustate->ARAM = &cpustate->RAM[0]; cpustate->BRAM = &cpustate->RAM[0x200]; - cpustate->Tables = (UINT32*) device->machine->region(_config->tablergn)->base(); + cpustate->Tables = (UINT32*) device->machine().region(_config->tablergn)->base(); - state_save_register_global_pointer(device->machine, cpustate->RAM,2 * 0x200 * sizeof(UINT32)); + state_save_register_global_pointer(device->machine(), cpustate->RAM,2 * 0x200 * sizeof(UINT32)); } static CPU_RESET( mb86233 ) diff --git a/src/emu/cpu/mb88xx/mb88xx.c b/src/emu/cpu/mb88xx/mb88xx.c index d14b6cf5b44..8c60ca444aa 100644 --- a/src/emu/cpu/mb88xx/mb88xx.c +++ b/src/emu/cpu/mb88xx/mb88xx.c @@ -149,7 +149,7 @@ static CPU_INIT( mb88 ) cpustate->data = device->space(AS_DATA); cpustate->io = device->space(AS_IO); - cpustate->serial = device->machine->scheduler().timer_alloc(FUNC(serial_timer), (void *)device); + cpustate->serial = device->machine().scheduler().timer_alloc(FUNC(serial_timer), (void *)device); device->save_item(NAME(cpustate->PC)); device->save_item(NAME(cpustate->PA)); diff --git a/src/emu/cpu/mc68hc11/mc68hc11.c b/src/emu/cpu/mc68hc11/mc68hc11.c index 7cd5d87d15e..4806a287fd3 100644 --- a/src/emu/cpu/mc68hc11/mc68hc11.c +++ b/src/emu/cpu/mc68hc11/mc68hc11.c @@ -410,7 +410,7 @@ static CPU_INIT( hc11 ) cpustate->internal_ram_size = 1280; } - cpustate->internal_ram = auto_alloc_array(device->machine, UINT8, cpustate->internal_ram_size); + cpustate->internal_ram = auto_alloc_array(device->machine(), UINT8, cpustate->internal_ram_size); cpustate->reg_position = 0; cpustate->ram_position = 0x100; diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c index bcedcf23008..4575a04fd9c 100644 --- a/src/emu/cpu/mcs48/mcs48.c +++ b/src/emu/cpu/mcs48/mcs48.c @@ -1215,7 +1215,7 @@ static TIMER_CALLBACK( master_callback ) void upi41_master_w(device_t *_device, UINT8 a0, UINT8 data) { legacy_cpu_device *device = downcast<legacy_cpu_device *>(_device); - device->machine->scheduler().synchronize(FUNC(master_callback), (a0 << 8) | data, (void *)device); + device->machine().scheduler().synchronize(FUNC(master_callback), (a0 << 8) | data, (void *)device); } diff --git a/src/emu/cpu/mips/mips3com.c b/src/emu/cpu/mips/mips3com.c index 9e84e9d3780..21e67659249 100644 --- a/src/emu/cpu/mips/mips3com.c +++ b/src/emu/cpu/mips/mips3com.c @@ -105,7 +105,7 @@ void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, legacy mips->vtlb = vtlb_alloc(device, AS_PROGRAM, 2 * mips->tlbentries + 2, 0); /* allocate a timer for the compare interrupt */ - mips->compare_int_timer = device->machine->scheduler().timer_alloc(FUNC(compare_int_callback), (void *)device); + mips->compare_int_timer = device->machine().scheduler().timer_alloc(FUNC(compare_int_callback), (void *)device); /* reset the state */ mips3com_reset(mips); diff --git a/src/emu/cpu/mips/mips3drc.c b/src/emu/cpu/mips/mips3drc.c index 83f95669eff..f62c4d16c8b 100644 --- a/src/emu/cpu/mips/mips3drc.c +++ b/src/emu/cpu/mips/mips3drc.c @@ -396,7 +396,7 @@ static void mips3_init(mips3_flavor flavor, int bigendian, legacy_cpu_device *de int regnum; /* allocate enough space for the cache and the core */ - cache = auto_alloc(device->machine, drc_cache(CACHE_SIZE + sizeof(*mips3))); + cache = auto_alloc(device->machine(), drc_cache(CACHE_SIZE + sizeof(*mips3))); if (cache == NULL) fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(*mips3))); @@ -419,7 +419,7 @@ static void mips3_init(mips3_flavor flavor, int bigendian, legacy_cpu_device *de flags |= DRCUML_OPTION_LOG_UML; if (LOG_NATIVE) flags |= DRCUML_OPTION_LOG_NATIVE; - mips3->impstate->drcuml = auto_alloc(device->machine, drcuml_state(*device, *cache, flags, 8, 32, 2)); + mips3->impstate->drcuml = auto_alloc(device->machine(), drcuml_state(*device, *cache, flags, 8, 32, 2)); /* add symbols for our stuff */ mips3->impstate->drcuml->symbol_add(&mips3->pc, sizeof(mips3->pc), "pc"); @@ -465,7 +465,7 @@ static void mips3_init(mips3_flavor flavor, int bigendian, legacy_cpu_device *de mips3->impstate->drcuml->symbol_add(&mips3->impstate->fpmode, sizeof(mips3->impstate->fpmode), "fpmode"); /* initialize the front-end helper */ - mips3->impstate->drcfe = auto_alloc(device->machine, mips3_frontend(*mips3, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE)); + mips3->impstate->drcfe = auto_alloc(device->machine(), mips3_frontend(*mips3, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE)); /* allocate memory for cache-local state and initialize it */ memcpy(mips3->impstate->fpmode, fpmode_source, sizeof(fpmode_source)); @@ -562,9 +562,9 @@ static CPU_EXIT( mips3 ) mips3com_exit(mips3); /* clean up the DRC */ - auto_free(device->machine, mips3->impstate->drcfe); - auto_free(device->machine, mips3->impstate->drcuml); - auto_free(device->machine, mips3->impstate->cache); + auto_free(device->machine(), mips3->impstate->drcfe); + auto_free(device->machine(), mips3->impstate->drcuml); + auto_free(device->machine(), mips3->impstate->cache); } @@ -1275,7 +1275,7 @@ static void static_generate_memory_accessor(mips3_state *mips3, int mode, int si UML_JMPc(block, COND_Z, tlbmiss = label++); // jmp tlbmiss,z UML_ROLINS(block, I0, I3, 0, 0xfffff000); // rolins i0,i3,0,0xfffff000 - if ((mips3->device->machine->debug_flags & DEBUG_FLAG_ENABLED) == 0) + if ((mips3->device->machine().debug_flags & DEBUG_FLAG_ENABLED) == 0) for (ramnum = 0; ramnum < MIPS3_MAX_FASTRAM; ramnum++) if (mips3->impstate->fastram[ramnum].base != NULL && (!iswrite || !mips3->impstate->fastram[ramnum].readonly)) { @@ -1612,7 +1612,7 @@ static void generate_sequence_instruction(mips3_state *mips3, drcuml_block *bloc } /* if we are debugging, call the debugger */ - if ((mips3->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((mips3->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) { UML_MOV(block, mem(&mips3->pc), desc->pc); // mov [pc],desc->pc save_fast_iregs(mips3, block); diff --git a/src/emu/cpu/mips/psx.c b/src/emu/cpu/mips/psx.c index 72a5bde1bf0..2437f082721 100644 --- a/src/emu/cpu/mips/psx.c +++ b/src/emu/cpu/mips/psx.c @@ -232,7 +232,7 @@ void psxcpu_device::set_biu( UINT32 data, UINT32 mem_mask ) void psxcpu_device::stop() { - debugger_break( machine ); + debugger_break( m_machine ); debugger_instruction_hook( this, m_pc ); } @@ -1602,12 +1602,12 @@ device_config *cxd8661r_device_config::static_alloc_device_config(const machine_ device_t *psxcpu_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, psxcpu_device(machine, *this)); + return auto_alloc(machine, psxcpu_device(machine, *this)); } device_t *cxd8661r_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, psxcpu_device(machine, *this)); + return auto_alloc(machine, psxcpu_device(machine, *this)); } diff --git a/src/emu/cpu/mips/r3000.c b/src/emu/cpu/mips/r3000.c index 1388fd9edf6..c0a6cbb2b9a 100644 --- a/src/emu/cpu/mips/r3000.c +++ b/src/emu/cpu/mips/r3000.c @@ -303,8 +303,8 @@ static CPU_INIT( r3000 ) r3000_state *r3000 = get_safe_token(device); /* allocate memory */ - r3000->icache = auto_alloc_array(device->machine, UINT32, configdata->icache/4); - r3000->dcache = auto_alloc_array(device->machine, UINT32, configdata->dcache/4); + r3000->icache = auto_alloc_array(device->machine(), UINT32, configdata->icache/4); + r3000->dcache = auto_alloc_array(device->machine(), UINT32, configdata->dcache/4); r3000->icache_size = configdata->icache; r3000->dcache_size = configdata->dcache; diff --git a/src/emu/cpu/mn10200/mn10200.c b/src/emu/cpu/mn10200/mn10200.c index 9b37e6d194d..4ffb6ac3a88 100644 --- a/src/emu/cpu/mn10200/mn10200.c +++ b/src/emu/cpu/mn10200/mn10200.c @@ -295,7 +295,7 @@ static CPU_INIT(mn10200) for (tmr = 0; tmr < NUM_TIMERS_8BIT; tmr++) { - cpustate->timer_timers[tmr] = device->machine->scheduler().timer_alloc(FUNC(simple_timer_cb), cpustate); + cpustate->timer_timers[tmr] = device->machine().scheduler().timer_alloc(FUNC(simple_timer_cb), cpustate); cpustate->timer_timers[tmr]->adjust(attotime::never, tmr); } } diff --git a/src/emu/cpu/nec/v25.c b/src/emu/cpu/nec/v25.c index 8b8f27eef71..15c8ea5e666 100644 --- a/src/emu/cpu/nec/v25.c +++ b/src/emu/cpu/nec/v25.c @@ -430,7 +430,7 @@ static void v25_init(legacy_cpu_device *device, device_irq_callback irqcallback, nec_state->config = config; for (int i = 0; i < 4; i++) - nec_state->timers[i] = device->machine->scheduler().timer_alloc(FUNC(v25_timer_callback), nec_state); + nec_state->timers[i] = device->machine().scheduler().timer_alloc(FUNC(v25_timer_callback), nec_state); device->save_item(NAME(nec_state->ram.w)); device->save_item(NAME(nec_state->intp_state)); diff --git a/src/emu/cpu/powerpc/ppc.c b/src/emu/cpu/powerpc/ppc.c index 296e1594ee0..a839bf2c51c 100644 --- a/src/emu/cpu/powerpc/ppc.c +++ b/src/emu/cpu/powerpc/ppc.c @@ -947,8 +947,8 @@ static CPU_INIT( ppc403 ) // !!! why is rfci here !!! ppc.optable19[51] = ppc_rfci; - ppc.spu.rx_timer = device->machine->scheduler().timer_alloc(FUNC(ppc403_spu_rx_callback)); - ppc.spu.tx_timer = device->machine->scheduler().timer_alloc(FUNC(ppc403_spu_tx_callback)); + ppc.spu.rx_timer = device->machine().scheduler().timer_alloc(FUNC(ppc403_spu_rx_callback)); + ppc.spu.tx_timer = device->machine().scheduler().timer_alloc(FUNC(ppc403_spu_tx_callback)); ppc.read8 = ppc403_read8; ppc.read16 = ppc403_read16; diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c index c99b2a50ebc..60d3855793d 100644 --- a/src/emu/cpu/powerpc/ppccom.c +++ b/src/emu/cpu/powerpc/ppccom.c @@ -328,14 +328,14 @@ void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_di /* allocate a timer for the compare interrupt */ if ((cap & PPCCAP_OEA) && (ppc->tb_divisor)) - ppc->decrementer_int_timer = device->machine->scheduler().timer_alloc(FUNC(decrementer_int_callback), ppc); + ppc->decrementer_int_timer = device->machine().scheduler().timer_alloc(FUNC(decrementer_int_callback), ppc); /* and for the 4XX interrupts if needed */ if (cap & PPCCAP_4XX) { - ppc->fit_timer = device->machine->scheduler().timer_alloc(FUNC(ppc4xx_fit_callback), ppc); - ppc->pit_timer = device->machine->scheduler().timer_alloc(FUNC(ppc4xx_pit_callback), ppc); - ppc->spu.timer = device->machine->scheduler().timer_alloc(FUNC(ppc4xx_spu_callback), ppc); + ppc->fit_timer = device->machine().scheduler().timer_alloc(FUNC(ppc4xx_fit_callback), ppc); + ppc->pit_timer = device->machine().scheduler().timer_alloc(FUNC(ppc4xx_pit_callback), ppc); + ppc->spu.timer = device->machine().scheduler().timer_alloc(FUNC(ppc4xx_spu_callback), ppc); } /* register for save states */ @@ -403,7 +403,7 @@ void ppccom_reset(powerpc_state *ppc) ppc->dec_zero_cycles = ppc->device->total_cycles(); if (ppc->tb_divisor) { - decrementer_int_callback(ppc->device->machine, ppc, 0); + decrementer_int_callback(ppc->device->machine(), ppc, 0); } } @@ -676,7 +676,7 @@ void ppccom_execute_tlbl(powerpc_state *ppc) int entrynum; /* determine entry number; we use rand() for associativity */ - entrynum = ((address >> 12) & 0x1f) | (ppc->device->machine->rand() & 0x20) | (isitlb ? 0x40 : 0); + entrynum = ((address >> 12) & 0x1f) | (ppc->device->machine().rand() & 0x20) | (isitlb ? 0x40 : 0); /* determine the flags */ flags = VTLB_FLAG_VALID | VTLB_READ_ALLOWED | VTLB_FETCH_ALLOWED; @@ -946,9 +946,9 @@ void ppccom_execute_mtspr(powerpc_state *ppc) case SPR4XX_TCR: ppc->spr[SPR4XX_TCR] = ppc->param1 | (oldval & PPC4XX_TCR_WRC_MASK); if ((oldval ^ ppc->spr[SPR4XX_TCR]) & PPC4XX_TCR_FIE) - ppc4xx_fit_callback(ppc->device->machine, ppc, FALSE); + ppc4xx_fit_callback(ppc->device->machine(), ppc, FALSE); if ((oldval ^ ppc->spr[SPR4XX_TCR]) & PPC4XX_TCR_PIE) - ppc4xx_pit_callback(ppc->device->machine, ppc, FALSE); + ppc4xx_pit_callback(ppc->device->machine(), ppc, FALSE); return; /* timer status register */ @@ -961,7 +961,7 @@ void ppccom_execute_mtspr(powerpc_state *ppc) case SPR4XX_PIT: ppc->spr[SPR4XX_PIT] = ppc->param1; ppc->pit_reload = ppc->param1; - ppc4xx_pit_callback(ppc->device->machine, ppc, FALSE); + ppc4xx_pit_callback(ppc->device->machine(), ppc, FALSE); return; /* timebase */ diff --git a/src/emu/cpu/powerpc/ppcdrc.c b/src/emu/cpu/powerpc/ppcdrc.c index 8aff8c0a62f..ce77712dd12 100644 --- a/src/emu/cpu/powerpc/ppcdrc.c +++ b/src/emu/cpu/powerpc/ppcdrc.c @@ -557,7 +557,7 @@ static void ppcdrc_init(powerpc_flavor flavor, UINT8 cap, int tb_divisor, legacy int regnum; /* allocate enough space for the cache and the core */ - cache = auto_alloc(device->machine, drc_cache(CACHE_SIZE + sizeof(*ppc))); + cache = auto_alloc(device->machine(), drc_cache(CACHE_SIZE + sizeof(*ppc))); /* allocate the core from the near cache */ *(powerpc_state **)device->token() = ppc = (powerpc_state *)cache->alloc_near(sizeof(*ppc)); @@ -578,7 +578,7 @@ static void ppcdrc_init(powerpc_flavor flavor, UINT8 cap, int tb_divisor, legacy flags |= DRCUML_OPTION_LOG_UML; if (LOG_NATIVE) flags |= DRCUML_OPTION_LOG_NATIVE; - ppc->impstate->drcuml = auto_alloc(device->machine, drcuml_state(*device, *cache, flags, 8, 32, 2)); + ppc->impstate->drcuml = auto_alloc(device->machine(), drcuml_state(*device, *cache, flags, 8, 32, 2)); /* add symbols for our stuff */ ppc->impstate->drcuml->symbol_add(&ppc->pc, sizeof(ppc->pc), "pc"); @@ -624,7 +624,7 @@ static void ppcdrc_init(powerpc_flavor flavor, UINT8 cap, int tb_divisor, legacy ppc->impstate->drcuml->symbol_add(&ppc->impstate->fcmp_cr_table, sizeof(ppc->impstate->fcmp_cr_table), "fcmp_cr_table"); /* initialize the front-end helper */ - ppc->impstate->drcfe = auto_alloc(device->machine, ppc_frontend(*ppc, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE)); + ppc->impstate->drcfe = auto_alloc(device->machine(), ppc_frontend(*ppc, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE)); /* initialize the implementation state tables */ memcpy(ppc->impstate->fpmode, fpmode_source, sizeof(fpmode_source)); @@ -716,9 +716,9 @@ static CPU_EXIT( ppcdrc ) ppccom_exit(ppc); /* clean up the DRC */ - auto_free(device->machine, ppc->impstate->drcfe); - auto_free(device->machine, ppc->impstate->drcuml); - auto_free(device->machine, ppc->impstate->cache); + auto_free(device->machine(), ppc->impstate->drcfe); + auto_free(device->machine(), ppc->impstate->drcuml); + auto_free(device->machine(), ppc->impstate->cache); } @@ -1511,7 +1511,7 @@ static void static_generate_memory_accessor(powerpc_state *ppc, int mode, int si UML_AND(block, I0, I0, 0x7fffffff); // and i0,i0,0x7fffffff UML_XOR(block, I0, I0, (mode & MODE_LITTLE_ENDIAN) ? (8 - size) : 0); // xor i0,i0,8-size - if ((ppc->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((ppc->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) for (ramnum = 0; ramnum < PPC_MAX_FASTRAM; ramnum++) if (ppc->impstate->fastram[ramnum].base != NULL && (!iswrite || !ppc->impstate->fastram[ramnum].readonly)) { @@ -2127,7 +2127,7 @@ static void generate_sequence_instruction(powerpc_state *ppc, drcuml_block *bloc } /* if we are debugging, call the debugger */ - if ((ppc->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((ppc->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) { UML_MOV(block, mem(&ppc->pc), desc->pc); // mov [pc],desc->pc save_fast_iregs(ppc, block); // <save fastregs> diff --git a/src/emu/cpu/rsp/rsp.c b/src/emu/cpu/rsp/rsp.c index a756842f2f8..1a9bd158f6e 100644 --- a/src/emu/cpu/rsp/rsp.c +++ b/src/emu/cpu/rsp/rsp.c @@ -207,7 +207,7 @@ static void set_cop0_reg(rsp_state *rsp, int reg, UINT32 data) static void unimplemented_opcode(rsp_state *rsp, UINT32 op) { - if ((rsp->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((rsp->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) { char string[200]; rsp_dasm_one(string, rsp->ppc, op); @@ -303,7 +303,7 @@ static CPU_INIT( rsp ) #endif // ...except for the accumulators. - // We're not calling machine->rand() because initializing something with machine->rand() + // We're not calling machine.rand() because initializing something with machine.rand() // makes me retch uncontrollably. for(accumIdx = 0; accumIdx < 8; accumIdx++ ) { diff --git a/src/emu/cpu/rsp/rspdrc.c b/src/emu/cpu/rsp/rspdrc.c index 9c7b2295355..f41d462b3a5 100644 --- a/src/emu/cpu/rsp/rspdrc.c +++ b/src/emu/cpu/rsp/rspdrc.c @@ -496,7 +496,7 @@ static void cfunc_unimplemented_opcode(void *param) { rsp_state *rsp = (rsp_state*)param; int op = rsp->impstate->arg0; - if ((rsp->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((rsp->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) { char string[200]; rsp_dasm_one(string, rsp->ppc, op); @@ -508,7 +508,7 @@ static void cfunc_unimplemented_opcode(void *param) static void unimplemented_opcode(rsp_state *rsp, UINT32 op) { - if ((rsp->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((rsp->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) { char string[200]; rsp_dasm_one(string, rsp->ppc, op); @@ -612,7 +612,7 @@ static CPU_INIT( rsp ) //int elnum; /* allocate enough space for the cache and the core */ - cache = auto_alloc(device->machine, drc_cache(CACHE_SIZE + sizeof(*rsp))); + cache = auto_alloc(device->machine(), drc_cache(CACHE_SIZE + sizeof(*rsp))); /* allocate the core memory */ *(rsp_state **)device->token() = rsp = (rsp_state *)cache->alloc_near(sizeof(*rsp)); @@ -638,7 +638,7 @@ static CPU_INIT( rsp ) { flags |= DRCUML_OPTION_LOG_NATIVE; } - rsp->impstate->drcuml = auto_alloc(device->machine, drcuml_state(*device, *cache, flags, 8, 32, 2)); + rsp->impstate->drcuml = auto_alloc(device->machine(), drcuml_state(*device, *cache, flags, 8, 32, 2)); /* add symbols for our stuff */ rsp->impstate->drcuml->symbol_add(&rsp->pc, sizeof(rsp->pc), "pc"); @@ -656,7 +656,7 @@ static CPU_INIT( rsp ) rsp->impstate->drcuml->symbol_add(&rsp->impstate->numcycles, sizeof(rsp->impstate->numcycles), "numcycles"); /* initialize the front-end helper */ - rsp->impstate->drcfe = auto_alloc(device->machine, rsp_frontend(*rsp, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE)); + rsp->impstate->drcfe = auto_alloc(device->machine(), rsp_frontend(*rsp, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE)); /* compute the register parameters */ for (regnum = 0; regnum < 32; regnum++) @@ -696,9 +696,9 @@ static CPU_EXIT( rsp ) rsp_state *rsp = get_safe_token(device); /* clean up the DRC */ - auto_free(device->machine, rsp->impstate->drcfe); - auto_free(device->machine, rsp->impstate->drcuml); - auto_free(device->machine, rsp->impstate->cache); + auto_free(device->machine(), rsp->impstate->drcfe); + auto_free(device->machine(), rsp->impstate->drcuml); + auto_free(device->machine(), rsp->impstate->cache); } @@ -3817,7 +3817,7 @@ static void generate_sequence_instruction(rsp_state *rsp, drcuml_block *block, c UML_MAPVAR(block, MAPVAR_CYCLES, compiler->cycles); // mapvar CYCLES,compiler->cycles /* if we are debugging, call the debugger */ - if ((rsp->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((rsp->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) { UML_MOV(block, mem(&rsp->pc), desc->pc); // mov [pc],desc->pc save_fast_iregs(rsp, block); diff --git a/src/emu/cpu/sc61860/sc61860.c b/src/emu/cpu/sc61860/sc61860.c index ce2e0951626..edf585abc8f 100644 --- a/src/emu/cpu/sc61860/sc61860.c +++ b/src/emu/cpu/sc61860/sc61860.c @@ -104,7 +104,7 @@ static CPU_INIT( sc61860 ) { sc61860_state *cpustate = get_safe_token(device); cpustate->config = (sc61860_cpu_core *) device->baseconfig().static_config(); - device->machine->scheduler().timer_pulse(attotime::from_hz(500), FUNC(sc61860_2ms_tick), 0, cpustate); + device->machine().scheduler().timer_pulse(attotime::from_hz(500), FUNC(sc61860_2ms_tick), 0, cpustate); cpustate->device = device; cpustate->program = device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c index 6cd5b690da1..4fcacce823d 100644 --- a/src/emu/cpu/sh2/sh2comn.c +++ b/src/emu/cpu/sh2/sh2comn.c @@ -923,17 +923,17 @@ void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_callb const sh2_cpu_core *conf = (const sh2_cpu_core *)device->baseconfig().static_config(); int i; - sh2->timer = device->machine->scheduler().timer_alloc(FUNC(sh2_timer_callback), sh2); + sh2->timer = device->machine().scheduler().timer_alloc(FUNC(sh2_timer_callback), sh2); sh2->timer->adjust(attotime::never); - sh2->dma_current_active_timer[0] = device->machine->scheduler().timer_alloc(FUNC(sh2_dma_current_active_callback), sh2); + sh2->dma_current_active_timer[0] = device->machine().scheduler().timer_alloc(FUNC(sh2_dma_current_active_callback), sh2); sh2->dma_current_active_timer[0]->adjust(attotime::never); - sh2->dma_current_active_timer[1] = device->machine->scheduler().timer_alloc(FUNC(sh2_dma_current_active_callback), sh2); + sh2->dma_current_active_timer[1] = device->machine().scheduler().timer_alloc(FUNC(sh2_dma_current_active_callback), sh2); sh2->dma_current_active_timer[1]->adjust(attotime::never); - sh2->m = auto_alloc_array(device->machine, UINT32, 0x200/4); + sh2->m = auto_alloc_array(device->machine(), UINT32, 0x200/4); if(conf) { diff --git a/src/emu/cpu/sh2/sh2drc.c b/src/emu/cpu/sh2/sh2drc.c index f1a44969ff4..41bcc49289e 100644 --- a/src/emu/cpu/sh2/sh2drc.c +++ b/src/emu/cpu/sh2/sh2drc.c @@ -8,7 +8,7 @@ Visit http://mamedev.org for licensing and usage restrictions. ST-V status: - colmns97 & stress crash due to SCSP stream->machine getting corrupted. + colmns97 & stress crash due to SCSP stream->machine() getting corrupted. cottonbm w/US bios: run to 60323B4 on master, then MOV insn @ 602f5aa crashes? actually crash on slave @ 6032b38 after above. reading wrong addr for jump vector. @@ -683,7 +683,7 @@ static CPU_INIT( sh2 ) int regnum; /* allocate enough space for the cache and the core */ - cache = auto_alloc(device->machine, drc_cache(CACHE_SIZE + sizeof(sh2_state))); + cache = auto_alloc(device->machine(), drc_cache(CACHE_SIZE + sizeof(sh2_state))); /* allocate the core memory */ *(sh2_state **)device->token() = sh2 = (sh2_state *)cache->alloc_near(sizeof(sh2_state)); @@ -705,7 +705,7 @@ static CPU_INIT( sh2 ) flags |= DRCUML_OPTION_LOG_UML; if (LOG_NATIVE) flags |= DRCUML_OPTION_LOG_NATIVE; - sh2->drcuml = auto_alloc(device->machine, drcuml_state(*device, *cache, flags, 1, 32, 1)); + sh2->drcuml = auto_alloc(device->machine(), drcuml_state(*device, *cache, flags, 1, 32, 1)); /* add symbols for our stuff */ sh2->drcuml->symbol_add(&sh2->pc, sizeof(sh2->pc), "pc"); @@ -724,7 +724,7 @@ static CPU_INIT( sh2 ) sh2->drcuml->symbol_add(&sh2->mach, sizeof(sh2->macl), "mach"); /* initialize the front-end helper */ - sh2->drcfe = auto_alloc(device->machine, sh2_frontend(*sh2, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE)); + sh2->drcfe = auto_alloc(device->machine(), sh2_frontend(*sh2, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE)); /* compute the register parameters */ for (regnum = 0; regnum < 16; regnum++) @@ -764,9 +764,9 @@ static CPU_EXIT( sh2 ) sh2_state *sh2 = get_safe_token(device); /* clean up the DRC */ - auto_free(device->machine, sh2->drcfe); - auto_free(device->machine, sh2->drcuml); - auto_free(device->machine, sh2->cache); + auto_free(device->machine(), sh2->drcfe); + auto_free(device->machine(), sh2->drcuml); + auto_free(device->machine(), sh2->cache); } @@ -1577,7 +1577,7 @@ static void generate_sequence_instruction(sh2_state *sh2, drcuml_block *block, c } /* if we are debugging, call the debugger */ - if ((sh2->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((sh2->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) { UML_MOV(block, mem(&sh2->pc), desc->pc); // mov [pc],desc->pc save_fast_iregs(sh2, block); diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c index d928ae6d633..6d508d9b996 100644 --- a/src/emu/cpu/sh4/sh4.c +++ b/src/emu/cpu/sh4/sh4.c @@ -845,7 +845,7 @@ INLINE void LDCSR(sh4_state *sh4, UINT32 m) UINT32 reg; reg = sh4->r[m]; - if ((sh4->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((sh4->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) sh4_syncronize_register_bank(sh4, (sh4->sr & sRB) >> 29); if ((sh4->r[m] & sRB) != (sh4->sr & sRB)) sh4_change_register_bank(sh4, sh4->r[m] & sRB ? 1 : 0); @@ -873,7 +873,7 @@ UINT32 old; old = sh4->sr; sh4->ea = sh4->r[m]; sh4->sr = RL(sh4, sh4->ea ) & FLAGS; - if ((sh4->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((sh4->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) sh4_syncronize_register_bank(sh4, (old & sRB) >> 29); if ((old & sRB) != (sh4->sr & sRB)) sh4_change_register_bank(sh4, sh4->sr & sRB ? 1 : 0); @@ -1459,7 +1459,7 @@ INLINE void RTE(sh4_state *sh4) { sh4->delay = sh4->pc; sh4->pc = sh4->ea = sh4->spc; - if ((sh4->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((sh4->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) sh4_syncronize_register_bank(sh4, (sh4->sr & sRB) >> 29); if ((sh4->ssr & sRB) != (sh4->sr & sRB)) sh4_change_register_bank(sh4, sh4->ssr & sRB ? 1 : 0); @@ -1750,7 +1750,7 @@ INLINE void TRAPA(sh4_state *sh4, UINT32 i) sh4->sgr = sh4->r[15]; sh4->sr |= MD; - if ((sh4->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((sh4->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) sh4_syncronize_register_bank(sh4, (sh4->sr & sRB) >> 29); if (!(sh4->sr & sRB)) sh4_change_register_bank(sh4, 1); @@ -3196,7 +3196,7 @@ INLINE void op1111(sh4_state *sh4, UINT16 opcode) FRCHG(sh4); break; default: - debugger_break(sh4->device->machine); + debugger_break(sh4->device->machine()); break; } } else { @@ -3207,7 +3207,7 @@ INLINE void op1111(sh4_state *sh4, UINT16 opcode) } break; default: - debugger_break(sh4->device->machine); + debugger_break(sh4->device->machine()); break; } break; @@ -3215,7 +3215,7 @@ INLINE void op1111(sh4_state *sh4, UINT16 opcode) FMAC(sh4, Rm,Rn); break; default: - debugger_break(sh4->device->machine); + debugger_break(sh4->device->machine()); break; } } diff --git a/src/emu/cpu/sh4/sh4comn.c b/src/emu/cpu/sh4/sh4comn.c index f6df416911c..e24742e9f28 100644 --- a/src/emu/cpu/sh4/sh4comn.c +++ b/src/emu/cpu/sh4/sh4comn.c @@ -193,7 +193,7 @@ void sh4_exception(sh4_state *sh4, const char *message, int exception) // handle sh4->sgr = sh4->r[15]; sh4->sr |= MD; - if ((sh4->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((sh4->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) sh4_syncronize_register_bank(sh4, (sh4->sr & sRB) >> 29); if (!(sh4->sr & sRB)) sh4_change_register_bank(sh4, 1); @@ -1160,24 +1160,24 @@ void sh4_common_init(device_t *device) for (i=0; i<3; i++) { - sh4->timer[i] = device->machine->scheduler().timer_alloc(FUNC(sh4_timer_callback), sh4); + sh4->timer[i] = device->machine().scheduler().timer_alloc(FUNC(sh4_timer_callback), sh4); sh4->timer[i]->adjust(attotime::never, i); } for (i=0; i<4; i++) { - sh4->dma_timer[i] = device->machine->scheduler().timer_alloc(FUNC(sh4_dmac_callback), sh4); + sh4->dma_timer[i] = device->machine().scheduler().timer_alloc(FUNC(sh4_dmac_callback), sh4); sh4->dma_timer[i]->adjust(attotime::never, i); } - sh4->refresh_timer = device->machine->scheduler().timer_alloc(FUNC(sh4_refresh_timer_callback), sh4); + sh4->refresh_timer = device->machine().scheduler().timer_alloc(FUNC(sh4_refresh_timer_callback), sh4); sh4->refresh_timer->adjust(attotime::never); sh4->refresh_timer_base = 0; - sh4->rtc_timer = device->machine->scheduler().timer_alloc(FUNC(sh4_rtc_timer_callback), sh4); + sh4->rtc_timer = device->machine().scheduler().timer_alloc(FUNC(sh4_rtc_timer_callback), sh4); sh4->rtc_timer->adjust(attotime::never); - sh4->m = auto_alloc_array(device->machine, UINT32, 16384); + sh4->m = auto_alloc_array(device->machine(), UINT32, 16384); } void sh4_dma_ddt(device_t *device, struct sh4_ddt_dma *s) diff --git a/src/emu/cpu/sharc/sharc.c b/src/emu/cpu/sharc/sharc.c index 5d70fcc2f78..63bd604603f 100644 --- a/src/emu/cpu/sharc/sharc.c +++ b/src/emu/cpu/sharc/sharc.c @@ -430,7 +430,7 @@ static CPU_INIT( sharc ) build_opcode_table(); - cpustate->internal_ram = auto_alloc_array(device->machine, UINT16, 2 * 0x10000); // 2x 128KB + cpustate->internal_ram = auto_alloc_array(device->machine(), UINT16, 2 * 0x10000); // 2x 128KB cpustate->internal_ram_block0 = &cpustate->internal_ram[0]; cpustate->internal_ram_block1 = &cpustate->internal_ram[0x20000/2]; diff --git a/src/emu/cpu/ssem/ssem.c b/src/emu/cpu/ssem/ssem.c index 18d4aa7ead5..22f18c12983 100644 --- a/src/emu/cpu/ssem/ssem.c +++ b/src/emu/cpu/ssem/ssem.c @@ -95,7 +95,7 @@ INLINE void WRITE32(ssem_state *cpustate, UINT32 address, UINT32 data) static void unimplemented_opcode(ssem_state *cpustate, UINT32 op) { - if((cpustate->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if((cpustate->device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) { char string[200]; ssem_dasm_one(string, cpustate->pc-1, op); diff --git a/src/emu/cpu/tlcs90/tlcs90.c b/src/emu/cpu/tlcs90/tlcs90.c index aa38f2009ad..720112a8127 100644 --- a/src/emu/cpu/tlcs90/tlcs90.c +++ b/src/emu/cpu/tlcs90/tlcs90.c @@ -2726,9 +2726,9 @@ static CPU_INIT( t90 ) // Timers for (i = 0; i < 4; i++) - cpustate->timer[i] = device->machine->scheduler().timer_alloc(FUNC(t90_timer_callback), cpustate); + cpustate->timer[i] = device->machine().scheduler().timer_alloc(FUNC(t90_timer_callback), cpustate); - cpustate->timer[4] = device->machine->scheduler().timer_alloc(FUNC(t90_timer4_callback), cpustate); + cpustate->timer[4] = device->machine().scheduler().timer_alloc(FUNC(t90_timer4_callback), cpustate); } static ADDRESS_MAP_START(tmp90840_mem, AS_PROGRAM, 8) diff --git a/src/emu/cpu/tms32025/tms32025.c b/src/emu/cpu/tms32025/tms32025.c index 1c9aa0dd33a..fcaf214431b 100644 --- a/src/emu/cpu/tms32025/tms32025.c +++ b/src/emu/cpu/tms32025/tms32025.c @@ -1719,7 +1719,7 @@ static CPU_INIT( tms32025 ) { tms32025_state *cpustate = get_safe_token(device); - cpustate->intRAM = auto_alloc_array(device->machine, UINT16, 0x800); + cpustate->intRAM = auto_alloc_array(device->machine(), UINT16, 0x800); cpustate->irq_callback = irqcallback; cpustate->device = device; cpustate->program = device->space(AS_PROGRAM); diff --git a/src/emu/cpu/tms32031/32031ops.c b/src/emu/cpu/tms32031/32031ops.c index 9fae72f13cd..4a3654b5c03 100644 --- a/src/emu/cpu/tms32031/32031ops.c +++ b/src/emu/cpu/tms32031/32031ops.c @@ -103,7 +103,7 @@ void tms3203x_device::illegal(UINT32 op) if ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0) { logerror("Illegal op @ %06X: %08X (tbl=%03X)\n", m_pc - 1, op, op >> 21); - debugger_break(machine); + debugger_break(m_machine); } } @@ -120,7 +120,7 @@ inline void tms3203x_device::execute_one() m_icount -= 2; // 2 clocks per cycle m_pc++; #if (TMS_3203X_LOG_OPCODE_USAGE) - if (machine->primary_screen->frame_number() == 2003) + if (machine.primary_screen->frame_number() == 2003) m_hits[op >> 21]++; #endif (this->*s_tms32031ops[op >> 21])(op); diff --git a/src/emu/cpu/tms32031/tms32031.c b/src/emu/cpu/tms32031/tms32031.c index 124a7d81e2a..32e37e8b874 100644 --- a/src/emu/cpu/tms32031/tms32031.c +++ b/src/emu/cpu/tms32031/tms32031.c @@ -178,12 +178,12 @@ device_config *tms32032_device_config::static_alloc_device_config(const machine_ device_t *tms32031_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, tms32031_device(machine, *this)); + return auto_alloc(machine, tms32031_device(machine, *this)); } device_t *tms32032_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, tms32032_device(machine, *this)); + return auto_alloc(machine, tms32032_device(machine, *this)); } @@ -854,7 +854,7 @@ void tms3203x_device::execute_run() { // watch for out-of-range stack pointers if (IREG(TMR_SP) & 0xff000000) - debugger_break(&m_machine); + debugger_break(m_machine); if ((IREG(TMR_ST) & RMFLAG) && m_pc == IREG(TMR_RE) + 1) { if ((INT32)--IREG(TMR_RC) >= 0) diff --git a/src/emu/cpu/tms34010/34010gfx.c b/src/emu/cpu/tms34010/34010gfx.c index 2936d3961bd..73dd70ee972 100644 --- a/src/emu/cpu/tms34010/34010gfx.c +++ b/src/emu/cpu/tms34010/34010gfx.c @@ -11,7 +11,7 @@ #define LOG_GFX_OPS 0 -#define LOGGFX(x) do { if (LOG_GFX_OPS && input_code_pressed(tms->device->machine, KEYCODE_L)) logerror x; } while (0) +#define LOGGFX(x) do { if (LOG_GFX_OPS && input_code_pressed(tms->device->machine(), KEYCODE_L)) logerror x; } while (0) /* Graphics Instructions */ diff --git a/src/emu/cpu/tms34010/34010ops.c b/src/emu/cpu/tms34010/34010ops.c index ab162bfd88c..66d5f8237b4 100644 --- a/src/emu/cpu/tms34010/34010ops.c +++ b/src/emu/cpu/tms34010/34010ops.c @@ -97,7 +97,7 @@ static void unimpl(tms34010_state *tms, UINT16 op) if (tms->pc == 0 || opcode_table[tms->direct->read_decrypted_word(TOBYTE(tms->pc)) >> 4] == unimpl) { device_set_input_line(tms->device, INPUT_LINE_HALT, ASSERT_LINE); - debugger_break(tms->device->machine); + debugger_break(tms->device->machine()); } } diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c index c89895c5066..65b3b9e9ab0 100644 --- a/src/emu/cpu/tms34010/tms34010.c +++ b/src/emu/cpu/tms34010/tms34010.c @@ -630,7 +630,7 @@ static CPU_INIT( tms34010 ) tms->device = device; tms->program = device->space(AS_PROGRAM); tms->direct = &tms->program->direct(); - tms->screen = downcast<screen_device *>(device->machine->device(configdata->screen_tag)); + tms->screen = downcast<screen_device *>(device->machine().device(configdata->screen_tag)); /* set up the state table */ { @@ -652,11 +652,11 @@ static CPU_INIT( tms34010 ) } /* allocate a scanline timer and set it to go off at the start */ - tms->scantimer = device->machine->scheduler().timer_alloc(FUNC(scanline_callback), tms); + tms->scantimer = device->machine().scheduler().timer_alloc(FUNC(scanline_callback), tms); tms->scantimer->adjust(attotime::zero); /* allocate the shiftreg */ - tms->shiftreg = auto_alloc_array(device->machine, UINT16, SHIFTREG_SIZE/2); + tms->shiftreg = auto_alloc_array(device->machine(), UINT16, SHIFTREG_SIZE/2); device->save_item(NAME(tms->pc)); device->save_item(NAME(tms->st)); @@ -669,7 +669,7 @@ static CPU_INIT( tms34010 ) device->save_item(NAME(tms->pixelshift)); device->save_item(NAME(tms->gfxcycles)); device->save_pointer(NAME(&tms->regs[0].reg), ARRAY_LENGTH(tms->regs)); - device->machine->state().register_postload(tms34010_state_postload, tms); + device->machine().state().register_postload(tms34010_state_postload, tms); } static CPU_RESET( tms34010 ) @@ -799,7 +799,7 @@ static CPU_EXECUTE( tms34010 ) /* check interrupts first */ tms->executing = TRUE; check_interrupt(tms); - if ((tms->device->machine->debug_flags & DEBUG_FLAG_ENABLED) == 0) + if ((tms->device->machine().debug_flags & DEBUG_FLAG_ENABLED) == 0) { do { @@ -1080,14 +1080,14 @@ void tms34010_get_display_params(device_t *cpu, tms34010_display_params *params) SCREEN_UPDATE( tms340x0 ) { - pen_t blackpen = get_black_pen(screen->machine); + pen_t blackpen = get_black_pen(screen->machine()); tms34010_display_params params; tms34010_state *tms = NULL; device_t *cpu; int x; /* find the owning CPU */ - for (cpu = screen->machine->m_devicelist.first(); cpu != NULL; cpu = cpu->next()) + for (cpu = screen->machine().m_devicelist.first(); cpu != NULL; cpu = cpu->next()) { device_type type = cpu->type(); if (type == TMS34010 || type == TMS34020) @@ -1200,7 +1200,7 @@ WRITE16_HANDLER( tms34010_io_register_w ) /* NMI issued? */ if (data & 0x0100) - tms->device->machine->scheduler().synchronize(FUNC(internal_interrupt_callback), 0, tms); + tms->device->machine().scheduler().synchronize(FUNC(internal_interrupt_callback), 0, tms); break; case REG_HSTCTLL: @@ -1235,7 +1235,7 @@ WRITE16_HANDLER( tms34010_io_register_w ) /* input interrupt? (should really be state-based, but the functions don't exist!) */ if (!(oldreg & 0x0008) && (newreg & 0x0008)) - tms->device->machine->scheduler().synchronize(FUNC(internal_interrupt_callback), TMS34010_HI, tms); + tms->device->machine().scheduler().synchronize(FUNC(internal_interrupt_callback), TMS34010_HI, tms); else if ((oldreg & 0x0008) && !(newreg & 0x0008)) IOREG(tms, REG_INTPEND) &= ~TMS34010_HI; break; @@ -1270,7 +1270,7 @@ WRITE16_HANDLER( tms34010_io_register_w ) } // if (LOG_CONTROL_REGS) -// logerror("%s: %s = %04X (%d)\n", tms->device->machine->describe_context(), ioreg_name[offset], IOREG(tms, offset), tms->screen->vpos()); +// logerror("%s: %s = %04X (%d)\n", tms->device->machine().describe_context(), ioreg_name[offset], IOREG(tms, offset), tms->screen->vpos()); } @@ -1307,7 +1307,7 @@ WRITE16_HANDLER( tms34020_io_register_w ) IOREG(tms, offset) = data; // if (LOG_CONTROL_REGS) -// logerror("%s: %s = %04X (%d)\n", device->machine->describe_context(), ioreg020_name[offset], IOREG(tms, offset), tms->screen->vpos()); +// logerror("%s: %s = %04X (%d)\n", device->machine().describe_context(), ioreg020_name[offset], IOREG(tms, offset), tms->screen->vpos()); switch (offset) { @@ -1351,7 +1351,7 @@ WRITE16_HANDLER( tms34020_io_register_w ) /* NMI issued? */ if (data & 0x0100) - tms->device->machine->scheduler().synchronize(FUNC(internal_interrupt_callback), 0, tms); + tms->device->machine().scheduler().synchronize(FUNC(internal_interrupt_callback), 0, tms); break; case REG020_HSTCTLL: @@ -1386,7 +1386,7 @@ WRITE16_HANDLER( tms34020_io_register_w ) /* input interrupt? (should really be state-based, but the functions don't exist!) */ if (!(oldreg & 0x0008) && (newreg & 0x0008)) - tms->device->machine->scheduler().synchronize(FUNC(internal_interrupt_callback), TMS34010_HI, tms); + tms->device->machine().scheduler().synchronize(FUNC(internal_interrupt_callback), TMS34010_HI, tms); else if ((oldreg & 0x0008) && !(newreg & 0x0008)) IOREG(tms, REG020_INTPEND) &= ~TMS34010_HI; break; @@ -1466,7 +1466,7 @@ READ16_HANDLER( tms34010_io_register_r ) int result, total; // if (LOG_CONTROL_REGS) -// logerror("%s: read %s\n", device->machine->describe_context(), ioreg_name[offset]); +// logerror("%s: read %s\n", device->machine().describe_context(), ioreg_name[offset]); switch (offset) { @@ -1509,7 +1509,7 @@ READ16_HANDLER( tms34020_io_register_r ) int result, total; // if (LOG_CONTROL_REGS) -// logerror("%s: read %s\n", device->machine->describe_context(), ioreg_name[offset]); +// logerror("%s: read %s\n", device->machine().describe_context(), ioreg_name[offset]); switch (offset) { diff --git a/src/emu/cpu/tms9900/99xxcore.h b/src/emu/cpu/tms9900/99xxcore.h index 31c953c68a1..df8a4714626 100644 --- a/src/emu/cpu/tms9900/99xxcore.h +++ b/src/emu/cpu/tms9900/99xxcore.h @@ -1298,7 +1298,7 @@ static CPU_INIT( tms99xx ) cpustate->io = device->space(AS_IO); #if (TMS99XX_MODEL == TMS9995_ID) - cpustate->timer = device->machine->scheduler().timer_alloc(FUNC(decrementer_callback), cpustate); + cpustate->timer = device->machine().scheduler().timer_alloc(FUNC(decrementer_callback), cpustate); #endif cpustate->idle_callback = param ? param->idle_callback : NULL; @@ -1815,7 +1815,7 @@ static void tms99xx_set_irq_line(tms99xx_state *cpustate, int irqline, int state { /* decrement, then interrupt if reach 0 */ if ((-- cpustate->decrementer_count) == 0) { - decrementer_callback(cpustate->device->machine, cpustate, 0); + decrementer_callback(cpustate->device->machine(), cpustate, 0); cpustate->decrementer_count = cpustate->decrementer_interval; /* reload */ } } diff --git a/src/emu/cpu/upd7725/upd7725.c b/src/emu/cpu/upd7725/upd7725.c index 5922099e680..5856bb50611 100755 --- a/src/emu/cpu/upd7725/upd7725.c +++ b/src/emu/cpu/upd7725/upd7725.c @@ -72,17 +72,17 @@ device_config *upd96050_device_config::static_alloc_device_config(const machine_ device_t *necdsp_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, necdsp_device(machine, *this)); + return auto_alloc(machine, necdsp_device(machine, *this)); } device_t *upd7725_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, upd7725_device(machine, *this)); + return auto_alloc(machine, upd7725_device(machine, *this)); } device_t *upd96050_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, upd96050_device(machine, *this)); + return auto_alloc(machine, upd96050_device(machine, *this)); } //------------------------------------------------- diff --git a/src/emu/cpu/vtlb.c b/src/emu/cpu/vtlb.c index 80a5b9109f7..7cec6b3a90e 100644 --- a/src/emu/cpu/vtlb.c +++ b/src/emu/cpu/vtlb.c @@ -59,7 +59,7 @@ vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries, vtlb_state *vtlb; /* allocate memory for the core structure */ - vtlb = auto_alloc_clear(cpu->machine, vtlb_state); + vtlb = auto_alloc_clear(cpu->machine(), vtlb_state); /* fill in CPU information */ vtlb->cpudevice = downcast<cpu_device *>(cpu); @@ -76,17 +76,17 @@ vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries, assert(vtlb->addrwidth > vtlb->pageshift); /* allocate the entry array */ - vtlb->live = auto_alloc_array_clear(cpu->machine, offs_t, fixed_entries + dynamic_entries); + vtlb->live = auto_alloc_array_clear(cpu->machine(), offs_t, fixed_entries + dynamic_entries); cpu->save_pointer(NAME(vtlb->live), fixed_entries + dynamic_entries, space); /* allocate the lookup table */ - vtlb->table = auto_alloc_array_clear(cpu->machine, vtlb_entry, (size_t) 1 << (vtlb->addrwidth - vtlb->pageshift)); + vtlb->table = auto_alloc_array_clear(cpu->machine(), vtlb_entry, (size_t) 1 << (vtlb->addrwidth - vtlb->pageshift)); cpu->save_pointer(NAME(vtlb->table), 1 << (vtlb->addrwidth - vtlb->pageshift), space); /* allocate the fixed page count array */ if (fixed_entries > 0) { - vtlb->fixedpages = auto_alloc_array_clear(cpu->machine, int, fixed_entries); + vtlb->fixedpages = auto_alloc_array_clear(cpu->machine(), int, fixed_entries); cpu->save_pointer(NAME(vtlb->fixedpages), fixed_entries, space); } return vtlb; @@ -101,16 +101,16 @@ void vtlb_free(vtlb_state *vtlb) { /* free the fixed pages if allocated */ if (vtlb->fixedpages != NULL) - auto_free(vtlb->cpudevice->machine, vtlb->fixedpages); + auto_free(vtlb->cpudevice->machine(), vtlb->fixedpages); /* free the table and array if they exist */ if (vtlb->live != NULL) - auto_free(vtlb->cpudevice->machine, vtlb->live); + auto_free(vtlb->cpudevice->machine(), vtlb->live); if (vtlb->table != NULL) - auto_free(vtlb->cpudevice->machine, vtlb->table); + auto_free(vtlb->cpudevice->machine(), vtlb->table); /* and then the VTLB object itself */ - auto_free(vtlb->cpudevice->machine, vtlb); + auto_free(vtlb->cpudevice->machine(), vtlb); } diff --git a/src/emu/cpu/z180/z180.c b/src/emu/cpu/z180/z180.c index 5f9139ffc78..546cef949c0 100644 --- a/src/emu/cpu/z180/z180.c +++ b/src/emu/cpu/z180/z180.c @@ -1945,8 +1945,8 @@ static CPU_INIT( z180 ) cpustate->daisy.init(device, (const z80_daisy_config *)device->baseconfig().static_config()); cpustate->irq_callback = irqcallback; - SZHVC_add = auto_alloc_array(device->machine, UINT8, 2*256*256); - SZHVC_sub = auto_alloc_array(device->machine, UINT8, 2*256*256); + SZHVC_add = auto_alloc_array(device->machine(), UINT8, 2*256*256); + SZHVC_sub = auto_alloc_array(device->machine(), UINT8, 2*256*256); /* set up the state table */ { diff --git a/src/emu/cpu/z8/z8.c b/src/emu/cpu/z8/z8.c index e25b8f3b24c..444f36b4af2 100644 --- a/src/emu/cpu/z8/z8.c +++ b/src/emu/cpu/z8/z8.c @@ -669,8 +669,8 @@ static CPU_INIT( z8 ) cpustate->io = device->space(AS_IO); /* allocate timers */ - cpustate->t0_timer = device->machine->scheduler().timer_alloc(FUNC(t0_tick), cpustate); - cpustate->t1_timer = device->machine->scheduler().timer_alloc(FUNC(t1_tick), cpustate); + cpustate->t0_timer = device->machine().scheduler().timer_alloc(FUNC(t0_tick), cpustate); + cpustate->t1_timer = device->machine().scheduler().timer_alloc(FUNC(t1_tick), cpustate); /* register for state saving */ device->save_item(NAME(cpustate->pc)); diff --git a/src/emu/cpu/z80/z80daisy.c b/src/emu/cpu/z80/z80daisy.c index 9b789d0e38d..4b50bd12118 100644 --- a/src/emu/cpu/z80/z80daisy.c +++ b/src/emu/cpu/z80/z80daisy.c @@ -95,7 +95,7 @@ void z80_daisy_chain::init(device_t *cpudevice, const z80_daisy_config *daisy) fatalerror("Device '%s' does not implement the z80daisy interface!", daisy->devname); // append to the end - *tailptr = auto_alloc(cpudevice->machine, daisy_entry(target)); + *tailptr = auto_alloc(cpudevice->machine(), daisy_entry(target)); tailptr = &(*tailptr)->m_next; } } diff --git a/src/emu/crsshair.c b/src/emu/crsshair.c index c2ed06f4233..fbf9700ab83 100644 --- a/src/emu/crsshair.c +++ b/src/emu/crsshair.c @@ -132,8 +132,8 @@ static const rgb_t crosshair_colors[] = ***************************************************************************/ static void crosshair_exit(running_machine &machine); -static void crosshair_load(running_machine *machine, int config_type, xml_data_node *parentnode); -static void crosshair_save(running_machine *machine, int config_type, xml_data_node *parentnode); +static void crosshair_load(running_machine &machine, int config_type, xml_data_node *parentnode); +static void crosshair_save(running_machine &machine, int config_type, xml_data_node *parentnode); static void animate(screen_device &device, void *param, bool vblank_state); @@ -148,7 +148,7 @@ static void animate(screen_device &device, void *param, bool vblank_state); structures for the given player -------------------------------------------------*/ -static void create_bitmap(running_machine *machine, int player) +static void create_bitmap(running_machine &machine, int player) { int x, y; char filename[20]; @@ -156,9 +156,9 @@ static void create_bitmap(running_machine *machine, int player) /* if we have a bitmap and texture for this player, kill it */ global_free(global.bitmap[player]); - machine->render().texture_free(global.texture[player]); + machine.render().texture_free(global.texture[player]); - emu_file crossfile(machine->options().crosshair_path(), OPEN_FLAG_READ); + emu_file crossfile(machine.options().crosshair_path(), OPEN_FLAG_READ); if (global.name[player][0] != 0) { /* look for user specified file */ @@ -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->system().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) @@ -198,7 +198,7 @@ static void create_bitmap(running_machine *machine, int player) } /* create a texture to reference the bitmap */ - global.texture[player] = machine->render().texture_alloc(render_texture::hq_scale); + global.texture[player] = machine.render().texture_alloc(render_texture::hq_scale); global.texture[player]->set_bitmap(global.bitmap[player], NULL, TEXFORMAT_ARGB32); } @@ -208,10 +208,10 @@ static void create_bitmap(running_machine *machine, int player) bitmaps and such -------------------------------------------------*/ -void crosshair_init(running_machine *machine) +void crosshair_init(running_machine &machine) { /* request a callback upon exiting */ - machine->add_notifier(MACHINE_NOTIFY_EXIT, crosshair_exit); + machine.add_notifier(MACHINE_NOTIFY_EXIT, crosshair_exit); /* clear all the globals */ memset(&global, 0, sizeof(global)); @@ -220,7 +220,7 @@ void crosshair_init(running_machine *machine) global.auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT; /* determine who needs crosshairs */ - for (const input_port_config *port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (const input_port_config *port = machine.m_portlist.first(); port != NULL; port = port->next()) for (const input_field_config *field = port->fieldlist; field != NULL; field = field->next) if (field->crossaxis != CROSSHAIR_AXIS_NONE) { @@ -235,7 +235,7 @@ void crosshair_init(running_machine *machine) global.visible[player] = (CROSSHAIR_VISIBILITY_DEFAULT == CROSSHAIR_VISIBILITY_OFF) ? FALSE : TRUE; /* for now, use the main screen */ - global.screen[player] = machine->primary_screen; + global.screen[player] = machine.primary_screen; create_bitmap(machine, player); } @@ -245,8 +245,8 @@ void crosshair_init(running_machine *machine) config_register(machine, "crosshairs", crosshair_load, crosshair_save); /* register the animation callback */ - if (machine->primary_screen != NULL) - machine->primary_screen->register_vblank_callback(animate, NULL); + if (machine.primary_screen != NULL) + machine.primary_screen->register_vblank_callback(animate, NULL); } @@ -274,7 +274,7 @@ static void crosshair_exit(running_machine &machine) if any crosshairs are used -------------------------------------------------*/ -int crosshair_get_usage(running_machine *machine) +int crosshair_get_usage(running_machine &machine) { return global.usage; } @@ -286,7 +286,7 @@ int crosshair_get_usage(running_machine *machine) Note: auto_time is common for all players -------------------------------------------------*/ -void crosshair_get_user_settings(running_machine *machine, UINT8 player, crosshair_user_settings *settings) +void crosshair_get_user_settings(running_machine &machine, UINT8 player, crosshair_user_settings *settings) { settings->auto_time = global.auto_time; settings->used = global.used[player]; @@ -301,7 +301,7 @@ void crosshair_get_user_settings(running_machine *machine, UINT8 player, crossha Note: auto_time is common for all players -------------------------------------------------*/ -void crosshair_set_user_settings(running_machine *machine, UINT8 player, crosshair_user_settings *settings) +void crosshair_set_user_settings(running_machine &machine, UINT8 player, crosshair_user_settings *settings) { int changed = FALSE; @@ -346,7 +346,7 @@ static void animate(screen_device &device, void *param, bool vblank_state) { /* read all the lightgun values */ if (global.used[player]) - input_port_get_crosshair_position(device.machine, player, &global.x[player], &global.y[player]); + input_port_get_crosshair_position(device.machine(), player, &global.x[player], &global.y[player]); /* auto visibility */ if (global.mode[player] == CROSSHAIR_VISIBILITY_AUTO) @@ -405,7 +405,7 @@ void crosshair_render(screen_device &screen) given player's crosshair -------------------------------------------------*/ -void crosshair_set_screen(running_machine *machine, int player, device_t *screen) +void crosshair_set_screen(running_machine &machine, int player, device_t *screen) { global.screen[player] = screen; } @@ -416,7 +416,7 @@ void crosshair_set_screen(running_machine *machine, int player, device_t *screen configuration file -------------------------------------------------*/ -static void crosshair_load(running_machine *machine, int config_type, xml_data_node *parentnode) +static void crosshair_load(running_machine &machine, int config_type, xml_data_node *parentnode) { /* Note: crosshair_load() is only registered if croshairs are used */ @@ -475,7 +475,7 @@ static void crosshair_load(running_machine *machine, int config_type, xml_data_n configuration file -------------------------------------------------*/ -static void crosshair_save(running_machine *machine, int config_type, xml_data_node *parentnode) +static void crosshair_save(running_machine &machine, int config_type, xml_data_node *parentnode) { /* Note: crosshair_save() is only registered if crosshairs are used */ diff --git a/src/emu/crsshair.h b/src/emu/crsshair.h index 92285c7f2db..defbea703d1 100644 --- a/src/emu/crsshair.h +++ b/src/emu/crsshair.h @@ -59,22 +59,22 @@ struct _crosshair_user_settings ***************************************************************************/ /* initializes the crosshair system */ -void crosshair_init(running_machine *machine); +void crosshair_init(running_machine &machine); /* draws crosshair(s) in a given screen, if neccessary */ void crosshair_render(screen_device &screen); /* sets the screen(s) for a given player's crosshair */ -void crosshair_set_screen(running_machine *machine, int player, device_t *screen); +void crosshair_set_screen(running_machine &machine, int player, device_t *screen); /* return TRUE if any crosshairs are used */ -int crosshair_get_usage(running_machine *machine); +int crosshair_get_usage(running_machine &machine); /* return the current crosshair settings for the given player */ -void crosshair_get_user_settings(running_machine *machine, UINT8 player, crosshair_user_settings *settings); +void crosshair_get_user_settings(running_machine &machine, UINT8 player, crosshair_user_settings *settings); /* modify the current crosshair settings for the given player */ -void crosshair_set_user_settings(running_machine *machine, UINT8 player, crosshair_user_settings *settings); +void crosshair_set_user_settings(running_machine &machine, UINT8 player, crosshair_user_settings *settings); #endif /* __CRSSHAIR_H__ */ diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c index 2bd5196eaff..c3e76dd192b 100644 --- a/src/emu/debug/debugcmd.c +++ b/src/emu/debug/debugcmd.c @@ -99,56 +99,56 @@ static UINT64 execute_if(symbol_table &table, void *ref, int params, const UINT6 static UINT64 global_get(symbol_table &table, void *ref); static void global_set(symbol_table &table, void *ref, UINT64 value); -static void execute_help(running_machine *machine, int ref, int params, const char **param); -static void execute_print(running_machine *machine, int ref, int params, const char **param); -static void execute_printf(running_machine *machine, int ref, int params, const char **param); -static void execute_logerror(running_machine *machine, int ref, int params, const char **param); -static void execute_tracelog(running_machine *machine, int ref, int params, const char **param); -static void execute_quit(running_machine *machine, int ref, int params, const char **param); -static void execute_do(running_machine *machine, int ref, int params, const char **param); -static void execute_step(running_machine *machine, int ref, int params, const char **param); -static void execute_over(running_machine *machine, int ref, int params, const char **param); -static void execute_out(running_machine *machine, int ref, int params, const char **param); -static void execute_go(running_machine *machine, int ref, int params, const char **param); -static void execute_go_vblank(running_machine *machine, int ref, int params, const char **param); -static void execute_go_interrupt(running_machine *machine, int ref, int params, const char **param); -static void execute_go_time(running_machine *machine, int ref, int params, const char *param[]); -static void execute_focus(running_machine *machine, int ref, int params, const char **param); -static void execute_ignore(running_machine *machine, int ref, int params, const char **param); -static void execute_observe(running_machine *machine, int ref, int params, const char **param); -static void execute_next(running_machine *machine, int ref, int params, const char **param); -static void execute_comment(running_machine *machine, int ref, int params, const char **param); -static void execute_comment_del(running_machine *machine, int ref, int params, const char **param); -static void execute_comment_save(running_machine *machine, int ref, int params, const char **param); -static void execute_bpset(running_machine *machine, int ref, int params, const char **param); -static void execute_bpclear(running_machine *machine, int ref, int params, const char **param); -static void execute_bpdisenable(running_machine *machine, int ref, int params, const char **param); -static void execute_bplist(running_machine *machine, int ref, int params, const char **param); -static void execute_wpset(running_machine *machine, int ref, int params, const char **param); -static void execute_wpclear(running_machine *machine, int ref, int params, const char **param); -static void execute_wpdisenable(running_machine *machine, int ref, int params, const char **param); -static void execute_wplist(running_machine *machine, int ref, int params, const char **param); -static void execute_hotspot(running_machine *machine, int ref, int params, const char **param); -static void execute_save(running_machine *machine, int ref, int params, const char **param); -static void execute_load(running_machine *machine, int ref, int params, const char **param); -static void execute_dump(running_machine *machine, int ref, int params, const char **param); -static void execute_cheatinit(running_machine *machine, int ref, int params, const char **param); -static void execute_cheatnext(running_machine *machine, int ref, int params, const char **param); -static void execute_cheatlist(running_machine *machine, int ref, int params, const char **param); -static void execute_cheatundo(running_machine *machine, int ref, int params, const char **param); -static void execute_dasm(running_machine *machine, int ref, int params, const char **param); -static void execute_find(running_machine *machine, int ref, int params, const char **param); -static void execute_trace(running_machine *machine, int ref, int params, const char **param); -static void execute_traceover(running_machine *machine, int ref, int params, const char **param); -static void execute_traceflush(running_machine *machine, int ref, int params, const char **param); -static void execute_history(running_machine *machine, int ref, int params, const char **param); -static void execute_snap(running_machine *machine, int ref, int params, const char **param); -static void execute_source(running_machine *machine, int ref, int params, const char **param); -static void execute_map(running_machine *machine, int ref, int params, const char **param); -static void execute_memdump(running_machine *machine, int ref, int params, const char **param); -static void execute_symlist(running_machine *machine, int ref, int params, const char **param); -static void execute_softreset(running_machine *machine, int ref, int params, const char **param); -static void execute_hardreset(running_machine *machine, int ref, int params, const char **param); +static void execute_help(running_machine &machine, int ref, int params, const char **param); +static void execute_print(running_machine &machine, int ref, int params, const char **param); +static void execute_printf(running_machine &machine, int ref, int params, const char **param); +static void execute_logerror(running_machine &machine, int ref, int params, const char **param); +static void execute_tracelog(running_machine &machine, int ref, int params, const char **param); +static void execute_quit(running_machine &machine, int ref, int params, const char **param); +static void execute_do(running_machine &machine, int ref, int params, const char **param); +static void execute_step(running_machine &machine, int ref, int params, const char **param); +static void execute_over(running_machine &machine, int ref, int params, const char **param); +static void execute_out(running_machine &machine, int ref, int params, const char **param); +static void execute_go(running_machine &machine, int ref, int params, const char **param); +static void execute_go_vblank(running_machine &machine, int ref, int params, const char **param); +static void execute_go_interrupt(running_machine &machine, int ref, int params, const char **param); +static void execute_go_time(running_machine &machine, int ref, int params, const char *param[]); +static void execute_focus(running_machine &machine, int ref, int params, const char **param); +static void execute_ignore(running_machine &machine, int ref, int params, const char **param); +static void execute_observe(running_machine &machine, int ref, int params, const char **param); +static void execute_next(running_machine &machine, int ref, int params, const char **param); +static void execute_comment(running_machine &machine, int ref, int params, const char **param); +static void execute_comment_del(running_machine &machine, int ref, int params, const char **param); +static void execute_comment_save(running_machine &machine, int ref, int params, const char **param); +static void execute_bpset(running_machine &machine, int ref, int params, const char **param); +static void execute_bpclear(running_machine &machine, int ref, int params, const char **param); +static void execute_bpdisenable(running_machine &machine, int ref, int params, const char **param); +static void execute_bplist(running_machine &machine, int ref, int params, const char **param); +static void execute_wpset(running_machine &machine, int ref, int params, const char **param); +static void execute_wpclear(running_machine &machine, int ref, int params, const char **param); +static void execute_wpdisenable(running_machine &machine, int ref, int params, const char **param); +static void execute_wplist(running_machine &machine, int ref, int params, const char **param); +static void execute_hotspot(running_machine &machine, int ref, int params, const char **param); +static void execute_save(running_machine &machine, int ref, int params, const char **param); +static void execute_load(running_machine &machine, int ref, int params, const char **param); +static void execute_dump(running_machine &machine, int ref, int params, const char **param); +static void execute_cheatinit(running_machine &machine, int ref, int params, const char **param); +static void execute_cheatnext(running_machine &machine, int ref, int params, const char **param); +static void execute_cheatlist(running_machine &machine, int ref, int params, const char **param); +static void execute_cheatundo(running_machine &machine, int ref, int params, const char **param); +static void execute_dasm(running_machine &machine, int ref, int params, const char **param); +static void execute_find(running_machine &machine, int ref, int params, const char **param); +static void execute_trace(running_machine &machine, int ref, int params, const char **param); +static void execute_traceover(running_machine &machine, int ref, int params, const char **param); +static void execute_traceflush(running_machine &machine, int ref, int params, const char **param); +static void execute_history(running_machine &machine, int ref, int params, const char **param); +static void execute_snap(running_machine &machine, int ref, int params, const char **param); +static void execute_source(running_machine &machine, int ref, int params, const char **param); +static void execute_map(running_machine &machine, int ref, int params, const char **param); +static void execute_memdump(running_machine &machine, int ref, int params, const char **param); +static void execute_symlist(running_machine &machine, int ref, int params, const char **param); +static void execute_softreset(running_machine &machine, int ref, int params, const char **param); +static void execute_hardreset(running_machine &machine, int ref, int params, const char **param); @@ -226,7 +226,7 @@ INLINE UINT64 cheat_read_extended(const cheat_system *cheatsys, address_space *s system -------------------------------------------------*/ -void debug_command_init(running_machine *machine) +void debug_command_init(running_machine &machine) { symbol_table *symtable = debug_cpu_get_global_symtable(machine); const char *name; @@ -244,7 +244,7 @@ void debug_command_init(running_machine *machine) void *base; /* stop when we run out of items */ - name = machine->state().indexed_item(itemnum, base, valsize, valcount); + name = machine.state().indexed_item(itemnum, base, valsize, valcount); if (name == NULL) break; @@ -369,10 +369,10 @@ void debug_command_init(running_machine *machine) debug_console_register_command(machine, "softreset", CMDFLAG_NONE, 0, 0, 1, execute_softreset); debug_console_register_command(machine, "hardreset", CMDFLAG_NONE, 0, 0, 1, execute_hardreset); - machine->add_notifier(MACHINE_NOTIFY_EXIT, debug_command_exit); + machine.add_notifier(MACHINE_NOTIFY_EXIT, debug_command_exit); /* set up the initial debugscript if specified */ - name = machine->options().debug_script(); + name = machine.options().debug_script(); if (name[0] != 0) debug_cpu_source_script(machine, name); } @@ -389,7 +389,7 @@ static void debug_command_exit(running_machine &machine) device->debug()->trace(NULL, 0, NULL); if (cheat.length) - auto_free(&machine, cheat.cheatmap); + auto_free(machine, cheat.cheatmap); } @@ -478,7 +478,7 @@ static void global_set(symbol_table &table, void *ref, UINT64 value) number parameter -------------------------------------------------*/ -int debug_command_parameter_number(running_machine *machine, const char *param, UINT64 *result) +int debug_command_parameter_number(running_machine &machine, const char *param, UINT64 *result) { /* NULL parameter does nothing and returns no error */ if (param == NULL) @@ -506,7 +506,7 @@ int debug_command_parameter_number(running_machine *machine, const char *param, parameter as a cpu -------------------------------------------------*/ -int debug_command_parameter_cpu(running_machine *machine, const char *param, device_t **result) +int debug_command_parameter_cpu(running_machine &machine, const char *param, device_t **result) { UINT64 cpunum; @@ -523,7 +523,7 @@ int debug_command_parameter_cpu(running_machine *machine, const char *param, dev } /* first look for a tag match */ - *result = machine->device(param); + *result = machine.device(param); if (*result != NULL) return TRUE; @@ -540,7 +540,7 @@ int debug_command_parameter_cpu(running_machine *machine, const char *param, dev /* if we got a valid one, return */ device_execute_interface *exec = NULL; - for (bool gotone = machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) + for (bool gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec)) if (cpunum-- == 0) { *result = &exec->device(); @@ -559,7 +559,7 @@ int debug_command_parameter_cpu(running_machine *machine, const char *param, dev address space -------------------------------------------------*/ -int debug_command_parameter_cpu_space(running_machine *machine, const char *param, int spacenum, address_space **result) +int debug_command_parameter_cpu_space(running_machine &machine, const char *param, int spacenum, address_space **result) { device_t *cpu; @@ -583,7 +583,7 @@ int debug_command_parameter_cpu_space(running_machine *machine, const char *para an expression parameter -------------------------------------------------*/ -static int debug_command_parameter_expression(running_machine *machine, const char *param, parsed_expression &result) +static int debug_command_parameter_expression(running_machine &machine, const char *param, parsed_expression &result) { /* NULL parameter does nothing and returns no error */ if (param == NULL) @@ -611,7 +611,7 @@ static int debug_command_parameter_expression(running_machine *machine, const ch command parameter -------------------------------------------------*/ -static int debug_command_parameter_command(running_machine *machine, const char *param) +static int debug_command_parameter_command(running_machine &machine, const char *param) { CMDERR err; @@ -641,7 +641,7 @@ static int debug_command_parameter_command(running_machine *machine, const char execute_help - execute the help command -------------------------------------------------*/ -static void execute_help(running_machine *machine, int ref, int params, const char *param[]) +static void execute_help(running_machine &machine, int ref, int params, const char *param[]) { if (params == 0) debug_console_printf_wrap(machine, 80, "%s\n", debug_get_help("")); @@ -654,7 +654,7 @@ static void execute_help(running_machine *machine, int ref, int params, const ch execute_print - execute the print command -------------------------------------------------*/ -static void execute_print(running_machine *machine, int ref, int params, const char *param[]) +static void execute_print(running_machine &machine, int ref, int params, const char *param[]) { UINT64 values[MAX_COMMAND_PARAMS]; int i; @@ -675,7 +675,7 @@ static void execute_print(running_machine *machine, int ref, int params, const c mini_printf - safe printf to a buffer -------------------------------------------------*/ -static int mini_printf(running_machine *machine, char *buffer, const char *format, int params, UINT64 *param) +static int mini_printf(running_machine &machine, char *buffer, const char *format, int params, UINT64 *param) { const char *f = format; char *p = buffer; @@ -769,7 +769,7 @@ static int mini_printf(running_machine *machine, char *buffer, const char *forma execute_printf - execute the printf command -------------------------------------------------*/ -static void execute_printf(running_machine *machine, int ref, int params, const char *param[]) +static void execute_printf(running_machine &machine, int ref, int params, const char *param[]) { UINT64 values[MAX_COMMAND_PARAMS]; char buffer[1024]; @@ -790,7 +790,7 @@ static void execute_printf(running_machine *machine, int ref, int params, const execute_logerror - execute the logerror command -------------------------------------------------*/ -static void execute_logerror(running_machine *machine, int ref, int params, const char *param[]) +static void execute_logerror(running_machine &machine, int ref, int params, const char *param[]) { UINT64 values[MAX_COMMAND_PARAMS]; char buffer[1024]; @@ -811,7 +811,7 @@ static void execute_logerror(running_machine *machine, int ref, int params, cons execute_tracelog - execute the tracelog command -------------------------------------------------*/ -static void execute_tracelog(running_machine *machine, int ref, int params, const char *param[]) +static void execute_tracelog(running_machine &machine, int ref, int params, const char *param[]) { UINT64 values[MAX_COMMAND_PARAMS]; char buffer[1024]; @@ -832,10 +832,10 @@ static void execute_tracelog(running_machine *machine, int ref, int params, cons execute_quit - execute the quit command -------------------------------------------------*/ -static void execute_quit(running_machine *machine, int ref, int params, const char *param[]) +static void execute_quit(running_machine &machine, int ref, int params, const char *param[]) { mame_printf_error("Exited via the debugger\n"); - machine->schedule_exit(); + machine.schedule_exit(); } @@ -843,7 +843,7 @@ static void execute_quit(running_machine *machine, int ref, int params, const ch execute_do - execute the do command -------------------------------------------------*/ -static void execute_do(running_machine *machine, int ref, int params, const char *param[]) +static void execute_do(running_machine &machine, int ref, int params, const char *param[]) { UINT64 dummy; debug_command_parameter_number(machine, param[0], &dummy); @@ -854,7 +854,7 @@ static void execute_do(running_machine *machine, int ref, int params, const char execute_step - execute the step command -------------------------------------------------*/ -static void execute_step(running_machine *machine, int ref, int params, const char *param[]) +static void execute_step(running_machine &machine, int ref, int params, const char *param[]) { UINT64 steps = 1; @@ -870,7 +870,7 @@ static void execute_step(running_machine *machine, int ref, int params, const ch execute_over - execute the over command -------------------------------------------------*/ -static void execute_over(running_machine *machine, int ref, int params, const char *param[]) +static void execute_over(running_machine &machine, int ref, int params, const char *param[]) { UINT64 steps = 1; @@ -886,7 +886,7 @@ static void execute_over(running_machine *machine, int ref, int params, const ch execute_out - execute the out command -------------------------------------------------*/ -static void execute_out(running_machine *machine, int ref, int params, const char *param[]) +static void execute_out(running_machine &machine, int ref, int params, const char *param[]) { debug_cpu_get_visible_cpu(machine)->debug()->single_step_out(); } @@ -896,7 +896,7 @@ static void execute_out(running_machine *machine, int ref, int params, const cha execute_go - execute the go command -------------------------------------------------*/ -static void execute_go(running_machine *machine, int ref, int params, const char *param[]) +static void execute_go(running_machine &machine, int ref, int params, const char *param[]) { UINT64 addr = ~0; @@ -913,7 +913,7 @@ static void execute_go(running_machine *machine, int ref, int params, const char command -------------------------------------------------*/ -static void execute_go_vblank(running_machine *machine, int ref, int params, const char *param[]) +static void execute_go_vblank(running_machine &machine, int ref, int params, const char *param[]) { debug_cpu_get_visible_cpu(machine)->debug()->go_vblank(); } @@ -923,7 +923,7 @@ static void execute_go_vblank(running_machine *machine, int ref, int params, con execute_go_interrupt - execute the goint command -------------------------------------------------*/ -static void execute_go_interrupt(running_machine *machine, int ref, int params, const char *param[]) +static void execute_go_interrupt(running_machine &machine, int ref, int params, const char *param[]) { UINT64 irqline = -1; @@ -939,7 +939,7 @@ static void execute_go_interrupt(running_machine *machine, int ref, int params, execute_go_time - execute the gtime command -------------------------------------------------*/ -static void execute_go_time(running_machine *machine, int ref, int params, const char *param[]) +static void execute_go_time(running_machine &machine, int ref, int params, const char *param[]) { UINT64 milliseconds = -1; @@ -955,7 +955,7 @@ static void execute_go_time(running_machine *machine, int ref, int params, const execute_next - execute the next command -------------------------------------------------*/ -static void execute_next(running_machine *machine, int ref, int params, const char *param[]) +static void execute_next(running_machine &machine, int ref, int params, const char *param[]) { debug_cpu_get_visible_cpu(machine)->debug()->go_next_device(); } @@ -965,7 +965,7 @@ static void execute_next(running_machine *machine, int ref, int params, const ch execute_focus - execute the focus command -------------------------------------------------*/ -static void execute_focus(running_machine *machine, int ref, int params, const char *param[]) +static void execute_focus(running_machine &machine, int ref, int params, const char *param[]) { /* validate params */ device_t *cpu; @@ -977,7 +977,7 @@ static void execute_focus(running_machine *machine, int ref, int params, const c /* then loop over CPUs and set the ignore flags on all other CPUs */ device_execute_interface *exec = NULL; - for (bool gotone = machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) + for (bool gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec)) if (&exec->device() != cpu) exec->device().debug()->ignore(true); debug_console_printf(machine, "Now focused on CPU '%s'\n", cpu->tag()); @@ -988,7 +988,7 @@ static void execute_focus(running_machine *machine, int ref, int params, const c execute_ignore - execute the ignore command -------------------------------------------------*/ -static void execute_ignore(running_machine *machine, int ref, int params, const char *param[]) +static void execute_ignore(running_machine &machine, int ref, int params, const char *param[]) { /* if there are no parameters, dump the ignore list */ if (params == 0) @@ -997,7 +997,7 @@ static void execute_ignore(running_machine *machine, int ref, int params, const /* loop over all executable devices */ device_execute_interface *exec = NULL; - for (bool gotone = machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) + for (bool gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec)) /* build up a comma-separated list */ if (!exec->device().debug()->observing()) @@ -1030,7 +1030,7 @@ static void execute_ignore(running_machine *machine, int ref, int params, const /* make sure this isn't the last live CPU */ device_execute_interface *exec = NULL; bool gotone; - for (gotone = machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) + for (gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec)) if (&exec->device() != devicelist[paramnum] && exec->device().debug()->observing()) break; if (!gotone) @@ -1050,7 +1050,7 @@ static void execute_ignore(running_machine *machine, int ref, int params, const execute_observe - execute the observe command -------------------------------------------------*/ -static void execute_observe(running_machine *machine, int ref, int params, const char *param[]) +static void execute_observe(running_machine &machine, int ref, int params, const char *param[]) { /* if there are no parameters, dump the ignore list */ if (params == 0) @@ -1059,7 +1059,7 @@ static void execute_observe(running_machine *machine, int ref, int params, const /* loop over all executable devices */ device_execute_interface *exec = NULL; - for (bool gotone = machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) + for (bool gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec)) /* build up a comma-separated list */ if (exec->device().debug()->observing()) @@ -1100,7 +1100,7 @@ static void execute_observe(running_machine *machine, int ref, int params, const execute_comment - add a comment to a line -------------------------------------------------*/ -static void execute_comment(running_machine *machine, int ref, int params, const char *param[]) +static void execute_comment(running_machine &machine, int ref, int params, const char *param[]) { device_t *cpu; UINT64 address; @@ -1122,7 +1122,7 @@ static void execute_comment(running_machine *machine, int ref, int params, const /* Now try adding the comment */ cpu->debug()->comment_add(address, param[1], 0x00ff0000); - cpu->machine->debug_view().update_all(DVT_DISASSEMBLY); + cpu->machine().debug_view().update_all(DVT_DISASSEMBLY); } @@ -1130,7 +1130,7 @@ static void execute_comment(running_machine *machine, int ref, int params, const execute_comment_del - remove a comment from an addr --------------------------------------------------------*/ -static void execute_comment_del(running_machine *machine, int ref, int params, const char *param[]) +static void execute_comment_del(running_machine &machine, int ref, int params, const char *param[]) { device_t *cpu; UINT64 address; @@ -1146,7 +1146,7 @@ static void execute_comment_del(running_machine *machine, int ref, int params, c /* If it's a number, it must be an address */ /* The bankoff and cbn will be pulled from what's currently active */ cpu->debug()->comment_remove(address); - cpu->machine->debug_view().update_all(DVT_DISASSEMBLY); + cpu->machine().debug_view().update_all(DVT_DISASSEMBLY); } @@ -1154,7 +1154,7 @@ static void execute_comment_del(running_machine *machine, int ref, int params, c execute_comment - add a comment to a line -------------------------------------------------*/ -static void execute_comment_save(running_machine *machine, int ref, int params, const char *param[]) +static void execute_comment_save(running_machine &machine, int ref, int params, const char *param[]) { if (debug_comment_save(machine)) debug_console_printf(machine, "Comments successfully saved\n"); @@ -1166,7 +1166,7 @@ static void execute_comment_save(running_machine *machine, int ref, int params, command -------------------------------------------------*/ -static void execute_bpset(running_machine *machine, int ref, int params, const char *param[]) +static void execute_bpset(running_machine &machine, int ref, int params, const char *param[]) { device_t *cpu; const char *action = NULL; @@ -1201,14 +1201,14 @@ static void execute_bpset(running_machine *machine, int ref, int params, const c clear command -------------------------------------------------*/ -static void execute_bpclear(running_machine *machine, int ref, int params, const char *param[]) +static void execute_bpclear(running_machine &machine, int ref, int params, const char *param[]) { UINT64 bpindex; /* if 0 parameters, clear all */ if (params == 0) { - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) device->debug()->breakpoint_clear_all(); debug_console_printf(machine, "Cleared all breakpoints\n"); } @@ -1219,7 +1219,7 @@ static void execute_bpclear(running_machine *machine, int ref, int params, const else { bool found = false; - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) if (device->debug()->breakpoint_clear(bpindex)) found = true; if (found) @@ -1235,14 +1235,14 @@ static void execute_bpclear(running_machine *machine, int ref, int params, const disable/enable commands -------------------------------------------------*/ -static void execute_bpdisenable(running_machine *machine, int ref, int params, const char *param[]) +static void execute_bpdisenable(running_machine &machine, int ref, int params, const char *param[]) { UINT64 bpindex; /* if 0 parameters, clear all */ if (params == 0) { - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) device->debug()->breakpoint_enable_all(ref); if (ref == 0) debug_console_printf(machine, "Disabled all breakpoints\n"); @@ -1256,7 +1256,7 @@ static void execute_bpdisenable(running_machine *machine, int ref, int params, c else { bool found = false; - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) if (device->debug()->breakpoint_enable(bpindex, ref)) found = true; if (found) @@ -1272,13 +1272,13 @@ static void execute_bpdisenable(running_machine *machine, int ref, int params, c command -------------------------------------------------*/ -static void execute_bplist(running_machine *machine, int ref, int params, const char *param[]) +static void execute_bplist(running_machine &machine, int ref, int params, const char *param[]) { int printed = 0; astring buffer; /* loop over all CPUs */ - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) if (device->debug()->breakpoint_first() != NULL) { debug_console_printf(machine, "Device '%s' breakpoints:\n", device->tag()); @@ -1306,7 +1306,7 @@ static void execute_bplist(running_machine *machine, int ref, int params, const command -------------------------------------------------*/ -static void execute_wpset(running_machine *machine, int ref, int params, const char *param[]) +static void execute_wpset(running_machine &machine, int ref, int params, const char *param[]) { address_space *space; const char *action = NULL; @@ -1359,14 +1359,14 @@ static void execute_wpset(running_machine *machine, int ref, int params, const c clear command -------------------------------------------------*/ -static void execute_wpclear(running_machine *machine, int ref, int params, const char *param[]) +static void execute_wpclear(running_machine &machine, int ref, int params, const char *param[]) { UINT64 wpindex; /* if 0 parameters, clear all */ if (params == 0) { - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) device->debug()->watchpoint_clear_all(); debug_console_printf(machine, "Cleared all watchpoints\n"); } @@ -1377,7 +1377,7 @@ static void execute_wpclear(running_machine *machine, int ref, int params, const else { bool found = false; - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) if (device->debug()->watchpoint_clear(wpindex)) found = true; if (found) @@ -1393,14 +1393,14 @@ static void execute_wpclear(running_machine *machine, int ref, int params, const disable/enable commands -------------------------------------------------*/ -static void execute_wpdisenable(running_machine *machine, int ref, int params, const char *param[]) +static void execute_wpdisenable(running_machine &machine, int ref, int params, const char *param[]) { UINT64 wpindex; /* if 0 parameters, clear all */ if (params == 0) { - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) device->debug()->watchpoint_enable_all(ref); if (ref == 0) debug_console_printf(machine, "Disabled all watchpoints\n"); @@ -1414,7 +1414,7 @@ static void execute_wpdisenable(running_machine *machine, int ref, int params, c else { bool found = false; - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) if (device->debug()->watchpoint_enable(wpindex, ref)) found = true; if (found) @@ -1430,13 +1430,13 @@ static void execute_wpdisenable(running_machine *machine, int ref, int params, c command -------------------------------------------------*/ -static void execute_wplist(running_machine *machine, int ref, int params, const char *param[]) +static void execute_wplist(running_machine &machine, int ref, int params, const char *param[]) { int printed = 0; astring buffer; /* loop over all CPUs */ - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++) if (device->debug()->watchpoint_first(spacenum) != NULL) { @@ -1470,7 +1470,7 @@ static void execute_wplist(running_machine *machine, int ref, int params, const command -------------------------------------------------*/ -static void execute_hotspot(running_machine *machine, int ref, int params, const char *param[]) +static void execute_hotspot(running_machine &machine, int ref, int params, const char *param[]) { /* if no params, and there are live hotspots, clear them */ if (params == 0) @@ -1478,7 +1478,7 @@ static void execute_hotspot(running_machine *machine, int ref, int params, const bool cleared = false; /* loop over CPUs and find live spots */ - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) if (device->debug()->hotspot_tracking_enabled()) { device->debug()->hotspot_track(0, 0); @@ -1512,7 +1512,7 @@ static void execute_hotspot(running_machine *machine, int ref, int params, const execute_save - execute the save command -------------------------------------------------*/ -static void execute_save(running_machine *machine, int ref, int params, const char *param[]) +static void execute_save(running_machine &machine, int ref, int params, const char *param[]) { UINT64 offset, endoffset, length; address_space *space; @@ -1556,7 +1556,7 @@ static void execute_save(running_machine *machine, int ref, int params, const ch execute_load - execute the load command -------------------------------------------------*/ -static void execute_load(running_machine *machine, int ref, int params, const char *param[]) +static void execute_load(running_machine &machine, int ref, int params, const char *param[]) { UINT64 offset, endoffset, length; address_space *space; @@ -1606,7 +1606,7 @@ static void execute_load(running_machine *machine, int ref, int params, const ch execute_dump - execute the dump command -------------------------------------------------*/ -static void execute_dump(running_machine *machine, int ref, int params, const char *param[]) +static void execute_dump(running_machine &machine, int ref, int params, const char *param[]) { UINT64 offset, endoffset, length, width = 0, ascii = 1; address_space *space; @@ -1704,7 +1704,7 @@ static void execute_dump(running_machine *machine, int ref, int params, const ch execute_cheatinit - initialize the cheat system -------------------------------------------------*/ -static void execute_cheatinit(running_machine *machine, int ref, int params, const char *param[]) +static void execute_cheatinit(running_machine &machine, int ref, int params, const char *param[]) { UINT64 offset, length = 0, real_length = 0; address_space *space; @@ -1867,7 +1867,7 @@ static void execute_cheatinit(running_machine *machine, int ref, int params, con execute_cheatnext - execute the search -------------------------------------------------*/ -static void execute_cheatnext(running_machine *machine, int ref, int params, const char *param[]) +static void execute_cheatnext(running_machine &machine, int ref, int params, const char *param[]) { address_space *space; UINT64 cheatindex; @@ -2044,7 +2044,7 @@ static void execute_cheatnext(running_machine *machine, int ref, int params, con execute_cheatlist - show a list of active cheat -------------------------------------------------*/ -static void execute_cheatlist(running_machine *machine, int ref, int params, const char *param[]) +static void execute_cheatlist(running_machine &machine, int ref, int params, const char *param[]) { char spaceletter, sizeletter; address_space *space; @@ -2110,7 +2110,7 @@ static void execute_cheatlist(running_machine *machine, int ref, int params, con execute_cheatundo - undo the last search -------------------------------------------------*/ -static void execute_cheatundo(running_machine *machine, int ref, int params, const char *param[]) +static void execute_cheatundo(running_machine &machine, int ref, int params, const char *param[]) { UINT64 cheatindex; UINT32 undo_count = 0; @@ -2139,7 +2139,7 @@ static void execute_cheatundo(running_machine *machine, int ref, int params, con execute_find - execute the find command -------------------------------------------------*/ -static void execute_find(running_machine *machine, int ref, int params, const char *param[]) +static void execute_find(running_machine &machine, int ref, int params, const char *param[]) { UINT64 offset, endoffset, length; address_space *space; @@ -2238,7 +2238,7 @@ static void execute_find(running_machine *machine, int ref, int params, const ch execute_dasm - execute the dasm command -------------------------------------------------*/ -static void execute_dasm(running_machine *machine, int ref, int params, const char *param[]) +static void execute_dasm(running_machine &machine, int ref, int params, const char *param[]) { UINT64 offset, length, bytes = 1; int minbytes, maxbytes, byteswidth; @@ -2353,7 +2353,7 @@ static void execute_dasm(running_machine *machine, int ref, int params, const ch trace over and trace info -------------------------------------------------*/ -static void execute_trace_internal(running_machine *machine, int ref, int params, const char *param[], int trace_over) +static void execute_trace_internal(running_machine &machine, int ref, int params, const char *param[], int trace_over) { const char *action = NULL, *filename = param[0]; device_t *cpu; @@ -2403,7 +2403,7 @@ static void execute_trace_internal(running_machine *machine, int ref, int params execute_trace - execute the trace command -------------------------------------------------*/ -static void execute_trace(running_machine *machine, int ref, int params, const char *param[]) +static void execute_trace(running_machine &machine, int ref, int params, const char *param[]) { execute_trace_internal(machine, ref, params, param, 0); } @@ -2413,7 +2413,7 @@ static void execute_trace(running_machine *machine, int ref, int params, const c execute_traceover - execute the trace over command -------------------------------------------------*/ -static void execute_traceover(running_machine *machine, int ref, int params, const char *param[]) +static void execute_traceover(running_machine &machine, int ref, int params, const char *param[]) { execute_trace_internal(machine, ref, params, param, 1); } @@ -2423,7 +2423,7 @@ static void execute_traceover(running_machine *machine, int ref, int params, con execute_traceflush - execute the trace flush command -------------------------------------------------*/ -static void execute_traceflush(running_machine *machine, int ref, int params, const char *param[]) +static void execute_traceflush(running_machine &machine, int ref, int params, const char *param[]) { debug_cpu_flush_traces(machine); } @@ -2433,7 +2433,7 @@ static void execute_traceflush(running_machine *machine, int ref, int params, co execute_history - execute the history command -------------------------------------------------*/ -static void execute_history(running_machine *machine, int ref, int params, const char *param[]) +static void execute_history(running_machine &machine, int ref, int params, const char *param[]) { /* validate parameters */ address_space *space; @@ -2477,12 +2477,12 @@ static void execute_history(running_machine *machine, int ref, int params, const execute_snap - execute the snapshot command -------------------------------------------------*/ -static void execute_snap(running_machine *machine, int ref, int params, const char *param[]) +static void execute_snap(running_machine &machine, int ref, int params, const char *param[]) { /* if no params, use the default behavior */ if (params == 0) { - machine->video().save_active_screen_snapshots(); + machine.video().save_active_screen_snapshots(); debug_console_printf(machine, "Saved snapshot\n"); } @@ -2492,9 +2492,9 @@ static void execute_snap(running_machine *machine, int ref, int params, const ch const char *filename = param[0]; int scrnum = (params > 1) ? atoi(param[1]) : 0; - screen_device *screen = downcast<screen_device *>(machine->m_devicelist.find(SCREEN, scrnum)); + screen_device *screen = downcast<screen_device *>(machine.m_devicelist.find(SCREEN, scrnum)); - if ((screen == NULL) || !machine->render().is_live(*screen)) + if ((screen == NULL) || !machine.render().is_live(*screen)) { debug_console_printf(machine, "Invalid screen number '%d'\n", scrnum); return; @@ -2503,7 +2503,7 @@ static void execute_snap(running_machine *machine, int ref, int params, const ch astring fname(filename); if (fname.find(0, ".png") == -1) fname.cat(".png"); - emu_file file(machine->options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); file_error filerr = file.open(fname); if (filerr != FILERR_NONE) @@ -2512,7 +2512,7 @@ static void execute_snap(running_machine *machine, int ref, int params, const ch return; } - screen->machine->video().save_snapshot(screen, file); + screen->machine().video().save_snapshot(screen, file); debug_console_printf(machine, "Saved screen #%d snapshot as '%s'\n", scrnum, filename); } } @@ -2522,7 +2522,7 @@ static void execute_snap(running_machine *machine, int ref, int params, const ch execute_source - execute the source command -------------------------------------------------*/ -static void execute_source(running_machine *machine, int ref, int params, const char *param[]) +static void execute_source(running_machine &machine, int ref, int params, const char *param[]) { debug_cpu_source_script(machine, param[0]); } @@ -2532,7 +2532,7 @@ static void execute_source(running_machine *machine, int ref, int params, const execute_map - execute the map command -------------------------------------------------*/ -static void execute_map(running_machine *machine, int ref, int params, const char *param[]) +static void execute_map(running_machine &machine, int ref, int params, const char *param[]) { address_space *space; offs_t taddress; @@ -2567,7 +2567,7 @@ static void execute_map(running_machine *machine, int ref, int params, const cha execute_memdump - execute the memdump command -------------------------------------------------*/ -static void execute_memdump(running_machine *machine, int ref, int params, const char **param) +static void execute_memdump(running_machine &machine, int ref, int params, const char **param) { FILE *file; const char *filename; @@ -2596,7 +2596,7 @@ static int CLIB_DECL symbol_sort_compare(const void *item1, const void *item2) return strcmp(str1, str2); } -static void execute_symlist(running_machine *machine, int ref, int params, const char **param) +static void execute_symlist(running_machine &machine, int ref, int params, const char **param) { device_t *cpu = NULL; const char *namelist[1000]; @@ -2654,9 +2654,9 @@ static void execute_symlist(running_machine *machine, int ref, int params, const execute_softreset - execute the softreset command -------------------------------------------------*/ -static void execute_softreset(running_machine *machine, int ref, int params, const char **param) +static void execute_softreset(running_machine &machine, int ref, int params, const char **param) { - machine->schedule_soft_reset(); + machine.schedule_soft_reset(); } @@ -2664,7 +2664,7 @@ static void execute_softreset(running_machine *machine, int ref, int params, con execute_hardreset - execute the hardreset command -------------------------------------------------*/ -static void execute_hardreset(running_machine *machine, int ref, int params, const char **param) +static void execute_hardreset(running_machine &machine, int ref, int params, const char **param) { - machine->schedule_hard_reset(); + machine.schedule_hard_reset(); } diff --git a/src/emu/debug/debugcmd.h b/src/emu/debug/debugcmd.h index 7e43b784786..0944df45f89 100644 --- a/src/emu/debug/debugcmd.h +++ b/src/emu/debug/debugcmd.h @@ -20,19 +20,19 @@ /* ----- initialization ----- */ /* initializes the command system */ -void debug_command_init(running_machine *machine); +void debug_command_init(running_machine &machine); /* ----- parameter validation ----- */ /* validates a number parameter */ -int debug_command_parameter_number(running_machine *machine, const char *param, UINT64 *result); +int debug_command_parameter_number(running_machine &machine, const char *param, UINT64 *result); /* validates a parameter as a cpu */ -int debug_command_parameter_cpu(running_machine *machine, const char *param, device_t **result); +int debug_command_parameter_cpu(running_machine &machine, const char *param, device_t **result); /* validates a parameter as a cpu and retrieves the given address space */ -int debug_command_parameter_cpu_space(running_machine *machine, const char *param, int spacenum, address_space **result); +int debug_command_parameter_cpu_space(running_machine &machine, const char *param, int spacenum, address_space **result); #endif diff --git a/src/emu/debug/debugcon.c b/src/emu/debug/debugcon.c index f09d3cce4fb..e73b463a99a 100644 --- a/src/emu/debug/debugcon.c +++ b/src/emu/debug/debugcon.c @@ -43,7 +43,7 @@ struct _debug_command char command[32]; const char * params; const char * help; - void (*handler)(running_machine *machine, int ref, int params, const char **param); + void (*handler)(running_machine &machine, int ref, int params, const char **param); void (*handler_ex)(int ref); UINT32 flags; int ref; @@ -83,7 +83,7 @@ static void debug_console_exit(running_machine &machine); system -------------------------------------------------*/ -void debug_console_init(running_machine *machine) +void debug_console_init(running_machine &machine) { /* allocate text buffers */ console_textbuf = text_buffer_alloc(CONSOLE_BUF_SIZE, CONSOLE_MAX_LINES); @@ -96,10 +96,10 @@ 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->system().name, machine->system().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); + machine.add_notifier(MACHINE_NOTIFY_EXIT, debug_console_exit); } @@ -193,7 +193,7 @@ static void trim_parameter(char **paramptr, int keep_quotes) command -------------------------------------------------*/ -static CMDERR internal_execute_command(running_machine *machine, int execute, int params, char **param) +static CMDERR internal_execute_command(running_machine &machine, int execute, int params, char **param) { debug_command *cmd, *found = NULL; int i, foundcount = 0; @@ -268,7 +268,7 @@ static CMDERR internal_execute_command(running_machine *machine, int execute, in and either executes or just validates it -------------------------------------------------*/ -static CMDERR internal_parse_command(running_machine *machine, const char *original_command, int execute) +static CMDERR internal_parse_command(running_machine &machine, const char *original_command, int execute) { char command[MAX_COMMAND_LENGTH], parens[MAX_COMMAND_LENGTH]; char *params[MAX_COMMAND_PARAMS] = { 0 }; @@ -364,7 +364,7 @@ static CMDERR internal_parse_command(running_machine *machine, const char *origi command string -------------------------------------------------*/ -CMDERR debug_console_execute_command(running_machine *machine, const char *command, int echo) +CMDERR debug_console_execute_command(running_machine &machine, const char *command, int echo) { CMDERR result; @@ -387,7 +387,7 @@ CMDERR debug_console_execute_command(running_machine *machine, const char *comma /* update all views */ if (echo) { - machine->debug_view().update_all(); + machine.debug_view().update_all(); debugger_refresh_display(machine); } return result; @@ -399,7 +399,7 @@ CMDERR debug_console_execute_command(running_machine *machine, const char *comma command string -------------------------------------------------*/ -CMDERR debug_console_validate_command(running_machine *machine, const char *command) +CMDERR debug_console_validate_command(running_machine &machine, const char *command) { return internal_parse_command(machine, command, FALSE); } @@ -410,12 +410,12 @@ CMDERR debug_console_validate_command(running_machine *machine, const char *comm command handler -------------------------------------------------*/ -void debug_console_register_command(running_machine *machine, const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(running_machine *machine, int ref, int params, const char **param)) +void debug_console_register_command(running_machine &machine, const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(running_machine &machine, int ref, int params, const char **param)) { debug_command *cmd; - assert_always(machine->phase() == MACHINE_PHASE_INIT, "Can only call debug_console_register_command() at init time!"); - assert_always((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0, "Cannot call debug_console_register_command() when debugger is not running"); + assert_always(machine.phase() == MACHINE_PHASE_INIT, "Can only call debug_console_register_command() at init time!"); + assert_always((machine.debug_flags & DEBUG_FLAG_ENABLED) != 0, "Cannot call debug_console_register_command() when debugger is not running"); cmd = auto_alloc_clear(machine, debug_command); @@ -474,7 +474,7 @@ const char *debug_cmderr_to_string(CMDERR error) console -------------------------------------------------*/ -void CLIB_DECL debug_console_printf(running_machine *machine, const char *format, ...) +void CLIB_DECL debug_console_printf(running_machine &machine, const char *format, ...) { astring buffer; va_list arg; @@ -486,7 +486,7 @@ void CLIB_DECL debug_console_printf(running_machine *machine, const char *format text_buffer_print(console_textbuf, buffer); /* force an update of any console views */ - machine->debug_view().update_all(DVT_CONSOLE); + machine.debug_view().update_all(DVT_CONSOLE); } @@ -496,7 +496,7 @@ void CLIB_DECL debug_console_printf(running_machine *machine, const char *format console -------------------------------------------------*/ -void CLIB_DECL debug_console_vprintf(running_machine *machine, const char *format, va_list args) +void CLIB_DECL debug_console_vprintf(running_machine &machine, const char *format, va_list args) { astring buffer; @@ -504,7 +504,7 @@ void CLIB_DECL debug_console_vprintf(running_machine *machine, const char *forma text_buffer_print(console_textbuf, buffer); /* force an update of any console views */ - machine->debug_view().update_all(DVT_CONSOLE); + machine.debug_view().update_all(DVT_CONSOLE); } @@ -514,7 +514,7 @@ void CLIB_DECL debug_console_vprintf(running_machine *machine, const char *forma console -------------------------------------------------*/ -void CLIB_DECL debug_console_printf_wrap(running_machine *machine, int wrapcol, const char *format, ...) +void CLIB_DECL debug_console_printf_wrap(running_machine &machine, int wrapcol, const char *format, ...) { astring buffer; va_list arg; @@ -526,7 +526,7 @@ void CLIB_DECL debug_console_printf_wrap(running_machine *machine, int wrapcol, text_buffer_print_wrap(console_textbuf, buffer, wrapcol); /* force an update of any console views */ - machine->debug_view().update_all(DVT_CONSOLE); + machine.debug_view().update_all(DVT_CONSOLE); } diff --git a/src/emu/debug/debugcon.h b/src/emu/debug/debugcon.h index 3ff691c9dbd..9977a19b578 100644 --- a/src/emu/debug/debugcon.h +++ b/src/emu/debug/debugcon.h @@ -75,18 +75,18 @@ typedef UINT32 CMDERR; ***************************************************************************/ /* initialization */ -void debug_console_init(running_machine *machine); +void debug_console_init(running_machine &machine); /* command handling */ -CMDERR debug_console_execute_command(running_machine *machine, const char *command, int echo); -CMDERR debug_console_validate_command(running_machine *machine, const char *command); -void debug_console_register_command(running_machine *machine, const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(running_machine *machine, int ref, int params, const char **param)); +CMDERR debug_console_execute_command(running_machine &machine, const char *command, int echo); +CMDERR debug_console_validate_command(running_machine &machine, const char *command); +void debug_console_register_command(running_machine &machine, const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(running_machine &machine, int ref, int params, const char **param)); const char * debug_cmderr_to_string(CMDERR error); /* console management */ -void CLIB_DECL debug_console_printf(running_machine *machine, const char *format, ...) ATTR_PRINTF(2,3); -void CLIB_DECL debug_console_vprintf(running_machine *machine, const char *format, va_list args); -void CLIB_DECL debug_console_printf_wrap(running_machine *machine, int wrapcol, const char *format, ...) ATTR_PRINTF(3,4); +void CLIB_DECL debug_console_printf(running_machine &machine, const char *format, ...) ATTR_PRINTF(2,3); +void CLIB_DECL debug_console_vprintf(running_machine &machine, const char *format, va_list args); +void CLIB_DECL debug_console_printf_wrap(running_machine &machine, int wrapcol, const char *format, ...) ATTR_PRINTF(3,4); text_buffer * debug_console_get_textbuf(void); /* errorlog management */ diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index d530745c6ed..e79bd70d9e0 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -115,15 +115,15 @@ struct _debugcpu_private static void debug_cpu_exit(running_machine &machine); static void on_vblank(screen_device &device, void *param, bool vblank_state); static void reset_transient_flags(running_machine &machine); -static void process_source_file(running_machine *machine); +static void process_source_file(running_machine &machine); /* expression handlers */ static UINT64 expression_read_memory(void *param, const char *name, expression_space space, UINT32 address, int size); static UINT64 expression_read_program_direct(address_space *space, int opcode, offs_t address, int size); -static UINT64 expression_read_memory_region(running_machine *machine, const char *rgntag, offs_t address, int size); +static UINT64 expression_read_memory_region(running_machine &machine, const char *rgntag, offs_t address, int size); static void expression_write_memory(void *param, const char *name, expression_space space, UINT32 address, int size, UINT64 data); static void expression_write_program_direct(address_space *space, int opcode, offs_t address, int size, UINT64 data); -static void expression_write_memory_region(running_machine *machine, const char *rgntag, offs_t address, int size, UINT64 data); +static void expression_write_memory_region(running_machine &machine, const char *rgntag, offs_t address, int size, UINT64 data); static expression_error::error_code expression_validate(void *param, const char *name, expression_space space); /* variable getters/setters */ @@ -143,23 +143,23 @@ static UINT64 get_frame(symbol_table &table, void *ref); information for debugging -------------------------------------------------*/ -void debug_cpu_init(running_machine *machine) +void debug_cpu_init(running_machine &machine) { - screen_device *first_screen = machine->first_screen(); + screen_device *first_screen = machine.first_screen(); debugcpu_private *global; int regnum; /* allocate and reset globals */ - machine->debugcpu_data = global = auto_alloc_clear(machine, debugcpu_private); + machine.debugcpu_data = global = auto_alloc_clear(machine, debugcpu_private); global->execution_state = EXECUTION_STATE_STOPPED; global->bpindex = 1; global->wpindex = 1; /* create a global symbol table */ - global->symtable = global_alloc(symbol_table(machine)); + global->symtable = global_alloc(symbol_table(&machine)); // configure our base memory accessors - debug_cpu_configure_memory(*machine, *global->symtable); + debug_cpu_configure_memory(machine, *global->symtable); /* add "wpaddr", "wpdata", "cycles", "cpunum", "logunmap" to the global symbol table */ global->symtable->add("wpaddr", symbol_table::READ_ONLY, &global->wpaddr); @@ -178,13 +178,13 @@ void debug_cpu_init(running_machine *machine) } /* first CPU is visible by default */ - global->visiblecpu = machine->firstcpu; + global->visiblecpu = machine.firstcpu; /* add callback for breaking on VBLANK */ - if (machine->primary_screen != NULL) - machine->primary_screen->register_vblank_callback(on_vblank, NULL); + if (machine.primary_screen != NULL) + machine.primary_screen->register_vblank_callback(on_vblank, NULL); - machine->add_notifier(MACHINE_NOTIFY_EXIT, debug_cpu_exit); + machine.add_notifier(MACHINE_NOTIFY_EXIT, debug_cpu_exit); } @@ -200,11 +200,11 @@ void debug_cpu_configure_memory(running_machine &machine, symbol_table &table) fatalerror -------------------------------------------------*/ -void debug_cpu_flush_traces(running_machine *machine) +void debug_cpu_flush_traces(running_machine &machine) { /* this can be called on exit even when no debugging is enabled, so make sure the devdebug is valid before proceeding */ - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) if (device->debug() != NULL) device->debug()->trace_flush(); } @@ -220,9 +220,9 @@ void debug_cpu_flush_traces(running_machine *machine) device (the one that commands should apply to) -------------------------------------------------*/ -device_t *debug_cpu_get_visible_cpu(running_machine *machine) +device_t *debug_cpu_get_visible_cpu(running_machine &machine) { - return machine->debugcpu_data->visiblecpu; + return machine.debugcpu_data->visiblecpu; } @@ -231,9 +231,9 @@ device_t *debug_cpu_get_visible_cpu(running_machine *machine) the debugger is currently live -------------------------------------------------*/ -int debug_cpu_within_instruction_hook(running_machine *machine) +int debug_cpu_within_instruction_hook(running_machine &machine) { - return machine->debugcpu_data->within_instruction_hook; + return machine.debugcpu_data->within_instruction_hook; } @@ -242,9 +242,9 @@ int debug_cpu_within_instruction_hook(running_machine *machine) current execution state is stopped -------------------------------------------------*/ -int debug_cpu_is_stopped(running_machine *machine) +int debug_cpu_is_stopped(running_machine &machine) { - debugcpu_private *global = machine->debugcpu_data; + debugcpu_private *global = machine.debugcpu_data; return (global != NULL) ? (global->execution_state == EXECUTION_STATE_STOPPED) : false; } @@ -259,9 +259,9 @@ int debug_cpu_is_stopped(running_machine *machine) global symbol table -------------------------------------------------*/ -symbol_table *debug_cpu_get_global_symtable(running_machine *machine) +symbol_table *debug_cpu_get_global_symtable(running_machine &machine) { - return machine->debugcpu_data->symtable; + return machine.debugcpu_data->symtable; } @@ -270,9 +270,9 @@ symbol_table *debug_cpu_get_global_symtable(running_machine *machine) locally-visible symbol table -------------------------------------------------*/ -symbol_table *debug_cpu_get_visible_symtable(running_machine *machine) +symbol_table *debug_cpu_get_visible_symtable(running_machine &machine) { - return &machine->debugcpu_data->visiblecpu->debug()->symtable(); + return &machine.debugcpu_data->visiblecpu->debug()->symtable(); } @@ -281,9 +281,9 @@ symbol_table *debug_cpu_get_visible_symtable(running_machine *machine) command script to execute -------------------------------------------------*/ -void debug_cpu_source_script(running_machine *machine, const char *file) +void debug_cpu_source_script(running_machine &machine, const char *file) { - debugcpu_private *global = machine->debugcpu_data; + debugcpu_private *global = machine.debugcpu_data; /* close any existing source file */ if (global->source_file != NULL) @@ -298,7 +298,7 @@ void debug_cpu_source_script(running_machine *machine, const char *file) global->source_file = fopen(file, "r"); if (!global->source_file) { - if (machine->phase() == MACHINE_PHASE_RUNNING) + if (machine.phase() == MACHINE_PHASE_RUNNING) debug_console_printf(machine, "Cannot open command file '%s'\n", file); else fatalerror("Cannot open command file '%s'", file); @@ -317,7 +317,7 @@ void debug_cpu_source_script(running_machine *machine, const char *file) // the given machine //------------------------------------------------- -bool debug_comment_save(running_machine *machine) +bool debug_comment_save(running_machine &machine) { // if we don't have a root, bail xml_data_node *root = xml_file_create(); @@ -337,11 +337,11 @@ 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->system().name); + xml_set_attribute(systemnode, "name", machine.system().name); // for each device bool found_comments = false; - for (device_t *device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device_t *device = machine.m_devicelist.first(); device != NULL; device = device->next()) if (device->debug()->comment_count() > 0) { // create a node for this device @@ -359,8 +359,8 @@ bool debug_comment_save(running_machine *machine) // flush the file if (found_comments) { - emu_file file(machine->options().comment_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - file_error filerr = file.open(machine->basename(), ".cmt"); + emu_file file(machine.options().comment_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + file_error filerr = file.open(machine.basename(), ".cmt"); if (filerr == FILERR_NONE) xml_file_write(root, file); } @@ -382,11 +382,11 @@ bool debug_comment_save(running_machine *machine) // the given machine //------------------------------------------------- -bool debug_comment_load(running_machine *machine) +bool debug_comment_load(running_machine &machine) { // open the file - emu_file file(machine->options().comment_directory(), OPEN_FLAG_READ); - file_error filerr = file.open(machine->basename(), ".cmt"); + emu_file file(machine.options().comment_directory(), OPEN_FLAG_READ); + file_error filerr = file.open(machine.basename(), ".cmt"); // if an error, just return false if (filerr != FILERR_NONE) @@ -413,13 +413,13 @@ 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->system().name) != 0) + if (strcmp(name, machine.system().name) != 0) throw emu_exception(); // iterate over devices for (xml_data_node *cpunode = xml_get_sibling(systemnode->child, "cpu"); cpunode; cpunode = xml_get_sibling(cpunode->next, "cpu")) { - device_t *device = machine->device(xml_get_attribute_string(cpunode, "tag", "")); + device_t *device = machine.device(xml_get_attribute_string(cpunode, "tag", "")); if (device != NULL) if (!device->debug()->comment_import(*cpunode)) throw emu_exception(); @@ -471,7 +471,7 @@ int debug_cpu_translate(address_space *space, int intention, offs_t *address) UINT8 debug_read_byte(address_space *_space, offs_t address, int apply_translation) { address_space *space = const_cast<address_space *>(_space); - debugcpu_private *global = space->machine->debugcpu_data; + debugcpu_private *global = space->machine().debugcpu_data; UINT64 custom; UINT8 result; @@ -507,7 +507,7 @@ UINT8 debug_read_byte(address_space *_space, offs_t address, int apply_translati UINT16 debug_read_word(address_space *_space, offs_t address, int apply_translation) { address_space *space = const_cast<address_space *>(_space); - debugcpu_private *global = space->machine->debugcpu_data; + debugcpu_private *global = space->machine().debugcpu_data; UINT16 result; /* mask against the logical byte mask */ @@ -562,7 +562,7 @@ UINT16 debug_read_word(address_space *_space, offs_t address, int apply_translat UINT32 debug_read_dword(address_space *_space, offs_t address, int apply_translation) { address_space *space = const_cast<address_space *>(_space); - debugcpu_private *global = space->machine->debugcpu_data; + debugcpu_private *global = space->machine().debugcpu_data; UINT32 result; /* mask against the logical byte mask */ @@ -617,7 +617,7 @@ UINT32 debug_read_dword(address_space *_space, offs_t address, int apply_transla UINT64 debug_read_qword(address_space *_space, offs_t address, int apply_translation) { address_space *space = const_cast<address_space *>(_space); - debugcpu_private *global = space->machine->debugcpu_data; + debugcpu_private *global = space->machine().debugcpu_data; UINT64 result; /* mask against the logical byte mask */ @@ -691,7 +691,7 @@ UINT64 debug_read_memory(address_space *space, offs_t address, int size, int app void debug_write_byte(address_space *_space, offs_t address, UINT8 data, int apply_translation) { address_space *space = const_cast<address_space *>(_space); - debugcpu_private *global = space->machine->debugcpu_data; + debugcpu_private *global = space->machine().debugcpu_data; /* mask against the logical byte mask */ address &= space->logbytemask(); @@ -725,7 +725,7 @@ void debug_write_byte(address_space *_space, offs_t address, UINT8 data, int app void debug_write_word(address_space *_space, offs_t address, UINT16 data, int apply_translation) { address_space *space = const_cast<address_space *>(_space); - debugcpu_private *global = space->machine->debugcpu_data; + debugcpu_private *global = space->machine().debugcpu_data; /* mask against the logical byte mask */ address &= space->logbytemask(); @@ -778,7 +778,7 @@ void debug_write_word(address_space *_space, offs_t address, UINT16 data, int ap void debug_write_dword(address_space *_space, offs_t address, UINT32 data, int apply_translation) { address_space *space = const_cast<address_space *>(_space); - debugcpu_private *global = space->machine->debugcpu_data; + debugcpu_private *global = space->machine().debugcpu_data; /* mask against the logical byte mask */ address &= space->logbytemask(); @@ -831,7 +831,7 @@ void debug_write_dword(address_space *_space, offs_t address, UINT32 data, int a void debug_write_qword(address_space *_space, offs_t address, UINT64 data, int apply_translation) { address_space *space = const_cast<address_space *>(_space); - debugcpu_private *global = space->machine->debugcpu_data; + debugcpu_private *global = space->machine().debugcpu_data; /* mask against the logical byte mask */ address &= space->logbytemask(); @@ -902,7 +902,7 @@ UINT64 debug_read_opcode(address_space *_space, offs_t address, int size, int ar { address_space *space = const_cast<address_space *>(_space); UINT64 result = ~(UINT64)0 & (~(UINT64)0 >> (64 - 8*size)), result2; - debugcpu_private *global = space->machine->debugcpu_data; + debugcpu_private *global = space->machine().debugcpu_data; /* keep in logical range */ address &= space->logbytemask(); @@ -1072,7 +1072,7 @@ static void on_vblank(screen_device &device, void *param, bool vblank_state) { /* just set a global flag to be consumed later */ if (vblank_state) - device.machine->debugcpu_data->vblank_occurred = true; + device.machine().debugcpu_data->vblank_occurred = true; } @@ -1095,9 +1095,9 @@ static void reset_transient_flags(running_machine &machine) a source file -------------------------------------------------*/ -static void process_source_file(running_machine *machine) +static void process_source_file(running_machine &machine) { - debugcpu_private *global = machine->debugcpu_data; + debugcpu_private *global = machine.debugcpu_data; /* loop until the file is exhausted or until we are executing again */ while (global->source_file != NULL && global->execution_state == EXECUTION_STATE_STOPPED) @@ -1145,11 +1145,11 @@ static void process_source_file(running_machine *machine) based on a case insensitive tag search -------------------------------------------------*/ -static device_t *expression_get_device(running_machine *machine, const char *tag) +static device_t *expression_get_device(running_machine &machine, const char *tag) { device_t *device; - for (device = machine->m_devicelist.first(); device != NULL; device = device->next()) + for (device = machine.m_devicelist.first(); device != NULL; device = device->next()) if (mame_stricmp(device->tag(), tag) == 0) return device; @@ -1165,7 +1165,7 @@ static device_t *expression_get_device(running_machine *machine, const char *tag static UINT64 expression_read_memory(void *param, const char *name, expression_space spacenum, UINT32 address, int size) { - running_machine *machine = (running_machine *)param; + running_machine &machine = *(running_machine *)param; UINT64 result = ~(UINT64)0 >> (64 - 8*size); device_t *device = NULL; address_space *space; @@ -1286,9 +1286,9 @@ static UINT64 expression_read_program_direct(address_space *_space, int opcode, from a memory region -------------------------------------------------*/ -static UINT64 expression_read_memory_region(running_machine *machine, const char *rgntag, offs_t address, int size) +static UINT64 expression_read_memory_region(running_machine &machine, const char *rgntag, offs_t address, int size) { - const memory_region *region = machine->region(rgntag); + const memory_region *region = machine.region(rgntag); UINT64 result = ~(UINT64)0 >> (64 - 8*size); /* make sure we get a valid base before proceeding */ @@ -1337,7 +1337,7 @@ static UINT64 expression_read_memory_region(running_machine *machine, const char static void expression_write_memory(void *param, const char *name, expression_space spacenum, UINT32 address, int size, UINT64 data) { - running_machine *machine = (running_machine *)param; + running_machine &machine = *(running_machine *)param; device_t *device = NULL; address_space *space; @@ -1400,7 +1400,7 @@ static void expression_write_program_direct(address_space *_space, int opcode, o address_space *space = const_cast<address_space *>(_space); if (space != NULL) { - debugcpu_private *global = space->machine->debugcpu_data; + debugcpu_private *global = space->machine().debugcpu_data; UINT8 *base; /* adjust the address into a byte address, but not if being called recursively */ @@ -1462,10 +1462,10 @@ static void expression_write_program_direct(address_space *_space, int opcode, o from a memory region -------------------------------------------------*/ -static void expression_write_memory_region(running_machine *machine, const char *rgntag, offs_t address, int size, UINT64 data) +static void expression_write_memory_region(running_machine &machine, const char *rgntag, offs_t address, int size, UINT64 data) { - debugcpu_private *global = machine->debugcpu_data; - const memory_region *region = machine->region(rgntag); + debugcpu_private *global = machine.debugcpu_data; + const memory_region *region = machine.region(rgntag); /* make sure we get a valid base before proceeding */ if (region != NULL) @@ -1520,7 +1520,7 @@ static void expression_write_memory_region(running_machine *machine, const char static expression_error::error_code expression_validate(void *param, const char *name, expression_space space) { - running_machine *machine = (running_machine *)param; + running_machine &machine = *(running_machine *)param; device_t *device = NULL; switch (space) @@ -1574,7 +1574,7 @@ static expression_error::error_code expression_validate(void *param, const char case EXPSPACE_REGION: if (name == NULL) return expression_error::MISSING_MEMORY_NAME; - if (machine->region(name)->base() == NULL) + if (machine.region(name)->base() == NULL) return expression_error::INVALID_MEMORY_NAME; break; @@ -1630,12 +1630,12 @@ static UINT64 get_frame(symbol_table &table, void *ref) static UINT64 get_cpunum(symbol_table &table, void *ref) { - running_machine *machine = reinterpret_cast<running_machine *>(table.globalref()); - device_t *target = machine->debugcpu_data->visiblecpu; + running_machine &machine = *reinterpret_cast<running_machine *>(table.globalref()); + device_t *target = machine.debugcpu_data->visiblecpu; device_execute_interface *exec = NULL; int index = 0; - for (bool gotone = machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) + for (bool gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec)) { if (&exec->device() == target) return index; @@ -1661,7 +1661,7 @@ device_debug::device_debug(device_t &device) m_state(NULL), m_disasm(NULL), m_flags(0), - m_symtable(&device, debug_cpu_get_global_symtable(device.machine)), + m_symtable(&device, debug_cpu_get_global_symtable(device.machine())), m_instrhook(NULL), m_dasm_override(NULL), m_opwidth(0), @@ -1744,9 +1744,9 @@ device_debug::~device_debug() void device_debug::start_hook(attotime endtime) { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; - assert((m_device.machine->debug_flags & DEBUG_FLAG_ENABLED) != 0); + assert((m_device.machine().debug_flags & DEBUG_FLAG_ENABLED) != 0); // stash a pointer to the current live CPU assert(global->livecpu == NULL); @@ -1757,7 +1757,7 @@ void device_debug::start_hook(attotime endtime) { global->m_stop_when_not_device = NULL; global->execution_state = EXECUTION_STATE_STOPPED; - reset_transient_flags(*m_device.machine); + reset_transient_flags(m_device.machine()); } // update the target execution end time @@ -1769,8 +1769,8 @@ void device_debug::start_hook(attotime endtime) // check for periodic updates if (&m_device == global->visiblecpu && osd_ticks() > global->last_periodic_update_time + osd_ticks_per_second()/4) { - m_device.machine->debug_view().update_all(); - m_device.machine->debug_view().flush_osd_updates(); + m_device.machine().debug_view().update_all(); + m_device.machine().debug_view().flush_osd_updates(); global->last_periodic_update_time = osd_ticks(); } @@ -1790,11 +1790,11 @@ void device_debug::start_hook(attotime endtime) if ((m_flags & DEBUG_FLAG_STOP_VBLANK) != 0) { global->execution_state = EXECUTION_STATE_STOPPED; - debug_console_printf(m_device.machine, "Stopped at VBLANK\n"); + debug_console_printf(m_device.machine(), "Stopped at VBLANK\n"); } // check for debug keypresses - else if (ui_input_pressed(m_device.machine, IPT_UI_DEBUG_BREAK)) + else if (ui_input_pressed(m_device.machine(), IPT_UI_DEBUG_BREAK)) global->visiblecpu->debug()->halt_on_next_instruction("User-initiated break\n"); } } @@ -1811,7 +1811,7 @@ void device_debug::start_hook(attotime endtime) void device_debug::stop_hook() { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; assert(global->livecpu == &m_device); @@ -1827,13 +1827,13 @@ void device_debug::stop_hook() void device_debug::interrupt_hook(int irqline) { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; // see if this matches a pending interrupt request if ((m_flags & DEBUG_FLAG_STOP_INTERRUPT) != 0 && (m_stopirq == -1 || m_stopirq == irqline)) { global->execution_state = EXECUTION_STATE_STOPPED; - debug_console_printf(m_device.machine, "Stopped on interrupt (CPU '%s', IRQ %d)\n", m_device.tag(), irqline); + debug_console_printf(m_device.machine(), "Stopped on interrupt (CPU '%s', IRQ %d)\n", m_device.tag(), irqline); compute_debug_flags(); } } @@ -1846,13 +1846,13 @@ void device_debug::interrupt_hook(int irqline) void device_debug::exception_hook(int exception) { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; // see if this matches a pending interrupt request if ((m_flags & DEBUG_FLAG_STOP_EXCEPTION) != 0 && (m_stopexception == -1 || m_stopexception == exception)) { global->execution_state = EXECUTION_STATE_STOPPED; - debug_console_printf(m_device.machine, "Stopped on exception (CPU '%s', exception %d)\n", m_device.tag(), exception); + debug_console_printf(m_device.machine(), "Stopped on exception (CPU '%s', exception %d)\n", m_device.tag(), exception); compute_debug_flags(); } } @@ -1865,7 +1865,7 @@ void device_debug::exception_hook(int exception) void device_debug::instruction_hook(offs_t curpc) { - running_machine &machine = *m_device.machine; + running_machine &machine = m_device.machine(); debugcpu_private *global = machine.debugcpu_data; // note that we are in the debugger code @@ -1901,7 +1901,7 @@ void device_debug::instruction_hook(offs_t curpc) { machine.debug_view().update_all(); machine.debug_view().flush_osd_updates(); - debugger_refresh_display(&machine); + debugger_refresh_display(machine); } } } @@ -1912,14 +1912,14 @@ void device_debug::instruction_hook(offs_t curpc) // see if we hit a target time if ((m_flags & DEBUG_FLAG_STOP_TIME) != 0 && machine.time() >= m_stoptime) { - debug_console_printf(&machine, "Stopped at time interval %.1g\n", machine.time().as_double()); + debug_console_printf(machine, "Stopped at time interval %.1g\n", machine.time().as_double()); global->execution_state = EXECUTION_STATE_STOPPED; } // check the temp running breakpoint and break if we hit it else if ((m_flags & DEBUG_FLAG_STOP_PC) != 0 && m_stopaddr == curpc) { - debug_console_printf(&machine, "Stopped at temporary breakpoint %X on CPU '%s'\n", m_stopaddr, m_device.tag()); + debug_console_printf(machine, "Stopped at temporary breakpoint %X on CPU '%s'\n", m_stopaddr, m_device.tag()); global->execution_state = EXECUTION_STATE_STOPPED; } @@ -1936,12 +1936,12 @@ void device_debug::instruction_hook(offs_t curpc) // load comments if we haven't yet if (!global->comments_loaded) { - debug_comment_load(m_device.machine); + debug_comment_load(m_device.machine()); global->comments_loaded = true; } // reset any transient state - reset_transient_flags(*m_device.machine); + reset_transient_flags(m_device.machine()); global->breakcpu = NULL; // remember the last visible CPU in the debugger @@ -1949,10 +1949,10 @@ void device_debug::instruction_hook(offs_t curpc) // update all views machine.debug_view().update_all(); - debugger_refresh_display(m_device.machine); + debugger_refresh_display(m_device.machine()); // wait for the debugger; during this time, disable sound output - m_device.machine->sound().debugger_mute(true); + m_device.machine().sound().debugger_mute(true); while (global->execution_state == EXECUTION_STATE_STOPPED) { // flush any pending updates before waiting again @@ -1970,17 +1970,17 @@ void device_debug::instruction_hook(offs_t curpc) if (global->memory_modified) { machine.debug_view().update_all(DVT_DISASSEMBLY); - debugger_refresh_display(m_device.machine); + debugger_refresh_display(m_device.machine()); } // check for commands in the source file - process_source_file(m_device.machine); + process_source_file(m_device.machine()); // if an event got scheduled, resume if (machine.scheduled_event_pending()) global->execution_state = EXECUTION_STATE_RUNNING; } - m_device.machine->sound().debugger_mute(false); + m_device.machine().sound().debugger_mute(false); // remember the last visible CPU in the debugger global->visiblecpu = &m_device; @@ -2080,7 +2080,7 @@ if (m_memory != NULL && m_disasm != NULL) void device_debug::ignore(bool ignore) { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; assert(m_exec != NULL); @@ -2101,7 +2101,7 @@ void device_debug::ignore(bool ignore) void device_debug::single_step(int numsteps) { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; assert(m_exec != NULL); @@ -2119,7 +2119,7 @@ void device_debug::single_step(int numsteps) void device_debug::single_step_over(int numsteps) { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; assert(m_exec != NULL); @@ -2137,7 +2137,7 @@ void device_debug::single_step_over(int numsteps) void device_debug::single_step_out() { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; assert(m_exec != NULL); @@ -2155,7 +2155,7 @@ void device_debug::single_step_out() void device_debug::go(offs_t targetpc) { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; assert(m_exec != NULL); @@ -2171,7 +2171,7 @@ void device_debug::go(offs_t targetpc) void device_debug::go_vblank() { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; assert(m_exec != NULL); @@ -2188,7 +2188,7 @@ void device_debug::go_vblank() void device_debug::go_interrupt(int irqline) { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; assert(m_exec != NULL); @@ -2205,7 +2205,7 @@ void device_debug::go_interrupt(int irqline) void device_debug::go_exception(int exception) { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; assert(m_exec != NULL); @@ -2222,11 +2222,11 @@ void device_debug::go_exception(int exception) void device_debug::go_milliseconds(UINT64 milliseconds) { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; assert(m_exec != NULL); - m_stoptime = m_device.machine->time() + attotime::from_msec(milliseconds); + m_stoptime = m_device.machine().time() + attotime::from_msec(milliseconds); m_flags |= DEBUG_FLAG_STOP_TIME; global->execution_state = EXECUTION_STATE_RUNNING; } @@ -2239,7 +2239,7 @@ void device_debug::go_milliseconds(UINT64 milliseconds) void device_debug::go_next_device() { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; assert(m_exec != NULL); @@ -2255,7 +2255,7 @@ void device_debug::go_next_device() void device_debug::halt_on_next_instruction(const char *fmt, ...) { - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; va_list arg; assert(m_exec != NULL); @@ -2266,7 +2266,7 @@ void device_debug::halt_on_next_instruction(const char *fmt, ...) // output the message to the console va_start(arg, fmt); - debug_console_vprintf(m_device.machine, fmt, arg); + debug_console_vprintf(m_device.machine(), fmt, arg); va_end(arg); // if we are live, stop now, otherwise note that we want to break there @@ -2289,7 +2289,7 @@ void device_debug::halt_on_next_instruction(const char *fmt, ...) int device_debug::breakpoint_set(offs_t address, const char *condition, const char *action) { // allocate a new one - breakpoint *bp = auto_alloc(m_device.machine, breakpoint(m_symtable, m_device.machine->debugcpu_data->bpindex++, address, condition, action)); + breakpoint *bp = auto_alloc(m_device.machine(), breakpoint(m_symtable, m_device.machine().debugcpu_data->bpindex++, address, condition, action)); // hook it into our list bp->m_next = m_bplist; @@ -2314,7 +2314,7 @@ bool device_debug::breakpoint_clear(int index) { breakpoint *deleteme = *bp; *bp = deleteme->m_next; - auto_free(m_device.machine, deleteme); + auto_free(m_device.machine(), deleteme); breakpoint_update_flags(); return true; } @@ -2380,7 +2380,7 @@ int device_debug::watchpoint_set(address_space &space, int type, offs_t address, assert(space.spacenum() < ARRAY_LENGTH(m_wplist)); // allocate a new one - watchpoint *wp = auto_alloc(m_device.machine, watchpoint(m_symtable, m_device.machine->debugcpu_data->bpindex++, space, type, address, length, condition, action)); + watchpoint *wp = auto_alloc(m_device.machine(), watchpoint(m_symtable, m_device.machine().debugcpu_data->bpindex++, space, type, address, length, condition, action)); // hook it into our list wp->m_next = m_wplist[space.spacenum()]; @@ -2407,7 +2407,7 @@ bool device_debug::watchpoint_clear(int index) watchpoint *deleteme = *wp; address_space &space = deleteme->m_space; *wp = deleteme->m_next; - auto_free(m_device.machine, deleteme); + auto_free(m_device.machine(), deleteme); watchpoint_update_flags(space); return true; } @@ -2474,14 +2474,14 @@ void device_debug::watchpoint_enable_all(bool enable) void device_debug::hotspot_track(int numspots, int threshhold) { // if we already have tracking enabled, kill it - auto_free(m_device.machine, m_hotspots); + auto_free(m_device.machine(), m_hotspots); m_hotspots = NULL; // only start tracking if we have a non-zero count if (numspots > 0) { // allocate memory for hotspots - m_hotspots = auto_alloc_array(m_device.machine, hotspot_entry, numspots); + m_hotspots = auto_alloc_array(m_device.machine(), hotspot_entry, numspots); memset(m_hotspots, 0xff, sizeof(*m_hotspots) * numspots); // fill in the info @@ -2519,7 +2519,7 @@ void device_debug::comment_add(offs_t addr, const char *comment, rgb_t color) { // create a new item for the list UINT32 crc = compute_opcode_crc32(addr); - dasm_comment *newcomment = auto_alloc(m_device.machine, dasm_comment(comment, addr, color, crc)); + dasm_comment *newcomment = auto_alloc(m_device.machine(), dasm_comment(comment, addr, color, crc)); // figure out where to insert it dasm_comment *prev = NULL; @@ -2646,7 +2646,7 @@ bool device_debug::comment_import(xml_data_node &cpunode) sscanf(xml_get_attribute_string(datanode, "crc", 0), "%08X", &crc); // add the new comment; we assume they were saved ordered - m_comment_list.append(*auto_alloc(m_device.machine, dasm_comment(datanode->value, address, color, crc))); + m_comment_list.append(*auto_alloc(m_device.machine(), dasm_comment(datanode->value, address, color, crc))); } return true; } @@ -2723,12 +2723,12 @@ UINT32 device_debug::compute_opcode_crc32(offs_t address) const void device_debug::trace(FILE *file, bool trace_over, const char *action) { // delete any existing tracers - auto_free(m_device.machine, m_trace); + auto_free(m_device.machine(), m_trace); m_trace = NULL; // if we have a new file, make a new tracer if (file != NULL) - m_trace = auto_alloc(m_device.machine, tracer(*this, *file, trace_over, action)); + m_trace = auto_alloc(m_device.machine(), tracer(*this, *file, trace_over, action)); } @@ -2756,33 +2756,33 @@ void device_debug::trace_printf(const char *fmt, ...) void device_debug::compute_debug_flags() { - running_machine *machine = m_device.machine; - debugcpu_private *global = machine->debugcpu_data; + running_machine &machine = m_device.machine(); + debugcpu_private *global = machine.debugcpu_data; // clear out global flags by default, keep DEBUG_FLAG_OSD_ENABLED - machine->debug_flags &= DEBUG_FLAG_OSD_ENABLED; - machine->debug_flags |= DEBUG_FLAG_ENABLED; + machine.debug_flags &= DEBUG_FLAG_OSD_ENABLED; + machine.debug_flags |= DEBUG_FLAG_ENABLED; // if we are ignoring this CPU, or if events are pending, we're done - if ((m_flags & DEBUG_FLAG_OBSERVING) == 0 || machine->scheduled_event_pending() || machine->save_or_load_pending()) + if ((m_flags & DEBUG_FLAG_OBSERVING) == 0 || machine.scheduled_event_pending() || machine.save_or_load_pending()) return; // if we're stopped, keep calling the hook if (global->execution_state == EXECUTION_STATE_STOPPED) - machine->debug_flags |= DEBUG_FLAG_CALL_HOOK; + machine.debug_flags |= DEBUG_FLAG_CALL_HOOK; // if we're tracking history, or we're hooked, or stepping, or stopping at a breakpoint // make sure we call the hook if ((m_flags & (DEBUG_FLAG_HISTORY | DEBUG_FLAG_HOOKED | DEBUG_FLAG_STEPPING_ANY | DEBUG_FLAG_STOP_PC | DEBUG_FLAG_LIVE_BP)) != 0) - machine->debug_flags |= DEBUG_FLAG_CALL_HOOK; + machine.debug_flags |= DEBUG_FLAG_CALL_HOOK; // also call if we are tracing if (m_trace != NULL) - machine->debug_flags |= DEBUG_FLAG_CALL_HOOK; + machine.debug_flags |= DEBUG_FLAG_CALL_HOOK; // if we are stopping at a particular time and that time is within the current timeslice, we need to be called if ((m_flags & DEBUG_FLAG_STOP_TIME) && m_endexectime <= m_stoptime) - machine->debug_flags |= DEBUG_FLAG_CALL_HOOK; + machine.debug_flags |= DEBUG_FLAG_CALL_HOOK; } @@ -2837,7 +2837,7 @@ void device_debug::breakpoint_update_flags() } // push the flags out globally - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; if (global->livecpu != NULL) global->livecpu->debug()->compute_debug_flags(); } @@ -2855,16 +2855,16 @@ void device_debug::breakpoint_check(offs_t pc) if (bp->hit(pc)) { // halt in the debugger by default - debugcpu_private *global = m_device.machine->debugcpu_data; + debugcpu_private *global = m_device.machine().debugcpu_data; global->execution_state = EXECUTION_STATE_STOPPED; // if we hit, evaluate the action if (bp->m_action) - debug_console_execute_command(m_device.machine, bp->m_action, 0); + debug_console_execute_command(m_device.machine(), bp->m_action, 0); // print a notification, unless the action made us go again if (global->execution_state == EXECUTION_STATE_STOPPED) - debug_console_printf(m_device.machine, "Stopped at breakpoint %X\n", bp->m_index); + debug_console_printf(m_device.machine(), "Stopped at breakpoint %X\n", bp->m_index); break; } } @@ -2906,7 +2906,7 @@ void device_debug::watchpoint_update_flags(address_space &space) void device_debug::watchpoint_check(address_space &space, int type, offs_t address, UINT64 value_to_write, UINT64 mem_mask) { - debugcpu_private *global = space.machine->debugcpu_data; + debugcpu_private *global = space.machine().debugcpu_data; // if we're within debugger code, don't stop if (global->within_instruction_hook || global->debugger_access) @@ -2953,7 +2953,7 @@ void device_debug::watchpoint_check(address_space &space, int type, offs_t addre // if we hit, evaluate the action if (wp->m_action) - debug_console_execute_command(space.machine, wp->m_action, 0); + debug_console_execute_command(space.machine(), wp->m_action, 0); // print a notification, unless the action made us go again if (global->execution_state == EXECUTION_STATE_STOPPED) @@ -2975,7 +2975,7 @@ void device_debug::watchpoint_check(address_space &space, int type, offs_t addre } else buffer.printf("Stopped at watchpoint %X reading %s from %08X (PC=%X)", wp->m_index, sizes[size], space.byte_to_address(address), pc); - debug_console_printf(space.machine, "%s\n", buffer.cstr()); + debug_console_printf(space.machine(), "%s\n", buffer.cstr()); space.cpu->debug()->compute_debug_flags(); } break; @@ -3006,7 +3006,7 @@ void device_debug::hotspot_check(address_space &space, offs_t address) // if the bottom of the list is over the threshhold, print it hotspot_entry &spot = m_hotspots[m_hotspot_count - 1]; if (spot.m_count > m_hotspot_threshhold) - debug_console_printf(space.machine, "Hotspot @ %s %08X (PC=%08X) hit %d times (fell off bottom)\n", space.name(), spot.m_access, spot.m_pc, spot.m_count); + debug_console_printf(space.machine(), "Hotspot @ %s %08X (PC=%08X) hit %d times (fell off bottom)\n", space.name(), spot.m_access, spot.m_pc, spot.m_count); // move everything else down and insert this one at the top memmove(&m_hotspots[1], &m_hotspots[0], sizeof(m_hotspots[0]) * (m_hotspot_count - 1)); @@ -3307,7 +3307,7 @@ void device_debug::tracer::update(offs_t pc) // execute any trace actions first if (m_action) - debug_console_execute_command(m_debug.m_device.machine, m_action, 0); + debug_console_execute_command(m_debug.m_device.machine(), m_action, 0); // print the address astring buffer; diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index 990cc7e5cf5..2c414b88fc8 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -370,51 +370,51 @@ private: /* ----- initialization and cleanup ----- */ /* initialize the CPU tracking for the debugger */ -void debug_cpu_init(running_machine *machine); +void debug_cpu_init(running_machine &machine); void debug_cpu_configure_memory(running_machine &machine, symbol_table &table); /* flushes all traces; this is useful if a trace is going on when we fatalerror */ -void debug_cpu_flush_traces(running_machine *machine); +void debug_cpu_flush_traces(running_machine &machine); /* ----- debugging status & information ----- */ /* return the visible CPU device (the one that commands should apply to) */ -device_t *debug_cpu_get_visible_cpu(running_machine *machine); +device_t *debug_cpu_get_visible_cpu(running_machine &machine); /* TRUE if the debugger is currently stopped within an instruction hook callback */ -int debug_cpu_within_instruction_hook(running_machine *machine); +int debug_cpu_within_instruction_hook(running_machine &machine); /* return TRUE if the current execution state is stopped */ -int debug_cpu_is_stopped(running_machine *machine); +int debug_cpu_is_stopped(running_machine &machine); /* ----- symbol table interfaces ----- */ /* return the global symbol table */ -symbol_table *debug_cpu_get_global_symtable(running_machine *machine); +symbol_table *debug_cpu_get_global_symtable(running_machine &machine); /* return the locally-visible symbol table */ -symbol_table *debug_cpu_get_visible_symtable(running_machine *machine); +symbol_table *debug_cpu_get_visible_symtable(running_machine &machine); /* ----- misc debugger functions ----- */ /* specifies a debug command script to execute */ -void debug_cpu_source_script(running_machine *machine, const char *file); +void debug_cpu_source_script(running_machine &machine, const char *file); /* ----- debugger comment helpers ----- */ // save all comments for a given machine -bool debug_comment_save(running_machine *machine); +bool debug_comment_save(running_machine &machine); // load all comments for a given machine -bool debug_comment_load(running_machine *machine); +bool debug_comment_load(running_machine &machine); diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c index 2454644c7ed..9d652f5078d 100644 --- a/src/emu/debug/debugvw.c +++ b/src/emu/debug/debugvw.c @@ -147,7 +147,7 @@ void debug_view_source_list::reset() { debug_view_source *source = m_head; m_head = source->m_next; - auto_free(&m_machine, source); + auto_free(m_machine, source); } // reset the tail pointer and index @@ -222,7 +222,7 @@ debug_view::debug_view(running_machine &machine, debug_view_type type, debug_vie { // allocate memory for the buffer m_viewdata_size = m_visible.y * m_visible.x; - m_viewdata = auto_alloc_array(&machine, debug_view_char, m_viewdata_size); + m_viewdata = auto_alloc_array(machine, debug_view_char, m_viewdata_size); } @@ -256,8 +256,8 @@ void debug_view::end_update() if (size > m_viewdata_size) { m_viewdata_size = size; - auto_free(&m_machine, m_viewdata); - m_viewdata = auto_alloc_array(&m_machine, debug_view_char, m_viewdata_size); + auto_free(m_machine, m_viewdata); + m_viewdata = auto_alloc_array(m_machine, debug_view_char, m_viewdata_size); } // update the view @@ -450,7 +450,7 @@ debug_view_manager::~debug_view_manager() { debug_view *oldhead = m_viewlist; m_viewlist = oldhead->m_next; - auto_free(&m_machine, oldhead); + auto_free(m_machine, oldhead); } } @@ -464,25 +464,25 @@ debug_view *debug_view_manager::alloc_view(debug_view_type type, debug_view_osd_ switch (type) { case DVT_CONSOLE: - return append(auto_alloc(&m_machine, debug_view_console(m_machine, osdupdate, osdprivate))); + return append(auto_alloc(m_machine, debug_view_console(m_machine, osdupdate, osdprivate))); case DVT_STATE: - return append(auto_alloc(&m_machine, debug_view_state(m_machine, osdupdate, osdprivate))); + return append(auto_alloc(m_machine, debug_view_state(m_machine, osdupdate, osdprivate))); case DVT_DISASSEMBLY: - return append(auto_alloc(&m_machine, debug_view_disasm(m_machine, osdupdate, osdprivate))); + return append(auto_alloc(m_machine, debug_view_disasm(m_machine, osdupdate, osdprivate))); case DVT_MEMORY: - return append(auto_alloc(&m_machine, debug_view_memory(m_machine, osdupdate, osdprivate))); + return append(auto_alloc(m_machine, debug_view_memory(m_machine, osdupdate, osdprivate))); case DVT_LOG: - return append(auto_alloc(&m_machine, debug_view_log(m_machine, osdupdate, osdprivate))); + return append(auto_alloc(m_machine, debug_view_log(m_machine, osdupdate, osdprivate))); case DVT_TIMERS: -// return append(auto_alloc(&m_machine, debug_view_timers(m_machine, osdupdate, osdprivate))); +// return append(auto_alloc(m_machine, debug_view_timers(m_machine, osdupdate, osdprivate))); case DVT_ALLOCS: -// return append(auto_alloc(&m_machine, debug_view_allocs(m_machine, osdupdate, osdprivate))); +// return append(auto_alloc(m_machine, debug_view_allocs(m_machine, osdupdate, osdprivate))); default: fatalerror("Attempt to create invalid debug view type %d\n", type); @@ -502,7 +502,7 @@ void debug_view_manager::free_view(debug_view &view) if (*viewptr == &view) { *viewptr = view.m_next; - auto_free(&m_machine, &view); + auto_free(m_machine, &view); break; } } @@ -559,7 +559,7 @@ debug_view_expression::debug_view_expression(running_machine &machine) : m_machine(machine), m_dirty(true), m_result(0), - m_parsed(debug_cpu_get_global_symtable(&machine)), + m_parsed(debug_cpu_get_global_symtable(machine)), m_string("0") { } @@ -581,7 +581,7 @@ debug_view_expression::~debug_view_expression() void debug_view_expression::set_context(symbol_table *context) { - m_parsed.set_symbols((context != NULL) ? context : debug_cpu_get_global_symtable(&m_machine)); + m_parsed.set_symbols((context != NULL) ? context : debug_cpu_get_global_symtable(m_machine)); m_dirty = true; } diff --git a/src/emu/debug/dvdisasm.c b/src/emu/debug/dvdisasm.c index c98682776b9..5275eea49db 100644 --- a/src/emu/debug/dvdisasm.c +++ b/src/emu/debug/dvdisasm.c @@ -116,8 +116,8 @@ debug_view_disasm::debug_view_disasm(running_machine &machine, debug_view_osd_up debug_view_disasm::~debug_view_disasm() { - auto_free(&m_machine, m_byteaddress); - auto_free(&m_machine, m_dasm); + auto_free(m_machine, m_byteaddress); + auto_free(m_machine, m_dasm); } @@ -137,7 +137,7 @@ void debug_view_disasm::enumerate_sources() for (bool gotone = m_machine.m_devicelist.first(dasm); gotone; gotone = dasm->next(dasm)) { name.printf("%s '%s'", dasm->device().name(), dasm->device().tag()); - m_source_list.append(*auto_alloc(&m_machine, debug_view_disasm_source(name, dasm->device()))); + m_source_list.append(*auto_alloc(m_machine, debug_view_disasm_source(name, dasm->device()))); } // reset the source to a known good entry @@ -377,12 +377,12 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) m_allocated = m_total; // allocate address array - auto_free(&m_machine, m_byteaddress); - m_byteaddress = auto_alloc_array(&m_machine, offs_t, m_allocated.y); + auto_free(m_machine, m_byteaddress); + m_byteaddress = auto_alloc_array(m_machine, offs_t, m_allocated.y); // allocate disassembly buffer - auto_free(&m_machine, m_dasm); - m_dasm = auto_alloc_array(&m_machine, char, m_allocated.x * m_allocated.y); + auto_free(m_machine, m_dasm); + m_dasm = auto_alloc_array(m_machine, char, m_allocated.x * m_allocated.y); } // iterate over lines diff --git a/src/emu/debug/dvmemory.c b/src/emu/debug/dvmemory.c index 8d636999e49..0d2417fe0c1 100644 --- a/src/emu/debug/dvmemory.c +++ b/src/emu/debug/dvmemory.c @@ -160,7 +160,7 @@ void debug_view_memory::enumerate_sources() if (space != NULL) { name.printf("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space->name()); - m_source_list.append(*auto_alloc(&m_machine, debug_view_memory_source(name, *space))); + m_source_list.append(*auto_alloc(m_machine, debug_view_memory_source(name, *space))); } } @@ -168,7 +168,7 @@ void debug_view_memory::enumerate_sources() 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))); + m_source_list.append(*auto_alloc(m_machine, debug_view_memory_source(name, *region))); } // finally add all global array symbols @@ -185,7 +185,7 @@ void debug_view_memory::enumerate_sources() if (valcount > 1 && strstr(itemname, "globals/")) { name.cpy(strrchr(itemname, '/') + 1); - m_source_list.append(*auto_alloc(&m_machine, debug_view_memory_source(name, base, valsize, valcount))); + m_source_list.append(*auto_alloc(m_machine, debug_view_memory_source(name, base, valsize, valcount))); } } @@ -707,10 +707,10 @@ void debug_view_memory::write(UINT8 size, offs_t offs, UINT64 data) // hack for FD1094 editing #ifdef FD1094_HACK - if (source.m_base == *m_machine.region("user2")) + if (source.m_base == m_machine.region("user2")) { - extern void fd1094_regenerate_key(running_machine *machine); - fd1094_regenerate_key(&m_machine); + extern void fd1094_regenerate_key(running_machine &machine); + fd1094_regenerate_key(m_machine); } #endif } diff --git a/src/emu/debug/dvstate.c b/src/emu/debug/dvstate.c index 01383a3ca2c..296dadc6c35 100644 --- a/src/emu/debug/dvstate.c +++ b/src/emu/debug/dvstate.c @@ -108,7 +108,7 @@ void debug_view_state::enumerate_sources() for (bool gotone = m_machine.m_devicelist.first(state); gotone; gotone = state->next(state)) { name.printf("%s '%s'", state->device().name(), state->device().tag()); - m_source_list.append(*auto_alloc(&m_machine, debug_view_state_source(name, state->device()))); + m_source_list.append(*auto_alloc(m_machine, debug_view_state_source(name, state->device()))); } // reset the source to a known good entry @@ -127,7 +127,7 @@ void debug_view_state::reset() { state_item *oldhead = m_state_list; m_state_list = oldhead->m_next; - auto_free(&m_machine, oldhead); + auto_free(m_machine, oldhead); } } @@ -146,34 +146,34 @@ void debug_view_state::recompute() // add a cycles entry: cycles:99999999 state_item **tailptr = &m_state_list; - *tailptr = auto_alloc(&m_machine, state_item(REG_CYCLES, "cycles", 8)); + *tailptr = auto_alloc(m_machine, state_item(REG_CYCLES, "cycles", 8)); tailptr = &(*tailptr)->m_next; // add a beam entry: beamx:1234 - *tailptr = auto_alloc(&m_machine, state_item(REG_BEAMX, "beamx", 4)); + *tailptr = auto_alloc(m_machine, state_item(REG_BEAMX, "beamx", 4)); tailptr = &(*tailptr)->m_next; // add a beam entry: beamy:5678 - *tailptr = auto_alloc(&m_machine, state_item(REG_BEAMY, "beamy", 4)); + *tailptr = auto_alloc(m_machine, state_item(REG_BEAMY, "beamy", 4)); tailptr = &(*tailptr)->m_next; // add a beam entry: frame:123456 - *tailptr = auto_alloc(&m_machine, state_item(REG_FRAME, "frame", 6)); + *tailptr = auto_alloc(m_machine, state_item(REG_FRAME, "frame", 6)); tailptr = &(*tailptr)->m_next; // add a flags entry: flags:xxxxxxxx - *tailptr = auto_alloc(&m_machine, state_item(STATE_GENFLAGS, "flags", source.m_stateintf->state_string_max_length(STATE_GENFLAGS))); + *tailptr = auto_alloc(m_machine, state_item(STATE_GENFLAGS, "flags", source.m_stateintf->state_string_max_length(STATE_GENFLAGS))); tailptr = &(*tailptr)->m_next; // add a divider entry - *tailptr = auto_alloc(&m_machine, state_item(REG_DIVIDER, "", 0)); + *tailptr = auto_alloc(m_machine, state_item(REG_DIVIDER, "", 0)); tailptr = &(*tailptr)->m_next; // add all registers into it for (const device_state_entry *entry = source.m_stateintf->state_first(); entry != NULL; entry = entry->next()) if (entry->visible()) { - *tailptr = auto_alloc(&m_machine, state_item(entry->index(), entry->symbol(), source.m_stateintf->state_string_max_length(entry->index()))); + *tailptr = auto_alloc(m_machine, state_item(entry->index(), entry->symbol(), source.m_stateintf->state_string_max_length(entry->index()))); tailptr = &(*tailptr)->m_next; } diff --git a/src/emu/debugger.c b/src/emu/debugger.c index 519b08dcd1d..536740dd97b 100644 --- a/src/emu/debugger.c +++ b/src/emu/debugger.c @@ -60,15 +60,15 @@ static void debugger_exit(running_machine &machine); debugger_init - start up all subsections -------------------------------------------------*/ -void debugger_init(running_machine *machine) +void debugger_init(running_machine &machine) { /* only if debugging is enabled */ - if (machine->debug_flags & DEBUG_FLAG_ENABLED) + if (machine.debug_flags & DEBUG_FLAG_ENABLED) { machine_entry *entry; /* initialize the submodules */ - machine->m_debug_view = auto_alloc(machine, debug_view_manager(*machine)); + machine.m_debug_view = auto_alloc(machine, debug_view_manager(machine)); debug_cpu_init(machine); debug_command_init(machine); debug_console_init(machine); @@ -77,10 +77,10 @@ void debugger_init(running_machine *machine) debugint_init(machine); /* allocate a new entry for our global list */ - machine->add_notifier(MACHINE_NOTIFY_EXIT, debugger_exit); + machine.add_notifier(MACHINE_NOTIFY_EXIT, debugger_exit); entry = global_alloc(machine_entry); entry->next = machine_list; - entry->machine = machine; + entry->machine = &machine; machine_list = entry; /* register an atexit handler if we haven't yet */ @@ -89,10 +89,10 @@ void debugger_init(running_machine *machine) atexit_registered = TRUE; /* listen in on the errorlog */ - machine->add_logerror_callback(debug_errorlog_write_line); + machine.add_logerror_callback(debug_errorlog_write_line); /* initialize osd debugger features */ - machine->osd().init_debugger(); + machine.osd().init_debugger(); } } @@ -102,9 +102,9 @@ void debugger_init(running_machine *machine) video display -------------------------------------------------*/ -void debugger_refresh_display(running_machine *machine) +void debugger_refresh_display(running_machine &machine) { - machine->video().frame_update(true); + machine.video().frame_update(true); } @@ -141,7 +141,7 @@ void debugger_flush_all_traces_on_abnormal_exit(void) while (machine_list != NULL) { machine_entry *deleteme = machine_list; - debug_cpu_flush_traces(deleteme->machine); + debug_cpu_flush_traces(*deleteme->machine); machine_list = deleteme->next; global_free(deleteme); } diff --git a/src/emu/debugger.h b/src/emu/debugger.h index 4b13c3fa615..6b2978974eb 100644 --- a/src/emu/debugger.h +++ b/src/emu/debugger.h @@ -24,10 +24,10 @@ /* ----- core debugger functions ----- */ /* initialize the debugger */ -void debugger_init(running_machine *machine); +void debugger_init(running_machine &machine); /* redraw the current video display */ -void debugger_refresh_display(running_machine *machine); +void debugger_refresh_display(running_machine &machine); /* OSD can call this to safely flush all traces in the event of a crash */ void debugger_flush_all_traces_on_abnormal_exit(void); @@ -45,7 +45,7 @@ void debugger_flush_all_traces_on_abnormal_exit(void); INLINE void debugger_instruction_hook(device_t *device, offs_t curpc) { - if ((device->machine->debug_flags & DEBUG_FLAG_CALL_HOOK) != 0) + if ((device->machine().debug_flags & DEBUG_FLAG_CALL_HOOK) != 0) device->debug()->instruction_hook(curpc); } @@ -57,7 +57,7 @@ INLINE void debugger_instruction_hook(device_t *device, offs_t curpc) INLINE void debugger_exception_hook(device_t *device, int exception) { - if ((device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) device->debug()->exception_hook(exception); } @@ -75,7 +75,7 @@ INLINE void debugger_exception_hook(device_t *device, int exception) INLINE void debugger_start_cpu_hook(device_t *device, attotime endtime) { - if ((device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) device->debug()->start_hook(endtime); } @@ -88,7 +88,7 @@ INLINE void debugger_start_cpu_hook(device_t *device, attotime endtime) INLINE void debugger_stop_cpu_hook(device_t *device) { - if ((device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) device->debug()->stop_hook(); } @@ -101,7 +101,7 @@ INLINE void debugger_stop_cpu_hook(device_t *device) INLINE void debugger_interrupt_hook(device_t *device, int irqline) { - if ((device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) device->debug()->interrupt_hook(irqline); } @@ -116,9 +116,9 @@ INLINE void debugger_interrupt_hook(device_t *device, int irqline) next opportunity -------------------------------------------------*/ -INLINE void debugger_break(running_machine *machine) +INLINE void debugger_break(running_machine &machine) { - if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((machine.debug_flags & DEBUG_FLAG_ENABLED) != 0) debug_cpu_get_visible_cpu(machine)->debug()->halt_on_next_instruction("Internal breakpoint\n"); } @@ -129,9 +129,9 @@ INLINE void debugger_break(running_machine *machine) halted within the instruction hook -------------------------------------------------*/ -INLINE int debugger_within_instruction_hook(running_machine *machine) +INLINE int debugger_within_instruction_hook(running_machine &machine) { - if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + if ((machine.debug_flags & DEBUG_FLAG_ENABLED) != 0) return debug_cpu_within_instruction_hook(machine); return FALSE; } diff --git a/src/emu/debugint/debugint.c b/src/emu/debugint/debugint.c index a6fedf61500..82a393105f0 100644 --- a/src/emu/debugint/debugint.c +++ b/src/emu/debugint/debugint.c @@ -150,7 +150,7 @@ class DView DISABLE_COPYING(DView); public: - DView(render_target *target, running_machine *machine, debug_view_type type, int flags) + DView(render_target *target, running_machine &machine, debug_view_type type, int flags) : next(NULL), type(0), state(0), @@ -160,9 +160,9 @@ public: this->target = target; //dv->container = render_target_get_component_container(target, name, &pos); this->container = target->debug_alloc(); - this->view = machine->debug_view().alloc_view(type, dview_update, this); + this->view = machine.debug_view().alloc_view(type, dview_update, this); this->type = type; - this->machine = machine; + this->m_machine = &machine; this->state = flags | VIEW_STATE_NEEDS_UPDATE; // initial size @@ -186,16 +186,18 @@ public: ~DView() { this->target->debug_free(*this->container); - machine->debug_view().free_view(*this->view); + m_machine->debug_view().free_view(*this->view); } + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } + DView * next; int type; debug_view * view; render_container * container; render_target * target; - running_machine * machine; + running_machine * m_machine; int state; // drawing rectangle bounds; @@ -299,7 +301,7 @@ static void set_focus_view(DView *dv) } } -static DView *dview_alloc(render_target *target, running_machine *machine, debug_view_type type, int flags) +static DView *dview_alloc(render_target *target, running_machine &machine, debug_view_type type, int flags) { DView *dv; @@ -316,7 +318,7 @@ static void dview_free(DView *dv) { //astring_free(dv->title); LIST_REMOVE(list, dv, DView); - auto_free(dv->machine, dv); + auto_free(dv->machine(), dv); } static void dview_get_rect(DView *dv, int type, rectangle *rect) @@ -895,11 +897,11 @@ static void debugint_exit(running_machine &machine) } -void debugint_init(running_machine *machine) +void debugint_init(running_machine &machine) { unicode_char ch; int chw; - debug_font = machine->render().font_alloc("ui.bdf"); //ui_get_font(machine); + debug_font = machine.render().font_alloc("ui.bdf"); //ui_get_font(machine); debug_font_width = 0; debug_font_height = 15; @@ -908,7 +910,7 @@ void debugint_init(running_machine *machine) list = NULL; focus_view = NULL; - debug_font_aspect = machine->render().ui_aspect(); + debug_font_aspect = machine.render().ui_aspect(); for (ch=0;ch<=127;ch++) { @@ -919,7 +921,7 @@ void debugint_init(running_machine *machine) debug_font_width++; /* FIXME: above does not really work */ debug_font_width = 10; - machine->add_notifier(MACHINE_NOTIFY_EXIT, debugint_exit); + machine.add_notifier(MACHINE_NOTIFY_EXIT, debugint_exit); } #if 0 @@ -957,9 +959,9 @@ static void process_string(DView *dv, const char *str) break; case DVT_CONSOLE: if(!dv->editor.str[(long)0]) - debug_cpu_get_visible_cpu(dv->machine)->debug()->single_step(); + debug_cpu_get_visible_cpu(dv->machine())->debug()->single_step(); else - debug_console_execute_command(dv->machine, str, 1); + debug_console_execute_command(dv->machine(), str, 1); break; case DVT_MEMORY: downcast<debug_view_memory *>(dv->view)->set_expression(str); @@ -977,11 +979,11 @@ static void on_disassembly_window_activate(DView *dv, const ui_menu_event *event render_target *target; const debug_view_source *source; - target = &dv->machine->render().ui_target(); + target = &dv->machine().render().ui_target(); - ndv = dview_alloc(target, dv->machine, DVT_DISASSEMBLY, 0); + ndv = dview_alloc(target, dv->machine(), DVT_DISASSEMBLY, 0); ndv->editor.active = TRUE; - ndv->editor.container = &dv->machine->render().ui_container(); + ndv->editor.container = &dv->machine().render().ui_container(); source = ndv->view->source(); dview_set_title(ndv, source->name()); set_focus_view(ndv); @@ -1010,8 +1012,8 @@ static void on_log_window_activate(DView *dv, const ui_menu_event *event) DView *ndv; render_target *target; - target = &dv->machine->render().ui_target(); - ndv = dview_alloc(target, dv->machine, DVT_LOG, 0); + target = &dv->machine().render().ui_target(); + ndv = dview_alloc(target, dv->machine(), DVT_LOG, 0); dview_set_title(ndv, "Log"); set_focus_view(ndv); } @@ -1025,63 +1027,63 @@ static void on_close_activate(DView *dv, const ui_menu_event *event) static void on_run_activate(DView *dv, const ui_menu_event *event) { - debug_cpu_get_visible_cpu(dv->machine)->debug()->go(); + debug_cpu_get_visible_cpu(dv->machine())->debug()->go(); } #if 0 void on_run_h_activate(DView *dv, const ui_menu_event *event) { debugwin_show(0); - debug_cpu_get_visible_cpu(dv->machine)->debug()->go(); + debug_cpu_get_visible_cpu(dv->machine())->debug()->go(); } #endif static void on_run_cpu_activate(DView *dv, const ui_menu_event *event) { - debug_cpu_get_visible_cpu(dv->machine)->debug()->go_next_device(); + debug_cpu_get_visible_cpu(dv->machine())->debug()->go_next_device(); } static void on_run_irq_activate(DView *dv, const ui_menu_event *event) { - debug_cpu_get_visible_cpu(dv->machine)->debug()->go_interrupt(); + debug_cpu_get_visible_cpu(dv->machine())->debug()->go_interrupt(); } static void on_run_vbl_activate(DView *dv, const ui_menu_event *event) { - debug_cpu_get_visible_cpu(dv->machine)->debug()->go_vblank(); + debug_cpu_get_visible_cpu(dv->machine())->debug()->go_vblank(); } static void on_step_into_activate(DView *dv, const ui_menu_event *event) { - debug_cpu_get_visible_cpu(dv->machine)->debug()->single_step(); + debug_cpu_get_visible_cpu(dv->machine())->debug()->single_step(); } static void on_step_over_activate(DView *dv, const ui_menu_event *event) { - debug_cpu_get_visible_cpu(dv->machine)->debug()->single_step_over(); + debug_cpu_get_visible_cpu(dv->machine())->debug()->single_step_over(); } #ifdef UNUSED_CODE static void on_step_out_activate(DView *dv, const ui_menu_event *event) { - debug_cpu_get_visible_cpu(dv->machine)->debug()->single_step_out(); + debug_cpu_get_visible_cpu(dv->machine())->debug()->single_step_out(); } #endif static void on_hard_reset_activate(DView *dv, const ui_menu_event *event) { - dv->machine->schedule_hard_reset(); + dv->machine().schedule_hard_reset(); } static void on_soft_reset_activate(DView *dv, const ui_menu_event *event) { - dv->machine->schedule_soft_reset(); - debug_cpu_get_visible_cpu(dv->machine)->debug()->go(); + dv->machine().schedule_soft_reset(); + debug_cpu_get_visible_cpu(dv->machine())->debug()->go(); } static void on_exit_activate(DView *dv, const ui_menu_event *event) { - dv->machine->schedule_exit(); + dv->machine().schedule_exit(); } static void on_view_opcodes_activate(DView *dv, const ui_menu_event *event) @@ -1108,11 +1110,11 @@ static void on_run_to_cursor_activate(DView *dv, const ui_menu_event *event) { char command[64]; - if (dv->view->cursor_visible() && debug_cpu_get_visible_cpu(dv->machine) == dv->view->source()->device()) + if (dv->view->cursor_visible() && debug_cpu_get_visible_cpu(dv->machine()) == dv->view->source()->device()) { offs_t address = downcast<debug_view_disasm *>(dv->view)->selected_address(); sprintf(command, "go %X", address); - debug_console_execute_command(dv->machine, command, 1); + debug_console_execute_command(dv->machine(), command, 1); } } @@ -1157,7 +1159,7 @@ static void render_editor(DView_edit *editor) menu_main_populate - populate the main menu -------------------------------------------------*/ -static void CreateMainMenu(running_machine *machine) +static void CreateMainMenu(running_machine &machine) { const char *subtext = ""; int rc; @@ -1165,7 +1167,7 @@ static void CreateMainMenu(running_machine *machine) if (menu != NULL) ui_menu_free(menu); - menu = ui_menu_alloc(machine, &machine->render().ui_container(),NULL,NULL); + menu = ui_menu_alloc(machine, &machine.render().ui_container(),NULL,NULL); switch (focus_view->type) { @@ -1258,7 +1260,7 @@ static int map_point(DView *dv, INT32 target_x, INT32 target_y, INT32 *mapped_x, return FALSE; } -static void handle_mouse(running_machine *machine) +static void handle_mouse(running_machine &machine) { render_target * mouse_target; INT32 x,y; @@ -1288,7 +1290,7 @@ static void handle_mouse(running_machine *machine) handle_editor - handle the editor -------------------------------------------------*/ -static void handle_editor(running_machine *machine) +static void handle_editor(running_machine &machine) { if (focus_view->editor.active) { @@ -1344,12 +1346,12 @@ static void handle_editor(running_machine *machine) menu_main - handle the main menu -------------------------------------------------*/ -static void handle_menus(running_machine *machine) +static void handle_menus(running_machine &machine) { const ui_menu_event *event; - machine->render().ui_container().empty(); - ui_input_frame_update(*machine); + machine.render().ui_container().empty(); + ui_input_frame_update(machine); if (menu != NULL) { /* process the menu */ @@ -1447,35 +1449,35 @@ void debugint_wait_for_debugger(device_t &device, bool firststop) DView *dv; render_target *target; - target = &device.machine->render().ui_target(); + target = &device.machine().render().ui_target(); //set_view_by_name(target, "Debug"); - dv = dview_alloc(target, device.machine, DVT_DISASSEMBLY, VIEW_STATE_FOLLOW_CPU); + dv = dview_alloc(target, device.machine(), DVT_DISASSEMBLY, VIEW_STATE_FOLLOW_CPU); dv->editor.active = TRUE; - dv->editor.container = &device.machine->render().ui_container(); - dv = dview_alloc(target, device.machine, DVT_STATE, VIEW_STATE_FOLLOW_CPU); - dv = dview_alloc(target, device.machine, DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU); + dv->editor.container = &device.machine().render().ui_container(); + dv = dview_alloc(target, device.machine(), DVT_STATE, VIEW_STATE_FOLLOW_CPU); + dv = dview_alloc(target, device.machine(), DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU); dview_set_title(dv, "Console"); dv->editor.active = TRUE; - dv->editor.container = &device.machine->render().ui_container(); + dv->editor.container = &device.machine().render().ui_container(); set_focus_view(dv); } followers_set_cpu(&device); - //ui_update_and_render(device.machine, &device.machine->render().ui_container()()); + //ui_update_and_render(device.machine(), device.machine().render().ui_container()()); update_views(); - device.machine->osd().update(false); - handle_menus(device.machine); - handle_mouse(device.machine); + device.machine().osd().update(false); + handle_menus(device.machine()); + handle_mouse(device.machine()); //osd_sleep(osd_ticks_per_second()/60); } -void debugint_update_during_game(running_machine *machine) +void debugint_update_during_game(running_machine &machine) { - if (!debug_cpu_is_stopped(machine) && machine->phase() == MACHINE_PHASE_RUNNING) + if (!debug_cpu_is_stopped(machine) && machine.phase() == MACHINE_PHASE_RUNNING) { update_views(); } diff --git a/src/emu/debugint/debugint.h b/src/emu/debugint/debugint.h index 4d057e17b15..850be46a547 100644 --- a/src/emu/debugint/debugint.h +++ b/src/emu/debugint/debugint.h @@ -36,12 +36,12 @@ ***************************************************************************/ /* initialize the internal debugger */ -void debugint_init(running_machine *machine); +void debugint_init(running_machine &machine); /* process events for internal debugger */ void debugint_wait_for_debugger(device_t &device, bool firststop); /* update the internal debugger during a game */ -void debugint_update_during_game(running_machine *machine); +void debugint_update_during_game(running_machine &machine); #endif diff --git a/src/emu/devcb.c b/src/emu/devcb.c index d70af9f9507..5907abc7a3f 100644 --- a/src/emu/devcb.c +++ b/src/emu/devcb.c @@ -41,7 +41,7 @@ void devcb_resolve_read_line(devcb_resolved_read_line *resolved, const devcb_rea /* input port handlers */ if (config->type == DEVCB_TYPE_INPUT) { - resolved->target = device->machine->port(config->tag); + resolved->target = device->machine().port(config->tag); if (resolved->target == NULL) fatalerror("devcb_resolve_read_line: unable to find input port '%s' (requested by %s '%s')", config->tag, device->name(), device->tag()); resolved->read = trampoline_read_port_to_read_line; @@ -74,7 +74,7 @@ void devcb_resolve_read_line(devcb_resolved_read_line *resolved, const devcb_rea if (config->type == DEVCB_TYPE_SELF) resolved->target = device; else if (config->type == DEVCB_TYPE_DRIVER) - resolved->target = device->machine->driver_data(); + resolved->target = device->machine().driver_data(); else if (strcmp(config->tag, DEVICE_SELF_OWNER) == 0) resolved->target = device->owner(); @@ -130,7 +130,7 @@ void devcb_resolve_write_line(devcb_resolved_write_line *resolved, const devcb_w if (config->type == DEVCB_TYPE_INPUT) { - resolved->target = device->machine->port(config->tag); + resolved->target = device->machine().port(config->tag); if (resolved->target == NULL) fatalerror("devcb_resolve_write_line: unable to find input port '%s' (requested by %s '%s')", config->tag, device->name(), device->tag()); resolved->write = trampoline_write_port_to_write_line; @@ -178,7 +178,7 @@ void devcb_resolve_write_line(devcb_resolved_write_line *resolved, const devcb_w if (config->type == DEVCB_TYPE_SELF) resolved->target = device; else if (config->type == DEVCB_TYPE_DRIVER) - resolved->target = device->machine->driver_data(); + resolved->target = device->machine().driver_data(); else if (strcmp(config->tag, DEVICE_SELF_OWNER) == 0) resolved->target = device->owner(); @@ -228,7 +228,7 @@ void devcb_resolve_read8(devcb_resolved_read8 *resolved, const devcb_read8 *conf /* input port handlers */ if (config->type == DEVCB_TYPE_INPUT) { - resolved->target = device->machine->port(config->tag); + resolved->target = device->machine().port(config->tag); if (resolved->target == NULL) fatalerror("devcb_resolve_read8: unable to find input port '%s' (requested by %s '%s')", config->tag, device->name(), device->tag()); resolved->read = trampoline_read_port_to_read8; @@ -258,7 +258,7 @@ void devcb_resolve_read8(devcb_resolved_read8 *resolved, const devcb_read8 *conf if (config->type == DEVCB_TYPE_SELF) resolved->target = device; else if (config->type == DEVCB_TYPE_DRIVER) - resolved->target = device->machine->driver_data(); + resolved->target = device->machine().driver_data(); else if (strcmp(config->tag, DEVICE_SELF_OWNER) == 0) resolved->target = device->owner(); @@ -307,7 +307,7 @@ void devcb_resolve_write8(devcb_resolved_write8 *resolved, const devcb_write8 *c if (config->type == DEVCB_TYPE_INPUT) { - resolved->target = device->machine->port(config->tag); + resolved->target = device->machine().port(config->tag); if (resolved->target == NULL) fatalerror("devcb_resolve_read_line: unable to find input port '%s' (requested by %s '%s')", config->tag, device->name(), device->tag()); resolved->write = trampoline_write_port_to_write8; @@ -337,7 +337,7 @@ void devcb_resolve_write8(devcb_resolved_write8 *resolved, const devcb_write8 *c if (config->type == DEVCB_TYPE_SELF) resolved->target = device; else if (config->type == DEVCB_TYPE_DRIVER) - resolved->target = device->machine->driver_data(); + resolved->target = device->machine().driver_data(); else if (strcmp(config->tag, DEVICE_SELF_OWNER) == 0) resolved->target = device->owner(); diff --git a/src/emu/devcb.h b/src/emu/devcb.h index 6940923bed8..6641c2fdaf1 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)(*memory_nonspecific_space(device->machine), 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)(*memory_nonspecific_space(device->machine), offset, data, 0xff); + (target->*_Function)(*memory_nonspecific_space(device->machine()), offset, data, 0xff); } #define DEVCB_NULL { DEVCB_TYPE_NULL } diff --git a/src/emu/devcpu.c b/src/emu/devcpu.c index 9585949b348..4793308c966 100644 --- a/src/emu/devcpu.c +++ b/src/emu/devcpu.c @@ -236,7 +236,7 @@ legacy_cpu_device::legacy_cpu_device(running_machine &machine, const legacy_cpu_ throw emu_fatalerror("Device %s specifies a 0 context size!\n", tag()); // allocate memory for the token - m_token = auto_alloc_array_clear(&machine, UINT8, tokenbytes); + m_token = auto_alloc_array_clear(machine, UINT8, tokenbytes); } diff --git a/src/emu/devcpu.h b/src/emu/devcpu.h index aa40b5f78ea..e889321448f 100644 --- a/src/emu/devcpu.h +++ b/src/emu/devcpu.h @@ -286,8 +286,8 @@ const device_type name = basename##_device_config::static_alloc_device_config #define INTERRUPT_GEN(func) void func(device_t *device) // helpers for using machine/cputag instead of cpu objects -#define cputag_set_input_line(mach, tag, line, state) device_execute((mach)->device(tag))->set_input_line(line, state) -#define cputag_set_input_line_and_vector(mach, tag, line, state, vec) device_execute((mach)->device(tag))->set_input_line_and_vector(line, state, vec) +#define cputag_set_input_line(mach, tag, line, state) device_execute((mach).device(tag))->set_input_line(line, state) +#define cputag_set_input_line_and_vector(mach, tag, line, state, vec) device_execute((mach).device(tag))->set_input_line_and_vector(line, state, vec) diff --git a/src/emu/devimage.c b/src/emu/devimage.c index 0815a74df09..d2183f690ba 100644 --- a/src/emu/devimage.c +++ b/src/emu/devimage.c @@ -487,7 +487,7 @@ done: if (m_err!=0) { if (!m_init_phase) { - if (machine->phase() == MACHINE_PHASE_RUNNING) + if (m_machine.phase() == MACHINE_PHASE_RUNNING) popmessage("Error: Unable to %s image '%s': %s\n", is_create ? "create" : "load", path, error()); else mame_printf_error("Error: Unable to %s image '%s': %s", is_create ? "create" : "load", path, error()); @@ -496,13 +496,13 @@ done: } else { /* do we need to reset the CPU? only schedule it if load/create is successful */ - if (device().machine->time() > attotime::zero && m_image_config.is_reset_on_load()) - device().machine->schedule_hard_reset(); + if (device().machine().time() > attotime::zero && m_image_config.is_reset_on_load()) + device().machine().schedule_hard_reset(); else { if (!m_init_phase) { - if (machine->phase() == MACHINE_PHASE_RUNNING) + if (m_machine.phase() == MACHINE_PHASE_RUNNING) popmessage("Image '%s' was successfully %s.", path, is_create ? "created" : "loaded"); else mame_printf_info("Image '%s' was successfully %s.\n", path, is_create ? "created" : "loaded"); diff --git a/src/emu/devintrf.c b/src/emu/devintrf.c index 60c217b06af..094693f3114 100644 --- a/src/emu/devintrf.c +++ b/src/emu/devintrf.c @@ -189,7 +189,7 @@ void device_list::static_exit(running_machine &machine) { // first let the debugger save comments if ((machine.debug_flags & DEBUG_FLAG_ENABLED) != 0) - debug_comment_save(&machine); + debug_comment_save(machine); // then nuke the devices machine.m_devicelist.reset(); @@ -201,7 +201,7 @@ void device_list::static_exit(running_machine &machine) // about to save //------------------------------------------------- -void device_list::static_pre_save(running_machine *machine, void *param) +void device_list::static_pre_save(running_machine &machine, void *param) { device_list *list = reinterpret_cast<device_list *>(param); for (device_t *device = list->first(); device != NULL; device = device->next()) @@ -214,7 +214,7 @@ void device_list::static_pre_save(running_machine *machine, void *param) // completed a load //------------------------------------------------- -void device_list::static_post_load(running_machine *machine, void *param) +void device_list::static_post_load(running_machine &machine, void *param) { device_list *list = reinterpret_cast<device_list *>(param); for (device_t *device = list->first(); device != NULL; device = device->next()) @@ -545,8 +545,7 @@ void device_interface::interface_debug_setup() //------------------------------------------------- device_t::device_t(running_machine &_machine, const device_config &config) - : machine(&_machine), - m_machine(_machine), + : m_machine(_machine), m_state_manager(_machine.state()), m_debug(NULL), m_execute(NULL), @@ -573,7 +572,7 @@ device_t::device_t(running_machine &_machine, const device_config &config) device_t::~device_t() { - auto_free(&m_machine, m_debug); + auto_free(m_machine, m_debug); } @@ -737,13 +736,13 @@ void device_t::start() intf->interface_pre_start(); // remember the number of state registrations - int state_registrations = machine->state().registration_count(); + int state_registrations = m_machine.state().registration_count(); // start the device device_start(); // complain if nothing was registered by the device - state_registrations = machine->state().registration_count() - state_registrations; + state_registrations = m_machine.state().registration_count() - state_registrations; device_execute_interface *exec; device_sound_interface *sound; if (state_registrations == 0 && (interface(exec) || interface(sound))) @@ -763,7 +762,7 @@ void device_t::start() // if we're debugging, create a device_debug object if ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0) { - m_debug = auto_alloc(&m_machine, device_debug(*this)); + m_debug = auto_alloc(m_machine, device_debug(*this)); debug_setup(); } @@ -983,7 +982,7 @@ device_t *device_t::auto_finder_base::find_device(device_t &base, const char *ta void *device_t::auto_finder_base::find_shared_ptr(device_t &base, const char *tag) { - return memory_get_shared(*base.machine, tag); + return memory_get_shared(base.machine(), tag); } @@ -994,6 +993,6 @@ void *device_t::auto_finder_base::find_shared_ptr(device_t &base, const char *ta size_t device_t::auto_finder_base::find_shared_size(device_t &base, const char *tag) { size_t result = 0; - memory_get_shared(*base.machine, tag, result); + memory_get_shared(base.machine(), tag, result); return result; } diff --git a/src/emu/devintrf.h b/src/emu/devintrf.h index 5b7106c2b66..1897daf9881 100644 --- a/src/emu/devintrf.h +++ b/src/emu/devintrf.h @@ -56,7 +56,7 @@ #define DERIVED_CLOCK(num, den) (0xff000000 | ((num) << 12) | ((den) << 0)) // shorthand for accessing devices by machine/type/tag -#define devtag_reset(mach,tag) (mach)->device(tag)->reset() +#define devtag_reset(mach,tag) (mach).device(tag)->reset() // often derived devices need only a different name and a simple parameter to differentiate them // these are provided as macros because you can't pass string literals to templates, annoyingly enough @@ -89,7 +89,7 @@ device_config *_ConfigClass::static_alloc_device_config(const machine_config &mc \ device_t *_ConfigClass::alloc_device(running_machine &machine) const \ { \ - return auto_alloc(&machine, _DeviceClass(machine, *this)); \ + return auto_alloc(machine, _DeviceClass(machine, *this)); \ } \ @@ -234,8 +234,8 @@ class device_list : public tagged_device_list<device_t> static void static_reset(running_machine &machine); static void static_exit(running_machine &machine); - static void static_pre_save(running_machine *machine, void *param); - static void static_post_load(running_machine *machine, void *param); + static void static_pre_save(running_machine &machine, void *param); + static void static_post_load(running_machine &machine, void *param); public: device_list(resource_pool &pool = global_resource_pool); @@ -394,6 +394,9 @@ protected: virtual ~device_t(); public: + // getters + running_machine &machine() const { return m_machine; } + // iteration helpers device_t *next() const { return m_next; } device_t *typenext() const; @@ -467,9 +470,6 @@ public: machine_config_constructor machine_config_additions() const { return m_baseconfig.machine_config_additions(); } const input_port_token *input_ports() const { return m_baseconfig.input_ports(); } -public: - running_machine * machine; - protected: // miscellaneous helpers void find_interfaces(); diff --git a/src/emu/devlegcy.c b/src/emu/devlegcy.c index 0479a2e87d5..638153683e6 100644 --- a/src/emu/devlegcy.c +++ b/src/emu/devlegcy.c @@ -217,7 +217,7 @@ legacy_device_base::legacy_device_base(running_machine &_machine, const device_c { int tokenbytes = m_config.get_legacy_config_int(DEVINFO_INT_TOKEN_BYTES); if (tokenbytes != 0) - m_token = auto_alloc_array_clear(machine, UINT8, tokenbytes); + m_token = auto_alloc_array_clear(m_machine, UINT8, tokenbytes); } diff --git a/src/emu/diexec.c b/src/emu/diexec.c index ae703b650be..d5c7b295d5c 100644 --- a/src/emu/diexec.c +++ b/src/emu/diexec.c @@ -314,7 +314,7 @@ device_execute_interface::~device_execute_interface() bool device_execute_interface::executing() const { - return (this == device().machine->scheduler().currently_executing()); + return (this == device().machine().scheduler().currently_executing()); } @@ -372,7 +372,7 @@ void device_execute_interface::adjust_icount(int delta) void device_execute_interface::abort_timeslice() { // ignore if not the executing device - if (this != device().machine->scheduler().currently_executing()) + if (this != device().machine().scheduler().currently_executing()) return; // swallow the remaining cycles @@ -442,7 +442,7 @@ void device_execute_interface::spin_until_time(attotime duration) suspend_until_trigger(TRIGGER_SUSPENDTIME + timetrig, true); // then set a timer for it - device().machine->scheduler().timer_set(duration, FUNC(static_timed_trigger_callback), TRIGGER_SUSPENDTIME + timetrig, this); + device().machine().scheduler().timer_set(duration, FUNC(static_timed_trigger_callback), TRIGGER_SUSPENDTIME + timetrig, this); timetrig = (timetrig + 1) % 256; } @@ -547,7 +547,7 @@ void device_execute_interface::execute_set_input(int linenum, int state) void device_execute_interface::interface_pre_start() { // fill in the initial states - int index = device().machine->m_devicelist.indexof(m_device); + int index = device().machine().m_devicelist.indexof(m_device); m_suspend = SUSPEND_REASON_RESET; m_profiler = profile_type(index + PROFILER_DEVICE_FIRST); m_inttrigger = index + TRIGGER_INT; @@ -558,9 +558,9 @@ void device_execute_interface::interface_pre_start() // allocate timers if we need them if (m_execute_config.m_vblank_interrupts_per_frame > 1) - m_partial_frame_timer = device().machine->scheduler().timer_alloc(FUNC(static_trigger_partial_frame_interrupt), (void *)this); + m_partial_frame_timer = device().machine().scheduler().timer_alloc(FUNC(static_trigger_partial_frame_interrupt), (void *)this); if (m_execute_config.m_timed_interrupt_period != attotime::zero) - m_timedint_timer = device().machine->scheduler().timer_alloc(FUNC(static_trigger_periodic_interrupt), (void *)this); + m_timedint_timer = device().machine().scheduler().timer_alloc(FUNC(static_trigger_periodic_interrupt), (void *)this); // register for save states m_device.save_item(NAME(m_suspend)); @@ -623,11 +623,11 @@ void device_execute_interface::interface_post_reset() // new style - use screen tag directly screen_device *screen; if (m_execute_config.m_vblank_interrupt_screen != NULL) - screen = downcast<screen_device *>(device().machine->device(m_execute_config.m_vblank_interrupt_screen)); + screen = downcast<screen_device *>(device().machine().device(m_execute_config.m_vblank_interrupt_screen)); // old style 'hack' setup - use screen #0 else - screen = device().machine->first_screen(); + screen = device().machine().first_screen(); assert(screen != NULL); screen->register_vblank_callback(static_on_vblank, NULL); @@ -665,7 +665,7 @@ void device_execute_interface::interface_clock_changed() m_divisor = attos; // re-compute the perfect interleave factor - device().machine->scheduler().compute_perfect_interleave(); + device().machine().scheduler().compute_perfect_interleave(); } @@ -709,7 +709,7 @@ void device_execute_interface::static_on_vblank(screen_device &screen, void *par if (vblank_state) { device_execute_interface *exec = NULL; - for (bool gotone = screen.machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) + for (bool gotone = screen.machine().m_devicelist.first(exec); gotone; gotone = exec->next(exec)) exec->on_vblank_start(screen); } } @@ -740,7 +740,7 @@ void device_execute_interface::on_vblank_start(screen_device &screen) // if we have more than one interrupt per frame, start the timer now to trigger the rest of them if (m_execute_config.m_vblank_interrupts_per_frame > 1 && !suspended(SUSPEND_REASON_DISABLE)) { - m_partial_frame_period = device().machine->primary_screen->frame_period() / m_execute_config.m_vblank_interrupts_per_frame; + m_partial_frame_period = device().machine().primary_screen->frame_period() / m_execute_config.m_vblank_interrupts_per_frame; m_partial_frame_timer->adjust(m_partial_frame_period); } } @@ -916,7 +916,7 @@ if (TEMPLOG) printf("setline(%s,%d,%d,%d)\n", m_device->tag(), m_linenum, state, // if this is the first one, set the timer if (event_index == 0) - m_execute->device().machine->scheduler().synchronize(FUNC(static_empty_event_queue), 0, (void *)this); + m_execute->device().machine().scheduler().synchronize(FUNC(static_empty_event_queue), 0, (void *)this); } } diff --git a/src/emu/diexec.h b/src/emu/diexec.h index 65b398a4640..db1fc83643f 100644 --- a/src/emu/diexec.h +++ b/src/emu/diexec.h @@ -300,7 +300,7 @@ protected: int m_qindex; // index within the queue private: - static void static_empty_event_queue(running_machine *machine, void *ptr, int param); + static void static_empty_event_queue(running_machine &machine, void *ptr, int param); void empty_event_queue(); }; @@ -344,15 +344,15 @@ protected: private: // callbacks - static void static_timed_trigger_callback(running_machine *machine, void *ptr, int param); + static void static_timed_trigger_callback(running_machine &machine, void *ptr, int param); static void static_on_vblank(screen_device &screen, void *param, bool vblank_state); void on_vblank_start(screen_device &screen); - static void static_trigger_partial_frame_interrupt(running_machine *machine, void *ptr, int param); + static void static_trigger_partial_frame_interrupt(running_machine &machine, void *ptr, int param); void trigger_partial_frame_interrupt(); - static void static_trigger_periodic_interrupt(running_machine *machine, void *ptr, int param); + static void static_trigger_periodic_interrupt(running_machine &machine, void *ptr, int param); void trigger_periodic_interrupt(); attoseconds_t minimum_quantum() const; diff --git a/src/emu/diimage.c b/src/emu/diimage.c index 6ef5203baec..7573fa8e6f3 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->system(); + gamedrv = &device().machine().system(); while(gamedrv && !try_change_working_directory(gamedrv->name)) { gamedrv = driver_get_compatible(gamedrv); @@ -431,7 +431,7 @@ UINT8 *device_image_interface::get_software_region(const char *tag) return NULL; sprintf( full_tag, "%s:%s", device().tag(), tag ); - return device().machine->region( full_tag )->base(); + return device().machine().region( full_tag )->base(); } @@ -444,7 +444,7 @@ UINT32 device_image_interface::get_software_region_length(const char *tag) char full_tag[256]; sprintf( full_tag, "%s:%s", device().tag(), tag ); - return device().machine->region( full_tag )->bytes(); + return device().machine().region( full_tag )->bytes(); } @@ -582,9 +582,9 @@ 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->system().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); + image_battery_load_by_name(device().machine().options(), astring_c(fname), buffer, length, fill); astring_free(fname); } @@ -596,9 +596,9 @@ 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->system().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); + image_battery_save_by_name(device().machine().options(), astring_c(fname), buffer, length); astring_free(fname); } diff --git a/src/emu/disound.c b/src/emu/disound.c index 4a1b31dc772..89fbd33ecb8 100644 --- a/src/emu/disound.c +++ b/src/emu/disound.c @@ -181,7 +181,7 @@ int device_sound_interface::inputs() const { // scan the list counting streams we own and summing their inputs int inputs = 0; - for (sound_stream *stream = m_device.machine->sound().first_stream(); stream != NULL; stream = stream->next()) + for (sound_stream *stream = m_device.machine().sound().first_stream(); stream != NULL; stream = stream->next()) if (&stream->device() == &m_device) inputs += stream->input_count(); return inputs; @@ -197,7 +197,7 @@ int device_sound_interface::outputs() const { // scan the list counting streams we own and summing their outputs int outputs = 0; - for (sound_stream *stream = m_device.machine->sound().first_stream(); stream != NULL; stream = stream->next()) + for (sound_stream *stream = m_device.machine().sound().first_stream(); stream != NULL; stream = stream->next()) if (&stream->device() == &m_device) outputs += stream->output_count(); return outputs; @@ -215,7 +215,7 @@ sound_stream *device_sound_interface::input_to_stream_input(int inputnum, int &s assert(inputnum >= 0); // scan the list looking for streams owned by this device - for (sound_stream *stream = m_device.machine->sound().first_stream(); stream != NULL; stream = stream->next()) + for (sound_stream *stream = m_device.machine().sound().first_stream(); stream != NULL; stream = stream->next()) if (&stream->device() == &m_device) { if (inputnum < stream->input_count()) @@ -242,7 +242,7 @@ sound_stream *device_sound_interface::output_to_stream_output(int outputnum, int assert(outputnum >= 0); // scan the list looking for streams owned by this device - for (sound_stream *stream = m_device.machine->sound().first_stream(); stream != NULL; stream = stream->next()) + for (sound_stream *stream = m_device.machine().sound().first_stream(); stream != NULL; stream = stream->next()) if (&stream->device() == &device()) { if (outputnum < stream->output_count()) @@ -268,7 +268,7 @@ void device_sound_interface::set_output_gain(int outputnum, float gain) // handle ALL_OUTPUTS as a special case if (outputnum == ALL_OUTPUTS) { - for (sound_stream *stream = m_device.machine->sound().first_stream(); stream != NULL; stream = stream->next()) + for (sound_stream *stream = m_device.machine().sound().first_stream(); stream != NULL; stream = stream->next()) if (&stream->device() == &device()) for (int outputnum = 0; outputnum < stream->output_count(); outputnum++) stream->set_output_gain(outputnum, gain); @@ -294,13 +294,13 @@ void device_sound_interface::interface_pre_start() { // scan all the sound devices device_sound_interface *sound = NULL; - for (bool gotone = m_device.machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound)) + for (bool gotone = m_device.machine().m_devicelist.first(sound); gotone; gotone = sound->next(sound)) { // scan each route on the device for (const device_config_sound_interface::sound_route *route = sound->sound_config().first_route(); route != NULL; route = route->next()) { // see if we are the target of this route; if we are, make sure the source device is started - device_t *target_device = m_device.machine->device(route->m_target); + device_t *target_device = m_device.machine().device(route->m_target); if (target_device == &m_device && !sound->device().started()) throw device_missing_dependencies(); } @@ -308,13 +308,13 @@ void device_sound_interface::interface_pre_start() // now iterate through devices again and assign any auto-allocated inputs m_auto_allocated_inputs = 0; - for (bool gotone = m_device.machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound)) + for (bool gotone = m_device.machine().m_devicelist.first(sound); gotone; gotone = sound->next(sound)) { // scan each route on the device for (const device_config_sound_interface::sound_route *route = sound->sound_config().first_route(); route != NULL; route = route->next()) { // see if we are the target of this route - device_t *target_device = m_device.machine->device(route->m_target); + device_t *target_device = m_device.machine().device(route->m_target); if (target_device == &m_device && route->m_input == AUTO_ALLOC_INPUT) { const_cast<device_config_sound_interface::sound_route *>(route)->m_input = m_auto_allocated_inputs; @@ -334,13 +334,13 @@ void device_sound_interface::interface_post_start() { // iterate over all the sound devices device_sound_interface *sound = NULL; - for (bool gotone = m_device.machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound)) + for (bool gotone = m_device.machine().m_devicelist.first(sound); gotone; gotone = sound->next(sound)) { // scan each route on the device for (const device_config_sound_interface::sound_route *route = sound->sound_config().first_route(); route != NULL; route = route->next()) { // if we are the target of this route, hook it up - device_t *target_device = m_device.machine->device(route->m_target); + device_t *target_device = m_device.machine().device(route->m_target); if (target_device == &m_device) { // iterate over all outputs, matching any that apply @@ -378,7 +378,7 @@ void device_sound_interface::interface_post_start() void device_sound_interface::interface_pre_reset() { // update all streams on this device prior to reset - for (sound_stream *stream = m_device.machine->sound().first_stream(); stream != NULL; stream = stream->next()) + for (sound_stream *stream = m_device.machine().sound().first_stream(); stream != NULL; stream = stream->next()) if (&stream->device() == &device()) stream->update(); } diff --git a/src/emu/distate.c b/src/emu/distate.c index f4e01737ea6..4a095bc5457 100644 --- a/src/emu/distate.c +++ b/src/emu/distate.c @@ -579,7 +579,7 @@ device_state_entry &device_state_interface::state_add(int index, const char *sym assert(symbol != NULL); // allocate new entry - device_state_entry *entry = auto_alloc(device().machine, device_state_entry(index, symbol, data, size)); + device_state_entry *entry = auto_alloc(device().machine(), device_state_entry(index, symbol, data, size)); // append to the end of the list m_state_list.append(*entry); diff --git a/src/emu/drawgfx.c b/src/emu/drawgfx.c index c5701def17e..cf5654394f1 100644 --- a/src/emu/drawgfx.c +++ b/src/emu/drawgfx.c @@ -79,9 +79,9 @@ INLINE INT32 normalize_yscroll(bitmap_t *bitmap, INT32 yscroll) elements referenced by a machine -------------------------------------------------*/ -void gfx_init(running_machine *machine) +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 */ @@ -92,7 +92,7 @@ void gfx_init(running_machine *machine) for (curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != NULL; curgfx++) { const gfx_decode_entry *gfxdecode = &gfxdecodeinfo[curgfx]; - const memory_region *region = (gfxdecode->memory_region != NULL) ? machine->region(gfxdecode->memory_region) : NULL; + const memory_region *region = (gfxdecode->memory_region != NULL) ? machine.region(gfxdecode->memory_region) : NULL; UINT32 region_length = (region != NULL) ? (8 * region->bytes()) : 0; const UINT8 *region_base = (region != NULL) ? region->base() : NULL; UINT32 xscale = (gfxdecode->xscale == 0) ? 1 : gfxdecode->xscale; @@ -206,7 +206,7 @@ void gfx_init(running_machine *machine) glcopy.total = total; /* allocate the graphics */ - machine->gfx[curgfx] = gfx_element_alloc(machine, &glcopy, (region_base != NULL) ? region_base + gfxdecode->start : NULL, gfxdecode->total_color_codes, gfxdecode->color_codes_start); + machine.gfx[curgfx] = gfx_element_alloc(machine, &glcopy, (region_base != NULL) ? region_base + gfxdecode->start : NULL, gfxdecode->total_color_codes, gfxdecode->color_codes_start); } } @@ -217,7 +217,7 @@ void gfx_init(running_machine *machine) based on a given layout -------------------------------------------------*/ -gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base) +gfx_element *gfx_element_alloc(running_machine &machine, const gfx_layout *gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base) { int israw = (gl->planeoffset[0] == GFX_RAW); int planes = gl->planes; @@ -243,7 +243,7 @@ gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, c gfx->total_colors = total_colors; gfx->srcdata = srcdata; - gfx->machine = machine; + gfx->m_machine = &machine; /* copy the layout */ gfx->layout = *gl; @@ -338,12 +338,12 @@ void gfx_element_free(gfx_element *gfx) return; /* free our data */ - auto_free(gfx->machine, gfx->layout.extyoffs); - auto_free(gfx->machine, gfx->layout.extxoffs); - auto_free(gfx->machine, gfx->pen_usage); - auto_free(gfx->machine, gfx->dirty); - auto_free(gfx->machine, gfx->gfxdata); - auto_free(gfx->machine, gfx); + auto_free(gfx->machine(), gfx->layout.extyoffs); + auto_free(gfx->machine(), gfx->layout.extxoffs); + auto_free(gfx->machine(), gfx->pen_usage); + auto_free(gfx->machine(), gfx->dirty); + auto_free(gfx->machine(), gfx->gfxdata); + auto_free(gfx->machine(), gfx); } @@ -352,7 +352,7 @@ void gfx_element_free(gfx_element *gfx) temporary one-off gfx_element -------------------------------------------------*/ -void gfx_element_build_temporary(gfx_element *gfx, running_machine *machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity, UINT32 flags) +void gfx_element_build_temporary(gfx_element *gfx, running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity, UINT32 flags) { static UINT8 not_dirty = 0; @@ -369,7 +369,7 @@ void gfx_element_build_temporary(gfx_element *gfx, running_machine *machine, UIN gfx->color_base = color_base; gfx->color_depth = color_granularity; gfx->color_granularity = color_granularity; - gfx->total_colors = (machine->total_colors() - color_base) / color_granularity; + gfx->total_colors = (machine.total_colors() - color_base) / color_granularity; gfx->pen_usage = NULL; @@ -380,7 +380,7 @@ void gfx_element_build_temporary(gfx_element *gfx, running_machine *machine, UIN gfx->dirty = ¬_dirty; gfx->dirtyseq = 0; - gfx->machine = machine; + gfx->m_machine = &machine; } @@ -517,7 +517,7 @@ void drawgfx_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_element /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* render based on dest bitmap depth */ if (dest->bpp == 16) @@ -553,7 +553,7 @@ void drawgfx_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_eleme /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* use pen usage to optimize */ if (gfx->pen_usage != NULL && !gfx->dirty[code]) @@ -638,7 +638,7 @@ void drawgfx_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_elem /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* use pen usage to optimize */ if (gfx->pen_usage != NULL && !gfx->dirty[code]) @@ -686,7 +686,7 @@ void drawgfx_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_ele /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* render based on dest bitmap depth */ if (dest->bpp == 16) @@ -723,7 +723,7 @@ void drawgfx_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* early out if completely transparent */ if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) @@ -768,7 +768,7 @@ void drawgfxzoom_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_ele /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* render based on dest bitmap depth */ if (dest->bpp == 16) @@ -811,7 +811,7 @@ void drawgfxzoom_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_e /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* use pen usage to optimize */ if (gfx->pen_usage != NULL && !gfx->dirty[code]) @@ -910,7 +910,7 @@ void drawgfxzoom_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_ /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* use pen usage to optimize */ if (gfx->pen_usage != NULL && !gfx->dirty[code]) @@ -965,7 +965,7 @@ void drawgfxzoom_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* render based on dest bitmap depth */ if (dest->bpp == 16) @@ -1009,7 +1009,7 @@ void drawgfxzoom_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_elem /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* early out if completely transparent */ if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) @@ -1047,7 +1047,7 @@ void pdrawgfx_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_elemen /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* high bit of the mask is implicitly on */ pmask |= 1 << 31; @@ -1086,7 +1086,7 @@ void pdrawgfx_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_elem /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* use pen usage to optimize */ if (gfx->pen_usage != NULL && !gfx->dirty[code]) @@ -1174,7 +1174,7 @@ void pdrawgfx_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx_ele /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* use pen usage to optimize */ if (gfx->pen_usage != NULL && !gfx->dirty[code]) @@ -1225,7 +1225,7 @@ void pdrawgfx_transtable(bitmap_t *dest, const rectangle *cliprect, const gfx_el /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* high bit of the mask is implicitly on */ pmask |= 1 << 31; @@ -1265,7 +1265,7 @@ void pdrawgfx_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_element /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* early out if completely transparent */ if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) @@ -1313,7 +1313,7 @@ void pdrawgfxzoom_opaque(bitmap_t *dest, const rectangle *cliprect, const gfx_el /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* high bit of the mask is implicitly on */ pmask |= 1 << 31; @@ -1360,7 +1360,7 @@ void pdrawgfxzoom_transpen(bitmap_t *dest, const rectangle *cliprect, const gfx_ /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* use pen usage to optimize */ if (gfx->pen_usage != NULL && !gfx->dirty[code]) @@ -1466,7 +1466,7 @@ void pdrawgfxzoom_transmask(bitmap_t *dest, const rectangle *cliprect, const gfx /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* use pen usage to optimize */ if (gfx->pen_usage != NULL && !gfx->dirty[code]) @@ -1525,7 +1525,7 @@ void pdrawgfxzoom_transtable(bitmap_t *dest, const rectangle *cliprect, const gf /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* high bit of the mask is implicitly on */ pmask |= 1 << 31; @@ -1574,7 +1574,7 @@ void pdrawgfxzoom_alpha(bitmap_t *dest, const rectangle *cliprect, const gfx_ele /* get final code and color, and grab lookup tables */ code %= gfx->total_elements; color %= gfx->total_colors; - paldata = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * color]; + paldata = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * color]; /* early out if completely transparent */ if (gfx->pen_usage != NULL && !gfx->dirty[code] && (gfx->pen_usage[code] & ~(1 << transpen)) == 0) diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h index b5f15be9ecb..4a379f580ab 100644 --- a/src/emu/drawgfx.h +++ b/src/emu/drawgfx.h @@ -120,6 +120,8 @@ struct _gfx_layout class gfx_element { public: + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } + UINT16 width; /* current pixel width of each element (changeble with source clipping) */ UINT16 height; /* current pixel height of each element (changeble with source clipping) */ UINT16 startx; /* current source clip X offset */ @@ -144,7 +146,7 @@ public: UINT8 * dirty; /* dirty array for detecting tiles that need decoding */ UINT32 dirtyseq; /* sequence number; incremented each time a tile is dirtied */ - running_machine *machine; /* pointer to the owning machine */ + running_machine *m_machine; /* pointer to the owning machine */ gfx_layout layout; /* copy of the original layout */ }; @@ -170,10 +172,10 @@ struct gfx_decode_entry /* ----- graphics elements ----- */ /* allocate memory for the graphics elements referenced by a machine */ -void gfx_init(running_machine *machine); +void gfx_init(running_machine &machine); /* allocate a gfx_element structure based on a given layout */ -gfx_element *gfx_element_alloc(running_machine *machine, const gfx_layout *gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base); +gfx_element *gfx_element_alloc(running_machine &machine, const gfx_layout *gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base); /* update a single code in a gfx_element */ void gfx_element_decode(const gfx_element *gfx, UINT32 code); @@ -182,7 +184,7 @@ void gfx_element_decode(const gfx_element *gfx, UINT32 code); void gfx_element_free(gfx_element *gfx); /* create a temporary one-off gfx_element */ -void gfx_element_build_temporary(gfx_element *gfx, running_machine *machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity, UINT32 flags); +void gfx_element_build_temporary(gfx_element *gfx, running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity, UINT32 flags); diff --git a/src/emu/driver.h b/src/emu/driver.h index fa38519c93f..47e64ef6564 100644 --- a/src/emu/driver.h +++ b/src/emu/driver.h @@ -60,7 +60,7 @@ TYPE DEFINITIONS ***************************************************************************/ -typedef void (*driver_init_func)(running_machine *machine); +typedef void (*driver_init_func)(running_machine &machine); struct game_driver @@ -73,7 +73,7 @@ struct game_driver const char * manufacturer; /* manufacturer of the game */ machine_config_constructor machine_config; /* machine driver tokens */ const input_port_token *ipt; /* pointer to array of input port tokens */ - void (*driver_init)(running_machine *machine); /* DRIVER_INIT callback */ + void (*driver_init)(running_machine &machine); /* DRIVER_INIT callback */ const rom_entry * rom; /* pointer to list of ROMs for the game */ const char * compatible_with; UINT32 flags; /* orientation and other flags; see defines below */ @@ -88,7 +88,7 @@ struct game_driver #define DRIVER_INIT_NAME(name) driver_init_##name -#define DRIVER_INIT(name) void DRIVER_INIT_NAME(name)(running_machine *machine) +#define DRIVER_INIT(name) void DRIVER_INIT_NAME(name)(running_machine &machine) #define DRIVER_INIT_CALL(name) DRIVER_INIT_NAME(name)(machine) #define driver_init_0 NULL diff --git a/src/emu/drivers/empty.c b/src/emu/drivers/empty.c index ad4511b44f3..bea3c2231ab 100644 --- a/src/emu/drivers/empty.c +++ b/src/emu/drivers/empty.c @@ -23,7 +23,7 @@ static MACHINE_START( empty ) { /* force the UI to show the game select screen */ - ui_menu_force_game_select(machine, &machine->render().ui_container()); + ui_menu_force_game_select(machine, &machine.render().ui_container()); } diff --git a/src/emu/emucore.h b/src/emu/emucore.h index b8801fc5159..68503d30887 100644 --- a/src/emu/emucore.h +++ b/src/emu/emucore.h @@ -373,7 +373,7 @@ inline _Dest crosscast(_Source *src) //************************************************************************** DECL_NORETURN void fatalerror(const char *format, ...) ATTR_PRINTF(1,2) ATTR_NORETURN; -DECL_NORETURN void fatalerror_exitcode(running_machine *machine, int exitcode, const char *format, ...) ATTR_PRINTF(3,4) ATTR_NORETURN; +DECL_NORETURN void fatalerror_exitcode(running_machine &machine, int exitcode, const char *format, ...) ATTR_PRINTF(3,4) ATTR_NORETURN; inline void fatalerror(const char *format, ...) { @@ -383,7 +383,7 @@ inline void fatalerror(const char *format, ...) va_end(ap); } -inline void fatalerror_exitcode(running_machine *machine, int exitcode, const char *format, ...) +inline void fatalerror_exitcode(running_machine &machine, int exitcode, const char *format, ...) { va_list ap; va_start(ap, format); diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c index d3db7c45503..69cca4f8b87 100644 --- a/src/emu/emuopts.c +++ b/src/emu/emuopts.c @@ -401,7 +401,7 @@ void emu_options::set_system_name(const char *name) const char *emu_options::device_option(device_image_interface &image) { - return image.device().machine->options().value(image.image_config().instance_name()); + return image.device().machine().options().value(image.image_config().instance_name()); } diff --git a/src/emu/emupal.c b/src/emu/emupal.c index 819c1746283..061aa96dd90 100644 --- a/src/emu/emupal.c +++ b/src/emu/emupal.c @@ -62,7 +62,9 @@ struct _palette_private class colortable_t { public: - running_machine * machine; /* associated machine */ + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } + + running_machine * m_machine; /* associated machine */ UINT32 entries; /* number of entries */ UINT32 palentries; /* number of palette entries */ UINT16 * raw; /* raw data about each entry */ @@ -75,13 +77,13 @@ public: FUNCTION PROTOTYPES ***************************************************************************/ -static void palette_presave(running_machine *machine, void *param); -static void palette_postload(running_machine *machine, void *param); +static void palette_presave(running_machine &machine, void *param); +static void palette_postload(running_machine &machine, void *param); static void palette_exit(running_machine &machine); -static void allocate_palette(running_machine *machine, palette_private *palette); -static void allocate_color_tables(running_machine *machine, palette_private *palette); -static void allocate_shadow_tables(running_machine *machine, palette_private *palette); -static void configure_rgb_shadows(running_machine *machine, int mode, float factor); +static void allocate_palette(running_machine &machine, palette_private *palette); +static void allocate_color_tables(running_machine &machine, palette_private *palette); +static void allocate_shadow_tables(running_machine &machine, palette_private *palette); +static void configure_rgb_shadows(running_machine &machine, int mode, float factor); @@ -94,17 +96,17 @@ static void configure_rgb_shadows(running_machine *machine, int mode, float fact takes place before the display is created -------------------------------------------------*/ -void palette_init(running_machine *machine) +void palette_init(running_machine &machine) { palette_private *palette = auto_alloc_clear(machine, palette_private); - screen_device *device = machine->first_screen(); + screen_device *device = machine.first_screen(); /* get the format from the first screen, or use BITMAP_FORMAT_INVALID, if screenless */ bitmap_format format = (device != NULL) ? device->format() : BITMAP_FORMAT_INVALID; /* request cleanup */ - machine->palette_data = palette; - machine->add_notifier(MACHINE_NOTIFY_EXIT, palette_exit); + machine.palette_data = palette; + machine.add_notifier(MACHINE_NOTIFY_EXIT, palette_exit); /* reset all our data */ palette->format = format; @@ -120,7 +122,7 @@ void palette_init(running_machine *machine) case BITMAP_FORMAT_INVALID: /* invalid format means no palette - or at least it should */ - assert(machine->total_colors() == 0); + assert(machine.total_colors() == 0); return; default: @@ -129,7 +131,7 @@ void palette_init(running_machine *machine) } /* allocate all the data structures */ - if (machine->total_colors() > 0) + if (machine.total_colors() > 0) { int numcolors; @@ -138,13 +140,13 @@ void palette_init(running_machine *machine) allocate_shadow_tables(machine, palette); /* set up save/restore of the palette */ - numcolors = palette_get_num_colors(machine->palette); + numcolors = palette_get_num_colors(machine.palette); palette->save_pen = auto_alloc_array(machine, pen_t, numcolors); palette->save_bright = auto_alloc_array(machine, float, numcolors); state_save_register_global_pointer(machine, palette->save_pen, numcolors); state_save_register_global_pointer(machine, palette->save_bright, numcolors); - machine->state().register_presave(palette_presave, palette); - machine->state().register_postload(palette_postload, palette); + machine.state().register_presave(palette_presave, palette); + machine.state().register_postload(palette_postload, palette); } } @@ -159,12 +161,12 @@ void palette_init(running_machine *machine) shadow brightness factor -------------------------------------------------*/ -void palette_set_shadow_factor(running_machine *machine, double factor) +void palette_set_shadow_factor(running_machine &machine, double factor) { - palette_private *palette = machine->palette_data; + palette_private *palette = machine.palette_data; assert(palette->shadow_group != 0); - palette_group_set_contrast(machine->palette, palette->shadow_group, factor); + palette_group_set_contrast(machine.palette, palette->shadow_group, factor); } @@ -173,12 +175,12 @@ void palette_set_shadow_factor(running_machine *machine, double factor) highlight brightness factor -------------------------------------------------*/ -void palette_set_highlight_factor(running_machine *machine, double factor) +void palette_set_highlight_factor(running_machine &machine, double factor) { - palette_private *palette = machine->palette_data; + palette_private *palette = machine.palette_data; assert(palette->hilight_group != 0); - palette_group_set_contrast(machine->palette, palette->hilight_group, factor); + palette_group_set_contrast(machine.palette, palette->hilight_group, factor); } @@ -238,11 +240,11 @@ void palette_set_highlight_factor(running_machine *machine, double factor) different live shadow tables -------------------------------------------------*/ -void palette_set_shadow_mode(running_machine *machine, int mode) +void palette_set_shadow_mode(running_machine &machine, int mode) { - palette_private *palette = machine->palette_data; + palette_private *palette = machine.palette_data; assert(mode >= 0 && mode < MAX_SHADOW_PRESETS); - machine->shadow_table = palette->shadow_table[mode].base; + machine.shadow_table = palette->shadow_table[mode].base; } @@ -251,9 +253,9 @@ void palette_set_shadow_mode(running_machine *machine, int mode) RGB values for 1 of 4 shadow tables -------------------------------------------------*/ -void palette_set_shadow_dRGB32(running_machine *machine, int mode, int dr, int dg, int db, int noclip) +void palette_set_shadow_dRGB32(running_machine &machine, int mode, int dr, int dg, int db, int noclip) { - palette_private *palette = machine->palette_data; + palette_private *palette = machine.palette_data; shadow_table_data *stable = &palette->shadow_table[mode]; int i; @@ -313,20 +315,19 @@ void palette_set_shadow_dRGB32(running_machine *machine, int mode, int dr, int d with the given number of entries -------------------------------------------------*/ -colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize) +colortable_t *colortable_alloc(running_machine &machine, UINT32 palettesize) { colortable_t *ctable; UINT32 index; - assert(machine != NULL); assert(palettesize > 0); /* allocate the colortable */ ctable = auto_alloc_clear(machine, colortable_t); /* fill in the basics */ - ctable->machine = machine; - ctable->entries = machine->total_colors(); + ctable->m_machine = &machine; + ctable->entries = machine.total_colors(); ctable->palentries = palettesize; /* allocate the raw colortable */ @@ -361,7 +362,7 @@ void colortable_entry_set_value(colortable_t *ctable, UINT32 entry, UINT16 value if (ctable->raw[entry] != value) { ctable->raw[entry] = value; - palette_set_color(ctable->machine, entry, ctable->palette[value]); + palette_set_color(ctable->machine(), entry, ctable->palette[value]); } } @@ -403,7 +404,7 @@ void colortable_palette_set_color(colortable_t *ctable, UINT32 entry, rgb_t colo /* update the palette for any colortable entries that reference it */ for (index = 0; index < ctable->entries; index++) if (ctable->raw[index] == entry) - palette_set_color(ctable->machine, index, color); + palette_set_color(ctable->machine(), index, color); } } @@ -495,9 +496,9 @@ UINT32 colortable_palette_get_size(colortable_t *ctable) black color -------------------------------------------------*/ -pen_t get_black_pen(running_machine *machine) +pen_t get_black_pen(running_machine &machine) { - palette_private *palette = machine->palette_data; + palette_private *palette = machine.palette_data; return palette->black_pen; } @@ -507,9 +508,9 @@ pen_t get_black_pen(running_machine *machine) white color -------------------------------------------------*/ -pen_t get_white_pen(running_machine *machine) +pen_t get_white_pen(running_machine &machine) { - palette_private *palette = machine->palette_data; + palette_private *palette = machine.palette_data; return palette->white_pen; } @@ -524,17 +525,17 @@ pen_t get_white_pen(running_machine *machine) for saving -------------------------------------------------*/ -static void palette_presave(running_machine *machine, void *param) +static void palette_presave(running_machine &machine, void *param) { - int numcolors = palette_get_num_colors(machine->palette); + int numcolors = palette_get_num_colors(machine.palette); palette_private *palette = (palette_private *)param; int index; /* fill the save arrays with updated pen and brightness information */ for (index = 0; index < numcolors; index++) { - palette->save_pen[index] = palette_entry_get_color(machine->palette, index); - palette->save_bright[index] = palette_entry_get_contrast(machine->palette, index); + palette->save_pen[index] = palette_entry_get_color(machine.palette, index); + palette->save_bright[index] = palette_entry_get_contrast(machine.palette, index); } } @@ -544,17 +545,17 @@ static void palette_presave(running_machine *machine, void *param) actually update the palette -------------------------------------------------*/ -static void palette_postload(running_machine *machine, void *param) +static void palette_postload(running_machine &machine, void *param) { - int numcolors = palette_get_num_colors(machine->palette); + int numcolors = palette_get_num_colors(machine.palette); palette_private *palette = (palette_private *)param; int index; /* reset the pen and brightness for each entry */ for (index = 0; index < numcolors; index++) { - palette_entry_set_color(machine->palette, index, palette->save_pen[index]); - palette_entry_set_contrast(machine->palette, index, palette->save_bright[index]); + palette_entry_set_color(machine.palette, index, palette->save_pen[index]); + palette_entry_set_contrast(machine.palette, index, palette->save_bright[index]); } } @@ -576,39 +577,39 @@ static void palette_exit(running_machine &machine) palette object itself -------------------------------------------------*/ -static void allocate_palette(running_machine *machine, palette_private *palette) +static void allocate_palette(running_machine &machine, palette_private *palette) { int numgroups, index; /* 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."); + assert_always(machine.total_colors() * numgroups <= 65536, "Error: palette has more than 65536 colors."); /* allocate a palette object containing all the colors and groups */ - machine->palette = palette_alloc(machine->total_colors(), numgroups); - assert_always(machine->palette != NULL, "Failed to allocate system palette"); + machine.palette = palette_alloc(machine.total_colors(), numgroups); + assert_always(machine.palette != NULL, "Failed to allocate system palette"); /* configure the groups */ if (palette->shadow_group != 0) - palette_group_set_contrast(machine->palette, palette->shadow_group, (float)PALETTE_DEFAULT_SHADOW_FACTOR); + palette_group_set_contrast(machine.palette, palette->shadow_group, (float)PALETTE_DEFAULT_SHADOW_FACTOR); if (palette->hilight_group != 0) - palette_group_set_contrast(machine->palette, palette->hilight_group, (float)PALETTE_DEFAULT_HIGHLIGHT_FACTOR); + palette_group_set_contrast(machine.palette, palette->hilight_group, (float)PALETTE_DEFAULT_HIGHLIGHT_FACTOR); /* set the initial colors to a standard rainbow */ - for (index = 0; index < machine->total_colors(); index++) - palette_entry_set_color(machine->palette, index, MAKE_RGB(pal1bit(index >> 0), pal1bit(index >> 1), pal1bit(index >> 2))); + for (index = 0; index < machine.total_colors(); index++) + palette_entry_set_color(machine.palette, index, MAKE_RGB(pal1bit(index >> 0), pal1bit(index >> 1), pal1bit(index >> 2))); /* switch off the color mode */ switch (palette->format) { /* 16-bit paletteized case */ case BITMAP_FORMAT_INDEXED16: - palette->black_pen = palette_get_black_entry(machine->palette); - palette->white_pen = palette_get_white_entry(machine->palette); + palette->black_pen = palette_get_black_entry(machine.palette); + palette->white_pen = palette_get_white_entry(machine.palette); if (palette->black_pen >= 65536) palette->black_pen = 0; if (palette->white_pen >= 65536) @@ -640,9 +641,9 @@ static void allocate_palette(running_machine *machine, palette_private *palette) pen and color tables -------------------------------------------------*/ -static void allocate_color_tables(running_machine *machine, palette_private *palette) +static void allocate_color_tables(running_machine &machine, palette_private *palette) { - int total_colors = palette_get_num_colors(machine->palette) * palette_get_num_groups(machine->palette); + int total_colors = palette_get_num_colors(machine.palette) * palette_get_num_groups(machine.palette); pen_t *pentable; int i; @@ -651,21 +652,21 @@ static void allocate_color_tables(running_machine *machine, palette_private *pal { case BITMAP_FORMAT_INDEXED16: /* create a dummy 1:1 mapping */ - machine->pens = pentable = auto_alloc_array(machine, pen_t, total_colors + 2); + machine.pens = pentable = auto_alloc_array(machine, pen_t, total_colors + 2); for (i = 0; i < total_colors + 2; i++) pentable[i] = i; break; case BITMAP_FORMAT_RGB15: - machine->pens = palette_entry_list_adjusted_rgb15(machine->palette); + machine.pens = palette_entry_list_adjusted_rgb15(machine.palette); break; case BITMAP_FORMAT_RGB32: - machine->pens = palette_entry_list_adjusted(machine->palette); + machine.pens = palette_entry_list_adjusted(machine.palette); break; default: - machine->pens = NULL; + machine.pens = NULL; break; } } @@ -676,10 +677,10 @@ static void allocate_color_tables(running_machine *machine, palette_private *pal shadow tables -------------------------------------------------*/ -static void allocate_shadow_tables(running_machine *machine, palette_private *palette) +static void allocate_shadow_tables(running_machine &machine, palette_private *palette) { /* if we have shadows, allocate shadow tables */ - if (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; @@ -689,7 +690,7 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa { palette->shadow_table[0].base = palette->shadow_table[2].base = table; for (i = 0; i < 65536; i++) - table[i] = (i < machine->total_colors()) ? (i + machine->total_colors()) : i; + table[i] = (i < machine.total_colors()) ? (i + machine.total_colors()) : i; } /* RGB mode gets two 32k tables in slots 0 and 2 */ @@ -702,7 +703,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; @@ -712,7 +713,7 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa { palette->shadow_table[1].base = palette->shadow_table[3].base = table; for (i = 0; i < 65536; i++) - table[i] = (i < machine->total_colors()) ? (i + 2 * machine->total_colors()) : i; + table[i] = (i < machine.total_colors()) ? (i + 2 * machine.total_colors()) : i; } /* RGB mode gets two 32k tables in slots 1 and 3 */ @@ -725,7 +726,7 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa } /* set the default table */ - machine->shadow_table = palette->shadow_table[0].base; + machine.shadow_table = palette->shadow_table[0].base; } @@ -734,9 +735,9 @@ static void allocate_shadow_tables(running_machine *machine, palette_private *pa for the RGB tables -------------------------------------------------*/ -static void configure_rgb_shadows(running_machine *machine, int mode, float factor) +static void configure_rgb_shadows(running_machine &machine, int mode, float factor) { - palette_private *palette = machine->palette_data; + palette_private *palette = machine.palette_data; shadow_table_data *stable = &palette->shadow_table[mode]; int ifactor = (int)(factor * 256.0f); int i; diff --git a/src/emu/emupal.h b/src/emu/emupal.h index 9b590de8c46..1180cfdb25a 100644 --- a/src/emu/emupal.h +++ b/src/emu/emupal.h @@ -124,34 +124,34 @@ class colortable_t; /* ----- initialization and configuration ----- */ /* palette initialization that takes place before the display is created */ -void palette_init(running_machine *machine); +void palette_init(running_machine &machine); /* ----- shadow/hilight configuration ----- */ /* set the global shadow brightness factor */ -void palette_set_shadow_factor(running_machine *machine, double factor); +void palette_set_shadow_factor(running_machine &machine, double factor); /* set the global highlight brightness factor */ -void palette_set_highlight_factor(running_machine *machine, double factor); +void palette_set_highlight_factor(running_machine &machine, double factor); /* ----- shadow table configuration ----- */ /* select 1 of 4 different live shadow tables */ -void palette_set_shadow_mode(running_machine *machine, int mode); +void palette_set_shadow_mode(running_machine &machine, int mode); /* configure delta RGB values for 1 of 4 shadow tables */ -void palette_set_shadow_dRGB32(running_machine *machine, int mode, int dr, int dg, int db, int noclip); +void palette_set_shadow_dRGB32(running_machine &machine, int mode, int dr, int dg, int db, int noclip); /* ----- colortable management ----- */ /* allocate a new colortable with the given number of entries */ -colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize); +colortable_t *colortable_alloc(running_machine &machine, UINT32 palettesize); /* set the value of a colortable entry */ void colortable_entry_set_value(colortable_t *ctable, UINT32 entry, UINT16 value); @@ -179,10 +179,10 @@ UINT32 colortable_palette_get_size(colortable_t *ctable); /* ----- utilities ----- */ /* return the pen for a fixed black color */ -pen_t get_black_pen(running_machine *machine); +pen_t get_black_pen(running_machine &machine); /* return the pen for a fixed white color */ -pen_t get_white_pen(running_machine *machine); +pen_t get_white_pen(running_machine &machine); @@ -196,9 +196,9 @@ pen_t get_white_pen(running_machine *machine); entry -------------------------------------------------*/ -INLINE void palette_set_color(running_machine *machine, pen_t pen, rgb_t rgb) +INLINE void palette_set_color(running_machine &machine, pen_t pen, rgb_t rgb) { - palette_entry_set_color(machine->palette, pen, rgb); + palette_entry_set_color(machine.palette, pen, rgb); } @@ -207,9 +207,9 @@ INLINE void palette_set_color(running_machine *machine, pen_t pen, rgb_t rgb) entry with individual R,G,B components -------------------------------------------------*/ -INLINE void palette_set_color_rgb(running_machine *machine, pen_t pen, UINT8 r, UINT8 g, UINT8 b) +INLINE void palette_set_color_rgb(running_machine &machine, pen_t pen, UINT8 r, UINT8 g, UINT8 b) { - palette_entry_set_color(machine->palette, pen, MAKE_RGB(r, g, b)); + palette_entry_set_color(machine.palette, pen, MAKE_RGB(r, g, b)); } @@ -218,9 +218,9 @@ INLINE void palette_set_color_rgb(running_machine *machine, pen_t pen, UINT8 r, entry -------------------------------------------------*/ -INLINE rgb_t palette_get_color(running_machine *machine, pen_t pen) +INLINE rgb_t palette_get_color(running_machine &machine, pen_t pen) { - return palette_entry_get_color(machine->palette, pen); + return palette_entry_get_color(machine.palette, pen); } @@ -229,9 +229,9 @@ INLINE rgb_t palette_get_color(running_machine *machine, pen_t pen) contrast factor -------------------------------------------------*/ -INLINE void palette_set_pen_contrast(running_machine *machine, pen_t pen, double bright) +INLINE void palette_set_pen_contrast(running_machine &machine, pen_t pen, double bright) { - palette_entry_set_contrast(machine->palette, pen, bright); + palette_entry_set_contrast(machine.palette, pen, bright); } @@ -240,10 +240,10 @@ INLINE void palette_set_pen_contrast(running_machine *machine, pen_t pen, double entries from an array of rgb_t values -------------------------------------------------*/ -INLINE void palette_set_colors(running_machine *machine, pen_t color_base, const rgb_t *colors, int color_count) +INLINE void palette_set_colors(running_machine &machine, pen_t color_base, const rgb_t *colors, int color_count) { while (color_count--) - palette_entry_set_color(machine->palette, color_base++, *colors++); + palette_entry_set_color(machine.palette, color_base++, *colors++); } diff --git a/src/emu/image.c b/src/emu/image.c index 03cfb34e339..e228f980a76 100644 --- a/src/emu/image.c +++ b/src/emu/image.c @@ -62,7 +62,7 @@ struct io_procs image_ioprocs = configuration items -------------------------------------------------*/ -static void image_dirs_load(running_machine *machine, int config_type, xml_data_node *parentnode) +static void image_dirs_load(running_machine &machine, int config_type, xml_data_node *parentnode) { xml_data_node *node; const char *dev_instance; @@ -77,7 +77,7 @@ static void image_dirs_load(running_machine *machine, int config_type, xml_data_ if ((dev_instance != NULL) && (dev_instance[0] != '\0')) { - for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image)) + for (bool gotone = machine.m_devicelist.first(image); gotone; gotone = image->next(image)) { if (!strcmp(dev_instance, image->image_config().instance_name())) { working_directory = xml_get_attribute_string(node, "directory", NULL); @@ -97,7 +97,7 @@ static void image_dirs_load(running_machine *machine, int config_type, xml_data_ directories to the configuration file -------------------------------------------------*/ -static void image_dirs_save(running_machine *machine, int config_type, xml_data_node *parentnode) +static void image_dirs_save(running_machine &machine, int config_type, xml_data_node *parentnode) { xml_data_node *node; const char *dev_instance; @@ -106,7 +106,7 @@ static void image_dirs_save(running_machine *machine, int config_type, xml_data_ /* only care about game-specific data */ if (config_type == CONFIG_TYPE_GAME) { - for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image)) + for (bool gotone = machine.m_devicelist.first(image); gotone; gotone = image->next(image)) { dev_instance = image->image_config().instance_name(); @@ -153,21 +153,21 @@ static int write_config(emu_options &options, const char *filename, const game_d out of core into the options -------------------------------------------------*/ -static void image_options_extract(running_machine *machine) +static void image_options_extract(running_machine &machine) { /* only extract the device options if we've added them */ -// if (machine->options().bool_value(OPTION_ADDED_DEVICE_OPTIONS)) +// if (machine.options().bool_value(OPTION_ADDED_DEVICE_OPTIONS)) { int index = 0; device_image_interface *image = NULL; - for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image)) + for (bool gotone = machine.m_devicelist.first(image); gotone; gotone = image->next(image)) { const char *filename = image->filename(); /* and set the option */ astring error; - machine->options().set_value(image->image_config().instance_name(), filename ? filename : "", OPTION_PRIORITY_CMDLINE, error); + machine.options().set_value(image->image_config().instance_name(), filename ? filename : "", OPTION_PRIORITY_CMDLINE, error); assert(!error); index++; @@ -175,8 +175,8 @@ static void image_options_extract(running_machine *machine) } /* write the config, if appropriate */ - if (machine->options().write_config()) - write_config(machine->options(), NULL, &machine->system()); + if (machine.options().write_config()) + write_config(machine.options(), NULL, &machine.system()); } /*------------------------------------------------- @@ -189,7 +189,7 @@ void image_unload_all(running_machine &machine) device_image_interface *image = NULL; // extract the options - image_options_extract(&machine); + image_options_extract(machine); for (bool gotone = machine.m_devicelist.first(image); gotone; gotone = image->next(image)) { @@ -202,16 +202,16 @@ void image_unload_all(running_machine &machine) running_machine -------------------------------------------------*/ -void image_device_init(running_machine *machine) +void image_device_init(running_machine &machine) { const char *image_name; device_image_interface *image = NULL; /* make sure that any required devices have been allocated */ - for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image)) + for (bool gotone = machine.m_devicelist.first(image); gotone; gotone = image->next(image)) { /* is an image specified for this image */ - image_name = machine->options().device_option(*image); + image_name = machine.options().device_option(*image); if ((image_name != NULL) && (image_name[0] != '\0')) { @@ -229,7 +229,7 @@ void image_device_init(running_machine *machine) astring image_basename(image_name); /* unload all images */ - image_unload_all(*machine); + image_unload_all(machine); fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load (%s) failed: %s", image->image_config().devconfig().name(), @@ -255,12 +255,12 @@ void image_device_init(running_machine *machine) running_machine -------------------------------------------------*/ -void image_postdevice_init(running_machine *machine) +void image_postdevice_init(running_machine &machine) { device_image_interface *image = NULL; /* make sure that any required devices have been allocated */ - for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image)) + for (bool gotone = machine.m_devicelist.first(image); gotone; gotone = image->next(image)) { int result = image->finish_load(); /* did the image load fail? */ @@ -270,7 +270,7 @@ void image_postdevice_init(running_machine *machine) astring image_err = astring(image->error()); /* unload all images */ - image_unload_all(*machine); + image_unload_all(machine); fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load failed: %s", image->image_config().devconfig().name(), @@ -279,7 +279,7 @@ void image_postdevice_init(running_machine *machine) } /* add a callback for when we shut down */ - machine->add_notifier(MACHINE_NOTIFY_EXIT, image_unload_all); + machine.add_notifier(MACHINE_NOTIFY_EXIT, image_unload_all); } /*************************************************************************** INITIALIZATION @@ -289,7 +289,7 @@ void image_postdevice_init(running_machine *machine) image_init - start up the image system -------------------------------------------------*/ -void image_init(running_machine *machine) +void image_init(running_machine &machine) { image_device_init(machine); config_register(machine, "image_directories", image_dirs_load, image_dirs_save); @@ -364,11 +364,11 @@ static char *strip_extension(const char *filename) string with the image info text -------------------------------------------------*/ -astring *image_info_astring(running_machine *machine, astring *string) +astring *image_info_astring(running_machine &machine, astring *string) { device_image_interface *image = NULL; - astring_printf(string, "%s\n\n", machine->system().description); + astring_printf(string, "%s\n\n", machine.system().description); #if 0 if (mess_ram_size > 0) @@ -378,7 +378,7 @@ astring *image_info_astring(running_machine *machine, astring *string) } #endif - for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image)) + for (bool gotone = machine.m_devicelist.first(image); gotone; gotone = image->next(image)) { const char *name = image->filename(); if (name != NULL) @@ -471,12 +471,12 @@ void image_battery_save_by_name(emu_options &options, const char *filename, cons image_from_absolute_index - retreives index number of image in device list -------------------------------------------------*/ -device_image_interface *image_from_absolute_index(running_machine *machine, int absolute_index) +device_image_interface *image_from_absolute_index(running_machine &machine, int absolute_index) { device_image_interface *image = NULL; int cnt = 0; /* make sure that any required devices have been allocated */ - for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image)) + for (bool gotone = machine.m_devicelist.first(image); gotone; gotone = image->next(image)) { if (cnt==absolute_index) return image; cnt++; @@ -492,11 +492,11 @@ device_image_interface *image_from_absolute_index(running_machine *machine, int void image_add_device_with_subdevices(device_t *owner, device_type type, const char *tag, UINT32 clock) { astring tempstring; - device_list *device_list = &owner->machine->m_devicelist; - machine_config &config = const_cast<machine_config &>(owner->machine->config()); + device_list *device_list = &owner->machine().m_devicelist; + machine_config &config = const_cast<machine_config &>(owner->machine().config()); 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)); + device_t &device = device_list->append(devconfig->tag(), *devconfig->alloc_device(owner->machine())); machine_config_constructor machconfig = device.machine_config_additions(); if (machconfig != NULL) @@ -505,7 +505,7 @@ void image_add_device_with_subdevices(device_t *owner, device_type type, const c 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)); + device_list->append(config_dev->tag(), *config_dev->alloc_device(owner->machine())); } } } diff --git a/src/emu/image.h b/src/emu/image.h index 3f082772104..659a43dacf6 100644 --- a/src/emu/image.h +++ b/src/emu/image.h @@ -20,17 +20,17 @@ #include "ioprocs.h" -void image_init(running_machine *machine); -void image_postdevice_init(running_machine *machine); +void image_init(running_machine &machine); +void image_postdevice_init(running_machine &machine); extern struct io_procs image_ioprocs; void image_battery_load_by_name(emu_options &options, const char *filename, void *buffer, int length, int fill); void image_battery_save_by_name(emu_options &options, const char *filename, const void *buffer, int length); -astring *image_info_astring(running_machine *machine, astring *string); +astring *image_info_astring(running_machine &machine, astring *string); -device_image_interface *image_from_absolute_index(running_machine *machine, int absolute_index); +device_image_interface *image_from_absolute_index(running_machine &machine, int absolute_index); void image_add_device_with_subdevices(device_t *owner, device_type type, const char *tag, UINT32 clock); diff --git a/src/emu/imagedev/bitbngr.c b/src/emu/imagedev/bitbngr.c index 591a38d1032..cb2dadac3ea 100644 --- a/src/emu/imagedev/bitbngr.c +++ b/src/emu/imagedev/bitbngr.c @@ -344,10 +344,10 @@ static DEVICE_START(bitbanger) /* output config */ bi->build_count = 0; - bi->bitbanger_output_timer = device->machine->scheduler().timer_alloc(FUNC(bitbanger_output_timer), (void *) device); + bi->bitbanger_output_timer = device->machine().scheduler().timer_alloc(FUNC(bitbanger_output_timer), (void *) device); /* input config */ - bi->bitbanger_input_timer = device->machine->scheduler().timer_alloc(FUNC(bitbanger_input_timer), (void *) device ); + bi->bitbanger_input_timer = device->machine().scheduler().timer_alloc(FUNC(bitbanger_input_timer), (void *) device ); bi->idle_delay = attotime::from_seconds(1); bi->input_buffer_size = 0; bi->input_buffer_cursor = 0; @@ -453,7 +453,7 @@ void bitbanger_output(device_t *device, int value) bi->bitbanger_output_timer->adjust(one_point_five_baud, 0, bi->current_baud); } - //fprintf(stderr,"%s, %d\n", device->machine->time().as_string(9), value); + //fprintf(stderr,"%s, %d\n", device->machine().time().as_string(9), value); bi->output_value = value; } diff --git a/src/emu/imagedev/bitbngr.h b/src/emu/imagedev/bitbngr.h index 85124ca2536..ac27e3817c0 100644 --- a/src/emu/imagedev/bitbngr.h +++ b/src/emu/imagedev/bitbngr.h @@ -70,7 +70,7 @@ typedef struct _bitbanger_config bitbanger_config; struct _bitbanger_config { /* callback to driver */ - void (*input_callback)(running_machine *machine, UINT8 bit); + void (*input_callback)(running_machine &machine, UINT8 bit); int default_mode; /* emulating a printer or modem */ int default_baud; /* output bits per second */ int default_tune; /* fine tune adjustment to the baud */ diff --git a/src/emu/imagedev/cartslot.c b/src/emu/imagedev/cartslot.c index 60e1a25820c..112141dbbb0 100644 --- a/src/emu/imagedev/cartslot.c +++ b/src/emu/imagedev/cartslot.c @@ -72,7 +72,7 @@ static int load_cartridge(device_image_interface *image, const rom_entry *romrgn offset = ROM_GETOFFSET(roment); length = ROM_GETLENGTH(roment); flags = ROM_GETFLAGS(roment); - ptr = ((UINT8 *) image->device().machine->region(region)->base()) + offset; + ptr = ((UINT8 *) image->device().machine().region(region)->base()) + offset; if (mode == PROCESS_LOAD) { @@ -124,7 +124,7 @@ static int load_cartridge(device_image_interface *image, const rom_entry *romrgn /* if the region is inverted, do that now */ device_memory_interface *memory; - cpu = image->device().machine->device(type); + cpu = image->device().machine().device(type); if (cpu!=NULL && cpu->interface(memory)) { datawidth = cpu->memory().space_config(AS_PROGRAM)->m_databus_width / 8; @@ -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->system().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) { @@ -337,7 +337,7 @@ static DEVICE_IMAGE_UNLOAD( cartslot ) if (cart->mc != NULL) { - multicart_close(device->machine->options(), cart->mc); + multicart_close(device->machine().options(), cart->mc); cart->mc = NULL; } @@ -360,12 +360,12 @@ 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->system().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 */ astring_cpyc(&pcb_name, mc->pcb_type); - multicart_close(image.device().machine->options(), mc); + multicart_close(image.device().machine().options(), mc); } else { diff --git a/src/emu/imagedev/cassette.c b/src/emu/imagedev/cassette.c index c62e9544d54..555196c890b 100644 --- a/src/emu/imagedev/cassette.c +++ b/src/emu/imagedev/cassette.c @@ -71,7 +71,7 @@ INLINE int cassette_is_motor_on(device_t *device) static void cassette_update(device_t *device) { dev_cassette_t *cassette = get_safe_token( device ); - double cur_time = device->machine->time().as_double(); + double cur_time = device->machine().time().as_double(); if (cassette_is_motor_on(device)) { @@ -187,7 +187,7 @@ double cassette_get_position(device_t *device) position = cassette->position; if (cassette_is_motor_on(device)) - position += device->machine->time().as_double() - cassette->position_time; + position += device->machine().time().as_double() - cassette->position_time; return position; } @@ -273,7 +273,7 @@ static DEVICE_IMAGE_LOAD( cassette ) { /* creating an image */ create_opts = cassette->config->create_opts; - err = cassette_create(device->machine, (void *) &image, &image_ioprocs, &wavfile_format, create_opts, CASSETTE_FLAG_READWRITE|CASSETTE_FLAG_SAVEONEXIT, &cassette->cassette); + err = cassette_create(device->machine(), (void *) &image, &image_ioprocs, &wavfile_format, create_opts, CASSETTE_FLAG_READWRITE|CASSETTE_FLAG_SAVEONEXIT, &cassette->cassette); if (err) goto error; } @@ -285,7 +285,7 @@ static DEVICE_IMAGE_LOAD( cassette ) is_writable = image.is_writable(); cassette_flags = is_writable ? (CASSETTE_FLAG_READWRITE|CASSETTE_FLAG_SAVEONEXIT) : CASSETTE_FLAG_READONLY; extension = image.filetype(); - err = cassette_open_choices(device->machine,(void *) &image, &image_ioprocs, extension, formats, cassette_flags, &cassette->cassette); + err = cassette_open_choices(device->machine(),(void *) &image, &image_ioprocs, extension, formats, cassette_flags, &cassette->cassette); /* this is kind of a hack */ if (err && is_writable) @@ -302,7 +302,7 @@ static DEVICE_IMAGE_LOAD( cassette ) /* reset the position */ cassette->position = 0.0; - cassette->position_time = device->machine->time().as_double(); + cassette->position_time = device->machine().time().as_double(); return IMAGE_INIT_PASS; @@ -360,7 +360,7 @@ static DEVICE_IMAGE_DISPLAY(cassette) x = 0.2f; y = 0.5f; - dev = device->machine->m_devicelist.first(CASSETTE ); + dev = device->machine().m_devicelist.first(CASSETTE ); while ( dev && strcmp( dev->tag(), device->tag() ) ) { @@ -368,7 +368,7 @@ static DEVICE_IMAGE_DISPLAY(cassette) dev = dev->typenext(); } - y *= ui_get_line_height(*device->machine) + 2.0f * UI_BOX_TB_BORDER; + y *= ui_get_line_height(device->machine()) + 2.0f * UI_BOX_TB_BORDER; /* choose which frame of the animation we are at */ n = ((int) position / ANIMATION_FPS) % ANIMATION_FRAMES; /* Since you can have anything in a BDF file, we will use crude ascii characters instead */ @@ -393,7 +393,7 @@ static DEVICE_IMAGE_DISPLAY(cassette) (int) length); /* draw the cassette */ - ui_draw_text_box(&device->machine->render().ui_container(), buf, JUSTIFY_LEFT, x, y, UI_BACKGROUND_COLOR); + ui_draw_text_box(&device->machine().render().ui_container(), buf, JUSTIFY_LEFT, x, y, UI_BACKGROUND_COLOR); } /*------------------------------------------------- diff --git a/src/emu/imagedev/cassimg.c b/src/emu/imagedev/cassimg.c index f2e3c9b2eb7..b69196af57e 100644 --- a/src/emu/imagedev/cassimg.c +++ b/src/emu/imagedev/cassimg.c @@ -81,7 +81,7 @@ static INT16 interpolate16(INT32 value) initialization and termination *********************************************************************/ -static cassette_image *cassette_init(running_machine *machine,const struct CassetteFormat *format, void *file, const struct io_procs *procs, int flags) +static cassette_image *cassette_init(running_machine &machine,const struct CassetteFormat *format, void *file, const struct io_procs *procs, int flags) { cassette_image *cassette; @@ -95,7 +95,7 @@ static cassette_image *cassette_init(running_machine *machine,const struct Casse cassette->io.procs = procs; cassette->flags = flags; cassette->pool = pool_alloc_lib(NULL); - cassette->machine = machine; + cassette->m_machine = &machine; return cassette; } @@ -125,7 +125,7 @@ static int good_format(const struct CassetteFormat *format, const char *extensio -casserr_t cassette_open_choices(running_machine *machine,void *file, const struct io_procs *procs, const char *extension, +casserr_t cassette_open_choices(running_machine &machine,void *file, const struct io_procs *procs, const char *extension, const struct CassetteFormat *const *formats, int flags, cassette_image **outcassette) { casserr_t err; @@ -190,7 +190,7 @@ done: -casserr_t cassette_open(running_machine *machine, void *file, const struct io_procs *procs, +casserr_t cassette_open(running_machine &machine, void *file, const struct io_procs *procs, const struct CassetteFormat *format, int flags, cassette_image **outcassette) { const struct CassetteFormat *formats[2]; @@ -201,7 +201,7 @@ casserr_t cassette_open(running_machine *machine, void *file, const struct io_pr -casserr_t cassette_create(running_machine *machine, void *file, const struct io_procs *procs, const struct CassetteFormat *format, +casserr_t cassette_create(running_machine &machine, void *file, const struct io_procs *procs, const struct CassetteFormat *format, const struct CassetteOptions *opts, int flags, cassette_image **outcassette) { casserr_t err; diff --git a/src/emu/imagedev/cassimg.h b/src/emu/imagedev/cassimg.h index 5128e5628d2..48b6a32f3c3 100644 --- a/src/emu/imagedev/cassimg.h +++ b/src/emu/imagedev/cassimg.h @@ -87,6 +87,8 @@ struct CassetteInfo struct _cassette_image { + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } + const struct CassetteFormat *format; struct io_generic io; object_pool *pool; @@ -99,7 +101,7 @@ struct _cassette_image size_t block_count; size_t sample_count; - running_machine *machine; + running_machine *m_machine; }; typedef struct _cassette_image cassette_image; @@ -163,11 +165,11 @@ CASSETTE_FORMATLIST_EXTERN(cassette_default_formats); ***************************************************************************/ -casserr_t cassette_open(running_machine *machine,void *file, const struct io_procs *procs, +casserr_t cassette_open(running_machine &machine,void *file, const struct io_procs *procs, const struct CassetteFormat *format, int flags, cassette_image **outcassette); -casserr_t cassette_open_choices(running_machine *machine,void *file, const struct io_procs *procs, const char *extension, +casserr_t cassette_open_choices(running_machine &machine,void *file, const struct io_procs *procs, const char *extension, const struct CassetteFormat *const *formats, int flags, cassette_image **outcassette); -casserr_t cassette_create(running_machine *machine,void *file, const struct io_procs *procs, const struct CassetteFormat *format, +casserr_t cassette_create(running_machine &machine,void *file, const struct io_procs *procs, const struct CassetteFormat *format, const struct CassetteOptions *opts, int flags, cassette_image **outcassette); casserr_t cassette_save(cassette_image *cassette); void cassette_close(cassette_image *cassette); diff --git a/src/emu/imagedev/chd_cd.c b/src/emu/imagedev/chd_cd.c index 008fa87fb2b..df427a0507a 100644 --- a/src/emu/imagedev/chd_cd.c +++ b/src/emu/imagedev/chd_cd.c @@ -87,7 +87,7 @@ static DEVICE_IMAGE_LOAD(cdrom) if ( err ) goto error; } else { - chd = get_disk_handle(image.device().machine, image.device().subtag(tempstring,"cdrom")); + chd = get_disk_handle(image.device().machine(), image.device().subtag(tempstring,"cdrom")); } /* open the CHD file */ diff --git a/src/emu/imagedev/flopdrv.c b/src/emu/imagedev/flopdrv.c index b31ae72358d..70b019cd9ce 100644 --- a/src/emu/imagedev/flopdrv.c +++ b/src/emu/imagedev/flopdrv.c @@ -214,7 +214,7 @@ static void floppy_drive_init(device_t *img) pDrive->flags = 0; pDrive->index_pulse_callback = NULL; pDrive->ready_state_change_callback = NULL; - pDrive->index_timer = img->machine->scheduler().timer_alloc(FUNC(floppy_drive_index_callback), (void *) img); + pDrive->index_timer = img->machine().scheduler().timer_alloc(FUNC(floppy_drive_index_callback), (void *) img); pDrive->idx = 0; floppy_drive_set_geometry(img, ((floppy_config*)img->baseconfig().static_config())->floppy_type); @@ -674,7 +674,7 @@ DEVICE_IMAGE_LOAD( floppy ) else next_wpt = CLEAR_LINE; - image.device().machine->scheduler().timer_set(attotime::from_msec(250), FUNC(set_wpt), next_wpt, flopimg); + image.device().machine().scheduler().timer_set(attotime::from_msec(250), FUNC(set_wpt), next_wpt, flopimg); return retVal; } @@ -702,16 +702,16 @@ DEVICE_IMAGE_UNLOAD( floppy ) devcb_call_write_line(&flopimg->out_wpt_func, flopimg->wpt); /* set timer for disk eject */ - image.device().machine->scheduler().timer_set(attotime::from_msec(250), FUNC(set_wpt), ASSERT_LINE, flopimg); + image.device().machine().scheduler().timer_set(attotime::from_msec(250), FUNC(set_wpt), ASSERT_LINE, flopimg); } -device_t *floppy_get_device(running_machine *machine,int drive) +device_t *floppy_get_device(running_machine &machine,int drive) { switch(drive) { - case 0 : return machine->device(FLOPPY_0); - case 1 : return machine->device(FLOPPY_1); - case 2 : return machine->device(FLOPPY_2); - case 3 : return machine->device(FLOPPY_3); + case 0 : return machine.device(FLOPPY_0); + case 1 : return machine.device(FLOPPY_1); + case 2 : return machine.device(FLOPPY_2); + case 3 : return machine.device(FLOPPY_3); } return NULL; } @@ -728,7 +728,7 @@ void floppy_set_type(device_t *image,int ftype) flopimg->floppy_drive_type = ftype; } -device_t *floppy_get_device_by_type(running_machine *machine,int ftype,int drive) +device_t *floppy_get_device_by_type(running_machine &machine,int ftype,int drive) { int i; int cnt = 0; @@ -758,7 +758,7 @@ int floppy_get_drive_by_type(device_t *image,int ftype) { int i,drive =0; for (i=0;i<4;i++) { - device_t *disk = floppy_get_device(image->machine,i); + device_t *disk = floppy_get_device(image->machine(),i); if (floppy_get_drive_type(disk)==ftype) { if (image==disk) { return drive; @@ -769,13 +769,13 @@ int floppy_get_drive_by_type(device_t *image,int ftype) return drive; } -int floppy_get_count(running_machine *machine) +int floppy_get_count(running_machine &machine) { int cnt = 0; - if (machine->device(FLOPPY_0)) cnt++; - if (machine->device(FLOPPY_1)) cnt++; - if (machine->device(FLOPPY_2)) cnt++; - if (machine->device(FLOPPY_3)) cnt++; + if (machine.device(FLOPPY_0)) cnt++; + if (machine.device(FLOPPY_1)) cnt++; + if (machine.device(FLOPPY_2)) cnt++; + if (machine.device(FLOPPY_3)) cnt++; return cnt; } diff --git a/src/emu/imagedev/flopdrv.h b/src/emu/imagedev/flopdrv.h index 971b5ee1ac1..d9c8f2203e6 100644 --- a/src/emu/imagedev/flopdrv.h +++ b/src/emu/imagedev/flopdrv.h @@ -137,11 +137,11 @@ void floppy_install_unload_proc(device_t *image, void (*proc)(device_image_inter void floppy_install_load_proc(device_t *image, void (*proc)(device_image_interface &image)); -device_t *floppy_get_device(running_machine *machine,int drive); -device_t *floppy_get_device_by_type(running_machine *machine,int ftype,int drive); +device_t *floppy_get_device(running_machine &machine,int drive); +device_t *floppy_get_device_by_type(running_machine &machine,int ftype,int drive); int floppy_get_drive_type(device_t *image); void floppy_set_type(device_t *image,int ftype); -int floppy_get_count(running_machine *machine); +int floppy_get_count(running_machine &machine); int floppy_get_drive(device_t *image); int floppy_get_drive_by_type(device_t *image,int ftype); diff --git a/src/emu/imagedev/snapquik.c b/src/emu/imagedev/snapquik.c index af56b4776ec..ba9ccaeaad3 100644 --- a/src/emu/imagedev/snapquik.c +++ b/src/emu/imagedev/snapquik.c @@ -132,7 +132,7 @@ static DEVICE_START( snapquick ) snapquick_token *token = get_token(device); /* allocate a timer */ - token->timer = device->machine->scheduler().timer_alloc(FUNC(process_snapshot_or_quickload), (void *) dynamic_cast<device_image_interface *>(device)); + token->timer = device->machine().scheduler().timer_alloc(FUNC(process_snapshot_or_quickload), (void *) dynamic_cast<device_image_interface *>(device)); } @@ -298,7 +298,7 @@ static int z80bin_load_file(device_image_interface *image, const char *file_type image->message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); return IMAGE_INIT_FAIL; } - image->device().machine->device("maincpu")->memory().space(AS_PROGRAM)->write_byte(j, data); + image->device().machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte(j, data); } return IMAGE_INIT_PASS; @@ -326,17 +326,17 @@ static QUICKLOAD_LOAD( z80bin ) config = (const z80bin_config *)downcast<const legacy_device_config_base &>(image.device().baseconfig()).inline_config(); /* check to see if autorun is on (I hate how this works) */ - autorun = input_port_read_safe(image.device().machine, "CONFIG", 0xFF) & 1; + autorun = input_port_read_safe(image.device().machine(), "CONFIG", 0xFF) & 1; /* start program */ if (config->execute != NULL) { - (*config->execute)(image.device().machine, start_addr, end_addr, exec_addr, autorun); + (*config->execute)(image.device().machine(), start_addr, end_addr, exec_addr, autorun); } else { if (autorun) - cpu_set_reg(image.device().machine->device("maincpu"), STATE_GENPC, exec_addr); + cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, exec_addr); } } diff --git a/src/emu/imagedev/snapquik.h b/src/emu/imagedev/snapquik.h index 37ccfa12a2c..126c47c8807 100644 --- a/src/emu/imagedev/snapquik.h +++ b/src/emu/imagedev/snapquik.h @@ -39,7 +39,7 @@ DECLARE_LEGACY_IMAGE_DEVICE(Z80BIN, z80bin); #define QUICKLOAD_LOAD(name) int QUICKLOAD_LOAD_NAME(name)(device_image_interface &image, const char *file_type, int quickload_size) #define Z80BIN_EXECUTE_NAME(name) z80bin_execute_##name -#define Z80BIN_EXECUTE(name) void Z80BIN_EXECUTE_NAME(name)(running_machine *machine, UINT16 start_address, UINT16 end_address, UINT16 execute_address, int autorun) +#define Z80BIN_EXECUTE(name) void Z80BIN_EXECUTE_NAME(name)(running_machine &machine, UINT16 start_address, UINT16 end_address, UINT16 execute_address, int autorun) #define LOAD_REG(_cpu, _reg, _data) \ do { \ @@ -64,7 +64,7 @@ struct _snapquick_config attoseconds_t delay_attoseconds; /* loading delay (attoseconds) */ }; -typedef void (*z80bin_execute_func)(running_machine *machine, UINT16 start_address, UINT16 end_address, UINT16 execute_address, int autorun); +typedef void (*z80bin_execute_func)(running_machine &machine, UINT16 start_address, UINT16 end_address, UINT16 execute_address, int autorun); typedef struct _z80bin_config z80bin_config; struct _z80bin_config diff --git a/src/emu/inptport.c b/src/emu/inptport.c index 59d834634e2..22194da114e 100644 --- a/src/emu/inptport.c +++ b/src/emu/inptport.c @@ -297,9 +297,9 @@ struct _input_port_private inputx_code *codes; key_buffer *keybuffer; emu_timer *inputx_timer; - int (*queue_chars)(running_machine *machine, const unicode_char *text, size_t text_len); - int (*accept_char)(running_machine *machine, unicode_char ch); - int (*charqueue_empty)(running_machine *machine); + int (*queue_chars)(running_machine &machine, const unicode_char *text, size_t text_len); + int (*accept_char)(running_machine &machine, unicode_char ch); + int (*charqueue_empty)(running_machine &machine); attotime current_rate; }; @@ -623,8 +623,8 @@ static TIMER_CALLBACK(inputx_timerproc); /* Debugging commands and handlers. */ -static void execute_input(running_machine *machine, int ref, int params, const char *param[]); -static void execute_dumpkbd(running_machine *machine, int ref, int params, const char *param[]); +static void execute_input(running_machine &machine, int ref, int params, const char *param[]); +static void execute_dumpkbd(running_machine &machine, int ref, int params, const char *param[]); /*************************************************************************** COMMON SHARED STRINGS @@ -774,17 +774,17 @@ static void input_port_exit(running_machine &machine); static INT32 apply_analog_settings(INT32 current, analog_field_state *analog); /* initialization helpers */ -static void init_port_types(running_machine *machine); -static void init_port_state(running_machine *machine); +static void init_port_types(running_machine &machine); +static void init_port_state(running_machine &machine); static void init_autoselect_devices(running_machine &machine, int type1, int type2, int type3, const char *option, const char *ananame); static device_field_info *init_field_device_info(const input_field_config *field,const char *device_name); static analog_field_state *init_field_analog_state(const input_field_config *field); /* once-per-frame updates */ static void frame_update_callback(running_machine &machine); -static void frame_update(running_machine *machine); -static void frame_update_digital_joysticks(running_machine *machine); -static void frame_update_analog_field(running_machine *machine, analog_field_state *analog); +static void frame_update(running_machine &machine); +static void frame_update_digital_joysticks(running_machine &machine); +static void frame_update_analog_field(running_machine &machine, analog_field_state *analog); static int frame_get_digital_field_state(const input_field_config *field, int mouse_down); /* port configuration helpers */ @@ -798,33 +798,33 @@ static const input_field_diplocation *diplocation_list_alloc(const input_field_c static void diplocation_free(input_field_diplocation **diplocptr); /* tokenization helpers */ -static int token_to_input_field_type(running_machine *machine, const char *string, int *player); -static const char *input_field_type_to_token(running_machine *machine, int type, int player); +static int token_to_input_field_type(running_machine &machine, const char *string, int *player); +static const char *input_field_type_to_token(running_machine &machine, int type, int player); static int token_to_seq_type(const char *string); /* settings load */ -static void load_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode); -static void load_remap_table(running_machine *machine, xml_data_node *parentnode); -static int load_default_config(running_machine *machine, xml_data_node *portnode, int type, int player, const input_seq *newseq); -static int load_game_config(running_machine *machine, xml_data_node *portnode, int type, int player, const input_seq *newseq); +static void load_config_callback(running_machine &machine, int config_type, xml_data_node *parentnode); +static void load_remap_table(running_machine &machine, xml_data_node *parentnode); +static int load_default_config(running_machine &machine, xml_data_node *portnode, int type, int player, const input_seq *newseq); +static int load_game_config(running_machine &machine, xml_data_node *portnode, int type, int player, const input_seq *newseq); /* settings save */ -static void save_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode); -static void save_sequence(running_machine *machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq); +static void save_config_callback(running_machine &machine, int config_type, xml_data_node *parentnode); +static void save_sequence(running_machine &machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq); static int save_this_input_field_type(int type); -static void save_default_inputs(running_machine *machine, xml_data_node *parentnode); -static void save_game_inputs(running_machine *machine, xml_data_node *parentnode); +static void save_default_inputs(running_machine &machine, xml_data_node *parentnode); +static void save_game_inputs(running_machine &machine, xml_data_node *parentnode); /* input playback */ -static time_t playback_init(running_machine *machine); -static void playback_end(running_machine *machine, const char *message); -static void playback_frame(running_machine *machine, attotime curtime); +static time_t playback_init(running_machine &machine); +static void playback_end(running_machine &machine, const char *message); +static void playback_frame(running_machine &machine, attotime curtime); static void playback_port(const input_port_config *port); /* input recording */ -static void record_init(running_machine *machine); -static void record_end(running_machine *machine, const char *message); -static void record_frame(running_machine *machine, attotime curtime); +static void record_init(running_machine &machine); +static void record_end(running_machine &machine, const char *message); +static void record_frame(running_machine &machine, attotime curtime); static void record_port(const input_port_config *port); @@ -890,7 +890,7 @@ INLINE const char *get_port_tag(const input_port_config *port, char *tempbuffer) if (port->tag != NULL) return port->tag; - for (curport = port->machine->m_portlist.first(); curport != NULL; curport = curport->next()) + for (curport = port->machine().m_portlist.first(); curport != NULL; curport = curport->next()) { if (curport == port) break; @@ -973,19 +973,19 @@ static WRITE_LINE_DEVICE_HANDLER( changed_write_line_device ) system -------------------------------------------------*/ -time_t input_port_init(running_machine *machine, const input_port_token *tokens, const device_config_list &devicelist) +time_t input_port_init(running_machine &machine, const input_port_token *tokens, const device_config_list &devicelist) { //input_port_private *portdata; char errorbuf[1024]; time_t basetime; /* allocate memory for our data structure */ - machine->input_port_data = auto_alloc_clear(machine, input_port_private); - //portdata = machine->input_port_data; + machine.input_port_data = auto_alloc_clear(machine, input_port_private); + //portdata = machine.input_port_data; /* add an exit callback and a frame callback */ - machine->add_notifier(MACHINE_NOTIFY_EXIT, input_port_exit); - machine->add_notifier(MACHINE_NOTIFY_FRAME, frame_update_callback); + machine.add_notifier(MACHINE_NOTIFY_EXIT, input_port_exit); + machine.add_notifier(MACHINE_NOTIFY_FRAME, frame_update_callback); /* initialize the default port info from the OSD */ init_port_types(machine); @@ -993,7 +993,7 @@ time_t input_port_init(running_machine *machine, const input_port_token *tokens, /* if we have a token list, proceed */ if (tokens != NULL) { - input_port_list_init(machine->m_portlist, tokens, errorbuf, sizeof(errorbuf), TRUE, NULL); + input_port_list_init(machine.m_portlist, tokens, errorbuf, sizeof(errorbuf), TRUE, NULL); if (errorbuf[0] != 0) mame_printf_error("Input port errors:\n%s", errorbuf); } @@ -1001,7 +1001,7 @@ time_t input_port_init(running_machine *machine, const input_port_token *tokens, for (device_config *config = devicelist.first(); config != NULL; config = config->next()) { if (config->input_ports()!=NULL) { - input_port_list_init(machine->m_portlist, config->input_ports(), errorbuf, sizeof(errorbuf), TRUE, config); + input_port_list_init(machine.m_portlist, config->input_ports(), errorbuf, sizeof(errorbuf), TRUE, config); if (errorbuf[0] != 0) mame_printf_error("Input port errors:\n%s", errorbuf); } @@ -1027,8 +1027,8 @@ time_t input_port_init(running_machine *machine, const input_port_token *tokens, static void input_port_exit(running_machine &machine) { /* close any playback or recording files */ - playback_end(&machine, NULL); - record_end(&machine, NULL); + playback_end(machine, NULL); + record_end(machine, NULL); } @@ -1097,7 +1097,7 @@ const char *input_field_name(const input_field_config *field) return field->name; /* otherwise, return the name associated with the type */ - return input_type_name(field->port->machine, field->type, field->player); + return input_type_name(field->port->machine(), field->type, field->player); } @@ -1120,7 +1120,7 @@ const input_seq *input_field_seq(const input_field_config *field, input_seq_type /* if the portseq is the special default code, return the expanded default value */ if (input_seq_get_1(portseq) == SEQCODE_DEFAULT) - return input_type_seq(field->port->machine, field->type, field->player, seqtype); + return input_type_seq(field->port->machine(), field->type, field->player, seqtype); /* otherwise, return the sequence as-is */ return portseq; @@ -1171,7 +1171,7 @@ void input_field_set_user_settings(const input_field_config *field, const input_ /* copy the basics */ for (seqtype = 0; seqtype < ARRAY_LENGTH(settings->seq); seqtype++) { - const input_seq *defseq = input_type_seq(field->port->machine, field->type, field->player, (input_seq_type)seqtype); + const input_seq *defseq = input_type_seq(field->port->machine(), field->type, field->player, (input_seq_type)seqtype); if (input_seq_cmp(defseq, &settings->seq[seqtype]) == 0) field->state->seq[seqtype] = default_seq; else @@ -1207,7 +1207,7 @@ const char *input_field_setting_name(const input_field_config *field) /* scan the list of settings looking for a match on the current value */ for (setting = field->settinglist; setting != NULL; setting = setting->next) - if (input_condition_true(field->port->machine, &setting->condition)) + if (input_condition_true(field->port->machine(), &setting->condition)) if (setting->value == field->state->value) return setting->name; @@ -1229,7 +1229,7 @@ int input_field_has_previous_setting(const input_field_config *field) /* scan the list of settings looking for a match on the current value */ for (setting = field->settinglist; setting != NULL; setting = setting->next) - if (input_condition_true(field->port->machine, &setting->condition)) + if (input_condition_true(field->port->machine(), &setting->condition)) return (setting->value != field->state->value); return FALSE; @@ -1253,7 +1253,7 @@ void input_field_select_previous_setting(const input_field_config *field) /* scan the list of settings looking for a match on the current value */ prevsetting = NULL; for (setting = field->settinglist; setting != NULL; setting = setting->next) - if (input_condition_true(field->port->machine, &setting->condition)) + if (input_condition_true(field->port->machine(), &setting->condition)) { if (setting->value == field->state->value) { @@ -1268,7 +1268,7 @@ void input_field_select_previous_setting(const input_field_config *field) if (!found_match) { for (prevsetting = field->settinglist; prevsetting != NULL; prevsetting = prevsetting->next) - if (input_condition_true(field->port->machine, &prevsetting->condition)) + if (input_condition_true(field->port->machine(), &prevsetting->condition)) break; } @@ -1293,7 +1293,7 @@ int input_field_has_next_setting(const input_field_config *field) /* scan the list of settings looking for a match on the current value */ for (setting = field->settinglist; setting != NULL; setting = setting->next) - if (input_condition_true(field->port->machine, &setting->condition)) + if (input_condition_true(field->port->machine(), &setting->condition)) { if (found) return TRUE; @@ -1321,20 +1321,20 @@ void input_field_select_next_setting(const input_field_config *field) /* scan the list of settings looking for a match on the current value */ nextsetting = NULL; for (setting = field->settinglist; setting != NULL; setting = setting->next) - if (input_condition_true(field->port->machine, &setting->condition)) + if (input_condition_true(field->port->machine(), &setting->condition)) if (setting->value == field->state->value) break; /* if we found one, scan forward for the next valid one */ if (setting != NULL) for (nextsetting = setting->next; nextsetting != NULL; nextsetting = nextsetting->next) - if (input_condition_true(field->port->machine, &nextsetting->condition)) + if (input_condition_true(field->port->machine(), &nextsetting->condition)) break; /* if we hit the end, search from the beginning */ if (nextsetting == NULL) for (nextsetting = field->settinglist; nextsetting != NULL; nextsetting = nextsetting->next) - if (input_condition_true(field->port->machine, &nextsetting->condition)) + if (input_condition_true(field->port->machine(), &nextsetting->condition)) break; /* update the value to the previous one */ @@ -1364,12 +1364,12 @@ int input_type_is_analog(int type) for the given type/player -------------------------------------------------*/ -const char *input_type_name(running_machine *machine, int type, int player) +const char *input_type_name(running_machine &machine, int type, int player) { /* if we have a machine, use the live state and quick lookup */ - if (machine != NULL) + if (1)//machine != NULL) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; input_type_state *typestate = portdata->type_to_typestate[type][player]; if (typestate != NULL) return typestate->typedesc.name; @@ -1394,12 +1394,12 @@ const char *input_type_name(running_machine *machine, int type, int player) for the given type/player -------------------------------------------------*/ -int input_type_group(running_machine *machine, int type, int player) +int input_type_group(running_machine &machine, int type, int player) { /* if we have a machine, use the live state and quick lookup */ - if (machine != NULL) + if (1)//machine != NULL) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; input_type_state *typestate = portdata->type_to_typestate[type][player]; if (typestate != NULL) return typestate->typedesc.group; @@ -1424,7 +1424,7 @@ int input_type_group(running_machine *machine, int type, int player) sequence for the given type/player -------------------------------------------------*/ -const input_seq *input_type_seq(running_machine *machine, int type, int player, input_seq_type seqtype) +const input_seq *input_type_seq(running_machine &machine, int type, int player, input_seq_type seqtype) { static const input_seq ip_none = SEQ_DEF_0; @@ -1432,9 +1432,9 @@ const input_seq *input_type_seq(running_machine *machine, int type, int player, assert((player >= 0) && (player < MAX_PLAYERS)); /* if we have a machine, use the live state and quick lookup */ - if (machine != NULL) + if (1)//machine != NULL) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; input_type_state *typestate = portdata->type_to_typestate[type][player]; if (typestate != NULL) return &typestate->seq[seqtype]; @@ -1459,9 +1459,9 @@ const input_seq *input_type_seq(running_machine *machine, int type, int player, sequence for the given type/player -------------------------------------------------*/ -void input_type_set_seq(running_machine *machine, int type, int player, input_seq_type seqtype, const input_seq *newseq) +void input_type_set_seq(running_machine &machine, int type, int player, input_seq_type seqtype, const input_seq *newseq) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; input_type_state *typestate = portdata->type_to_typestate[type][player]; if (typestate != NULL) typestate->seq[seqtype] = *newseq; @@ -1474,7 +1474,7 @@ void input_type_set_seq(running_machine *machine, int type, int player, input_se is pressed -------------------------------------------------*/ -int input_type_pressed(running_machine *machine, int type, int player) +int input_type_pressed(running_machine &machine, int type, int player) { return input_seq_pressed(machine, input_type_seq(machine, type, player, SEQ_TYPE_STANDARD)); } @@ -1484,9 +1484,9 @@ int input_type_pressed(running_machine *machine, int type, int player) input_type_list - return the list of types -------------------------------------------------*/ -const input_type_desc *input_type_list(running_machine *machine) +const input_type_desc *input_type_list(running_machine &machine) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; return &portdata->typestatelist->typedesc; } @@ -1502,9 +1502,9 @@ const input_type_desc *input_type_list(running_machine *machine) port exists -------------------------------------------------*/ -bool input_port_exists(running_machine *machine, const char *tag) +bool input_port_exists(running_machine &machine, const char *tag) { - return machine->port(tag) != 0; + return machine.port(tag) != 0; } @@ -1514,9 +1514,9 @@ bool input_port_exists(running_machine *machine, const char *tag) unused or unknown) -------------------------------------------------*/ -input_port_value input_port_active(running_machine *machine, const char *tag) +input_port_value input_port_active(running_machine &machine, const char *tag) { - const input_port_config *port = machine->port(tag); + const input_port_config *port = machine.port(tag); if (port == NULL) fatalerror("Unable to locate input port '%s'", tag); return port->active; @@ -1530,9 +1530,9 @@ input_port_value input_port_active(running_machine *machine, const char *tag) the port does not exist -------------------------------------------------*/ -input_port_value input_port_active_safe(running_machine *machine, const char *tag, input_port_value defvalue) +input_port_value input_port_active_safe(running_machine &machine, const char *tag, input_port_value defvalue) { - const input_port_config *port = machine->port(tag); + const input_port_config *port = machine.port(tag); return port == NULL ? defvalue : port->active; } @@ -1549,7 +1549,7 @@ input_port_value input_port_active_safe(running_machine *machine, const char *ta input_port_value input_port_read_direct(const input_port_config *port) { - input_port_private *portdata = port->machine->input_port_data; + input_port_private *portdata = port->machine().input_port_data; analog_field_state *analog; device_field_info *device_field; input_port_value result; @@ -1561,7 +1561,7 @@ input_port_value input_port_read_direct(const input_port_config *port) /* update custom values */ for (device_field = port->state->readdevicelist; device_field != NULL; device_field = device_field->next) - if (input_condition_true(port->machine, &device_field->field->condition)) + if (input_condition_true(port->machine(), &device_field->field->condition)) { /* replace the bits with bits from the device */ input_port_value newval = (*device_field->field->read_line_device)(device_field->device); @@ -1572,7 +1572,7 @@ input_port_value input_port_read_direct(const input_port_config *port) /* update VBLANK bits */ if (port->state->vblank != 0) { - if (port->machine->primary_screen->vblank()) + if (port->machine().primary_screen->vblank()) result |= port->state->vblank; else result &= ~port->state->vblank; @@ -1583,7 +1583,7 @@ input_port_value input_port_read_direct(const input_port_config *port) /* merge in analog portions */ for (analog = port->state->analoglist; analog != NULL; analog = analog->next) - if (input_condition_true(port->machine, &analog->field->condition)) + if (input_condition_true(port->machine(), &analog->field->condition)) { /* start with the raw value */ INT32 value = analog->accum; @@ -1591,7 +1591,7 @@ input_port_value input_port_read_direct(const input_port_config *port) /* interpolate if appropriate and if time has passed since the last update */ if (analog->interpolate && !(analog->field->flags & ANALOG_FLAG_RESET) && portdata->last_delta_nsec != 0) { - attoseconds_t nsec_since_last = (port->machine->time() - portdata->last_frame_time).as_attoseconds() / ATTOSECONDS_PER_NANOSECOND; + attoseconds_t nsec_since_last = (port->machine().time() - portdata->last_frame_time).as_attoseconds() / ATTOSECONDS_PER_NANOSECOND; value = analog->previous + ((INT64)(analog->accum - analog->previous) * nsec_since_last / portdata->last_delta_nsec); } @@ -1619,9 +1619,9 @@ input_port_value input_port_read_direct(const input_port_config *port) an input port specified by tag -------------------------------------------------*/ -input_port_value input_port_read(running_machine *machine, const char *tag) +input_port_value input_port_read(running_machine &machine, const char *tag) { - const input_port_config *port = machine->port(tag); + const input_port_config *port = machine.port(tag); if (port == NULL) fatalerror("Unable to locate input port '%s'", tag); return input_port_read_direct(port); @@ -1636,7 +1636,7 @@ input_port_value input_port_read(running_machine *machine, const char *tag) input_port_value input_port_read(device_t *device, const char *tag) { astring tempstring; - const input_port_config *port = device->machine->port(device->baseconfig().subtag(tempstring, tag)); + const input_port_config *port = device->machine().port(device->baseconfig().subtag(tempstring, tag)); if (port == NULL) fatalerror("Unable to locate input port '%s'", tag); return input_port_read_direct(port); @@ -1649,9 +1649,9 @@ input_port_value input_port_read(device_t *device, const char *tag) value if the port does not exist -------------------------------------------------*/ -input_port_value input_port_read_safe(running_machine *machine, const char *tag, UINT32 defvalue) +input_port_value input_port_read_safe(running_machine &machine, const char *tag, UINT32 defvalue) { - const input_port_config *port = machine->port(tag); + const input_port_config *port = machine.port(tag); return (port == NULL) ? defvalue : input_port_read_direct(port); } @@ -1662,14 +1662,14 @@ input_port_value input_port_read_safe(running_machine *machine, const char *tag, player -------------------------------------------------*/ -int input_port_get_crosshair_position(running_machine *machine, int player, float *x, float *y) +int input_port_get_crosshair_position(running_machine &machine, int player, float *x, float *y) { const input_port_config *port; const input_field_config *field; int gotx = FALSE, goty = FALSE; /* read all the lightgun values */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) if (field->player == player && field->crossaxis != CROSSHAIR_AXIS_NONE) if (input_condition_true(machine, &field->condition)) @@ -1728,7 +1728,7 @@ int input_port_get_crosshair_position(running_machine *machine, int player, floa conditions -------------------------------------------------*/ -void input_port_update_defaults(running_machine *machine) +void input_port_update_defaults(running_machine &machine) { int loopnum; @@ -1738,7 +1738,7 @@ void input_port_update_defaults(running_machine *machine) const input_port_config *port; /* loop over all input ports */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) { const input_field_config *field; @@ -1803,7 +1803,7 @@ void input_port_write_direct(const input_port_config *port, input_port_value dat COMBINE_DATA(&port->state->outputvalue); for (device_field = port->state->writedevicelist; device_field; device_field = device_field->next) - if (device_field->field->type == IPT_OUTPUT && input_condition_true(port->machine, &device_field->field->condition)) + if (device_field->field->type == IPT_OUTPUT && input_condition_true(port->machine(), &device_field->field->condition)) { input_port_value newval = ( (port->state->outputvalue ^ device_field->field->defvalue ) & device_field->field->mask) >> device_field->shift; @@ -1823,9 +1823,9 @@ void input_port_write_direct(const input_port_config *port, input_port_value dat port specified by tag -------------------------------------------------*/ -void input_port_write(running_machine *machine, const char *tag, input_port_value value, input_port_value mask) +void input_port_write(running_machine &machine, const char *tag, input_port_value value, input_port_value mask) { - const input_port_config *port = machine->port(tag); + const input_port_config *port = machine.port(tag); if (port == NULL) fatalerror("Unable to locate input port '%s'", tag); input_port_write_direct(port, value, mask); @@ -1837,9 +1837,9 @@ void input_port_write(running_machine *machine, const char *tag, input_port_valu a port, ignore if the port does not exist -------------------------------------------------*/ -void input_port_write_safe(running_machine *machine, const char *tag, input_port_value value, input_port_value mask) +void input_port_write_safe(running_machine &machine, const char *tag, input_port_value value, input_port_value mask) { - const input_port_config *port = machine->port(tag); + const input_port_config *port = machine.port(tag); if (port != NULL) input_port_write_direct(port, value, mask); } @@ -1855,7 +1855,7 @@ void input_port_write_safe(running_machine *machine, const char *tag, input_port if the given condition attached is true -------------------------------------------------*/ -int input_condition_true(running_machine *machine, const input_condition *condition) +int input_condition_true(running_machine &machine, const input_condition *condition) { input_port_value condvalue; @@ -1926,9 +1926,9 @@ const char *input_port_string_from_token(const input_port_token token) type list -------------------------------------------------*/ -static void init_port_types(running_machine *machine) +static void init_port_types(running_machine &machine) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; input_type_state **stateptr; input_type_state *curtype; input_type_desc *lasttype = NULL; @@ -1953,7 +1953,7 @@ static void init_port_types(running_machine *machine) } /* ask the OSD to customize the list */ - machine->osd().customize_input_type_list(&portdata->typestatelist->typedesc); + machine.osd().customize_input_type_list(&portdata->typestatelist->typedesc); /* now iterate over the OSD-modified types */ for (curtype = portdata->typestatelist; curtype != NULL; curtype = curtype->next) @@ -2080,15 +2080,15 @@ static astring *get_keyboard_key_name(const input_field_config *field) states based on the tokens -------------------------------------------------*/ -static void init_port_state(running_machine *machine) +static void init_port_state(running_machine &machine) { - const char *joystick_map_default = machine->options().joystick_map(); - input_port_private *portdata = machine->input_port_data; + const char *joystick_map_default = machine.options().joystick_map(); + input_port_private *portdata = machine.input_port_data; const input_field_config *field; const input_port_config *port; /* allocate live structures to mirror the configuration */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) { analog_field_state **analogstatetail; device_field_info **readdevicetail; @@ -2098,7 +2098,7 @@ static void init_port_state(running_machine *machine) /* allocate a new input_port_info structure */ portstate = auto_alloc_clear(machine, input_port_state); ((input_port_config *)port)->state = portstate; - ((input_port_config *)port)->machine = machine; + ((input_port_config *)port)->m_machine = &machine; /* start with tail pointers to all the data */ analogstatetail = &portstate->analoglist; @@ -2164,18 +2164,18 @@ static void init_port_state(running_machine *machine) } /* handle autoselection of devices */ - init_autoselect_devices(*machine, IPT_PADDLE, IPT_PADDLE_V, 0, OPTION_PADDLE_DEVICE, "paddle"); - init_autoselect_devices(*machine, IPT_AD_STICK_X, IPT_AD_STICK_Y, IPT_AD_STICK_Z, OPTION_ADSTICK_DEVICE, "analog joystick"); - init_autoselect_devices(*machine, IPT_LIGHTGUN_X, IPT_LIGHTGUN_Y, 0, OPTION_LIGHTGUN_DEVICE, "lightgun"); - init_autoselect_devices(*machine, IPT_PEDAL, IPT_PEDAL2, IPT_PEDAL3, OPTION_PEDAL_DEVICE, "pedal"); - init_autoselect_devices(*machine, IPT_DIAL, IPT_DIAL_V, 0, OPTION_DIAL_DEVICE, "dial"); - init_autoselect_devices(*machine, IPT_TRACKBALL_X, IPT_TRACKBALL_Y, 0, OPTION_TRACKBALL_DEVICE, "trackball"); - init_autoselect_devices(*machine, IPT_POSITIONAL, IPT_POSITIONAL_V, 0, OPTION_POSITIONAL_DEVICE, "positional"); - init_autoselect_devices(*machine, IPT_MOUSE_X, IPT_MOUSE_Y, 0, OPTION_MOUSE_DEVICE, "mouse"); + init_autoselect_devices(machine, IPT_PADDLE, IPT_PADDLE_V, 0, OPTION_PADDLE_DEVICE, "paddle"); + init_autoselect_devices(machine, IPT_AD_STICK_X, IPT_AD_STICK_Y, IPT_AD_STICK_Z, OPTION_ADSTICK_DEVICE, "analog joystick"); + init_autoselect_devices(machine, IPT_LIGHTGUN_X, IPT_LIGHTGUN_Y, 0, OPTION_LIGHTGUN_DEVICE, "lightgun"); + init_autoselect_devices(machine, IPT_PEDAL, IPT_PEDAL2, IPT_PEDAL3, OPTION_PEDAL_DEVICE, "pedal"); + init_autoselect_devices(machine, IPT_DIAL, IPT_DIAL_V, 0, OPTION_DIAL_DEVICE, "dial"); + init_autoselect_devices(machine, IPT_TRACKBALL_X, IPT_TRACKBALL_Y, 0, OPTION_TRACKBALL_DEVICE, "trackball"); + init_autoselect_devices(machine, IPT_POSITIONAL, IPT_POSITIONAL_V, 0, OPTION_POSITIONAL_DEVICE, "positional"); + init_autoselect_devices(machine, IPT_MOUSE_X, IPT_MOUSE_Y, 0, OPTION_MOUSE_DEVICE, "mouse"); /* look for 4-way joysticks and change the default map if we find any */ if (joystick_map_default[0] == 0 || strcmp(joystick_map_default, "auto") == 0) - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) if (field->state->joystick != NULL && field->way == 4) { @@ -2229,7 +2229,7 @@ static void init_autoselect_devices(running_machine &machine, int type1, int typ mame_printf_error("Invalid %s value %s; reverting to keyboard\n", option, stemp); /* only scan the list if we haven't already enabled this class of control */ - if (portlist.first() != NULL && !input_device_class_enabled(portlist.first()->machine, autoenable)) + if (portlist.first() != NULL && !input_device_class_enabled(portlist.first()->machine(), autoenable)) for (port = portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) @@ -2239,7 +2239,7 @@ static void init_autoselect_devices(running_machine &machine, int type1, int typ (type3 != 0 && field->type == type3)) { mame_printf_verbose("Input: Autoenabling %s due to presence of a %s\n", autostring, ananame); - input_device_class_enable(port->machine, autoenable, TRUE); + input_device_class_enable(port->machine(), autoenable, TRUE); break; } } @@ -2256,7 +2256,7 @@ static device_field_info *init_field_device_info(const input_field_config *field input_port_value mask; /* allocate memory */ - info = auto_alloc_clear(field->port->machine, device_field_info); + info = auto_alloc_clear(field->port->machine(), device_field_info); /* fill in the data */ info->field = field; @@ -2264,7 +2264,7 @@ static device_field_info *init_field_device_info(const input_field_config *field info->shift++; if (device_name != NULL) - info->device = field->port->machine->device(device_name); + info->device = field->port->machine().device(device_name); else info->device = (device_t *) info; @@ -2284,7 +2284,7 @@ static analog_field_state *init_field_analog_state(const input_field_config *fie input_port_value mask; /* allocate memory */ - state = auto_alloc_clear(field->port->machine, analog_field_state); + state = auto_alloc_clear(field->port->machine(), analog_field_state); /* compute the shift amount and number of bits */ for (mask = field->mask; !(mask & 1); mask >>= 1) @@ -2459,12 +2459,12 @@ static void frame_update_callback(running_machine &machine) return; /* otherwise, use the common code */ - frame_update(&machine); + frame_update(machine); } -static key_buffer *get_buffer(running_machine *machine) +static key_buffer *get_buffer(running_machine &machine) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; assert(inputx_can_post(machine)); return (key_buffer *)portdata->keybuffer; } @@ -2489,9 +2489,9 @@ static const inputx_code *find_code(inputx_code *codes, unicode_char ch) called from core to allow for natural keyboard -------------------------------------------------*/ -static void input_port_update_hook(running_machine *machine, const input_port_config *port, input_port_value *digital) +static void input_port_update_hook(running_machine &machine, const input_port_config *port, input_port_value *digital) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; const key_buffer *keybuf; const inputx_code *code; unicode_char ch; @@ -2531,12 +2531,12 @@ static void input_port_update_hook(running_machine *machine, const input_port_co port updating -------------------------------------------------*/ -static void frame_update(running_machine *machine) +static void frame_update(running_machine &machine) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; const input_field_config *mouse_field = NULL; int ui_visible = ui_is_menu_active(); - attotime curtime = machine->time(); + attotime curtime = machine.time(); const input_port_config *port; render_target *mouse_target; INT32 mouse_target_x; @@ -2567,11 +2567,11 @@ g_profiler.start(PROFILER_INPUT); input_port_value mask; float x, y; if (mouse_target->map_point_input(mouse_target_x, mouse_target_y, tag, mask, x, y)) - mouse_field = input_field_by_tag_and_mask(machine->m_portlist, tag, mask); + mouse_field = input_field_by_tag_and_mask(machine.m_portlist, tag, mask); } /* loop over all input ports */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) { const input_field_config *field; device_field_info *device_field; @@ -2583,7 +2583,7 @@ g_profiler.start(PROFILER_INPUT); /* now loop back and modify based on the inputs */ for (field = port->fieldlist; field != NULL; field = field->next) - if (input_condition_true(port->machine, &field->condition)) + if (input_condition_true(port->machine(), &field->condition)) { /* accumulate VBLANK bits */ if (field->type == IPT_VBLANK) @@ -2608,7 +2608,7 @@ g_profiler.start(PROFILER_INPUT); /* call device line changed handlers */ newvalue = input_port_read_direct(port); for (device_field = port->state->writedevicelist; device_field; device_field = device_field->next) - if (device_field->field->type != IPT_OUTPUT && input_condition_true(port->machine, &device_field->field->condition)) + if (device_field->field->type != IPT_OUTPUT && input_condition_true(port->machine(), &device_field->field->condition)) { input_port_value newval = (newvalue & device_field->field->mask) >> device_field->shift; @@ -2632,9 +2632,9 @@ g_profiler.stop(); accumulating the results in a port -------------------------------------------------*/ -static void frame_update_digital_joysticks(running_machine *machine) +static void frame_update_digital_joysticks(running_machine &machine) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; int player, joyindex; /* loop over all the joysticks */ @@ -2699,7 +2699,7 @@ static void frame_update_digital_joysticks(running_machine *machine) if ((joystick->current4way & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) && (joystick->current4way & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT))) { - if (machine->rand() & 1) + if (machine.rand() & 1) joystick->current4way &= ~(JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT); else joystick->current4way &= ~(JOYDIR_UP_BIT | JOYDIR_DOWN_BIT); @@ -2715,7 +2715,7 @@ static void frame_update_digital_joysticks(running_machine *machine) internals of a single analog field -------------------------------------------------*/ -static void frame_update_analog_field(running_machine *machine, analog_field_state *analog) +static void frame_update_analog_field(running_machine &machine, analog_field_state *analog) { input_item_class itemclass; int keypressed = FALSE; @@ -2861,7 +2861,7 @@ static void frame_update_analog_field(running_machine *machine, analog_field_sta static int frame_get_digital_field_state(const input_field_config *field, int mouse_down) { - int curstate = mouse_down || input_seq_pressed(field->port->machine, input_field_seq(field, SEQ_TYPE_STANDARD)); + int curstate = mouse_down || input_seq_pressed(field->port->machine(), input_field_seq(field, SEQ_TYPE_STANDARD)); int changed = FALSE; /* if the state changed, look for switch down/switch up */ @@ -2871,7 +2871,7 @@ static int frame_get_digital_field_state(const input_field_config *field, int mo changed = TRUE; } - if (field->type == IPT_KEYBOARD && ui_get_use_natural_keyboard(field->port->machine)) + if (field->type == IPT_KEYBOARD && ui_get_use_natural_keyboard(field->port->machine())) return FALSE; /* if this is a switch-down event, handle impulse and toggle */ @@ -2917,7 +2917,7 @@ static int frame_get_digital_field_state(const input_field_config *field, int mo } /* skip locked-out coin inputs */ - if (curstate && field->type >= IPT_COIN1 && field->type <= IPT_COIN12 && coin_lockout_get_state(field->port->machine, field->type - IPT_COIN1) && field->port->machine->options().coin_lockout()) + if (curstate && field->type >= IPT_COIN1 && field->type <= IPT_COIN12 && coin_lockout_get_state(field->port->machine(), field->type - IPT_COIN1) && field->port->machine().options().coin_lockout()) { ui_popup_time(3, "Coinlock disabled %s.", input_field_name(field)); return FALSE; @@ -3645,7 +3645,7 @@ input_port_config::input_port_config(const char *_tag) tag(_tag), fieldlist(NULL), state(NULL), - machine(NULL), + m_machine(NULL), owner(NULL), active(0) { @@ -3941,9 +3941,9 @@ static void diplocation_free(input_field_diplocation **diplocptr) token to an input field type and player -------------------------------------------------*/ -static int token_to_input_field_type(running_machine *machine, const char *string, int *player) +static int token_to_input_field_type(running_machine &machine, const char *string, int *player) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; const input_type_desc *typedesc; int ipnum; @@ -3970,9 +3970,9 @@ static int token_to_input_field_type(running_machine *machine, const char *strin field type and player to a string token -------------------------------------------------*/ -static const char *input_field_type_to_token(running_machine *machine, int type, int player) +static const char *input_field_type_to_token(running_machine &machine, int type, int player) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; input_type_state *typestate; static char tempbuf[32]; @@ -4015,9 +4015,9 @@ static int token_to_seq_type(const char *string) configuration data from the XML nodes -------------------------------------------------*/ -static void load_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode) +static void load_config_callback(running_machine &machine, int config_type, xml_data_node *parentnode) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; xml_data_node *portnode; int seqtype; @@ -4090,9 +4090,9 @@ static void load_config_callback(running_machine *machine, int config_type, xml_ global remapping table -------------------------------------------------*/ -static void load_remap_table(running_machine *machine, xml_data_node *parentnode) +static void load_remap_table(running_machine &machine, xml_data_node *parentnode) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; input_code *oldtable, *newtable; xml_data_node *remapnode; int count; @@ -4157,9 +4157,9 @@ static void load_remap_table(running_machine *machine, xml_data_node *parentnode data to the default mappings -------------------------------------------------*/ -static int load_default_config(running_machine *machine, xml_data_node *portnode, int type, int player, const input_seq *newseq) +static int load_default_config(running_machine &machine, xml_data_node *portnode, int type, int player, const input_seq *newseq) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; input_type_state *typestate; int seqtype; @@ -4182,7 +4182,7 @@ static int load_default_config(running_machine *machine, xml_data_node *portnode data to the current set of input ports -------------------------------------------------*/ -static int load_game_config(running_machine *machine, xml_data_node *portnode, int type, int player, const input_seq *newseq) +static int load_game_config(running_machine &machine, xml_data_node *portnode, int type, int player, const input_seq *newseq) { input_port_value mask, defvalue; const input_field_config *field; @@ -4196,7 +4196,7 @@ static int load_game_config(running_machine *machine, xml_data_node *portnode, i defvalue = xml_get_attribute_int(portnode, "defvalue", 0); /* find the port we want; if no tag, search them all */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) if (tag == NULL || strcmp(get_port_tag(port, tempbuffer), tag) == 0) for (field = port->fieldlist; field != NULL; field = field->next) @@ -4246,7 +4246,7 @@ static int load_game_config(running_machine *machine, xml_data_node *portnode, i saving input port configuration -------------------------------------------------*/ -static void save_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode) +static void save_config_callback(running_machine &machine, int config_type, xml_data_node *parentnode) { /* if no parentnode, ignore */ if (parentnode == NULL) @@ -4265,7 +4265,7 @@ static void save_config_callback(running_machine *machine, int config_type, xml_ sequence -------------------------------------------------*/ -static void save_sequence(running_machine *machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq) +static void save_sequence(running_machine &machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq) { astring seqstring; xml_data_node *seqnode; @@ -4308,9 +4308,9 @@ static int save_this_input_field_type(int type) mappings that have changed -------------------------------------------------*/ -static void save_default_inputs(running_machine *machine, xml_data_node *parentnode) +static void save_default_inputs(running_machine &machine, xml_data_node *parentnode) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; input_type_state *typestate; /* iterate over ports */ @@ -4352,13 +4352,13 @@ static void save_default_inputs(running_machine *machine, xml_data_node *parentn mappings that have changed -------------------------------------------------*/ -static void save_game_inputs(running_machine *machine, xml_data_node *parentnode) +static void save_game_inputs(running_machine &machine, xml_data_node *parentnode) { const input_field_config *field; const input_port_config *port; /* iterate over ports */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) if (save_this_input_field_type(field->type)) { @@ -4437,9 +4437,9 @@ static void save_game_inputs(running_machine *machine, xml_data_node *parentnode from the playback file -------------------------------------------------*/ -static UINT8 playback_read_uint8(running_machine *machine) +static UINT8 playback_read_uint8(running_machine &machine) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; UINT8 result; /* protect against NULL handles if previous reads fail */ @@ -4463,9 +4463,9 @@ static UINT8 playback_read_uint8(running_machine *machine) from the playback file -------------------------------------------------*/ -static UINT32 playback_read_uint32(running_machine *machine) +static UINT32 playback_read_uint32(running_machine &machine) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; UINT32 result; /* protect against NULL handles if previous reads fail */ @@ -4489,9 +4489,9 @@ static UINT32 playback_read_uint32(running_machine *machine) from the playback file -------------------------------------------------*/ -static UINT64 playback_read_uint64(running_machine *machine) +static UINT64 playback_read_uint64(running_machine &machine) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; UINT64 result; /* protect against NULL handles if previous reads fail */ @@ -4514,10 +4514,10 @@ static UINT64 playback_read_uint64(running_machine *machine) playback_init - initialize INP playback -------------------------------------------------*/ -static time_t playback_init(running_machine *machine) +static time_t playback_init(running_machine &machine) { - const char *filename = machine->options().playback(); - input_port_private *portdata = machine->input_port_data; + const char *filename = machine.options().playback(); + input_port_private *portdata = machine.input_port_data; UINT8 header[INP_HEADER_SIZE]; time_t basetime; @@ -4526,7 +4526,7 @@ static time_t playback_init(running_machine *machine) return 0; /* open the playback file */ - portdata->playback_file = auto_alloc(machine, emu_file(machine->options().input_directory(), OPEN_FLAG_READ)); + portdata->playback_file = auto_alloc(machine, emu_file(machine.options().input_directory(), OPEN_FLAG_READ)); file_error filerr = portdata->playback_file->open(filename); assert_always(filerr == FILERR_NONE, "Failed to open file for playback"); @@ -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->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); + 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); @@ -4561,9 +4561,9 @@ static time_t playback_init(running_machine *machine) playback_end - end INP playback -------------------------------------------------*/ -static void playback_end(running_machine *machine, const char *message) +static void playback_end(running_machine &machine, const char *message) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; /* only applies if we have a live file */ if (portdata->playback_file != NULL) @@ -4589,9 +4589,9 @@ static void playback_end(running_machine *machine, const char *message) playback -------------------------------------------------*/ -static void playback_frame(running_machine *machine, attotime curtime) +static void playback_frame(running_machine &machine, attotime curtime) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; /* if playing back, fetch the information and verify */ if (portdata->playback_file != NULL) @@ -4617,7 +4617,7 @@ static void playback_frame(running_machine *machine, attotime curtime) static void playback_port(const input_port_config *port) { - input_port_private *portdata = port->machine->input_port_data; + input_port_private *portdata = port->machine().input_port_data; /* if playing back, fetch information about this port */ if (portdata->playback_file != NULL) @@ -4625,19 +4625,19 @@ static void playback_port(const input_port_config *port) analog_field_state *analog; /* read the default value and the digital state */ - port->state->defvalue = playback_read_uint32(port->machine); - port->state->digital = playback_read_uint32(port->machine); + port->state->defvalue = playback_read_uint32(port->machine()); + port->state->digital = playback_read_uint32(port->machine()); /* loop over analog ports and save their data */ for (analog = port->state->analoglist; analog != NULL; analog = analog->next) { /* read current and previous values */ - analog->accum = playback_read_uint32(port->machine); - analog->previous = playback_read_uint32(port->machine); + analog->accum = playback_read_uint32(port->machine()); + analog->previous = playback_read_uint32(port->machine()); /* read configuration information */ - analog->sensitivity = playback_read_uint32(port->machine); - analog->reverse = playback_read_uint8(port->machine); + analog->sensitivity = playback_read_uint32(port->machine()); + analog->reverse = playback_read_uint8(port->machine()); } } } @@ -4653,9 +4653,9 @@ static void playback_port(const input_port_config *port) to the record file -------------------------------------------------*/ -static void record_write_uint8(running_machine *machine, UINT8 data) +static void record_write_uint8(running_machine &machine, UINT8 data) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; UINT8 result = data; /* protect against NULL handles if previous reads fail */ @@ -4673,9 +4673,9 @@ static void record_write_uint8(running_machine *machine, UINT8 data) to the record file -------------------------------------------------*/ -static void record_write_uint32(running_machine *machine, UINT32 data) +static void record_write_uint32(running_machine &machine, UINT32 data) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; UINT32 result = LITTLE_ENDIANIZE_INT32(data); /* protect against NULL handles if previous reads fail */ @@ -4693,9 +4693,9 @@ static void record_write_uint32(running_machine *machine, UINT32 data) to the record file -------------------------------------------------*/ -static void record_write_uint64(running_machine *machine, UINT64 data) +static void record_write_uint64(running_machine &machine, UINT64 data) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; UINT64 result = LITTLE_ENDIANIZE_INT64(data); /* protect against NULL handles if previous reads fail */ @@ -4712,10 +4712,10 @@ static void record_write_uint64(running_machine *machine, UINT64 data) record_init - initialize INP recording -------------------------------------------------*/ -static void record_init(running_machine *machine) +static void record_init(running_machine &machine) { - const char *filename = machine->options().record(); - input_port_private *portdata = machine->input_port_data; + const char *filename = machine.options().record(); + input_port_private *portdata = machine.input_port_data; UINT8 header[INP_HEADER_SIZE]; system_time systime; @@ -4724,12 +4724,12 @@ static void record_init(running_machine *machine) return; /* open the record file */ - portdata->record_file = auto_alloc(machine, emu_file(machine->options().input_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)); + portdata->record_file = auto_alloc(machine, emu_file(machine.options().input_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)); file_error filerr = portdata->record_file->open(filename); assert_always(filerr == FILERR_NONE, "Failed to open file for recording"); /* get the base time */ - machine->base_datetime(systime); + machine.base_datetime(systime); /* fill in the header */ memset(header, 0, sizeof(header)); @@ -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->system().name); + strcpy((char *)header + 0x14, machine.system().name); sprintf((char *)header + 0x20, APPNAME " %s", build_version); /* write it */ @@ -4759,9 +4759,9 @@ static void record_init(running_machine *machine) record_end - end INP recording -------------------------------------------------*/ -static void record_end(running_machine *machine, const char *message) +static void record_end(running_machine &machine, const char *message) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; /* only applies if we have a live file */ if (portdata->record_file != NULL) @@ -4782,9 +4782,9 @@ static void record_end(running_machine *machine, const char *message) recording -------------------------------------------------*/ -static void record_frame(running_machine *machine, attotime curtime) +static void record_frame(running_machine &machine, attotime curtime) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; /* if recording, record information about the current frame */ if (portdata->record_file != NULL) @@ -4794,7 +4794,7 @@ static void record_frame(running_machine *machine, attotime curtime) record_write_uint64(machine, curtime.attoseconds); /* then the current speed */ - record_write_uint32(machine, machine->video().speed_percent() * (double)(1 << 20)); + record_write_uint32(machine, machine.video().speed_percent() * (double)(1 << 20)); } } @@ -4805,7 +4805,7 @@ static void record_frame(running_machine *machine, attotime curtime) static void record_port(const input_port_config *port) { - input_port_private *portdata = port->machine->input_port_data; + input_port_private *portdata = port->machine().input_port_data; /* if recording, store information about this port */ if (portdata->record_file != NULL) @@ -4813,29 +4813,29 @@ static void record_port(const input_port_config *port) analog_field_state *analog; /* store the default value and digital state */ - record_write_uint32(port->machine, port->state->defvalue); - record_write_uint32(port->machine, port->state->digital); + record_write_uint32(port->machine(), port->state->defvalue); + record_write_uint32(port->machine(), port->state->digital); /* loop over analog ports and save their data */ for (analog = port->state->analoglist; analog != NULL; analog = analog->next) { /* store current and previous values */ - record_write_uint32(port->machine, analog->accum); - record_write_uint32(port->machine, analog->previous); + record_write_uint32(port->machine(), analog->accum); + record_write_uint32(port->machine(), analog->previous); /* store configuration information */ - record_write_uint32(port->machine, analog->sensitivity); - record_write_uint8(port->machine, analog->reverse); + record_write_uint32(port->machine(), analog->sensitivity); + record_write_uint8(port->machine(), analog->reverse); } } } -int input_machine_has_keyboard(running_machine *machine) +int input_machine_has_keyboard(running_machine &machine) { int have_keyboard = FALSE; const input_field_config *field; const input_port_config *port; - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) { for (field = port->fieldlist; field != NULL; field = field->next) { @@ -4858,7 +4858,7 @@ int input_machine_has_keyboard(running_machine *machine) given code; used for logging and debugging -------------------------------------------------*/ -static const char *code_point_string(running_machine *machine, unicode_char ch) +static const char *code_point_string(running_machine &machine, unicode_char ch) { static char buf[16]; const char *result = buf; @@ -4905,7 +4905,7 @@ static const char *code_point_string(running_machine *machine, unicode_char ch) sets up natural keyboard input mapping -------------------------------------------------*/ -static int scan_keys(running_machine *machine, const input_port_config *portconfig, inputx_code *codes, const input_port_config * *ports, const input_field_config * *shift_ports, int keys, int shift) +static int scan_keys(running_machine &machine, const input_port_config *portconfig, inputx_code *codes, const input_port_config * *ports, const input_field_config * *shift_ports, int keys, int shift) { int code_count = 0; const input_port_config *port; @@ -4967,7 +4967,7 @@ static int scan_keys(running_machine *machine, const input_port_config *portconf chars -------------------------------------------------*/ -static inputx_code *build_codes(running_machine *machine, const input_port_config *portconfig) +static inputx_code *build_codes(running_machine &machine, const input_port_config *portconfig) { inputx_code *codes = NULL; const input_port_config *ports[NUM_SIMUL_KEYS]; @@ -5045,19 +5045,19 @@ static void clear_keybuffer(running_machine &machine) -static void setup_keybuffer(running_machine *machine) +static void setup_keybuffer(running_machine &machine) { - input_port_private *portdata = machine->input_port_data; - portdata->inputx_timer = machine->scheduler().timer_alloc(FUNC(inputx_timerproc)); + input_port_private *portdata = machine.input_port_data; + portdata->inputx_timer = machine.scheduler().timer_alloc(FUNC(inputx_timerproc)); portdata->keybuffer = auto_alloc_clear(machine, key_buffer); - machine->add_notifier(MACHINE_NOTIFY_EXIT, clear_keybuffer); + machine.add_notifier(MACHINE_NOTIFY_EXIT, clear_keybuffer); } -void inputx_init(running_machine *machine) +void inputx_init(running_machine &machine) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; portdata->codes = NULL; portdata->inputx_timer = NULL; portdata->queue_chars = NULL; @@ -5065,7 +5065,7 @@ void inputx_init(running_machine *machine) portdata->charqueue_empty = NULL; portdata->keybuffer = NULL; - if (machine->debug_flags & DEBUG_FLAG_ENABLED) + if (machine.debug_flags & DEBUG_FLAG_ENABLED) { debug_console_register_command(machine, "input", CMDFLAG_NONE, 0, 1, 1, execute_input); debug_console_register_command(machine, "dumpkbd", CMDFLAG_NONE, 0, 0, 1, execute_dumpkbd); @@ -5074,7 +5074,7 @@ void inputx_init(running_machine *machine) /* posting keys directly only makes sense for a computer */ if (input_machine_has_keyboard(machine)) { - portdata->codes = build_codes(machine, machine->m_portlist.first()); + portdata->codes = build_codes(machine, machine.m_portlist.first()); setup_keybuffer(machine); } } @@ -5082,27 +5082,27 @@ void inputx_init(running_machine *machine) void inputx_setup_natural_keyboard( - running_machine *machine, - int (*queue_chars)(running_machine *machine, const unicode_char *text, size_t text_len), - int (*accept_char)(running_machine *machine, unicode_char ch), - int (*charqueue_empty)(running_machine *machine)) + running_machine &machine, + int (*queue_chars)(running_machine &machine, const unicode_char *text, size_t text_len), + int (*accept_char)(running_machine &machine, unicode_char ch), + int (*charqueue_empty)(running_machine &machine)) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; portdata->queue_chars = queue_chars; portdata->accept_char = accept_char; portdata->charqueue_empty = charqueue_empty; } -int inputx_can_post(running_machine *machine) +int inputx_can_post(running_machine &machine) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; return portdata->queue_chars || portdata->codes; } -static int can_post_key_directly(running_machine *machine, unicode_char ch) +static int can_post_key_directly(running_machine &machine, unicode_char ch) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; int rc = FALSE; const inputx_code *code; @@ -5121,7 +5121,7 @@ static int can_post_key_directly(running_machine *machine, unicode_char ch) -static int can_post_key_alternate(running_machine *machine, unicode_char ch) +static int can_post_key_alternate(running_machine &machine, unicode_char ch) { const char *s; const char_info *ci; @@ -5173,9 +5173,9 @@ static attotime choose_delay(input_port_private *portdata, unicode_char ch) -static void internal_post_key(running_machine *machine, unicode_char ch) +static void internal_post_key(running_machine &machine, unicode_char ch) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; key_buffer *keybuf; keybuf = get_buffer(machine); @@ -5193,7 +5193,7 @@ static void internal_post_key(running_machine *machine, unicode_char ch) -static int buffer_full(running_machine *machine) +static int buffer_full(running_machine &machine) { key_buffer *keybuf; keybuf = get_buffer(machine); @@ -5202,9 +5202,9 @@ static int buffer_full(running_machine *machine) -static void inputx_postn_rate(running_machine *machine, const unicode_char *text, size_t text_len, attotime rate) +static void inputx_postn_rate(running_machine &machine, const unicode_char *text, size_t text_len, attotime rate) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; int last_cr = 0; unicode_char ch; const char *s; @@ -5264,7 +5264,7 @@ static void inputx_postn_rate(running_machine *machine, const unicode_char *text static TIMER_CALLBACK(inputx_timerproc) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; key_buffer *keybuf; attotime delay; @@ -5305,9 +5305,9 @@ static TIMER_CALLBACK(inputx_timerproc) } } -int inputx_is_posting(running_machine *machine) +int inputx_is_posting(running_machine &machine) { - input_port_private *portdata = machine->input_port_data; + input_port_private *portdata = machine.input_port_data; const key_buffer *keybuf; keybuf = get_buffer(machine); return (keybuf->begin_pos != keybuf->end_pos) || (portdata->charqueue_empty && !(*portdata->charqueue_empty)(machine)); @@ -5318,9 +5318,9 @@ int inputx_is_posting(running_machine *machine) Coded input ***************************************************************************/ -static void inputx_postc_rate(running_machine *machine, unicode_char ch, attotime rate); +static void inputx_postc_rate(running_machine &machine, unicode_char ch, attotime rate); -static void inputx_postn_coded_rate(running_machine *machine, const char *text, size_t text_len, attotime rate) +static void inputx_postn_coded_rate(running_machine &machine, const char *text, size_t text_len, attotime rate) { size_t i, j, key_len, increment; unicode_char ch; @@ -5397,17 +5397,17 @@ static void inputx_postn_coded_rate(running_machine *machine, const char *text, ***************************************************************************/ -static void inputx_postc_rate(running_machine *machine, unicode_char ch, attotime rate) +static void inputx_postc_rate(running_machine &machine, unicode_char ch, attotime rate) { inputx_postn_rate(machine, &ch, 1, rate); } -void inputx_postc(running_machine *machine, unicode_char ch) +void inputx_postc(running_machine &machine, unicode_char ch) { inputx_postc_rate(machine, ch, attotime::zero); } -static void inputx_postn_utf8_rate(running_machine *machine, const char *text, size_t text_len, attotime rate) +static void inputx_postn_utf8_rate(running_machine &machine, const char *text, size_t text_len, attotime rate) { size_t len = 0; unicode_char buf[256]; @@ -5435,12 +5435,12 @@ static void inputx_postn_utf8_rate(running_machine *machine, const char *text, s inputx_postn_rate(machine, buf, len, rate); } -void inputx_post_utf8(running_machine *machine, const char *text) +void inputx_post_utf8(running_machine &machine, const char *text) { inputx_postn_utf8_rate(machine, text, strlen(text), attotime::zero); } -void inputx_post_utf8_rate(running_machine *machine, const char *text, attotime rate) +void inputx_post_utf8_rate(running_machine &machine, const char *text, attotime rate) { inputx_postn_utf8_rate(machine, text, strlen(text), rate); } @@ -5538,12 +5538,12 @@ int input_player_number(const input_field_config *port) particular input class is present -------------------------------------------------*/ -int input_has_input_class(running_machine *machine, int inputclass) +int input_has_input_class(running_machine &machine, int inputclass) { const input_port_config *port; const input_field_config *field; - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) { for (field = port->fieldlist; field != NULL; field = field->next) { @@ -5561,14 +5561,14 @@ int input_has_input_class(running_machine *machine, int inputclass) active players -------------------------------------------------*/ -int input_count_players(running_machine *machine) +int input_count_players(running_machine &machine) { const input_port_config *port; const input_field_config *field; int joystick_count; joystick_count = 0; - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) { for (field = port->fieldlist; field != NULL; field = field->next) { @@ -5589,7 +5589,7 @@ int input_count_players(running_machine *machine) specific category is active -------------------------------------------------*/ -int input_category_active(running_machine *machine, int category) +int input_category_active(running_machine &machine, int category) { const input_port_config *port; const input_field_config *field = NULL; @@ -5599,7 +5599,7 @@ int input_category_active(running_machine *machine, int category) assert(category >= 1); /* loop through the input ports */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) { for (field = port->fieldlist; field != NULL; field = field->next) { @@ -5632,7 +5632,7 @@ int input_category_active(running_machine *machine, int category) natural keyboard input -------------------------------------------------*/ -static void execute_input(running_machine *machine, int ref, int params, const char *param[]) +static void execute_input(running_machine &machine, int ref, int params, const char *param[]) { inputx_postn_coded_rate(machine, param[0], strlen(param[0]), attotime::zero); } @@ -5644,9 +5644,9 @@ static void execute_input(running_machine *machine, int ref, int params, const c keyboard codes -------------------------------------------------*/ -static void execute_dumpkbd(running_machine *machine, int ref, int params, const char *param[]) +static void execute_dumpkbd(running_machine &machine, int ref, int params, const char *param[]) { - inputx_code *codes = machine->input_port_data->codes; + inputx_code *codes = machine.input_port_data->codes; const char *filename; FILE *file = NULL; const inputx_code *code; diff --git a/src/emu/inptport.h b/src/emu/inptport.h index 31d566323fa..7f98c5092d2 100644 --- a/src/emu/inptport.h +++ b/src/emu/inptport.h @@ -741,6 +741,7 @@ public: ~input_port_config(); input_port_config *next() const { return m_next; } + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } input_port_config * m_next; /* pointer to next port */ const char * tag; /* pointer to this port's tag */ @@ -748,7 +749,7 @@ public: /* these fields are only valid if the port is live */ input_port_state * state; /* live state of port (NULL if not live) */ - running_machine * machine; /* machine if port is live */ + running_machine * m_machine; /* machine if port is live */ device_config * owner; /* associated device, when appropriate */ input_port_value active; /* mask of active bits in the port */ }; @@ -1081,7 +1082,7 @@ struct _inp_header /* ----- core system management ----- */ /* initialize the input ports, processing the given token list */ -time_t input_port_init(running_machine *machine, const input_port_token *tokens, const device_config_list &devicelist); +time_t input_port_init(running_machine &machine, const input_port_token *tokens, const device_config_list &devicelist); @@ -1101,22 +1102,22 @@ const input_field_config *input_field_by_tag_and_mask(const ioport_list &portlis int input_type_is_analog(int type); /* return the name for the given type/player */ -const char *input_type_name(running_machine *machine, int type, int player); +const char *input_type_name(running_machine &machine, int type, int player); /* return the group for the given type/player */ -int input_type_group(running_machine *machine, int type, int player); +int input_type_group(running_machine &machine, int type, int player); /* return the global input mapping sequence for the given type/player */ -const input_seq *input_type_seq(running_machine *machine, int type, int player, input_seq_type seqtype); +const input_seq *input_type_seq(running_machine &machine, int type, int player, input_seq_type seqtype); /* change the global input sequence for the given type/player */ -void input_type_set_seq(running_machine *machine, int type, int player, input_seq_type seqtype, const input_seq *newseq); +void input_type_set_seq(running_machine &machine, int type, int player, input_seq_type seqtype, const input_seq *newseq); /* return TRUE if the sequence for the given input type/player is pressed */ -int input_type_pressed(running_machine *machine, int type, int player); +int input_type_pressed(running_machine &machine, int type, int player); /* return the list of default mappings */ -const input_type_desc *input_type_list(running_machine *machine); +const input_type_desc *input_type_list(running_machine &machine); @@ -1153,13 +1154,13 @@ void input_field_select_next_setting(const input_field_config *field); /* ----- port checking ----- */ /* return whether an input port exists */ -bool input_port_exists(running_machine *machine, const char *tag); +bool input_port_exists(running_machine &machine, const char *tag); /* return a bitmask of which bits of an input port are active (i.e. not unused or unknown) */ -input_port_value input_port_active(running_machine *machine, const char *tag); +input_port_value input_port_active(running_machine &machine, const char *tag); /* return a bitmask of which bits of an input port are active (i.e. not unused or unknown), or a default value if the port does not exist */ -input_port_value input_port_active_safe(running_machine *machine, const char *tag, input_port_value defvalue); +input_port_value input_port_active_safe(running_machine &machine, const char *tag, input_port_value defvalue); /* ----- port reading ----- */ @@ -1168,19 +1169,19 @@ input_port_value input_port_active_safe(running_machine *machine, const char *ta input_port_value input_port_read_direct(const input_port_config *port); /* return the value of an input port specified by tag */ -input_port_value input_port_read(running_machine *machine, const char *tag); +input_port_value input_port_read(running_machine &machine, const char *tag); /* return the value of a device input port specified by tag */ input_port_value input_port_read(device_t *device, const char *tag); /* return the value of an input port specified by tag, or a default value if the port does not exist */ -input_port_value input_port_read_safe(running_machine *machine, const char *tag, input_port_value defvalue); +input_port_value input_port_read_safe(running_machine &machine, const char *tag, input_port_value defvalue); /* return the extracted crosshair values for the given player */ -int input_port_get_crosshair_position(running_machine *machine, int player, float *x, float *y); +int input_port_get_crosshair_position(running_machine &machine, int player, float *x, float *y); /* force an update to the input port values based on current conditions */ -void input_port_update_defaults(running_machine *machine); +void input_port_update_defaults(running_machine &machine); @@ -1190,50 +1191,50 @@ void input_port_update_defaults(running_machine *machine); void input_port_write_direct(const input_port_config *port, input_port_value value, input_port_value mask); /* write a value to a port specified by tag */ -void input_port_write(running_machine *machine, const char *tag, input_port_value value, input_port_value mask); +void input_port_write(running_machine &machine, const char *tag, input_port_value value, input_port_value mask); /* write a value to a port, ignore if the port does not exist */ -void input_port_write_safe(running_machine *machine, const char *tag, input_port_value value, input_port_value mask); +void input_port_write_safe(running_machine &machine, const char *tag, input_port_value value, input_port_value mask); /* ----- misc helper functions ----- */ /* return the TRUE if the given condition attached is true */ -int input_condition_true(running_machine *machine, const input_condition *condition); +int input_condition_true(running_machine &machine, const input_condition *condition); /* convert an input_port_token to a default string */ const char *input_port_string_from_token(const input_port_token token); /* return TRUE if machine use full keyboard emulation */ -int input_machine_has_keyboard(running_machine *machine); +int input_machine_has_keyboard(running_machine &machine); /* these are called by the core; they should not be called from FEs */ -void inputx_init(running_machine *machine); +void inputx_init(running_machine &machine); /* called by drivers to setup natural keyboard support */ -void inputx_setup_natural_keyboard(running_machine *machine, - int (*queue_chars)(running_machine *machine, const unicode_char *text, size_t text_len), - int (*accept_char)(running_machine *machine, unicode_char ch), - int (*charqueue_empty)(running_machine *machine)); +void inputx_setup_natural_keyboard(running_machine &machine, + int (*queue_chars)(running_machine &machine, const unicode_char *text, size_t text_len), + int (*accept_char)(running_machine &machine, unicode_char ch), + int (*charqueue_empty)(running_machine &machine)); /* validity checks */ int validate_natural_keyboard_statics(void); /* these can be called from FEs */ -int inputx_can_post(running_machine *machine); +int inputx_can_post(running_machine &machine); /* various posting functions; can be called from FEs */ -void inputx_postc(running_machine *machine, unicode_char ch); -void inputx_post_utf8(running_machine *machine, const char *text); -void inputx_post_utf8_rate(running_machine *machine, const char *text, attotime rate); -int inputx_is_posting(running_machine *machine); +void inputx_postc(running_machine &machine, unicode_char ch); +void inputx_post_utf8(running_machine &machine, const char *text); +void inputx_post_utf8_rate(running_machine &machine, const char *text, attotime rate); +int inputx_is_posting(running_machine &machine); /* miscellaneous functions */ int input_classify_port(const input_field_config *field); -int input_has_input_class(running_machine *machine, int inputclass); +int input_has_input_class(running_machine &machine, int inputclass); int input_player_number(const input_field_config *field); -int input_count_players(running_machine *machine); -int input_category_active(running_machine *machine, int category); +int input_count_players(running_machine &machine); +int input_category_active(running_machine &machine, int category); #endif /* __INPTPORT_H__ */ diff --git a/src/emu/input.c b/src/emu/input.c index 40d09320fda..bbe4ea7ad4b 100644 --- a/src/emu/input.c +++ b/src/emu/input.c @@ -80,7 +80,9 @@ struct _joystick_map /* a single input device */ struct _input_device { - running_machine * machine; /* machine we are attached to */ + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } + + running_machine * m_machine; /* machine we are attached to */ astring name; /* string name of device */ input_device_class devclass; /* class of this device */ int devindex; /* device index of this device */ @@ -421,15 +423,15 @@ const char joystick_map_4way_diagonal[] = "4444s8888..444458888.444555888.ss5. ***************************************************************************/ static void input_frame(running_machine &machine); -static input_device_item *input_code_item(running_machine *machine, input_code code); -static INT32 convert_absolute_value(running_machine *machine, input_code code, input_device_item *item); +static input_device_item *input_code_item(running_machine &machine, input_code code); +static INT32 convert_absolute_value(running_machine &machine, input_code code, input_device_item *item); static INT32 convert_relative_value(input_code code, input_device_item *item); -static INT32 convert_switch_value(running_machine *machine, input_code code, input_device_item *item); -static INT32 apply_deadzone_and_saturation(running_machine *machine, input_code code, INT32 result); +static INT32 convert_switch_value(running_machine &machine, input_code code, input_device_item *item); +static INT32 apply_deadzone_and_saturation(running_machine &machine, input_code code, INT32 result); static int joystick_map_parse(const char *mapstring, joystick_map *map); static void joystick_map_print(const char *header, const char *origstring, const joystick_map *map); -static void input_code_reset_axes(running_machine *machine); -static int input_code_check_axis(running_machine *machine, input_device_item *item, input_code code); +static void input_code_reset_axes(running_machine &machine); +static int input_code_check_axis(running_machine &machine, input_device_item *item, input_code code); @@ -442,13 +444,13 @@ static int input_code_check_axis(running_machine *machine, input_device_item *it a pointer to the associated device -------------------------------------------------*/ -INLINE input_device *input_code_device(running_machine *machine, input_code code) +INLINE input_device *input_code_device(running_machine &machine, input_code code) { /* if the class is valid... */ input_device_class devclass = INPUT_CODE_DEVCLASS(code); if (devclass > DEVICE_CLASS_INVALID && devclass < DEVICE_CLASS_MAXIMUM) { - input_device_list *device_list = machine->input_data->device_list; + input_device_list *device_list = machine.input_data->device_list; /* ...and the index is valid for that class, return a pointer to the device */ int devindex = INPUT_CODE_DEVINDEX(code); @@ -470,7 +472,7 @@ INLINE input_code device_item_to_code(input_device *device, input_item_id itemid { int devindex = device->devindex; - assert(devindex < device->machine->input_data->device_list[device->devclass].count); + assert(devindex < device->machine().input_data->device_list[device->devclass].count); assert(itemid < ITEM_ID_ABSOLUTE_MAXIMUM); assert(device->item[itemid] != NULL); @@ -504,9 +506,9 @@ INLINE input_item_class input_item_standard_class(input_device_class devclass, i of an input item -------------------------------------------------*/ -INLINE void input_item_update_value(running_machine *machine, input_device_item *item) +INLINE void input_item_update_value(running_machine &machine, input_device_item *item) { - input_device_list *device_list = machine->input_data->device_list; + input_device_list *device_list = machine.input_data->device_list; item->current = (*item->getstate)(device_list[item->devclass].list[item->devindex]->internal, item->internal); } @@ -517,9 +519,9 @@ INLINE void input_item_update_value(running_machine *machine, input_device_item of memory for pressed switches -------------------------------------------------*/ -INLINE void code_pressed_memory_reset(running_machine *machine) +INLINE void code_pressed_memory_reset(running_machine &machine) { - input_code *code_pressed_memory = machine->input_data->code_pressed_memory; + input_code *code_pressed_memory = machine.input_data->code_pressed_memory; int memnum; for (memnum = 0; memnum < MAX_PRESSED_SWITCHES; memnum++) @@ -570,45 +572,45 @@ INLINE const char *code_to_string(const code_string_table *table, UINT32 code) input_init - initialize the input lists -------------------------------------------------*/ -void input_init(running_machine *machine) +void input_init(running_machine &machine) { joystick_map map; input_private *state; input_device_list *device_list; /* remember this machine */ - stashed_machine = machine; + stashed_machine = &machine; /* allocate private memory */ - machine->input_data = state = auto_alloc_clear(machine, input_private); + machine.input_data = state = auto_alloc_clear(machine, input_private); device_list = state->device_list; /* reset code memory */ code_pressed_memory_reset(machine); /* request a per-frame callback for bookkeeping */ - machine->add_notifier(MACHINE_NOTIFY_FRAME, input_frame); + machine.add_notifier(MACHINE_NOTIFY_FRAME, input_frame); /* read input enable options */ device_list[DEVICE_CLASS_KEYBOARD].enabled = TRUE; - device_list[DEVICE_CLASS_MOUSE].enabled = machine->options().mouse(); - device_list[DEVICE_CLASS_LIGHTGUN].enabled = machine->options().lightgun(); - device_list[DEVICE_CLASS_JOYSTICK].enabled = machine->options().joystick(); + device_list[DEVICE_CLASS_MOUSE].enabled = machine.options().mouse(); + device_list[DEVICE_CLASS_LIGHTGUN].enabled = machine.options().lightgun(); + device_list[DEVICE_CLASS_JOYSTICK].enabled = machine.options().joystick(); /* read input device multi options */ - device_list[DEVICE_CLASS_KEYBOARD].multi = machine->options().multi_keyboard(); - device_list[DEVICE_CLASS_MOUSE].multi = machine->options().multi_mouse(); + device_list[DEVICE_CLASS_KEYBOARD].multi = machine.options().multi_keyboard(); + device_list[DEVICE_CLASS_MOUSE].multi = machine.options().multi_mouse(); device_list[DEVICE_CLASS_LIGHTGUN].multi = TRUE; device_list[DEVICE_CLASS_JOYSTICK].multi = TRUE; /* read other input options */ - state->steadykey_enabled = machine->options().steadykey(); - state->lightgun_reload_button = machine->options().offscreen_reload(); - state->joystick_deadzone = (INT32)(machine->options().joystick_deadzone() * INPUT_ABSOLUTE_MAX); - state->joystick_saturation = (INT32)(machine->options().joystick_saturation() * INPUT_ABSOLUTE_MAX); + state->steadykey_enabled = machine.options().steadykey(); + state->lightgun_reload_button = machine.options().offscreen_reload(); + state->joystick_deadzone = (INT32)(machine.options().joystick_deadzone() * INPUT_ABSOLUTE_MAX); + state->joystick_saturation = (INT32)(machine.options().joystick_saturation() * INPUT_ABSOLUTE_MAX); /* get the default joystick map */ - state->joystick_map_default = machine->options().joystick_map(); + state->joystick_map_default = machine.options().joystick_map(); if (state->joystick_map_default[0] == 0 || strcmp(state->joystick_map_default, "auto") == 0) state->joystick_map_default = joystick_map_8way; if (!joystick_map_parse(state->joystick_map_default, &map)) @@ -623,9 +625,9 @@ void input_init(running_machine *machine) a device class -------------------------------------------------*/ -void input_device_class_enable(running_machine *machine, input_device_class devclass, UINT8 enable) +void input_device_class_enable(running_machine &machine, input_device_class devclass, UINT8 enable) { - input_device_list *device_list = machine->input_data->device_list; + input_device_list *device_list = machine.input_data->device_list; assert(devclass > DEVICE_CLASS_INVALID && devclass < DEVICE_CLASS_MAXIMUM); device_list[devclass].enabled = enable; @@ -637,9 +639,9 @@ void input_device_class_enable(running_machine *machine, input_device_class devc enabled? -------------------------------------------------*/ -UINT8 input_device_class_enabled(running_machine *machine, input_device_class devclass) +UINT8 input_device_class_enabled(running_machine &machine, input_device_class devclass) { - input_device_list *device_list = machine->input_data->device_list; + input_device_list *device_list = machine.input_data->device_list; assert(devclass > DEVICE_CLASS_INVALID && devclass < DEVICE_CLASS_MAXIMUM); return device_list[devclass].enabled; @@ -651,9 +653,9 @@ UINT8 input_device_class_enabled(running_machine *machine, input_device_class de joystick map for a device -------------------------------------------------*/ -int input_device_set_joystick_map(running_machine *machine, int devindex, const char *mapstring) +int input_device_set_joystick_map(running_machine &machine, int devindex, const char *mapstring) { - input_device_list *device_list = machine->input_data->device_list; + input_device_list *device_list = machine.input_data->device_list; int startindex = devindex; int stopindex = devindex; joystick_map map; @@ -710,7 +712,7 @@ static void input_frame(running_machine &machine) input_device_item *item = device->item[itemid]; if (item != NULL && item->itemclass == ITEM_CLASS_SWITCH) { - input_item_update_value(&machine, item); + input_item_update_value(machine, item); if ((item->current ^ item->oldkey) & 1) { changed = TRUE; @@ -747,12 +749,12 @@ static void input_frame(running_machine &machine) input_device_add - add a new input device -------------------------------------------------*/ -input_device *input_device_add(running_machine *machine, input_device_class devclass, const char *name, void *internal) +input_device *input_device_add(running_machine &machine, input_device_class devclass, const char *name, void *internal) { - input_private *state = machine->input_data; + input_private *state = machine.input_data; input_device_list *devlist = &state->device_list[devclass]; - assert_always(machine->phase() == MACHINE_PHASE_INIT, "Can only call input_device_add at init time!"); + assert_always(machine.phase() == MACHINE_PHASE_INIT, "Can only call input_device_add at init time!"); assert(name != NULL); assert(devclass != DEVICE_CLASS_INVALID && devclass < DEVICE_CLASS_MAXIMUM); @@ -766,7 +768,7 @@ input_device *input_device_add(running_machine *machine, input_device_class devc devlist->list[devlist->count++] = device; /* fill in the data */ - device->machine = machine; + device->m_machine = &machine; device->name.cpy(name); device->devclass = devclass; device->devindex = devlist->count - 1; @@ -794,7 +796,7 @@ void input_device_item_add(input_device *device, const char *name, void *interna input_device_item *item; input_item_id itemid_std = itemid; - assert_always(device->machine->phase() == MACHINE_PHASE_INIT, "Can only call input_device_item_add at init time!"); + assert_always(device->machine().phase() == MACHINE_PHASE_INIT, "Can only call input_device_item_add at init time!"); assert(name != NULL); assert(itemid > ITEM_ID_INVALID && itemid < ITEM_ID_MAXIMUM); assert(getstate != NULL); @@ -810,7 +812,7 @@ void input_device_item_add(input_device *device, const char *name, void *interna assert(device->item[itemid] == NULL); /* allocate a new item and copy data into it */ - item = auto_alloc_clear(device->machine, input_device_item); + item = auto_alloc_clear(device->machine(), input_device_item); device->item[itemid] = item; device->maxitem = MAX(device->maxitem, itemid); @@ -848,9 +850,9 @@ void input_device_item_add(input_device *device, const char *name, void *interna given input code -------------------------------------------------*/ -INT32 input_code_value(running_machine *machine, input_code code) +INT32 input_code_value(running_machine &machine, input_code code) { - input_device_list *device_list = machine->input_data->device_list; + input_device_list *device_list = machine.input_data->device_list; input_device_class devclass = INPUT_CODE_DEVCLASS(code); int startindex = INPUT_CODE_DEVINDEX(code); int stopindex = startindex; @@ -918,7 +920,7 @@ exit: given input code has been pressed -------------------------------------------------*/ -int input_code_pressed(running_machine *machine, input_code code) +int input_code_pressed(running_machine &machine, input_code code) { return (input_code_value(machine, code) != 0); } @@ -930,9 +932,9 @@ int input_code_pressed(running_machine *machine, input_code code) on since the last call -------------------------------------------------*/ -int input_code_pressed_once(running_machine *machine, input_code code) +int input_code_pressed_once(running_machine &machine, input_code code) { - input_code *code_pressed_memory = machine->input_data->code_pressed_memory; + input_code *code_pressed_memory = machine.input_data->code_pressed_memory; int curvalue = input_code_pressed(machine, code); int memnum, empty = -1; @@ -972,9 +974,9 @@ int input_code_pressed_once(running_machine *machine, input_code code) an input_item_id to an input_code -------------------------------------------------*/ -input_code input_code_from_input_item_id(running_machine *machine, input_item_id itemid) +input_code input_code_from_input_item_id(running_machine &machine, input_item_id itemid) { - input_device_list *device_list = machine->input_data->device_list; + input_device_list *device_list = machine.input_data->device_list; input_device_class devclass; /* iterate over device classes and devices */ @@ -999,9 +1001,9 @@ input_code input_code_from_input_item_id(running_machine *machine, input_item_id input_code_poll_switches - poll for any input -------------------------------------------------*/ -input_code input_code_poll_switches(running_machine *machine, int reset) +input_code input_code_poll_switches(running_machine &machine, int reset) { - input_device_list *device_list = machine->input_data->device_list; + input_device_list *device_list = machine.input_data->device_list; input_device_class devclass; /* if resetting memory, do it now */ @@ -1094,9 +1096,9 @@ input_code input_code_poll_switches(running_machine *machine, int reset) any keyboard-specific input -------------------------------------------------*/ -input_code input_code_poll_keyboard_switches(running_machine *machine, int reset) +input_code input_code_poll_keyboard_switches(running_machine &machine, int reset) { - input_device_list *devlist = &machine->input_data->device_list[DEVICE_CLASS_KEYBOARD]; + input_device_list *devlist = &machine.input_data->device_list[DEVICE_CLASS_KEYBOARD]; int devnum; /* if resetting memory, do it now */ @@ -1132,7 +1134,7 @@ input_code input_code_poll_keyboard_switches(running_machine *machine, int reset move far enough -------------------------------------------------*/ -static int input_code_check_axis(running_machine *machine, input_device_item *item, input_code code) +static int input_code_check_axis(running_machine &machine, input_device_item *item, input_code code) { INT32 curval, diff; @@ -1177,9 +1179,9 @@ static int input_code_check_axis(running_machine *machine, input_device_item *it input_code_reset_axes - reset axes memory -------------------------------------------------*/ -static void input_code_reset_axes(running_machine *machine) +static void input_code_reset_axes(running_machine &machine) { - input_device_list *device_list = machine->input_data->device_list; + input_device_list *device_list = machine.input_data->device_list; input_device_class devclass; /* iterate over device classes and devices */ @@ -1219,9 +1221,9 @@ static void input_code_reset_axes(running_machine *machine) input_code_poll_axes - poll for any input -------------------------------------------------*/ -input_code input_code_poll_axes(running_machine *machine, int reset) +input_code input_code_poll_axes(running_machine &machine, int reset) { - input_device_list *device_list = machine->input_data->device_list; + input_device_list *device_list = machine.input_data->device_list; input_device_class devclass; /* if resetting memory, do it now */ @@ -1275,9 +1277,9 @@ input_code input_code_poll_axes(running_machine *machine, int reset) a friendly name -------------------------------------------------*/ -astring &input_code_name(running_machine *machine, astring &string, input_code code) +astring &input_code_name(running_machine &machine, astring &string, input_code code) { - input_device_list *device_list = machine->input_data->device_list; + input_device_list *device_list = machine.input_data->device_list; input_device_item *item = input_code_item(machine, code); const char *devclass; const char *devcode; @@ -1335,7 +1337,7 @@ astring &input_code_name(running_machine *machine, astring &string, input_code c a given code -------------------------------------------------*/ -astring &input_code_to_token(running_machine *machine, astring &string, input_code code) +astring &input_code_to_token(running_machine &machine, astring &string, input_code code) { input_device_item *item = input_code_item(machine, code); const char *devclass; @@ -1390,7 +1392,7 @@ astring &input_code_to_token(running_machine *machine, astring &string, input_co code from a token -------------------------------------------------*/ -input_code input_code_from_token(running_machine *machine, const char *_token) +input_code input_code_from_token(running_machine &machine, const char *_token) { UINT32 devclass, itemid, devindex, modifier, standard; UINT32 itemclass = ITEM_CLASS_INVALID; @@ -1438,7 +1440,7 @@ input_code input_code_from_token(running_machine *machine, const char *_token) /* otherwise, keep parsing */ else { - input_device_list *device_list = (machine != NULL) ? machine->input_data->device_list : NULL; + input_device_list *device_list = machine.input_data->device_list; input_device *device; /* if this is an invalid device, we have nothing to look up */ @@ -1510,16 +1512,16 @@ exit: INT32 debug_global_input_code_pressed(input_code code) { - if (!mame_is_valid_machine(stashed_machine)) + if (!mame_is_valid_machine(*stashed_machine)) return 0; - return input_code_pressed(stashed_machine, code); + return input_code_pressed(*stashed_machine, code); } INT32 debug_global_input_code_pressed_once(input_code code) { - if (!mame_is_valid_machine(stashed_machine)) + if (!mame_is_valid_machine(*stashed_machine)) return 0; - return input_code_pressed_once(stashed_machine, code); + return input_code_pressed_once(*stashed_machine, code); } /*************************************************************************** @@ -1531,7 +1533,7 @@ INT32 debug_global_input_code_pressed_once(input_code code) from the code -------------------------------------------------*/ -static input_device_item *input_code_item(running_machine *machine, input_code code) +static input_device_item *input_code_item(running_machine &machine, input_code code) { input_device *device = input_code_device(machine, code); input_item_id itemid; @@ -1555,9 +1557,9 @@ static input_device_item *input_code_item(running_machine *machine, input_code c value into the class specified by code -------------------------------------------------*/ -static INT32 convert_absolute_value(running_machine *machine, input_code code, input_device_item *item) +static INT32 convert_absolute_value(running_machine &machine, input_code code, input_device_item *item) { - input_private *state = machine->input_data; + input_private *state = machine.input_data; /* make sure values are valid */ assert(item->current >= INPUT_ABSOLUTE_MIN && item->current <= INPUT_ABSOLUTE_MAX); @@ -1679,9 +1681,9 @@ static INT32 convert_relative_value(input_code code, input_device_item *item) value into the class specified by code -------------------------------------------------*/ -static INT32 convert_switch_value(running_machine *machine, input_code code, input_device_item *item) +static INT32 convert_switch_value(running_machine &machine, input_code code, input_device_item *item) { - input_private *state = machine->input_data; + input_private *state = machine.input_data; /* only a switch is supported */ if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_SWITCH) @@ -1723,9 +1725,9 @@ static INT32 convert_switch_value(running_machine *machine, input_code code, inp absolute value -------------------------------------------------*/ -static INT32 apply_deadzone_and_saturation(running_machine *machine, input_code code, INT32 result) +static INT32 apply_deadzone_and_saturation(running_machine &machine, input_code code, INT32 result) { - input_private *state = machine->input_data; + input_private *state = machine.input_data; int negative = FALSE; /* ignore if not a joystick */ diff --git a/src/emu/input.h b/src/emu/input.h index b7af5498352..ecbd66d0d49 100644 --- a/src/emu/input.h +++ b/src/emu/input.h @@ -582,22 +582,22 @@ extern const char joystick_map_4way_diagonal[]; /* ----- initialization and configuration ----- */ /* core initialization, prior to calling osd_init() */ -void input_init(running_machine *machine); +void input_init(running_machine &machine); /* enable or disable a device class */ -void input_device_class_enable(running_machine *machine, input_device_class devclass, UINT8 enable); +void input_device_class_enable(running_machine &machine, input_device_class devclass, UINT8 enable); /* is a device class enabled? */ -UINT8 input_device_class_enabled(running_machine *machine, input_device_class devclass); +UINT8 input_device_class_enabled(running_machine &machine, input_device_class devclass); /* configure default joystick maps */ -int input_device_set_joystick_map(running_machine *machine, int devindex, const char *mapstring); +int input_device_set_joystick_map(running_machine &machine, int devindex, const char *mapstring); /* ----- OSD configuration and access ----- */ /* add a new input device */ -input_device *input_device_add(running_machine *machine, input_device_class devclass, const char *name, void *internal); +input_device *input_device_add(running_machine &machine, input_device_class devclass, const char *name, void *internal); /* add a new item to an input device */ void input_device_item_add(input_device *device, const char *name, void *internal, input_item_id itemid, item_get_state_func getstate); @@ -607,38 +607,38 @@ void input_device_item_add(input_device *device, const char *name, void *interna /* ----- state queries ----- */ /* return the value of a particular input code */ -INT32 input_code_value(running_machine *machine, input_code code); +INT32 input_code_value(running_machine &machine, input_code code); /* return TRUE if the given input code has been pressed */ -INT32 input_code_pressed(running_machine *machine, input_code code); +INT32 input_code_pressed(running_machine &machine, input_code code); /* same as above, but returns TRUE only on the first call after an off->on transition */ -INT32 input_code_pressed_once(running_machine *machine, input_code code); +INT32 input_code_pressed_once(running_machine &machine, input_code code); /* translates an input_item_id to an input_code */ -input_code input_code_from_input_item_id(running_machine *machine, input_item_id itemid); +input_code input_code_from_input_item_id(running_machine &machine, input_item_id itemid); /* poll for any switch input, optionally resetting internal memory */ -input_code input_code_poll_switches(running_machine *machine, int reset); +input_code input_code_poll_switches(running_machine &machine, int reset); /* poll for any keyboard switch input, optionally resetting internal memory */ -input_code input_code_poll_keyboard_switches(running_machine *machine, int reset); +input_code input_code_poll_keyboard_switches(running_machine &machine, int reset); /* poll for any axis input, optionally resetting internal memory */ -input_code input_code_poll_axes(running_machine *machine, int reset); +input_code input_code_poll_axes(running_machine &machine, int reset); /* ----- strings and tokenization ----- */ /* generate the friendly name of an input code, returning the length (buffer can be NULL) */ -astring &input_code_name(running_machine *machine, astring &buffer, input_code code); +astring &input_code_name(running_machine &machine, astring &buffer, input_code code); /* convert an input code to a token, returning the length (buffer can be NULL) */ -astring &input_code_to_token(running_machine *machine, astring &buffer, input_code code); +astring &input_code_to_token(running_machine &machine, astring &buffer, input_code code); /* convert a token back to an input code */ -input_code input_code_from_token(running_machine *machine, const char *_token); +input_code input_code_from_token(running_machine &machine, const char *_token); diff --git a/src/emu/inputseq.c b/src/emu/inputseq.c index 972e4c4f149..6b54596a983 100644 --- a/src/emu/inputseq.c +++ b/src/emu/inputseq.c @@ -132,7 +132,7 @@ INLINE void input_seq_backspace(input_seq *seq) sequence of switch inputs is "pressed" -------------------------------------------------*/ -int input_seq_pressed(running_machine *machine, const input_seq *seq) +int input_seq_pressed(running_machine &machine, const input_seq *seq) { int result = FALSE; int invert = FALSE; @@ -187,7 +187,7 @@ int input_seq_pressed(running_machine *machine, const input_seq *seq) axis defined in an input sequence -------------------------------------------------*/ -INT32 input_seq_axis_value(running_machine *machine, const input_seq *seq, input_item_class *itemclass_ptr) +INT32 input_seq_axis_value(running_machine &machine, const input_seq *seq, input_item_class *itemclass_ptr) { input_item_class itemclasszero = ITEM_CLASS_ABSOLUTE; input_item_class itemclass = ITEM_CLASS_INVALID; @@ -278,7 +278,7 @@ INT32 input_seq_axis_value(running_machine *machine, const input_seq *seq, input new sequence of the given itemclass -------------------------------------------------*/ -void input_seq_poll_start(running_machine *machine, input_item_class itemclass, const input_seq *startseq) +void input_seq_poll_start(running_machine &machine, input_item_class itemclass, const input_seq *startseq) { input_code dummycode; @@ -309,7 +309,7 @@ void input_seq_poll_start(running_machine *machine, input_item_class itemclass, input_seq_poll - continue polling -------------------------------------------------*/ -int input_seq_poll(running_machine *machine, input_seq *finalseq) +int input_seq_poll(running_machine &machine, input_seq *finalseq) { input_code lastcode = input_seq_get_last(&record_seq); int has_or = FALSE; @@ -406,7 +406,7 @@ int input_seq_poll(running_machine *machine, input_seq *finalseq) of a sequence -------------------------------------------------*/ -astring &input_seq_name(running_machine *machine, astring &string, const input_seq *seq) +astring &input_seq_name(running_machine &machine, astring &string, const input_seq *seq) { astring codestr; int codenum, copycodenum; @@ -464,7 +464,7 @@ astring &input_seq_name(running_machine *machine, astring &string, const input_s form of a sequence -------------------------------------------------*/ -astring &input_seq_to_tokens(running_machine *machine, astring &string, const input_seq *seq) +astring &input_seq_to_tokens(running_machine &machine, astring &string, const input_seq *seq) { astring codestr; int codenum; @@ -503,7 +503,7 @@ astring &input_seq_to_tokens(running_machine *machine, astring &string, const in form of a sequence -------------------------------------------------*/ -int input_seq_from_tokens(running_machine *machine, const char *string, input_seq *seq) +int input_seq_from_tokens(running_machine &machine, const char *string, input_seq *seq) { char *strcopy = auto_alloc_array(machine, char, strlen(string) + 1); char *str = strcopy; diff --git a/src/emu/inputseq.h b/src/emu/inputseq.h index aa1f65f841d..d0d344ee12d 100644 --- a/src/emu/inputseq.h +++ b/src/emu/inputseq.h @@ -71,33 +71,33 @@ struct _input_seq /* ----- state queries ----- */ /* return TRUE if the given switch sequence has been pressed */ -int input_seq_pressed(running_machine *machine, const input_seq *seq); +int input_seq_pressed(running_machine &machine, const input_seq *seq); /* return the value of an axis sequence */ -INT32 input_seq_axis_value(running_machine *machine, const input_seq *seq, input_item_class *itemclass_ptr); +INT32 input_seq_axis_value(running_machine &machine, const input_seq *seq, input_item_class *itemclass_ptr); /* ----- sequence polling ----- */ /* begin polling for a new sequence of the given itemclass */ -void input_seq_poll_start(running_machine *machine, input_item_class itemclass, const input_seq *startseq); +void input_seq_poll_start(running_machine &machine, input_item_class itemclass, const input_seq *startseq); /* continue polling for a sequence */ -int input_seq_poll(running_machine *machine, input_seq *finalseq); +int input_seq_poll(running_machine &machine, input_seq *finalseq); /* ----- strings and tokenization ----- */ /* generate the friendly name of an input sequence */ -astring &input_seq_name(running_machine *machine, astring &string, const input_seq *seq); +astring &input_seq_name(running_machine &machine, astring &string, const input_seq *seq); /* convert an input sequence to tokens, returning the length */ -astring &input_seq_to_tokens(running_machine *machine, astring &string, const input_seq *seq); +astring &input_seq_to_tokens(running_machine &machine, astring &string, const input_seq *seq); /* convert a set of tokens back to an input sequence */ -int input_seq_from_tokens(running_machine *machine, const char *string, input_seq *seq); +int input_seq_from_tokens(running_machine &machine, const char *string, input_seq *seq); diff --git a/src/emu/machine.c b/src/emu/machine.c index 2ea6772b10a..31dcc31ca5c 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -258,13 +258,13 @@ const char *running_machine::describe_context() void running_machine::start() { // initialize basic can't-fail systems here - config_init(this); - input_init(this); - output_init(this); - palette_init(this); - m_render = auto_alloc(this, render_manager(*this)); - generic_machine_init(this); - generic_sound_init(this); + config_init(*this); + input_init(*this); + output_init(*this); + palette_init(*this); + m_render = auto_alloc(*this, render_manager(*this)); + generic_machine_init(*this); + generic_sound_init(*this); // allocate a soft_reset timer m_soft_reset_timer = m_scheduler.timer_alloc(MSTUB(timer_expired, running_machine, soft_reset), this); @@ -273,8 +273,8 @@ void running_machine::start() m_osd.init(*this); // create the video manager - m_video = auto_alloc(this, video_manager(*this)); - ui_init(this); + m_video = auto_alloc(*this, video_manager(*this)); + ui_init(*this); // initialize the base time (needed for doing record/playback) ::time(&m_base_time); @@ -282,44 +282,44 @@ 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_system.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; // intialize UI input - ui_input_init(this); + ui_input_init(*this); // initialize the streams engine before the sound devices start - m_sound = auto_alloc(this, sound_manager(*this)); + m_sound = auto_alloc(*this, sound_manager(*this)); // first load ROMs, then populate memory, and finally initialize CPUs // these operations must proceed in this order - rom_init(this); - memory_init(this); - watchdog_init(this); + rom_init(*this); + memory_init(*this); + watchdog_init(*this); // must happen after memory_init because this relies on generic.spriteram - generic_video_init(this); + generic_video_init(*this); // allocate the gfx elements prior to device initialization - gfx_init(this); + gfx_init(*this); // initialize natural keyboard support - inputx_init(this); + inputx_init(*this); // initialize image devices - image_init(this); - tilemap_init(this); - crosshair_init(this); + image_init(*this); + tilemap_init(*this); + crosshair_init(*this); // initialize the debugger if ((debug_flags & DEBUG_FLAG_ENABLED) != 0) - debugger_init(this); + debugger_init(*this); // call the game driver's init function // this is where decryption is done and memory maps are altered // so this location in the init order is important - ui_set_startup_text(this, "Initializing...", true); + ui_set_startup_text(*this, "Initializing...", true); // start up the devices m_devicelist.start_all(); @@ -334,7 +334,7 @@ void running_machine::start() schedule_load("auto"); // set up the cheat engine - m_cheat = auto_alloc(this, cheat_manager(*this)); + m_cheat = auto_alloc(*this, cheat_manager(*this)); // disallow save state registrations starting here m_state.allow_registration(false); @@ -358,7 +358,7 @@ int running_machine::run(bool firstrun) // if we have a logfile, set up the callback if (options().log()) { - m_logfile = auto_alloc(this, emu_file(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)); + m_logfile = auto_alloc(*this, emu_file(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)); file_error filerr = m_logfile->open("error.log"); assert_always(filerr == FILERR_NONE, "unable to open log file"); add_logerror_callback(logfile_callback); @@ -368,12 +368,12 @@ int running_machine::run(bool firstrun) start(); // load the configuration settings and NVRAM - bool settingsloaded = config_load_settings(this); - nvram_load(this); + bool settingsloaded = config_load_settings(*this); + nvram_load(*this); sound().ui_mute(false); // display the startup screens - ui_display_startup_screens(this, firstrun, !settingsloaded); + ui_display_startup_screens(*this, firstrun, !settingsloaded); // perform a soft reset -- this takes us to the running phase soft_reset(*this); @@ -404,8 +404,8 @@ int running_machine::run(bool firstrun) // save the NVRAM and configuration sound().ui_mute(true); - nvram_save(this); - config_save_settings(this); + nvram_save(*this); + config_save_settings(*this); } catch (emu_fatalerror &fatal) { @@ -430,7 +430,7 @@ int running_machine::run(bool firstrun) zip_file_cache_clear(); // close the logfile - auto_free(this, m_logfile); + auto_free(*this, m_logfile); return error; } @@ -445,7 +445,7 @@ void running_machine::schedule_exit() if (m_exit_to_game_select && options().system_name()[0] != 0) { options().set_system_name(""); - ui_menu_force_game_select(this, &render().ui_container()); + ui_menu_force_game_select(*this, &render().ui_container()); } // otherwise, exit for real @@ -610,7 +610,7 @@ memory_region *running_machine::region_alloc(const char *name, UINT32 length, UI fatalerror("region_alloc called with duplicate region name \"%s\"\n", name); // allocate the region - return &m_regionlist.append(name, *auto_alloc(this, memory_region(*this, name, length, width, endian))); + return &m_regionlist.append(name, *auto_alloc(*this, memory_region(*this, name, length, width, endian))); } @@ -651,7 +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!"); - m_logerror_list.append(*auto_alloc(this, logerror_callback_item(callback))); + m_logerror_list.append(*auto_alloc(*this, logerror_callback_item(callback))); } @@ -877,7 +877,7 @@ memory_region::memory_region(running_machine &machine, const char *name, UINT32 m_endianness(endian) { assert(width == 1 || width == 2 || width == 4 || width == 8); - m_base.u8 = auto_alloc_array(&machine, UINT8, length); + m_base.u8 = auto_alloc_array(machine, UINT8, length); } @@ -887,7 +887,7 @@ memory_region::memory_region(running_machine &machine, const char *name, UINT32 memory_region::~memory_region() { - auto_free(&m_machine, m_base.v); + auto_free(m_machine, m_base.v); } @@ -1026,7 +1026,7 @@ void driver_device::driver_start() void driver_device::machine_start() { if (m_config.m_callbacks[driver_device_config_base::CB_MACHINE_START] != NULL) - (*m_config.m_callbacks[driver_device_config_base::CB_MACHINE_START])(&m_machine); + (*m_config.m_callbacks[driver_device_config_base::CB_MACHINE_START])(m_machine); } @@ -1038,7 +1038,7 @@ void driver_device::machine_start() void driver_device::sound_start() { if (m_config.m_callbacks[driver_device_config_base::CB_SOUND_START] != NULL) - (*m_config.m_callbacks[driver_device_config_base::CB_SOUND_START])(&m_machine); + (*m_config.m_callbacks[driver_device_config_base::CB_SOUND_START])(m_machine); } @@ -1050,7 +1050,7 @@ void driver_device::sound_start() void driver_device::video_start() { if (m_config.m_callbacks[driver_device_config_base::CB_VIDEO_START] != NULL) - (*m_config.m_callbacks[driver_device_config_base::CB_VIDEO_START])(&m_machine); + (*m_config.m_callbacks[driver_device_config_base::CB_VIDEO_START])(m_machine); } @@ -1072,7 +1072,7 @@ void driver_device::driver_reset() void driver_device::machine_reset() { if (m_config.m_callbacks[driver_device_config_base::CB_MACHINE_RESET] != NULL) - (*m_config.m_callbacks[driver_device_config_base::CB_MACHINE_RESET])(&m_machine); + (*m_config.m_callbacks[driver_device_config_base::CB_MACHINE_RESET])(m_machine); } @@ -1084,7 +1084,7 @@ void driver_device::machine_reset() void driver_device::sound_reset() { if (m_config.m_callbacks[driver_device_config_base::CB_SOUND_RESET] != NULL) - (*m_config.m_callbacks[driver_device_config_base::CB_SOUND_RESET])(&m_machine); + (*m_config.m_callbacks[driver_device_config_base::CB_SOUND_RESET])(m_machine); } @@ -1096,7 +1096,7 @@ void driver_device::sound_reset() void driver_device::video_reset() { if (m_config.m_callbacks[driver_device_config_base::CB_VIDEO_RESET] != NULL) - (*m_config.m_callbacks[driver_device_config_base::CB_VIDEO_RESET])(&m_machine); + (*m_config.m_callbacks[driver_device_config_base::CB_VIDEO_RESET])(m_machine); } @@ -1134,14 +1134,14 @@ void driver_device::device_start() // call the game-specific init if (m_config.m_system->driver_init != NULL) - (*m_config.m_system->driver_init)(&m_machine); + (*m_config.m_system->driver_init)(m_machine); // finish image devices init process - image_postdevice_init(&m_machine); + image_postdevice_init(m_machine); // call palette_init if present if (m_config.m_palette_init != NULL) - (*m_config.m_palette_init)(&m_machine, machine->region("proms")->base()); + (*m_config.m_palette_init)(m_machine, m_machine.region("proms")->base()); // start the various pieces driver_start(); diff --git a/src/emu/machine.h b/src/emu/machine.h index 775b416cf85..6caff360b51 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -112,31 +112,31 @@ const int DEBUG_FLAG_OSD_ENABLED = 0x00001000; // The OSD debugger is enabled // macros to wrap legacy callbacks #define MACHINE_START_NAME(name) machine_start_##name -#define MACHINE_START(name) void MACHINE_START_NAME(name)(running_machine *machine) +#define MACHINE_START(name) void MACHINE_START_NAME(name)(running_machine &machine) #define MACHINE_START_CALL(name) MACHINE_START_NAME(name)(machine) #define MACHINE_RESET_NAME(name) machine_reset_##name -#define MACHINE_RESET(name) void MACHINE_RESET_NAME(name)(running_machine *machine) +#define MACHINE_RESET(name) void MACHINE_RESET_NAME(name)(running_machine &machine) #define MACHINE_RESET_CALL(name) MACHINE_RESET_NAME(name)(machine) #define SOUND_START_NAME(name) sound_start_##name -#define SOUND_START(name) void SOUND_START_NAME(name)(running_machine *machine) +#define SOUND_START(name) void SOUND_START_NAME(name)(running_machine &machine) #define SOUND_START_CALL(name) SOUND_START_NAME(name)(machine) #define SOUND_RESET_NAME(name) sound_reset_##name -#define SOUND_RESET(name) void SOUND_RESET_NAME(name)(running_machine *machine) +#define SOUND_RESET(name) void SOUND_RESET_NAME(name)(running_machine &machine) #define SOUND_RESET_CALL(name) SOUND_RESET_NAME(name)(machine) #define VIDEO_START_NAME(name) video_start_##name -#define VIDEO_START(name) void VIDEO_START_NAME(name)(running_machine *machine) +#define VIDEO_START(name) void VIDEO_START_NAME(name)(running_machine &machine) #define VIDEO_START_CALL(name) VIDEO_START_NAME(name)(machine) #define VIDEO_RESET_NAME(name) video_reset_##name -#define VIDEO_RESET(name) void VIDEO_RESET_NAME(name)(running_machine *machine) +#define VIDEO_RESET(name) void VIDEO_RESET_NAME(name)(running_machine &machine) #define VIDEO_RESET_CALL(name) VIDEO_RESET_NAME(name)(machine) #define PALETTE_INIT_NAME(name) palette_init_##name -#define PALETTE_INIT(name) void PALETTE_INIT_NAME(name)(running_machine *machine, const UINT8 *color_prom) +#define PALETTE_INIT(name) void PALETTE_INIT_NAME(name)(running_machine &machine, const UINT8 *color_prom) #define PALETTE_INIT_CALL(name) PALETTE_INIT_NAME(name)(machine, color_prom) @@ -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)->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_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) @@ -197,8 +197,8 @@ typedef tagged_list<memory_region> region_list; // legacy callback functions -typedef void (*legacy_callback_func)(running_machine *machine); -typedef void (*palette_init_func)(running_machine *machine, const UINT8 *color_prom); +typedef void (*legacy_callback_func)(running_machine &machine); +typedef void (*palette_init_func)(running_machine &machine, const UINT8 *color_prom); @@ -315,7 +315,7 @@ class running_machine : public bindable_object { DISABLE_COPYING(running_machine); - friend void debugger_init(running_machine *machine); + friend void debugger_init(running_machine &machine); friend class sound_manager; typedef void (*notify_callback)(running_machine &machine); @@ -596,7 +596,7 @@ public: { // we clear here for historical reasons, as many existing driver states // assume everything is NULL before starting - return auto_alloc_clear(&machine, _DeviceClass(machine, *this)); + return auto_alloc_clear(machine, _DeviceClass(machine, *this)); } }; diff --git a/src/emu/machine/53c810.c b/src/emu/machine/53c810.c index 2dcc0f938eb..caaf32460b5 100644 --- a/src/emu/machine/53c810.c +++ b/src/emu/machine/53c810.c @@ -42,15 +42,15 @@ static struct { int halted; int carry; UINT32 (* fetch)(UINT32 dsp); - void (* irq_callback)(running_machine *machine); + void (* irq_callback)(running_machine &machine); void (* dma_callback)(UINT32, UINT32, int, int); } lsi810; -typedef void (*opcode_handler)(running_machine *machine); -#define OPCODE_HANDLER(name) void name(running_machine *machine) +typedef void (*opcode_handler)(running_machine &machine); +#define OPCODE_HANDLER(name) void name(running_machine &machine) static opcode_handler dma_opcode[256]; -INLINE UINT32 FETCH(running_machine *machine) +INLINE UINT32 FETCH(running_machine &machine) { UINT32 r = intf->fetch(machine, lsi810.dsp); lsi810.dsp += 4; @@ -340,7 +340,7 @@ static int scripts_compute_branch(void) return passed; } -static UINT32 scripts_get_jump_dest(running_machine *machine) +static UINT32 scripts_get_jump_dest(running_machine &machine) { INT32 dsps; UINT32 dest; @@ -421,7 +421,7 @@ static OPCODE_HANDLER( dmaop_load ) -static void dma_exec(running_machine *machine) +static void dma_exec(running_machine &machine) { lsi810.dma_icount = DMA_MAX_ICOUNT; @@ -484,7 +484,7 @@ READ8_HANDLER( lsi53c810_reg_r ) // clear the interrupt on service if(intf->irq_callback != NULL) { - intf->irq_callback(space->machine, 0); + intf->irq_callback(space->machine(), 0); } return lsi810.istat; @@ -599,7 +599,7 @@ WRITE8_HANDLER( lsi53c810_reg_w ) lsi810.dsp |= data << 24; lsi810.halted = 0; if((lsi810.dmode & 0x1) == 0 && !lsi810.halted) { - dma_exec(space->machine); + dma_exec(space->machine()); } break; case 0x34: /* SCRATCH A */ @@ -620,19 +620,19 @@ WRITE8_HANDLER( lsi53c810_reg_w ) if(lsi810.dcntl & 0x14 && !lsi810.halted) /* single-step & start DMA */ { int op; - lsi810.dcmd = FETCH(space->machine); + lsi810.dcmd = FETCH(space->machine()); op = (lsi810.dcmd >> 24) & 0xff; - dma_opcode[op](space->machine); + dma_opcode[op](space->machine()); lsi810.istat |= 0x3; /* DMA interrupt pending */ lsi810.dstat |= 0x8; /* SSI (Single Step Interrupt) */ if(intf->irq_callback != NULL) { - intf->irq_callback(space->machine, 1); + intf->irq_callback(space->machine(), 1); } } else if(lsi810.dcntl & 0x04 && !lsi810.halted) /* manual start DMA */ { - dma_exec(space->machine); + dma_exec(space->machine()); } break; case 0x40: /* SIEN0 */ @@ -672,7 +672,7 @@ static void add_opcode(UINT8 op, UINT8 mask, opcode_handler handler) } } -void lsi53c810_init(running_machine *machine, const struct LSI53C810interface *interface) +void lsi53c810_init(running_machine &machine, const struct LSI53C810interface *interface) { int i; @@ -766,12 +766,12 @@ void *lsi53c810_get_device(int id) * *************************************/ -static UINT32 lsi53c810_dasm_fetch(running_machine *machine, UINT32 pc) +static UINT32 lsi53c810_dasm_fetch(running_machine &machine, UINT32 pc) { return intf->fetch(machine, pc); } -unsigned lsi53c810_dasm(running_machine *machine, char *buf, UINT32 pc) +unsigned lsi53c810_dasm(running_machine &machine, char *buf, UINT32 pc) { unsigned result = 0; const char *op_mnemonic = NULL; diff --git a/src/emu/machine/53c810.h b/src/emu/machine/53c810.h index 1d3b80772b3..3c49d8d0f15 100644 --- a/src/emu/machine/53c810.h +++ b/src/emu/machine/53c810.h @@ -6,12 +6,12 @@ struct LSI53C810interface { const SCSIConfigTable *scsidevs; /* SCSI devices */ - void (*irq_callback)(running_machine *machine, int); /* IRQ callback */ - void (*dma_callback)(running_machine *machine, UINT32, UINT32, int, int); /* DMA callback */ - UINT32 (*fetch)(running_machine *machine, UINT32 dsp); + void (*irq_callback)(running_machine &machine, int); /* IRQ callback */ + void (*dma_callback)(running_machine &machine, UINT32, UINT32, int, int); /* DMA callback */ + UINT32 (*fetch)(running_machine &machine, UINT32 dsp); }; -extern void lsi53c810_init(running_machine *machine, const struct LSI53C810interface *interface); +extern void lsi53c810_init(running_machine &machine, const struct LSI53C810interface *interface); extern void lsi53c810_exit(const struct LSI53C810interface *interface); extern void lsi53c810_read_data(int bytes, UINT8 *pData); @@ -22,6 +22,6 @@ extern void *lsi53c810_get_device(int id); READ8_HANDLER( lsi53c810_reg_r ); WRITE8_HANDLER( lsi53c810_reg_w ); -unsigned lsi53c810_dasm(running_machine *machine, char *buf, UINT32 pc); +unsigned lsi53c810_dasm(running_machine &machine, char *buf, UINT32 pc); #endif diff --git a/src/emu/machine/6526cia.c b/src/emu/machine/6526cia.c index a90652efded..00d74718e59 100644 --- a/src/emu/machine/6526cia.c +++ b/src/emu/machine/6526cia.c @@ -72,7 +72,7 @@ device_config *mos6526_device_config::static_alloc_device_config(const machine_c device_t *mos6526_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, mos6526_device(machine, *this)); + return auto_alloc(machine, mos6526_device(machine, *this)); } diff --git a/src/emu/machine/6532riot.c b/src/emu/machine/6532riot.c index 63437a2dfa5..426277e8e06 100644 --- a/src/emu/machine/6532riot.c +++ b/src/emu/machine/6532riot.c @@ -70,7 +70,7 @@ device_config *riot6532_device_config::static_alloc_device_config(const machine_ device_t *riot6532_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, riot6532_device(machine, *this)); + return auto_alloc(machine, riot6532_device(machine, *this)); } diff --git a/src/emu/machine/6821pia.c b/src/emu/machine/6821pia.c index 03afe7986c2..94181f76459 100644 --- a/src/emu/machine/6821pia.c +++ b/src/emu/machine/6821pia.c @@ -66,7 +66,7 @@ device_config *pia6821_device_config::static_alloc_device_config(const machine_c device_t *pia6821_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, pia6821_device(machine, *this)); + return auto_alloc(machine, pia6821_device(machine, *this)); } diff --git a/src/emu/machine/68681.c b/src/emu/machine/68681.c index f12b48dc192..a053f1e432c 100644 --- a/src/emu/machine/68681.c +++ b/src/emu/machine/68681.c @@ -541,14 +541,14 @@ READ8_DEVICE_HANDLER(duart68681_r) { r = 0xff; #if 0 - if (input_code_pressed(device->machine, KEYCODE_1)) r ^= 0x0001; - if (input_code_pressed(device->machine, KEYCODE_2)) r ^= 0x0002; - if (input_code_pressed(device->machine, KEYCODE_3)) r ^= 0x0004; - if (input_code_pressed(device->machine, KEYCODE_4)) r ^= 0x0008; - if (input_code_pressed(device->machine, KEYCODE_5)) r ^= 0x0010; - if (input_code_pressed(device->machine, KEYCODE_6)) r ^= 0x0020; - if (input_code_pressed(device->machine, KEYCODE_7)) r ^= 0x0040; - if (input_code_pressed(device->machine, KEYCODE_8)) r ^= 0x0080; + if (input_code_pressed(device->machine(), KEYCODE_1)) r ^= 0x0001; + if (input_code_pressed(device->machine(), KEYCODE_2)) r ^= 0x0002; + if (input_code_pressed(device->machine(), KEYCODE_3)) r ^= 0x0004; + if (input_code_pressed(device->machine(), KEYCODE_4)) r ^= 0x0008; + if (input_code_pressed(device->machine(), KEYCODE_5)) r ^= 0x0010; + if (input_code_pressed(device->machine(), KEYCODE_6)) r ^= 0x0020; + if (input_code_pressed(device->machine(), KEYCODE_7)) r ^= 0x0040; + if (input_code_pressed(device->machine(), KEYCODE_8)) r ^= 0x0080; #endif } break; @@ -710,9 +710,9 @@ static DEVICE_START(duart68681) duart68681->duart_config = (const duart68681_config *)device->baseconfig().static_config(); duart68681->device = device; - duart68681->channel[0].tx_timer = device->machine->scheduler().timer_alloc(FUNC(tx_timer_callback), (void*)device); - duart68681->channel[1].tx_timer = device->machine->scheduler().timer_alloc(FUNC(tx_timer_callback), (void*)device); - duart68681->duart_timer = device->machine->scheduler().timer_alloc(FUNC(duart_timer_callback), (void*)device); + duart68681->channel[0].tx_timer = device->machine().scheduler().timer_alloc(FUNC(tx_timer_callback), (void*)device); + duart68681->channel[1].tx_timer = device->machine().scheduler().timer_alloc(FUNC(tx_timer_callback), (void*)device); + duart68681->duart_timer = device->machine().scheduler().timer_alloc(FUNC(duart_timer_callback), (void*)device); device->save_item(NAME(duart68681->ACR)); device->save_item(NAME(duart68681->IMR)); diff --git a/src/emu/machine/74123.c b/src/emu/machine/74123.c index 2ab8ff8619f..8a6338d7149 100644 --- a/src/emu/machine/74123.c +++ b/src/emu/machine/74123.c @@ -52,7 +52,7 @@ device_config *ttl74123_device_config::static_alloc_device_config(const machine_ device_t *ttl74123_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, ttl74123_device(machine, *this)); + return auto_alloc(machine, ttl74123_device(machine, *this)); } diff --git a/src/emu/machine/74181.c b/src/emu/machine/74181.c index 03c2478e490..dca07ad01fe 100644 --- a/src/emu/machine/74181.c +++ b/src/emu/machine/74181.c @@ -27,11 +27,11 @@ struct _TTL74181_state static TTL74181_state chips[TTL74181_MAX_CHIPS]; -void TTL74181_config(running_machine *machine, int which, void *intf) +void TTL74181_config(running_machine &machine, int which, void *intf) { TTL74181_state *c; - assert_always(machine->phase() == MACHINE_PHASE_INIT, "Can only call at init time!"); + assert_always(machine.phase() == MACHINE_PHASE_INIT, "Can only call at init time!"); assert_always(intf == 0, "Interface must be NULL"); assert_always((which >= 0) && (which < TTL74181_MAX_CHIPS), "Exceeded maximum number of 74181 chips"); diff --git a/src/emu/machine/74181.h b/src/emu/machine/74181.h index e4f23dcd16e..5d15bdac9cf 100644 --- a/src/emu/machine/74181.h +++ b/src/emu/machine/74181.h @@ -33,7 +33,7 @@ #define TTL74181_OUTPUT_CN4 (7) -void TTL74181_config(running_machine *machine, int chip, void *interface); +void TTL74181_config(running_machine &machine, int chip, void *interface); void TTL74181_reset(int chip); void TTL74181_write(int chip, int startline, int lines, UINT8 data); diff --git a/src/emu/machine/7474.c b/src/emu/machine/7474.c index 5e537210d89..3b92dab2463 100644 --- a/src/emu/machine/7474.c +++ b/src/emu/machine/7474.c @@ -80,7 +80,7 @@ device_config *ttl7474_device_config::static_alloc_device_config(const machine_c device_t *ttl7474_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, ttl7474_device(machine, *this)); + return auto_alloc(machine, ttl7474_device(machine, *this)); } diff --git a/src/emu/machine/8042kbdc.c b/src/emu/machine/8042kbdc.c index 2bf3b3a8dfe..8d45e2005a8 100644 --- a/src/emu/machine/8042kbdc.c +++ b/src/emu/machine/8042kbdc.c @@ -204,9 +204,9 @@ static struct { kbdc8042_type_t type; - void (*set_gate_a20)(running_machine *machine, int a20); - void (*keyboard_interrupt)(running_machine *machine, int state); - int (*get_out2)(running_machine *machine); + void (*set_gate_a20)(running_machine &machine, int a20); + void (*keyboard_interrupt)(running_machine &machine, int state); + int (*get_out2)(running_machine &machine); UINT8 inport, outport, data, command; @@ -234,7 +234,7 @@ static struct static int poll_delay; -static void at_8042_check_keyboard(running_machine *machine); +static void at_8042_check_keyboard(running_machine &machine); @@ -244,7 +244,7 @@ static void at_8042_check_keyboard(running_machine *machine); ***************************************************************************/ -static void at_8042_set_outport(running_machine *machine, UINT8 data, int initial) +static void at_8042_set_outport(running_machine &machine, UINT8 data, int initial) { UINT8 change; change = initial ? 0xFF : (kbdc8042.outport ^ data); @@ -266,7 +266,7 @@ static TIMER_CALLBACK( kbdc8042_time ) -void kbdc8042_init(running_machine *machine, const struct kbdc8042_interface *intf) +void kbdc8042_init(running_machine &machine, const struct kbdc8042_interface *intf) { poll_delay = 10; memset(&kbdc8042, 0, sizeof(kbdc8042)); @@ -279,10 +279,10 @@ void kbdc8042_init(running_machine *machine, const struct kbdc8042_interface *in kbdc8042.inport = 0xa0; at_8042_set_outport(machine, 0xfe, 1); - machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(kbdc8042_time)); + machine.scheduler().timer_pulse(attotime::from_hz(60), FUNC(kbdc8042_time)); } -static void at_8042_receive(running_machine *machine, UINT8 data) +static void at_8042_receive(running_machine &machine, UINT8 data) { if (LOG_KEYBOARD) logerror("at_8042_receive Received 0x%02x\n", data); @@ -297,7 +297,7 @@ static void at_8042_receive(running_machine *machine, UINT8 data) } } -static void at_8042_check_keyboard(running_machine *machine) +static void at_8042_check_keyboard(running_machine &machine) { int data; @@ -360,7 +360,7 @@ READ8_HANDLER(kbdc8042_8_r) /* at386 self test doesn't like this */ at_8042_clear_keyboard_received(); } - at_8042_check_keyboard(space->machine); + at_8042_check_keyboard(space->machine()); break; case 1: @@ -388,14 +388,14 @@ READ8_HANDLER(kbdc8042_8_r) break; case 2: - if (kbdc8042.get_out2(space->machine)) + if (kbdc8042.get_out2(space->machine())) data |= 0x20; else data &= ~0x20; break; case 4: - at_8042_check_keyboard(space->machine); + at_8042_check_keyboard(space->machine()); if (kbdc8042.keyboard.received || kbdc8042.mouse.received) data |= 1; @@ -441,7 +441,7 @@ WRITE8_HANDLER(kbdc8042_8_w) /* normal case */ kbdc8042.data = data; kbdc8042.sending=1; - at_keyboard_write(space->machine, data); + at_keyboard_write(space->machine(), data); break; case 1: @@ -455,14 +455,14 @@ WRITE8_HANDLER(kbdc8042_8_w) * | `----------- keyboard clock (output) * `------------ keyboard data (output) */ - at_8042_set_outport(space->machine, data, 0); + at_8042_set_outport(space->machine(), data, 0); break; case 2: /* preceeded by writing 0xD2 to port 60h */ kbdc8042.data = data; kbdc8042.sending=1; - at_keyboard_write(space->machine, data); + at_keyboard_write(space->machine(), data); break; case 3: @@ -506,13 +506,13 @@ WRITE8_HANDLER(kbdc8042_8_w) kbdc8042.mouse.on = 1; break; case 0xa9: /* test mouse */ - at_8042_receive(space->machine, PS2_MOUSE_ON ? 0x00 : 0xff); + at_8042_receive(space->machine(), PS2_MOUSE_ON ? 0x00 : 0xff); break; case 0xaa: /* selftest */ - at_8042_receive(space->machine, 0x55); + at_8042_receive(space->machine(), 0x55); break; case 0xab: /* test keyboard */ - at_8042_receive(space->machine, KEYBOARD_ON ? 0x00 : 0xff); + at_8042_receive(space->machine(), KEYBOARD_ON ? 0x00 : 0xff); break; case 0xad: /* disable keyboard interface */ kbdc8042.keyboard.on = 0; @@ -530,7 +530,7 @@ WRITE8_HANDLER(kbdc8042_8_w) * | `----------- 1=primary display is MDA, 0=CGA * `------------ 1=keyboard not inhibited; 0=inhibited */ - at_8042_receive(space->machine, kbdc8042.inport); + at_8042_receive(space->machine(), kbdc8042.inport); break; case 0xc1: /* read input port 3..0 until write to 0x60 */ kbdc8042.status_read_mode = 1; @@ -539,7 +539,7 @@ WRITE8_HANDLER(kbdc8042_8_w) kbdc8042.status_read_mode = 2; break; case 0xd0: /* read output port */ - at_8042_receive(space->machine, kbdc8042.outport); + at_8042_receive(space->machine(), kbdc8042.outport); break; case 0xd1: /* write output port; next byte written to port 60h is placed on @@ -568,7 +568,7 @@ WRITE8_HANDLER(kbdc8042_8_w) break; case 0xe0: /* read test inputs; read T1/T0 test inputs into bit 1/0 */ - at_8042_receive(space->machine, 0x00); + at_8042_receive(space->machine(), 0x00); break; case 0xf0: @@ -584,8 +584,8 @@ WRITE8_HANDLER(kbdc8042_8_w) * the bits low set in the command byte. The only pulse that has * an effect currently is bit 0, which pulses the CPU's reset line */ - device_set_input_line(space->machine->firstcpu, INPUT_LINE_RESET, PULSE_LINE); - at_8042_set_outport(space->machine, kbdc8042.outport | 0x02, 0); + device_set_input_line(space->machine().firstcpu, INPUT_LINE_RESET, PULSE_LINE); + at_8042_set_outport(space->machine(), kbdc8042.outport | 0x02, 0); break; } kbdc8042.sending = 1; diff --git a/src/emu/machine/8042kbdc.h b/src/emu/machine/8042kbdc.h index f6ec7b4c44c..35dc301d570 100644 --- a/src/emu/machine/8042kbdc.h +++ b/src/emu/machine/8042kbdc.h @@ -21,14 +21,14 @@ typedef enum struct kbdc8042_interface { kbdc8042_type_t type; - void (*set_gate_a20)(running_machine *machine, int a20); - void (*keyboard_interrupt)(running_machine *machine, int state); - int (*get_out2)(running_machine *machine); + void (*set_gate_a20)(running_machine &machine, int a20); + void (*keyboard_interrupt)(running_machine &machine, int state); + int (*get_out2)(running_machine &machine); }; -void kbdc8042_init(running_machine *machine, const struct kbdc8042_interface *intf); +void kbdc8042_init(running_machine &machine, const struct kbdc8042_interface *intf); READ8_HANDLER(kbdc8042_8_r); WRITE8_HANDLER(kbdc8042_8_w); diff --git a/src/emu/machine/adc083x.c b/src/emu/machine/adc083x.c index 06ad3b4a3fc..6e14a262e32 100644 --- a/src/emu/machine/adc083x.c +++ b/src/emu/machine/adc083x.c @@ -11,7 +11,7 @@ #define VERBOSE_LEVEL ( 0 ) -INLINE void ATTR_PRINTF( 3, 4 ) verboselog( int n_level, running_machine *machine, const char *s_fmt, ... ) +INLINE void ATTR_PRINTF( 3, 4 ) verboselog( int n_level, running_machine &machine, const char *s_fmt, ... ) { if( VERBOSE_LEVEL >= n_level ) { @@ -20,7 +20,7 @@ INLINE void ATTR_PRINTF( 3, 4 ) verboselog( int n_level, running_machine *machin va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%s: %s", machine ->describe_context( ), buf ); + logerror( "%s: %s", machine.describe_context( ), buf ); } } @@ -116,7 +116,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_cs_write ) if( adc083x->cs != state ) { - verboselog( 2, device->machine, "adc083x_cs_write( %s, %d )\n", device->tag(), state ); + verboselog( 2, device->machine(), "adc083x_cs_write( %s, %d )\n", device->tag(), state ); } if( adc083x->cs == 0 && state != 0 ) @@ -234,7 +234,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_clk_write ) if( adc083x->clk != state ) { - verboselog( 2, device->machine, "adc083x_clk_write( %s, %d )\n", device->tag(), state ); + verboselog( 2, device->machine(), "adc083x_clk_write( %s, %d )\n", device->tag(), state ); } if( adc083x->cs == 0 ) @@ -246,7 +246,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_clk_write ) case STATE_WAIT_FOR_START: if( adc083x->di != 0 ) { - verboselog( 1, device->machine, "adc083x %s got start bit\n", device->tag() ); + verboselog( 1, device->machine(), "adc083x %s got start bit\n", device->tag() ); adc083x->state = STATE_SHIFT_MUX; adc083x->sars = 0; adc083x->sgl = 0; @@ -257,7 +257,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_clk_write ) } else { - verboselog( 1, device->machine, "adc083x %s not start bit\n", device->tag() ); + verboselog( 1, device->machine(), "adc083x %s not start bit\n", device->tag() ); } break; @@ -269,7 +269,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_clk_write ) { adc083x->sgl = 1; } - verboselog( 1, device->machine, "adc083x %s sgl <- %d\n", device->tag(), adc083x->sgl ); + verboselog( 1, device->machine(), "adc083x %s sgl <- %d\n", device->tag(), adc083x->sgl ); break; case 1: @@ -277,7 +277,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_clk_write ) { adc083x->odd = 1; } - verboselog( 1, device->machine, "adc083x %s odd <- %d\n", device->tag(), adc083x->odd ); + verboselog( 1, device->machine(), "adc083x %s odd <- %d\n", device->tag(), adc083x->odd ); break; case 2: @@ -285,7 +285,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_clk_write ) { adc083x->sel1 = 1; } - verboselog( 1, device->machine, "adc083x %s sel1 <- %d\n", device->tag(), adc083x->sel1 ); + verboselog( 1, device->machine(), "adc083x %s sel1 <- %d\n", device->tag(), adc083x->sel1 ); break; case 3: @@ -293,7 +293,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_clk_write ) { adc083x->sel0 = 1; } - verboselog( 1, device->machine, "adc083x %s sel0 <- %d\n", device->tag(), adc083x->sel0 ); + verboselog( 1, device->machine(), "adc083x %s sel0 <- %d\n", device->tag(), adc083x->sel0 ); break; } @@ -309,11 +309,11 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_clk_write ) adc083x->sars = 0; if( device->type() == ADC0838 && adc083x->se != 0 ) { - verboselog( 1, device->machine, "adc083x %s not se\n", device->tag() ); + verboselog( 1, device->machine(), "adc083x %s not se\n", device->tag() ); } else { - verboselog( 1, device->machine, "adc083x %s got se\n", device->tag() ); + verboselog( 1, device->machine(), "adc083x %s got se\n", device->tag() ); adc083x->state = STATE_OUTPUT_LSB_FIRST; adc083x->bit = 1; } @@ -326,7 +326,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_clk_write ) switch( adc083x->state ) { case STATE_MUX_SETTLE: - verboselog( 1, device->machine, "adc083x %s mux settle\n", device->tag() ); + verboselog( 1, device->machine(), "adc083x %s mux settle\n", device->tag() ); adc083x->output = adc083x_conversion( device ); adc083x->state = STATE_OUTPUT_MSB_FIRST; adc083x->bit = 7; @@ -336,7 +336,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_clk_write ) case STATE_OUTPUT_MSB_FIRST: adc083x->_do = ( adc083x->output >> adc083x->bit ) & 1; - verboselog( 1, device->machine, "adc083x %s msb %d -> %d\n", device->tag(), adc083x->bit, adc083x->_do ); + verboselog( 1, device->machine(), "adc083x %s msb %d -> %d\n", device->tag(), adc083x->bit, adc083x->_do ); adc083x->bit--; if( adc083x->bit < 0 ) @@ -354,7 +354,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_clk_write ) case STATE_OUTPUT_LSB_FIRST: adc083x->_do = ( adc083x->output >> adc083x->bit ) & 1; - verboselog( 1, device->machine, "adc083x %s lsb %d -> %d\n", device->tag(), adc083x->bit, adc083x->_do ); + verboselog( 1, device->machine(), "adc083x %s lsb %d -> %d\n", device->tag(), adc083x->bit, adc083x->_do ); adc083x->bit++; if( adc083x->bit == 8 ) @@ -384,7 +384,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_di_write ) if( adc083x->di != state ) { - verboselog( 2, device->machine, "adc083x_di_write( %s, %d )\n", device->tag(), state ); + verboselog( 2, device->machine(), "adc083x_di_write( %s, %d )\n", device->tag(), state ); } adc083x->di = state; @@ -400,7 +400,7 @@ WRITE_LINE_DEVICE_HANDLER( adc083x_se_write ) if( adc083x->se != state ) { - verboselog( 2, device->machine, "adc083x_se_write( %s, %d )\n", device->tag(), state ); + verboselog( 2, device->machine(), "adc083x_se_write( %s, %d )\n", device->tag(), state ); } adc083x->se = state; @@ -414,7 +414,7 @@ READ_LINE_DEVICE_HANDLER( adc083x_sars_read ) { adc0831_state *adc083x = get_safe_token( device ); - verboselog( 1, device->machine, "adc083x_sars_read( %s ) %d\n", device->tag(), adc083x->sars ); + verboselog( 1, device->machine(), "adc083x_sars_read( %s ) %d\n", device->tag(), adc083x->sars ); return adc083x->sars; } @@ -426,7 +426,7 @@ READ_LINE_DEVICE_HANDLER( adc083x_do_read ) { adc0831_state *adc083x = get_safe_token( device ); - verboselog( 1, device->machine, "adc083x_do_read( %s ) %d\n", device->tag(), adc083x->_do ); + verboselog( 1, device->machine(), "adc083x_do_read( %s ) %d\n", device->tag(), adc083x->_do ); return adc083x->_do; } diff --git a/src/emu/machine/am53cf96.c b/src/emu/machine/am53cf96.c index 1119175f14b..5d02656167f 100644 --- a/src/emu/machine/am53cf96.c +++ b/src/emu/machine/am53cf96.c @@ -159,10 +159,10 @@ WRITE32_HANDLER( am53cf96_w ) case 3: // reset SCSI bus scsi_regs[REG_INTSTATE] = 4; // command sent OK xfer_state = 0; - space->machine->scheduler().timer_set( attotime::from_hz( 16384 ), FUNC(am53cf96_irq )); + space->machine().scheduler().timer_set( attotime::from_hz( 16384 ), FUNC(am53cf96_irq )); break; case 0x42: // select with ATN steps - space->machine->scheduler().timer_set( attotime::from_hz( 16384 ), FUNC(am53cf96_irq )); + space->machine().scheduler().timer_set( attotime::from_hz( 16384 ), FUNC(am53cf96_irq )); if ((fifo[1] == 0) || (fifo[1] == 0x48) || (fifo[1] == 0x4b)) { scsi_regs[REG_INTSTATE] = 6; @@ -192,7 +192,7 @@ WRITE32_HANDLER( am53cf96_w ) case 0x10: // information transfer (must not change xfer_state) case 0x11: // second phase of information transfer case 0x12: // message accepted - space->machine->scheduler().timer_set( attotime::from_hz( 16384 ), FUNC(am53cf96_irq )); + space->machine().scheduler().timer_set( attotime::from_hz( 16384 ), FUNC(am53cf96_irq )); scsi_regs[REG_INTSTATE] = 6; // command sent OK break; default: @@ -208,7 +208,7 @@ WRITE32_HANDLER( am53cf96_w ) } } -void am53cf96_init( running_machine *machine, const struct AM53CF96interface *interface ) +void am53cf96_init( running_machine &machine, const struct AM53CF96interface *interface ) { int i; diff --git a/src/emu/machine/am53cf96.h b/src/emu/machine/am53cf96.h index 1eeb728bb63..df74b4a80aa 100644 --- a/src/emu/machine/am53cf96.h +++ b/src/emu/machine/am53cf96.h @@ -11,10 +11,10 @@ struct AM53CF96interface { const SCSIConfigTable *scsidevs; /* SCSI devices */ - void (*irq_callback)(running_machine *machine); /* irq callback */ + void (*irq_callback)(running_machine &machine); /* irq callback */ }; -extern void am53cf96_init( running_machine *machine, const struct AM53CF96interface *interface ); +extern void am53cf96_init( running_machine &machine, const struct AM53CF96interface *interface ); extern void am53cf96_exit( const struct AM53CF96interface *interface ); extern void am53cf96_read_data(int bytes, UINT8 *pData); void am53cf96_write_data(int bytes, UINT8 *pData); diff --git a/src/emu/machine/at28c16.c b/src/emu/machine/at28c16.c index f7418af244d..ff7bc172ddc 100644 --- a/src/emu/machine/at28c16.c +++ b/src/emu/machine/at28c16.c @@ -63,7 +63,7 @@ device_config *at28c16_device_config::static_alloc_device_config( const machine_ device_t *at28c16_device_config::alloc_device( running_machine &machine ) const { - return auto_alloc( &machine, at28c16_device( machine, *this ) ); + return auto_alloc( machine, at28c16_device( machine, *this ) ); } @@ -187,7 +187,7 @@ void at28c16_device::nvram_default() void at28c16_device::nvram_read( emu_file &file ) { - UINT8 *buffer = auto_alloc_array( &m_machine, UINT8, AT28C16_TOTAL_BYTES ); + UINT8 *buffer = auto_alloc_array( m_machine, UINT8, AT28C16_TOTAL_BYTES ); file.read( buffer, AT28C16_TOTAL_BYTES ); @@ -196,7 +196,7 @@ void at28c16_device::nvram_read( emu_file &file ) m_addrspace[ 0 ]->write_byte( offs, buffer[ offs ] ); } - auto_free( &m_machine, buffer ); + auto_free( m_machine, buffer ); } //------------------------------------------------- @@ -206,7 +206,7 @@ void at28c16_device::nvram_read( emu_file &file ) void at28c16_device::nvram_write( emu_file &file ) { - UINT8 *buffer = auto_alloc_array( &m_machine, UINT8, AT28C16_TOTAL_BYTES ); + UINT8 *buffer = auto_alloc_array( m_machine, UINT8, AT28C16_TOTAL_BYTES ); for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ ) { @@ -215,7 +215,7 @@ void at28c16_device::nvram_write( emu_file &file ) file.write( buffer, AT28C16_TOTAL_BYTES ); - auto_free( &m_machine, buffer ); + auto_free( m_machine, buffer ); } @@ -233,11 +233,11 @@ void at28c16_device::write( offs_t offset, UINT8 data ) { if( m_last_write >= 0 ) { -// logerror( "%s: AT28C16: write( %04x, %02x ) busy\n", machine->describe_context(), offset, data ); +// logerror( "%s: AT28C16: write( %04x, %02x ) busy\n", machine.describe_context(), offset, data ); } else if( m_oe_12v ) { -// logerror( "%s: AT28C16: write( %04x, %02x ) erase\n", machine->describe_context(), offset, data ); +// logerror( "%s: AT28C16: write( %04x, %02x ) erase\n", machine.describe_context(), offset, data ); if( m_last_write < 0 ) { for( offs_t offs = 0; offs < AT28C16_TOTAL_BYTES; offs++ ) @@ -256,7 +256,7 @@ void at28c16_device::write( offs_t offset, UINT8 data ) offset += AT28C16_ID_BYTES; } -// logerror( "%s: AT28C16: write( %04x, %02x )\n", machine->describe_context(), offset, data ); +// logerror( "%s: AT28C16: write( %04x, %02x )\n", machine.describe_context(), offset, data ); if( m_last_write < 0 && m_addrspace[ 0 ]->read_byte( offset ) != data ) { m_addrspace[ 0 ]->write_byte( offset, data ); @@ -277,7 +277,7 @@ UINT8 at28c16_device::read( offs_t offset ) if( m_last_write >= 0 ) { UINT8 data = m_last_write ^ 0x80; -// logerror( "%s: AT28C16: read( %04x ) write status %02x\n", machine->describe_context(), offset, data ); +// logerror( "%s: AT28C16: read( %04x ) write status %02x\n", machine.describe_context(), offset, data ); return data; } else @@ -288,7 +288,7 @@ UINT8 at28c16_device::read( offs_t offset ) } UINT8 data = m_addrspace[ 0 ]->read_byte( offset ); -// logerror( "%s: AT28C16: read( %04x ) data %02x\n", machine->describe_context(), offset, data ); +// logerror( "%s: AT28C16: read( %04x ) data %02x\n", machine.describe_context(), offset, data ); return data; } } @@ -304,7 +304,7 @@ void at28c16_device::set_a9_12v( int state ) state &= 1; if( m_a9_12v != state ) { -// logerror( "%s: AT28C16: set_a9_12v( %d )\n", machine->describe_context(), state ); +// logerror( "%s: AT28C16: set_a9_12v( %d )\n", machine.describe_context(), state ); m_a9_12v = state; } } @@ -320,7 +320,7 @@ void at28c16_device::set_oe_12v( int state ) state &= 1; if( m_oe_12v != state ) { -// logerror( "%s: AT28C16: set_oe_12v( %d )\n", machine->describe_context(), state ); +// logerror( "%s: AT28C16: set_oe_12v( %d )\n", machine.describe_context(), state ); m_oe_12v = state; } } diff --git a/src/emu/machine/cdp1852.c b/src/emu/machine/cdp1852.c index fe98f13d53b..a5e4ea0783a 100644 --- a/src/emu/machine/cdp1852.c +++ b/src/emu/machine/cdp1852.c @@ -165,7 +165,7 @@ static DEVICE_START( cdp1852 ) if (device->clock() > 0) { /* create the scan timer */ - cdp1852->scan_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1852_scan_tick), (void *)device); + cdp1852->scan_timer = device->machine().scheduler().timer_alloc(FUNC(cdp1852_scan_tick), (void *)device); cdp1852->scan_timer->adjust(attotime::zero, 0, attotime::from_hz(device->clock())); } diff --git a/src/emu/machine/cr589.c b/src/emu/machine/cr589.c index ed4a9ad00f1..1297b3a893a 100644 --- a/src/emu/machine/cr589.c +++ b/src/emu/machine/cr589.c @@ -110,7 +110,7 @@ static void cr589_write_data( SCSIInstance *scsiInstance, UINT8 *data, int dataL static void cr589_alloc_instance( SCSIInstance *scsiInstance, const char *diskregion ) { - running_machine *machine = scsiInstance->machine; + running_machine &machine = scsiInstance->machine(); SCSICr589 *our_this = (SCSICr589 *)SCSIThis( &SCSIClassCr589, scsiInstance ); our_this->download = 0; diff --git a/src/emu/machine/devhelpr.h b/src/emu/machine/devhelpr.h index 8d35dc7a295..97ee11a08d4 100644 --- a/src/emu/machine/devhelpr.h +++ b/src/emu/machine/devhelpr.h @@ -47,7 +47,7 @@ { return global_alloc(devname##_device_config(mconfig, tag, owner, clock)); } \ \ device_t *devname##_device_config::alloc_device(running_machine &machine) const \ - { return auto_alloc(&machine, devname##_device(machine, *this)); } + { return auto_alloc(machine, devname##_device(machine, *this)); } #define GENERIC_DEVICE_DERIVED_CONFIG(basename, devname) \ class devname##_device_config : public basename##_device_config \ diff --git a/src/emu/machine/ds1302.c b/src/emu/machine/ds1302.c index 6b59a0d6a09..63b732d446b 100644 --- a/src/emu/machine/ds1302.c +++ b/src/emu/machine/ds1302.c @@ -70,7 +70,7 @@ device_config *ds1302_device_config::static_alloc_device_config(const machine_co device_t *ds1302_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, ds1302_device(machine, *this)); + return auto_alloc(machine, ds1302_device(machine, *this)); } diff --git a/src/emu/machine/ds2401.c b/src/emu/machine/ds2401.c index 412a78a483e..2902a033c03 100644 --- a/src/emu/machine/ds2401.c +++ b/src/emu/machine/ds2401.c @@ -20,7 +20,7 @@ inline void ATTR_PRINTF(3,4) ds2401_device::verboselog(int n_level, const char * va_start(v, s_fmt); vsprintf(buf, s_fmt, v); va_end(v); - logerror("ds2401 %s %s: %s", config.tag(), machine->describe_context(), buf); + logerror("ds2401 %s %s: %s", config.tag(), m_machine.describe_context(), buf); } } @@ -38,7 +38,7 @@ device_config *ds2401_device_config::static_alloc_device_config(const machine_co device_t *ds2401_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, ds2401_device(machine, *this)); + return auto_alloc(machine, ds2401_device(machine, *this)); } ds2401_device::ds2401_device(running_machine &_machine, const ds2401_device_config &_config) diff --git a/src/emu/machine/ds2404.c b/src/emu/machine/ds2404.c index e834744d557..c16ca1b5ca7 100644 --- a/src/emu/machine/ds2404.c +++ b/src/emu/machine/ds2404.c @@ -47,7 +47,7 @@ device_config *ds2404_device_config::static_alloc_device_config(const machine_co device_t *ds2404_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, ds2404_device(machine, *this)); + return auto_alloc(machine, ds2404_device(machine, *this)); } diff --git a/src/emu/machine/eeprom.c b/src/emu/machine/eeprom.c index 27c95819464..5c5a3bbe9e0 100644 --- a/src/emu/machine/eeprom.c +++ b/src/emu/machine/eeprom.c @@ -104,7 +104,7 @@ device_config *eeprom_device_config::static_alloc_device_config(const machine_co device_t *eeprom_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, eeprom_device(machine, *this)); + return auto_alloc(machine, eeprom_device(machine, *this)); } @@ -302,11 +302,11 @@ void eeprom_device::nvram_read(emu_file &file) UINT32 eeprom_length = 1 << m_config.m_address_bits; UINT32 eeprom_bytes = eeprom_length * m_config.m_data_bits / 8; - UINT8 *buffer = auto_alloc_array(&m_machine, UINT8, eeprom_bytes); + UINT8 *buffer = auto_alloc_array(m_machine, UINT8, eeprom_bytes); file.read(buffer, eeprom_bytes); for (offs_t offs = 0; offs < eeprom_bytes; offs++) m_addrspace[0]->write_byte(offs, buffer[offs]); - auto_free(&m_machine, buffer); + auto_free(m_machine, buffer); } @@ -320,11 +320,11 @@ void eeprom_device::nvram_write(emu_file &file) UINT32 eeprom_length = 1 << m_config.m_address_bits; UINT32 eeprom_bytes = eeprom_length * m_config.m_data_bits / 8; - UINT8 *buffer = auto_alloc_array(&m_machine, UINT8, eeprom_bytes); + UINT8 *buffer = auto_alloc_array(m_machine, UINT8, eeprom_bytes); for (offs_t offs = 0; offs < eeprom_bytes; offs++) buffer[offs] = m_addrspace[0]->read_byte(offs); file.write(buffer, eeprom_bytes); - auto_free(&m_machine, buffer); + auto_free(m_machine, buffer); } diff --git a/src/emu/machine/er2055.c b/src/emu/machine/er2055.c index ff7879a19ff..ddf735fe3a0 100644 --- a/src/emu/machine/er2055.c +++ b/src/emu/machine/er2055.c @@ -87,7 +87,7 @@ device_config *er2055_device_config::static_alloc_device_config(const machine_co device_t *er2055_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, er2055_device(machine, *this)); + return auto_alloc(machine, er2055_device(machine, *this)); } diff --git a/src/emu/machine/f3853.c b/src/emu/machine/f3853.c index 0cb2db9bb20..98040b3fd9d 100644 --- a/src/emu/machine/f3853.c +++ b/src/emu/machine/f3853.c @@ -68,7 +68,7 @@ device_config *f3853_device_config::static_alloc_device_config(const machine_con device_t *f3853_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, f3853_device(machine, *this)); + return auto_alloc(machine, f3853_device(machine, *this)); } diff --git a/src/emu/machine/generic.c b/src/emu/machine/generic.c index 8d595230f07..c7a5a4a0c0e 100644 --- a/src/emu/machine/generic.c +++ b/src/emu/machine/generic.c @@ -19,8 +19,8 @@ FUNCTION PROTOTYPES ***************************************************************************/ -static void counters_load(running_machine *machine, int config_type, xml_data_node *parentnode); -static void counters_save(running_machine *machine, int config_type, xml_data_node *parentnode); +static void counters_load(running_machine &machine, int config_type, xml_data_node *parentnode); +static void counters_save(running_machine &machine, int config_type, xml_data_node *parentnode); static void interrupt_reset(running_machine &machine); @@ -58,7 +58,7 @@ struct _generic_machine_private INLINE int interrupt_enabled(device_t *device) { - generic_machine_private *state = device->machine->generic_machine_data; + generic_machine_private *state = device->machine().generic_machine_data; for (int index = 0; index < ARRAY_LENGTH(state->interrupt_device); index++) if (state->interrupt_device[index] == device) return state->interrupt_enable[index]; @@ -76,14 +76,14 @@ INLINE int interrupt_enabled(device_t *device) register for save states -------------------------------------------------*/ -void generic_machine_init(running_machine *machine) +void generic_machine_init(running_machine &machine) { generic_machine_private *state; int counternum; /* allocate our state */ - machine->generic_machine_data = auto_alloc_clear(machine, generic_machine_private); - state = machine->generic_machine_data; + machine.generic_machine_data = auto_alloc_clear(machine, generic_machine_private); + state = machine.generic_machine_data; /* reset coin counters */ for (counternum = 0; counternum < COIN_COUNTERS; counternum++) @@ -96,29 +96,29 @@ void generic_machine_init(running_machine *machine) memset(state->interrupt_device, 0, sizeof(state->interrupt_device)); device_execute_interface *exec = NULL; int index = 0; - for (bool gotone = machine->m_devicelist.first(exec); gotone && index < ARRAY_LENGTH(state->interrupt_device); gotone = exec->next(exec)) + for (bool gotone = machine.m_devicelist.first(exec); gotone && index < ARRAY_LENGTH(state->interrupt_device); gotone = exec->next(exec)) state->interrupt_device[index++] = &exec->device(); /* register coin save state */ - machine->state().save_item(NAME(state->coin_count)); - machine->state().save_item(NAME(state->coinlockedout)); - machine->state().save_item(NAME(state->lastcoin)); + machine.state().save_item(NAME(state->coin_count)); + machine.state().save_item(NAME(state->coinlockedout)); + machine.state().save_item(NAME(state->lastcoin)); /* reset memory card info */ state->memcard_inserted = -1; /* register a reset callback and save state for interrupt enable */ - machine->add_notifier(MACHINE_NOTIFY_RESET, interrupt_reset); - machine->state().save_item(NAME(state->interrupt_enable)); + machine.add_notifier(MACHINE_NOTIFY_RESET, interrupt_reset); + machine.state().save_item(NAME(state->interrupt_enable)); /* register for configuration */ 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); + machine.add_notifier(MACHINE_NOTIFY_EXIT, memcard_eject); } } @@ -133,9 +133,9 @@ void generic_machine_init(running_machine *machine) tickets dispensed -------------------------------------------------*/ -int get_dispensed_tickets(running_machine *machine) +int get_dispensed_tickets(running_machine &machine) { - generic_machine_private *state = machine->generic_machine_data; + generic_machine_private *state = machine.generic_machine_data; return state->dispensed_tickets; } @@ -145,9 +145,9 @@ int get_dispensed_tickets(running_machine *machine) number of dispensed tickets -------------------------------------------------*/ -void increment_dispensed_tickets(running_machine *machine, int delta) +void increment_dispensed_tickets(running_machine &machine, int delta) { - generic_machine_private *state = machine->generic_machine_data; + generic_machine_private *state = machine.generic_machine_data; state->dispensed_tickets += delta; } @@ -162,9 +162,9 @@ void increment_dispensed_tickets(running_machine *machine, int delta) and tickets -------------------------------------------------*/ -static void counters_load(running_machine *machine, int config_type, xml_data_node *parentnode) +static void counters_load(running_machine &machine, int config_type, xml_data_node *parentnode) { - generic_machine_private *state = machine->generic_machine_data; + generic_machine_private *state = machine.generic_machine_data; xml_data_node *coinnode, *ticketnode; /* on init, reset the counters */ @@ -202,9 +202,9 @@ static void counters_load(running_machine *machine, int config_type, xml_data_no and tickets -------------------------------------------------*/ -static void counters_save(running_machine *machine, int config_type, xml_data_node *parentnode) +static void counters_save(running_machine &machine, int config_type, xml_data_node *parentnode) { - generic_machine_private *state = machine->generic_machine_data; + generic_machine_private *state = machine.generic_machine_data; int i; /* only care about game-specific data */ @@ -237,9 +237,9 @@ static void counters_save(running_machine *machine, int config_type, xml_data_no coin_counter_w - sets input for coin counter -------------------------------------------------*/ -void coin_counter_w(running_machine *machine, int num, int on) +void coin_counter_w(running_machine &machine, int num, int on) { - generic_machine_private *state = machine->generic_machine_data; + generic_machine_private *state = machine.generic_machine_data; if (num >= ARRAY_LENGTH(state->coin_count)) return; @@ -255,9 +255,9 @@ void coin_counter_w(running_machine *machine, int num, int on) for a given coin -------------------------------------------------*/ -int coin_counter_get_count(running_machine *machine, int num) +int coin_counter_get_count(running_machine &machine, int num) { - generic_machine_private *state = machine->generic_machine_data; + generic_machine_private *state = machine.generic_machine_data; if (num >= ARRAY_LENGTH(state->coin_count)) return 0; return state->coin_count[num]; @@ -268,9 +268,9 @@ int coin_counter_get_count(running_machine *machine, int num) coin_lockout_w - locks out one coin input -------------------------------------------------*/ -void coin_lockout_w(running_machine *machine, int num,int on) +void coin_lockout_w(running_machine &machine, int num,int on) { - generic_machine_private *state = machine->generic_machine_data; + generic_machine_private *state = machine.generic_machine_data; if (num >= ARRAY_LENGTH(state->coinlockedout)) return; state->coinlockedout[num] = on; @@ -282,9 +282,9 @@ void coin_lockout_w(running_machine *machine, int num,int on) state for a particular coin -------------------------------------------------*/ -int coin_lockout_get_state(running_machine *machine, int num) +int coin_lockout_get_state(running_machine &machine, int num) { - generic_machine_private *state = machine->generic_machine_data; + generic_machine_private *state = machine.generic_machine_data; if (num >= ARRAY_LENGTH(state->coinlockedout)) return FALSE; return state->coinlockedout[num]; @@ -296,9 +296,9 @@ int coin_lockout_get_state(running_machine *machine, int num) inputs -------------------------------------------------*/ -void coin_lockout_global_w(running_machine *machine, int on) +void coin_lockout_global_w(running_machine &machine, int on) { - generic_machine_private *state = machine->generic_machine_data; + generic_machine_private *state = machine.generic_machine_data; int i; for (i = 0; i < ARRAY_LENGTH(state->coinlockedout); i++) @@ -315,20 +315,20 @@ void coin_lockout_global_w(running_machine *machine, int on) nvram_load - load a system's NVRAM -------------------------------------------------*/ -void nvram_load(running_machine *machine) +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 - emu_file file(machine->options().nvram_directory(), OPEN_FLAG_READ); - if (file.open(machine->basename(), ".nv") == FILERR_NONE) + emu_file file(machine.options().nvram_directory(), OPEN_FLAG_READ); + 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)) @@ -353,20 +353,20 @@ void nvram_load(running_machine *machine) nvram_save - save a system's NVRAM -------------------------------------------------*/ -void nvram_save(running_machine *machine) +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 - emu_file file(machine->options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - if (file.open(machine->basename(), ".nv") == FILERR_NONE) + emu_file file(machine.options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + 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)) @@ -396,7 +396,7 @@ INLINE void memcard_name(int index, char *buffer) the given index -------------------------------------------------*/ -int memcard_create(running_machine *machine, int index, int overwrite) +int memcard_create(running_machine &machine, int index, int overwrite) { char name[16]; @@ -404,23 +404,23 @@ int memcard_create(running_machine *machine, int index, int overwrite) memcard_name(index, name); /* if we can't overwrite, fail if the file already exists */ - astring fname(machine->basename(), PATH_SEPARATOR, name); + astring fname(machine.basename(), PATH_SEPARATOR, name); if (!overwrite) { - emu_file testfile(machine->options().memcard_directory(), OPEN_FLAG_READ); + emu_file testfile(machine.options().memcard_directory(), OPEN_FLAG_READ); if (testfile.open(fname) == FILERR_NONE) return 1; } /* create a new file */ - emu_file file(machine->options().memcard_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(machine.options().memcard_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); file_error filerr = file.open(fname); if (filerr != FILERR_NONE) 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; @@ -432,28 +432,28 @@ int memcard_create(running_machine *machine, int index, int overwrite) with the given index -------------------------------------------------*/ -int memcard_insert(running_machine *machine, int index) +int memcard_insert(running_machine &machine, int index) { - generic_machine_private *state = machine->generic_machine_data; + generic_machine_private *state = machine.generic_machine_data; char name[16]; /* if a card is already inserted, eject it first */ if (state->memcard_inserted != -1) - memcard_eject(*machine); + memcard_eject(machine); assert(state->memcard_inserted == -1); /* create a name */ memcard_name(index, name); /* open the file; if we can't, it's an error */ - emu_file file(machine->options().memcard_directory(), OPEN_FLAG_READ); - file_error filerr = file.open(machine->basename(), PATH_SEPARATOR, name); + emu_file file(machine.options().memcard_directory(), OPEN_FLAG_READ); + file_error filerr = file.open(machine.basename(), PATH_SEPARATOR, name); if (filerr != FILERR_NONE) 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; @@ -486,7 +486,7 @@ void memcard_eject(running_machine &machine) /* initialize and then load the card */ if (machine.config().m_memcard_handler) - (*machine.config().m_memcard_handler)(&machine, file, MEMCARD_EJECT); + (*machine.config().m_memcard_handler)(machine, file, MEMCARD_EJECT); /* close the file */ state->memcard_inserted = -1; @@ -498,9 +498,9 @@ void memcard_eject(running_machine &machine) card index, or -1 if none -------------------------------------------------*/ -int memcard_present(running_machine *machine) +int memcard_present(running_machine &machine) { - generic_machine_private *state = machine->generic_machine_data; + generic_machine_private *state = machine.generic_machine_data; return state->memcard_inserted; } @@ -514,7 +514,7 @@ int memcard_present(running_machine *machine) set_led_status - set the state of a given LED -------------------------------------------------*/ -void set_led_status(running_machine *machine, int num, int on) +void set_led_status(running_machine &machine, int num, int on) { output_set_led_value(num, on); } @@ -585,7 +585,7 @@ void generic_pulse_irq_line(device_t *device, int irqline) cpu_device *cpudevice = downcast<cpu_device *>(device); attotime target_time = cpudevice->local_time() + cpudevice->cycles_to_attotime(cpudevice->min_cycles()); - device->machine->scheduler().timer_set(target_time - device->machine->time(), FUNC(irq_pulse_clear), irqline, (void *)device); + device->machine().scheduler().timer_set(target_time - device->machine().time(), FUNC(irq_pulse_clear), irqline, (void *)device); } @@ -602,7 +602,7 @@ void generic_pulse_irq_line_and_vector(device_t *device, int irqline, int vector cpu_device *cpudevice = downcast<cpu_device *>(device); attotime target_time = cpudevice->local_time() + cpudevice->cycles_to_attotime(cpudevice->min_cycles()); - device->machine->scheduler().timer_set(target_time - device->machine->time(), FUNC(irq_pulse_clear), irqline, (void *)device); + device->machine().scheduler().timer_set(target_time - device->machine().time(), FUNC(irq_pulse_clear), irqline, (void *)device); } @@ -615,7 +615,7 @@ void cpu_interrupt_enable(device_t *device, int enabled) { cpu_device *cpudevice = downcast<cpu_device *>(device); - generic_machine_private *state = device->machine->generic_machine_data; + generic_machine_private *state = device->machine().generic_machine_data; int index; for (index = 0; index < ARRAY_LENGTH(state->interrupt_device); index++) if (state->interrupt_device[index] == device) @@ -628,7 +628,7 @@ void cpu_interrupt_enable(device_t *device, int enabled) /* make sure there are no queued interrupts */ if (enabled == 0) - device->machine->scheduler().synchronize(FUNC(clear_all_lines), 0, (void *)cpudevice); + device->machine().scheduler().synchronize(FUNC(clear_all_lines), 0, (void *)cpudevice); } @@ -713,24 +713,24 @@ INTERRUPT_GEN( irq7_line_assert ) { if (interrupt_enabled(device)) device_set_in 8-bit reset read/write handlers -------------------------------------------------*/ -WRITE8_HANDLER( watchdog_reset_w ) { watchdog_reset(space->machine); } -READ8_HANDLER( watchdog_reset_r ) { watchdog_reset(space->machine); return space->unmap(); } +WRITE8_HANDLER( watchdog_reset_w ) { watchdog_reset(space->machine()); } +READ8_HANDLER( watchdog_reset_r ) { watchdog_reset(space->machine()); return space->unmap(); } /*------------------------------------------------- 16-bit reset read/write handlers -------------------------------------------------*/ -WRITE16_HANDLER( watchdog_reset16_w ) { watchdog_reset(space->machine); } -READ16_HANDLER( watchdog_reset16_r ) { watchdog_reset(space->machine); return space->unmap(); } +WRITE16_HANDLER( watchdog_reset16_w ) { watchdog_reset(space->machine()); } +READ16_HANDLER( watchdog_reset16_r ) { watchdog_reset(space->machine()); return space->unmap(); } /*------------------------------------------------- 32-bit reset read/write handlers -------------------------------------------------*/ -WRITE32_HANDLER( watchdog_reset32_w ) { watchdog_reset(space->machine); } -READ32_HANDLER( watchdog_reset32_r ) { watchdog_reset(space->machine); return space->unmap(); } +WRITE32_HANDLER( watchdog_reset32_w ) { watchdog_reset(space->machine()); } +READ32_HANDLER( watchdog_reset32_r ) { watchdog_reset(space->machine()); return space->unmap(); } @@ -748,5 +748,5 @@ READ32_HANDLER( watchdog_reset32_r ) { watchdog_reset(space->machine); return sp CUSTOM_INPUT( custom_port_read ) { const char *tag = (const char *)param; - return input_port_read(field->port->machine, tag); + return input_port_read(field->port->machine(), tag); } diff --git a/src/emu/machine/generic.h b/src/emu/machine/generic.h index 565a14ff679..3cc006c5e5e 100644 --- a/src/emu/machine/generic.h +++ b/src/emu/machine/generic.h @@ -38,69 +38,69 @@ /* ----- initialization ----- */ /* set up all the common systems */ -void generic_machine_init(running_machine *machine); +void generic_machine_init(running_machine &machine); /* ----- tickets ----- */ /* return the number of tickets dispensed */ -int get_dispensed_tickets(running_machine *machine); +int get_dispensed_tickets(running_machine &machine); /* increment the number of dispensed tickets */ -void increment_dispensed_tickets(running_machine *machine, int delta); +void increment_dispensed_tickets(running_machine &machine, int delta); /* ----- coin counters ----- */ /* write to a particular coin counter (clocks on active high edge) */ -void coin_counter_w(running_machine *machine, int num, int on); +void coin_counter_w(running_machine &machine, int num, int on); /* return the coin count for a given coin */ -int coin_counter_get_count(running_machine *machine, int num); +int coin_counter_get_count(running_machine &machine, int num); /* enable/disable coin lockout for a particular coin */ -void coin_lockout_w(running_machine *machine, int num, int on); +void coin_lockout_w(running_machine &machine, int num, int on); /* return current lockout state for a particular coin */ -int coin_lockout_get_state(running_machine *machine, int num); +int coin_lockout_get_state(running_machine &machine, int num); /* enable/disable global coin lockout */ -void coin_lockout_global_w(running_machine *machine, int on); +void coin_lockout_global_w(running_machine &machine, int on); /* ----- NVRAM management ----- */ /* load NVRAM from a file */ -void nvram_load(running_machine *machine); +void nvram_load(running_machine &machine); /* save NVRAM to a file */ -void nvram_save(running_machine *machine); +void nvram_save(running_machine &machine); /* ----- memory card management ----- */ /* create a new memory card with the given index */ -int memcard_create(running_machine *machine, int index, int overwrite); +int memcard_create(running_machine &machine, int index, int overwrite); /* "insert" a memory card with the given index and load its data */ -int memcard_insert(running_machine *machine, int index); +int memcard_insert(running_machine &machine, int index); /* "eject" a memory card and save its data */ void memcard_eject(running_machine &machine); /* returns the index of the current memory card, or -1 if none */ -int memcard_present(running_machine *machine); +int memcard_present(running_machine &machine); /* ----- miscellaneous bits & pieces ----- */ /* set the status of an LED */ -void set_led_status(running_machine *machine, int num, int value); +void set_led_status(running_machine &machine, int num, int value); diff --git a/src/emu/machine/i2cmem.c b/src/emu/machine/i2cmem.c index 88dd45e805f..063030d6b23 100644 --- a/src/emu/machine/i2cmem.c +++ b/src/emu/machine/i2cmem.c @@ -47,7 +47,7 @@ INLINE void ATTR_PRINTF( 3, 4 ) verboselog( device_t *device, int n_level, const va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%s: I2CMEM(%s) %s", device->machine ->describe_context( ), device->tag(), buf ); + logerror( "%s: I2CMEM(%s) %s", device->machine().describe_context( ), device->tag(), buf ); } } @@ -106,7 +106,7 @@ device_config *i2cmem_device_config::static_alloc_device_config( const machine_c device_t *i2cmem_device_config::alloc_device( running_machine &machine ) const { - return auto_alloc( &machine, i2cmem_device( machine, *this ) ); + return auto_alloc( machine, i2cmem_device( machine, *this ) ); } @@ -182,7 +182,7 @@ i2cmem_device::i2cmem_device( running_machine &_machine, const i2cmem_device_con { if( m_config.m_page_size > 0 ) { - m_page = auto_alloc_array( machine, UINT8, m_config.m_page_size ); + m_page = auto_alloc_array( m_machine, UINT8, m_config.m_page_size ); } } @@ -262,7 +262,7 @@ void i2cmem_device::nvram_default() void i2cmem_device::nvram_read( emu_file &file ) { int i2cmem_bytes = m_config.m_data_size; - UINT8 *buffer = auto_alloc_array( &m_machine, UINT8, i2cmem_bytes ); + UINT8 *buffer = auto_alloc_array( m_machine, UINT8, i2cmem_bytes ); file.read( buffer, i2cmem_bytes ); @@ -271,7 +271,7 @@ void i2cmem_device::nvram_read( emu_file &file ) m_addrspace[ 0 ]->write_byte( offs, buffer[ offs ] ); } - auto_free( &m_machine, buffer ); + auto_free( m_machine, buffer ); } //------------------------------------------------- @@ -282,7 +282,7 @@ void i2cmem_device::nvram_read( emu_file &file ) void i2cmem_device::nvram_write( emu_file &file ) { int i2cmem_bytes = m_config.m_data_size; - UINT8 *buffer = auto_alloc_array( &m_machine, UINT8, i2cmem_bytes ); + UINT8 *buffer = auto_alloc_array( m_machine, UINT8, i2cmem_bytes ); for( offs_t offs = 0; offs < i2cmem_bytes; offs++ ) { @@ -291,7 +291,7 @@ void i2cmem_device::nvram_write( emu_file &file ) file.write( buffer, i2cmem_bytes ); - auto_free( &m_machine, buffer ); + auto_free( m_machine, buffer ); } diff --git a/src/emu/machine/i8155.c b/src/emu/machine/i8155.c index 8b6bcfa9cfd..3726e766029 100644 --- a/src/emu/machine/i8155.c +++ b/src/emu/machine/i8155.c @@ -138,7 +138,7 @@ device_config *i8155_device_config::static_alloc_device_config(const machine_con device_t *i8155_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, i8155_device(machine, *this)); + return auto_alloc(machine, i8155_device(machine, *this)); } diff --git a/src/emu/machine/i8355.c b/src/emu/machine/i8355.c index 6c305793710..10671198227 100644 --- a/src/emu/machine/i8355.c +++ b/src/emu/machine/i8355.c @@ -83,7 +83,7 @@ device_config *i8355_device_config::static_alloc_device_config(const machine_con device_t *i8355_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, i8355_device(machine, *this)); + return auto_alloc(machine, i8355_device(machine, *this)); } diff --git a/src/emu/machine/idectrl.c b/src/emu/machine/idectrl.c index 91e5a710dc1..106c4bb5470 100644 --- a/src/emu/machine/idectrl.c +++ b/src/emu/machine/idectrl.c @@ -258,9 +258,9 @@ INLINE void signal_delayed_interrupt(ide_state *ide, attotime time, int buffer_r /* set a timer */ if (buffer_ready) - ide->device->machine->scheduler().timer_set(time, FUNC(delayed_interrupt_buffer_ready), 0, ide); + ide->device->machine().scheduler().timer_set(time, FUNC(delayed_interrupt_buffer_ready), 0, ide); else - ide->device->machine->scheduler().timer_set(time, FUNC(delayed_interrupt), 0, ide); + ide->device->machine().scheduler().timer_set(time, FUNC(delayed_interrupt), 0, ide); } @@ -625,7 +625,7 @@ static void security_error(ide_state *ide) ide->status &= ~IDE_STATUS_DRIVE_READY; /* just set a timer and mark ourselves error */ - ide->device->machine->scheduler().timer_set(TIME_SECURITY_ERROR, FUNC(security_error_done), 0, ide); + ide->device->machine().scheduler().timer_set(TIME_SECURITY_ERROR, FUNC(security_error_done), 0, ide); } @@ -806,10 +806,10 @@ static void read_first_sector(ide_state *ide) seek_time = TIME_SEEK_MULTISECTOR; ide->cur_lba = new_lba; - ide->device->machine->scheduler().timer_set(seek_time, FUNC(read_sector_done_callback), 0, ide); + ide->device->machine().scheduler().timer_set(seek_time, FUNC(read_sector_done_callback), 0, ide); } else - ide->device->machine->scheduler().timer_set(TIME_PER_SECTOR, FUNC(read_sector_done_callback), 0, ide); + ide->device->machine().scheduler().timer_set(TIME_PER_SECTOR, FUNC(read_sector_done_callback), 0, ide); } @@ -825,11 +825,11 @@ static void read_next_sector(ide_state *ide) read_sector_done(ide); else /* just set a timer */ - ide->device->machine->scheduler().timer_set(attotime::from_usec(1), FUNC(read_sector_done_callback), 0, ide); + ide->device->machine().scheduler().timer_set(attotime::from_usec(1), FUNC(read_sector_done_callback), 0, ide); } else /* just set a timer */ - ide->device->machine->scheduler().timer_set(TIME_PER_SECTOR, FUNC(read_sector_done_callback), 0, ide); + ide->device->machine().scheduler().timer_set(TIME_PER_SECTOR, FUNC(read_sector_done_callback), 0, ide); } @@ -862,13 +862,13 @@ static void continue_write(ide_state *ide) else { /* set a timer to do the write */ - ide->device->machine->scheduler().timer_set(TIME_PER_SECTOR, FUNC(write_sector_done_callback), 0, ide); + ide->device->machine().scheduler().timer_set(TIME_PER_SECTOR, FUNC(write_sector_done_callback), 0, ide); } } else { /* set a timer to do the write */ - ide->device->machine->scheduler().timer_set(TIME_PER_SECTOR, FUNC(write_sector_done_callback), 0, ide); + ide->device->machine().scheduler().timer_set(TIME_PER_SECTOR, FUNC(write_sector_done_callback), 0, ide); } } @@ -1224,7 +1224,7 @@ static void handle_command(ide_state *ide, UINT8 command) default: LOGPRINT(("IDE unknown command (%02X)\n", command)); - debugger_break(ide->device->machine); + debugger_break(ide->device->machine()); break; } } @@ -1244,7 +1244,7 @@ static UINT32 ide_controller_read(device_t *device, int bank, offs_t offset, int /* logit */ // if (BANK(bank, offset) != IDE_BANK0_DATA && BANK(bank, offset) != IDE_BANK0_STATUS_COMMAND && BANK(bank, offset) != IDE_BANK1_STATUS_CONTROL) - LOG(("%s:IDE read at %d:%X, size=%d\n", device->machine->describe_context(), bank, offset, size)); + LOG(("%s:IDE read at %d:%X, size=%d\n", device->machine().describe_context(), bank, offset, size)); switch (BANK(bank, offset)) { @@ -1279,7 +1279,7 @@ static UINT32 ide_controller_read(device_t *device, int bank, offs_t offset, int /* if we're at the end of the buffer, handle it */ if (ide->buffer_offset >= IDE_DISK_SECTOR_SIZE) { - LOG(("%s:IDE completed PIO read\n", device->machine->describe_context())); + LOG(("%s:IDE completed PIO read\n", device->machine().describe_context())); continue_read(ide); } } @@ -1330,7 +1330,7 @@ static UINT32 ide_controller_read(device_t *device, int bank, offs_t offset, int /* log anything else */ default: - logerror("%s:unknown IDE read at %03X, size=%d\n", device->machine->describe_context(), offset, size); + logerror("%s:unknown IDE read at %03X, size=%d\n", device->machine().describe_context(), offset, size); break; } @@ -1352,7 +1352,7 @@ static void ide_controller_write(device_t *device, int bank, offs_t offset, int /* logit */ if (BANK(bank, offset) != IDE_BANK0_DATA) - LOG(("%s:IDE write to %d:%X = %08X, size=%d\n", device->machine->describe_context(), bank, offset, data, size)); + LOG(("%s:IDE write to %d:%X = %08X, size=%d\n", device->machine().describe_context(), bank, offset, data, size)); // fprintf(stderr, "ide write %03x %02x size=%d\n", offset, data, size); switch (BANK(bank, offset)) { @@ -1389,7 +1389,7 @@ static void ide_controller_write(device_t *device, int bank, offs_t offset, int /* if we're at the end of the buffer, handle it */ if (ide->buffer_offset >= IDE_DISK_SECTOR_SIZE) { - LOG(("%s:IDE completed PIO write\n", device->machine->describe_context())); + LOG(("%s:IDE completed PIO write\n", device->machine().describe_context())); if (ide->command == IDE_COMMAND_SECURITY_UNLOCK) { if (ide->user_password_enable && memcmp(ide->buffer, ide->user_password, 2 + 32) == 0) @@ -1518,7 +1518,7 @@ static UINT32 ide_bus_master_read(device_t *device, offs_t offset, int size) { ide_state *ide = get_safe_token(device); - LOG(("%s:ide_bus_master_read(%d, %d)\n", device->machine->describe_context(), offset, size)); + LOG(("%s:ide_bus_master_read(%d, %d)\n", device->machine().describe_context(), offset, size)); /* command register */ if (offset == 0) @@ -1547,7 +1547,7 @@ static void ide_bus_master_write(device_t *device, offs_t offset, int size, UINT { ide_state *ide = get_safe_token(device); - LOG(("%s:ide_bus_master_write(%d, %d, %08X)\n", device->machine->describe_context(), offset, size, data)); + LOG(("%s:ide_bus_master_write(%d, %d, %08X)\n", device->machine().describe_context(), offset, size, data)); /* command register */ if (offset == 0) @@ -1792,21 +1792,20 @@ static DEVICE_START( ide_controller ) assert(device != NULL); assert(device->baseconfig().static_config() == NULL); assert(downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config() != NULL); - assert(device->machine != NULL); /* store a pointer back to the device */ ide->device = device; /* set MAME harddisk handle */ config = (const ide_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config(); - ide->handle = get_disk_handle(device->machine, (config->master != NULL) ? config->master : device->tag()); + ide->handle = get_disk_handle(device->machine(), (config->master != NULL) ? config->master : device->tag()); ide->disk = hard_disk_open(ide->handle); assert_always(config->slave == NULL, "IDE controller does not yet support slave drives\n"); /* find the bus master space */ if (config->bmcpu != NULL) { - device_t *bmtarget = device->machine->device(config->bmcpu); + device_t *bmtarget = device->machine().device(config->bmcpu); if (bmtarget == NULL) throw emu_fatalerror("IDE controller '%s' bus master target '%s' doesn't exist!", device->tag(), config->bmcpu); device_memory_interface *memory; @@ -1835,8 +1834,8 @@ static DEVICE_START( ide_controller ) } /* create a timer for timing status */ - ide->last_status_timer = device->machine->scheduler().timer_alloc(FUNC(NULL)); - ide->reset_timer = device->machine->scheduler().timer_alloc(FUNC(reset_callback), (void *)device); + ide->last_status_timer = device->machine().scheduler().timer_alloc(FUNC(NULL)); + ide->reset_timer = device->machine().scheduler().timer_alloc(FUNC(reset_callback), (void *)device); /* register ide states */ device->save_item(NAME(ide->adapter_control)); @@ -1910,14 +1909,14 @@ static DEVICE_RESET( ide_controller ) LOG(("IDE controller reset performed\n")); - if (device->machine->device( "harddisk" )) { + if (device->machine().device( "harddisk" )) { if (!ide->disk) { - ide->handle = hd_get_chd_file( device->machine->device( "harddisk" ) ); // should be config->master + ide->handle = hd_get_chd_file( device->machine().device( "harddisk" ) ); // should be config->master if (ide->handle) { - ide->disk = hd_get_hard_disk_file( device->machine->device( "harddisk" ) ); // should be config->master + ide->disk = hd_get_hard_disk_file( device->machine().device( "harddisk" ) ); // should be config->master if (ide->disk != NULL) { diff --git a/src/emu/machine/ins8250.c b/src/emu/machine/ins8250.c index a23c3ab4981..e44641922b3 100644 --- a/src/emu/machine/ins8250.c +++ b/src/emu/machine/ins8250.c @@ -437,7 +437,7 @@ READ8_DEVICE_HANDLER( ins8250_r ) case 5: #if 0 - if (ins8250->send.active && (machine->time()-ins8250->send.time>uart_byte_time(n))) + if (ins8250->send.active && (machine.time()-ins8250->send.time>uart_byte_time(n))) { // currently polling is enough for pc1512 ins8250->lsr |= 0x40; /* set TSRE */ diff --git a/src/emu/machine/k033906.c b/src/emu/machine/k033906.c index 30f8fa35baf..bea1fdd7c49 100644 --- a/src/emu/machine/k033906.c +++ b/src/emu/machine/k033906.c @@ -65,8 +65,8 @@ void k033906_device::device_start() { m_voodoo = m_machine.device(m_config.m_voodoo_tag); - m_reg = auto_alloc_array(&m_machine, UINT32, 256); - m_ram = auto_alloc_array(&m_machine, UINT32, 32768); + m_reg = auto_alloc_array(m_machine, UINT32, 256); + m_ram = auto_alloc_array(m_machine, UINT32, 32768); m_reg_set = 0; diff --git a/src/emu/machine/k056230.c b/src/emu/machine/k056230.c index 9d17ae4b734..54c944e1f03 100644 --- a/src/emu/machine/k056230.c +++ b/src/emu/machine/k056230.c @@ -74,7 +74,7 @@ void k056230_device::device_start() m_is_thunderh = m_config.m_is_thunderh; - m_ram = auto_alloc_array(&m_machine, UINT32, 0x2000); + m_ram = auto_alloc_array(m_machine, UINT32, 0x2000); save_pointer(NAME(m_ram), 0x2000); } diff --git a/src/emu/machine/latch8.c b/src/emu/machine/latch8.c index 289588f28e6..5ec709f1597 100644 --- a/src/emu/machine/latch8.c +++ b/src/emu/machine/latch8.c @@ -44,7 +44,7 @@ static void update(device_t *device, UINT8 new_val, UINT8 mask) UINT8 changed = old_val ^ latch8->value; for (i=0; i<8; i++) if (((changed & (1<<i)) != 0) && latch8->intf->node_map[i] != 0) - discrete_sound_w(device->machine->device(latch8->intf->node_device[i]), latch8->intf->node_map[i] , (latch8->value >> i) & 1); + discrete_sound_w(device->machine().device(latch8->intf->node_device[i]), latch8->intf->node_map[i] , (latch8->value >> i) & 1); } } @@ -83,7 +83,7 @@ READ8_DEVICE_HANDLER( latch8_r ) if (latch8->has_read) { /* temporary hack until all relevant systems are devices */ - address_space *space = device->machine->firstcpu->memory().space(AS_PROGRAM); + address_space *space = device->machine().firstcpu->memory().space(AS_PROGRAM); int i; for (i=0; i<8; i++) { @@ -105,7 +105,7 @@ WRITE8_DEVICE_HANDLER( latch8_w ) assert(offset == 0); if (latch8->intf->nosync != 0xff) - device->machine->scheduler().synchronize(FUNC(latch8_timerproc), (0xFF << 8) | data, (void *)device); + device->machine().scheduler().synchronize(FUNC(latch8_timerproc), (0xFF << 8) | data, (void *)device); else update(device, data, 0xFF); } @@ -165,7 +165,7 @@ INLINE void latch8_bitx_w(device_t *device, int bit, offs_t offset, UINT8 data) if (latch8->intf->nosync & mask) update(device, masked_data, mask); else - device->machine->scheduler().synchronize(FUNC(latch8_timerproc), (mask << 8) | masked_data, (void *) device); + device->machine().scheduler().synchronize(FUNC(latch8_timerproc), (mask << 8) | masked_data, (void *) device); } WRITE8_DEVICE_HANDLER( latch8_bit0_w ) { latch8_bitx_w(device, 0, offset, data); } @@ -206,7 +206,7 @@ static DEVICE_START( latch8 ) { if (latch8->devices[i] != NULL) fatalerror("Device %s: Bit %d already has a handler.\n", device->tag(), i); - latch8->devices[i] = device->machine->device(latch8->intf->devread[i].tag); + latch8->devices[i] = device->machine().device(latch8->intf->devread[i].tag); if (latch8->devices[i] == NULL) fatalerror("Device %s: Unable to find device %s\n", device->tag(), latch8->intf->devread[i].tag); latch8->has_devread = 1; diff --git a/src/emu/machine/ldcore.c b/src/emu/machine/ldcore.c index b7e540ca0ab..353fb68d130 100644 --- a/src/emu/machine/ldcore.c +++ b/src/emu/machine/ldcore.c @@ -146,8 +146,8 @@ static void read_track_data(laserdisc_state *ld); static void process_track_data(device_t *device); static DEVICE_START( laserdisc_sound ); static STREAM_UPDATE( custom_stream_callback ); -static void configuration_load(running_machine *machine, int config_type, xml_data_node *parentnode); -static void configuration_save(running_machine *machine, int config_type, xml_data_node *parentnode); +static void configuration_load(running_machine &machine, int config_type, xml_data_node *parentnode); +static void configuration_save(running_machine &machine, int config_type, xml_data_node *parentnode); @@ -292,7 +292,7 @@ static void vblank_state_changed(screen_device &screen, void *param, bool vblank device_t *device = (device_t *)param; laserdisc_state *ld = get_safe_token(device); ldcore_data *ldcore = ld->core; - attotime curtime = screen.machine->time(); + attotime curtime = screen.machine().time(); /* update current track based on slider speed */ update_slider_pos(ldcore, curtime); @@ -305,7 +305,7 @@ static void vblank_state_changed(screen_device &screen, void *param, bool vblank (*ldcore->intf.vsync)(ld, &ldcore->metadata[ldcore->fieldnum], ldcore->fieldnum, curtime); /* set a timer to begin fetching the next frame just before the VBI data would be fetched */ - screen.machine->scheduler().timer_set(screen.time_until_pos(16*2), FUNC(perform_player_update), 0, ld); + screen.machine().scheduler().timer_set(screen.time_until_pos(16*2), FUNC(perform_player_update), 0, ld); } } @@ -319,7 +319,7 @@ static TIMER_CALLBACK( perform_player_update ) { laserdisc_state *ld = (laserdisc_state *)ptr; ldcore_data *ldcore = ld->core; - attotime curtime = machine->time(); + attotime curtime = machine.time(); /* wait for previous read and decode to finish */ process_track_data(ld->device); @@ -554,7 +554,7 @@ void ldcore_set_slider_speed(laserdisc_state *ld, INT32 tracks_per_vsync) ldcore_data *ldcore = ld->core; attotime vsyncperiod = ld->screen->frame_period(); - update_slider_pos(ldcore, ld->device->machine->time()); + update_slider_pos(ldcore, ld->device->machine().time()); /* if 0, set the time to 0 */ if (tracks_per_vsync == 0) @@ -582,7 +582,7 @@ void ldcore_advance_slider(laserdisc_state *ld, INT32 numtracks) { ldcore_data *ldcore = ld->core; - update_slider_pos(ldcore, ld->device->machine->time()); + update_slider_pos(ldcore, ld->device->machine().time()); add_and_clamp_track(ldcore, numtracks); if (LOG_SLIDER) printf("Advance by %d\n", numtracks); @@ -599,7 +599,7 @@ slider_position ldcore_get_slider_position(laserdisc_state *ld) ldcore_data *ldcore = ld->core; /* update the slider position first */ - update_slider_pos(ldcore, ld->device->machine->time()); + update_slider_pos(ldcore, ld->device->machine().time()); /* return the status */ if (ldcore->curtrack == 1) @@ -964,7 +964,7 @@ static void process_track_data(device_t *device) static DEVICE_START( laserdisc_sound ) { sound_token *token = (sound_token *)downcast<legacy_device_base *>(device)->token(); - token->stream = device->machine->sound().stream_alloc(*device, 0, 2, 48000, token, custom_stream_callback); + token->stream = device->machine().sound().stream_alloc(*device, 0, 2, 48000, token, custom_stream_callback); token->ld = NULL; } @@ -1072,7 +1072,7 @@ static STREAM_UPDATE( custom_stream_callback ) the configuration file -------------------------------------------------*/ -static void configuration_load(running_machine *machine, int config_type, xml_data_node *parentnode) +static void configuration_load(running_machine &machine, int config_type, xml_data_node *parentnode) { xml_data_node *overnode; xml_data_node *ldnode; @@ -1089,7 +1089,7 @@ static void configuration_load(running_machine *machine, int config_type, xml_da for (ldnode = xml_get_sibling(parentnode->child, "device"); ldnode != NULL; ldnode = xml_get_sibling(ldnode->next, "device")) { const char *devtag = xml_get_attribute_string(ldnode, "tag", ""); - device_t *device = machine->device(devtag); + device_t *device = machine.device(devtag); if (device != NULL) { laserdisc_state *ld = get_safe_token(device); @@ -1115,7 +1115,7 @@ static void configuration_load(running_machine *machine, int config_type, xml_da configuration file -------------------------------------------------*/ -static void configuration_save(running_machine *machine, int config_type, xml_data_node *parentnode) +static void configuration_save(running_machine &machine, int config_type, xml_data_node *parentnode) { device_t *device; @@ -1124,7 +1124,7 @@ static void configuration_save(running_machine *machine, int config_type, xml_da return; /* iterate over disc devices */ - for (device = machine->m_devicelist.first(LASERDISC); device != NULL; device = device->typenext()) + for (device = machine.m_devicelist.first(LASERDISC); device != NULL; device = device->typenext()) { laserdisc_config *origconfig = (laserdisc_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config(); laserdisc_state *ld = get_safe_token(device); @@ -1214,7 +1214,7 @@ void laserdisc_overlay_enable(device_t *device, int enable) SCREEN_UPDATE( laserdisc ) { - device_t *laserdisc = screen->machine->m_devicelist.first(LASERDISC); + device_t *laserdisc = screen->machine().m_devicelist.first(LASERDISC); if (laserdisc != NULL) { const rectangle &visarea = screen->visible_area(); @@ -1245,7 +1245,7 @@ SCREEN_UPDATE( laserdisc ) if (overbitmap != NULL) { if (overbitmap->format == BITMAP_FORMAT_INDEXED16) - ldcore->overtex->set_bitmap(overbitmap, &ldcore->config.overclip, TEXFORMAT_PALETTEA16, laserdisc->machine->palette); + ldcore->overtex->set_bitmap(overbitmap, &ldcore->config.overclip, TEXFORMAT_PALETTEA16, laserdisc->machine().palette); else if (overbitmap->format == BITMAP_FORMAT_RGB32) ldcore->overtex->set_bitmap(overbitmap, &ldcore->config.overclip, TEXFORMAT_ARGB32); } @@ -1331,7 +1331,7 @@ static void init_disc(device_t *device) if (config->getdisc != NULL) ldcore->disc = (*config->getdisc)(device); else - ldcore->disc = get_disk_handle(device->machine, device->tag()); + ldcore->disc = get_disk_handle(device->machine(), device->tag()); /* set default parameters */ ldcore->width = 720; @@ -1372,7 +1372,7 @@ static void init_disc(device_t *device) ldcore->chdtracks = totalhunks / 2; /* allocate memory for the precomputed per-frame metadata */ - ldcore->vbidata = auto_alloc_array(device->machine, UINT8, totalhunks * VBI_PACKED_BYTES); + ldcore->vbidata = auto_alloc_array(device->machine(), UINT8, totalhunks * VBI_PACKED_BYTES); err = chd_get_metadata(ldcore->disc, AV_LD_METADATA_TAG, 0, ldcore->vbidata, totalhunks * VBI_PACKED_BYTES, &vbilength, NULL, NULL); if (err != CHDERR_NONE || vbilength != totalhunks * VBI_PACKED_BYTES) fatalerror("Precomputed VBI metadata missing or incorrect size"); @@ -1401,23 +1401,23 @@ static void init_video(device_t *device) frame_data *frame = &ldcore->frame[index]; /* first allocate a YUY16 bitmap at 2x the height */ - frame->bitmap = auto_alloc(device->machine, bitmap_t(ldcore->width, ldcore->height * 2, BITMAP_FORMAT_YUY16)); + frame->bitmap = auto_alloc(device->machine(), bitmap_t(ldcore->width, ldcore->height * 2, BITMAP_FORMAT_YUY16)); fillbitmap_yuy16(frame->bitmap, 40, 109, 240); /* make a copy of the bitmap that clips out the VBI and horizontal blanking areas */ - frame->visbitmap = auto_alloc(device->machine, bitmap_t(BITMAP_ADDR16(frame->bitmap, 44, frame->bitmap->width * 8 / 720), + frame->visbitmap = auto_alloc(device->machine(), bitmap_t(BITMAP_ADDR16(frame->bitmap, 44, frame->bitmap->width * 8 / 720), frame->bitmap->width - 2 * frame->bitmap->width * 8 / 720, frame->bitmap->height - 44, frame->bitmap->rowpixels, frame->bitmap->format)); } /* allocate an empty frame of the same size */ - ldcore->emptyframe = auto_bitmap_alloc(device->machine, ldcore->width, ldcore->height * 2, BITMAP_FORMAT_YUY16); + ldcore->emptyframe = auto_bitmap_alloc(device->machine(), ldcore->width, ldcore->height * 2, BITMAP_FORMAT_YUY16); fillbitmap_yuy16(ldcore->emptyframe, 0, 128, 128); /* allocate texture for rendering */ ldcore->videoenable = TRUE; - ldcore->videotex = device->machine->render().texture_alloc(); + ldcore->videotex = device->machine().render().texture_alloc(); if (ldcore->videotex == NULL) fatalerror("Out of memory allocating video texture"); @@ -1432,9 +1432,9 @@ static void init_video(device_t *device) if (ldcore->config.overwidth > 0 && ldcore->config.overheight > 0 && ldcore->config.overupdate != NULL) { ldcore->overenable = TRUE; - ldcore->overbitmap[0] = auto_bitmap_alloc(device->machine, ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat); - ldcore->overbitmap[1] = auto_bitmap_alloc(device->machine, ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat); - ldcore->overtex = device->machine->render().texture_alloc(); + ldcore->overbitmap[0] = auto_bitmap_alloc(device->machine(), ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat); + ldcore->overbitmap[1] = auto_bitmap_alloc(device->machine(), ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat); + ldcore->overtex = device->machine().render().texture_alloc(); if (ldcore->overtex == NULL) fatalerror("Out of memory allocating overlay texture"); } @@ -1452,13 +1452,13 @@ static void init_audio(device_t *device) ldcore_data *ldcore = ld->core; /* find the custom audio */ - ldcore->audiocustom = device->machine->device(ldcore->config.sound); + ldcore->audiocustom = device->machine().device(ldcore->config.sound); /* allocate audio buffers */ ldcore->audiomaxsamples = ((UINT64)ldcore->samplerate * 1000000 + ldcore->fps_times_1million - 1) / ldcore->fps_times_1million; ldcore->audiobufsize = ldcore->audiomaxsamples * 4; - ldcore->audiobuffer[0] = auto_alloc_array(device->machine, INT16, ldcore->audiobufsize); - ldcore->audiobuffer[1] = auto_alloc_array(device->machine, INT16, ldcore->audiobufsize); + ldcore->audiobuffer[0] = auto_alloc_array(device->machine(), INT16, ldcore->audiobufsize); + ldcore->audiobuffer[1] = auto_alloc_array(device->machine(), INT16, ldcore->audiobufsize); } @@ -1480,7 +1480,7 @@ static DEVICE_START( laserdisc ) int index; /* ensure that our screen is started first */ - ld->screen = downcast<screen_device *>(device->machine->device(config->screen)); + ld->screen = downcast<screen_device *>(device->machine().device(config->screen)); assert(ld->screen != NULL); if (!ld->screen->started()) throw device_missing_dependencies(); @@ -1489,14 +1489,14 @@ static DEVICE_START( laserdisc ) ld->device = device; /* allocate memory for the core state */ - ld->core = auto_alloc_clear(device->machine, ldcore_data); + ld->core = auto_alloc_clear(device->machine(), ldcore_data); ldcore = ld->core; /* determine the maximum player-specific state size and allocate it */ statesize = 0; for (index = 0; index < ARRAY_LENGTH(player_interfaces); index++) statesize = MAX(statesize, player_interfaces[index]->statesize); - ld->player = (ldplayer_data *)auto_alloc_array_clear(device->machine, UINT8, statesize); + ld->player = (ldplayer_data *)auto_alloc_array_clear(device->machine(), UINT8, statesize); /* copy config data to the live state */ ldcore->config = *config; @@ -1517,7 +1517,7 @@ static DEVICE_START( laserdisc ) init_audio(device); /* register callbacks */ - config_register(device->machine, "laserdisc", configuration_load, configuration_save); + config_register(device->machine(), "laserdisc", configuration_load, configuration_save); } @@ -1535,10 +1535,10 @@ static DEVICE_STOP( laserdisc ) chd_async_complete(ldcore->disc); /* free any textures and palettes */ - device->machine->render().texture_free(ldcore->videotex); + device->machine().render().texture_free(ldcore->videotex); if (ldcore->videopalette != NULL) palette_deref(ldcore->videopalette); - device->machine->render().texture_free(ldcore->overtex); + device->machine().render().texture_free(ldcore->overtex); } @@ -1549,7 +1549,7 @@ static DEVICE_STOP( laserdisc ) static DEVICE_RESET( laserdisc ) { laserdisc_state *ld = get_safe_token(device); - attotime curtime = device->machine->time(); + attotime curtime = device->machine().time(); ldcore_data *ldcore = ld->core; int pltype, line; diff --git a/src/emu/machine/ldpr8210.c b/src/emu/machine/ldpr8210.c index 5f9c6e22ed0..1e90f5862f6 100644 --- a/src/emu/machine/ldpr8210.c +++ b/src/emu/machine/ldpr8210.c @@ -341,7 +341,7 @@ const ldplayer_interface pr8210_interface = static void pr8210_init(laserdisc_state *ld) { astring tempstring; - attotime curtime = ld->device->machine->time(); + attotime curtime = ld->device->machine().time(); ldplayer_data *player = ld->player; /* reset our state */ @@ -381,10 +381,10 @@ static void pr8210_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int field /* signal VSYNC and set a timer to turn it off */ player->vsync = TRUE; - ld->device->machine->scheduler().timer_set(ld->screen->scan_period() * 4, FUNC(vsync_off), 0, ld); + ld->device->machine().scheduler().timer_set(ld->screen->scan_period() * 4, FUNC(vsync_off), 0, ld); /* also set a timer to fetch the VBI data when it is ready */ - ld->device->machine->scheduler().timer_set(ld->screen->time_until_pos(19*2), FUNC(vbi_data_fetch), 0, ld); + ld->device->machine().scheduler().timer_set(ld->screen->time_until_pos(19*2), FUNC(vbi_data_fetch), 0, ld); } @@ -452,7 +452,7 @@ static void pr8210_control_w(laserdisc_state *ld, UINT8 prev, UINT8 data) /* handle rising edge */ if (prev != ASSERT_LINE && data == ASSERT_LINE) { - attotime curtime = ld->device->machine->time(); + attotime curtime = ld->device->machine().time(); attotime delta, overalldelta; int longpulse; @@ -841,7 +841,7 @@ static WRITE8_HANDLER( pr8210_port2_w ) /* on the falling edge of bit 5, start the slow timer */ if (!(data & 0x20) && (prev & 0x20)) - player->slowtrg = space->machine->time(); + player->slowtrg = space->machine().time(); /* bit 6 when low triggers an IRQ on the MCU */ if (player->cpu != NULL) @@ -1121,7 +1121,7 @@ static void simutrek_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int fie if (LOG_SIMUTREK) printf("%3d:VSYNC IRQ\n", ld->screen->vpos()); device_set_input_line(player->simutrek.cpu, MCS48_INPUT_IRQ, ASSERT_LINE); - ld->device->machine->scheduler().timer_set(ld->screen->scan_period(), FUNC(irq_off), 0, ld); + ld->device->machine().scheduler().timer_set(ld->screen->scan_period(), FUNC(irq_off), 0, ld); } } @@ -1166,7 +1166,7 @@ static UINT8 simutrek_status_r(laserdisc_state *ld) static void simutrek_data_w(laserdisc_state *ld, UINT8 prev, UINT8 data) { - ld->device->machine->scheduler().synchronize(FUNC(simutrek_latched_data_w), data, ld); + ld->device->machine().scheduler().synchronize(FUNC(simutrek_latched_data_w), data, ld); if (LOG_SIMUTREK) printf("%03d:**** Simutrek Command = %02X\n", ld->screen->vpos(), data); } diff --git a/src/emu/machine/ldv1000.c b/src/emu/machine/ldv1000.c index f9477730987..02bc16486df 100644 --- a/src/emu/machine/ldv1000.c +++ b/src/emu/machine/ldv1000.c @@ -258,13 +258,13 @@ static void ldv1000_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int fiel /* signal VSYNC and set a timer to turn it off */ player->vsync = TRUE; - ld->device->machine->scheduler().timer_set(ld->screen->scan_period() * 4, FUNC(vsync_off), 0, ld); + ld->device->machine().scheduler().timer_set(ld->screen->scan_period() * 4, FUNC(vsync_off), 0, ld); /* also set a timer to fetch the VBI data when it is ready */ - ld->device->machine->scheduler().timer_set(ld->screen->time_until_pos(19*2), FUNC(vbi_data_fetch), 0, ld); + ld->device->machine().scheduler().timer_set(ld->screen->time_until_pos(19*2), FUNC(vbi_data_fetch), 0, ld); /* boost interleave for the first 1ms to improve communications */ - ld->device->machine->scheduler().boost_interleave(attotime::zero, attotime::from_msec(1)); + ld->device->machine().scheduler().boost_interleave(attotime::zero, attotime::from_msec(1)); } @@ -526,7 +526,7 @@ static WRITE8_DEVICE_HANDLER( ppi0_porta_w ) laserdisc_state *ld = ldcore_get_safe_token(device->owner()); ld->player->counter_start = data; if (LOG_PORT_IO) - printf("%s:PORTA.0=%02X\n", device->machine->describe_context(), data); + printf("%s:PORTA.0=%02X\n", device->machine().describe_context(), data); } @@ -589,7 +589,7 @@ static WRITE8_DEVICE_HANDLER( ppi0_portc_w ) player->portc0 = data; if (LOG_PORT_IO && ((data ^ prev) & 0x0f) != 0) { - printf("%s:PORTC.0=%02X", device->machine->describe_context(), data); + printf("%s:PORTC.0=%02X", device->machine().describe_context(), data); if (data & 0x01) printf(" PRELOAD"); if (!(data & 0x02)) printf(" /MULTIJUMP"); if (data & 0x04) printf(" SCANMODE"); @@ -685,7 +685,7 @@ static WRITE8_DEVICE_HANDLER( ppi1_portb_w ) player->portb1 = data; if (LOG_PORT_IO && ((data ^ prev) & 0xff) != 0) { - printf("%s:PORTB.1=%02X:", device->machine->describe_context(), data); + printf("%s:PORTB.1=%02X:", device->machine().describe_context(), data); if (!(data & 0x01)) printf(" FOCSON"); if (!(data & 0x02)) printf(" SPDLRUN"); if (!(data & 0x04)) printf(" JUMPTRIG"); @@ -741,7 +741,7 @@ static WRITE8_DEVICE_HANDLER( ppi1_portc_w ) player->portc1 = data; if (LOG_PORT_IO && ((data ^ prev) & 0xcf) != 0) { - printf("%s:PORTC.1=%02X", device->machine->describe_context(), data); + printf("%s:PORTC.1=%02X", device->machine().describe_context(), data); if (data & 0x01) printf(" AUD1"); if (data & 0x02) printf(" AUD2"); if (data & 0x04) printf(" AUDEN"); diff --git a/src/emu/machine/ldvp931.c b/src/emu/machine/ldvp931.c index e01a3f07541..d3b5d0005f7 100644 --- a/src/emu/machine/ldvp931.c +++ b/src/emu/machine/ldvp931.c @@ -234,7 +234,7 @@ static void vp931_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int fieldn /* set the ERP signal to 1 to indicate start of frame, and set a timer to turn it off */ ld->player->daticerp = 1; - ld->device->machine->scheduler().timer_set(ld->screen->time_until_pos(15*2), FUNC(erp_off), 0, ld); + ld->device->machine().scheduler().timer_set(ld->screen->time_until_pos(15*2), FUNC(erp_off), 0, ld); } @@ -246,7 +246,7 @@ static void vp931_vsync(laserdisc_state *ld, const vbi_metadata *vbi, int fieldn static INT32 vp931_update(laserdisc_state *ld, const vbi_metadata *vbi, int fieldnum, attotime curtime) { /* set the first VBI timer to go at the start of line 16 */ - ld->device->machine->scheduler().timer_set(ld->screen->time_until_pos(16*2), FUNC(vbi_data_fetch), LASERDISC_CODE_LINE16 << 2, ld); + ld->device->machine().scheduler().timer_set(ld->screen->time_until_pos(16*2), FUNC(vbi_data_fetch), LASERDISC_CODE_LINE16 << 2, ld); /* play forward by default */ return fieldnum; @@ -261,7 +261,7 @@ static INT32 vp931_update(laserdisc_state *ld, const vbi_metadata *vbi, int fiel static void vp931_data_w(laserdisc_state *ld, UINT8 prev, UINT8 data) { /* set a timer to synchronize execution before sending the data */ - ld->device->machine->scheduler().synchronize(FUNC(deferred_data_w), data, ld); + ld->device->machine().scheduler().synchronize(FUNC(deferred_data_w), data, ld); } @@ -283,7 +283,7 @@ static UINT8 vp931_data_r(laserdisc_state *ld) } /* also boost interleave for 4 scanlines to ensure proper communications */ - ld->device->machine->scheduler().boost_interleave(attotime::zero, ld->screen->scan_period() * 4); + ld->device->machine().scheduler().boost_interleave(attotime::zero, ld->screen->scan_period() * 4); return player->tocontroller; } @@ -336,7 +336,7 @@ static TIMER_CALLBACK( vbi_data_fetch ) if (which == 0) { device_set_input_line(player->cpu, MCS48_INPUT_IRQ, ASSERT_LINE); - machine->scheduler().timer_set(attotime::from_nsec(5580), FUNC(irq_off), 0, ld); + machine.scheduler().timer_set(attotime::from_nsec(5580), FUNC(irq_off), 0, ld); } /* clock the data strobe on each subsequent callback */ @@ -344,7 +344,7 @@ static TIMER_CALLBACK( vbi_data_fetch ) { player->daticval = code >> (8 * (3 - which)); player->datastrobe = 1; - machine->scheduler().timer_set(attotime::from_nsec(5000), FUNC(datastrobe_off), 0, ld); + machine.scheduler().timer_set(attotime::from_nsec(5000), FUNC(datastrobe_off), 0, ld); } /* determine the next bit to fetch and reprime ourself */ @@ -354,7 +354,7 @@ static TIMER_CALLBACK( vbi_data_fetch ) line++; } if (line <= LASERDISC_CODE_LINE18 + 1) - machine->scheduler().timer_set(ld->screen->time_until_pos(line*2, which * 2 * ld->screen->width() / 4), FUNC(vbi_data_fetch), (line << 2), ld); + machine.scheduler().timer_set(ld->screen->time_until_pos(line*2, which * 2 * ld->screen->width() / 4), FUNC(vbi_data_fetch), (line << 2), ld); } @@ -617,7 +617,7 @@ static WRITE8_HANDLER( to_controller_w ) (*player->data_ready_cb)(ld->device, TRUE); /* also boost interleave for 4 scanlines to ensure proper communications */ - ld->device->machine->scheduler().boost_interleave(attotime::zero, ld->screen->scan_period() * 4); + ld->device->machine().scheduler().boost_interleave(attotime::zero, ld->screen->scan_period() * 4); } diff --git a/src/emu/machine/mb3773.c b/src/emu/machine/mb3773.c index 55dbbed0ae8..ae114786ab7 100644 --- a/src/emu/machine/mb3773.c +++ b/src/emu/machine/mb3773.c @@ -55,7 +55,7 @@ device_config *mb3773_device_config::static_alloc_device_config( const machine_c device_t *mb3773_device_config::alloc_device( running_machine &machine ) const { - return auto_alloc( &machine, mb3773_device( machine, *this ) ); + return auto_alloc( machine, mb3773_device( machine, *this ) ); } diff --git a/src/emu/machine/mb87078.c b/src/emu/machine/mb87078.c index 5a60dd5686a..c487e751ae8 100644 --- a/src/emu/machine/mb87078.c +++ b/src/emu/machine/mb87078.c @@ -175,7 +175,7 @@ static void gain_recalc( device_t *device ) int old_index = mb87078->gain[i]; mb87078->gain[i] = calc_gain_index(mb87078->latch[0][i], mb87078->latch[1][i]); if (old_index != mb87078->gain[i]) - mb87078->gain_changed_cb(device->machine, i, mb87078_gain_percent[mb87078->gain[i]]); + mb87078->gain_changed_cb(device->machine(), i, mb87078_gain_percent[mb87078->gain[i]]); } } diff --git a/src/emu/machine/mb87078.h b/src/emu/machine/mb87078.h index 9c5397cd966..7f62b44c06e 100644 --- a/src/emu/machine/mb87078.h +++ b/src/emu/machine/mb87078.h @@ -16,7 +16,7 @@ TYPE DEFINITIONS ***************************************************************************/ -typedef void (*mb87078_gain_changed_cb)(running_machine *machine, int channel, int percent /*, float decibels*/); +typedef void (*mb87078_gain_changed_cb)(running_machine &machine, int channel, int percent /*, float decibels*/); typedef struct _mb87078_interface mb87078_interface; struct _mb87078_interface diff --git a/src/emu/machine/mc146818.c b/src/emu/machine/mc146818.c index 926818829cc..8f31779a58b 100644 --- a/src/emu/machine/mc146818.c +++ b/src/emu/machine/mc146818.c @@ -141,7 +141,7 @@ device_config *mc146818_device_config::static_alloc_device_config(const machine_ device_t *mc146818_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, mc146818_device(machine, *this)); + return auto_alloc(machine, mc146818_device(machine, *this)); } @@ -436,7 +436,7 @@ READ8_MEMBER( mc146818_device::read ) switch (m_index % MC146818_DATA_SIZE) { case 0xa: data = m_data[m_index % MC146818_DATA_SIZE]; - if ((space.machine->time() - m_last_refresh) < attotime::from_hz(32768)) + if ((space.machine().time() - m_last_refresh) < attotime::from_hz(32768)) data |= 0x80; #if 0 /* for pc1512 bios realtime clock test */ diff --git a/src/emu/machine/microtch.c b/src/emu/machine/microtch.c index 4d07c268216..128dc29c383 100644 --- a/src/emu/machine/microtch.c +++ b/src/emu/machine/microtch.c @@ -151,7 +151,7 @@ static TIMER_CALLBACK(microtouch_timer_callback) } }; -void microtouch_init(running_machine *machine, microtouch_tx_func tx_cb, microtouch_touch_func touch_cb) +void microtouch_init(running_machine &machine, microtouch_tx_func tx_cb, microtouch_touch_func touch_cb) { memset(µtouch, 0, sizeof(microtouch)); @@ -159,7 +159,7 @@ void microtouch_init(running_machine *machine, microtouch_tx_func tx_cb, microto microtouch.tx_callback = tx_cb; microtouch.touch_callback = touch_cb; - microtouch.timer = machine->scheduler().timer_alloc(FUNC(microtouch_timer_callback)); + microtouch.timer = machine.scheduler().timer_alloc(FUNC(microtouch_timer_callback)); microtouch.timer->adjust(attotime::from_hz(167*5), 0, attotime::from_hz(167*5)); state_save_register_item(machine, "microtouch", NULL, 0, microtouch.reset_done); diff --git a/src/emu/machine/microtch.h b/src/emu/machine/microtch.h index efa6c2a4f12..d378c49eb91 100644 --- a/src/emu/machine/microtch.h +++ b/src/emu/machine/microtch.h @@ -3,10 +3,10 @@ INPUT_PORTS_EXTERN(microtouch); -typedef void (*microtouch_tx_func)(running_machine *machine, UINT8 data); -typedef int (*microtouch_touch_func)(running_machine *machine, int *touch_x, int *touch_y); +typedef void (*microtouch_tx_func)(running_machine &machine, UINT8 data); +typedef int (*microtouch_touch_func)(running_machine &machine, int *touch_x, int *touch_y); -void microtouch_init(running_machine *machine, microtouch_tx_func tx_cb, microtouch_touch_func touch_cb); +void microtouch_init(running_machine &machine, microtouch_tx_func tx_cb, microtouch_touch_func touch_cb); void microtouch_rx(int count, UINT8* data); #endif //_MICROTOUCH_H diff --git a/src/emu/machine/msm6242.c b/src/emu/machine/msm6242.c index 31bc218740f..8ba28098905 100644 --- a/src/emu/machine/msm6242.c +++ b/src/emu/machine/msm6242.c @@ -58,7 +58,7 @@ READ8_DEVICE_HANDLER( msm6242_r ) } else /* otherwise, use the current time */ { - device->machine->current_datetime(curtime); + device->machine().current_datetime(curtime); } switch(offset) @@ -103,7 +103,7 @@ READ8_DEVICE_HANDLER( msm6242_r ) case MSM6242_REG_CF: return msm6242->reg[2]; } - logerror("%s: MSM6242 unmapped offset %02x read\n", device->machine->describe_context(), offset); + logerror("%s: MSM6242 unmapped offset %02x read\n", device->machine().describe_context(), offset); return 0; } @@ -120,7 +120,7 @@ WRITE8_DEVICE_HANDLER( msm6242_w ) if (data & 1) /* was Hold set? */ { - device->machine->current_datetime(msm6242->hold_time); + device->machine().current_datetime(msm6242->hold_time); } return; @@ -146,7 +146,7 @@ WRITE8_DEVICE_HANDLER( msm6242_w ) } } - logerror("%s: MSM6242 unmapped offset %02x written with %02x\n", device->machine->describe_context(), offset, data); + logerror("%s: MSM6242 unmapped offset %02x written with %02x\n", device->machine().describe_context(), offset, data); } diff --git a/src/emu/machine/nmc9306.c b/src/emu/machine/nmc9306.c index 2ea9c963365..71ded4d32ad 100644 --- a/src/emu/machine/nmc9306.c +++ b/src/emu/machine/nmc9306.c @@ -93,7 +93,7 @@ device_config *nmc9306_device_config::static_alloc_device_config(const machine_c device_t *nmc9306_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, nmc9306_device(machine, *this)); + return auto_alloc(machine, nmc9306_device(machine, *this)); } diff --git a/src/emu/machine/nvram.c b/src/emu/machine/nvram.c index 33894e7a6a3..58e174a0d92 100644 --- a/src/emu/machine/nvram.c +++ b/src/emu/machine/nvram.c @@ -83,7 +83,7 @@ device_config *nvram_device_config::static_alloc_device_config(const machine_con device_t *nvram_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, nvram_device(machine, *this)); + return auto_alloc(machine, nvram_device(machine, *this)); } diff --git a/src/emu/machine/pc16552d.c b/src/emu/machine/pc16552d.c index 3b9888d040b..4595d48a85f 100644 --- a/src/emu/machine/pc16552d.c +++ b/src/emu/machine/pc16552d.c @@ -54,7 +54,7 @@ typedef struct { PC16552D_CHANNEL ch[2]; int frequency; - void (* irq_handler)(running_machine *machine, int channel, int value); + void (* irq_handler)(running_machine &machine, int channel, int value); void (* tx_callback)(int channel, int count, UINT8* data); } PC16552D_REGS; @@ -67,7 +67,7 @@ static PC16552D_REGS duart[MAX_PC16552D_CHIPS]; static const int rx_trigger_level[4] = { 1, 4, 8, 14 }; -static void check_interrupts(running_machine *machine, int chip, int channel) +static void check_interrupts(running_machine &machine, int chip, int channel) { PC16552D_CHANNEL *ch = &duart[chip].ch[channel]; int signal = 0; @@ -89,7 +89,7 @@ static void check_interrupts(running_machine *machine, int chip, int channel) } } -static void duart_push_rx_fifo(running_machine *machine, int chip, int channel, UINT8 data) +static void duart_push_rx_fifo(running_machine &machine, int chip, int channel, UINT8 data) { PC16552D_CHANNEL *ch = &duart[chip].ch[channel]; @@ -114,7 +114,7 @@ static void duart_push_rx_fifo(running_machine *machine, int chip, int channel, } } -static UINT8 duart_pop_rx_fifo(running_machine *machine, int chip, int channel) +static UINT8 duart_pop_rx_fifo(running_machine &machine, int chip, int channel) { UINT8 r; PC16552D_CHANNEL *ch = &duart[chip].ch[channel]; @@ -183,7 +183,7 @@ static UINT8 duart_pop_tx_fifo(int chip, int channel, UINT8 data) #endif -static UINT8 duart_r(running_machine *machine, int chip, int reg) +static UINT8 duart_r(running_machine &machine, int chip, int reg) { int channel = (reg >> 3) & 1; PC16552D_CHANNEL *ch = &duart[chip].ch[channel]; @@ -291,7 +291,7 @@ static UINT8 duart_r(running_machine *machine, int chip, int reg) return ch->reg[reg]; } -static void duart_w(running_machine *machine, int chip, int reg, UINT8 data) +static void duart_w(running_machine &machine, int chip, int reg, UINT8 data) { int channel = (reg >> 3) & 1; PC16552D_CHANNEL *ch = &duart[chip].ch[channel]; @@ -387,7 +387,7 @@ static void duart_w(running_machine *machine, int chip, int reg, UINT8 data) /*****************************************************************************/ -void pc16552d_init(running_machine *machine, int chip, int frequency, void (* irq_handler)(running_machine *machine, int channel, int value), void (* tx_callback)(int channel, int count, UINT8* data)) +void pc16552d_init(running_machine &machine, int chip, int frequency, void (* irq_handler)(running_machine &machine, int channel, int value), void (* tx_callback)(int channel, int count, UINT8* data)) { memset(&duart[chip], 0, sizeof(PC16552D_REGS)); @@ -400,14 +400,14 @@ void pc16552d_init(running_machine *machine, int chip, int frequency, void (* ir duart[chip].ch[1].pending_interrupt = 0; // allocate transmit timers - duart[chip].ch[0].tx_fifo_timer = machine->scheduler().timer_alloc(FUNC(tx_fifo_timer_callback)); + duart[chip].ch[0].tx_fifo_timer = machine.scheduler().timer_alloc(FUNC(tx_fifo_timer_callback)); duart[chip].ch[0].tx_fifo_timer->adjust(attotime::never, (chip * 2) + 0); - duart[chip].ch[1].tx_fifo_timer = machine->scheduler().timer_alloc(FUNC(tx_fifo_timer_callback)); + duart[chip].ch[1].tx_fifo_timer = machine.scheduler().timer_alloc(FUNC(tx_fifo_timer_callback)); duart[chip].ch[1].tx_fifo_timer->adjust(attotime::never, (chip * 2) + 1); } -void pc16552d_rx_data(running_machine *machine, int chip, int channel, UINT8 data) +void pc16552d_rx_data(running_machine &machine, int chip, int channel, UINT8 data) { if (duart[chip].ch[channel].reg[REG_FIFO_CTRL] & 0x01) // RCVR & XMIT FIFO enable { @@ -420,20 +420,20 @@ void pc16552d_rx_data(running_machine *machine, int chip, int channel, UINT8 dat READ8_HANDLER(pc16552d_0_r) { - return duart_r(space->machine, 0, offset); + return duart_r(space->machine(), 0, offset); } WRITE8_HANDLER(pc16552d_0_w) { - duart_w(space->machine, 0, offset, data); + duart_w(space->machine(), 0, offset, data); } READ8_HANDLER(pc16552d_1_r) { - return duart_r(space->machine, 1, offset); + return duart_r(space->machine(), 1, offset); } WRITE8_HANDLER(pc16552d_1_w) { - duart_w(space->machine, 1, offset, data); + duart_w(space->machine(), 1, offset, data); } diff --git a/src/emu/machine/pc16552d.h b/src/emu/machine/pc16552d.h index 58133ccc24e..93f2181e37a 100644 --- a/src/emu/machine/pc16552d.h +++ b/src/emu/machine/pc16552d.h @@ -1,8 +1,8 @@ #ifndef PC16552D_H #define PC16552D_H -void pc16552d_init(running_machine *machine, int chip, int frequency, void (* irq_handler)(running_machine *machine, int channel, int value), void (* tx_callback)(int channel, int count, UINT8* data)); -void pc16552d_rx_data(running_machine *machine, int chip, int channel, UINT8 data); +void pc16552d_init(running_machine &machine, int chip, int frequency, void (* irq_handler)(running_machine &machine, int channel, int value), void (* tx_callback)(int channel, int count, UINT8* data)); +void pc16552d_rx_data(running_machine &machine, int chip, int channel, UINT8 data); READ8_HANDLER(pc16552d_0_r); WRITE8_HANDLER(pc16552d_0_w); diff --git a/src/emu/machine/pci.c b/src/emu/machine/pci.c index 090e2fe1d85..ba21473d61e 100644 --- a/src/emu/machine/pci.c +++ b/src/emu/machine/pci.c @@ -222,10 +222,10 @@ READ64_DEVICE_HANDLER(pci_64be_r) { return read64be_with_32le_device_handler(pci WRITE64_DEVICE_HANDLER(pci_64be_w) { write64be_with_32le_device_handler(pci_32le_w, device, offset, data, mem_mask); } -int pci_add_sibling( running_machine *machine, char *pcitag, char *sibling ) +int pci_add_sibling( running_machine &machine, char *pcitag, char *sibling ) { - device_t *device1 = machine->device(pcitag); - device_t *device2 = machine->device(sibling); + device_t *device1 = machine.device(pcitag); + device_t *device2 = machine.device(sibling); pci_bus_state *pcibus1 = get_safe_token(device1); pci_bus_state *pcibus2 = get_safe_token(device2); pci_bus_config *config2; @@ -271,7 +271,6 @@ static DEVICE_START( pci_bus ) assert(device != NULL); assert(device->baseconfig().static_config() == NULL); assert(downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config() != NULL); - assert(device->machine != NULL); /* store a pointer back to the device */ pcibus->config = (const pci_bus_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config(); @@ -281,17 +280,17 @@ static DEVICE_START( pci_bus ) /* find all our devices */ for (devicenum = 0; devicenum < ARRAY_LENGTH(pcibus->device); devicenum++) if (pcibus->config->device[devicenum].devtag != NULL) - pcibus->device[devicenum] = device->machine->device(pcibus->config->device[devicenum].devtag); + pcibus->device[devicenum] = device->machine().device(pcibus->config->device[devicenum].devtag); if (pcibus->config->father != NULL) - pci_add_sibling(device->machine, (char *)pcibus->config->father, (char *)device->tag()); + pci_add_sibling(device->machine(), (char *)pcibus->config->father, (char *)device->tag()); /* register pci states */ device->save_item(NAME(pcibus->address)); device->save_item(NAME(pcibus->devicenum)); device->save_item(NAME(pcibus->busnum)); - device->machine->state().register_postload(pci_bus_postload, pcibus); + device->machine().state().register_postload(pci_bus_postload, pcibus); } diff --git a/src/emu/machine/pci.h b/src/emu/machine/pci.h index b88e3f1aa1f..c61fcb709ba 100644 --- a/src/emu/machine/pci.h +++ b/src/emu/machine/pci.h @@ -64,7 +64,7 @@ WRITE32_DEVICE_HANDLER( pci_32le_w ); READ64_DEVICE_HANDLER( pci_64be_r ); WRITE64_DEVICE_HANDLER( pci_64be_w ); -int pci_add_sibling( running_machine *machine, char *pcitag, char *sibling ); +int pci_add_sibling( running_machine &machine, char *pcitag, char *sibling ); /* ----- device interface ----- */ diff --git a/src/emu/machine/pckeybrd.h b/src/emu/machine/pckeybrd.h index a5c21b025ab..ed1f4c4439a 100644 --- a/src/emu/machine/pckeybrd.h +++ b/src/emu/machine/pckeybrd.h @@ -19,12 +19,12 @@ typedef enum AT_KEYBOARD_TYPE_MF2 } AT_KEYBOARD_TYPE; -void at_keyboard_init(running_machine *machine, AT_KEYBOARD_TYPE type); +void at_keyboard_init(running_machine &machine, AT_KEYBOARD_TYPE type); void at_keyboard_polling(void); int at_keyboard_read(void); -void at_keyboard_write(running_machine *machine, UINT8 data); -void at_keyboard_reset(running_machine *machine); +void at_keyboard_write(running_machine &machine, UINT8 data); +void at_keyboard_reset(running_machine &machine); void at_keyboard_set_scan_code_set(int set); INPUT_PORTS_EXTERN( pc_keyboard ); diff --git a/src/emu/machine/pcshare.h b/src/emu/machine/pcshare.h index 3b8f1f57eae..a746f7a1982 100644 --- a/src/emu/machine/pcshare.h +++ b/src/emu/machine/pcshare.h @@ -2,7 +2,7 @@ #define PCCOMMON_KEYBOARD_PC 0 #define PCCOMMON_KEYBOARD_AT 1 -void init_pc_common(running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(running_machine *, int)); +void init_pc_common(running_machine &machine, UINT32 flags, void (*set_keyb_int_func)(running_machine &, int)); void pc_keyboard(void); UINT8 pc_keyb_read(void); diff --git a/src/emu/machine/pd4990a.c b/src/emu/machine/pd4990a.c index 7c41e867f04..86c928cea15 100644 --- a/src/emu/machine/pd4990a.c +++ b/src/emu/machine/pd4990a.c @@ -449,7 +449,7 @@ static DEVICE_START( upd4990a ) upd4990a_state *upd4990a = get_safe_token(device); system_time curtime, *systime = &curtime; - device->machine->current_datetime(curtime); + device->machine().current_datetime(curtime); #if 0 upd4990a->seconds = 0x00; diff --git a/src/emu/machine/pic8259.c b/src/emu/machine/pic8259.c index 36e2b87e1b6..dd8e59cb952 100644 --- a/src/emu/machine/pic8259.c +++ b/src/emu/machine/pic8259.c @@ -406,7 +406,7 @@ static DEVICE_START( pic8259 ) assert(intf != NULL); - pic8259->timer = device->machine->scheduler().timer_alloc( FUNC(pic8259_timerproc), (void *)device ); + pic8259->timer = device->machine().scheduler().timer_alloc( FUNC(pic8259_timerproc), (void *)device ); /* resolve callbacks */ devcb_resolve_write_line(&pic8259->out_int_func, &intf->out_int_func, device); diff --git a/src/emu/machine/pit8253.c b/src/emu/machine/pit8253.c index abb85c08387..1781aae3a44 100644 --- a/src/emu/machine/pit8253.c +++ b/src/emu/machine/pit8253.c @@ -614,7 +614,7 @@ static void simulate2(device_t *device, struct pit8253_timer *timer, INT64 elaps { attotime next_fire_time = timer->last_updated + cycles_to_output * attotime::from_hz( timer->clockin ); - timer->updatetimer->adjust(next_fire_time - device->machine->time(), timer->index ); + timer->updatetimer->adjust(next_fire_time - device->machine().time(), timer->index ); } LOG2(("pit8253: simulate2(): simulating %d cycles for %d in mode %d, bcd = %d, phase = %d, gate = %d, output %d, value = 0x%04x, cycles_to_output = %04x\n", @@ -654,7 +654,7 @@ static void update(device_t *device, struct pit8253_timer *timer) { /* With the 82C54's maximum clockin of 10MHz, 64 bits is nearly 60,000 years of time. Should be enough for now. */ - attotime now = device->machine->time(); + attotime now = device->machine().time(); attotime elapsed_time = now - timer->last_updated; INT64 elapsed_cycles = elapsed_time.as_double() * timer->clockin; @@ -916,7 +916,7 @@ WRITE8_DEVICE_HANDLER( pit8253_w ) update(device, timer); - if ( device->machine->time() > timer->last_updated && timer->clockin != 0 ) + if ( device->machine().time() > timer->last_updated && timer->clockin != 0 ) { middle_of_a_cycle = 1; } @@ -1081,7 +1081,7 @@ static void common_start( device_t *device, int device_type ) { /* initialize timer */ timer->clockin = pit8253->config->timer[timerno].clockin; - timer->updatetimer = device->machine->scheduler().timer_alloc(FUNC(update_timer_cb), (void *)device); + timer->updatetimer = device->machine().scheduler().timer_alloc(FUNC(update_timer_cb), (void *)device); timer->updatetimer->adjust(attotime::never, timerno); /* resolve callbacks */ @@ -1148,7 +1148,7 @@ static DEVICE_RESET( pit8253 ) { timer->null_count = 1; timer->cycles_to_output = CYCLES_NEVER; - timer->last_updated = device->machine->time(); + timer->last_updated = device->machine().time(); update(device, timer); } diff --git a/src/emu/machine/ram.c b/src/emu/machine/ram.c index 7a08d377fd0..dee4fa83c4e 100644 --- a/src/emu/machine/ram.c +++ b/src/emu/machine/ram.c @@ -100,7 +100,7 @@ static DEVICE_START( ram ) /* the device named 'ram' can get ram options from command line */ if (strcmp(device->tag(), RAM_TAG) == 0) { - const char *ramsize_string = device->machine->options().ram_size(); + const char *ramsize_string = device->machine().options().ram_size(); if ((ramsize_string != NULL) && (ramsize_string[0] != '\0')) ram->size = ram_parse_string(ramsize_string); @@ -111,7 +111,7 @@ static DEVICE_START( ram ) ram->size = ram_parse_string(config->default_size); /* allocate space for the ram */ - ram->ram = auto_alloc_array(device->machine, UINT8, ram->size); + ram->ram = auto_alloc_array(device->machine(), UINT8, ram->size); /* reset ram to the default value */ memset(ram->ram, config->default_value, ram->size); diff --git a/src/emu/machine/rtc65271.c b/src/emu/machine/rtc65271.c index 3ed46197e8b..502826c90e9 100644 --- a/src/emu/machine/rtc65271.c +++ b/src/emu/machine/rtc65271.c @@ -236,7 +236,7 @@ static int rtc65271_file_load(device_t *device, emu_file &file) system_time systime; /* get the current date/time from the core */ - device->machine->current_datetime(systime); + device->machine().current_datetime(systime); /* set clock registers */ state->regs[reg_second] = systime.local_time.second; @@ -522,7 +522,7 @@ static TIMER_CALLBACK( rtc_begin_update_callback ) state->regs[reg_A] |= reg_A_UIP; /* schedule end of update cycle */ - device->machine->scheduler().timer_set(UPDATE_CYCLE_TIME, FUNC(rtc_end_update_callback), 0, (void *)device); + device->machine().scheduler().timer_set(UPDATE_CYCLE_TIME, FUNC(rtc_end_update_callback), 0, (void *)device); } } @@ -688,9 +688,9 @@ static DEVICE_START( rtc65271 ) rtc65271_config *config = (rtc65271_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config(); rtc65271_state *state = get_safe_token(device); - state->update_timer = device->machine->scheduler().timer_alloc(FUNC(rtc_begin_update_callback), (void *)device); + state->update_timer = device->machine().scheduler().timer_alloc(FUNC(rtc_begin_update_callback), (void *)device); state->update_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); - state->SQW_timer = device->machine->scheduler().timer_alloc(FUNC(rtc_SQW_callback), (void *)device); + state->SQW_timer = device->machine().scheduler().timer_alloc(FUNC(rtc_SQW_callback), (void *)device); state->interrupt_callback = config->interrupt_callback; device->save_item(NAME(state->regs)); diff --git a/src/emu/machine/s3c2400.c b/src/emu/machine/s3c2400.c index ed330f124cd..0b969b191cb 100644 --- a/src/emu/machine/s3c2400.c +++ b/src/emu/machine/s3c2400.c @@ -14,7 +14,7 @@ #define VERBOSE_LEVEL ( 0 ) -INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, const char *s_fmt, ...) +INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ...) { if (VERBOSE_LEVEL >= n_level) { @@ -23,7 +23,7 @@ INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, va_start( v, s_fmt); vsprintf( buf, s_fmt, v); va_end( v); - logerror( "%s: %s", machine->describe_context( ), buf); + logerror( "%s: %s", machine.describe_context( ), buf); } } @@ -33,19 +33,19 @@ INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, VIDEO_START( s3c2400 ) { - device_t *device = machine->device( S3C2400_TAG); + device_t *device = machine.device( S3C2400_TAG); s3c24xx_video_start( device, machine); } SCREEN_UPDATE( s3c2400 ) { - device_t *device = screen->machine->device( S3C2400_TAG); + device_t *device = screen->machine().device( S3C2400_TAG); return s3c24xx_video_update( device, screen, bitmap, cliprect); } DEVICE_START( s3c2400 ) { - address_space *space = device->machine->device( "maincpu")->memory().space( AS_PROGRAM); + address_space *space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); DEVICE_START_CALL(s3c24xx); space->install_legacy_readwrite_handler( *device, 0x14000000, 0x1400003b, FUNC(s3c24xx_memcon_r), FUNC(s3c24xx_memcon_w)); space->install_legacy_readwrite_handler( *device, 0x14200000, 0x1420005b, FUNC(s3c24xx_usb_host_r), FUNC(s3c24xx_usb_host_w)); diff --git a/src/emu/machine/s3c2410.c b/src/emu/machine/s3c2410.c index 498020ecda3..9dee05b1fbf 100644 --- a/src/emu/machine/s3c2410.c +++ b/src/emu/machine/s3c2410.c @@ -14,7 +14,7 @@ #define VERBOSE_LEVEL ( 0 ) -INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, const char *s_fmt, ...) +INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ...) { if (VERBOSE_LEVEL >= n_level) { @@ -23,7 +23,7 @@ INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, va_start( v, s_fmt); vsprintf( buf, s_fmt, v); va_end( v); - logerror( "%s: %s", machine->describe_context( ), buf); + logerror( "%s: %s", machine.describe_context( ), buf); } } @@ -33,19 +33,19 @@ INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, VIDEO_START( s3c2410 ) { - device_t *device = machine->device( S3C2410_TAG); + device_t *device = machine.device( S3C2410_TAG); s3c24xx_video_start( device, machine); } SCREEN_UPDATE( s3c2410 ) { - device_t *device = screen->machine->device( S3C2410_TAG); + device_t *device = screen->machine().device( S3C2410_TAG); return s3c24xx_video_update( device, screen, bitmap, cliprect); } DEVICE_START( s3c2410 ) { - address_space *space = device->machine->device( "maincpu")->memory().space( AS_PROGRAM); + address_space *space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); DEVICE_START_CALL(s3c24xx); space->install_legacy_readwrite_handler( *device, 0x48000000, 0x4800003b, FUNC(s3c24xx_memcon_r), FUNC(s3c24xx_memcon_w)); space->install_legacy_readwrite_handler( *device, 0x49000000, 0x4900005b, FUNC(s3c24xx_usb_host_r), FUNC(s3c24xx_usb_host_w)); diff --git a/src/emu/machine/s3c2440.c b/src/emu/machine/s3c2440.c index 359eb41d5bc..445053926ed 100644 --- a/src/emu/machine/s3c2440.c +++ b/src/emu/machine/s3c2440.c @@ -14,7 +14,7 @@ #define VERBOSE_LEVEL ( 0 ) -INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, const char *s_fmt, ...) +INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ...) { if (VERBOSE_LEVEL >= n_level) { @@ -23,7 +23,7 @@ INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, va_start( v, s_fmt); vsprintf( buf, s_fmt, v); va_end( v); - logerror( "%s: %s", machine->describe_context( ), buf); + logerror( "%s: %s", machine.describe_context( ), buf); } } @@ -33,19 +33,19 @@ INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, VIDEO_START( s3c2440 ) { - device_t *device = machine->device( S3C2440_TAG); + device_t *device = machine.device( S3C2440_TAG); s3c24xx_video_start( device, machine); } SCREEN_UPDATE( s3c2440 ) { - device_t *device = screen->machine->device( S3C2440_TAG); + device_t *device = screen->machine().device( S3C2440_TAG); return s3c24xx_video_update( device, screen, bitmap, cliprect); } DEVICE_START( s3c2440 ) { - address_space *space = device->machine->device( "maincpu")->memory().space( AS_PROGRAM); + address_space *space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); space->install_legacy_readwrite_handler( *device, 0x48000000, 0x4800003b, FUNC(s3c24xx_memcon_r), FUNC(s3c24xx_memcon_w)); space->install_legacy_readwrite_handler( *device, 0x49000000, 0x4900005b, FUNC(s3c24xx_usb_host_r), FUNC(s3c24xx_usb_host_w)); space->install_legacy_readwrite_handler( *device, 0x4a000000, 0x4a00001f, FUNC(s3c24xx_irq_r), FUNC(s3c24xx_irq_w)); diff --git a/src/emu/machine/s3c24xx.c b/src/emu/machine/s3c24xx.c index 6ec6e637426..fcd4ac80a95 100644 --- a/src/emu/machine/s3c24xx.c +++ b/src/emu/machine/s3c24xx.c @@ -225,7 +225,7 @@ static void s3c24xx_lcd_dma_reload( device_t *device) s3c24xx->lcd.offsize = BITS( s3c24xx->lcd.regs.lcdsaddr3, 21, 11); s3c24xx->lcd.pagewidth_cur = 0; s3c24xx->lcd.pagewidth_max = BITS( s3c24xx->lcd.regs.lcdsaddr3, 10, 0); - verboselog( device->machine, 3, "LCD - vramaddr %08X %08X offsize %08X pagewidth %08X\n", s3c24xx->lcd.vramaddr_cur, s3c24xx->lcd.vramaddr_max, s3c24xx->lcd.offsize, s3c24xx->lcd.pagewidth_max); + verboselog( device->machine(), 3, "LCD - vramaddr %08X %08X offsize %08X pagewidth %08X\n", s3c24xx->lcd.vramaddr_cur, s3c24xx->lcd.vramaddr_max, s3c24xx->lcd.offsize, s3c24xx->lcd.pagewidth_max); s3c24xx->lcd.dma_data = 0; s3c24xx->lcd.dma_bits = 0; } @@ -238,7 +238,7 @@ static void s3c24xx_lcd_dma_init( device_t *device) s3c24xx->lcd.bswp = BIT( s3c24xx->lcd.regs.lcdcon5, 1); s3c24xx->lcd.hwswp = BIT( s3c24xx->lcd.regs.lcdcon5, 0); s3c24xx->lcd.tpal = s3c24xx->lcd.regs.tpal; - verboselog( device->machine, 3, "LCD - bppmode %d hwswp %d bswp %d\n", s3c24xx->lcd.bppmode, s3c24xx->lcd.hwswp, s3c24xx->lcd.bswp); + verboselog( device->machine(), 3, "LCD - bppmode %d hwswp %d bswp %d\n", s3c24xx->lcd.bppmode, s3c24xx->lcd.hwswp, s3c24xx->lcd.bswp); s3c24xx->lcd.dma_data = 0; s3c24xx->lcd.dma_bits = 0; } @@ -247,7 +247,7 @@ static void s3c24xx_lcd_dma_init( device_t *device) static UINT32 s3c24xx_lcd_dma_read( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - address_space* space = device->machine->device( "maincpu")->memory().space( AS_PROGRAM); + address_space* space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); UINT8 *vram, data[4]; vram = (UINT8 *)space->get_read_ptr( s3c24xx->lcd.vramaddr_cur); for (int i = 0; i < 2; i++) @@ -291,7 +291,7 @@ static UINT32 s3c24xx_lcd_dma_read( device_t *device) static UINT32 s3c24xx_lcd_dma_read( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - address_space* space = device->machine->device( "maincpu")->memory().space( AS_PROGRAM); + address_space* space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); UINT8 *vram, data[4]; vram = (UINT8 *)space->get_read_ptr( s3c24xx->lcd.vramaddr_cur); for (int i = 0; i < 2; i++) @@ -570,7 +570,7 @@ static void s3c24xx_lcd_render_tft_01( device_t *device) UINT32 data = s3c24xx_lcd_dma_read( device); for (int j = 0; j < 32; j++) { - *scanline++ = palette_get_color( device->machine, (data >> 31) & 0x01); + *scanline++ = palette_get_color( device->machine(), (data >> 31) & 0x01); data = data << 1; s3c24xx->lcd.hpos++; if (s3c24xx->lcd.hpos >= s3c24xx->lcd.hpos_min + (s3c24xx->lcd.pagewidth_max << 4)) @@ -594,7 +594,7 @@ static void s3c24xx_lcd_render_tft_02( device_t *device) UINT32 data = s3c24xx_lcd_dma_read( device); for (int j = 0; j < 16; j++) { - *scanline++ = palette_get_color( device->machine, (data >> 30) & 0x03); + *scanline++ = palette_get_color( device->machine(), (data >> 30) & 0x03); data = data << 2; s3c24xx->lcd.hpos++; if (s3c24xx->lcd.hpos >= s3c24xx->lcd.hpos_min + (s3c24xx->lcd.pagewidth_max << 3)) @@ -618,7 +618,7 @@ static void s3c24xx_lcd_render_tft_04( device_t *device) UINT32 data = s3c24xx_lcd_dma_read( device); for (int j = 0; j < 8; j++) { - *scanline++ = palette_get_color( device->machine, (data >> 28) & 0x0F); + *scanline++ = palette_get_color( device->machine(), (data >> 28) & 0x0F); data = data << 4; s3c24xx->lcd.hpos++; if (s3c24xx->lcd.hpos >= s3c24xx->lcd.hpos_min + (s3c24xx->lcd.pagewidth_max << 2)) @@ -642,7 +642,7 @@ static void s3c24xx_lcd_render_tft_08( device_t *device) UINT32 data = s3c24xx_lcd_dma_read( device); for (int j = 0; j < 4; j++) { - *scanline++ = palette_get_color( device->machine, (data >> 24) & 0xFF); + *scanline++ = palette_get_color( device->machine(), (data >> 24) & 0xFF); data = data << 8; s3c24xx->lcd.hpos++; if (s3c24xx->lcd.hpos >= s3c24xx->lcd.hpos_min + (s3c24xx->lcd.pagewidth_max << 1)) @@ -684,7 +684,7 @@ static TIMER_CALLBACK( s3c24xx_lcd_timer_exp ) { device_t *device = (device_t *)ptr; s3c24xx_t *s3c24xx = get_token( device); - screen_device *screen = machine->primary_screen; + screen_device *screen = machine.primary_screen; UINT32 tpalen; verboselog( machine, 2, "LCD timer callback\n"); s3c24xx->lcd.vpos = screen->vpos(); @@ -725,10 +725,10 @@ static TIMER_CALLBACK( s3c24xx_lcd_timer_exp ) s3c24xx->lcd.timer->adjust( screen->time_until_pos( s3c24xx->lcd.vpos, s3c24xx->lcd.hpos)); } -static void s3c24xx_video_start( device_t *device, running_machine *machine) +static void s3c24xx_video_start( device_t *device, running_machine &machine) { s3c24xx_t *s3c24xx = get_token( device); - screen_device *screen = machine->primary_screen; + screen_device *screen = machine.primary_screen; s3c24xx->lcd.bitmap[0] = screen->alloc_compatible_bitmap(); s3c24xx->lcd.bitmap[1] = screen->alloc_compatible_bitmap(); } @@ -789,7 +789,7 @@ READ32_DEVICE_HANDLER( s3c2440_lcd_r ) case S3C24XX_LCDCON1 : { // make sure line counter is going - UINT32 vpos = device->machine->primary_screen->vpos(); + UINT32 vpos = device->machine().primary_screen->vpos(); if (vpos < s3c24xx->lcd.vpos_min) vpos = s3c24xx->lcd.vpos_min; if (vpos > s3c24xx->lcd.vpos_max) vpos = s3c24xx->lcd.vpos_max; data = (data & ~0xFFFC0000) | ((s3c24xx->lcd.vpos_max - vpos) << 18); @@ -797,7 +797,7 @@ READ32_DEVICE_HANDLER( s3c2440_lcd_r ) break; case S3C24XX_LCDCON5 : { - UINT32 vpos = device->machine->primary_screen->vpos(); + UINT32 vpos = device->machine().primary_screen->vpos(); data = data & ~0x00018000; if (vpos < s3c24xx->lcd.vpos_min) data = data | 0x00000000; if (vpos > s3c24xx->lcd.vpos_max) data = data | 0x00018000; @@ -805,19 +805,19 @@ READ32_DEVICE_HANDLER( s3c2440_lcd_r ) } break; } - verboselog( device->machine, 9, "(LCD) %08X -> %08X\n", S3C24XX_BASE_LCD + (offset << 2), data); + verboselog( device->machine(), 9, "(LCD) %08X -> %08X\n", S3C24XX_BASE_LCD + (offset << 2), data); return data; } static void s3c24xx_lcd_configure_tft( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - screen_device *screen = device->machine->primary_screen; + screen_device *screen = device->machine().primary_screen; UINT32 vspw, vbpd, lineval, vfpd, hspw, hbpd, hfpd, hozval, clkval, hclk; double framerate, vclk; UINT32 width, height; rectangle visarea; - verboselog( device->machine, 5, "s3c24xx_lcd_configure_tft\n"); + verboselog( device->machine(), 5, "s3c24xx_lcd_configure_tft\n"); vspw = BITS( s3c24xx->lcd.regs.lcdcon2, 5, 0); vbpd = BITS( s3c24xx->lcd.regs.lcdcon2, 31, 24); lineval = BITS( s3c24xx->lcd.regs.lcdcon2, 23, 14); @@ -828,11 +828,11 @@ static void s3c24xx_lcd_configure_tft( device_t *device) hozval = BITS( s3c24xx->lcd.regs.lcdcon3, 18, 8); clkval = BITS( s3c24xx->lcd.regs.lcdcon1, 17, 8); hclk = s3c24xx_get_hclk( device); - verboselog( device->machine, 3, "LCD - vspw %d vbpd %d lineval %d vfpd %d hspw %d hbpd %d hfpd %d hozval %d clkval %d hclk %d\n", vspw, vbpd, lineval, vfpd, hspw, hbpd, hfpd, hozval, clkval, hclk); + verboselog( device->machine(), 3, "LCD - vspw %d vbpd %d lineval %d vfpd %d hspw %d hbpd %d hfpd %d hozval %d clkval %d hclk %d\n", vspw, vbpd, lineval, vfpd, hspw, hbpd, hfpd, hozval, clkval, hclk); vclk = (double)(hclk / ((clkval + 1) * 2)); - verboselog( device->machine, 3, "LCD - vclk %f\n", vclk); + verboselog( device->machine(), 3, "LCD - vclk %f\n", vclk); framerate = vclk / (((vspw + 1) + (vbpd + 1) + (lineval + 1) + (vfpd + 1)) * ((hspw + 1) + (hbpd + 1) + (hozval + 1) + (hfpd + 1))); - verboselog( device->machine, 3, "LCD - framerate %f\n", framerate); + verboselog( device->machine(), 3, "LCD - framerate %f\n", framerate); s3c24xx->lcd.framerate = framerate; width = (hspw + 1) + (hbpd + 1) + (hozval + 1) + (hfpd + 1); height = (vspw + 1) + (vbpd + 1) + (lineval + 1) + (vfpd + 1); @@ -840,8 +840,8 @@ static void s3c24xx_lcd_configure_tft( device_t *device) visarea.min_y = (vspw + 1) + (vbpd + 1); visarea.max_x = visarea.min_x + (hozval + 1) - 1; visarea.max_y = visarea.min_y + (lineval + 1) - 1; - verboselog( device->machine, 3, "LCD - visarea min_x %d min_y %d max_x %d max_y %d\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y); - verboselog( device->machine, 3, "video_screen_configure %d %d %f\n", width, height, s3c24xx->lcd.framerate); + verboselog( device->machine(), 3, "LCD - visarea min_x %d min_y %d max_x %d max_y %d\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y); + verboselog( device->machine(), 3, "video_screen_configure %d %d %f\n", width, height, s3c24xx->lcd.framerate); s3c24xx->lcd.hpos_min = (hspw + 1) + (hbpd + 1); s3c24xx->lcd.hpos_max = s3c24xx->lcd.hpos_min + (hozval + 1) - 1; s3c24xx->lcd.vpos_min = (vspw + 1) + (vbpd + 1); @@ -852,12 +852,12 @@ static void s3c24xx_lcd_configure_tft( device_t *device) static void s3c24xx_lcd_configure_stn( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - screen_device *screen = device->machine->primary_screen; + screen_device *screen = device->machine().primary_screen; UINT32 pnrmode, bppmode, clkval, lineval, wdly, hozval, lineblank, wlh, hclk; double vclk, framerate; UINT32 width, height; rectangle visarea; - verboselog( device->machine, 5, "s3c24xx_lcd_configure_stn\n"); + verboselog( device->machine(), 5, "s3c24xx_lcd_configure_stn\n"); pnrmode = BITS( s3c24xx->lcd.regs.lcdcon1, 6, 5); bppmode = BITS( s3c24xx->lcd.regs.lcdcon1, 4, 1); clkval = BITS( s3c24xx->lcd.regs.lcdcon1, 17, 8); @@ -867,11 +867,11 @@ static void s3c24xx_lcd_configure_stn( device_t *device) lineblank = BITS( s3c24xx->lcd.regs.lcdcon3, 7, 0); wlh = BITS( s3c24xx->lcd.regs.lcdcon4, 1, 0); hclk = s3c24xx_get_hclk( device); - verboselog( device->machine, 3, "LCD - pnrmode %d bppmode %d clkval %d lineval %d wdly %d hozval %d lineblank %d wlh %d hclk %d\n", pnrmode, bppmode, clkval, lineval, wdly, hozval, lineblank, wlh, hclk); + verboselog( device->machine(), 3, "LCD - pnrmode %d bppmode %d clkval %d lineval %d wdly %d hozval %d lineblank %d wlh %d hclk %d\n", pnrmode, bppmode, clkval, lineval, wdly, hozval, lineblank, wlh, hclk); vclk = (double)(hclk / ((clkval + 0) * 2)); - verboselog( device->machine, 3, "LCD - vclk %f\n", vclk); + verboselog( device->machine(), 3, "LCD - vclk %f\n", vclk); framerate = 1 / (((1 / vclk) * (hozval + 1) + (1 / hclk) * ((1 << (4 + wlh)) + (1 << (4 + wdly)) + (lineblank * 8))) * (lineval + 1)); - verboselog( device->machine, 3, "LCD - framerate %f\n", framerate); + verboselog( device->machine(), 3, "LCD - framerate %f\n", framerate); switch (pnrmode) { case S3C24XX_PNRMODE_STN_04_SS : width = ((hozval + 1) * 4); break; @@ -885,8 +885,8 @@ static void s3c24xx_lcd_configure_stn( device_t *device) visarea.min_y = 0; visarea.max_x = width - 1; visarea.max_y = height - 1; - verboselog( device->machine, 3, "LCD - visarea min_x %d min_y %d max_x %d max_y %d\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y); - verboselog( device->machine, 3, "video_screen_configure %d %d %f\n", width, height, s3c24xx->lcd.framerate); + verboselog( device->machine(), 3, "LCD - visarea min_x %d min_y %d max_x %d max_y %d\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y); + verboselog( device->machine(), 3, "video_screen_configure %d %d %f\n", width, height, s3c24xx->lcd.framerate); s3c24xx->lcd.hpos_min = 0; s3c24xx->lcd.hpos_max = width - 1; s3c24xx->lcd.vpos_min = 0; @@ -898,7 +898,7 @@ static void s3c24xx_lcd_configure( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); UINT32 bppmode; - verboselog( device->machine, 5, "s3c24xx_lcd_configure\n"); + verboselog( device->machine(), 5, "s3c24xx_lcd_configure\n"); bppmode = BITS( s3c24xx->lcd.regs.lcdcon1, 4, 1); if ((bppmode & (1 << 3)) == 0) { @@ -913,8 +913,8 @@ static void s3c24xx_lcd_configure( device_t *device) static void s3c24xx_lcd_start( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - screen_device *screen = device->machine->primary_screen; - verboselog( device->machine, 1, "LCD start\n"); + screen_device *screen = device->machine().primary_screen; + verboselog( device->machine(), 1, "LCD start\n"); s3c24xx_lcd_configure( device); s3c24xx_lcd_dma_init( device); s3c24xx->lcd.timer->adjust( screen->time_until_pos( s3c24xx->lcd.vpos_min, s3c24xx->lcd.hpos_min)); @@ -923,7 +923,7 @@ static void s3c24xx_lcd_start( device_t *device) static void s3c24xx_lcd_stop( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 1, "LCD stop\n"); + verboselog( device->machine(), 1, "LCD stop\n"); s3c24xx->lcd.timer->adjust( attotime::never); } @@ -944,7 +944,7 @@ static WRITE32_DEVICE_HANDLER( s3c24xx_lcd_w ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 old_value = ((UINT32*)&s3c24xx->lcd.regs)[offset]; - verboselog( device->machine, 9, "(LCD) %08X <- %08X\n", S3C24XX_BASE_LCD + (offset << 2), data); + verboselog( device->machine(), 9, "(LCD) %08X <- %08X\n", S3C24XX_BASE_LCD + (offset << 2), data); COMBINE_DATA(&((UINT32*)&s3c24xx->lcd.regs)[offset]); switch (offset) { @@ -965,20 +965,20 @@ static READ32_DEVICE_HANDLER( s3c24xx_lcd_palette_r ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 data = s3c24xx->lcdpal.regs.data[offset]; - verboselog( device->machine, 9, "(LCD) %08X -> %08X\n", S3C24XX_BASE_LCDPAL + (offset << 2), data); + verboselog( device->machine(), 9, "(LCD) %08X -> %08X\n", S3C24XX_BASE_LCDPAL + (offset << 2), data); return data; } static WRITE32_DEVICE_HANDLER( s3c24xx_lcd_palette_w ) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 9, "(LCD) %08X <- %08X\n", S3C24XX_BASE_LCDPAL + (offset << 2), data); + verboselog( device->machine(), 9, "(LCD) %08X <- %08X\n", S3C24XX_BASE_LCDPAL + (offset << 2), data); COMBINE_DATA(&s3c24xx->lcdpal.regs.data[offset]); if (mem_mask != 0xffffffff) { - verboselog( device->machine, 0, "s3c24xx_lcd_palette_w: unknown mask %08x\n", mem_mask); + verboselog( device->machine(), 0, "s3c24xx_lcd_palette_w: unknown mask %08x\n", mem_mask); } - palette_set_color( device->machine, offset, s3c24xx_get_color_tft_16( device, data & 0xFFFF)); + palette_set_color( device->machine(), offset, s3c24xx_get_color_tft_16( device, data & 0xFFFF)); } /* Clock & Power Management */ @@ -1025,21 +1025,21 @@ static READ32_DEVICE_HANDLER( s3c24xx_clkpow_r ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 data = ((UINT32*)&s3c24xx->clkpow.regs)[offset]; - verboselog( device->machine, 9, "(CLKPOW) %08X -> %08X\n", S3C24XX_BASE_CLKPOW + (offset << 2), data); + verboselog( device->machine(), 9, "(CLKPOW) %08X -> %08X\n", S3C24XX_BASE_CLKPOW + (offset << 2), data); return data; } static WRITE32_DEVICE_HANDLER( s3c24xx_clkpow_w ) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 9, "(CLKPOW) %08X <- %08X\n", S3C24XX_BASE_CLKPOW + (offset << 2), data); + verboselog( device->machine(), 9, "(CLKPOW) %08X <- %08X\n", S3C24XX_BASE_CLKPOW + (offset << 2), data); COMBINE_DATA(&((UINT32*)&s3c24xx->clkpow.regs)[offset]); switch (offset) { case S3C24XX_MPLLCON : { - verboselog( device->machine, 5, "CLKPOW - fclk %d hclk %d pclk %d\n", s3c24xx_get_fclk( device), s3c24xx_get_hclk( device), s3c24xx_get_pclk( device)); - device->machine->device( "maincpu")->set_unscaled_clock(s3c24xx_get_fclk( device) * CLOCK_MULTIPLIER); + verboselog( device->machine(), 5, "CLKPOW - fclk %d hclk %d pclk %d\n", s3c24xx_get_fclk( device), s3c24xx_get_hclk( device), s3c24xx_get_pclk( device)); + device->machine().device( "maincpu")->set_unscaled_clock(s3c24xx_get_fclk( device) * CLOCK_MULTIPLIER); } break; } @@ -1065,7 +1065,7 @@ static void s3c24xx_check_pending_irq( device_t *device) s3c24xx->irq.regs.intoffset = int_type; if (s3c24xx->irq.line_irq != ASSERT_LINE) { - cputag_set_input_line( device->machine, "maincpu", ARM7_IRQ_LINE, ASSERT_LINE); + cputag_set_input_line( device->machine(), "maincpu", ARM7_IRQ_LINE, ASSERT_LINE); s3c24xx->irq.line_irq = ASSERT_LINE; } } @@ -1073,7 +1073,7 @@ static void s3c24xx_check_pending_irq( device_t *device) { if (s3c24xx->irq.line_irq != CLEAR_LINE) { - cputag_set_input_line( device->machine, "maincpu", ARM7_IRQ_LINE, CLEAR_LINE); + cputag_set_input_line( device->machine(), "maincpu", ARM7_IRQ_LINE, CLEAR_LINE); s3c24xx->irq.line_irq = CLEAR_LINE; } } @@ -1089,7 +1089,7 @@ static void s3c24xx_check_pending_irq( device_t *device) } if (s3c24xx->irq.line_fiq != ASSERT_LINE) { - cputag_set_input_line( device->machine, "maincpu", ARM7_FIRQ_LINE, ASSERT_LINE); + cputag_set_input_line( device->machine(), "maincpu", ARM7_FIRQ_LINE, ASSERT_LINE); s3c24xx->irq.line_fiq = ASSERT_LINE; } } @@ -1097,7 +1097,7 @@ static void s3c24xx_check_pending_irq( device_t *device) { if (s3c24xx->irq.line_fiq != CLEAR_LINE) { - cputag_set_input_line( device->machine, "maincpu", ARM7_FIRQ_LINE, CLEAR_LINE); + cputag_set_input_line( device->machine(), "maincpu", ARM7_FIRQ_LINE, CLEAR_LINE); s3c24xx->irq.line_fiq = CLEAR_LINE; } } @@ -1106,7 +1106,7 @@ static void s3c24xx_check_pending_irq( device_t *device) static void s3c24xx_request_irq( device_t *device, UINT32 int_type) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 5, "request irq %d\n", int_type); + verboselog( device->machine(), 5, "request irq %d\n", int_type); s3c24xx->irq.regs.srcpnd |= (1 << int_type); s3c24xx_check_pending_irq( device); } @@ -1132,7 +1132,7 @@ static void s3c24xx_check_pending_subirq( device_t *device) ATTR_UNUSED static void s3c24xx_request_subirq( device_t *device, UINT32 int_type) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 5, "request subirq %d\n", int_type); + verboselog( device->machine(), 5, "request subirq %d\n", int_type); s3c24xx->irq.regs.subsrcpnd |= (1 << int_type); s3c24xx_check_pending_subirq( device); } @@ -1163,7 +1163,7 @@ static void s3c24xx_check_pending_eint( device_t *device) ATTR_UNUSED static void s3c24xx_request_eint( device_t *device, UINT32 number) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 5, "request external interrupt %d\n", number); + verboselog( device->machine(), 5, "request external interrupt %d\n", number); if (number < 4) { s3c24xx_request_irq( device, S3C24XX_INT_EINT0 + number); @@ -1181,7 +1181,7 @@ static READ32_DEVICE_HANDLER( s3c24xx_irq_r ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 data = ((UINT32*)&s3c24xx->irq.regs)[offset]; - verboselog( device->machine, 9, "(IRQ) %08X -> %08X\n", S3C24XX_BASE_INT + (offset << 2), data); + verboselog( device->machine(), 9, "(IRQ) %08X -> %08X\n", S3C24XX_BASE_INT + (offset << 2), data); return data; } @@ -1189,7 +1189,7 @@ static WRITE32_DEVICE_HANDLER( s3c24xx_irq_w ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 old_value = ((UINT32*)&s3c24xx->irq.regs)[offset]; - verboselog( device->machine, 9, "(IRQ) %08X <- %08X\n", S3C24XX_BASE_INT + (offset << 2), data); + verboselog( device->machine(), 9, "(IRQ) %08X <- %08X\n", S3C24XX_BASE_INT + (offset << 2), data); COMBINE_DATA(&((UINT32*)&s3c24xx->irq.regs)[offset]); switch (offset) { @@ -1274,7 +1274,7 @@ static READ32_DEVICE_HANDLER( s3c24xx_pwm_r ) } break; } - verboselog( device->machine, 9, "(PWM) %08X -> %08X\n", S3C24XX_BASE_PWM + (offset << 2), data); + verboselog( device->machine(), 9, "(PWM) %08X -> %08X\n", S3C24XX_BASE_PWM + (offset << 2), data); return data; } @@ -1286,7 +1286,7 @@ static void s3c24xx_pwm_start( device_t *device, int timer) const int mux_shift[] = { 0, 4, 8, 12, 16}; UINT32 pclk, prescaler, mux, cnt, cmp, auto_reload; double freq, hz; - verboselog( device->machine, 1, "PWM %d start\n", timer); + verboselog( device->machine(), 1, "PWM %d start\n", timer); pclk = s3c24xx_get_pclk( device); prescaler = (s3c24xx->pwm.regs.tcfg0 >> prescaler_shift[timer]) & 0xFF; mux = (s3c24xx->pwm.regs.tcfg1 >> mux_shift[timer]) & 0x0F; @@ -1351,7 +1351,7 @@ static void s3c24xx_pwm_start( device_t *device, int timer) { hz = freq / cnt; } - verboselog( device->machine, 5, "PWM %d - pclk=%d prescaler=%d div=%d freq=%f cnt=%d cmp=%d auto_reload=%d hz=%f\n", timer, pclk, prescaler, mux_table[mux], freq, cnt, cmp, auto_reload, hz); + verboselog( device->machine(), 5, "PWM %d - pclk=%d prescaler=%d div=%d freq=%f cnt=%d cmp=%d auto_reload=%d hz=%f\n", timer, pclk, prescaler, mux_table[mux], freq, cnt, cmp, auto_reload, hz); s3c24xx->pwm.cnt[timer] = cnt; s3c24xx->pwm.cmp[timer] = cmp; s3c24xx->pwm.freq[timer] = freq; @@ -1368,7 +1368,7 @@ static void s3c24xx_pwm_start( device_t *device, int timer) static void s3c24xx_pwm_stop( device_t *device, int timer) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 1, "PWM %d stop\n", timer); + verboselog( device->machine(), 1, "PWM %d stop\n", timer); s3c24xx->pwm.timer[timer]->adjust( attotime::never); } @@ -1390,7 +1390,7 @@ static WRITE32_DEVICE_HANDLER( s3c24xx_pwm_w ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 old_value = ((UINT32*)&s3c24xx->pwm.regs)[offset]; - verboselog( device->machine, 9, "(PWM) %08X <- %08X\n", S3C24XX_BASE_PWM + (offset << 2), data); + verboselog( device->machine(), 9, "(PWM) %08X <- %08X\n", S3C24XX_BASE_PWM + (offset << 2), data); COMBINE_DATA(&((UINT32*)&s3c24xx->pwm.regs)[offset]); switch (offset) { @@ -1454,10 +1454,10 @@ static void s3c24xx_dma_trigger( device_t *device, int ch) s3c24xx_t *s3c24xx = get_token( device); s3c24xx_dma_regs_t *regs = &s3c24xx->dma[ch].regs; UINT32 curr_tc, curr_src, curr_dst; - address_space *space = device->machine->device( "maincpu")->memory().space( AS_PROGRAM); + address_space *space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); int dsz, inc_src, inc_dst, servmode, tsz; const UINT32 ch_int[] = { S3C24XX_INT_DMA0, S3C24XX_INT_DMA1, S3C24XX_INT_DMA2, S3C24XX_INT_DMA3}; - verboselog( device->machine, 5, "DMA %d trigger\n", ch); + verboselog( device->machine(), 5, "DMA %d trigger\n", ch); curr_tc = S3C24XX_DSTAT_GET_CURR_TC( regs->dstat); dsz = S3C24XX_DCON_GET_DSZ( regs->dcon); curr_src = S3C24XX_DCSRC_GET_CURR_SRC( regs->dcsrc); @@ -1471,7 +1471,7 @@ static void s3c24xx_dma_trigger( device_t *device, int ch) inc_src = BIT( regs->disrcc, 0); inc_dst = BIT( regs->didstc, 0); #endif - verboselog( device->machine, 5, "DMA %d - curr_src %08X curr_dst %08X curr_tc %d dsz %d\n", ch, curr_src, curr_dst, curr_tc, dsz); + verboselog( device->machine(), 5, "DMA %d - curr_src %08X curr_dst %08X curr_tc %d dsz %d\n", ch, curr_src, curr_dst, curr_tc, dsz); while (curr_tc > 0) { curr_tc--; @@ -1512,7 +1512,7 @@ static void s3c24xx_dma_request_iis( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); s3c24xx_dma_regs_t *regs = &s3c24xx->dma[2].regs; - verboselog( device->machine, 5, "s3c24xx_dma_request_iis\n"); + verboselog( device->machine(), 5, "s3c24xx_dma_request_iis\n"); if ((S3C24XX_DMASKTRIG_GET_ON_OFF( regs->dmasktrig) != 0) && (S3C24XX_DCON_GET_SWHWSEL( regs->dcon) != 0) && (S3C24XX_DCON_GET_HWSRCSEL( regs->dcon) == 0)) { s3c24xx_dma_trigger( device, 2); @@ -1522,7 +1522,7 @@ static void s3c24xx_dma_request_iis( device_t *device) static void s3c24xx_dma_request_pwm( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 5, "s3c24xx_dma_request_pwm\n"); + verboselog( device->machine(), 5, "s3c24xx_dma_request_pwm\n"); for (int i = 0; i < 4; i++) { if (i != 1) @@ -1543,7 +1543,7 @@ static void s3c24xx_dma_start( device_t *device, int ch) s3c24xx_dma_regs_t *regs = &s3c24xx->dma[ch].regs; UINT32 dsz, tsz, reload; int inc_src, inc_dst, _int, servmode, swhwsel, hwsrcsel; - verboselog( device->machine, 1, "DMA %d start\n", ch); + verboselog( device->machine(), 1, "DMA %d start\n", ch); addr_src = S3C24XX_DISRC_GET_SADDR( regs->disrc); addr_dst = S3C24XX_DIDST_GET_DADDR( regs->didst); tc = S3C24XX_DCON_GET_TC( regs->dcon); @@ -1561,8 +1561,8 @@ static void s3c24xx_dma_start( device_t *device, int ch) inc_src = BIT( regs->disrcc, 0); inc_dst = BIT( regs->didstc, 0); #endif - verboselog( device->machine, 5, "DMA %d - addr_src %08X inc_src %d addr_dst %08X inc_dst %d int %d tsz %d servmode %d hwsrcsel %d swhwsel %d reload %d dsz %d tc %d\n", ch, addr_src, inc_src, addr_dst, inc_dst, _int, tsz, servmode, hwsrcsel, swhwsel, reload, dsz, tc); - verboselog( device->machine, 5, "DMA %d - copy %08X bytes from %08X (%s) to %08X (%s)\n", ch, (tc << dsz) << (tsz << 1), addr_src, inc_src ? "fix" : "inc", addr_dst, inc_dst ? "fix" : "inc"); + verboselog( device->machine(), 5, "DMA %d - addr_src %08X inc_src %d addr_dst %08X inc_dst %d int %d tsz %d servmode %d hwsrcsel %d swhwsel %d reload %d dsz %d tc %d\n", ch, addr_src, inc_src, addr_dst, inc_dst, _int, tsz, servmode, hwsrcsel, swhwsel, reload, dsz, tc); + verboselog( device->machine(), 5, "DMA %d - copy %08X bytes from %08X (%s) to %08X (%s)\n", ch, (tc << dsz) << (tsz << 1), addr_src, inc_src ? "fix" : "inc", addr_dst, inc_dst ? "fix" : "inc"); s3c24xx_dma_reload( device, ch); if (swhwsel == 0) { @@ -1572,7 +1572,7 @@ static void s3c24xx_dma_start( device_t *device, int ch) static void s3c24xx_dma_stop( device_t *device, int ch) { - verboselog( device->machine, 1, "DMA %d stop\n", ch); + verboselog( device->machine(), 1, "DMA %d stop\n", ch); } static void s3c24xx_dma_recalc( device_t *device, int ch) @@ -1626,52 +1626,52 @@ static void s3c24xx_dma_w( device_t *device, UINT32 ch, UINT32 offset, UINT32 da static READ32_DEVICE_HANDLER( s3c24xx_dma_0_r ) { UINT32 data = s3c24xx_dma_r( device, 0, offset); - verboselog( device->machine, 9, "(DMA 0) %08X -> %08X\n", S3C24XX_BASE_DMA_0 + (offset << 2), data); + verboselog( device->machine(), 9, "(DMA 0) %08X -> %08X\n", S3C24XX_BASE_DMA_0 + (offset << 2), data); return data; } static READ32_DEVICE_HANDLER( s3c24xx_dma_1_r ) { UINT32 data = s3c24xx_dma_r( device, 1, offset); - verboselog( device->machine, 9, "(DMA 1) %08X -> %08X\n", S3C24XX_BASE_DMA_1 + (offset << 2), data); + verboselog( device->machine(), 9, "(DMA 1) %08X -> %08X\n", S3C24XX_BASE_DMA_1 + (offset << 2), data); return data; } static READ32_DEVICE_HANDLER( s3c24xx_dma_2_r ) { UINT32 data = s3c24xx_dma_r( device, 2, offset); - verboselog( device->machine, 9, "(DMA 2) %08X -> %08X\n", S3C24XX_BASE_DMA_2 + (offset << 2), data); + verboselog( device->machine(), 9, "(DMA 2) %08X -> %08X\n", S3C24XX_BASE_DMA_2 + (offset << 2), data); return data; } static READ32_DEVICE_HANDLER( s3c24xx_dma_3_r ) { UINT32 data = s3c24xx_dma_r( device, 3, offset); - verboselog( device->machine, 9, "(DMA 3) %08X -> %08X\n", S3C24XX_BASE_DMA_3 + (offset << 2), data); + verboselog( device->machine(), 9, "(DMA 3) %08X -> %08X\n", S3C24XX_BASE_DMA_3 + (offset << 2), data); return data; } static WRITE32_DEVICE_HANDLER( s3c24xx_dma_0_w ) { - verboselog( device->machine, 9, "(DMA 0) %08X <- %08X\n", S3C24XX_BASE_DMA_0 + (offset << 2), data); + verboselog( device->machine(), 9, "(DMA 0) %08X <- %08X\n", S3C24XX_BASE_DMA_0 + (offset << 2), data); s3c24xx_dma_w( device, 0, offset, data, mem_mask); } static WRITE32_DEVICE_HANDLER( s3c24xx_dma_1_w ) { - verboselog( device->machine, 9, "(DMA 1) %08X <- %08X\n", S3C24XX_BASE_DMA_1 + (offset << 2), data); + verboselog( device->machine(), 9, "(DMA 1) %08X <- %08X\n", S3C24XX_BASE_DMA_1 + (offset << 2), data); s3c24xx_dma_w( device, 1, offset, data, mem_mask); } static WRITE32_DEVICE_HANDLER( s3c24xx_dma_2_w ) { - verboselog( device->machine, 9, "(DMA 2) %08X <- %08X\n", S3C24XX_BASE_DMA_2 + (offset << 2), data); + verboselog( device->machine(), 9, "(DMA 2) %08X <- %08X\n", S3C24XX_BASE_DMA_2 + (offset << 2), data); s3c24xx_dma_w( device, 2, offset, data, mem_mask); } static WRITE32_DEVICE_HANDLER( s3c24xx_dma_3_w ) { - verboselog( device->machine, 9, "(DMA 3) %08X <- %08X\n", S3C24XX_BASE_DMA_3 + (offset << 2), data); + verboselog( device->machine(), 9, "(DMA 3) %08X <- %08X\n", S3C24XX_BASE_DMA_3 + (offset << 2), data); s3c24xx_dma_w( device, 3, offset, data, mem_mask); } @@ -1761,7 +1761,7 @@ static READ32_DEVICE_HANDLER( s3c24xx_gpio_r ) break; #endif } - verboselog( device->machine, 9, "(GPIO) %08X -> %08X\n", S3C24XX_BASE_GPIO + (offset << 2), data); + verboselog( device->machine(), 9, "(GPIO) %08X -> %08X\n", S3C24XX_BASE_GPIO + (offset << 2), data); return data; } @@ -1771,7 +1771,7 @@ static WRITE32_DEVICE_HANDLER( s3c24xx_gpio_w ) #if defined(DEVICE_S3C2410) || defined(DEVICE_S3C2440) UINT32 old_value = ((UINT32*)&s3c24xx->gpio.regs)[offset]; #endif - verboselog( device->machine, 9, "(GPIO) %08X <- %08X\n", S3C24XX_BASE_GPIO + (offset << 2), data); + verboselog( device->machine(), 9, "(GPIO) %08X <- %08X\n", S3C24XX_BASE_GPIO + (offset << 2), data); COMBINE_DATA(&((UINT32*)&s3c24xx->gpio.regs)[offset]); switch (offset) { @@ -1844,14 +1844,14 @@ static READ32_DEVICE_HANDLER( s3c24xx_memcon_r ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 data = s3c24xx->memcon.regs.data[offset]; - verboselog( device->machine, 9, "(MEMCON) %08X -> %08X\n", S3C24XX_BASE_MEMCON + (offset << 2), data); + verboselog( device->machine(), 9, "(MEMCON) %08X -> %08X\n", S3C24XX_BASE_MEMCON + (offset << 2), data); return data; } static WRITE32_DEVICE_HANDLER( s3c24xx_memcon_w ) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 9, "(MEMCON) %08X <- %08X\n", S3C24XX_BASE_MEMCON + (offset << 2), data); + verboselog( device->machine(), 9, "(MEMCON) %08X <- %08X\n", S3C24XX_BASE_MEMCON + (offset << 2), data); COMBINE_DATA(&s3c24xx->memcon.regs.data[offset]); } @@ -1870,14 +1870,14 @@ static READ32_DEVICE_HANDLER( s3c24xx_usb_host_r ) } break; } - verboselog( device->machine, 9, "(USB H) %08X -> %08X\n", S3C24XX_BASE_USBHOST + (offset << 2), data); + verboselog( device->machine(), 9, "(USB H) %08X -> %08X\n", S3C24XX_BASE_USBHOST + (offset << 2), data); return data; } static WRITE32_DEVICE_HANDLER( s3c24xx_usb_host_w ) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 9, "(USB H) %08X <- %08X\n", S3C24XX_BASE_USBHOST + (offset << 2), data); + verboselog( device->machine(), 9, "(USB H) %08X <- %08X\n", S3C24XX_BASE_USBHOST + (offset << 2), data); COMBINE_DATA(&s3c24xx->usbhost.regs.data[offset]); } @@ -1897,7 +1897,7 @@ static UINT32 s3c24xx_uart_r( device_t *device, UINT32 ch, UINT32 offset) case S3C24XX_URXH : { UINT8 rxdata = data & 0xFF; - verboselog( device->machine, 5, "UART %d read %02X (%c)\n", ch, rxdata, ((rxdata >= 32) && (rxdata < 128)) ? (char)rxdata : '?'); + verboselog( device->machine(), 5, "UART %d read %02X (%c)\n", ch, rxdata, ((rxdata >= 32) && (rxdata < 128)) ? (char)rxdata : '?'); s3c24xx->uart[ch].regs.utrstat &= ~1; // [bit 0] Receive buffer data ready } break; @@ -1914,7 +1914,7 @@ static void s3c24xx_uart_w( device_t *device, UINT32 ch, UINT32 offset, UINT32 d case S3C24XX_UTXH : { UINT8 txdata = data & 0xFF; - verboselog( device->machine, 5, "UART %d write %02X (%c)\n", ch, txdata, ((txdata >= 32) && (txdata < 128)) ? (char)txdata : '?'); + verboselog( device->machine(), 5, "UART %d write %02X (%c)\n", ch, txdata, ((txdata >= 32) && (txdata < 128)) ? (char)txdata : '?'); #ifdef UART_PRINTF printf( "%c", ((txdata >= 32) && (txdata < 128)) ? (char)txdata : '?'); #endif @@ -1926,14 +1926,14 @@ static void s3c24xx_uart_w( device_t *device, UINT32 ch, UINT32 offset, UINT32 d static READ32_DEVICE_HANDLER( s3c24xx_uart_0_r ) { UINT32 data = s3c24xx_uart_r( device, 0, offset); -// verboselog( device->machine, 9, "(UART 0) %08X -> %08X\n", S3C24XX_BASE_UART_0 + (offset << 2), data); +// verboselog( device->machine(), 9, "(UART 0) %08X -> %08X\n", S3C24XX_BASE_UART_0 + (offset << 2), data); return data; } static READ32_DEVICE_HANDLER( s3c24xx_uart_1_r ) { UINT32 data = s3c24xx_uart_r( device, 1, offset); -// verboselog( device->machine, 9, "(UART 1) %08X -> %08X\n", S3C24XX_BASE_UART_1 + (offset << 2), data); +// verboselog( device->machine(), 9, "(UART 1) %08X -> %08X\n", S3C24XX_BASE_UART_1 + (offset << 2), data); return data; } @@ -1942,7 +1942,7 @@ static READ32_DEVICE_HANDLER( s3c24xx_uart_1_r ) static READ32_DEVICE_HANDLER( s3c24xx_uart_2_r ) { UINT32 data = s3c24xx_uart_r( device, 2, offset); -// verboselog( device->machine, 9, "(UART 2) %08X -> %08X\n", S3C24XX_BASE_UART_2 + (offset << 2), data); +// verboselog( device->machine(), 9, "(UART 2) %08X -> %08X\n", S3C24XX_BASE_UART_2 + (offset << 2), data); return data; } @@ -1950,13 +1950,13 @@ static READ32_DEVICE_HANDLER( s3c24xx_uart_2_r ) static WRITE32_DEVICE_HANDLER( s3c24xx_uart_0_w ) { -// verboselog( device->machine, 9, "(UART 0) %08X <- %08X\n", S3C24XX_BASE_UART_0 + (offset << 2), data); +// verboselog( device->machine(), 9, "(UART 0) %08X <- %08X\n", S3C24XX_BASE_UART_0 + (offset << 2), data); s3c24xx_uart_w( device, 0, offset, data, mem_mask); } static WRITE32_DEVICE_HANDLER( s3c24xx_uart_1_w ) { -// verboselog( device->machine, 9, "(UART 1) %08X <- %08X\n", S3C24XX_BASE_UART_1 + (offset << 2), data); +// verboselog( device->machine(), 9, "(UART 1) %08X <- %08X\n", S3C24XX_BASE_UART_1 + (offset << 2), data); s3c24xx_uart_w( device, 1, offset, data, mem_mask); } @@ -1964,7 +1964,7 @@ static WRITE32_DEVICE_HANDLER( s3c24xx_uart_1_w ) static WRITE32_DEVICE_HANDLER( s3c24xx_uart_2_w ) { -// verboselog( device->machine, 9, "(UART 2) %08X <- %08X\n", S3C24XX_BASE_UART_2 + (offset << 2), data); +// verboselog( device->machine(), 9, "(UART 2) %08X <- %08X\n", S3C24XX_BASE_UART_2 + (offset << 2), data); s3c24xx_uart_w( device, 2, offset, data, mem_mask); } @@ -1984,14 +1984,14 @@ static READ32_DEVICE_HANDLER( s3c24xx_usb_device_r ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 data = s3c24xx->usbdev.regs.data[offset]; - verboselog( device->machine, 9, "(USB D) %08X -> %08X\n", S3C24XX_BASE_USBDEV + (offset << 2), data); + verboselog( device->machine(), 9, "(USB D) %08X -> %08X\n", S3C24XX_BASE_USBDEV + (offset << 2), data); return data; } static WRITE32_DEVICE_HANDLER( s3c24xx_usb_device_w ) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 9, "(USB D) %08X <- %08X\n", S3C24XX_BASE_USBDEV + (offset << 2), data); + verboselog( device->machine(), 9, "(USB D) %08X <- %08X\n", S3C24XX_BASE_USBDEV + (offset << 2), data); COMBINE_DATA(&s3c24xx->usbdev.regs.data[offset]); } @@ -2039,7 +2039,7 @@ static READ32_DEVICE_HANDLER( s3c24xx_wdt_r ) } break; } - verboselog( device->machine, 9, "(WDT) %08X -> %08X\n", S3C24XX_BASE_WDT + (offset << 2), data); + verboselog( device->machine(), 9, "(WDT) %08X -> %08X\n", S3C24XX_BASE_WDT + (offset << 2), data); return data; } @@ -2048,13 +2048,13 @@ static void s3c24xx_wdt_start( device_t *device) s3c24xx_t *s3c24xx = get_token( device); UINT32 pclk, prescaler, clock; double freq, hz; - verboselog( device->machine, 1, "WDT start\n"); + verboselog( device->machine(), 1, "WDT start\n"); pclk = s3c24xx_get_pclk( device); prescaler = BITS( s3c24xx->wdt.regs.wtcon, 15, 8); clock = 16 << BITS( s3c24xx->wdt.regs.wtcon, 4, 3); freq = (double)pclk / (prescaler + 1) / clock; hz = freq / s3c24xx->wdt.regs.wtcnt; - verboselog( device->machine, 5, "WDT pclk %d prescaler %d clock %d freq %f hz %f\n", pclk, prescaler, clock, freq, hz); + verboselog( device->machine(), 5, "WDT pclk %d prescaler %d clock %d freq %f hz %f\n", pclk, prescaler, clock, freq, hz); s3c24xx->wdt.timer->adjust( attotime::from_hz( hz), 0, attotime::from_hz( hz)); #if defined(DEVICE_S3C2410) s3c24xx->wdt.freq = freq; @@ -2065,7 +2065,7 @@ static void s3c24xx_wdt_start( device_t *device) static void s3c24xx_wdt_stop( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 1, "WDT stop\n"); + verboselog( device->machine(), 1, "WDT stop\n"); s3c24xx->wdt.regs.wtcnt = s3c24xx_wdt_calc_current_count( device); s3c24xx->wdt.timer->adjust( attotime::never); } @@ -2087,7 +2087,7 @@ static WRITE32_DEVICE_HANDLER( s3c24xx_wdt_w ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 old_value = ((UINT32*)&s3c24xx->wdt.regs)[offset]; - verboselog( device->machine, 9, "(WDT) %08X <- %08X\n", S3C24XX_BASE_WDT + (offset << 2), data); + verboselog( device->machine(), 9, "(WDT) %08X <- %08X\n", S3C24XX_BASE_WDT + (offset << 2), data); COMBINE_DATA(&((UINT32*)&s3c24xx->wdt.regs)[offset]); switch (offset) { @@ -2156,7 +2156,7 @@ INLINE int iface_i2c_sda_r( device_t *device) static void i2c_send_start( device_t *device) { - verboselog( device->machine, 5, "i2c_send_start\n"); + verboselog( device->machine(), 5, "i2c_send_start\n"); iface_i2c_sda_w( device, 1); iface_i2c_scl_w( device, 1); iface_i2c_sda_w( device, 0); @@ -2165,7 +2165,7 @@ static void i2c_send_start( device_t *device) static void i2c_send_stop( device_t *device) { - verboselog( device->machine, 5, "i2c_send_stop\n"); + verboselog( device->machine(), 5, "i2c_send_stop\n"); iface_i2c_sda_w( device, 0); iface_i2c_scl_w( device, 1); iface_i2c_sda_w( device, 1); @@ -2175,7 +2175,7 @@ static void i2c_send_stop( device_t *device) static UINT8 i2c_receive_byte( device_t *device, int ack) { UINT8 data = 0; - verboselog( device->machine, 5, "i2c_receive_byte ...\n"); + verboselog( device->machine(), 5, "i2c_receive_byte ...\n"); iface_i2c_sda_w( device, 1); for (int i = 0; i < 8; i++) { @@ -2183,8 +2183,8 @@ static UINT8 i2c_receive_byte( device_t *device, int ack) data = (data << 1) + (iface_i2c_sda_r( device) ? 1 : 0); iface_i2c_scl_w( device, 0); } - verboselog( device->machine, 5, "recv data %02X\n", data); - verboselog( device->machine, 5, "send ack %d\n", ack); + verboselog( device->machine(), 5, "recv data %02X\n", data); + verboselog( device->machine(), 5, "send ack %d\n", ack); iface_i2c_sda_w( device, ack ? 0 : 1); iface_i2c_scl_w( device, 1); iface_i2c_scl_w( device, 0); @@ -2194,8 +2194,8 @@ static UINT8 i2c_receive_byte( device_t *device, int ack) static int i2c_send_byte( device_t *device, UINT8 data) { int ack; - verboselog( device->machine, 5, "i2c_send_byte ...\n"); - verboselog( device->machine, 5, "send data %02X\n", data); + verboselog( device->machine(), 5, "i2c_send_byte ...\n"); + verboselog( device->machine(), 5, "send data %02X\n", data); for (int i = 0; i < 8; i++) { iface_i2c_sda_w( device, (data & 0x80) ? 1 : 0); @@ -2206,7 +2206,7 @@ static int i2c_send_byte( device_t *device, UINT8 data) iface_i2c_sda_w( device, 1); // ack bit iface_i2c_scl_w( device, 1); ack = iface_i2c_sda_r( device); - verboselog( device->machine, 5, "recv ack %d\n", ack); + verboselog( device->machine(), 5, "recv ack %d\n", ack); iface_i2c_scl_w( device, 0); return ack; } @@ -2215,7 +2215,7 @@ static void iic_start( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); int mode_selection; - verboselog( device->machine, 1, "IIC start\n"); + verboselog( device->machine(), 1, "IIC start\n"); i2c_send_start( device); mode_selection = BITS( s3c24xx->iic.regs.iicstat, 7, 6); switch (mode_selection) @@ -2229,7 +2229,7 @@ static void iic_start( device_t *device) static void iic_stop( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 1, "IIC stop\n"); + verboselog( device->machine(), 1, "IIC stop\n"); i2c_send_stop( device); s3c24xx->iic.timer->adjust( attotime::never); } @@ -2238,7 +2238,7 @@ static void iic_resume( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); int mode_selection; - verboselog( device->machine, 1, "IIC resume\n"); + verboselog( device->machine(), 1, "IIC resume\n"); mode_selection = BITS( s3c24xx->iic.regs.iicstat, 7, 6); switch (mode_selection) { @@ -2260,7 +2260,7 @@ static READ32_DEVICE_HANDLER( s3c24xx_iic_r ) } break; } - verboselog( device->machine, 9, "(IIC) %08X -> %08X\n", S3C24XX_BASE_IIC + (offset << 2), data); + verboselog( device->machine(), 9, "(IIC) %08X -> %08X\n", S3C24XX_BASE_IIC + (offset << 2), data); return data; } @@ -2268,7 +2268,7 @@ static WRITE32_DEVICE_HANDLER( s3c24xx_iic_w ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 old_value = ((UINT32*)&s3c24xx->iic.regs)[offset]; - verboselog( device->machine, 9, "(IIC) %08X <- %08X\n", S3C24XX_BASE_IIC + (offset << 2), data); + verboselog( device->machine(), 9, "(IIC) %08X <- %08X\n", S3C24XX_BASE_IIC + (offset << 2), data); COMBINE_DATA(&((UINT32*)&s3c24xx->iic.regs)[offset]); switch (offset) { @@ -2375,21 +2375,21 @@ static void s3c24xx_iis_start( device_t *device) const UINT32 codeclk_table[] = { 256, 384}; double freq; int pclk, prescaler_enable, prescaler_control_a, prescaler_control_b, codeclk; - verboselog( device->machine, 1, "IIS start\n"); + verboselog( device->machine(), 1, "IIS start\n"); prescaler_enable = BIT( s3c24xx->iis.regs.iiscon, 1); prescaler_control_a = BITS( s3c24xx->iis.regs.iispsr, 9, 5); prescaler_control_b = BITS( s3c24xx->iis.regs.iispsr, 4, 0); codeclk = BIT( s3c24xx->iis.regs.iismod, 2); pclk = s3c24xx_get_pclk( device); freq = ((double)pclk / (prescaler_control_a + 1) / codeclk_table[codeclk]) * 2; // why do I have to multiply by two? - verboselog( device->machine, 5, "IIS - pclk %d psc_enable %d psc_a %d psc_b %d codeclk %d freq %f\n", pclk, prescaler_enable, prescaler_control_a, prescaler_control_b, codeclk_table[codeclk], freq); + verboselog( device->machine(), 5, "IIS - pclk %d psc_enable %d psc_a %d psc_b %d codeclk %d freq %f\n", pclk, prescaler_enable, prescaler_control_a, prescaler_control_b, codeclk_table[codeclk], freq); s3c24xx->iis.timer->adjust( attotime::from_hz( freq), 0, attotime::from_hz( freq)); } static void s3c24xx_iis_stop( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 1, "IIS stop\n"); + verboselog( device->machine(), 1, "IIS stop\n"); s3c24xx->iis.timer->adjust( attotime::never); } @@ -2420,7 +2420,7 @@ static READ32_DEVICE_HANDLER( s3c24xx_iis_r ) break; } #endif - verboselog( device->machine, 9, "(IIS) %08X -> %08X\n", S3C24XX_BASE_IIS + (offset << 2), data); + verboselog( device->machine(), 9, "(IIS) %08X -> %08X\n", S3C24XX_BASE_IIS + (offset << 2), data); return data; } @@ -2428,7 +2428,7 @@ static WRITE32_DEVICE_HANDLER( s3c24xx_iis_w ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 old_value = ((UINT32*)&s3c24xx->iis.regs)[offset]; - verboselog( device->machine, 9, "(IIS) %08X <- %08X\n", S3C24XX_BASE_IIS + (offset << 2), data); + verboselog( device->machine(), 9, "(IIS) %08X <- %08X\n", S3C24XX_BASE_IIS + (offset << 2), data); COMBINE_DATA(&((UINT32*)&s3c24xx->iis.regs)[offset]); switch (offset) { @@ -2486,7 +2486,7 @@ static READ32_DEVICE_HANDLER( s3c24xx_rtc_r ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 data = ((UINT32*)&s3c24xx->rtc.regs)[offset]; - verboselog( device->machine, 9, "(RTC) %08X -> %08X\n", S3C24XX_BASE_RTC + (offset << 2), data); + verboselog( device->machine(), 9, "(RTC) %08X -> %08X\n", S3C24XX_BASE_RTC + (offset << 2), data); return data; } @@ -2511,7 +2511,7 @@ static void s3c24xx_rtc_recalc( device_t *device) static WRITE32_DEVICE_HANDLER( s3c24xx_rtc_w ) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 9, "(RTC) %08X <- %08X\n", S3C24XX_BASE_RTC + (offset << 2), data); + verboselog( device->machine(), 9, "(RTC) %08X <- %08X\n", S3C24XX_BASE_RTC + (offset << 2), data); COMBINE_DATA(&((UINT32*)&s3c24xx->rtc.regs)[offset]); switch (offset) { @@ -2573,7 +2573,7 @@ static void s3c24xx_rtc_update( device_t *device) } } } - verboselog( device->machine, 5, "RTC - %04d/%02d/%02d %02d:%02d:%02d\n", bcd_2_dec( s3c24xx->rtc.regs.bcdyear) + 2000, bcd_2_dec( s3c24xx->rtc.regs.bcdmon), bcd_2_dec( s3c24xx->rtc.regs.bcdday), bcd_2_dec( s3c24xx->rtc.regs.bcdhour), bcd_2_dec( s3c24xx->rtc.regs.bcdmin), bcd_2_dec( s3c24xx->rtc.regs.bcdsec)); + verboselog( device->machine(), 5, "RTC - %04d/%02d/%02d %02d:%02d:%02d\n", bcd_2_dec( s3c24xx->rtc.regs.bcdyear) + 2000, bcd_2_dec( s3c24xx->rtc.regs.bcdmon), bcd_2_dec( s3c24xx->rtc.regs.bcdday), bcd_2_dec( s3c24xx->rtc.regs.bcdhour), bcd_2_dec( s3c24xx->rtc.regs.bcdmin), bcd_2_dec( s3c24xx->rtc.regs.bcdsec)); } static void s3c24xx_rtc_check_alarm( device_t *device) @@ -2643,14 +2643,14 @@ static READ32_DEVICE_HANDLER( s3c24xx_adc_r ) break; #endif } - verboselog( device->machine, 9, "(ADC) %08X -> %08X\n", S3C24XX_BASE_ADC + (offset << 2), data); + verboselog( device->machine(), 9, "(ADC) %08X -> %08X\n", S3C24XX_BASE_ADC + (offset << 2), data); return data; } static void s3c24xx_adc_start( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 1, "ADC start\n"); + verboselog( device->machine(), 1, "ADC start\n"); s3c24xx->adc.regs.adccon &= ~(1 << 0); // A/D conversion is completed s3c24xx->adc.regs.adccon |= (1 << 15); // End of A/D conversion } @@ -2659,7 +2659,7 @@ static WRITE32_DEVICE_HANDLER( s3c24xx_adc_w ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 old_value = ((UINT32*)&s3c24xx->adc.regs)[offset]; - verboselog( device->machine, 9, "(ADC) %08X <- %08X\n", S3C24XX_BASE_ADC + (offset << 2), data); + verboselog( device->machine(), 9, "(ADC) %08X <- %08X\n", S3C24XX_BASE_ADC + (offset << 2), data); COMBINE_DATA(&((UINT32*)&s3c24xx->adc.regs)[offset]); switch (offset) { @@ -2712,7 +2712,7 @@ static void s3c24xx_spi_w( device_t *device, UINT32 ch, UINT32 offset, UINT32 da static READ32_DEVICE_HANDLER( s3c24xx_spi_0_r ) { UINT32 data = s3c24xx_spi_r( device, 0, offset); - verboselog( device->machine, 9, "(SPI 0) %08X -> %08X\n", S3C24XX_BASE_SPI_0 + (offset << 2), data); + verboselog( device->machine(), 9, "(SPI 0) %08X -> %08X\n", S3C24XX_BASE_SPI_0 + (offset << 2), data); return data; } @@ -2721,7 +2721,7 @@ static READ32_DEVICE_HANDLER( s3c24xx_spi_0_r ) static READ32_DEVICE_HANDLER( s3c24xx_spi_1_r ) { UINT32 data = s3c24xx_spi_r( device, 1, offset); - verboselog( device->machine, 9, "(SPI 1) %08X -> %08X\n", S3C24XX_BASE_SPI_1 + (offset << 2), data); + verboselog( device->machine(), 9, "(SPI 1) %08X -> %08X\n", S3C24XX_BASE_SPI_1 + (offset << 2), data); return data; } @@ -2729,7 +2729,7 @@ static READ32_DEVICE_HANDLER( s3c24xx_spi_1_r ) static WRITE32_DEVICE_HANDLER( s3c24xx_spi_0_w ) { - verboselog( device->machine, 9, "(SPI 0) %08X <- %08X\n", S3C24XX_BASE_SPI_0 + (offset << 2), data); + verboselog( device->machine(), 9, "(SPI 0) %08X <- %08X\n", S3C24XX_BASE_SPI_0 + (offset << 2), data); s3c24xx_spi_w( device, 0, offset, data, mem_mask); } @@ -2737,7 +2737,7 @@ static WRITE32_DEVICE_HANDLER( s3c24xx_spi_0_w ) static WRITE32_DEVICE_HANDLER( s3c24xx_spi_1_w ) { - verboselog( device->machine, 9, "(SPI 1) %08X <- %08X\n", S3C24XX_BASE_SPI_1 + (offset << 2), data); + verboselog( device->machine(), 9, "(SPI 1) %08X <- %08X\n", S3C24XX_BASE_SPI_1 + (offset << 2), data); s3c24xx_spi_w( device, 1, offset, data, mem_mask); } @@ -2751,14 +2751,14 @@ static READ32_DEVICE_HANDLER( s3c24xx_mmc_r ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 data = s3c24xx->mmc.regs.data[offset]; - verboselog( device->machine, 9, "(MMC) %08X -> %08X\n", S3C24XX_BASE_MMC + (offset << 2), data); + verboselog( device->machine(), 9, "(MMC) %08X -> %08X\n", S3C24XX_BASE_MMC + (offset << 2), data); return data; } static WRITE32_DEVICE_HANDLER( s3c24xx_mmc_w ) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 9, "(MMC) %08X <- %08X\n", S3C24XX_BASE_MMC + (offset << 2), data); + verboselog( device->machine(), 9, "(MMC) %08X <- %08X\n", S3C24XX_BASE_MMC + (offset << 2), data); COMBINE_DATA(&s3c24xx->mmc.regs.data[offset]); } @@ -2772,14 +2772,14 @@ static READ32_DEVICE_HANDLER( s3c24xx_sdi_r ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 data = s3c24xx->sdi.regs.data[offset]; - verboselog( device->machine, 9, "(SDI) %08X -> %08X\n", S3C24XX_BASE_SDI + (offset << 2), data); + verboselog( device->machine(), 9, "(SDI) %08X -> %08X\n", S3C24XX_BASE_SDI + (offset << 2), data); return data; } static WRITE32_DEVICE_HANDLER( s3c24xx_sdi_w ) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 9, "(SDI) %08X <- %08X\n", S3C24XX_BASE_SDI + (offset << 2), data); + verboselog( device->machine(), 9, "(SDI) %08X <- %08X\n", S3C24XX_BASE_SDI + (offset << 2), data); COMBINE_DATA(&s3c24xx->sdi.regs.data[offset]); } @@ -2903,7 +2903,7 @@ static void s3c24xx_nand_update_ecc( device_t *device, UINT8 data) temp[1] = s3c24xx->nand.mecc[1]; temp[2] = s3c24xx->nand.mecc[2]; nand_update_mecc( s3c24xx->nand.mecc, s3c24xx->nand.pos++, data); - verboselog( device->machine, 5, "NAND - MECC %03X - %02X %02X %02X -> %02X %02X %02X\n", s3c24xx->nand.pos - 1, temp[0], temp[1], temp[2], s3c24xx->nand.mecc[0], s3c24xx->nand.mecc[1], s3c24xx->nand.mecc[2]); + verboselog( device->machine(), 5, "NAND - MECC %03X - %02X %02X %02X -> %02X %02X %02X\n", s3c24xx->nand.pos - 1, temp[0], temp[1], temp[2], s3c24xx->nand.mecc[0], s3c24xx->nand.mecc[1], s3c24xx->nand.mecc[2]); if (s3c24xx->nand.pos == 512) s3c24xx->nand.pos = 0; #else if ((s3c24xx->nand.regs.nfcont & (1 << 5)) == 0) @@ -2913,7 +2913,7 @@ static void s3c24xx_nand_update_ecc( device_t *device, UINT8 data) temp[2] = s3c24xx->nand.mecc[2]; temp[3] = s3c24xx->nand.mecc[3]; nand_update_mecc( s3c24xx->nand.mecc, s3c24xx->nand.pos++, data); - verboselog( device->machine, 5, "NAND - MECC %03X - %02X %02X %02X %02X -> %02X %02X %02X %02X\n", s3c24xx->nand.pos - 1, temp[0], temp[1], temp[2], temp[3], s3c24xx->nand.mecc[0], s3c24xx->nand.mecc[1], s3c24xx->nand.mecc[2], s3c24xx->nand.mecc[3]); + verboselog( device->machine(), 5, "NAND - MECC %03X - %02X %02X %02X %02X -> %02X %02X %02X %02X\n", s3c24xx->nand.pos - 1, temp[0], temp[1], temp[2], temp[3], s3c24xx->nand.mecc[0], s3c24xx->nand.mecc[1], s3c24xx->nand.mecc[2], s3c24xx->nand.mecc[3]); if (s3c24xx->nand.pos == 2048) s3c24xx->nand.pos = 0; } if ((s3c24xx->nand.regs.nfcont & (1 << 6)) == 0) @@ -2921,7 +2921,7 @@ static void s3c24xx_nand_update_ecc( device_t *device, UINT8 data) temp[0] = s3c24xx->nand.secc[0]; temp[1] = s3c24xx->nand.secc[1]; nand_update_secc( s3c24xx->nand.secc, s3c24xx->nand.pos++, data); - verboselog( device->machine, 5, "NAND - SECC %02X - %02X %02X -> %02X %02X\n", s3c24xx->nand.pos - 1, temp[0], temp[1], s3c24xx->nand.secc[0], s3c24xx->nand.secc[1]); + verboselog( device->machine(), 5, "NAND - SECC %02X - %02X %02X -> %02X %02X\n", s3c24xx->nand.pos - 1, temp[0], temp[1], s3c24xx->nand.secc[0], s3c24xx->nand.secc[1]); if (s3c24xx->nand.pos == 16) s3c24xx->nand.pos = 0; } #endif @@ -2929,27 +2929,27 @@ static void s3c24xx_nand_update_ecc( device_t *device, UINT8 data) static void s3c24xx_nand_command_w( device_t *device, UINT8 data) { - verboselog( device->machine, 5, "NAND write command %02X\n", data); + verboselog( device->machine(), 5, "NAND write command %02X\n", data); iface_nand_command_w( device, data); } static void s3c24xx_nand_address_w( device_t *device, UINT8 data) { - verboselog( device->machine, 5, "NAND write address %02X\n", data); + verboselog( device->machine(), 5, "NAND write address %02X\n", data); iface_nand_address_w( device, data); } static UINT8 s3c24xx_nand_data_r( device_t *device) { UINT8 data = iface_nand_data_r( device); - verboselog( device->machine, 5, "NAND data read %02X\n", data); + verboselog( device->machine(), 5, "NAND data read %02X\n", data); s3c24xx_nand_update_ecc( device, data); return data; } static void s3c24xx_nand_data_w( device_t *device, UINT8 data) { - verboselog( device->machine, 5, "NAND write data %02X\n", data); + verboselog( device->machine(), 5, "NAND write data %02X\n", data); iface_nand_data_w( device, data); s3c24xx_nand_update_ecc( device, data); } @@ -3001,14 +3001,14 @@ static READ32_DEVICE_HANDLER( s3c24xx_nand_r ) break; #endif } - verboselog( device->machine, 9, "(NAND) %08X -> %08X (%08X)\n", S3C24XX_BASE_NAND + (offset << 2), data, mem_mask); + verboselog( device->machine(), 9, "(NAND) %08X -> %08X (%08X)\n", S3C24XX_BASE_NAND + (offset << 2), data, mem_mask); return data; } static void s3c24xx_nand_init_ecc( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 5, "NAND - init ecc\n"); + verboselog( device->machine(), 5, "NAND - init ecc\n"); #if defined(DEVICE_S3C2410) s3c24xx->nand.mecc[0] = 0; s3c24xx->nand.mecc[1] = 0; @@ -3028,7 +3028,7 @@ static WRITE32_DEVICE_HANDLER( s3c24xx_nand_w ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 old_value = ((UINT32*)&s3c24xx->nand.regs)[offset]; - verboselog( device->machine, 9, "(NAND) %08X <- %08X\n", S3C24XX_BASE_NAND + (offset << 2), data); + verboselog( device->machine(), 9, "(NAND) %08X <- %08X\n", S3C24XX_BASE_NAND + (offset << 2), data); COMBINE_DATA(&((UINT32*)&s3c24xx->nand.regs)[offset]); switch (offset) { @@ -3117,14 +3117,14 @@ static READ32_DEVICE_HANDLER( s3c24xx_cam_r ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 data = s3c24xx->cam.regs.data[offset]; - verboselog( device->machine, 9, "(CAM) %08X -> %08X\n", S3C24XX_BASE_CAM + (offset << 2), data); + verboselog( device->machine(), 9, "(CAM) %08X -> %08X\n", S3C24XX_BASE_CAM + (offset << 2), data); return data; } static WRITE32_DEVICE_HANDLER( s3c24xx_cam_w ) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 9, "(CAM) %08X <- %08X\n", S3C24XX_BASE_CAM + (offset << 2), data); + verboselog( device->machine(), 9, "(CAM) %08X <- %08X\n", S3C24XX_BASE_CAM + (offset << 2), data); COMBINE_DATA(&s3c24xx->cam.regs.data[offset]); } @@ -3138,14 +3138,14 @@ static READ32_DEVICE_HANDLER( s3c24xx_ac97_r ) { s3c24xx_t *s3c24xx = get_token( device); UINT32 data = s3c24xx->ac97.regs.data[offset]; - verboselog( device->machine, 9, "(AC97) %08X -> %08X\n", S3C24XX_BASE_AC97 + (offset << 2), data); + verboselog( device->machine(), 9, "(AC97) %08X -> %08X\n", S3C24XX_BASE_AC97 + (offset << 2), data); return data; } static WRITE32_DEVICE_HANDLER( s3c24xx_ac97_w ) { s3c24xx_t *s3c24xx = get_token( device); - verboselog( device->machine, 9, "(AC97) %08X <- %08X\n", S3C24XX_BASE_AC97 + (offset << 2), data); + verboselog( device->machine(), 9, "(AC97) %08X <- %08X\n", S3C24XX_BASE_AC97 + (offset << 2), data); COMBINE_DATA(&s3c24xx->ac97.regs.data[offset]); } @@ -3168,14 +3168,14 @@ static DEVICE_START( s3c24xx ) { s3c24xx_t *s3c24xx = get_token( device); s3c24xx->iface = (const s3c24xx_interface *)device->baseconfig().static_config(); - for (int i = 0; i < 5; i++) s3c24xx->pwm.timer[i] = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_pwm_timer_exp), (void*)device); - for (int i = 0; i < 4; i++) s3c24xx->dma[i].timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_dma_timer_exp), (void*)device); - s3c24xx->iic.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_iic_timer_exp), (void*)device); - s3c24xx->iis.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_iis_timer_exp), (void*)device); - s3c24xx->lcd.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_lcd_timer_exp), (void*)device); - s3c24xx->rtc.timer_tick_count = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_rtc_timer_tick_count_exp), (void*)device); - s3c24xx->rtc.timer_update = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_rtc_timer_update_exp), (void*)device); - s3c24xx->wdt.timer = device->machine->scheduler().timer_alloc( FUNC(s3c24xx_wdt_timer_exp), (void*)device); + for (int i = 0; i < 5; i++) s3c24xx->pwm.timer[i] = device->machine().scheduler().timer_alloc( FUNC(s3c24xx_pwm_timer_exp), (void*)device); + for (int i = 0; i < 4; i++) s3c24xx->dma[i].timer = device->machine().scheduler().timer_alloc( FUNC(s3c24xx_dma_timer_exp), (void*)device); + s3c24xx->iic.timer = device->machine().scheduler().timer_alloc( FUNC(s3c24xx_iic_timer_exp), (void*)device); + s3c24xx->iis.timer = device->machine().scheduler().timer_alloc( FUNC(s3c24xx_iis_timer_exp), (void*)device); + s3c24xx->lcd.timer = device->machine().scheduler().timer_alloc( FUNC(s3c24xx_lcd_timer_exp), (void*)device); + s3c24xx->rtc.timer_tick_count = device->machine().scheduler().timer_alloc( FUNC(s3c24xx_rtc_timer_tick_count_exp), (void*)device); + s3c24xx->rtc.timer_update = device->machine().scheduler().timer_alloc( FUNC(s3c24xx_rtc_timer_update_exp), (void*)device); + s3c24xx->wdt.timer = device->machine().scheduler().timer_alloc( FUNC(s3c24xx_wdt_timer_exp), (void*)device); s3c24xx->rtc.timer_update->adjust( attotime::from_msec( 1000), 0, attotime::from_msec( 1000)); s3c24xx_rtc_init( device); } diff --git a/src/emu/machine/scsi.c b/src/emu/machine/scsi.c index 1ddf429bed8..9506bb1fe0a 100644 --- a/src/emu/machine/scsi.c +++ b/src/emu/machine/scsi.c @@ -1,12 +1,12 @@ #include "emu.h" #include "scsi.h" -void SCSIAllocInstance( running_machine *machine, const SCSIClass *scsiClass, SCSIInstance **instance, const char *diskregion ) +void SCSIAllocInstance( running_machine &machine, const SCSIClass *scsiClass, SCSIInstance **instance, const char *diskregion ) { SCSIAllocInstanceParams params; params.instance = NULL; params.diskregion = diskregion; - params.machine = machine; + params.m_machine = &machine; scsiClass->dispatch( SCSIOP_ALLOC_INSTANCE, (void *)scsiClass, 0, ¶ms ); *instance = params.instance; } @@ -104,11 +104,11 @@ int SCSIBase( const SCSIClass *scsiClass, int operation, void *file, INT64 intpa return scsiClass->baseClass->dispatch( operation, file, intparm, ptrparm ); } -SCSIInstance *SCSIMalloc( running_machine *machine, const SCSIClass *scsiClass ) +SCSIInstance *SCSIMalloc( running_machine &machine, const SCSIClass *scsiClass ) { SCSIInstance *scsiInstance = (SCSIInstance *)auto_alloc_array(machine, UINT8, SCSISizeof( scsiClass )); scsiInstance->scsiClass = scsiClass; - scsiInstance->machine = machine; + scsiInstance->m_machine = &machine; return scsiInstance; } diff --git a/src/emu/machine/scsi.h b/src/emu/machine/scsi.h index 3bc85c05417..b040e32230a 100644 --- a/src/emu/machine/scsi.h +++ b/src/emu/machine/scsi.h @@ -20,15 +20,17 @@ typedef struct _SCSIClass typedef struct { + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } const SCSIClass *scsiClass; - running_machine *machine; + running_machine *m_machine; } SCSIInstance; typedef struct { + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } SCSIInstance *instance; const char *diskregion; - running_machine *machine; + running_machine *m_machine; } SCSIAllocInstanceParams; // commands accepted by a SCSI device's dispatch handler @@ -84,7 +86,7 @@ enum #define SCSI_PHASE_MESSAGE_OUT ( 6 ) #define SCSI_PHASE_MESSAGE_IN ( 7 ) -extern void SCSIAllocInstance( running_machine *machine, const SCSIClass *scsiClass, SCSIInstance **instance, const char *diskregion ); +extern void SCSIAllocInstance( running_machine &machine, const SCSIClass *scsiClass, SCSIInstance **instance, const char *diskregion ); extern void SCSIDeleteInstance( SCSIInstance *instance ); extern void SCSISetDevice( SCSIInstance *instance, void *device ); extern void SCSIGetDevice( SCSIInstance *instance, void **device ); @@ -97,7 +99,7 @@ extern void SCSIReadData( SCSIInstance *instance, void *data, int dataLength ); extern void SCSISetPhase( SCSIInstance *instance, int phase ); extern void SCSIGetPhase( SCSIInstance *instance, int *phase ); -extern SCSIInstance *SCSIMalloc( running_machine *machine, const SCSIClass *scsiClass ); +extern SCSIInstance *SCSIMalloc( running_machine &machine, const SCSIClass *scsiClass ); extern int SCSIBase( const SCSIClass *scsiClass, int operation, void *file, INT64 intparm, UINT8 *ptrparm ); extern void *SCSIThis( const SCSIClass *scsiClass, SCSIInstance *instance ); extern int SCSISizeof( const SCSIClass *scsiClass ); diff --git a/src/emu/machine/scsicd.c b/src/emu/machine/scsicd.c index 8dfb0ff7e72..3034981819f 100644 --- a/src/emu/machine/scsicd.c +++ b/src/emu/machine/scsicd.c @@ -70,7 +70,7 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) return SCSILengthFromUINT8( &command[ 4 ] ); case 0x1b: // START STOP UNIT - cdda = cdda_from_cdrom(scsiInstance->machine, cdrom); + cdda = cdda_from_cdrom(scsiInstance->machine(), cdrom); if (cdda != NULL) { cdda_stop_audio(cdda); @@ -103,7 +103,7 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) our_this->cur_subblock = 0; } - cdda = cdda_from_cdrom(scsiInstance->machine, cdrom); + cdda = cdda_from_cdrom(scsiInstance->machine(), cdrom); if (cdda != NULL) { cdda_stop_audio(cdda); @@ -143,7 +143,7 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) length = 4; } - cdda = cdda_from_cdrom(scsiInstance->machine, cdrom); + cdda = cdda_from_cdrom(scsiInstance->machine(), cdrom); if (cdda != NULL) { cdda_stop_audio(cdda); @@ -173,7 +173,7 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) if (cdrom_get_track_type(cdrom, trk) == CD_TRACK_AUDIO) { our_this->play_err_flag = 0; - cdda = cdda_from_cdrom(scsiInstance->machine, cdrom); + cdda = cdda_from_cdrom(scsiInstance->machine(), cdrom); if (cdda != NULL) cdda_start_audio(cdda, our_this->lba, our_this->blocks); } @@ -203,7 +203,7 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) if (our_this->blocks && cdrom) { - cdda = cdda_from_cdrom(scsiInstance->machine, cdrom); + cdda = cdda_from_cdrom(scsiInstance->machine(), cdrom); if (cdda != NULL) cdda_start_audio(cdda, our_this->lba, our_this->blocks); } @@ -215,7 +215,7 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) case 0x4b: // PAUSE/RESUME if (cdrom) { - cdda = cdda_from_cdrom(scsiInstance->machine, cdrom); + cdda = cdda_from_cdrom(scsiInstance->machine(), cdrom); if (cdda != NULL) cdda_pause_audio(cdda, (command[8] & 0x01) ^ 0x01); } @@ -254,7 +254,7 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) if (cdrom_get_track_type(cdrom, trk) == CD_TRACK_AUDIO) { our_this->play_err_flag = 0; - cdda = cdda_from_cdrom(scsiInstance->machine, cdrom); + cdda = cdda_from_cdrom(scsiInstance->machine(), cdrom); if (cdda != NULL) cdda_start_audio(cdda, our_this->lba, our_this->blocks); } @@ -282,7 +282,7 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) our_this->cur_subblock = 0; } - cdda = cdda_from_cdrom(scsiInstance->machine, cdrom); + cdda = cdda_from_cdrom(scsiInstance->machine(), cdrom); if (cdda != NULL) { cdda_stop_audio(cdda); @@ -329,7 +329,7 @@ static void scsicd_read_data( SCSIInstance *scsiInstance, UINT8 *data, int dataL data[0] = 0x71; // deferred error - cdda = cdda_from_cdrom(scsiInstance->machine, cdrom); + cdda = cdda_from_cdrom(scsiInstance->machine(), cdrom); if (cdda != NULL && cdda_audio_active(cdda)) { data[12] = 0x00; @@ -422,7 +422,7 @@ static void scsicd_read_data( SCSIInstance *scsiInstance, UINT8 *data, int dataL msf = command[1] & 0x2; - cdda = cdda_from_cdrom(scsiInstance->machine, cdrom); + cdda = cdda_from_cdrom(scsiInstance->machine(), cdrom); audio_active = cdda != NULL && cdda_audio_active(cdda); if (audio_active) { @@ -671,7 +671,7 @@ static void scsicd_write_data( SCSIInstance *scsiInstance, UINT8 *data, int data static void scsicd_alloc_instance( SCSIInstance *scsiInstance, const char *diskregion ) { - running_machine *machine = scsiInstance->machine; + running_machine &machine = scsiInstance->machine(); SCSICd *our_this = (SCSICd *)SCSIThis( &SCSIClassCDROM, scsiInstance ); our_this->lba = 0; @@ -690,9 +690,9 @@ static void scsicd_alloc_instance( SCSIInstance *scsiInstance, const char *diskr state_save_register_item( machine, "scsicd", diskregion, 0, our_this->cur_subblock ); state_save_register_item( machine, "scsicd", diskregion, 0, our_this->play_err_flag ); - if (machine->device( diskregion )) { + if (machine.device( diskregion )) { our_this->is_file = TRUE; - our_this->cdrom = cd_get_cdrom_file( machine->device( diskregion ) ); + our_this->cdrom = cd_get_cdrom_file( machine.device( diskregion ) ); } else { our_this->is_file = FALSE; our_this->cdrom = cdrom_open(get_disk_handle( machine, diskregion )); diff --git a/src/emu/machine/scsidev.c b/src/emu/machine/scsidev.c index 0018fa17305..c20f8f23ac8 100644 --- a/src/emu/machine/scsidev.c +++ b/src/emu/machine/scsidev.c @@ -28,7 +28,7 @@ static int scsidev_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) return 0; default: - logerror( "%s: SCSIDEV unknown command %02x\n", scsiInstance->machine->describe_context(), command[ 0 ] ); + logerror( "%s: SCSIDEV unknown command %02x\n", scsiInstance->machine().describe_context(), command[ 0 ] ); return 0; } } @@ -43,7 +43,7 @@ static void scsidev_read_data( SCSIInstance *scsiInstance, UINT8 *data, int data switch( command[ 0 ] ) { default: - logerror( "%s: SCSIDEV unknown read %02x\n", scsiInstance->machine->describe_context(), command[ 0 ] ); + logerror( "%s: SCSIDEV unknown read %02x\n", scsiInstance->machine().describe_context(), command[ 0 ] ); break; } } @@ -58,7 +58,7 @@ static void scsidev_write_data( SCSIInstance *scsiInstance, UINT8 *data, int dat switch( command[ 0 ] ) { default: - logerror( "%s: SCSIDEV unknown write %02x\n", scsiInstance->machine->describe_context(), command[ 0 ] ); + logerror( "%s: SCSIDEV unknown write %02x\n", scsiInstance->machine().describe_context(), command[ 0 ] ); break; } } @@ -100,7 +100,7 @@ static int scsidev_get_command( SCSIInstance *scsiInstance, void **command ) static void scsidev_alloc_instance( SCSIInstance *scsiInstance, const char *diskregion ) { - running_machine *machine = scsiInstance->machine; + running_machine &machine = scsiInstance->machine(); SCSIDev *our_this = (SCSIDev *)SCSIThis( &SCSIClassDevice, scsiInstance ); state_save_register_item_array( machine, "scsidev", diskregion, 0, our_this->command ); @@ -141,12 +141,12 @@ static int scsidev_dispatch( int operation, void *file, INT64 intparm, void *ptr case SCSIOP_ALLOC_INSTANCE: params = (SCSIAllocInstanceParams *)ptrparm; - params->instance = SCSIMalloc( params->machine, (const SCSIClass *)file ); + params->instance = SCSIMalloc( params->machine(), (const SCSIClass *)file ); scsidev_alloc_instance( params->instance, params->diskregion ); return 0; case SCSIOP_DELETE_INSTANCE: - auto_free( ((SCSIInstance *)file)->machine, file ); + auto_free( ((SCSIInstance *)file)->machine(), file ); return 0; } return 0; diff --git a/src/emu/machine/scsihd.c b/src/emu/machine/scsihd.c index 64b99c0c2c3..b3b6c340c8a 100644 --- a/src/emu/machine/scsihd.c +++ b/src/emu/machine/scsihd.c @@ -245,7 +245,7 @@ static void scsihd_write_data( SCSIInstance *scsiInstance, UINT8 *data, int data static void scsihd_alloc_instance( SCSIInstance *scsiInstance, const char *diskregion ) { - running_machine *machine = scsiInstance->machine; + running_machine &machine = scsiInstance->machine(); SCSIHd *our_this = (SCSIHd *)SCSIThis( &SCSIClassHARDDISK, scsiInstance ); our_this->lba = 0; @@ -254,9 +254,9 @@ static void scsihd_alloc_instance( SCSIInstance *scsiInstance, const char *diskr state_save_register_item( machine, "scsihd", diskregion, 0, our_this->lba ); state_save_register_item( machine, "scsihd", diskregion, 0, our_this->blocks ); - if (machine->device( diskregion )) { + if (machine.device( diskregion )) { our_this->is_file = TRUE; - our_this->disk = hd_get_hard_disk_file( machine->device( diskregion ) ); + our_this->disk = hd_get_hard_disk_file( machine.device( diskregion ) ); } else { our_this->is_file = FALSE; our_this->disk = hard_disk_open(get_disk_handle( machine, diskregion )); diff --git a/src/emu/machine/smc91c9x.c b/src/emu/machine/smc91c9x.c index 8e37f8f65a9..94c9afd9c27 100644 --- a/src/emu/machine/smc91c9x.c +++ b/src/emu/machine/smc91c9x.c @@ -376,7 +376,7 @@ READ16_DEVICE_HANDLER( smc91c9x_r ) } if (LOG_ETHERNET && offset != EREG_BANK) - logerror("%s:smc91c9x_r(%s) = %04X & %04X\n", device->machine->describe_context(), ethernet_regname[offset], result, mem_mask); + logerror("%s:smc91c9x_r(%s) = %04X & %04X\n", device->machine().describe_context(), ethernet_regname[offset], result, mem_mask); return result; } @@ -401,7 +401,7 @@ WRITE16_DEVICE_HANDLER( smc91c9x_w ) COMBINE_DATA(&smc->reg[offset]); if (LOG_ETHERNET && offset != 7) - logerror("%s:smc91c9x_w(%s) = %04X & %04X\n", device->machine->describe_context(), ethernet_regname[offset], data, mem_mask); + logerror("%s:smc91c9x_w(%s) = %04X & %04X\n", device->machine().describe_context(), ethernet_regname[offset], data, mem_mask); /* handle it */ switch (offset) @@ -516,7 +516,6 @@ static DEVICE_START( smc91c9x ) assert(device != NULL); assert(device->baseconfig().static_config() == NULL); assert(downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config() != NULL); - assert(device->machine != NULL); /* store a pointer back to the device */ smc->device = device; diff --git a/src/emu/machine/timekpr.c b/src/emu/machine/timekpr.c index 2cce3bc68eb..79bd13627ca 100644 --- a/src/emu/machine/timekpr.c +++ b/src/emu/machine/timekpr.c @@ -62,7 +62,7 @@ #define TIMEKPR_DEVCFG_DERIVED_DEV_ALLOC(devtype) \ device_t *devtype##_device_config::alloc_device(running_machine &machine) const \ - { return auto_alloc(&machine, devtype##_device(machine, *this)); } + { return auto_alloc(machine, devtype##_device(machine, *this)); } #define TIMEKPR_DERIVE(devtype, name, shortname) \ TIMEKPR_DEV_DERIVED_CTOR(devtype) \ @@ -104,7 +104,7 @@ device_config *timekeeper_device_config::static_alloc_device_config(const machin device_t *timekeeper_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, timekeeper_device(machine, *this)); + return auto_alloc(machine, timekeeper_device(machine, *this)); } /*************************************************************************** @@ -211,7 +211,7 @@ void timekeeper_device::device_start() m_month = make_bcd( systime.local_time.month + 1 ); m_year = make_bcd( systime.local_time.year % 100 ); m_century = make_bcd( systime.local_time.year / 100 ); - m_data = auto_alloc_array( &m_machine, UINT8, m_size ); + m_data = auto_alloc_array( m_machine, UINT8, m_size ); m_default_data = *region(); if (m_default_data) diff --git a/src/emu/machine/tmp68301.c b/src/emu/machine/tmp68301.c index 2767b2277d5..3c09130fc2f 100644 --- a/src/emu/machine/tmp68301.c +++ b/src/emu/machine/tmp68301.c @@ -18,12 +18,12 @@ static emu_timer *tmp68301_timer[3]; // 3 Timers static int tmp68301_irq_vector[8]; -static void tmp68301_update_timer( running_machine *machine, int i ); +static void tmp68301_update_timer( running_machine &machine, int i ); static IRQ_CALLBACK(tmp68301_irq_callback) { int vector = tmp68301_irq_vector[irqline]; -// logerror("%s: irq callback returns %04X for level %x\n",machine->describe_context(),vector,int_level); +// logerror("%s: irq callback returns %04X for level %x\n",machine.describe_context(),vector,int_level); return vector; } @@ -35,7 +35,7 @@ static TIMER_CALLBACK( tmp68301_timer_callback ) UINT16 ICR = tmp68301_regs[0x8e/2+i]; // Interrupt Controller Register (ICR7..9) UINT16 IVNR = tmp68301_regs[0x9a/2]; // Interrupt Vector Number Register (IVNR) -// logerror("s: callback timer %04X, j = %d\n",machine->describe_context(),i,tcount); +// logerror("s: callback timer %04X, j = %d\n",machine.describe_context(),i,tcount); if ( (TCR & 0x0004) && // INT !(IMR & (0x100<<i)) @@ -47,7 +47,7 @@ static TIMER_CALLBACK( tmp68301_timer_callback ) tmp68301_irq_vector[level] = IVNR & 0x00e0; tmp68301_irq_vector[level] += 4+i; - device_set_input_line(machine->firstcpu,level,HOLD_LINE); + device_set_input_line(machine.firstcpu,level,HOLD_LINE); } if (TCR & 0x0080) // N/1 @@ -61,7 +61,7 @@ static TIMER_CALLBACK( tmp68301_timer_callback ) } } -static void tmp68301_update_timer( running_machine *machine, int i ) +static void tmp68301_update_timer( running_machine &machine, int i ) { UINT16 TCR = tmp68301_regs[(0x200 + i * 0x20)/2]; UINT16 MAX1 = tmp68301_regs[(0x204 + i * 0x20)/2]; @@ -90,19 +90,19 @@ static void tmp68301_update_timer( running_machine *machine, int i ) { int scale = (TCR & 0x3c00)>>10; // P4..1 if (scale > 8) scale = 8; - duration = attotime::from_hz(machine->firstcpu->unscaled_clock()) * ((1 << scale) * max); + duration = attotime::from_hz(machine.firstcpu->unscaled_clock()) * ((1 << scale) * max); } break; } -// logerror("%s: TMP68301 Timer %d, duration %lf, max %04X\n",machine->describe_context(),i,duration,max); +// logerror("%s: TMP68301 Timer %d, duration %lf, max %04X\n",machine.describe_context(),i,duration,max); if (!(TCR & 0x0002)) // CS { if (duration != attotime::zero) tmp68301_timer[i]->adjust(duration,i); else - logerror("%s: TMP68301 error, timer %d duration is 0\n",machine->describe_context(),i); + logerror("%s: TMP68301 error, timer %d duration is 0\n",machine.describe_context(),i); } } @@ -110,7 +110,7 @@ MACHINE_START( tmp68301 ) { int i; for (i = 0; i < 3; i++) - tmp68301_timer[i] = machine->scheduler().timer_alloc(FUNC(tmp68301_timer_callback)); + tmp68301_timer[i] = machine.scheduler().timer_alloc(FUNC(tmp68301_timer_callback)); } MACHINE_RESET( tmp68301 ) @@ -120,11 +120,11 @@ MACHINE_RESET( tmp68301 ) for (i = 0; i < 3; i++) tmp68301_IE[i] = 0; - device_set_irq_callback(machine->firstcpu, tmp68301_irq_callback); + device_set_irq_callback(machine.firstcpu, tmp68301_irq_callback); } /* Update the IRQ state based on all possible causes */ -static void update_irq_state(running_machine *machine) +static void update_irq_state(running_machine &machine) { int i; @@ -150,7 +150,7 @@ static void update_irq_state(running_machine *machine) tmp68301_IE[i] = 0; // Interrupts are edge triggerred - device_set_input_line(machine->firstcpu,level,HOLD_LINE); + device_set_input_line(machine.firstcpu,level,HOLD_LINE); } } } @@ -177,13 +177,13 @@ WRITE16_HANDLER( tmp68301_regs_w ) { int i = ((offset*2) >> 5) & 3; - tmp68301_update_timer( space->machine, i ); + tmp68301_update_timer( space->machine(), i ); } break; } } -void tmp68301_external_interrupt_0(running_machine *machine) { tmp68301_IE[0] = 1; update_irq_state(machine); } -void tmp68301_external_interrupt_1(running_machine *machine) { tmp68301_IE[1] = 1; update_irq_state(machine); } -void tmp68301_external_interrupt_2(running_machine *machine) { tmp68301_IE[2] = 1; update_irq_state(machine); } +void tmp68301_external_interrupt_0(running_machine &machine) { tmp68301_IE[0] = 1; update_irq_state(machine); } +void tmp68301_external_interrupt_1(running_machine &machine) { tmp68301_IE[1] = 1; update_irq_state(machine); } +void tmp68301_external_interrupt_2(running_machine &machine) { tmp68301_IE[2] = 1; update_irq_state(machine); } diff --git a/src/emu/machine/tmp68301.h b/src/emu/machine/tmp68301.h index c57407d68c8..c83c249c839 100644 --- a/src/emu/machine/tmp68301.h +++ b/src/emu/machine/tmp68301.h @@ -10,8 +10,8 @@ READ16_HANDLER( tmp68301_regs_r ); WRITE16_HANDLER( tmp68301_regs_w ); // Interrupts -void tmp68301_external_interrupt_0(running_machine *machine); -void tmp68301_external_interrupt_1(running_machine *machine); -void tmp68301_external_interrupt_2(running_machine *machine); +void tmp68301_external_interrupt_0(running_machine &machine); +void tmp68301_external_interrupt_1(running_machine &machine); +void tmp68301_external_interrupt_2(running_machine &machine); #endif diff --git a/src/emu/machine/wd33c93.c b/src/emu/machine/wd33c93.c index 3f093a69c64..df05fadf910 100644 --- a/src/emu/machine/wd33c93.c +++ b/src/emu/machine/wd33c93.c @@ -168,8 +168,8 @@ static const struct WD33C93interface *intf; #define SRCID_ER 0x80 /* command handler definition */ -typedef void (*cmd_handler)(running_machine *machine); -#define CMD_HANDLER(name) void name(running_machine *machine) +typedef void (*cmd_handler)(running_machine &machine); +#define CMD_HANDLER(name) void name(running_machine &machine) #define TEMP_INPUT_LEN 262144 #define FIFO_SIZE 12 @@ -235,7 +235,7 @@ static void wd33c93_read_data(int bytes, UINT8 *pData) } } -static void wd33c93_complete_immediate( running_machine *machine, int status ) +static void wd33c93_complete_immediate( running_machine &machine, int status ) { /* reset our timer */ scsi_data.cmd_timer->reset( ); @@ -293,7 +293,7 @@ static void wd33c93_complete_cmd( UINT8 status ) /* command handlers */ static CMD_HANDLER( wd33c93_invalid_cmd ) { - logerror( "%s:Unknown/Unimplemented SCSI controller command: %02x\n", machine->describe_context(), scsi_data.regs[WD_COMMAND] ); + logerror( "%s:Unknown/Unimplemented SCSI controller command: %02x\n", machine.describe_context(), scsi_data.regs[WD_COMMAND] ); /* complete the command */ wd33c93_complete_cmd( CSR_INVALID ); @@ -352,7 +352,7 @@ static CMD_HANDLER( wd33c93_select_cmd ) } /* queue up a service request out in the future */ - machine->scheduler().timer_set( attotime::from_usec(50), FUNC(wd33c93_service_request )); + machine.scheduler().timer_set( attotime::from_usec(50), FUNC(wd33c93_service_request )); } else { @@ -424,7 +424,7 @@ static CMD_HANDLER( wd33c93_selectxfer_cmd ) scsi_data.busphase = PHS_MESS_IN; /* queue up a service request out in the future */ - machine->scheduler().timer_set( attotime::from_msec(50), FUNC(wd33c93_service_request )); + machine.scheduler().timer_set( attotime::from_msec(50), FUNC(wd33c93_service_request )); } } else @@ -454,7 +454,7 @@ static CMD_HANDLER( wd33c93_xferinfo_cmd ) scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_CIP; /* the command will be completed once the data is transferred */ - machine->scheduler().timer_set( attotime::from_msec(1), FUNC(wd33c93_deassert_cip )); + machine.scheduler().timer_set( attotime::from_msec(1), FUNC(wd33c93_deassert_cip )); } /* Command handlers */ @@ -497,7 +497,7 @@ static const cmd_handler wd33c93_cmds[0x22] = }; /* Handle pending commands */ -static void wd33c93_command( running_machine *machine ) +static void wd33c93_command( running_machine &machine ) { /* get the command */ UINT8 cmd = scsi_data.regs[WD_COMMAND]; @@ -540,7 +540,7 @@ WRITE8_HANDLER(wd33c93_w) scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_CIP; /* process the command */ - wd33c93_command(space->machine); + wd33c93_command(space->machine()); } else if ( scsi_data.sasr == WD_CDB_1 ) { @@ -635,7 +635,7 @@ WRITE8_HANDLER(wd33c93_w) } /* complete the command */ - wd33c93_complete_immediate(space->machine, CSR_XFER_DONE | scsi_data.busphase); + wd33c93_complete_immediate(space->machine(), CSR_XFER_DONE | scsi_data.busphase); } } else @@ -682,7 +682,7 @@ READ8_HANDLER(wd33c93_r) if (intf && intf->irq_callback) { - intf->irq_callback(space->machine, 0); + intf->irq_callback(space->machine(), 0); } LOG(( "WD33C93: PC=%08x - Status read (%02x)\n", cpu_get_pc(space->cpu), scsi_data.regs[WD_SCSI_STATUS] )); @@ -778,7 +778,7 @@ READ8_HANDLER(wd33c93_r) return 0; } -void wd33c93_init( running_machine *machine, const struct WD33C93interface *interface ) +void wd33c93_init( running_machine &machine, const struct WD33C93interface *interface ) { int i; @@ -795,7 +795,7 @@ void wd33c93_init( running_machine *machine, const struct WD33C93interface *inte } /* allocate a timer for commands */ - scsi_data.cmd_timer = machine->scheduler().timer_alloc(FUNC(wd33c93_complete_cb)); + scsi_data.cmd_timer = machine.scheduler().timer_alloc(FUNC(wd33c93_complete_cb)); scsi_data.temp_input = auto_alloc_array( machine, UINT8, TEMP_INPUT_LEN ); diff --git a/src/emu/machine/wd33c93.h b/src/emu/machine/wd33c93.h index 7598aa99cb4..2804019dbbc 100644 --- a/src/emu/machine/wd33c93.h +++ b/src/emu/machine/wd33c93.h @@ -11,10 +11,10 @@ struct WD33C93interface { const SCSIConfigTable *scsidevs; /* SCSI devices */ - void (*irq_callback)(running_machine *machine, int state); /* irq callback */ + void (*irq_callback)(running_machine &machine, int state); /* irq callback */ }; -extern void wd33c93_init( running_machine *machine, const struct WD33C93interface *interface ); +extern void wd33c93_init( running_machine &machine, const struct WD33C93interface *interface ); extern void wd33c93_exit( const struct WD33C93interface *interface ); extern void wd33c93_get_dma_data(int bytes, UINT8 *pData); extern void wd33c93_write_data(int bytes, UINT8 *pData); diff --git a/src/emu/machine/x2212.c b/src/emu/machine/x2212.c index 81f76677f0a..e246ca53e05 100644 --- a/src/emu/machine/x2212.c +++ b/src/emu/machine/x2212.c @@ -62,7 +62,7 @@ device_config *x2212_device_config::static_alloc_device_config(const machine_con device_t *x2212_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, x2212_device(machine, *this)); + return auto_alloc(machine, x2212_device(machine, *this)); } diff --git a/src/emu/machine/x76f041.c b/src/emu/machine/x76f041.c index 6844c2ac507..6070a120a54 100644 --- a/src/emu/machine/x76f041.c +++ b/src/emu/machine/x76f041.c @@ -25,7 +25,7 @@ inline void ATTR_PRINTF(3,4) x76f041_device::verboselog(int n_level, const char va_start(v, s_fmt); vsprintf(buf, s_fmt, v); va_end(v); - logerror("x76f041 %s %s: %s", config.tag(), machine->describe_context(), buf); + logerror("x76f041 %s %s: %s", config.tag(), m_machine.describe_context(), buf); } } @@ -43,7 +43,7 @@ device_config *x76f041_device_config::static_alloc_device_config(const machine_c device_t *x76f041_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, x76f041_device(machine, *this)); + return auto_alloc(machine, x76f041_device(machine, *this)); } x76f041_device::x76f041_device(running_machine &_machine, const x76f041_device_config &_config) diff --git a/src/emu/machine/x76f100.c b/src/emu/machine/x76f100.c index 222a8d540f6..e89ec08b015 100644 --- a/src/emu/machine/x76f100.c +++ b/src/emu/machine/x76f100.c @@ -23,7 +23,7 @@ inline void ATTR_PRINTF(3,4) x76f100_device::verboselog(int n_level, const char va_start(v, s_fmt); vsprintf(buf, s_fmt, v); va_end(v); - logerror("x76f100 %s %s: %s", config.tag(), machine->describe_context(), buf); + logerror("x76f100 %s %s: %s", config.tag(), m_machine.describe_context(), buf); } } @@ -41,7 +41,7 @@ device_config *x76f100_device_config::static_alloc_device_config(const machine_c device_t *x76f100_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, x76f100_device(machine, *this)); + return auto_alloc(machine, x76f100_device(machine, *this)); } x76f100_device::x76f100_device(running_machine &_machine, const x76f100_device_config &_config) diff --git a/src/emu/machine/z80ctc.c b/src/emu/machine/z80ctc.c index e112707233b..fe195f62913 100644 --- a/src/emu/machine/z80ctc.c +++ b/src/emu/machine/z80ctc.c @@ -108,7 +108,7 @@ device_config *z80ctc_device_config::static_alloc_device_config(const machine_co device_t *z80ctc_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, z80ctc_device(machine, *this)); + return auto_alloc(machine, z80ctc_device(machine, *this)); } @@ -336,7 +336,7 @@ void z80ctc_device::ctc_channel::start(z80ctc_device *device, int index, bool no if (write_line != NULL) devcb_resolve_write_line(&m_zc, write_line, m_device); m_notimer = notimer; - m_timer = m_device->machine->scheduler().timer_alloc(FUNC(static_timer_callback), this); + m_timer = m_device->machine().scheduler().timer_alloc(FUNC(static_timer_callback), this); // register for save states m_device->save_item(NAME(m_mode), m_index); diff --git a/src/emu/machine/z80dart.c b/src/emu/machine/z80dart.c index e23b39a65d8..6058d8d7148 100644 --- a/src/emu/machine/z80dart.c +++ b/src/emu/machine/z80dart.c @@ -221,7 +221,7 @@ device_config *z80dart_device_config::static_alloc_device_config(const machine_c device_t *z80dart_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, z80dart_device(machine, *this)); + return auto_alloc(machine, z80dart_device(machine, *this)); } diff --git a/src/emu/machine/z80dma.c b/src/emu/machine/z80dma.c index 8f027e5037d..0ae998debcd 100644 --- a/src/emu/machine/z80dma.c +++ b/src/emu/machine/z80dma.c @@ -172,7 +172,7 @@ device_config *z80dma_device_config::static_alloc_device_config(const machine_co device_t *z80dma_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, z80dma_device(machine, *this)); + return auto_alloc(machine, z80dma_device(machine, *this)); } diff --git a/src/emu/machine/z80pio.c b/src/emu/machine/z80pio.c index 3ca7bbd330c..1e6c123d308 100644 --- a/src/emu/machine/z80pio.c +++ b/src/emu/machine/z80pio.c @@ -84,7 +84,7 @@ device_config *z80pio_device_config::static_alloc_device_config(const machine_co device_t *z80pio_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, z80pio_device(machine, *this)); + return auto_alloc(machine, z80pio_device(machine, *this)); } diff --git a/src/emu/machine/z80sio.c b/src/emu/machine/z80sio.c index cb39ca4c90d..71e99630a02 100644 --- a/src/emu/machine/z80sio.c +++ b/src/emu/machine/z80sio.c @@ -326,7 +326,7 @@ device_config *z80sio_device_config::static_alloc_device_config(const machine_co device_t *z80sio_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, z80sio_device(machine, *this)); + return auto_alloc(machine, z80sio_device(machine, *this)); } @@ -524,7 +524,7 @@ void z80sio_device::sio_channel::start(z80sio_device *device, int index) { m_device = device; m_index = index; - m_receive_timer = device->machine->scheduler().timer_alloc(FUNC(static_serial_callback), this); + m_receive_timer = device->machine().scheduler().timer_alloc(FUNC(static_serial_callback), this); } @@ -713,7 +713,7 @@ int z80sio_device::sio_channel::rts() void z80sio_device::sio_channel::set_cts(int state) { - m_device->machine->scheduler().synchronize(FUNC(static_change_input_line), (SIO_RR0_CTS << 1) + (state != 0), this); + m_device->machine().scheduler().synchronize(FUNC(static_change_input_line), (SIO_RR0_CTS << 1) + (state != 0), this); } @@ -723,7 +723,7 @@ void z80sio_device::sio_channel::set_cts(int state) void z80sio_device::sio_channel::set_dcd(int state) { - m_device->machine->scheduler().synchronize(FUNC(static_change_input_line), (SIO_RR0_DCD << 1) + (state != 0), this); + m_device->machine().scheduler().synchronize(FUNC(static_change_input_line), (SIO_RR0_DCD << 1) + (state != 0), this); } diff --git a/src/emu/machine/z80sti.c b/src/emu/machine/z80sti.c index 61442abc32d..6be81805b97 100644 --- a/src/emu/machine/z80sti.c +++ b/src/emu/machine/z80sti.c @@ -175,7 +175,7 @@ device_config *z80sti_device_config::static_alloc_device_config(const machine_co device_t *z80sti_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, z80sti_device(machine, *this)); + return auto_alloc(machine, z80sti_device(machine, *this)); } diff --git a/src/emu/mame.c b/src/emu/mame.c index 1cbfa192f72..65d671b32ef 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -129,9 +129,9 @@ const char mame_disclaimer[] = given machine is valid -------------------------------------------------*/ -int mame_is_valid_machine(running_machine *machine) +int mame_is_valid_machine(running_machine &machine) { - return (machine != NULL && machine == global_machine); + return (&machine == global_machine); } diff --git a/src/emu/mame.h b/src/emu/mame.h index 5132fd3f659..52a0399dc55 100644 --- a/src/emu/mame.h +++ b/src/emu/mame.h @@ -99,7 +99,7 @@ extern const char build_version[]; int mame_execute(emu_options &options, osd_interface &osd); /* return true if the given machine is valid */ -int mame_is_valid_machine(running_machine *machine); +int mame_is_valid_machine(running_machine &machine); diff --git a/src/emu/mconfig.h b/src/emu/mconfig.h index b52ec412234..05fb5500cb7 100644 --- a/src/emu/mconfig.h +++ b/src/emu/mconfig.h @@ -84,11 +84,11 @@ #define NVRAM_HANDLER_NAME(name) nvram_handler_##name -#define NVRAM_HANDLER(name) void NVRAM_HANDLER_NAME(name)(running_machine *machine, emu_file *file, int read_or_write) +#define NVRAM_HANDLER(name) void NVRAM_HANDLER_NAME(name)(running_machine &machine, emu_file *file, int read_or_write) #define NVRAM_HANDLER_CALL(name) NVRAM_HANDLER_NAME(name)(machine, file, read_or_write) #define MEMCARD_HANDLER_NAME(name) memcard_handler_##name -#define MEMCARD_HANDLER(name) void MEMCARD_HANDLER_NAME(name)(running_machine *machine, emu_file &file, int action) +#define MEMCARD_HANDLER(name) void MEMCARD_HANDLER_NAME(name)(running_machine &machine, emu_file &file, int action) #define MEMCARD_HANDLER_CALL(name) MEMCARD_HANDLER_NAME(name)(machine, file, action) @@ -110,8 +110,8 @@ class screen_device_config; // various callback functions -typedef void (*nvram_handler_func)(running_machine *machine, emu_file *file, int read_or_write); -typedef void (*memcard_handler_func)(running_machine *machine, emu_file &file, int action); +typedef void (*nvram_handler_func)(running_machine &machine, emu_file *file, int read_or_write); +typedef void (*memcard_handler_func)(running_machine &machine, emu_file &file, int action); diff --git a/src/emu/memory.c b/src/emu/memory.c index 45e3772a3cd..abb1b6c3873 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -190,13 +190,13 @@ AM_SIZE_MEMBER(struct, sizefield) Specifies a field within a given struct as where to store the base or size of the current bucket. The struct is assumed to be hanging - off of the machine->driver_data pointer. + off of the machine.driver_data pointer. AM_BASE_GENERIC(basefield) AM_SIZE_GENERIC(sizefield) Specifies a field within the global generic_pointers struct as where to store the base or size of the current bucket. The global - generic_pointer struct lives in machine->generic. + generic_pointer struct lives in machine.generic. ***************************************************************************/ @@ -788,7 +788,7 @@ private: { if (m_space.log_unmap() && !m_space.debugger_access()) logerror("%s: unmapped %s memory read from %s & %s\n", - m_space.m_machine.describe_context(), m_space.name(), + m_space.machine().describe_context(), m_space.name(), core_i64_hex_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars()), core_i64_hex_format(mask, 2 * sizeof(_UintType))); return m_space.unmap(); @@ -844,7 +844,7 @@ private: { if (m_space.log_unmap() && !m_space.debugger_access()) logerror("%s: unmapped %s memory write to %s = %s & %s\n", - m_space.m_machine.describe_context(), m_space.name(), + m_space.machine().describe_context(), m_space.name(), core_i64_hex_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars()), core_i64_hex_format(data, 2 * sizeof(_UintType)), core_i64_hex_format(mask, 2 * sizeof(_UintType))); @@ -1542,7 +1542,7 @@ UINT8 address_table::s_watchpoint_table[1 << LEVEL1_BITS]; static STATE_POSTLOAD( bank_reattach ); // debugging -static void generate_memdump(running_machine *machine); +static void generate_memdump(running_machine &machine); @@ -1554,21 +1554,21 @@ static void generate_memdump(running_machine *machine); // memory_init - initialize the memory system //------------------------------------------------- -void memory_init(running_machine *machine) +void memory_init(running_machine &machine) { // allocate our private data - memory_private *memdata = machine->memory_data = auto_alloc_clear(machine, memory_private); + memory_private *memdata = machine.memory_data = auto_alloc_clear(machine, memory_private); memdata->banknext = STATIC_BANK1; // loop over devices and spaces within each device device_memory_interface *memory = NULL; - for (bool gotone = machine->m_devicelist.first(memory); gotone; gotone = memory->next(memory)) + for (bool gotone = machine.m_devicelist.first(memory); gotone; gotone = memory->next(memory)) for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++) { // if there is a configuration for this space, we need an address space const address_space_config *spaceconfig = memory->space_config(spacenum); if (spaceconfig != NULL) - memdata->spacelist.append(address_space::allocate(*machine, *spaceconfig, *memory, spacenum)); + memdata->spacelist.append(address_space::allocate(machine, *spaceconfig, *memory, spacenum)); } // construct and preprocess the address_map for each space @@ -1588,7 +1588,7 @@ void memory_init(running_machine *machine) space->locate_memory(); // register a callback to reset banks when reloading state - machine->state().register_postload(bank_reattach, NULL); + machine.state().register_postload(bank_reattach, NULL); // dump the final memory configuration generate_memdump(machine); @@ -1597,9 +1597,9 @@ void memory_init(running_machine *machine) memdata->initialized = true; } -address_space *memory_nonspecific_space(running_machine *machine) +address_space *memory_nonspecific_space(running_machine &machine) { - memory_private *memdata = machine->memory_data; + memory_private *memdata = machine.memory_data; return memdata->spacelist.first(); } @@ -1614,10 +1614,10 @@ address_space *memory_nonspecific_space(running_machine *machine) // addresses for a bank //------------------------------------------------- -void memory_configure_bank(running_machine *machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) +void memory_configure_bank(running_machine &machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) { // validation checks - memory_bank *bank = machine->memory_data->bankmap.find_hash_only(tag); + memory_bank *bank = machine.memory_data->bankmap.find_hash_only(tag); if (bank == NULL) fatalerror("memory_configure_bank called for unknown bank '%s'", tag); if (base == NULL) @@ -1634,10 +1634,10 @@ void memory_configure_bank(running_machine *machine, const char *tag, int starte // the decrypted addresses for a bank //------------------------------------------------- -void memory_configure_bank_decrypted(running_machine *machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) +void memory_configure_bank_decrypted(running_machine &machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) { // validation checks - memory_bank *bank = machine->memory_data->bankmap.find_hash_only(tag); + memory_bank *bank = machine.memory_data->bankmap.find_hash_only(tag); if (bank == NULL) fatalerror("memory_configure_bank_decrypted called for unknown bank '%s'", tag); if (base == NULL) @@ -1654,10 +1654,10 @@ void memory_configure_bank_decrypted(running_machine *machine, const char *tag, // entry to be the new bank base //------------------------------------------------- -void memory_set_bank(running_machine *machine, const char *tag, int entrynum) +void memory_set_bank(running_machine &machine, const char *tag, int entrynum) { // validation checks - memory_bank *bank = machine->memory_data->bankmap.find_hash_only(tag); + memory_bank *bank = machine.memory_data->bankmap.find_hash_only(tag); if (bank == NULL) fatalerror("memory_set_bank called for unknown bank '%s'", tag); @@ -1671,10 +1671,10 @@ void memory_set_bank(running_machine *machine, const char *tag, int entrynum) // selected bank //------------------------------------------------- -int memory_get_bank(running_machine *machine, const char *tag) +int memory_get_bank(running_machine &machine, const char *tag) { // validation checks - memory_bank *bank = machine->memory_data->bankmap.find_hash_only(tag); + memory_bank *bank = machine.memory_data->bankmap.find_hash_only(tag); if (bank == NULL) fatalerror("memory_get_bank called for unknown bank '%s'", tag); @@ -1687,10 +1687,10 @@ int memory_get_bank(running_machine *machine, const char *tag) // memory_set_bankptr - set the base of a bank //------------------------------------------------- -void memory_set_bankptr(running_machine *machine, const char *tag, void *base) +void memory_set_bankptr(running_machine &machine, const char *tag, void *base) { // validation checks - memory_bank *bank = machine->memory_data->bankmap.find_hash_only(tag); + memory_bank *bank = machine.memory_data->bankmap.find_hash_only(tag); if (bank == NULL) throw emu_fatalerror("memory_set_bankptr called for unknown bank '%s'", tag); @@ -1725,14 +1725,14 @@ void *memory_get_shared(running_machine &machine, const char *tag, size_t &lengt // to the given file //------------------------------------------------- -void memory_dump(running_machine *machine, FILE *file) +void memory_dump(running_machine &machine, FILE *file) { // skip if we can't open the file if (file == NULL) return; // loop over address spaces - for (address_space *space = machine->memory_data->spacelist.first(); space != NULL; space = space->next()) + for (address_space *space = machine.memory_data->spacelist.first(); space != NULL; space = space->next()) { fprintf(file, "\n\n" "====================================================\n" @@ -1753,7 +1753,7 @@ void memory_dump(running_machine *machine, FILE *file) // generate_memdump - internal memory dump //------------------------------------------------- -static void generate_memdump(running_machine *machine) +static void generate_memdump(running_machine &machine) { if (MEM_DUMP) { @@ -1774,7 +1774,7 @@ static void generate_memdump(running_machine *machine) static STATE_POSTLOAD( bank_reattach ) { // for each non-anonymous bank, explicitly reset its entry - for (memory_bank *bank = machine->memory_data->banklist.first(); bank != NULL; bank = bank->next()) + for (memory_bank *bank = machine.memory_data->banklist.first(); bank != NULL; bank = bank->next()) if (!bank->anonymous() && bank->entry() != BANK_ENTRY_UNSPECIFIED) bank->set_entry(bank->entry()); } @@ -1790,12 +1790,11 @@ static STATE_POSTLOAD( bank_reattach ) //------------------------------------------------- address_space::address_space(device_memory_interface &memory, address_spacenum spacenum, bool large) - : machine(memory.device().machine), - cpu(&memory.device()), - m_machine(*memory.device().machine), + : cpu(&memory.device()), m_next(NULL), m_config(*memory.space_config(spacenum)), m_device(memory.device()), + m_machine(memory.device().machine()), m_map(NULL), m_addrmask(0xffffffffUL >> (32 - m_config.m_addrbus_width)), m_bytemask(address_to_byte_end(m_addrmask)), @@ -1805,7 +1804,7 @@ address_space::address_space(device_memory_interface &memory, address_spacenum s m_spacenum(spacenum), m_debugger_access(false), m_log_unmap(true), - m_direct(*auto_alloc(memory.device().machine, direct_read_data(*this))), + m_direct(*auto_alloc(memory.device().machine(), direct_read_data(*this))), m_name(memory.space_config(spacenum)->name()), m_addrchars((m_config.m_databus_width + 3) / 4), m_logaddrchars((m_config.m_logaddr_width + 3) / 4) @@ -1841,64 +1840,64 @@ address_space &address_space::allocate(running_machine &machine, const address_s if (config.endianness() == ENDIANNESS_LITTLE) { if (large) - return *auto_alloc(&machine, address_space_8le_large(memory, spacenum)); + return *auto_alloc(machine, address_space_8le_large(memory, spacenum)); else - return *auto_alloc(&machine, address_space_8le_small(memory, spacenum)); + return *auto_alloc(machine, address_space_8le_small(memory, spacenum)); } else { if (large) - return *auto_alloc(&machine, address_space_8be_large(memory, spacenum)); + return *auto_alloc(machine, address_space_8be_large(memory, spacenum)); else - return *auto_alloc(&machine, address_space_8be_small(memory, spacenum)); + return *auto_alloc(machine, address_space_8be_small(memory, spacenum)); } case 16: if (config.endianness() == ENDIANNESS_LITTLE) { if (large) - return *auto_alloc(&machine, address_space_16le_large(memory, spacenum)); + return *auto_alloc(machine, address_space_16le_large(memory, spacenum)); else - return *auto_alloc(&machine, address_space_16le_small(memory, spacenum)); + return *auto_alloc(machine, address_space_16le_small(memory, spacenum)); } else { if (large) - return *auto_alloc(&machine, address_space_16be_large(memory, spacenum)); + return *auto_alloc(machine, address_space_16be_large(memory, spacenum)); else - return *auto_alloc(&machine, address_space_16be_small(memory, spacenum)); + return *auto_alloc(machine, address_space_16be_small(memory, spacenum)); } case 32: if (config.endianness() == ENDIANNESS_LITTLE) { if (large) - return *auto_alloc(&machine, address_space_32le_large(memory, spacenum)); + return *auto_alloc(machine, address_space_32le_large(memory, spacenum)); else - return *auto_alloc(&machine, address_space_32le_small(memory, spacenum)); + return *auto_alloc(machine, address_space_32le_small(memory, spacenum)); } else { if (large) - return *auto_alloc(&machine, address_space_32be_large(memory, spacenum)); + return *auto_alloc(machine, address_space_32be_large(memory, spacenum)); else - return *auto_alloc(&machine, address_space_32be_small(memory, spacenum)); + return *auto_alloc(machine, address_space_32be_small(memory, spacenum)); } case 64: if (config.endianness() == ENDIANNESS_LITTLE) { if (large) - return *auto_alloc(&machine, address_space_64le_large(memory, spacenum)); + return *auto_alloc(machine, address_space_64le_large(memory, spacenum)); else - return *auto_alloc(&machine, address_space_64le_small(memory, spacenum)); + return *auto_alloc(machine, address_space_64le_small(memory, spacenum)); } else { if (large) - return *auto_alloc(&machine, address_space_64be_large(memory, spacenum)); + return *auto_alloc(machine, address_space_64be_large(memory, spacenum)); else - return *auto_alloc(&machine, address_space_64be_small(memory, spacenum)); + return *auto_alloc(machine, address_space_64be_small(memory, spacenum)); } } throw emu_fatalerror("Invalid width %d specified for address_space::allocate", config.data_width()); @@ -1964,7 +1963,7 @@ void address_space::prepare_map() if (entry->m_share != NULL && m_machine.memory_data->sharemap.find(entry->m_share) == NULL) { VPRINTF(("Creating share '%s' of length 0x%X\n", entry->m_share, entry->m_byteend + 1 - entry->m_bytestart)); - memory_share *share = auto_alloc(&m_machine, memory_share(entry->m_byteend + 1 - entry->m_bytestart)); + memory_share *share = auto_alloc(m_machine, memory_share(entry->m_byteend + 1 - entry->m_bytestart)); m_machine.memory_data->sharemap.add(entry->m_share, share, false); } @@ -2171,7 +2170,7 @@ void address_space::allocate_memory() memory_block *prev_memblock_tail = blocklist.last(); for (address_map_entry *entry = m_map->m_entrylist.first(); entry != NULL; entry = entry->next()) if (entry->m_memory != NULL) - blocklist.append(*auto_alloc(&m_machine, memory_block(*this, entry->m_bytestart, entry->m_byteend, entry->m_memory))); + blocklist.append(*auto_alloc(m_machine, memory_block(*this, entry->m_bytestart, entry->m_byteend, entry->m_memory))); // loop over all blocks just allocated and assign pointers from them address_map_entry *unassigned = NULL; @@ -2218,7 +2217,7 @@ void address_space::allocate_memory() // we now have a block to allocate; do it offs_t curbytestart = curblockstart * MEMORY_BLOCK_CHUNK; offs_t curbyteend = curblockend * MEMORY_BLOCK_CHUNK + (MEMORY_BLOCK_CHUNK - 1); - memory_block &block = blocklist.append(*auto_alloc(&m_machine, memory_block(*this, curbytestart, curbyteend))); + memory_block &block = blocklist.append(*auto_alloc(m_machine, memory_block(*this, curbytestart, curbyteend))); // assign memory that intersected the new block unassigned = block_assign_intersecting(curbytestart, curbyteend, block.data()); @@ -2468,7 +2467,7 @@ void address_space::install_readwrite_port(offs_t addrstart, offs_t addrend, off } // update the memory dump - generate_memdump(&m_machine); + generate_memdump(m_machine); } @@ -2499,7 +2498,7 @@ void address_space::install_bank_generic(offs_t addrstart, offs_t addrend, offs_ } // update the memory dump - generate_memdump(&m_machine); + generate_memdump(m_machine); } @@ -2542,7 +2541,7 @@ void *address_space::install_ram_generic(offs_t addrstart, offs_t addrend, offs_ { if (m_machine.phase() >= MACHINE_PHASE_RESET) fatalerror("Attempted to call install_ram_generic() after initialization time without a baseptr!"); - memory_block &block = memdata->blocklist.append(*auto_alloc(&m_machine, memory_block(*this, address_to_byte(addrstart), address_to_byte_end(addrend)))); + memory_block &block = memdata->blocklist.append(*auto_alloc(m_machine, memory_block(*this, address_to_byte(addrstart), address_to_byte_end(addrend)))); bank.set_base(block.data()); } } @@ -2571,7 +2570,7 @@ void *address_space::install_ram_generic(offs_t addrstart, offs_t addrend, offs_ { if (m_machine.phase() >= MACHINE_PHASE_RESET) fatalerror("Attempted to call install_ram_generic() after initialization time without a baseptr!"); - memory_block &block = memdata->blocklist.append(*auto_alloc(&m_machine, memory_block(*this, address_to_byte(addrstart), address_to_byte_end(addrend)))); + memory_block &block = memdata->blocklist.append(*auto_alloc(m_machine, memory_block(*this, address_to_byte(addrstart), address_to_byte_end(addrend)))); bank.set_base(block.data()); } } @@ -2594,7 +2593,7 @@ UINT8 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, off UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); read().handler_read(entry).set_delegate(handler, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); } @@ -2607,7 +2606,7 @@ UINT8 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, of UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); write().handler_write(entry).set_delegate(handler, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); } @@ -2633,7 +2632,7 @@ UINT8 *address_space::install_legacy_read_handler(offs_t addrstart, offs_t addre UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); read().handler_read(entry).set_legacy_func(*this, rhandler, rname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); } @@ -2646,7 +2645,7 @@ UINT8 *address_space::install_legacy_write_handler(offs_t addrstart, offs_t addr UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); write().handler_write(entry).set_legacy_func(*this, whandler, wname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); } @@ -2671,7 +2670,7 @@ UINT8 *address_space::install_legacy_read_handler(device_t &device, offs_t addrs UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); read().handler_read(entry).set_legacy_func(device, rhandler, rname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); } @@ -2684,7 +2683,7 @@ UINT8 *address_space::install_legacy_write_handler(device_t &device, offs_t addr UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); write().handler_write(entry).set_legacy_func(device, whandler, wname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); } @@ -2704,7 +2703,7 @@ UINT16 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, of { UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); read().handler_read(entry).set_delegate(handler, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); } @@ -2712,7 +2711,7 @@ UINT16 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, o { UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); write().handler_write(entry).set_delegate(handler, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); } @@ -2733,7 +2732,7 @@ UINT16 *address_space::install_legacy_read_handler(offs_t addrstart, offs_t addr { UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); read().handler_read(entry).set_legacy_func(*this, rhandler, rname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); } @@ -2741,7 +2740,7 @@ UINT16 *address_space::install_legacy_write_handler(offs_t addrstart, offs_t add { UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); write().handler_write(entry).set_legacy_func(*this, whandler, wname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); } @@ -2761,7 +2760,7 @@ UINT16 *address_space::install_legacy_read_handler(device_t &device, offs_t addr { UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); read().handler_read(entry).set_legacy_func(device, rhandler, rname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); } @@ -2769,7 +2768,7 @@ UINT16 *address_space::install_legacy_write_handler(device_t &device, offs_t add { UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); write().handler_write(entry).set_legacy_func(device, whandler, wname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); } @@ -2789,7 +2788,7 @@ UINT32 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, of { UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); read().handler_read(entry).set_delegate(handler, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); } @@ -2797,7 +2796,7 @@ UINT32 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, o { UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); write().handler_write(entry).set_delegate(handler, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); } @@ -2818,7 +2817,7 @@ UINT32 *address_space::install_legacy_read_handler(offs_t addrstart, offs_t addr { UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); read().handler_read(entry).set_legacy_func(*this, rhandler, rname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); } @@ -2826,7 +2825,7 @@ UINT32 *address_space::install_legacy_write_handler(offs_t addrstart, offs_t add { UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); write().handler_write(entry).set_legacy_func(*this, whandler, wname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); } @@ -2846,7 +2845,7 @@ UINT32 *address_space::install_legacy_read_handler(device_t &device, offs_t addr { UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); read().handler_read(entry).set_legacy_func(device, rhandler, rname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); } @@ -2854,7 +2853,7 @@ UINT32 *address_space::install_legacy_write_handler(device_t &device, offs_t add { UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); write().handler_write(entry).set_legacy_func(device, whandler, wname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); } @@ -2874,7 +2873,7 @@ UINT64 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, of { UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); read().handler_read(entry).set_delegate(handler, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); } @@ -2882,7 +2881,7 @@ UINT64 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, o { UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); write().handler_write(entry).set_delegate(handler, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); } @@ -2903,7 +2902,7 @@ UINT64 *address_space::install_legacy_read_handler(offs_t addrstart, offs_t addr { UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); read().handler_read(entry).set_legacy_func(*this, rhandler, rname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); } @@ -2911,7 +2910,7 @@ UINT64 *address_space::install_legacy_write_handler(offs_t addrstart, offs_t add { UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); write().handler_write(entry).set_legacy_func(*this, whandler, wname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); } @@ -2931,7 +2930,7 @@ UINT64 *address_space::install_legacy_read_handler(device_t &device, offs_t addr { UINT32 entry = read().map_range(addrstart, addrend, addrmask, addrmirror); read().handler_read(entry).set_legacy_func(device, rhandler, rname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); } @@ -2939,7 +2938,7 @@ UINT64 *address_space::install_legacy_write_handler(device_t &device, offs_t add { UINT32 entry = write().map_range(addrstart, addrend, addrmask, addrmirror); write().handler_write(entry).set_legacy_func(device, whandler, wname, unitmask); - generate_memdump(machine); + generate_memdump(m_machine); return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); } @@ -3078,7 +3077,7 @@ memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrst } // allocate the bank - bank = auto_alloc(&m_machine, memory_bank(*this, banknum, bytestart, byteend, tag)); + bank = auto_alloc(m_machine, memory_bank(*this, banknum, bytestart, byteend, tag)); memdata->banklist.append(*bank); // for named banks, add to the map and register for save states @@ -3102,11 +3101,11 @@ memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrst //------------------------------------------------- address_table::address_table(address_space &space, bool large) - : m_table(auto_alloc_array(&space.m_machine, UINT8, 1 << LEVEL1_BITS)), + : m_table(auto_alloc_array(space.machine(), UINT8, 1 << LEVEL1_BITS)), m_live_lookup(m_table), m_space(space), m_large(large), - m_subtable(auto_alloc_array(&space.m_machine, subtable_data, SUBTABLE_COUNT)), + m_subtable(auto_alloc_array(space.machine(), subtable_data, SUBTABLE_COUNT)), m_subtable_alloc(0) { // make our static table all watchpoints @@ -3124,8 +3123,8 @@ address_table::address_table(address_space &space, bool large) address_table::~address_table() { - auto_free(&m_space.m_machine, m_table); - auto_free(&m_space.m_machine, m_subtable); + auto_free(m_space.machine(), m_table); + auto_free(m_space.machine(), m_subtable); } @@ -3495,11 +3494,11 @@ UINT8 address_table::subtable_alloc() m_subtable_alloc += SUBTABLE_ALLOC; UINT32 newsize = (1 << LEVEL1_BITS) + (m_subtable_alloc << level2_bits()); - UINT8 *newtable = auto_alloc_array_clear(&m_space.m_machine, UINT8, newsize); + UINT8 *newtable = auto_alloc_array_clear(m_space.machine(), UINT8, newsize); memcpy(newtable, m_table, oldsize); if (m_live_lookup == m_table) m_live_lookup = newtable; - auto_free(&m_space.m_machine, m_table); + auto_free(m_space.machine(), m_table); m_table = newtable; } @@ -3712,7 +3711,7 @@ const char *address_table::handler_name(UINT8 entry) const // banks have names if (entry >= STATIC_BANK1 && entry <= STATIC_BANKMAX) - for (memory_bank *info = m_space.m_machine.memory_data->banklist.first(); info != NULL; info = info->next()) + for (memory_bank *info = m_space.machine().memory_data->banklist.first(); info != NULL; info = info->next()) if (info->index() == entry) return info->name(); @@ -3736,8 +3735,8 @@ address_table_read::address_table_read(address_space &space, bool large) // allocate handlers for each entry, prepopulating the bankptrs for banks for (int entrynum = 0; entrynum < ARRAY_LENGTH(m_handlers); entrynum++) { - UINT8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? &space.m_machine.memory_data->bank_ptr[entrynum] : NULL; - m_handlers[entrynum] = auto_alloc(&space.m_machine, handler_entry_read(space.data_width(), space.endianness(), bankptr)); + UINT8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? &space.machine().memory_data->bank_ptr[entrynum] : NULL; + m_handlers[entrynum] = auto_alloc(space.machine(), handler_entry_read(space.data_width(), space.endianness(), bankptr)); } // we have to allocate different object types based on the data bus width @@ -3786,7 +3785,7 @@ address_table_read::address_table_read(address_space &space, bool large) address_table_read::~address_table_read() { for (int handnum = 0; handnum < ARRAY_LENGTH(m_handlers); handnum++) - auto_free(&m_space.m_machine, m_handlers[handnum]); + auto_free(m_space.machine(), m_handlers[handnum]); } @@ -3812,8 +3811,8 @@ address_table_write::address_table_write(address_space &space, bool large) // allocate handlers for each entry, prepopulating the bankptrs for banks for (int entrynum = 0; entrynum < ARRAY_LENGTH(m_handlers); entrynum++) { - UINT8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? &space.m_machine.memory_data->bank_ptr[entrynum] : NULL; - m_handlers[entrynum] = auto_alloc(&space.m_machine, handler_entry_write(space.data_width(), space.endianness(), bankptr)); + UINT8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? &space.machine().memory_data->bank_ptr[entrynum] : NULL; + m_handlers[entrynum] = auto_alloc(space.machine(), handler_entry_write(space.data_width(), space.endianness(), bankptr)); } // we have to allocate different object types based on the data bus width @@ -3862,7 +3861,7 @@ address_table_write::address_table_write(address_space &space, bool large) address_table_write::~address_table_write() { for (int handnum = 0; handnum < ARRAY_LENGTH(m_handlers); handnum++) - auto_free(&m_space.m_machine, m_handlers[handnum]); + auto_free(m_space.machine(), m_handlers[handnum]); } @@ -3942,8 +3941,8 @@ bool direct_read_data::set_direct_region(offs_t &byteaddress) } // if no decrypted opcodes, point to the same base - UINT8 *base = m_space.m_machine.memory_data->bank_ptr[m_entry]; - UINT8 *based = m_space.m_machine.memory_data->bankd_ptr[m_entry]; + UINT8 *base = m_space.machine().memory_data->bank_ptr[m_entry]; + UINT8 *based = m_space.machine().memory_data->bankd_ptr[m_entry]; if (based == NULL) based = base; @@ -3978,7 +3977,7 @@ direct_read_data::direct_range *direct_read_data::find_range(offs_t byteaddress, if (range != NULL) m_freerangelist.detach(*range); else - range = auto_alloc(&m_space.m_machine, direct_range); + range = auto_alloc(m_space.machine(), direct_range); // fill in the range m_space.read().derive_range(byteaddress, range->m_bytestart, range->m_byteend); @@ -4057,7 +4056,7 @@ void direct_read_data::explicit_configure(offs_t bytestart, offs_t byteend, offs memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteend, void *memory) : m_next(NULL), - m_machine(space.m_machine), + m_machine(space.machine()), m_space(space), m_bytestart(bytestart), m_byteend(byteend), @@ -4071,17 +4070,17 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen { offs_t length = byteend + 1 - bytestart; if (length < 4096) - m_allocated = m_data = auto_alloc_array_clear(&space.m_machine, UINT8, length); + m_allocated = m_data = auto_alloc_array_clear(space.machine(), UINT8, length); else { - m_allocated = auto_alloc_array_clear(&space.m_machine, UINT8, length + 0xfff); + m_allocated = auto_alloc_array_clear(space.machine(), UINT8, length + 0xfff); m_data = reinterpret_cast<UINT8 *>((reinterpret_cast<FPTR>(m_allocated) + 0xfff) & ~0xfff); } } // register for saving, but only if we're not part of a memory region const memory_region *region; - for (region = space.m_machine.first_region(); region != NULL; region = region->next()) + for (region = space.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")); @@ -4094,7 +4093,7 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen int bytes_per_element = space.data_width() / 8; astring name; name.printf("%08x-%08x", bytestart, byteend); - space.m_machine.state().save_memory("memory", space.device().tag(), space.spacenum(), name, m_data, bytes_per_element, (UINT32)(byteend + 1 - bytestart) / bytes_per_element); + space.machine().state().save_memory("memory", space.device().tag(), space.spacenum(), name, m_data, bytes_per_element, (UINT32)(byteend + 1 - bytestart) / bytes_per_element); } } @@ -4106,7 +4105,7 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen memory_block::~memory_block() { if (m_allocated != NULL) - auto_free(&m_machine, m_allocated); + auto_free(m_machine, m_allocated); } @@ -4121,9 +4120,9 @@ memory_block::~memory_block() memory_bank::memory_bank(address_space &space, int index, offs_t bytestart, offs_t byteend, const char *tag) : m_next(NULL), - m_machine(space.m_machine), - m_baseptr(&space.m_machine.memory_data->bank_ptr[index]), - m_basedptr(&space.m_machine.memory_data->bankd_ptr[index]), + m_machine(space.machine()), + m_baseptr(&space.machine().memory_data->bank_ptr[index]), + m_basedptr(&space.machine().memory_data->bankd_ptr[index]), m_index(index), m_anonymous(tag == NULL), m_bytestart(bytestart), @@ -4144,8 +4143,8 @@ memory_bank::memory_bank(address_space &space, int index, offs_t bytestart, offs m_name.printf("Bank '%s'", tag); } - if (!m_anonymous && space.m_machine.state().registration_allowed()) - space.m_machine.state().save_item("memory", m_tag, 0, NAME(m_curentry)); + if (!m_anonymous && space.machine().state().registration_allowed()) + space.machine().state().save_item("memory", m_tag, 0, NAME(m_curentry)); } @@ -4155,7 +4154,7 @@ memory_bank::memory_bank(address_space &space, int index, offs_t bytestart, offs memory_bank::~memory_bank() { - auto_free(&m_machine, m_entry); + auto_free(m_machine, m_entry); } @@ -4184,7 +4183,7 @@ void memory_bank::add_reference(address_space &space, read_or_write readorwrite) // if we already have a reference, skip it if (references_space(space, readorwrite)) return; - m_reflist.append(*auto_alloc(&space.m_machine, bank_reference(space, readorwrite))); + m_reflist.append(*auto_alloc(space.machine(), bank_reference(space, readorwrite))); } @@ -4269,12 +4268,12 @@ void memory_bank::expand_entries(int entrynum) int newcount = entrynum + 1; // allocate a new array and copy from the old one; zero out the new entries - bank_entry *newentry = auto_alloc_array(&m_machine, bank_entry, newcount); + bank_entry *newentry = auto_alloc_array(m_machine, bank_entry, newcount); memcpy(newentry, m_entry, sizeof(m_entry[0]) * m_entry_count); memset(&newentry[m_entry_count], 0, (newcount - m_entry_count) * sizeof(m_entry[0])); // free the old array and set the updated values - auto_free(&m_machine, m_entry); + auto_free(m_machine, m_entry); m_entry = newentry; m_entry_count = newcount; } diff --git a/src/emu/memory.h b/src/emu/memory.h index b7d648f61de..cf5ef7cad54 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -353,6 +353,7 @@ public: // getters address_space *next() const { return m_next; } device_t &device() const { return m_device; } + running_machine &machine() const { return m_machine; } const char *name() const { return m_name; } address_spacenum spacenum() const { return m_spacenum; } address_map *map() const { return m_map; } @@ -576,15 +577,14 @@ private: public: // public state (eventually will go away) - running_machine * machine; // kept for backwards compatibility device_t * cpu; // kept for backwards compatibility - running_machine & m_machine; // reference to the owning machine protected: // private state address_space * m_next; // next address space in the global list const address_space_config &m_config; // configuration of this space device_t & m_device; // reference to the owning device + running_machine & m_machine; // reference to the owning machine address_map * m_map; // original memory map offs_t m_addrmask; // physical address mask offs_t m_bytemask; // byte-converted physical address mask @@ -715,31 +715,31 @@ extern const char *const address_space_names[ADDRESS_SPACES]; //************************************************************************** // initialize the memory system -void memory_init(running_machine *machine); +void memory_init(running_machine &machine); // configure the addresses for a bank -void memory_configure_bank(running_machine *machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) ATTR_NONNULL(1, 5); +void memory_configure_bank(running_machine &machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) ATTR_NONNULL(5); // configure the decrypted addresses for a bank -void memory_configure_bank_decrypted(running_machine *machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) ATTR_NONNULL(1, 5); +void memory_configure_bank_decrypted(running_machine &machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) ATTR_NONNULL(5); // select one pre-configured entry to be the new bank base -void memory_set_bank(running_machine *machine, const char *tag, int entrynum) ATTR_NONNULL(1); +void memory_set_bank(running_machine &machine, const char *tag, int entrynum); // return the currently selected bank -int memory_get_bank(running_machine *machine, const char *tag) ATTR_NONNULL(1); +int memory_get_bank(running_machine &machine, const char *tag); // set the absolute address of a bank base -void memory_set_bankptr(running_machine *machine, const char *tag, void *base) ATTR_NONNULL(1, 3); +void memory_set_bankptr(running_machine &machine, const char *tag, void *base) ATTR_NONNULL(3); // get a pointer to a shared memory region by tag void *memory_get_shared(running_machine &machine, const char *tag); void *memory_get_shared(running_machine &machine, const char *tag, size_t &length); // dump the internal memory tables to the given file -void memory_dump(running_machine *machine, FILE *file); +void memory_dump(running_machine &machine, FILE *file); -address_space *memory_nonspecific_space(running_machine *machine); +address_space *memory_nonspecific_space(running_machine &machine); //************************************************************************** diff --git a/src/emu/output.c b/src/emu/output.c index b4b05e30a1a..31a0f444f95 100644 --- a/src/emu/output.c +++ b/src/emu/output.c @@ -144,14 +144,14 @@ INLINE output_item *create_new_item(const char *outname, INT32 value) output_init - initialize everything -------------------------------------------------*/ -void output_init(running_machine *machine) +void output_init(running_machine &machine) { /* add pause callback */ - machine->add_notifier(MACHINE_NOTIFY_PAUSE, output_pause); - machine->add_notifier(MACHINE_NOTIFY_RESUME, output_resume); + machine.add_notifier(MACHINE_NOTIFY_PAUSE, output_pause); + machine.add_notifier(MACHINE_NOTIFY_RESUME, output_resume); /* get a callback when done */ - machine->add_notifier(MACHINE_NOTIFY_EXIT, output_exit); + machine.add_notifier(MACHINE_NOTIFY_EXIT, output_exit); /* reset the lists */ memset(itemtable, 0, sizeof(itemtable)); diff --git a/src/emu/output.h b/src/emu/output.h index 308d5c764c7..46b74ea5a92 100644 --- a/src/emu/output.h +++ b/src/emu/output.h @@ -32,7 +32,7 @@ typedef void (*output_notifier_func)(const char *outname, INT32 value, void *par ***************************************************************************/ /* core initialization */ -void output_init(running_machine *machine); +void output_init(running_machine &machine); /* set the value for a given output */ void output_set_value(const char *outname, INT32 value); diff --git a/src/emu/render.c b/src/emu/render.c index 709e9a3d0ea..654534d3a52 100644 --- a/src/emu/render.c +++ b/src/emu/render.c @@ -405,7 +405,7 @@ void render_texture::release() for (int scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++) { m_manager->invalidate_all(m_scaled[scalenum].bitmap); - auto_free(&m_manager->machine(), m_scaled[scalenum].bitmap); + auto_free(m_manager->machine(), m_scaled[scalenum].bitmap); m_scaled[scalenum].bitmap = NULL; m_scaled[scalenum].seqid = 0; } @@ -423,7 +423,7 @@ void render_texture::release() m_palette = NULL; // free any B/C/G lookup tables - auto_free(&m_manager->machine(), m_bcglookup); + auto_free(m_manager->machine(), m_bcglookup); m_bcglookup = NULL; m_bcglookup_entries = 0; } @@ -467,7 +467,7 @@ void render_texture::set_bitmap(bitmap_t *bitmap, const rectangle *sbounds, int if (m_scaled[scalenum].bitmap != NULL) { m_manager->invalidate_all(m_scaled[scalenum].bitmap); - auto_free(&m_manager->machine(), m_scaled[scalenum].bitmap); + auto_free(m_manager->machine(), m_scaled[scalenum].bitmap); } m_scaled[scalenum].bitmap = NULL; m_scaled[scalenum].seqid = 0; @@ -545,11 +545,11 @@ bool render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &t if (scaled->bitmap != NULL) { m_manager->invalidate_all(scaled->bitmap); - auto_free(&m_manager->machine(), scaled->bitmap); + auto_free(m_manager->machine(), scaled->bitmap); } // allocate a new bitmap - scaled->bitmap = auto_alloc(&m_manager->machine(), bitmap_t(dwidth, dheight, BITMAP_FORMAT_ARGB32)); + scaled->bitmap = auto_alloc(m_manager->machine(), bitmap_t(dwidth, dheight, BITMAP_FORMAT_ARGB32)); scaled->seqid = ++m_curseq; // let the scaler do the work @@ -599,9 +599,9 @@ const rgb_t *render_texture::get_adjusted_palette(render_container &container) numentries = palette_get_num_colors(m_palette) * palette_get_num_groups(m_palette); if (m_bcglookup == NULL || m_bcglookup_entries < numentries) { - rgb_t *newlookup = auto_alloc_array(&m_manager->machine(), rgb_t, numentries); + rgb_t *newlookup = auto_alloc_array(m_manager->machine(), rgb_t, numentries); memcpy(newlookup, m_bcglookup, m_bcglookup_entries * sizeof(rgb_t)); - auto_free(&m_manager->machine(), m_bcglookup); + auto_free(m_manager->machine(), m_bcglookup); m_bcglookup = newlookup; m_bcglookup_entries = numentries; } @@ -629,9 +629,9 @@ const rgb_t *render_texture::get_adjusted_palette(render_container &container) adjusted = palette_entry_list_adjusted(m_palette); if (m_bcglookup == NULL || m_bcglookup_entries < 4 * 32) { - rgb_t *newlookup = auto_alloc_array(&m_manager->machine(), rgb_t, 4 * 32); + rgb_t *newlookup = auto_alloc_array(m_manager->machine(), rgb_t, 4 * 32); memcpy(newlookup, m_bcglookup, m_bcglookup_entries * sizeof(rgb_t)); - auto_free(&m_manager->machine(), m_bcglookup); + auto_free(m_manager->machine(), m_bcglookup); m_bcglookup = newlookup; m_bcglookup_entries = 4 * 32; } @@ -664,9 +664,9 @@ const rgb_t *render_texture::get_adjusted_palette(render_container &container) adjusted = palette_entry_list_adjusted(m_palette); if (m_bcglookup == NULL || m_bcglookup_entries < 4 * 256) { - rgb_t *newlookup = auto_alloc_array(&m_manager->machine(), rgb_t, 4 * 256); + rgb_t *newlookup = auto_alloc_array(m_manager->machine(), rgb_t, 4 * 256); memcpy(newlookup, m_bcglookup, m_bcglookup_entries * sizeof(rgb_t)); - auto_free(&m_manager->machine(), m_bcglookup); + auto_free(m_manager->machine(), m_bcglookup); m_bcglookup = newlookup; m_bcglookup_entries = 4 * 256; } @@ -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().respool()))), + m_filelist(*auto_alloc(manager.machine(), simple_list<layout_file>(manager.machine().respool()))), m_flags(flags), m_listindex(0), m_width(640), @@ -1110,7 +1110,7 @@ render_target::render_target(render_manager &manager, const char *layoutfile, UI render_target::~render_target() { - auto_free(&m_manager.machine(), &m_filelist); + auto_free(m_manager.machine(), &m_filelist); } @@ -1703,7 +1703,7 @@ bool render_target::load_layout_file(const char *dirname, const char *filename) bool result = true; try { - m_filelist.append(*auto_alloc(&m_manager.machine(), layout_file(m_manager.machine(), *rootnode, dirname))); + m_filelist.append(*auto_alloc(m_manager.machine(), layout_file(m_manager.machine(), *rootnode, dirname))); } catch (emu_fatalerror &err) { @@ -2458,11 +2458,11 @@ render_manager::render_manager(running_machine &machine) m_ui_target(NULL), m_live_textures(0), m_texture_allocator(machine.respool()), - m_ui_container(auto_alloc(&machine, render_container(*this))), + m_ui_container(auto_alloc(machine, render_container(*this))), m_screen_container_list(machine.respool()) { // register callbacks - config_register(&machine, "video", config_load_static, config_save_static); + config_register(machine, "video", config_load_static, config_save_static); // create one container per screen for (screen_device *screen = machine.first_screen(); screen != NULL; screen = screen->next_screen()) @@ -2527,7 +2527,7 @@ float render_manager::max_update_rate() const render_target *render_manager::target_alloc(const char *layoutfile, UINT32 flags) { - return &m_targetlist.append(*auto_alloc(&m_machine, render_target(*this, layoutfile, flags))); + return &m_targetlist.append(*auto_alloc(m_machine, render_target(*this, layoutfile, flags))); } @@ -2621,7 +2621,7 @@ void render_manager::texture_free(render_texture *texture) render_font *render_manager::font_alloc(const char *filename) { - return auto_alloc(&m_machine, render_font(*this, filename)); + return auto_alloc(m_machine, render_font(*this, filename)); } @@ -2631,7 +2631,7 @@ render_font *render_manager::font_alloc(const char *filename) void render_manager::font_free(render_font *font) { - auto_free(&m_machine, font); + auto_free(m_machine, font); } @@ -2658,7 +2658,7 @@ void render_manager::invalidate_all(void *refptr) render_container *render_manager::container_alloc(screen_device *screen) { - render_container *container = auto_alloc(&m_machine, render_container(*this, screen)); + render_container *container = auto_alloc(m_machine, render_container(*this, screen)); if (screen != NULL) m_screen_container_list.append(*container); return container; @@ -2672,7 +2672,7 @@ render_container *render_manager::container_alloc(screen_device *screen) void render_manager::container_free(render_container *container) { m_screen_container_list.detach(*container); - auto_free(&m_machine, container); + auto_free(m_machine, container); } @@ -2681,9 +2681,9 @@ void render_manager::container_free(render_container *container) // configuration file //------------------------------------------------- -void render_manager::config_load_static(running_machine *machine, int config_type, xml_data_node *parentnode) +void render_manager::config_load_static(running_machine &machine, int config_type, xml_data_node *parentnode) { - machine->render().config_load(config_type, parentnode); + machine.render().config_load(config_type, parentnode); } void render_manager::config_load(int config_type, xml_data_node *parentnode) @@ -2745,9 +2745,9 @@ void render_manager::config_load(int config_type, xml_data_node *parentnode) // file //------------------------------------------------- -void render_manager::config_save_static(running_machine *machine, int config_type, xml_data_node *parentnode) +void render_manager::config_save_static(running_machine &machine, int config_type, xml_data_node *parentnode) { - machine->render().config_save(config_type, parentnode); + machine.render().config_save(config_type, parentnode); } void render_manager::config_save(int config_type, xml_data_node *parentnode) diff --git a/src/emu/render.h b/src/emu/render.h index 312977d9299..d14e28f03b0 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -761,8 +761,8 @@ private: void container_free(render_container *container); // config callbacks - static void config_load_static(running_machine *machine, int config_type, xml_data_node *parentnode); - static void config_save_static(running_machine *machine, int config_type, xml_data_node *parentnode); + static void config_load_static(running_machine &machine, int config_type, xml_data_node *parentnode); + static void config_save_static(running_machine &machine, int config_type, xml_data_node *parentnode); void config_load(int config_type, xml_data_node *parentnode); void config_save(int config_type, xml_data_node *parentnode); diff --git a/src/emu/rendfont.c b/src/emu/rendfont.c index 629e6b84533..c5325f3c1e8 100644 --- a/src/emu/rendfont.c +++ b/src/emu/rendfont.c @@ -83,7 +83,7 @@ inline render_font::glyph &render_font::get_char(unicode_char chnum) // grab the table; if none, return the dummy character glyph *glyphtable = m_glyphs[chnum / 256]; if (glyphtable == NULL && m_format == FF_OSD) - glyphtable = m_glyphs[chnum / 256] = auto_alloc_array_clear(&m_manager.machine(), glyph, 256); + glyphtable = m_glyphs[chnum / 256] = auto_alloc_array_clear(m_manager.machine(), glyph, 256); if (glyphtable == NULL) return dummy_glyph; @@ -161,15 +161,15 @@ render_font::~render_font() { glyph &gl = m_glyphs[tablenum][charnum]; m_manager.texture_free(gl.texture); - auto_free(&m_manager.machine(), gl.bitmap); + auto_free(m_manager.machine(), gl.bitmap); } // free the subtable itself - auto_free(&m_manager.machine(), m_glyphs[tablenum]); + auto_free(m_manager.machine(), m_glyphs[tablenum]); } // free the raw data and the size itself - auto_free(&m_manager.machine(), m_rawdata); + auto_free(m_manager.machine(), m_rawdata); // release the OSD font if (m_osdfont != NULL) @@ -212,7 +212,7 @@ void render_font::char_expand(unicode_char chnum, glyph &gl) return; // allocate a new bitmap of the size we need - gl.bitmap = auto_alloc(&m_manager.machine(), bitmap_t(gl.bmwidth, m_height, BITMAP_FORMAT_ARGB32)); + gl.bitmap = auto_alloc(m_manager.machine(), bitmap_t(gl.bmwidth, m_height, BITMAP_FORMAT_ARGB32)); bitmap_fill(gl.bitmap, NULL, 0); // extract the data @@ -419,7 +419,7 @@ bool render_font::load_cached_bdf(const char *filename) // determine the file size and allocate memory m_rawsize = file.size(); - char *data = auto_alloc_array_clear(&m_manager.machine(), char, m_rawsize + 1); + char *data = auto_alloc_array_clear(m_manager.machine(), char, m_rawsize + 1); // read the first chunk UINT32 bytes = file.read(data, MIN(CACHED_BDF_HASH_SIZE, m_rawsize)); @@ -445,7 +445,7 @@ bool render_font::load_cached_bdf(const char *filename) // if that worked, we're done if (result) { - auto_free(&m_manager.machine(), data); + auto_free(m_manager.machine(), data); return true; } } @@ -457,7 +457,7 @@ bool render_font::load_cached_bdf(const char *filename) UINT32 read = file.read(data + bytes, m_rawsize - bytes); if (read != m_rawsize - bytes) { - auto_free(&m_manager.machine(), data); + auto_free(m_manager.machine(), data); return false; } } @@ -559,7 +559,7 @@ bool render_font::load_bdf() { // if we don't have a subtable yet, make one if (m_glyphs[charnum / 256] == NULL) - m_glyphs[charnum / 256] = auto_alloc_array_clear(&m_manager.machine(), glyph, 256); + m_glyphs[charnum / 256] = auto_alloc_array_clear(m_manager.machine(), glyph, 256); // fill in the entry glyph &gl = m_glyphs[charnum / 256][charnum % 256]; @@ -620,11 +620,11 @@ bool render_font::load_cached(emu_file &file, UINT32 hash) return false; // now read the rest of the data - UINT8 *data = auto_alloc_array(&m_manager.machine(), UINT8, filesize - CACHED_HEADER_SIZE); + UINT8 *data = auto_alloc_array(m_manager.machine(), UINT8, filesize - CACHED_HEADER_SIZE); bytes_read = file.read(data, filesize - CACHED_HEADER_SIZE); if (bytes_read != filesize - CACHED_HEADER_SIZE) { - auto_free(&m_manager.machine(), data); + auto_free(m_manager.machine(), data); return false; } @@ -637,7 +637,7 @@ bool render_font::load_cached(emu_file &file, UINT32 hash) // if we don't have a subtable yet, make one if (m_glyphs[chnum / 256] == NULL) - m_glyphs[chnum / 256] = auto_alloc_array_clear(&m_manager.machine(), glyph, 256); + m_glyphs[chnum / 256] = auto_alloc_array_clear(m_manager.machine(), glyph, 256); // fill in the entry glyph &gl = m_glyphs[chnum / 256][chnum % 256]; @@ -652,7 +652,7 @@ bool render_font::load_cached(emu_file &file, UINT32 hash) offset += (gl.bmwidth * gl.bmheight + 7) / 8; if (offset > filesize - CACHED_HEADER_SIZE) { - auto_free(&m_manager.machine(), data); + auto_free(m_manager.machine(), data); return false; } } @@ -696,10 +696,10 @@ bool render_font::save_cached(const char *filename, UINT32 hash) try { // allocate an array to hold the character data - UINT8 *chartable = auto_alloc_array_clear(&m_manager.machine(), UINT8, numchars * CACHED_CHAR_SIZE); + UINT8 *chartable = auto_alloc_array_clear(m_manager.machine(), UINT8, numchars * CACHED_CHAR_SIZE); // allocate a temp buffer to compress into - UINT8 *tempbuffer = auto_alloc_array(&m_manager.machine(), UINT8, 65536); + UINT8 *tempbuffer = auto_alloc_array(m_manager.machine(), UINT8, 65536); // write the header UINT8 *dest = tempbuffer; @@ -773,7 +773,7 @@ bool render_font::save_cached(const char *filename, UINT32 hash) // free the bitmap and texture m_manager.texture_free(gl.texture); - auto_free(&m_manager.machine(), gl.bitmap); + auto_free(m_manager.machine(), gl.bitmap); gl.texture = NULL; gl.bitmap = NULL; } @@ -802,15 +802,15 @@ bool render_font::save_cached(const char *filename, UINT32 hash) throw emu_fatalerror("Error writing cached file"); // all done - auto_free(&m_manager.machine(), tempbuffer); - auto_free(&m_manager.machine(), chartable); + auto_free(m_manager.machine(), tempbuffer); + auto_free(m_manager.machine(), chartable); return true; } catch (...) { file.remove_on_close(); - auto_free(&m_manager.machine(), tempbuffer); - auto_free(&m_manager.machine(), chartable); + auto_free(m_manager.machine(), tempbuffer); + auto_free(m_manager.machine(), chartable); return false; } } diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c index 5f99b5b8d27..c6e03f1c1d6 100644 --- a/src/emu/rendlay.c +++ b/src/emu/rendlay.c @@ -454,7 +454,7 @@ layout_element::layout_element(running_machine &machine, xml_data_node &elemnode for (xml_data_node *compnode = elemnode.child; compnode != NULL; compnode = compnode->next) { // allocate a new component - component &newcomp = m_complist.append(*auto_alloc(&machine, component(machine, *compnode, dirname))); + component &newcomp = m_complist.append(*auto_alloc(machine, component(machine, *compnode, dirname))); // accumulate bounds if (first) @@ -494,7 +494,7 @@ layout_element::layout_element(running_machine &machine, xml_data_node &elemnode } // allocate an array of element textures for the states - m_elemtex = auto_alloc_array(&machine, texture, m_maxstate + 1); + m_elemtex = auto_alloc_array(machine, texture, m_maxstate + 1); } @@ -505,7 +505,7 @@ layout_element::layout_element(running_machine &machine, xml_data_node &elemnode layout_element::~layout_element() { // loop over all states and free their textures - auto_free(&m_machine, m_elemtex); + auto_free(m_machine, m_elemtex); } @@ -1682,19 +1682,19 @@ layout_view::layout_view(running_machine &machine, xml_data_node &viewnode, simp // load backdrop items for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "backdrop"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "backdrop")) - m_backdrop_list.append(*auto_alloc(&machine, item(machine, *itemnode, elemlist))); + m_backdrop_list.append(*auto_alloc(machine, item(machine, *itemnode, elemlist))); // load screen items for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "screen"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "screen")) - m_screen_list.append(*auto_alloc(&machine, item(machine, *itemnode, elemlist))); + m_screen_list.append(*auto_alloc(machine, item(machine, *itemnode, elemlist))); // load overlay items for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "overlay"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "overlay")) - m_overlay_list.append(*auto_alloc(&machine, item(machine, *itemnode, elemlist))); + m_overlay_list.append(*auto_alloc(machine, item(machine, *itemnode, elemlist))); // load bezel items for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "bezel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "bezel")) - m_bezel_list.append(*auto_alloc(&machine, item(machine, *itemnode, elemlist))); + m_bezel_list.append(*auto_alloc(machine, item(machine, *itemnode, elemlist))); // recompute the data for the view based on a default layer config recompute(render_layer_config()); @@ -1914,7 +1914,7 @@ int layout_view::item::state() const { const input_field_config *field = input_field_by_tag_and_mask(m_element->machine().m_portlist, m_input_tag, m_input_mask); if (field != NULL) - state = ((input_port_read_safe(&m_element->machine(), m_input_tag, 0) ^ field->defvalue) & m_input_mask) ? 1 : 0; + state = ((input_port_read_safe(m_element->machine(), m_input_tag, 0) ^ field->defvalue) & m_input_mask) ? 1 : 0; } return state; } @@ -1946,11 +1946,11 @@ layout_file::layout_file(running_machine &machine, xml_data_node &rootnode, cons // parse all the elements for (xml_data_node *elemnode = xml_get_sibling(mamelayoutnode->child, "element"); elemnode != NULL; elemnode = xml_get_sibling(elemnode->next, "element")) - m_elemlist.append(*auto_alloc(&machine, layout_element(machine, *elemnode, dirname))); + m_elemlist.append(*auto_alloc(machine, layout_element(machine, *elemnode, dirname))); // parse all the views for (xml_data_node *viewnode = xml_get_sibling(mamelayoutnode->child, "view"); viewnode != NULL; viewnode = xml_get_sibling(viewnode->next, "view")) - m_viewlist.append(*auto_alloc(&machine, layout_view(machine, *viewnode, m_elemlist))); + m_viewlist.append(*auto_alloc(machine, layout_view(machine, *viewnode, m_elemlist))); } diff --git a/src/emu/romload.c b/src/emu/romload.c index fec47443462..760cfc46ac0 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -49,7 +49,9 @@ struct _open_chd typedef struct _romload_private rom_load_data; struct _romload_private { - running_machine *machine; /* machine object where needed */ + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } + + running_machine *m_machine; /* machine object where needed */ int system_bios; /* the system BIOS we wish to load */ int warnings; /* warning count during processing */ @@ -127,11 +129,11 @@ file_error common_process_file(emu_options &options, const char *location, bool CHD file associated with the given region -------------------------------------------------*/ -chd_file *get_disk_handle(running_machine *machine, const char *region) +chd_file *get_disk_handle(running_machine &machine, const char *region) { open_chd *curdisk; - for (curdisk = machine->romload_data->chd_list; curdisk != NULL; curdisk = curdisk->next) + for (curdisk = machine.romload_data->chd_list; curdisk != NULL; curdisk = curdisk->next) if (strcmp(curdisk->region, region) == 0) return (curdisk->diffchd != NULL) ? curdisk->diffchd : curdisk->origchd; return NULL; @@ -143,9 +145,9 @@ chd_file *get_disk_handle(running_machine *machine, const char *region) list of CHD files -------------------------------------------------*/ -static void add_disk_handle(running_machine *machine, open_chd *chd) +static void add_disk_handle(running_machine &machine, open_chd *chd) { - romload_private *romload_data = machine->romload_data; + romload_private *romload_data = machine.romload_data; *romload_data->chd_list_tailptr = auto_alloc(machine, open_chd); **romload_data->chd_list_tailptr = *chd; @@ -168,7 +170,7 @@ void set_disk_handle(running_machine &machine, const char *region, emu_file &fil chd.origfile = &file; /* we're okay, add to the list of disks */ - add_disk_handle(&machine, &chd); + add_disk_handle(machine, &chd); } @@ -330,7 +332,7 @@ static void CLIB_DECL ATTR_PRINTF(1,2) debugload(const char *string, ...) static void determine_bios_rom(rom_load_data *romdata) { - const char *specbios = romdata->machine->options().bios(); + const char *specbios = romdata->machine().options().bios(); const char *defaultname = NULL; const rom_entry *rom; int default_no = 1; @@ -338,7 +340,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 +398,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) @@ -412,10 +414,10 @@ static void count_roms(rom_load_data *romdata) random data -------------------------------------------------*/ -static void fill_random(running_machine *machine, UINT8 *base, UINT32 length) +static void fill_random(running_machine &machine, UINT8 *base, UINT32 length) { while (length--) - *base++ = machine->rand(); + *base++ = machine.rand(); } @@ -531,7 +533,7 @@ static void display_loading_rom_message(rom_load_data *romdata, const char *name else sprintf(buffer, "Loading Complete"); - ui_set_startup_text(romdata->machine, buffer, FALSE); + ui_set_startup_text(romdata->machine(), buffer, FALSE); } @@ -550,7 +552,7 @@ static void display_rom_load_results(rom_load_data *romdata) { /* create the error message and exit fatally */ mame_printf_error("%s", romdata->errorstring.cstr()); - fatalerror_exitcode(romdata->machine, MAMERR_MISSING_FILES, "ERROR: required files are missing, the "GAMENOUN" cannot be run."); + fatalerror_exitcode(romdata->machine(), MAMERR_MISSING_FILES, "ERROR: required files are missing, the "GAMENOUN" cannot be run."); } /* if we had warnings, output them, but continue */ @@ -569,7 +571,7 @@ static void display_rom_load_results(rom_load_data *romdata) static void region_post_process(rom_load_data *romdata, const char *rgntag, bool invert) { - const memory_region *region = romdata->machine->region(rgntag); + const memory_region *region = romdata->machine().region(rgntag); UINT8 *base; int i, j; @@ -624,9 +626,9 @@ 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->system(); 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); + filerr = common_process_file(romdata->machine().options(), drv->name, has_crc, crc, romp, &romdata->file); /* if the region is load by name, load the ROM from there */ if (romdata->file == NULL && regiontag != NULL) @@ -676,21 +678,21 @@ static int open_rom_file(rom_load_data *romdata, const char *regiontag, const ro // - if we are not using lists, we have regiontag only; // - if we are using lists, we have: list/clonename, list/parentname, clonename, parentname if (!is_list) - filerr = common_process_file(romdata->machine->options(), tag1.cstr(), has_crc, crc, romp, &romdata->file); + filerr = common_process_file(romdata->machine().options(), tag1.cstr(), has_crc, crc, romp, &romdata->file); else { // try to load from list/setname if ((romdata->file == NULL) && (tag2.cstr() != NULL)) - filerr = common_process_file(romdata->machine->options(), tag2.cstr(), has_crc, crc, romp, &romdata->file); + filerr = common_process_file(romdata->machine().options(), tag2.cstr(), has_crc, crc, romp, &romdata->file); // try to load from list/parentname if ((romdata->file == NULL) && has_parent && (tag3.cstr() != NULL)) - filerr = common_process_file(romdata->machine->options(), tag3.cstr(), has_crc, crc, romp, &romdata->file); + filerr = common_process_file(romdata->machine().options(), tag3.cstr(), has_crc, crc, romp, &romdata->file); // try to load from setname if ((romdata->file == NULL) && (tag4.cstr() != NULL)) - filerr = common_process_file(romdata->machine->options(), tag4.cstr(), has_crc, crc, romp, &romdata->file); + filerr = common_process_file(romdata->machine().options(), tag4.cstr(), has_crc, crc, romp, &romdata->file); // try to load from parentname if ((romdata->file == NULL) && has_parent && (tag5.cstr() != NULL)) - filerr = common_process_file(romdata->machine->options(), tag5.cstr(), has_crc, crc, romp, &romdata->file); + filerr = common_process_file(romdata->machine().options(), tag5.cstr(), has_crc, crc, romp, &romdata->file); } } @@ -716,7 +718,7 @@ static int rom_fread(rom_load_data *romdata, UINT8 *buffer, int length) /* otherwise, fill with randomness */ else - fill_random(romdata->machine, buffer, length); + fill_random(romdata->machine(), buffer, length); return length; } @@ -761,7 +763,7 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp) /* use a temporary buffer for complex loads */ tempbufsize = MIN(TEMPBUFFER_MAX_SIZE, numbytes); - tempbuf = auto_alloc_array(romdata->machine, UINT8, tempbufsize); + tempbuf = auto_alloc_array(romdata->machine(), UINT8, tempbufsize); /* chunky reads for complex loads */ skip += groupsize; @@ -775,7 +777,7 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp) LOG((" Reading %X bytes into buffer\n", bytesleft)); if (rom_fread(romdata, bufptr, bytesleft) != bytesleft) { - auto_free(romdata->machine, tempbuf); + auto_free(romdata->machine(), tempbuf); return 0; } numbytes -= bytesleft; @@ -836,7 +838,7 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp) } } } - auto_free(romdata->machine, tempbuf); + auto_free(romdata->machine(), tempbuf); LOG((" All done\n")); return ROM_GETLENGTH(romp); @@ -885,7 +887,7 @@ static void copy_rom_data(rom_load_data *romdata, const rom_entry *romp) fatalerror("Error in RomModule definition: COPY has an invalid length\n"); /* make sure the source was valid */ - const memory_region *region = romdata->machine->region(srcrgntag); + const memory_region *region = romdata->machine().region(srcrgntag); if (region == NULL) fatalerror("Error in RomModule definition: COPY from an invalid region\n"); @@ -1226,7 +1228,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->system(), 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) @@ -1266,7 +1268,7 @@ static void process_disk_entries(rom_load_data *romdata, const char *regiontag, if (!DISK_ISREADONLY(romp)) { /* try to open or create the diff */ - err = open_disk_diff(romdata->machine->options(), romp, chd.origchd, &chd.difffile, &chd.diffchd); + err = open_disk_diff(romdata->machine().options(), romp, chd.origchd, &chd.difffile, &chd.diffchd); if (err != CHDERR_NONE) { romdata->errorstring.catprintf("%s DIFF CHD ERROR: %s\n", filename.cstr(), chd_error_string(err)); @@ -1277,7 +1279,7 @@ static void process_disk_entries(rom_load_data *romdata, const char *regiontag, /* we're okay, add to the list of disks */ LOG(("Assigning to handle %d\n", DISK_GETINDEX(romp))); - add_disk_handle(romdata->machine, &chd); + add_disk_handle(romdata->machine(), &chd); } } } @@ -1288,9 +1290,9 @@ static void process_disk_entries(rom_load_data *romdata, const char *regiontag, flags for the given device -------------------------------------------------*/ -static void normalize_flags_for_device(running_machine *machine, const char *rgntag, UINT8 &width, endianness_t &endian) +static void normalize_flags_for_device(running_machine &machine, const char *rgntag, UINT8 &width, endianness_t &endian) { - device_t *device = machine->device(rgntag); + device_t *device = machine.device(rgntag); device_memory_interface *memory; if (device->interface(memory)) { @@ -1332,7 +1334,7 @@ static void normalize_flags_for_device(running_machine *machine, const char *rgn void load_software_part_region(device_t *device, char *swlist, char *swname, rom_entry *start_region) { astring locationtag(swlist), breakstr("%"); - rom_load_data *romdata = device->machine->romload_data; + rom_load_data *romdata = device->machine().romload_data; const rom_entry *region; astring regiontag; @@ -1340,7 +1342,7 @@ void load_software_part_region(device_t *device, char *swlist, char *swname, rom // " swlist % clonename % parentname " // open_rom_file contains the code to split the elements and to create paths to load from - software_list *software_list_ptr = software_list_open(device->machine->options(), swlist, FALSE, NULL); + software_list *software_list_ptr = software_list_open(device->machine().options(), swlist, FALSE, NULL); if (software_list_ptr) { locationtag.cat(breakstr); @@ -1354,7 +1356,7 @@ void load_software_part_region(device_t *device, char *swlist, char *swname, rom locationtag.cat(breakstr); // printf("%s\n", locationtag.cstr()); } - const char *parentname = software_get_clone(device->machine->options(), swlist, swinfo->shortname); + const char *parentname = software_get_clone(device->machine().options(), swlist, swinfo->shortname); if (parentname != NULL) swinfo = software_list_find(software_list_ptr, parentname, NULL); else @@ -1370,12 +1372,12 @@ void load_software_part_region(device_t *device, char *swlist, char *swname, rom romdata->errorstring.reset(); - if (software_get_support(device->machine->options(), swlist, swname) == SOFTWARE_SUPPORTED_PARTIAL) + if (software_get_support(device->machine().options(), swlist, swname) == SOFTWARE_SUPPORTED_PARTIAL) { romdata->errorstring.catprintf("WARNING: support for software %s (in list %s) is only partial\n", swname, swlist); romdata->warnings++; } - if (software_get_support(device->machine->options(), swlist, swname) == SOFTWARE_SUPPORTED_NO) + if (software_get_support(device->machine().options(), swlist, swname) == SOFTWARE_SUPPORTED_NO) { romdata->errorstring.catprintf("WARNING: support for software %s (in list %s) is only preliminary\n", swname, swlist); romdata->warnings++; @@ -1395,18 +1397,18 @@ void load_software_part_region(device_t *device, char *swlist, char *swname, rom /* if this is a device region, override with the device width and endianness */ endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE; UINT8 width = ROMREGION_GETWIDTH(region) / 8; - const memory_region *memregion = romdata->machine->region(regiontag); + const memory_region *memregion = romdata->machine().region(regiontag); if (memregion != NULL) { - if (romdata->machine->device(regiontag) != NULL) - normalize_flags_for_device(romdata->machine, regiontag, width, endianness); + if (romdata->machine().device(regiontag) != NULL) + normalize_flags_for_device(romdata->machine(), regiontag, width, endianness); /* clear old region (todo: should be moved to an image unload function) */ - romdata->machine->region_free(memregion->name()); + romdata->machine().region_free(memregion->name()); } /* remember the base and length */ - romdata->region = romdata->machine->region_alloc(regiontag, regionlength, width, endianness); + romdata->region = romdata->machine().region_alloc(regiontag, regionlength, width, endianness); LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base())); /* clear the region if it's requested */ @@ -1420,7 +1422,7 @@ void load_software_part_region(device_t *device, char *swlist, char *swname, rom #ifdef MAME_DEBUG /* if we're debugging, fill region with random data to catch errors */ else - fill_random(romdata->machine, romdata->region->base(), romdata->region->bytes()); + fill_random(romdata->machine(), romdata->region->base(), romdata->region->bytes()); #endif /* now process the entries in the region */ @@ -1450,12 +1452,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->system(), 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 */ @@ -1466,11 +1468,11 @@ static void process_region_list(rom_load_data *romdata) /* if this is a device region, override with the device width and endianness */ UINT8 width = ROMREGION_GETWIDTH(region) / 8; endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE; - if (romdata->machine->device(regiontag) != NULL) - normalize_flags_for_device(romdata->machine, regiontag, width, endianness); + if (romdata->machine().device(regiontag) != NULL) + normalize_flags_for_device(romdata->machine(), regiontag, width, endianness); /* remember the base and length */ - romdata->region = romdata->machine->region_alloc(regiontag, regionlength, width, endianness); + romdata->region = romdata->machine().region_alloc(regiontag, regionlength, width, endianness); LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base())); /* clear the region if it's requested */ @@ -1484,7 +1486,7 @@ static void process_region_list(rom_load_data *romdata) #ifdef MAME_DEBUG /* if we're debugging, fill region with random data to catch errors */ else - fill_random(romdata->machine, romdata->region->base(), romdata->region->bytes()); + fill_random(romdata->machine(), romdata->region->base(), romdata->region->bytes()); #endif /* now process the entries in the region */ @@ -1495,7 +1497,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)); } @@ -1506,18 +1508,18 @@ static void process_region_list(rom_load_data *romdata) images associated with the given machine -------------------------------------------------*/ -void rom_init(running_machine *machine) +void rom_init(running_machine &machine) { rom_load_data *romdata; /* allocate private data */ - machine->romload_data = romdata = auto_alloc_clear(machine, romload_private); + machine.romload_data = romdata = auto_alloc_clear(machine, romload_private); /* make sure we get called back on the way out */ - machine->add_notifier(MACHINE_NOTIFY_EXIT, rom_exit); + machine.add_notifier(MACHINE_NOTIFY_EXIT, rom_exit); /* reset the romdata struct */ - romdata->machine = machine; + romdata->m_machine = &machine; /* figure out which BIOS we are using */ determine_bios_rom(romdata); @@ -1527,7 +1529,7 @@ void rom_init(running_machine *machine) /* reset the disk list */ romdata->chd_list = NULL; - romdata->chd_list_tailptr = &machine->romload_data->chd_list; + romdata->chd_list_tailptr = &machine.romload_data->chd_list; /* process the ROM entries we were passed */ process_region_list(romdata); @@ -1565,9 +1567,9 @@ static void rom_exit(running_machine &machine) warnings we generated -------------------------------------------------*/ -int rom_load_warnings(running_machine *machine) +int rom_load_warnings(running_machine &machine) { - return machine->romload_data->warnings; + return machine.romload_data->warnings; } @@ -1576,7 +1578,7 @@ int rom_load_warnings(running_machine *machine) BAD_DUMP/NO_DUMP warnings we generated -------------------------------------------------*/ -int rom_load_knownbad(running_machine *machine) +int rom_load_knownbad(running_machine &machine) { - return machine->romload_data->knownbad; + return machine.romload_data->knownbad; } diff --git a/src/emu/romload.h b/src/emu/romload.h index 68d842d1613..65451683ec7 100644 --- a/src/emu/romload.h +++ b/src/emu/romload.h @@ -266,13 +266,13 @@ struct rom_entry /* ----- ROM processing ----- */ /* load the ROMs and open the disk images associated with the given machine */ -void rom_init(running_machine *machine); +void rom_init(running_machine &machine); /* return the number of warnings we generated */ -int rom_load_warnings(running_machine *machine); +int rom_load_warnings(running_machine &machine); /* return the number of BAD_DUMP/NO_DUMP warnings we generated */ -int rom_load_knownbad(running_machine *machine); +int rom_load_knownbad(running_machine &machine); /* ----- Helpers ----- */ @@ -318,7 +318,7 @@ astring &rom_region_name(astring &result, const game_driver *drv, const rom_sour chd_error open_disk_image(emu_options &options, const game_driver *gamedrv, const rom_entry *romp, emu_file **image_file, chd_file **image_chd,const char *locationtag); /* return a pointer to the CHD file associated with the given region */ -chd_file *get_disk_handle(running_machine *machine, const char *region); +chd_file *get_disk_handle(running_machine &machine, const char *region); /* set a pointer to the CHD file associated with the given region */ void set_disk_handle(running_machine &machine, const char *region, emu_file &file, chd_file &chdfile); diff --git a/src/emu/schedule.c b/src/emu/schedule.c index 1630d4dfbee..33cbac54fe6 100644 --- a/src/emu/schedule.c +++ b/src/emu/schedule.c @@ -143,7 +143,7 @@ emu_timer &emu_timer::init(running_machine &machine, timer_expired_func callback emu_timer &emu_timer::init(device_t &device, device_timer_id id, void *ptr, bool temporary) { // ensure the entire timer state is clean - m_machine = device.machine; + m_machine = &device.machine(); m_next = NULL; m_prev = NULL; m_callback = NULL; @@ -875,7 +875,7 @@ void device_scheduler::execute_timers() if (timer.m_device != NULL) timer.m_device->timer_expired(timer, timer.m_id, timer.m_param, timer.m_ptr); else if (timer.m_callback != NULL) - (*timer.m_callback)(&m_machine, timer.m_ptr, timer.m_param); + (*timer.m_callback)(m_machine, timer.m_ptr, timer.m_param); g_profiler.stop(); } diff --git a/src/emu/schedule.h b/src/emu/schedule.h index 959d2345ad5..4c8e936fd45 100644 --- a/src/emu/schedule.h +++ b/src/emu/schedule.h @@ -62,7 +62,7 @@ #define PERIOD_OF_555_MONOSTABLE(r,c) attotime::from_nsec(PERIOD_OF_555_MONOSTABLE_NSEC(r,c)) #define PERIOD_OF_555_ASTABLE(r1,r2,c) attotime::from_nsec(PERIOD_OF_555_ASTABLE_NSEC(r1,r2,c)) -#define TIMER_CALLBACK(name) void name(running_machine *machine, void *ptr, int param) +#define TIMER_CALLBACK(name) void name(running_machine &machine, void *ptr, int param) @@ -71,14 +71,14 @@ //************************************************************************** // timer callbacks look like this -typedef void (*timer_expired_func)(running_machine *machine, void *ptr, INT32 param); +typedef void (*timer_expired_func)(running_machine &machine, void *ptr, INT32 param); // stub for when the ptr parameter points to a class template<class T, void (T::*func)(running_machine &machine, INT32 param)> -void timer_expired_stub(running_machine *machine, void *ptr, INT32 param) +void timer_expired_stub(running_machine &machine, void *ptr, INT32 param) { T *target = reinterpret_cast<T *>(ptr); - (target->*func)(*machine, param); + (target->*func)(machine, param); } diff --git a/src/emu/screen.c b/src/emu/screen.c index 71e3a964524..8908fd69fe7 100644 --- a/src/emu/screen.c +++ b/src/emu/screen.c @@ -107,7 +107,7 @@ device_config *screen_device_config::static_alloc_device_config(const machine_co device_t *screen_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, screen_device(machine, *this)); + return auto_alloc(machine, screen_device(machine, *this)); } @@ -371,15 +371,15 @@ void screen_device::device_start() m_container->set_user_settings(settings); // allocate the VBLANK timers - m_vblank_begin_timer = machine->scheduler().timer_alloc(FUNC(static_vblank_begin_callback), (void *)this); - m_vblank_end_timer = machine->scheduler().timer_alloc(FUNC(static_vblank_end_callback), (void *)this); + m_vblank_begin_timer = m_machine.scheduler().timer_alloc(FUNC(static_vblank_begin_callback), (void *)this); + m_vblank_end_timer = m_machine.scheduler().timer_alloc(FUNC(static_vblank_end_callback), (void *)this); // allocate a timer to reset partial updates - m_scanline0_timer = machine->scheduler().timer_alloc(FUNC(static_scanline0_callback), (void *)this); + m_scanline0_timer = m_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) - m_scanline_timer = machine->scheduler().timer_alloc(FUNC(static_scanline_update_callback), (void *)this); + if ((m_machine.config().m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0) + m_scanline_timer = m_machine.scheduler().timer_alloc(FUNC(static_scanline_update_callback), (void *)this); // configure the screen with the default parameters configure(m_config.m_width, m_config.m_height, m_config.m_visarea, m_config.m_refresh); @@ -389,23 +389,23 @@ 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 ((m_machine.config().m_video_attributes & VIDEO_UPDATE_SCANLINE) != 0) m_scanline_timer->adjust(time_until_pos(0)); // create burn-in bitmap - if (machine->options().burnin()) + if (m_machine.options().burnin()) { int width, height; - if (sscanf(machine->options().snap_size(), "%dx%d", &width, &height) != 2 || width == 0 || height == 0) + if (sscanf(m_machine.options().snap_size(), "%dx%d", &width, &height) != 2 || width == 0 || height == 0) width = height = 300; - m_burnin = auto_alloc(machine, bitmap_t(width, height, BITMAP_FORMAT_INDEXED64)); + m_burnin = auto_alloc(m_machine, bitmap_t(width, height, BITMAP_FORMAT_INDEXED64)); if (m_burnin == NULL) fatalerror("Error allocating burn-in bitmap for screen at (%dx%d)\n", width, height); bitmap_fill(m_burnin, NULL, 0); } // load the effect overlay - const char *overname = machine->options().effect(); + const char *overname = m_machine.options().effect(); if (overname != NULL && strcmp(overname, "none") != 0) load_effect_overlay(overname); @@ -496,7 +496,7 @@ void screen_device::configure(int width, int height, const rectangle &visarea, a void screen_device::reset_origin(int beamy, int beamx) { // compute the effective VBLANK start/end times - attotime curtime = machine->time(); + attotime curtime = m_machine.time(); m_vblank_end_time = curtime - attotime(0, beamy * m_scantime + beamx * m_pixeltime); m_vblank_start_time = m_vblank_end_time - attotime(0, m_vblank_period); @@ -541,8 +541,8 @@ void screen_device::realloc_screen_bitmaps() // free what we have currently m_machine.render().texture_free(m_texture[0]); m_machine.render().texture_free(m_texture[1]); - auto_free(machine, m_bitmap[0]); - auto_free(machine, m_bitmap[1]); + auto_free(m_machine, m_bitmap[0]); + auto_free(m_machine, m_bitmap[1]); // compute new width/height curwidth = MAX(m_width, curwidth); @@ -552,17 +552,17 @@ void screen_device::realloc_screen_bitmaps() palette_t *palette = NULL; switch (m_config.m_format) { - case BITMAP_FORMAT_INDEXED16: m_texture_format = TEXFORMAT_PALETTE16; palette = machine->palette; break; + case BITMAP_FORMAT_INDEXED16: m_texture_format = TEXFORMAT_PALETTE16; palette = m_machine.palette; break; case BITMAP_FORMAT_RGB15: m_texture_format = TEXFORMAT_RGB15; palette = NULL; break; case BITMAP_FORMAT_RGB32: m_texture_format = TEXFORMAT_RGB32; palette = NULL; break; default: fatalerror("Invalid bitmap format!"); break; } // allocate bitmaps - m_bitmap[0] = auto_alloc(machine, bitmap_t(curwidth, curheight, m_config.m_format)); - bitmap_set_palette(m_bitmap[0], machine->palette); - m_bitmap[1] = auto_alloc(machine, bitmap_t(curwidth, curheight, m_config.m_format)); - bitmap_set_palette(m_bitmap[1], machine->palette); + m_bitmap[0] = auto_alloc(m_machine, bitmap_t(curwidth, curheight, m_config.m_format)); + bitmap_set_palette(m_bitmap[0], m_machine.palette); + m_bitmap[1] = auto_alloc(m_machine, bitmap_t(curwidth, curheight, m_config.m_format)); + bitmap_set_palette(m_bitmap[1], m_machine.palette); // allocate textures m_texture[0] = m_machine.render().texture_alloc(); @@ -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 (!(m_machine.config().m_video_attributes & VIDEO_ALWAYS_UPDATE)) { // if skipping this frame, bail if (m_machine.video().skip_this_frame()) @@ -696,7 +696,7 @@ void screen_device::update_now() int screen_device::vpos() const { - attoseconds_t delta = (machine->time() - m_vblank_start_time).as_attoseconds(); + attoseconds_t delta = (m_machine.time() - m_vblank_start_time).as_attoseconds(); int vpos; // round to the nearest pixel @@ -717,7 +717,7 @@ int screen_device::vpos() const int screen_device::hpos() const { - attoseconds_t delta = (machine->time() - m_vblank_start_time).as_attoseconds(); + attoseconds_t delta = (m_machine.time() - m_vblank_start_time).as_attoseconds(); // round to the nearest pixel delta += m_pixeltime / 2; @@ -753,7 +753,7 @@ attotime screen_device::time_until_pos(int vpos, int hpos) const attoseconds_t targetdelta = (attoseconds_t)vpos * m_scantime + (attoseconds_t)hpos * m_pixeltime; // if we're past that time (within 1/2 of a pixel), head to the next frame - attoseconds_t curdelta = (machine->time() - m_vblank_start_time).as_attoseconds(); + attoseconds_t curdelta = (m_machine.time() - m_vblank_start_time).as_attoseconds(); if (targetdelta <= curdelta + m_pixeltime / 2) targetdelta += m_frame_period; while (targetdelta <= curdelta) @@ -777,7 +777,7 @@ attotime screen_device::time_until_vblank_end() const attotime target_time = m_vblank_end_time; if (!vblank()) target_time += attotime(0, m_frame_period); - return target_time - machine->time(); + return target_time - m_machine.time(); } @@ -800,7 +800,7 @@ void screen_device::register_vblank_callback(vblank_state_changed_func vblank_ca // if not found, register if (*itemptr == NULL) { - *itemptr = auto_alloc(machine, callback_item); + *itemptr = auto_alloc(m_machine, callback_item); (*itemptr)->m_next = NULL; (*itemptr)->m_callback = vblank_callback; (*itemptr)->m_param = param; @@ -816,7 +816,7 @@ void screen_device::register_vblank_callback(vblank_state_changed_func vblank_ca void screen_device::vblank_begin_callback() { // reset the starting VBLANK time - m_vblank_start_time = machine->time(); + m_vblank_start_time = m_machine.time(); m_vblank_end_time = m_vblank_start_time + attotime(0, m_vblank_period); // call the screen specific callbacks @@ -824,8 +824,8 @@ 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)) - machine->video().frame_update(); + if (this == m_machine.primary_screen && !(m_machine.config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) + m_machine.video().frame_update(); // reset the VBLANK start timer for the next frame m_vblank_begin_timer->adjust(time_until_vblank_start()); @@ -850,8 +850,8 @@ 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)) - machine->video().frame_update(); + if (this == m_machine.primary_screen && (m_machine.config().m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) + m_machine.video().frame_update(); // increment the frame number counter m_frame_number++; @@ -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 && (m_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) @@ -911,7 +911,7 @@ bool screen_device::update_quads() fixedvis.max_x++; fixedvis.max_y++; - palette_t *palette = (m_texture_format == TEXFORMAT_PALETTE16) ? machine->palette : NULL; + palette_t *palette = (m_texture_format == TEXFORMAT_PALETTE16) ? m_machine.palette : NULL; m_texture[m_curbitmap]->set_bitmap(m_bitmap[m_curbitmap], &fixedvis, m_texture_format, palette); m_curtexture = m_curbitmap; @@ -965,7 +965,7 @@ void screen_device::update_burnin() if (srcbitmap->format == BITMAP_FORMAT_INDEXED16) { const UINT16 *src = BITMAP_ADDR16(srcbitmap, srcy >> 16, 0); - const rgb_t *palette = palette_entry_list_adjusted(machine->palette); + const rgb_t *palette = palette_entry_list_adjusted(m_machine.palette); for (x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb_t pixel = palette[src[srcx >> 16]]; @@ -1015,7 +1015,7 @@ void screen_device::finalize_burnin() scaledvis.max_y = m_visarea.max_y * m_burnin->height / m_height; // wrap a bitmap around the subregion we care about - bitmap_t *finalmap = auto_alloc(machine, bitmap_t(scaledvis.max_x + 1 - scaledvis.min_x, + bitmap_t *finalmap = auto_alloc(m_machine, bitmap_t(scaledvis.max_x + 1 - scaledvis.min_x, scaledvis.max_y + 1 - scaledvis.min_y, BITMAP_FORMAT_ARGB32)); @@ -1058,7 +1058,7 @@ void screen_device::finalize_burnin() // compute the name and create the file emu_file file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - file_error filerr = file.open(machine->basename(), PATH_SEPARATOR "burnin-", tag(), ".png") ; + file_error filerr = file.open(m_machine.basename(), PATH_SEPARATOR "burnin-", tag(), ".png") ; if (filerr == FILERR_NONE) { png_info pnginfo = { 0 }; @@ -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->system().manufacturer, machine->system().description); + sprintf(text, "%s %s", m_machine.system().manufacturer, m_machine.system().description); png_add_text(&pnginfo, "System", text); // now do the actual work @@ -1125,7 +1125,7 @@ bool screen_device::screen_update(bitmap_t &bitmap, const rectangle &cliprect) void screen_device::screen_eof() { if (m_config.m_screen_eof != NULL) { - return (*m_config.m_screen_eof)(this, machine); + return (*m_config.m_screen_eof)(this, m_machine); } else { m_machine.driver_data<driver_device>()->screen_eof(); } diff --git a/src/emu/screen.h b/src/emu/screen.h index 746b7bd61f1..2c7f9d3ae25 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -78,7 +78,7 @@ extern const device_type SCREEN; // callback that is called to notify of a change in the VBLANK state typedef void (*vblank_state_changed_func)(screen_device &device, void *param, bool vblank_state); typedef UINT32 (*screen_update_func)(screen_device *screen, bitmap_t *bitmap, const rectangle *cliprect); -typedef void (*screen_eof_func)(screen_device *screen, running_machine *machine); +typedef void (*screen_eof_func)(screen_device *screen, running_machine &machine); // ======================> screen_device_config @@ -175,14 +175,14 @@ public: // beam positioning and state int vpos() const; int hpos() const; - bool vblank() const { return (machine->time() < m_vblank_end_time); } + bool vblank() const { return (m_machine.time() < m_vblank_end_time); } bool hblank() const { int curpos = hpos(); return (curpos < m_visarea.min_x || curpos > m_visarea.max_x); } // timing 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 (m_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; } @@ -194,7 +194,7 @@ public: // additional helpers void register_vblank_callback(vblank_state_changed_func vblank_callback, void *param); - bitmap_t *alloc_compatible_bitmap(int width = 0, int height = 0) { return auto_bitmap_alloc(machine, (width == 0) ? m_width : width, (height == 0) ? m_height : height, m_config.m_format); } + bitmap_t *alloc_compatible_bitmap(int width = 0, int height = 0) { return auto_bitmap_alloc(m_machine, (width == 0) ? m_width : width, (height == 0) ? m_height : height, m_config.m_format); } // internal to the video system bool update_quads(); @@ -283,7 +283,7 @@ private: #define SCREEN_UPDATE_CALL(name) SCREEN_UPDATE_NAME(name)(screen, bitmap, cliprect) #define SCREEN_EOF_NAME(name) screen_eof_##name -#define SCREEN_EOF(name) void SCREEN_EOF_NAME(name)(screen_device *screen, running_machine *machine) +#define SCREEN_EOF(name) void SCREEN_EOF_NAME(name)(screen_device *screen, running_machine &machine) #define SCREEN_EOF_CALL(name) SCREEN_EOF_NAME(name)(screen, machine) #define screen_eof_0 NULL diff --git a/src/emu/softlist.c b/src/emu/softlist.c index 0dc7aa57205..8e3ce252433 100644 --- a/src/emu/softlist.c +++ b/src/emu/softlist.c @@ -163,7 +163,7 @@ INLINE void unknown_attribute_value(parse_state *state, from the global pool. So they should be global_free'ed when they are not used anymore. -------------------------------------------------*/ -static void software_name_split(running_machine* machine, const char *swlist_swname, char **swlist_name, char **swname, char **swpart ) +static void software_name_split(running_machine& machine, const char *swlist_swname, char **swlist_name, char **swname, char **swpart ) { const char *split_1st_loc = strchr( swlist_swname, ':' ); const char *split_2nd_loc = ( split_1st_loc ) ? strchr( split_1st_loc + 1, ':' ) : NULL; @@ -1383,7 +1383,7 @@ bool load_software_part(device_image_interface *image, const char *path, softwar *sw_part = NULL; /* Split full software name into software list name and short software name */ - software_name_split( image->device().machine, path, &swlist_name, &swname, &swpart ); + software_name_split( image->device().machine(), path, &swlist_name, &swname, &swpart ); swname_bckp = swname; const char *interface = image->image_config().image_interface(); @@ -1391,7 +1391,7 @@ bool load_software_part(device_image_interface *image, const char *path, softwar if ( swlist_name ) { /* Try to open the software list xml file explicitly named by the user */ - software_list_ptr = software_list_open( image->device().machine->options(), swlist_name, FALSE, NULL ); + software_list_ptr = software_list_open( image->device().machine().options(), swlist_name, FALSE, NULL ); if ( software_list_ptr ) { @@ -1406,7 +1406,7 @@ bool load_software_part(device_image_interface *image, const char *path, softwar else { /* Loop through all the software lists named in the driver */ - for (device_t *swlists = image->device().machine->m_devicelist.first(SOFTWARE_LIST); swlists != NULL; swlists = swlists->typenext()) + for (device_t *swlists = image->device().machine().m_devicelist.first(SOFTWARE_LIST); swlists != NULL; swlists = swlists->typenext()) { if ( swlists ) { @@ -1425,7 +1425,7 @@ bool load_software_part(device_image_interface *image, const char *path, softwar software_list_close( software_list_ptr ); } - software_list_ptr = software_list_open( image->device().machine->options(), swlist_name, FALSE, NULL ); + software_list_ptr = software_list_open( image->device().machine().options(), swlist_name, FALSE, NULL ); if ( software_list_ptr ) { @@ -1445,14 +1445,14 @@ 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->system().name; + swlist_name = (char *)image->device().machine().system().name; if ( software_list_ptr ) { software_list_close( software_list_ptr ); } - software_list_ptr = software_list_open( image->device().machine->options(), swlist_name, FALSE, NULL ); + software_list_ptr = software_list_open( image->device().machine().options(), swlist_name, FALSE, NULL ); if ( software_list_ptr ) { @@ -1478,7 +1478,7 @@ bool load_software_part(device_image_interface *image, const char *path, softwar software_list_close( software_list_ptr ); } - software_list_ptr = software_list_open( image->device().machine->options(), swlist_name, FALSE, NULL ); + software_list_ptr = software_list_open( image->device().machine().options(), swlist_name, FALSE, NULL ); if ( software_list_ptr ) { @@ -1502,13 +1502,13 @@ bool load_software_part(device_image_interface *image, const char *path, softwar if (software_info_ptr == NULL) { // check if there is at least a software list - if (image->device().machine->m_devicelist.first(SOFTWARE_LIST)) + if (image->device().machine().m_devicelist.first(SOFTWARE_LIST)) { mame_printf_error("\n\"%s\" approximately matches the following\n" "supported software items (best match first):\n\n", swname_bckp); } - for (device_t *swlists = image->device().machine->m_devicelist.first(SOFTWARE_LIST); swlists != NULL; swlists = swlists->typenext()) + for (device_t *swlists = image->device().machine().m_devicelist.first(SOFTWARE_LIST); swlists != NULL; swlists = swlists->typenext()) { software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(&swlists->baseconfig())->inline_config(); @@ -1516,7 +1516,7 @@ bool load_software_part(device_image_interface *image, const char *path, softwar { if (swlist->list_name[i] && *swlist->list_name[i]) { - software_list *list = software_list_open(image->device().machine->options(), swlist->list_name[i], FALSE, NULL); + software_list *list = software_list_open(image->device().machine().options(), swlist->list_name[i], FALSE, NULL); if (list) { @@ -1561,37 +1561,37 @@ bool load_software_part(device_image_interface *image, const char *path, softwar } /* Create a copy of the software and part information */ - *sw_info = auto_alloc_clear( image->device().machine, software_info ); - (*sw_info)->shortname = auto_strdup( image->device().machine, software_info_ptr->shortname ); - (*sw_info)->longname = auto_strdup( image->device().machine, software_info_ptr->longname ); + *sw_info = auto_alloc_clear( image->device().machine(), software_info ); + (*sw_info)->shortname = auto_strdup( image->device().machine(), software_info_ptr->shortname ); + (*sw_info)->longname = auto_strdup( image->device().machine(), software_info_ptr->longname ); if ( software_info_ptr->year ) - (*sw_info)->year = auto_strdup( image->device().machine, software_info_ptr->year ); + (*sw_info)->year = auto_strdup( image->device().machine(), software_info_ptr->year ); if ( software_info_ptr->publisher ) - (*sw_info)->publisher = auto_strdup( image->device().machine, software_info_ptr->publisher ); + (*sw_info)->publisher = auto_strdup( image->device().machine(), software_info_ptr->publisher ); - *sw_part = auto_alloc_clear( image->device().machine, software_part ); - (*sw_part)->name = auto_strdup( image->device().machine, software_part_ptr->name ); + *sw_part = auto_alloc_clear( image->device().machine(), software_part ); + (*sw_part)->name = auto_strdup( image->device().machine(), software_part_ptr->name ); if ( software_part_ptr->interface_ ) - (*sw_part)->interface_ = auto_strdup( image->device().machine, software_part_ptr->interface_ ); + (*sw_part)->interface_ = auto_strdup( image->device().machine(), software_part_ptr->interface_ ); if ( software_part_ptr->featurelist ) { feature_list *list = software_part_ptr->featurelist; - feature_list *new_list = auto_alloc_clear( image->device().machine, feature_list ); + feature_list *new_list = auto_alloc_clear( image->device().machine(), feature_list ); (*sw_part)->featurelist = new_list; - new_list->name = auto_strdup( image->device().machine, list->name ); - new_list->value = auto_strdup( image->device().machine, list->value ); + new_list->name = auto_strdup( image->device().machine(), list->name ); + new_list->value = auto_strdup( image->device().machine(), list->value ); list = list->next; while( list ) { - new_list->next = auto_alloc_clear( image->device().machine, feature_list ); + new_list->next = auto_alloc_clear( image->device().machine(), feature_list ); new_list = new_list->next; - new_list->name = auto_strdup( image->device().machine, list->name ); - new_list->value = auto_strdup( image->device().machine, list->value ); + new_list->name = auto_strdup( image->device().machine(), list->name ); + new_list->value = auto_strdup( image->device().machine(), list->value ); list = list->next; } @@ -1600,7 +1600,7 @@ bool load_software_part(device_image_interface *image, const char *path, softwar } /* Tell the world which part we actually loaded */ - *full_sw_name = auto_alloc_array( image->device().machine, char, strlen(swlist_name) + strlen(software_info_ptr->shortname) + strlen(software_part_ptr->name) + 3 ); + *full_sw_name = auto_alloc_array( image->device().machine(), char, strlen(swlist_name) + strlen(software_info_ptr->shortname) + strlen(software_part_ptr->name) + 3 ); sprintf( *full_sw_name, "%s:%s:%s", swlist_name, software_info_ptr->shortname, software_part_ptr->name ); } @@ -1611,9 +1611,9 @@ bool load_software_part(device_image_interface *image, const char *path, softwar software_info_ptr = NULL; software_list_ptr = NULL; } - auto_free( image->device().machine, swlist_name ); - auto_free( image->device().machine, swname ); - auto_free( image->device().machine, swpart ); + auto_free( image->device().machine(), swlist_name ); + auto_free( image->device().machine(), swname ); + auto_free( image->device().machine(), swpart ); return result; } @@ -1872,9 +1872,9 @@ struct _software_part_state }; -static void ui_mess_menu_populate_software_parts(running_machine *machine, ui_menu *menu, const char *swlist, const char *swinfo, const char *interface) +static void ui_mess_menu_populate_software_parts(running_machine &machine, ui_menu *menu, const char *swlist, const char *swinfo, const char *interface) { - software_list *list = software_list_open(machine->options(), swlist, FALSE, NULL); + software_list *list = software_list_open(machine.options(), swlist, FALSE, NULL); if (list) { @@ -1907,7 +1907,7 @@ static void ui_mess_menu_populate_software_parts(running_machine *machine, ui_me } } -void ui_mess_menu_software_parts(running_machine *machine, ui_menu *menu, void *parameter, void *state) +void ui_mess_menu_software_parts(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *event; software_entry_state *sw_state = (software_entry_state *)state; @@ -1942,9 +1942,9 @@ void ui_mess_menu_software_parts(running_machine *machine, ui_menu *menu, void * } /* populate a specific list */ -static void ui_mess_menu_populate_software_entries(running_machine *machine, ui_menu *menu, char *list_name, device_image_interface* image) +static void ui_mess_menu_populate_software_entries(running_machine &machine, ui_menu *menu, char *list_name, device_image_interface* image) { - software_list *list = software_list_open(machine->options(), list_name, FALSE, NULL); + software_list *list = software_list_open(machine.options(), list_name, FALSE, NULL); const char *interface = image->image_config().image_interface(); if (list) { @@ -1983,7 +1983,7 @@ bool swinfo_has_multiple_parts(software_info *swinfo, const char *interface) return (count > 1) ? TRUE : FALSE; } -void ui_mess_menu_software_list(running_machine *machine, ui_menu *menu, void *parameter, void *state) +void ui_mess_menu_software_list(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *event; software_menu_state *sw_state = (software_menu_state *)state; @@ -2003,13 +2003,13 @@ void ui_mess_menu_software_list(running_machine *machine, ui_menu *menu, void *p { device_image_interface *image = sw_state->image; software_entry_state *entry = (software_entry_state *) event->itemref; - software_list *tmp_list = software_list_open(machine->options(), sw_state->list_name, FALSE, NULL); + software_list *tmp_list = software_list_open(machine.options(), sw_state->list_name, FALSE, NULL); software_info *tmp_info = software_list_find(tmp_list, entry->short_name, NULL); // if the selected software has multiple parts that can be loaded, open the submenu if (swinfo_has_multiple_parts(tmp_info, image->image_config().image_interface())) { - ui_menu *child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), ui_mess_menu_software_parts, entry); + ui_menu *child_menu = ui_menu_alloc(machine, &machine.render().ui_container(), ui_mess_menu_software_parts, entry); software_entry_state *child_menustate = (software_entry_state *)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL); child_menustate->short_name = entry->short_name; child_menustate->interface = image->image_config().image_interface(); @@ -2030,12 +2030,12 @@ void ui_mess_menu_software_list(running_machine *machine, ui_menu *menu, void *p } /* list of available software lists - i.e. cartridges, floppies */ -static void ui_mess_menu_populate_software_list(running_machine *machine, ui_menu *menu, device_image_interface* image) +static void ui_mess_menu_populate_software_list(running_machine &machine, ui_menu *menu, device_image_interface* image) { 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(); @@ -2043,7 +2043,7 @@ static void ui_mess_menu_populate_software_list(running_machine *machine, ui_men { if (swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM)) { - software_list *list = software_list_open(machine->options(), swlist->list_name[i], FALSE, NULL); + software_list *list = software_list_open(machine.options(), swlist->list_name[i], FALSE, NULL); if (list) { @@ -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(); @@ -2073,7 +2073,7 @@ static void ui_mess_menu_populate_software_list(running_machine *machine, ui_men { if (swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_COMPATIBLE_SYSTEM)) { - software_list *list = software_list_open(machine->options(), swlist->list_name[i], FALSE, NULL); + software_list *list = software_list_open(machine.options(), swlist->list_name[i], FALSE, NULL); if (list) { @@ -2101,7 +2101,7 @@ static void ui_mess_menu_populate_software_list(running_machine *machine, ui_men } -void ui_image_menu_software(running_machine *machine, ui_menu *menu, void *parameter, void *state) +void ui_image_menu_software(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *event; device_image_interface* image = (device_image_interface*)parameter; @@ -2113,7 +2113,7 @@ void ui_image_menu_software(running_machine *machine, ui_menu *menu, void *param if (event != NULL && event->iptkey == IPT_UI_SELECT) { - ui_menu *child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), ui_mess_menu_software_list, NULL); + ui_menu *child_menu = ui_menu_alloc(machine, &machine.render().ui_container(), ui_mess_menu_software_list, NULL); software_menu_state *child_menustate = (software_menu_state *)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL); child_menustate->list_name = (char *)event->itemref; child_menustate->image = image; diff --git a/src/emu/softlist.h b/src/emu/softlist.h index 563d5426044..b5dd563ee73 100644 --- a/src/emu/softlist.h +++ b/src/emu/softlist.h @@ -71,7 +71,7 @@ const char *software_part_get_feature(software_part *part, const char *feature_n bool load_software_part(device_image_interface *image, const char *path, software_info **sw_info, software_part **sw_part, char **full_sw_name); -void ui_image_menu_software(running_machine *machine, ui_menu *menu, void *parameter, void *state); +void ui_image_menu_software(running_machine &machine, ui_menu *menu, void *parameter, void *state); /********************************************************************* diff --git a/src/emu/sound.c b/src/emu/sound.c index 2081f41c118..64ffa942bef 100644 --- a/src/emu/sound.c +++ b/src/emu/sound.c @@ -86,12 +86,12 @@ sound_stream::sound_stream(device_t &device, int inputs, int outputs, int sample m_attoseconds_per_sample(0), m_max_samples_per_update(0), m_inputs(inputs), - m_input((inputs == 0) ? NULL : auto_alloc_array_clear(device.machine, stream_input, inputs)), - m_input_array((inputs == 0) ? NULL : auto_alloc_array_clear(device.machine, stream_sample_t *, inputs)), + m_input((inputs == 0) ? NULL : auto_alloc_array_clear(device.machine(), stream_input, inputs)), + m_input_array((inputs == 0) ? NULL : auto_alloc_array_clear(device.machine(), stream_sample_t *, inputs)), m_resample_bufalloc(0), m_outputs(outputs), - m_output((outputs == 0) ? NULL : auto_alloc_array_clear(device.machine, stream_output, outputs)), - m_output_array((outputs == 0) ? NULL : auto_alloc_array_clear(device.machine, stream_sample_t *, outputs)), + m_output((outputs == 0) ? NULL : auto_alloc_array_clear(device.machine(), stream_output, outputs)), + m_output_array((outputs == 0) ? NULL : auto_alloc_array_clear(device.machine(), stream_sample_t *, outputs)), m_output_bufalloc(0), m_output_sampindex(0), m_output_update_sampindex(0), @@ -110,17 +110,17 @@ sound_stream::sound_stream(device_t &device, int inputs, int outputs, int sample // create a unique tag for saving astring state_tag; - state_tag.printf("%d", m_device.machine->sound().m_stream_list.count()); - m_device.machine->state().save_item("stream", state_tag, 0, NAME(m_sample_rate)); - m_device.machine->state().register_postload(state_postload_stub<sound_stream, &sound_stream::postload>, this); + state_tag.printf("%d", m_device.machine().sound().m_stream_list.count()); + m_device.machine().state().save_item("stream", state_tag, 0, NAME(m_sample_rate)); + m_device.machine().state().register_postload(state_postload_stub<sound_stream, &sound_stream::postload>, this); // save the gain of each input and output for (int inputnum = 0; inputnum < m_inputs; inputnum++) - m_device.machine->state().save_item("stream", state_tag, inputnum, NAME(m_input[inputnum].m_gain)); + m_device.machine().state().save_item("stream", state_tag, inputnum, NAME(m_input[inputnum].m_gain)); for (int outputnum = 0; outputnum < m_outputs; outputnum++) { m_output[outputnum].m_stream = this; - m_device.machine->state().save_item("stream", state_tag, outputnum, NAME(m_output[outputnum].m_gain)); + m_device.machine().state().save_item("stream", state_tag, outputnum, NAME(m_output[outputnum].m_gain)); } // force an update to the sample rates; this will cause everything to be recomputed @@ -139,7 +139,7 @@ sound_stream::sound_stream(device_t &device, int inputs, int outputs, int sample attotime sound_stream::sample_time() const { - return attotime(m_device.machine->sound().last_update().seconds, 0) + attotime(0, m_output_sampindex * m_attoseconds_per_sample); + return attotime(m_device.machine().sound().last_update().seconds, 0) + attotime(0, m_output_sampindex * m_attoseconds_per_sample); } @@ -258,11 +258,11 @@ void sound_stream::set_input(int index, sound_stream *input_stream, int output_i void sound_stream::update() { // determine the number of samples since the start of this second - attotime time = m_device.machine->time(); + attotime time = m_device.machine().time(); INT32 update_sampindex = INT32(time.attoseconds / m_attoseconds_per_sample); // if we're ahead of the last update, then adjust upwards - attotime last_update = m_device.machine->sound().last_update(); + attotime last_update = m_device.machine().sound().last_update(); if (time.seconds > last_update.seconds) { assert(time.seconds == last_update.seconds + 1); @@ -439,7 +439,7 @@ STREAM_UPDATE( sound_stream::device_stream_update_stub ) void sound_stream::recompute_sample_rate_data() { // recompute the timing parameters - attoseconds_t update_attoseconds = m_device.machine->sound().update_attoseconds(); + attoseconds_t update_attoseconds = m_device.machine().sound().update_attoseconds(); m_attoseconds_per_sample = ATTOSECONDS_PER_SECOND / m_sample_rate; m_max_samples_per_update = (update_attoseconds + m_attoseconds_per_sample - 1) / m_attoseconds_per_sample; @@ -498,9 +498,9 @@ void sound_stream::allocate_resample_buffers() for (int inputnum = 0; inputnum < m_inputs; inputnum++) { stream_input &input = m_input[inputnum]; - stream_sample_t *newbuffer = auto_alloc_array(m_device.machine, stream_sample_t, m_resample_bufalloc); + stream_sample_t *newbuffer = auto_alloc_array(m_device.machine(), stream_sample_t, m_resample_bufalloc); memcpy(newbuffer, input.m_resample, oldsize * sizeof(stream_sample_t)); - auto_free(m_device.machine, input.m_resample); + auto_free(m_device.machine(), input.m_resample); input.m_resample = newbuffer; } } @@ -526,10 +526,10 @@ void sound_stream::allocate_output_buffers() for (int outputnum = 0; outputnum < m_outputs; outputnum++) { stream_output &output = m_output[outputnum]; - stream_sample_t *newbuffer = auto_alloc_array(m_device.machine, stream_sample_t, m_output_bufalloc); + stream_sample_t *newbuffer = auto_alloc_array(m_device.machine(), stream_sample_t, m_output_bufalloc); memcpy(newbuffer, output.m_buffer, oldsize * sizeof(stream_sample_t)); memset(newbuffer + oldsize, 0, (m_output_bufalloc - oldsize) * sizeof(stream_sample_t)); - auto_free(m_device.machine, output.m_buffer); + auto_free(m_device.machine(), output.m_buffer); output.m_buffer = newbuffer; } } @@ -550,7 +550,7 @@ void sound_stream::postload() memset(m_output[outputnum].m_buffer, 0, m_output_bufalloc * sizeof(m_output[outputnum].m_buffer[0])); // recompute the sample indexes to make sense - m_output_sampindex = m_device.machine->sound().last_update().attoseconds / m_attoseconds_per_sample; + m_output_sampindex = m_device.machine().sound().last_update().attoseconds / m_attoseconds_per_sample; m_output_update_sampindex = m_output_sampindex; m_output_base_sampindex = m_output_sampindex - m_max_samples_per_update; } @@ -791,22 +791,22 @@ sound_manager::sound_manager(running_machine &machine) 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); // register callbacks - config_register(&machine, "mixer", &sound_manager::config_load, &sound_manager::config_save); + config_register(machine, "mixer", &sound_manager::config_load, &sound_manager::config_save); machine.add_notifier(MACHINE_NOTIFY_PAUSE, &sound_manager::pause); machine.add_notifier(MACHINE_NOTIFY_RESUME, &sound_manager::resume); machine.add_notifier(MACHINE_NOTIFY_RESET, &sound_manager::reset); // register global states - state_save_register_global(&machine, m_last_update); + state_save_register_global(machine, m_last_update); // set the starting attenuation set_attenuation(machine.options().volume()); @@ -836,9 +836,9 @@ sound_manager::~sound_manager() sound_stream *sound_manager::stream_alloc(device_t &device, int inputs, int outputs, int sample_rate, void *param, sound_stream::stream_update_func callback) { if (callback != NULL) - return &m_stream_list.append(*auto_alloc(device.machine, sound_stream(device, inputs, outputs, sample_rate, param, callback))); + return &m_stream_list.append(*auto_alloc(device.machine(), sound_stream(device, inputs, outputs, sample_rate, param, callback))); else - return &m_stream_list.append(*auto_alloc(device.machine, sound_stream(device, inputs, outputs, sample_rate))); + return &m_stream_list.append(*auto_alloc(device.machine(), sound_stream(device, inputs, outputs, sample_rate))); } @@ -930,7 +930,7 @@ void sound_manager::resume(running_machine &machine) // configuration file //------------------------------------------------- -void sound_manager::config_load(running_machine *machine, int config_type, xml_data_node *parentnode) +void sound_manager::config_load(running_machine &machine, int config_type, xml_data_node *parentnode) { // we only care about game files if (config_type != CONFIG_TYPE_GAME) @@ -944,7 +944,7 @@ void sound_manager::config_load(running_machine *machine, int config_type, xml_d for (xml_data_node *channelnode = xml_get_sibling(parentnode->child, "channel"); channelnode != NULL; channelnode = xml_get_sibling(channelnode->next, "channel")) { speaker_input info; - if (machine->sound().indexed_speaker_input(xml_get_attribute_int(channelnode, "index", -1), info)) + if (machine.sound().indexed_speaker_input(xml_get_attribute_int(channelnode, "index", -1), info)) { float defvol = xml_get_attribute_float(channelnode, "defvol", -1000.0); float newvol = xml_get_attribute_float(channelnode, "newvol", -1000.0); @@ -960,7 +960,7 @@ void sound_manager::config_load(running_machine *machine, int config_type, xml_d // file //------------------------------------------------- -void sound_manager::config_save(running_machine *machine, int config_type, xml_data_node *parentnode) +void sound_manager::config_save(running_machine &machine, int config_type, xml_data_node *parentnode) { // we only care about game files if (config_type != CONFIG_TYPE_GAME) @@ -971,7 +971,7 @@ void sound_manager::config_save(running_machine *machine, int config_type, xml_d for (int mixernum = 0; ; mixernum++) { speaker_input info; - if (!machine->sound().indexed_speaker_input(mixernum, info)) + if (!machine.sound().indexed_speaker_input(mixernum, info)) break; float defvol = info.stream->initial_input_gain(info.inputnum); float newvol = info.stream->input_gain(info.inputnum); diff --git a/src/emu/sound.h b/src/emu/sound.h index d8130e1aae5..10ac49ef987 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -244,8 +244,8 @@ private: static void reset(running_machine &machine); static void pause(running_machine &machine); static void resume(running_machine &machine); - static void config_load(running_machine *machine, int config_type, xml_data_node *parentnode); - static void config_save(running_machine *machine, int config_type, xml_data_node *parentnode); + static void config_load(running_machine &machine, int config_type, xml_data_node *parentnode); + static void config_save(running_machine &machine, int config_type, xml_data_node *parentnode); static TIMER_CALLBACK( update_static ) { reinterpret_cast<sound_manager *>(ptr)->update(); } void update(); diff --git a/src/emu/sound/2151intf.c b/src/emu/sound/2151intf.c index 1531cf82c95..50155b780f6 100644 --- a/src/emu/sound/2151intf.c +++ b/src/emu/sound/2151intf.c @@ -56,12 +56,12 @@ static DEVICE_START( ym2151 ) rate = device->clock()/64; /* stream setup */ - info->stream = device->machine->sound().stream_alloc(*device,0,2,rate,info,ym2151_update); + info->stream = device->machine().sound().stream_alloc(*device,0,2,rate,info,ym2151_update); info->chip = ym2151_init(device,device->clock(),rate); assert_always(info->chip != NULL, "Error creating YM2151 chip"); - device->machine->state().register_postload(ym2151intf_postload, info); + device->machine().state().register_postload(ym2151intf_postload, info); ym2151_set_irq_handler(info->chip,info->intf->irqhandler); ym2151_set_port_write_handler(info->chip,info->intf->portwritehandler); diff --git a/src/emu/sound/2203intf.c b/src/emu/sound/2203intf.c index 1604af2a8cd..c9759e016b0 100644 --- a/src/emu/sound/2203intf.c +++ b/src/emu/sound/2203intf.c @@ -134,17 +134,17 @@ static DEVICE_START( ym2203 ) assert_always(info->psg != NULL, "Error creating YM2203/AY8910 chip"); /* Timer Handler set */ - info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2203_0), info); - info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2203_1), info); + info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_2203_0), info); + info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_2203_1), info); /* stream system initialize */ - info->stream = device->machine->sound().stream_alloc(*device,0,1,rate,info,ym2203_stream_update); + info->stream = device->machine().sound().stream_alloc(*device,0,1,rate,info,ym2203_stream_update); /* Initialize FM emurator */ info->chip = ym2203_init(info,device,device->clock(),rate,timer_handler,IRQHandler,&psgintf); assert_always(info->chip != NULL, "Error creating YM2203 chip"); - device->machine->state().register_postload(ym2203_intf_postload, info); + device->machine().state().register_postload(ym2203_intf_postload, info); } static DEVICE_STOP( ym2203 ) diff --git a/src/emu/sound/2413intf.c b/src/emu/sound/2413intf.c index fc37220eb23..ab4c738a1dc 100644 --- a/src/emu/sound/2413intf.c +++ b/src/emu/sound/2413intf.c @@ -62,7 +62,7 @@ static DEVICE_START( ym2413 ) assert_always(info->chip != NULL, "Error creating YM2413 chip"); /* stream system initialize */ - info->stream = device->machine->sound().stream_alloc(*device,0,2,rate,info,ym2413_stream_update); + info->stream = device->machine().sound().stream_alloc(*device,0,2,rate,info,ym2413_stream_update); ym2413_set_update_handler(info->chip, _stream_update, info); @@ -83,7 +83,7 @@ static DEVICE_START( ym2413 ) { ym2413_reset (i); - ym2413[i].DAC_stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock()/72, i, YM2413DAC_update); + ym2413[i].DAC_stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock()/72, i, YM2413DAC_update); if (ym2413[i].DAC_stream == -1) return 1; diff --git a/src/emu/sound/2608intf.c b/src/emu/sound/2608intf.c index 9d54be5f90b..9d267f78489 100644 --- a/src/emu/sound/2608intf.c +++ b/src/emu/sound/2608intf.c @@ -152,11 +152,11 @@ static DEVICE_START( ym2608 ) assert_always(info->psg != NULL, "Error creating YM2608/AY8910 chip"); /* Timer Handler set */ - info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2608_0), info); - info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2608_1), info); + info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_2608_0), info); + info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_2608_1), info); /* stream system initialize */ - info->stream = device->machine->sound().stream_alloc(*device,0,2,rate,info,ym2608_stream_update); + info->stream = device->machine().sound().stream_alloc(*device,0,2,rate,info,ym2608_stream_update); /* setup adpcm buffers */ pcmbufa = *device->region(); pcmsizea = device->region()->bytes(); @@ -167,7 +167,7 @@ static DEVICE_START( ym2608 ) timer_handler,IRQHandler,&psgintf); assert_always(info->chip != NULL, "Error creating YM2608 chip"); - device->machine->state().register_postload(ym2608_intf_postload, info); + device->machine().state().register_postload(ym2608_intf_postload, info); } static DEVICE_STOP( ym2608 ) diff --git a/src/emu/sound/2610intf.c b/src/emu/sound/2610intf.c index e59bf97d8f8..2572bc295c9 100644 --- a/src/emu/sound/2610intf.c +++ b/src/emu/sound/2610intf.c @@ -156,17 +156,17 @@ static DEVICE_START( ym2610 ) assert_always(info->psg != NULL, "Error creating YM2610/AY8910 chip"); /* Timer Handler set */ - info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info); - info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info); + info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_0), info); + info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_1), info); /* stream system initialize */ - info->stream = device->machine->sound().stream_alloc(*device,0,2,rate,info,(type == YM2610) ? ym2610_stream_update : ym2610b_stream_update); + info->stream = device->machine().sound().stream_alloc(*device,0,2,rate,info,(type == YM2610) ? ym2610_stream_update : ym2610b_stream_update); /* setup adpcm buffers */ pcmbufa = *device->region(); pcmsizea = device->region()->bytes(); name.printf("%s.deltat", device->tag()); - pcmbufb = (void *)(device->machine->region(name)->base()); - pcmsizeb = device->machine->region(name)->bytes(); + pcmbufb = (void *)(device->machine().region(name)->base()); + pcmsizeb = device->machine().region(name)->bytes(); if (pcmbufb == NULL || pcmsizeb == 0) { pcmbufb = pcmbufa; @@ -179,7 +179,7 @@ static DEVICE_START( ym2610 ) timer_handler,IRQHandler,&psgintf); assert_always(info->chip != NULL, "Error creating YM2610 chip"); - device->machine->state().register_postload(ym2610_intf_postload, info); + device->machine().state().register_postload(ym2610_intf_postload, info); } static DEVICE_STOP( ym2610 ) diff --git a/src/emu/sound/2612intf.c b/src/emu/sound/2612intf.c index 88ca4ae82fa..2311ad39a0e 100644 --- a/src/emu/sound/2612intf.c +++ b/src/emu/sound/2612intf.c @@ -108,17 +108,17 @@ static DEVICE_START( ym2612 ) /* FM init */ /* Timer Handler set */ - info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2612_0), info); - info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_2612_1), info); + info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_2612_0), info); + info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_2612_1), info); /* stream system initialize */ - info->stream = device->machine->sound().stream_alloc(*device,0,2,rate,info,ym2612_stream_update); + info->stream = device->machine().sound().stream_alloc(*device,0,2,rate,info,ym2612_stream_update); /**** initialize YM2612 ****/ info->chip = ym2612_init(info,device,device->clock(),rate,timer_handler,IRQHandler); assert_always(info->chip != NULL, "Error creating YM2612 chip"); - device->machine->state().register_postload(ym2612_intf_postload, info); + device->machine().state().register_postload(ym2612_intf_postload, info); } diff --git a/src/emu/sound/262intf.c b/src/emu/sound/262intf.c index eeaaf46f6c7..85b2853160f 100644 --- a/src/emu/sound/262intf.c +++ b/src/emu/sound/262intf.c @@ -88,15 +88,15 @@ static DEVICE_START( ymf262 ) info->chip = ymf262_init(device,device->clock(),rate); assert_always(info->chip != NULL, "Error creating YMF262 chip"); - info->stream = device->machine->sound().stream_alloc(*device,0,4,rate,info,ymf262_stream_update); + info->stream = device->machine().sound().stream_alloc(*device,0,4,rate,info,ymf262_stream_update); /* YMF262 setup */ ymf262_set_timer_handler (info->chip, timer_handler_262, info); ymf262_set_irq_handler (info->chip, IRQHandler_262, info); ymf262_set_update_handler(info->chip, _stream_update, info); - info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_262_0), info); - info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_262_1), info); + info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_262_0), info); + info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_262_1), info); } static DEVICE_STOP( ymf262 ) diff --git a/src/emu/sound/3526intf.c b/src/emu/sound/3526intf.c index 0d4b67b0434..e97ec9069a1 100644 --- a/src/emu/sound/3526intf.c +++ b/src/emu/sound/3526intf.c @@ -99,14 +99,14 @@ static DEVICE_START( ym3526 ) info->chip = ym3526_init(device,device->clock(),rate); assert_always(info->chip != NULL, "Error creating YM3526 chip"); - info->stream = device->machine->sound().stream_alloc(*device,0,1,rate,info,ym3526_stream_update); + info->stream = device->machine().sound().stream_alloc(*device,0,1,rate,info,ym3526_stream_update); /* YM3526 setup */ ym3526_set_timer_handler (info->chip, TimerHandler, info); ym3526_set_irq_handler (info->chip, IRQHandler, info); ym3526_set_update_handler(info->chip, _stream_update, info); - info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info); - info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info); + info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_0), info); + info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_1), info); } static DEVICE_STOP( ym3526 ) diff --git a/src/emu/sound/3812intf.c b/src/emu/sound/3812intf.c index fd58c7b04e1..5379ae5ed63 100644 --- a/src/emu/sound/3812intf.c +++ b/src/emu/sound/3812intf.c @@ -99,15 +99,15 @@ static DEVICE_START( ym3812 ) info->chip = ym3812_init(device,device->clock(),rate); assert_always(info->chip != NULL, "Error creating YM3812 chip"); - info->stream = device->machine->sound().stream_alloc(*device,0,1,rate,info,ym3812_stream_update); + info->stream = device->machine().sound().stream_alloc(*device,0,1,rate,info,ym3812_stream_update); /* YM3812 setup */ ym3812_set_timer_handler (info->chip, TimerHandler, info); ym3812_set_irq_handler (info->chip, IRQHandler, info); ym3812_set_update_handler(info->chip, _stream_update, info); - info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info); - info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info); + info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_0), info); + info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_1), info); } static DEVICE_STOP( ym3812 ) diff --git a/src/emu/sound/8950intf.c b/src/emu/sound/8950intf.c index 19e02b73dc7..240f3e93bd5 100644 --- a/src/emu/sound/8950intf.c +++ b/src/emu/sound/8950intf.c @@ -129,7 +129,7 @@ static DEVICE_START( y8950 ) /* ADPCM ROM data */ y8950_set_delta_t_memory(info->chip, *device->region(), device->region()->bytes()); - info->stream = device->machine->sound().stream_alloc(*device,0,1,rate,info,y8950_stream_update); + info->stream = device->machine().sound().stream_alloc(*device,0,1,rate,info,y8950_stream_update); /* port and keyboard handler */ y8950_set_port_handler(info->chip, Y8950PortHandler_w, Y8950PortHandler_r, info); y8950_set_keyboard_handler(info->chip, Y8950KeyboardHandler_w, Y8950KeyboardHandler_r, info); @@ -139,8 +139,8 @@ static DEVICE_START( y8950 ) y8950_set_irq_handler (info->chip, IRQHandler, info); y8950_set_update_handler(info->chip, _stream_update, info); - info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info); - info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info); + info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_0), info); + info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_1), info); } static DEVICE_STOP( y8950 ) diff --git a/src/emu/sound/aica.c b/src/emu/sound/aica.c index ca10f73af89..9dd5dbbecd4 100644 --- a/src/emu/sound/aica.c +++ b/src/emu/sound/aica.c @@ -521,9 +521,9 @@ static void AICA_Init(device_t *device, aica_state *AICA, const aica_interface * } } - AICA->timerA = device->machine->scheduler().timer_alloc(FUNC(timerA_cb), AICA); - AICA->timerB = device->machine->scheduler().timer_alloc(FUNC(timerB_cb), AICA); - AICA->timerC = device->machine->scheduler().timer_alloc(FUNC(timerC_cb), AICA); + AICA->timerA = device->machine().scheduler().timer_alloc(FUNC(timerA_cb), AICA); + AICA->timerB = device->machine().scheduler().timer_alloc(FUNC(timerB_cb), AICA); + AICA->timerC = device->machine().scheduler().timer_alloc(FUNC(timerC_cb), AICA); for(i=0;i<0x400;++i) { @@ -614,9 +614,9 @@ static void AICA_Init(device_t *device, aica_state *AICA, const aica_interface * AICA->Slots[i].lpend=1; } - AICALFO_Init(device->machine); - AICA->buffertmpl=auto_alloc_array_clear(device->machine, signed int, 44100); - AICA->buffertmpr=auto_alloc_array_clear(device->machine, signed int, 44100); + AICALFO_Init(device->machine()); + AICA->buffertmpl=auto_alloc_array_clear(device->machine(), signed int, 44100); + AICA->buffertmpr=auto_alloc_array_clear(device->machine(), signed int, 44100); // no "pend" AICA[0].udata.data[0xa0/2] = 0; @@ -1283,7 +1283,7 @@ static DEVICE_START( aica ) { AICA->IntARMCB = intf->irq_callback; - AICA->stream = device->machine->sound().stream_alloc(*device, 0, 2, 44100, AICA, AICA_Update); + AICA->stream = device->machine().sound().stream_alloc(*device, 0, 2, 44100, AICA, AICA_Update); } } diff --git a/src/emu/sound/aicalfo.c b/src/emu/sound/aicalfo.c index d6b6436f9cd..f992ea29a2d 100644 --- a/src/emu/sound/aicalfo.c +++ b/src/emu/sound/aicalfo.c @@ -34,7 +34,7 @@ static const float PSCALE[8]={0.0f,7.0f,13.5f,27.0f,55.0f,112.0f,230.0f,494.0f}; static int PSCALES[8][256]; static int ASCALES[8][256]; -static void AICALFO_Init(running_machine *machine) +static void AICALFO_Init(running_machine &machine) { int i,s; for(i=0;i<256;++i) @@ -82,7 +82,7 @@ static void AICALFO_Init(running_machine *machine) //noise //a=lfo_noise[i]; - a=machine->rand()&0xff; + a=machine.rand()&0xff; p=128-a; ALFO_NOI[i]=a; PLFO_NOI[i]=p; diff --git a/src/emu/sound/asc.c b/src/emu/sound/asc.c index 7440b1b885b..824c04a92c3 100644 --- a/src/emu/sound/asc.c +++ b/src/emu/sound/asc.c @@ -93,7 +93,7 @@ device_config *asc_device_config::static_alloc_device_config(const machine_confi device_t *asc_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, asc_device(machine, *this)); + return auto_alloc(machine, asc_device(machine, *this)); } //************************************************************************** @@ -133,7 +133,7 @@ void asc_device::device_start() memset(m_regs, 0, sizeof(m_regs)); - m_sync_timer = this->machine->scheduler().timer_alloc(FUNC(sync_timer_cb), this); + m_sync_timer = this->machine().scheduler().timer_alloc(FUNC(sync_timer_cb), this); save_item(NAME(m_fifo_a_rdptr)); save_item(NAME(m_fifo_b_rdptr)); diff --git a/src/emu/sound/astrocde.c b/src/emu/sound/astrocde.c index 4547172cc8c..3ae7112fb7a 100644 --- a/src/emu/sound/astrocde.c +++ b/src/emu/sound/astrocde.c @@ -271,7 +271,7 @@ static DEVICE_START( astrocade ) chip->bitswap[i] = BITSWAP8(i, 0,1,2,3,4,5,6,7); /* allocate a stream for output */ - chip->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock(), chip, astrocade_update); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock(), chip, astrocade_update); /* reset state */ DEVICE_RESET_CALL(astrocade); diff --git a/src/emu/sound/ay8910.c b/src/emu/sound/ay8910.c index 3ff68bcc46f..f9f57e326b9 100644 --- a/src/emu/sound/ay8910.c +++ b/src/emu/sound/ay8910.c @@ -738,7 +738,7 @@ void *ay8910_start_ym(void *infoptr, device_type chip_type, device_t *device, in ay8910_context *info = (ay8910_context *)infoptr; if (info == NULL) - info = auto_alloc_clear(device->machine, ay8910_context); + info = auto_alloc_clear(device->machine(), ay8910_context); info->device = device; info->intf = intf; @@ -775,7 +775,7 @@ void *ay8910_start_ym(void *infoptr, device_type chip_type, device_t *device, in /* The envelope is pacing twice as fast for the YM2149 as for the AY-3-8910, */ /* This handled by the step parameter. Consequently we use a divider of 8 here. */ - info->channel = device->machine->sound().stream_alloc(*device, 0, info->streams, device->clock() / 8, info, ay8910_update); + info->channel = device->machine().sound().stream_alloc(*device, 0, info->streams, device->clock() / 8, info, ay8910_update); ay8910_set_clock_ym(info,device->clock()); ay8910_statesave(info, device); @@ -887,7 +887,7 @@ int ay8910_read_ym(void *chip) if (psg->portAread.read) psg->regs[AY_PORTA] = devcb_call_read8(&psg->portAread, 0); else - logerror("%s: warning - read 8910 '%s' Port A\n",psg->device->machine->describe_context(),psg->device->tag()); + logerror("%s: warning - read 8910 '%s' Port A\n",psg->device->machine().describe_context(),psg->device->tag()); break; case AY_PORTB: if ((psg->regs[AY_ENABLE] & 0x80) != 0) @@ -895,7 +895,7 @@ int ay8910_read_ym(void *chip) if (psg->portBread.read) psg->regs[AY_PORTB] = devcb_call_read8(&psg->portBread, 0); else - logerror("%s: warning - read 8910 '%s' Port B\n",psg->device->machine->describe_context(),psg->device->tag()); + logerror("%s: warning - read 8910 '%s' Port B\n",psg->device->machine().describe_context(),psg->device->tag()); break; } diff --git a/src/emu/sound/beep.c b/src/emu/sound/beep.c index 0c0fe947f9e..fc5f9d5e124 100644 --- a/src/emu/sound/beep.c +++ b/src/emu/sound/beep.c @@ -92,7 +92,7 @@ static DEVICE_START( beep ) { beep_state *pBeep = get_safe_token(device); - pBeep->stream = device->machine->sound().stream_alloc(*device, 0, 1, BEEP_RATE, pBeep, beep_sound_update ); + pBeep->stream = device->machine().sound().stream_alloc(*device, 0, 1, BEEP_RATE, pBeep, beep_sound_update ); pBeep->enable = 0; pBeep->frequency = 3250; pBeep->incr = 0; diff --git a/src/emu/sound/bsmt2000.c b/src/emu/sound/bsmt2000.c index d2781fef5b1..523836045f4 100644 --- a/src/emu/sound/bsmt2000.c +++ b/src/emu/sound/bsmt2000.c @@ -134,7 +134,7 @@ device_config *bsmt2000_device_config::static_alloc_device_config(const machine_ device_t *bsmt2000_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, bsmt2000_device(machine, *this)); + return auto_alloc(machine, bsmt2000_device(machine, *this)); } diff --git a/src/emu/sound/c140.c b/src/emu/sound/c140.c index f87c8d22b8c..cc5e5deeab9 100644 --- a/src/emu/sound/c140.c +++ b/src/emu/sound/c140.c @@ -470,7 +470,7 @@ static DEVICE_START( c140 ) info->banking_type = intf->banking_type; - info->stream = device->machine->sound().stream_alloc(*device,0,2,info->sample_rate,info,update_stereo); + info->stream = device->machine().sound().stream_alloc(*device,0,2,info->sample_rate,info,update_stereo); info->pRom=*device->region(); @@ -492,7 +492,7 @@ static DEVICE_START( c140 ) } /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */ - info->mixer_buffer_left = auto_alloc_array(device->machine, INT16, 2 * info->sample_rate); + info->mixer_buffer_left = auto_alloc_array(device->machine(), INT16, 2 * info->sample_rate); info->mixer_buffer_right = info->mixer_buffer_left + info->sample_rate; } diff --git a/src/emu/sound/c352.c b/src/emu/sound/c352.c index 93e38fd841b..4bb73edcb73 100644 --- a/src/emu/sound/c352.c +++ b/src/emu/sound/c352.c @@ -545,7 +545,7 @@ static DEVICE_START( c352 ) info->sample_rate_base = device->clock() / 192; - info->stream = device->machine->sound().stream_alloc(*device, 0, 4, info->sample_rate_base, info, c352_update); + info->stream = device->machine().sound().stream_alloc(*device, 0, 4, info->sample_rate_base, info, c352_update); c352_init(info, device); } diff --git a/src/emu/sound/c6280.c b/src/emu/sound/c6280.c index 0412d014dab..64a9a0dda10 100644 --- a/src/emu/sound/c6280.c +++ b/src/emu/sound/c6280.c @@ -26,7 +26,7 @@ game will reset the index prior to playback so this isn't an issue. - While the noise emulation is complete, the data for the pseudo-random - bitstream is calculated by machine->rand() and is not a representation of what + bitstream is calculated by machine.rand() and is not a representation of what the actual hardware does. For some background on Hudson Soft's C62 chipset: @@ -107,7 +107,7 @@ static void c6280_init(device_t *device, c6280_t *p, double clk, double rate) memset(p, 0, sizeof(c6280_t)); p->device = device; - p->cpudevice = device->machine->device(intf->cpu); + p->cpudevice = device->machine().device(intf->cpu); if (p->cpudevice == NULL) fatalerror("c6280_init: no CPU found with tag of '%s'\n", device->tag()); @@ -277,7 +277,7 @@ static STREAM_UPDATE( c6280_update ) p->channel[ch].noise_counter += step; if(p->channel[ch].noise_counter >= 0x800) { - data = (p->device->machine->rand() & 1) ? 0x1F : 0; + data = (p->device->machine().rand() & 1) ? 0x1F : 0; } p->channel[ch].noise_counter &= 0x7FF; outputs[0][i] += (INT16)(vll * (data - 16)); @@ -328,7 +328,7 @@ static DEVICE_START( c6280 ) c6280_init(device, info, device->clock(), rate); /* Create stereo stream */ - info->stream = device->machine->sound().stream_alloc(*device, 0, 2, rate, info, c6280_update); + info->stream = device->machine().sound().stream_alloc(*device, 0, 2, rate, info, c6280_update); } READ8_DEVICE_HANDLER( c6280_r ) diff --git a/src/emu/sound/cdda.c b/src/emu/sound/cdda.c index 71d02515f7d..fdf102b050b 100644 --- a/src/emu/sound/cdda.c +++ b/src/emu/sound/cdda.c @@ -54,11 +54,11 @@ static DEVICE_START( cdda ) cdda_info *info = get_safe_token(device); /* allocate an audio cache */ - info->audio_cache = auto_alloc_array( device->machine, UINT8, CD_MAX_SECTOR_DATA * MAX_SECTORS ); + info->audio_cache = auto_alloc_array( device->machine(), UINT8, CD_MAX_SECTOR_DATA * MAX_SECTORS ); //intf = (const struct CDDAinterface *)device->baseconfig().static_config(); - info->stream = device->machine->sound().stream_alloc(*device, 0, 2, 44100, info, cdda_update); + info->stream = device->machine().sound().stream_alloc(*device, 0, 2, 44100, info, cdda_update); device->save_item( NAME(info->audio_playing) ); device->save_item( NAME(info->audio_pause) ); @@ -88,11 +88,11 @@ void cdda_set_cdrom(device_t *device, void *file) that references the given CD-ROM file -------------------------------------------------*/ -device_t *cdda_from_cdrom(running_machine *machine, void *file) +device_t *cdda_from_cdrom(running_machine &machine, void *file) { device_sound_interface *sound = NULL; - for (bool gotone = machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound)) + for (bool gotone = machine.m_devicelist.first(sound); gotone; gotone = sound->next(sound)) if (sound->device().type() == CDDA) { cdda_info *info = get_safe_token(*sound); diff --git a/src/emu/sound/cdda.h b/src/emu/sound/cdda.h index 3db1830e9af..0c9c605978b 100644 --- a/src/emu/sound/cdda.h +++ b/src/emu/sound/cdda.h @@ -6,7 +6,7 @@ #include "devlegcy.h" void cdda_set_cdrom(device_t *device, void *file); -device_t *cdda_from_cdrom(running_machine *machine, void *file); +device_t *cdda_from_cdrom(running_machine &machine, void *file); void cdda_start_audio(device_t *device, UINT32 startlba, UINT32 numblocks); void cdda_stop_audio(device_t *device); diff --git a/src/emu/sound/cdp1863.c b/src/emu/sound/cdp1863.c index 29c9dac9a19..64349b5193f 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 52fcb51368f..da02f4f8f50 100644 --- a/src/emu/sound/cdp1864.c +++ b/src/emu/sound/cdp1864.c @@ -176,7 +176,7 @@ static TIMER_CALLBACK( cdp1864_dma_tick ) } } - cdp1864->dma_timer->adjust(machine->firstcpu->cycles_to_attotime(CDP1864_CYCLES_DMA_WAIT)); + cdp1864->dma_timer->adjust(machine.firstcpu->cycles_to_attotime(CDP1864_CYCLES_DMA_WAIT)); cdp1864->dmaout = 0; } @@ -190,7 +190,7 @@ static TIMER_CALLBACK( cdp1864_dma_tick ) } } - cdp1864->dma_timer->adjust(machine->firstcpu->cycles_to_attotime(CDP1864_CYCLES_DMA_ACTIVE)); + cdp1864->dma_timer->adjust(machine.firstcpu->cycles_to_attotime(CDP1864_CYCLES_DMA_ACTIVE)); cdp1864->dmaout = 1; } @@ -226,7 +226,7 @@ static void cdp1864_init_palette(device_t *device, const cdp1864_interface *intf g = (i & 1) ? luma : 0; b = (i & 2) ? luma : 0; - palette_set_color_rgb( device->machine, i, r, g, b ); + palette_set_color_rgb( device->machine(), i, r, g, b ); } } @@ -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; @@ -410,7 +410,7 @@ void cdp1864_update(device_t *device, bitmap_t *bitmap, const rectangle *cliprec } else { - bitmap_fill(bitmap, cliprect, get_black_pen(device->machine)); + bitmap_fill(bitmap, cliprect, get_black_pen(device->machine())); } } @@ -432,26 +432,26 @@ static DEVICE_START( cdp1864 ) devcb_resolve_write_line(&cdp1864->out_efx_func, &intf->out_efx_func, device); /* get the cpu */ - cdp1864->cpu = device->machine->device(intf->cpu_tag); + cdp1864->cpu = device->machine().device(intf->cpu_tag); /* get the screen device */ - cdp1864->screen = downcast<screen_device *>(device->machine->device(intf->screen_tag)); + cdp1864->screen = downcast<screen_device *>(device->machine().device(intf->screen_tag)); assert(cdp1864->screen != NULL); /* allocate the temporary bitmap */ - cdp1864->bitmap = auto_bitmap_alloc(device->machine, cdp1864->screen->width(), cdp1864->screen->height(), cdp1864->screen->format()); + cdp1864->bitmap = auto_bitmap_alloc(device->machine(), cdp1864->screen->width(), cdp1864->screen->height(), cdp1864->screen->format()); bitmap_fill(cdp1864->bitmap, 0, CDP1864_BACKGROUND_COLOR_SEQUENCE[cdp1864->bgcolor] + 8); /* initialize the palette */ 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); - cdp1864->efx_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1864_efx_tick), (void *)device); - cdp1864->dma_timer = device->machine->scheduler().timer_alloc(FUNC(cdp1864_dma_tick), (void *)device); + cdp1864->int_timer = device->machine().scheduler().timer_alloc(FUNC(cdp1864_int_tick), (void *)device); + cdp1864->efx_timer = device->machine().scheduler().timer_alloc(FUNC(cdp1864_efx_tick), (void *)device); + cdp1864->dma_timer = device->machine().scheduler().timer_alloc(FUNC(cdp1864_dma_tick), (void *)device); /* register for state saving */ device->save_item(NAME(cdp1864->disp)); @@ -477,7 +477,7 @@ static DEVICE_RESET( cdp1864 ) cdp1864->int_timer->adjust(cdp1864->screen->time_until_pos(CDP1864_SCANLINE_INT_START)); cdp1864->efx_timer->adjust(cdp1864->screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_START)); - cdp1864->dma_timer->adjust(device->machine->firstcpu->cycles_to_attotime(CDP1864_CYCLES_DMA_START)); + cdp1864->dma_timer->adjust(device->machine().firstcpu->cycles_to_attotime(CDP1864_CYCLES_DMA_START)); cdp1864->disp = 0; cdp1864->dmaout = 0; diff --git a/src/emu/sound/cdp1869.c b/src/emu/sound/cdp1869.c index cd3952d6604..f003bed0791 100644 --- a/src/emu/sound/cdp1869.c +++ b/src/emu/sound/cdp1869.c @@ -101,7 +101,7 @@ device_config *cdp1869_device_config::static_alloc_device_config(const machine_c device_t *cdp1869_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, cdp1869_device(machine, *this)); + return auto_alloc(machine, cdp1869_device(machine, *this)); } @@ -496,7 +496,7 @@ void cdp1869_device::initialize_palette() for (i = 0; i < 8; i++) { - palette_set_color(machine, i, get_rgb(i, i, 15)); + palette_set_color(m_machine, i, get_rgb(i, i, 15)); } // tone-on-tone display (CFC=1) @@ -504,7 +504,7 @@ void cdp1869_device::initialize_palette() { for (int l = 0; l < 8; l++) { - palette_set_color(machine, i, get_rgb(i, c, l)); + palette_set_color(m_machine, i, get_rgb(i, c, l)); i++; } } diff --git a/src/emu/sound/cem3394.c b/src/emu/sound/cem3394.c index e703910374c..b15c2887312 100644 --- a/src/emu/sound/cem3394.c +++ b/src/emu/sound/cem3394.c @@ -334,14 +334,14 @@ static DEVICE_START( cem3394 ) chip->inv_sample_rate = 1.0 / (double)chip->sample_rate; /* allocate stream channels, 1 per chip */ - chip->stream = device->machine->sound().stream_alloc(*device, 0, 1, chip->sample_rate, chip, cem3394_update); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 1, chip->sample_rate, chip, cem3394_update); chip->external = intf->external; chip->vco_zero_freq = intf->vco_zero_freq; chip->filter_zero_freq = intf->filter_zero_freq; /* allocate memory for a mixer buffer and external buffer (1 second should do it!) */ - chip->mixer_buffer = auto_alloc_array(device->machine, INT16, chip->sample_rate); - chip->external_buffer = auto_alloc_array(device->machine, INT16, chip->sample_rate); + chip->mixer_buffer = auto_alloc_array(device->machine(), INT16, chip->sample_rate); + chip->external_buffer = auto_alloc_array(device->machine(), INT16, chip->sample_rate); device->save_item(NAME(chip->values)); device->save_item(NAME(chip->wave_select)); diff --git a/src/emu/sound/dac.c b/src/emu/sound/dac.c index 4a600718d16..57b5171cc22 100644 --- a/src/emu/sound/dac.c +++ b/src/emu/sound/dac.c @@ -110,7 +110,7 @@ static DEVICE_START( dac ) DAC_build_voltable(info); - info->channel = device->machine->sound().stream_alloc(*device,0,1,device->clock() ? device->clock() : DEFAULT_SAMPLE_RATE,info,DAC_update); + info->channel = device->machine().sound().stream_alloc(*device,0,1,device->clock() ? device->clock() : DEFAULT_SAMPLE_RATE,info,DAC_update); info->output = 0; device->save_item(NAME(info->output)); diff --git a/src/emu/sound/digitalk.c b/src/emu/sound/digitalk.c index 5fbb1cbf5f0..48410c38df7 100644 --- a/src/emu/sound/digitalk.c +++ b/src/emu/sound/digitalk.c @@ -648,8 +648,8 @@ static DEVICE_START(digitalker) { digitalker *dg = get_safe_token(device); dg->device = device; - dg->rom = device->machine->region(device->tag())->base(); - dg->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock()/4, dg, digitalker_update); + dg->rom = device->machine().region(device->tag())->base(); + dg->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock()/4, dg, digitalker_update); dg->dac_index = 128; dg->data = 0xff; dg->cs = dg->cms = dg->wr = 1; diff --git a/src/emu/sound/disc_inp.c b/src/emu/sound/disc_inp.c index 53331138932..d2e09bcd7e0 100644 --- a/src/emu/sound/disc_inp.c +++ b/src/emu/sound/disc_inp.c @@ -23,14 +23,14 @@ READ8_DEVICE_HANDLER(discrete_sound_r) { discrete_device *disc_device = downcast<discrete_device *>(device); - return disc_device->read( *disc_device->machine->firstcpu->space(), offset, 0xff); + return disc_device->read( *disc_device->machine().firstcpu->space(), offset, 0xff); } WRITE8_DEVICE_HANDLER(discrete_sound_w) { discrete_device *disc_device = downcast<discrete_device *>(device); - disc_device->write(*disc_device->machine->firstcpu->space(), offset, data, 0xff); + disc_device->write(*disc_device->machine().firstcpu->space(), offset, data, 0xff); } /************************************************************************ @@ -75,7 +75,7 @@ DISCRETE_RESET(dss_adjustment) { double min, max; - m_port = m_device->machine->m_portlist.find((const char *)this->custom_data()); + m_port = m_device->machine().m_portlist.find((const char *)this->custom_data()); if (m_port == NULL) fatalerror("DISCRETE_ADJUSTMENT - NODE_%d has invalid tag", this->index()); @@ -334,7 +334,7 @@ void DISCRETE_CLASS_NAME(dss_input_stream)::stream_start(void) discrete_sound_device *snd_device = downcast<discrete_sound_device *>(m_device); //assert(DSS_INPUT_STREAM__STREAM < snd_device->m_input_stream_list.count()); - m_buffer_stream = m_device->machine->sound().stream_alloc(*snd_device, 0, 1, this->sample_rate(), this, static_stream_generate); + m_buffer_stream = m_device->machine().sound().stream_alloc(*snd_device, 0, 1, this->sample_rate(), this, static_stream_generate); snd_device->get_stream()->set_input(m_stream_in_number, m_buffer_stream); } diff --git a/src/emu/sound/disc_wav.c b/src/emu/sound/disc_wav.c index c3d46dad81e..1e4109d52ff 100644 --- a/src/emu/sound/disc_wav.c +++ b/src/emu/sound/disc_wav.c @@ -452,7 +452,7 @@ DISCRETE_STEP(dss_noise) if(m_phase > (2.0 * M_PI)) { /* GCC's rand returns a RAND_MAX value of 0x7fff */ - int newval = (m_device->machine->rand() & 0x7fff) - 16384; + int newval = (m_device->machine().rand() & 0x7fff) - 16384; /* make sure the peak to peak values are the amplitude */ v_out = DSS_NOISE__AMP / 2; diff --git a/src/emu/sound/discrete.c b/src/emu/sound/discrete.c index 75b5671db11..b2bb8036238 100644 --- a/src/emu/sound/discrete.c +++ b/src/emu/sound/discrete.c @@ -314,7 +314,7 @@ void discrete_task::check(discrete_task *dest_task) { output_buffer buf; - buf.node_buf = auto_alloc_array(m_device.machine, double, + buf.node_buf = auto_alloc_array(m_device.machine(), double, ((task_node->sample_rate() + sound_manager::STREAMS_UPDATE_FREQUENCY) / sound_manager::STREAMS_UPDATE_FREQUENCY)); buf.ptr = buf.node_buf; buf.source = dest_node->m_input[inputnum]; @@ -326,7 +326,7 @@ void discrete_task::check(discrete_task *dest_task) m_device.discrete_log("dso_task_start - buffering %d(%d) in task %p group %d referenced by %d group %d", NODE_INDEX(inputnode_num), NODE_CHILD_NODE_NUM(inputnode_num), this, task_group, dest_node->index(), dest_task->task_group); /* register into source list */ - //source = auto_alloc(device->machine, discrete_source_node); + //source = auto_alloc(device->machine(), discrete_source_node); //source.task = this; //source.output_node = i; source.linked_outbuf = pbuf; @@ -688,7 +688,7 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list) /* make sure we have one simple task * No need to create a node since there are no dependencies. */ - task = auto_alloc_clear(machine, discrete_task(*this)); + task = auto_alloc_clear(m_machine, discrete_task(*this)); task_list.add(task); } @@ -722,7 +722,7 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list) { if (task != NULL) fatalerror("init_nodes() - Nested DISCRETE_START_TASK."); - task = auto_alloc_clear(machine, discrete_task(*this)); + task = auto_alloc_clear(m_machine, discrete_task(*this)); task->task_group = block->initial[0]; if (task->task_group < 0 || task->task_group >= DISCRETE_MAX_TASK_GROUPS) fatalerror("discrete_dso_task: illegal task_group %d", task->task_group); @@ -861,12 +861,12 @@ device_config *discrete_sound_device_config::static_alloc_device_config(const ma device_t *discrete_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, discrete_device(machine, *this)); + return auto_alloc(machine, discrete_device(machine, *this)); } device_t *discrete_sound_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, discrete_sound_device(machine, *this)); + return auto_alloc(machine, discrete_sound_device(machine, *this)); } @@ -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; @@ -958,7 +958,7 @@ void discrete_device::device_start() m_node_list.clear(); /* allocate memory to hold pointers to nodes by index */ - m_indexed_node = auto_alloc_array_clear(this->machine, discrete_base_node *, DISCRETE_MAX_NODES); + m_indexed_node = auto_alloc_array_clear(this->machine(), discrete_base_node *, DISCRETE_MAX_NODES); /* initialize the node data */ init_nodes(block_list); diff --git a/src/emu/sound/discrete.h b/src/emu/sound/discrete.h index 9174c9753a9..731bdef93e9 100644 --- a/src/emu/sound/discrete.h +++ b/src/emu/sound/discrete.h @@ -4563,7 +4563,7 @@ class discrete_node_factory : public discrete_node_base_factory template <class C> discrete_base_node * discrete_node_factory<C>::Create(discrete_device * pdev, const discrete_block *block) { - discrete_base_node *r = auto_alloc_clear(pdev->machine, C); + discrete_base_node *r = auto_alloc_clear(pdev->machine(), C); r->init(pdev, block); return r; diff --git a/src/emu/sound/dmadac.c b/src/emu/sound/dmadac.c index 470604834e2..9a8d6613235 100644 --- a/src/emu/sound/dmadac.c +++ b/src/emu/sound/dmadac.c @@ -106,13 +106,13 @@ static DEVICE_START( dmadac ) dmadac_state *info = get_safe_token(device); /* allocate a clear a buffer */ - info->buffer = auto_alloc_array_clear(device->machine, INT16, BUFFER_SIZE); + info->buffer = auto_alloc_array_clear(device->machine(), INT16, BUFFER_SIZE); /* reset the state */ info->volume = 0x100; /* allocate a stream channel */ - info->channel = device->machine->sound().stream_alloc(*device, 0, 1, DEFAULT_SAMPLE_RATE, info, dmadac_update); + info->channel = device->machine().sound().stream_alloc(*device, 0, 1, DEFAULT_SAMPLE_RATE, info, dmadac_update); /* register with the save state system */ device->save_item(NAME(info->bufin)); diff --git a/src/emu/sound/es5503.c b/src/emu/sound/es5503.c index f0e4f58a028..23fc862b099 100644 --- a/src/emu/sound/es5503.c +++ b/src/emu/sound/es5503.c @@ -259,14 +259,14 @@ static DEVICE_START( es5503 ) chip->oscillators[osc].irqpend = 0; chip->oscillators[osc].accumulator = 0; - chip->oscillators[osc].timer = device->machine->scheduler().timer_alloc(FUNC(es5503_timer_cb), &chip->oscillators[osc]); + chip->oscillators[osc].timer = device->machine().scheduler().timer_alloc(FUNC(es5503_timer_cb), &chip->oscillators[osc]); chip->oscillators[osc].chip = (void *)chip; } chip->oscsenabled = 1; chip->output_rate = (device->clock()/8)/34; // (input clock / 8) / # of oscs. enabled + 2 - chip->stream = device->machine->sound().stream_alloc(*device, 0, 2, chip->output_rate, chip, es5503_pcm_update); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, chip->output_rate, chip, es5503_pcm_update); } READ8_DEVICE_HANDLER( es5503_r ) diff --git a/src/emu/sound/es5506.c b/src/emu/sound/es5506.c index f6e8572fbd2..2f25bd7ead4 100644 --- a/src/emu/sound/es5506.c +++ b/src/emu/sound/es5506.c @@ -261,7 +261,7 @@ static void compute_tables(es5506_state *chip) int i; /* allocate ulaw lookup table */ - chip->ulaw_lookup = auto_alloc_array(chip->device->machine, INT16, 1 << ULAW_MAXBITS); + chip->ulaw_lookup = auto_alloc_array(chip->device->machine(), INT16, 1 << ULAW_MAXBITS); /* generate ulaw lookup table */ for (i = 0; i < (1 << ULAW_MAXBITS); i++) @@ -280,7 +280,7 @@ static void compute_tables(es5506_state *chip) } /* allocate volume lookup table */ - chip->volume_lookup = auto_alloc_array(chip->device->machine, UINT16, 4096); + chip->volume_lookup = auto_alloc_array(chip->device->machine(), UINT16, 4096); /* generate volume lookup table */ for (i = 0; i < 4096; i++) @@ -910,13 +910,13 @@ static void es5506_start_common(device_t *device, const void *config, device_typ eslog = fopen("es.log", "w"); /* create the stream */ - chip->stream = device->machine->sound().stream_alloc(*device, 0, 2, device->clock() / (16*32), chip, es5506_update); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock() / (16*32), chip, es5506_update); /* initialize the regions */ - chip->region_base[0] = intf->region0 ? (UINT16 *)device->machine->region(intf->region0)->base() : NULL; - chip->region_base[1] = intf->region1 ? (UINT16 *)device->machine->region(intf->region1)->base() : NULL; - chip->region_base[2] = intf->region2 ? (UINT16 *)device->machine->region(intf->region2)->base() : NULL; - chip->region_base[3] = intf->region3 ? (UINT16 *)device->machine->region(intf->region3)->base() : NULL; + chip->region_base[0] = intf->region0 ? (UINT16 *)device->machine().region(intf->region0)->base() : NULL; + chip->region_base[1] = intf->region1 ? (UINT16 *)device->machine().region(intf->region1)->base() : NULL; + chip->region_base[2] = intf->region2 ? (UINT16 *)device->machine().region(intf->region2)->base() : NULL; + chip->region_base[3] = intf->region3 ? (UINT16 *)device->machine().region(intf->region3)->base() : NULL; /* initialize the rest of the structure */ chip->device = device; @@ -940,7 +940,7 @@ static void es5506_start_common(device_t *device, const void *config, device_typ } /* allocate memory */ - chip->scratch = auto_alloc_array(device->machine, INT32, 2 * MAX_SAMPLE_CHUNK); + chip->scratch = auto_alloc_array(device->machine(), INT32, 2 * MAX_SAMPLE_CHUNK); /* register save */ device->save_item(NAME(chip->sample_rate)); @@ -1596,7 +1596,7 @@ static DEVICE_RESET( es5505 ) INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t offset, UINT16 data, UINT16 mem_mask) { - running_machine *machine = chip->device->machine; + running_machine &machine = chip->device->machine(); switch (offset) { @@ -1619,7 +1619,7 @@ INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t } if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", machine->describe_context(), chip->current_page & 0x1f, voice->control, data, mem_mask ^ 0xffff); + fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", machine.describe_context(), chip->current_page & 0x1f, voice->control, data, mem_mask ^ 0xffff); break; case 0x01: /* FC */ @@ -1628,7 +1628,7 @@ INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t if (ACCESSING_BITS_8_15) voice->freqcount = (voice->freqcount & ~0x1fe00) | ((data & 0xff00) << 1); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, freq count=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->freqcount); + fprintf(eslog, "%s:voice %d, freq count=%08x\n", machine.describe_context(), chip->current_page & 0x1f, voice->freqcount); break; case 0x02: /* STRT (hi) */ @@ -1637,7 +1637,7 @@ INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t if (ACCESSING_BITS_8_15) voice->start = (voice->start & ~0x7c000000) | ((data & 0x1f00) << 18); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, loop start=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->start); + fprintf(eslog, "%s:voice %d, loop start=%08x\n", machine.describe_context(), chip->current_page & 0x1f, voice->start); break; case 0x03: /* STRT (lo) */ @@ -1646,7 +1646,7 @@ INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t if (ACCESSING_BITS_8_15) voice->start = (voice->start & ~0x0003fc00) | ((data & 0xff00) << 2); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, loop start=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->start); + fprintf(eslog, "%s:voice %d, loop start=%08x\n", machine.describe_context(), chip->current_page & 0x1f, voice->start); break; case 0x04: /* END (hi) */ @@ -1658,7 +1658,7 @@ INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t voice->control |= CONTROL_STOP0; #endif if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, loop end=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->end); + fprintf(eslog, "%s:voice %d, loop end=%08x\n", machine.describe_context(), chip->current_page & 0x1f, voice->end); break; case 0x05: /* END (lo) */ @@ -1670,7 +1670,7 @@ INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t voice->control |= CONTROL_STOP0; #endif if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, loop end=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->end); + fprintf(eslog, "%s:voice %d, loop end=%08x\n", machine.describe_context(), chip->current_page & 0x1f, voice->end); break; case 0x06: /* K2 */ @@ -1679,7 +1679,7 @@ INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t if (ACCESSING_BITS_8_15) voice->k2 = (voice->k2 & ~0xff00) | (data & 0xff00); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, K2=%04x\n", machine->describe_context(), chip->current_page & 0x1f, voice->k2); + fprintf(eslog, "%s:voice %d, K2=%04x\n", machine.describe_context(), chip->current_page & 0x1f, voice->k2); break; case 0x07: /* K1 */ @@ -1688,21 +1688,21 @@ INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t if (ACCESSING_BITS_8_15) voice->k1 = (voice->k1 & ~0xff00) | (data & 0xff00); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, K1=%04x\n", machine->describe_context(), chip->current_page & 0x1f, voice->k1); + fprintf(eslog, "%s:voice %d, K1=%04x\n", machine.describe_context(), chip->current_page & 0x1f, voice->k1); break; case 0x08: /* LVOL */ if (ACCESSING_BITS_8_15) voice->lvol = (voice->lvol & ~0xff00) | (data & 0xff00); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, left vol=%04x\n", machine->describe_context(), chip->current_page & 0x1f, voice->lvol); + fprintf(eslog, "%s:voice %d, left vol=%04x\n", machine.describe_context(), chip->current_page & 0x1f, voice->lvol); break; case 0x09: /* RVOL */ if (ACCESSING_BITS_8_15) voice->rvol = (voice->rvol & ~0xff00) | (data & 0xff00); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, right vol=%04x\n", machine->describe_context(), chip->current_page & 0x1f, voice->rvol); + fprintf(eslog, "%s:voice %d, right vol=%04x\n", machine.describe_context(), chip->current_page & 0x1f, voice->rvol); break; case 0x0a: /* ACC (hi) */ @@ -1711,7 +1711,7 @@ INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t if (ACCESSING_BITS_8_15) voice->accum = (voice->accum & ~0x7c000000) | ((data & 0x1f00) << 18); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, accum=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->accum); + fprintf(eslog, "%s:voice %d, accum=%08x\n", machine.describe_context(), chip->current_page & 0x1f, voice->accum); break; case 0x0b: /* ACC (lo) */ @@ -1720,7 +1720,7 @@ INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t if (ACCESSING_BITS_8_15) voice->accum = (voice->accum & ~0x0003fc00) | ((data & 0xff00) << 2); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, accum=%08x\n", machine->describe_context(), chip->current_page & 0x1f, voice->accum); + fprintf(eslog, "%s:voice %d, accum=%08x\n", machine.describe_context(), chip->current_page & 0x1f, voice->accum); break; case 0x0c: /* unused */ @@ -1751,7 +1751,7 @@ INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t INLINE void es5505_reg_write_high(es5506_state *chip, es5506_voice *voice, offs_t offset, UINT16 data, UINT16 mem_mask) { - running_machine *machine = chip->device->machine; + running_machine &machine = chip->device->machine(); switch (offset) { @@ -1769,7 +1769,7 @@ INLINE void es5505_reg_write_high(es5506_state *chip, es5506_voice *voice, offs_ ((data << 2) & (CONTROL_CA0 | CONTROL_CA1)); } if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", machine->describe_context(), chip->current_page & 0x1f, voice->control, data, mem_mask); + fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", machine.describe_context(), chip->current_page & 0x1f, voice->control, data, mem_mask); break; case 0x01: /* O4(n-1) */ @@ -1778,7 +1778,7 @@ INLINE void es5505_reg_write_high(es5506_state *chip, es5506_voice *voice, offs_ if (ACCESSING_BITS_8_15) voice->o4n1 = (INT16)((voice->o4n1 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, O4(n-1)=%05x\n", machine->describe_context(), chip->current_page & 0x1f, voice->o4n1 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O4(n-1)=%05x\n", machine.describe_context(), chip->current_page & 0x1f, voice->o4n1 & 0x3ffff); break; case 0x02: /* O3(n-1) */ @@ -1787,7 +1787,7 @@ INLINE void es5505_reg_write_high(es5506_state *chip, es5506_voice *voice, offs_ if (ACCESSING_BITS_8_15) voice->o3n1 = (INT16)((voice->o3n1 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, O3(n-1)=%05x\n", machine->describe_context(), chip->current_page & 0x1f, voice->o3n1 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O3(n-1)=%05x\n", machine.describe_context(), chip->current_page & 0x1f, voice->o3n1 & 0x3ffff); break; case 0x03: /* O3(n-2) */ @@ -1796,7 +1796,7 @@ INLINE void es5505_reg_write_high(es5506_state *chip, es5506_voice *voice, offs_ if (ACCESSING_BITS_8_15) voice->o3n2 = (INT16)((voice->o3n2 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, O3(n-2)=%05x\n", machine->describe_context(), chip->current_page & 0x1f, voice->o3n2 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O3(n-2)=%05x\n", machine.describe_context(), chip->current_page & 0x1f, voice->o3n2 & 0x3ffff); break; case 0x04: /* O2(n-1) */ @@ -1805,7 +1805,7 @@ INLINE void es5505_reg_write_high(es5506_state *chip, es5506_voice *voice, offs_ if (ACCESSING_BITS_8_15) voice->o2n1 = (INT16)((voice->o2n1 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, O2(n-1)=%05x\n", machine->describe_context(), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O2(n-1)=%05x\n", machine.describe_context(), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff); break; case 0x05: /* O2(n-2) */ @@ -1814,7 +1814,7 @@ INLINE void es5505_reg_write_high(es5506_state *chip, es5506_voice *voice, offs_ if (ACCESSING_BITS_8_15) voice->o2n2 = (INT16)((voice->o2n2 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, O2(n-2)=%05x\n", machine->describe_context(), chip->current_page & 0x1f, voice->o2n2 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O2(n-2)=%05x\n", machine.describe_context(), chip->current_page & 0x1f, voice->o2n2 & 0x3ffff); break; case 0x06: /* O1(n-1) */ @@ -1823,7 +1823,7 @@ INLINE void es5505_reg_write_high(es5506_state *chip, es5506_voice *voice, offs_ if (ACCESSING_BITS_8_15) voice->o1n1 = (INT16)((voice->o1n1 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%s:voice %d, O1(n-1)=%05x (accum=%08x)\n", machine->describe_context(), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff, voice->accum); + fprintf(eslog, "%s:voice %d, O1(n-1)=%05x (accum=%08x)\n", machine.describe_context(), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff, voice->accum); break; case 0x07: @@ -1906,7 +1906,7 @@ WRITE16_DEVICE_HANDLER( es5505_w ) es5506_state *chip = get_safe_token(device); es5506_voice *voice = &chip->voice[chip->current_page & 0x1f]; -// logerror("%s:ES5505 write %02x/%02x = %04x & %04x\n", machine->describe_context(), chip->current_page, offset, data, mem_mask); +// logerror("%s:ES5505 write %02x/%02x = %04x & %04x\n", machine.describe_context(), chip->current_page, offset, data, mem_mask); /* force an update */ chip->stream->update(); diff --git a/src/emu/sound/es8712.c b/src/emu/sound/es8712.c index 4615b5dc026..8cae3700798 100644 --- a/src/emu/sound/es8712.c +++ b/src/emu/sound/es8712.c @@ -227,7 +227,7 @@ static DEVICE_START( es8712 ) chip->region_base = *device->region(); /* generate the name and create the stream */ - chip->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock(), chip, es8712_update); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock(), chip, es8712_update); /* initialize the rest of the structure */ chip->signal = -2; diff --git a/src/emu/sound/filter.c b/src/emu/sound/filter.c index 5aa7582fdad..43acebde248 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 9f004c08cbc..ab831c234ed 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 2e057223f8e..27b354be948 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/fm.c b/src/emu/sound/fm.c index 256a6a595a8..8027883618c 100644 --- a/src/emu/sound/fm.c +++ b/src/emu/sound/fm.c @@ -841,7 +841,7 @@ INLINE UINT8 FM_STATUS_FLAG(FM_ST *ST) { if( COMPARE_TIMES(ST->busy_expiry_time, UNDEFINED_TIME) != 0 ) { - if (COMPARE_TIMES(ST->busy_expiry_time, FM_GET_TIME_NOW(ST->device->machine)) > 0) + if (COMPARE_TIMES(ST->busy_expiry_time, FM_GET_TIME_NOW(&ST->device->machine())) > 0) return ST->status | 0x80; /* with busy */ /* expire */ FM_BUSY_CLEAR(ST); @@ -851,7 +851,7 @@ INLINE UINT8 FM_STATUS_FLAG(FM_ST *ST) INLINE void FM_BUSY_SET(FM_ST *ST,int busyclock ) { TIME_TYPE expiry_period = MULTIPLY_TIME_BY_INT(attotime::from_hz(ST->clock), busyclock * ST->timer_prescaler); - ST->busy_expiry_time = ADD_TIMES(FM_GET_TIME_NOW(ST->device->machine), expiry_period); + ST->busy_expiry_time = ADD_TIMES(FM_GET_TIME_NOW(&ST->device->machine()), expiry_period); } #else #define FM_STATUS_FLAG(ST) ((ST)->status) @@ -2264,11 +2264,11 @@ void * ym2203_init(void *param, device_t *device, int clock, int rate, YM2203 *F2203; /* allocate ym2203 state space */ - F2203 = auto_alloc_clear(device->machine, YM2203); + F2203 = auto_alloc_clear(device->machine(), YM2203); if( !init_tables() ) { - auto_free( device->machine, F2203 ); + auto_free( device->machine(), F2203 ); return NULL; } @@ -2295,7 +2295,7 @@ void ym2203_shutdown(void *chip) YM2203 *FM2203 = (YM2203 *)chip; FMCloseTable(); - auto_free(FM2203->OPN.ST.device->machine, FM2203); + auto_free(FM2203->OPN.ST.device->machine(), FM2203); } /* YM2203 I/O interface */ @@ -3487,11 +3487,11 @@ void * ym2608_init(void *param, device_t *device, int clock, int rate, YM2608 *F2608; /* allocate extend state space */ - F2608 = auto_alloc_clear(device->machine, YM2608); + F2608 = auto_alloc_clear(device->machine(), YM2608); /* allocate total level table (128kb space) */ if( !init_tables() ) { - auto_free( device->machine, F2608 ); + auto_free( device->machine(), F2608 ); return NULL; } @@ -3539,7 +3539,7 @@ void ym2608_shutdown(void *chip) YM2608 *F2608 = (YM2608 *)chip; FMCloseTable(); - auto_free(F2608->OPN.ST.device->machine, F2608); + auto_free(F2608->OPN.ST.device->machine(), F2608); } /* reset one of chips */ @@ -4170,11 +4170,11 @@ void *ym2610_init(void *param, device_t *device, int clock, int rate, YM2610 *F2610; /* allocate extend state space */ - F2610 = auto_alloc_clear(device->machine, YM2610); + F2610 = auto_alloc_clear(device->machine(), YM2610); /* allocate total level table (128kb space) */ if( !init_tables() ) { - auto_free( device->machine, F2610 ); + auto_free( device->machine(), F2610 ); return NULL; } @@ -4214,7 +4214,7 @@ void ym2610_shutdown(void *chip) YM2610 *F2610 = (YM2610 *)chip; FMCloseTable(); - auto_free(F2610->OPN.ST.device->machine, F2610); + auto_free(F2610->OPN.ST.device->machine(), F2610); } /* reset one of chip */ @@ -4230,17 +4230,17 @@ void ym2610_reset_chip(void *chip) /* setup PCM buffers again */ name.printf("%s",dev->tag()); - F2610->pcmbuf = (const UINT8 *)dev->machine->region(name)->base(); - F2610->pcm_size = dev->machine->region(name)->bytes(); + F2610->pcmbuf = (const UINT8 *)dev->machine().region(name)->base(); + F2610->pcm_size = dev->machine().region(name)->bytes(); name.printf("%s.deltat",dev->tag()); - F2610->deltaT.memory = (UINT8 *)dev->machine->region(name)->base(); + F2610->deltaT.memory = (UINT8 *)dev->machine().region(name)->base(); if(F2610->deltaT.memory == NULL) { F2610->deltaT.memory = (UINT8*)F2610->pcmbuf; F2610->deltaT.memory_size = F2610->pcm_size; } else - F2610->deltaT.memory_size = dev->machine->region(name)->bytes(); + F2610->deltaT.memory_size = dev->machine().region(name)->bytes(); /* Reset Prescaler */ OPNSetPres( OPN, 6*24, 6*24, 4*2); /* OPN 1/6 , SSG 1/4 */ diff --git a/src/emu/sound/fm.h b/src/emu/sound/fm.h index 6a195006fc0..120ca9bdea8 100644 --- a/src/emu/sound/fm.h +++ b/src/emu/sound/fm.h @@ -42,7 +42,7 @@ struct _ssg_callbacks #if FM_BUSY_FLAG_SUPPORT #define TIME_TYPE attotime #define UNDEFINED_TIME attotime::zero -#define FM_GET_TIME_NOW(machine) machine->time() +#define FM_GET_TIME_NOW(machine) (machine)->time() #define ADD_TIMES(t1, t2) ((t1) + (t2)) #define COMPARE_TIMES(t1, t2) (((t1) == (t2)) ? 0 : ((t1) < (t2)) ? -1 : 1) #define MULTIPLY_TIME_BY_INT(t,i) ((t) * (i)) diff --git a/src/emu/sound/fm2612.c b/src/emu/sound/fm2612.c index 7a22e09dcc9..b8002cf1a29 100644 --- a/src/emu/sound/fm2612.c +++ b/src/emu/sound/fm2612.c @@ -1004,7 +1004,7 @@ INLINE UINT8 FM_STATUS_FLAG(FM_ST *ST) { if( COMPARE_TIMES(ST->busy_expiry_time, UNDEFINED_TIME) != 0 ) { - if (COMPARE_TIMES(ST->busy_expiry_time, FM_GET_TIME_NOW(ST->device->machine)) > 0) + if (COMPARE_TIMES(ST->busy_expiry_time, FM_GET_TIME_NOW(&ST->device->machine())) > 0) return ST->status | 0x80; /* with busy */ /* expire */ FM_BUSY_CLEAR(ST); @@ -1014,7 +1014,7 @@ INLINE UINT8 FM_STATUS_FLAG(FM_ST *ST) INLINE void FM_BUSY_SET(FM_ST *ST,int busyclock ) { TIME_TYPE expiry_period = MULTIPLY_TIME_BY_INT(attotime::from_hz(ST->clock), busyclock * ST->timer_prescaler); - ST->busy_expiry_time = ADD_TIMES(FM_GET_TIME_NOW(ST->device->machine), expiry_period); + ST->busy_expiry_time = ADD_TIMES(FM_GET_TIME_NOW(&ST->device->machine()), expiry_period); } #else #define FM_STATUS_FLAG(ST) ((ST)->status) @@ -2369,7 +2369,7 @@ void * ym2612_init(void *param, device_t *device, int clock, int rate, YM2612 *F2612; /* allocate extend state space */ - F2612 = auto_alloc_clear(device->machine, YM2612); + F2612 = auto_alloc_clear(device->machine(), YM2612); /* allocate total level table (128kb space) */ init_tables(); @@ -2397,7 +2397,7 @@ void ym2612_shutdown(void *chip) YM2612 *F2612 = (YM2612 *)chip; FMCloseTable(); - auto_free(F2612->OPN.ST.device->machine, F2612); + auto_free(F2612->OPN.ST.device->machine(), F2612); } /* reset one of chip */ diff --git a/src/emu/sound/fmopl.c b/src/emu/sound/fmopl.c index 7f885bc1119..77e2a03473e 100644 --- a/src/emu/sound/fmopl.c +++ b/src/emu/sound/fmopl.c @@ -1744,7 +1744,7 @@ static int OPL_LockTable(device_t *device) { cymfile = fopen("3812_.cym","wb"); if (cymfile) - device->machine->scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/ + device->machine().scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/ else logerror("Could not create file 3812_.cym\n"); } @@ -1957,7 +1957,7 @@ static void OPL_save_state(FM_OPL *OPL, device_t *device) device->save_item(NAME(OPL->statusmask)); device->save_item(NAME(OPL->mode)); - device->machine->state().register_postload(OPL_postload, OPL); + device->machine().state().register_postload(OPL_postload, OPL); } @@ -1980,7 +1980,7 @@ static FM_OPL *OPLCreate(device_t *device, UINT32 clock, UINT32 rate, int type) #endif /* allocate memory block */ - ptr = (char *)auto_alloc_array_clear(device->machine, UINT8, state_size); + ptr = (char *)auto_alloc_array_clear(device->machine(), UINT8, state_size); OPL = (FM_OPL *)ptr; @@ -2009,7 +2009,7 @@ static FM_OPL *OPLCreate(device_t *device, UINT32 clock, UINT32 rate, int type) static void OPLDestroy(FM_OPL *OPL) { OPL_UnLockTable(); - auto_free(OPL->device->machine, OPL); + auto_free(OPL->device->machine(), OPL); } /* Optional handlers */ diff --git a/src/emu/sound/gaelco.c b/src/emu/sound/gaelco.c index 036590bf837..5823f3248e4 100644 --- a/src/emu/sound/gaelco.c +++ b/src/emu/sound/gaelco.c @@ -195,7 +195,7 @@ READ16_DEVICE_HANDLER( gaelcosnd_r ) { gaelco_sound_state *info = get_safe_token(device); - LOG_READ_WRITES(("%s: (GAE1): read from %04x\n", device->machine->describe_context(), offset)); + LOG_READ_WRITES(("%s: (GAE1): read from %04x\n", device->machine().describe_context(), offset)); return info->sndregs[offset]; } @@ -209,7 +209,7 @@ WRITE16_DEVICE_HANDLER( gaelcosnd_w ) gaelco_sound_state *info = get_safe_token(device); gaelco_sound_channel *channel = &info->channel[offset >> 3]; - LOG_READ_WRITES(("%s: (GAE1): write %04x to %04x\n", device->machine->describe_context(), data, offset)); + LOG_READ_WRITES(("%s: (GAE1): write %04x to %04x\n", device->machine().describe_context(), data, offset)); /* first update the stream to this point in time */ info->stream->update(); @@ -259,8 +259,8 @@ static DEVICE_START( gaelco ) for (j = 0; j < 4; j++){ info->banks[j] = intf->banks[j]; } - info->stream = device->machine->sound().stream_alloc(*device, 0, 2, 8000, info, gaelco_update); - info->snd_data = (UINT8 *)device->machine->region(intf->gfxregion)->base(); + info->stream = device->machine().sound().stream_alloc(*device, 0, 2, 8000, info, gaelco_update); + info->snd_data = (UINT8 *)device->machine().region(intf->gfxregion)->base(); if (info->snd_data == NULL) info->snd_data = *device->region(); diff --git a/src/emu/sound/hc55516.c b/src/emu/sound/hc55516.c index c10f765a3c6..58d4d862886 100644 --- a/src/emu/sound/hc55516.c +++ b/src/emu/sound/hc55516.c @@ -76,7 +76,7 @@ static void start_common(device_t *device, UINT8 _shiftreg_mask, int _active_clo chip->last_clock_state = 0; /* create the stream */ - chip->channel = device->machine->sound().stream_alloc(*device, 0, 1, SAMPLE_RATE, chip, hc55516_update); + chip->channel = device->machine().sound().stream_alloc(*device, 0, 1, SAMPLE_RATE, chip, hc55516_update); device->save_item(NAME(chip->last_clock_state)); device->save_item(NAME(chip->digit)); diff --git a/src/emu/sound/ics2115.c b/src/emu/sound/ics2115.c index 0a15dae9b6d..02fe11b9eca 100644 --- a/src/emu/sound/ics2115.c +++ b/src/emu/sound/ics2115.c @@ -33,7 +33,7 @@ device_config *ics2115_device_config::static_alloc_device_config(const machine_c device_t *ics2115_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, ics2115_device(machine, *this)); + return auto_alloc(machine, ics2115_device(machine, *this)); } ics2115_device::ics2115_device(running_machine &machine, const ics2115_device_config &config) @@ -47,8 +47,8 @@ ics2115_device::ics2115_device(running_machine &machine, const ics2115_device_co void ics2115_device::device_start() { m_rom = *region(); - m_timer[0].timer = machine->scheduler().timer_alloc(FUNC(timer_cb_0), this); - m_timer[1].timer = machine->scheduler().timer_alloc(FUNC(timer_cb_1), this); + m_timer[0].timer = m_machine.scheduler().timer_alloc(FUNC(timer_cb_0), this); + m_timer[1].timer = m_machine.scheduler().timer_alloc(FUNC(timer_cb_1), this); m_stream = m_machine.sound().stream_alloc(*this, 0, 2, 33075); //Exact formula as per patent 5809466 diff --git a/src/emu/sound/iremga20.c b/src/emu/sound/iremga20.c index cb8aa2cc451..a92e6870fca 100644 --- a/src/emu/sound/iremga20.c +++ b/src/emu/sound/iremga20.c @@ -247,7 +247,7 @@ static DEVICE_START( iremga20 ) for ( i = 0; i < 0x40; i++ ) chip->regs[i] = 0; - chip->stream = device->machine->sound().stream_alloc( *device, 0, 2, device->clock()/4, chip, IremGA20_update ); + chip->stream = device->machine().sound().stream_alloc( *device, 0, 2, device->clock()/4, chip, IremGA20_update ); device->save_item(NAME(chip->regs)); for (i = 0; i < 4; i++) diff --git a/src/emu/sound/k005289.c b/src/emu/sound/k005289.c index a33ce5c7e98..d8c14c66998 100644 --- a/src/emu/sound/k005289.c +++ b/src/emu/sound/k005289.c @@ -68,7 +68,7 @@ INLINE k005289_state *get_safe_token(device_t *device) } /* build a table to divide by the number of voices */ -static void make_mixer_table(running_machine *machine, k005289_state *info, int voices) +static void make_mixer_table(running_machine &machine, k005289_state *info, int voices) { int count = voices * 128; int i; @@ -164,14 +164,14 @@ static DEVICE_START( k005289 ) /* get stream channels */ info->rate = device->clock()/16; - info->stream = device->machine->sound().stream_alloc(*device, 0, 1, info->rate, info, K005289_update); + info->stream = device->machine().sound().stream_alloc(*device, 0, 1, info->rate, info, K005289_update); info->mclock = device->clock(); /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */ - info->mixer_buffer = auto_alloc_array(device->machine, short, 2 * info->rate); + info->mixer_buffer = auto_alloc_array(device->machine(), short, 2 * info->rate); /* build the mixer table */ - make_mixer_table(device->machine, info, 2); + make_mixer_table(device->machine(), info, 2); info->sound_prom = *device->region(); diff --git a/src/emu/sound/k007232.c b/src/emu/sound/k007232.c index f763342dabd..8a5de7ee2b4 100644 --- a/src/emu/sound/k007232.c +++ b/src/emu/sound/k007232.c @@ -328,7 +328,7 @@ static DEVICE_START( k007232 ) for( i = 0; i < 0x10; i++ ) info->wreg[i] = 0; - info->stream = device->machine->sound().stream_alloc(*device,0,2,device->clock()/128,info,KDAC_A_update); + info->stream = device->machine().sound().stream_alloc(*device,0,2,device->clock()/128,info,KDAC_A_update); KDAC_A_make_fncode(info); } diff --git a/src/emu/sound/k051649.c b/src/emu/sound/k051649.c index 9a9d60cd71c..361d565c615 100644 --- a/src/emu/sound/k051649.c +++ b/src/emu/sound/k051649.c @@ -62,7 +62,7 @@ INLINE k051649_state *get_safe_token(device_t *device) } /* build a table to divide by the number of voices */ -static void make_mixer_table(running_machine *machine, k051649_state *info, int voices) +static void make_mixer_table(running_machine &machine, k051649_state *info, int voices) { int count = voices * 256; int i; @@ -138,14 +138,14 @@ static DEVICE_START( k051649 ) /* get stream channels */ info->rate = device->clock()/16; - info->stream = device->machine->sound().stream_alloc(*device, 0, 1, info->rate, info, k051649_update); + info->stream = device->machine().sound().stream_alloc(*device, 0, 1, info->rate, info, k051649_update); info->mclock = device->clock(); /* allocate a buffer to mix into - 1 second's worth should be more than enough */ - info->mixer_buffer = auto_alloc_array(device->machine, short, 2 * info->rate); + info->mixer_buffer = auto_alloc_array(device->machine(), short, 2 * info->rate); /* build the mixer table */ - make_mixer_table(device->machine, info, 5); + make_mixer_table(device->machine(), info, 5); } static DEVICE_RESET( k051649 ) diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c index 068e026159e..e694bec5dc7 100644 --- a/src/emu/sound/k053260.c +++ b/src/emu/sound/k053260.c @@ -221,7 +221,7 @@ static DEVICE_START( k053260 ) ic->mode = 0; - const memory_region *region = (ic->intf->rgnoverride != NULL) ? device->machine->region(ic->intf->rgnoverride) : device->region(); + const memory_region *region = (ic->intf->rgnoverride != NULL) ? device->machine().region(ic->intf->rgnoverride) : device->region(); ic->rom = *region; ic->rom_size = region->bytes(); @@ -231,9 +231,9 @@ static DEVICE_START( k053260 ) for ( i = 0; i < 0x30; i++ ) ic->regs[i] = 0; - ic->delta_table = auto_alloc_array( device->machine, UINT32, 0x1000 ); + ic->delta_table = auto_alloc_array( device->machine(), UINT32, 0x1000 ); - ic->channel = device->machine->sound().stream_alloc( *device, 0, 2, rate, ic, k053260_update ); + ic->channel = device->machine().sound().stream_alloc( *device, 0, 2, rate, ic, k053260_update ); InitDeltaTable( ic, rate, device->clock() ); @@ -258,7 +258,7 @@ static DEVICE_START( k053260 ) /* setup SH1 timer if necessary */ if ( ic->intf->irq ) - device->machine->scheduler().timer_pulse( attotime::from_hz(device->clock()) * 32, FUNC(ic->intf->irq )); + device->machine().scheduler().timer_pulse( attotime::from_hz(device->clock()) * 32, FUNC(ic->intf->irq )); } INLINE void check_bounds( k053260_state *ic, int channel ) @@ -424,7 +424,7 @@ READ8_DEVICE_HANDLER( k053260_r ) ic->channels[0].pos += ( 1 << 16 ); if ( offs > ic->rom_size ) { - logerror("%s: K53260: Attempting to read past ROM size in ROM Read Mode (offs = %06x, size = %06x).\n", device->machine->describe_context(),offs,ic->rom_size ); + logerror("%s: K53260: Attempting to read past ROM size in ROM Read Mode (offs = %06x, size = %06x).\n", device->machine().describe_context(),offs,ic->rom_size ); return 0; } diff --git a/src/emu/sound/k054539.c b/src/emu/sound/k054539.c index 00d44b5cdb1..638d7b62007 100644 --- a/src/emu/sound/k054539.c +++ b/src/emu/sound/k054539.c @@ -384,7 +384,7 @@ else double gc_f0; int gc_i, gc_j, gc_k, gc_l; - if (input_code_pressed_once(device->machine, KEYCODE_DEL_PAD)) + if (input_code_pressed_once(device->machine(), KEYCODE_DEL_PAD)) { gc_active ^= 1; if (!gc_active) popmessage(NULL); @@ -392,23 +392,23 @@ else if (gc_active) { - if (input_code_pressed_once(device->machine, KEYCODE_0_PAD)) gc_chip ^= 1; + if (input_code_pressed_once(device->machine(), KEYCODE_0_PAD)) gc_chip ^= 1; gc_i = gc_pos[gc_chip]; gc_j = 0; - if (input_code_pressed_once(device->machine, KEYCODE_4_PAD)) { gc_i--; gc_j = 1; } - if (input_code_pressed_once(device->machine, KEYCODE_6_PAD)) { gc_i++; gc_j = 1; } + if (input_code_pressed_once(device->machine(), KEYCODE_4_PAD)) { gc_i--; gc_j = 1; } + if (input_code_pressed_once(device->machine(), KEYCODE_6_PAD)) { gc_i++; gc_j = 1; } if (gc_j) { gc_i &= 7; gc_pos[gc_chip] = gc_i; } - if (input_code_pressed_once(device->machine, KEYCODE_5_PAD)) + if (input_code_pressed_once(device->machine(), KEYCODE_5_PAD)) info->k054539_gain[gc_i] = 1.0; else { gc_fptr = &info->k054539_gain[gc_i]; gc_f0 = *gc_fptr; gc_j = 0; - if (input_code_pressed_once(device->machine, KEYCODE_2_PAD)) { gc_f0 -= 0.1; gc_j = 1; } - if (input_code_pressed_once(device->machine, KEYCODE_8_PAD)) { gc_f0 += 0.1; gc_j = 1; } + if (input_code_pressed_once(device->machine(), KEYCODE_2_PAD)) { gc_f0 -= 0.1; gc_j = 1; } + if (input_code_pressed_once(device->machine(), KEYCODE_8_PAD)) { gc_f0 += 0.1; gc_j = 1; } if (gc_j) { if (gc_f0 < 0) gc_f0 = 0; *gc_fptr = gc_f0; } } @@ -451,12 +451,12 @@ static void k054539_init_chip(device_t *device, k054539_state *info) info->k054539_flags |= K054539_UPDATE_AT_KEYON; //* make it default until proven otherwise // Real size of 0x4000, the addon is to simplify the reverb buffer computations - info->ram = auto_alloc_array(device->machine, unsigned char, 0x4000*2+device->clock()/50*2); + info->ram = auto_alloc_array(device->machine(), unsigned char, 0x4000*2+device->clock()/50*2); info->reverb_pos = 0; info->cur_ptr = 0; memset(info->ram, 0, 0x4000*2+device->clock()/50*2); - const memory_region *region = (info->intf->rgnoverride != NULL) ? device->machine->region(info->intf->rgnoverride) : device->region(); + const memory_region *region = (info->intf->rgnoverride != NULL) ? device->machine().region(info->intf->rgnoverride) : device->region(); info->rom = *region; info->rom_size = region->bytes(); info->rom_mask = 0xffffffffU; @@ -470,9 +470,9 @@ static void k054539_init_chip(device_t *device, k054539_state *info) // One or more of the registers must be the timer period // And anyway, this particular frequency is probably wrong // 480 hz is TRUSTED by gokuparo disco stage - the looping sample doesn't line up otherwise - device->machine->scheduler().timer_pulse(attotime::from_hz(480), FUNC(k054539_irq), 0, info); + device->machine().scheduler().timer_pulse(attotime::from_hz(480), FUNC(k054539_irq), 0, info); - info->stream = device->machine->sound().stream_alloc(*device, 0, 2, device->clock(), info, k054539_update); + info->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock(), info, k054539_update); device->save_item(NAME(info->regs)); device->save_pointer(NAME(info->ram), 0x4000); @@ -674,7 +674,7 @@ static DEVICE_START( k054539 ) k054539_init_chip(device, info); - device->machine->state().register_postload(reset_zones, info); + device->machine().state().register_postload(reset_zones, info); } diff --git a/src/emu/sound/k056800.c b/src/emu/sound/k056800.c index eb2c671b59d..758303edd11 100644 --- a/src/emu/sound/k056800.c +++ b/src/emu/sound/k056800.c @@ -61,7 +61,7 @@ static void k056800_host_reg_w( device_t *device, int reg, UINT8 data ) k056800->sound_reg[reg] = data; if (reg == 7) - k056800->irq_cb(device->machine, 1); + k056800->irq_cb(device->machine(), 1); } static UINT8 k056800_sound_reg_r( device_t *device, int reg ) @@ -146,7 +146,7 @@ static DEVICE_START( k056800 ) k056800->irq_cb = intf->irq_cb; - k056800->sound_cpu_timer = device->machine->scheduler().timer_alloc(FUNC(k056800_sound_cpu_timer_tick), k056800); + k056800->sound_cpu_timer = device->machine().scheduler().timer_alloc(FUNC(k056800_sound_cpu_timer_tick), k056800); k056800->sound_cpu_timer->adjust(timer_period, 0, timer_period); device->save_item(NAME(k056800->host_reg)); diff --git a/src/emu/sound/k056800.h b/src/emu/sound/k056800.h index 57c205b61a7..81afa200ae3 100644 --- a/src/emu/sound/k056800.h +++ b/src/emu/sound/k056800.h @@ -14,7 +14,7 @@ TYPE DEFINITIONS ***************************************************************************/ -typedef void (*k056800_irq_cb)(running_machine *, int); +typedef void (*k056800_irq_cb)(running_machine &, int); typedef struct _k056800_interface k056800_interface; diff --git a/src/emu/sound/mas3507d.c b/src/emu/sound/mas3507d.c index c88a3d4e477..77fa947259d 100644 --- a/src/emu/sound/mas3507d.c +++ b/src/emu/sound/mas3507d.c @@ -21,7 +21,7 @@ device_config *mas3507d_device_config::static_alloc_device_config(const machine_ device_t *mas3507d_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, mas3507d_device(machine, *this)); + return auto_alloc(machine, mas3507d_device(machine, *this)); } mas3507d_device::mas3507d_device(running_machine &machine, const mas3507d_device_config &_config) diff --git a/src/emu/sound/mos6560.c b/src/emu/sound/mos6560.c index 471a4ed193d..061fe8a957a 100644 --- a/src/emu/sound/mos6560.c +++ b/src/emu/sound/mos6560.c @@ -145,7 +145,7 @@ INLINE const mos6560_interface *get_interface( device_t *device ) if(VERBOSE_LEVEL >= N) \ { \ if( M ) \ - logerror("%11.6f: %-24s", device->machine->time().as_double(), (char*) M ); \ + logerror("%11.6f: %-24s", device->machine().time().as_double(), (char*) M ); \ logerror A; \ } \ } while (0) @@ -153,9 +153,9 @@ INLINE const mos6560_interface *get_interface( device_t *device ) /* 2008-05 FP: lightpen code needs to read input port from vc20.c */ -#define LIGHTPEN_BUTTON ((mos6560->lightpen_button_cb != NULL) ? mos6560->lightpen_button_cb(device->machine) : 0) -#define LIGHTPEN_X_VALUE ((mos6560->lightpen_x_cb != NULL) ? mos6560->lightpen_x_cb(device->machine) : 0) -#define LIGHTPEN_Y_VALUE ((mos6560->lightpen_y_cb != NULL) ? mos6560->lightpen_y_cb(device->machine) : 0) +#define LIGHTPEN_BUTTON ((mos6560->lightpen_button_cb != NULL) ? mos6560->lightpen_button_cb(device->machine()) : 0) +#define LIGHTPEN_X_VALUE ((mos6560->lightpen_x_cb != NULL) ? mos6560->lightpen_x_cb(device->machine()) : 0) +#define LIGHTPEN_Y_VALUE ((mos6560->lightpen_y_cb != NULL) ? mos6560->lightpen_y_cb(device->machine()) : 0) /* lightpen delivers values from internal counters * they do not start with the visual area or frame area */ @@ -214,7 +214,7 @@ static void mos6560_draw_character( device_t *device, int ybegin, int yend, int for (y = ybegin; y <= yend; y++) { - code = mos6560->dma_read(device->machine, (mos6560->chargenaddr + ch * mos6560->charheight + y) & 0x3fff); + code = mos6560->dma_read(device->machine(), (mos6560->chargenaddr + ch * mos6560->charheight + y) & 0x3fff); *BITMAP_ADDR16(mos6560->bitmap, y + yoff, xoff + 0) = color[code >> 7]; *BITMAP_ADDR16(mos6560->bitmap, y + yoff, xoff + 1) = color[(code >> 6) & 1]; *BITMAP_ADDR16(mos6560->bitmap, y + yoff, xoff + 2) = color[(code >> 5) & 1]; @@ -238,7 +238,7 @@ static void mos6560_draw_character_multi( device_t *device, int ybegin, int yend for (y = ybegin; y <= yend; y++) { - code = mos6560->dma_read(device->machine, (mos6560->chargenaddr + ch * mos6560->charheight + y) & 0x3fff); + code = mos6560->dma_read(device->machine(), (mos6560->chargenaddr + ch * mos6560->charheight + y) & 0x3fff); *BITMAP_ADDR16(mos6560->bitmap, y + yoff, xoff + 0) = *BITMAP_ADDR16(mos6560->bitmap, y + yoff, xoff + 1) = color[code >> 6]; *BITMAP_ADDR16(mos6560->bitmap, y + yoff, xoff + 2) = @@ -298,8 +298,8 @@ static void mos6560_drawlines( device_t *device, int first, int last ) for (xoff = mos6560->xpos; (xoff < mos6560->xpos + mos6560->xsize) && (xoff < mos6560->total_xsize); xoff += 8, offs++) { - ch = mos6560->dma_read(device->machine, (mos6560->videoaddr + offs) & 0x3fff); - attr = (mos6560->dma_read_color(device->machine, (mos6560->videoaddr + offs) & 0x3fff)) & 0xf; + ch = mos6560->dma_read(device->machine(), (mos6560->videoaddr + offs) & 0x3fff); + attr = (mos6560->dma_read_color(device->machine(), (mos6560->videoaddr + offs) & 0x3fff)) & 0xf; if (mos6560->type == MOS6560_ATTACKUFO) { @@ -460,7 +460,7 @@ READ8_DEVICE_HANDLER( mos6560_port_r ) break; case 6: /*lightpen horizontal */ case 7: /*lightpen vertical */ - if (LIGHTPEN_BUTTON && ((device->machine->time().as_double() - mos6560->lightpenreadtime) * MOS656X_VRETRACERATE >= 1)) + if (LIGHTPEN_BUTTON && ((device->machine().time().as_double() - mos6560->lightpenreadtime) * MOS656X_VRETRACERATE >= 1)) { /* only 1 update each frame */ /* and diode must recognize light */ @@ -469,13 +469,13 @@ READ8_DEVICE_HANDLER( mos6560_port_r ) mos6560->reg[6] = MOS656X_X_VALUE; mos6560->reg[7] = MOS656X_Y_VALUE; } - mos6560->lightpenreadtime = device->machine->time().as_double(); + mos6560->lightpenreadtime = device->machine().time().as_double(); } val = mos6560->reg[offset]; break; case 8: /* poti 1 */ case 9: /* poti 2 */ - val = (mos6560->paddle_cb != NULL) ? mos6560->paddle_cb[offset - 8](device->machine) : mos6560->reg[offset]; + val = (mos6560->paddle_cb != NULL) ? mos6560->paddle_cb[offset - 8](device->machine()) : mos6560->reg[offset]; break; default: val = mos6560->reg[offset]; @@ -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,11 +739,11 @@ 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; - mos6560->noise = auto_alloc_array(device->machine, INT8, mos6560->noisesize); + mos6560->noise = auto_alloc_array(device->machine(), INT8, mos6560->noisesize); { int noiseshift = 0x7ffff8; char data; @@ -774,11 +774,11 @@ 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) { - mos6560->tone = auto_alloc_array(device->machine, INT16, mos6560->tonesize); + mos6560->tone = auto_alloc_array(device->machine(), INT16, mos6560->tonesize); for (i = 0; i < mos6560->tonesize; i++) { @@ -802,13 +802,13 @@ static DEVICE_START( mos6560 ) const mos6560_interface *intf = (mos6560_interface *)device->baseconfig().static_config(); int width, height; - mos6560->screen = downcast<screen_device *>(device->machine->device(intf->screen)); + mos6560->screen = downcast<screen_device *>(device->machine().device(intf->screen)); width = mos6560->screen->width(); height = mos6560->screen->height(); mos6560->type = intf->type; - mos6560->bitmap = auto_bitmap_alloc(device->machine, width, height, BITMAP_FORMAT_INDEXED16); + mos6560->bitmap = auto_bitmap_alloc(device->machine(), width, height, BITMAP_FORMAT_INDEXED16); assert(intf->dma_read != NULL); assert(intf->dma_read_color != NULL); diff --git a/src/emu/sound/mos6560.h b/src/emu/sound/mos6560.h index 7d1e873df3b..fc7d406e0d5 100644 --- a/src/emu/sound/mos6560.h +++ b/src/emu/sound/mos6560.h @@ -15,13 +15,13 @@ TYPE DEFINITIONS ***************************************************************************/ -typedef UINT8 (*mos6560_lightpen_x_callback)(running_machine *machine); -typedef UINT8 (*mos6560_lightpen_y_callback)(running_machine *machine); -typedef UINT8 (*mos6560_lightpen_button_callback)(running_machine *machine); -typedef UINT8 (*mos6560_paddle_callback)(running_machine *machine); +typedef UINT8 (*mos6560_lightpen_x_callback)(running_machine &machine); +typedef UINT8 (*mos6560_lightpen_y_callback)(running_machine &machine); +typedef UINT8 (*mos6560_lightpen_button_callback)(running_machine &machine); +typedef UINT8 (*mos6560_paddle_callback)(running_machine &machine); -typedef int (*mos6560_dma_read)(running_machine *machine, int); -typedef int (*mos6560_dma_read_color)(running_machine *machine, int); +typedef int (*mos6560_dma_read)(running_machine &machine, int); +typedef int (*mos6560_dma_read_color)(running_machine &machine, int); typedef enum diff --git a/src/emu/sound/msm5205.c b/src/emu/sound/msm5205.c index cf50d6e442d..3414804e91f 100644 --- a/src/emu/sound/msm5205.c +++ b/src/emu/sound/msm5205.c @@ -187,8 +187,8 @@ static DEVICE_START( msm5205 ) ComputeTables (voice); /* stream system initialize */ - voice->stream = device->machine->sound().stream_alloc(*device,0,1,device->clock(),voice,MSM5205_update); - voice->timer = device->machine->scheduler().timer_alloc(FUNC(MSM5205_vclk_callback), voice); + voice->stream = device->machine().sound().stream_alloc(*device,0,1,device->clock(),voice,MSM5205_update); + voice->timer = device->machine().scheduler().timer_alloc(FUNC(MSM5205_vclk_callback), voice); /* initialize */ DEVICE_RESET_CALL(msm5205); @@ -221,7 +221,7 @@ void msm5205_vclk_w (device_t *device, int vclk) if( voice->vclk != vclk) { voice->vclk = vclk; - if( !vclk ) MSM5205_vclk_callback(voice->device->machine, voice, 0); + if( !vclk ) MSM5205_vclk_callback(voice->device->machine(), voice, 0); } } } diff --git a/src/emu/sound/msm5232.c b/src/emu/sound/msm5232.c index f7bcd3378f9..819eff53b7f 100644 --- a/src/emu/sound/msm5232.c +++ b/src/emu/sound/msm5232.c @@ -796,10 +796,10 @@ static DEVICE_START( msm5232 ) msm5232_init(chip, intf, device->clock(), rate); - chip->stream = device->machine->sound().stream_alloc(*device, 0, 11, rate, chip, MSM5232_update_one); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 11, rate, chip, MSM5232_update_one); /* register with the save state system */ - device->machine->state().register_postload(msm5232_postload, chip); + device->machine().state().register_postload(msm5232_postload, chip); device->save_item(NAME(chip->EN_out16)); device->save_item(NAME(chip->EN_out8)); device->save_item(NAME(chip->EN_out4)); diff --git a/src/emu/sound/multipcm.c b/src/emu/sound/multipcm.c index a0cff9a46a7..43c7a2b3a2f 100644 --- a/src/emu/sound/multipcm.c +++ b/src/emu/sound/multipcm.c @@ -503,7 +503,7 @@ static DEVICE_START( multipcm ) ptChip->ROM=*device->region(); ptChip->Rate=(float) device->clock() / MULTIPCM_CLOCKDIV; - ptChip->stream = device->machine->sound().stream_alloc(*device, 0, 2, ptChip->Rate, ptChip, MultiPCM_update); + ptChip->stream = device->machine().sound().stream_alloc(*device, 0, 2, ptChip->Rate, ptChip, MultiPCM_update); //Volume+pan table for(i=0;i<0x800;++i) diff --git a/src/emu/sound/n63701x.c b/src/emu/sound/n63701x.c index 9c33e396ee2..0c0faae0b1b 100644 --- a/src/emu/sound/n63701x.c +++ b/src/emu/sound/n63701x.c @@ -114,7 +114,7 @@ static DEVICE_START( namco_63701x ) chip->rom = *device->region(); - chip->stream = device->machine->sound().stream_alloc(*device, 0, 2, device->clock()/1000, chip, namco_63701x_update); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock()/1000, chip, namco_63701x_update); } diff --git a/src/emu/sound/namco.c b/src/emu/sound/namco.c index 8d60b93aa2d..eae14998f21 100644 --- a/src/emu/sound/namco.c +++ b/src/emu/sound/namco.c @@ -112,7 +112,7 @@ static void update_namco_waveform(namco_sound *chip, int offset, UINT8 data) /* build the decoded waveform table */ -static void build_decoded_waveform(running_machine *machine, namco_sound *chip, UINT8 *rgnbase) +static void build_decoded_waveform(running_machine &machine, namco_sound *chip, UINT8 *rgnbase) { INT16 *p; int size; @@ -369,7 +369,7 @@ static DEVICE_START( namco ) chip->last_channel = chip->channel_list + chip->num_voices; chip->stereo = intf->stereo; - chip->soundregs = auto_alloc_array_clear(device->machine, UINT8, 0x400); + chip->soundregs = auto_alloc_array_clear(device->machine(), UINT8, 0x400); /* adjust internal clock */ chip->namco_clock = device->clock(); @@ -384,13 +384,13 @@ static DEVICE_START( namco ) logerror("Namco: freq fractional bits = %d: internal freq = %d, output freq = %d\n", chip->f_fracbits, chip->namco_clock, chip->sample_rate); /* build the waveform table */ - build_decoded_waveform(device->machine, chip, *device->region()); + build_decoded_waveform(device->machine(), chip, *device->region()); /* get stream channels */ if (intf->stereo) - chip->stream = device->machine->sound().stream_alloc(*device, 0, 2, chip->sample_rate, chip, namco_update_stereo); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, chip->sample_rate, chip, namco_update_stereo); else - chip->stream = device->machine->sound().stream_alloc(*device, 0, 1, chip->sample_rate, chip, namco_update_mono); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 1, chip->sample_rate, chip, namco_update_mono); /* start with sound enabled, many games don't have a sound enable register */ chip->sound_enable = 1; diff --git a/src/emu/sound/nes_apu.c b/src/emu/sound/nes_apu.c index c95a9672691..f7c37cae2fa 100644 --- a/src/emu/sound/nes_apu.c +++ b/src/emu/sound/nes_apu.c @@ -690,9 +690,9 @@ static DEVICE_START( nesapu ) int i; /* Initialize global variables */ - info->samps_per_sync = rate / ATTOSECONDS_TO_HZ(device->machine->primary_screen->frame_period().attoseconds); + info->samps_per_sync = rate / ATTOSECONDS_TO_HZ(device->machine().primary_screen->frame_period().attoseconds); info->buffer_size = info->samps_per_sync; - info->real_rate = info->samps_per_sync * ATTOSECONDS_TO_HZ(device->machine->primary_screen->frame_period().attoseconds); + info->real_rate = info->samps_per_sync * ATTOSECONDS_TO_HZ(device->machine().primary_screen->frame_period().attoseconds); info->apu_incsize = (float) (device->clock() / (float) info->real_rate); /* Use initializer calls */ @@ -704,9 +704,9 @@ static DEVICE_START( nesapu ) info->buffer_size+=info->samps_per_sync; /* Initialize individual chips */ - (info->APU.dpcm).memory = device->machine->device(intf->cpu_tag)->memory().space(AS_PROGRAM); + (info->APU.dpcm).memory = device->machine().device(intf->cpu_tag)->memory().space(AS_PROGRAM); - info->stream = device->machine->sound().stream_alloc(*device, 0, 1, rate, info, nes_psg_update_sound); + info->stream = device->machine().sound().stream_alloc(*device, 0, 1, rate, info, nes_psg_update_sound); /* register for save */ for (i = 0; i < 2; i++) diff --git a/src/emu/sound/nile.c b/src/emu/sound/nile.c index 54132196ebc..f2eb959bafb 100644 --- a/src/emu/sound/nile.c +++ b/src/emu/sound/nile.c @@ -227,7 +227,7 @@ static DEVICE_START( nile ) info->sound_ram = *device->region(); - info->stream = device->machine->sound().stream_alloc(*device, 0, 2, 44100, info, nile_update); + info->stream = device->machine().sound().stream_alloc(*device, 0, 2, 44100, info, nile_update); } diff --git a/src/emu/sound/okim6258.c b/src/emu/sound/okim6258.c index 1bff117eaf2..15dd49a9eb1 100644 --- a/src/emu/sound/okim6258.c +++ b/src/emu/sound/okim6258.c @@ -201,7 +201,7 @@ static DEVICE_START( okim6258 ) info->output_bits = intf->output_12bits ? 12 : 10; info->divider = dividers[intf->divider]; - info->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock()/info->divider, info, okim6258_update); + info->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock()/info->divider, info, okim6258_update); info->signal = -2; info->step = 0; diff --git a/src/emu/sound/okim6295.c b/src/emu/sound/okim6295.c index 1b765f31f50..af27711b7d3 100644 --- a/src/emu/sound/okim6295.c +++ b/src/emu/sound/okim6295.c @@ -115,7 +115,7 @@ device_config *okim6295_device_config::static_alloc_device_config(const machine_ device_t *okim6295_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, okim6295_device(machine, *this)); + return auto_alloc(machine, okim6295_device(machine, *this)); } @@ -266,7 +266,7 @@ void okim6295_device::set_bank_base(offs_t base) if (m_bank_installed) { m_bank_offs = base; - memory_set_bankptr(&m_machine, tag(), m_region->base() + base); + memory_set_bankptr(m_machine, tag(), m_region->base() + base); } } diff --git a/src/emu/sound/okim6376.c b/src/emu/sound/okim6376.c index fcfda3f9ba9..c1ac5f5eb92 100644 --- a/src/emu/sound/okim6376.c +++ b/src/emu/sound/okim6376.c @@ -306,7 +306,7 @@ static DEVICE_START( okim6376 ) info->master_clock = device->clock(); /* generate the name and create the stream */ - info->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock()/divisor, info, okim6376_update); + info->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock()/divisor, info, okim6376_update); /* initialize the voices */ for (voice = 0; voice < OKIM6376_VOICES; voice++) diff --git a/src/emu/sound/okim9810.c b/src/emu/sound/okim9810.c index ffbf37a39f2..095c811f9ad 100644 --- a/src/emu/sound/okim9810.c +++ b/src/emu/sound/okim9810.c @@ -101,7 +101,7 @@ device_config *okim9810_device_config::static_alloc_device_config(const machine_ device_t *okim9810_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, okim9810_device(machine, *this)); + return auto_alloc(machine, okim9810_device(machine, *this)); } diff --git a/src/emu/sound/pokey.c b/src/emu/sound/pokey.c index 54f15f94d88..d63278331d4 100644 --- a/src/emu/sound/pokey.c +++ b/src/emu/sound/pokey.c @@ -648,15 +648,15 @@ static DEVICE_START( pokey ) chip->clockmult = DIV_64; chip->KBCODE = 0x09; /* Atari 800 'no key' */ chip->SKCTL = SK_RESET; /* let the RNG run after reset */ - chip->rtimer = device->machine->scheduler().timer_alloc(FUNC(NULL)); + chip->rtimer = device->machine().scheduler().timer_alloc(FUNC(NULL)); - chip->timer[0] = device->machine->scheduler().timer_alloc(FUNC(pokey_timer_expire), chip); - chip->timer[1] = device->machine->scheduler().timer_alloc(FUNC(pokey_timer_expire), chip); - chip->timer[2] = device->machine->scheduler().timer_alloc(FUNC(pokey_timer_expire), chip); + chip->timer[0] = device->machine().scheduler().timer_alloc(FUNC(pokey_timer_expire), chip); + chip->timer[1] = device->machine().scheduler().timer_alloc(FUNC(pokey_timer_expire), chip); + chip->timer[2] = device->machine().scheduler().timer_alloc(FUNC(pokey_timer_expire), chip); for (i=0; i<8; i++) { - chip->ptimer[i] = device->machine->scheduler().timer_alloc(FUNC(pokey_pot_trigger), chip); + chip->ptimer[i] = device->machine().scheduler().timer_alloc(FUNC(pokey_pot_trigger), chip); devcb_resolve_read8(&chip->pot_r[i], &chip->intf.pot_r[i], device); } devcb_resolve_read8(&chip->allpot_r, &chip->intf.allpot_r, device); @@ -664,7 +664,7 @@ static DEVICE_START( pokey ) devcb_resolve_write8(&chip->serout_w, &chip->intf.serout_w, device); chip->interrupt_cb = chip->intf.interrupt_cb; - chip->channel = device->machine->sound().stream_alloc(*device, 0, 1, sample_rate, chip, pokey_update); + chip->channel = device->machine().sound().stream_alloc(*device, 0, 1, sample_rate, chip, pokey_update); register_for_save(chip, device); } @@ -843,7 +843,7 @@ READ8_DEVICE_HANDLER( pokey_r ) } } else - logerror("%s: warning - read '%s' POT%d\n", p->device->machine->describe_context(), p->device->tag(), pot); + logerror("%s: warning - read '%s' POT%d\n", p->device->machine().describe_context(), p->device->tag(), pot); break; case ALLPOT_C: @@ -943,7 +943,7 @@ READ8_HANDLER( quad_pokey_r ) int control = (offset & 0x20) >> 2; int pokey_reg = (offset % 8) | control; - return pokey_r(space->machine->device(devname[pokey_num]), pokey_reg); + return pokey_r(space->machine().device(devname[pokey_num]), pokey_reg); } @@ -1138,9 +1138,9 @@ WRITE8_DEVICE_HANDLER( pokey_w ) * loaders from Ballblazer and Escape from Fractalus * The real times are unknown */ - device->machine->scheduler().timer_set(attotime::from_usec(200), FUNC(pokey_serout_ready_cb), 0, p); + device->machine().scheduler().timer_set(attotime::from_usec(200), FUNC(pokey_serout_ready_cb), 0, p); /* 10 bits (assumption 1 start, 8 data and 1 stop bit) take how long? */ - device->machine->scheduler().timer_set(attotime::from_usec(2000), FUNC(pokey_serout_complete), 0, p); + device->machine().scheduler().timer_set(attotime::from_usec(2000), FUNC(pokey_serout_complete), 0, p); break; case IRQEN_C: @@ -1329,13 +1329,13 @@ WRITE8_HANDLER( quad_pokey_w ) int control = (offset & 0x20) >> 2; int pokey_reg = (offset % 8) | control; - pokey_w(space->machine->device(devname[pokey_num]), pokey_reg, data); + pokey_w(space->machine().device(devname[pokey_num]), pokey_reg, data); } void pokey_serin_ready(device_t *device, int after) { pokey_state *p = get_safe_token(device); - device->machine->scheduler().timer_set(p->clock_period * after, FUNC(pokey_serin_ready_cb), 0, p); + device->machine().scheduler().timer_set(p->clock_period * after, FUNC(pokey_serin_ready_cb), 0, p); } void pokey_break_w(device_t *device, int shift) diff --git a/src/emu/sound/qsound.c b/src/emu/sound/qsound.c index af1222395d9..cc08776aca6 100644 --- a/src/emu/sound/qsound.c +++ b/src/emu/sound/qsound.c @@ -123,7 +123,7 @@ static DEVICE_START( qsound ) { /* Allocate stream */ - chip->stream = device->machine->sound().stream_alloc( + chip->stream = device->machine().sound().stream_alloc( *device, 0, 2, device->clock() / QSOUND_CLOCKDIV, chip, @@ -187,7 +187,7 @@ WRITE8_DEVICE_HANDLER( qsound_w ) break; default: - logerror("%s: unexpected qsound write to offset %d == %02X\n", device->machine->describe_context(), offset, data); + logerror("%s: unexpected qsound write to offset %d == %02X\n", device->machine().describe_context(), offset, data); break; } } diff --git a/src/emu/sound/rf5c400.c b/src/emu/sound/rf5c400.c index e7c12f73d1e..65ff5be839f 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; @@ -345,7 +345,7 @@ static void rf5c400_init_chip(device_t *device, rf5c400_state *info) device->save_item(NAME(info->channels[i].env_scale), i); } - info->stream = device->machine->sound().stream_alloc(*device, 0, 2, device->clock()/384, info, rf5c400_update); + info->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock()/384, info, rf5c400_update); } @@ -448,11 +448,11 @@ WRITE16_DEVICE_HANDLER( rf5c400_w ) default: { - //mame_printf_debug("%s:rf5c400_w: %08X, %08X, %08X\n", device->machine->describe_context(), data, offset, mem_mask); + //mame_printf_debug("%s:rf5c400_w: %08X, %08X, %08X\n", device->machine().describe_context(), data, offset, mem_mask); break; } } - //mame_printf_debug("%s:rf5c400_w: %08X, %08X, %08X at %08X\n", device->machine->describe_context(), data, offset, mem_mask); + //mame_printf_debug("%s:rf5c400_w: %08X, %08X, %08X at %08X\n", device->machine().describe_context(), data, offset, mem_mask); } else { diff --git a/src/emu/sound/rf5c68.c b/src/emu/sound/rf5c68.c index ba756d0ec56..56f60f4e7a7 100644 --- a/src/emu/sound/rf5c68.c +++ b/src/emu/sound/rf5c68.c @@ -145,7 +145,7 @@ static DEVICE_START( rf5c68 ) rf5c68_state *chip = get_safe_token(device); /* allocate the stream */ - chip->stream = device->machine->sound().stream_alloc(*device, 0, 2, device->clock() / 384, chip, rf5c68_update); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock() / 384, chip, rf5c68_update); chip->device = device; diff --git a/src/emu/sound/s14001a.c b/src/emu/sound/s14001a.c index d2d9741b658..902d644e81c 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 36c5c29a519..baeb1b7f487 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/saa1099.c b/src/emu/sound/saa1099.c index 19054f55327..f93f1639247 100644 --- a/src/emu/sound/saa1099.c +++ b/src/emu/sound/saa1099.c @@ -327,7 +327,7 @@ static DEVICE_START( saa1099 ) saa->sample_rate = device->clock() / 256; /* for each chip allocate one stream */ - saa->stream = device->machine->sound().stream_alloc(*device, 0, 2, saa->sample_rate, saa, saa1099_update); + saa->stream = device->machine().sound().stream_alloc(*device, 0, 2, saa->sample_rate, saa, saa1099_update); } WRITE8_DEVICE_HANDLER( saa1099_control_w ) @@ -337,7 +337,7 @@ WRITE8_DEVICE_HANDLER( saa1099_control_w ) if ((data & 0xff) > 0x1c) { /* Error! */ - logerror("%s: (SAA1099 '%s') Unknown register selected\n",device->machine->describe_context(), device->tag()); + logerror("%s: (SAA1099 '%s') Unknown register selected\n",device->machine().describe_context(), device->tag()); } saa->selected_reg = data & 0x1f; @@ -423,7 +423,7 @@ WRITE8_DEVICE_HANDLER( saa1099_data_w ) int i; /* Synch & Reset generators */ - logerror("%s: (SAA1099 '%s') -reg 0x1c- Chip reset\n",device->machine->describe_context(), device->tag()); + logerror("%s: (SAA1099 '%s') -reg 0x1c- Chip reset\n",device->machine().describe_context(), device->tag()); for (i = 0; i < 6; i++) { saa->channels[i].level = 0; @@ -432,7 +432,7 @@ WRITE8_DEVICE_HANDLER( saa1099_data_w ) } break; default: /* Error! */ - logerror("%s: (SAA1099 '%s') Unknown operation (reg:%02x, data:%02x)\n",device->machine->describe_context(), device->tag(), reg, data); + logerror("%s: (SAA1099 '%s') Unknown operation (reg:%02x, data:%02x)\n",device->machine().describe_context(), device->tag(), reg, data); } } diff --git a/src/emu/sound/samples.c b/src/emu/sound/samples.c index 2d76933a3ed..1052cbfbcfb 100644 --- a/src/emu/sound/samples.c +++ b/src/emu/sound/samples.c @@ -48,7 +48,7 @@ INLINE samples_info *get_safe_token(device_t *device) read_wav_sample - read a WAV file as a sample -------------------------------------------------*/ -static int read_wav_sample(running_machine *machine, emu_file &file, loaded_sample *sample) +static int read_wav_sample(running_machine &machine, emu_file &file, loaded_sample *sample) { unsigned long offset = 0; UINT32 length, rate, filesize; @@ -177,14 +177,14 @@ static int read_wav_sample(running_machine *machine, emu_file &file, loaded_samp readsamples - load all samples -------------------------------------------------*/ -loaded_samples *readsamples(running_machine *machine, const char *const *samplenames, const char *basename) +loaded_samples *readsamples(running_machine &machine, const char *const *samplenames, const char *basename) { loaded_samples *samples; int skipfirst = 0; int i; /* if the user doesn't want to use samples, bail */ - if (!machine->options().samples()) + if (!machine.options().samples()) return NULL; if (samplenames == 0 || samplenames[0] == 0) return NULL; @@ -206,7 +206,7 @@ loaded_samples *readsamples(running_machine *machine, const char *const *samplen for (i = 0; i < samples->total; i++) if (samplenames[i+skipfirst][0]) { - emu_file file(machine->options().sample_path(), OPEN_FLAG_READ); + emu_file file(machine.options().sample_path(), OPEN_FLAG_READ); file_error filerr = file.open(basename, PATH_SEPARATOR, samplenames[i+skipfirst]); if (filerr != FILERR_NONE && skipfirst) @@ -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,15 +468,15 @@ static DEVICE_START( samples ) /* read audio samples */ if (intf->samplenames) - info->samples = readsamples(device->machine, intf->samplenames,device->machine->system().name); + info->samples = readsamples(device->machine(), intf->samplenames,device->machine().system().name); /* allocate channels */ info->numchannels = intf->channels; assert(info->numchannels < MAX_CHANNELS); - info->channel = auto_alloc_array(device->machine, sample_channel, info->numchannels); + 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; @@ -493,7 +493,7 @@ static DEVICE_START( samples ) device->save_item(NAME(info->channel[i].loop), i); device->save_item(NAME(info->channel[i].paused), i); } - device->machine->state().register_postload(samples_postload, info); + device->machine().state().register_postload(samples_postload, info); /* initialize any custom handlers */ if (intf->start) diff --git a/src/emu/sound/samples.h b/src/emu/sound/samples.h index 018296aec08..0d44d994c2f 100644 --- a/src/emu/sound/samples.h +++ b/src/emu/sound/samples.h @@ -42,7 +42,7 @@ int sample_playing(device_t *device,int channel); /* helper function that reads samples from disk - this can be used by other */ /* drivers as well (e.g. a sound chip emulator needing drum samples) */ -loaded_samples *readsamples(running_machine *machine, const char *const *samplenames, const char *name); +loaded_samples *readsamples(running_machine &machine, const char *const *samplenames, const char *name); DECLARE_LEGACY_SOUND_DEVICE(SAMPLES, samples); diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c index 7e92f3eca8d..486f473ee33 100644 --- a/src/emu/sound/scsp.c +++ b/src/emu/sound/scsp.c @@ -547,9 +547,9 @@ static void SCSP_Init(device_t *device, scsp_state *scsp, const scsp_interface * scsp->SCSPRAM += intf->roffset; } - scsp->timerA = device->machine->scheduler().timer_alloc(FUNC(timerA_cb), scsp); - scsp->timerB = device->machine->scheduler().timer_alloc(FUNC(timerB_cb), scsp); - scsp->timerC = device->machine->scheduler().timer_alloc(FUNC(timerC_cb), scsp); + scsp->timerA = device->machine().scheduler().timer_alloc(FUNC(timerA_cb), scsp); + scsp->timerB = device->machine().scheduler().timer_alloc(FUNC(timerB_cb), scsp); + scsp->timerC = device->machine().scheduler().timer_alloc(FUNC(timerC_cb), scsp); for(i=0;i<0x400;++i) { @@ -639,9 +639,9 @@ static void SCSP_Init(device_t *device, scsp_state *scsp, const scsp_interface * scsp->Slots[i].EG.state=RELEASE; } - LFO_Init(device->machine); - scsp->buffertmpl=auto_alloc_array_clear(device->machine, signed int, 44100); - scsp->buffertmpr=auto_alloc_array_clear(device->machine, signed int, 44100); + LFO_Init(device->machine()); + scsp->buffertmpl=auto_alloc_array_clear(device->machine(), signed int, 44100); + scsp->buffertmpr=auto_alloc_array_clear(device->machine(), signed int, 44100); // no "pend" scsp->udata.data[0x20/2] = 0; @@ -696,7 +696,7 @@ static void SCSP_UpdateSlotReg(scsp_state *scsp,int s,int r) static void SCSP_UpdateReg(scsp_state *scsp, int reg) { /* temporary hack until this is converted to a device */ - address_space *space = scsp->device->machine->firstcpu->memory().space(AS_PROGRAM); + address_space *space = scsp->device->machine().firstcpu->memory().space(AS_PROGRAM); switch(reg&0x3f) { case 0x2: @@ -716,7 +716,7 @@ static void SCSP_UpdateReg(scsp_state *scsp, int reg) break; case 0x6: case 0x7: - scsp_midi_in(space->machine->device("scsp"), 0, scsp->udata.data[0x6/2]&0xff, 0); + scsp_midi_in(space->machine().device("scsp"), 0, scsp->udata.data[0x6/2]&0xff, 0); break; case 0x12: case 0x13: @@ -1214,7 +1214,7 @@ static void dma_scsp(address_space *space, scsp_state *scsp) /*Job done,request a dma end irq*/ if(scsp_regs[0x1e/2] & 0x10) - device_set_input_line(space->machine->device("audiocpu"),dma_transfer_end,HOLD_LINE); + device_set_input_line(space->machine().device("audiocpu"),dma_transfer_end,HOLD_LINE); } #ifdef UNUSED_FUNCTION @@ -1249,7 +1249,7 @@ static DEVICE_START( scsp ) { scsp->Int68kCB = intf->irq_callback; - scsp->stream = device->machine->sound().stream_alloc(*device, 0, 2, 44100, scsp, SCSP_Update); + scsp->stream = device->machine().sound().stream_alloc(*device, 0, 2, 44100, scsp, SCSP_Update); } } @@ -1318,7 +1318,7 @@ WRITE16_DEVICE_HANDLER( scsp_w ) scsp->scsp_dtlg = scsp_regs[0x416/2] & 0x0ffe; if(scsp_dexe) { - dma_scsp(device->machine->firstcpu->memory().space(AS_PROGRAM), scsp); + dma_scsp(device->machine().firstcpu->memory().space(AS_PROGRAM), scsp); scsp_regs[0x416/2]^=0x1000;//disable starting bit } break; @@ -1326,7 +1326,7 @@ WRITE16_DEVICE_HANDLER( scsp_w ) case 0x42a: if(stv_scu && !(stv_scu[40] & 0x40) /*&& scsp_regs[0x42c/2] & 0x20*/)/*Main CPU allow sound irq*/ { - device_set_input_line_and_vector(device->machine->firstcpu, 9, HOLD_LINE , 0x46); + device_set_input_line_and_vector(device->machine().firstcpu, 9, HOLD_LINE , 0x46); logerror("SCSP: Main CPU interrupt\n"); } break; diff --git a/src/emu/sound/scsplfo.c b/src/emu/sound/scsplfo.c index 2609a612524..ca658d1d4ec 100644 --- a/src/emu/sound/scsplfo.c +++ b/src/emu/sound/scsplfo.c @@ -38,7 +38,7 @@ static const float PSCALE[8]={0.0f,7.0f,13.5f,27.0f,55.0f,112.0f,230.0f,494.0f}; static int PSCALES[8][256]; static int ASCALES[8][256]; -static void LFO_Init(running_machine *machine) +static void LFO_Init(running_machine &machine) { int i,s; for(i=0;i<256;++i) @@ -86,7 +86,7 @@ static void LFO_Init(running_machine *machine) //noise //a=lfo_noise[i]; - a=machine->rand()&0xff; + a=machine.rand()&0xff; p=128-a; ALFO_NOI[i]=a; PLFO_NOI[i]=p; diff --git a/src/emu/sound/segapcm.c b/src/emu/sound/segapcm.c index c7edc760ef6..4df96f9d9b6 100644 --- a/src/emu/sound/segapcm.c +++ b/src/emu/sound/segapcm.c @@ -109,7 +109,7 @@ static DEVICE_START( segapcm ) segapcm_state *spcm = get_safe_token(device); spcm->rom = *device->region(); - spcm->ram = auto_alloc_array(device->machine, UINT8, 0x800); + spcm->ram = auto_alloc_array(device->machine(), UINT8, 0x800); memset(spcm->ram, 0xff, 0x800); @@ -127,7 +127,7 @@ static DEVICE_START( segapcm ) spcm->bankmask = mask & (rom_mask >> spcm->bankshift); - spcm->stream = device->machine->sound().stream_alloc(*device, 0, 2, device->clock() / 128, spcm, SEGAPCM_update); + spcm->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock() / 128, spcm, SEGAPCM_update); device->save_item(NAME(spcm->low)); device->save_pointer(NAME(spcm->ram), 0x800); diff --git a/src/emu/sound/sid.c b/src/emu/sound/sid.c index 8aca0f283eb..5f35e04d8ba 100644 --- a/src/emu/sound/sid.c +++ b/src/emu/sound/sid.c @@ -149,9 +149,9 @@ int sidEmuReset(_SID6581 *This) } -static void filterTableInit(running_machine *machine) +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. */ @@ -233,8 +233,8 @@ void sid6581_init (_SID6581 *This) This->filter.Enabled = TRUE; - sidInitMixerEngine(This->device->machine); - filterTableInit(This->device->machine); + sidInitMixerEngine(This->device->machine()); + filterTableInit(This->device->machine()); sidInitWaveformTables(This->type); @@ -323,7 +323,7 @@ void sid6581_port_w (_SID6581 *This, int offset, int data) } } -int sid6581_port_r (running_machine *machine, _SID6581 *This, int offset) +int sid6581_port_r (running_machine &machine, _SID6581 *This, int offset) { int data; /* SIDPLAY reads last written at a sid address value */ diff --git a/src/emu/sound/sid.h b/src/emu/sound/sid.h index df512edda13..e8c4e1bfe04 100644 --- a/src/emu/sound/sid.h +++ b/src/emu/sound/sid.h @@ -58,7 +58,7 @@ void sid6581_init (_SID6581 *This); int sidEmuReset(_SID6581 *This); -int sid6581_port_r (running_machine *machine, _SID6581 *This, int offset); +int sid6581_port_r (running_machine &machine, _SID6581 *This, int offset); void sid6581_port_w (_SID6581 *This, int offset, int data); void sidEmuFillBuffer(_SID6581 *This, stream_sample_t *buffer, UINT32 bufferLen ); diff --git a/src/emu/sound/sid6581.c b/src/emu/sound/sid6581.c index 6596df42d6e..49b99579078 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; @@ -71,7 +71,7 @@ static DEVICE_START( sid8580 ) READ8_DEVICE_HANDLER ( sid6581_r ) { - return sid6581_port_r(device->machine, get_sid(device), offset); + return sid6581_port_r(device->machine(), get_sid(device), offset); } diff --git a/src/emu/sound/sidvoice.c b/src/emu/sound/sidvoice.c index 32387b569bc..59da4ed3ba6 100644 --- a/src/emu/sound/sidvoice.c +++ b/src/emu/sound/sidvoice.c @@ -25,7 +25,7 @@ static INT8* ampMod1x8; static const UINT32 noiseSeed = 0x7ffff8; -void sidInitMixerEngine(running_machine *machine) +void sidInitMixerEngine(running_machine &machine) { UINT16 uk; INT32 si, sj ; diff --git a/src/emu/sound/sidvoice.h b/src/emu/sound/sidvoice.h index fbf1fd00369..58e6ca856b5 100644 --- a/src/emu/sound/sidvoice.h +++ b/src/emu/sound/sidvoice.h @@ -106,7 +106,7 @@ void sidEmuSet2(sidOperator* pVoice); INT8 sidWaveCalcNormal(sidOperator* pVoice); void sidInitWaveformTables(SIDTYPE type); -void sidInitMixerEngine(running_machine *machine); +void sidInitMixerEngine(running_machine &machine); #if 0 extern ptr2sidVoidFunc sid6581ModeNormalTable[16]; diff --git a/src/emu/sound/sn76477.c b/src/emu/sound/sn76477.c index 15852105526..1c62f699fa9 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 */ @@ -1988,13 +1988,13 @@ static STREAM_UPDATE( SN76477_update ) #if TEST_MODE - static int recursing = 0; /* we need to prevent recursion since enable_w calls input_code_pressed_once(device->machine, KEYCODE_SPACE->update */ + static int recursing = 0; /* we need to prevent recursion since enable_w calls input_code_pressed_once(device->machine(), KEYCODE_SPACE->update */ if () && !recursing) { recursing = 1; - device->machine->sound().system_enable(); + device->machine().sound().system_enable(); SN76477_test_enable_w(sn, !sn->enable); } @@ -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/sn76496.c b/src/emu/sound/sn76496.c index e3d66fbed62..826f4e7866a 100644 --- a/src/emu/sound/sn76496.c +++ b/src/emu/sound/sn76496.c @@ -360,7 +360,7 @@ static int SN76496_init(device_t *device, sn76496_state *R, int stereo) int sample_rate = device->clock()/2; int i; - R->Channel = device->machine->sound().stream_alloc(*device,0,(stereo?2:1),sample_rate,R,SN76496Update); + R->Channel = device->machine().sound().stream_alloc(*device,0,(stereo?2:1),sample_rate,R,SN76496Update); for (i = 0;i < 4;i++) R->Volume[i] = 0; diff --git a/src/emu/sound/snkwave.c b/src/emu/sound/snkwave.c index b2ccc46b1f7..20efad91663 100644 --- a/src/emu/sound/snkwave.c +++ b/src/emu/sound/snkwave.c @@ -119,7 +119,7 @@ static DEVICE_START( snkwave ) chip->sample_rate = chip->external_clock >> CLOCK_SHIFT; /* get stream channels */ - chip->stream = device->machine->sound().stream_alloc(*device, 0, 1, chip->sample_rate, chip, snkwave_update); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 1, chip->sample_rate, chip, snkwave_update); /* reset all the voices */ chip->frequency = 0; diff --git a/src/emu/sound/sp0250.c b/src/emu/sound/sp0250.c index fb6110eb67e..9c5f6367869 100644 --- a/src/emu/sound/sp0250.c +++ b/src/emu/sound/sp0250.c @@ -208,10 +208,10 @@ static DEVICE_START( sp0250 ) if (sp->drq != NULL) { sp->drq(sp->device, ASSERT_LINE); - device->machine->scheduler().timer_pulse(attotime::from_hz(device->clock()) * CLOCK_DIVIDER, FUNC(sp0250_timer_tick), 0, sp); + device->machine().scheduler().timer_pulse(attotime::from_hz(device->clock()) * CLOCK_DIVIDER, FUNC(sp0250_timer_tick), 0, sp); } - sp->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock() / CLOCK_DIVIDER, sp, sp0250_update); + sp->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock() / CLOCK_DIVIDER, sp, sp0250_update); } @@ -226,7 +226,7 @@ WRITE8_DEVICE_HANDLER( sp0250_w ) sp->drq(sp->device, CLEAR_LINE); } else - logerror("%s: overflow SP0250 FIFO\n", device->machine->describe_context()); + logerror("%s: overflow SP0250 FIFO\n", device->machine().describe_context()); } diff --git a/src/emu/sound/sp0256.c b/src/emu/sound/sp0256.c index 7481c9d48e9..914a601a9e5 100644 --- a/src/emu/sound/sp0256.c +++ b/src/emu/sound/sp0256.c @@ -1186,7 +1186,7 @@ static DEVICE_START( sp0256 ) devcb_call_write_line(&sp->drq, 1); devcb_call_write_line(&sp->sby, 1); - sp->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock() / CLOCK_DIVIDER, sp, sp0256_update); + sp->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock() / CLOCK_DIVIDER, sp, sp0256_update); /* -------------------------------------------------------------------- */ /* Configure our internal variables. */ @@ -1196,7 +1196,7 @@ static DEVICE_START( sp0256 ) /* -------------------------------------------------------------------- */ /* Allocate a scratch buffer for generating ~10kHz samples. */ /* -------------------------------------------------------------------- */ - sp->scratch = auto_alloc_array(device->machine, INT16, SCBUF_SIZE); + sp->scratch = auto_alloc_array(device->machine(), INT16, SCBUF_SIZE); sp->sc_head = sp->sc_tail = 0; /* -------------------------------------------------------------------- */ diff --git a/src/emu/sound/speaker.c b/src/emu/sound/speaker.c index fd43eade776..54f13bfa9f2 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) { @@ -159,8 +159,8 @@ static DEVICE_START( speaker ) for (i = 0; i < FILTER_LENGTH; i++) 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->last_update_time = device->machine().time(); + 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); @@ -275,7 +275,7 @@ void speaker_level_w(device_t *device, int new_level) new_level = sp->num_levels - 1; volume = sp->levels[sp->level]; - time = device->machine->time(); + time = device->machine().time(); if (time < sp->channel_next_sample_time) { diff --git a/src/emu/sound/spu.c b/src/emu/sound/spu.c index 4ffbe31f845..e64f58f4e3a 100644 --- a/src/emu/sound/spu.c +++ b/src/emu/sound/spu.c @@ -285,7 +285,7 @@ device_config *spu_device_config::static_alloc_device_config(const machine_confi device_t *spu_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, spu_device(machine, *this)); + return auto_alloc(machine, spu_device(machine, *this)); } class adpcm_decoder @@ -3121,18 +3121,18 @@ void spu_device::flush_cdda(const unsigned int sector) // MAME I/O stuff. This can get cleaner when machine/psx.c does. -static void spu_dma_read( running_machine *machine, UINT32 n_address, INT32 n_size ) +static void spu_dma_read( running_machine &machine, UINT32 n_address, INT32 n_size ) { - spu_device *spu = machine->device<spu_device>("spu"); - UINT8 *psxram = (UINT8 *)memory_get_shared(*machine, "share1"); + spu_device *spu = machine.device<spu_device>("spu"); + UINT8 *psxram = (UINT8 *)memory_get_shared(machine, "share1"); spu->start_dma(psxram + n_address, false, n_size*4); } -static void spu_dma_write( running_machine *machine, UINT32 n_address, INT32 n_size ) +static void spu_dma_write( running_machine &machine, UINT32 n_address, INT32 n_size ) { - spu_device *spu = machine->device<spu_device>("spu"); - UINT8 *psxram = (UINT8 *)memory_get_shared(*machine, "share1"); + spu_device *spu = machine.device<spu_device>("spu"); + UINT8 *psxram = (UINT8 *)memory_get_shared(machine, "share1"); // printf("SPU DMA write from %x, size %x\n", n_address, n_size); @@ -3141,12 +3141,12 @@ static void spu_dma_write( running_machine *machine, UINT32 n_address, INT32 n_s READ16_HANDLER( spu_r ) { - spu_device *spu = space->machine->device<spu_device>("spu"); + spu_device *spu = space->machine().device<spu_device>("spu"); if (!spu->installed_dma_hooks) { - psx_dma_install_read_handler(space->machine, 4, spu_dma_read); - psx_dma_install_write_handler(space->machine, 4, spu_dma_write); + psx_dma_install_read_handler(space->machine(), 4, spu_dma_read); + psx_dma_install_write_handler(space->machine(), 4, spu_dma_write); spu->installed_dma_hooks = true; } @@ -3155,12 +3155,12 @@ READ16_HANDLER( spu_r ) WRITE16_HANDLER( spu_w ) { - spu_device *spu = space->machine->device<spu_device>("spu"); + spu_device *spu = space->machine().device<spu_device>("spu"); if (!spu->installed_dma_hooks) { - psx_dma_install_read_handler(space->machine, 4, spu_dma_read); - psx_dma_install_write_handler(space->machine, 4, spu_dma_write); + psx_dma_install_read_handler(space->machine(), 4, spu_dma_read); + psx_dma_install_write_handler(space->machine(), 4, spu_dma_write); spu->installed_dma_hooks = true; } diff --git a/src/emu/sound/st0016.c b/src/emu/sound/st0016.c index c4473995127..dd9e41ed651 100644 --- a/src/emu/sound/st0016.c +++ b/src/emu/sound/st0016.c @@ -142,7 +142,7 @@ static DEVICE_START( st0016 ) info->sound_ram = intf->p_soundram; - info->stream = device->machine->sound().stream_alloc(*device, 0, 2, 44100, info, st0016_update); + info->stream = device->machine().sound().stream_alloc(*device, 0, 2, 44100, info, st0016_update); } diff --git a/src/emu/sound/t6w28.c b/src/emu/sound/t6w28.c index 864f31a3d0f..8f03adaa0aa 100644 --- a/src/emu/sound/t6w28.c +++ b/src/emu/sound/t6w28.c @@ -309,7 +309,7 @@ static int t6w28_init(device_t *device, t6w28_state *R) int sample_rate = device->clock()/16; int i; - R->Channel = device->machine->sound().stream_alloc(*device,0,2,sample_rate,R,t6w28_update); + R->Channel = device->machine().sound().stream_alloc(*device,0,2,sample_rate,R,t6w28_update); R->SampleRate = sample_rate; diff --git a/src/emu/sound/tiaintf.c b/src/emu/sound/tiaintf.c index cd3091ef3d7..8c977c5c102 100644 --- a/src/emu/sound/tiaintf.c +++ b/src/emu/sound/tiaintf.c @@ -28,7 +28,7 @@ static DEVICE_START( tia ) { tia_state *info = get_safe_token(device); - info->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->clock(), info, tia_update); + info->channel = device->machine().sound().stream_alloc(*device, 0, 1, device->clock(), info, tia_update); info->chip = tia_sound_init(device->clock(), device->clock(), 16); assert_always(info->chip != NULL, "Error creating TIA chip"); diff --git a/src/emu/sound/tms3615.c b/src/emu/sound/tms3615.c index d8d8ceb92d5..5c263335fee 100644 --- a/src/emu/sound/tms3615.c +++ b/src/emu/sound/tms3615.c @@ -89,7 +89,7 @@ static DEVICE_START( tms3615 ) { tms_state *tms = get_safe_token(device); - tms->channel = device->machine->sound().stream_alloc(*device, 0, 2, device->clock()/8, tms, tms3615_sound_update); + tms->channel = device->machine().sound().stream_alloc(*device, 0, 2, device->clock()/8, tms, tms3615_sound_update); tms->samplerate = device->clock()/8; tms->basefreq = device->clock(); } diff --git a/src/emu/sound/tms36xx.c b/src/emu/sound/tms36xx.c index 6d1e4635f73..e9c70baacdc 100644 --- a/src/emu/sound/tms36xx.c +++ b/src/emu/sound/tms36xx.c @@ -500,7 +500,7 @@ static DEVICE_START( tms36xx ) tms->intf = (const tms36xx_interface *)device->baseconfig().static_config(); - tms->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->clock() * 64, tms, tms36xx_sound_update); + tms->channel = device->machine().sound().stream_alloc(*device, 0, 1, device->clock() * 64, tms, tms36xx_sound_update); tms->samplerate = device->clock() * 64; tms->basefreq = device->clock(); enable = 0; diff --git a/src/emu/sound/tms5110.c b/src/emu/sound/tms5110.c index 09f34a1b124..11b04ad2998 100644 --- a/src/emu/sound/tms5110.c +++ b/src/emu/sound/tms5110.c @@ -1031,7 +1031,7 @@ static DEVICE_START( tms5110 ) devcb_resolve_read_line(&tms->data_func, &tms->intf->data_func, device); /* initialize a stream */ - tms->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock() / 80, tms, tms5110_update); + tms->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock() / 80, tms, tms5110_update); if (tms->table == NULL) { @@ -1048,7 +1048,7 @@ static DEVICE_START( tms5110 ) } tms->state = CTL_STATE_INPUT; /* most probably not defined */ - tms->romclk_hack_timer = device->machine->scheduler().timer_alloc(FUNC(romclk_hack_timer_cb), (void *) device); + tms->romclk_hack_timer = device->machine().scheduler().timer_alloc(FUNC(romclk_hack_timer_cb), (void *) device); register_for_save_states(tms); } @@ -1415,13 +1415,13 @@ static DEVICE_START( tmsprom ) tms->rom = *device->region(); assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No rom region found"); - tms->prom = device->machine->region(tms->intf->prom_region)->base(); + tms->prom = device->machine().region(tms->intf->prom_region)->base(); assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No prom region found"); tms->device = device; tms->clock = device->clock(); - tms->romclk_timer = device->machine->scheduler().timer_alloc(FUNC(tmsprom_step), device); + tms->romclk_timer = device->machine().scheduler().timer_alloc(FUNC(tmsprom_step), device); tms->romclk_timer->adjust(attotime::zero, 0, attotime::from_hz(tms->clock)); tms->bit = 0; diff --git a/src/emu/sound/tms5220.c b/src/emu/sound/tms5220.c index 0ad9576a78b..06969db03ca 100644 --- a/src/emu/sound/tms5220.c +++ b/src/emu/sound/tms5220.c @@ -1518,7 +1518,7 @@ static DEVICE_START( tms5220 ) devcb_resolve_write_line(&tms->readyq_func, &tms->intf->readyq_func, device); /* initialize a stream */ - tms->stream = device->machine->sound().stream_alloc(*device, 0, 1, device->clock() / 80, tms, tms5220_update); + tms->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock() / 80, tms, tms5220_update); /*if (tms->table == NULL) { @@ -1696,7 +1696,7 @@ WRITE_LINE_DEVICE_HANDLER( tms5220_rsq_w ) tms->io_ready = 0; update_ready_state(tms); /* How long does /READY stay inactive, when /RS is pulled low? I believe its almost always ~16 clocks (25 usec at 800khz as shown on the datasheet) */ - tms->device->machine->scheduler().timer_set(attotime::from_hz(device->clock()/16), FUNC(io_ready_cb), 1, tms); // this should take around 10-16 (closer to ~11?) cycles to complete + tms->device->machine().scheduler().timer_set(attotime::from_hz(device->clock()/16), FUNC(io_ready_cb), 1, tms); // this should take around 10-16 (closer to ~11?) cycles to complete } } } @@ -1759,7 +1759,7 @@ WRITE_LINE_DEVICE_HANDLER( tms5220_wsq_w ) SET RATE (5220C only): ? cycles (probably ~16) */ // TODO: actually HANDLE the timing differences! currently just assuming always 16 cycles - tms->device->machine->scheduler().timer_set(attotime::from_hz(device->clock()/16), FUNC(io_ready_cb), 1, tms); // this should take around 10-16 (closer to ~15) cycles to complete for fifo writes, TODO: but actually depends on what command is written if in command mode + tms->device->machine().scheduler().timer_set(attotime::from_hz(device->clock()/16), FUNC(io_ready_cb), 1, tms); // this should take around 10-16 (closer to ~15) cycles to complete for fifo writes, TODO: but actually depends on what command is written if in command mode } } } diff --git a/src/emu/sound/upd7759.c b/src/emu/sound/upd7759.c index 7d6fffa2991..f5bd40697cb 100644 --- a/src/emu/sound/upd7759.c +++ b/src/emu/sound/upd7759.c @@ -628,7 +628,7 @@ static void register_for_save(upd7759_state *chip, device_t *device) device->save_item(NAME(chip->sample)); device->save_item(NAME(chip->romoffset)); - device->machine->state().register_postload(upd7759_postload, chip); + device->machine().state().register_postload(upd7759_postload, chip); } @@ -641,7 +641,7 @@ static DEVICE_START( upd7759 ) chip->device = device; /* allocate a stream channel */ - chip->channel = device->machine->sound().stream_alloc(*device, 0, 1, device->clock()/4, chip, upd7759_update); + chip->channel = device->machine().sound().stream_alloc(*device, 0, 1, device->clock()/4, chip, upd7759_update); /* compute the stepping rate based on the chip's clock speed */ chip->step = 4 * FRAC_ONE; @@ -655,7 +655,7 @@ static DEVICE_START( upd7759 ) /* compute the ROM base or allocate a timer */ chip->rom = chip->rombase = *device->region(); if (chip->rom == NULL) - chip->timer = device->machine->scheduler().timer_alloc(FUNC(upd7759_slave_update), chip); + chip->timer = device->machine().scheduler().timer_alloc(FUNC(upd7759_slave_update), chip); /* set the DRQ callback */ chip->drqcallback = intf->drqcallback; diff --git a/src/emu/sound/vlm5030.c b/src/emu/sound/vlm5030.c index 351233f72ad..634c3cca5f9 100644 --- a/src/emu/sound/vlm5030.c +++ b/src/emu/sound/vlm5030.c @@ -47,7 +47,7 @@ RST not only resets the chip on its rising edge but grabs a byte of mode state d 9bit DAC is composed of 5bit Physical and 3bitPWM. todo: - Noise Generator circuit without 'machine->rand()' function. + Noise Generator circuit without 'machine.rand()' function. ----------- command format (Analytical result) ---------- @@ -410,7 +410,7 @@ static STREAM_UPDATE( vlm5030_update_callback ) } else if (chip->old_pitch <= 1) { /* generate unvoiced samples here */ - current_val = (chip->device->machine->rand()&1) ? chip->current_energy : -chip->current_energy; + current_val = (chip->device->machine().rand()&1) ? chip->current_energy : -chip->current_energy; } else { @@ -703,7 +703,7 @@ static DEVICE_START( vlm5030 ) else chip->address_mask = chip->intf->memory_size-1; - chip->channel = device->machine->sound().stream_alloc(*device, 0, 1, emulation_rate,chip,vlm5030_update_callback); + chip->channel = device->machine().sound().stream_alloc(*device, 0, 1, emulation_rate,chip,vlm5030_update_callback); /* don't restore "UINT8 *chip->rom" when use vlm5030_set_rom() */ @@ -726,7 +726,7 @@ static DEVICE_START( vlm5030 ) device->save_item(NAME(chip->target_pitch)); device->save_item(NAME(chip->target_k)); device->save_item(NAME(chip->x)); - device->machine->state().register_postload(vlm5030_restore_state, chip); + device->machine().state().register_postload(vlm5030_restore_state, chip); } diff --git a/src/emu/sound/votrax.c b/src/emu/sound/votrax.c index adfb1e212ff..176d7cf537f 100644 --- a/src/emu/sound/votrax.c +++ b/src/emu/sound/votrax.c @@ -113,11 +113,11 @@ static DEVICE_START( votrax ) votrax_state *votrax = get_safe_token(device); votrax->device = device; - votrax->samples = readsamples(device->machine,VotraxTable,"votrax"); + votrax->samples = readsamples(device->machine(),VotraxTable,"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/vrender0.c b/src/emu/sound/vrender0.c index 46ca52ed6ae..e39d049fc26 100644 --- a/src/emu/sound/vrender0.c +++ b/src/emu/sound/vrender0.c @@ -110,7 +110,7 @@ static DEVICE_START( vrender0 ) memcpy(&(VR0->Intf),intf,sizeof(vr0_interface)); memset(VR0->SOUNDREGS,0,sizeof(VR0->SOUNDREGS)); - VR0->stream = device->machine->sound().stream_alloc(*device, 0, 2, 44100, VR0, VR0_Update); + VR0->stream = device->machine().sound().stream_alloc(*device, 0, 2, 44100, VR0, VR0_Update); device->save_item(NAME(VR0->SOUNDREGS)); } diff --git a/src/emu/sound/wave.c b/src/emu/sound/wave.c index 42b7f724da3..86bbd429361 100644 --- a/src/emu/sound/wave.c +++ b/src/emu/sound/wave.c @@ -22,7 +22,7 @@ static STREAM_UPDATE( wave_sound_update ) { device_image_interface *image = (device_image_interface *)param; - int speakers = image->device().machine->m_devicelist.count(SPEAKER); + int speakers = image->device().machine().m_devicelist.count(SPEAKER); cassette_image *cassette; cassette_state state; double time_index; @@ -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); - image = dynamic_cast<device_image_interface *>(device->machine->device( (const char *)device->baseconfig().static_config())); + 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/sound/x1_010.c b/src/emu/sound/x1_010.c index 2bdc309ffd0..c4d446e0173 100644 --- a/src/emu/sound/x1_010.c +++ b/src/emu/sound/x1_010.c @@ -216,7 +216,7 @@ static DEVICE_START( x1_010 ) LOG_SOUND(("masterclock = %d rate = %d\n", device->clock(), info->rate )); /* get stream channels */ - info->stream = device->machine->sound().stream_alloc(*device,0,2,info->rate,info,seta_update); + info->stream = device->machine().sound().stream_alloc(*device,0,2,info->rate,info,seta_update); } @@ -255,7 +255,7 @@ WRITE8_DEVICE_HANDLER( seta_sound_w ) info->smp_offset[channel] = 0; info->env_offset[channel] = 0; } - LOG_REGISTER_WRITE(("%s: offset %6X : data %2X\n", device->machine->describe_context(), offset, data )); + LOG_REGISTER_WRITE(("%s: offset %6X : data %2X\n", device->machine().describe_context(), offset, data )); info->reg[offset] = data; } @@ -271,7 +271,7 @@ READ16_DEVICE_HANDLER( seta_sound_word_r ) ret = info->HI_WORD_BUF[offset]<<8; ret += (seta_sound_r( device, offset )&0xff); - LOG_REGISTER_READ(( "%s: Read X1-010 Offset:%04X Data:%04X\n", device->machine->describe_context(), offset, ret )); + LOG_REGISTER_READ(( "%s: Read X1-010 Offset:%04X Data:%04X\n", device->machine().describe_context(), offset, ret )); return ret; } @@ -280,7 +280,7 @@ WRITE16_DEVICE_HANDLER( seta_sound_word_w ) x1_010_state *info = get_safe_token(device); info->HI_WORD_BUF[offset] = (data>>8)&0xff; seta_sound_w( device, offset, data&0xff ); - LOG_REGISTER_WRITE(( "%s: Write X1-010 Offset:%04X Data:%04X\n", device->machine->describe_context(), offset, data )); + LOG_REGISTER_WRITE(( "%s: Write X1-010 Offset:%04X Data:%04X\n", device->machine().describe_context(), offset, data )); } diff --git a/src/emu/sound/ym2151.c b/src/emu/sound/ym2151.c index 924790fea68..dd092c5b3ba 100644 --- a/src/emu/sound/ym2151.c +++ b/src/emu/sound/ym2151.c @@ -824,7 +824,7 @@ static TIMER_CALLBACK( timer_callback_a ) if (chip->irq_enable & 0x04) { chip->status |= 1; - machine->scheduler().timer_set(attotime::zero, FUNC(irqAon_callback), 0, chip); + machine.scheduler().timer_set(attotime::zero, FUNC(irqAon_callback), 0, chip); } if (chip->irq_enable & 0x80) chip->csm_req = 2; /* request KEY ON / KEY OFF sequence */ @@ -837,7 +837,7 @@ static TIMER_CALLBACK( timer_callback_b ) if (chip->irq_enable & 0x08) { chip->status |= 2; - machine->scheduler().timer_set(attotime::zero, FUNC(irqBon_callback), 0, chip); + machine.scheduler().timer_set(attotime::zero, FUNC(irqBon_callback), 0, chip); } } #if 0 @@ -1098,7 +1098,7 @@ void ym2151_write_reg(void *_chip, int r, int v) { #ifdef USE_MAME_TIMERS chip->status &= ~1; - chip->device->machine->scheduler().timer_set(attotime::zero, FUNC(irqAoff_callback), 0, chip); + chip->device->machine().scheduler().timer_set(attotime::zero, FUNC(irqAoff_callback), 0, chip); #else int oldstate = chip->status & 3; chip->status &= ~1; @@ -1110,7 +1110,7 @@ void ym2151_write_reg(void *_chip, int r, int v) { #ifdef USE_MAME_TIMERS chip->status &= ~2; - chip->device->machine->scheduler().timer_set(attotime::zero, FUNC(irqBoff_callback), 0, chip); + chip->device->machine().scheduler().timer_set(attotime::zero, FUNC(irqBoff_callback), 0, chip); #else int oldstate = chip->status & 3; chip->status &= ~2; @@ -1485,7 +1485,7 @@ static void ym2151_state_save_register( YM2151 *chip, device_t *device ) device->save_item(NAME(chip->connect)); - device->machine->state().register_postload(ym2151_postload, chip); + device->machine().state().register_postload(ym2151_postload, chip); } #else STATE_POSTLOAD( ym2151_postload ) @@ -1509,7 +1509,7 @@ void * ym2151_init(device_t *device, int clock, int rate) { YM2151 *PSG; - PSG = auto_alloc(device->machine, YM2151); + PSG = auto_alloc(device->machine(), YM2151); memset(PSG, 0, sizeof(YM2151)); @@ -1533,8 +1533,8 @@ void * ym2151_init(device_t *device, int clock, int rate) #ifdef USE_MAME_TIMERS /* this must be done _before_ a call to ym2151_reset_chip() */ - PSG->timer_A = device->machine->scheduler().timer_alloc(FUNC(timer_callback_a), PSG); - PSG->timer_B = device->machine->scheduler().timer_alloc(FUNC(timer_callback_b), PSG); + PSG->timer_A = device->machine().scheduler().timer_alloc(FUNC(timer_callback_a), PSG); + PSG->timer_B = device->machine().scheduler().timer_alloc(FUNC(timer_callback_b), PSG); #else PSG->tim_A = 0; PSG->tim_B = 0; @@ -1546,7 +1546,7 @@ void * ym2151_init(device_t *device, int clock, int rate) { cymfile = fopen("2151_.cym","wb"); if (cymfile) - device->machine->scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/ + device->machine().scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/ else logerror("Could not create file 2151_.cym\n"); } @@ -1560,7 +1560,7 @@ void ym2151_shutdown(void *_chip) { YM2151 *chip = (YM2151 *)_chip; - auto_free (chip->device->machine, chip); + auto_free (chip->device->machine(), chip); if (cymfile) fclose (cymfile); diff --git a/src/emu/sound/ym2413.c b/src/emu/sound/ym2413.c index 68992390a33..7aaf447e99b 100644 --- a/src/emu/sound/ym2413.c +++ b/src/emu/sound/ym2413.c @@ -1940,7 +1940,7 @@ static int OPLL_LockTable(device_t *device) { cymfile = fopen("2413_.cym","wb"); if (cymfile) - device->machine->scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/ + device->machine().scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/ else logerror("Could not create file 2413_.cym\n"); } @@ -2011,7 +2011,7 @@ static YM2413 *OPLLCreate(device_t *device, int clock, int rate) if (OPLL_LockTable(device) == -1) return NULL; /* allocate memory block */ - chip = auto_alloc_clear(device->machine, YM2413); + chip = auto_alloc_clear(device->machine(), YM2413); chip->device = device; chip->clock = clock; @@ -2029,7 +2029,7 @@ static YM2413 *OPLLCreate(device_t *device, int clock, int rate) static void OPLLDestroy(YM2413 *chip) { OPLL_UnLockTable(); - auto_free(chip->device->machine, chip); + auto_free(chip->device->machine(), chip); } /* Option handlers */ diff --git a/src/emu/sound/ymf262.c b/src/emu/sound/ymf262.c index 0d6ab4d9353..e6ea783f58f 100644 --- a/src/emu/sound/ymf262.c +++ b/src/emu/sound/ymf262.c @@ -2268,7 +2268,7 @@ static int OPL3_LockTable(device_t *device) { cymfile = fopen("ymf262_.cym","wb"); if (cymfile) - device->machine->scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/ + device->machine().scheduler().timer_pulse ( attotime::from_hz(110), FUNC(cymfile_callback)); /*110 Hz pulse timer*/ else logerror("Could not create ymf262_.cym file\n"); } @@ -2341,7 +2341,7 @@ static OPL3 *OPL3Create(device_t *device, int clock, int rate, int type) if (OPL3_LockTable(device) == -1) return NULL; /* allocate memory block */ - chip = auto_alloc_clear(device->machine, OPL3); + chip = auto_alloc_clear(device->machine(), OPL3); chip->device = device; chip->type = type; @@ -2360,7 +2360,7 @@ static OPL3 *OPL3Create(device_t *device, int clock, int rate, int type) static void OPL3Destroy(OPL3 *chip) { OPL3_UnLockTable(); - auto_free(chip->device->machine, chip); + auto_free(chip->device->machine(), chip); } diff --git a/src/emu/sound/ymf271.c b/src/emu/sound/ymf271.c index 3a476785612..043fb6f60c4 100644 --- a/src/emu/sound/ymf271.c +++ b/src/emu/sound/ymf271.c @@ -1589,7 +1589,7 @@ READ8_DEVICE_HANDLER( ymf271_r ) return 0; } -static void init_tables(running_machine *machine) +static void init_tables(running_machine &machine) { int i,j; @@ -1752,8 +1752,8 @@ static void init_state(YMF271Chip *chip, device_t *device) static void ymf271_init(device_t *device, YMF271Chip *chip, UINT8 *rom, void (*cb)(device_t *,int), const devcb_read8 *ext_read, const devcb_write8 *ext_write) { - chip->timA = device->machine->scheduler().timer_alloc(FUNC(ymf271_timer_a_tick), chip); - chip->timB = device->machine->scheduler().timer_alloc(FUNC(ymf271_timer_b_tick), chip); + chip->timA = device->machine().scheduler().timer_alloc(FUNC(ymf271_timer_a_tick), chip); + chip->timB = device->machine().scheduler().timer_alloc(FUNC(ymf271_timer_b_tick), chip); chip->rom = rom; chip->irq_callback = cb; @@ -1761,7 +1761,7 @@ static void ymf271_init(device_t *device, YMF271Chip *chip, UINT8 *rom, void (*c devcb_resolve_read8(&chip->ext_mem_read, ext_read, device); devcb_resolve_write8(&chip->ext_mem_write, ext_write, device); - init_tables(device->machine); + init_tables(device->machine()); init_state(chip, device); } @@ -1778,7 +1778,7 @@ static DEVICE_START( ymf271 ) intf = (device->baseconfig().static_config() != NULL) ? (const ymf271_interface *)device->baseconfig().static_config() : &defintrf; ymf271_init(device, chip, *device->region(), intf->irq_callback, &intf->ext_read, &intf->ext_write); - chip->stream = device->machine->sound().stream_alloc(*device, 0, 2, device->clock()/384, chip, ymf271_update); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock()/384, chip, ymf271_update); for (i = 0; i < 256; i++) { diff --git a/src/emu/sound/ymf278b.c b/src/emu/sound/ymf278b.c index 7584588fffa..c0a116b1854 100644 --- a/src/emu/sound/ymf278b.c +++ b/src/emu/sound/ymf278b.c @@ -340,7 +340,7 @@ static STREAM_UPDATE( ymf278b_pcm_update ) } } -static void ymf278b_irq_check(running_machine *machine, YMF278BChip *chip) +static void ymf278b_irq_check(running_machine &machine, YMF278BChip *chip) { int prev_line = chip->irq_line; chip->irq_line = chip->current_irq ? ASSERT_LINE : CLEAR_LINE; @@ -398,7 +398,7 @@ static void ymf278b_timer_b_reset(YMF278BChip *chip) chip->timer_b->adjust(attotime::never); } -static void ymf278b_A_w(running_machine *machine, YMF278BChip *chip, UINT8 reg, UINT8 data) +static void ymf278b_A_w(running_machine &machine, YMF278BChip *chip, UINT8 reg, UINT8 data) { switch(reg) { @@ -620,7 +620,7 @@ READ8_DEVICE_HANDLER( ymf278b_r ) return chip->current_irq | (chip->irq_line == ASSERT_LINE ? 0x80 : 0x00); default: - logerror("%s: unexpected read at offset %X from ymf278b\n", device->machine->describe_context(), offset); + logerror("%s: unexpected read at offset %X from ymf278b\n", device->machine().describe_context(), offset); break; } return 0xff; @@ -637,7 +637,7 @@ WRITE8_DEVICE_HANDLER( ymf278b_w ) break; case 1: - ymf278b_A_w(device->machine, chip, chip->port_A, data); + ymf278b_A_w(device->machine(), chip, chip->port_A, data); break; case 2: @@ -657,7 +657,7 @@ WRITE8_DEVICE_HANDLER( ymf278b_w ) break; default: - logerror("%s: unexpected write at offset %X to ymf278b = %02X\n", device->machine->describe_context(), offset, data); + logerror("%s: unexpected write at offset %X to ymf278b = %02X\n", device->machine().describe_context(), offset, data); break; } } @@ -666,8 +666,8 @@ static void ymf278b_init(device_t *device, YMF278BChip *chip, void (*cb)(device_ { chip->rom = *device->region(); chip->irq_callback = cb; - chip->timer_a = device->machine->scheduler().timer_alloc(FUNC(ymf278b_timer_a_tick), chip); - chip->timer_b = device->machine->scheduler().timer_alloc(FUNC(ymf278b_timer_b_tick), chip); + chip->timer_a = device->machine().scheduler().timer_alloc(FUNC(ymf278b_timer_a_tick), chip); + chip->timer_b = device->machine().scheduler().timer_alloc(FUNC(ymf278b_timer_b_tick), chip); chip->irq_line = CLEAR_LINE; chip->clock = device->clock(); } @@ -741,7 +741,7 @@ static DEVICE_START( ymf278b ) intf = (device->baseconfig().static_config() != NULL) ? (const ymf278b_interface *)device->baseconfig().static_config() : &defintrf; ymf278b_init(device, chip, intf->irq_callback); - chip->stream = device->machine->sound().stream_alloc(*device, 0, 2, device->clock()/768, chip, ymf278b_pcm_update); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock()/768, chip, ymf278b_pcm_update); // Volume table, 1 = -0.375dB, 8 = -3dB, 256 = -96dB for(i = 0; i < 256; i++) diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c index f363b80d98b..04f7938dae3 100644 --- a/src/emu/sound/ymz280b.c +++ b/src/emu/sound/ymz280b.c @@ -205,7 +205,7 @@ static STATE_POSTLOAD( YMZ280B_state_save_update_step ) struct YMZ280BVoice *voice = &chip->voice[j]; update_step(chip, voice); if(voice->irq_schedule) - machine->scheduler().timer_set(attotime::zero, FUNC(update_irq_state_cb[j]), 0, chip); + machine.scheduler().timer_set(attotime::zero, FUNC(update_irq_state_cb[j]), 0, chip); } } @@ -581,7 +581,7 @@ static STREAM_UPDATE( ymz280b_update ) voice->playing = 0; /* set update_irq_state_timer. IRQ is signaled on next CPU execution. */ - chip->device->machine->scheduler().timer_set(attotime::zero, FUNC(update_irq_state_cb[v]), 0, chip); + chip->device->machine().scheduler().timer_set(attotime::zero, FUNC(update_irq_state_cb[v]), 0, chip); voice->irq_schedule = 1; } } @@ -651,10 +651,10 @@ static DEVICE_START( ymz280b ) chip->irq_callback = intf->irq_callback; /* create the stream */ - chip->stream = device->machine->sound().stream_alloc(*device, 0, 2, INTERNAL_SAMPLE_RATE, chip, ymz280b_update); + chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, INTERNAL_SAMPLE_RATE, chip, ymz280b_update); /* allocate memory */ - chip->scratch = auto_alloc_array(device->machine, INT16, MAX_SAMPLE_CHUNK); + chip->scratch = auto_alloc_array(device->machine(), INT16, MAX_SAMPLE_CHUNK); /* state save */ { @@ -694,7 +694,7 @@ static DEVICE_START( ymz280b ) } } - device->machine->state().register_postload(YMZ280B_state_save_update_step, chip); + device->machine().state().register_postload(YMZ280B_state_save_update_step, chip); #if MAKE_WAVS chip->wavresample = wav_open("resamp.wav", INTERNAL_SAMPLE_RATE, 2); diff --git a/src/emu/sound/zsg2.c b/src/emu/sound/zsg2.c index 7f5f99a3a04..28be392d6aa 100644 --- a/src/emu/sound/zsg2.c +++ b/src/emu/sound/zsg2.c @@ -226,9 +226,9 @@ static DEVICE_START( zsg2 ) memset(&info->zc, 0, sizeof(info->zc)); memset(&info->act, 0, sizeof(info->act)); - info->stream = device->machine->sound().stream_alloc(*device, 0, 2, info->sample_rate, info, update_stereo); + info->stream = device->machine().sound().stream_alloc(*device, 0, 2, info->sample_rate, info, update_stereo); - info->bank_samples = device->machine->region(intf->samplergn)->base(); + info->bank_samples = device->machine().region(intf->samplergn)->base(); } /************************************************************************** diff --git a/src/emu/speaker.c b/src/emu/speaker.c index 924f2dab582..052a581a676 100644 --- a/src/emu/speaker.c +++ b/src/emu/speaker.c @@ -99,7 +99,7 @@ device_config *speaker_device_config::static_alloc_device_config(const machine_c device_t *speaker_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, speaker_device(machine, *this)); + return auto_alloc(machine, speaker_device(machine, *this)); } @@ -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, m_machine.sample_rate()); } diff --git a/src/emu/state.c b/src/emu/state.c index a56f3a25528..1e5577addbc 100644 --- a/src/emu/state.c +++ b/src/emu/state.c @@ -162,7 +162,7 @@ void state_manager::register_presave(prepost_func func, void *param) fatalerror("Duplicate save state function (%p, %p)", param, func); // allocate a new entry - m_presave_list.append(*auto_alloc(&m_machine, state_callback(func, param))); + m_presave_list.append(*auto_alloc(m_machine, state_callback(func, param))); } @@ -183,7 +183,7 @@ void state_manager::register_postload(prepost_func func, void *param) fatalerror("Duplicate save state function (%p, %p)", param, func); // allocate a new entry - m_postload_list.append(*auto_alloc(&m_machine, state_callback(func, param))); + m_postload_list.append(*auto_alloc(m_machine, state_callback(func, param))); } @@ -228,7 +228,7 @@ void state_manager::save_memory(const char *module, const char *tag, UINT32 inde } // insert us into the list - m_entry_list.insert_after(*auto_alloc(&m_machine, state_entry(val, totalname, valsize, valcount)), insert_after); + m_entry_list.insert_after(*auto_alloc(m_machine, state_entry(val, totalname, valsize, valcount)), insert_after); } @@ -237,12 +237,11 @@ void state_manager::save_memory(const char *module, const char *tag, UINT32 inde // state //------------------------------------------------- -state_save_error state_manager::check_file(running_machine *machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...)) +state_save_error state_manager::check_file(running_machine &machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...)) { // if we want to validate the signature, compute it UINT32 sig = 0; - if (machine != NULL) - sig = machine->state().signature(); + sig = machine.state().signature(); // seek to the beginning and read the header file.compress(FCOMPRESS_NONE); @@ -300,7 +299,7 @@ state_save_error state_manager::read_file(emu_file &file) // call the post-load functions for (state_callback *func = m_postload_list.first(); func != NULL; func = func->next()) - (*func->m_func)(&m_machine, func->m_param); + (*func->m_func)(m_machine, func->m_param); return STATERR_NONE; } @@ -334,7 +333,7 @@ state_save_error state_manager::write_file(emu_file &file) // call the pre-save functions for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next()) - (*func->m_func)(&m_machine, func->m_param); + (*func->m_func)(m_machine, func->m_param); // then write all the data for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next()) diff --git a/src/emu/state.h b/src/emu/state.h index 8b22f1b990c..dacfef66673 100644 --- a/src/emu/state.h +++ b/src/emu/state.h @@ -68,20 +68,20 @@ enum state_save_error //************************************************************************** // macros to declare presave/postload functions with the appropriate parameters -#define STATE_PRESAVE(name) void name(running_machine *machine, void *param) -#define STATE_POSTLOAD(name) void name(running_machine *machine, void *param) +#define STATE_PRESAVE(name) void name(running_machine &machine, void *param) +#define STATE_POSTLOAD(name) void name(running_machine &machine, void *param) // templates to assume the 'param' of a presave/postload function is a class pointer template<class T, void (T::*func)()> -void state_presave_stub(running_machine *machine, void *param) +void state_presave_stub(running_machine &machine, void *param) { T *target = reinterpret_cast<T *>(param); (target->*func)(); } template<class T, void (T::*func)()> -void state_postload_stub(running_machine *machine, void *param) +void state_postload_stub(running_machine &machine, void *param) { T *target = reinterpret_cast<T *>(param); (target->*func)(); @@ -97,37 +97,37 @@ void state_postload_stub(running_machine *machine, void *param) // register items with explicit tags #define state_save_register_item(_mach, _mod, _tag, _index, _val) \ - (_mach)->state().save_item(_mod, _tag, _index, _val, #_val) + (_mach).state().save_item(_mod, _tag, _index, _val, #_val) #define state_save_register_item_pointer(_mach, _mod, _tag, _index, _val, _count) \ - (_mach)->state().save_pointer(_mod, _tag, _index, _val, #_val, _count) + (_mach).state().save_pointer(_mod, _tag, _index, _val, #_val, _count) #define state_save_register_item_array(_mach, _mod, _tag, _index, _val) \ - (_mach)->state().save_item(_mod, _tag, _index, _val, #_val) + (_mach).state().save_item(_mod, _tag, _index, _val, #_val) #define state_save_register_item_2d_array(_mach, _mod, _tag, _index, _val) \ - (_mach)->state().save_item(_mod, _tag, _index, _val, #_val) + (_mach).state().save_item(_mod, _tag, _index, _val, #_val) #define state_save_register_item_bitmap(_mach, _mod, _tag, _index, _val) \ - (_mach)->state().save_item(_mod, _tag, _index, *(_val), #_val) + (_mach).state().save_item(_mod, _tag, _index, *(_val), #_val) // register global items #define state_save_register_global(_mach, _val) \ - (_mach)->state().save_item(_val, #_val) + (_mach).state().save_item(_val, #_val) #define state_save_register_global_pointer(_mach, _val, _count) \ - (_mach)->state().save_pointer(_val, #_val, _count) + (_mach).state().save_pointer(_val, #_val, _count) #define state_save_register_global_array(_mach, _val) \ - (_mach)->state().save_item(_val, #_val) + (_mach).state().save_item(_val, #_val) #define state_save_register_global_2d_array(_mach, _val) \ - (_mach)->state().save_item(_val, #_val) + (_mach).state().save_item(_val, #_val) #define state_save_register_global_bitmap(_mach, _val) \ - (_mach)->state().save_item(*(_val), #_val) + (_mach).state().save_item(*(_val), #_val) @@ -142,7 +142,7 @@ class state_manager template<typename T> struct type_checker<T*> { static const bool is_atom = false; static const bool is_pointer = true; }; public: - typedef void (*prepost_func)(running_machine *machine, void *param); + typedef void (*prepost_func)(running_machine &machine, void *param); // construction/destruction state_manager(running_machine &machine); @@ -202,7 +202,7 @@ public: void save_pointer(T *value, const char *valname, UINT32 count, int index = 0) { save_pointer("global", NULL, index, value, valname, count); } // file processing - static state_save_error check_file(running_machine *machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...)); + static state_save_error check_file(running_machine &machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...)); state_save_error write_file(emu_file &file); state_save_error read_file(emu_file &file); diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c index 41e3e48a604..014779c1b6f 100644 --- a/src/emu/tilemap.c +++ b/src/emu/tilemap.c @@ -67,8 +67,10 @@ struct _blit_parameters /* core tilemap structure */ struct _tilemap_t { + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } + tilemap_t * next; /* pointer to next tilemap */ - running_machine * machine; /* pointer back to the owning machine */ + running_machine * m_machine; /* pointer back to the owning machine */ /* basic tilemap metrics */ UINT32 rows; /* number of tile rows */ @@ -135,7 +137,7 @@ struct _tilemap_private ***************************************************************************/ /* system management helpers */ -static tilemap_t *tilemap_create_common(running_machine *machine, void *get_info_object, tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows); +static tilemap_t *tilemap_create_common(running_machine &machine, void *get_info_object, tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows); static void tilemap_exit(running_machine &machine); static STATE_POSTLOAD( tilemap_postload ); static void tilemap_dispose(tilemap_t *tmap); @@ -238,12 +240,12 @@ INLINE INT32 effective_colscroll(tilemap_t *tmap, int index, UINT32 screen_heigh indexed_tilemap - return a tilemap by index -------------------------------------------------*/ -INLINE tilemap_t *indexed_tilemap(running_machine *machine, int index) +INLINE tilemap_t *indexed_tilemap(running_machine &machine, int index) { tilemap_t *tmap; /* find by the tilemap index */ - for (tmap = machine->tilemap_data->list; tmap != NULL; tmap = tmap->next) + for (tmap = machine.tilemap_data->list; tmap != NULL; tmap = tmap->next) if (index-- == 0) return tmap; @@ -266,9 +268,9 @@ INLINE int gfx_elements_changed(tilemap_t *tmap) /* iterate over all used gfx types and set the dirty flag if any of them have changed */ for (gfxnum = 0; usedmask != 0; usedmask >>= 1, gfxnum++) if ((usedmask & 1) != 0) - if (tmap->gfx_dirtyseq[gfxnum] != tmap->machine->gfx[gfxnum]->dirtyseq) + if (tmap->gfx_dirtyseq[gfxnum] != tmap->machine().gfx[gfxnum]->dirtyseq) { - tmap->gfx_dirtyseq[gfxnum] = tmap->machine->gfx[gfxnum]->dirtyseq; + tmap->gfx_dirtyseq[gfxnum] = tmap->machine().gfx[gfxnum]->dirtyseq; isdirty = TRUE; } @@ -284,20 +286,20 @@ INLINE int gfx_elements_changed(tilemap_t *tmap) tilemap_init - initialize the tilemap system -------------------------------------------------*/ -void tilemap_init(running_machine *machine) +void tilemap_init(running_machine &machine) { UINT32 screen_width, screen_height; - if (machine->primary_screen == NULL) + if (machine.primary_screen == NULL) return; - screen_width = machine->primary_screen->width(); - screen_height = machine->primary_screen->height(); + screen_width = machine.primary_screen->width(); + screen_height = machine.primary_screen->height(); if (screen_width != 0 && screen_height != 0) { - machine->priority_bitmap = auto_bitmap_alloc(machine, screen_width, screen_height, BITMAP_FORMAT_INDEXED8); - machine->add_notifier(MACHINE_NOTIFY_EXIT, tilemap_exit); + machine.priority_bitmap = auto_bitmap_alloc(machine, screen_width, screen_height, BITMAP_FORMAT_INDEXED8); + machine.add_notifier(MACHINE_NOTIFY_EXIT, tilemap_exit); } } @@ -311,9 +313,9 @@ void tilemap_init(running_machine *machine) tilemap_create - create a new tilemap -------------------------------------------------*/ -tilemap_t *tilemap_create(running_machine *machine, tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows) +tilemap_t *tilemap_create(running_machine &machine, tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows) { - return tilemap_create_common(machine, (void *)machine, tile_get_info, mapper, tilewidth, tileheight, cols, rows); + return tilemap_create_common(machine, (void *)&machine, tile_get_info, mapper, tilewidth, tileheight, cols, rows); } @@ -324,7 +326,7 @@ tilemap_t *tilemap_create(running_machine *machine, tile_get_info_func tile_get_ tilemap_t *tilemap_create_device(device_t *device, tile_get_info_device_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows) { - return tilemap_create_common(device->machine, (void *)device, (tile_get_info_func)tile_get_info, mapper, tilewidth, tileheight, cols, rows); + return tilemap_create_common(device->machine(), (void *)device, (tile_get_info_func)tile_get_info, mapper, tilewidth, tileheight, cols, rows); } @@ -333,25 +335,25 @@ tilemap_t *tilemap_create_device(device_t *device, tile_get_info_device_func til function -------------------------------------------------*/ -static tilemap_t *tilemap_create_common(running_machine *machine, void *get_info_object, tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows) +static tilemap_t *tilemap_create_common(running_machine &machine, void *get_info_object, tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows) { tilemap_t *tmap; int tilemap_instance; int group; /* if no tilemap private data yet, allocate it */ - if (machine->tilemap_data == NULL) + if (machine.tilemap_data == NULL) { - machine->tilemap_data = auto_alloc_clear(machine, tilemap_private); - machine->tilemap_data->tailptr = &machine->tilemap_data->list; + machine.tilemap_data = auto_alloc_clear(machine, tilemap_private); + machine.tilemap_data->tailptr = &machine.tilemap_data->list; } - tilemap_instance = machine->tilemap_data->instance; + tilemap_instance = machine.tilemap_data->instance; /* allocate the tilemap itself */ tmap = auto_alloc_clear(machine, tilemap_t); /* fill in the basic metrics */ - tmap->machine = machine; + tmap->m_machine = &machine; tmap->rows = rows; tmap->cols = cols; tmap->tilewidth = tilewidth; @@ -392,26 +394,26 @@ static tilemap_t *tilemap_create_common(running_machine *machine, void *get_info tilemap_map_pens_to_layer(tmap, group, 0, 0, TILEMAP_PIXEL_LAYER0); /* add us to the end of the list of tilemaps */ - *machine->tilemap_data->tailptr = tmap; - machine->tilemap_data->tailptr = &tmap->next; + *machine.tilemap_data->tailptr = tmap; + machine.tilemap_data->tailptr = &tmap->next; /* save relevant state */ - machine->state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->enable)); - machine->state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->attributes)); - machine->state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->palette_offset)); - machine->state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->pen_data_offset)); - machine->state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->scrollrows)); - machine->state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->scrollcols)); - machine->state().save_pointer("tilemap", NULL, tilemap_instance, NAME(tmap->rowscroll), rows * tileheight); - machine->state().save_pointer("tilemap", NULL, tilemap_instance, NAME(tmap->colscroll), cols * tilewidth); - machine->state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->dx)); - machine->state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->dx_flipped)); - machine->state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->dy)); - machine->state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->dy_flipped)); - machine->tilemap_data->instance++; + machine.state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->enable)); + machine.state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->attributes)); + machine.state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->palette_offset)); + machine.state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->pen_data_offset)); + machine.state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->scrollrows)); + machine.state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->scrollcols)); + machine.state().save_pointer("tilemap", NULL, tilemap_instance, NAME(tmap->rowscroll), rows * tileheight); + machine.state().save_pointer("tilemap", NULL, tilemap_instance, NAME(tmap->colscroll), cols * tilewidth); + machine.state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->dx)); + machine.state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->dx_flipped)); + machine.state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->dy)); + machine.state().save_item("tilemap", NULL, tilemap_instance, NAME(tmap->dy_flipped)); + machine.tilemap_data->instance++; /* reset everything after a load */ - machine->state().register_postload(tilemap_postload, tmap); + machine.state().register_postload(tilemap_postload, tmap); return tmap; } @@ -482,14 +484,14 @@ void tilemap_set_flip(tilemap_t *tmap, UINT32 attributes) the tilemaps -------------------------------------------------*/ -void tilemap_set_flip_all(running_machine *machine, UINT32 attributes) +void tilemap_set_flip_all(running_machine &machine, UINT32 attributes) { tilemap_t *tmap; - if (machine->tilemap_data == NULL) + if (machine.tilemap_data == NULL) return; - for (tmap = machine->tilemap_data->list; tmap != NULL; tmap = tmap->next) + for (tmap = machine.tilemap_data->list; tmap != NULL; tmap = tmap->next) tilemap_set_flip(tmap, attributes); } @@ -539,10 +541,10 @@ void tilemap_mark_all_tiles_dirty(tilemap_t *tmap) tiles in all the tilemaps dirty -------------------------------------------------*/ -void tilemap_mark_all_tiles_dirty_all(running_machine *machine) +void tilemap_mark_all_tiles_dirty_all(running_machine &machine) { tilemap_t *tmap; - for (tmap = machine->tilemap_data->list; tmap != NULL; tmap = tmap->next) + for (tmap = machine.tilemap_data->list; tmap != NULL; tmap = tmap->next) tilemap_mark_all_tiles_dirty(tmap); } @@ -836,8 +838,8 @@ g_profiler.start(PROFILER_TILEMAP_DRAW); tmap->gfx_used = 0; } - width = tmap->machine->primary_screen->width(); - height = tmap->machine->primary_screen->height(); + width = tmap->machine().primary_screen->width(); + height = tmap->machine().primary_screen->height(); /* XY scrolling playfield */ if (tmap->scrollrows == 1 && tmap->scrollcols == 1) @@ -984,16 +986,16 @@ g_profiler.stop(); tilemap_count - return the number of tilemaps -------------------------------------------------*/ -int tilemap_count(running_machine *machine) +int tilemap_count(running_machine &machine) { tilemap_t *tmap; int count = 0; - if (machine->tilemap_data == NULL) + if (machine.tilemap_data == NULL) return 0; /* find by the tilemap index */ - for (tmap = machine->tilemap_data->list; tmap != NULL; tmap = tmap->next) + for (tmap = machine.tilemap_data->list; tmap != NULL; tmap = tmap->next) count++; return count; } @@ -1004,7 +1006,7 @@ int tilemap_count(running_machine *machine) indexed tilemap -------------------------------------------------*/ -void tilemap_size_by_index(running_machine *machine, int number, UINT32 *width, UINT32 *height) +void tilemap_size_by_index(running_machine &machine, int number, UINT32 *width, UINT32 *height) { tilemap_t *tmap = indexed_tilemap(machine, number); *width = tmap->width; @@ -1018,7 +1020,7 @@ void tilemap_size_by_index(running_machine *machine, int number, UINT32 *width, priority) -------------------------------------------------*/ -void tilemap_draw_by_index(running_machine *machine, bitmap_t *dest, int number, UINT32 scrollx, UINT32 scrolly) +void tilemap_draw_by_index(running_machine &machine, bitmap_t *dest, int number, UINT32 scrollx, UINT32 scrolly) { tilemap_t *tmap = indexed_tilemap(machine, number); blit_parameters blit; @@ -1156,7 +1158,7 @@ static void tilemap_dispose(tilemap_t *tmap) tilemap_t **tmapptr; /* walk the list of tilemaps; when we find ourself, remove it */ - for (tmapptr = &tmap->machine->tilemap_data->list; *tmapptr != NULL; tmapptr = &(*tmapptr)->next) + for (tmapptr = &tmap->machine().tilemap_data->list; *tmapptr != NULL; tmapptr = &(*tmapptr)->next) if (*tmapptr == tmap) { *tmapptr = tmap->next; @@ -1164,15 +1166,15 @@ static void tilemap_dispose(tilemap_t *tmap) } /* free allocated memory */ - auto_free(tmap->machine, tmap->pen_to_flags); - auto_free(tmap->machine, tmap->tileflags); - auto_free(tmap->machine, tmap->flagsmap); - auto_free(tmap->machine, tmap->pixmap); - auto_free(tmap->machine, tmap->colscroll); - auto_free(tmap->machine, tmap->rowscroll); - auto_free(tmap->machine, tmap->logical_to_memory); - auto_free(tmap->machine, tmap->memory_to_logical); - auto_free(tmap->machine, tmap); + auto_free(tmap->machine(), tmap->pen_to_flags); + auto_free(tmap->machine(), tmap->tileflags); + auto_free(tmap->machine(), tmap->flagsmap); + auto_free(tmap->machine(), tmap->pixmap); + auto_free(tmap->machine(), tmap->colscroll); + auto_free(tmap->machine(), tmap->rowscroll); + auto_free(tmap->machine(), tmap->logical_to_memory); + auto_free(tmap->machine(), tmap->memory_to_logical); + auto_free(tmap->machine(), tmap); } @@ -1204,8 +1206,8 @@ static void mappings_create(tilemap_t *tmap) tmap->max_memory_index++; /* allocate the necessary mappings */ - tmap->memory_to_logical = auto_alloc_array(tmap->machine, tilemap_logical_index, tmap->max_memory_index); - tmap->logical_to_memory = auto_alloc_array(tmap->machine, tilemap_memory_index, tmap->max_logical_index); + tmap->memory_to_logical = auto_alloc_array(tmap->machine(), tilemap_logical_index, tmap->max_memory_index); + tmap->logical_to_memory = auto_alloc_array(tmap->machine(), tilemap_memory_index, tmap->max_logical_index); /* update the mappings */ mappings_update(tmap); @@ -1333,7 +1335,7 @@ g_profiler.start(PROFILER_TILEMAP_UPDATE); /* call the get info callback for the associated memory index */ memindex = tmap->logical_to_memory[logindex]; - (*tmap->tile_get_info)((running_machine *)tmap->tile_get_info_object, &tmap->tileinfo, memindex, tmap->user_data); + (*tmap->tile_get_info)(*(running_machine *)tmap->tile_get_info_object, &tmap->tileinfo, memindex, tmap->user_data); /* apply the global tilemap flip to the returned flip flags */ flags = tmap->tileinfo.flags ^ (tmap->attributes & 0x03); @@ -1350,7 +1352,7 @@ g_profiler.start(PROFILER_TILEMAP_UPDATE); if (tmap->tileinfo.gfxnum != 0xff && (tmap->gfx_used & (1 << tmap->tileinfo.gfxnum)) == 0) { tmap->gfx_used |= 1 << tmap->tileinfo.gfxnum; - tmap->gfx_dirtyseq[tmap->tileinfo.gfxnum] = tmap->machine->gfx[tmap->tileinfo.gfxnum]->dirtyseq; + tmap->gfx_dirtyseq[tmap->tileinfo.gfxnum] = tmap->machine().gfx[tmap->tileinfo.gfxnum]->dirtyseq; } g_profiler.stop(); @@ -1615,7 +1617,7 @@ static void configure_blit_parameters(blit_parameters *blit, tilemap_t *tmap, bi static void tilemap_draw_instance(tilemap_t *tmap, const blit_parameters *blit, int xpos, int ypos) { - bitmap_t *priority_bitmap = tmap->machine->priority_bitmap; + bitmap_t *priority_bitmap = tmap->machine().priority_bitmap; bitmap_t *dest = blit->bitmap; const UINT16 *source_baseaddr; const UINT8 *mask_baseaddr; @@ -1724,7 +1726,7 @@ static void tilemap_draw_instance(tilemap_t *tmap, const blit_parameters *blit, { for (cury = y; cury < nexty; cury++) { - (*blit->draw_opaque)(dest0, source0, x_end - x_start, tmap->machine->pens, pmap0, blit->tilemap_priority_code, blit->alpha); + (*blit->draw_opaque)(dest0, source0, x_end - x_start, tmap->machine().pens, pmap0, blit->tilemap_priority_code, blit->alpha); dest0 = (UINT8 *)dest0 + dest_line_pitch_bytes; source0 += tmap->pixmap->rowpixels; @@ -1738,7 +1740,7 @@ static void tilemap_draw_instance(tilemap_t *tmap, const blit_parameters *blit, const UINT8 *mask0 = mask_baseaddr + x_start; for (cury = y; cury < nexty; cury++) { - (*blit->draw_masked)(dest0, source0, mask0, blit->mask, blit->value, x_end - x_start, tmap->machine->pens, pmap0, blit->tilemap_priority_code, blit->alpha); + (*blit->draw_masked)(dest0, source0, mask0, blit->mask, blit->value, x_end - x_start, tmap->machine().pens, pmap0, blit->tilemap_priority_code, blit->alpha); dest0 = (UINT8 *)dest0 + dest_line_pitch_bytes; source0 += tmap->pixmap->rowpixels; @@ -1794,8 +1796,8 @@ do { \ static void tilemap_draw_roz_core(tilemap_t *tmap, const blit_parameters *blit, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound) { - const pen_t *clut = &tmap->machine->pens[blit->tilemap_priority_code >> 16]; - bitmap_t *priority_bitmap = tmap->machine->priority_bitmap; + const pen_t *clut = &tmap->machine().pens[blit->tilemap_priority_code >> 16]; + bitmap_t *priority_bitmap = tmap->machine().priority_bitmap; bitmap_t *destbitmap = blit->bitmap; bitmap_t *srcbitmap = tmap->pixmap; bitmap_t *flagsmap = tmap->flagsmap; diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h index 9c83c91ff47..0f9b750b05d 100644 --- a/src/emu/tilemap.h +++ b/src/emu/tilemap.h @@ -173,7 +173,7 @@ // set the common info for the tile SET_TILE_INFO( - 1, // use machine->gfx[1] for tile graphics + 1, // use machine.gfx[1] for tile graphics code, // the index of the graphics for this tile color, // the color to use for this tile (flipx ? TILE_FLIPX : 0) | // flags for this tile; also @@ -354,7 +354,7 @@ ***************************************************************************/ /* function definition for a get info callback */ -#define TILE_GET_INFO(_name) void _name(running_machine *machine, tile_data *tileinfo, tilemap_memory_index tile_index, void *param) +#define TILE_GET_INFO(_name) void _name(running_machine &machine, tile_data *tileinfo, tilemap_memory_index tile_index, void *param) #define TILE_GET_INFO_DEVICE(_name) void _name(device_t *device, tile_data *tileinfo, tilemap_memory_index tile_index, void *param) /* function definition for a logical-to-memory mapper */ @@ -362,7 +362,7 @@ /* useful macro inside of a TILE_GET_INFO callback to set tile information */ #define SET_TILE_INFO(GFX,CODE,COLOR,FLAGS) tileinfo_set(machine, tileinfo, GFX, CODE, COLOR, FLAGS) -#define SET_TILE_INFO_DEVICE(GFX,CODE,COLOR,FLAGS) tileinfo_set(device->machine, tileinfo, GFX, CODE, COLOR, FLAGS) +#define SET_TILE_INFO_DEVICE(GFX,CODE,COLOR,FLAGS) tileinfo_set(device->machine(), tileinfo, GFX, CODE, COLOR, FLAGS) /* Macros for setting tile attributes in the TILE_GET_INFO callback: */ /* TILE_FLIP_YX assumes that flipy is in bit 1 and flipx is in bit 0 */ @@ -394,12 +394,12 @@ struct _tile_data UINT8 group; /* defaults to 0; range from 0..TILEMAP_NUM_GROUPS */ UINT8 flags; /* defaults to 0; one or more of TILE_* flags above */ UINT8 pen_mask; /* defaults to 0xff; mask to apply to pen_data while rendering the tile */ - UINT8 gfxnum; /* defaults to 0xff; specify index of machine->gfx for auto-invalidation on dirty */ + UINT8 gfxnum; /* defaults to 0xff; specify index of machine.gfx for auto-invalidation on dirty */ }; /* callback function to get info about a tile */ -typedef void (*tile_get_info_func)(running_machine *machine, tile_data *tileinfo, tilemap_memory_index tile_index, void *param); +typedef void (*tile_get_info_func)(running_machine &machine, tile_data *tileinfo, tilemap_memory_index tile_index, void *param); typedef void (*tile_get_info_device_func)(device_t *device, tile_data *tileinfo, tilemap_memory_index tile_index, void *param); /* callback function to map a column,row pair to a memory index */ @@ -415,14 +415,14 @@ typedef tilemap_memory_index (*tilemap_mapper_func)(UINT32 col, UINT32 row, UINT /* ----- system-wide management ----- */ /* initialize the tilemap system -- not for use by drivers */ -void tilemap_init(running_machine *machine); +void tilemap_init(running_machine &machine); /* ----- tilemap creation and configuration ----- */ /* create a new tilemap; note that tilemaps are tracked by the core so there is no dispose */ -tilemap_t *tilemap_create(running_machine *machine, tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows); +tilemap_t *tilemap_create(running_machine &machine, tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows); /* create a new tilemap that is owned by a device */ tilemap_t *tilemap_create_device(device_t *device, tile_get_info_device_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows); @@ -446,7 +446,7 @@ int tilemap_get_enable(tilemap_t *tmap); void tilemap_set_flip(tilemap_t *tmap, UINT32 attributes); /* set a global flip for all tilemaps */ -void tilemap_set_flip_all(running_machine *machine, UINT32 attributes); +void tilemap_set_flip_all(running_machine &machine, UINT32 attributes); @@ -459,7 +459,7 @@ void tilemap_mark_tile_dirty(tilemap_t *tmap, tilemap_memory_index memory_index) void tilemap_mark_all_tiles_dirty(tilemap_t *tmap); /* mark all the tiles dirty in all tilemaps */ -void tilemap_mark_all_tiles_dirty_all(running_machine *machine); +void tilemap_mark_all_tiles_dirty_all(running_machine &machine); @@ -531,13 +531,13 @@ void tilemap_draw_roz_primask(bitmap_t *dest, const rectangle *cliprect, tilemap /* ----- indexed tilemap handling ----- */ /* return the number of tilemaps */ -int tilemap_count(running_machine *machine); +int tilemap_count(running_machine &machine); /* return the size of an indexed tilemap */ -void tilemap_size_by_index(running_machine *machine, int number, UINT32 *width, UINT32 *height); +void tilemap_size_by_index(running_machine &machine, int number, UINT32 *width, UINT32 *height); /* render an indexed tilemap with fixed characteristics (no priority) */ -void tilemap_draw_by_index(running_machine *machine, bitmap_t *dest, int number, UINT32 scrollx, UINT32 scrolly); +void tilemap_draw_by_index(running_machine &machine, bitmap_t *dest, int number, UINT32 scrollx, UINT32 scrolly); @@ -566,9 +566,9 @@ TILEMAP_MAPPER( tilemap_scan_cols_flip_xy ); structure -------------------------------------------------*/ -INLINE void tileinfo_set(running_machine *machine, tile_data *tileinfo, int gfxnum, int rawcode, int rawcolor, int flags) +INLINE void tileinfo_set(running_machine &machine, tile_data *tileinfo, int gfxnum, int rawcode, int rawcolor, int flags) { - const gfx_element *gfx = machine->gfx[gfxnum]; + const gfx_element *gfx = machine.gfx[gfxnum]; int code = rawcode % gfx->total_elements; tileinfo->pen_data = gfx_element_get_data(gfx, code); tileinfo->palette_base = gfx->color_base + gfx->color_granularity * rawcolor; diff --git a/src/emu/timer.c b/src/emu/timer.c index bc9a4e8d396..eb4a2020ef9 100644 --- a/src/emu/timer.c +++ b/src/emu/timer.c @@ -100,7 +100,7 @@ device_config *timer_device_config::static_alloc_device_config(const machine_con device_t *timer_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, timer_device(machine, *this)); + return auto_alloc(machine, timer_device(machine, *this)); } @@ -280,7 +280,7 @@ void timer_device::device_start() { // fetch the screen if (m_config.m_screen != NULL) - m_screen = downcast<screen_device *>(machine->device(m_config.m_screen)); + m_screen = downcast<screen_device *>(m_machine.device(m_config.m_screen)); // allocate the timer m_timer = timer_alloc(); diff --git a/src/emu/ui.c b/src/emu/ui.c index 6fa9834c12d..61110734aca 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -93,7 +93,7 @@ static const input_item_id non_char_keys[] = static render_font *ui_font; /* current UI handler */ -static UINT32 (*ui_handler_callback)(running_machine *, render_container *, UINT32); +static UINT32 (*ui_handler_callback)(running_machine &, render_container *, UINT32); static UINT32 ui_handler_param; /* flag to track single stepping */ @@ -129,42 +129,42 @@ static UINT8 non_char_keys_down[(ARRAY_LENGTH(non_char_keys) + 7) / 8]; static void ui_exit(running_machine &machine); /* text generators */ -static astring &disclaimer_string(running_machine *machine, astring &buffer); -static astring &warnings_string(running_machine *machine, astring &buffer); +static astring &disclaimer_string(running_machine &machine, astring &buffer); +static astring &warnings_string(running_machine &machine, astring &buffer); /* UI handlers */ -static UINT32 handler_messagebox(running_machine *machine, render_container *container, UINT32 state); -static UINT32 handler_messagebox_ok(running_machine *machine, render_container *container, UINT32 state); -static UINT32 handler_messagebox_anykey(running_machine *machine, render_container *container, UINT32 state); -static UINT32 handler_ingame(running_machine *machine, render_container *container, UINT32 state); -static UINT32 handler_load_save(running_machine *machine, render_container *container, UINT32 state); +static UINT32 handler_messagebox(running_machine &machine, render_container *container, UINT32 state); +static UINT32 handler_messagebox_ok(running_machine &machine, render_container *container, UINT32 state); +static UINT32 handler_messagebox_anykey(running_machine &machine, render_container *container, UINT32 state); +static UINT32 handler_ingame(running_machine &machine, render_container *container, UINT32 state); +static UINT32 handler_load_save(running_machine &machine, render_container *container, UINT32 state); /* slider controls */ -static slider_state *slider_alloc(running_machine *machine, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg); -static slider_state *slider_init(running_machine *machine); -static INT32 slider_volume(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_mixervol(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_adjuster(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_overclock(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_refresh(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_brightness(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_contrast(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_gamma(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_xscale(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_yscale(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_xoffset(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_yoffset(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_overxscale(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_overyscale(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_overxoffset(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_overyoffset(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_flicker(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_beam(running_machine *machine, void *arg, astring *string, INT32 newval); +static slider_state *slider_alloc(running_machine &machine, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg); +static slider_state *slider_init(running_machine &machine); +static INT32 slider_volume(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_mixervol(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_adjuster(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_overclock(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_refresh(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_brightness(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_contrast(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_gamma(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_xscale(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_yscale(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_xoffset(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_yoffset(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_overxscale(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_overyscale(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_overxoffset(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_overyoffset(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_flicker(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_beam(running_machine &machine, void *arg, astring *string, INT32 newval); static char *slider_get_screen_desc(screen_device &screen); static char *slider_get_laserdisc_desc(device_t *screen); #ifdef MAME_DEBUG -static INT32 slider_crossscale(running_machine *machine, void *arg, astring *string, INT32 newval); -static INT32 slider_crossoffset(running_machine *machine, void *arg, astring *string, INT32 newval); +static INT32 slider_crossscale(running_machine &machine, void *arg, astring *string, INT32 newval); +static INT32 slider_crossoffset(running_machine &machine, void *arg, astring *string, INT32 newval); #endif @@ -177,7 +177,7 @@ static INT32 slider_crossoffset(running_machine *machine, void *arg, astring *st pair for the current UI handler -------------------------------------------------*/ -INLINE UINT32 ui_set_handler(UINT32 (*callback)(running_machine *, render_container *, UINT32), UINT32 param) +INLINE UINT32 ui_set_handler(UINT32 (*callback)(running_machine &, render_container *, UINT32), UINT32 param) { ui_handler_callback = callback; ui_handler_param = param; @@ -234,10 +234,10 @@ INLINE int is_breakable_char(unicode_char ch) ui_init - set up the user interface -------------------------------------------------*/ -int ui_init(running_machine *machine) +int ui_init(running_machine &machine) { /* make sure we clean up after ourselves */ - machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_exit); + machine.add_notifier(MACHINE_NOTIFY_EXIT, ui_exit); /* initialize the other UI bits */ ui_menu_init(machine); @@ -247,7 +247,7 @@ int ui_init(running_machine *machine) single_step = FALSE; ui_set_handler(handler_messagebox, 0); /* retrieve options */ - ui_use_natural_keyboard = machine->options().natural_keyboard(); + ui_use_natural_keyboard = machine.options().natural_keyboard(); return 0; } @@ -270,17 +270,17 @@ static void ui_exit(running_machine &machine) various startup screens -------------------------------------------------*/ -int ui_display_startup_screens(running_machine *machine, int first_time, int show_disclaimer) +int ui_display_startup_screens(running_machine &machine, int first_time, int show_disclaimer) { const int maxstate = 3; - int str = machine->options().seconds_to_run(); - int show_gameinfo = !machine->options().skip_gameinfo(); + int str = machine.options().seconds_to_run(); + int show_gameinfo = !machine.options().skip_gameinfo(); int show_warnings = TRUE; int state; /* 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->system() == &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 */ @@ -288,7 +288,7 @@ int ui_display_startup_screens(running_machine *machine, int first_time, int sho /* loop over states */ ui_set_handler(handler_ingame, 0); - for (state = 0; state < maxstate && !machine->scheduled_event_pending() && !ui_menu_is_force_game_select(); state++) + for (state = 0; state < maxstate && !machine.scheduled_event_pending() && !ui_menu_is_force_game_select(); state++) { /* default to standard colors */ messagebox_backcolor = UI_BACKGROUND_COLOR; @@ -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->system().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->system().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; @@ -323,12 +323,12 @@ int ui_display_startup_screens(running_machine *machine, int first_time, int sho while (input_code_poll_switches(machine, FALSE) != INPUT_CODE_INVALID) ; /* loop while we have a handler */ - while (ui_handler_callback != handler_ingame && !machine->scheduled_event_pending() && !ui_menu_is_force_game_select()) - machine->video().frame_update(); + while (ui_handler_callback != handler_ingame && !machine.scheduled_event_pending() && !ui_menu_is_force_game_select()) + machine.video().frame_update(); /* clear the handler and force an update */ ui_set_handler(handler_ingame, 0); - machine->video().frame_update(); + machine.video().frame_update(); } /* if we're the empty driver, force the menus on */ @@ -344,7 +344,7 @@ int ui_display_startup_screens(running_machine *machine, int first_time, int sho at startup -------------------------------------------------*/ -void ui_set_startup_text(running_machine *machine, const char *text, int force) +void ui_set_startup_text(running_machine &machine, const char *text, int force) { static osd_ticks_t lastupdatetime = 0; osd_ticks_t curtime = osd_ticks(); @@ -357,7 +357,7 @@ void ui_set_startup_text(running_machine *machine, const char *text, int force) if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4) { lastupdatetime = curtime; - machine->video().frame_update(); + machine.video().frame_update(); } } @@ -367,15 +367,15 @@ void ui_set_startup_text(running_machine *machine, const char *text, int force) render it; called by video.c -------------------------------------------------*/ -void ui_update_and_render(running_machine *machine, render_container *container) +void ui_update_and_render(running_machine &machine, render_container *container) { /* always start clean */ container->empty(); /* if we're paused, dim the whole screen */ - if (machine->phase() >= MACHINE_PHASE_RESET && (single_step || machine->paused())) + if (machine.phase() >= MACHINE_PHASE_RESET && (single_step || machine.paused())) { - int alpha = (1.0f - machine->options().pause_brightness()) * 255.0f; + int alpha = (1.0f - machine.options().pause_brightness()) * 255.0f; if (ui_menu_is_force_game_select()) alpha = 255; if (alpha > 255) @@ -385,8 +385,8 @@ void ui_update_and_render(running_machine *machine, render_container *container) } /* render any cheat stuff at the bottom */ - if (machine->phase() >= MACHINE_PHASE_RESET) - machine->cheat().render_text(*container); + if (machine.phase() >= MACHINE_PHASE_RESET) + machine.cheat().render_text(*container); /* call the current UI handler */ assert(ui_handler_callback != NULL); @@ -880,10 +880,10 @@ int ui_is_menu_active(void) text to the given buffer -------------------------------------------------*/ -static astring &disclaimer_string(running_machine *machine, astring &string) +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->system().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; } @@ -894,7 +894,7 @@ static astring &disclaimer_string(running_machine *machine, astring &string) text to the given buffer -------------------------------------------------*/ -static astring &warnings_string(running_machine *machine, astring &string) +static astring &warnings_string(running_machine &machine, astring &string) { #define WARNING_FLAGS ( GAME_NOT_WORKING | \ GAME_UNEMULATED_PROTECTION | \ @@ -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->system().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->system().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->system().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->system().flags & GAME_IMPERFECT_COLORS) + if (machine.system().flags & GAME_IMPERFECT_COLORS) string.cat("The colors aren't 100% accurate.\n"); - if (machine->system().flags & GAME_WRONG_COLORS) + if (machine.system().flags & GAME_WRONG_COLORS) string.cat("The colors are completely wrong.\n"); - if (machine->system().flags & GAME_IMPERFECT_GRAPHICS) + if (machine.system().flags & GAME_IMPERFECT_GRAPHICS) string.cat("The video emulation isn't 100% accurate.\n"); - if (machine->system().flags & GAME_IMPERFECT_SOUND) + if (machine.system().flags & GAME_IMPERFECT_SOUND) string.cat("The sound emulation isn't 100% accurate.\n"); - if (machine->system().flags & GAME_NO_SOUND) + if (machine.system().flags & GAME_NO_SOUND) string.cat("The game lacks sound.\n"); - if (machine->system().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->system().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->system().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->system().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->system().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->system().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->system()); + clone_of = driver_get_clone(&machine.system()); if (clone_of != NULL && !(clone_of->flags & GAME_IS_BIOS_ROOT)) maindrv = clone_of; else - maindrv = &machine->system(); + maindrv = &machine.system(); /* scan the driver list for any working clones and add them */ foundworking = FALSE; @@ -1007,17 +1007,17 @@ static astring &warnings_string(running_machine *machine, astring &string) string with the game info text -------------------------------------------------*/ -astring &game_info_astring(running_machine *machine, astring &string) +astring &game_info_astring(running_machine &machine, astring &string) { - int scrcount = machine->m_devicelist.count(SCREEN); + int scrcount = machine.m_devicelist.count(SCREEN); int found_sound = FALSE; /* print description, manufacturer, and CPU: */ - string.printf("%s\n%s %s\n\nCPU:\n", machine->system().description, machine->system().year, machine->system().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; - for (bool gotone = machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) + for (bool gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec)) { /* get cpu specific clock that takes internal multiplier/dividers into account */ int clock = exec->device().clock(); @@ -1047,7 +1047,7 @@ astring &game_info_astring(running_machine *machine, astring &string) /* loop over all sound chips */ device_sound_interface *sound = NULL; - for (bool gotone = machine->m_devicelist.first(sound); gotone; gotone = sound->next(sound)) + for (bool gotone = machine.m_devicelist.first(sound); gotone; gotone = sound->next(sound)) { /* append the Sound: string */ if (!found_sound) @@ -1086,7 +1086,7 @@ astring &game_info_astring(running_machine *machine, astring &string) string.cat("None\n"); else { - for (screen_device *screen = machine->first_screen(); screen != NULL; screen = screen->next_screen()) + for (screen_device *screen = machine.first_screen(); screen != NULL; screen = screen->next_screen()) { if (scrcount > 1) { @@ -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->system().flags & ORIENTATION_SWAP_XY) ? "V" : "H", + (machine.system().flags & ORIENTATION_SWAP_XY) ? "V" : "H", ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds)); } } @@ -1123,7 +1123,7 @@ astring &game_info_astring(running_machine *machine, astring &string) messagebox_text string but handles no input -------------------------------------------------*/ -static UINT32 handler_messagebox(running_machine *machine, render_container *container, UINT32 state) +static UINT32 handler_messagebox(running_machine &machine, render_container *container, UINT32 state) { ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); return 0; @@ -1135,7 +1135,7 @@ static UINT32 handler_messagebox(running_machine *machine, render_container *con messagebox_text string and waits for an OK -------------------------------------------------*/ -static UINT32 handler_messagebox_ok(running_machine *machine, render_container *container, UINT32 state) +static UINT32 handler_messagebox_ok(running_machine &machine, render_container *container, UINT32 state) { /* draw a standard message window */ ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); @@ -1151,7 +1151,7 @@ static UINT32 handler_messagebox_ok(running_machine *machine, render_container * /* if the user cancels, exit out completely */ else if (ui_input_pressed(machine, IPT_UI_CANCEL)) { - machine->schedule_exit(); + machine.schedule_exit(); state = UI_HANDLER_CANCEL; } @@ -1165,7 +1165,7 @@ static UINT32 handler_messagebox_ok(running_machine *machine, render_container * any keypress -------------------------------------------------*/ -static UINT32 handler_messagebox_anykey(running_machine *machine, render_container *container, UINT32 state) +static UINT32 handler_messagebox_anykey(running_machine &machine, render_container *container, UINT32 state) { /* draw a standard message window */ ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); @@ -1173,7 +1173,7 @@ static UINT32 handler_messagebox_anykey(running_machine *machine, render_contain /* if the user cancels, exit out completely */ if (ui_input_pressed(machine, IPT_UI_CANCEL)) { - machine->schedule_exit(); + machine.schedule_exit(); state = UI_HANDLER_CANCEL; } @@ -1189,7 +1189,7 @@ static UINT32 handler_messagebox_anykey(running_machine *machine, render_contain natural keyboard input -------------------------------------------------*/ -static void process_natural_keyboard(running_machine *machine) +static void process_natural_keyboard(running_machine &machine) { ui_event event; int i, pressed; @@ -1240,7 +1240,7 @@ static void process_natural_keyboard(running_machine *machine) ui_paste - does a paste from the keyboard -------------------------------------------------*/ -void ui_paste(running_machine *machine) +void ui_paste(running_machine &machine) { /* retrieve the clipboard text */ char *text = osd_get_clipboard_text(); @@ -1261,14 +1261,14 @@ void ui_paste(running_machine *machine) callback function for each image device -------------------------------------------------*/ -void ui_image_handler_ingame(running_machine *machine) +void ui_image_handler_ingame(running_machine &machine) { device_image_interface *image = NULL; /* run display routine for devices */ - if (machine->phase() == MACHINE_PHASE_RUNNING) + if (machine.phase() == MACHINE_PHASE_RUNNING) { - for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image)) + for (bool gotone = machine.m_devicelist.first(image); gotone; gotone = image->next(image)) { image->call_display(); } @@ -1281,15 +1281,15 @@ void ui_image_handler_ingame(running_machine *machine) of the standard keypresses -------------------------------------------------*/ -static UINT32 handler_ingame(running_machine *machine, render_container *container, UINT32 state) +static UINT32 handler_ingame(running_machine &machine, render_container *container, UINT32 state) { - bool is_paused = machine->paused(); + bool is_paused = machine.paused(); /* first draw the FPS counter */ if (showfps || osd_ticks() < showfps_end) { astring tempstring; - ui_draw_text_full(container, machine->video().speed_text(tempstring), 0.0f, 0.0f, 1.0f, + ui_draw_text_full(container, machine.video().speed_text(tempstring), 0.0f, 0.0f, 1.0f, JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL); } else @@ -1299,19 +1299,19 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain if (show_profiler) { astring profilertext; - g_profiler.text(*machine, profilertext); + g_profiler.text(machine, profilertext); ui_draw_text_full(container, profilertext, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL); } /* if we're single-stepping, pause now */ if (single_step) { - machine->pause(); + machine.pause(); single_step = FALSE; } /* 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->set_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", @@ -1347,7 +1347,7 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain } /* is the natural keyboard enabled? */ - if (ui_get_use_natural_keyboard(machine) && (machine->phase() == MACHINE_PHASE_RUNNING)) + if (ui_get_use_natural_keyboard(machine) && (machine.phase() == MACHINE_PHASE_RUNNING)) process_natural_keyboard(machine); if (!ui_disabled) @@ -1362,47 +1362,47 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain if (ui_disabled) return ui_disabled; if (ui_input_pressed(machine, IPT_UI_CANCEL)) - machine->schedule_exit(); + machine.schedule_exit(); /* turn on menus if requested */ if (ui_input_pressed(machine, IPT_UI_CONFIGURE)) return ui_set_handler(ui_menu_ui_handler, 0); /* if the on-screen display isn't up and the user has toggled it, turn it on */ - if ((machine->debug_flags & DEBUG_FLAG_ENABLED) == 0 && ui_input_pressed(machine, IPT_UI_ON_SCREEN_DISPLAY)) + if ((machine.debug_flags & DEBUG_FLAG_ENABLED) == 0 && ui_input_pressed(machine, IPT_UI_ON_SCREEN_DISPLAY)) return ui_set_handler(ui_slider_ui_handler, 1); /* handle a reset request */ if (ui_input_pressed(machine, IPT_UI_RESET_MACHINE)) - machine->schedule_hard_reset(); + machine.schedule_hard_reset(); if (ui_input_pressed(machine, IPT_UI_SOFT_RESET)) - machine->schedule_soft_reset(); + machine.schedule_soft_reset(); /* handle a request to display graphics/palette */ if (ui_input_pressed(machine, IPT_UI_SHOW_GFX)) { if (!is_paused) - machine->pause(); + machine.pause(); return ui_set_handler(ui_gfx_ui_handler, is_paused); } /* handle a save state request */ if (ui_input_pressed(machine, IPT_UI_SAVE_STATE)) { - machine->pause(); + machine.pause(); return ui_set_handler(handler_load_save, LOADSAVE_SAVE); } /* handle a load state request */ if (ui_input_pressed(machine, IPT_UI_LOAD_STATE)) { - machine->pause(); + machine.pause(); return ui_set_handler(handler_load_save, LOADSAVE_LOAD); } /* handle a save snapshot request */ if (ui_input_pressed(machine, IPT_UI_SNAPSHOT)) - machine->video().save_active_screen_snapshots(); + machine.video().save_active_screen_snapshots(); /* toggle pause */ if (ui_input_pressed(machine, IPT_UI_PAUSE)) @@ -1411,29 +1411,29 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain if (is_paused && (input_code_pressed(machine, KEYCODE_LSHIFT) || input_code_pressed(machine, KEYCODE_RSHIFT))) { single_step = TRUE; - machine->resume(); + machine.resume(); } - else if (machine->paused()) - machine->resume(); + else if (machine.paused()) + machine.resume(); else - machine->pause(); + machine.pause(); } /* handle a toggle cheats request */ if (ui_input_pressed(machine, IPT_UI_TOGGLE_CHEAT)) - machine->cheat().set_enable(!machine->cheat().enabled()); + machine.cheat().set_enable(!machine.cheat().enabled()); /* toggle movie recording */ if (ui_input_pressed(machine, IPT_UI_RECORD_MOVIE)) { - if (!machine->video().is_recording()) + if (!machine.video().is_recording()) { - machine->video().begin_recording(NULL, video_manager::MF_MNG); + machine.video().begin_recording(NULL, video_manager::MF_MNG); popmessage("REC START"); } else { - machine->video().end_recording(); + machine.video().end_recording(); popmessage("REC STOP"); } } @@ -1450,10 +1450,10 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_INC)) { /* get the current value and increment it */ - int newframeskip = machine->video().frameskip() + 1; + int newframeskip = machine.video().frameskip() + 1; if (newframeskip > MAX_FRAMESKIP) newframeskip = -1; - machine->video().set_frameskip(newframeskip); + machine.video().set_frameskip(newframeskip); /* display the FPS counter for 2 seconds */ ui_show_fps_temp(2.0); @@ -1463,10 +1463,10 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_DEC)) { /* get the current value and decrement it */ - int newframeskip = machine->video().frameskip() - 1; + int newframeskip = machine.video().frameskip() - 1; if (newframeskip < -1) newframeskip = MAX_FRAMESKIP; - machine->video().set_frameskip(newframeskip); + machine.video().set_frameskip(newframeskip); /* display the FPS counter for 2 seconds */ ui_show_fps_temp(2.0); @@ -1474,16 +1474,16 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain /* toggle throttle? */ if (ui_input_pressed(machine, IPT_UI_THROTTLE)) - machine->video().set_throttled(!machine->video().throttled()); + machine.video().set_throttled(!machine.video().throttled()); /* check for fast forward */ if (input_type_pressed(machine, IPT_UI_FAST_FORWARD, 0)) { - machine->video().set_fastforward(true); + machine.video().set_fastforward(true); ui_show_fps_temp(0.5); } else - machine->video().set_fastforward(false); + machine.video().set_fastforward(false); return 0; } @@ -1494,7 +1494,7 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain specifying a game to save or load -------------------------------------------------*/ -static UINT32 handler_load_save(running_machine *machine, render_container *container, UINT32 state) +static UINT32 handler_load_save(running_machine &machine, render_container *container, UINT32 state) { char filename[20]; input_code code; @@ -1520,7 +1520,7 @@ static UINT32 handler_load_save(running_machine *machine, render_container *cont popmessage("Load cancelled"); /* reset the state */ - machine->resume(); + machine.resume(); return UI_HANDLER_CANCEL; } @@ -1544,16 +1544,16 @@ static UINT32 handler_load_save(running_machine *machine, render_container *cont if (state == LOADSAVE_SAVE) { popmessage("Save to position %c", file); - machine->schedule_save(filename); + machine.schedule_save(filename); } else { popmessage("Load from position %c", file); - machine->schedule_load(filename); + machine.schedule_load(filename); } /* remove the pause and reset the state */ - machine->resume(); + machine.resume(); return UI_HANDLER_CANCEL; } @@ -1577,7 +1577,7 @@ const slider_state *ui_get_slider_list(void) slider_alloc - allocate a new slider entry -------------------------------------------------*/ -static slider_state *slider_alloc(running_machine *machine, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg) +static slider_state *slider_alloc(running_machine &machine, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg) { int size = sizeof(slider_state) + strlen(title); slider_state *state = (slider_state *)auto_alloc_array_clear(machine, UINT8, size); @@ -1599,7 +1599,7 @@ static slider_state *slider_alloc(running_machine *machine, const char *title, I controls -------------------------------------------------*/ -static slider_state *slider_init(running_machine *machine) +static slider_state *slider_init(running_machine &machine) { const input_field_config *field; const input_port_config *port; @@ -1615,7 +1615,7 @@ static slider_state *slider_init(running_machine *machine) /* add per-channel volume */ speaker_input info; - for (item = 0; machine->sound().indexed_speaker_input(item, info); item++) + for (item = 0; machine.sound().indexed_speaker_input(item, info); item++) { INT32 maxval = 2000; INT32 defval = info.stream->initial_input_gain(info.inputnum) * 1000.0f + 0.5f; @@ -1630,7 +1630,7 @@ static slider_state *slider_init(running_machine *machine) } /* add analog adjusters */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) if (field->type == IPT_ADJUSTER) { @@ -1640,10 +1640,10 @@ static slider_state *slider_init(running_machine *machine) } /* add CPU overclocking (cheat only) */ - if (machine->options().cheat()) + if (machine.options().cheat()) { device_execute_interface *exec = NULL; - for (bool gotone = machine->m_devicelist.first(exec); gotone; gotone = exec->next(exec)) + for (bool gotone = machine.m_devicelist.first(exec); gotone; gotone = exec->next(exec)) { void *param = (void *)&exec->device(); string.printf("Overclock CPU %s", exec->device().tag()); @@ -1653,7 +1653,7 @@ static slider_state *slider_init(running_machine *machine) } /* add screen parameters */ - for (screen_device *screen = machine->first_screen(); screen != NULL; screen = screen->next_screen()) + for (screen_device *screen = machine.first_screen(); screen != NULL; screen = screen->next_screen()) { int defxscale = floor(screen->config().xscale() * 1000.0f + 0.5f); int defyscale = floor(screen->config().yscale() * 1000.0f + 0.5f); @@ -1662,7 +1662,7 @@ static slider_state *slider_init(running_machine *machine) void *param = (void *)screen; /* add refresh rate tweaker */ - if (machine->options().cheat()) + if (machine.options().cheat()) { string.printf("%s Refresh Rate", slider_get_screen_desc(*screen)); *tailptr = slider_alloc(machine, string, -10000, 0, 10000, 1000, slider_refresh, param); @@ -1695,7 +1695,7 @@ static slider_state *slider_init(running_machine *machine) tailptr = &(*tailptr)->next; } - for (device = machine->m_devicelist.first(LASERDISC); device != NULL; device = device->typenext()) + for (device = machine.m_devicelist.first(LASERDISC); device != NULL; device = device->typenext()) { const laserdisc_config *config = (const laserdisc_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config(); if (config->overupdate != NULL) @@ -1722,7 +1722,7 @@ static slider_state *slider_init(running_machine *machine) } } - for (screen_device *screen = machine->first_screen(); screen != NULL; screen = screen->next_screen()) + for (screen_device *screen = machine.first_screen(); screen != NULL; screen = screen->next_screen()) if (screen->screen_type() == SCREEN_TYPE_VECTOR) { /* add flicker control */ @@ -1735,7 +1735,7 @@ static slider_state *slider_init(running_machine *machine) #ifdef MAME_DEBUG /* add crosshair adjusters */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) if (field->crossaxis != CROSSHAIR_AXIS_NONE && field->player == 0) { @@ -1757,13 +1757,13 @@ static slider_state *slider_init(running_machine *machine) slider_volume - global volume slider callback -------------------------------------------------*/ -static INT32 slider_volume(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_volume(running_machine &machine, void *arg, astring *string, INT32 newval) { if (newval != SLIDER_NOCHANGE) - machine->sound().set_attenuation(newval); + machine.sound().set_attenuation(newval); if (string != NULL) - string->printf("%3ddB", machine->sound().attenuation()); - return machine->sound().attenuation(); + string->printf("%3ddB", machine.sound().attenuation()); + return machine.sound().attenuation(); } @@ -1772,10 +1772,10 @@ static INT32 slider_volume(running_machine *machine, void *arg, astring *string, slider callback -------------------------------------------------*/ -static INT32 slider_mixervol(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_mixervol(running_machine &machine, void *arg, astring *string, INT32 newval) { speaker_input info; - if (!machine->sound().indexed_speaker_input((FPTR)arg, info)) + if (!machine.sound().indexed_speaker_input((FPTR)arg, info)) return 0; if (newval != SLIDER_NOCHANGE) { @@ -1794,7 +1794,7 @@ static INT32 slider_mixervol(running_machine *machine, void *arg, astring *strin callback -------------------------------------------------*/ -static INT32 slider_adjuster(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_adjuster(running_machine &machine, void *arg, astring *string, INT32 newval) { const input_field_config *field = (const input_field_config *)arg; input_field_user_settings settings; @@ -1816,7 +1816,7 @@ static INT32 slider_adjuster(running_machine *machine, void *arg, astring *strin callback -------------------------------------------------*/ -static INT32 slider_overclock(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_overclock(running_machine &machine, void *arg, astring *string, INT32 newval) { device_t *cpu = (device_t *)arg; if (newval != SLIDER_NOCHANGE) @@ -1831,7 +1831,7 @@ static INT32 slider_overclock(running_machine *machine, void *arg, astring *stri slider_refresh - refresh rate slider callback -------------------------------------------------*/ -static INT32 slider_refresh(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_refresh(running_machine &machine, void *arg, astring *string, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); double defrefresh = ATTOSECONDS_TO_HZ(screen->config().refresh()); @@ -1845,8 +1845,8 @@ static INT32 slider_refresh(running_machine *machine, void *arg, astring *string screen->configure(width, height, visarea, HZ_TO_ATTOSECONDS(defrefresh + (double)newval * 0.001)); } if (string != NULL) - string->printf("%.3ffps", ATTOSECONDS_TO_HZ(machine->primary_screen->frame_period().attoseconds)); - refresh = ATTOSECONDS_TO_HZ(machine->primary_screen->frame_period().attoseconds); + string->printf("%.3ffps", ATTOSECONDS_TO_HZ(machine.primary_screen->frame_period().attoseconds)); + refresh = ATTOSECONDS_TO_HZ(machine.primary_screen->frame_period().attoseconds); return floor((refresh - defrefresh) * 1000.0f + 0.5f); } @@ -1856,7 +1856,7 @@ static INT32 slider_refresh(running_machine *machine, void *arg, astring *string callback -------------------------------------------------*/ -static INT32 slider_brightness(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_brightness(running_machine &machine, void *arg, astring *string, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -1878,7 +1878,7 @@ static INT32 slider_brightness(running_machine *machine, void *arg, astring *str callback -------------------------------------------------*/ -static INT32 slider_contrast(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_contrast(running_machine &machine, void *arg, astring *string, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -1899,7 +1899,7 @@ static INT32 slider_contrast(running_machine *machine, void *arg, astring *strin slider_gamma - screen gamma slider callback -------------------------------------------------*/ -static INT32 slider_gamma(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_gamma(running_machine &machine, void *arg, astring *string, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -1921,7 +1921,7 @@ static INT32 slider_gamma(running_machine *machine, void *arg, astring *string, callback -------------------------------------------------*/ -static INT32 slider_xscale(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_xscale(running_machine &machine, void *arg, astring *string, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -1943,7 +1943,7 @@ static INT32 slider_xscale(running_machine *machine, void *arg, astring *string, callback -------------------------------------------------*/ -static INT32 slider_yscale(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_yscale(running_machine &machine, void *arg, astring *string, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -1965,7 +1965,7 @@ static INT32 slider_yscale(running_machine *machine, void *arg, astring *string, slider callback -------------------------------------------------*/ -static INT32 slider_xoffset(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_xoffset(running_machine &machine, void *arg, astring *string, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -1987,7 +1987,7 @@ static INT32 slider_xoffset(running_machine *machine, void *arg, astring *string slider callback -------------------------------------------------*/ -static INT32 slider_yoffset(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_yoffset(running_machine &machine, void *arg, astring *string, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -2009,7 +2009,7 @@ static INT32 slider_yoffset(running_machine *machine, void *arg, astring *string callback -------------------------------------------------*/ -static INT32 slider_overxscale(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_overxscale(running_machine &machine, void *arg, astring *string, INT32 newval) { device_t *laserdisc = (device_t *)arg; laserdisc_config settings; @@ -2031,7 +2031,7 @@ static INT32 slider_overxscale(running_machine *machine, void *arg, astring *str callback -------------------------------------------------*/ -static INT32 slider_overyscale(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_overyscale(running_machine &machine, void *arg, astring *string, INT32 newval) { device_t *laserdisc = (device_t *)arg; laserdisc_config settings; @@ -2053,7 +2053,7 @@ static INT32 slider_overyscale(running_machine *machine, void *arg, astring *str slider callback -------------------------------------------------*/ -static INT32 slider_overxoffset(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_overxoffset(running_machine &machine, void *arg, astring *string, INT32 newval) { device_t *laserdisc = (device_t *)arg; laserdisc_config settings; @@ -2075,7 +2075,7 @@ static INT32 slider_overxoffset(running_machine *machine, void *arg, astring *st slider callback -------------------------------------------------*/ -static INT32 slider_overyoffset(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_overyoffset(running_machine &machine, void *arg, astring *string, INT32 newval) { device_t *laserdisc = (device_t *)arg; laserdisc_config settings; @@ -2097,7 +2097,7 @@ static INT32 slider_overyoffset(running_machine *machine, void *arg, astring *st callback -------------------------------------------------*/ -static INT32 slider_flicker(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_flicker(running_machine &machine, void *arg, astring *string, INT32 newval) { if (newval != SLIDER_NOCHANGE) vector_set_flicker((float)newval * 0.1f); @@ -2112,7 +2112,7 @@ static INT32 slider_flicker(running_machine *machine, void *arg, astring *string callback -------------------------------------------------*/ -static INT32 slider_beam(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_beam(running_machine &machine, void *arg, astring *string, INT32 newval) { if (newval != SLIDER_NOCHANGE) vector_set_beam((float)newval * 0.01f); @@ -2129,7 +2129,7 @@ static INT32 slider_beam(running_machine *machine, void *arg, astring *string, I static char *slider_get_screen_desc(screen_device &screen) { - int scrcount = screen.machine->m_devicelist.count(SCREEN); + int scrcount = screen.machine().m_devicelist.count(SCREEN); static char descbuf[256]; if (scrcount > 1) @@ -2148,7 +2148,7 @@ static char *slider_get_screen_desc(screen_device &screen) static char *slider_get_laserdisc_desc(device_t *laserdisc) { - int ldcount = laserdisc->machine->m_devicelist.count(LASERDISC); + int ldcount = laserdisc->machine().m_devicelist.count(LASERDISC); static char descbuf[256]; if (ldcount > 1) @@ -2166,7 +2166,7 @@ static char *slider_get_laserdisc_desc(device_t *laserdisc) -------------------------------------------------*/ #ifdef MAME_DEBUG -static INT32 slider_crossscale(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_crossscale(running_machine &machine, void *arg, astring *string, INT32 newval) { input_field_config *field = (input_field_config *)arg; @@ -2185,7 +2185,7 @@ static INT32 slider_crossscale(running_machine *machine, void *arg, astring *str -------------------------------------------------*/ #ifdef MAME_DEBUG -static INT32 slider_crossoffset(running_machine *machine, void *arg, astring *string, INT32 newval) +static INT32 slider_crossoffset(running_machine &machine, void *arg, astring *string, INT32 newval) { input_field_config *field = (input_field_config *)arg; @@ -2203,7 +2203,7 @@ static INT32 slider_crossoffset(running_machine *machine, void *arg, astring *st whether the natural keyboard is active -------------------------------------------------*/ -int ui_get_use_natural_keyboard(running_machine *machine) +int ui_get_use_natural_keyboard(running_machine &machine) { return ui_use_natural_keyboard; } @@ -2215,11 +2215,11 @@ int ui_get_use_natural_keyboard(running_machine *machine) whether the natural keyboard is active -------------------------------------------------*/ -void ui_set_use_natural_keyboard(running_machine *machine, int use_natural_keyboard) +void ui_set_use_natural_keyboard(running_machine &machine, int use_natural_keyboard) { ui_use_natural_keyboard = use_natural_keyboard; astring error; - machine->options().set_value(OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE, error); + machine.options().set_value(OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE, error); assert(!error); } diff --git a/src/emu/ui.h b/src/emu/ui.h index d4f35f6b569..6eb096032ec 100644 --- a/src/emu/ui.h +++ b/src/emu/ui.h @@ -91,7 +91,7 @@ enum TYPE DEFINITIONS ***************************************************************************/ -typedef INT32 (*slider_update)(running_machine *machine, void *arg, astring *string, INT32 newval); +typedef INT32 (*slider_update)(running_machine &machine, void *arg, astring *string, INT32 newval); typedef struct _slider_state slider_state; struct _slider_state @@ -121,16 +121,16 @@ struct _slider_state ***************************************************************************/ /* main init/exit routines */ -int ui_init(running_machine *machine); +int ui_init(running_machine &machine); /* display the startup screens */ -int ui_display_startup_screens(running_machine *machine, int first_time, int show_disclaimer); +int ui_display_startup_screens(running_machine &machine, int first_time, int show_disclaimer); /* set the current text to display at startup */ -void ui_set_startup_text(running_machine *machine, const char *text, int force); +void ui_set_startup_text(running_machine &machine, const char *text, int force); /* once-per-frame update and render */ -void ui_update_and_render(running_machine *machine, render_container *container); +void ui_update_and_render(running_machine &machine, render_container *container); /* returns the current UI font */ render_font *ui_get_font(running_machine &machine); @@ -173,18 +173,18 @@ void ui_show_menu(void); int ui_is_menu_active(void); /* print the game info string into a buffer */ -astring &game_info_astring(running_machine *machine, astring &string); +astring &game_info_astring(running_machine &machine, astring &string); /* get the list of sliders */ const slider_state *ui_get_slider_list(void); /* paste */ -void ui_paste(running_machine *machine); +void ui_paste(running_machine &machine); /* returns whether the natural keyboard is active */ -int ui_get_use_natural_keyboard(running_machine *machine); +int ui_get_use_natural_keyboard(running_machine &machine); /* specifies whether the natural keyboard is active */ -void ui_set_use_natural_keyboard(running_machine *machine, int use_natural_keyboard); +void ui_set_use_natural_keyboard(running_machine &machine, int use_natural_keyboard); #endif /* __USRINTRF_H__ */ diff --git a/src/emu/uigfx.c b/src/emu/uigfx.c index 5b413e3fb03..2167be8a64b 100644 --- a/src/emu/uigfx.c +++ b/src/emu/uigfx.c @@ -79,19 +79,19 @@ static ui_gfx_state ui_gfx; static void ui_gfx_exit(running_machine &machine); /* palette handling */ -static void palette_handle_keys(running_machine *machine, ui_gfx_state *state); -static void palette_handler(running_machine *machine, render_container *container, ui_gfx_state *state); +static void palette_handle_keys(running_machine &machine, ui_gfx_state *state); +static void palette_handler(running_machine &machine, render_container *container, ui_gfx_state *state); /* graphics set handling */ -static void gfxset_handle_keys(running_machine *machine, ui_gfx_state *state, int xcells, int ycells); -static void gfxset_draw_item(running_machine *machine, const gfx_element *gfx, int index, bitmap_t *bitmap, int dstx, int dsty, int color, int rotate); -static void gfxset_update_bitmap(running_machine *machine, ui_gfx_state *state, int xcells, int ycells, gfx_element *gfx); -static void gfxset_handler(running_machine *machine, render_container *container, ui_gfx_state *state); +static void gfxset_handle_keys(running_machine &machine, ui_gfx_state *state, int xcells, int ycells); +static void gfxset_draw_item(running_machine &machine, const gfx_element *gfx, int index, bitmap_t *bitmap, int dstx, int dsty, int color, int rotate); +static void gfxset_update_bitmap(running_machine &machine, ui_gfx_state *state, int xcells, int ycells, gfx_element *gfx); +static void gfxset_handler(running_machine &machine, render_container *container, ui_gfx_state *state); /* tilemap handling */ -static void tilemap_handle_keys(running_machine *machine, ui_gfx_state *state, int viswidth, int visheight); -static void tilemap_update_bitmap(running_machine *machine, ui_gfx_state *state, int width, int height); -static void tilemap_handler(running_machine *machine, render_container *container, ui_gfx_state *state); +static void tilemap_handle_keys(running_machine &machine, ui_gfx_state *state, int viswidth, int visheight); +static void tilemap_update_bitmap(running_machine &machine, ui_gfx_state *state, int width, int height); +static void tilemap_handler(running_machine &machine, render_container *container, ui_gfx_state *state); @@ -103,13 +103,13 @@ static void tilemap_handler(running_machine *machine, render_container *containe ui_gfx_init - initialize the menu system -------------------------------------------------*/ -void ui_gfx_init(running_machine *machine) +void ui_gfx_init(running_machine &machine) { ui_gfx_state *state = &ui_gfx; int gfx; /* make sure we clean up after ourselves */ - machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_gfx_exit); + machine.add_notifier(MACHINE_NOTIFY_EXIT, ui_gfx_exit); /* initialize our global state */ memset(state, 0, sizeof(*state)); @@ -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->system().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->system().flags & ORIENTATION_MASK; + state->tilemap.rotate = machine.system().flags & ORIENTATION_MASK; } @@ -149,16 +149,16 @@ static void ui_gfx_exit(running_machine &machine) ui_gfx_ui_handler - primary UI handler -------------------------------------------------*/ -UINT32 ui_gfx_ui_handler(running_machine *machine, render_container *container, UINT32 uistate) +UINT32 ui_gfx_ui_handler(running_machine &machine, render_container *container, UINT32 uistate) { ui_gfx_state *state = &ui_gfx; /* if we have nothing, implicitly cancel */ - if (machine->total_colors() == 0 && machine->colortable == NULL && machine->gfx[0] == NULL && tilemap_count(machine) == 0) + if (machine.total_colors() == 0 && machine.colortable == NULL && machine.gfx[0] == NULL && tilemap_count(machine) == 0) goto cancel; /* if we're not paused, mark the bitmap dirty */ - if (!machine->paused()) + if (!machine.paused()) state->bitmap_dirty = TRUE; /* switch off the state to display something */ @@ -167,7 +167,7 @@ again: { case 0: /* if we have a palette, display it */ - if (machine->total_colors() > 0) + if (machine.total_colors() > 0) { palette_handler(machine, container, state); break; @@ -178,7 +178,7 @@ again: case 1: /* if we have graphics sets, display them */ - if (machine->gfx[0] != NULL) + if (machine.gfx[0] != NULL) { gfxset_handler(machine, container, state); break; @@ -208,10 +208,10 @@ again: if (ui_input_pressed(machine, IPT_UI_PAUSE)) { - if (machine->paused()) - machine->resume(); + if (machine.paused()) + machine.resume(); else - machine->pause(); + machine.pause(); } if (ui_input_pressed(machine, IPT_UI_CANCEL) || ui_input_pressed(machine, IPT_UI_SHOW_GFX)) @@ -221,7 +221,7 @@ again: cancel: if (!uistate) - machine->resume(); + machine.resume(); state->bitmap_dirty = TRUE; return UI_HANDLER_CANCEL; } @@ -237,12 +237,12 @@ cancel: viewer -------------------------------------------------*/ -static void palette_handler(running_machine *machine, render_container *container, ui_gfx_state *state) +static void palette_handler(running_machine &machine, render_container *container, ui_gfx_state *state) { - int total = state->palette.which ? colortable_palette_get_size(machine->colortable) : machine->total_colors(); + int total = state->palette.which ? colortable_palette_get_size(machine.colortable) : machine.total_colors(); const char *title = state->palette.which ? "COLORTABLE" : "PALETTE"; - const rgb_t *raw_color = palette_entry_list_raw(machine->palette); - render_font *ui_font = ui_get_font(*machine); + const rgb_t *raw_color = palette_entry_list_raw(machine.palette); + render_font *ui_font = ui_get_font(machine); float cellwidth, cellheight; float chwidth, chheight; float titlewidth; @@ -252,8 +252,8 @@ static void palette_handler(running_machine *machine, render_container *containe int x, y, skip; /* add a half character padding for the box */ - chheight = ui_get_line_height(*machine); - chwidth = ui_font->char_width(chheight, machine->render().ui_aspect(), '0'); + chheight = ui_get_line_height(machine); + chwidth = ui_font->char_width(chheight, machine.render().ui_aspect(), '0'); boxbounds.x0 = 0.0f + 0.5f * chwidth; boxbounds.x1 = 1.0f - 0.5f * chwidth; boxbounds.y0 = 0.0f + 0.5f * chheight; @@ -273,7 +273,7 @@ static void palette_handler(running_machine *machine, render_container *containe cellboxbounds.y0 += 3.0f * chheight; /* figure out the title and expand the outer box to fit */ - titlewidth = ui_font->string_width(chheight, machine->render().ui_aspect(), title); + titlewidth = ui_font->string_width(chheight, machine.render().ui_aspect(), title); x0 = 0.0f; if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth) x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth)); @@ -286,8 +286,8 @@ static void palette_handler(running_machine *machine, render_container *containe y0 = boxbounds.y0 + 0.5f * chheight; for (x = 0; title[x] != 0; x++) { - container->add_char(x0, y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]); - x0 += ui_font->char_width(chheight, machine->render().ui_aspect(), title[x]); + container->add_char(x0, y0, chheight, machine.render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]); + x0 += ui_font->char_width(chheight, machine.render().ui_aspect(), title[x]); } /* compute the cell size */ @@ -300,7 +300,7 @@ static void palette_handler(running_machine *machine, render_container *containe { x0 = boxbounds.x0 + 6.0f * chwidth + (float)x * cellwidth; y0 = boxbounds.y0 + 2.0f * chheight; - container->add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, "0123456789ABCDEF"[x & 0xf]); + container->add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, machine.render().ui_aspect(), ARGB_WHITE, *ui_font, "0123456789ABCDEF"[x & 0xf]); /* if we're skipping, draw a point between the character and the box to indicate which */ /* one it's referring to */ @@ -328,8 +328,8 @@ static void palette_handler(running_machine *machine, render_container *containe sprintf(buffer, "%5X", state->palette.offset + y * state->palette.count); for (x = 4; x >= 0; x--) { - x0 -= ui_font->char_width(chheight, machine->render().ui_aspect(), buffer[x]); - container->add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, buffer[x]); + x0 -= ui_font->char_width(chheight, machine.render().ui_aspect(), buffer[x]); + container->add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, machine.render().ui_aspect(), ARGB_WHITE, *ui_font, buffer[x]); } } @@ -340,7 +340,7 @@ static void palette_handler(running_machine *machine, render_container *containe int index = state->palette.offset + y * state->palette.count + x; if (index < total) { - pen_t pen = state->palette.which ? colortable_palette_get_color(machine->colortable, index) : raw_color[index]; + pen_t pen = state->palette.which ? colortable_palette_get_color(machine.colortable, index) : raw_color[index]; container->add_rect(cellboxbounds.x0 + x * cellwidth, cellboxbounds.y0 + y * cellheight, cellboxbounds.x0 + (x + 1) * cellwidth, cellboxbounds.y0 + (y + 1) * cellheight, 0xff000000 | pen, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); @@ -357,7 +357,7 @@ static void palette_handler(running_machine *machine, render_container *containe palette viewer -------------------------------------------------*/ -static void palette_handle_keys(running_machine *machine, ui_gfx_state *state) +static void palette_handle_keys(running_machine &machine, ui_gfx_state *state) { int rowcount, screencount; int total; @@ -383,11 +383,11 @@ static void palette_handle_keys(running_machine *machine, ui_gfx_state *state) /* clamp within range */ if (state->palette.which < 0) state->palette.which = 1; - if (state->palette.which > (int)(machine->colortable != NULL)) - state->palette.which = (int)(machine->colortable != NULL); + if (state->palette.which > (int)(machine.colortable != NULL)) + state->palette.which = (int)(machine.colortable != NULL); /* cache some info in locals */ - total = state->palette.which ? colortable_palette_get_size(machine->colortable) : machine->total_colors(); + total = state->palette.which ? colortable_palette_get_size(machine.colortable) : machine.total_colors(); /* determine number of entries per row and total */ rowcount = state->palette.count; @@ -425,11 +425,11 @@ static void palette_handle_keys(running_machine *machine, ui_gfx_state *state) viewer -------------------------------------------------*/ -static void gfxset_handler(running_machine *machine, render_container *container, ui_gfx_state *state) +static void gfxset_handler(running_machine &machine, render_container *container, ui_gfx_state *state) { - render_font *ui_font = ui_get_font(*machine); + render_font *ui_font = ui_get_font(machine); int set = state->gfxset.set; - gfx_element *gfx = machine->gfx[set]; + gfx_element *gfx = machine.gfx[set]; float fullwidth, fullheight; float cellwidth, cellheight; float chwidth, chheight; @@ -439,8 +439,8 @@ static void gfxset_handler(running_machine *machine, render_container *container render_bounds cellboxbounds; render_bounds boxbounds; int cellboxwidth, cellboxheight; - int targwidth = machine->render().ui_target().width(); - int targheight = machine->render().ui_target().height(); + int targwidth = machine.render().ui_target().width(); + int targheight = machine.render().ui_target().height(); int cellxpix, cellypix; int xcells, ycells; int pixelscale = 0; @@ -448,8 +448,8 @@ static void gfxset_handler(running_machine *machine, render_container *container char title[100]; /* add a half character padding for the box */ - chheight = ui_get_line_height(*machine); - chwidth = ui_font->char_width(chheight, machine->render().ui_aspect(), '0'); + chheight = ui_get_line_height(machine); + chwidth = ui_font->char_width(chheight, machine.render().ui_aspect(), '0'); boxbounds.x0 = 0.0f + 0.5f * chwidth; boxbounds.x1 = 1.0f - 0.5f * chwidth; boxbounds.y0 = 0.0f + 0.5f * chheight; @@ -512,9 +512,9 @@ static void gfxset_handler(running_machine *machine, render_container *container boxbounds.y1 = boxbounds.y0 + fullheight; /* figure out the title and expand the outer box to fit */ - for (x = 0; x < MAX_GFX_ELEMENTS && machine->gfx[x] != NULL; x++) ; + for (x = 0; x < MAX_GFX_ELEMENTS && machine.gfx[x] != NULL; x++) ; sprintf(title, "GFX %d/%d %dx%d COLOR %X", state->gfxset.set, x - 1, gfx->width, gfx->height, state->gfxset.color[set]); - titlewidth = ui_font->string_width(chheight, machine->render().ui_aspect(), title); + titlewidth = ui_font->string_width(chheight, machine.render().ui_aspect(), title); x0 = 0.0f; if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth) x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth)); @@ -527,8 +527,8 @@ static void gfxset_handler(running_machine *machine, render_container *container y0 = boxbounds.y0 + 0.5f * chheight; for (x = 0; title[x] != 0; x++) { - container->add_char(x0, y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]); - x0 += ui_font->char_width(chheight, machine->render().ui_aspect(), title[x]); + container->add_char(x0, y0, chheight, machine.render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]); + x0 += ui_font->char_width(chheight, machine.render().ui_aspect(), title[x]); } /* draw the top column headers */ @@ -537,7 +537,7 @@ static void gfxset_handler(running_machine *machine, render_container *container { x0 = boxbounds.x0 + 6.0f * chwidth + (float)x * cellwidth; y0 = boxbounds.y0 + 2.0f * chheight; - container->add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, "0123456789ABCDEF"[x & 0xf]); + container->add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, machine.render().ui_aspect(), ARGB_WHITE, *ui_font, "0123456789ABCDEF"[x & 0xf]); /* if we're skipping, draw a point between the character and the box to indicate which */ /* one it's referring to */ @@ -565,8 +565,8 @@ static void gfxset_handler(running_machine *machine, render_container *container sprintf(buffer, "%5X", state->gfxset.offset[set] + y * xcells); for (x = 4; x >= 0; x--) { - x0 -= ui_font->char_width(chheight, machine->render().ui_aspect(), buffer[x]); - container->add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, buffer[x]); + x0 -= ui_font->char_width(chheight, machine.render().ui_aspect(), buffer[x]); + container->add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, machine.render().ui_aspect(), ARGB_WHITE, *ui_font, buffer[x]); } } @@ -589,7 +589,7 @@ static void gfxset_handler(running_machine *machine, render_container *container graphics viewer -------------------------------------------------*/ -static void gfxset_handle_keys(running_machine *machine, ui_gfx_state *state, int xcells, int ycells) +static void gfxset_handle_keys(running_machine &machine, ui_gfx_state *state, int xcells, int ycells) { ui_gfx_state oldstate = *state; gfx_element *gfx; @@ -599,7 +599,7 @@ static void gfxset_handle_keys(running_machine *machine, ui_gfx_state *state, in if (ui_input_pressed(machine, IPT_UI_PREV_GROUP)) { for (temp = state->gfxset.set - 1; temp >= 0; temp--) - if (machine->gfx[temp] != NULL) + if (machine.gfx[temp] != NULL) break; if (temp >= 0) state->gfxset.set = temp; @@ -607,7 +607,7 @@ static void gfxset_handle_keys(running_machine *machine, ui_gfx_state *state, in if (ui_input_pressed(machine, IPT_UI_NEXT_GROUP)) { for (temp = state->gfxset.set + 1; temp < MAX_GFX_ELEMENTS; temp++) - if (machine->gfx[temp] != NULL) + if (machine.gfx[temp] != NULL) break; if (temp < MAX_GFX_ELEMENTS) state->gfxset.set = temp; @@ -615,7 +615,7 @@ static void gfxset_handle_keys(running_machine *machine, ui_gfx_state *state, in /* cache some info in locals */ set = state->gfxset.set; - gfx = machine->gfx[set]; + gfx = machine.gfx[set]; /* handle cells per line (minus,plus) */ if (ui_input_pressed(machine, IPT_UI_ZOOM_OUT)) @@ -682,7 +682,7 @@ static void gfxset_handle_keys(running_machine *machine, ui_gfx_state *state, in graphics view bitmap -------------------------------------------------*/ -static void gfxset_update_bitmap(running_machine *machine, ui_gfx_state *state, int xcells, int ycells, gfx_element *gfx) +static void gfxset_update_bitmap(running_machine &machine, ui_gfx_state *state, int xcells, int ycells, gfx_element *gfx) { int set = state->gfxset.set; int cellxpix, cellypix; @@ -696,12 +696,12 @@ static void gfxset_update_bitmap(running_machine *machine, ui_gfx_state *state, if (state->bitmap == NULL || state->texture == NULL || state->bitmap->bpp != 32 || state->bitmap->width != cellxpix * xcells || state->bitmap->height != cellypix * ycells) { /* free the old stuff */ - machine->render().texture_free(state->texture); + machine.render().texture_free(state->texture); global_free(state->bitmap); /* allocate new stuff */ state->bitmap = global_alloc(bitmap_t(cellxpix * xcells, cellypix * ycells, BITMAP_FORMAT_ARGB32)); - state->texture = machine->render().texture_alloc(); + state->texture = machine.render().texture_alloc(); state->texture->set_bitmap(state->bitmap, NULL, TEXFORMAT_ARGB32); /* force a redraw */ @@ -761,7 +761,7 @@ static void gfxset_update_bitmap(running_machine *machine, ui_gfx_state *state, the view -------------------------------------------------*/ -static void gfxset_draw_item(running_machine *machine, const gfx_element *gfx, int index, bitmap_t *bitmap, int dstx, int dsty, int color, int rotate) +static void gfxset_draw_item(running_machine &machine, const gfx_element *gfx, int index, bitmap_t *bitmap, int dstx, int dsty, int color, int rotate) { static const pen_t default_palette[] = { @@ -770,7 +770,7 @@ static void gfxset_draw_item(running_machine *machine, const gfx_element *gfx, i }; int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width; int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height; - const rgb_t *palette = (machine->total_colors() != 0) ? palette_entry_list_raw(machine->palette) : NULL; + const rgb_t *palette = (machine.total_colors() != 0) ? palette_entry_list_raw(machine.palette) : NULL; UINT32 rowpixels = bitmap->rowpixels; UINT32 palette_mask = ~0; int x, y; @@ -838,14 +838,14 @@ static void gfxset_draw_item(running_machine *machine, const gfx_element *gfx, i viewer -------------------------------------------------*/ -static void tilemap_handler(running_machine *machine, render_container *container, ui_gfx_state *state) +static void tilemap_handler(running_machine &machine, render_container *container, ui_gfx_state *state) { - render_font *ui_font = ui_get_font(*machine); + render_font *ui_font = ui_get_font(machine); float chwidth, chheight; render_bounds mapboxbounds; render_bounds boxbounds; - int targwidth = machine->render().ui_target().width(); - int targheight = machine->render().ui_target().height(); + int targwidth = machine.render().ui_target().width(); + int targheight = machine.render().ui_target().height(); float titlewidth; float x0, y0; int mapboxwidth, mapboxheight; @@ -860,8 +860,8 @@ static void tilemap_handler(running_machine *machine, render_container *containe { UINT32 temp = mapwidth; mapwidth = mapheight; mapheight = temp; } /* add a half character padding for the box */ - chheight = ui_get_line_height(*machine); - chwidth = ui_font->char_width(chheight, machine->render().ui_aspect(), '0'); + chheight = ui_get_line_height(machine); + chwidth = ui_font->char_width(chheight, machine.render().ui_aspect(), '0'); boxbounds.x0 = 0.0f + 0.5f * chwidth; boxbounds.x1 = 1.0f - 0.5f * chwidth; boxbounds.y0 = 0.0f + 0.5f * chheight; @@ -908,7 +908,7 @@ static void tilemap_handler(running_machine *machine, render_container *containe /* figure out the title and expand the outer box to fit */ sprintf(title, "TMAP %d/%d %dx%d OFFS %d,%d", state->tilemap.which, tilemap_count(machine) - 1, mapwidth, mapheight, state->tilemap.xoffs, state->tilemap.yoffs); - titlewidth = ui_font->string_width(chheight, machine->render().ui_aspect(), title); + titlewidth = ui_font->string_width(chheight, machine.render().ui_aspect(), title); if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth) { boxbounds.x0 = 0.5f - 0.5f * (titlewidth + chwidth); @@ -923,8 +923,8 @@ static void tilemap_handler(running_machine *machine, render_container *containe y0 = boxbounds.y0 + 0.5f * chheight; for (x = 0; title[x] != 0; x++) { - container->add_char(x0, y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]); - x0 += ui_font->char_width(chheight, machine->render().ui_aspect(), title[x]); + container->add_char(x0, y0, chheight, machine.render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]); + x0 += ui_font->char_width(chheight, machine.render().ui_aspect(), title[x]); } /* update the bitmap */ @@ -946,7 +946,7 @@ static void tilemap_handler(running_machine *machine, render_container *containe tilemap view -------------------------------------------------*/ -static void tilemap_handle_keys(running_machine *machine, ui_gfx_state *state, int viswidth, int visheight) +static void tilemap_handle_keys(running_machine &machine, ui_gfx_state *state, int viswidth, int visheight) { ui_gfx_state oldstate = *state; UINT32 mapwidth, mapheight; @@ -1029,16 +1029,16 @@ static void tilemap_handle_keys(running_machine *machine, ui_gfx_state *state, i for the tilemap view -------------------------------------------------*/ -static void tilemap_update_bitmap(running_machine *machine, ui_gfx_state *state, int width, int height) +static void tilemap_update_bitmap(running_machine &machine, ui_gfx_state *state, int width, int height) { - bitmap_format screen_format = machine->primary_screen->format(); + bitmap_format screen_format = machine.primary_screen->format(); palette_t *palette = NULL; int screen_texformat; /* convert the screen format to a texture format */ switch (screen_format) { - case BITMAP_FORMAT_INDEXED16: screen_texformat = TEXFORMAT_PALETTE16; palette = machine->palette; break; + case BITMAP_FORMAT_INDEXED16: screen_texformat = TEXFORMAT_PALETTE16; palette = machine.palette; break; case BITMAP_FORMAT_RGB15: screen_texformat = TEXFORMAT_RGB15; palette = NULL; break; case BITMAP_FORMAT_RGB32: screen_texformat = TEXFORMAT_RGB32; palette = NULL; break; default: fatalerror("Invalid bitmap format!"); break; @@ -1052,12 +1052,12 @@ static void tilemap_update_bitmap(running_machine *machine, ui_gfx_state *state, if (state->bitmap == NULL || state->texture == NULL || state->bitmap->format != screen_format || state->bitmap->width != width || state->bitmap->height != height) { /* free the old stuff */ - machine->render().texture_free(state->texture); + machine.render().texture_free(state->texture); global_free(state->bitmap); /* allocate new stuff */ state->bitmap = global_alloc(bitmap_t(width, height, screen_format)); - state->texture = machine->render().texture_alloc(); + state->texture = machine.render().texture_alloc(); state->texture->set_bitmap(state->bitmap, NULL, screen_texformat, palette); /* force a redraw */ diff --git a/src/emu/uigfx.h b/src/emu/uigfx.h index d7d1d2c42e8..c514916d127 100644 --- a/src/emu/uigfx.h +++ b/src/emu/uigfx.h @@ -21,10 +21,10 @@ ***************************************************************************/ /* initialization */ -void ui_gfx_init(running_machine *machine); +void ui_gfx_init(running_machine &machine); /* master handler */ -UINT32 ui_gfx_ui_handler(running_machine *machine, render_container *container, UINT32 state); +UINT32 ui_gfx_ui_handler(running_machine &machine, render_container *container, UINT32 state); #endif /* __UIGFX_H__ */ diff --git a/src/emu/uiimage.c b/src/emu/uiimage.c index 7c903b3cfe0..5405ff6d2c3 100644 --- a/src/emu/uiimage.c +++ b/src/emu/uiimage.c @@ -196,7 +196,7 @@ static void extra_text_draw_box(render_container &ui_container, float origx1, fl and footer text -------------------------------------------------*/ -static void extra_text_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, +static void extra_text_render(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2, const char *header, const char *footer) { @@ -204,9 +204,9 @@ static void extra_text_render(running_machine *machine, ui_menu *menu, void *sta footer = ((footer != NULL) && (footer[0] != '\0')) ? footer : NULL; if (header != NULL) - extra_text_draw_box(machine->render().ui_container(), origx1, origx2, origy1, top, header, -1); + extra_text_draw_box(machine.render().ui_container(), origx1, origx2, origy1, top, header, -1); if (footer != NULL) - extra_text_draw_box(machine->render().ui_container(), origx1, origx2, origy2, bottom, footer, +1); + extra_text_draw_box(machine.render().ui_container(), origx1, origx2, origy2, bottom, footer, +1); } @@ -220,7 +220,7 @@ static void extra_text_render(running_machine *machine, ui_menu *menu, void *sta confirm save as menu -------------------------------------------------*/ -static void menu_confirm_save_as_populate(running_machine *machine, ui_menu *menu, void *state) +static void menu_confirm_save_as_populate(running_machine &machine, ui_menu *menu, void *state) { ui_menu_item_append(menu, "File Already Exists - Overide?", NULL, MENU_FLAG_DISABLE, NULL); ui_menu_item_append(menu, MENU_SEPARATOR_ITEM, NULL, MENU_FLAG_DISABLE, NULL); @@ -234,7 +234,7 @@ static void menu_confirm_save_as_populate(running_machine *machine, ui_menu *men menu_confirm_save_as - confirm save as menu -------------------------------------------------*/ -static void menu_confirm_save_as(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_confirm_save_as(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *event; confirm_save_as_menu_state *menustate = (confirm_save_as_menu_state *) state; @@ -292,7 +292,7 @@ static int is_valid_filename_char(unicode_char unichar) special rendering -------------------------------------------------*/ -static void file_create_render_extra(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +static void file_create_render_extra(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { file_create_menu_state *menustate = (file_create_menu_state *) state; @@ -308,7 +308,7 @@ static void file_create_render_extra(running_machine *machine, ui_menu *menu, vo creator menu -------------------------------------------------*/ -static void menu_file_create_populate(running_machine *machine, ui_menu *menu, void *state, void *selection) +static void menu_file_create_populate(running_machine &machine, ui_menu *menu, void *state, void *selection) { astring buffer; file_create_menu_state *menustate = (file_create_menu_state *) state; @@ -341,7 +341,7 @@ static void menu_file_create_populate(running_machine *machine, ui_menu *menu, v ui_menu_item_append(menu, "Create", NULL, 0, ITEMREF_CREATE); /* set up custom render proc */ - ui_menu_set_custom_render(menu, file_create_render_extra, ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER, 0); + ui_menu_set_custom_render(menu, file_create_render_extra, ui_get_line_height(machine) + 3.0f * UI_BOX_TB_BORDER, 0); } @@ -382,7 +382,7 @@ static int create_new_image(device_image_interface *image, const char *directory case ENTTYPE_FILE: /* a file exists here - ask for permission from the user */ - child_menu = ui_menu_alloc(image->device().machine, &image->device().machine->render().ui_container(), menu_confirm_save_as, NULL); + child_menu = ui_menu_alloc(image->device().machine(), &image->device().machine().render().ui_container(), menu_confirm_save_as, NULL); child_menustate = (confirm_save_as_menu_state*)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL); child_menustate->yes = yes; ui_menu_stack_push(child_menu); @@ -423,7 +423,7 @@ static int create_new_image(device_image_interface *image, const char *directory menu_file_create - file creator menu -------------------------------------------------*/ -static void menu_file_create(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_file_create(running_machine &machine, ui_menu *menu, void *parameter, void *state) { void *selection; const ui_menu_event *event; @@ -498,7 +498,7 @@ static void menu_file_create(running_machine *machine, ui_menu *menu, void *para special rendering -------------------------------------------------*/ -static void file_selector_render_extra(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +static void file_selector_render_extra(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { file_selector_menu_state *menustate = (file_selector_menu_state *) state; @@ -676,7 +676,7 @@ static void append_file_selector_entry_menu_item(ui_menu *menu, const file_selec allocates all menu items for a directory -------------------------------------------------*/ -static file_error menu_file_selector_populate(running_machine *machine, ui_menu *menu, file_selector_menu_state *menustate) +static file_error menu_file_selector_populate(running_machine &machine, ui_menu *menu, file_selector_menu_state *menustate) { zippath_directory *directory = NULL; file_error err = FILERR_NONE; @@ -744,7 +744,7 @@ static file_error menu_file_selector_populate(running_machine *machine, ui_menu ui_menu_set_selection(menu, (void *) selected_entry); /* set up custom render proc */ - ui_menu_set_custom_render(menu, file_selector_render_extra, ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER, 0); + ui_menu_set_custom_render(menu, file_selector_render_extra, ui_get_line_height(machine) + 3.0f * UI_BOX_TB_BORDER, 0); done: if (directory != NULL) @@ -770,7 +770,7 @@ static file_error check_path(const char *path) menu_file_selector - file selector menu -------------------------------------------------*/ -static void menu_file_selector(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_file_selector(running_machine &machine, ui_menu *menu, void *parameter, void *state) { file_error err; const ui_menu_event *event; @@ -815,13 +815,13 @@ static void menu_file_selector(running_machine *machine, ui_menu *menu, void *pa case SELECTOR_ENTRY_TYPE_CREATE: /* create */ - child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), menu_file_create, NULL); + child_menu = ui_menu_alloc(machine, &machine.render().ui_container(), menu_file_create, NULL); child_menustate = (file_create_menu_state*)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL); child_menustate->manager_menustate = menustate->manager_menustate; ui_menu_stack_push(child_menu); break; case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST: - child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), ui_image_menu_software, menustate->manager_menustate->selected_device); + child_menu = ui_menu_alloc(machine, &machine.render().ui_container(), ui_image_menu_software, menustate->manager_menustate->selected_device); ui_menu_stack_push(child_menu); break; case SELECTOR_ENTRY_TYPE_DRIVE: @@ -956,7 +956,7 @@ static void fix_working_directory(device_image_interface *image) special rendering -------------------------------------------------*/ -static void file_manager_render_extra(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +static void file_manager_render_extra(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { file_manager_menu_state *menustate = (file_manager_menu_state *) state; const char *path; @@ -974,14 +974,14 @@ static void file_manager_render_extra(running_machine *machine, ui_menu *menu, v file manager menu -------------------------------------------------*/ -static void menu_file_manager_populate(running_machine *machine, ui_menu *menu, void *state) +static void menu_file_manager_populate(running_machine &machine, ui_menu *menu, void *state) { char buffer[2048]; device_image_interface *image = NULL; astring tmp_name; /* cycle through all devices for this system */ - for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image)) + for (bool gotone = machine.m_devicelist.first(image); gotone; gotone = image->next(image)) { /* get the image type/id */ snprintf(buffer, ARRAY_LENGTH(buffer), @@ -1019,7 +1019,7 @@ static void menu_file_manager_populate(running_machine *machine, ui_menu *menu, } /* set up custom render proc */ - ui_menu_set_custom_render(menu, file_manager_render_extra, 0, ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER); + ui_menu_set_custom_render(menu, file_manager_render_extra, 0, ui_get_line_height(machine) + 3.0f * UI_BOX_TB_BORDER); } @@ -1045,7 +1045,7 @@ static void file_manager_destroy_state(ui_menu *menu, void *state) menu_file_manager - main file manager menu -------------------------------------------------*/ -void ui_image_menu_file_manager(running_machine *machine, ui_menu *menu, void *parameter, void *state) +void ui_image_menu_file_manager(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *event; file_manager_menu_state *menustate; @@ -1088,7 +1088,7 @@ void ui_image_menu_file_manager(running_machine *machine, ui_menu *menu, void *p ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_POSITION); /* push the menu */ - child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), menu_file_selector, NULL); + child_menu = ui_menu_alloc(machine, &machine.render().ui_container(), menu_file_selector, NULL); child_menustate = (file_selector_menu_state *)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL); child_menustate->manager_menustate = menustate; ui_menu_stack_push(child_menu); @@ -1101,7 +1101,7 @@ void ui_image_menu_file_manager(running_machine *machine, ui_menu *menu, void *p on all loaded images -------------------------------------------------*/ -void ui_image_menu_image_info(running_machine *machine, ui_menu *menu, void *parameter, void *state) +void ui_image_menu_image_info(running_machine &machine, ui_menu *menu, void *parameter, void *state) { /* if the menu isn't built, populate now */ if (!ui_menu_populated(menu)) @@ -1160,10 +1160,10 @@ struct _bitbanger_control_menu_state devices in the machine -------------------------------------------------*/ -INLINE int cassette_count( running_machine *machine ) +INLINE int cassette_count( running_machine &machine ) { int count = 0; - device_t *device = machine->m_devicelist.first(CASSETTE); + device_t *device = machine.m_devicelist.first(CASSETTE); while ( device ) { @@ -1178,10 +1178,10 @@ INLINE int cassette_count( running_machine *machine ) devices in the machine -------------------------------------------------*/ -INLINE int bitbanger_count( running_machine *machine ) +INLINE int bitbanger_count( running_machine &machine ) { int count = 0; - device_t *device = machine->m_devicelist.first(BITBANGER); + device_t *device = machine.m_devicelist.first(BITBANGER); while ( device ) { @@ -1223,7 +1223,7 @@ astring *tapecontrol_gettime(astring *dest, device_t *device, int *curpos, int * main tape control menu -------------------------------------------------*/ -static void menu_tape_control_populate(running_machine *machine, ui_menu *menu, tape_control_menu_state *menustate) +static void menu_tape_control_populate(running_machine &machine, ui_menu *menu, tape_control_menu_state *menustate) { astring timepos; cassette_state state; @@ -1300,7 +1300,7 @@ static void menu_tape_control_populate(running_machine *machine, ui_menu *menu, main bitbanger control menu -------------------------------------------------*/ -static void menu_bitbanger_control_populate(running_machine *machine, ui_menu *menu, bitbanger_control_menu_state *menustate) +static void menu_bitbanger_control_populate(running_machine &machine, ui_menu *menu, bitbanger_control_menu_state *menustate) { int count = bitbanger_count(machine); UINT32 flags = 0, mode_flags = 0, baud_flags = 0, tune_flags = 0; @@ -1353,7 +1353,7 @@ static void menu_bitbanger_control_populate(running_machine *machine, ui_menu *m menu_tape_control - main tape control menu -------------------------------------------------*/ -void ui_mess_menu_tape_control(running_machine *machine, ui_menu *menu, void *parameter, void *state) +void ui_mess_menu_tape_control(running_machine &machine, ui_menu *menu, void *parameter, void *state) { tape_control_menu_state *menustate; const ui_menu_event *event; @@ -1368,7 +1368,7 @@ void ui_mess_menu_tape_control(running_machine *machine, ui_menu *menu, void *pa { int index = menustate->index; device_image_interface *device = NULL; - for (bool gotone = machine->m_devicelist.first(device); gotone; gotone = device->next(device)) + for (bool gotone = machine.m_devicelist.first(device); gotone; gotone = device->next(device)) { if(device->device().type() == CASSETTE) { if (index==0) break; @@ -1450,7 +1450,7 @@ void ui_mess_menu_tape_control(running_machine *machine, ui_menu *menu, void *pa control menu -------------------------------------------------*/ -void ui_mess_menu_bitbanger_control(running_machine *machine, ui_menu *menu, void *parameter, void *state) +void ui_mess_menu_bitbanger_control(running_machine &machine, ui_menu *menu, void *parameter, void *state) { bitbanger_control_menu_state *menustate; const ui_menu_event *event; @@ -1465,7 +1465,7 @@ void ui_mess_menu_bitbanger_control(running_machine *machine, ui_menu *menu, voi { int index = menustate->index; device_image_interface *device = NULL; - for (bool gotone = machine->m_devicelist.first(device); gotone; gotone = device->next(device)) + for (bool gotone = machine.m_devicelist.first(device); gotone; gotone = device->next(device)) { if(device->device().type() == BITBANGER) { if (index==0) break; diff --git a/src/emu/uiimage.h b/src/emu/uiimage.h index 5c83d64e44e..31881cdbdb9 100644 --- a/src/emu/uiimage.h +++ b/src/emu/uiimage.h @@ -20,12 +20,12 @@ FUNCTION PROTOTYPES ***************************************************************************/ -void ui_image_menu_file_manager(running_machine *machine, ui_menu *menu, void *parameter, void *state); +void ui_image_menu_file_manager(running_machine &machine, ui_menu *menu, void *parameter, void *state); -void ui_image_menu_image_info(running_machine *machine, ui_menu *menu, void *parameter, void *state); +void ui_image_menu_image_info(running_machine &machine, ui_menu *menu, void *parameter, void *state); -void ui_mess_menu_bitbanger_control(running_machine *machine, ui_menu *menu, void *parameter, void *state); +void ui_mess_menu_bitbanger_control(running_machine &machine, ui_menu *menu, void *parameter, void *state); -void ui_mess_menu_tape_control(running_machine *machine, ui_menu *menu, void *parameter, void *state); +void ui_mess_menu_tape_control(running_machine &machine, ui_menu *menu, void *parameter, void *state); #endif /* __UIIMAGE_H__ */ diff --git a/src/emu/uiinput.c b/src/emu/uiinput.c index 486d710ff54..1a7af6dda67 100644 --- a/src/emu/uiinput.c +++ b/src/emu/uiinput.c @@ -59,7 +59,7 @@ struct _ui_input_private FUNCTION PROTOYPES ***************************************************************************/ -//static void ui_input_frame_update(running_machine *machine); +//static void ui_input_frame_update(running_machine &machine); @@ -72,15 +72,15 @@ struct _ui_input_private system -------------------------------------------------*/ -void ui_input_init(running_machine *machine) +void ui_input_init(running_machine &machine) { /* create the private data */ - machine->ui_input_data = auto_alloc_clear(machine, ui_input_private); - machine->ui_input_data->current_mouse_x = -1; - machine->ui_input_data->current_mouse_y = -1; + machine.ui_input_data = auto_alloc_clear(machine, ui_input_private); + machine.ui_input_data->current_mouse_x = -1; + machine.ui_input_data->current_mouse_y = -1; /* add a frame callback to poll inputs */ - machine->add_notifier(MACHINE_NOTIFY_FRAME, ui_input_frame_update); + machine.add_notifier(MACHINE_NOTIFY_FRAME, ui_input_frame_update); } @@ -103,7 +103,7 @@ void ui_input_frame_update(running_machine &machine) /* update the state of all the UI keys */ for (code = __ipt_ui_start; code <= __ipt_ui_end; code++) { - int pressed = input_seq_pressed(&machine, input_type_seq(&machine, code, 0, SEQ_TYPE_STANDARD)); + int pressed = input_seq_pressed(machine, input_type_seq(machine, code, 0, SEQ_TYPE_STANDARD)); if (!pressed || uidata->seqpressed[code] != SEQ_PRESSED_RESET) uidata->seqpressed[code] = pressed; } @@ -115,9 +115,9 @@ void ui_input_frame_update(running_machine &machine) onto the queue -------------------------------------------------*/ -int ui_input_push_event(running_machine *machine, ui_event evt) +int ui_input_push_event(running_machine &machine, ui_event evt) { - ui_input_private *uidata = machine->ui_input_data; + ui_input_private *uidata = machine.ui_input_data; /* we may be called before the UI is initialized */ if (uidata == NULL) @@ -168,9 +168,9 @@ int ui_input_push_event(running_machine *machine, ui_event evt) ui_input_pop_event - pops an event off of the queue -------------------------------------------------*/ -int ui_input_pop_event(running_machine *machine, ui_event *evt) +int ui_input_pop_event(running_machine &machine, ui_event *evt) { - ui_input_private *uidata = machine->ui_input_data; + ui_input_private *uidata = machine.ui_input_data; int result; if (uidata->events_start != uidata->events_end) @@ -193,9 +193,9 @@ int ui_input_pop_event(running_machine *machine, ui_event *evt) and resets the sequence states -------------------------------------------------*/ -void ui_input_reset(running_machine *machine) +void ui_input_reset(running_machine &machine) { - ui_input_private *uidata = machine->ui_input_data; + ui_input_private *uidata = machine.ui_input_data; int code; uidata->events_start = 0; @@ -213,9 +213,9 @@ void ui_input_reset(running_machine *machine) location of the mouse -------------------------------------------------*/ -render_target *ui_input_find_mouse(running_machine *machine, INT32 *x, INT32 *y, int *button) +render_target *ui_input_find_mouse(running_machine &machine, INT32 *x, INT32 *y, int *button) { - ui_input_private *uidata = machine->ui_input_data; + ui_input_private *uidata = machine.ui_input_data; if (x != NULL) *x = uidata->current_mouse_x; if (y != NULL) @@ -237,7 +237,7 @@ render_target *ui_input_find_mouse(running_machine *machine, INT32 *x, INT32 *y, detected -------------------------------------------------*/ -int ui_input_pressed(running_machine *machine, int code) +int ui_input_pressed(running_machine &machine, int code) { return ui_input_pressed_repeat(machine, code, 0); } @@ -250,9 +250,9 @@ int ui_input_pressed(running_machine *machine, int code) is triggered -------------------------------------------------*/ -int ui_input_pressed_repeat(running_machine *machine, int code, int speed) +int ui_input_pressed_repeat(running_machine &machine, int code, int speed) { - ui_input_private *uidata = machine->ui_input_data; + ui_input_private *uidata = machine.ui_input_data; int pressed = FALSE; g_profiler.start(PROFILER_INPUT); diff --git a/src/emu/uiinput.h b/src/emu/uiinput.h index dc0d3382b28..5923fb501de 100644 --- a/src/emu/uiinput.h +++ b/src/emu/uiinput.h @@ -55,7 +55,7 @@ struct _ui_event /* ----- core system management ----- */ /* initialization */ -void ui_input_init(running_machine *machine); +void ui_input_init(running_machine &machine); @@ -64,27 +64,27 @@ void ui_input_init(running_machine *machine); void ui_input_frame_update(running_machine &machine); /* pushes a single event onto the queue */ -int ui_input_push_event(running_machine *machine, ui_event event); +int ui_input_push_event(running_machine &machine, ui_event event); /* pops an event off of the queue */ -int ui_input_pop_event(running_machine *machine, ui_event *event); +int ui_input_pop_event(running_machine &machine, ui_event *event); /* clears all outstanding events */ -void ui_input_reset(running_machine *machine); +void ui_input_reset(running_machine &machine); /* retrieves the current location of the mouse */ -render_target *ui_input_find_mouse(running_machine *machine, INT32 *x, INT32 *y, int *button); +render_target *ui_input_find_mouse(running_machine &machine, INT32 *x, INT32 *y, int *button); /* ----- user interface sequence reading ----- */ /* return TRUE if a key down for the given user interface sequence is detected */ -int ui_input_pressed(running_machine *machine, int code); +int ui_input_pressed(running_machine &machine, int code); /* return TRUE if a key down for the given user interface sequence is detected, or if autorepeat at the given speed is triggered */ -int ui_input_pressed_repeat(running_machine *machine, int code, int speed); +int ui_input_pressed_repeat(running_machine &machine, int code, int speed); @@ -97,7 +97,7 @@ int ui_input_pressed_repeat(running_machine *machine, int code, int speed); move event to the specified render_target -------------------------------------------------*/ -INLINE void ui_input_push_mouse_move_event(running_machine *machine, render_target *target, INT32 x, INT32 y) +INLINE void ui_input_push_mouse_move_event(running_machine &machine, render_target *target, INT32 x, INT32 y) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_MOUSE_MOVE; @@ -113,7 +113,7 @@ INLINE void ui_input_push_mouse_move_event(running_machine *machine, render_targ mouse leave event to the specified render_target -------------------------------------------------*/ -INLINE void ui_input_push_mouse_leave_event(running_machine *machine, render_target *target) +INLINE void ui_input_push_mouse_leave_event(running_machine &machine, render_target *target) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_MOUSE_LEAVE; @@ -127,7 +127,7 @@ INLINE void ui_input_push_mouse_leave_event(running_machine *machine, render_tar down event to the specified render_target -------------------------------------------------*/ -INLINE void ui_input_push_mouse_down_event(running_machine *machine, render_target *target, INT32 x, INT32 y) +INLINE void ui_input_push_mouse_down_event(running_machine &machine, render_target *target, INT32 x, INT32 y) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_MOUSE_DOWN; @@ -143,7 +143,7 @@ INLINE void ui_input_push_mouse_down_event(running_machine *machine, render_targ down event to the specified render_target -------------------------------------------------*/ -INLINE void ui_input_push_mouse_up_event(running_machine *machine, render_target *target, INT32 x, INT32 y) +INLINE void ui_input_push_mouse_up_event(running_machine &machine, render_target *target, INT32 x, INT32 y) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_MOUSE_UP; @@ -160,7 +160,7 @@ INLINE void ui_input_push_mouse_up_event(running_machine *machine, render_target render_target -------------------------------------------------*/ -INLINE void ui_input_push_mouse_double_click_event(running_machine *machine, render_target *target, INT32 x, INT32 y) +INLINE void ui_input_push_mouse_double_click_event(running_machine &machine, render_target *target, INT32 x, INT32 y) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_MOUSE_DOUBLE_CLICK; @@ -176,7 +176,7 @@ INLINE void ui_input_push_mouse_double_click_event(running_machine *machine, ren to the specified render_target -------------------------------------------------*/ -INLINE void ui_input_push_char_event(running_machine *machine, render_target *target, unicode_char ch) +INLINE void ui_input_push_char_event(running_machine &machine, render_target *target, unicode_char ch) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_CHAR; diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index d628cd67298..efd14614b1b 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -118,7 +118,9 @@ struct _ui_menu_item struct _ui_menu { - running_machine * machine; /* machine we are attached to */ + running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } + + running_machine * m_machine; /* machine we are attached to */ render_container * container; /* render_container we render to */ ui_menu_handler_func handler; /* handler callback */ void * parameter; /* parameter */ @@ -252,59 +254,59 @@ static const char exittext[] = "Exit"; static void ui_menu_exit(running_machine &machine); /* internal menu processing */ -static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly); +static void ui_menu_draw(running_machine &machine, ui_menu *menu, int customonly); static void ui_menu_draw_text_box(ui_menu *menu); static void ui_menu_handle_events(ui_menu *menu); static void ui_menu_handle_keys(ui_menu *menu, UINT32 flags); static void ui_menu_validate_selection(ui_menu *menu, int scandir); -static void ui_menu_clear_free_list(running_machine *machine); +static void ui_menu_clear_free_list(running_machine &machine); /* menu handlers */ -static void menu_main(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_main_populate(running_machine *machine, ui_menu *menu, void *state); -static void menu_input_groups(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_input_groups_populate(running_machine *machine, ui_menu *menu, void *state); -static void menu_input_general(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_input_general_populate(running_machine *machine, ui_menu *menu, input_menu_state *menustate, int group); -static void menu_input_specific(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_input_specific_populate(running_machine *machine, ui_menu *menu, input_menu_state *menustate); -static void menu_input_common(running_machine *machine, ui_menu *menu, void *parameter, void *state); +static void menu_main(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_main_populate(running_machine &machine, ui_menu *menu, void *state); +static void menu_input_groups(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_input_groups_populate(running_machine &machine, ui_menu *menu, void *state); +static void menu_input_general(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_input_general_populate(running_machine &machine, ui_menu *menu, input_menu_state *menustate, int group); +static void menu_input_specific(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_input_specific_populate(running_machine &machine, ui_menu *menu, input_menu_state *menustate); +static void menu_input_common(running_machine &machine, ui_menu *menu, void *parameter, void *state); static int CLIB_DECL menu_input_compare_items(const void *i1, const void *i2); -static void menu_input_populate_and_sort(running_machine *machine, ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate); -static void menu_settings_dip_switches(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_settings_driver_config(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_settings_categories(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_settings_common(running_machine *machine, ui_menu *menu, void *state, UINT32 type); -static void menu_settings_populate(running_machine *machine, ui_menu *menu, settings_menu_state *menustate, UINT32 type); -static void menu_analog(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_analog_populate(running_machine *machine, ui_menu *menu); -static void menu_bookkeeping(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_bookkeeping_populate(running_machine *machine, ui_menu *menu, attotime *curtime); -static void menu_game_info(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_cheat(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_cheat_populate(running_machine *machine, ui_menu *menu); -static void menu_memory_card(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_memory_card_populate(running_machine *machine, ui_menu *menu, int cardnum); -static void menu_sliders(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_sliders_populate(running_machine *machine, ui_menu *menu, int menuless_mode); -static void menu_sliders_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2); -static void menu_video_targets(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_video_targets_populate(running_machine *machine, ui_menu *menu); -static void menu_video_options(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_video_options_populate(running_machine *machine, ui_menu *menu, render_target *target); -static void menu_crosshair(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_crosshair_populate(running_machine *machine, ui_menu *menu); -static void menu_quit_game(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_select_game(running_machine *machine, ui_menu *menu, void *parameter, void *state); -static void menu_select_game_populate(running_machine *machine, ui_menu *menu, select_game_state *menustate); +static void menu_input_populate_and_sort(running_machine &machine, ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate); +static void menu_settings_dip_switches(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_settings_driver_config(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_settings_categories(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_settings_common(running_machine &machine, ui_menu *menu, void *state, UINT32 type); +static void menu_settings_populate(running_machine &machine, ui_menu *menu, settings_menu_state *menustate, UINT32 type); +static void menu_analog(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_analog_populate(running_machine &machine, ui_menu *menu); +static void menu_bookkeeping(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_bookkeeping_populate(running_machine &machine, ui_menu *menu, attotime *curtime); +static void menu_game_info(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_cheat(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_cheat_populate(running_machine &machine, ui_menu *menu); +static void menu_memory_card(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_memory_card_populate(running_machine &machine, ui_menu *menu, int cardnum); +static void menu_sliders(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_sliders_populate(running_machine &machine, ui_menu *menu, int menuless_mode); +static void menu_sliders_custom_render(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2); +static void menu_video_targets(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_video_targets_populate(running_machine &machine, ui_menu *menu); +static void menu_video_options(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_video_options_populate(running_machine &machine, ui_menu *menu, render_target *target); +static void menu_crosshair(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_crosshair_populate(running_machine &machine, ui_menu *menu); +static void menu_quit_game(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_select_game(running_machine &machine, ui_menu *menu, void *parameter, void *state); +static void menu_select_game_populate(running_machine &machine, ui_menu *menu, select_game_state *menustate); static int CLIB_DECL menu_select_game_driver_compare(const void *elem1, const void *elem2); static void menu_select_game_build_driver_list(ui_menu *menu, select_game_state *menustate); -static void menu_select_game_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2); +static void menu_select_game_custom_render(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2); /* menu helpers */ static void menu_render_triangle(bitmap_t &dest, const bitmap_t &source, const rectangle &sbounds, void *param); static void menu_settings_custom_render_one(render_container *container, float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask); -static void menu_settings_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2); +static void menu_settings_custom_render(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2); @@ -320,7 +322,7 @@ static void menu_settings_custom_render(running_machine *machine, ui_menu *menu, INLINE const input_seq *get_field_default_seq(const input_field_config *field, input_seq_type seqtype) { if (input_seq_get_1(&field->seq[seqtype]) == SEQCODE_DEFAULT) - return input_type_seq(field->port->machine, field->type, field->player, seqtype); + return input_type_seq(field->port->machine(), field->type, field->player, seqtype); else return &field->seq[seqtype]; } @@ -362,7 +364,7 @@ INLINE int item_is_selectable(const ui_menu_item *item) INLINE int exclusive_input_pressed(ui_menu *menu, int key, int repeat) { - if (menu->menu_event.iptkey == IPT_INVALID && ui_input_pressed_repeat(menu->machine, key, repeat)) + if (menu->menu_event.iptkey == IPT_INVALID && ui_input_pressed_repeat(menu->machine(), key, repeat)) { menu->menu_event.iptkey = key; return TRUE; @@ -380,7 +382,7 @@ INLINE int exclusive_input_pressed(ui_menu *menu, int key, int repeat) ui_menu_init - initialize the menu system -------------------------------------------------*/ -void ui_menu_init(running_machine *machine) +void ui_menu_init(running_machine &machine) { int x; @@ -396,14 +398,14 @@ void ui_menu_init(running_machine *machine) if (x > 256 - 25) alpha = 0xff * (255 - x) / 25; *BITMAP_ADDR32(hilight_bitmap, 0, x) = MAKE_ARGB(alpha,0xff,0xff,0xff); } - hilight_texture = machine->render().texture_alloc(); + hilight_texture = machine.render().texture_alloc(); hilight_texture->set_bitmap(hilight_bitmap, NULL, TEXFORMAT_ARGB32); /* create a texture for arrow icons */ - arrow_texture = machine->render().texture_alloc(menu_render_triangle); + arrow_texture = machine.render().texture_alloc(menu_render_triangle); /* add an exit callback to free memory */ - machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_menu_exit); + machine.add_notifier(MACHINE_NOTIFY_EXIT, ui_menu_exit); } @@ -414,8 +416,8 @@ void ui_menu_init(running_machine *machine) static void ui_menu_exit(running_machine &machine) { /* free menus */ - ui_menu_stack_reset(&machine); - ui_menu_clear_free_list(&machine); + ui_menu_stack_reset(machine); + ui_menu_clear_free_list(machine); /* free textures */ machine.render().texture_free(hilight_texture); @@ -432,7 +434,7 @@ static void ui_menu_exit(running_machine &machine) ui_menu_alloc - allocate a new menu -------------------------------------------------*/ -ui_menu *ui_menu_alloc(running_machine *machine, render_container *container, ui_menu_handler_func handler, void *parameter) +ui_menu *ui_menu_alloc(running_machine &machine, render_container *container, ui_menu_handler_func handler, void *parameter) { ui_menu *menu; @@ -440,7 +442,7 @@ ui_menu *ui_menu_alloc(running_machine *machine, render_container *container, ui menu = auto_alloc_clear(machine, ui_menu); /* initialize the state */ - menu->machine = machine; + menu->m_machine = &machine; menu->container = container; menu->handler = handler; menu->parameter = parameter; @@ -462,23 +464,23 @@ void ui_menu_free(ui_menu *menu) { ui_menu_pool *pool = menu->pool; menu->pool = pool->next; - auto_free(menu->machine, pool); + auto_free(menu->machine(), pool); } /* free the item array */ if (menu->item != NULL) - auto_free(menu->machine, menu->item); + auto_free(menu->machine(), menu->item); /* free the state */ if (menu->state != NULL) { if (menu->destroy_state != NULL) (*menu->destroy_state)(menu, menu->state); - auto_free(menu->machine, menu->state); + auto_free(menu->machine(), menu->state); } /* free the menu */ - auto_free(menu->machine, menu); + auto_free(menu->machine(), menu); } @@ -550,10 +552,10 @@ void ui_menu_item_append(ui_menu *menu, const char *text, const char *subtext, U { int olditems = menu->allocitems; menu->allocitems += UI_MENU_ALLOC_ITEMS; - ui_menu_item *newitems = auto_alloc_array(menu->machine, ui_menu_item, menu->allocitems); + ui_menu_item *newitems = auto_alloc_array(menu->machine(), ui_menu_item, menu->allocitems); for (int itemnum = 0; itemnum < olditems; itemnum++) newitems[itemnum] = menu->item[itemnum]; - auto_free(menu->machine, menu->item); + auto_free(menu->machine(), menu->item); menu->item = newitems; } index = menu->numitems++; @@ -585,7 +587,7 @@ void ui_menu_item_append(ui_menu *menu, const char *text, const char *subtext, U and returning any interesting events -------------------------------------------------*/ -const ui_menu_event *ui_menu_process(running_machine *machine, ui_menu *menu, UINT32 flags) +const ui_menu_event *ui_menu_process(running_machine &machine, ui_menu *menu, UINT32 flags) { /* reset the menu_event */ menu->menu_event.iptkey = IPT_INVALID; @@ -644,9 +646,9 @@ void *ui_menu_alloc_state(ui_menu *menu, size_t size, ui_menu_destroy_state_func { if (menu->destroy_state != NULL) (*menu->destroy_state)(menu, menu->state); - auto_free(menu->machine, menu->state); + auto_free(menu->machine(), menu->state); } - menu->state = auto_alloc_array_clear(menu->machine, UINT8, size); + menu->state = auto_alloc_array_clear(menu->machine(), UINT8, size); menu->destroy_state = destroy_state; return menu->state; @@ -674,7 +676,7 @@ void *ui_menu_pool_alloc(ui_menu *menu, size_t size) } /* allocate a new pool */ - pool = (ui_menu_pool *)auto_alloc_array_clear(menu->machine, UINT8, sizeof(*pool) + UI_MENU_POOL_SIZE); + pool = (ui_menu_pool *)auto_alloc_array_clear(menu->machine(), UINT8, sizeof(*pool) + UI_MENU_POOL_SIZE); /* wire it up */ pool->next = menu->pool; @@ -735,11 +737,11 @@ void ui_menu_set_selection(ui_menu *menu, void *selected_itemref) ui_menu_draw - draw a menu -------------------------------------------------*/ -static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly) +static void ui_menu_draw(running_machine &machine, ui_menu *menu, int customonly) { - float line_height = ui_get_line_height(*machine); - float lr_arrow_width = 0.4f * line_height * machine->render().ui_aspect(); - float ud_arrow_width = line_height * machine->render().ui_aspect(); + float line_height = ui_get_line_height(machine); + float lr_arrow_width = 0.4f * line_height * machine.render().ui_aspect(); + float ud_arrow_width = line_height * machine.render().ui_aspect(); float gutter_width = lr_arrow_width * 1.3f; float x1, y1, x2, y2; @@ -765,11 +767,11 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly float total_width; /* compute width of left hand side */ - total_width = gutter_width + ui_get_string_width(*machine, item->text) + gutter_width; + total_width = gutter_width + ui_get_string_width(machine, item->text) + gutter_width; /* add in width of right hand side */ if (item->subtext) - total_width += 2.0f * gutter_width + ui_get_string_width(*machine, item->subtext); + total_width += 2.0f * gutter_width + ui_get_string_width(machine, item->subtext); /* track the maximum */ if (total_width > visible_width) @@ -933,7 +935,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly item_width += 2.0f * gutter_width; /* if the subitem doesn't fit here, display dots */ - if (ui_get_string_width(*machine, subitem_text) > effective_width - item_width) + if (ui_get_string_width(machine, subitem_text) > effective_width - item_width) { subitem_text = "..."; if (itemnum == menu->selected) @@ -1003,7 +1005,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly if (menu->custom != NULL) { void *selectedref = (menu->selected >= 0 && menu->selected < menu->numitems) ? menu->item[menu->selected].ref : NULL; - (*menu->custom)(menu->machine, menu, menu->state, selectedref, menu->customtop, menu->custombottom, x1, y1, x2, y2); + (*menu->custom)(menu->machine(), menu, menu->state, selectedref, menu->customtop, menu->custombottom, x1, y1, x2, y2); } /* return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow */ @@ -1021,8 +1023,8 @@ static void ui_menu_draw_text_box(ui_menu *menu) { const char *text = menu->item[0].text; const char *backtext = menu->item[1].text; - float line_height = ui_get_line_height(*menu->machine); - float lr_arrow_width = 0.4f * line_height * menu->machine->render().ui_aspect(); + float line_height = ui_get_line_height(menu->machine()); + float lr_arrow_width = 0.4f * line_height * menu->machine().render().ui_aspect(); float gutter_width = lr_arrow_width; float target_width, target_height, prior_width; float target_x, target_y; @@ -1035,7 +1037,7 @@ static void ui_menu_draw_text_box(ui_menu *menu) target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height; /* maximum against "return to prior menu" text */ - prior_width = ui_get_string_width(*menu->machine, backtext) + 2.0f * gutter_width; + prior_width = ui_get_string_width(menu->machine(), backtext) + 2.0f * gutter_width; target_width = MAX(target_width, prior_width); /* determine the target location */ @@ -1088,7 +1090,7 @@ static void ui_menu_handle_events(ui_menu *menu) ui_event menu_event; /* loop while we have interesting events */ - while (ui_input_pop_event(menu->machine, &menu_event) && !stop) + while (ui_input_pop_event(menu->machine(), &menu_event) && !stop) { switch (menu_event.event_type) { @@ -1119,7 +1121,7 @@ static void ui_menu_handle_events(ui_menu *menu) if (menu->selected == menu->numitems - 1) { menu->menu_event.iptkey = IPT_UI_CANCEL; - ui_menu_stack_pop(menu->machine); + ui_menu_stack_pop(menu->machine()); } } stop = TRUE; @@ -1163,7 +1165,7 @@ static void ui_menu_handle_keys(ui_menu *menu, UINT32 flags) if (menu->selected == menu->numitems - 1) { menu->menu_event.iptkey = IPT_UI_CANCEL; - ui_menu_stack_pop(menu->machine); + ui_menu_stack_pop(menu->machine()); } return; } @@ -1171,7 +1173,7 @@ static void ui_menu_handle_keys(ui_menu *menu, UINT32 flags) /* hitting cancel also pops the stack */ if (exclusive_input_pressed(menu, IPT_UI_CANCEL, 0)) { - ui_menu_stack_pop(menu->machine); + ui_menu_stack_pop(menu->machine()); return; } @@ -1233,15 +1235,15 @@ static void ui_menu_handle_keys(ui_menu *menu, UINT32 flags) /* pause enables/disables pause */ if (!ignorepause && exclusive_input_pressed(menu, IPT_UI_PAUSE, 0)) { - if (menu->machine->paused()) - menu->machine->resume(); + if (menu->machine().paused()) + menu->machine().resume(); else - menu->machine->pause(); + menu->machine().pause(); } /* handle a toggle cheats request */ - if (ui_input_pressed_repeat(menu->machine, IPT_UI_TOGGLE_CHEAT, 0)) - menu->machine->cheat().set_enable(!menu->machine->cheat().enabled()); + if (ui_input_pressed_repeat(menu->machine(), IPT_UI_TOGGLE_CHEAT, 0)) + menu->machine().cheat().set_enable(!menu->machine().cheat().enabled()); /* see if any other UI keys are pressed */ if (menu->menu_event.iptkey == IPT_INVALID) @@ -1281,7 +1283,7 @@ static void ui_menu_validate_selection(ui_menu *menu, int scandir) accumulated in the free list -------------------------------------------------*/ -static void ui_menu_clear_free_list(running_machine *machine) +static void ui_menu_clear_free_list(running_machine &machine) { while (menu_free != NULL) { @@ -1301,7 +1303,7 @@ static void ui_menu_clear_free_list(running_machine *machine) ui_menu_stack_reset - reset the menu stack -------------------------------------------------*/ -void ui_menu_stack_reset(running_machine *machine) +void ui_menu_stack_reset(running_machine &machine) { while (menu_stack != NULL) ui_menu_stack_pop(machine); @@ -1318,7 +1320,7 @@ void ui_menu_stack_push(ui_menu *menu) menu->parent = menu_stack; menu_stack = menu; ui_menu_reset(menu, UI_MENU_RESET_SELECT_FIRST); - ui_input_reset(menu->machine); + ui_input_reset(menu->machine()); } @@ -1326,7 +1328,7 @@ void ui_menu_stack_push(ui_menu *menu) ui_menu_stack_pop - pop a menu from the stack -------------------------------------------------*/ -void ui_menu_stack_pop(running_machine *machine) +void ui_menu_stack_pop(running_machine &machine) { if (menu_stack != NULL) { @@ -1349,7 +1351,7 @@ void ui_menu_stack_pop(running_machine *machine) and calls the menu handler -------------------------------------------------*/ -UINT32 ui_menu_ui_handler(running_machine *machine, render_container *container, UINT32 state) +UINT32 ui_menu_ui_handler(running_machine &machine, render_container *container, UINT32 state) { /* if we have no menus stacked up, start with the main menu */ if (menu_stack == NULL) @@ -1379,7 +1381,7 @@ UINT32 ui_menu_ui_handler(running_machine *machine, render_container *container, standard menu handler -------------------------------------------------*/ -UINT32 ui_slider_ui_handler(running_machine *machine, render_container *container, UINT32 state) +UINT32 ui_slider_ui_handler(running_machine &machine, render_container *container, UINT32 state) { UINT32 result; @@ -1403,9 +1405,9 @@ UINT32 ui_slider_ui_handler(running_machine *machine, render_container *containe select menu to be visible and inescapable -------------------------------------------------*/ -void ui_menu_force_game_select(running_machine *machine, render_container *container) +void ui_menu_force_game_select(running_machine &machine, render_container *container) { - char *gamename = (char *)machine->options().system_name(); + char *gamename = (char *)machine.options().system_name(); /* reset the menu stack */ ui_menu_stack_reset(machine); @@ -1418,7 +1420,7 @@ void ui_menu_force_game_select(running_machine *machine, render_container *conta ui_show_menu(); /* make sure MAME is paused */ - machine->pause(); + machine.pause(); } @@ -1449,7 +1451,7 @@ int ui_menu_is_force_game_select(void) menu_main - handle the main menu -------------------------------------------------*/ -static void menu_main(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_main(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *menu_event; @@ -1468,7 +1470,7 @@ static void menu_main(running_machine *machine, ui_menu *menu, void *parameter, ui_menu_keyboard_mode - menu that -------------------------------------------------*/ -static void ui_menu_keyboard_mode(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void ui_menu_keyboard_mode(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *menu_event; int natural = ui_get_use_natural_keyboard(machine); @@ -1495,7 +1497,7 @@ static void ui_menu_keyboard_mode(running_machine *machine, ui_menu *menu, void menu_main_populate - populate the main menu -------------------------------------------------*/ -static void menu_main_populate(running_machine *machine, ui_menu *menu, void *state) +static void menu_main_populate(running_machine &machine, ui_menu *menu, void *state) { const input_field_config *field; const input_port_config *port; @@ -1505,7 +1507,7 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st int has_dips = FALSE; /* scan the input port array to see what options we need to enable */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) { if (field->type == IPT_DIPSWITCH) @@ -1539,7 +1541,7 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st ui_menu_item_append(menu, CAPSTARTGAMENOUN " Information", NULL, 0, (void *)menu_game_info); device_image_interface *image = NULL; - if (machine->m_devicelist.first(image)) + if (machine.m_devicelist.first(image)) { /* add image info menu */ ui_menu_item_append(menu, "Image Information", NULL, 0, (void*)ui_image_menu_image_info); @@ -1548,11 +1550,11 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st ui_menu_item_append(menu, "File Manager", NULL, 0, (void*)ui_image_menu_file_manager); /* add tape control menu */ - if (machine->m_devicelist.first(CASSETTE)) + if (machine.m_devicelist.first(CASSETTE)) ui_menu_item_append(menu, "Tape Control", NULL, 0, (void*)ui_mess_menu_tape_control); /* add bitbanger control menu */ - if (machine->m_devicelist.first(BITBANGER)) + if (machine.m_devicelist.first(BITBANGER)) ui_menu_item_append(menu, "Bitbanger Control", NULL, 0, (void*)ui_mess_menu_bitbanger_control); } /* add keyboard mode menu */ @@ -1563,18 +1565,18 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st ui_menu_item_append(menu, "Slider Controls", NULL, 0, (void *)menu_sliders); /* add video options menu */ - ui_menu_item_append(menu, "Video Options", NULL, 0, (machine->render().target_by_index(1) != NULL) ? (void *)menu_video_targets : (void *)menu_video_options); + ui_menu_item_append(menu, "Video Options", NULL, 0, (machine.render().target_by_index(1) != NULL) ? (void *)menu_video_targets : (void *)menu_video_options); /* add crosshair options menu */ if (crosshair_get_usage(machine)) ui_menu_item_append(menu, "Crosshair Options", NULL, 0, (void *)menu_crosshair); /* add cheat menu */ - if (machine->options().cheat() && machine->cheat().first() != NULL) + if (machine.options().cheat() && machine.cheat().first() != NULL) 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 */ @@ -1587,7 +1589,7 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st menu -------------------------------------------------*/ -static void menu_input_groups(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_input_groups(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *menu_event; @@ -1607,7 +1609,7 @@ static void menu_input_groups(running_machine *machine, ui_menu *menu, void *par input groups menu -------------------------------------------------*/ -static void menu_input_groups_populate(running_machine *machine, ui_menu *menu, void *state) +static void menu_input_groups_populate(running_machine &machine, ui_menu *menu, void *state) { int player; @@ -1629,7 +1631,7 @@ static void menu_input_groups_populate(running_machine *machine, ui_menu *menu, input menu -------------------------------------------------*/ -static void menu_input_general(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_input_general(running_machine &machine, ui_menu *menu, void *parameter, void *state) { menu_input_common(machine, menu, parameter, state); } @@ -1640,7 +1642,7 @@ static void menu_input_general(running_machine *machine, ui_menu *menu, void *pa general input menu -------------------------------------------------*/ -static void menu_input_general_populate(running_machine *machine, ui_menu *menu, input_menu_state *menustate, int group) +static void menu_input_general_populate(running_machine &machine, ui_menu *menu, input_menu_state *menustate, int group) { input_item_data *itemlist = NULL; const input_type_desc *typedesc; @@ -1694,7 +1696,7 @@ static void menu_input_general_populate(running_machine *machine, ui_menu *menu, input menu -------------------------------------------------*/ -static void menu_input_specific(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_input_specific(running_machine &machine, ui_menu *menu, void *parameter, void *state) { menu_input_common(machine, menu, NULL, state); } @@ -1705,7 +1707,7 @@ static void menu_input_specific(running_machine *machine, ui_menu *menu, void *p the input menu with game-specific items -------------------------------------------------*/ -static void menu_input_specific_populate(running_machine *machine, ui_menu *menu, input_menu_state *menustate) +static void menu_input_specific_populate(running_machine &machine, ui_menu *menu, input_menu_state *menustate) { input_item_data *itemlist = NULL; const input_field_config *field; @@ -1719,7 +1721,7 @@ static void menu_input_specific_populate(running_machine *machine, ui_menu *menu suborder[SEQ_TYPE_INCREMENT] = 2; /* iterate over the input ports and add menu items */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) { const char *name = input_field_name(field); @@ -1770,7 +1772,7 @@ static void menu_input_specific_populate(running_machine *machine, ui_menu *menu menu_input - display a menu for inputs -------------------------------------------------*/ -static void menu_input_common(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_input_common(running_machine &machine, ui_menu *menu, void *parameter, void *state) { input_item_data *seqchangeditem = NULL; input_menu_state *menustate; @@ -1906,7 +1908,7 @@ static int menu_input_compare_items(const void *i1, const void *i2) menu from them -------------------------------------------------*/ -static void menu_input_populate_and_sort(running_machine *machine, ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate) +static void menu_input_populate_and_sort(running_machine &machine, ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate) { const char *nameformat[INPUT_TYPE_TOTAL] = { 0 }; input_item_data **itemarray, *item; @@ -1967,7 +1969,7 @@ static void menu_input_populate_and_sort(running_machine *machine, ui_menu *menu switches menu -------------------------------------------------*/ -static void menu_settings_dip_switches(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_settings_dip_switches(running_machine &machine, ui_menu *menu, void *parameter, void *state) { menu_settings_common(machine, menu, state, IPT_DIPSWITCH); } @@ -1978,7 +1980,7 @@ static void menu_settings_dip_switches(running_machine *machine, ui_menu *menu, driver config menu -------------------------------------------------*/ -static void menu_settings_driver_config(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_settings_driver_config(running_machine &machine, ui_menu *menu, void *parameter, void *state) { menu_settings_common(machine, menu, state, IPT_CONFIG); } @@ -1989,7 +1991,7 @@ static void menu_settings_driver_config(running_machine *machine, ui_menu *menu, categories menu -------------------------------------------------*/ -static void menu_settings_categories(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_settings_categories(running_machine &machine, ui_menu *menu, void *parameter, void *state) { menu_settings_common(machine, menu, state, IPT_CATEGORY); } @@ -2000,7 +2002,7 @@ static void menu_settings_categories(running_machine *machine, ui_menu *menu, vo switches menus -------------------------------------------------*/ -static void menu_settings_common(running_machine *machine, ui_menu *menu, void *state, UINT32 type) +static void menu_settings_common(running_machine &machine, ui_menu *menu, void *state, UINT32 type) { settings_menu_state *menustate; const ui_menu_event *menu_event; @@ -2059,7 +2061,7 @@ static void menu_settings_common(running_machine *machine, ui_menu *menu, void * switches menus -------------------------------------------------*/ -static void menu_settings_populate(running_machine *machine, ui_menu *menu, settings_menu_state *menustate, UINT32 type) +static void menu_settings_populate(running_machine &machine, ui_menu *menu, settings_menu_state *menustate, UINT32 type) { const input_field_config *field; const input_port_config *port; @@ -2071,7 +2073,7 @@ static void menu_settings_populate(running_machine *machine, ui_menu *menu, sett diplist_tailptr = &menustate->diplist; /* loop over input ports and set up the current values */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) if (field->type == type && input_condition_true(machine, &field->condition)) { @@ -2141,7 +2143,7 @@ static void menu_settings_populate(running_machine *machine, ui_menu *menu, sett rendering -------------------------------------------------*/ -static void menu_settings_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2) +static void menu_settings_custom_render(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2) { const input_field_config *field = (const input_field_config *)selectedref; settings_menu_state *menustate = (settings_menu_state *)state; @@ -2248,7 +2250,7 @@ static void menu_settings_custom_render_one(render_container *container, float x menu_analog - handle the analog settings menu -------------------------------------------------*/ -static void menu_analog(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_analog(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *menu_event; @@ -2317,7 +2319,7 @@ static void menu_analog(running_machine *machine, ui_menu *menu, void *parameter settings menu -------------------------------------------------*/ -static void menu_analog_populate(running_machine *machine, ui_menu *menu) +static void menu_analog_populate(running_machine &machine, ui_menu *menu) { const input_field_config *field; const input_port_config *port; @@ -2325,7 +2327,7 @@ static void menu_analog_populate(running_machine *machine, ui_menu *menu) astring text; /* loop over input ports and add the items */ - for (port = machine->m_portlist.first(); port != NULL; port = port->next()) + for (port = machine.m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) if (input_type_is_analog(field->type) && input_condition_true(machine, &field->condition)) { @@ -2427,7 +2429,7 @@ static void menu_analog_populate(running_machine *machine, ui_menu *menu) information menu -------------------------------------------------*/ -static void menu_bookkeeping(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_bookkeeping(running_machine &machine, ui_menu *menu, void *parameter, void *state) { attotime *prevtime; attotime curtime; @@ -2438,7 +2440,7 @@ static void menu_bookkeeping(running_machine *machine, ui_menu *menu, void *para prevtime = (attotime *)state; /* if the time has rolled over another second, regenerate */ - curtime = machine->time(); + curtime = machine.time(); if (prevtime->seconds != curtime.seconds) { ui_menu_reset(menu, UI_MENU_RESET_SELECT_FIRST); @@ -2456,7 +2458,7 @@ static void menu_bookkeeping(running_machine *machine, ui_menu *menu, void *para information menu -------------------------------------------------*/ -static void menu_bookkeeping_populate(running_machine *machine, ui_menu *menu, attotime *curtime) +static void menu_bookkeeping_populate(running_machine &machine, ui_menu *menu, attotime *curtime) { int tickets = get_dispensed_tickets(machine); astring tempstring; @@ -2502,7 +2504,7 @@ static void menu_bookkeeping_populate(running_machine *machine, ui_menu *menu, a menu -------------------------------------------------*/ -static void menu_game_info(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_game_info(running_machine &machine, ui_menu *menu, void *parameter, void *state) { /* if the menu isn't built, populate now */ if (!ui_menu_populated(menu)) @@ -2520,7 +2522,7 @@ static void menu_game_info(running_machine *machine, ui_menu *menu, void *parame menu_cheat - handle the cheat menu -------------------------------------------------*/ -static void menu_cheat(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_cheat(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *menu_event; @@ -2542,7 +2544,7 @@ static void menu_cheat(running_machine *machine, ui_menu *menu, void *parameter, /* handle reset all + reset all cheats for reload all option */ if ((FPTR)menu_event->itemref < 3 && menu_event->iptkey == IPT_UI_SELECT) { - for (cheat_entry *curcheat = machine->cheat().first(); curcheat != NULL; curcheat = curcheat->next()) + for (cheat_entry *curcheat = machine.cheat().first(); curcheat != NULL; curcheat = curcheat->next()) if (curcheat->select_default_state()) changed = true; } @@ -2590,7 +2592,7 @@ static void menu_cheat(running_machine *machine, ui_menu *menu, void *parameter, if ((FPTR)menu_event->itemref == 2 && menu_event->iptkey == IPT_UI_SELECT) { /* re-init cheat engine and thus reload cheats/cheats have already been turned off by here */ - machine->cheat().reload(); + machine.cheat().reload(); /* display the reloaded cheats */ ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_REF); @@ -2608,12 +2610,12 @@ static void menu_cheat(running_machine *machine, ui_menu *menu, void *parameter, menu_cheat_populate - populate the cheat menu -------------------------------------------------*/ -static void menu_cheat_populate(running_machine *machine, ui_menu *menu) +static void menu_cheat_populate(running_machine &machine, ui_menu *menu) { /* iterate over cheats */ astring text; astring subtext; - for (cheat_entry *curcheat = machine->cheat().first(); curcheat != NULL; curcheat = curcheat->next()) + for (cheat_entry *curcheat = machine.cheat().first(); curcheat != NULL; curcheat = curcheat->next()) { UINT32 flags; curcheat->menu_text(text, subtext, flags); @@ -2636,7 +2638,7 @@ static void menu_cheat_populate(running_machine *machine, ui_menu *menu) menu -------------------------------------------------*/ -static void menu_memory_card(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_memory_card(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *menu_event; int *cardnum; @@ -2665,10 +2667,10 @@ static void menu_memory_card(running_machine *machine, ui_menu *menu, void *para { /* handle card loading; if we succeed, clear the menus */ case MEMCARD_ITEM_LOAD: - if (memcard_insert(menu->machine, *cardnum) == 0) + if (memcard_insert(menu->machine(), *cardnum) == 0) { popmessage("Memory card loaded"); - ui_menu_stack_reset(menu->machine); + ui_menu_stack_reset(menu->machine()); } else popmessage("Error loading memory card"); @@ -2676,13 +2678,13 @@ static void menu_memory_card(running_machine *machine, ui_menu *menu, void *para /* handle card ejecting */ case MEMCARD_ITEM_EJECT: - memcard_eject(*menu->machine); + memcard_eject(menu->machine()); popmessage("Memory card ejected"); break; /* handle card creating */ case MEMCARD_ITEM_CREATE: - if (memcard_create(menu->machine, *cardnum, FALSE) == 0) + if (memcard_create(menu->machine(), *cardnum, FALSE) == 0) popmessage("Memory card created"); else popmessage("Error creating memory card\n(Card may already exist)"); @@ -2717,7 +2719,7 @@ static void menu_memory_card(running_machine *machine, ui_menu *menu, void *para memory card menu -------------------------------------------------*/ -static void menu_memory_card_populate(running_machine *machine, ui_menu *menu, int cardnum) +static void menu_memory_card_populate(running_machine &machine, ui_menu *menu, int cardnum) { char tempstring[20]; UINT32 flags = 0; @@ -2742,7 +2744,7 @@ static void menu_memory_card_populate(running_machine *machine, ui_menu *menu, i menu_sliders - handle the sliders menu -------------------------------------------------*/ -static void menu_sliders(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_sliders(running_machine &machine, ui_menu *menu, void *parameter, void *state) { int menuless_mode = (parameter != NULL); const ui_menu_event *menu_event; @@ -2852,7 +2854,7 @@ static void menu_sliders(running_machine *machine, ui_menu *menu, void *paramete menu -------------------------------------------------*/ -static void menu_sliders_populate(running_machine *machine, ui_menu *menu, int menuless_mode) +static void menu_sliders_populate(running_machine &machine, ui_menu *menu, int menuless_mode) { const slider_state *curslider; astring tempstring; @@ -2872,7 +2874,7 @@ static void menu_sliders_populate(running_machine *machine, ui_menu *menu, int m break; } - ui_menu_set_custom_render(menu, menu_sliders_custom_render, 0.0f, 2.0f * ui_get_line_height(*machine) + 2.0f * UI_BOX_TB_BORDER); + ui_menu_set_custom_render(menu, menu_sliders_custom_render, 0.0f, 2.0f * ui_get_line_height(machine) + 2.0f * UI_BOX_TB_BORDER); } @@ -2881,13 +2883,13 @@ static void menu_sliders_populate(running_machine *machine, ui_menu *menu, int m rendering -------------------------------------------------*/ -static void menu_sliders_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2) +static void menu_sliders_custom_render(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2) { const slider_state *curslider = (const slider_state *)selectedref; if (curslider != NULL) { float bar_left, bar_area_top, bar_width, bar_area_height, bar_top, bar_bottom, default_x, current_x; - float line_height = ui_get_line_height(*machine); + float line_height = ui_get_line_height(machine); float percentage, default_percentage; astring tempstring; float text_height; @@ -2952,7 +2954,7 @@ static void menu_sliders_custom_render(running_machine *machine, ui_menu *menu, menu -------------------------------------------------*/ -static void menu_video_targets(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_video_targets(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *menu_event; @@ -2972,14 +2974,14 @@ static void menu_video_targets(running_machine *machine, ui_menu *menu, void *pa video targets menu -------------------------------------------------*/ -static void menu_video_targets_populate(running_machine *machine, ui_menu *menu) +static void menu_video_targets_populate(running_machine &machine, ui_menu *menu) { int targetnum; /* find the targets */ for (targetnum = 0; ; targetnum++) { - render_target *target = machine->render().target_by_index(targetnum); + render_target *target = machine.render().target_by_index(targetnum); char buffer[40]; /* stop when we run out */ @@ -2998,9 +3000,9 @@ static void menu_video_targets_populate(running_machine *machine, ui_menu *menu) menu -------------------------------------------------*/ -static void menu_video_options(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_video_options(running_machine &machine, ui_menu *menu, void *parameter, void *state) { - render_target *target = (parameter != NULL) ? (render_target *)parameter : machine->render().first_target(); + render_target *target = (parameter != NULL) ? (render_target *)parameter : machine.render().first_target(); const ui_menu_event *menu_event; int changed = FALSE; @@ -3086,7 +3088,7 @@ static void menu_video_options(running_machine *machine, ui_menu *menu, void *pa video options menu -------------------------------------------------*/ -static void menu_video_options_populate(running_machine *machine, ui_menu *menu, render_target *target) +static void menu_video_options_populate(running_machine &machine, ui_menu *menu, render_target *target) { const char *subtext = ""; astring tempstring; @@ -3141,7 +3143,7 @@ static void menu_video_options_populate(running_machine *machine, ui_menu *menu, menu -------------------------------------------------*/ -static void menu_crosshair(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_crosshair(running_machine &machine, ui_menu *menu, void *parameter, void *state) { const ui_menu_event *menu_event; @@ -3246,7 +3248,7 @@ static void menu_crosshair(running_machine *machine, ui_menu *menu, void *parame crosshair settings menu -------------------------------------------------*/ -static void menu_crosshair_populate(running_machine *machine, ui_menu *menu) +static void menu_crosshair_populate(running_machine &machine, ui_menu *menu) { crosshair_user_settings settings; crosshair_item_data *data; @@ -3299,7 +3301,7 @@ static void menu_crosshair_populate(running_machine *machine, ui_menu *menu) /* search for crosshair graphics */ /* open a path to the crosshairs */ - file_enumerator path(machine->options().crosshair_path()); + file_enumerator path(machine.options().crosshair_path()); const osd_directory_entry *dir; /* reset search flags */ int using_default = FALSE; @@ -3401,10 +3403,10 @@ static void menu_crosshair_populate(running_machine *machine, ui_menu *menu) quitting the game -------------------------------------------------*/ -static void menu_quit_game(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_quit_game(running_machine &machine, ui_menu *menu, void *parameter, void *state) { /* request a reset */ - machine->schedule_exit(); + machine.schedule_exit(); /* reset the menu stack */ ui_menu_stack_reset(machine); @@ -3416,7 +3418,7 @@ static void menu_quit_game(running_machine *machine, ui_menu *menu, void *parame menu -------------------------------------------------*/ -static void menu_select_game(running_machine *machine, ui_menu *menu, void *parameter, void *state) +static void menu_select_game(running_machine &machine, ui_menu *menu, void *parameter, void *state) { select_game_state *menustate; const ui_menu_event *menu_event; @@ -3452,7 +3454,7 @@ static void menu_select_game(running_machine *machine, ui_menu *menu, void *para /* special case for configure inputs */ if ((FPTR)driver == 1) - ui_menu_stack_push(ui_menu_alloc(menu->machine, menu->container, menu_input_groups, NULL)); + ui_menu_stack_push(ui_menu_alloc(menu->machine(), menu->container, menu_input_groups, NULL)); /* anything else is a driver */ else @@ -3462,7 +3464,7 @@ static void menu_select_game(running_machine *machine, ui_menu *menu, void *para int audit_result; /* audit the game first to see if we're going to work */ - audit_records = audit_images(menu->machine->options(), driver, AUDIT_VALIDATE_FAST, &audit); + audit_records = audit_images(menu->machine().options(), driver, AUDIT_VALIDATE_FAST, &audit); audit_result = audit_summary(driver, audit_records, audit, FALSE); if (audit_records > 0) global_free(audit); @@ -3470,7 +3472,7 @@ static void menu_select_game(running_machine *machine, ui_menu *menu, void *para /* if everything looks good, schedule the new driver */ if (audit_result == CORRECT || audit_result == BEST_AVAILABLE) { - machine->schedule_new_driver(*driver); + machine.schedule_new_driver(*driver); ui_menu_stack_reset(machine); } @@ -3487,7 +3489,7 @@ static void menu_select_game(running_machine *machine, ui_menu *menu, void *para else if (menu_event->iptkey == IPT_UI_CANCEL && menustate->search[0] != 0) { /* since we have already been popped, we must recreate ourself from scratch */ - ui_menu_stack_push(ui_menu_alloc(menu->machine, menu->container, menu_select_game, NULL)); + ui_menu_stack_push(ui_menu_alloc(menu->machine(), menu->container, menu_select_game, NULL)); } /* typed characters append to the buffer */ @@ -3527,7 +3529,7 @@ static void menu_select_game(running_machine *machine, ui_menu *menu, void *para select menu -------------------------------------------------*/ -static void menu_select_game_populate(running_machine *machine, ui_menu *menu, select_game_state *menustate) +static void menu_select_game_populate(running_machine &machine, ui_menu *menu, select_game_state *menustate) { int matchcount; int curitem; @@ -3572,7 +3574,7 @@ static void menu_select_game_populate(running_machine *machine, ui_menu *menu, s } /* configure the custom rendering */ - ui_menu_set_custom_render(menu, menu_select_game_custom_render, ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER, 4.0f * ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER); + ui_menu_set_custom_render(menu, menu_select_game_custom_render, ui_get_line_height(machine) + 3.0f * UI_BOX_TB_BORDER, 4.0f * ui_get_line_height(machine) + 3.0f * UI_BOX_TB_BORDER); } @@ -3614,7 +3616,7 @@ static void menu_select_game_build_driver_list(ui_menu *menu, select_game_state memset(found, 0, (driver_count + 7) / 8); /* open a path to the ROMs and find them in the array */ - file_enumerator path(menu->machine->options().media_path()); + file_enumerator path(menu->machine().options().media_path()); const osd_directory_entry *dir; /* iterate while we get new objects */ @@ -3660,7 +3662,7 @@ static void menu_select_game_build_driver_list(ui_menu *menu, select_game_state special rendering -------------------------------------------------*/ -static void menu_select_game_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) +static void menu_select_game_custom_render(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { select_game_state *menustate = (select_game_state *)state; const game_driver *driver; @@ -3798,7 +3800,7 @@ static void menu_select_game_custom_render(running_machine *machine, ui_menu *me { ui_draw_text_full(menu->container, &tempbuf[line][0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL); - y1 += ui_get_line_height(*machine); + y1 += ui_get_line_height(machine); } } diff --git a/src/emu/uimenu.h b/src/emu/uimenu.h index b58dd9f2b33..4e4d5e4f20f 100644 --- a/src/emu/uimenu.h +++ b/src/emu/uimenu.h @@ -57,8 +57,8 @@ typedef struct _ui_menu ui_menu; /* menu-related callback functions */ -typedef void (*ui_menu_handler_func)(running_machine *machine, ui_menu *menu, void *parameter, void *state); -typedef void (*ui_menu_custom_func)(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2); +typedef void (*ui_menu_handler_func)(running_machine &machine, ui_menu *menu, void *parameter, void *state); +typedef void (*ui_menu_custom_func)(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2); typedef void (*ui_menu_destroy_state_func)(ui_menu *menu, void *state); @@ -81,14 +81,14 @@ struct _ui_menu_event /* ----- core system management ----- */ /* initialization */ -void ui_menu_init(running_machine *machine); +void ui_menu_init(running_machine &machine); /* ----- core menu management ----- */ /* allocate a new menu */ -ui_menu *ui_menu_alloc(running_machine *machine, render_container *container, ui_menu_handler_func handler, void *parameter); +ui_menu *ui_menu_alloc(running_machine &machine, render_container *container, ui_menu_handler_func handler, void *parameter); /* free a menu */ void ui_menu_free(ui_menu *menu); @@ -103,7 +103,7 @@ int ui_menu_populated(ui_menu *menu); void ui_menu_item_append(ui_menu *menu, const char *text, const char *subtext, UINT32 flags, void *ref); /* process a menu, drawing it and returning any interesting events */ -const ui_menu_event *ui_menu_process(running_machine *machine, ui_menu *menu, UINT32 flags); +const ui_menu_event *ui_menu_process(running_machine &machine, ui_menu *menu, UINT32 flags); /* configure the menu for custom rendering */ void ui_menu_set_custom_render(ui_menu *menu, ui_menu_custom_func custom, float top, float bottom); @@ -128,26 +128,26 @@ void ui_menu_set_selection(ui_menu *menu, void *selected_itemref); /* ----- menu stack management ----- */ /* reset the menus, clearing everything */ -void ui_menu_stack_reset(running_machine *machine); +void ui_menu_stack_reset(running_machine &machine); /* push a new menu onto the stack */ void ui_menu_stack_push(ui_menu *menu); /* pop a menu from the stack */ -void ui_menu_stack_pop(running_machine *machine); +void ui_menu_stack_pop(running_machine &machine); /* ----- UI system interaction ----- */ /* master handler */ -UINT32 ui_menu_ui_handler(running_machine *machine, render_container *container, UINT32 state); +UINT32 ui_menu_ui_handler(running_machine &machine, render_container *container, UINT32 state); /* slider handler */ -UINT32 ui_slider_ui_handler(running_machine *machine, render_container *container, UINT32 state); +UINT32 ui_slider_ui_handler(running_machine &machine, render_container *container, UINT32 state); /* force game select menu */ -void ui_menu_force_game_select(running_machine *machine, render_container *container); +void ui_menu_force_game_select(running_machine &machine, render_container *container); int ui_menu_is_force_game_select(void); diff --git a/src/emu/video.c b/src/emu/video.c index 5cc3c54698b..aed2ef572bc 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -234,10 +234,10 @@ void video_manager::frame_update(bool debug) } // draw the user interface - ui_update_and_render(&m_machine, &m_machine.render().ui_container()); + ui_update_and_render(m_machine, &m_machine.render().ui_container()); // update the internal render debugger - debugint_update_during_game(&m_machine); + debugint_update_during_game(m_machine); // if we're throttling, synchronize before rendering attotime current_time = m_machine.time(); @@ -265,7 +265,7 @@ void video_manager::frame_update(bool debug) if (phase == MACHINE_PHASE_RUNNING) { // reset partial updates if we're paused or if the debugger is active - if (m_machine.primary_screen != NULL && (m_machine.paused() || debug || debugger_within_instruction_hook(&m_machine))) + if (m_machine.primary_screen != NULL && (m_machine.paused() || debug || debugger_within_instruction_hook(m_machine))) m_machine.primary_screen->scanline0_callback(); // otherwise, call the video EOF callback @@ -452,7 +452,7 @@ void video_manager::begin_recording(const char *name, movie_format format) else if (format == MF_MNG) { // create a new movie file and start recording - m_mngfile = auto_alloc(&m_machine, emu_file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)); + m_mngfile = auto_alloc(m_machine, emu_file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)); file_error filerr; if (name != NULL) filerr = m_mngfile->open(name); @@ -497,7 +497,7 @@ void video_manager::end_recording() if (m_mngfile != NULL) { mng_capture_stop(*m_mngfile); - auto_free(&m_machine, m_mngfile); + auto_free(m_machine, m_mngfile); m_mngfile = NULL; } @@ -1082,8 +1082,8 @@ void video_manager::create_snapshot_bitmap(device_t *screen) if (m_snap_bitmap == NULL || width != m_snap_bitmap->width || height != m_snap_bitmap->height) { if (m_snap_bitmap != NULL) - auto_free(&m_machine, m_snap_bitmap); - m_snap_bitmap = auto_alloc(&m_machine, bitmap_t(width, height, BITMAP_FORMAT_RGB32)); + auto_free(m_machine, m_snap_bitmap); + m_snap_bitmap = auto_alloc(m_machine, bitmap_t(width, height, BITMAP_FORMAT_RGB32)); } // render the screen there @@ -1294,10 +1294,10 @@ void video_manager::record_frame() invalid palette index -------------------------------------------------*/ -void video_assert_out_of_range_pixels(running_machine *machine, bitmap_t *bitmap) +void video_assert_out_of_range_pixels(running_machine &machine, bitmap_t *bitmap) { #ifdef MAME_DEBUG - int maxindex = palette_get_max_index(machine->palette); + int maxindex = palette_get_max_index(machine.palette); int x, y; // this only applies to indexed16 bitmaps diff --git a/src/emu/video.h b/src/emu/video.h index e83e06d96f3..b928f9b6d0f 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -204,7 +204,7 @@ private: // ----- debugging helpers ----- // assert if any pixels in the given bitmap contain an invalid palette index -void video_assert_out_of_range_pixels(running_machine *machine, bitmap_t *bitmap); +void video_assert_out_of_range_pixels(running_machine &machine, bitmap_t *bitmap); #endif /* __VIDEO_H__ */ diff --git a/src/emu/video/crt9007.c b/src/emu/video/crt9007.c index f048f8929f2..88ea8b4a6ad 100644 --- a/src/emu/video/crt9007.c +++ b/src/emu/video/crt9007.c @@ -255,7 +255,7 @@ device_config *crt9007_device_config::static_alloc_device_config(const machine_c device_t *crt9007_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, crt9007_device(machine, *this)); + return auto_alloc(machine, crt9007_device(machine, *this)); } @@ -566,7 +566,7 @@ void crt9007_device::device_start() devcb_resolve_write_line(&m_out_sld_func, &m_config.out_sld_func, this); // get the screen device - m_screen = machine->device<screen_device>(m_config.screen_tag); + m_screen = m_machine.device<screen_device>(m_config.screen_tag); assert(m_screen != NULL); // set horizontal pixels per column diff --git a/src/emu/video/crt9021.c b/src/emu/video/crt9021.c index 13844f4808f..dd159dd2ba4 100644 --- a/src/emu/video/crt9021.c +++ b/src/emu/video/crt9021.c @@ -103,7 +103,7 @@ device_config *crt9021_device_config::static_alloc_device_config(const machine_c device_t *crt9021_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, crt9021_device(machine, *this)); + return auto_alloc(machine, crt9021_device(machine, *this)); } @@ -166,7 +166,7 @@ void crt9021_device::device_start() devcb_resolve_read_line(&m_in_atten_func, &m_config.in_atten_func, this); // get the screen device - m_screen = machine->device<screen_device>(m_config.screen_tag); + m_screen = m_machine.device<screen_device>(m_config.screen_tag); assert(m_screen != NULL); // register for state saving diff --git a/src/emu/video/crt9212.c b/src/emu/video/crt9212.c index 0a91fc8948a..8b6e75e5766 100644 --- a/src/emu/video/crt9212.c +++ b/src/emu/video/crt9212.c @@ -76,7 +76,7 @@ device_config *crt9212_device_config::static_alloc_device_config(const machine_c device_t *crt9212_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, crt9212_device(machine, *this)); + return auto_alloc(machine, crt9212_device(machine, *this)); } diff --git a/src/emu/video/generic.c b/src/emu/video/generic.c index 9b74b409f6e..f600106dc4b 100644 --- a/src/emu/video/generic.c +++ b/src/emu/video/generic.c @@ -118,9 +118,9 @@ const gfx_layout gfx_16x16x4_planar = palette RAM referenced by offset -------------------------------------------------*/ -INLINE UINT16 paletteram16_le(running_machine *machine, offs_t offset) +INLINE UINT16 paletteram16_le(running_machine &machine, offs_t offset) { - return machine->generic.paletteram.u8[offset & ~1] | (machine->generic.paletteram.u8[offset | 1] << 8); + return machine.generic.paletteram.u8[offset & ~1] | (machine.generic.paletteram.u8[offset | 1] << 8); } @@ -130,9 +130,9 @@ INLINE UINT16 paletteram16_le(running_machine *machine, offs_t offset) palette RAM referenced by offset -------------------------------------------------*/ -INLINE UINT16 paletteram16_be(running_machine *machine, offs_t offset) +INLINE UINT16 paletteram16_be(running_machine &machine, offs_t offset) { - return machine->generic.paletteram.u8[offset | 1] | (machine->generic.paletteram.u8[offset & ~1] << 8); + return machine.generic.paletteram.u8[offset | 1] | (machine.generic.paletteram.u8[offset & ~1] << 8); } @@ -142,9 +142,9 @@ INLINE UINT16 paletteram16_be(running_machine *machine, offs_t offset) RAM referenced by offset -------------------------------------------------*/ -INLINE UINT16 paletteram16_split(running_machine *machine, offs_t offset) +INLINE UINT16 paletteram16_split(running_machine &machine, offs_t offset) { - return machine->generic.paletteram.u8[offset] | (machine->generic.paletteram2.u8[offset] << 8); + return machine.generic.paletteram.u8[offset] | (machine.generic.paletteram2.u8[offset] << 8); } @@ -154,9 +154,9 @@ INLINE UINT16 paletteram16_split(running_machine *machine, offs_t offset) palette RAM referenced by offset -------------------------------------------------*/ -INLINE UINT32 paletteram32_be(running_machine *machine, offs_t offset) +INLINE UINT32 paletteram32_be(running_machine &machine, offs_t offset) { - return machine->generic.paletteram.u16[offset | 1] | (machine->generic.paletteram.u16[offset & ~1] << 16); + return machine.generic.paletteram.u16[offset | 1] | (machine.generic.paletteram.u16[offset & ~1] << 16); } @@ -166,7 +166,7 @@ INLINE UINT32 paletteram32_be(running_machine *machine, offs_t offset) shift values -------------------------------------------------*/ -INLINE void set_color_444(running_machine *machine, pen_t color, int rshift, int gshift, int bshift, UINT16 data) +INLINE void set_color_444(running_machine &machine, pen_t color, int rshift, int gshift, int bshift, UINT16 data) { palette_set_color_rgb(machine, color, pal4bit(data >> rshift), pal4bit(data >> gshift), pal4bit(data >> bshift)); } @@ -178,7 +178,7 @@ INLINE void set_color_444(running_machine *machine, pen_t color, int rshift, int shift values -------------------------------------------------*/ -INLINE void set_color_4444(running_machine *machine, pen_t color, int ishift, int rshift, int gshift, int bshift, UINT16 data) +INLINE void set_color_4444(running_machine &machine, pen_t color, int ishift, int rshift, int gshift, int bshift, UINT16 data) { static const UINT8 ztable[16] = { 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11 }; @@ -199,7 +199,7 @@ INLINE void set_color_4444(running_machine *machine, pen_t color, int ishift, in shift values -------------------------------------------------*/ -INLINE void set_color_555(running_machine *machine, pen_t color, int rshift, int gshift, int bshift, UINT16 data) +INLINE void set_color_555(running_machine &machine, pen_t color, int rshift, int gshift, int bshift, UINT16 data) { palette_set_color_rgb(machine, color, pal5bit(data >> rshift), pal5bit(data >> gshift), pal5bit(data >> bshift)); } @@ -211,7 +211,7 @@ INLINE void set_color_555(running_machine *machine, pen_t color, int rshift, int shift values -------------------------------------------------*/ -INLINE void set_color_888(running_machine *machine, pen_t color, int rshift, int gshift, int bshift, UINT32 data) +INLINE void set_color_888(running_machine &machine, pen_t color, int rshift, int gshift, int bshift, UINT32 data) { palette_set_color_rgb(machine, color, (data >> rshift) & 0xff, (data >> gshift) & 0xff, (data >> bshift) & 0xff); } @@ -227,34 +227,34 @@ INLINE void set_color_888(running_machine *machine, pen_t color, int rshift, int register for save states -------------------------------------------------*/ -void generic_video_init(running_machine *machine) +void generic_video_init(running_machine &machine) { generic_video_private *state; - state = machine->generic_video_data = auto_alloc_clear(machine, generic_video_private); + state = machine.generic_video_data = auto_alloc_clear(machine, generic_video_private); - machine->state().save_item(NAME(state->flip_screen_x)); - machine->state().save_item(NAME(state->flip_screen_y)); + machine.state().save_item(NAME(state->flip_screen_x)); + 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"); + assert_always(machine.generic.spriteram_size != 0, "Video buffers spriteram but spriteram size is 0"); // allocate memory for the back buffer - machine->generic.buffered_spriteram.u8 = auto_alloc_array(machine, UINT8, machine->generic.spriteram_size); + machine.generic.buffered_spriteram.u8 = auto_alloc_array(machine, UINT8, machine.generic.spriteram_size); // register for saving it - state_save_register_global_pointer(machine, machine->generic.buffered_spriteram.u8, machine->generic.spriteram_size); + state_save_register_global_pointer(machine, machine.generic.buffered_spriteram.u8, machine.generic.spriteram_size); // do the same for the second back buffer, if present - if (machine->generic.spriteram2_size) + if (machine.generic.spriteram2_size) { // allocate memory - machine->generic.buffered_spriteram2.u8 = auto_alloc_array(machine, UINT8, machine->generic.spriteram2_size); + machine.generic.buffered_spriteram2.u8 = auto_alloc_array(machine, UINT8, machine.generic.spriteram2_size); // register for saving it - state_save_register_global_pointer(machine, machine->generic.buffered_spriteram2.u8, machine->generic.spriteram2_size); + state_save_register_global_pointer(machine, machine.generic.buffered_spriteram2.u8, machine.generic.spriteram2_size); } } } @@ -273,10 +273,10 @@ void generic_video_init(running_machine *machine) VIDEO_START( generic_bitmapped ) { /* allocate the temporary bitmap */ - machine->generic.tmpbitmap = machine->primary_screen->alloc_compatible_bitmap(); + machine.generic.tmpbitmap = machine.primary_screen->alloc_compatible_bitmap(); /* ensure the contents of the bitmap are saved */ - machine->state().save_item(NAME(*machine->generic.tmpbitmap)); + machine.state().save_item(NAME(*machine.generic.tmpbitmap)); } @@ -287,7 +287,7 @@ VIDEO_START( generic_bitmapped ) SCREEN_UPDATE( generic_bitmapped ) { - copybitmap(bitmap, screen->machine->generic.tmpbitmap, 0, 0, 0, 0, cliprect); + copybitmap(bitmap, screen->machine().generic.tmpbitmap, 0, 0, 0, 0, cliprect); return 0; } @@ -348,17 +348,17 @@ more control is needed over what is buffered. WRITE8_HANDLER( buffer_spriteram_w ) { - memcpy(space->machine->generic.buffered_spriteram.u8, space->machine->generic.spriteram.u8, space->machine->generic.spriteram_size); + memcpy(space->machine().generic.buffered_spriteram.u8, space->machine().generic.spriteram.u8, space->machine().generic.spriteram_size); } WRITE16_HANDLER( buffer_spriteram16_w ) { - memcpy(space->machine->generic.buffered_spriteram.u16, space->machine->generic.spriteram.u16, space->machine->generic.spriteram_size); + memcpy(space->machine().generic.buffered_spriteram.u16, space->machine().generic.spriteram.u16, space->machine().generic.spriteram_size); } WRITE32_HANDLER( buffer_spriteram32_w ) { - memcpy(space->machine->generic.buffered_spriteram.u32, space->machine->generic.spriteram.u32, space->machine->generic.spriteram_size); + memcpy(space->machine().generic.buffered_spriteram.u32, space->machine().generic.spriteram.u32, space->machine().generic.spriteram_size); } @@ -369,17 +369,17 @@ WRITE32_HANDLER( buffer_spriteram32_w ) WRITE8_HANDLER( buffer_spriteram_2_w ) { - memcpy(space->machine->generic.buffered_spriteram2.u8, space->machine->generic.spriteram2.u8, space->machine->generic.spriteram2_size); + memcpy(space->machine().generic.buffered_spriteram2.u8, space->machine().generic.spriteram2.u8, space->machine().generic.spriteram2_size); } WRITE16_HANDLER( buffer_spriteram16_2_w ) { - memcpy(space->machine->generic.buffered_spriteram2.u16, space->machine->generic.spriteram2.u16, space->machine->generic.spriteram2_size); + memcpy(space->machine().generic.buffered_spriteram2.u16, space->machine().generic.spriteram2.u16, space->machine().generic.spriteram2_size); } WRITE32_HANDLER( buffer_spriteram32_2_w ) { - memcpy(space->machine->generic.buffered_spriteram2.u32, space->machine->generic.spriteram2.u32, space->machine->generic.spriteram2_size); + memcpy(space->machine().generic.buffered_spriteram2.u32, space->machine().generic.spriteram2.u32, space->machine().generic.spriteram2_size); } @@ -388,14 +388,14 @@ WRITE32_HANDLER( buffer_spriteram32_2_w ) spriteram -------------------------------------------------*/ -void buffer_spriteram(running_machine *machine, UINT8 *ptr, int length) +void buffer_spriteram(running_machine &machine, UINT8 *ptr, int length) { - memcpy(machine->generic.buffered_spriteram.u8, ptr, length); + memcpy(machine.generic.buffered_spriteram.u8, ptr, length); } -void buffer_spriteram_2(running_machine *machine, UINT8 *ptr, int length) +void buffer_spriteram_2(running_machine &machine, UINT8 *ptr, int length) { - memcpy(machine->generic.buffered_spriteram2.u8, ptr, length); + memcpy(machine.generic.buffered_spriteram2.u8, ptr, length); } @@ -408,13 +408,13 @@ void buffer_spriteram_2(running_machine *machine, UINT8 *ptr, int length) updateflip - handle global flipping -------------------------------------------------*/ -static void updateflip(running_machine *machine) +static void updateflip(running_machine &machine) { - generic_video_private *state = machine->generic_video_data; - int width = machine->primary_screen->width(); - int height = machine->primary_screen->height(); - attoseconds_t period = machine->primary_screen->frame_period().attoseconds; - rectangle visarea = machine->primary_screen->visible_area(); + generic_video_private *state = machine.generic_video_data; + int width = machine.primary_screen->width(); + int height = machine.primary_screen->height(); + attoseconds_t period = machine.primary_screen->frame_period().attoseconds; + rectangle visarea = machine.primary_screen->visible_area(); tilemap_set_flip_all(machine,(TILEMAP_FLIPX & state->flip_screen_x) | (TILEMAP_FLIPY & state->flip_screen_y)); @@ -435,7 +435,7 @@ static void updateflip(running_machine *machine) visarea.max_y = temp; } - machine->primary_screen->configure(width, height, visarea, period); + machine.primary_screen->configure(width, height, visarea, period); } @@ -443,9 +443,9 @@ static void updateflip(running_machine *machine) flip_screen_set - set global flip -------------------------------------------------*/ -void flip_screen_set(running_machine *machine, int on) +void flip_screen_set(running_machine &machine, int on) { - generic_video_private *state = machine->generic_video_data; + generic_video_private *state = machine.generic_video_data; if (on) on = ~0; if (state->flip_screen_x != on || state->flip_screen_y != on) { @@ -461,14 +461,14 @@ void flip_screen_set(running_machine *machine, int on) do not call update_flip. -------------------------------------------------*/ -void flip_screen_set_no_update(running_machine *machine, int on) +void flip_screen_set_no_update(running_machine &machine, int on) { /* flip_screen_y is not updated on purpose * this function is for drivers which * where writing to flip_screen_x to * bypass update_flip */ - generic_video_private *state = machine->generic_video_data; + generic_video_private *state = machine.generic_video_data; if (on) on = ~0; state->flip_screen_x = on; } @@ -478,9 +478,9 @@ void flip_screen_set_no_update(running_machine *machine, int on) flip_screen_x_set - set global horizontal flip -------------------------------------------------*/ -void flip_screen_x_set(running_machine *machine, int on) +void flip_screen_x_set(running_machine &machine, int on) { - generic_video_private *state = machine->generic_video_data; + generic_video_private *state = machine.generic_video_data; if (on) on = ~0; if (state->flip_screen_x != on) { @@ -494,9 +494,9 @@ void flip_screen_x_set(running_machine *machine, int on) flip_screen_y_set - set global vertical flip -------------------------------------------------*/ -void flip_screen_y_set(running_machine *machine, int on) +void flip_screen_y_set(running_machine &machine, int on) { - generic_video_private *state = machine->generic_video_data; + generic_video_private *state = machine.generic_video_data; if (on) on = ~0; if (state->flip_screen_y != on) { @@ -510,9 +510,9 @@ void flip_screen_y_set(running_machine *machine, int on) flip_screen_get - get global flip -------------------------------------------------*/ -int flip_screen_get(running_machine *machine) +int flip_screen_get(running_machine &machine) { - generic_video_private *state = machine->generic_video_data; + generic_video_private *state = machine.generic_video_data; return state->flip_screen_x; } @@ -521,9 +521,9 @@ int flip_screen_get(running_machine *machine) flip_screen_x_get - get global x flip -------------------------------------------------*/ -int flip_screen_x_get(running_machine *machine) +int flip_screen_x_get(running_machine &machine) { - generic_video_private *state = machine->generic_video_data; + generic_video_private *state = machine.generic_video_data; return state->flip_screen_x; } @@ -532,9 +532,9 @@ int flip_screen_x_get(running_machine *machine) flip_screen_get - get global y flip -------------------------------------------------*/ -int flip_screen_y_get(running_machine *machine) +int flip_screen_y_get(running_machine &machine) { - generic_video_private *state = machine->generic_video_data; + generic_video_private *state = machine.generic_video_data; return state->flip_screen_y; } @@ -552,7 +552,7 @@ PALETTE_INIT( all_black ) { int i; - for (i = 0; i < machine->total_colors(); i++) + for (i = 0; i < machine.total_colors(); i++) { palette_set_color(machine,i,RGB_BLACK); /* black */ } @@ -606,7 +606,7 @@ PALETTE_INIT( RRRR_GGGG_BBBB ) { int i; - for (i = 0; i < machine->total_colors(); i++) + for (i = 0; i < machine.total_colors(); i++) { int bit0,bit1,bit2,bit3,r,g,b; @@ -618,17 +618,17 @@ PALETTE_INIT( RRRR_GGGG_BBBB ) r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* green component */ - bit0 = (color_prom[i + machine->total_colors()] >> 0) & 0x01; - bit1 = (color_prom[i + machine->total_colors()] >> 1) & 0x01; - bit2 = (color_prom[i + machine->total_colors()] >> 2) & 0x01; - bit3 = (color_prom[i + machine->total_colors()] >> 3) & 0x01; + bit0 = (color_prom[i + machine.total_colors()] >> 0) & 0x01; + bit1 = (color_prom[i + machine.total_colors()] >> 1) & 0x01; + bit2 = (color_prom[i + machine.total_colors()] >> 2) & 0x01; + bit3 = (color_prom[i + machine.total_colors()] >> 3) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* blue component */ - bit0 = (color_prom[i + 2*machine->total_colors()] >> 0) & 0x01; - bit1 = (color_prom[i + 2*machine->total_colors()] >> 1) & 0x01; - bit2 = (color_prom[i + 2*machine->total_colors()] >> 2) & 0x01; - bit3 = (color_prom[i + 2*machine->total_colors()] >> 3) & 0x01; + bit0 = (color_prom[i + 2*machine.total_colors()] >> 0) & 0x01; + bit1 = (color_prom[i + 2*machine.total_colors()] >> 1) & 0x01; + bit2 = (color_prom[i + 2*machine.total_colors()] >> 2) & 0x01; + bit3 = (color_prom[i + 2*machine.total_colors()] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine,i,MAKE_RGB(r,g,b)); @@ -688,8 +688,8 @@ PALETTE_INIT( RRRRR_GGGGGG_BBBBB ) WRITE8_HANDLER( paletteram_RRRGGGBB_w ) { - space->machine->generic.paletteram.u8[offset] = data; - palette_set_color_rgb(space->machine, offset, pal3bit(data >> 5), pal3bit(data >> 2), pal2bit(data >> 0)); + space->machine().generic.paletteram.u8[offset] = data; + palette_set_color_rgb(space->machine(), offset, pal3bit(data >> 5), pal3bit(data >> 2), pal2bit(data >> 0)); } @@ -699,8 +699,8 @@ WRITE8_HANDLER( paletteram_RRRGGGBB_w ) WRITE8_HANDLER( paletteram_BBGGGRRR_w ) { - space->machine->generic.paletteram.u8[offset] = data; - palette_set_color_rgb(space->machine, offset, pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6)); + space->machine().generic.paletteram.u8[offset] = data; + palette_set_color_rgb(space->machine(), offset, pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6)); } @@ -712,8 +712,8 @@ WRITE8_HANDLER( paletteram_BBGGRRII_w ) { int i = (data >> 0) & 3; - space->machine->generic.paletteram.u8[offset] = data; - palette_set_color_rgb(space->machine, offset, pal4bit(((data >> 0) & 0x0c) | i), + space->machine().generic.paletteram.u8[offset] = data; + palette_set_color_rgb(space->machine(), offset, pal4bit(((data >> 0) & 0x0c) | i), pal4bit(((data >> 2) & 0x0c) | i), pal4bit(((data >> 4) & 0x0c) | i)); } @@ -726,8 +726,8 @@ WRITE8_HANDLER( paletteram_IIBBGGRR_w ) { int i = (data >> 6) & 3; - space->machine->generic.paletteram.u8[offset] = data; - palette_set_color_rgb(space->machine, offset, pal4bit(((data << 2) & 0x0c) | i), + space->machine().generic.paletteram.u8[offset] = data; + palette_set_color_rgb(space->machine(), offset, pal4bit(((data << 2) & 0x0c) | i), pal4bit(((data >> 0) & 0x0c) | i), pal4bit(((data >> 2) & 0x0c) | i)); } @@ -744,32 +744,32 @@ WRITE8_HANDLER( paletteram_IIBBGGRR_w ) WRITE8_HANDLER( paletteram_xxxxBBBBGGGGRRRR_le_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_444(space->machine, offset / 2, 0, 4, 8, paletteram16_le(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_444(space->machine(), offset / 2, 0, 4, 8, paletteram16_le(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xxxxBBBBGGGGRRRR_be_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_444(space->machine, offset / 2, 0, 4, 8, paletteram16_be(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_444(space->machine(), offset / 2, 0, 4, 8, paletteram16_be(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xxxxBBBBGGGGRRRR_split1_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_444(space->machine, offset, 0, 4, 8, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_444(space->machine(), offset, 0, 4, 8, paletteram16_split(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xxxxBBBBGGGGRRRR_split2_w ) { - space->machine->generic.paletteram2.u8[offset] = data; - set_color_444(space->machine, offset, 0, 4, 8, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram2.u8[offset] = data; + set_color_444(space->machine(), offset, 0, 4, 8, paletteram16_split(space->machine(), offset)); } WRITE16_HANDLER( paletteram16_xxxxBBBBGGGGRRRR_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_444(space->machine, offset, 0, 4, 8, space->machine->generic.paletteram.u16[offset]); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_444(space->machine(), offset, 0, 4, 8, space->machine().generic.paletteram.u16[offset]); } @@ -779,32 +779,32 @@ WRITE16_HANDLER( paletteram16_xxxxBBBBGGGGRRRR_word_w ) WRITE8_HANDLER( paletteram_xxxxBBBBRRRRGGGG_le_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_444(space->machine, offset / 2, 4, 0, 8, paletteram16_le(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_444(space->machine(), offset / 2, 4, 0, 8, paletteram16_le(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xxxxBBBBRRRRGGGG_be_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_444(space->machine, offset / 2, 4, 0, 8, paletteram16_be(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_444(space->machine(), offset / 2, 4, 0, 8, paletteram16_be(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xxxxBBBBRRRRGGGG_split1_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_444(space->machine, offset, 4, 0, 8, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_444(space->machine(), offset, 4, 0, 8, paletteram16_split(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xxxxBBBBRRRRGGGG_split2_w ) { - space->machine->generic.paletteram2.u8[offset] = data; - set_color_444(space->machine, offset, 4, 0, 8, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram2.u8[offset] = data; + set_color_444(space->machine(), offset, 4, 0, 8, paletteram16_split(space->machine(), offset)); } WRITE16_HANDLER( paletteram16_xxxxBBBBRRRRGGGG_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_444(space->machine, offset, 4, 0, 8, space->machine->generic.paletteram.u16[offset]); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_444(space->machine(), offset, 4, 0, 8, space->machine().generic.paletteram.u16[offset]); } @@ -814,14 +814,14 @@ WRITE16_HANDLER( paletteram16_xxxxBBBBRRRRGGGG_word_w ) WRITE8_HANDLER( paletteram_xxxxRRRRBBBBGGGG_split1_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_444(space->machine, offset, 8, 0, 4, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_444(space->machine(), offset, 8, 0, 4, paletteram16_split(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xxxxRRRRBBBBGGGG_split2_w ) { - space->machine->generic.paletteram2.u8[offset] = data; - set_color_444(space->machine, offset, 8, 0, 4, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram2.u8[offset] = data; + set_color_444(space->machine(), offset, 8, 0, 4, paletteram16_split(space->machine(), offset)); } @@ -831,32 +831,32 @@ WRITE8_HANDLER( paletteram_xxxxRRRRBBBBGGGG_split2_w ) WRITE8_HANDLER( paletteram_xxxxRRRRGGGGBBBB_le_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_444(space->machine, offset / 2, 8, 4, 0, paletteram16_le(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_444(space->machine(), offset / 2, 8, 4, 0, paletteram16_le(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xxxxRRRRGGGGBBBB_be_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_444(space->machine, offset / 2, 8, 4, 0, paletteram16_be(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_444(space->machine(), offset / 2, 8, 4, 0, paletteram16_be(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xxxxRRRRGGGGBBBB_split1_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_444(space->machine, offset, 8, 4, 0, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_444(space->machine(), offset, 8, 4, 0, paletteram16_split(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xxxxRRRRGGGGBBBB_split2_w ) { - space->machine->generic.paletteram2.u8[offset] = data; - set_color_444(space->machine, offset, 8, 4, 0, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram2.u8[offset] = data; + set_color_444(space->machine(), offset, 8, 4, 0, paletteram16_split(space->machine(), offset)); } WRITE16_HANDLER( paletteram16_xxxxRRRRGGGGBBBB_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_444(space->machine, offset, 8, 4, 0, space->machine->generic.paletteram.u16[offset]); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_444(space->machine(), offset, 8, 4, 0, space->machine().generic.paletteram.u16[offset]); } @@ -866,26 +866,26 @@ WRITE16_HANDLER( paletteram16_xxxxRRRRGGGGBBBB_word_w ) WRITE8_HANDLER( paletteram_RRRRGGGGBBBBxxxx_be_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_444(space->machine, offset / 2, 12, 8, 4, paletteram16_be(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_444(space->machine(), offset / 2, 12, 8, 4, paletteram16_be(space->machine(), offset)); } WRITE8_HANDLER( paletteram_RRRRGGGGBBBBxxxx_split1_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_444(space->machine, offset, 12, 8, 4, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_444(space->machine(), offset, 12, 8, 4, paletteram16_split(space->machine(), offset)); } WRITE8_HANDLER( paletteram_RRRRGGGGBBBBxxxx_split2_w ) { - space->machine->generic.paletteram2.u8[offset] = data; - set_color_444(space->machine, offset, 12, 8, 4, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram2.u8[offset] = data; + set_color_444(space->machine(), offset, 12, 8, 4, paletteram16_split(space->machine(), offset)); } WRITE16_HANDLER( paletteram16_RRRRGGGGBBBBxxxx_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_444(space->machine, offset, 12, 8, 4, space->machine->generic.paletteram.u16[offset]); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_444(space->machine(), offset, 12, 8, 4, space->machine().generic.paletteram.u16[offset]); } @@ -900,32 +900,32 @@ WRITE16_HANDLER( paletteram16_RRRRGGGGBBBBxxxx_word_w ) WRITE8_HANDLER( paletteram_xBBBBBGGGGGRRRRR_le_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_555(space->machine, offset / 2, 0, 5, 10, paletteram16_le(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_555(space->machine(), offset / 2, 0, 5, 10, paletteram16_le(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xBBBBBGGGGGRRRRR_be_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_555(space->machine, offset / 2, 0, 5, 10, paletteram16_be(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_555(space->machine(), offset / 2, 0, 5, 10, paletteram16_be(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xBBBBBGGGGGRRRRR_split1_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_555(space->machine, offset, 0, 5, 10, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_555(space->machine(), offset, 0, 5, 10, paletteram16_split(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xBBBBBGGGGGRRRRR_split2_w ) { - space->machine->generic.paletteram2.u8[offset] = data; - set_color_555(space->machine, offset, 0, 5, 10, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram2.u8[offset] = data; + set_color_555(space->machine(), offset, 0, 5, 10, paletteram16_split(space->machine(), offset)); } WRITE16_HANDLER( paletteram16_xBBBBBGGGGGRRRRR_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_555(space->machine, offset, 0, 5, 10, space->machine->generic.paletteram.u16[offset]); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_555(space->machine(), offset, 0, 5, 10, space->machine().generic.paletteram.u16[offset]); } @@ -935,14 +935,14 @@ WRITE16_HANDLER( paletteram16_xBBBBBGGGGGRRRRR_word_w ) WRITE8_HANDLER( paletteram_xBBBBBRRRRRGGGGG_split1_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_555(space->machine, offset, 5, 0, 10, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_555(space->machine(), offset, 5, 0, 10, paletteram16_split(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xBBBBBRRRRRGGGGG_split2_w ) { - space->machine->generic.paletteram2.u8[offset] = data; - set_color_555(space->machine, offset, 5, 0, 10, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram2.u8[offset] = data; + set_color_555(space->machine(), offset, 5, 0, 10, paletteram16_split(space->machine(), offset)); } @@ -952,32 +952,32 @@ WRITE8_HANDLER( paletteram_xBBBBBRRRRRGGGGG_split2_w ) WRITE8_HANDLER( paletteram_xRRRRRGGGGGBBBBB_le_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_555(space->machine, offset / 2, 10, 5, 0, paletteram16_le(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_555(space->machine(), offset / 2, 10, 5, 0, paletteram16_le(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xRRRRRGGGGGBBBBB_be_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_555(space->machine, offset / 2, 10, 5, 0, paletteram16_be(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_555(space->machine(), offset / 2, 10, 5, 0, paletteram16_be(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xRRRRRGGGGGBBBBB_split1_w ) { - space->machine->generic.paletteram.u8[offset] = data; - set_color_555(space->machine, offset, 10, 5, 0, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram.u8[offset] = data; + set_color_555(space->machine(), offset, 10, 5, 0, paletteram16_split(space->machine(), offset)); } WRITE8_HANDLER( paletteram_xRRRRRGGGGGBBBBB_split2_w ) { - space->machine->generic.paletteram2.u8[offset] = data; - set_color_555(space->machine, offset, 10, 5, 0, paletteram16_split(space->machine, offset)); + space->machine().generic.paletteram2.u8[offset] = data; + set_color_555(space->machine(), offset, 10, 5, 0, paletteram16_split(space->machine(), offset)); } WRITE16_HANDLER( paletteram16_xRRRRRGGGGGBBBBB_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_555(space->machine, offset, 10, 5, 0, space->machine->generic.paletteram.u16[offset]); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_555(space->machine(), offset, 10, 5, 0, space->machine().generic.paletteram.u16[offset]); } @@ -987,8 +987,8 @@ WRITE16_HANDLER( paletteram16_xRRRRRGGGGGBBBBB_word_w ) WRITE16_HANDLER( paletteram16_xGGGGGRRRRRBBBBB_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_555(space->machine, offset, 5, 10, 0, space->machine->generic.paletteram.u16[offset]); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_555(space->machine(), offset, 5, 10, 0, space->machine().generic.paletteram.u16[offset]); } @@ -998,8 +998,8 @@ WRITE16_HANDLER( paletteram16_xGGGGGRRRRRBBBBB_word_w ) WRITE16_HANDLER( paletteram16_xGGGGGBBBBBRRRRR_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_555(space->machine, offset, 0, 10, 5, space->machine->generic.paletteram.u16[offset]); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_555(space->machine(), offset, 0, 10, 5, space->machine().generic.paletteram.u16[offset]); } @@ -1009,8 +1009,8 @@ WRITE16_HANDLER( paletteram16_xGGGGGBBBBBRRRRR_word_w ) WRITE16_HANDLER( paletteram16_GGGGGRRRRRBBBBBx_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_555(space->machine, offset, 6, 11, 1, space->machine->generic.paletteram.u16[offset]); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_555(space->machine(), offset, 6, 11, 1, space->machine().generic.paletteram.u16[offset]); } /*------------------------------------------------- @@ -1019,8 +1019,8 @@ WRITE16_HANDLER( paletteram16_GGGGGRRRRRBBBBBx_word_w ) WRITE16_HANDLER( paletteram16_RRRRRGGGGGBBBBBx_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_555(space->machine, offset, 11, 6, 1, space->machine->generic.paletteram.u16[offset]); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_555(space->machine(), offset, 11, 6, 1, space->machine().generic.paletteram.u16[offset]); } @@ -1030,9 +1030,9 @@ WRITE16_HANDLER( paletteram16_RRRRRGGGGGBBBBBx_word_w ) WRITE16_HANDLER( paletteram16_RRRRGGGGBBBBRGBx_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - data = space->machine->generic.paletteram.u16[offset]; - palette_set_color_rgb(space->machine, offset, pal5bit(((data >> 11) & 0x1e) | ((data >> 3) & 0x01)), + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + data = space->machine().generic.paletteram.u16[offset]; + palette_set_color_rgb(space->machine(), offset, pal5bit(((data >> 11) & 0x1e) | ((data >> 3) & 0x01)), pal5bit(((data >> 7) & 0x1e) | ((data >> 2) & 0x01)), pal5bit(((data >> 3) & 0x1e) | ((data >> 1) & 0x01))); } @@ -1049,8 +1049,8 @@ WRITE16_HANDLER( paletteram16_RRRRGGGGBBBBRGBx_word_w ) WRITE16_HANDLER( paletteram16_IIIIRRRRGGGGBBBB_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_4444(space->machine, offset, 12, 8, 4, 0, space->machine->generic.paletteram.u16[offset]); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_4444(space->machine(), offset, 12, 8, 4, 0, space->machine().generic.paletteram.u16[offset]); } @@ -1060,8 +1060,8 @@ WRITE16_HANDLER( paletteram16_IIIIRRRRGGGGBBBB_word_w ) WRITE16_HANDLER( paletteram16_RRRRGGGGBBBBIIII_word_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_4444(space->machine, offset, 0, 12, 8, 4, space->machine->generic.paletteram.u16[offset]); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_4444(space->machine(), offset, 0, 12, 8, 4, space->machine().generic.paletteram.u16[offset]); } @@ -1076,8 +1076,8 @@ WRITE16_HANDLER( paletteram16_RRRRGGGGBBBBIIII_word_w ) WRITE16_HANDLER( paletteram16_xrgb_word_be_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_888(space->machine, offset / 2, 16, 8, 0, paletteram32_be(space->machine, offset)); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_888(space->machine(), offset / 2, 16, 8, 0, paletteram32_be(space->machine(), offset)); } @@ -1087,6 +1087,6 @@ WRITE16_HANDLER( paletteram16_xrgb_word_be_w ) WRITE16_HANDLER( paletteram16_xbgr_word_be_w ) { - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - set_color_888(space->machine, offset / 2, 0, 8, 16, paletteram32_be(space->machine, offset)); + COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]); + set_color_888(space->machine(), offset / 2, 0, 8, 16, paletteram32_be(space->machine(), offset)); } diff --git a/src/emu/video/generic.h b/src/emu/video/generic.h index 90796c75591..9ed617608d8 100644 --- a/src/emu/video/generic.h +++ b/src/emu/video/generic.h @@ -38,7 +38,7 @@ extern const gfx_layout gfx_16x16x4_planar; /* ----- initialization ----- */ /* set up all the common systems */ -void generic_video_init(running_machine *machine); +void generic_video_init(running_machine &machine); /* generic video start with a temporary bitmap */ VIDEO_START( generic_bitmapped ); @@ -59,21 +59,21 @@ WRITE16_HANDLER( buffer_spriteram16_2_w ); WRITE32_HANDLER( buffer_spriteram32_2_w ); /* perform the actual buffering */ -void buffer_spriteram(running_machine *machine, UINT8 *ptr, int length); -void buffer_spriteram_2(running_machine *machine, UINT8 *ptr, int length); +void buffer_spriteram(running_machine &machine, UINT8 *ptr, int length); +void buffer_spriteram_2(running_machine &machine, UINT8 *ptr, int length); /* ----- global attributes ----- */ /* set global attributes */ -void flip_screen_set(running_machine *machine, int on); -void flip_screen_set_no_update(running_machine *machine, int on); /* will not call update_flip */ -void flip_screen_x_set(running_machine *machine, int on); -void flip_screen_y_set(running_machine *machine, int on); -int flip_screen_get(running_machine *machine); -int flip_screen_x_get(running_machine *machine); -int flip_screen_y_get(running_machine *machine); +void flip_screen_set(running_machine &machine, int on); +void flip_screen_set_no_update(running_machine &machine, int on); /* will not call update_flip */ +void flip_screen_x_set(running_machine &machine, int on); +void flip_screen_y_set(running_machine &machine, int on); +int flip_screen_get(running_machine &machine); +int flip_screen_x_get(running_machine &machine); +int flip_screen_y_get(running_machine &machine); //#define flip_screen flip_screen_get(machine) diff --git a/src/emu/video/hd61830.c b/src/emu/video/hd61830.c index 6fceb8014cb..b8fa2de0f85 100644 --- a/src/emu/video/hd61830.c +++ b/src/emu/video/hd61830.c @@ -105,7 +105,7 @@ device_config *hd61830_device_config::static_alloc_device_config(const machine_c device_t *hd61830_device_config::alloc_device(running_machine &machine) const { - return auto_alloc(&machine, hd61830_device(machine, *this)); + return auto_alloc(machine, hd61830_device(machine, *this)); } @@ -208,7 +208,7 @@ void hd61830_device::device_start() // resolve callbacks devcb_resolve_read8(&m_in_rd_func, &m_config.m_in_rd_func, this); - m_screen = machine->device<screen_device>(m_config.screen_tag); + m_screen = m_machine.device<screen_device>(m_config.screen_tag); // register for state saving save_item(NAME(m_bf)); diff --git a/src/emu/video/hd63484.c b/src/emu/video/hd63484.c index 2e8a5efea7e..7d159b45224 100644 --- a/src/emu/video/hd63484.c +++ b/src/emu/video/hd63484.c @@ -1037,7 +1037,7 @@ static void hd63484_command_w(device_t *device, UINT16 cmd) #if LOG_COMMANDS int i; - logerror("%s: HD63484 command %s (%04x) ", device->machine->describe_context(), instruction_name[hd63484->fifo[0] >> 10], hd63484->fifo[0]); + logerror("%s: HD63484 command %s (%04x) ", device->machine().describe_context(), instruction_name[hd63484->fifo[0] >> 10], hd63484->fifo[0]); for (i = 1; i < hd63484->fifo_counter; i++) logerror("%04x ", hd63484->fifo[i]); logerror("\n"); @@ -1470,7 +1470,7 @@ READ16_DEVICE_HANDLER( hd63484_status_r ) // if (cpu_get_pc(space->cpu) != 0xfced6 && cpu_get_pc(space->cpu) != 0xfe1d6) // logerror("%05x: HD63484 status read\n",cpu_get_pc(space->cpu)); - return 0xff22 | (device->machine->rand() & 0x0004); /* write FIFO ready + command end + (read FIFO ready or read FIFO not ready) */ + return 0xff22 | (device->machine().rand() & 0x0004); /* write FIFO ready + command end + (read FIFO ready or read FIFO not ready) */ } WRITE16_DEVICE_HANDLER( hd63484_address_w ) @@ -1508,7 +1508,7 @@ READ16_DEVICE_HANDLER( hd63484_data_r ) int res; if (hd63484->regno == 0x80) - res = device->machine->primary_screen->vpos(); + res = device->machine().primary_screen->vpos(); else if (hd63484->regno == 0) { #if LOG_COMMANDS @@ -1562,7 +1562,7 @@ static DEVICE_START( hd63484 ) const hd63484_interface *intf = get_interface(device); hd63484->skattva_hack = intf->skattva_hack; - hd63484->ram = auto_alloc_array_clear(device->machine, UINT16, HD63484_RAM_SIZE); + hd63484->ram = auto_alloc_array_clear(device->machine(), UINT16, HD63484_RAM_SIZE); // device->save_item(NAME(hd63484->clear_bitmap)); // device->save_pointer(NAME(hd63484->spriteram), 0x1000); diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c index a2858038003..3ea4a924f18 100644 --- a/src/emu/video/mc6845.c +++ b/src/emu/video/mc6845.c @@ -208,7 +208,7 @@ INLINE void call_on_update_address(device_t *device, int strobe) mc6845_t *mc6845 = get_safe_token(device); if (mc6845->intf->on_update_addr_changed) - device->machine->scheduler().timer_set(attotime::zero, FUNC(on_update_address_cb), (mc6845->update_addr << 8) | strobe, (void *) device); + device->machine().scheduler().timer_set(attotime::zero, FUNC(on_update_address_cb), (mc6845->update_addr << 8) | strobe, (void *) device); else fatalerror("M6845: transparent memory mode without handler\n"); } @@ -289,7 +289,7 @@ WRITE8_DEVICE_HANDLER( mc6845_register_w ) { mc6845_t *mc6845 = get_safe_token(device); - if (LOG) logerror("%s:M6845 reg 0x%02x = 0x%02x\n", device->machine->describe_context(), mc6845->register_address_latch, data); + if (LOG) logerror("%s:M6845 reg 0x%02x = 0x%02x\n", device->machine().describe_context(), mc6845->register_address_latch, data); switch (mc6845->register_address_latch) { @@ -893,10 +893,10 @@ static void common_start(device_t *device, int device_type) /* get the screen device */ if ( mc6845->intf->screen_tag != NULL ) { - mc6845->screen = downcast<screen_device *>(device->machine->device(mc6845->intf->screen_tag)); + mc6845->screen = downcast<screen_device *>(device->machine().device(mc6845->intf->screen_tag)); if (mc6845->screen == NULL) { astring tempstring; - mc6845->screen = downcast<screen_device *>(device->machine->device(device->owner()->subtag(tempstring,mc6845->intf->screen_tag))); + mc6845->screen = downcast<screen_device *>(device->machine().device(device->owner()->subtag(tempstring,mc6845->intf->screen_tag))); } assert(mc6845->screen != NULL); } @@ -904,19 +904,19 @@ static void common_start(device_t *device, int device_type) mc6845->screen = NULL; /* create the timers */ - mc6845->line_timer = device->machine->scheduler().timer_alloc(FUNC(line_timer_cb), (void *)device); + mc6845->line_timer = device->machine().scheduler().timer_alloc(FUNC(line_timer_cb), (void *)device); - mc6845->de_off_timer = device->machine->scheduler().timer_alloc(FUNC(de_off_timer_cb), (void *)device); - mc6845->upd_adr_timer = device->machine->scheduler().timer_alloc(FUNC(upd_adr_timer_cb), (void *)device); + mc6845->de_off_timer = device->machine().scheduler().timer_alloc(FUNC(de_off_timer_cb), (void *)device); + mc6845->upd_adr_timer = device->machine().scheduler().timer_alloc(FUNC(upd_adr_timer_cb), (void *)device); - mc6845->cur_on_timer = device->machine->scheduler().timer_alloc(FUNC(cur_on_timer_cb), (void *)device); - mc6845->cur_off_timer = device->machine->scheduler().timer_alloc(FUNC(cur_off_timer_cb), (void *)device); + mc6845->cur_on_timer = device->machine().scheduler().timer_alloc(FUNC(cur_on_timer_cb), (void *)device); + mc6845->cur_off_timer = device->machine().scheduler().timer_alloc(FUNC(cur_off_timer_cb), (void *)device); - mc6845->hsync_on_timer = device->machine->scheduler().timer_alloc(FUNC(hsync_on_timer_cb), (void *)device); - mc6845->hsync_off_timer = device->machine->scheduler().timer_alloc(FUNC(hsync_off_timer_cb), (void *)device); + mc6845->hsync_on_timer = device->machine().scheduler().timer_alloc(FUNC(hsync_on_timer_cb), (void *)device); + mc6845->hsync_off_timer = device->machine().scheduler().timer_alloc(FUNC(hsync_off_timer_cb), (void *)device); } - mc6845->light_pen_latch_timer = device->machine->scheduler().timer_alloc(FUNC(light_pen_latch_timer_cb), (void *)device); + mc6845->light_pen_latch_timer = device->machine().scheduler().timer_alloc(FUNC(light_pen_latch_timer_cb), (void *)device); /* Use some large startup values */ mc6845->horiz_char_total = 0xff; @@ -924,7 +924,7 @@ static void common_start(device_t *device, int device_type) mc6845->vert_char_total = 0x7f; /* register for state saving */ - device->machine->state().register_postload(mc6845_state_save_postload, mc6845); + device->machine().state().register_postload(mc6845_state_save_postload, mc6845); device->save_item(NAME(mc6845->clock)); device->save_item(NAME(mc6845->hpixels_per_column)); diff --git a/src/emu/video/msm6255.c b/src/emu/video/msm6255.c index 9b0b078a7c3..00d43391d2a 100644 --- a/src/emu/video/msm6255.c +++ b/src/emu/video/msm6255.c @@ -143,7 +143,7 @@ msm6255_device::msm6255_device(running_machine &_machine, const msm6255_device_c void msm6255_device::device_start() { // find screen - m_screen = machine->device<screen_device>(m_config.m_screen_tag); + m_screen = m_machine.device<screen_device>(m_config.m_screen_tag); // register for state saving save_item(NAME(m_ir)); @@ -447,6 +447,6 @@ void msm6255_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect) } else { - bitmap_fill(bitmap, cliprect, get_black_pen(machine)); + bitmap_fill(bitmap, cliprect, get_black_pen(m_machine)); } } diff --git a/src/emu/video/pc_vga.c b/src/emu/video/pc_vga.c index 70eb3cbc52f..c38b10067ae 100644 --- a/src/emu/video/pc_vga.c +++ b/src/emu/video/pc_vga.c @@ -80,8 +80,8 @@ static VIDEO_START( vga ); static VIDEO_RESET( ega ); static VIDEO_RESET( vga ); -static pc_video_update_proc pc_vga_choosevideomode(running_machine *machine, int *width, int *height); -static pc_video_update_proc pc_ega_choosevideomode(running_machine *machine, int *width, int *height); +static pc_video_update_proc pc_vga_choosevideomode(running_machine &machine, int *width, int *height); +static pc_video_update_proc pc_ega_choosevideomode(running_machine &machine, int *width, int *height); /*************************************************************************** @@ -594,9 +594,9 @@ static WRITE64_HANDLER( vga_vga64_w ) { write64be_with_write8_handler(vga_vga_w, static READ64_HANDLER( vga_ega64_r ) { return read64be_with_read8_handler(vga_ega_r, space, offset, mem_mask); } static WRITE64_HANDLER( vga_ega64_w ) { write64be_with_write8_handler(vga_ega_w, space, offset, data, mem_mask); } -static void vga_cpu_interface(running_machine *machine) +static void vga_cpu_interface(running_machine &machine) { - address_space *space = machine->firstcpu->memory().space(AS_PROGRAM); + address_space *space = machine.firstcpu->memory().space(AS_PROGRAM); static int sequencer, gc; read8_space_func read_handler; write8_space_func write_handler; @@ -675,7 +675,7 @@ static void vga_cpu_interface(running_machine *machine) } else { - buswidth = downcast<cpu_device *>(machine->firstcpu)->space_config(AS_PROGRAM)->m_databus_width; + buswidth = downcast<cpu_device *>(machine.firstcpu)->space_config(AS_PROGRAM)->m_databus_width; switch(buswidth) { case 8: @@ -781,7 +781,7 @@ static READ8_HANDLER(vga_crtc_r) int clock=vga.monitor.get_clock(); int lines=vga.monitor.get_lines(); int columns=vga.monitor.get_columns(); - int diff = (((space->machine->time() - vga.monitor.start_time) * clock).seconds) + int diff = (((space->machine().time() - vga.monitor.start_time) * clock).seconds) %(lines*columns); if (diff<columns*vga.monitor.get_sync_lines()) data|=8; diff=diff/lines; @@ -791,7 +791,7 @@ static READ8_HANDLER(vga_crtc_r) if (vga.monitor.retrace) { data |= 1; - if ((space->machine->time() - vga.monitor.start_time) > attotime::from_usec(300)) + if ((space->machine().time() - vga.monitor.start_time) > attotime::from_usec(300)) { data |= 8; vga.monitor.retrace=0; @@ -799,9 +799,9 @@ static READ8_HANDLER(vga_crtc_r) } else { - if ((space->machine->time() - vga.monitor.start_time) > attotime::from_msec(15)) + if ((space->machine().time() - vga.monitor.start_time) > attotime::from_msec(15)) vga.monitor.retrace=1; - vga.monitor.start_time=space->machine->time(); + vga.monitor.start_time=space->machine().time(); } #else // not working with ps2m30 @@ -1053,10 +1053,10 @@ WRITE8_HANDLER(vga_port_03c0_w) if (vga.sequencer.index < vga.svga_intf.seq_regcount) { vga.sequencer.data[vga.sequencer.index] = data; - vga_cpu_interface(space->machine); + vga_cpu_interface(space->machine()); if (vga.sequencer.index == 0) - vga.monitor.start_time = space->machine->time(); + vga.monitor.start_time = space->machine().time(); } break; case 6: @@ -1118,7 +1118,7 @@ WRITE8_HANDLER(vga_port_03c0_w) if (vga.gc.index < vga.svga_intf.gc_regcount) { vga.gc.data[vga.gc.index] = data; - vga_cpu_interface(space->machine); + vga_cpu_interface(space->machine()); } break; } @@ -1154,7 +1154,7 @@ READ8_HANDLER( paradise_ega_03c0_r ) -void pc_vga_reset(running_machine *machine) +void pc_vga_reset(running_machine &machine) { /* clear out the VGA structure */ memset(vga.pens, 0, sizeof(vga.pens)); @@ -1217,7 +1217,7 @@ static WRITE64_HANDLER( vga_port64be_03b0_w ) { write64be_with_write8_handler(vg static WRITE64_HANDLER( vga_port64be_03c0_w ) { write64be_with_write8_handler(vga_port_03c0_w, space, offset, data, mem_mask); } static WRITE64_HANDLER( vga_port64be_03d0_w ) { write64be_with_write8_handler(vga_port_03d0_w, space, offset, data, mem_mask); } -void pc_vga_init(running_machine *machine, const struct pc_vga_interface *vga_intf, const struct pc_svga_interface *svga_intf) +void pc_vga_init(running_machine &machine, const struct pc_vga_interface *vga_intf, const struct pc_svga_interface *svga_intf) { int i, j, k, mask, buswidth; address_space *spacevga; @@ -1265,8 +1265,8 @@ void pc_vga_init(running_machine *machine, const struct pc_vga_interface *vga_in memset(vga.crtc.data, '\0', vga.svga_intf.crtc_regcount); memset(vga.gc.data, '\0', vga.svga_intf.gc_regcount); - buswidth = downcast<cpu_device *>(machine->firstcpu)->space_config(AS_PROGRAM)->m_databus_width; - spacevga = machine->firstcpu->memory().space(vga.vga_intf.port_addressspace); + buswidth = downcast<cpu_device *>(machine.firstcpu)->space_config(AS_PROGRAM)->m_databus_width; + spacevga = machine.firstcpu->memory().space(vga.vga_intf.port_addressspace); switch(buswidth) { case 8: @@ -1325,7 +1325,7 @@ static VIDEO_START( ega ) vga.monitor.get_columns = ega_get_crtc_columns; vga.monitor.get_sync_lines = vga_get_crtc_sync_lines; vga.monitor.get_sync_columns = vga_get_crtc_sync_columns; - machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(vga_timer)); + machine.scheduler().timer_pulse(attotime::from_hz(60), FUNC(vga_timer)); pc_video_start(machine, pc_ega_choosevideomode, 0); } @@ -1340,7 +1340,7 @@ static VIDEO_START( vga ) vga.monitor.get_columns=vga_get_crtc_columns; vga.monitor.get_sync_lines=vga_get_crtc_sync_lines; vga.monitor.get_sync_columns=vga_get_crtc_sync_columns; - machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(vga_timer)); + machine.scheduler().timer_pulse(attotime::from_hz(60), FUNC(vga_timer)); pc_video_start(machine, pc_vga_choosevideomode, 0); } @@ -1519,7 +1519,7 @@ static void vga_vh_vga(bitmap_t *bitmap) } } -static pc_video_update_proc pc_ega_choosevideomode(running_machine *machine, int *width, int *height) +static pc_video_update_proc pc_ega_choosevideomode(running_machine &machine, int *width, int *height) { pc_video_update_proc proc = NULL; int i; @@ -1527,7 +1527,7 @@ static pc_video_update_proc pc_ega_choosevideomode(running_machine *machine, int //if (CRTC_ON) { for (i = 0; i < 16; i++) - vga.pens[i]=machine->pens[i/*vga.attribute.data[i]&0x3f*/]; + vga.pens[i]=machine.pens[i/*vga.attribute.data[i]&0x3f*/]; if (!GRAPHIC_MODE) { @@ -1545,7 +1545,7 @@ static pc_video_update_proc pc_ega_choosevideomode(running_machine *machine, int return proc; } -static pc_video_update_proc pc_vga_choosevideomode(running_machine *machine, int *width, int *height) +static pc_video_update_proc pc_vga_choosevideomode(running_machine &machine, int *width, int *height) { pc_video_update_proc proc = NULL; int i; @@ -1567,7 +1567,7 @@ static pc_video_update_proc pc_vga_choosevideomode(running_machine *machine, int { for (i=0; i<16;i++) { - vga.pens[i] = machine->pens[(vga.attribute.data[i]&0x0f) + vga.pens[i] = machine.pens[(vga.attribute.data[i]&0x0f) |((vga.attribute.data[0x14]&0xf)<<4)]; } } @@ -1575,7 +1575,7 @@ static pc_video_update_proc pc_vga_choosevideomode(running_machine *machine, int { for (i=0; i<16;i++) { - vga.pens[i]=machine->pens[(vga.attribute.data[i]&0x3f) + vga.pens[i]=machine.pens[(vga.attribute.data[i]&0x3f) |((vga.attribute.data[0x14]&0xc)<<4)]; } } diff --git a/src/emu/video/pc_vga.h b/src/emu/video/pc_vga.h index 525274ae344..da059e7ef39 100644 --- a/src/emu/video/pc_vga.h +++ b/src/emu/video/pc_vga.h @@ -19,7 +19,7 @@ struct pc_vga_interface { /* VGA memory mapper */ const char *vga_memory_bank; - void (*map_vga_memory)(running_machine *machine, offs_t begin, offs_t end, read8_space_func rh, write8_space_func wh); + void (*map_vga_memory)(running_machine &machine, offs_t begin, offs_t end, read8_space_func rh, write8_space_func wh); /* VGA dipswitch (???) */ read8_space_func read_dipswitch; @@ -38,8 +38,8 @@ struct pc_svga_interface pc_video_update_proc (*choosevideomode)(const UINT8 *sequencer, const UINT8 *crtc, const UINT8 *gc, int *width, int *height); }; -void pc_vga_init(running_machine *machine, const struct pc_vga_interface *vga_intf, const struct pc_svga_interface *svga_intf); -void pc_vga_reset(running_machine *machine); +void pc_vga_init(running_machine &machine, const struct pc_vga_interface *vga_intf, const struct pc_svga_interface *svga_intf); +void pc_vga_reset(running_machine &machine); void *pc_vga_memory(void); size_t pc_vga_memory_size(void); @@ -103,7 +103,7 @@ WRITE16_HANDLER( vga_port16le_03d0_w ); */ #if 0 int i; - UINT8 *memory=machine->region("maincpu")->base()+0xc0000; + UINT8 *memory=machine.region("maincpu")->base()+0xc0000; UINT8 chksum; /* oak vga */ diff --git a/src/emu/video/pc_video.c b/src/emu/video/pc_video.c index 5293ffbf69e..9d591dcf908 100644 --- a/src/emu/video/pc_video.c +++ b/src/emu/video/pc_video.c @@ -19,7 +19,7 @@ ***************************************************************************/ -static pc_video_update_proc (*pc_choosevideomode)(running_machine *machine, int *width, int *height); +static pc_video_update_proc (*pc_choosevideomode)(running_machine &machine, int *width, int *height); static int pc_anythingdirty; static int pc_current_height; static int pc_current_width; @@ -38,22 +38,22 @@ static STATE_POSTLOAD( pc_video_postload ) -void pc_video_start(running_machine *machine, - pc_video_update_proc (*choosevideomode)(running_machine *machine, int *width, int *height), +void pc_video_start(running_machine &machine, + pc_video_update_proc (*choosevideomode)(running_machine &machine, int *width, int *height), size_t vramsize) { pc_choosevideomode = choosevideomode; pc_anythingdirty = 1; pc_current_height = -1; pc_current_width = -1; - machine->generic.tmpbitmap = NULL; + machine.generic.tmpbitmap = NULL; if (vramsize) { video_start_generic_bitmapped(machine); } - machine->state().register_postload(pc_video_postload, NULL); + machine.state().register_postload(pc_video_postload, NULL); } @@ -64,7 +64,7 @@ SCREEN_UPDATE( pc_video ) int w = 0, h = 0; pc_video_update_proc video_update; - video_update = pc_choosevideomode(screen->machine, &w, &h); + video_update = pc_choosevideomode(screen->machine(), &w, &h); if (video_update) { @@ -88,11 +88,11 @@ SCREEN_UPDATE( pc_video ) bitmap_fill(bitmap, cliprect, 0); } - video_update(screen->machine->generic.tmpbitmap ? screen->machine->generic.tmpbitmap : bitmap); + video_update(screen->machine().generic.tmpbitmap ? screen->machine().generic.tmpbitmap : bitmap); - if (screen->machine->generic.tmpbitmap) + if (screen->machine().generic.tmpbitmap) { - copybitmap(bitmap, screen->machine->generic.tmpbitmap, 0, 0, 0, 0, cliprect); + copybitmap(bitmap, screen->machine().generic.tmpbitmap, 0, 0, 0, 0, cliprect); if (!pc_anythingdirty) rc = UPDATE_HAS_NOT_CHANGED; pc_anythingdirty = 0; diff --git a/src/emu/video/pc_video.h b/src/emu/video/pc_video.h index 2256ce59cbf..8f1e13655b4 100644 --- a/src/emu/video/pc_video.h +++ b/src/emu/video/pc_video.h @@ -11,8 +11,8 @@ typedef void (*pc_video_update_proc)(bitmap_t *bitmap); -void pc_video_start(running_machine *machine, - pc_video_update_proc (*choosevideomode)(running_machine *machine, int *width, int *height), +void pc_video_start(running_machine &machine, + pc_video_update_proc (*choosevideomode)(running_machine &machine, int *width, int *height), size_t vramsize); SCREEN_UPDATE( pc_video ); diff --git a/src/emu/video/poly.c b/src/emu/video/poly.c index 02c1c16f8bf..4f372146231 100644 --- a/src/emu/video/poly.c +++ b/src/emu/video/poly.c @@ -200,7 +200,7 @@ struct _poly_manager FUNCTION PROTOTYPES ***************************************************************************/ -static void **allocate_array(running_machine *machine, size_t *itemsize, UINT32 itemcount); +static void **allocate_array(running_machine &machine, size_t *itemsize, UINT32 itemcount); static void *poly_item_callback(void *param, int threadid); static STATE_PRESAVE( poly_state_presave ); @@ -316,7 +316,7 @@ INLINE polygon_info *allocate_polygon(poly_manager *poly, int miny, int maxy) manager -------------------------------------------------*/ -poly_manager *poly_alloc(running_machine *machine, int max_polys, size_t extra_data_size, UINT8 flags) +poly_manager *poly_alloc(running_machine &machine, int max_polys, size_t extra_data_size, UINT8 flags) { poly_manager *poly; @@ -347,7 +347,7 @@ poly_manager *poly_alloc(running_machine *machine, int max_polys, size_t extra_d poly->queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ); /* request a pre-save callback for synchronization */ - machine->state().register_presave(poly_state_presave, poly); + machine.state().register_presave(poly_state_presave, poly); return poly; } @@ -1286,7 +1286,7 @@ int poly_zclip_if_less(int numverts, const poly_vertex *v, poly_vertex *outv, in allocate_array - allocate an array of pointers -------------------------------------------------*/ -static void **allocate_array(running_machine *machine, size_t *itemsize, UINT32 itemcount) +static void **allocate_array(running_machine &machine, size_t *itemsize, UINT32 itemcount) { void **ptrarray; int itemnum; diff --git a/src/emu/video/poly.h b/src/emu/video/poly.h index e6fc8c54fa3..49706ec5998 100644 --- a/src/emu/video/poly.h +++ b/src/emu/video/poly.h @@ -100,7 +100,7 @@ typedef void (*poly_draw_scanline_func)(void *dest, INT32 scanline, const poly_e /* ----- initialization/teardown ----- */ /* allocate a new poly manager that can render triangles */ -poly_manager *poly_alloc(running_machine *machine, int max_polys, size_t extra_data_size, UINT8 flags); +poly_manager *poly_alloc(running_machine &machine, int max_polys, size_t extra_data_size, UINT8 flags); /* free a poly manager */ void poly_free(poly_manager *poly); diff --git a/src/emu/video/resnet.c b/src/emu/video/resnet.c index d60328e5f74..35d98e376ba 100644 --- a/src/emu/video/resnet.c +++ b/src/emu/video/resnet.c @@ -696,7 +696,7 @@ int compute_res_net(int inputs, int channel, const res_net_info *di) return (int) (v * 255 / vcc + 0.4); } -rgb_t *compute_res_net_all(running_machine *machine, const UINT8 *prom, const res_net_decode_info *rdi, const res_net_info *di) +rgb_t *compute_res_net_all(running_machine &machine, const UINT8 *prom, const res_net_decode_info *rdi, const res_net_info *di) { UINT8 r,g,b; int i,j,k; diff --git a/src/emu/video/resnet.h b/src/emu/video/resnet.h index f81d37a5ad1..1c7d53845c6 100644 --- a/src/emu/video/resnet.h +++ b/src/emu/video/resnet.h @@ -160,7 +160,7 @@ int compute_res_net(int inputs, int channel, const res_net_info *di); /* compute all values */ -rgb_t *compute_res_net_all(running_machine *machine, const UINT8 *prom, const res_net_decode_info *rdi, const res_net_info *di); +rgb_t *compute_res_net_all(running_machine &machine, const UINT8 *prom, const res_net_decode_info *rdi, const res_net_info *di); /* legacy interface */ diff --git a/src/emu/video/s2636.c b/src/emu/video/s2636.c index 75045759216..f261e1f36db 100644 --- a/src/emu/video/s2636.c +++ b/src/emu/video/s2636.c @@ -324,7 +324,7 @@ WRITE8_DEVICE_HANDLER( s2636_work_ram_w ) const s2636_interface *intf = get_interface(device); if ( intf->sound && *intf->sound ) { - s2636_soundport_w(device->machine->device(intf->sound), 0, data); + s2636_soundport_w(device->machine().device(intf->sound), 0, data); } } @@ -351,7 +351,7 @@ static DEVICE_START( s2636 ) { s2636_state *s2636 = get_safe_token(device); const s2636_interface *intf = get_interface(device); - screen_device *screen = downcast<screen_device *>(device->machine->device(intf->screen)); + screen_device *screen = downcast<screen_device *>(device->machine().device(intf->screen)); int width = screen->width(); int height = screen->height(); @@ -359,9 +359,9 @@ static DEVICE_START( s2636 ) s2636->x_offset = intf->x_offset; s2636->y_offset = intf->y_offset; - s2636->work_ram = auto_alloc_array_clear(device->machine, UINT8, intf->work_ram_size); - s2636->bitmap = auto_bitmap_alloc(device->machine, width, height, BITMAP_FORMAT_INDEXED16); - s2636->collision_bitmap = auto_bitmap_alloc(device->machine, width, height, BITMAP_FORMAT_INDEXED16); + s2636->work_ram = auto_alloc_array_clear(device->machine(), UINT8, intf->work_ram_size); + s2636->bitmap = auto_bitmap_alloc(device->machine(), width, height, BITMAP_FORMAT_INDEXED16); + s2636->collision_bitmap = auto_bitmap_alloc(device->machine(), width, height, BITMAP_FORMAT_INDEXED16); device->save_item(NAME(s2636->x_offset)); device->save_item(NAME(s2636->y_offset)); diff --git a/src/emu/video/saa5050.c b/src/emu/video/saa5050.c index 8ca8457dd2e..d62f7ae3edd 100644 --- a/src/emu/video/saa5050.c +++ b/src/emu/video/saa5050.c @@ -154,18 +154,18 @@ PALETTE_INIT( saa5050 ) { UINT8 i, r, g, b; - machine->colortable = colortable_alloc(machine, 8); + machine.colortable = colortable_alloc(machine, 8); for ( i = 0; i < 8; i++ ) { r = saa5050_colors[i * 3]; g = saa5050_colors[i * 3 + 1]; b = saa5050_colors[i * 3 + 2]; - colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); + colortable_palette_set_color(machine.colortable, i, MAKE_RGB(r, g, b)); } for (i = 0; i < 128; i++) - colortable_entry_set_value(machine->colortable, i, saa5050_palette[i]); + colortable_entry_set_value(machine.colortable, i, saa5050_palette[i]); } /************************************* @@ -317,12 +317,12 @@ void saa5050_update( device_t *device, bitmap_t *bitmap, const rectangle *clipre { if (saa5050->flags & SAA5050_DBLHI) { - drawgfxzoom_opaque(bitmap, cliprect, saa5050->screen->machine->gfx[saa5050->gfxnum + 1], code, colour, 0, 0, sx * 12, ssy * 20, 0x20000, 0x20000); - drawgfxzoom_opaque(bitmap, cliprect, saa5050->screen->machine->gfx[saa5050->gfxnum + 2], code, colour, 0, 0, sx * 12, (ssy + 1) * 20, 0x20000, 0x20000); + drawgfxzoom_opaque(bitmap, cliprect, saa5050->screen->machine().gfx[saa5050->gfxnum + 1], code, colour, 0, 0, sx * 12, ssy * 20, 0x20000, 0x20000); + drawgfxzoom_opaque(bitmap, cliprect, saa5050->screen->machine().gfx[saa5050->gfxnum + 2], code, colour, 0, 0, sx * 12, (ssy + 1) * 20, 0x20000, 0x20000); } else { - drawgfxzoom_opaque(bitmap, cliprect, saa5050->screen->machine->gfx[saa5050->gfxnum + 0], code, colour, 0, 0, sx * 12, ssy * 20, 0x20000, 0x20000); + drawgfxzoom_opaque(bitmap, cliprect, saa5050->screen->machine().gfx[saa5050->gfxnum + 0], code, colour, 0, 0, sx * 12, ssy * 20, 0x20000, 0x20000); } } } @@ -344,14 +344,14 @@ static DEVICE_START( saa5050 ) saa5050_state *saa5050 = get_safe_token(device); const saa5050_interface *intf = get_interface(device); - saa5050->screen = device->machine->device(intf->screen); + saa5050->screen = device->machine().device(intf->screen); saa5050->gfxnum = intf->gfxnum; saa5050->x = intf->x; saa5050->y = intf->y; saa5050->size = intf->size; saa5050->rev = intf->rev; - saa5050->videoram = auto_alloc_array(device->machine, UINT8, 0x800); + saa5050->videoram = auto_alloc_array(device->machine(), UINT8, 0x800); device->save_pointer(NAME(saa5050->videoram), 0x800); device->save_item(NAME(saa5050->flags)); diff --git a/src/emu/video/tlc34076.c b/src/emu/video/tlc34076.c index 5e36420e2a8..cbc5d5ae148 100644 --- a/src/emu/video/tlc34076.c +++ b/src/emu/video/tlc34076.c @@ -267,13 +267,13 @@ static DEVICE_START( tlc34076 ) state->dacbits = config->res_sel ? 8 : 6; - state_save_register_global_array(device->machine, state->local_paletteram); - state_save_register_global_array(device->machine, state->regs); - state_save_register_global_array(device->machine, state->pens); + state_save_register_global_array(device->machine(), state->local_paletteram); + state_save_register_global_array(device->machine(), state->regs); + state_save_register_global_array(device->machine(), state->pens); - state_save_register_global(device->machine, state->writeindex); - state_save_register_global(device->machine, state->readindex); - state_save_register_global(device->machine, state->dacbits); + state_save_register_global(device->machine(), state->writeindex); + state_save_register_global(device->machine(), state->readindex); + state_save_register_global(device->machine(), state->dacbits); } static const char DEVTEMPLATE_SOURCE[] = __FILE__; diff --git a/src/emu/video/tms34061.c b/src/emu/video/tms34061.c index e6d754914a1..b4ad0d6aa2d 100644 --- a/src/emu/video/tms34061.c +++ b/src/emu/video/tms34061.c @@ -75,12 +75,12 @@ static TIMER_CALLBACK( tms34061_interrupt ); * *************************************/ -void tms34061_start(running_machine *machine, const struct tms34061_interface *interface) +void tms34061_start(running_machine &machine, const struct tms34061_interface *interface) { /* reset the data */ memset(&tms34061, 0, sizeof(tms34061)); tms34061.intf = *interface; - tms34061.screen = downcast<screen_device *>(machine->device(tms34061.intf.screen_tag)); + tms34061.screen = downcast<screen_device *>(machine.device(tms34061.intf.screen_tag)); tms34061.vrammask = tms34061.intf.vramsize - 1; /* allocate memory for VRAM */ @@ -119,7 +119,7 @@ void tms34061_start(running_machine *machine, const struct tms34061_interface *i tms34061.regs[TMS34061_VERCOUNTER] = 0x0000; /* start vertical interrupt timer */ - tms34061.timer = machine->scheduler().timer_alloc(FUNC(tms34061_interrupt)); + tms34061.timer = machine.scheduler().timer_alloc(FUNC(tms34061_interrupt)); } @@ -137,9 +137,9 @@ INLINE void update_interrupts(void) { /* if the status bit is set, and ints are enabled, turn it on */ if ((tms34061.regs[TMS34061_STATUS] & 0x0001) && (tms34061.regs[TMS34061_CONTROL1] & 0x0400)) - (*tms34061.intf.interrupt)(tms34061.screen->machine, ASSERT_LINE); + (*tms34061.intf.interrupt)(tms34061.screen->machine(), ASSERT_LINE); else - (*tms34061.intf.interrupt)(tms34061.screen->machine, CLEAR_LINE); + (*tms34061.intf.interrupt)(tms34061.screen->machine(), CLEAR_LINE); } } @@ -184,7 +184,7 @@ static void register_w(address_space *space, offs_t offset, UINT8 data) } /* log it */ - if (VERBOSE) logerror("%s:tms34061 %s = %04x\n", space->machine->describe_context(), regnames[regnum], tms34061.regs[regnum]); + if (VERBOSE) logerror("%s:tms34061 %s = %04x\n", space->machine().describe_context(), regnames[regnum], tms34061.regs[regnum]); /* update the state of things */ switch (regnum) @@ -262,7 +262,7 @@ static UINT8 register_r(address_space *space, offs_t offset) } /* log it */ - if (VERBOSE) logerror("%s:tms34061 %s read = %04X\n", space->machine->describe_context(), regnames[regnum], result); + if (VERBOSE) logerror("%s:tms34061 %s read = %04X\n", space->machine().describe_context(), regnames[regnum], result); return (offset & 0x02) ? (result >> 8) : result; } @@ -369,7 +369,7 @@ static void xypixel_w(address_space *space, int offset, UINT8 data) /* mask to the VRAM size */ pixeloffs &= tms34061.vrammask; - if (VERBOSE) logerror("%s:tms34061 xy (%04x) = %02x/%02x\n", space->machine->describe_context(), pixeloffs, data, tms34061.latchdata); + if (VERBOSE) logerror("%s:tms34061 xy (%04x) = %02x/%02x\n", space->machine().describe_context(), pixeloffs, data, tms34061.latchdata); /* set the pixel data */ tms34061.vram[pixeloffs] = data; @@ -425,7 +425,7 @@ void tms34061_w(address_space *space, int col, int row, int func, UINT8 data) offs = ((row << tms34061.intf.rowshift) | col) & tms34061.vrammask; if (tms34061.regs[TMS34061_CONTROL2] & 0x0040) offs |= (tms34061.regs[TMS34061_CONTROL2] & 3) << 16; - if (VERBOSE) logerror("%s:tms34061 direct (%04x) = %02x/%02x\n", space->machine->describe_context(), offs, data, tms34061.latchdata); + if (VERBOSE) logerror("%s:tms34061 direct (%04x) = %02x/%02x\n", space->machine().describe_context(), offs, data, tms34061.latchdata); if (tms34061.vram[offs] != data || tms34061.latchram[offs] != tms34061.latchdata) { tms34061.vram[offs] = data; @@ -439,7 +439,7 @@ void tms34061_w(address_space *space, int col, int row, int func, UINT8 data) if (tms34061.regs[TMS34061_CONTROL2] & 0x0040) offs |= (tms34061.regs[TMS34061_CONTROL2] & 3) << 16; offs &= tms34061.vrammask; - if (VERBOSE) logerror("%s:tms34061 shiftreg write (%04x)\n", space->machine->describe_context(), offs); + if (VERBOSE) logerror("%s:tms34061 shiftreg write (%04x)\n", space->machine().describe_context(), offs); memcpy(&tms34061.vram[offs], tms34061.shiftreg, (size_t)1 << tms34061.intf.rowshift); memset(&tms34061.latchram[offs], tms34061.latchdata, (size_t)1 << tms34061.intf.rowshift); @@ -451,14 +451,14 @@ void tms34061_w(address_space *space, int col, int row, int func, UINT8 data) if (tms34061.regs[TMS34061_CONTROL2] & 0x0040) offs |= (tms34061.regs[TMS34061_CONTROL2] & 3) << 16; offs &= tms34061.vrammask; - if (VERBOSE) logerror("%s:tms34061 shiftreg read (%04x)\n", space->machine->describe_context(), offs); + if (VERBOSE) logerror("%s:tms34061 shiftreg read (%04x)\n", space->machine().describe_context(), offs); tms34061.shiftreg = &tms34061.vram[offs]; break; /* log anything else */ default: - logerror("%s:Unsupported TMS34061 function %d\n", space->machine->describe_context(), func); + logerror("%s:Unsupported TMS34061 function %d\n", space->machine().describe_context(), func); break; } } @@ -512,7 +512,7 @@ UINT8 tms34061_r(address_space *space, int col, int row, int func) /* log anything else */ default: - logerror("%s:Unsupported TMS34061 function %d\n", space->machine->describe_context(), + logerror("%s:Unsupported TMS34061 function %d\n", space->machine().describe_context(), func); break; } diff --git a/src/emu/video/tms34061.h b/src/emu/video/tms34061.h index e94b56d9c29..0128785d9ef 100644 --- a/src/emu/video/tms34061.h +++ b/src/emu/video/tms34061.h @@ -43,7 +43,7 @@ struct tms34061_interface const char *screen_tag; /* the screen we are acting on */ UINT8 rowshift; /* VRAM address is (row << rowshift) | col */ UINT32 vramsize; /* size of video RAM */ - void (*interrupt)(running_machine *machine, int state); /* interrupt gen callback */ + void (*interrupt)(running_machine &machine, int state); /* interrupt gen callback */ }; @@ -59,7 +59,7 @@ struct tms34061_display /* starts/stops the emulator */ -void tms34061_start(running_machine *machine, const struct tms34061_interface *interface); +void tms34061_start(running_machine &machine, const struct tms34061_interface *interface); /* reads/writes to the 34061 */ UINT8 tms34061_r(address_space *space, int col, int row, int func); diff --git a/src/emu/video/tms9927.c b/src/emu/video/tms9927.c index 5ef5425d04d..a7c89807d54 100644 --- a/src/emu/video/tms9927.c +++ b/src/emu/video/tms9927.c @@ -271,19 +271,19 @@ static DEVICE_START( tms9927 ) tms->hpixels_per_column = tms->intf->hpixels_per_column; /* get the screen device */ - tms->screen = downcast<screen_device *>(device->machine->device(tms->intf->screen_tag)); + tms->screen = downcast<screen_device *>(device->machine().device(tms->intf->screen_tag)); assert(tms->screen != NULL); /* get the self-load PROM */ if (tms->intf->selfload_region != NULL) { - tms->selfload = device->machine->region(tms->intf->selfload_region)->base(); + tms->selfload = device->machine().region(tms->intf->selfload_region)->base(); assert(tms->selfload != NULL); } } /* register for state saving */ - device->machine->state().register_postload(tms9927_state_save_postload, tms); + device->machine().state().register_postload(tms9927_state_save_postload, tms); device->save_item(NAME(tms->clock)); device->save_item(NAME(tms->reg)); diff --git a/src/emu/video/tms9928a.c b/src/emu/video/tms9928a.c index ce9e803b821..b427a4cda3e 100644 --- a/src/emu/video/tms9928a.c +++ b/src/emu/video/tms9928a.c @@ -108,7 +108,7 @@ static void draw_mode3 (device_t *screen, bitmap_t *bitmap, const rectangle *cli static void draw_mode23 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect); static void draw_modebogus (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect); static void draw_sprites (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect); -static void change_register (running_machine *machine, int reg, UINT8 data); +static void change_register (running_machine &machine, int reg, UINT8 data); static void (*const ModeHandlers[])(device_t *screen, bitmap_t *bitmap, const rectangle *cliprect) = { draw_mode0, draw_mode1, draw_mode2, draw_mode12, @@ -139,7 +139,7 @@ typedef struct { INT32 Addr; int colour,pattern,nametbl,spriteattribute,spritepattern; int colourmask,patternmask; - void (*INTCallback)(running_machine *, int); + void (*INTCallback)(running_machine &, int); /* memory */ UINT8 *vMem, *dBackMem; bitmap_t *tmpbmp; @@ -176,7 +176,7 @@ void TMS9928A_reset () { tms.latch = 0; } -static void TMS9928A_start (running_machine *machine, const TMS9928a_interface *intf) +static void TMS9928A_start (running_machine &machine, const TMS9928a_interface *intf) { assert_always(((intf->vram == 0x1000) || (intf->vram == 0x2000) || (intf->vram == 0x4000)), "4, 8 or 16 kB vram please"); @@ -194,9 +194,9 @@ static void TMS9928A_start (running_machine *machine, const TMS9928a_interface * tms.visarea.max_y = tms.top_border + 24*8 - 1 + MIN(intf->bordery, tms.bottom_border); /* configure the screen if we weren't overridden */ - if (machine->primary_screen->width() == LEFT_BORDER+32*8+RIGHT_BORDER && - machine->primary_screen->height() == TOP_BORDER_60HZ+24*8+BOTTOM_BORDER_60HZ) - machine->primary_screen->configure(LEFT_BORDER + 32*8 + RIGHT_BORDER, tms.top_border + 24*8 + tms.bottom_border, tms.visarea, machine->primary_screen->frame_period().attoseconds); + if (machine.primary_screen->width() == LEFT_BORDER+32*8+RIGHT_BORDER && + machine.primary_screen->height() == TOP_BORDER_60HZ+24*8+BOTTOM_BORDER_60HZ) + machine.primary_screen->configure(LEFT_BORDER + 32*8 + RIGHT_BORDER, tms.top_border + 24*8 + tms.bottom_border, tms.visarea, machine.primary_screen->frame_period().attoseconds); /* Video RAM */ tms.vramsize = intf->vram; @@ -206,7 +206,7 @@ static void TMS9928A_start (running_machine *machine, const TMS9928a_interface * tms.dBackMem = auto_alloc_array(machine, UINT8, IMAGE_SIZE); /* back bitmap */ - tms.tmpbmp = auto_bitmap_alloc (machine, 256, 192, machine->primary_screen->format()); + tms.tmpbmp = auto_bitmap_alloc (machine, 256, 192, machine.primary_screen->format()); TMS9928A_reset (); tms.LimitSprites = 1; @@ -233,7 +233,7 @@ const rectangle *TMS9928A_get_visarea (void) } -void TMS9928A_post_load (running_machine *machine) { +void TMS9928A_post_load (running_machine &machine) { int i; /* all registers need to be re-written, so tables are recalculated */ @@ -271,7 +271,7 @@ READ8_HANDLER (TMS9928A_register_r) { tms.StatusReg = 0x1f; if (tms.INT) { tms.INT = 0; - if (tms.INTCallback) tms.INTCallback (space->machine, tms.INT); + if (tms.INTCallback) tms.INTCallback (space->machine(), tms.INT); } tms.latch = 0; return b; @@ -287,7 +287,7 @@ WRITE8_HANDLER (TMS9928A_register_w) { if (data & 0x80) { /* register write */ reg = data & 7; - change_register (space->machine, reg, tms.Addr & 0xff); + change_register (space->machine(), reg, tms.Addr & 0xff); } else { if ( !(data & 0x40) ) { /* read ahead */ @@ -302,7 +302,7 @@ WRITE8_HANDLER (TMS9928A_register_w) { } } -static void change_register (running_machine *machine, int reg, UINT8 val) { +static void change_register (running_machine &machine, int reg, UINT8 val) { static const UINT8 Mask[8] = { 0x03, 0xfb, 0x0f, 0xff, 0x07, 0x7f, 0x07, 0xff }; static const char *const modes[] = { @@ -393,15 +393,15 @@ void TMS9928A_set_spriteslimit (int limit) { SCREEN_UPDATE( tms9928a ) { INT32 BackColour = tms.Regs[7] & 15; - rgb_t oldcolor = palette_get_color(screen->machine, 0); + rgb_t oldcolor = palette_get_color(screen->machine(), 0); if (!BackColour) BackColour=1; /* note we preserve the alpha here; this is so that it can be controlled independently */ /* see cliffhgr.c for an example */ - palette_set_color(screen->machine, 0, (TMS9928A_palette[BackColour] & MAKE_ARGB(0,255,255,255)) | (oldcolor & MAKE_ARGB(255,0,0,0))); + palette_set_color(screen->machine(), 0, (TMS9928A_palette[BackColour] & MAKE_ARGB(0,255,255,255)) | (oldcolor & MAKE_ARGB(255,0,0,0))); if (! (tms.Regs[1] & 0x40)) - bitmap_fill(bitmap, cliprect, screen->machine->pens[BackColour]); + bitmap_fill(bitmap, cliprect, screen->machine().pens[BackColour]); else { (*ModeHandlers[TMS_MODE])(screen, tms.tmpbmp, cliprect); @@ -430,13 +430,13 @@ SCREEN_UPDATE( tms9928a ) return 0; } -int TMS9928A_interrupt(running_machine *machine) { +int TMS9928A_interrupt(running_machine &machine) { int b; /* when skipping frames, calculate sprite collision */ - if (machine->video().skip_this_frame()) { + if (machine.video().skip_this_frame()) { if (TMS_SPRITES_ENABLED) { - draw_sprites (machine->primary_screen, NULL, NULL); + draw_sprites (machine.primary_screen, NULL, NULL); } } @@ -456,7 +456,7 @@ static void draw_mode1 (device_t *screen, bitmap_t *bitmap, const rectangle *cli rectangle rt; const pen_t *pens; - pens = screen->machine->pens; + pens = screen->machine().pens; fg = pens[tms.Regs[7] / 16]; bg = pens[tms.Regs[7] & 15]; @@ -491,7 +491,7 @@ static void draw_mode12 (device_t *screen, bitmap_t *bitmap, const rectangle *cl const pen_t *pens; rectangle rt; - pens = screen->machine->pens; + pens = screen->machine().pens; fg = pens[tms.Regs[7] / 16]; bg = pens[tms.Regs[7] & 15]; @@ -525,7 +525,7 @@ static void draw_mode0 (device_t *screen, bitmap_t *bitmap, const rectangle *cli UINT8 fg,bg,*patternptr; const pen_t *pens; - pens = screen->machine->pens; + pens = screen->machine().pens; name = 0; for (y=0;y<24;y++) { for (x=0;x<32;x++) { @@ -552,7 +552,7 @@ static void draw_mode2 (device_t *screen, bitmap_t *bitmap, const rectangle *cli const pen_t *pens; UINT8 *colourptr,*patternptr; - pens = screen->machine->pens; + pens = screen->machine().pens; name = 0; for (y=0;y<24;y++) { for (x=0;x<32;x++) { @@ -581,7 +581,7 @@ static void draw_mode3 (device_t *screen, bitmap_t *bitmap, const rectangle *cli UINT8 fg,bg,*patternptr; const pen_t *pens; - pens = screen->machine->pens; + pens = screen->machine().pens; name = 0; for (y=0;y<24;y++) { for (x=0;x<32;x++) { @@ -611,7 +611,7 @@ static void draw_mode23 (device_t *screen, bitmap_t *bitmap, const rectangle *cl UINT8 fg,bg,*patternptr; const pen_t *pens; - pens = screen->machine->pens; + pens = screen->machine().pens; name = 0; for (y=0;y<24;y++) { for (x=0;x<32;x++) { @@ -642,7 +642,7 @@ static void draw_modebogus (device_t *screen, bitmap_t *bitmap, const rectangle int x,y,n,xx; const pen_t *pens; - pens = screen->machine->pens; + pens = screen->machine().pens; fg = pens[tms.Regs[7] / 16]; bg = pens[tms.Regs[7] & 15]; @@ -673,7 +673,7 @@ static void draw_sprites (device_t *screen, bitmap_t *bitmap, const rectangle *c UINT16 line,line2; const pen_t *pens; - pens = screen->machine->pens; + pens = screen->machine().pens; attributeptr = tms.vMem + tms.spriteattribute; size = (tms.Regs[1] & 2) ? 16 : 8; large = (int)(tms.Regs[1] & 1); diff --git a/src/emu/video/tms9928a.h b/src/emu/video/tms9928a.h index d5bd15af7bc..62e24fe8e48 100644 --- a/src/emu/video/tms9928a.h +++ b/src/emu/video/tms9928a.h @@ -45,7 +45,7 @@ typedef struct TMS9928a_interface tms9928a_model model; /* model: tms9929(a) runs at 50Hz instead of 60Hz */ int vram; /* VRAM size in bytes (4k, 8k or 16k) */ int borderx, bordery; /* number of border pixels to show in each direction */ - void (*int_callback)(running_machine *, int); /* callback which is called whenever the state + void (*int_callback)(running_machine &, int); /* callback which is called whenever the state ** of the INT output of the TMS9918A changes (may be NULL)*/ } TMS9928a_interface; @@ -82,7 +82,7 @@ extern SCREEN_UPDATE( tms9928a ); ** This next function must be called 50 (tms9929a) or 60 (tms99x8a) times per second, ** to generate the necessary interrupts */ -int TMS9928A_interrupt (running_machine *machine); +int TMS9928A_interrupt (running_machine &machine); /* ** The parameter is a function pointer. This function is called whenever @@ -98,7 +98,7 @@ void TMS9928A_set_spriteslimit (int); /* ** After loading a state, call this function */ -void TMS9928A_post_load (running_machine *machine); +void TMS9928A_post_load (running_machine &machine); /* ** MachineDriver video declarations for the TMS9928A chip diff --git a/src/emu/video/v9938.c b/src/emu/video/v9938.c index 2a0a639b681..292467e512e 100644 --- a/src/emu/video/v9938.c +++ b/src/emu/video/v9938.c @@ -34,7 +34,7 @@ typedef struct { int vram_size; /* interrupt */ UINT8 INT; - void (*INTCallback)(running_machine *, int); + void (*INTCallback)(running_machine &, int); int scanline; /* blinking */ int blink, blink_count; @@ -94,13 +94,13 @@ static const char *const v9938_modes[] = { "UNKNOWN" }; -static void v9938_register_write (running_machine *machine, int reg, int data); +static void v9938_register_write (running_machine &machine, int reg, int data); static void v9938_update_command (void); static void v9938_cpu_to_vdp (UINT8 V); static UINT8 v9938_command_unit_w (UINT8 Op); static UINT8 v9938_vdp_to_cpu (void); static void v9938_set_mode (void); -static void v9938_refresh_line (running_machine *machine, bitmap_t *bmp, int line); +static void v9938_refresh_line (running_machine &machine, bitmap_t *bmp, int line); /*************************************************************************** @@ -435,7 +435,7 @@ READ8_HANDLER (v9938_1_vram_r) return v9938_vram_r(); } -static void v9938_command_w(running_machine *machine, UINT8 data) +static void v9938_command_w(running_machine &machine, UINT8 data) { if (vdp->cmd_write_first) { @@ -463,13 +463,13 @@ static void v9938_command_w(running_machine *machine, UINT8 data) WRITE8_HANDLER (v9938_0_command_w) { vdp = &vdps[0]; - v9938_command_w(space->machine, data); + v9938_command_w(space->machine(), data); } WRITE8_HANDLER (v9938_1_command_w) { vdp = &vdps[1]; - v9938_command_w(space->machine, data); + v9938_command_w(space->machine(), data); } /*************************************************************************** @@ -478,7 +478,7 @@ WRITE8_HANDLER (v9938_1_command_w) ***************************************************************************/ -void v9938_init (running_machine *machine, int which, screen_device &screen, bitmap_t *bitmap, int model, int vram_size, void (*callback)(running_machine *, int) ) +void v9938_init (running_machine &machine, int which, screen_device &screen, bitmap_t *bitmap, int model, int vram_size, void (*callback)(running_machine &, int) ) { vdp = &vdps[which]; @@ -590,7 +590,7 @@ void v9938_reset (int which) vdp->statReg[6] = 0xfc; } -static void v9938_check_int (running_machine *machine) +static void v9938_check_int (running_machine &machine) { UINT8 n; @@ -644,7 +644,7 @@ void v9938_set_resolution (int which, int i) ***************************************************************************/ -static void v9938_register_w(running_machine *machine, UINT8 data) +static void v9938_register_w(running_machine &machine, UINT8 data) { int reg; @@ -659,16 +659,16 @@ static void v9938_register_w(running_machine *machine, UINT8 data) WRITE8_HANDLER (v9938_0_register_w) { vdp = &vdps[0]; - v9938_register_w(space->machine, data); + v9938_register_w(space->machine(), data); } WRITE8_HANDLER (v9938_1_register_w) { vdp = &vdps[1]; - v9938_register_w(space->machine, data); + v9938_register_w(space->machine(), data); } -static void v9938_register_write (running_machine *machine, int reg, int data) +static void v9938_register_write (running_machine &machine, int reg, int data) { static UINT8 const reg_mask[] = { @@ -756,7 +756,7 @@ static void v9938_register_write (running_machine *machine, int reg, int data) vdp->contReg[reg] = data; } -static UINT8 v9938_status_r(running_machine *machine) +static UINT8 v9938_status_r(running_machine &machine) { int reg; UINT8 ret; @@ -790,7 +790,7 @@ static UINT8 v9938_status_r(running_machine *machine) if ( (n < 28) || (n > 199) ) vdp.statReg[2] |= 0x20; else vdp.statReg[2] &= ~0x20; */ - if (machine->rand() & 1) vdp->statReg[2] |= 0x20; + if (machine.rand() & 1) vdp->statReg[2] |= 0x20; else vdp->statReg[2] &= ~0x20; ret = vdp->statReg[2]; break; @@ -830,13 +830,13 @@ static UINT8 v9938_status_r(running_machine *machine) READ8_HANDLER( v9938_0_status_r ) { vdp = &vdps[0]; - return v9938_status_r(space->machine); + return v9938_status_r(space->machine()); } READ8_HANDLER( v9938_1_status_r ) { vdp = &vdps[1]; - return v9938_status_r(space->machine); + return v9938_status_r(space->machine()); } /*************************************************************************** @@ -1222,9 +1222,9 @@ static void v9938_set_mode (void) vdp->mode = i; } -static void v9938_refresh_16 (running_machine *machine, bitmap_t *bmp, int line) +static void v9938_refresh_16 (running_machine &machine, bitmap_t *bmp, int line) { - const pen_t *pens = machine->pens; + const pen_t *pens = machine.pens; int i, double_lines; UINT8 col[256]; UINT16 *ln, *ln2 = NULL; @@ -1282,7 +1282,7 @@ static void v9938_refresh_16 (running_machine *machine, bitmap_t *bmp, int line) memcpy (ln2, ln, (512 + 32) * 2); } -static void v9938_refresh_line (running_machine *machine, bitmap_t *bmp, int line) +static void v9938_refresh_line (running_machine &machine, bitmap_t *bmp, int line) { int ind16, ind256; @@ -1409,7 +1409,7 @@ I do not know the behaviour of FV when IE0=0. That is the part that I still have to test. */ -static void v9938_interrupt_start_vblank (running_machine *machine) +static void v9938_interrupt_start_vblank (running_machine &machine) { #if 0 if (input_code_pressed (machine, KEYCODE_D) ) @@ -1469,7 +1469,7 @@ static void v9938_interrupt_start_vblank (running_machine *machine) vdp->size_now = -1; } -int v9938_interrupt (running_machine *machine, int which) +int v9938_interrupt (running_machine &machine, int which) { int scanline, max, pal, scanline_start; diff --git a/src/emu/video/v9938.h b/src/emu/video/v9938.h index f7496ccdce6..f14072c85e0 100644 --- a/src/emu/video/v9938.h +++ b/src/emu/video/v9938.h @@ -14,9 +14,9 @@ #define RENDER_LOW (1) #define RENDER_AUTO (2) -void v9938_init (running_machine *machine, int which, screen_device &screen, bitmap_t *bitmap, int model, int vram_size, void (*callback)(running_machine *, int) ); +void v9938_init (running_machine &machine, int which, screen_device &screen, bitmap_t *bitmap, int model, int vram_size, void (*callback)(running_machine &, int) ); void v9938_reset (int which); -int v9938_interrupt (running_machine *machine, int which); +int v9938_interrupt (running_machine &machine, int which); void v9938_set_sprite_limit (int which, int); void v9938_set_resolution (int which, int); int v9938_get_transpen(int which); diff --git a/src/emu/video/vector.c b/src/emu/video/vector.c index 94eb76a669c..cf92011acbc 100644 --- a/src/emu/video/vector.c +++ b/src/emu/video/vector.c @@ -175,10 +175,10 @@ float vector_get_beam(void) VIDEO_START( vector ) { - beam_width = machine->options().beam(); + beam_width = machine.options().beam(); /* Grab the settings for this session */ - vector_set_flicker(machine->options().flicker()); + vector_set_flicker(machine.options().flicker()); vector_index = 0; @@ -191,7 +191,7 @@ VIDEO_START( vector ) * Adds a line end point to the vertices list. The vector processor emulation * needs to call this. */ -void vector_add_point (running_machine *machine, int x, int y, rgb_t color, int intensity) +void vector_add_point (running_machine &machine, int x, int y, rgb_t color, int intensity) { point *newpoint; @@ -200,7 +200,7 @@ void vector_add_point (running_machine *machine, int x, int y, rgb_t color, int if (flicker && (intensity > 0)) { - intensity += (intensity * (0x80-(machine->rand()&0xff)) * flicker)>>16; + intensity += (intensity * (0x80-(machine.rand()&0xff)) * flicker)>>16; if (intensity < 0) intensity = 0; if (intensity > 0xff) @@ -256,7 +256,7 @@ void vector_clear_list (void) SCREEN_UPDATE( vector ) { - UINT32 flags = PRIMFLAG_ANTIALIAS(screen->machine->options().antialias() ? 1 : 0) | PRIMFLAG_BLENDMODE(BLENDMODE_ADD); + UINT32 flags = PRIMFLAG_ANTIALIAS(screen->machine().options().antialias() ? 1 : 0) | PRIMFLAG_BLENDMODE(BLENDMODE_ADD); const rectangle &visarea = screen->visible_area(); float xscale = 1.0f / (65536 * (visarea.max_x - visarea.min_x)); float yscale = 1.0f / (65536 * (visarea.max_y - visarea.min_y)); diff --git a/src/emu/video/vector.h b/src/emu/video/vector.h index 8d4fc7d8353..9fe90bba9d6 100644 --- a/src/emu/video/vector.h +++ b/src/emu/video/vector.h @@ -14,7 +14,7 @@ VIDEO_START( vector ); SCREEN_UPDATE( vector ); void vector_clear_list(void); -void vector_add_point(running_machine *machine, int x, int y, rgb_t color, int intensity); +void vector_add_point(running_machine &machine, int x, int y, rgb_t color, int intensity); void vector_add_clip(int minx, int miny, int maxx, int maxy); void vector_set_flicker(float _flicker); diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index d275cff840b..13e09886b4f 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -416,7 +416,7 @@ int voodoo_update(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) } /* debugging! */ - if (input_code_pressed(device->machine, KEYCODE_L)) + if (input_code_pressed(device->machine(), KEYCODE_L)) drawbuf = v->fbi.backbuf; /* copy from the current front buffer */ @@ -430,7 +430,7 @@ int voodoo_update(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) } /* update stats display */ - statskey = (input_code_pressed(device->machine, KEYCODE_BACKSLASH) != 0); + statskey = (input_code_pressed(device->machine(), KEYCODE_BACKSLASH) != 0); if (statskey && statskey != v->stats.lastkey) v->stats.display = !v->stats.display; v->stats.lastkey = statskey; @@ -440,7 +440,7 @@ int voodoo_update(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) popmessage(v->stats.buffer, 0, 0); /* update render override */ - v->stats.render_override = input_code_pressed(device->machine, KEYCODE_ENTER); + v->stats.render_override = input_code_pressed(device->machine(), KEYCODE_ENTER); if (DEBUG_DEPTH && v->stats.render_override) { for (y = cliprect->min_y; y <= cliprect->max_y; y++) @@ -523,7 +523,7 @@ static void init_fbi(voodoo_state *v, fbi_state *f, void *memory, int fbmem) } /* allocate a VBLANK timer */ - f->vblank_timer = v->device->machine->scheduler().timer_alloc(FUNC(vblank_callback), v); + f->vblank_timer = v->device->machine().scheduler().timer_alloc(FUNC(vblank_callback), v); f->vblank = FALSE; /* initialize the memory FIFO */ @@ -656,7 +656,7 @@ static void init_save_state(device_t *device) voodoo_state *v = get_safe_token(device); int index, subindex; - device->machine->state().register_postload(voodoo_postload, v); + device->machine().state().register_postload(voodoo_postload, v); /* register states: core */ device->save_item(NAME(v->extra_cycles)); @@ -910,13 +910,13 @@ static void swap_buffers(voodoo_state *v) /* reset the last_op_time to now and start processing the next command */ if (v->pci.op_pending) { - v->pci.op_end_time = v->device->machine->time(); + v->pci.op_end_time = v->device->machine().time(); flush_fifos(v, v->pci.op_end_time); } /* we may be able to unstall now */ if (v->pci.stall_state != NOT_STALLED) - check_stalled_cpu(v, v->device->machine->time()); + check_stalled_cpu(v, v->device->machine().time()); /* periodically log rasterizer info */ v->stats.swaps++; @@ -1015,7 +1015,7 @@ static TIMER_CALLBACK( vblank_callback ) if (v->pci.op_pending) { if (LOG_VBLANK_SWAP) logerror("---- vblank flush begin\n"); - flush_fifos(v, machine->time()); + flush_fifos(v, machine.time()); if (LOG_VBLANK_SWAP) logerror("---- vblank flush end\n"); } @@ -1033,7 +1033,7 @@ static TIMER_CALLBACK( vblank_callback ) swap_buffers(v); /* set a timer for the next off state */ - machine->scheduler().timer_set(v->screen->time_until_pos(0), FUNC(vblank_off_callback), 0, v); + machine.scheduler().timer_set(v->screen->time_until_pos(0), FUNC(vblank_off_callback), 0, v); /* set internal state and call the client */ v->fbi.vblank = TRUE; @@ -2002,10 +2002,10 @@ static void cmdfifo_w(voodoo_state *v, cmdfifo_info *f, offs_t offset, UINT32 da if (cycles > 0) { v->pci.op_pending = TRUE; - v->pci.op_end_time = v->device->machine->time() + attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle); + v->pci.op_end_time = v->device->machine().time() + attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle); if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", v->index, - v->device->machine->time().seconds, (UINT32)(v->device->machine->time().attoseconds >> 32), (UINT32)v->device->machine->time().attoseconds, + v->device->machine().time().seconds, (UINT32)(v->device->machine().time().attoseconds >> 32), (UINT32)v->device->machine().time().attoseconds, v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds); } } @@ -2022,7 +2022,7 @@ static void cmdfifo_w(voodoo_state *v, cmdfifo_info *f, offs_t offset, UINT32 da static TIMER_CALLBACK( stall_cpu_callback ) { - check_stalled_cpu((voodoo_state *)ptr, machine->time()); + check_stalled_cpu((voodoo_state *)ptr, machine.time()); } @@ -2069,7 +2069,7 @@ static void check_stalled_cpu(voodoo_state *v, attotime current_time) if (v->pci.stall_callback) (*v->pci.stall_callback)(v->device, FALSE); else - v->device->machine->scheduler().trigger(v->trigger); + v->device->machine().scheduler().trigger(v->trigger); } /* if not, set a timer for the next one */ @@ -3463,7 +3463,7 @@ WRITE32_DEVICE_HANDLER( voodoo_w ) /* if we have something pending, flush the FIFOs up to the current time */ if (v->pci.op_pending) - flush_fifos(v, device->machine->time()); + flush_fifos(v, device->machine().time()); /* special handling for registers */ if ((offset & 0xc00000/4) == 0) @@ -3543,10 +3543,10 @@ WRITE32_DEVICE_HANDLER( voodoo_w ) if (cycles) { v->pci.op_pending = TRUE; - v->pci.op_end_time = device->machine->time() + attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle); + v->pci.op_end_time = device->machine().time() + attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle); if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", v->index, - device->machine->time().seconds, (UINT32)(device->machine->time().attoseconds >> 32), (UINT32)device->machine->time().attoseconds, + device->machine().time().seconds, (UINT32)(device->machine().time().attoseconds >> 32), (UINT32)device->machine().time().attoseconds, v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds); } g_profiler.stop(); @@ -3596,7 +3596,7 @@ WRITE32_DEVICE_HANDLER( voodoo_w ) fifo_items(&v->fbi.fifo) >= 2 * 32 * FBIINIT0_MEMORY_FIFO_HWM(v->reg[fbiInit0].u)) { if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit memory FIFO HWM -- stalling\n", v->index); - stall_cpu(v, STALLED_UNTIL_FIFO_LWM, device->machine->time()); + stall_cpu(v, STALLED_UNTIL_FIFO_LWM, device->machine().time()); } } @@ -3605,14 +3605,14 @@ WRITE32_DEVICE_HANDLER( voodoo_w ) fifo_space(&v->pci.fifo) <= 2 * FBIINIT0_PCI_FIFO_LWM(v->reg[fbiInit0].u)) { if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit PCI FIFO free LWM -- stalling\n", v->index); - stall_cpu(v, STALLED_UNTIL_FIFO_LWM, device->machine->time()); + stall_cpu(v, STALLED_UNTIL_FIFO_LWM, device->machine().time()); } /* if we weren't ready, and this is a non-FIFO access, stall until the FIFOs are clear */ if (stall) { if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w wrote non-FIFO register -- stalling until clear\n", v->index); - stall_cpu(v, STALLED_UNTIL_FIFO_EMPTY, device->machine->time()); + stall_cpu(v, STALLED_UNTIL_FIFO_EMPTY, device->machine().time()); } g_profiler.stop(); @@ -3890,7 +3890,7 @@ READ32_DEVICE_HANDLER( voodoo_r ) /* if we have something pending, flush the FIFOs up to the current time */ if (v->pci.op_pending) - flush_fifos(v, device->machine->time()); + flush_fifos(v, device->machine().time()); /* target the appropriate location */ if (!(offset & (0xc00000/4))) @@ -3966,7 +3966,7 @@ static READ32_DEVICE_HANDLER( banshee_agp_r ) } if (LOG_REGISTERS) - logerror("%s:banshee_r(AGP:%s)\n", v->device->machine->describe_context(), banshee_agp_reg_name[offset]); + logerror("%s:banshee_r(AGP:%s)\n", v->device->machine().describe_context(), banshee_agp_reg_name[offset]); return result; } @@ -3978,22 +3978,22 @@ READ32_DEVICE_HANDLER( banshee_r ) /* if we have something pending, flush the FIFOs up to the current time */ if (v->pci.op_pending) - flush_fifos(v, device->machine->time()); + flush_fifos(v, device->machine().time()); if (offset < 0x80000/4) result = banshee_io_r(device, offset, mem_mask); else if (offset < 0x100000/4) result = banshee_agp_r(device, offset, mem_mask); else if (offset < 0x200000/4) - logerror("%s:banshee_r(2D:%X)\n", device->machine->describe_context(), (offset*4) & 0xfffff); + logerror("%s:banshee_r(2D:%X)\n", device->machine().describe_context(), (offset*4) & 0xfffff); else if (offset < 0x600000/4) result = register_r(v, offset & 0x1fffff/4); else if (offset < 0x800000/4) - logerror("%s:banshee_r(TEX:%X)\n", device->machine->describe_context(), (offset*4) & 0x1fffff); + logerror("%s:banshee_r(TEX:%X)\n", device->machine().describe_context(), (offset*4) & 0x1fffff); else if (offset < 0xc00000/4) - logerror("%s:banshee_r(RES:%X)\n", device->machine->describe_context(), (offset*4) & 0x3fffff); + logerror("%s:banshee_r(RES:%X)\n", device->machine().describe_context(), (offset*4) & 0x3fffff); else if (offset < 0x1000000/4) - logerror("%s:banshee_r(YUV:%X)\n", device->machine->describe_context(), (offset*4) & 0x3fffff); + logerror("%s:banshee_r(YUV:%X)\n", device->machine().describe_context(), (offset*4) & 0x3fffff); else if (offset < 0x2000000/4) { UINT8 temp = v->fbi.lfb_stride; @@ -4012,11 +4012,11 @@ READ32_DEVICE_HANDLER( banshee_fb_r ) /* if we have something pending, flush the FIFOs up to the current time */ if (v->pci.op_pending) - flush_fifos(v, device->machine->time()); + flush_fifos(v, device->machine().time()); if (offset < v->fbi.lfb_base) { - logerror("%s:banshee_fb_r(%X)\n", device->machine->describe_context(), offset*4); + logerror("%s:banshee_fb_r(%X)\n", device->machine().describe_context(), offset*4); if (offset*4 <= v->fbi.mask) result = ((UINT32 *)v->fbi.ram)[offset]; } @@ -4041,7 +4041,7 @@ static READ8_DEVICE_HANDLER( banshee_vga_r ) if (v->banshee.vga[0x3c1 & 0x1f] < ARRAY_LENGTH(v->banshee.att)) result = v->banshee.att[v->banshee.vga[0x3c1 & 0x1f]]; if (LOG_REGISTERS) - logerror("%s:banshee_att_r(%X)\n", device->machine->describe_context(), v->banshee.vga[0x3c1 & 0x1f]); + logerror("%s:banshee_att_r(%X)\n", device->machine().describe_context(), v->banshee.vga[0x3c1 & 0x1f]); break; /* Input status 0 */ @@ -4054,7 +4054,7 @@ static READ8_DEVICE_HANDLER( banshee_vga_r ) */ result = 0x00; if (LOG_REGISTERS) - logerror("%s:banshee_vga_r(%X)\n", device->machine->describe_context(), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", device->machine().describe_context(), 0x300+offset); break; /* Sequencer access */ @@ -4062,7 +4062,7 @@ static READ8_DEVICE_HANDLER( banshee_vga_r ) if (v->banshee.vga[0x3c4 & 0x1f] < ARRAY_LENGTH(v->banshee.seq)) result = v->banshee.seq[v->banshee.vga[0x3c4 & 0x1f]]; if (LOG_REGISTERS) - logerror("%s:banshee_seq_r(%X)\n", device->machine->describe_context(), v->banshee.vga[0x3c4 & 0x1f]); + logerror("%s:banshee_seq_r(%X)\n", device->machine().describe_context(), v->banshee.vga[0x3c4 & 0x1f]); break; /* Feature control */ @@ -4070,14 +4070,14 @@ static READ8_DEVICE_HANDLER( banshee_vga_r ) result = v->banshee.vga[0x3da & 0x1f]; v->banshee.attff = 0; if (LOG_REGISTERS) - logerror("%s:banshee_vga_r(%X)\n", device->machine->describe_context(), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", device->machine().describe_context(), 0x300+offset); break; /* Miscellaneous output */ case 0x3cc: result = v->banshee.vga[0x3c2 & 0x1f]; if (LOG_REGISTERS) - logerror("%s:banshee_vga_r(%X)\n", device->machine->describe_context(), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", device->machine().describe_context(), 0x300+offset); break; /* Graphics controller access */ @@ -4085,7 +4085,7 @@ static READ8_DEVICE_HANDLER( banshee_vga_r ) if (v->banshee.vga[0x3ce & 0x1f] < ARRAY_LENGTH(v->banshee.gc)) result = v->banshee.gc[v->banshee.vga[0x3ce & 0x1f]]; if (LOG_REGISTERS) - logerror("%s:banshee_gc_r(%X)\n", device->machine->describe_context(), v->banshee.vga[0x3ce & 0x1f]); + logerror("%s:banshee_gc_r(%X)\n", device->machine().describe_context(), v->banshee.vga[0x3ce & 0x1f]); break; /* CRTC access */ @@ -4093,7 +4093,7 @@ static READ8_DEVICE_HANDLER( banshee_vga_r ) if (v->banshee.vga[0x3d4 & 0x1f] < ARRAY_LENGTH(v->banshee.crtc)) result = v->banshee.crtc[v->banshee.vga[0x3d4 & 0x1f]]; if (LOG_REGISTERS) - logerror("%s:banshee_crtc_r(%X)\n", device->machine->describe_context(), v->banshee.vga[0x3d4 & 0x1f]); + logerror("%s:banshee_crtc_r(%X)\n", device->machine().describe_context(), v->banshee.vga[0x3d4 & 0x1f]); break; /* Input status 1 */ @@ -4109,13 +4109,13 @@ static READ8_DEVICE_HANDLER( banshee_vga_r ) */ result = 0x04; if (LOG_REGISTERS) - logerror("%s:banshee_vga_r(%X)\n", device->machine->describe_context(), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", device->machine().describe_context(), 0x300+offset); break; default: result = v->banshee.vga[offset]; if (LOG_REGISTERS) - logerror("%s:banshee_vga_r(%X)\n", device->machine->describe_context(), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", device->machine().describe_context(), 0x300+offset); break; } return result; @@ -4139,7 +4139,7 @@ READ32_DEVICE_HANDLER( banshee_io_r ) case io_dacData: result = v->fbi.clut[v->banshee.io[io_dacAddr] & 0x1ff] = v->banshee.io[offset]; if (LOG_REGISTERS) - logerror("%s:banshee_dac_r(%X)\n", device->machine->describe_context(), v->banshee.io[io_dacAddr] & 0x1ff); + logerror("%s:banshee_dac_r(%X)\n", device->machine().describe_context(), v->banshee.io[io_dacAddr] & 0x1ff); break; case io_vgab0: case io_vgab4: case io_vgab8: case io_vgabc: @@ -4159,7 +4159,7 @@ READ32_DEVICE_HANDLER( banshee_io_r ) default: result = v->banshee.io[offset]; if (LOG_REGISTERS) - logerror("%s:banshee_io_r(%s)\n", device->machine->describe_context(), banshee_io_reg_name[offset]); + logerror("%s:banshee_io_r(%s)\n", device->machine().describe_context(), banshee_io_reg_name[offset]); break; } @@ -4169,7 +4169,7 @@ READ32_DEVICE_HANDLER( banshee_io_r ) READ32_DEVICE_HANDLER( banshee_rom_r ) { - logerror("%s:banshee_rom_r(%X)\n", device->machine->describe_context(), offset*4); + logerror("%s:banshee_rom_r(%X)\n", device->machine().describe_context(), offset*4); return 0xffffffff; } @@ -4263,7 +4263,7 @@ static WRITE32_DEVICE_HANDLER( banshee_agp_w ) } if (LOG_REGISTERS) - logerror("%s:banshee_w(AGP:%s) = %08X & %08X\n", device->machine->describe_context(), banshee_agp_reg_name[offset], data, mem_mask); + logerror("%s:banshee_w(AGP:%s) = %08X & %08X\n", device->machine().describe_context(), banshee_agp_reg_name[offset], data, mem_mask); } @@ -4273,22 +4273,22 @@ WRITE32_DEVICE_HANDLER( banshee_w ) /* if we have something pending, flush the FIFOs up to the current time */ if (v->pci.op_pending) - flush_fifos(v, device->machine->time()); + flush_fifos(v, device->machine().time()); if (offset < 0x80000/4) banshee_io_w(device, offset, data, mem_mask); else if (offset < 0x100000/4) banshee_agp_w(device, offset, data, mem_mask); else if (offset < 0x200000/4) - logerror("%s:banshee_w(2D:%X) = %08X & %08X\n", device->machine->describe_context(), (offset*4) & 0xfffff, data, mem_mask); + logerror("%s:banshee_w(2D:%X) = %08X & %08X\n", device->machine().describe_context(), (offset*4) & 0xfffff, data, mem_mask); else if (offset < 0x600000/4) register_w(v, offset & 0x1fffff/4, data); else if (offset < 0x800000/4) - logerror("%s:banshee_w(TEX:%X) = %08X & %08X\n", device->machine->describe_context(), (offset*4) & 0x1fffff, data, mem_mask); + logerror("%s:banshee_w(TEX:%X) = %08X & %08X\n", device->machine().describe_context(), (offset*4) & 0x1fffff, data, mem_mask); else if (offset < 0xc00000/4) - logerror("%s:banshee_w(RES:%X) = %08X & %08X\n", device->machine->describe_context(), (offset*4) & 0x3fffff, data, mem_mask); + logerror("%s:banshee_w(RES:%X) = %08X & %08X\n", device->machine().describe_context(), (offset*4) & 0x3fffff, data, mem_mask); else if (offset < 0x1000000/4) - logerror("%s:banshee_w(YUV:%X) = %08X & %08X\n", device->machine->describe_context(), (offset*4) & 0x3fffff, data, mem_mask); + logerror("%s:banshee_w(YUV:%X) = %08X & %08X\n", device->machine().describe_context(), (offset*4) & 0x3fffff, data, mem_mask); else if (offset < 0x2000000/4) { UINT8 temp = v->fbi.lfb_stride; @@ -4306,7 +4306,7 @@ WRITE32_DEVICE_HANDLER( banshee_fb_w ) /* if we have something pending, flush the FIFOs up to the current time */ if (v->pci.op_pending) - flush_fifos(v, device->machine->time()); + flush_fifos(v, device->machine().time()); if (offset < v->fbi.lfb_base) { @@ -4318,7 +4318,7 @@ WRITE32_DEVICE_HANDLER( banshee_fb_w ) { if (offset*4 <= v->fbi.mask) COMBINE_DATA(&((UINT32 *)v->fbi.ram)[offset]); - logerror("%s:banshee_fb_w(%X) = %08X & %08X\n", device->machine->describe_context(), offset*4, data, mem_mask); + logerror("%s:banshee_fb_w(%X) = %08X & %08X\n", device->machine().describe_context(), offset*4, data, mem_mask); } } else @@ -4341,14 +4341,14 @@ static WRITE8_DEVICE_HANDLER( banshee_vga_w ) { v->banshee.vga[0x3c1 & 0x1f] = data; if (LOG_REGISTERS) - logerror("%s:banshee_vga_w(%X) = %02X\n", device->machine->describe_context(), 0x3c0+offset, data); + logerror("%s:banshee_vga_w(%X) = %02X\n", device->machine().describe_context(), 0x3c0+offset, data); } else { if (v->banshee.vga[0x3c1 & 0x1f] < ARRAY_LENGTH(v->banshee.att)) v->banshee.att[v->banshee.vga[0x3c1 & 0x1f]] = data; if (LOG_REGISTERS) - logerror("%s:banshee_att_w(%X) = %02X\n", device->machine->describe_context(), v->banshee.vga[0x3c1 & 0x1f], data); + logerror("%s:banshee_att_w(%X) = %02X\n", device->machine().describe_context(), v->banshee.vga[0x3c1 & 0x1f], data); } v->banshee.attff ^= 1; break; @@ -4358,7 +4358,7 @@ static WRITE8_DEVICE_HANDLER( banshee_vga_w ) if (v->banshee.vga[0x3c4 & 0x1f] < ARRAY_LENGTH(v->banshee.seq)) v->banshee.seq[v->banshee.vga[0x3c4 & 0x1f]] = data; if (LOG_REGISTERS) - logerror("%s:banshee_seq_w(%X) = %02X\n", device->machine->describe_context(), v->banshee.vga[0x3c4 & 0x1f], data); + logerror("%s:banshee_seq_w(%X) = %02X\n", device->machine().describe_context(), v->banshee.vga[0x3c4 & 0x1f], data); break; /* Graphics controller access */ @@ -4366,7 +4366,7 @@ static WRITE8_DEVICE_HANDLER( banshee_vga_w ) if (v->banshee.vga[0x3ce & 0x1f] < ARRAY_LENGTH(v->banshee.gc)) v->banshee.gc[v->banshee.vga[0x3ce & 0x1f]] = data; if (LOG_REGISTERS) - logerror("%s:banshee_gc_w(%X) = %02X\n", device->machine->describe_context(), v->banshee.vga[0x3ce & 0x1f], data); + logerror("%s:banshee_gc_w(%X) = %02X\n", device->machine().describe_context(), v->banshee.vga[0x3ce & 0x1f], data); break; /* CRTC access */ @@ -4374,13 +4374,13 @@ static WRITE8_DEVICE_HANDLER( banshee_vga_w ) if (v->banshee.vga[0x3d4 & 0x1f] < ARRAY_LENGTH(v->banshee.crtc)) v->banshee.crtc[v->banshee.vga[0x3d4 & 0x1f]] = data; if (LOG_REGISTERS) - logerror("%s:banshee_crtc_w(%X) = %02X\n", device->machine->describe_context(), v->banshee.vga[0x3d4 & 0x1f], data); + logerror("%s:banshee_crtc_w(%X) = %02X\n", device->machine().describe_context(), v->banshee.vga[0x3d4 & 0x1f], data); break; default: v->banshee.vga[offset] = data; if (LOG_REGISTERS) - logerror("%s:banshee_vga_w(%X) = %02X\n", device->machine->describe_context(), 0x3c0+offset, data); + logerror("%s:banshee_vga_w(%X) = %02X\n", device->machine().describe_context(), 0x3c0+offset, data); break; } } @@ -4402,7 +4402,7 @@ WRITE32_DEVICE_HANDLER( banshee_io_w ) if ((v->banshee.io[offset] ^ old) & 0x2800) v->fbi.clut_dirty = TRUE; if (LOG_REGISTERS) - logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine->describe_context(), banshee_io_reg_name[offset], data, mem_mask); + logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine().describe_context(), banshee_io_reg_name[offset], data, mem_mask); break; case io_dacData: @@ -4413,14 +4413,14 @@ WRITE32_DEVICE_HANDLER( banshee_io_w ) v->fbi.clut_dirty = TRUE; } if (LOG_REGISTERS) - logerror("%s:banshee_dac_w(%X) = %08X & %08X\n", device->machine->describe_context(), v->banshee.io[io_dacAddr] & 0x1ff, data, mem_mask); + logerror("%s:banshee_dac_w(%X) = %08X & %08X\n", device->machine().describe_context(), v->banshee.io[io_dacAddr] & 0x1ff, data, mem_mask); break; case io_miscInit0: COMBINE_DATA(&v->banshee.io[offset]); v->fbi.yorigin = (data >> 18) & 0xfff; if (LOG_REGISTERS) - logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine->describe_context(), banshee_io_reg_name[offset], data, mem_mask); + logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine().describe_context(), banshee_io_reg_name[offset], data, mem_mask); break; case io_vidScreenSize: @@ -4434,14 +4434,14 @@ WRITE32_DEVICE_HANDLER( banshee_io_w ) v->screen->set_visible_area(0, v->fbi.width - 1, 0, v->fbi.height - 1); adjust_vblank_timer(v); if (LOG_REGISTERS) - logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine->describe_context(), banshee_io_reg_name[offset], data, mem_mask); + logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine().describe_context(), banshee_io_reg_name[offset], data, mem_mask); break; case io_lfbMemoryConfig: v->fbi.lfb_base = (data & 0x1fff) << 10; v->fbi.lfb_stride = ((data >> 13) & 7) + 9; if (LOG_REGISTERS) - logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine->describe_context(), banshee_io_reg_name[offset], data, mem_mask); + logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine().describe_context(), banshee_io_reg_name[offset], data, mem_mask); break; case io_vgab0: case io_vgab4: case io_vgab8: case io_vgabc: @@ -4460,7 +4460,7 @@ WRITE32_DEVICE_HANDLER( banshee_io_w ) default: COMBINE_DATA(&v->banshee.io[offset]); if (LOG_REGISTERS) - logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine->describe_context(), banshee_io_reg_name[offset], data, mem_mask); + logerror("%s:banshee_io_w(%s) = %08X & %08X\n", device->machine().describe_context(), banshee_io_reg_name[offset], data, mem_mask); break; } } @@ -4487,7 +4487,6 @@ static DEVICE_START( voodoo ) /* validate some basic stuff */ assert(device->baseconfig().static_config() == NULL); assert(downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config() != NULL); - assert(device->machine != NULL); /* validate configuration */ assert(config->screen != NULL); @@ -4505,8 +4504,8 @@ static DEVICE_START( voodoo ) v->pci.stall_callback = config->stall; /* create a multiprocessor work queue */ - v->poly = poly_alloc(device->machine, 64, sizeof(poly_extra_data), 0); - v->thread_stats = auto_alloc_array(device->machine, stats_block, WORK_MAX_THREADS); + v->poly = poly_alloc(device->machine(), 64, sizeof(poly_extra_data), 0); + v->thread_stats = auto_alloc_array(device->machine(), stats_block, WORK_MAX_THREADS); /* create a table of precomputed 1/n and log2(n) values */ /* n ranges from 1.0000 to 2.0000 */ @@ -4574,10 +4573,10 @@ static DEVICE_START( voodoo ) } /* set the type, and initialize the chip mask */ - v->index = device->machine->m_devicelist.indexof(device->type(), device->tag()); - v->screen = downcast<screen_device *>(device->machine->device(config->screen)); + v->index = device->machine().m_devicelist.indexof(device->type(), device->tag()); + v->screen = downcast<screen_device *>(device->machine().device(config->screen)); assert_always(v->screen != NULL, "Unable to find screen attached to voodoo"); - v->cpu = device->machine->device(config->cputag); + v->cpu = device->machine().device(config->cputag); assert_always(v->cpu != NULL, "Unable to find CPU attached to voodoo"); v->type = config->type; v->chipmask = 0x01; @@ -4593,21 +4592,21 @@ static DEVICE_START( voodoo ) v->pci.fifo.size = 64*2; v->pci.fifo.in = v->pci.fifo.out = 0; v->pci.stall_state = NOT_STALLED; - v->pci.continue_timer = v->device->machine->scheduler().timer_alloc(FUNC(stall_cpu_callback), v); + v->pci.continue_timer = v->device->machine().scheduler().timer_alloc(FUNC(stall_cpu_callback), v); /* allocate memory */ tmumem0 = config->tmumem0; if (config->type <= VOODOO_2) { /* separate FB/TMU memory */ - fbmem = auto_alloc_array(device->machine, UINT8, config->fbmem << 20); - tmumem[0] = auto_alloc_array(device->machine, UINT8, config->tmumem0 << 20); - tmumem[1] = (config->tmumem1 != 0) ? auto_alloc_array(device->machine, UINT8, config->tmumem1 << 20) : NULL; + fbmem = auto_alloc_array(device->machine(), UINT8, config->fbmem << 20); + tmumem[0] = auto_alloc_array(device->machine(), UINT8, config->tmumem0 << 20); + tmumem[1] = (config->tmumem1 != 0) ? auto_alloc_array(device->machine(), UINT8, config->tmumem1 << 20) : NULL; } else { /* shared memory */ - tmumem[0] = tmumem[1] = fbmem = auto_alloc_array(device->machine, UINT8, config->fbmem << 20); + tmumem[0] = tmumem[1] = fbmem = auto_alloc_array(device->machine(), UINT8, config->fbmem << 20); tmumem0 = config->fbmem; } diff --git a/src/emu/watchdog.c b/src/emu/watchdog.c index 130e2815378..564aebec2d3 100644 --- a/src/emu/watchdog.c +++ b/src/emu/watchdog.c @@ -36,16 +36,16 @@ static TIMER_CALLBACK( watchdog_callback ); watchdog_init - one time initialization -------------------------------------------------*/ -void watchdog_init(running_machine *machine) +void watchdog_init(running_machine &machine) { /* allocate a timer for the watchdog */ - watchdog_timer = machine->scheduler().timer_alloc(FUNC(watchdog_callback)); + watchdog_timer = machine.scheduler().timer_alloc(FUNC(watchdog_callback)); - machine->add_notifier(MACHINE_NOTIFY_RESET, watchdog_internal_reset); + machine.add_notifier(MACHINE_NOTIFY_RESET, watchdog_internal_reset); /* save some stuff in the default tag */ - machine->state().save_item(NAME(watchdog_enabled)); - machine->state().save_item(NAME(watchdog_counter)); + machine.state().save_item(NAME(watchdog_enabled)); + machine.state().save_item(NAME(watchdog_counter)); } @@ -58,7 +58,7 @@ static void watchdog_internal_reset(running_machine &machine) { /* set up the watchdog timer; only start off enabled if explicitly configured */ watchdog_enabled = (machine.config().m_watchdog_vblank_count != 0 || machine.config().m_watchdog_time != attotime::zero); - watchdog_reset(&machine); + watchdog_reset(machine); watchdog_enabled = TRUE; } @@ -75,7 +75,7 @@ static TIMER_CALLBACK( watchdog_callback ) popmessage("Reset caused by the watchdog!!!\n"); #endif - machine->schedule_soft_reset(); + machine.schedule_soft_reset(); } @@ -90,12 +90,12 @@ 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; if (watchdog_counter == 0) - watchdog_callback(screen.machine, NULL, 0); + watchdog_callback(screen.machine(), NULL, 0); } } } @@ -105,25 +105,25 @@ static void on_vblank(screen_device &screen, void *param, bool vblank_state) watchdog_reset - reset the watchdog timer -------------------------------------------------*/ -void watchdog_reset(running_machine *machine) +void watchdog_reset(running_machine &machine) { /* if we're not enabled, skip it */ if (!watchdog_enabled) 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) - machine->primary_screen->register_vblank_callback(on_vblank, NULL); + if (machine.primary_screen != NULL) + machine.primary_screen->register_vblank_callback(on_vblank, NULL); } /* 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 @@ -135,7 +135,7 @@ void watchdog_reset(running_machine *machine) watchdog_enable - reset the watchdog timer -------------------------------------------------*/ -void watchdog_enable(running_machine *machine, int enable) +void watchdog_enable(running_machine &machine, int enable) { /* when re-enabled, we reset our state */ if (watchdog_enabled != enable) diff --git a/src/emu/watchdog.h b/src/emu/watchdog.h index acebfb96818..3787a729164 100644 --- a/src/emu/watchdog.h +++ b/src/emu/watchdog.h @@ -20,13 +20,13 @@ /* startup */ -void watchdog_init(running_machine *machine); +void watchdog_init(running_machine &machine); /* reset the watchdog */ -void watchdog_reset(running_machine *machine); +void watchdog_reset(running_machine &machine); /* enable/disable the watchdog */ -void watchdog_enable(running_machine *machine, int enable); +void watchdog_enable(running_machine &machine, int enable); #endif /* __WATCHDOG_H__ */ |