mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
Split mame.c into mame.c and machine.c, the latter containing the
running_machine definition and implementation. Moved global machine-level operations and accessors into methods on the running_machine class. For the most part, this doesn't affect drivers except for a few occasional bits: mame_get_phase() == machine->phase() add_reset_callback() == machine->add_notifier(MACHINE_NOTIFY_RESET, ...) add_exit_callback() == machine->add_notifier(MACHINE_NOTIFY_EXIT, ...) mame_get_base_datetime() == machine->base_datetime() mame_get_current_datetime() == machine->current_datetime() Cleaned up the region_info class, removing most global region accessors except for memory_region() and memory_region_length(). Again, this doesn't generally affect drivers.
This commit is contained in:
parent
2c549dad23
commit
733b797a3d
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -643,6 +643,8 @@ src/emu/layout/snap.lay svneol=native#text/plain
|
||||
src/emu/layout/triphsxs.lay svneol=native#text/plain
|
||||
src/emu/layout/vertical.lay svneol=native#text/plain
|
||||
src/emu/layout/voffff20.lay svneol=native#text/plain
|
||||
src/emu/machine.c svneol=native#text/plain
|
||||
src/emu/machine.h svneol=native#text/plain
|
||||
src/emu/machine/53c810.c svneol=native#text/plain
|
||||
src/emu/machine/53c810.h svneol=native#text/plain
|
||||
src/emu/machine/6522via.c svneol=native#text/plain
|
||||
|
@ -163,6 +163,6 @@ WRITE8_HANDLER( soundlatch4_clear_w ) { latch_clear(space, 3); }
|
||||
void soundlatch_setclearedvalue(running_machine *machine, int value)
|
||||
{
|
||||
generic_audio_private *state = machine->generic_audio_data;
|
||||
assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!");
|
||||
assert_always(machine->phase() == MACHINE_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!");
|
||||
state->latch_clear_value = value;
|
||||
}
|
||||
|
@ -215,8 +215,8 @@ struct _cheat_private
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void cheat_exit(running_machine *machine);
|
||||
static void cheat_frame(running_machine *machine);
|
||||
static void cheat_exit(running_machine &machine);
|
||||
static void cheat_frame(running_machine &machine);
|
||||
static void cheat_execute_script(cheat_private *cheatinfo, cheat_entry *cheat, script_state state);
|
||||
|
||||
static cheat_entry *cheat_list_load(running_machine *machine, const char *filename);
|
||||
@ -377,8 +377,8 @@ void cheat_init(running_machine *machine)
|
||||
cheat_private *cheatinfo;
|
||||
|
||||
/* request a callback */
|
||||
add_frame_callback(machine, cheat_frame);
|
||||
add_exit_callback(machine, cheat_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_FRAME, cheat_frame);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, cheat_exit);
|
||||
|
||||
/* allocate memory */
|
||||
cheatinfo = auto_alloc_clear(machine, cheat_private);
|
||||
@ -404,7 +404,7 @@ void cheat_reload(running_machine *machine)
|
||||
cheat_private *cheatinfo = machine->cheat_data;
|
||||
|
||||
/* free everything */
|
||||
cheat_exit(machine);
|
||||
cheat_exit(*machine);
|
||||
|
||||
/* reset our memory */
|
||||
auto_free(machine, cheatinfo);
|
||||
@ -420,7 +420,7 @@ void cheat_reload(running_machine *machine)
|
||||
cheatinfo->cheatlist = cheat_list_load(machine, mess_cheat_filename);
|
||||
}
|
||||
#else
|
||||
cheatinfo->cheatlist = cheat_list_load(machine, machine->basename);
|
||||
cheatinfo->cheatlist = cheat_list_load(machine, machine->basename());
|
||||
#endif
|
||||
|
||||
/* temporary: save the file back out as output.xml for comparison */
|
||||
@ -433,13 +433,13 @@ void cheat_reload(running_machine *machine)
|
||||
cheat_exit - clean up on the way out
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void cheat_exit(running_machine *machine)
|
||||
static void cheat_exit(running_machine &machine)
|
||||
{
|
||||
cheat_private *cheatinfo = machine->cheat_data;
|
||||
cheat_private *cheatinfo = machine.cheat_data;
|
||||
|
||||
/* free the list of cheats */
|
||||
if (cheatinfo->cheatlist != NULL)
|
||||
cheat_list_free(machine, cheatinfo->cheatlist);
|
||||
cheat_list_free(&machine, cheatinfo->cheatlist);
|
||||
}
|
||||
|
||||
|
||||
@ -892,9 +892,9 @@ astring &cheat_get_comment(void *entry)
|
||||
cheat_frame - per-frame callback
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void cheat_frame(running_machine *machine)
|
||||
static void cheat_frame(running_machine &machine)
|
||||
{
|
||||
cheat_private *cheatinfo = machine->cheat_data;
|
||||
cheat_private *cheatinfo = machine.cheat_data;
|
||||
cheat_entry *cheat;
|
||||
int linenum;
|
||||
|
||||
|
@ -102,7 +102,7 @@ void config_register(running_machine *machine, const char *nodename, config_call
|
||||
|
||||
int config_load_settings(running_machine *machine)
|
||||
{
|
||||
const char *controller = options_get_string(mame_options(), OPTION_CTRLR);
|
||||
const char *controller = options_get_string(machine->options(), OPTION_CTRLR);
|
||||
file_error filerr;
|
||||
config_type *type;
|
||||
mame_file *file;
|
||||
@ -137,7 +137,7 @@ int config_load_settings(running_machine *machine)
|
||||
}
|
||||
|
||||
/* finally, load the game-specific file */
|
||||
astring fname(machine->basename, ".cfg");
|
||||
astring fname(machine->basename(), ".cfg");
|
||||
filerr = mame_fopen(SEARCHPATH_CONFIG, fname, OPEN_FLAG_READ, &file);
|
||||
|
||||
if (filerr == FILERR_NONE)
|
||||
@ -175,7 +175,7 @@ void config_save_settings(running_machine *machine)
|
||||
}
|
||||
|
||||
/* finally, save the game-specific file */
|
||||
astring fname(machine->basename, ".cfg");
|
||||
astring fname(machine->basename(), ".cfg");
|
||||
filerr = mame_fopen(SEARCHPATH_CONFIG, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
|
||||
|
||||
if (filerr == FILERR_NONE)
|
||||
|
@ -131,7 +131,7 @@ static const rgb_t crosshair_colors[] =
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void crosshair_exit(running_machine *machine);
|
||||
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);
|
||||
|
||||
@ -212,7 +212,7 @@ void crosshair_init(running_machine *machine)
|
||||
const input_field_config *field;
|
||||
|
||||
/* request a callback upon exiting */
|
||||
add_exit_callback(machine, crosshair_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, crosshair_exit);
|
||||
|
||||
/* clear all the globals */
|
||||
memset(&global, 0, sizeof(global));
|
||||
@ -221,7 +221,7 @@ void crosshair_init(running_machine *machine)
|
||||
global.auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT;
|
||||
|
||||
/* determine who needs crosshairs */
|
||||
for (port = machine->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)
|
||||
{
|
||||
@ -256,7 +256,7 @@ void crosshair_init(running_machine *machine)
|
||||
the crosshairs
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void crosshair_exit(running_machine *machine)
|
||||
static void crosshair_exit(running_machine &machine)
|
||||
{
|
||||
int player;
|
||||
|
||||
|
@ -91,7 +91,7 @@ static cheat_system cheat;
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void debug_command_exit(running_machine *machine);
|
||||
static void debug_command_exit(running_machine &machine);
|
||||
|
||||
static UINT64 execute_min(void *globalref, void *ref, UINT32 params, const UINT64 *param);
|
||||
static UINT64 execute_max(void *globalref, void *ref, UINT32 params, const UINT64 *param);
|
||||
@ -368,10 +368,10 @@ void debug_command_init(running_machine *machine)
|
||||
/* ask all the devices if they would like to register functions or symbols */
|
||||
machine->m_devicelist.debug_setup_all();
|
||||
|
||||
add_exit_callback(machine, debug_command_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, debug_command_exit);
|
||||
|
||||
/* set up the initial debugscript if specified */
|
||||
name = options_get_string(mame_options(), OPTION_DEBUGSCRIPT);
|
||||
name = options_get_string(machine->options(), OPTION_DEBUGSCRIPT);
|
||||
if (name[0] != 0)
|
||||
debug_cpu_source_script(machine, name);
|
||||
}
|
||||
@ -381,16 +381,16 @@ void debug_command_init(running_machine *machine)
|
||||
debug_command_exit - exit-time cleanup
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void debug_command_exit(running_machine *machine)
|
||||
static void debug_command_exit(running_machine &machine)
|
||||
{
|
||||
device_t *cpu;
|
||||
|
||||
/* turn off all traces */
|
||||
for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
|
||||
for (cpu = machine.firstcpu; cpu != NULL; cpu = cpu_next(cpu))
|
||||
debug_cpu_trace(cpu, NULL, 0, NULL);
|
||||
|
||||
if (cheat.length)
|
||||
auto_free(machine, cheat.cheatmap);
|
||||
auto_free(&machine, cheat.cheatmap);
|
||||
}
|
||||
|
||||
|
||||
@ -834,7 +834,7 @@ static void execute_tracelog(running_machine *machine, int ref, int params, cons
|
||||
static void execute_quit(running_machine *machine, int ref, int params, const char *param[])
|
||||
{
|
||||
mame_printf_error("Exited via the debugger\n");
|
||||
mame_schedule_exit(machine);
|
||||
machine->schedule_exit();
|
||||
}
|
||||
|
||||
|
||||
@ -2670,7 +2670,7 @@ static void execute_symlist(running_machine *machine, int ref, int params, const
|
||||
|
||||
static void execute_softreset(running_machine *machine, int ref, int params, const char **param)
|
||||
{
|
||||
mame_schedule_soft_reset(machine);
|
||||
machine->schedule_soft_reset();
|
||||
}
|
||||
|
||||
|
||||
@ -2680,5 +2680,5 @@ static void execute_softreset(running_machine *machine, int ref, int params, con
|
||||
|
||||
static void execute_hardreset(running_machine *machine, int ref, int params, const char **param)
|
||||
{
|
||||
mame_schedule_hard_reset(machine);
|
||||
machine->schedule_hard_reset();
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ struct _debug_cpu_comment_group
|
||||
***************************************************************************/
|
||||
|
||||
static int debug_comment_load_xml(running_machine *machine, mame_file *file);
|
||||
static void debug_comment_exit(running_machine *machine);
|
||||
static void debug_comment_exit(running_machine &machine);
|
||||
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ int debug_comment_init(running_machine *machine)
|
||||
|
||||
/* automatically load em up */
|
||||
debug_comment_load(machine);
|
||||
add_exit_callback(machine, debug_comment_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, debug_comment_exit);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -415,7 +415,7 @@ int debug_comment_save(running_machine *machine)
|
||||
file_error filerr;
|
||||
mame_file *fp;
|
||||
|
||||
astring fname(machine->basename, ".cmt");
|
||||
astring fname(machine->basename(), ".cmt");
|
||||
filerr = mame_fopen(SEARCHPATH_COMMENT, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &fp);
|
||||
|
||||
if (filerr == FILERR_NONE)
|
||||
@ -444,7 +444,7 @@ int debug_comment_load(running_machine *machine)
|
||||
file_error filerr;
|
||||
mame_file *fp;
|
||||
|
||||
astring fname(machine->basename, ".cmt");
|
||||
astring fname(machine->basename(), ".cmt");
|
||||
filerr = mame_fopen(SEARCHPATH_COMMENT, fname, OPEN_FLAG_READ, &fp);
|
||||
|
||||
if (filerr != FILERR_NONE) return 0;
|
||||
@ -524,7 +524,7 @@ error:
|
||||
debug_comment_exit - saves the comments and frees memory
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
static void debug_comment_exit(running_machine *machine)
|
||||
static void debug_comment_exit(running_machine &machine)
|
||||
{
|
||||
debug_comment_save(machine);
|
||||
debug_comment_save(&machine);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ static debug_command *commandlist;
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void debug_console_exit(running_machine *machine);
|
||||
static void debug_console_exit(running_machine &machine);
|
||||
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ void debug_console_init(running_machine *machine)
|
||||
debug_console_printf(machine, "Currently targeting %s (%s)\n", machine->gamedrv->name, machine->gamedrv->description);
|
||||
|
||||
/* request callback upon exiting */
|
||||
add_exit_callback(machine, debug_console_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, debug_console_exit);
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ void debug_console_init(running_machine *machine)
|
||||
system
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void debug_console_exit(running_machine *machine)
|
||||
static void debug_console_exit(running_machine &machine)
|
||||
{
|
||||
/* free allocated memory */
|
||||
if (console_textbuf)
|
||||
@ -409,7 +409,7 @@ void debug_console_register_command(running_machine *machine, const char *comman
|
||||
{
|
||||
debug_command *cmd;
|
||||
|
||||
assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call debug_console_register_command() at init time!");
|
||||
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);
|
||||
@ -541,13 +541,13 @@ text_buffer *debug_console_get_textbuf(void)
|
||||
the errorlog ring buffer
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debug_errorlog_write_line(running_machine *machine, const char *line)
|
||||
void debug_errorlog_write_line(running_machine &machine, const char *line)
|
||||
{
|
||||
if (errorlog_textbuf)
|
||||
text_buffer_print(errorlog_textbuf, line);
|
||||
|
||||
/* force an update of any log views */
|
||||
machine->m_debug_view->update_all(DVT_LOG);
|
||||
machine.m_debug_view->update_all(DVT_LOG);
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,7 +90,7 @@ void CLIB_DECL debug_console_printf_wrap(running_machine *machine, int wrapcol,
|
||||
text_buffer * debug_console_get_textbuf(void);
|
||||
|
||||
/* errorlog management */
|
||||
void debug_errorlog_write_line(running_machine *machine, const char *line);
|
||||
void debug_errorlog_write_line(running_machine &machine, const char *line);
|
||||
text_buffer * debug_errorlog_get_textbuf(void);
|
||||
|
||||
#endif
|
||||
|
@ -83,7 +83,7 @@ struct _debugcpu_private
|
||||
***************************************************************************/
|
||||
|
||||
/* internal helpers */
|
||||
static void debug_cpu_exit(running_machine *machine);
|
||||
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 compute_debug_flags(device_t *device);
|
||||
@ -222,7 +222,7 @@ void debug_cpu_init(running_machine *machine)
|
||||
if (machine->primary_screen != NULL)
|
||||
machine->primary_screen->register_vblank_callback(on_vblank, NULL);
|
||||
|
||||
add_exit_callback(machine, debug_cpu_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, debug_cpu_exit);
|
||||
}
|
||||
|
||||
|
||||
@ -638,7 +638,7 @@ void debug_cpu_instruction_hook(device_t *device, offs_t curpc)
|
||||
process_source_file(device->machine);
|
||||
|
||||
/* if an event got scheduled, resume */
|
||||
if (mame_is_scheduled_event_pending(device->machine))
|
||||
if (device->machine->scheduled_event_pending())
|
||||
global->execution_state = EXECUTION_STATE_RUNNING;
|
||||
}
|
||||
sound_mute(device->machine, FALSE);
|
||||
@ -1157,7 +1157,7 @@ void debug_cpu_source_script(running_machine *machine, const char *file)
|
||||
global->source_file = fopen(file, "r");
|
||||
if (!global->source_file)
|
||||
{
|
||||
if (mame_get_phase(machine) == MAME_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);
|
||||
@ -1868,14 +1868,14 @@ UINT64 debug_read_opcode(const address_space *space, offs_t address, int size, i
|
||||
debug_cpu_exit - free all memory
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void debug_cpu_exit(running_machine *machine)
|
||||
static void debug_cpu_exit(running_machine &machine)
|
||||
{
|
||||
debugcpu_private *global = machine->debugcpu_data;
|
||||
debugcpu_private *global = machine.debugcpu_data;
|
||||
device_t *cpu;
|
||||
int spacenum;
|
||||
|
||||
/* loop over all watchpoints and breakpoints to free their memory */
|
||||
for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
|
||||
for (cpu = machine.firstcpu; cpu != NULL; cpu = cpu_next(cpu))
|
||||
{
|
||||
cpu_debug_data *cpudebug = cpu_get_debug_data(cpu);
|
||||
|
||||
@ -1883,7 +1883,7 @@ static void debug_cpu_exit(running_machine *machine)
|
||||
if (cpudebug->trace.file != NULL)
|
||||
fclose(cpudebug->trace.file);
|
||||
if (cpudebug->trace.action != NULL)
|
||||
auto_free(machine, cpudebug->trace.action);
|
||||
auto_free(&machine, cpudebug->trace.action);
|
||||
|
||||
/* free the symbol table */
|
||||
if (cpudebug->symtable != NULL)
|
||||
@ -1891,14 +1891,14 @@ static void debug_cpu_exit(running_machine *machine)
|
||||
|
||||
/* free all breakpoints */
|
||||
while (cpudebug->bplist != NULL)
|
||||
debug_cpu_breakpoint_clear(machine, cpudebug->bplist->index);
|
||||
debug_cpu_breakpoint_clear(&machine, cpudebug->bplist->index);
|
||||
|
||||
/* loop over all address spaces */
|
||||
for (spacenum = 0; spacenum < ARRAY_LENGTH(cpudebug->wplist); spacenum++)
|
||||
{
|
||||
/* free all watchpoints */
|
||||
while (cpudebug->wplist[spacenum] != NULL)
|
||||
debug_cpu_watchpoint_clear(machine, cpudebug->wplist[spacenum]->index);
|
||||
debug_cpu_watchpoint_clear(&machine, cpudebug->wplist[spacenum]->index);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1951,7 +1951,7 @@ static void compute_debug_flags(device_t *device)
|
||||
machine->debug_flags |= DEBUG_FLAG_ENABLED;
|
||||
|
||||
/* if we are ignoring this CPU, or if events are pending, we're done */
|
||||
if ((cpudebug->flags & DEBUG_FLAG_OBSERVING) == 0 || mame_is_scheduled_event_pending(machine) || mame_is_save_or_load_pending(machine))
|
||||
if ((cpudebug->flags & DEBUG_FLAG_OBSERVING) == 0 || machine->scheduled_event_pending() || machine->save_or_load_pending())
|
||||
return;
|
||||
|
||||
/* many of our states require us to be called on each instruction */
|
||||
@ -2525,15 +2525,12 @@ static UINT64 expression_read_program_direct(const address_space *space, int opc
|
||||
|
||||
static UINT64 expression_read_memory_region(running_machine *machine, const char *rgntag, offs_t address, int size)
|
||||
{
|
||||
UINT8 *base = memory_region(machine, rgntag);
|
||||
const region_info *region = machine->region(rgntag);
|
||||
UINT64 result = ~(UINT64)0 >> (64 - 8*size);
|
||||
|
||||
/* make sure we get a valid base before proceeding */
|
||||
if (base != NULL)
|
||||
if (region != NULL)
|
||||
{
|
||||
UINT32 length = memory_region_length(machine, rgntag);
|
||||
UINT32 flags = memory_region_flags(machine, rgntag);
|
||||
|
||||
/* call ourself recursively until we are byte-sized */
|
||||
if (size > 1)
|
||||
{
|
||||
@ -2545,21 +2542,21 @@ static UINT64 expression_read_memory_region(running_machine *machine, const char
|
||||
r1 = expression_read_memory_region(machine, rgntag, address + halfsize, halfsize);
|
||||
|
||||
/* assemble based on the target endianness */
|
||||
if ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE)
|
||||
if (region->endianness() == ENDIANNESS_LITTLE)
|
||||
result = r0 | (r1 << (8 * halfsize));
|
||||
else
|
||||
result = r1 | (r0 << (8 * halfsize));
|
||||
}
|
||||
|
||||
/* only process if we're within range */
|
||||
else if (address < length)
|
||||
else if (address < region->bytes())
|
||||
{
|
||||
/* lowmask specified which address bits are within the databus width */
|
||||
UINT32 lowmask = (1 << ((flags & ROMREGION_WIDTHMASK) >> 8)) - 1;
|
||||
base += address & ~lowmask;
|
||||
UINT32 lowmask = region->width() - 1;
|
||||
UINT8 *base = region->base() + (address & ~lowmask);
|
||||
|
||||
/* if we have a valid base, return the appropriate byte */
|
||||
if ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE)
|
||||
if (region->endianness() == ENDIANNESS_LITTLE)
|
||||
result = base[BYTE8_XOR_LE(address) & lowmask];
|
||||
else
|
||||
result = base[BYTE8_XOR_BE(address) & lowmask];
|
||||
@ -2701,14 +2698,11 @@ static void expression_write_program_direct(const address_space *space, int opco
|
||||
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;
|
||||
UINT8 *base = memory_region(machine, rgntag);
|
||||
const region_info *region = machine->region(rgntag);
|
||||
|
||||
/* make sure we get a valid base before proceeding */
|
||||
if (base != NULL)
|
||||
if (region != NULL)
|
||||
{
|
||||
UINT32 length = memory_region_length(machine, rgntag);
|
||||
UINT32 flags = memory_region_flags(machine, rgntag);
|
||||
|
||||
/* call ourself recursively until we are byte-sized */
|
||||
if (size > 1)
|
||||
{
|
||||
@ -2717,7 +2711,7 @@ static void expression_write_memory_region(running_machine *machine, const char
|
||||
|
||||
/* break apart based on the target endianness */
|
||||
halfmask = ~(UINT64)0 >> (64 - 8 * halfsize);
|
||||
if ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE)
|
||||
if (region->endianness() == ENDIANNESS_LITTLE)
|
||||
{
|
||||
r0 = data & halfmask;
|
||||
r1 = (data >> (8 * halfsize)) & halfmask;
|
||||
@ -2734,14 +2728,14 @@ static void expression_write_memory_region(running_machine *machine, const char
|
||||
}
|
||||
|
||||
/* only process if we're within range */
|
||||
else if (address < length)
|
||||
else if (address < region->bytes())
|
||||
{
|
||||
/* lowmask specified which address bits are within the databus width */
|
||||
UINT32 lowmask = (1 << ((flags & ROMREGION_WIDTHMASK) >> 8)) - 1;
|
||||
base += address & ~lowmask;
|
||||
UINT32 lowmask = region->width() - 1;
|
||||
UINT8 *base = region->base() + (address & ~lowmask);
|
||||
|
||||
/* if we have a valid base, set the appropriate byte */
|
||||
if ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE)
|
||||
if (region->endianness() == ENDIANNESS_LITTLE)
|
||||
base[BYTE8_XOR_LE(address) & lowmask] = data;
|
||||
else
|
||||
base[BYTE8_XOR_BE(address) & lowmask] = data;
|
||||
|
@ -165,9 +165,9 @@ void debug_view_memory::enumerate_sources()
|
||||
}
|
||||
|
||||
// then add all the memory regions
|
||||
for (const region_info *region = m_machine.regionlist.first(); region != NULL; region = region->next())
|
||||
for (const region_info *region = m_machine.m_regionlist.first(); region != NULL; region = region->next())
|
||||
{
|
||||
name.printf("Region '%s'", region->name.cstr());
|
||||
name.printf("Region '%s'", region->name());
|
||||
m_source_list.append(*auto_alloc(&m_machine, debug_view_memory_source(name, *region)));
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ static int atexit_registered;
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void debugger_exit(running_machine *machine);
|
||||
static void debugger_exit(running_machine &machine);
|
||||
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ void debugger_init(running_machine *machine)
|
||||
debugint_init(machine);
|
||||
|
||||
/* allocate a new entry for our global list */
|
||||
add_exit_callback(machine, debugger_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, debugger_exit);
|
||||
entry = global_alloc(machine_entry);
|
||||
entry->next = machine_list;
|
||||
entry->machine = machine;
|
||||
@ -90,7 +90,7 @@ void debugger_init(running_machine *machine)
|
||||
atexit_registered = TRUE;
|
||||
|
||||
/* listen in on the errorlog */
|
||||
add_logerror_callback(machine, debug_errorlog_write_line);
|
||||
machine->add_logerror_callback(debug_errorlog_write_line);
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,13 +111,13 @@ void debugger_refresh_display(running_machine *machine)
|
||||
global list of active machines for cleanup
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void debugger_exit(running_machine *machine)
|
||||
static void debugger_exit(running_machine &machine)
|
||||
{
|
||||
machine_entry **entryptr;
|
||||
|
||||
/* remove this machine from the list; it came down cleanly */
|
||||
for (entryptr = &machine_list; *entryptr != NULL; entryptr = &(*entryptr)->next)
|
||||
if ((*entryptr)->machine == machine)
|
||||
if ((*entryptr)->machine == &machine)
|
||||
{
|
||||
machine_entry *deleteme = *entryptr;
|
||||
*entryptr = deleteme->next;
|
||||
|
@ -879,7 +879,7 @@ static void dview_update(debug_view &dw, void *osdprivate)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void debugint_exit(running_machine *machine)
|
||||
static void debugint_exit(running_machine &machine)
|
||||
{
|
||||
for (DView *ndv = list; ndv != NULL; )
|
||||
{
|
||||
@ -919,7 +919,7 @@ void debugint_init(running_machine *machine)
|
||||
debug_font_width++;
|
||||
/* FIXME: above does not really work */
|
||||
debug_font_width = 10;
|
||||
add_exit_callback(machine, debugint_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, debugint_exit);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -1070,18 +1070,18 @@ static void on_step_out_activate(DView *dv, const ui_menu_event *event)
|
||||
|
||||
static void on_hard_reset_activate(DView *dv, const ui_menu_event *event)
|
||||
{
|
||||
mame_schedule_hard_reset(dv->machine);
|
||||
dv->machine->schedule_hard_reset();
|
||||
}
|
||||
|
||||
static void on_soft_reset_activate(DView *dv, const ui_menu_event *event)
|
||||
{
|
||||
mame_schedule_soft_reset(dv->machine);
|
||||
dv->machine->schedule_soft_reset();
|
||||
debug_cpu_go(dv->machine, ~0);
|
||||
}
|
||||
|
||||
static void on_exit_activate(DView *dv, const ui_menu_event *event)
|
||||
{
|
||||
mame_schedule_exit(dv->machine);
|
||||
dv->machine->schedule_exit();
|
||||
}
|
||||
|
||||
static void on_view_opcodes_activate(DView *dv, const ui_menu_event *event)
|
||||
@ -1349,7 +1349,7 @@ static void handle_menus(running_machine *machine)
|
||||
const ui_menu_event *event;
|
||||
|
||||
render_container_empty(render_container_get_ui());
|
||||
ui_input_frame_update(machine);
|
||||
ui_input_frame_update(*machine);
|
||||
if (menu != NULL)
|
||||
{
|
||||
/* process the menu */
|
||||
@ -1474,7 +1474,7 @@ void debugint_wait_for_debugger(running_device *device, int firststop)
|
||||
|
||||
void debugint_update_during_game(running_machine *machine)
|
||||
{
|
||||
if (!debug_cpu_is_stopped(machine) && mame_get_phase(machine) == MAME_PHASE_RUNNING)
|
||||
if (!debug_cpu_is_stopped(machine) && machine->phase() == MACHINE_PHASE_RUNNING)
|
||||
{
|
||||
update_views();
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ done:
|
||||
if (m_err) {
|
||||
if (!m_init_phase)
|
||||
{
|
||||
if (mame_get_phase(machine) == MAME_PHASE_RUNNING)
|
||||
if (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());
|
||||
@ -375,12 +375,12 @@ done:
|
||||
else {
|
||||
/* do we need to reset the CPU? only schedule it if load/create is successful */
|
||||
if ((attotime_compare(timer_get_time(device().machine), attotime_zero) > 0) && m_image_config.is_reset_on_load())
|
||||
mame_schedule_hard_reset(device().machine);
|
||||
device().machine->schedule_hard_reset();
|
||||
else
|
||||
{
|
||||
if (!m_init_phase)
|
||||
{
|
||||
if (mame_get_phase(machine) == MAME_PHASE_RUNNING)
|
||||
if (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");
|
||||
|
@ -80,7 +80,7 @@ resource_pool &machine_get_pool(running_machine &machine)
|
||||
{
|
||||
// temporary to get around include dependencies, until CPUs
|
||||
// get a proper device class
|
||||
return machine.respool;
|
||||
return machine.m_respool;
|
||||
}
|
||||
|
||||
|
||||
@ -125,8 +125,8 @@ void device_list::start_all()
|
||||
{
|
||||
// add exit and reset callbacks
|
||||
assert(m_machine != NULL);
|
||||
add_reset_callback(m_machine, static_reset);
|
||||
add_exit_callback(m_machine, static_exit);
|
||||
m_machine->add_notifier(MACHINE_NOTIFY_RESET, static_reset);
|
||||
m_machine->add_notifier(MACHINE_NOTIFY_EXIT, static_exit);
|
||||
|
||||
// add pre-save and post-load callbacks
|
||||
state_save_register_presave(m_machine, static_pre_save, this);
|
||||
@ -185,9 +185,9 @@ void device_list::reset_all()
|
||||
}
|
||||
|
||||
|
||||
void device_list::static_reset(running_machine *machine)
|
||||
void device_list::static_reset(running_machine &machine)
|
||||
{
|
||||
machine->m_devicelist.reset_all();
|
||||
machine.m_devicelist.reset_all();
|
||||
}
|
||||
|
||||
|
||||
@ -195,9 +195,9 @@ void device_list::static_reset(running_machine *machine)
|
||||
// static_exit - tear down all the devices
|
||||
//-------------------------------------------------
|
||||
|
||||
void device_list::static_exit(running_machine *machine)
|
||||
void device_list::static_exit(running_machine &machine)
|
||||
{
|
||||
machine->m_devicelist.reset();
|
||||
machine.m_devicelist.reset();
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,8 +201,8 @@ class device_list : public tagged_device_list<device_t>
|
||||
{
|
||||
running_machine *m_machine;
|
||||
|
||||
static void static_reset(running_machine *machine);
|
||||
static void static_exit(running_machine *machine);
|
||||
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);
|
||||
|
||||
|
@ -303,7 +303,7 @@ device_execute_interface::~device_execute_interface()
|
||||
|
||||
bool device_execute_interface::is_executing() const
|
||||
{
|
||||
return (this == m_machine.scheduler.currently_executing());
|
||||
return (this == m_machine.scheduler().currently_executing());
|
||||
}
|
||||
|
||||
|
||||
@ -361,7 +361,7 @@ void device_execute_interface::adjust_icount(int delta)
|
||||
void device_execute_interface::abort_timeslice()
|
||||
{
|
||||
// ignore if not the executing device
|
||||
if (this != m_machine.scheduler.currently_executing())
|
||||
if (this != m_machine.scheduler().currently_executing())
|
||||
return;
|
||||
|
||||
// swallow the remaining cycles
|
||||
@ -655,7 +655,7 @@ void device_execute_interface::interface_clock_changed()
|
||||
m_divisor = attos;
|
||||
|
||||
// re-compute the perfect interleave factor
|
||||
m_machine.scheduler.compute_perfect_interleave();
|
||||
m_machine.scheduler().compute_perfect_interleave();
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,8 +92,9 @@ 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];
|
||||
UINT32 region_length = (gfxdecode->memory_region != NULL) ? (8 * memory_region_length(machine, gfxdecode->memory_region)) : 0;
|
||||
const UINT8 *region_base = (gfxdecode->memory_region != NULL) ? memory_region(machine, gfxdecode->memory_region) : NULL;
|
||||
const region_info *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;
|
||||
UINT32 yscale = (gfxdecode->yscale == 0) ? 1 : gfxdecode->yscale;
|
||||
UINT32 *extpoffs, extxoffs[MAX_ABS_GFX_SIZE], extyoffs[MAX_ABS_GFX_SIZE];
|
||||
|
@ -107,6 +107,7 @@
|
||||
#include "mess.h"
|
||||
#include "messdrv.h"
|
||||
#endif /* MESS */
|
||||
#include "machine.h"
|
||||
#include "mame.h"
|
||||
|
||||
// video-related
|
||||
|
@ -72,6 +72,7 @@ EMUOBJS = \
|
||||
$(EMUOBJ)/inptport.o \
|
||||
$(EMUOBJ)/ioprocs.o \
|
||||
$(EMUOBJ)/mame.o \
|
||||
$(EMUOBJ)/machine.o \
|
||||
$(EMUOBJ)/mconfig.o \
|
||||
$(EMUOBJ)/memory.o \
|
||||
$(EMUOBJ)/output.o \
|
||||
|
@ -216,10 +216,10 @@ const char *image_get_device_option(device_image_interface *image)
|
||||
{
|
||||
const char *result = NULL;
|
||||
|
||||
if (options_get_bool(mame_options(), OPTION_ADDED_DEVICE_OPTIONS))
|
||||
if (options_get_bool(image->device().machine->options(), OPTION_ADDED_DEVICE_OPTIONS))
|
||||
{
|
||||
/* access the option */
|
||||
result = options_get_string(mame_options(), image->image_config().instance_name());
|
||||
result = options_get_string(image->device().machine->options(), image->image_config().instance_name());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
|
||||
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 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);
|
||||
@ -104,7 +104,7 @@ void palette_init(running_machine *machine)
|
||||
|
||||
/* request cleanup */
|
||||
machine->palette_data = palette;
|
||||
add_exit_callback(machine, palette_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, palette_exit);
|
||||
|
||||
/* reset all our data */
|
||||
palette->format = format;
|
||||
@ -564,11 +564,11 @@ static void palette_postload(running_machine *machine, void *param)
|
||||
palette_exit - free any allocated memory
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void palette_exit(running_machine *machine)
|
||||
static void palette_exit(running_machine &machine)
|
||||
{
|
||||
/* dereference the palette */
|
||||
if (machine->palette != NULL)
|
||||
palette_deref(machine->palette);
|
||||
if (machine.palette != NULL)
|
||||
palette_deref(machine.palette);
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,7 +77,7 @@ struct _mame_path
|
||||
***************************************************************************/
|
||||
|
||||
/* core functions */
|
||||
static void fileio_exit(running_machine *machine);
|
||||
static void fileio_exit(running_machine &machine);
|
||||
|
||||
/* file open/close */
|
||||
static file_error fopen_internal(core_options *opts, path_iterator *iterator, const char *filename, UINT32 crc, UINT32 flags, mame_file **file);
|
||||
@ -106,7 +106,7 @@ static int zip_header_is_path(const zip_file_header *header);
|
||||
|
||||
void fileio_init(running_machine *machine)
|
||||
{
|
||||
add_exit_callback(machine, fileio_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, fileio_exit);
|
||||
}
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ void fileio_init(running_machine *machine)
|
||||
fileio_exit - clean up behind ourselves
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void fileio_exit(running_machine *machine)
|
||||
static void fileio_exit(running_machine &machine)
|
||||
{
|
||||
zip_file_cache_clear();
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ done:
|
||||
static void image_options_extract(running_machine *machine)
|
||||
{
|
||||
/* only extract the device options if we've added them */
|
||||
if (options_get_bool(mame_options(), OPTION_ADDED_DEVICE_OPTIONS)) {
|
||||
if (options_get_bool(machine->options(), OPTION_ADDED_DEVICE_OPTIONS)) {
|
||||
int index = 0;
|
||||
device_image_interface *image = NULL;
|
||||
|
||||
@ -168,14 +168,14 @@ static void image_options_extract(running_machine *machine)
|
||||
const char *filename = image->filename();
|
||||
|
||||
/* and set the option */
|
||||
options_set_string(mame_options(), image->image_config().instance_name() , filename ? filename : "", OPTION_PRIORITY_CMDLINE);
|
||||
options_set_string(machine->options(), image->image_config().instance_name() , filename ? filename : "", OPTION_PRIORITY_CMDLINE);
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
/* write the config, if appropriate */
|
||||
if (options_get_bool(mame_options(), OPTION_WRITECONFIG))
|
||||
if (options_get_bool(machine->options(), OPTION_WRITECONFIG))
|
||||
write_config(NULL, machine->gamedrv);
|
||||
}
|
||||
|
||||
@ -184,14 +184,14 @@ static void image_options_extract(running_machine *machine)
|
||||
extract options
|
||||
-------------------------------------------------*/
|
||||
|
||||
void image_unload_all(running_machine *machine)
|
||||
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))
|
||||
for (bool gotone = machine.m_devicelist.first(image); gotone; gotone = image->next(image))
|
||||
{
|
||||
// unload this image
|
||||
image->unload();
|
||||
@ -229,7 +229,7 @@ void image_device_init(running_machine *machine)
|
||||
const char *image_basename_str = image->basename();
|
||||
|
||||
/* 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(),
|
||||
@ -271,7 +271,7 @@ void image_postdevice_init(running_machine *machine)
|
||||
const char *image_basename_str = image->basename();
|
||||
|
||||
/* 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(),
|
||||
@ -281,7 +281,7 @@ void image_postdevice_init(running_machine *machine)
|
||||
}
|
||||
|
||||
/* add a callback for when we shut down */
|
||||
add_exit_callback(machine, image_unload_all);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, image_unload_all);
|
||||
}
|
||||
/***************************************************************************
|
||||
INITIALIZATION
|
||||
|
@ -766,7 +766,7 @@ static const struct
|
||||
***************************************************************************/
|
||||
|
||||
/* core system management */
|
||||
static void input_port_exit(running_machine *machine);
|
||||
static void input_port_exit(running_machine &machine);
|
||||
|
||||
/* port reading */
|
||||
static INT32 apply_analog_settings(INT32 current, analog_field_state *analog);
|
||||
@ -779,7 +779,7 @@ static device_field_info *init_field_device_info(const input_field_config *field
|
||||
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_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);
|
||||
@ -888,7 +888,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->portlist.first(); curport != NULL; curport = curport->next())
|
||||
for (curport = port->machine->m_portlist.first(); curport != NULL; curport = curport->next())
|
||||
{
|
||||
if (curport == port)
|
||||
break;
|
||||
@ -982,8 +982,8 @@ time_t input_port_init(running_machine *machine, const input_port_token *tokens)
|
||||
//portdata = machine->input_port_data;
|
||||
|
||||
/* add an exit callback and a frame callback */
|
||||
add_exit_callback(machine, input_port_exit);
|
||||
add_frame_callback(machine, 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);
|
||||
@ -991,7 +991,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->portlist, tokens, errorbuf, sizeof(errorbuf), TRUE);
|
||||
input_port_list_init(machine->m_portlist, tokens, errorbuf, sizeof(errorbuf), TRUE);
|
||||
if (errorbuf[0] != 0)
|
||||
mame_printf_error("Input port errors:\n%s", errorbuf);
|
||||
init_port_state(machine);
|
||||
@ -1013,11 +1013,11 @@ time_t input_port_init(running_machine *machine, const input_port_token *tokens)
|
||||
we clean up and close our files
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void input_port_exit(running_machine *machine)
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -1597,7 +1597,7 @@ int input_port_get_crosshair_position(running_machine *machine, int player, floa
|
||||
int gotx = FALSE, goty = FALSE;
|
||||
|
||||
/* read all the lightgun values */
|
||||
for (port = machine->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))
|
||||
@ -1666,7 +1666,7 @@ void input_port_update_defaults(running_machine *machine)
|
||||
const input_port_config *port;
|
||||
|
||||
/* loop over all input ports */
|
||||
for (port = machine->portlist.first(); port != NULL; port = port->next())
|
||||
for (port = machine->m_portlist.first(); port != NULL; port = port->next())
|
||||
{
|
||||
const input_field_config *field;
|
||||
|
||||
@ -2010,13 +2010,13 @@ static astring *get_keyboard_key_name(const input_field_config *field)
|
||||
|
||||
static void init_port_state(running_machine *machine)
|
||||
{
|
||||
const char *joystick_map_default = options_get_string(mame_options(), OPTION_JOYSTICK_MAP);
|
||||
const char *joystick_map_default = options_get_string(machine->options(), OPTION_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->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;
|
||||
@ -2092,18 +2092,18 @@ static void init_port_state(running_machine *machine)
|
||||
}
|
||||
|
||||
/* handle autoselection of devices */
|
||||
init_autoselect_devices(machine->portlist, IPT_PADDLE, IPT_PADDLE_V, 0, OPTION_PADDLE_DEVICE, "paddle");
|
||||
init_autoselect_devices(machine->portlist, IPT_AD_STICK_X, IPT_AD_STICK_Y, IPT_AD_STICK_Z, OPTION_ADSTICK_DEVICE, "analog joystick");
|
||||
init_autoselect_devices(machine->portlist, IPT_LIGHTGUN_X, IPT_LIGHTGUN_Y, 0, OPTION_LIGHTGUN_DEVICE, "lightgun");
|
||||
init_autoselect_devices(machine->portlist, IPT_PEDAL, IPT_PEDAL2, IPT_PEDAL3, OPTION_PEDAL_DEVICE, "pedal");
|
||||
init_autoselect_devices(machine->portlist, IPT_DIAL, IPT_DIAL_V, 0, OPTION_DIAL_DEVICE, "dial");
|
||||
init_autoselect_devices(machine->portlist, IPT_TRACKBALL_X, IPT_TRACKBALL_Y, 0, OPTION_TRACKBALL_DEVICE, "trackball");
|
||||
init_autoselect_devices(machine->portlist, IPT_POSITIONAL, IPT_POSITIONAL_V, 0, OPTION_POSITIONAL_DEVICE, "positional");
|
||||
init_autoselect_devices(machine->portlist, IPT_MOUSE_X, IPT_MOUSE_Y, 0, OPTION_MOUSE_DEVICE, "mouse");
|
||||
init_autoselect_devices(machine->m_portlist, IPT_PADDLE, IPT_PADDLE_V, 0, OPTION_PADDLE_DEVICE, "paddle");
|
||||
init_autoselect_devices(machine->m_portlist, IPT_AD_STICK_X, IPT_AD_STICK_Y, IPT_AD_STICK_Z, OPTION_ADSTICK_DEVICE, "analog joystick");
|
||||
init_autoselect_devices(machine->m_portlist, IPT_LIGHTGUN_X, IPT_LIGHTGUN_Y, 0, OPTION_LIGHTGUN_DEVICE, "lightgun");
|
||||
init_autoselect_devices(machine->m_portlist, IPT_PEDAL, IPT_PEDAL2, IPT_PEDAL3, OPTION_PEDAL_DEVICE, "pedal");
|
||||
init_autoselect_devices(machine->m_portlist, IPT_DIAL, IPT_DIAL_V, 0, OPTION_DIAL_DEVICE, "dial");
|
||||
init_autoselect_devices(machine->m_portlist, IPT_TRACKBALL_X, IPT_TRACKBALL_Y, 0, OPTION_TRACKBALL_DEVICE, "trackball");
|
||||
init_autoselect_devices(machine->m_portlist, IPT_POSITIONAL, IPT_POSITIONAL_V, 0, OPTION_POSITIONAL_DEVICE, "positional");
|
||||
init_autoselect_devices(machine->m_portlist, 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->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)
|
||||
{
|
||||
@ -2379,14 +2379,14 @@ static analog_field_state *init_field_analog_state(const input_field_config *fie
|
||||
only if we are not paused
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void frame_update_callback(running_machine *machine)
|
||||
static void frame_update_callback(running_machine &machine)
|
||||
{
|
||||
/* if we're paused, don't do anything */
|
||||
if (mame_is_paused(machine))
|
||||
if (machine.paused())
|
||||
return;
|
||||
|
||||
/* otherwise, use the common code */
|
||||
frame_update(machine);
|
||||
frame_update(&machine);
|
||||
}
|
||||
|
||||
static key_buffer *get_buffer(running_machine *machine)
|
||||
@ -2491,11 +2491,11 @@ profiler_mark_start(PROFILER_INPUT);
|
||||
const char *tag = NULL;
|
||||
input_port_value mask;
|
||||
if (render_target_map_point_input(mouse_target, mouse_target_x, mouse_target_y, &tag, &mask, NULL, NULL))
|
||||
mouse_field = input_field_by_tag_and_mask(machine->portlist, tag, mask);
|
||||
mouse_field = input_field_by_tag_and_mask(machine->m_portlist, tag, mask);
|
||||
}
|
||||
|
||||
/* loop over all input ports */
|
||||
for (port = machine->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;
|
||||
@ -4068,7 +4068,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->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)
|
||||
|
||||
@ -4230,7 +4230,7 @@ static void save_game_inputs(running_machine *machine, xml_data_node *parentnode
|
||||
const input_port_config *port;
|
||||
|
||||
/* iterate over ports */
|
||||
for (port = machine->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))
|
||||
{
|
||||
@ -4388,7 +4388,7 @@ static UINT64 playback_read_uint64(running_machine *machine)
|
||||
|
||||
static time_t playback_init(running_machine *machine)
|
||||
{
|
||||
const char *filename = options_get_string(mame_options(), OPTION_PLAYBACK);
|
||||
const char *filename = options_get_string(machine->options(), OPTION_PLAYBACK);
|
||||
input_port_private *portdata = machine->input_port_data;
|
||||
UINT8 header[INP_HEADER_SIZE];
|
||||
file_error filerr;
|
||||
@ -4586,10 +4586,10 @@ static void record_write_uint64(running_machine *machine, UINT64 data)
|
||||
|
||||
static void record_init(running_machine *machine)
|
||||
{
|
||||
const char *filename = options_get_string(mame_options(), OPTION_RECORD);
|
||||
const char *filename = options_get_string(machine->options(), OPTION_RECORD);
|
||||
input_port_private *portdata = machine->input_port_data;
|
||||
UINT8 header[INP_HEADER_SIZE];
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
file_error filerr;
|
||||
|
||||
/* if no file, nothing to do */
|
||||
@ -4601,7 +4601,7 @@ static void record_init(running_machine *machine)
|
||||
assert_always(filerr == FILERR_NONE, "Failed to open file for recording");
|
||||
|
||||
/* get the base time */
|
||||
mame_get_base_datetime(machine, &systime);
|
||||
machine->base_datetime(systime);
|
||||
|
||||
/* fill in the header */
|
||||
memset(header, 0, sizeof(header));
|
||||
@ -4708,7 +4708,7 @@ int input_machine_has_keyboard(running_machine *machine)
|
||||
#ifdef MESS
|
||||
const input_field_config *field;
|
||||
const input_port_config *port;
|
||||
for (port = machine->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)
|
||||
{
|
||||
@ -4910,7 +4910,7 @@ int validate_natural_keyboard_statics(void)
|
||||
CORE IMPLEMENTATION
|
||||
***************************************************************************/
|
||||
|
||||
static void clear_keybuffer(running_machine *machine)
|
||||
static void clear_keybuffer(running_machine &machine)
|
||||
{
|
||||
keybuffer = NULL;
|
||||
queue_chars = NULL;
|
||||
@ -4923,7 +4923,7 @@ static void setup_keybuffer(running_machine *machine)
|
||||
{
|
||||
inputx_timer = timer_alloc(machine, inputx_timerproc, NULL);
|
||||
keybuffer = auto_alloc_clear(machine, key_buffer);
|
||||
add_exit_callback(machine, clear_keybuffer);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, clear_keybuffer);
|
||||
}
|
||||
|
||||
|
||||
@ -4946,7 +4946,7 @@ void inputx_init(running_machine *machine)
|
||||
/* posting keys directly only makes sense for a computer */
|
||||
if (input_machine_has_keyboard(machine))
|
||||
{
|
||||
codes = build_codes(machine, machine->portlist.first());
|
||||
codes = build_codes(machine, machine->m_portlist.first());
|
||||
setup_keybuffer(machine);
|
||||
}
|
||||
}
|
||||
@ -5408,7 +5408,7 @@ int input_has_input_class(running_machine *machine, int inputclass)
|
||||
const input_port_config *port;
|
||||
const input_field_config *field;
|
||||
|
||||
for (port = machine->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)
|
||||
{
|
||||
@ -5433,7 +5433,7 @@ int input_count_players(running_machine *machine)
|
||||
int joystick_count;
|
||||
|
||||
joystick_count = 0;
|
||||
for (port = machine->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)
|
||||
{
|
||||
@ -5464,7 +5464,7 @@ int input_category_active(running_machine *machine, int category)
|
||||
assert(category >= 1);
|
||||
|
||||
/* loop through the input ports */
|
||||
for (port = machine->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)
|
||||
{
|
||||
|
@ -420,7 +420,7 @@ const char joystick_map_4way_diagonal[] = "4444s8888..444458888.444555888.ss5.
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void input_frame(running_machine *machine);
|
||||
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 INT32 convert_relative_value(input_code code, input_device_item *item);
|
||||
@ -587,28 +587,28 @@ void input_init(running_machine *machine)
|
||||
code_pressed_memory_reset(machine);
|
||||
|
||||
/* request a per-frame callback for bookkeeping */
|
||||
add_frame_callback(machine, 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 = options_get_bool(mame_options(), OPTION_MOUSE);
|
||||
device_list[DEVICE_CLASS_LIGHTGUN].enabled = options_get_bool(mame_options(), OPTION_LIGHTGUN);
|
||||
device_list[DEVICE_CLASS_JOYSTICK].enabled = options_get_bool(mame_options(), OPTION_JOYSTICK);
|
||||
device_list[DEVICE_CLASS_MOUSE].enabled = options_get_bool(machine->options(), OPTION_MOUSE);
|
||||
device_list[DEVICE_CLASS_LIGHTGUN].enabled = options_get_bool(machine->options(), OPTION_LIGHTGUN);
|
||||
device_list[DEVICE_CLASS_JOYSTICK].enabled = options_get_bool(machine->options(), OPTION_JOYSTICK);
|
||||
|
||||
/* read input device multi options */
|
||||
device_list[DEVICE_CLASS_KEYBOARD].multi = options_get_bool(mame_options(), OPTION_MULTIKEYBOARD);
|
||||
device_list[DEVICE_CLASS_MOUSE].multi = options_get_bool(mame_options(), OPTION_MULTIMOUSE);
|
||||
device_list[DEVICE_CLASS_KEYBOARD].multi = options_get_bool(machine->options(), OPTION_MULTIKEYBOARD);
|
||||
device_list[DEVICE_CLASS_MOUSE].multi = options_get_bool(machine->options(), OPTION_MULTIMOUSE);
|
||||
device_list[DEVICE_CLASS_LIGHTGUN].multi = TRUE;
|
||||
device_list[DEVICE_CLASS_JOYSTICK].multi = TRUE;
|
||||
|
||||
/* read other input options */
|
||||
state->steadykey_enabled = options_get_bool(mame_options(), OPTION_STEADYKEY);
|
||||
state->lightgun_reload_button = options_get_bool(mame_options(), OPTION_OFFSCREEN_RELOAD);
|
||||
state->joystick_deadzone = (INT32)(options_get_float(mame_options(), OPTION_JOYSTICK_DEADZONE) * INPUT_ABSOLUTE_MAX);
|
||||
state->joystick_saturation = (INT32)(options_get_float(mame_options(), OPTION_JOYSTICK_SATURATION) * INPUT_ABSOLUTE_MAX);
|
||||
state->steadykey_enabled = options_get_bool(machine->options(), OPTION_STEADYKEY);
|
||||
state->lightgun_reload_button = options_get_bool(machine->options(), OPTION_OFFSCREEN_RELOAD);
|
||||
state->joystick_deadzone = (INT32)(options_get_float(machine->options(), OPTION_JOYSTICK_DEADZONE) * INPUT_ABSOLUTE_MAX);
|
||||
state->joystick_saturation = (INT32)(options_get_float(machine->options(), OPTION_JOYSTICK_SATURATION) * INPUT_ABSOLUTE_MAX);
|
||||
|
||||
/* get the default joystick map */
|
||||
state->joystick_map_default = options_get_string(mame_options(), OPTION_JOYSTICK_MAP);
|
||||
state->joystick_map_default = options_get_string(machine->options(), OPTION_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))
|
||||
@ -687,9 +687,9 @@ int input_device_set_joystick_map(running_machine *machine, int devindex, const
|
||||
bookkeeping
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void input_frame(running_machine *machine)
|
||||
static void input_frame(running_machine &machine)
|
||||
{
|
||||
input_private *state = machine->input_data;
|
||||
input_private *state = machine.input_data;
|
||||
|
||||
/* if steadykey is enabled, do processing here */
|
||||
if (state->steadykey_enabled)
|
||||
@ -710,7 +710,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;
|
||||
@ -752,7 +752,7 @@ input_device *input_device_add(running_machine *machine, input_device_class devc
|
||||
input_private *state = machine->input_data;
|
||||
input_device_list *devlist = &state->device_list[devclass];
|
||||
|
||||
assert_always(mame_get_phase(machine) == MAME_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);
|
||||
|
||||
@ -794,7 +794,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(mame_get_phase(device->machine) == MAME_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);
|
||||
|
1003
src/emu/machine.c
Normal file
1003
src/emu/machine.c
Normal file
File diff suppressed because it is too large
Load Diff
492
src/emu/machine.h
Normal file
492
src/emu/machine.h
Normal file
@ -0,0 +1,492 @@
|
||||
/***************************************************************************
|
||||
|
||||
machine.h
|
||||
|
||||
Controls execution of the core MAME system.
|
||||
|
||||
****************************************************************************
|
||||
|
||||
Copyright Aaron Giles
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name 'MAME' nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __EMU_H__
|
||||
#error Dont include this file directly; include emu.h instead.
|
||||
#endif
|
||||
|
||||
#ifndef __MACHINE_H__
|
||||
#define __MACHINE_H__
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// CONSTANTS
|
||||
//**************************************************************************
|
||||
|
||||
const int MAX_GFX_ELEMENTS = 32;
|
||||
|
||||
|
||||
// machine phases
|
||||
enum machine_phase
|
||||
{
|
||||
MACHINE_PHASE_PREINIT,
|
||||
MACHINE_PHASE_INIT,
|
||||
MACHINE_PHASE_RESET,
|
||||
MACHINE_PHASE_RUNNING,
|
||||
MACHINE_PHASE_EXIT
|
||||
};
|
||||
|
||||
|
||||
// notification callback types
|
||||
enum machine_notification
|
||||
{
|
||||
MACHINE_NOTIFY_FRAME,
|
||||
MACHINE_NOTIFY_RESET,
|
||||
MACHINE_NOTIFY_PAUSE,
|
||||
MACHINE_NOTIFY_RESUME,
|
||||
MACHINE_NOTIFY_EXIT,
|
||||
MACHINE_NOTIFY_COUNT
|
||||
};
|
||||
|
||||
|
||||
// output channels
|
||||
enum output_channel
|
||||
{
|
||||
OUTPUT_CHANNEL_ERROR,
|
||||
OUTPUT_CHANNEL_WARNING,
|
||||
OUTPUT_CHANNEL_INFO,
|
||||
OUTPUT_CHANNEL_DEBUG,
|
||||
OUTPUT_CHANNEL_VERBOSE,
|
||||
OUTPUT_CHANNEL_LOG,
|
||||
OUTPUT_CHANNEL_COUNT
|
||||
};
|
||||
|
||||
|
||||
// debug flags
|
||||
const int DEBUG_FLAG_ENABLED = 0x00000001; // debugging is enabled
|
||||
const int DEBUG_FLAG_CALL_HOOK = 0x00000002; // CPU cores must call instruction hook
|
||||
const int DEBUG_FLAG_WPR_PROGRAM = 0x00000010; // watchpoints are enabled for PROGRAM memory reads
|
||||
const int DEBUG_FLAG_WPR_DATA = 0x00000020; // watchpoints are enabled for DATA memory reads
|
||||
const int DEBUG_FLAG_WPR_IO = 0x00000040; // watchpoints are enabled for IO memory reads
|
||||
const int DEBUG_FLAG_WPW_PROGRAM = 0x00000100; // watchpoints are enabled for PROGRAM memory writes
|
||||
const int DEBUG_FLAG_WPW_DATA = 0x00000200; // watchpoints are enabled for DATA memory writes
|
||||
const int DEBUG_FLAG_WPW_IO = 0x00000400; // watchpoints are enabled for IO memory writes
|
||||
const int DEBUG_FLAG_OSD_ENABLED = 0x00001000; // The OSD debugger is enabled
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// MACROS
|
||||
//**************************************************************************
|
||||
|
||||
// global allocation helpers
|
||||
#define auto_alloc(m, t) pool_alloc(static_cast<running_machine *>(m)->m_respool, t)
|
||||
#define auto_alloc_clear(m, t) pool_alloc_clear(static_cast<running_machine *>(m)->m_respool, t)
|
||||
#define auto_alloc_array(m, t, c) pool_alloc_array(static_cast<running_machine *>(m)->m_respool, t, c)
|
||||
#define auto_alloc_array_clear(m, t, c) pool_alloc_array_clear(static_cast<running_machine *>(m)->m_respool, t, c)
|
||||
#define auto_free(m, v) pool_free(static_cast<running_machine *>(m)->m_respool, v)
|
||||
|
||||
#define auto_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)
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// forward declarations
|
||||
class gfx_element;
|
||||
class colortable_t;
|
||||
class debug_view_manager;
|
||||
|
||||
typedef struct _mame_private mame_private;
|
||||
typedef struct _cpuexec_private cpuexec_private;
|
||||
typedef struct _timer_private timer_private;
|
||||
typedef struct _state_private state_private;
|
||||
typedef struct _memory_private memory_private;
|
||||
typedef struct _palette_private palette_private;
|
||||
typedef struct _tilemap_private tilemap_private;
|
||||
typedef struct _streams_private streams_private;
|
||||
typedef struct _devices_private devices_private;
|
||||
typedef struct _romload_private romload_private;
|
||||
typedef struct _sound_private sound_private;
|
||||
typedef struct _input_private input_private;
|
||||
typedef struct _input_port_private input_port_private;
|
||||
typedef struct _ui_input_private ui_input_private;
|
||||
typedef struct _cheat_private cheat_private;
|
||||
typedef struct _debugcpu_private debugcpu_private;
|
||||
typedef struct _debugvw_private debugvw_private;
|
||||
typedef struct _generic_machine_private generic_machine_private;
|
||||
typedef struct _generic_video_private generic_video_private;
|
||||
typedef struct _generic_audio_private generic_audio_private;
|
||||
|
||||
|
||||
// template specializations
|
||||
typedef tagged_list<region_info> region_list;
|
||||
|
||||
|
||||
// memory region
|
||||
class region_info
|
||||
{
|
||||
DISABLE_COPYING(region_info);
|
||||
|
||||
friend class running_machine;
|
||||
template<class T> friend class tagged_list;
|
||||
friend resource_pool_object<region_info>::~resource_pool_object();
|
||||
|
||||
// construction/destruction
|
||||
region_info(running_machine &machine, const char *name, UINT32 length, UINT32 flags);
|
||||
~region_info();
|
||||
|
||||
public:
|
||||
// getters
|
||||
region_info *next() const { return m_next; }
|
||||
UINT8 *base() const { return (this != NULL) ? m_base.u8 : NULL; }
|
||||
UINT8 *end() const { return (this != NULL) ? m_base.u8 + m_length : NULL; }
|
||||
UINT32 bytes() const { return (this != NULL) ? m_length : 0; }
|
||||
const char *name() const { return m_name; }
|
||||
UINT32 flags() const { return m_flags; }
|
||||
|
||||
// flag expansion
|
||||
endianness_t endianness() const { return ((m_flags & ROMREGION_ENDIANMASK) == ROMREGION_LE) ? ENDIANNESS_LITTLE : ENDIANNESS_BIG; }
|
||||
UINT8 width() const { return 1 << ((m_flags & ROMREGION_WIDTHMASK) >> 8); }
|
||||
bool invert() const { return ((m_flags & ROMREGION_INVERTMASK) != 0); }
|
||||
|
||||
// data access
|
||||
UINT8 &u8(offs_t offset = 0) const { return m_base.u8[offset]; }
|
||||
UINT16 &u16(offs_t offset = 0) const { return m_base.u16[offset]; }
|
||||
UINT32 &u32(offs_t offset = 0) const { return m_base.u32[offset]; }
|
||||
UINT64 &u64(offs_t offset = 0) const { return m_base.u64[offset]; }
|
||||
|
||||
// allow passing a region for any common pointer
|
||||
operator void *() const { return (this != NULL) ? m_base.v : NULL; }
|
||||
operator INT8 *() const { return (this != NULL) ? m_base.i8 : NULL; }
|
||||
operator UINT8 *() const { return (this != NULL) ? m_base.u8 : NULL; }
|
||||
operator INT16 *() const { return (this != NULL) ? m_base.i16 : NULL; }
|
||||
operator UINT16 *() const { return (this != NULL) ? m_base.u16 : NULL; }
|
||||
operator INT32 *() const { return (this != NULL) ? m_base.i32 : NULL; }
|
||||
operator UINT32 *() const { return (this != NULL) ? m_base.u32 : NULL; }
|
||||
operator INT64 *() const { return (this != NULL) ? m_base.i64 : NULL; }
|
||||
operator UINT64 *() const { return (this != NULL) ? m_base.u64 : NULL; }
|
||||
|
||||
private:
|
||||
// internal data
|
||||
running_machine & m_machine;
|
||||
region_info * m_next;
|
||||
astring m_name;
|
||||
generic_ptr m_base;
|
||||
UINT32 m_length;
|
||||
UINT32 m_flags;
|
||||
};
|
||||
|
||||
|
||||
// this structure holds generic pointers that are commonly used
|
||||
struct generic_pointers
|
||||
{
|
||||
generic_ptr nvram; // generic NVRAM
|
||||
UINT32 nvram_size;
|
||||
generic_ptr videoram; // videoram
|
||||
UINT32 videoram_size;
|
||||
generic_ptr spriteram; // spriteram
|
||||
UINT32 spriteram_size;
|
||||
generic_ptr spriteram2; // secondary spriteram
|
||||
UINT32 spriteram2_size;
|
||||
generic_ptr buffered_spriteram; // buffered spriteram
|
||||
generic_ptr buffered_spriteram2;// secondary buffered spriteram
|
||||
generic_ptr paletteram; // palette RAM
|
||||
generic_ptr paletteram2; // secondary palette RAM
|
||||
bitmap_t * tmpbitmap; // temporary bitmap
|
||||
};
|
||||
|
||||
|
||||
class system_time
|
||||
{
|
||||
public:
|
||||
system_time();
|
||||
void set(time_t t);
|
||||
|
||||
struct full_time
|
||||
{
|
||||
void set(struct tm &t);
|
||||
|
||||
UINT8 second; // seconds (0-59)
|
||||
UINT8 minute; // minutes (0-59)
|
||||
UINT8 hour; // hours (0-23)
|
||||
UINT8 mday; // day of month (1-31)
|
||||
UINT8 month; // month (0-11)
|
||||
INT32 year; // year (1=1 AD)
|
||||
UINT8 weekday; // day of week (0-6)
|
||||
UINT16 day; // day of year (0-365)
|
||||
UINT8 is_dst; // is this daylight savings?
|
||||
};
|
||||
|
||||
INT64 time; // number of seconds elapsed since midnight, January 1 1970 UTC
|
||||
full_time local_time; // local time
|
||||
full_time utc_time; // UTC coordinated time
|
||||
};
|
||||
|
||||
|
||||
// description of the currently-running machine
|
||||
class running_machine
|
||||
{
|
||||
DISABLE_COPYING(running_machine);
|
||||
|
||||
typedef void (*notify_callback)(running_machine &machine);
|
||||
typedef void (*logerror_callback)(running_machine &machine, const char *string);
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
running_machine(const game_driver &driver, const machine_config &config, core_options &options, bool exit_to_game_select = false);
|
||||
~running_machine();
|
||||
|
||||
// fetch items by name
|
||||
inline device_t *device(const char *tag);
|
||||
template<class T> inline T *device(const char *tag) { return downcast<T *>(device(tag)); }
|
||||
inline const input_port_config *port(const char *tag);
|
||||
inline const region_info *region(const char *tag);
|
||||
|
||||
// configuration helpers
|
||||
UINT32 total_colors() const { return m_config.m_total_colors; }
|
||||
|
||||
// getters
|
||||
const char *basename() const { return m_basename; }
|
||||
core_options *options() const { return &m_options; }
|
||||
machine_phase phase() const { return m_current_phase; }
|
||||
bool paused() const { return m_paused || (m_current_phase != MACHINE_PHASE_RUNNING); }
|
||||
bool scheduled_event_pending() const { return m_exit_pending || m_hard_reset_pending; }
|
||||
bool save_or_load_pending() const { return (m_saveload_pending_file.len() != 0); }
|
||||
bool exit_pending() const { return m_exit_pending; }
|
||||
bool new_driver_pending() const { return (m_new_driver_pending != NULL); }
|
||||
const char *new_driver_name() const { return m_new_driver_pending->name; }
|
||||
device_scheduler &scheduler() { return m_scheduler; }
|
||||
|
||||
// immediate operations
|
||||
int run(bool firstrun);
|
||||
void pause();
|
||||
void resume();
|
||||
void add_notifier(machine_notification event, notify_callback callback);
|
||||
void call_notifiers(machine_notification which);
|
||||
void add_logerror_callback(logerror_callback callback);
|
||||
|
||||
// scheduled operations
|
||||
void schedule_exit();
|
||||
void schedule_hard_reset();
|
||||
void schedule_soft_reset();
|
||||
void schedule_new_driver(const game_driver &driver);
|
||||
void schedule_save(const char *filename);
|
||||
void schedule_load(const char *filename);
|
||||
|
||||
// time
|
||||
void base_datetime(system_time &systime);
|
||||
void current_datetime(system_time &systime);
|
||||
|
||||
// regions
|
||||
region_info *region_alloc(const char *name, UINT32 length, UINT32 flags);
|
||||
void region_free(const char *name);
|
||||
|
||||
// misc
|
||||
void CLIB_DECL logerror(const char *format, ...);
|
||||
void CLIB_DECL vlogerror(const char *format, va_list args);
|
||||
UINT32 rand();
|
||||
const char *describe_context();
|
||||
|
||||
// internals
|
||||
resource_pool m_respool; // pool of resources for this machine
|
||||
region_list m_regionlist; // list of memory regions
|
||||
device_list m_devicelist; // list of running devices
|
||||
|
||||
// configuration data
|
||||
const machine_config * config; // points to the constructed machine_config
|
||||
const machine_config & m_config; // points to the constructed machine_config
|
||||
ioport_list m_portlist; // points to a list of input port configurations
|
||||
|
||||
// CPU information
|
||||
device_t * firstcpu; // first CPU (allows for quick iteration via typenext)
|
||||
|
||||
// game-related information
|
||||
const game_driver * gamedrv; // points to the definition of the game machine
|
||||
const game_driver & m_game; // points to the definition of the game machine
|
||||
|
||||
// video-related information
|
||||
gfx_element * gfx[MAX_GFX_ELEMENTS];// array of pointers to graphic sets (chars, sprites)
|
||||
screen_device * primary_screen; // the primary screen device, or NULL if screenless
|
||||
palette_t * palette; // global palette object
|
||||
|
||||
// palette-related information
|
||||
const pen_t * pens; // remapped palette pen numbers
|
||||
colortable_t * colortable; // global colortable for remapping
|
||||
pen_t * shadow_table; // table for looking up a shadowed pen
|
||||
bitmap_t * priority_bitmap; // priority bitmap
|
||||
|
||||
// audio-related information
|
||||
int sample_rate; // the digital audio sample rate
|
||||
|
||||
// debugger-related information
|
||||
UINT32 debug_flags; // the current debug flags
|
||||
|
||||
// UI-related
|
||||
bool ui_active; // ui active or not (useful for games / systems with keyboard inputs)
|
||||
|
||||
// generic pointers
|
||||
generic_pointers generic; // generic pointers
|
||||
|
||||
// internal core information
|
||||
mame_private * mame_data; // internal data from mame.c
|
||||
timer_private * timer_data; // internal data from timer.c
|
||||
state_private * state_data; // internal data from state.c
|
||||
memory_private * memory_data; // internal data from memory.c
|
||||
palette_private * palette_data; // internal data from palette.c
|
||||
tilemap_private * tilemap_data; // internal data from tilemap.c
|
||||
streams_private * streams_data; // internal data from streams.c
|
||||
devices_private * devices_data; // internal data from devices.c
|
||||
romload_private * romload_data; // internal data from romload.c
|
||||
sound_private * sound_data; // internal data from sound.c
|
||||
input_private * input_data; // internal data from input.c
|
||||
input_port_private * input_port_data; // internal data from inptport.c
|
||||
ui_input_private * ui_input_data; // internal data from uiinput.c
|
||||
cheat_private * cheat_data; // internal data from cheat.c
|
||||
debugcpu_private * debugcpu_data; // internal data from debugcpu.c
|
||||
generic_machine_private *generic_machine_data; // internal data from machine/generic.c
|
||||
generic_video_private * generic_video_data; // internal data from video/generic.c
|
||||
generic_audio_private * generic_audio_data; // internal data from audio/generic.c
|
||||
|
||||
debug_view_manager * m_debug_view; // internal data from debugvw.c
|
||||
|
||||
// driver-specific information
|
||||
void * driver_data; // drivers can hang data off of here instead of using globals
|
||||
|
||||
private:
|
||||
void start();
|
||||
void set_saveload_filename(const char *filename);
|
||||
void fill_systime(system_time &systime, time_t t);
|
||||
void handle_saveload();
|
||||
|
||||
static TIMER_CALLBACK( static_soft_reset );
|
||||
void soft_reset();
|
||||
|
||||
static void logfile_callback(running_machine &machine, const char *buffer);
|
||||
|
||||
// notifier callbacks
|
||||
struct notifier_callback_item
|
||||
{
|
||||
notifier_callback_item(notify_callback func);
|
||||
notifier_callback_item * m_next;
|
||||
notify_callback m_func;
|
||||
};
|
||||
notifier_callback_item *m_notifier_list[MACHINE_NOTIFY_COUNT];
|
||||
|
||||
// logerror callbacks
|
||||
struct logerror_callback_item
|
||||
{
|
||||
logerror_callback_item(logerror_callback func);
|
||||
logerror_callback_item * m_next;
|
||||
logerror_callback m_func;
|
||||
};
|
||||
logerror_callback_item *m_logerror_list;
|
||||
|
||||
device_scheduler m_scheduler; // scheduler object
|
||||
core_options & m_options;
|
||||
|
||||
astring m_context; // context string
|
||||
astring m_basename; // basename used for game-related paths
|
||||
|
||||
machine_phase m_current_phase;
|
||||
bool m_paused;
|
||||
bool m_hard_reset_pending;
|
||||
bool m_exit_pending;
|
||||
bool m_exit_to_game_select;
|
||||
const game_driver * m_new_driver_pending;
|
||||
emu_timer * m_soft_reset_timer;
|
||||
mame_file * m_logfile;
|
||||
|
||||
// load/save
|
||||
enum saveload_schedule
|
||||
{
|
||||
SLS_NONE,
|
||||
SLS_SAVE,
|
||||
SLS_LOAD
|
||||
};
|
||||
saveload_schedule m_saveload_schedule;
|
||||
attotime m_saveload_schedule_time;
|
||||
astring m_saveload_pending_file;
|
||||
const char * m_saveload_searchpath;
|
||||
|
||||
// random number seed
|
||||
UINT32 m_rand_seed;
|
||||
|
||||
// base time
|
||||
time_t m_base_time;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INLINE FUNCTIONS
|
||||
//**************************************************************************
|
||||
|
||||
inline device_t *running_machine::device(const char *tag)
|
||||
{
|
||||
return m_devicelist.find(tag);
|
||||
}
|
||||
|
||||
inline const input_port_config *running_machine::port(const char *tag)
|
||||
{
|
||||
return m_portlist.find(tag);
|
||||
}
|
||||
|
||||
inline const region_info *running_machine::region(const char *tag)
|
||||
{
|
||||
return m_regionlist.find(tag);
|
||||
}
|
||||
|
||||
inline UINT32 mame_rand(running_machine *machine)
|
||||
{
|
||||
return machine->rand();
|
||||
}
|
||||
|
||||
inline UINT8 *memory_region(running_machine *machine, const char *name)
|
||||
{
|
||||
const region_info *region = machine->region(name);
|
||||
return (region != NULL) ? region->base() : NULL;
|
||||
}
|
||||
|
||||
inline UINT32 memory_region_length(running_machine *machine, const char *name)
|
||||
{
|
||||
const region_info *region = machine->region(name);
|
||||
return (region != NULL) ? region->bytes() : 0;
|
||||
}
|
||||
|
||||
|
||||
#endif /* __MACHINE_H__ */
|
@ -31,7 +31,7 @@ void TTL74181_config(running_machine *machine, int which, void *intf)
|
||||
{
|
||||
TTL74181_state *c;
|
||||
|
||||
assert_always(mame_get_phase(machine) == MAME_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");
|
||||
|
||||
|
@ -91,8 +91,8 @@ WRITE8_DEVICE_HANDLER( ds1302_clk_w )
|
||||
ds1302->icount++;
|
||||
if(ds1302->icount == 8) //Command start
|
||||
{
|
||||
mame_system_time systime;
|
||||
mame_get_base_datetime(device->machine, &systime);
|
||||
system_time systime;
|
||||
device->machine->base_datetime(systime);
|
||||
|
||||
switch(ds1302->shift_in)
|
||||
{
|
||||
|
@ -251,18 +251,18 @@ void eeprom_device::nvram_default()
|
||||
/* populate from a memory region if present */
|
||||
if (m_region != NULL)
|
||||
{
|
||||
if (m_region->length != eeprom_bytes)
|
||||
if (m_region->bytes() != eeprom_bytes)
|
||||
fatalerror("eeprom region '%s' wrong size (expected size = 0x%X)", tag(), eeprom_bytes);
|
||||
if (m_config.m_data_bits == 8 && (m_region->flags & ROMREGION_WIDTHMASK) != ROMREGION_8BIT)
|
||||
if (m_config.m_data_bits == 8 && m_region->width() != 1)
|
||||
fatalerror("eeprom region '%s' needs to be an 8-bit region", tag());
|
||||
if (m_config.m_data_bits == 16 && ((m_region->flags & ROMREGION_WIDTHMASK) != ROMREGION_16BIT || (m_region->flags & ROMREGION_ENDIANMASK) != ROMREGION_BE))
|
||||
fatalerror("eeprom region '%s' needs to be a 16-bit big-endian region (flags=%08x)", tag(), m_region->flags);
|
||||
if (m_config.m_data_bits == 16 && (m_region->width() != 2 || m_region->endianness() != ENDIANNESS_BIG))
|
||||
fatalerror("eeprom region '%s' needs to be a 16-bit big-endian region (flags=%08x)", tag(), m_region->flags());
|
||||
|
||||
for (offs_t offs = 0; offs < eeprom_length; offs++)
|
||||
if (m_config.m_data_bits == 8)
|
||||
memory_write_byte(m_addrspace[0], offs, m_region->base.u8[offs]);
|
||||
memory_write_byte(m_addrspace[0], offs, m_region->u8(offs));
|
||||
else
|
||||
memory_write_word(m_addrspace[0], offs * 2, m_region->base.u16[offs]);
|
||||
memory_write_word(m_addrspace[0], offs * 2, m_region->u16(offs));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
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);
|
||||
static void interrupt_reset(running_machine &machine);
|
||||
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ void generic_machine_init(running_machine *machine)
|
||||
state->memcard_inserted = -1;
|
||||
|
||||
/* register a reset callback and save state for interrupt enable */
|
||||
add_reset_callback(machine, interrupt_reset);
|
||||
machine->add_notifier(MACHINE_NOTIFY_RESET, interrupt_reset);
|
||||
state_save_register_item_array(machine, "cpu", NULL, 0, state->interrupt_enable);
|
||||
|
||||
/* register for configuration */
|
||||
@ -112,7 +112,7 @@ void generic_machine_init(running_machine *machine)
|
||||
if (machine->config->m_memcard_handler != NULL)
|
||||
{
|
||||
state_save_register_global(machine, state->memcard_inserted);
|
||||
add_exit_callback(machine, memcard_eject);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, memcard_eject);
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ mame_file *nvram_fopen(running_machine *machine, UINT32 openflags)
|
||||
file_error filerr;
|
||||
mame_file *file;
|
||||
|
||||
astring fname(machine->basename, ".nv");
|
||||
astring fname(machine->basename(), ".nv");
|
||||
filerr = mame_fopen(SEARCHPATH_NVRAM, fname, openflags, &file);
|
||||
|
||||
return (filerr == FILERR_NONE) ? file : NULL;
|
||||
@ -398,12 +398,13 @@ void nvram_save(running_machine *machine)
|
||||
|
||||
NVRAM_HANDLER( generic_0fill )
|
||||
{
|
||||
const region_info *region = machine->region("nvram");
|
||||
if (read_or_write)
|
||||
mame_fwrite(file, machine->generic.nvram.v, machine->generic.nvram_size);
|
||||
else if (file != NULL)
|
||||
mame_fread(file, machine->generic.nvram.v, machine->generic.nvram_size);
|
||||
else if (memory_region_length(machine, "nvram") == machine->generic.nvram_size)
|
||||
memcpy(machine->generic.nvram.v, memory_region(machine, "nvram"), machine->generic.nvram_size);
|
||||
else if (region != NULL && region->bytes() == machine->generic.nvram_size)
|
||||
memcpy(machine->generic.nvram.v, region->base(), machine->generic.nvram_size);
|
||||
else
|
||||
memset(machine->generic.nvram.v, 0, machine->generic.nvram_size);
|
||||
}
|
||||
@ -416,12 +417,13 @@ NVRAM_HANDLER( generic_0fill )
|
||||
|
||||
NVRAM_HANDLER( generic_1fill )
|
||||
{
|
||||
const region_info *region = machine->region("nvram");
|
||||
if (read_or_write)
|
||||
mame_fwrite(file, machine->generic.nvram.v, machine->generic.nvram_size);
|
||||
else if (file != NULL)
|
||||
mame_fread(file, machine->generic.nvram.v, machine->generic.nvram_size);
|
||||
else if (memory_region_length(machine, "nvram") == machine->generic.nvram_size)
|
||||
memcpy(machine->generic.nvram.v, memory_region(machine, "nvram"), machine->generic.nvram_size);
|
||||
else if (region != NULL && region->bytes() == machine->generic.nvram_size)
|
||||
memcpy(machine->generic.nvram.v, region->base(), machine->generic.nvram_size);
|
||||
else
|
||||
memset(machine->generic.nvram.v, 0xff, machine->generic.nvram_size);
|
||||
}
|
||||
@ -434,12 +436,13 @@ NVRAM_HANDLER( generic_1fill )
|
||||
|
||||
NVRAM_HANDLER( generic_randfill )
|
||||
{
|
||||
const region_info *region = machine->region("nvram");
|
||||
if (read_or_write)
|
||||
mame_fwrite(file, machine->generic.nvram.v, machine->generic.nvram_size);
|
||||
else if (file != NULL)
|
||||
mame_fread(file, machine->generic.nvram.v, machine->generic.nvram_size);
|
||||
else if (memory_region_length(machine, "nvram") == machine->generic.nvram_size)
|
||||
memcpy(machine->generic.nvram.v, memory_region(machine, "nvram"), machine->generic.nvram_size);
|
||||
else if (region != NULL && region->bytes() == machine->generic.nvram_size)
|
||||
memcpy(machine->generic.nvram.v, region->base(), machine->generic.nvram_size);
|
||||
else
|
||||
{
|
||||
UINT8 *nvram = (UINT8 *)machine->generic.nvram.v;
|
||||
@ -481,7 +484,7 @@ 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)
|
||||
{
|
||||
filerr = mame_fopen(SEARCHPATH_MEMCARD, fname, OPEN_FLAG_READ, &file);
|
||||
@ -521,12 +524,12 @@ int memcard_insert(running_machine *machine, int index)
|
||||
|
||||
/* 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);
|
||||
astring fname(machine->basename, PATH_SEPARATOR, name);
|
||||
astring fname(machine->basename(), PATH_SEPARATOR, name);
|
||||
|
||||
/* open the file; if we can't, it's an error */
|
||||
filerr = mame_fopen(SEARCHPATH_MEMCARD, fname, OPEN_FLAG_READ, &file);
|
||||
@ -549,9 +552,9 @@ int memcard_insert(running_machine *machine, int index)
|
||||
its contents along the way
|
||||
-------------------------------------------------*/
|
||||
|
||||
void memcard_eject(running_machine *machine)
|
||||
void memcard_eject(running_machine &machine)
|
||||
{
|
||||
generic_machine_private *state = machine->generic_machine_data;
|
||||
generic_machine_private *state = machine.generic_machine_data;
|
||||
file_error filerr;
|
||||
mame_file *file;
|
||||
char name[16];
|
||||
@ -562,7 +565,7 @@ void memcard_eject(running_machine *machine)
|
||||
|
||||
/* create a name */
|
||||
memcard_name(state->memcard_inserted, name);
|
||||
astring fname(machine->basename, PATH_SEPARATOR, name);
|
||||
astring fname(machine.basename(), PATH_SEPARATOR, name);
|
||||
|
||||
/* open the file; if we can't, it's an error */
|
||||
filerr = mame_fopen(SEARCHPATH_MEMCARD, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
|
||||
@ -573,8 +576,8 @@ 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);
|
||||
if (machine.m_config.m_memcard_handler)
|
||||
(*machine.m_config.m_memcard_handler)(&machine, file, MEMCARD_EJECT);
|
||||
|
||||
/* close the file */
|
||||
mame_fclose(file);
|
||||
@ -619,9 +622,9 @@ void set_led_status(running_machine *machine, int num, int on)
|
||||
states on a reset
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void interrupt_reset(running_machine *machine)
|
||||
static void interrupt_reset(running_machine &machine)
|
||||
{
|
||||
generic_machine_private *state = machine->generic_machine_data;
|
||||
generic_machine_private *state = machine.generic_machine_data;
|
||||
int cpunum;
|
||||
|
||||
/* on a reset, enable all interrupts */
|
||||
|
@ -102,7 +102,7 @@ int memcard_create(running_machine *machine, int index, int overwrite);
|
||||
int memcard_insert(running_machine *machine, int index);
|
||||
|
||||
/* "eject" a memory card and save its data */
|
||||
void memcard_eject(running_machine *machine);
|
||||
void memcard_eject(running_machine &machine);
|
||||
|
||||
/* returns the index of the current memory card, or -1 if none */
|
||||
int memcard_present(running_machine *machine);
|
||||
|
@ -48,7 +48,7 @@ INLINE mb3773_state *get_safe_token(running_device *device)
|
||||
|
||||
static TIMER_CALLBACK( watchdog_timeout )
|
||||
{
|
||||
mame_schedule_soft_reset(machine);
|
||||
machine->schedule_soft_reset();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
|
@ -238,9 +238,9 @@ static int dec_2_local(int a)
|
||||
|
||||
static void mc146818_set_base_datetime(running_machine *machine)
|
||||
{
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
|
||||
mame_get_base_datetime(machine, &systime);
|
||||
machine->base_datetime(systime);
|
||||
|
||||
if (HOURS_24 || (systime.local_time.hour < 12))
|
||||
mc146818->data[4] = dec_2_local(systime.local_time.hour);
|
||||
|
@ -33,7 +33,7 @@ typedef struct _msm6242_t msm6242_t;
|
||||
struct _msm6242_t
|
||||
{
|
||||
UINT8 reg[3];
|
||||
mame_system_time hold_time;
|
||||
system_time hold_time;
|
||||
};
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ INLINE msm6242_t *get_safe_token(running_device *device)
|
||||
|
||||
READ8_DEVICE_HANDLER( msm6242_r )
|
||||
{
|
||||
mame_system_time curtime, *systime = &curtime;
|
||||
system_time curtime, *systime = &curtime;
|
||||
msm6242_t *msm6242 = get_safe_token(device);
|
||||
|
||||
if (msm6242->reg[0] & 1) /* if HOLD is set, use the hold time */
|
||||
@ -58,7 +58,7 @@ READ8_DEVICE_HANDLER( msm6242_r )
|
||||
}
|
||||
else /* otherwise, use the current time */
|
||||
{
|
||||
mame_get_current_datetime(device->machine, &curtime);
|
||||
device->machine->current_datetime(curtime);
|
||||
}
|
||||
|
||||
switch(offset)
|
||||
@ -120,7 +120,7 @@ WRITE8_DEVICE_HANDLER( msm6242_w )
|
||||
|
||||
if (data & 1) /* was Hold set? */
|
||||
{
|
||||
mame_get_current_datetime(device->machine, &msm6242->hold_time);
|
||||
device->machine->current_datetime(msm6242->hold_time);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -157,7 +157,7 @@ static DEVICE_START( msm6242 )
|
||||
msm6242->reg[0] = 0;
|
||||
msm6242->reg[1] = 0;
|
||||
msm6242->reg[2] = 0;
|
||||
memset(&msm6242->hold_time, 0, sizeof(mame_system_time));
|
||||
memset(&msm6242->hold_time, 0, sizeof(system_time));
|
||||
}
|
||||
|
||||
|
||||
|
@ -448,8 +448,8 @@ static DEVICE_START( upd4990a )
|
||||
{
|
||||
upd4990a_state *upd4990a = get_safe_token(device);
|
||||
|
||||
mame_system_time curtime, *systime = &curtime;
|
||||
mame_get_current_datetime(device->machine, &curtime);
|
||||
system_time curtime, *systime = &curtime;
|
||||
device->machine->current_datetime(curtime);
|
||||
|
||||
#if 0
|
||||
upd4990a->seconds = 0x00;
|
||||
|
@ -233,10 +233,10 @@ static int rtc65271_file_load(running_device *device, mame_file *file)
|
||||
/*state->dirty = FALSE;*/
|
||||
|
||||
{
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
|
||||
/* get the current date/time from the core */
|
||||
mame_get_current_datetime(device->machine, &systime);
|
||||
device->machine->current_datetime(systime);
|
||||
|
||||
/* set clock registers */
|
||||
state->regs[reg_second] = systime.local_time.second;
|
||||
|
@ -286,7 +286,7 @@ static DEVICE_START(timekeeper)
|
||||
timekeeper_state *c = get_safe_token(device);
|
||||
emu_timer *timer;
|
||||
attotime duration;
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
|
||||
/* validate some basic stuff */
|
||||
assert(device != NULL);
|
||||
@ -295,7 +295,7 @@ static DEVICE_START(timekeeper)
|
||||
assert(device->machine != NULL);
|
||||
assert(device->machine->config != NULL);
|
||||
|
||||
mame_get_base_datetime(device->machine, &systime);
|
||||
device->machine->base_datetime(systime);
|
||||
|
||||
c->device = device;
|
||||
c->control = 0;
|
||||
|
1284
src/emu/mame.c
1284
src/emu/mame.c
File diff suppressed because it is too large
Load Diff
393
src/emu/mame.h
393
src/emu/mame.h
@ -18,15 +18,15 @@
|
||||
#ifndef __MAME_H__
|
||||
#define __MAME_H__
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
|
||||
const int MAX_GFX_ELEMENTS = 32;
|
||||
//**************************************************************************
|
||||
// CONSTANTS
|
||||
//**************************************************************************
|
||||
|
||||
/* return values from run_game */
|
||||
// return values from run_game
|
||||
enum
|
||||
{
|
||||
MAMERR_NONE = 0, /* no error */
|
||||
@ -42,30 +42,7 @@ enum
|
||||
};
|
||||
|
||||
|
||||
/* program phases */
|
||||
enum
|
||||
{
|
||||
MAME_PHASE_PREINIT,
|
||||
MAME_PHASE_INIT,
|
||||
MAME_PHASE_RESET,
|
||||
MAME_PHASE_RUNNING,
|
||||
MAME_PHASE_EXIT
|
||||
};
|
||||
|
||||
|
||||
/* debug flags */
|
||||
#define DEBUG_FLAG_ENABLED 0x00000001 /* debugging is enabled */
|
||||
#define DEBUG_FLAG_CALL_HOOK 0x00000002 /* CPU cores must call instruction hook */
|
||||
#define DEBUG_FLAG_WPR_PROGRAM 0x00000010 /* watchpoints are enabled for PROGRAM memory reads */
|
||||
#define DEBUG_FLAG_WPR_DATA 0x00000020 /* watchpoints are enabled for DATA memory reads */
|
||||
#define DEBUG_FLAG_WPR_IO 0x00000040 /* watchpoints are enabled for IO memory reads */
|
||||
#define DEBUG_FLAG_WPW_PROGRAM 0x00000100 /* watchpoints are enabled for PROGRAM memory writes */
|
||||
#define DEBUG_FLAG_WPW_DATA 0x00000200 /* watchpoints are enabled for DATA memory writes */
|
||||
#define DEBUG_FLAG_WPW_IO 0x00000400 /* watchpoints are enabled for IO memory writes */
|
||||
#define DEBUG_FLAG_OSD_ENABLED 0x00001000 /* The OSD debugger is enabled */
|
||||
|
||||
|
||||
/* MESS vs. MAME abstractions */
|
||||
// MESS vs. MAME abstractions
|
||||
#ifndef MESS
|
||||
#define APPNAME "MAME"
|
||||
#define APPNAME_LOWER "mame"
|
||||
@ -91,251 +68,19 @@ enum
|
||||
#endif
|
||||
|
||||
|
||||
/* output channels */
|
||||
enum _output_channel
|
||||
{
|
||||
OUTPUT_CHANNEL_ERROR,
|
||||
OUTPUT_CHANNEL_WARNING,
|
||||
OUTPUT_CHANNEL_INFO,
|
||||
OUTPUT_CHANNEL_DEBUG,
|
||||
OUTPUT_CHANNEL_VERBOSE,
|
||||
OUTPUT_CHANNEL_LOG,
|
||||
OUTPUT_CHANNEL_COUNT
|
||||
};
|
||||
typedef enum _output_channel output_channel;
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
MACROS
|
||||
***************************************************************************/
|
||||
|
||||
// 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_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)
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
// forward declarations
|
||||
class gfx_element;
|
||||
class colortable_t;
|
||||
class debug_view_manager;
|
||||
|
||||
typedef struct _mame_private mame_private;
|
||||
typedef struct _cpuexec_private cpuexec_private;
|
||||
typedef struct _timer_private timer_private;
|
||||
typedef struct _state_private state_private;
|
||||
typedef struct _memory_private memory_private;
|
||||
typedef struct _palette_private palette_private;
|
||||
typedef struct _tilemap_private tilemap_private;
|
||||
typedef struct _streams_private streams_private;
|
||||
typedef struct _devices_private devices_private;
|
||||
typedef struct _romload_private romload_private;
|
||||
typedef struct _sound_private sound_private;
|
||||
typedef struct _input_private input_private;
|
||||
typedef struct _input_port_private input_port_private;
|
||||
typedef struct _ui_input_private ui_input_private;
|
||||
typedef struct _cheat_private cheat_private;
|
||||
typedef struct _debugcpu_private debugcpu_private;
|
||||
typedef struct _debugvw_private debugvw_private;
|
||||
typedef struct _generic_machine_private generic_machine_private;
|
||||
typedef struct _generic_video_private generic_video_private;
|
||||
typedef struct _generic_audio_private generic_audio_private;
|
||||
|
||||
|
||||
// template specializations
|
||||
typedef tagged_list<region_info> region_list;
|
||||
|
||||
|
||||
/* output channel callback */
|
||||
// output channel callback
|
||||
typedef void (*output_callback_func)(void *param, const char *format, va_list argptr);
|
||||
|
||||
|
||||
// memory region
|
||||
class region_info
|
||||
{
|
||||
DISABLE_COPYING(region_info);
|
||||
|
||||
running_machine * machine;
|
||||
|
||||
public:
|
||||
region_info(running_machine *machine, const char *_name, UINT32 _length, UINT32 _flags);
|
||||
~region_info();
|
||||
|
||||
region_info *next() const { return m_next; }
|
||||
|
||||
operator void *() const { return (this != NULL) ? base.v : NULL; }
|
||||
operator INT8 *() const { return (this != NULL) ? base.i8 : NULL; }
|
||||
operator UINT8 *() const { return (this != NULL) ? base.u8 : NULL; }
|
||||
operator INT16 *() const { return (this != NULL) ? base.i16 : NULL; }
|
||||
operator UINT16 *() const { return (this != NULL) ? base.u16 : NULL; }
|
||||
operator INT32 *() const { return (this != NULL) ? base.i32 : NULL; }
|
||||
operator UINT32 *() const { return (this != NULL) ? base.u32 : NULL; }
|
||||
operator INT64 *() const { return (this != NULL) ? base.i64 : NULL; }
|
||||
operator UINT64 *() const { return (this != NULL) ? base.u64 : NULL; }
|
||||
|
||||
UINT32 bytes() const { return (this != NULL) ? length : 0; }
|
||||
|
||||
endianness_t endianness() const { return ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE) ? ENDIANNESS_LITTLE : ENDIANNESS_BIG; }
|
||||
UINT8 width() const { return 1 << ((flags & ROMREGION_WIDTHMASK) >> 8); }
|
||||
|
||||
region_info * m_next;
|
||||
astring name;
|
||||
generic_ptr base;
|
||||
UINT32 length;
|
||||
UINT32 flags;
|
||||
};
|
||||
|
||||
|
||||
/* this structure holds generic pointers that are commonly used */
|
||||
struct generic_pointers
|
||||
{
|
||||
generic_ptr nvram; /* generic NVRAM */
|
||||
UINT32 nvram_size;
|
||||
generic_ptr videoram; /* videoram */
|
||||
UINT32 videoram_size;
|
||||
generic_ptr spriteram; /* spriteram */
|
||||
UINT32 spriteram_size;
|
||||
generic_ptr spriteram2; /* secondary spriteram */
|
||||
UINT32 spriteram2_size;
|
||||
generic_ptr buffered_spriteram; /* buffered spriteram */
|
||||
generic_ptr buffered_spriteram2;/* secondary buffered spriteram */
|
||||
generic_ptr paletteram; /* palette RAM */
|
||||
generic_ptr paletteram2; /* secondary palette RAM */
|
||||
bitmap_t * tmpbitmap; /* temporary bitmap */
|
||||
};
|
||||
|
||||
|
||||
/* description of the currently-running machine */
|
||||
class running_machine
|
||||
{
|
||||
DISABLE_COPYING(running_machine);
|
||||
|
||||
public:
|
||||
running_machine(const game_driver &driver, const machine_config &config);
|
||||
~running_machine();
|
||||
|
||||
void start();
|
||||
|
||||
inline device_t *device(const char *tag);
|
||||
template<class T> inline T *device(const char *tag) { return downcast<T *>(device(tag)); }
|
||||
inline const input_port_config *port(const char *tag);
|
||||
inline const region_info *region(const char *tag);
|
||||
|
||||
// configuration helpers
|
||||
UINT32 total_colors() const { return m_config.m_total_colors; }
|
||||
|
||||
const char *describe_context();
|
||||
|
||||
resource_pool respool; // pool of resources for this machine
|
||||
region_list regionlist; // list of memory regions
|
||||
device_list m_devicelist; // list of running devices
|
||||
device_scheduler scheduler; // scheduler object
|
||||
|
||||
/* configuration data */
|
||||
const machine_config * config; /* points to the constructed machine_config */
|
||||
const machine_config & m_config; /* points to the constructed machine_config */
|
||||
ioport_list portlist; /* points to a list of input port configurations */
|
||||
|
||||
/* CPU information */
|
||||
device_t * firstcpu; /* first CPU (allows for quick iteration via typenext) */
|
||||
|
||||
/* game-related information */
|
||||
const game_driver * gamedrv; /* points to the definition of the game machine */
|
||||
const game_driver & m_game; /* points to the definition of the game machine */
|
||||
char * basename; /* basename used for game-related paths */
|
||||
|
||||
/* video-related information */
|
||||
gfx_element * gfx[MAX_GFX_ELEMENTS];/* array of pointers to graphic sets (chars, sprites) */
|
||||
screen_device * primary_screen; /* the primary screen device, or NULL if screenless */
|
||||
palette_t * palette; /* global palette object */
|
||||
|
||||
/* palette-related information */
|
||||
const pen_t * pens; /* remapped palette pen numbers */
|
||||
colortable_t * colortable; /* global colortable for remapping */
|
||||
pen_t * shadow_table; /* table for looking up a shadowed pen */
|
||||
bitmap_t * priority_bitmap; /* priority bitmap */
|
||||
|
||||
/* audio-related information */
|
||||
int sample_rate; /* the digital audio sample rate */
|
||||
|
||||
/* debugger-related information */
|
||||
UINT32 debug_flags; /* the current debug flags */
|
||||
|
||||
/* UI-related */
|
||||
bool ui_active; /* ui active or not (useful for games / systems with keyboard inputs) */
|
||||
|
||||
/* generic pointers */
|
||||
generic_pointers generic; /* generic pointers */
|
||||
|
||||
/* internal core information */
|
||||
mame_private * mame_data; /* internal data from mame.c */
|
||||
timer_private * timer_data; /* internal data from timer.c */
|
||||
state_private * state_data; /* internal data from state.c */
|
||||
memory_private * memory_data; /* internal data from memory.c */
|
||||
palette_private * palette_data; /* internal data from palette.c */
|
||||
tilemap_private * tilemap_data; /* internal data from tilemap.c */
|
||||
streams_private * streams_data; /* internal data from streams.c */
|
||||
devices_private * devices_data; /* internal data from devices.c */
|
||||
romload_private * romload_data; /* internal data from romload.c */
|
||||
sound_private * sound_data; /* internal data from sound.c */
|
||||
input_private * input_data; /* internal data from input.c */
|
||||
input_port_private * input_port_data; /* internal data from inptport.c */
|
||||
ui_input_private * ui_input_data; /* internal data from uiinput.c */
|
||||
cheat_private * cheat_data; /* internal data from cheat.c */
|
||||
debugcpu_private * debugcpu_data; /* internal data from debugcpu.c */
|
||||
generic_machine_private *generic_machine_data; /* internal data from machine/generic.c */
|
||||
generic_video_private * generic_video_data; /* internal data from video/generic.c */
|
||||
generic_audio_private * generic_audio_data; /* internal data from audio/generic.c */
|
||||
|
||||
debug_view_manager * m_debug_view; /* internal data from debugvw.c */
|
||||
|
||||
/* driver-specific information */
|
||||
void * driver_data; /* drivers can hang data off of here instead of using globals */
|
||||
|
||||
private:
|
||||
astring m_context; // context string
|
||||
};
|
||||
|
||||
|
||||
typedef struct _mame_system_tm mame_system_tm;
|
||||
struct _mame_system_tm
|
||||
{
|
||||
UINT8 second; /* seconds (0-59) */
|
||||
UINT8 minute; /* minutes (0-59) */
|
||||
UINT8 hour; /* hours (0-23) */
|
||||
UINT8 mday; /* day of month (1-31) */
|
||||
UINT8 month; /* month (0-11) */
|
||||
INT32 year; /* year (1=1 AD) */
|
||||
UINT8 weekday; /* day of week (0-6) */
|
||||
UINT16 day; /* day of year (0-365) */
|
||||
UINT8 is_dst; /* is this daylight savings? */
|
||||
};
|
||||
|
||||
|
||||
typedef struct _mame_system_time mame_system_time;
|
||||
struct _mame_system_time
|
||||
{
|
||||
INT64 time; /* number of seconds elapsed since midnight, January 1 1970 UTC */
|
||||
mame_system_tm local_time; /* local time */
|
||||
mame_system_tm utc_time; /* UTC coordinated time */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
GLOBAL VARIABLES
|
||||
***************************************************************************/
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
extern const char mame_disclaimer[];
|
||||
|
||||
@ -356,85 +101,11 @@ int mame_execute(core_options *options);
|
||||
/* accesses the core_options for the currently running emulation */
|
||||
core_options *mame_options(void);
|
||||
|
||||
/* return the current phase */
|
||||
int mame_get_phase(running_machine *machine);
|
||||
|
||||
/* request callback on frame update */
|
||||
void add_frame_callback(running_machine *machine, void (*callback)(running_machine *));
|
||||
|
||||
/* request callback on reset */
|
||||
void add_reset_callback(running_machine *machine, void (*callback)(running_machine *));
|
||||
|
||||
/* request callback on pause */
|
||||
void add_pause_callback(running_machine *machine, void (*callback)(running_machine *, int));
|
||||
|
||||
/* request callback on termination */
|
||||
void add_exit_callback(running_machine *machine, void (*callback)(running_machine *));
|
||||
|
||||
/* handle update tasks for a frame boundary */
|
||||
void mame_frame_update(running_machine *machine);
|
||||
|
||||
/* return true if the given machine is valid */
|
||||
int mame_is_valid_machine(running_machine *machine);
|
||||
|
||||
|
||||
|
||||
/* ----- global system states ----- */
|
||||
|
||||
/* schedule an exit */
|
||||
void mame_schedule_exit(running_machine *machine);
|
||||
|
||||
/* schedule a hard reset */
|
||||
void mame_schedule_hard_reset(running_machine *machine);
|
||||
|
||||
/* schedule a soft reset */
|
||||
void mame_schedule_soft_reset(running_machine *machine);
|
||||
|
||||
/* schedule a new driver */
|
||||
void mame_schedule_new_driver(running_machine *machine, const game_driver *driver);
|
||||
|
||||
/* schedule a save */
|
||||
void mame_schedule_save(running_machine *machine, const char *filename);
|
||||
|
||||
/* schedule a load */
|
||||
void mame_schedule_load(running_machine *machine, const char *filename);
|
||||
|
||||
/* is a save or load pending? */
|
||||
int mame_is_save_or_load_pending(running_machine *machine);
|
||||
|
||||
/* is a scheduled event pending? */
|
||||
int mame_is_scheduled_event_pending(running_machine *machine);
|
||||
|
||||
/* pause the system */
|
||||
void mame_pause(running_machine *machine, int pause);
|
||||
|
||||
/* get the current pause state */
|
||||
int mame_is_paused(running_machine *machine);
|
||||
|
||||
|
||||
|
||||
/* ----- memory region management ----- */
|
||||
|
||||
/* allocate a new memory region */
|
||||
region_info *memory_region_alloc(running_machine *machine, const char *name, UINT32 length, UINT32 flags);
|
||||
|
||||
/* free an allocated memory region */
|
||||
void memory_region_free(running_machine *machine, const char *name);
|
||||
|
||||
/* return a pointer to a specified memory region */
|
||||
UINT8 *memory_region(running_machine *machine, const char *name);
|
||||
|
||||
/* return the size (in bytes) of a specified memory region */
|
||||
UINT32 memory_region_length(running_machine *machine, const char *name);
|
||||
|
||||
/* return the flags (defined in romload.h) for a specified memory region */
|
||||
UINT32 memory_region_flags(running_machine *machine, const char *name);
|
||||
|
||||
/* return the name of the next memory region (or the first if name == NULL) */
|
||||
const char *memory_region_next(running_machine *machine, const char *name);
|
||||
|
||||
|
||||
|
||||
/* ----- output management ----- */
|
||||
|
||||
/* set the output handler for a channel, returns the current one */
|
||||
@ -461,45 +132,15 @@ void mame_printf_debug(const char *format, ...) ATTR_PRINTF(1,2);
|
||||
|
||||
/* ----- miscellaneous bits & pieces ----- */
|
||||
|
||||
/* pop-up a user visible message */
|
||||
void CLIB_DECL popmessage(const char *format,...) ATTR_PRINTF(1,2);
|
||||
|
||||
/* log to the standard error.log file */
|
||||
void CLIB_DECL logerror(const char *format,...) ATTR_PRINTF(1,2);
|
||||
|
||||
/* adds a callback to be called on logerror() */
|
||||
void add_logerror_callback(running_machine *machine, void (*callback)(running_machine *, const char *));
|
||||
|
||||
/* parse the configured INI files */
|
||||
void mame_parse_ini_files(core_options *options, const game_driver *driver);
|
||||
|
||||
/* standardized random number generator */
|
||||
UINT32 mame_rand(running_machine *machine);
|
||||
|
||||
/* retrieve the base system time */
|
||||
void mame_get_base_datetime(running_machine *machine, mame_system_time *systime);
|
||||
// pop-up a user visible message
|
||||
void CLIB_DECL popmessage(const char *format,...) ATTR_PRINTF(1,2);
|
||||
|
||||
/* retrieve the current system time */
|
||||
void mame_get_current_datetime(running_machine *machine, mame_system_time *systime);
|
||||
|
||||
/***************************************************************************
|
||||
INLINE FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
inline device_t *running_machine::device(const char *tag)
|
||||
{
|
||||
return m_devicelist.find(tag);
|
||||
}
|
||||
|
||||
inline const input_port_config *running_machine::port(const char *tag)
|
||||
{
|
||||
return portlist.find(tag);
|
||||
}
|
||||
|
||||
inline const region_info *running_machine::region(const char *tag)
|
||||
{
|
||||
return regionlist.find(tag);
|
||||
}
|
||||
// log to the standard error.log file
|
||||
void CLIB_DECL logerror(const char *format,...) ATTR_PRINTF(1,2);
|
||||
|
||||
|
||||
#endif /* __MAME_H__ */
|
||||
|
@ -393,7 +393,7 @@ static void memory_init_populate(running_machine *machine);
|
||||
static void memory_init_map_entry(address_space *space, const address_map_entry *entry, read_or_write readorwrite);
|
||||
static void memory_init_allocate(running_machine *machine);
|
||||
static void memory_init_locate(running_machine *machine);
|
||||
static void memory_exit(running_machine *machine);
|
||||
static void memory_exit(running_machine &machine);
|
||||
|
||||
/* address map helpers */
|
||||
static void map_detokenize(memory_private *memdata, address_map *map, const game_driver *driver, const device_config *devconfig, const addrmap_token *tokens);
|
||||
@ -793,7 +793,7 @@ void memory_init(running_machine *machine)
|
||||
{
|
||||
memory_private *memdata;
|
||||
|
||||
add_exit_callback(machine, memory_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, memory_exit);
|
||||
|
||||
/* allocate our private data */
|
||||
memdata = machine->memory_data = auto_alloc_clear(machine, memory_private);
|
||||
@ -1493,7 +1493,7 @@ void *_memory_install_ram(const address_space *space, offs_t addrstart, offs_t a
|
||||
/* if we still don't have a pointer, and we're past the initialization phase, allocate a new block */
|
||||
if (memdata->bank_ptr[bankindex] == NULL && memdata->initialized)
|
||||
{
|
||||
if (mame_get_phase(space->machine) >= MAME_PHASE_RESET)
|
||||
if (space->machine->phase() >= MACHINE_PHASE_RESET)
|
||||
fatalerror("Attempted to call memory_install_ram() after initialization time without a baseptr!");
|
||||
memdata->bank_ptr[bankindex] = (UINT8 *)block_allocate(space, memory_address_to_byte(space, addrstart), memory_address_to_byte_end(space, addrend), NULL);
|
||||
}
|
||||
@ -1517,7 +1517,7 @@ void *_memory_install_ram(const address_space *space, offs_t addrstart, offs_t a
|
||||
/* if we still don't have a pointer, and we're past the initialization phase, allocate a new block */
|
||||
if (memdata->bank_ptr[bankindex] == NULL && memdata->initialized)
|
||||
{
|
||||
if (mame_get_phase(space->machine) >= MAME_PHASE_RESET)
|
||||
if (space->machine->phase() >= MACHINE_PHASE_RESET)
|
||||
fatalerror("Attempted to call memory_install_ram() after initialization time without a baseptr!");
|
||||
memdata->bank_ptr[bankindex] = (UINT8 *)block_allocate(space, memory_address_to_byte(space, addrstart), memory_address_to_byte_end(space, addrend), NULL);
|
||||
}
|
||||
@ -1805,7 +1805,8 @@ static void memory_init_preflight(running_machine *machine)
|
||||
/* loop over valid address spaces */
|
||||
for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next)
|
||||
{
|
||||
int regionsize = (space->spacenum == ADDRESS_SPACE_0) ? memory_region_length(space->machine, space->cpu->tag()) : 0;
|
||||
const region_info *devregion = (space->spacenum == ADDRESS_SPACE_0) ? space->machine->region(space->cpu->tag()) : NULL;
|
||||
int devregionsize = (devregion != NULL) ? devregion->bytes() : 0;
|
||||
address_map_entry *entry;
|
||||
int entrynum;
|
||||
|
||||
@ -1834,7 +1835,7 @@ static void memory_init_preflight(running_machine *machine)
|
||||
if (space->spacenum == ADDRESS_SPACE_0 && entry->read.type == AMH_ROM && entry->region == NULL)
|
||||
{
|
||||
/* make sure it fits within the memory region before doing so, however */
|
||||
if (entry->byteend < regionsize)
|
||||
if (entry->byteend < devregionsize)
|
||||
{
|
||||
entry->region = space->cpu->tag();
|
||||
entry->rgnoffs = entry->bytestart;
|
||||
@ -1844,19 +1845,18 @@ static void memory_init_preflight(running_machine *machine)
|
||||
/* validate adjusted addresses against implicit regions */
|
||||
if (entry->region != NULL && entry->share == NULL && entry->baseptr == NULL)
|
||||
{
|
||||
UINT8 *base = memory_region(machine, entry->region);
|
||||
offs_t length = memory_region_length(machine, entry->region);
|
||||
|
||||
/* validate the region */
|
||||
if (base == NULL)
|
||||
const region_info *region = machine->region(entry->region);
|
||||
if (region == NULL)
|
||||
fatalerror("Error: device '%s' %s space memory map entry %X-%X references non-existant region \"%s\"", space->cpu->tag(), space->name, entry->addrstart, entry->addrend, entry->region);
|
||||
if (entry->rgnoffs + (entry->byteend - entry->bytestart + 1) > length)
|
||||
fatalerror("Error: device '%s' %s space memory map entry %X-%X extends beyond region \"%s\" size (%X)", space->cpu->tag(), space->name, entry->addrstart, entry->addrend, entry->region, length);
|
||||
|
||||
/* validate the region */
|
||||
if (entry->rgnoffs + (entry->byteend - entry->bytestart + 1) > region->bytes())
|
||||
fatalerror("Error: device '%s' %s space memory map entry %X-%X extends beyond region \"%s\" size (%X)", space->cpu->tag(), space->name, entry->addrstart, entry->addrend, entry->region, region->bytes());
|
||||
}
|
||||
|
||||
/* convert any region-relative entries to their memory pointers */
|
||||
if (entry->region != NULL)
|
||||
entry->memory = memory_region(machine, entry->region) + entry->rgnoffs;
|
||||
entry->memory = machine->region(entry->region)->base() + entry->rgnoffs;
|
||||
}
|
||||
|
||||
/* now loop over all the handlers and enforce the address mask */
|
||||
@ -2171,9 +2171,9 @@ static void memory_init_locate(running_machine *machine)
|
||||
memory_exit - free memory
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void memory_exit(running_machine *machine)
|
||||
static void memory_exit(running_machine &machine)
|
||||
{
|
||||
memory_private *memdata = machine->memory_data;
|
||||
memory_private *memdata = machine.memory_data;
|
||||
address_space *space;
|
||||
|
||||
/* free all the address spaces and tables */
|
||||
@ -2539,8 +2539,9 @@ static int space_needs_backing_store(const address_space *space, const address_m
|
||||
return TRUE;
|
||||
|
||||
/* if we're reading from RAM or from ROM outside of address space 0 or its region, then yes, we do need backing */
|
||||
const region_info *region = space->machine->region(space->cpu->tag());
|
||||
if (entry->read.type == AMH_RAM ||
|
||||
(entry->read.type == AMH_ROM && (space->spacenum != ADDRESS_SPACE_0 || entry->addrstart >= memory_region_length(space->machine, space->cpu->tag()))))
|
||||
(entry->read.type == AMH_ROM && (space->spacenum != ADDRESS_SPACE_0 || region == NULL || entry->addrstart >= region->bytes())))
|
||||
return TRUE;
|
||||
|
||||
/* all other cases don't need backing */
|
||||
@ -3323,7 +3324,7 @@ static void *block_allocate(const address_space *space, offs_t bytestart, offs_t
|
||||
int allocatemem = (memory == NULL);
|
||||
memory_block *block;
|
||||
size_t bytestoalloc;
|
||||
const char *region;
|
||||
const region_info *region;
|
||||
|
||||
VPRINTF(("block_allocate('%s',%s,%08X,%08X,%p)\n", space->cpu->tag(), space->name, bytestart, byteend, memory));
|
||||
|
||||
@ -3338,11 +3339,9 @@ static void *block_allocate(const address_space *space, offs_t bytestart, offs_t
|
||||
memory = block + 1;
|
||||
|
||||
/* register for saving, but only if we're not part of a memory region */
|
||||
for (region = memory_region_next(space->machine, NULL); region != NULL; region = memory_region_next(space->machine, region))
|
||||
for (region = space->machine->m_regionlist.first(); region != NULL; region = region->next())
|
||||
{
|
||||
UINT8 *region_base = memory_region(space->machine, region);
|
||||
UINT32 region_length = memory_region_length(space->machine, region);
|
||||
if (region_base != NULL && region_length != 0 && (UINT8 *)memory >= region_base && ((UINT8 *)memory + (byteend - bytestart + 1)) < region_base + region_length)
|
||||
if ((UINT8 *)memory >= region->base() && ((UINT8 *)memory + (byteend - bytestart + 1)) < region->end())
|
||||
{
|
||||
VPRINTF(("skipping save of this memory block as it is covered by a memory region\n"));
|
||||
break;
|
||||
|
@ -62,8 +62,9 @@ static UINT32 uniqueid = 12345;
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void output_pause(running_machine *machine, int pause);
|
||||
static void output_exit(running_machine *machine);
|
||||
static void output_pause(running_machine &machine);
|
||||
static void output_resume(running_machine &machine);
|
||||
static void output_exit(running_machine &machine);
|
||||
|
||||
|
||||
|
||||
@ -146,10 +147,11 @@ INLINE output_item *create_new_item(const char *outname, INT32 value)
|
||||
void output_init(running_machine *machine)
|
||||
{
|
||||
/* add pause callback */
|
||||
add_pause_callback(machine, output_pause);
|
||||
machine->add_notifier(MACHINE_NOTIFY_PAUSE, output_pause);
|
||||
machine->add_notifier(MACHINE_NOTIFY_RESUME, output_resume);
|
||||
|
||||
/* get a callback when done */
|
||||
add_exit_callback(machine, output_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, output_exit);
|
||||
|
||||
/* reset the lists */
|
||||
memset(itemtable, 0, sizeof(itemtable));
|
||||
@ -161,9 +163,14 @@ void output_init(running_machine *machine)
|
||||
output_pause - send pause message
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void output_pause(running_machine *machine, int pause)
|
||||
static void output_pause(running_machine &machine)
|
||||
{
|
||||
output_set_value("pause", pause & 1);
|
||||
output_set_value("pause", 1);
|
||||
}
|
||||
|
||||
static void output_resume(running_machine &machine)
|
||||
{
|
||||
output_set_value("pause", 0);
|
||||
}
|
||||
|
||||
|
||||
@ -171,7 +178,7 @@ static void output_pause(running_machine *machine, int pause)
|
||||
output_exit - cleanup on exit
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void output_exit(running_machine *machine)
|
||||
static void output_exit(running_machine &machine)
|
||||
{
|
||||
output_notify *notify;
|
||||
output_item *item;
|
||||
|
@ -256,7 +256,7 @@ static const int layer_order_alternate[] = { ITEM_LAYER_BACKDROP, ITEM_LAYER_SCR
|
||||
***************************************************************************/
|
||||
|
||||
/* core system */
|
||||
static void render_exit(running_machine *machine);
|
||||
static void render_exit(running_machine &machine);
|
||||
static void render_load(running_machine *machine, int config_type, xml_data_node *parentnode);
|
||||
static void render_save(running_machine *machine, int config_type, xml_data_node *parentnode);
|
||||
|
||||
@ -545,7 +545,7 @@ void render_init(running_machine *machine)
|
||||
render_container **current_container_ptr = &screen_container_list;
|
||||
|
||||
/* make sure we clean up after ourselves */
|
||||
add_exit_callback(machine, render_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, render_exit);
|
||||
|
||||
/* set up the list of render targets */
|
||||
targetlist = NULL;
|
||||
@ -570,9 +570,9 @@ void render_init(running_machine *machine)
|
||||
/* set the initial orientation and brightness/contrast/gamma */
|
||||
render_container_get_user_settings(screen_container, &settings);
|
||||
settings.orientation = machine->gamedrv->flags & ORIENTATION_MASK;
|
||||
settings.brightness = options_get_float(mame_options(), OPTION_BRIGHTNESS);
|
||||
settings.contrast = options_get_float(mame_options(), OPTION_CONTRAST);
|
||||
settings.gamma = options_get_float(mame_options(), OPTION_GAMMA);
|
||||
settings.brightness = options_get_float(machine->options(), OPTION_BRIGHTNESS);
|
||||
settings.contrast = options_get_float(machine->options(), OPTION_CONTRAST);
|
||||
settings.gamma = options_get_float(machine->options(), OPTION_GAMMA);
|
||||
render_container_set_user_settings(screen_container, &settings);
|
||||
|
||||
screen_container->screen = screendev;
|
||||
@ -594,7 +594,7 @@ void render_init(running_machine *machine)
|
||||
render_exit - free all rendering data
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void render_exit(running_machine *machine)
|
||||
static void render_exit(running_machine &machine)
|
||||
{
|
||||
render_texture **texture_ptr;
|
||||
render_container *container;
|
||||
@ -898,19 +898,19 @@ static void render_save(running_machine *machine, int config_type, xml_data_node
|
||||
xml_set_attribute_int(screennode, "index", scrnum);
|
||||
|
||||
/* output the color controls */
|
||||
if (container->brightness != options_get_float(mame_options(), OPTION_BRIGHTNESS))
|
||||
if (container->brightness != options_get_float(machine->options(), OPTION_BRIGHTNESS))
|
||||
{
|
||||
xml_set_attribute_float(screennode, "brightness", container->brightness);
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
if (container->contrast != options_get_float(mame_options(), OPTION_CONTRAST))
|
||||
if (container->contrast != options_get_float(machine->options(), OPTION_CONTRAST))
|
||||
{
|
||||
xml_set_attribute_float(screennode, "contrast", container->contrast);
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
if (container->gamma != options_get_float(mame_options(), OPTION_GAMMA))
|
||||
if (container->gamma != options_get_float(machine->options(), OPTION_GAMMA))
|
||||
{
|
||||
xml_set_attribute_float(screennode, "gamma", container->gamma);
|
||||
changed = TRUE;
|
||||
@ -1093,26 +1093,26 @@ render_target *render_target_alloc(running_machine *machine, const char *layoutf
|
||||
|
||||
/* determine the base layer configuration based on options */
|
||||
target->base_layerconfig = LAYER_CONFIG_DEFAULT;
|
||||
if (!options_get_bool(mame_options(), OPTION_USE_BACKDROPS)) target->base_layerconfig &= ~LAYER_CONFIG_ENABLE_BACKDROP;
|
||||
if (!options_get_bool(mame_options(), OPTION_USE_OVERLAYS)) target->base_layerconfig &= ~LAYER_CONFIG_ENABLE_OVERLAY;
|
||||
if (!options_get_bool(mame_options(), OPTION_USE_BEZELS)) target->base_layerconfig &= ~LAYER_CONFIG_ENABLE_BEZEL;
|
||||
if (options_get_bool(mame_options(), OPTION_ARTWORK_CROP)) target->base_layerconfig |= LAYER_CONFIG_ZOOM_TO_SCREEN;
|
||||
if (!options_get_bool(machine->options(), OPTION_USE_BACKDROPS)) target->base_layerconfig &= ~LAYER_CONFIG_ENABLE_BACKDROP;
|
||||
if (!options_get_bool(machine->options(), OPTION_USE_OVERLAYS)) target->base_layerconfig &= ~LAYER_CONFIG_ENABLE_OVERLAY;
|
||||
if (!options_get_bool(machine->options(), OPTION_USE_BEZELS)) target->base_layerconfig &= ~LAYER_CONFIG_ENABLE_BEZEL;
|
||||
if (options_get_bool(machine->options(), OPTION_ARTWORK_CROP)) target->base_layerconfig |= LAYER_CONFIG_ZOOM_TO_SCREEN;
|
||||
|
||||
/* determine the base orientation based on options */
|
||||
target->orientation = ROT0;
|
||||
if (!options_get_bool(mame_options(), OPTION_ROTATE))
|
||||
if (!options_get_bool(machine->options(), OPTION_ROTATE))
|
||||
target->base_orientation = orientation_reverse(machine->gamedrv->flags & ORIENTATION_MASK);
|
||||
|
||||
/* rotate left/right */
|
||||
if (options_get_bool(mame_options(), OPTION_ROR) || (options_get_bool(mame_options(), OPTION_AUTOROR) && (machine->gamedrv->flags & ORIENTATION_SWAP_XY)))
|
||||
if (options_get_bool(machine->options(), OPTION_ROR) || (options_get_bool(machine->options(), OPTION_AUTOROR) && (machine->gamedrv->flags & ORIENTATION_SWAP_XY)))
|
||||
target->base_orientation = orientation_add(ROT90, target->base_orientation);
|
||||
if (options_get_bool(mame_options(), OPTION_ROL) || (options_get_bool(mame_options(), OPTION_AUTOROL) && (machine->gamedrv->flags & ORIENTATION_SWAP_XY)))
|
||||
if (options_get_bool(machine->options(), OPTION_ROL) || (options_get_bool(machine->options(), OPTION_AUTOROL) && (machine->gamedrv->flags & ORIENTATION_SWAP_XY)))
|
||||
target->base_orientation = orientation_add(ROT270, target->base_orientation);
|
||||
|
||||
/* flip X/Y */
|
||||
if (options_get_bool(mame_options(), OPTION_FLIPX))
|
||||
if (options_get_bool(machine->options(), OPTION_FLIPX))
|
||||
target->base_orientation ^= ORIENTATION_FLIP_X;
|
||||
if (options_get_bool(mame_options(), OPTION_FLIPY))
|
||||
if (options_get_bool(machine->options(), OPTION_FLIPY))
|
||||
target->base_orientation ^= ORIENTATION_FLIP_Y;
|
||||
|
||||
/* set the orientation and layerconfig equal to the base */
|
||||
@ -1559,7 +1559,7 @@ const render_primitive_list *render_target_get_primitives(render_target *target)
|
||||
root_xform.no_center = FALSE;
|
||||
|
||||
/* iterate over layers back-to-front, but only if we're running */
|
||||
if (mame_get_phase(target->machine) >= MAME_PHASE_RESET)
|
||||
if (target->machine->phase() >= MACHINE_PHASE_RESET)
|
||||
for (layernum = 0; layernum < ITEM_LAYER_MAX; layernum++)
|
||||
{
|
||||
int blendmode;
|
||||
@ -1601,7 +1601,7 @@ const render_primitive_list *render_target_get_primitives(render_target *target)
|
||||
state = output_get_value(item->output_name);
|
||||
else if (item->input_tag[0] != 0)
|
||||
{
|
||||
const input_field_config *field = input_field_by_tag_and_mask(target->machine->portlist, item->input_tag, item->input_mask);
|
||||
const input_field_config *field = input_field_by_tag_and_mask(target->machine->m_portlist, item->input_tag, item->input_mask);
|
||||
if (field != NULL)
|
||||
state = ((input_port_read_safe(target->machine, item->input_tag, 0) ^ field->defvalue) & item->input_mask) ? 1 : 0;
|
||||
}
|
||||
@ -1801,7 +1801,7 @@ static int load_layout_files(render_target *target, const char *layoutfile, int
|
||||
running_machine *machine = target->machine;
|
||||
const game_driver *gamedrv = machine->gamedrv;
|
||||
const machine_config *config = machine->config;
|
||||
const char *basename = machine->basename;
|
||||
const char *basename = machine->basename();
|
||||
layout_file **nextfile = &target->filelist;
|
||||
const game_driver *cloneof;
|
||||
|
||||
|
@ -74,7 +74,7 @@ struct _romload_private
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void rom_exit(running_machine *machine);
|
||||
static void rom_exit(running_machine &machine);
|
||||
|
||||
|
||||
|
||||
@ -334,7 +334,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 = options_get_string(mame_options(), OPTION_BIOS);
|
||||
const char *specbios = options_get_string(romdata->machine->options(), OPTION_BIOS);
|
||||
const char *defaultname = NULL;
|
||||
const rom_entry *rom;
|
||||
int default_no = 1;
|
||||
@ -582,15 +582,6 @@ static void display_rom_load_results(rom_load_data *romdata)
|
||||
/* if we had errors, they are fatal */
|
||||
if (romdata->errors != 0)
|
||||
{
|
||||
const char *rgntag, *nextrgntag;
|
||||
|
||||
/* clean up any regions */
|
||||
for (rgntag = memory_region_next(romdata->machine, NULL); rgntag != NULL; rgntag = nextrgntag)
|
||||
{
|
||||
nextrgntag = memory_region_next(romdata->machine, rgntag);
|
||||
memory_region_free(romdata->machine, rgntag);
|
||||
}
|
||||
|
||||
/* 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.");
|
||||
@ -612,29 +603,30 @@ static void display_rom_load_results(rom_load_data *romdata)
|
||||
|
||||
static void region_post_process(rom_load_data *romdata, const char *rgntag)
|
||||
{
|
||||
UINT32 regionlength = memory_region_length(romdata->machine, rgntag);
|
||||
UINT32 regionflags = memory_region_flags(romdata->machine, rgntag);
|
||||
UINT8 *regionbase = memory_region(romdata->machine, rgntag);
|
||||
int endianness = ((regionflags & ROMREGION_ENDIANMASK) == ROMREGION_LE) ? ENDIANNESS_LITTLE : ENDIANNESS_BIG;
|
||||
int datawidth = 1 << ((regionflags & ROMREGION_WIDTHMASK) >> 8);
|
||||
const region_info *region = romdata->machine->region(rgntag);
|
||||
UINT8 *base;
|
||||
int i, j;
|
||||
|
||||
LOG(("+ datawidth=%d little=%d\n", datawidth, endianness == ENDIANNESS_LITTLE));
|
||||
// do nothing if no region
|
||||
if (region == NULL)
|
||||
return;
|
||||
|
||||
LOG(("+ datawidth=%d little=%d\n", region->width(), region->endianness() == ENDIANNESS_LITTLE));
|
||||
|
||||
/* if the region is inverted, do that now */
|
||||
if (regionflags & ROMREGION_INVERTMASK)
|
||||
if (region->invert())
|
||||
{
|
||||
LOG(("+ Inverting region\n"));
|
||||
for (i = 0, base = regionbase; i < regionlength; i++)
|
||||
for (i = 0, base = region->base(); i < region->bytes(); i++)
|
||||
*base++ ^= 0xff;
|
||||
}
|
||||
|
||||
/* swap the endianness if we need to */
|
||||
if (datawidth > 1 && endianness != ENDIANNESS_NATIVE)
|
||||
if (region->width() > 1 && region->endianness() != ENDIANNESS_NATIVE)
|
||||
{
|
||||
LOG(("+ Byte swapping region\n"));
|
||||
for (i = 0, base = regionbase; i < regionlength; i += datawidth)
|
||||
int datawidth = region->width();
|
||||
for (i = 0, base = region->base(); i < region->bytes(); i += datawidth)
|
||||
{
|
||||
UINT8 temp[8];
|
||||
memcpy(temp, base, datawidth);
|
||||
@ -732,7 +724,7 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp)
|
||||
int skip = ROM_GETSKIPCOUNT(romp);
|
||||
int reversed = ROM_ISREVERSED(romp);
|
||||
int numgroups = (numbytes + groupsize - 1) / groupsize;
|
||||
UINT8 *base = romdata->region->base.u8 + ROM_GETOFFSET(romp);
|
||||
UINT8 *base = romdata->region->base() + ROM_GETOFFSET(romp);
|
||||
UINT32 tempbufsize;
|
||||
UINT8 *tempbuf;
|
||||
int i;
|
||||
@ -744,7 +736,7 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp)
|
||||
fatalerror("Error in RomModule definition: %s length not an even multiple of group size\n", ROM_GETNAME(romp));
|
||||
|
||||
/* make sure we only fill within the region space */
|
||||
if (ROM_GETOFFSET(romp) + numgroups * groupsize + (numgroups - 1) * skip > romdata->region->length)
|
||||
if (ROM_GETOFFSET(romp) + numgroups * groupsize + (numgroups - 1) * skip > romdata->region->bytes())
|
||||
fatalerror("Error in RomModule definition: %s out of memory region space\n", ROM_GETNAME(romp));
|
||||
|
||||
/* make sure the length was valid */
|
||||
@ -846,10 +838,10 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp)
|
||||
static void fill_rom_data(rom_load_data *romdata, const rom_entry *romp)
|
||||
{
|
||||
UINT32 numbytes = ROM_GETLENGTH(romp);
|
||||
UINT8 *base = romdata->region->base.u8 + ROM_GETOFFSET(romp);
|
||||
UINT8 *base = romdata->region->base() + ROM_GETOFFSET(romp);
|
||||
|
||||
/* make sure we fill within the region space */
|
||||
if (ROM_GETOFFSET(romp) + numbytes > romdata->region->length)
|
||||
if (ROM_GETOFFSET(romp) + numbytes > romdata->region->bytes())
|
||||
fatalerror("Error in RomModule definition: FILL out of memory region space\n");
|
||||
|
||||
/* make sure the length was valid */
|
||||
@ -867,14 +859,13 @@ static void fill_rom_data(rom_load_data *romdata, const rom_entry *romp)
|
||||
|
||||
static void copy_rom_data(rom_load_data *romdata, const rom_entry *romp)
|
||||
{
|
||||
UINT8 *base = romdata->region->base.u8 + ROM_GETOFFSET(romp);
|
||||
UINT8 *base = romdata->region->base() + ROM_GETOFFSET(romp);
|
||||
const char *srcrgntag = ROM_GETNAME(romp);
|
||||
UINT32 numbytes = ROM_GETLENGTH(romp);
|
||||
UINT32 srcoffs = (FPTR)ROM_GETHASHDATA(romp); /* srcoffset in place of hashdata */
|
||||
UINT8 *srcbase;
|
||||
|
||||
/* make sure we copy within the region space */
|
||||
if (ROM_GETOFFSET(romp) + numbytes > romdata->region->length)
|
||||
if (ROM_GETOFFSET(romp) + numbytes > romdata->region->bytes())
|
||||
fatalerror("Error in RomModule definition: COPY out of target memory region space\n");
|
||||
|
||||
/* make sure the length was valid */
|
||||
@ -882,16 +873,16 @@ 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 */
|
||||
srcbase = memory_region(romdata->machine, srcrgntag);
|
||||
if (srcbase == NULL)
|
||||
const region_info *region = romdata->machine->region(srcrgntag);
|
||||
if (region == NULL)
|
||||
fatalerror("Error in RomModule definition: COPY from an invalid region\n");
|
||||
|
||||
/* make sure we find within the region space */
|
||||
if (srcoffs + numbytes > memory_region_length(romdata->machine, srcrgntag))
|
||||
if (srcoffs + numbytes > region->bytes())
|
||||
fatalerror("Error in RomModule definition: COPY out of source memory region space\n");
|
||||
|
||||
/* fill the data */
|
||||
memcpy(base, srcbase + srcoffs, numbytes);
|
||||
memcpy(base, region->base() + srcoffs, numbytes);
|
||||
}
|
||||
|
||||
|
||||
@ -1275,16 +1266,14 @@ static UINT32 normalize_flags_for_device(running_machine *machine, UINT32 startf
|
||||
|
||||
void load_software_part_region(running_device *device, char *swlist, char *swname, rom_entry *start_region)
|
||||
{
|
||||
astring *regiontag = astring_alloc();
|
||||
astring *locationtag = astring_alloc();
|
||||
const rom_entry *region;
|
||||
astring locationtag(swlist, PATH_SEPARATOR, swname);
|
||||
rom_load_data *romdata = device->machine->romload_data;
|
||||
const rom_entry *region;
|
||||
astring regiontag;
|
||||
|
||||
/* Make sure we are passed a device */
|
||||
assert(device!=NULL);
|
||||
|
||||
astring_assemble_3( locationtag, swlist, PATH_SEPARATOR, swname );
|
||||
|
||||
romdata->errorstring.reset();
|
||||
|
||||
/* loop until we hit the end */
|
||||
@ -1293,52 +1282,51 @@ void load_software_part_region(running_device *device, char *swlist, char *swnam
|
||||
UINT32 regionlength = ROMREGION_GETLENGTH(region);
|
||||
UINT32 regionflags = ROMREGION_GETFLAGS(region);
|
||||
|
||||
astring_assemble_3( regiontag, device->tag(), ":", ROMREGION_GETTAG(region) );
|
||||
LOG(("Processing region \"%s\" (length=%X)\n", astring_c(regiontag), regionlength));
|
||||
device->subtag(regiontag, ROMREGION_GETTAG(region));
|
||||
LOG(("Processing region \"%s\" (length=%X)\n", regiontag.cstr(), regionlength));
|
||||
|
||||
/* the first entry must be a region */
|
||||
assert(ROMENTRY_ISREGION(region));
|
||||
|
||||
/* if this is a device region, override with the device width and endianness */
|
||||
if (devtag_get_device(romdata->machine, astring_c(regiontag)) != NULL)
|
||||
regionflags = normalize_flags_for_device(romdata->machine, regionflags, astring_c(regiontag));
|
||||
const region_info *memregion = romdata->machine->region(regiontag);
|
||||
if (memregion != NULL)
|
||||
{
|
||||
regionflags = normalize_flags_for_device(romdata->machine, regionflags, regiontag);
|
||||
|
||||
/* clear old region (todo: should be moved to an image unload function) */
|
||||
if (memory_region(romdata->machine, astring_c(regiontag)) != NULL)
|
||||
memory_region_free(romdata->machine, astring_c(regiontag));
|
||||
/* clear old region (todo: should be moved to an image unload function) */
|
||||
romdata->machine->region_free(memregion->name());
|
||||
}
|
||||
|
||||
/* remember the base and length */
|
||||
romdata->region = memory_region_alloc(romdata->machine, astring_c(regiontag), regionlength, regionflags);
|
||||
LOG(("Allocated %X bytes @ %p\n", romdata->region->length, romdata->region->base.v));
|
||||
romdata->region = romdata->machine->region_alloc(regiontag, regionlength, regionflags);
|
||||
LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base()));
|
||||
|
||||
/* clear the region if it's requested */
|
||||
if (ROMREGION_ISERASE(region))
|
||||
memset(romdata->region->base.v, ROMREGION_GETERASEVAL(region), romdata->region->length);
|
||||
memset(romdata->region->base(), ROMREGION_GETERASEVAL(region), romdata->region->bytes());
|
||||
|
||||
/* or if it's sufficiently small (<= 4MB) */
|
||||
else if (romdata->region->length <= 0x400000)
|
||||
memset(romdata->region->base.v, 0, romdata->region->length);
|
||||
else if (romdata->region->bytes() <= 0x400000)
|
||||
memset(romdata->region->base(), 0, romdata->region->bytes());
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
/* if we're debugging, fill region with random data to catch errors */
|
||||
else
|
||||
fill_random(romdata->machine, romdata->region->base.u8, romdata->region->length);
|
||||
fill_random(romdata->machine, romdata->region->base(), romdata->region->bytes());
|
||||
#endif
|
||||
|
||||
/* now process the entries in the region */
|
||||
if (ROMREGION_ISROMDATA(region))
|
||||
process_rom_entries(romdata, astring_c(locationtag), region + 1);
|
||||
process_rom_entries(romdata, locationtag, region + 1);
|
||||
else if (ROMREGION_ISDISKDATA(region))
|
||||
process_disk_entries(romdata, astring_c(locationtag), region + 1);
|
||||
process_disk_entries(romdata, locationtag, region + 1);
|
||||
}
|
||||
|
||||
/* now go back and post-process all the regions */
|
||||
for (region = start_region; region != NULL; region = rom_next_region(region))
|
||||
region_post_process(romdata, ROMREGION_GETTAG(region));
|
||||
|
||||
astring_free(regiontag);
|
||||
astring_free(locationtag);
|
||||
|
||||
/* display the results and exit */
|
||||
display_rom_load_results(romdata);
|
||||
}
|
||||
@ -1374,21 +1362,21 @@ static void process_region_list(rom_load_data *romdata)
|
||||
regionflags = normalize_flags_for_device(romdata->machine, regionflags, regiontag);
|
||||
|
||||
/* remember the base and length */
|
||||
romdata->region = memory_region_alloc(romdata->machine, regiontag, regionlength, regionflags);
|
||||
LOG(("Allocated %X bytes @ %p\n", romdata->region->length, romdata->region->base.v));
|
||||
romdata->region = romdata->machine->region_alloc(regiontag, regionlength, regionflags);
|
||||
LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base()));
|
||||
|
||||
/* clear the region if it's requested */
|
||||
if (ROMREGION_ISERASE(region))
|
||||
memset(romdata->region->base.v, ROMREGION_GETERASEVAL(region), romdata->region->length);
|
||||
memset(romdata->region->base(), ROMREGION_GETERASEVAL(region), romdata->region->bytes());
|
||||
|
||||
/* or if it's sufficiently small (<= 4MB) */
|
||||
else if (romdata->region->length <= 0x400000)
|
||||
memset(romdata->region->base.v, 0, romdata->region->length);
|
||||
else if (romdata->region->bytes() <= 0x400000)
|
||||
memset(romdata->region->base(), 0, romdata->region->bytes());
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
/* if we're debugging, fill region with random data to catch errors */
|
||||
else
|
||||
fill_random(romdata->machine, romdata->region->base.u8, romdata->region->length);
|
||||
fill_random(romdata->machine, romdata->region->base(), romdata->region->bytes());
|
||||
#endif
|
||||
|
||||
/* now process the entries in the region */
|
||||
@ -1418,7 +1406,7 @@ void rom_init(running_machine *machine)
|
||||
machine->romload_data = romdata = auto_alloc_clear(machine, romload_private);
|
||||
|
||||
/* make sure we get called back on the way out */
|
||||
add_exit_callback(machine, rom_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, rom_exit);
|
||||
|
||||
/* reset the romdata struct */
|
||||
romdata->machine = machine;
|
||||
@ -1445,20 +1433,12 @@ void rom_init(running_machine *machine)
|
||||
rom_exit - clean up after ourselves
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void rom_exit(running_machine *machine)
|
||||
static void rom_exit(running_machine &machine)
|
||||
{
|
||||
const char *rgntag, *nextrgntag;
|
||||
open_chd *curchd;
|
||||
|
||||
/* free the memory allocated for various regions */
|
||||
for (rgntag = memory_region_next(machine, NULL); rgntag != NULL; rgntag = nextrgntag)
|
||||
{
|
||||
nextrgntag = memory_region_next(machine, rgntag);
|
||||
memory_region_free(machine, rgntag);
|
||||
}
|
||||
|
||||
/* close all hard drives */
|
||||
for (curchd = machine->romload_data->chd_list; curchd != NULL; curchd = curchd->next)
|
||||
for (curchd = machine.romload_data->chd_list; curchd != NULL; curchd = curchd->next)
|
||||
{
|
||||
if (curchd->diffchd != NULL)
|
||||
chd_close(curchd->diffchd);
|
||||
|
@ -53,9 +53,9 @@
|
||||
|
||||
// these must be macros because we are included before the running_machine
|
||||
#define cpuexec_describe_context(mach) (mach)->describe_context()
|
||||
#define cpuexec_boost_interleave(mach, slice, dur) (mach)->scheduler.boost_interleave(slice, dur)
|
||||
#define cpuexec_trigger(mach, trigid) (mach)->scheduler.trigger(trigid)
|
||||
#define cpuexec_triggertime(mach, trigid, dur) (mach)->scheduler.trigger(trigid, dur)
|
||||
#define cpuexec_boost_interleave(mach, slice, dur) (mach)->scheduler().boost_interleave(slice, dur)
|
||||
#define cpuexec_trigger(mach, trigid) (mach)->scheduler().trigger(trigid)
|
||||
#define cpuexec_triggertime(mach, trigid, dur) (mach)->scheduler().trigger(trigid, dur)
|
||||
|
||||
|
||||
|
||||
|
@ -1031,7 +1031,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( mame_options(), swlist_name, FALSE, NULL );
|
||||
software_list_ptr = software_list_open( image->device().machine->options(), swlist_name, FALSE, NULL );
|
||||
|
||||
if ( software_list_ptr )
|
||||
{
|
||||
@ -1057,7 +1057,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( mame_options(), swlist_name, FALSE, NULL );
|
||||
software_list_ptr = software_list_open( image->device().machine->options(), swlist_name, FALSE, NULL );
|
||||
|
||||
if ( software_list_ptr )
|
||||
{
|
||||
@ -1083,7 +1083,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( mame_options(), swlist_name, FALSE, NULL );
|
||||
software_list_ptr = software_list_open( image->device().machine->options(), swlist_name, FALSE, NULL );
|
||||
|
||||
if ( software_list_ptr )
|
||||
{
|
||||
@ -1336,7 +1336,7 @@ struct _software_entry_state
|
||||
/* populate a specific list */
|
||||
static void ui_mess_menu_populate_software_entries(running_machine *machine, ui_menu *menu, char *list_name)
|
||||
{
|
||||
software_list *list = software_list_open(mame_options(), list_name, FALSE, NULL);
|
||||
software_list *list = software_list_open(machine->options(), list_name, FALSE, NULL);
|
||||
|
||||
if (list)
|
||||
{
|
||||
@ -1407,7 +1407,7 @@ static void ui_mess_menu_populate_software_list(running_machine *machine, ui_men
|
||||
{
|
||||
if (swlist->list_name[i])
|
||||
{
|
||||
software_list *list = software_list_open(mame_options(), swlist->list_name[i], FALSE, NULL);
|
||||
software_list *list = software_list_open(machine->options(), swlist->list_name[i], FALSE, NULL);
|
||||
|
||||
if (list)
|
||||
{
|
||||
|
@ -66,9 +66,10 @@ struct _sound_private
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void sound_reset(running_machine *machine);
|
||||
static void sound_exit(running_machine *machine);
|
||||
static void sound_pause(running_machine *machine, int pause);
|
||||
static void sound_reset(running_machine &machine);
|
||||
static void sound_exit(running_machine &machine);
|
||||
static void sound_pause(running_machine &machine);
|
||||
static void sound_resume(running_machine &machine);
|
||||
static void sound_load(running_machine *machine, int config_type, xml_data_node *parentnode);
|
||||
static void sound_save(running_machine *machine, int config_type, xml_data_node *parentnode);
|
||||
static TIMER_CALLBACK( sound_update );
|
||||
@ -120,7 +121,7 @@ void sound_init(running_machine *machine)
|
||||
machine->sound_data = global = auto_alloc_clear(machine, sound_private);
|
||||
|
||||
/* handle -nosound */
|
||||
global->nosound_mode = !options_get_bool(mame_options(), OPTION_SOUND);
|
||||
global->nosound_mode = !options_get_bool(machine->options(), OPTION_SOUND);
|
||||
if (global->nosound_mode)
|
||||
machine->sample_rate = 11025;
|
||||
|
||||
@ -141,20 +142,21 @@ void sound_init(running_machine *machine)
|
||||
route_sound(machine);
|
||||
|
||||
/* open the output WAV file if specified */
|
||||
filename = options_get_string(mame_options(), OPTION_WAVWRITE);
|
||||
filename = options_get_string(machine->options(), OPTION_WAVWRITE);
|
||||
if (filename[0] != 0)
|
||||
global->wavfile = wav_open(filename, machine->sample_rate, 2);
|
||||
|
||||
/* enable sound by default */
|
||||
global->enabled = TRUE;
|
||||
global->muted = FALSE;
|
||||
sound_set_attenuation(machine, options_get_int(mame_options(), OPTION_VOLUME));
|
||||
sound_set_attenuation(machine, options_get_int(machine->options(), OPTION_VOLUME));
|
||||
|
||||
/* register callbacks */
|
||||
config_register(machine, "mixer", sound_load, sound_save);
|
||||
add_pause_callback(machine, sound_pause);
|
||||
add_reset_callback(machine, sound_reset);
|
||||
add_exit_callback(machine, sound_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_PAUSE, sound_pause);
|
||||
machine->add_notifier(MACHINE_NOTIFY_RESUME, sound_resume);
|
||||
machine->add_notifier(MACHINE_NOTIFY_RESET, sound_reset);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, sound_exit);
|
||||
}
|
||||
|
||||
|
||||
@ -162,9 +164,9 @@ void sound_init(running_machine *machine)
|
||||
sound_exit - clean up after ourselves
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void sound_exit(running_machine *machine)
|
||||
static void sound_exit(running_machine &machine)
|
||||
{
|
||||
sound_private *global = machine->sound_data;
|
||||
sound_private *global = machine.sound_data;
|
||||
|
||||
/* close any open WAV file */
|
||||
if (global->wavfile != NULL)
|
||||
@ -228,12 +230,12 @@ static void route_sound(running_machine *machine)
|
||||
sound_reset - reset all sound chips
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void sound_reset(running_machine *machine)
|
||||
static void sound_reset(running_machine &machine)
|
||||
{
|
||||
device_sound_interface *sound = NULL;
|
||||
|
||||
/* reset all the sound chips */
|
||||
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))
|
||||
sound->device().reset();
|
||||
}
|
||||
|
||||
@ -242,14 +244,17 @@ static void sound_reset(running_machine *machine)
|
||||
sound_pause - pause sound output
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void sound_pause(running_machine *machine, int pause)
|
||||
static void sound_pause(running_machine &machine)
|
||||
{
|
||||
sound_private *global = machine->sound_data;
|
||||
sound_private *global = machine.sound_data;
|
||||
global->muted |= 0x02;
|
||||
osd_set_mastervolume(global->muted ? -32 : global->attenuation);
|
||||
}
|
||||
|
||||
if (pause)
|
||||
global->muted |= 0x02;
|
||||
else
|
||||
global->muted &= ~0x02;
|
||||
static void sound_resume(running_machine &machine)
|
||||
{
|
||||
sound_private *global = machine.sound_data;
|
||||
global->muted &= ~0x02;
|
||||
osd_set_mastervolume(global->muted ? -32 : global->attenuation);
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ static DISCRETE_RESET(dss_adjustment)
|
||||
|
||||
double min, max;
|
||||
|
||||
context->port = node->info->device->machine->portlist.find((const char *)node->custom);
|
||||
context->port = node->info->device->machine->m_portlist.find((const char *)node->custom);
|
||||
if (context->port == NULL)
|
||||
fatalerror("DISCRETE_ADJUSTMENT - NODE_%d has invalid tag", NODE_BLOCKINDEX(node));
|
||||
|
||||
|
@ -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.u8 + base);
|
||||
memory_set_bankptr(&m_machine, tag(), m_region->base() + base);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ loaded_samples *readsamples(running_machine *machine, const char *const *samplen
|
||||
int i;
|
||||
|
||||
/* if the user doesn't want to use samples, bail */
|
||||
if (!options_get_bool(mame_options(), OPTION_SAMPLES))
|
||||
if (!options_get_bool(machine->options(), OPTION_SAMPLES))
|
||||
return NULL;
|
||||
if (samplenames == 0 || samplenames[0] == 0)
|
||||
return NULL;
|
||||
|
@ -136,7 +136,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 void tilemap_exit(running_machine *machine);
|
||||
static void tilemap_exit(running_machine &machine);
|
||||
static STATE_POSTLOAD( tilemap_postload );
|
||||
static void tilemap_dispose(tilemap_t *tmap);
|
||||
|
||||
@ -297,7 +297,7 @@ void tilemap_init(running_machine *machine)
|
||||
if (screen_width != 0 && screen_height != 0)
|
||||
{
|
||||
machine->priority_bitmap = auto_bitmap_alloc(machine, screen_width, screen_height, BITMAP_FORMAT_INDEXED8);
|
||||
add_exit_callback(machine, tilemap_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, tilemap_exit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1119,9 +1119,9 @@ TILEMAP_MAPPER( tilemap_scan_cols_flip_xy )
|
||||
tilemap system
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void tilemap_exit(running_machine *machine)
|
||||
static void tilemap_exit(running_machine &machine)
|
||||
{
|
||||
tilemap_private *tilemap_data = machine->tilemap_data;
|
||||
tilemap_private *tilemap_data = machine.tilemap_data;
|
||||
|
||||
/* free all the tilemaps in the list */
|
||||
if (tilemap_data != NULL)
|
||||
|
@ -123,7 +123,7 @@ INLINE attotime get_current_time(running_machine *machine)
|
||||
|
||||
/* if we're executing as a particular CPU, use its local time as a base */
|
||||
/* otherwise, return the global base time */
|
||||
device_execute_interface *execdevice = machine->scheduler.currently_executing();
|
||||
device_execute_interface *execdevice = machine->scheduler().currently_executing();
|
||||
return (execdevice != NULL) ? execdevice->local_time() : global->exec.basetime;
|
||||
}
|
||||
|
||||
@ -704,7 +704,7 @@ void timer_adjust_periodic(emu_timer *which, attotime start_delay, INT32 param,
|
||||
/* if this was inserted as the head, abort the current timeslice and resync */
|
||||
LOG(("timer_adjust_oneshot %s.%s:%d to expire @ %s\n", which->file, which->func, which->line, attotime_string(which->expire, 9)));
|
||||
if (which == global->activelist)
|
||||
which->machine->scheduler.abort_timeslice();
|
||||
which->machine->scheduler().abort_timeslice();
|
||||
}
|
||||
|
||||
|
||||
|
68
src/emu/ui.c
68
src/emu/ui.c
@ -126,7 +126,7 @@ static UINT8 non_char_keys_down[(ARRAY_LENGTH(non_char_keys) + 7) / 8];
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void ui_exit(running_machine *machine);
|
||||
static void ui_exit(running_machine &machine);
|
||||
|
||||
/* text generators */
|
||||
static astring &disclaimer_string(running_machine *machine, astring &buffer);
|
||||
@ -237,7 +237,7 @@ INLINE int is_breakable_char(unicode_char ch)
|
||||
int ui_init(running_machine *machine)
|
||||
{
|
||||
/* make sure we clean up after ourselves */
|
||||
add_exit_callback(machine, ui_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_exit);
|
||||
|
||||
/* allocate the font and messagebox string */
|
||||
ui_font = render_font_alloc("ui.bdf");
|
||||
@ -250,7 +250,7 @@ int ui_init(running_machine *machine)
|
||||
single_step = FALSE;
|
||||
ui_set_handler(handler_messagebox, 0);
|
||||
/* retrieve options */
|
||||
ui_use_natural_keyboard = options_get_bool(mame_options(), OPTION_NATURAL_KEYBOARD);
|
||||
ui_use_natural_keyboard = options_get_bool(machine->options(), OPTION_NATURAL_KEYBOARD);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -260,7 +260,7 @@ int ui_init(running_machine *machine)
|
||||
ui_exit - clean up ourselves on exit
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void ui_exit(running_machine *machine)
|
||||
static void ui_exit(running_machine &machine)
|
||||
{
|
||||
/* free the font */
|
||||
if (ui_font != NULL)
|
||||
@ -277,8 +277,8 @@ static void ui_exit(running_machine *machine)
|
||||
int ui_display_startup_screens(running_machine *machine, int first_time, int show_disclaimer)
|
||||
{
|
||||
const int maxstate = 3;
|
||||
int str = options_get_int(mame_options(), OPTION_SECONDS_TO_RUN);
|
||||
int show_gameinfo = !options_get_bool(mame_options(), OPTION_SKIP_GAMEINFO);
|
||||
int str = options_get_int(machine->options(), OPTION_SECONDS_TO_RUN);
|
||||
int show_gameinfo = !options_get_bool(machine->options(), OPTION_SKIP_GAMEINFO);
|
||||
int show_warnings = TRUE;
|
||||
int state;
|
||||
|
||||
@ -292,7 +292,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 && !mame_is_scheduled_event_pending(machine) && !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;
|
||||
@ -327,7 +327,7 @@ 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 && !mame_is_scheduled_event_pending(machine) && !ui_menu_is_force_game_select())
|
||||
while (ui_handler_callback != handler_ingame && !machine->scheduled_event_pending() && !ui_menu_is_force_game_select())
|
||||
video_frame_update(machine, FALSE);
|
||||
|
||||
/* clear the handler and force an update */
|
||||
@ -377,9 +377,9 @@ void ui_update_and_render(running_machine *machine, render_container *container)
|
||||
render_container_empty(container);
|
||||
|
||||
/* if we're paused, dim the whole screen */
|
||||
if (mame_get_phase(machine) >= MAME_PHASE_RESET && (single_step || mame_is_paused(machine)))
|
||||
if (machine->phase() >= MACHINE_PHASE_RESET && (single_step || machine->paused()))
|
||||
{
|
||||
int alpha = (1.0f - options_get_float(mame_options(), OPTION_PAUSE_BRIGHTNESS)) * 255.0f;
|
||||
int alpha = (1.0f - options_get_float(machine->options(), OPTION_PAUSE_BRIGHTNESS)) * 255.0f;
|
||||
if (ui_menu_is_force_game_select())
|
||||
alpha = 255;
|
||||
if (alpha > 255)
|
||||
@ -1139,7 +1139,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))
|
||||
{
|
||||
mame_schedule_exit(machine);
|
||||
machine->schedule_exit();
|
||||
state = UI_HANDLER_CANCEL;
|
||||
}
|
||||
|
||||
@ -1161,7 +1161,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))
|
||||
{
|
||||
mame_schedule_exit(machine);
|
||||
machine->schedule_exit();
|
||||
state = UI_HANDLER_CANCEL;
|
||||
}
|
||||
|
||||
@ -1270,7 +1270,7 @@ void ui_image_handler_ingame(running_machine *machine)
|
||||
device_image_interface *image = NULL;
|
||||
|
||||
/* run display routine for devices */
|
||||
if (mame_get_phase(machine) == MAME_PHASE_RUNNING)
|
||||
if (machine->phase() == MACHINE_PHASE_RUNNING)
|
||||
{
|
||||
for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
|
||||
{
|
||||
@ -1287,7 +1287,7 @@ void ui_image_handler_ingame(running_machine *machine)
|
||||
|
||||
static UINT32 handler_ingame(running_machine *machine, render_container *container, UINT32 state)
|
||||
{
|
||||
int is_paused = mame_is_paused(machine);
|
||||
bool is_paused = machine->paused();
|
||||
|
||||
/* first draw the FPS counter */
|
||||
if (showfps || osd_ticks() < showfps_end)
|
||||
@ -1309,7 +1309,7 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain
|
||||
/* if we're single-stepping, pause now */
|
||||
if (single_step)
|
||||
{
|
||||
mame_pause(machine, TRUE);
|
||||
machine->pause();
|
||||
single_step = FALSE;
|
||||
}
|
||||
|
||||
@ -1350,7 +1350,7 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain
|
||||
}
|
||||
|
||||
/* is the natural keyboard enabled? */
|
||||
if (ui_get_use_natural_keyboard(machine) && (mame_get_phase(machine) == MAME_PHASE_RUNNING))
|
||||
if (ui_get_use_natural_keyboard(machine) && (machine->phase() == MACHINE_PHASE_RUNNING))
|
||||
process_natural_keyboard(machine);
|
||||
|
||||
if (!ui_disabled)
|
||||
@ -1366,7 +1366,7 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain
|
||||
|
||||
/* if the user pressed ESC, stop the emulation (except in MESS with newui, where ESC toggles the menubar) */
|
||||
if (ui_input_pressed(machine, IPT_UI_CANCEL) && !ui_use_newui())
|
||||
mame_schedule_exit(machine);
|
||||
machine->schedule_exit();
|
||||
|
||||
/* turn on menus if requested */
|
||||
if (ui_input_pressed(machine, IPT_UI_CONFIGURE) && !ui_use_newui())
|
||||
@ -1378,29 +1378,29 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain
|
||||
|
||||
/* handle a reset request */
|
||||
if (ui_input_pressed(machine, IPT_UI_RESET_MACHINE))
|
||||
mame_schedule_hard_reset(machine);
|
||||
machine->schedule_hard_reset();
|
||||
if (ui_input_pressed(machine, IPT_UI_SOFT_RESET))
|
||||
mame_schedule_soft_reset(machine);
|
||||
machine->schedule_soft_reset();
|
||||
|
||||
/* handle a request to display graphics/palette */
|
||||
if (ui_input_pressed(machine, IPT_UI_SHOW_GFX))
|
||||
{
|
||||
if (!is_paused)
|
||||
mame_pause(machine, TRUE);
|
||||
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))
|
||||
{
|
||||
mame_pause(machine, TRUE);
|
||||
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))
|
||||
{
|
||||
mame_pause(machine, TRUE);
|
||||
machine->pause();
|
||||
return ui_set_handler(handler_load_save, LOADSAVE_LOAD);
|
||||
}
|
||||
|
||||
@ -1415,10 +1415,12 @@ 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;
|
||||
mame_pause(machine, FALSE);
|
||||
machine->resume();
|
||||
}
|
||||
else if (machine->paused())
|
||||
machine->resume();
|
||||
else
|
||||
mame_pause(machine, !mame_is_paused(machine));
|
||||
machine->pause();
|
||||
}
|
||||
|
||||
/* handle a toggle cheats request */
|
||||
@ -1522,7 +1524,7 @@ static UINT32 handler_load_save(running_machine *machine, render_container *cont
|
||||
popmessage("Load cancelled");
|
||||
|
||||
/* reset the state */
|
||||
mame_pause(machine, FALSE);
|
||||
machine->resume();
|
||||
return UI_HANDLER_CANCEL;
|
||||
}
|
||||
|
||||
@ -1546,16 +1548,16 @@ static UINT32 handler_load_save(running_machine *machine, render_container *cont
|
||||
if (state == LOADSAVE_SAVE)
|
||||
{
|
||||
popmessage("Save to position %c", file);
|
||||
mame_schedule_save(machine, filename);
|
||||
machine->schedule_save(filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
popmessage("Load from position %c", file);
|
||||
mame_schedule_load(machine, filename);
|
||||
machine->schedule_load(filename);
|
||||
}
|
||||
|
||||
/* remove the pause and reset the state */
|
||||
mame_pause(machine, FALSE);
|
||||
machine->resume();
|
||||
return UI_HANDLER_CANCEL;
|
||||
}
|
||||
|
||||
@ -1631,7 +1633,7 @@ static slider_state *slider_init(running_machine *machine)
|
||||
}
|
||||
|
||||
/* add analog adjusters */
|
||||
for (port = machine->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)
|
||||
{
|
||||
@ -1641,7 +1643,7 @@ static slider_state *slider_init(running_machine *machine)
|
||||
}
|
||||
|
||||
/* add CPU overclocking (cheat only) */
|
||||
if (options_get_bool(mame_options(), OPTION_CHEAT))
|
||||
if (options_get_bool(machine->options(), OPTION_CHEAT))
|
||||
{
|
||||
for (device = machine->firstcpu; device != NULL; device = cpu_next(device))
|
||||
{
|
||||
@ -1662,7 +1664,7 @@ static slider_state *slider_init(running_machine *machine)
|
||||
void *param = (void *)screen;
|
||||
|
||||
/* add refresh rate tweaker */
|
||||
if (options_get_bool(mame_options(), OPTION_CHEAT))
|
||||
if (options_get_bool(machine->options(), OPTION_CHEAT))
|
||||
{
|
||||
string.printf("%s Refresh Rate", slider_get_screen_desc(*screen));
|
||||
*tailptr = slider_alloc(machine, string, -10000, 0, 10000, 1000, slider_refresh, param);
|
||||
@ -1735,7 +1737,7 @@ static slider_state *slider_init(running_machine *machine)
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
/* add crosshair adjusters */
|
||||
for (port = machine->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)
|
||||
{
|
||||
@ -2219,6 +2221,6 @@ int ui_get_use_natural_keyboard(running_machine *machine)
|
||||
void ui_set_use_natural_keyboard(running_machine *machine, int use_natural_keyboard)
|
||||
{
|
||||
ui_use_natural_keyboard = use_natural_keyboard;
|
||||
options_set_bool(mame_options(), OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE);
|
||||
options_set_bool(machine->options(), OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE);
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ static ui_gfx_state ui_gfx;
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void ui_gfx_exit(running_machine *machine);
|
||||
static void ui_gfx_exit(running_machine &machine);
|
||||
|
||||
/* palette handling */
|
||||
static void palette_handle_keys(running_machine *machine, ui_gfx_state *state);
|
||||
@ -109,7 +109,7 @@ void ui_gfx_init(running_machine *machine)
|
||||
int gfx;
|
||||
|
||||
/* make sure we clean up after ourselves */
|
||||
add_exit_callback(machine, ui_gfx_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_gfx_exit);
|
||||
|
||||
/* initialize our global state */
|
||||
memset(state, 0, sizeof(*state));
|
||||
@ -133,7 +133,7 @@ void ui_gfx_init(running_machine *machine)
|
||||
ui_gfx_exit - clean up after ourselves
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void ui_gfx_exit(running_machine *machine)
|
||||
static void ui_gfx_exit(running_machine &machine)
|
||||
{
|
||||
/* free the texture */
|
||||
if (ui_gfx.texture != NULL)
|
||||
@ -159,7 +159,7 @@ UINT32 ui_gfx_ui_handler(running_machine *machine, render_container *container,
|
||||
goto cancel;
|
||||
|
||||
/* if we're not paused, mark the bitmap dirty */
|
||||
if (!mame_is_paused(machine))
|
||||
if (!machine->paused())
|
||||
state->bitmap_dirty = TRUE;
|
||||
|
||||
/* switch off the state to display something */
|
||||
@ -208,7 +208,12 @@ again:
|
||||
}
|
||||
|
||||
if (ui_input_pressed(machine, IPT_UI_PAUSE))
|
||||
mame_pause(machine, !mame_is_paused(machine));
|
||||
{
|
||||
if (machine->paused())
|
||||
machine->resume();
|
||||
else
|
||||
machine->pause();
|
||||
}
|
||||
|
||||
if (ui_input_pressed(machine, IPT_UI_CANCEL) || ui_input_pressed(machine, IPT_UI_SHOW_GFX))
|
||||
goto cancel;
|
||||
@ -217,7 +222,7 @@ again:
|
||||
|
||||
cancel:
|
||||
if (!uistate)
|
||||
mame_pause(machine, FALSE);
|
||||
machine->resume();
|
||||
state->bitmap_dirty = TRUE;
|
||||
return UI_HANDLER_CANCEL;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ void ui_input_init(running_machine *machine)
|
||||
machine->ui_input_data->current_mouse_y = -1;
|
||||
|
||||
/* add a frame callback to poll inputs */
|
||||
add_frame_callback(machine, ui_input_frame_update);
|
||||
machine->add_notifier(MACHINE_NOTIFY_FRAME, ui_input_frame_update);
|
||||
}
|
||||
|
||||
|
||||
@ -95,15 +95,15 @@ void ui_input_init(running_machine *machine)
|
||||
corresponding IPT_UI_* events
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_input_frame_update(running_machine *machine)
|
||||
void ui_input_frame_update(running_machine &machine)
|
||||
{
|
||||
ui_input_private *uidata = machine->ui_input_data;
|
||||
ui_input_private *uidata = machine.ui_input_data;
|
||||
int code;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ void ui_input_init(running_machine *machine);
|
||||
|
||||
/* ----- event handling ----- */
|
||||
|
||||
void ui_input_frame_update(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);
|
||||
|
@ -247,7 +247,7 @@ static const char exittext[] = "Exit";
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void ui_menu_exit(running_machine *machine);
|
||||
static void ui_menu_exit(running_machine &machine);
|
||||
|
||||
/* internal menu processing */
|
||||
static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly);
|
||||
@ -401,7 +401,7 @@ void ui_menu_init(running_machine *machine)
|
||||
arrow_texture = render_texture_alloc(menu_render_triangle, NULL);
|
||||
|
||||
/* add an exit callback to free memory */
|
||||
add_exit_callback(machine, ui_menu_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_menu_exit);
|
||||
}
|
||||
|
||||
|
||||
@ -409,11 +409,11 @@ void ui_menu_init(running_machine *machine)
|
||||
ui_menu_exit - clean up after ourselves
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void ui_menu_exit(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 */
|
||||
render_texture_free(hilight_texture);
|
||||
@ -1230,7 +1230,12 @@ 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))
|
||||
mame_pause(menu->machine, !mame_is_paused(menu->machine));
|
||||
{
|
||||
if (menu->machine->paused())
|
||||
menu->machine->resume();
|
||||
else
|
||||
menu->machine->pause();
|
||||
}
|
||||
|
||||
/* handle a toggle cheats request */
|
||||
if (ui_input_pressed_repeat(menu->machine, IPT_UI_TOGGLE_CHEAT, 0))
|
||||
@ -1398,7 +1403,7 @@ UINT32 ui_slider_ui_handler(running_machine *machine, render_container *containe
|
||||
|
||||
void ui_menu_force_game_select(running_machine *machine, render_container *container)
|
||||
{
|
||||
char *gamename = (char *)options_get_string(mame_options(), OPTION_GAMENAME);
|
||||
char *gamename = (char *)options_get_string(machine->options(), OPTION_GAMENAME);
|
||||
|
||||
/* reset the menu stack */
|
||||
ui_menu_stack_reset(machine);
|
||||
@ -1411,7 +1416,7 @@ void ui_menu_force_game_select(running_machine *machine, render_container *conta
|
||||
ui_show_menu();
|
||||
|
||||
/* make sure MAME is paused */
|
||||
mame_pause(machine, TRUE);
|
||||
machine->pause();
|
||||
}
|
||||
|
||||
|
||||
@ -1498,7 +1503,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->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)
|
||||
@ -1563,7 +1568,7 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st
|
||||
ui_menu_item_append(menu, "Crosshair Options", NULL, 0, (void *)menu_crosshair);
|
||||
|
||||
/* add cheat menu */
|
||||
if (options_get_bool(mame_options(), OPTION_CHEAT) && cheat_get_next_menu_entry(machine, NULL, NULL, NULL, NULL) != NULL)
|
||||
if (options_get_bool(machine->options(), OPTION_CHEAT) && cheat_get_next_menu_entry(machine, NULL, NULL, NULL, NULL) != NULL)
|
||||
ui_menu_item_append(menu, "Cheat", NULL, 0, (void *)menu_cheat);
|
||||
|
||||
/* add memory card menu */
|
||||
@ -1712,7 +1717,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->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);
|
||||
@ -2066,7 +2071,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->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))
|
||||
{
|
||||
@ -2320,7 +2325,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->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))
|
||||
{
|
||||
@ -2674,7 +2679,7 @@ 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;
|
||||
|
||||
@ -3278,7 +3283,7 @@ static void menu_crosshair_populate(running_machine *machine, ui_menu *menu)
|
||||
/* search for crosshair graphics */
|
||||
|
||||
/* open a path to the crosshairs */
|
||||
path = mame_openpath(mame_options(), OPTION_CROSSHAIRPATH);
|
||||
path = mame_openpath(machine->options(), OPTION_CROSSHAIRPATH);
|
||||
if (path != NULL)
|
||||
{
|
||||
const osd_directory_entry *dir;
|
||||
@ -3387,7 +3392,7 @@ 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)
|
||||
{
|
||||
/* request a reset */
|
||||
mame_schedule_exit(machine);
|
||||
machine->schedule_exit();
|
||||
|
||||
/* reset the menu stack */
|
||||
ui_menu_stack_reset(machine);
|
||||
@ -3445,7 +3450,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(mame_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);
|
||||
@ -3453,7 +3458,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)
|
||||
{
|
||||
mame_schedule_new_driver(machine, driver);
|
||||
machine->schedule_new_driver(*driver);
|
||||
ui_menu_stack_reset(machine);
|
||||
}
|
||||
|
||||
@ -3598,7 +3603,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 */
|
||||
path = mame_openpath(mame_options(), OPTION_ROMPATH);
|
||||
path = mame_openpath(menu->machine->options(), OPTION_ROMPATH);
|
||||
if (path != NULL)
|
||||
{
|
||||
const osd_directory_entry *dir;
|
||||
|
@ -162,7 +162,7 @@ static const UINT8 skiptable[FRAMESKIP_LEVELS][FRAMESKIP_LEVELS] =
|
||||
***************************************************************************/
|
||||
|
||||
/* core implementation */
|
||||
static void video_exit(running_machine *machine);
|
||||
static void video_exit(running_machine &machine);
|
||||
static void init_buffered_spriteram(running_machine *machine);
|
||||
|
||||
/* global rendering */
|
||||
@ -202,7 +202,7 @@ static void rgb888_draw_primitives(const render_primitive *primlist, void *dstda
|
||||
INLINE int effective_autoframeskip(running_machine *machine)
|
||||
{
|
||||
/* if we're fast forwarding or paused, autoframeskip is disabled */
|
||||
if (global.fastforward || mame_is_paused(machine))
|
||||
if (global.fastforward || machine->paused())
|
||||
return FALSE;
|
||||
|
||||
/* otherwise, it's up to the user */
|
||||
@ -236,7 +236,7 @@ INLINE int effective_frameskip(void)
|
||||
INLINE int effective_throttle(running_machine *machine)
|
||||
{
|
||||
/* if we're paused, or if the UI is active, we always throttle */
|
||||
if (mame_is_paused(machine) || ui_is_menu_active())
|
||||
if (machine->paused() || ui_is_menu_active())
|
||||
return TRUE;
|
||||
|
||||
/* if we're fast forwarding, we don't throttle */
|
||||
@ -278,7 +278,7 @@ void video_init(running_machine *machine)
|
||||
assert(machine->config != NULL);
|
||||
|
||||
/* request a callback upon exiting */
|
||||
add_exit_callback(machine, video_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, video_exit);
|
||||
|
||||
/* reset our global state */
|
||||
memset(&global, 0, sizeof(global));
|
||||
@ -287,10 +287,10 @@ void video_init(running_machine *machine)
|
||||
/* extract initial execution state from global configuration settings */
|
||||
global.speed = original_speed_setting();
|
||||
update_refresh_speed(machine);
|
||||
global.throttle = options_get_bool(mame_options(), OPTION_THROTTLE);
|
||||
global.auto_frameskip = options_get_bool(mame_options(), OPTION_AUTOFRAMESKIP);
|
||||
global.frameskip_level = options_get_int(mame_options(), OPTION_FRAMESKIP);
|
||||
global.seconds_to_run = options_get_int(mame_options(), OPTION_SECONDS_TO_RUN);
|
||||
global.throttle = options_get_bool(machine->options(), OPTION_THROTTLE);
|
||||
global.auto_frameskip = options_get_bool(machine->options(), OPTION_AUTOFRAMESKIP);
|
||||
global.frameskip_level = options_get_int(machine->options(), OPTION_FRAMESKIP);
|
||||
global.seconds_to_run = options_get_int(machine->options(), OPTION_SECONDS_TO_RUN);
|
||||
|
||||
/* create spriteram buffers if necessary */
|
||||
if (machine->config->m_video_attributes & VIDEO_BUFFERS_SPRITERAM)
|
||||
@ -301,7 +301,7 @@ void video_init(running_machine *machine)
|
||||
(*machine->config->m_init_palette)(machine, memory_region(machine, "proms"));
|
||||
|
||||
/* create a render target for snapshots */
|
||||
viewname = options_get_string(mame_options(), OPTION_SNAPVIEW);
|
||||
viewname = options_get_string(machine->options(), OPTION_SNAPVIEW);
|
||||
global.snap_native = (machine->primary_screen != NULL && (viewname[0] == 0 || strcmp(viewname, "native") == 0));
|
||||
|
||||
/* the native target is hard-coded to our internal layout and has all options disabled */
|
||||
@ -322,15 +322,15 @@ void video_init(running_machine *machine)
|
||||
}
|
||||
|
||||
/* extract snap resolution if present */
|
||||
if (sscanf(options_get_string(mame_options(), OPTION_SNAPSIZE), "%dx%d", &global.snap_width, &global.snap_height) != 2)
|
||||
if (sscanf(options_get_string(machine->options(), OPTION_SNAPSIZE), "%dx%d", &global.snap_width, &global.snap_height) != 2)
|
||||
global.snap_width = global.snap_height = 0;
|
||||
|
||||
/* start recording movie if specified */
|
||||
filename = options_get_string(mame_options(), OPTION_MNGWRITE);
|
||||
filename = options_get_string(machine->options(), OPTION_MNGWRITE);
|
||||
if (filename[0] != 0)
|
||||
video_mng_begin_recording(machine, filename);
|
||||
|
||||
filename = options_get_string(mame_options(), OPTION_AVIWRITE);
|
||||
filename = options_get_string(machine->options(), OPTION_AVIWRITE);
|
||||
if (filename[0] != 0)
|
||||
video_avi_begin_recording(machine, filename);
|
||||
|
||||
@ -347,21 +347,17 @@ void video_init(running_machine *machine)
|
||||
video_exit - close down the video system
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void video_exit(running_machine *machine)
|
||||
static void video_exit(running_machine &machine)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* validate */
|
||||
assert(machine != NULL);
|
||||
assert(machine->config != NULL);
|
||||
|
||||
/* stop recording any movie */
|
||||
video_mng_end_recording(machine);
|
||||
video_avi_end_recording(machine);
|
||||
video_mng_end_recording(&machine);
|
||||
video_avi_end_recording(&machine);
|
||||
|
||||
/* free all the graphics elements */
|
||||
for (i = 0; i < MAX_GFX_ELEMENTS; i++)
|
||||
gfx_element_free(machine->gfx[i]);
|
||||
gfx_element_free(machine.gfx[i]);
|
||||
|
||||
/* free the snapshot target */
|
||||
if (global.snap_target != NULL)
|
||||
@ -434,14 +430,14 @@ void video_frame_update(running_machine *machine, int debug)
|
||||
{
|
||||
attotime current_time = timer_get_time(machine);
|
||||
int skipped_it = global.skipping_this_frame;
|
||||
int phase = mame_get_phase(machine);
|
||||
int phase = machine->phase();
|
||||
|
||||
/* validate */
|
||||
assert(machine != NULL);
|
||||
assert(machine->config != NULL);
|
||||
|
||||
/* only render sound and video if we're in the running phase */
|
||||
if (phase == MAME_PHASE_RUNNING && (!mame_is_paused(machine) || options_get_bool(mame_options(), OPTION_UPDATEINPAUSE)))
|
||||
if (phase == MACHINE_PHASE_RUNNING && (!machine->paused() || options_get_bool(machine->options(), OPTION_UPDATEINPAUSE)))
|
||||
{
|
||||
int anything_changed = finish_screen_updates(machine);
|
||||
|
||||
@ -471,7 +467,7 @@ void video_frame_update(running_machine *machine, int debug)
|
||||
|
||||
/* perform tasks for this frame */
|
||||
if (!debug)
|
||||
mame_frame_update(machine);
|
||||
machine->call_notifiers(MACHINE_NOTIFY_FRAME);
|
||||
|
||||
/* update frameskipping */
|
||||
if (!debug)
|
||||
@ -482,10 +478,10 @@ void video_frame_update(running_machine *machine, int debug)
|
||||
recompute_speed(machine, current_time);
|
||||
|
||||
/* call the end-of-frame callback */
|
||||
if (phase == MAME_PHASE_RUNNING)
|
||||
if (phase == MACHINE_PHASE_RUNNING)
|
||||
{
|
||||
/* reset partial updates if we're paused or if the debugger is active */
|
||||
if (machine->primary_screen != NULL && (mame_is_paused(machine) || debug || debugger_within_instruction_hook(machine)))
|
||||
if (machine->primary_screen != NULL && (machine->paused() || debug || debugger_within_instruction_hook(machine)))
|
||||
machine->primary_screen->scanline0_callback();
|
||||
|
||||
/* otherwise, call the video EOF callback */
|
||||
@ -518,7 +514,7 @@ static int finish_screen_updates(running_machine *machine)
|
||||
anything_changed = true;
|
||||
|
||||
/* update our movie recording and burn-in state */
|
||||
if (!mame_is_paused(machine))
|
||||
if (!machine->paused())
|
||||
{
|
||||
video_mng_record_frame(machine);
|
||||
video_avi_record_frame(machine);
|
||||
@ -581,7 +577,7 @@ void video_set_speed_factor(int speed)
|
||||
|
||||
const char *video_get_speed_text(running_machine *machine)
|
||||
{
|
||||
int paused = mame_is_paused(machine);
|
||||
bool paused = machine->paused();
|
||||
static char buffer[1024];
|
||||
char *dest = buffer;
|
||||
|
||||
@ -787,7 +783,7 @@ static void update_throttle(running_machine *machine, attotime emutime)
|
||||
and explicitly reset our tracked real and emulated timers to that value ...
|
||||
this means we pretend that the last update was exactly 1/60th of a second
|
||||
ago, and was in sync in both real and emulated time */
|
||||
if (mame_is_paused(machine))
|
||||
if (machine->paused())
|
||||
{
|
||||
global.throttle_emutime = attotime_sub_attoseconds(emutime, ATTOSECONDS_PER_SECOND / PAUSED_REFRESH_RATE);
|
||||
global.throttle_realtime = global.throttle_emutime;
|
||||
@ -880,9 +876,9 @@ static osd_ticks_t throttle_until_ticks(running_machine *machine, osd_ticks_t ta
|
||||
|
||||
/* we're allowed to sleep via the OSD code only if we're configured to do so
|
||||
and we're not frameskipping due to autoframeskip, or if we're paused */
|
||||
if (options_get_bool(mame_options(), OPTION_SLEEP) && (!effective_autoframeskip(machine) || effective_frameskip() == 0))
|
||||
if (options_get_bool(machine->options(), OPTION_SLEEP) && (!effective_autoframeskip(machine) || effective_frameskip() == 0))
|
||||
allowed_to_sleep = TRUE;
|
||||
if (mame_is_paused(machine))
|
||||
if (machine->paused())
|
||||
allowed_to_sleep = TRUE;
|
||||
|
||||
/* loop until we reach our target */
|
||||
@ -989,7 +985,7 @@ static void update_frameskip(running_machine *machine)
|
||||
static void update_refresh_speed(running_machine *machine)
|
||||
{
|
||||
/* only do this if the refreshspeed option is used */
|
||||
if (options_get_bool(mame_options(), OPTION_REFRESHSPEED))
|
||||
if (options_get_bool(machine->options(), OPTION_REFRESHSPEED))
|
||||
{
|
||||
float minrefresh = render_get_max_update_rate();
|
||||
if (minrefresh != 0)
|
||||
@ -1035,7 +1031,7 @@ static void recompute_speed(running_machine *machine, attotime emutime)
|
||||
attoseconds_t delta_emutime;
|
||||
|
||||
/* if we don't have a starting time yet, or if we're paused, reset our starting point */
|
||||
if (global.speed_last_realtime == 0 || mame_is_paused(machine))
|
||||
if (global.speed_last_realtime == 0 || machine->paused())
|
||||
{
|
||||
global.speed_last_realtime = osd_ticks();
|
||||
global.speed_last_emutime = emutime;
|
||||
@ -1080,7 +1076,7 @@ static void recompute_speed(running_machine *machine, attotime emutime)
|
||||
{
|
||||
if (machine->primary_screen != NULL)
|
||||
{
|
||||
astring fname(machine->basename, PATH_SEPARATOR "final.png");
|
||||
astring fname(machine->basename(), PATH_SEPARATOR "final.png");
|
||||
file_error filerr;
|
||||
mame_file *file;
|
||||
|
||||
@ -1094,7 +1090,7 @@ static void recompute_speed(running_machine *machine, attotime emutime)
|
||||
}
|
||||
|
||||
/* schedule our demise */
|
||||
mame_schedule_exit(machine);
|
||||
machine->schedule_exit();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1232,7 +1228,7 @@ static void create_snapshot_bitmap(device_t *screen)
|
||||
|
||||
static file_error mame_fopen_next(running_machine *machine, const char *pathoption, const char *extension, mame_file **file)
|
||||
{
|
||||
const char *snapname = options_get_string(mame_options(), OPTION_SNAPNAME);
|
||||
const char *snapname = options_get_string(machine->options(), OPTION_SNAPNAME);
|
||||
file_error filerr;
|
||||
astring snapstr;
|
||||
astring fname;
|
||||
@ -1251,7 +1247,7 @@ static file_error mame_fopen_next(running_machine *machine, const char *pathopti
|
||||
|
||||
/* substitute path and gamename up front */
|
||||
snapstr.replace(0, "/", PATH_SEPARATOR);
|
||||
snapstr.replace(0, "%g", machine->basename);
|
||||
snapstr.replace(0, "%g", machine->basename());
|
||||
|
||||
/* determine if the template has an index; if not, we always use the same name */
|
||||
if (snapstr.find(0, "%i") == -1)
|
||||
@ -1896,10 +1892,10 @@ void screen_device::device_start()
|
||||
timer_adjust_oneshot(m_scanline_timer, time_until_pos(0), 0);
|
||||
|
||||
// create burn-in bitmap
|
||||
if (options_get_int(mame_options(), OPTION_BURNIN) > 0)
|
||||
if (options_get_int(machine->options(), OPTION_BURNIN) > 0)
|
||||
{
|
||||
int width, height;
|
||||
if (sscanf(options_get_string(mame_options(), OPTION_SNAPSIZE), "%dx%d", &width, &height) != 2 || width == 0 || height == 0)
|
||||
if (sscanf(options_get_string(machine->options(), OPTION_SNAPSIZE), "%dx%d", &width, &height) != 2 || width == 0 || height == 0)
|
||||
width = height = 300;
|
||||
m_burnin = auto_alloc(machine, bitmap_t(width, height, BITMAP_FORMAT_INDEXED64));
|
||||
if (m_burnin == NULL)
|
||||
@ -2523,7 +2519,7 @@ void screen_device::finalize_burnin()
|
||||
|
||||
// compute the name and create the file
|
||||
astring fname;
|
||||
fname.printf("%s" PATH_SEPARATOR "burnin-%s.png", machine->basename, tag());
|
||||
fname.printf("%s" PATH_SEPARATOR "burnin-%s.png", machine->basename(), tag());
|
||||
mame_file *file;
|
||||
file_error filerr = mame_fopen(SEARCHPATH_SCREENSHOT, fname, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
|
||||
if (filerr == FILERR_NONE)
|
||||
|
@ -178,10 +178,10 @@ float vector_get_beam(void)
|
||||
|
||||
VIDEO_START( vector )
|
||||
{
|
||||
beam_width = options_get_float(mame_options(), OPTION_BEAM);
|
||||
beam_width = options_get_float(machine->options(), OPTION_BEAM);
|
||||
|
||||
/* Grab the settings for this session */
|
||||
vector_set_flicker(options_get_float(mame_options(), OPTION_FLICKER));
|
||||
vector_set_flicker(options_get_float(machine->options(), OPTION_FLICKER));
|
||||
|
||||
vector_index = 0;
|
||||
|
||||
@ -259,7 +259,7 @@ void vector_clear_list (void)
|
||||
|
||||
VIDEO_UPDATE( vector )
|
||||
{
|
||||
UINT32 flags = PRIMFLAG_ANTIALIAS(options_get_bool(mame_options(), OPTION_ANTIALIAS) ? 1 : 0) | PRIMFLAG_BLENDMODE(BLENDMODE_ADD);
|
||||
UINT32 flags = PRIMFLAG_ANTIALIAS(options_get_bool(screen->machine->options(), OPTION_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));
|
||||
|
@ -27,7 +27,7 @@ static emu_timer *watchdog_timer;
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void watchdog_internal_reset(running_machine *machine);
|
||||
static void watchdog_internal_reset(running_machine &machine);
|
||||
static TIMER_CALLBACK( watchdog_callback );
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ void watchdog_init(running_machine *machine)
|
||||
/* allocate a timer for the watchdog */
|
||||
watchdog_timer = timer_alloc(machine, watchdog_callback, NULL);
|
||||
|
||||
add_reset_callback(machine, watchdog_internal_reset);
|
||||
machine->add_notifier(MACHINE_NOTIFY_RESET, watchdog_internal_reset);
|
||||
|
||||
/* save some stuff in the default tag */
|
||||
state_save_register_item(machine, "watchdog", NULL, 0, watchdog_enabled);
|
||||
@ -54,11 +54,11 @@ void watchdog_init(running_machine *machine)
|
||||
system
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void watchdog_internal_reset(running_machine *machine)
|
||||
static void watchdog_internal_reset(running_machine &machine)
|
||||
{
|
||||
/* set up the watchdog timer; only start off enabled if explicitly configured */
|
||||
watchdog_enabled = (machine->config->m_watchdog_vblank_count != 0 || attotime_compare(machine->config->m_watchdog_time, attotime_zero) != 0);
|
||||
watchdog_reset(machine);
|
||||
watchdog_enabled = (machine.m_config.m_watchdog_vblank_count != 0 || attotime_compare(machine.m_config.m_watchdog_time, attotime_zero) != 0);
|
||||
watchdog_reset(&machine);
|
||||
watchdog_enabled = TRUE;
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ static TIMER_CALLBACK( watchdog_callback )
|
||||
popmessage("Reset caused by the watchdog!!!\n");
|
||||
#endif
|
||||
|
||||
mame_schedule_soft_reset(machine);
|
||||
machine->schedule_soft_reset();
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ static void (*execute_command)(running_device *laserdisc, int command);
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void free_string(running_machine *machine)
|
||||
static void free_string(running_machine &machine)
|
||||
{
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ static chd_file *get_disc(running_device *device)
|
||||
mame_path *path;
|
||||
|
||||
/* open a path to the ROMs and find the first CHD file */
|
||||
path = mame_openpath(mame_options(), OPTION_ROMPATH);
|
||||
path = mame_openpath(device->machine->options(), OPTION_ROMPATH);
|
||||
if (path != NULL)
|
||||
{
|
||||
const osd_directory_entry *dir;
|
||||
@ -124,7 +124,7 @@ static chd_file *get_disc(running_device *device)
|
||||
{
|
||||
set_disk_handle(device->machine, "laserdisc", image_file, image_chd);
|
||||
filename.cpy(dir->name);
|
||||
add_exit_callback(device->machine, free_string);
|
||||
device->machine->add_notifier(MACHINE_NOTIFY_EXIT, free_string);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ static INTERRUPT_GEN( timer_irq )
|
||||
watchdog_cnt++;
|
||||
if ( watchdog_cnt > 2 ) // this is a hack, i don't know what the watchdog timeout is, 3 IRQ's works fine
|
||||
{ // reset board
|
||||
mame_schedule_soft_reset(device->machine);// reset entire machine. CPU 0 should be enough, but that doesn't seem to work !!
|
||||
device->machine->schedule_soft_reset();// reset entire machine. CPU 0 should be enough, but that doesn't seem to work !!
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ static INTERRUPT_GEN( timer_irq )
|
||||
watchdog_cnt++;
|
||||
if ( watchdog_cnt > 2 ) // this is a hack, i don't know what the watchdog timeout is, 3 IRQ's works fine
|
||||
{ // reset board
|
||||
mame_schedule_soft_reset(device->machine); // reset entire machine. CPU 0 should be enough, but that doesn't seem to work !!
|
||||
device->machine->schedule_soft_reset(); // reset entire machine. CPU 0 should be enough, but that doesn't seem to work !!
|
||||
on_scorpion2_reset(device->machine);
|
||||
return;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ static VIDEO_EOF( champbas )
|
||||
state->watchdog_count++;
|
||||
|
||||
if (state->watchdog_count == 0x10)
|
||||
mame_schedule_soft_reset(machine);
|
||||
machine->schedule_soft_reset();
|
||||
}
|
||||
|
||||
|
||||
|
@ -151,7 +151,7 @@ static WRITE8_HANDLER( mux_select_w )
|
||||
|
||||
static UINT8 joystick_read(running_device *device)
|
||||
{
|
||||
if (mame_get_phase(device->machine) != MAME_PHASE_RUNNING)
|
||||
if (device->machine->phase() != MACHINE_PHASE_RUNNING)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
|
@ -2269,7 +2269,7 @@ static const struct WD33C93interface scsi_intf =
|
||||
NULL /* command completion IRQ */
|
||||
};
|
||||
|
||||
static void cps3_exit(running_machine *machine)
|
||||
static void cps3_exit(running_machine &machine)
|
||||
{
|
||||
wd33c93_exit(&scsi_intf);
|
||||
}
|
||||
@ -2277,7 +2277,7 @@ static void cps3_exit(running_machine *machine)
|
||||
static MACHINE_START( cps3 )
|
||||
{
|
||||
wd33c93_init(machine, &scsi_intf);
|
||||
add_exit_callback(machine, cps3_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, cps3_exit);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( cps3 )
|
||||
|
@ -864,7 +864,7 @@ static void atapi_clear_irq(running_machine *machine)
|
||||
cputag_set_input_line(machine, "maincpu", INPUT_LINE_IRQ4, CLEAR_LINE);
|
||||
}
|
||||
|
||||
static void atapi_exit(running_machine* machine)
|
||||
static void atapi_exit(running_machine& machine)
|
||||
{
|
||||
SCSIDeleteInstance(atapi_device_data[1]);
|
||||
SCSIDeleteInstance(atapi_device_data[0]);
|
||||
@ -886,7 +886,7 @@ static void atapi_init(running_machine *machine)
|
||||
SCSIAllocInstance( machine, SCSI_DEVICE_CDROM, &atapi_device_data[0], "scsi0" );
|
||||
// TODO: the slave drive can be either CD-ROM, DVD-ROM or HDD
|
||||
SCSIAllocInstance( machine, SCSI_DEVICE_CDROM, &atapi_device_data[1], "scsi1" );
|
||||
add_exit_callback(machine, atapi_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, atapi_exit);
|
||||
}
|
||||
|
||||
static void atapi_reset(void)
|
||||
|
@ -2658,7 +2658,7 @@ static DRIVER_INIT( gmgalax )
|
||||
memory_configure_bank(machine, "bank1", 0, 2, memory_region(machine, "maincpu") + 0x10000, 0x4000);
|
||||
|
||||
/* callback when the game select is toggled */
|
||||
gmgalax_game_changed(machine->portlist.first()->fieldlist, NULL, 0, 0);
|
||||
gmgalax_game_changed(machine->m_portlist.first()->fieldlist, NULL, 0, 0);
|
||||
state_save_register_global(machine, gmgalax_selected_game);
|
||||
}
|
||||
|
||||
|
@ -3715,10 +3715,10 @@ static void init_ds3(running_machine *machine)
|
||||
|
||||
/* if we have a sound DSP, boot it */
|
||||
if (state->soundcpu != NULL && cpu_get_type(state->soundcpu) == CPU_ADSP2105)
|
||||
adsp2105_load_boot_data(state->soundcpu->region()->base.u8 + 0x10000, state->soundcpu->region()->base.u32);
|
||||
adsp2105_load_boot_data(state->soundcpu->region()->base() + 0x10000, &state->soundcpu->region()->u32());
|
||||
|
||||
if (state->sounddsp != NULL && cpu_get_type(state->sounddsp) == CPU_ADSP2105)
|
||||
adsp2105_load_boot_data(state->sounddsp->region()->base.u8 + 0x10000, state->sounddsp->region()->base.u32);
|
||||
adsp2105_load_boot_data(state->sounddsp->region()->base() + 0x10000, &state->sounddsp->region()->u32());
|
||||
|
||||
/*
|
||||
|
||||
|
@ -552,8 +552,8 @@ static WRITE32_HANDLER( hng64_pal_w )
|
||||
|
||||
static READ32_HANDLER( hng64_sysregs_r )
|
||||
{
|
||||
mame_system_time systime;
|
||||
mame_get_base_datetime(space->machine, &systime);
|
||||
system_time systime;
|
||||
space->machine->base_datetime(systime);
|
||||
|
||||
// if((offset*4) != 0x1084)
|
||||
// printf("HNG64 port read (PC=%08x) 0x%08x\n", cpu_get_pc(space->cpu),offset*4);
|
||||
|
@ -333,7 +333,7 @@ static DRIVER_INIT( konamigq )
|
||||
m_p_n_pcmram = memory_region( machine, "shared" ) + 0x80000;
|
||||
}
|
||||
|
||||
static void konamigq_exit(running_machine *machine)
|
||||
static void konamigq_exit(running_machine &machine)
|
||||
{
|
||||
am53cf96_exit(&scsi_intf);
|
||||
}
|
||||
@ -342,7 +342,7 @@ static MACHINE_START( konamigq )
|
||||
{
|
||||
/* init the scsi controller and hook up it's DMA */
|
||||
am53cf96_init(machine, &scsi_intf);
|
||||
add_exit_callback(machine, konamigq_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, konamigq_exit);
|
||||
psx_dma_install_read_handler(5, scsi_dma_read);
|
||||
psx_dma_install_write_handler(5, scsi_dma_write);
|
||||
|
||||
|
@ -280,7 +280,7 @@ static const struct AM53CF96interface scsi_intf =
|
||||
&scsi_irq, /* command completion IRQ */
|
||||
};
|
||||
|
||||
static void konamigv_exit(running_machine *machine)
|
||||
static void konamigv_exit(running_machine &machine)
|
||||
{
|
||||
am53cf96_exit(&scsi_intf);
|
||||
}
|
||||
@ -291,7 +291,7 @@ static DRIVER_INIT( konamigv )
|
||||
|
||||
/* init the scsi controller and hook up it's DMA */
|
||||
am53cf96_init(machine, &scsi_intf);
|
||||
add_exit_callback(machine, konamigv_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, konamigv_exit);
|
||||
psx_dma_install_read_handler(5, scsi_dma_read);
|
||||
psx_dma_install_write_handler(5, scsi_dma_write);
|
||||
}
|
||||
|
@ -963,13 +963,13 @@ static WRITE32_HANDLER( atapi_w )
|
||||
}
|
||||
}
|
||||
|
||||
static void atapi_exit(running_machine* machine)
|
||||
static void atapi_exit(running_machine& machine)
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < 2; i++ )
|
||||
{
|
||||
if( get_disk_handle( machine, diskregions[i] ) != NULL )
|
||||
if( get_disk_handle( &machine, diskregions[i] ) != NULL )
|
||||
{
|
||||
SCSIDeleteInstance( available_cdroms[ i ] );
|
||||
}
|
||||
@ -1006,7 +1006,7 @@ static void atapi_init(running_machine *machine)
|
||||
available_cdroms[ i ] = NULL;
|
||||
}
|
||||
}
|
||||
add_exit_callback(machine, atapi_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, atapi_exit);
|
||||
|
||||
atapi_data = auto_alloc_array(machine, UINT8, ATAPI_DATA_SIZE );
|
||||
|
||||
|
@ -423,8 +423,8 @@ static WRITE8_HANDLER( palette_w )
|
||||
// Oki M62X428 is a 4-bit RTC, doesn't seem to be millennium bug proof ...
|
||||
static READ8_HANDLER( rtc_r )
|
||||
{
|
||||
mame_system_time systime;
|
||||
mame_get_base_datetime(space->machine, &systime);
|
||||
system_time systime;
|
||||
space->machine->base_datetime(systime);
|
||||
|
||||
switch(offset)
|
||||
{
|
||||
|
@ -1171,7 +1171,7 @@ static const read32_space_func speedup_handlers[] =
|
||||
};
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
static void report_speedups(running_machine *machine)
|
||||
static void report_speedups(running_machine &machine)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1193,7 +1193,7 @@ static void install_speedups(running_machine *machine, const speedup_entry *entr
|
||||
memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), entries[i].offset, entries[i].offset + 3, 0, 0, speedup_handlers[i]);
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
add_exit_callback(machine, report_speedups);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, report_speedups);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -521,13 +521,13 @@ static UINT8 binary_to_BCD(UINT8 data)
|
||||
|
||||
static READ8_HANDLER(meritm_ds1644_r)
|
||||
{
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
int rambank = (meritm_psd_a15 >> 2) & 0x3;
|
||||
if (rambank == 3)
|
||||
{
|
||||
//logerror( "Reading RTC, reg = %x\n", offset);
|
||||
|
||||
mame_get_current_datetime(space->machine, &systime);
|
||||
space->machine->current_datetime(systime);
|
||||
meritm_ram[0x7ff9] = binary_to_BCD(systime.local_time.second);
|
||||
meritm_ram[0x7ffa] = binary_to_BCD(systime.local_time.minute);
|
||||
meritm_ram[0x7ffb] = binary_to_BCD(systime.local_time.hour);
|
||||
|
@ -1195,7 +1195,7 @@ static const struct LSI53C810interface scsi_intf =
|
||||
&scsi_fetch,
|
||||
};
|
||||
|
||||
static void model3_exit(running_machine *machine)
|
||||
static void model3_exit(running_machine &machine)
|
||||
{
|
||||
lsi53c810_exit(&scsi_intf);
|
||||
}
|
||||
@ -1212,13 +1212,13 @@ static void configure_fast_ram(running_machine *machine)
|
||||
static MACHINE_START(model3_10)
|
||||
{
|
||||
lsi53c810_init(machine, &scsi_intf);
|
||||
add_exit_callback(machine, model3_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, model3_exit);
|
||||
configure_fast_ram(machine);
|
||||
}
|
||||
static MACHINE_START(model3_15)
|
||||
{
|
||||
lsi53c810_init(machine, &scsi_intf);
|
||||
add_exit_callback(machine, model3_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, model3_exit);
|
||||
configure_fast_ram(machine);
|
||||
}
|
||||
static MACHINE_START(model3_20)
|
||||
|
@ -320,9 +320,9 @@ INLINE UINT8 make_bcd(UINT8 data)
|
||||
|
||||
static READ8_HANDLER(multfish_rtc_r)
|
||||
{
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
|
||||
mame_get_current_datetime(space->machine, &systime);
|
||||
space->machine->current_datetime(systime);
|
||||
switch (offset)
|
||||
{
|
||||
case 0:
|
||||
|
@ -1329,10 +1329,10 @@ INLINE UINT8 make_bcd(UINT8 data)
|
||||
static READ8_HANDLER( s12_mcu_rtc_r )
|
||||
{
|
||||
UINT8 ret = 0;
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
static const int weekday[7] = { 7, 1, 2, 3, 4, 5, 6 };
|
||||
|
||||
mame_get_current_datetime(space->machine, &systime);
|
||||
space->machine->current_datetime(systime);
|
||||
|
||||
switch (s12_rtcstate)
|
||||
{
|
||||
|
@ -2396,10 +2396,10 @@ INLINE UINT8 make_bcd(UINT8 data)
|
||||
static READ8_HANDLER( s23_mcu_rtc_r )
|
||||
{
|
||||
UINT8 ret = 0;
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
static const int weekday[7] = { 7, 1, 2, 3, 4, 5, 6 };
|
||||
|
||||
mame_get_current_datetime(space->machine, &systime);
|
||||
space->machine->current_datetime(systime);
|
||||
|
||||
switch (s23_rtcstate)
|
||||
{
|
||||
|
@ -55,9 +55,9 @@ static WRITE16_HANDLER( calendar_w )
|
||||
|
||||
static READ16_HANDLER( calendar_r )
|
||||
{
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
|
||||
mame_get_base_datetime(space->machine, &systime);
|
||||
space->machine->base_datetime(systime);
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
|
@ -501,7 +501,7 @@ static WRITE16_HANDLER( pgm_calendar_w )
|
||||
{
|
||||
pgm_state *state = (pgm_state *)space->machine->driver_data;
|
||||
|
||||
mame_get_base_datetime(space->machine, &state->systime);
|
||||
space->machine->base_datetime(state->systime);
|
||||
|
||||
state->cal_com <<= 1;
|
||||
state->cal_com |= data & 1;
|
||||
@ -552,7 +552,7 @@ static WRITE16_HANDLER( pgm_calendar_w )
|
||||
break;
|
||||
|
||||
case 0xf: //Load Date
|
||||
mame_get_base_datetime(space->machine, &state->systime);
|
||||
space->machine->base_datetime(state->systime);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1342,7 +1342,7 @@ static MACHINE_START( pgm )
|
||||
{
|
||||
pgm_state *state = (pgm_state *)machine->driver_data;
|
||||
|
||||
mame_get_base_datetime(machine, &state->systime);
|
||||
machine->base_datetime(state->systime);
|
||||
|
||||
state->soundcpu = devtag_get_device(machine, "soundcpu");
|
||||
state->prot = devtag_get_device(machine, "prot");
|
||||
|
@ -492,9 +492,9 @@ static UINT8 stv_SMPC_r8 (const address_space *space, int offset)
|
||||
|
||||
static void stv_SMPC_w8 (const address_space *space, int offset, UINT8 data)
|
||||
{
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
|
||||
mame_get_base_datetime(space->machine, &systime);
|
||||
space->machine->base_datetime(systime);
|
||||
|
||||
// if(LOG_SMPC) logerror ("8-bit SMPC Write to Offset %02x with Data %02x\n", offset, data);
|
||||
smpc_ram[offset] = data;
|
||||
@ -2336,9 +2336,9 @@ static void print_game_info(void);
|
||||
|
||||
DRIVER_INIT ( stv )
|
||||
{
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
|
||||
mame_get_base_datetime(machine, &systime);
|
||||
machine->base_datetime(systime);
|
||||
|
||||
/* amount of time to boost interleave for on MINIT / SINIT, needed for communication to work */
|
||||
minit_boost = 400;
|
||||
@ -2590,8 +2590,8 @@ static TIMER_CALLBACK(stv_rtc_increment)
|
||||
|
||||
static MACHINE_START( stv )
|
||||
{
|
||||
mame_system_time systime;
|
||||
mame_get_base_datetime(machine, &systime);
|
||||
system_time systime;
|
||||
machine->base_datetime(systime);
|
||||
|
||||
stv_maincpu = machine->device<cpu_device>("maincpu");
|
||||
stv_slave = machine->device<cpu_device>("slave");
|
||||
@ -2623,7 +2623,7 @@ static MACHINE_START( stv )
|
||||
|
||||
stv_register_protection_savestates(machine); // machine/stvprot.c
|
||||
|
||||
add_exit_callback(machine, stvcd_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, stvcd_exit);
|
||||
|
||||
smpc_ram[0x23] = DectoBCD(systime.local_time.year /100);
|
||||
smpc_ram[0x25] = DectoBCD(systime.local_time.year %100);
|
||||
|
@ -705,10 +705,10 @@ static WRITE32_HANDLER( skns_io_w )
|
||||
|
||||
static READ32_HANDLER( skns_msm6242_r )
|
||||
{
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
long value;
|
||||
|
||||
mame_get_base_datetime(space->machine, &systime);
|
||||
space->machine->base_datetime(systime);
|
||||
// The clock is not y2k-compatible, wrap back 10 years, screw the leap years
|
||||
// tm->tm_year -= 10;
|
||||
|
||||
|
@ -2672,7 +2672,7 @@ ROM_START( kikstart )
|
||||
ROM_LOAD( "pal16l8.28", 0x0000, 0x0104, NO_DUMP ) /* PAL is read protected */
|
||||
ROM_END
|
||||
|
||||
static void reset_common(running_machine *machine)
|
||||
static void reset_common(running_machine &machine)
|
||||
{
|
||||
sndnmi_disable = 1;
|
||||
input_port_4_f0 = 0;
|
||||
@ -2691,7 +2691,7 @@ static void init_common(running_machine *machine)
|
||||
state_save_register_global(machine, dac_out);
|
||||
state_save_register_global(machine, dac_vol);
|
||||
|
||||
add_reset_callback(machine, reset_common);
|
||||
machine->add_notifier(MACHINE_NOTIFY_RESET, reset_common);
|
||||
}
|
||||
|
||||
static DRIVER_INIT( taitosj )
|
||||
|
@ -184,9 +184,9 @@ static UINT8 binary_to_BCD(UINT8 data)
|
||||
|
||||
static READ16_HANDLER(rtc_r)
|
||||
{
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
|
||||
mame_get_current_datetime(space->machine, &systime);
|
||||
space->machine->current_datetime(systime);
|
||||
rtc_ram[0x1] = binary_to_BCD(systime.local_time.second);
|
||||
rtc_ram[0x2] = binary_to_BCD(systime.local_time.minute);
|
||||
rtc_ram[0x3] = binary_to_BCD(systime.local_time.hour);
|
||||
|
@ -636,8 +636,8 @@ static READ32_HANDLER( timekeeper_r )
|
||||
if ((offset*4) >= 0x7ff0)
|
||||
{
|
||||
/* get the time */
|
||||
mame_system_time systime;
|
||||
mame_get_base_datetime(space->machine, &systime);
|
||||
system_time systime;
|
||||
space->machine->base_datetime(systime);
|
||||
|
||||
/* return portions thereof */
|
||||
switch (offset*4)
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
|
||||
/* calendar */
|
||||
UINT8 cal_val, cal_mask, cal_com, cal_cnt;
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
|
||||
/* devices */
|
||||
running_device *soundcpu;
|
||||
|
@ -1575,7 +1575,7 @@ void amiga_add_autoconfig(running_machine *machine, const amiga_autoconfig_devic
|
||||
autoconfig_device *dev, **d;
|
||||
|
||||
/* validate the data */
|
||||
assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call amiga_add_autoconfig at init time!");
|
||||
assert_always(machine->phase() == MACHINE_PHASE_INIT, "Can only call amiga_add_autoconfig at init time!");
|
||||
assert_always((device->size & (device->size - 1)) == 0, "device->size must be power of 2!");
|
||||
|
||||
/* allocate memory and link it in at the end of the list */
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
static void a600xl_mmu(running_machine *machine, UINT8 new_mmu);
|
||||
|
||||
static void pokey_reset(running_machine *machine);
|
||||
static void pokey_reset(running_machine &machine);
|
||||
|
||||
void atari_interrupt_cb(running_device *device, int mask)
|
||||
{
|
||||
@ -306,9 +306,9 @@ void a5200_handle_keypads(running_machine *machine)
|
||||
*************************************/
|
||||
|
||||
|
||||
static void pokey_reset(running_machine *machine)
|
||||
static void pokey_reset(running_machine &machine)
|
||||
{
|
||||
running_device *pokey = devtag_get_device(machine, "pokey");
|
||||
running_device *pokey = machine.device("pokey");
|
||||
pokey_w(pokey,15,0);
|
||||
atari_last = 0xff;
|
||||
}
|
||||
@ -330,7 +330,7 @@ static void console_write(const address_space *space, UINT8 data)
|
||||
}
|
||||
|
||||
|
||||
static void _antic_reset(running_machine *machine)
|
||||
static void _antic_reset(running_machine &machine)
|
||||
{
|
||||
antic_reset();
|
||||
}
|
||||
@ -349,10 +349,10 @@ void atari_machine_start(running_machine *machine)
|
||||
gtia_init(machine, >ia_intf);
|
||||
|
||||
/* pokey */
|
||||
add_reset_callback(machine, pokey_reset);
|
||||
machine->add_notifier(MACHINE_NOTIFY_RESET, pokey_reset);
|
||||
|
||||
/* ANTIC */
|
||||
add_reset_callback(machine, _antic_reset);
|
||||
machine->add_notifier(MACHINE_NOTIFY_RESET, _antic_reset);
|
||||
|
||||
/* save states */
|
||||
state_save_register_global_pointer(machine, ((UINT8 *) &antic.r), sizeof(antic.r));
|
||||
|
@ -68,7 +68,7 @@ static struct akiko_def
|
||||
static TIMER_CALLBACK(akiko_dma_proc);
|
||||
static TIMER_CALLBACK(akiko_frame_proc);
|
||||
|
||||
static void amiga_akiko_exit(running_machine* machine)
|
||||
static void amiga_akiko_exit(running_machine& machine)
|
||||
{
|
||||
if( akiko.cdrom ) {
|
||||
cdrom_close(akiko.cdrom);
|
||||
@ -107,7 +107,7 @@ void amiga_akiko_init(running_machine* machine)
|
||||
akiko.dma_timer = timer_alloc(machine, akiko_dma_proc, NULL);
|
||||
akiko.frame_timer = timer_alloc(machine, akiko_frame_proc, NULL);
|
||||
|
||||
add_exit_callback(machine, amiga_akiko_exit);
|
||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, amiga_akiko_exit);
|
||||
|
||||
/* create the TOC table */
|
||||
if ( akiko.cdrom != NULL && cdrom_get_last_track(akiko.cdrom) )
|
||||
|
@ -1578,8 +1578,8 @@ static void rtc_initial_setup(running_machine *machine)
|
||||
static UINT32 current_time;
|
||||
static int year_count,cur_year,i;
|
||||
static const int month_to_day_conversion[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
|
||||
mame_system_time systime;
|
||||
mame_get_base_datetime(machine, &systime);
|
||||
system_time systime;
|
||||
machine->base_datetime(systime);
|
||||
|
||||
memset(dc_rtcregister, 0, sizeof(dc_rtcregister));
|
||||
|
||||
|
@ -383,8 +383,8 @@ void midway_serial_pic2_w(const address_space *space, UINT8 data)
|
||||
/* if we haven't written a new time recently, use the real live time */
|
||||
if (!pic.time_just_written)
|
||||
{
|
||||
mame_system_time systime;
|
||||
mame_get_base_datetime(machine, &systime);
|
||||
system_time systime;
|
||||
machine->base_datetime(systime);
|
||||
|
||||
pic.buffer[pic.total++] = make_bcd(systime.local_time.second);
|
||||
pic.buffer[pic.total++] = make_bcd(systime.local_time.minute);
|
||||
|
@ -289,9 +289,9 @@ void model3_machine_init(int step)
|
||||
|
||||
static UINT8 rtc_get_reg(running_machine *machine, int reg)
|
||||
{
|
||||
mame_system_time systime;
|
||||
system_time systime;
|
||||
|
||||
mame_get_current_datetime(machine, &systime);
|
||||
machine->current_datetime(systime);
|
||||
|
||||
switch(reg)
|
||||
{
|
||||
|
@ -136,7 +136,7 @@ void segaic16_memory_mapper_config(running_machine *machine, const UINT8 *map_da
|
||||
void segaic16_memory_mapper_set_decrypted(running_machine *machine, UINT8 *decrypted)
|
||||
{
|
||||
struct memory_mapper_chip *chip = &memory_mapper;
|
||||
offs_t romsize = chip->cpu->region()->length;
|
||||
offs_t romsize = chip->cpu->region()->bytes();
|
||||
int rgnum;
|
||||
|
||||
/* loop over the regions */
|
||||
@ -319,7 +319,7 @@ static void update_memory_mapping(running_machine *machine, struct memory_mapper
|
||||
/* ROM areas need extra clamping */
|
||||
if (rgn->romoffset != ~0)
|
||||
{
|
||||
offs_t romsize = chip->cpu->region()->length;
|
||||
offs_t romsize = chip->cpu->region()->bytes();
|
||||
if (region_start >= romsize)
|
||||
read = NULL;
|
||||
else if (region_start + rgn->length > romsize)
|
||||
@ -355,7 +355,7 @@ static void update_memory_mapping(running_machine *machine, struct memory_mapper
|
||||
decrypted = (UINT8 *)fd1089_get_decrypted_base();
|
||||
}
|
||||
|
||||
memory_configure_bank(machine, readbank, 0, 1, chip->cpu->region()->base.u8 + region_start, 0);
|
||||
memory_configure_bank(machine, readbank, 0, 1, chip->cpu->region()->base() + region_start, 0);
|
||||
if (decrypted)
|
||||
memory_configure_bank_decrypted(machine, readbank, 0, 1, decrypted + region_start, 0);
|
||||
|
||||
|
@ -992,8 +992,8 @@ static void spc7110_set_data_adjust(UINT32 addr)
|
||||
// (and indeed current code fails to pass Tengai Makyou Zero tests)
|
||||
static void spc7110_update_time(running_machine *machine, UINT8 offset)
|
||||
{
|
||||
mame_system_time curtime, *systime = &curtime;
|
||||
mame_get_current_datetime(machine, &curtime);
|
||||
system_time curtime, *systime = &curtime;
|
||||
machine->current_datetime(curtime);
|
||||
int update = 1;
|
||||
|
||||
snes_spc7110.rtc_offset += offset;
|
||||
|
@ -41,8 +41,8 @@ static const UINT8 srtc_months[12] =
|
||||
|
||||
static void srtc_update_time( running_machine *machine )
|
||||
{
|
||||
mame_system_time curtime, *systime = &curtime;
|
||||
mame_get_current_datetime(machine, &curtime);
|
||||
system_time curtime, *systime = &curtime;
|
||||
machine->current_datetime(curtime);
|
||||
rtc_state.ram[0] = systime->local_time.second % 10;
|
||||
rtc_state.ram[1] = systime->local_time.second / 10;
|
||||
rtc_state.ram[2] = systime->local_time.minute % 10;
|
||||
|
@ -604,7 +604,7 @@ const stepper_interface starpoint_interface_48step =
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
void stepper_config(running_machine *machine, int which, const stepper_interface *intf)
|
||||
{
|
||||
assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call stepper_config at init time!");
|
||||
assert_always(machine->phase() == MACHINE_PHASE_INIT, "Can only call stepper_config at init time!");
|
||||
assert_always((which >= 0) && (which < MAX_STEPPERS), "stepper_config called on an invalid stepper motor!");
|
||||
assert_always(intf, "stepper_config called with an invalid interface!");
|
||||
|
||||
|
@ -1538,11 +1538,11 @@ static void make_dir_current(running_machine *machine, UINT32 fad)
|
||||
}
|
||||
}
|
||||
|
||||
void stvcd_exit(running_machine* machine)
|
||||
void stvcd_exit(running_machine& machine)
|
||||
{
|
||||
if (curdir != (direntryT *)NULL)
|
||||
{
|
||||
auto_free(machine, curdir);
|
||||
auto_free(&machine, curdir);
|
||||
curdir = (direntryT *)NULL;
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user