diff options
author | Aaron Giles <aaron@aarongiles.com> | 2008-09-11 15:57:52 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2008-09-11 15:57:52 +0000 |
commit | 3d1dbafcc2b45b57207201850ac69e486ed0f648 (patch) | |
tree | 0e8f2fb24788aa01ef5326d3f890abef25f5fdd7 | |
parent | f67c8732b288cd5bbf7b8c80134e979697d57dfc (diff) |
From: Oliver Stoeneberg [mailto:oliverst@online.de]
Subject: Machine -> machine
This is a big patch adding running_machine* parameters and using
"machine" where available.
60 files changed, 812 insertions, 818 deletions
diff --git a/src/emu/cpu/powerpc/drc_ops.c b/src/emu/cpu/powerpc/drc_ops.c index 058b5f56811..0458bd57b75 100644 --- a/src/emu/cpu/powerpc/drc_ops.c +++ b/src/emu/cpu/powerpc/drc_ops.c @@ -132,7 +132,7 @@ static UINT32 *ppcdrc_getopptr(UINT32 address) address &= ~0x07; } - result = (UINT32 *) memory_get_op_ptr(cpu_getactivecpu(), address, 0); + result = (UINT32 *) memory_get_op_ptr(Machine, cpu_getactivecpu(), address, 0); if (result) result += offset; return result; diff --git a/src/emu/cpuexec.c b/src/emu/cpuexec.c index 4934f51b693..22a36ae39de 100644 --- a/src/emu/cpuexec.c +++ b/src/emu/cpuexec.c @@ -332,7 +332,7 @@ void cpuexec_timeslice(running_machine *machine) } /* update the global time */ - timer_set_global_time(target); + timer_set_global_time(machine, target); } diff --git a/src/emu/cpuintrf.c b/src/emu/cpuintrf.c index efe5daa4e7b..36f26282d0f 100644 --- a/src/emu/cpuintrf.c +++ b/src/emu/cpuintrf.c @@ -10,6 +10,7 @@ ***************************************************************************/ #include "driver.h" +#include "deprecat.h" @@ -910,7 +911,7 @@ static int temp_string_pool_index; * *************************************/ -INLINE void set_cpu_context(int cpunum) +INLINE void set_cpu_context(running_machine *machine, int cpunum) { int newfamily = cpu[cpunum].family; int oldcontext = cpu_active_context[newfamily]; @@ -921,7 +922,7 @@ INLINE void set_cpu_context(int cpunum) /* swap memory spaces */ activecpu = cpunum; - memory_set_context(cpunum); + memory_set_context(machine, cpunum); /* if the new CPU's context is not swapped in, do it now */ if (oldcontext != cpunum) @@ -946,7 +947,7 @@ void cpuintrf_push_context(int cpunum) /* do the rest only if this isn't the activecpu */ if (cpunum != activecpu && cpunum != -1) - set_cpu_context(cpunum); + set_cpu_context(Machine, cpunum); /* this is now the active CPU */ activecpu = cpunum; @@ -960,7 +961,7 @@ void cpuintrf_pop_context(void) /* do the rest only if this isn't the activecpu */ if (cpunum != activecpu && cpunum != -1) - set_cpu_context(cpunum); + set_cpu_context(Machine, cpunum); /* this is now the active CPU */ activecpu = cpunum; diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c index bf41c229566..4555b40ab63 100644 --- a/src/emu/debug/debugcmd.c +++ b/src/emu/debug/debugcmd.c @@ -18,7 +18,6 @@ #include "debughlp.h" #include "debugvw.h" #include "render.h" -#include "deprecat.h" #include <ctype.h> @@ -65,51 +64,51 @@ static UINT64 execute_if(void *ref, UINT32 params, const UINT64 *param); static UINT64 global_get(void *ref); static void global_set(void *ref, UINT64 value); -static void execute_help(int ref, int params, const char **param); -static void execute_print(int ref, int params, const char **param); -static void execute_printf(int ref, int params, const char **param); -static void execute_logerror(int ref, int params, const char **param); -static void execute_tracelog(int ref, int params, const char **param); -static void execute_quit(int ref, int params, const char **param); -static void execute_do(int ref, int params, const char **param); -static void execute_step(int ref, int params, const char **param); -static void execute_over(int ref, int params, const char **param); -static void execute_out(int ref, int params, const char **param); -static void execute_go(int ref, int params, const char **param); -static void execute_go_vblank(int ref, int params, const char **param); -static void execute_go_interrupt(int ref, int params, const char **param); -static void execute_go_time(int ref, int params, const char *param[]); -static void execute_focus(int ref, int params, const char **param); -static void execute_ignore(int ref, int params, const char **param); -static void execute_observe(int ref, int params, const char **param); -static void execute_next(int ref, int params, const char **param); -static void execute_comment(int ref, int params, const char **param); -static void execute_comment_del(int ref, int params, const char **param); -static void execute_comment_save(int ref, int params, const char **param); -static void execute_bpset(int ref, int params, const char **param); -static void execute_bpclear(int ref, int params, const char **param); -static void execute_bpdisenable(int ref, int params, const char **param); -static void execute_bplist(int ref, int params, const char **param); -static void execute_wpset(int ref, int params, const char **param); -static void execute_wpclear(int ref, int params, const char **param); -static void execute_wpdisenable(int ref, int params, const char **param); -static void execute_wplist(int ref, int params, const char **param); -static void execute_hotspot(int ref, int params, const char **param); -static void execute_save(int ref, int params, const char **param); -static void execute_dump(int ref, int params, const char **param); -static void execute_dasm(int ref, int params, const char **param); -static void execute_find(int ref, int params, const char **param); -static void execute_trace(int ref, int params, const char **param); -static void execute_traceover(int ref, int params, const char **param); -static void execute_traceflush(int ref, int params, const char **param); -static void execute_history(int ref, int params, const char **param); -static void execute_snap(int ref, int params, const char **param); -static void execute_source(int ref, int params, const char **param); -static void execute_map(int ref, int params, const char **param); -static void execute_memdump(int ref, int params, const char **param); -static void execute_symlist(int ref, int params, const char **param); -static void execute_softreset(int ref, int params, const char **param); -static void execute_hardreset(int ref, int params, const char **param); +static void execute_help(running_machine *machine, int ref, int params, const char **param); +static void execute_print(running_machine *machine, int ref, int params, const char **param); +static void execute_printf(running_machine *machine, int ref, int params, const char **param); +static void execute_logerror(running_machine *machine, int ref, int params, const char **param); +static void execute_tracelog(running_machine *machine, int ref, int params, const char **param); +static void execute_quit(running_machine *machine, int ref, int params, const char **param); +static void execute_do(running_machine *machine, int ref, int params, const char **param); +static void execute_step(running_machine *machine, int ref, int params, const char **param); +static void execute_over(running_machine *machine, int ref, int params, const char **param); +static void execute_out(running_machine *machine, int ref, int params, const char **param); +static void execute_go(running_machine *machine, int ref, int params, const char **param); +static void execute_go_vblank(running_machine *machine, int ref, int params, const char **param); +static void execute_go_interrupt(running_machine *machine, int ref, int params, const char **param); +static void execute_go_time(running_machine *machine, int ref, int params, const char *param[]); +static void execute_focus(running_machine *machine, int ref, int params, const char **param); +static void execute_ignore(running_machine *machine, int ref, int params, const char **param); +static void execute_observe(running_machine *machine, int ref, int params, const char **param); +static void execute_next(running_machine *machine, int ref, int params, const char **param); +static void execute_comment(running_machine *machine, int ref, int params, const char **param); +static void execute_comment_del(running_machine *machine, int ref, int params, const char **param); +static void execute_comment_save(running_machine *machine, int ref, int params, const char **param); +static void execute_bpset(running_machine *machine, int ref, int params, const char **param); +static void execute_bpclear(running_machine *machine, int ref, int params, const char **param); +static void execute_bpdisenable(running_machine *machine, int ref, int params, const char **param); +static void execute_bplist(running_machine *machine, int ref, int params, const char **param); +static void execute_wpset(running_machine *machine, int ref, int params, const char **param); +static void execute_wpclear(running_machine *machine, int ref, int params, const char **param); +static void execute_wpdisenable(running_machine *machine, int ref, int params, const char **param); +static void execute_wplist(running_machine *machine, int ref, int params, const char **param); +static void execute_hotspot(running_machine *machine, int ref, int params, const char **param); +static void execute_save(running_machine *machine, int ref, int params, const char **param); +static void execute_dump(running_machine *machine, int ref, int params, const char **param); +static void execute_dasm(running_machine *machine, int ref, int params, const char **param); +static void execute_find(running_machine *machine, int ref, int params, const char **param); +static void execute_trace(running_machine *machine, int ref, int params, const char **param); +static void execute_traceover(running_machine *machine, int ref, int params, const char **param); +static void execute_traceflush(running_machine *machine, int ref, int params, const char **param); +static void execute_history(running_machine *machine, int ref, int params, const char **param); +static void execute_snap(running_machine *machine, int ref, int params, const char **param); +static void execute_source(running_machine *machine, int ref, int params, const char **param); +static void execute_map(running_machine *machine, int ref, int params, const char **param); +static void execute_memdump(running_machine *machine, int ref, int params, const char **param); +static void execute_symlist(running_machine *machine, int ref, int params, const char **param); +static void execute_softreset(running_machine *machine, int ref, int params, const char **param); +static void execute_hardreset(running_machine *machine, int ref, int params, const char **param); @@ -157,93 +156,93 @@ void debug_command_init(running_machine *machine) } /* add all the commands */ - debug_console_register_command("help", CMDFLAG_NONE, 0, 0, 1, execute_help); - debug_console_register_command("print", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, execute_print); - debug_console_register_command("printf", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, execute_printf); - debug_console_register_command("logerror", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, execute_logerror); - debug_console_register_command("tracelog", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, execute_tracelog); - debug_console_register_command("quit", CMDFLAG_NONE, 0, 0, 0, execute_quit); - debug_console_register_command("do", CMDFLAG_NONE, 0, 1, 1, execute_do); - debug_console_register_command("step", CMDFLAG_NONE, 0, 0, 1, execute_step); - debug_console_register_command("s", CMDFLAG_NONE, 0, 0, 1, execute_step); - debug_console_register_command("over", CMDFLAG_NONE, 0, 0, 1, execute_over); - debug_console_register_command("o", CMDFLAG_NONE, 0, 0, 1, execute_over); - debug_console_register_command("out" , CMDFLAG_NONE, 0, 0, 0, execute_out); - debug_console_register_command("go", CMDFLAG_NONE, 0, 0, 1, execute_go); - debug_console_register_command("g", CMDFLAG_NONE, 0, 0, 1, execute_go); - debug_console_register_command("gvblank", CMDFLAG_NONE, 0, 0, 0, execute_go_vblank); - debug_console_register_command("gv", CMDFLAG_NONE, 0, 0, 0, execute_go_vblank); - debug_console_register_command("gint", CMDFLAG_NONE, 0, 0, 1, execute_go_interrupt); - debug_console_register_command("gi", CMDFLAG_NONE, 0, 0, 1, execute_go_interrupt); - debug_console_register_command("gtime", CMDFLAG_NONE, 0, 0, 1, execute_go_time); - debug_console_register_command("gt", CMDFLAG_NONE, 0, 0, 1, execute_go_time); - debug_console_register_command("next", CMDFLAG_NONE, 0, 0, 0, execute_next); - debug_console_register_command("n", CMDFLAG_NONE, 0, 0, 0, execute_next); - debug_console_register_command("focus", CMDFLAG_NONE, 0, 1, 1, execute_focus); - debug_console_register_command("ignore", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, execute_ignore); - debug_console_register_command("observe", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, execute_observe); - - debug_console_register_command("comadd", CMDFLAG_NONE, 0, 1, 2, execute_comment); - debug_console_register_command("//", CMDFLAG_NONE, 0, 1, 2, execute_comment); - debug_console_register_command("comdelete", CMDFLAG_NONE, 0, 1, 1, execute_comment_del); - debug_console_register_command("comsave", CMDFLAG_NONE, 0, 0, 0, execute_comment_save); - - debug_console_register_command("bpset", CMDFLAG_NONE, 0, 1, 3, execute_bpset); - debug_console_register_command("bp", CMDFLAG_NONE, 0, 1, 3, execute_bpset); - debug_console_register_command("bpclear", CMDFLAG_NONE, 0, 0, 1, execute_bpclear); - debug_console_register_command("bpdisable", CMDFLAG_NONE, 0, 0, 1, execute_bpdisenable); - debug_console_register_command("bpenable", CMDFLAG_NONE, 1, 0, 1, execute_bpdisenable); - debug_console_register_command("bplist", CMDFLAG_NONE, 0, 0, 0, execute_bplist); - - debug_console_register_command("wpset", CMDFLAG_NONE, ADDRESS_SPACE_PROGRAM, 3, 5, execute_wpset); - debug_console_register_command("wp", CMDFLAG_NONE, ADDRESS_SPACE_PROGRAM, 3, 5, execute_wpset); - debug_console_register_command("wpdset", CMDFLAG_NONE, ADDRESS_SPACE_DATA, 3, 5, execute_wpset); - debug_console_register_command("wpd", CMDFLAG_NONE, ADDRESS_SPACE_DATA, 3, 5, execute_wpset); - debug_console_register_command("wpiset", CMDFLAG_NONE, ADDRESS_SPACE_IO, 3, 5, execute_wpset); - debug_console_register_command("wpi", CMDFLAG_NONE, ADDRESS_SPACE_IO, 3, 5, execute_wpset); - debug_console_register_command("wpclear", CMDFLAG_NONE, 0, 0, 1, execute_wpclear); - debug_console_register_command("wpdisable", CMDFLAG_NONE, 0, 0, 1, execute_wpdisenable); - debug_console_register_command("wpenable", CMDFLAG_NONE, 1, 0, 1, execute_wpdisenable); - debug_console_register_command("wplist", CMDFLAG_NONE, 0, 0, 0, execute_wplist); - - debug_console_register_command("hotspot", CMDFLAG_NONE, 0, 0, 3, execute_hotspot); - - debug_console_register_command("save", CMDFLAG_NONE, ADDRESS_SPACE_PROGRAM, 3, 4, execute_save); - debug_console_register_command("saved", CMDFLAG_NONE, ADDRESS_SPACE_DATA, 3, 4, execute_save); - debug_console_register_command("savei", CMDFLAG_NONE, ADDRESS_SPACE_IO, 3, 4, execute_save); - - debug_console_register_command("dump", CMDFLAG_NONE, ADDRESS_SPACE_PROGRAM, 3, 6, execute_dump); - debug_console_register_command("dumpd", CMDFLAG_NONE, ADDRESS_SPACE_DATA, 3, 6, execute_dump); - debug_console_register_command("dumpi", CMDFLAG_NONE, ADDRESS_SPACE_IO, 3, 6, execute_dump); - - debug_console_register_command("f", CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_PROGRAM, 3, MAX_COMMAND_PARAMS, execute_find); - debug_console_register_command("find", CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_PROGRAM, 3, MAX_COMMAND_PARAMS, execute_find); - debug_console_register_command("fd", CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_DATA, 3, MAX_COMMAND_PARAMS, execute_find); - debug_console_register_command("findd", CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_DATA, 3, MAX_COMMAND_PARAMS, execute_find); - debug_console_register_command("fi", CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_IO, 3, MAX_COMMAND_PARAMS, execute_find); - debug_console_register_command("findi", CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_IO, 3, MAX_COMMAND_PARAMS, execute_find); - - debug_console_register_command("dasm", CMDFLAG_NONE, 0, 3, 5, execute_dasm); - - debug_console_register_command("trace", CMDFLAG_NONE, 0, 1, 3, execute_trace); - debug_console_register_command("traceover", CMDFLAG_NONE, 0, 1, 3, execute_traceover); - debug_console_register_command("traceflush",CMDFLAG_NONE, 0, 0, 0, execute_traceflush); - - debug_console_register_command("history", CMDFLAG_NONE, 0, 0, 2, execute_history); - - debug_console_register_command("snap", CMDFLAG_NONE, 0, 0, 1, execute_snap); - - debug_console_register_command("source", CMDFLAG_NONE, 0, 1, 1, execute_source); - - debug_console_register_command("map", CMDFLAG_NONE, ADDRESS_SPACE_PROGRAM, 1, 1, execute_map); - debug_console_register_command("mapd", CMDFLAG_NONE, ADDRESS_SPACE_DATA, 1, 1, execute_map); - debug_console_register_command("mapi", CMDFLAG_NONE, ADDRESS_SPACE_IO, 1, 1, execute_map); - debug_console_register_command("memdump", CMDFLAG_NONE, 0, 0, 1, execute_memdump); - - debug_console_register_command("symlist", CMDFLAG_NONE, 0, 0, 1, execute_symlist); - - debug_console_register_command("softreset", CMDFLAG_NONE, 0, 0, 1, execute_softreset); - debug_console_register_command("hardreset", CMDFLAG_NONE, 0, 0, 1, execute_hardreset); + debug_console_register_command(machine, "help", CMDFLAG_NONE, 0, 0, 1, execute_help); + debug_console_register_command(machine, "print", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, execute_print); + debug_console_register_command(machine, "printf", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, execute_printf); + debug_console_register_command(machine, "logerror", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, execute_logerror); + debug_console_register_command(machine, "tracelog", CMDFLAG_NONE, 0, 1, MAX_COMMAND_PARAMS, execute_tracelog); + debug_console_register_command(machine, "quit", CMDFLAG_NONE, 0, 0, 0, execute_quit); + debug_console_register_command(machine, "do", CMDFLAG_NONE, 0, 1, 1, execute_do); + debug_console_register_command(machine, "step", CMDFLAG_NONE, 0, 0, 1, execute_step); + debug_console_register_command(machine, "s", CMDFLAG_NONE, 0, 0, 1, execute_step); + debug_console_register_command(machine, "over", CMDFLAG_NONE, 0, 0, 1, execute_over); + debug_console_register_command(machine, "o", CMDFLAG_NONE, 0, 0, 1, execute_over); + debug_console_register_command(machine, "out" , CMDFLAG_NONE, 0, 0, 0, execute_out); + debug_console_register_command(machine, "go", CMDFLAG_NONE, 0, 0, 1, execute_go); + debug_console_register_command(machine, "g", CMDFLAG_NONE, 0, 0, 1, execute_go); + debug_console_register_command(machine, "gvblank", CMDFLAG_NONE, 0, 0, 0, execute_go_vblank); + debug_console_register_command(machine, "gv", CMDFLAG_NONE, 0, 0, 0, execute_go_vblank); + debug_console_register_command(machine, "gint", CMDFLAG_NONE, 0, 0, 1, execute_go_interrupt); + debug_console_register_command(machine, "gi", CMDFLAG_NONE, 0, 0, 1, execute_go_interrupt); + debug_console_register_command(machine, "gtime", CMDFLAG_NONE, 0, 0, 1, execute_go_time); + debug_console_register_command(machine, "gt", CMDFLAG_NONE, 0, 0, 1, execute_go_time); + debug_console_register_command(machine, "next", CMDFLAG_NONE, 0, 0, 0, execute_next); + debug_console_register_command(machine, "n", CMDFLAG_NONE, 0, 0, 0, execute_next); + debug_console_register_command(machine, "focus", CMDFLAG_NONE, 0, 1, 1, execute_focus); + debug_console_register_command(machine, "ignore", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, execute_ignore); + debug_console_register_command(machine, "observe", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, execute_observe); + + debug_console_register_command(machine, "comadd", CMDFLAG_NONE, 0, 1, 2, execute_comment); + debug_console_register_command(machine, "//", CMDFLAG_NONE, 0, 1, 2, execute_comment); + debug_console_register_command(machine, "comdelete", CMDFLAG_NONE, 0, 1, 1, execute_comment_del); + debug_console_register_command(machine, "comsave", CMDFLAG_NONE, 0, 0, 0, execute_comment_save); + + debug_console_register_command(machine, "bpset", CMDFLAG_NONE, 0, 1, 3, execute_bpset); + debug_console_register_command(machine, "bp", CMDFLAG_NONE, 0, 1, 3, execute_bpset); + debug_console_register_command(machine, "bpclear", CMDFLAG_NONE, 0, 0, 1, execute_bpclear); + debug_console_register_command(machine, "bpdisable", CMDFLAG_NONE, 0, 0, 1, execute_bpdisenable); + debug_console_register_command(machine, "bpenable", CMDFLAG_NONE, 1, 0, 1, execute_bpdisenable); + debug_console_register_command(machine, "bplist", CMDFLAG_NONE, 0, 0, 0, execute_bplist); + + debug_console_register_command(machine, "wpset", CMDFLAG_NONE, ADDRESS_SPACE_PROGRAM, 3, 5, execute_wpset); + debug_console_register_command(machine, "wp", CMDFLAG_NONE, ADDRESS_SPACE_PROGRAM, 3, 5, execute_wpset); + debug_console_register_command(machine, "wpdset", CMDFLAG_NONE, ADDRESS_SPACE_DATA, 3, 5, execute_wpset); + debug_console_register_command(machine, "wpd", CMDFLAG_NONE, ADDRESS_SPACE_DATA, 3, 5, execute_wpset); + debug_console_register_command(machine, "wpiset", CMDFLAG_NONE, ADDRESS_SPACE_IO, 3, 5, execute_wpset); + debug_console_register_command(machine, "wpi", CMDFLAG_NONE, ADDRESS_SPACE_IO, 3, 5, execute_wpset); + debug_console_register_command(machine, "wpclear", CMDFLAG_NONE, 0, 0, 1, execute_wpclear); + debug_console_register_command(machine, "wpdisable", CMDFLAG_NONE, 0, 0, 1, execute_wpdisenable); + debug_console_register_command(machine, "wpenable", CMDFLAG_NONE, 1, 0, 1, execute_wpdisenable); + debug_console_register_command(machine, "wplist", CMDFLAG_NONE, 0, 0, 0, execute_wplist); + + debug_console_register_command(machine, "hotspot", CMDFLAG_NONE, 0, 0, 3, execute_hotspot); + + debug_console_register_command(machine, "save", CMDFLAG_NONE, ADDRESS_SPACE_PROGRAM, 3, 4, execute_save); + debug_console_register_command(machine, "saved", CMDFLAG_NONE, ADDRESS_SPACE_DATA, 3, 4, execute_save); + debug_console_register_command(machine, "savei", CMDFLAG_NONE, ADDRESS_SPACE_IO, 3, 4, execute_save); + + debug_console_register_command(machine, "dump", CMDFLAG_NONE, ADDRESS_SPACE_PROGRAM, 3, 6, execute_dump); + debug_console_register_command(machine, "dumpd", CMDFLAG_NONE, ADDRESS_SPACE_DATA, 3, 6, execute_dump); + debug_console_register_command(machine, "dumpi", CMDFLAG_NONE, ADDRESS_SPACE_IO, 3, 6, execute_dump); + + debug_console_register_command(machine, "f", CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_PROGRAM, 3, MAX_COMMAND_PARAMS, execute_find); + debug_console_register_command(machine, "find", CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_PROGRAM, 3, MAX_COMMAND_PARAMS, execute_find); + debug_console_register_command(machine, "fd", CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_DATA, 3, MAX_COMMAND_PARAMS, execute_find); + debug_console_register_command(machine, "findd", CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_DATA, 3, MAX_COMMAND_PARAMS, execute_find); + debug_console_register_command(machine, "fi", CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_IO, 3, MAX_COMMAND_PARAMS, execute_find); + debug_console_register_command(machine, "findi", CMDFLAG_KEEP_QUOTES, ADDRESS_SPACE_IO, 3, MAX_COMMAND_PARAMS, execute_find); + + debug_console_register_command(machine, "dasm", CMDFLAG_NONE, 0, 3, 5, execute_dasm); + + debug_console_register_command(machine, "trace", CMDFLAG_NONE, 0, 1, 3, execute_trace); + debug_console_register_command(machine, "traceover", CMDFLAG_NONE, 0, 1, 3, execute_traceover); + debug_console_register_command(machine, "traceflush",CMDFLAG_NONE, 0, 0, 0, execute_traceflush); + + debug_console_register_command(machine, "history", CMDFLAG_NONE, 0, 0, 2, execute_history); + + debug_console_register_command(machine, "snap", CMDFLAG_NONE, 0, 0, 1, execute_snap); + + debug_console_register_command(machine, "source", CMDFLAG_NONE, 0, 1, 1, execute_source); + + debug_console_register_command(machine, "map", CMDFLAG_NONE, ADDRESS_SPACE_PROGRAM, 1, 1, execute_map); + debug_console_register_command(machine, "mapd", CMDFLAG_NONE, ADDRESS_SPACE_DATA, 1, 1, execute_map); + debug_console_register_command(machine, "mapi", CMDFLAG_NONE, ADDRESS_SPACE_IO, 1, 1, execute_map); + debug_console_register_command(machine, "memdump", CMDFLAG_NONE, 0, 0, 1, execute_memdump); + + debug_console_register_command(machine, "symlist", CMDFLAG_NONE, 0, 0, 1, execute_symlist); + + debug_console_register_command(machine, "softreset", CMDFLAG_NONE, 0, 0, 1, execute_softreset); + debug_console_register_command(machine, "hardreset", CMDFLAG_NONE, 0, 0, 1, execute_hardreset); /* ask all the CPUs if they would like to register functions or symbols */ for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++) @@ -402,9 +401,9 @@ static int debug_command_parameter_expression(const char *param, parsed_expressi command parameter -------------------------------------------------*/ -static int debug_command_parameter_command(const char *param) +static int debug_command_parameter_command(running_machine *machine, const char *param) { - CMDERR err = debug_console_validate_command(param); + CMDERR err = debug_console_validate_command(machine, param); if (err == CMDERR_NONE) return 1; debug_console_printf("Error in command: %s\n", param); @@ -425,7 +424,7 @@ static int debug_command_parameter_command(const char *param) execute_help - execute the help command -------------------------------------------------*/ -static void execute_help(int ref, int params, const char *param[]) +static void execute_help(running_machine *machine, int ref, int params, const char *param[]) { if (params == 0) debug_console_printf_wrap(80, "%s\n", debug_get_help("")); @@ -438,7 +437,7 @@ static void execute_help(int ref, int params, const char *param[]) execute_print - execute the print command -------------------------------------------------*/ -static void execute_print(int ref, int params, const char *param[]) +static void execute_print(running_machine *machine, int ref, int params, const char *param[]) { UINT64 values[MAX_COMMAND_PARAMS]; int i; @@ -558,7 +557,7 @@ static int mini_printf(char *buffer, const char *format, int params, UINT64 *par execute_printf - execute the printf command -------------------------------------------------*/ -static void execute_printf(int ref, int params, const char *param[]) +static void execute_printf(running_machine *machine, int ref, int params, const char *param[]) { UINT64 values[MAX_COMMAND_PARAMS]; char buffer[1024]; @@ -579,7 +578,7 @@ static void execute_printf(int ref, int params, const char *param[]) execute_logerror - execute the logerror command -------------------------------------------------*/ -static void execute_logerror(int ref, int params, const char *param[]) +static void execute_logerror(running_machine *machine, int ref, int params, const char *param[]) { UINT64 values[MAX_COMMAND_PARAMS]; char buffer[1024]; @@ -600,7 +599,7 @@ static void execute_logerror(int ref, int params, const char *param[]) execute_tracelog - execute the tracelog command -------------------------------------------------*/ -static void execute_tracelog(int ref, int params, const char *param[]) +static void execute_tracelog(running_machine *machine, int ref, int params, const char *param[]) { FILE *file = debug_get_cpu_info(cpu_getactivecpu())->trace.file; UINT64 values[MAX_COMMAND_PARAMS]; @@ -626,10 +625,10 @@ static void execute_tracelog(int ref, int params, const char *param[]) execute_quit - execute the quit command -------------------------------------------------*/ -static void execute_quit(int ref, int params, const char *param[]) +static void execute_quit(running_machine *machine, int ref, int params, const char *param[]) { mame_printf_error("Exited via the debugger\n"); - mame_schedule_exit(Machine); + mame_schedule_exit(machine); } @@ -637,7 +636,7 @@ static void execute_quit(int ref, int params, const char *param[]) execute_do - execute the do command -------------------------------------------------*/ -static void execute_do(int ref, int params, const char *param[]) +static void execute_do(running_machine *machine, int ref, int params, const char *param[]) { UINT64 dummy; debug_command_parameter_number(param[0], &dummy); @@ -648,7 +647,7 @@ static void execute_do(int ref, int params, const char *param[]) execute_step - execute the step command -------------------------------------------------*/ -static void execute_step(int ref, int params, const char *param[]) +static void execute_step(running_machine *machine, int ref, int params, const char *param[]) { UINT64 steps = 1; @@ -664,7 +663,7 @@ static void execute_step(int ref, int params, const char *param[]) execute_over - execute the over command -------------------------------------------------*/ -static void execute_over(int ref, int params, const char *param[]) +static void execute_over(running_machine *machine, int ref, int params, const char *param[]) { UINT64 steps = 1; @@ -680,7 +679,7 @@ static void execute_over(int ref, int params, const char *param[]) execute_out - execute the out command -------------------------------------------------*/ -static void execute_out(int ref, int params, const char *param[]) +static void execute_out(running_machine *machine, int ref, int params, const char *param[]) { debug_cpu_single_step_out(); } @@ -690,7 +689,7 @@ static void execute_out(int ref, int params, const char *param[]) execute_go - execute the go command -------------------------------------------------*/ -static void execute_go(int ref, int params, const char *param[]) +static void execute_go(running_machine *machine, int ref, int params, const char *param[]) { UINT64 addr = ~0; @@ -707,7 +706,7 @@ static void execute_go(int ref, int params, const char *param[]) command -------------------------------------------------*/ -static void execute_go_vblank(int ref, int params, const char *param[]) +static void execute_go_vblank(running_machine *machine, int ref, int params, const char *param[]) { debug_cpu_go_vblank(); } @@ -717,7 +716,7 @@ static void execute_go_vblank(int ref, int params, const char *param[]) execute_go_interrupt - execute the goint command -------------------------------------------------*/ -static void execute_go_interrupt(int ref, int params, const char *param[]) +static void execute_go_interrupt(running_machine *machine, int ref, int params, const char *param[]) { UINT64 irqline = -1; @@ -733,7 +732,7 @@ static void execute_go_interrupt(int ref, int params, const char *param[]) execute_go_time - execute the gtime command -------------------------------------------------*/ -static void execute_go_time(int ref, int params, const char *param[]) +static void execute_go_time(running_machine *machine, int ref, int params, const char *param[]) { UINT64 milliseconds = -1; @@ -749,7 +748,7 @@ static void execute_go_time(int ref, int params, const char *param[]) execute_next - execute the next command -------------------------------------------------*/ -static void execute_next(int ref, int params, const char *param[]) +static void execute_next(running_machine *machine, int ref, int params, const char *param[]) { debug_cpu_next_cpu(); } @@ -759,7 +758,7 @@ static void execute_next(int ref, int params, const char *param[]) execute_focus - execute the focus command -------------------------------------------------*/ -static void execute_focus(int ref, int params, const char *param[]) +static void execute_focus(running_machine *machine, int ref, int params, const char *param[]) { UINT64 cpuwhich; int cpunum; @@ -791,7 +790,7 @@ static void execute_focus(int ref, int params, const char *param[]) execute_ignore - execute the ignore command -------------------------------------------------*/ -static void execute_ignore(int ref, int params, const char *param[]) +static void execute_ignore(running_machine *machine, int ref, int params, const char *param[]) { UINT64 cpuwhich[MAX_COMMAND_PARAMS]; int cpunum, paramnum; @@ -862,7 +861,7 @@ static void execute_ignore(int ref, int params, const char *param[]) execute_observe - execute the observe command -------------------------------------------------*/ -static void execute_observe(int ref, int params, const char *param[]) +static void execute_observe(running_machine *machine, int ref, int params, const char *param[]) { UINT64 cpuwhich[MAX_COMMAND_PARAMS]; int cpunum, paramnum; @@ -920,7 +919,7 @@ static void execute_observe(int ref, int params, const char *param[]) execute_comment - add a comment to a line -------------------------------------------------*/ -static void execute_comment(int ref, int params, const char *param[]) +static void execute_comment(running_machine *machine, int ref, int params, const char *param[]) { UINT64 address; @@ -945,7 +944,7 @@ static void execute_comment(int ref, int params, const char *param[]) execute_comment_del - remove a comment from an addr --------------------------------------------------------*/ -static void execute_comment_del(int ref, int params, const char *param[]) +static void execute_comment_del(running_machine *machine, int ref, int params, const char *param[]) { UINT64 address; @@ -964,9 +963,9 @@ static void execute_comment_del(int ref, int params, const char *param[]) execute_comment - add a comment to a line -------------------------------------------------*/ -static void execute_comment_save(int ref, int params, const char *param[]) +static void execute_comment_save(running_machine *machine, int ref, int params, const char *param[]) { - if (debug_comment_save(Machine)) + if (debug_comment_save(machine)) debug_console_printf("Comments successfully saved\n"); } @@ -976,7 +975,7 @@ static void execute_comment_save(int ref, int params, const char *param[]) command -------------------------------------------------*/ -static void execute_bpset(int ref, int params, const char *param[]) +static void execute_bpset(running_machine *machine, int ref, int params, const char *param[]) { parsed_expression *condition = NULL; const char *action = NULL; @@ -999,11 +998,11 @@ static void execute_bpset(int ref, int params, const char *param[]) return; /* param 3 is the action */ - if (params > 2 && !debug_command_parameter_command(action = param[2])) + if (params > 2 && !debug_command_parameter_command(machine, action = param[2])) return; /* set the breakpoint */ - bpnum = debug_cpu_breakpoint_set(Machine, cpu_getactivecpu(), address, condition, action); + bpnum = debug_cpu_breakpoint_set(machine, cpu_getactivecpu(), address, condition, action); debug_console_printf("Breakpoint %X set\n", bpnum); } @@ -1013,7 +1012,7 @@ static void execute_bpset(int ref, int params, const char *param[]) clear command -------------------------------------------------*/ -static void execute_bpclear(int ref, int params, const char *param[]) +static void execute_bpclear(running_machine *machine, int ref, int params, const char *param[]) { UINT64 bpindex; @@ -1029,7 +1028,7 @@ static void execute_bpclear(int ref, int params, const char *param[]) { debug_cpu_breakpoint *bp; while ((bp = cpuinfo->bplist) != NULL) - debug_cpu_breakpoint_clear(Machine, bp->index); + debug_cpu_breakpoint_clear(machine, bp->index); } } debug_console_printf("Cleared all breakpoints\n"); @@ -1040,7 +1039,7 @@ static void execute_bpclear(int ref, int params, const char *param[]) return; else { - int found = debug_cpu_breakpoint_clear(Machine, bpindex); + int found = debug_cpu_breakpoint_clear(machine, bpindex); if (found) debug_console_printf("Breakpoint %X cleared\n", (UINT32)bpindex); else @@ -1054,7 +1053,7 @@ static void execute_bpclear(int ref, int params, const char *param[]) disable/enable commands -------------------------------------------------*/ -static void execute_bpdisenable(int ref, int params, const char *param[]) +static void execute_bpdisenable(running_machine *machine, int ref, int params, const char *param[]) { UINT64 bpindex; @@ -1070,7 +1069,7 @@ static void execute_bpdisenable(int ref, int params, const char *param[]) { debug_cpu_breakpoint *bp; for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next) - debug_cpu_breakpoint_enable(Machine, bp->index, ref); + debug_cpu_breakpoint_enable(machine, bp->index, ref); } } if (ref == 0) @@ -1084,7 +1083,7 @@ static void execute_bpdisenable(int ref, int params, const char *param[]) return; else { - int found = debug_cpu_breakpoint_enable(Machine, bpindex, ref); + int found = debug_cpu_breakpoint_enable(machine, bpindex, ref); if (found) debug_console_printf("Breakpoint %X %s\n", (UINT32)bpindex, ref ? "enabled" : "disabled"); else @@ -1098,7 +1097,7 @@ static void execute_bpdisenable(int ref, int params, const char *param[]) command -------------------------------------------------*/ -static void execute_bplist(int ref, int params, const char *param[]) +static void execute_bplist(running_machine *machine, int ref, int params, const char *param[]) { int cpunum, printed = 0; char buffer[256]; @@ -1139,7 +1138,7 @@ static void execute_bplist(int ref, int params, const char *param[]) command -------------------------------------------------*/ -static void execute_wpset(int ref, int params, const char *param[]) +static void execute_wpset(running_machine *machine, int ref, int params, const char *param[]) { parsed_expression *condition = NULL; const char *action = NULL; @@ -1173,11 +1172,11 @@ static void execute_wpset(int ref, int params, const char *param[]) return; /* param 5 is the action */ - if (params > 4 && !debug_command_parameter_command(action = param[4])) + if (params > 4 && !debug_command_parameter_command(machine, action = param[4])) return; /* set the watchpoint */ - wpnum = debug_cpu_watchpoint_set(Machine, cpu_getactivecpu(), ref, type, address, length, condition, action); + wpnum = debug_cpu_watchpoint_set(machine, cpu_getactivecpu(), ref, type, address, length, condition, action); debug_console_printf("Watchpoint %X set\n", wpnum); } @@ -1187,7 +1186,7 @@ static void execute_wpset(int ref, int params, const char *param[]) clear command -------------------------------------------------*/ -static void execute_wpclear(int ref, int params, const char *param[]) +static void execute_wpclear(running_machine *machine, int ref, int params, const char *param[]) { UINT64 wpindex; @@ -1207,7 +1206,7 @@ static void execute_wpclear(int ref, int params, const char *param[]) { debug_cpu_watchpoint *wp; while ((wp = cpuinfo->space[spacenum].wplist) != NULL) - debug_cpu_watchpoint_clear(Machine, wp->index); + debug_cpu_watchpoint_clear(machine, wp->index); } } } @@ -1219,7 +1218,7 @@ static void execute_wpclear(int ref, int params, const char *param[]) return; else { - int found = debug_cpu_watchpoint_clear(Machine, wpindex); + int found = debug_cpu_watchpoint_clear(machine, wpindex); if (found) debug_console_printf("Watchpoint %X cleared\n", (UINT32)wpindex); else @@ -1233,7 +1232,7 @@ static void execute_wpclear(int ref, int params, const char *param[]) disable/enable commands -------------------------------------------------*/ -static void execute_wpdisenable(int ref, int params, const char *param[]) +static void execute_wpdisenable(running_machine *machine, int ref, int params, const char *param[]) { UINT64 wpindex; @@ -1253,7 +1252,7 @@ static void execute_wpdisenable(int ref, int params, const char *param[]) { debug_cpu_watchpoint *wp; for (wp = cpuinfo->space[spacenum].wplist; wp != NULL; wp = wp->next) - debug_cpu_watchpoint_enable(Machine, wp->index, ref); + debug_cpu_watchpoint_enable(machine, wp->index, ref); } } } @@ -1268,7 +1267,7 @@ static void execute_wpdisenable(int ref, int params, const char *param[]) return; else { - int found = debug_cpu_watchpoint_enable(Machine, wpindex, ref); + int found = debug_cpu_watchpoint_enable(machine, wpindex, ref); if (found) debug_console_printf("Watchpoint %X %s\n", (UINT32)wpindex, ref ? "enabled" : "disabled"); else @@ -1282,7 +1281,7 @@ static void execute_wpdisenable(int ref, int params, const char *param[]) command -------------------------------------------------*/ -static void execute_wplist(int ref, int params, const char *param[]) +static void execute_wplist(running_machine *machine, int ref, int params, const char *param[]) { int cpunum, printed = 0; char buffer[256]; @@ -1333,7 +1332,7 @@ static void execute_wplist(int ref, int params, const char *param[]) command -------------------------------------------------*/ -static void execute_hotspot(int ref, int params, const char *param[]) +static void execute_hotspot(running_machine *machine, int ref, int params, const char *param[]) { UINT64 threshhold; UINT64 cpunum; @@ -1351,7 +1350,7 @@ static void execute_hotspot(int ref, int params, const char *param[]) if (cpuinfo->valid && cpuinfo->hotspots) { - debug_cpu_hotspot_track(Machine, cpunum, 0, 0); + debug_cpu_hotspot_track(machine, cpunum, 0, 0); debug_console_printf("Cleared hotspot tracking on CPU %d\n", (int)cpunum); cleared = TRUE; } @@ -1374,7 +1373,7 @@ static void execute_hotspot(int ref, int params, const char *param[]) return; /* attempt to install */ - if (debug_cpu_hotspot_track(Machine, cpunum, count, threshhold)) + if (debug_cpu_hotspot_track(machine, cpunum, count, threshhold)) debug_console_printf("Now tracking hotspots on CPU %d using %d slots with a threshhold of %d\n", (int)cpunum, (int)count, (int)threshhold); else debug_console_printf("Error setting up the hotspot tracking\n"); @@ -1385,7 +1384,7 @@ static void execute_hotspot(int ref, int params, const char *param[]) execute_save - execute the save command -------------------------------------------------*/ -static void execute_save(int ref, int params, const char *param[]) +static void execute_save(running_machine *machine, int ref, int params, const char *param[]) { UINT64 offset, endoffset, length, cpunum = cpu_getactivecpu(); const debug_cpu_info *info; @@ -1433,7 +1432,7 @@ static void execute_save(int ref, int params, const char *param[]) execute_dump - execute the dump command -------------------------------------------------*/ -static void execute_dump(int ref, int params, const char *param[]) +static void execute_dump(running_machine *machine, int ref, int params, const char *param[]) { UINT64 offset, endoffset, length, width = 0, ascii = 1, cpunum = cpu_getactivecpu(); const debug_cpu_info *info; @@ -1602,7 +1601,7 @@ static void execute_dump(int ref, int params, const char *param[]) execute_find - execute the find command -------------------------------------------------*/ -static void execute_find(int ref, int params, const char *param[]) +static void execute_find(running_machine *machine, int ref, int params, const char *param[]) { UINT64 offset, endoffset, length, cpunum = cpu_getactivecpu(); const debug_cpu_info *info; @@ -1708,7 +1707,7 @@ static void execute_find(int ref, int params, const char *param[]) execute_dasm - execute the dasm command -------------------------------------------------*/ -static void execute_dasm(int ref, int params, const char *param[]) +static void execute_dasm(running_machine *machine, int ref, int params, const char *param[]) { UINT64 offset, length, bytes = 1, cpunum = cpu_getactivecpu(); const debug_cpu_info *info; @@ -1855,7 +1854,7 @@ static void execute_dasm(int ref, int params, const char *param[]) trace over and trace info -------------------------------------------------*/ -static void execute_trace_internal(int ref, int params, const char *param[], int trace_over) +static void execute_trace_internal(running_machine *machine, int ref, int params, const char *param[], int trace_over) { const char *action = NULL, *filename = param[0]; FILE *f = NULL; @@ -1867,7 +1866,7 @@ static void execute_trace_internal(int ref, int params, const char *param[], int /* validate parameters */ if (params > 1 && !debug_command_parameter_number(param[1], &cpunum)) return; - if (params > 2 && !debug_command_parameter_command(action = param[2])) + if (params > 2 && !debug_command_parameter_command(machine, action = param[2])) return; /* further validation */ @@ -1912,9 +1911,9 @@ static void execute_trace_internal(int ref, int params, const char *param[], int execute_trace - execute the trace command -------------------------------------------------*/ -static void execute_trace(int ref, int params, const char *param[]) +static void execute_trace(running_machine *machine, int ref, int params, const char *param[]) { - execute_trace_internal(ref, params, param, 0); + execute_trace_internal(machine, ref, params, param, 0); } @@ -1922,9 +1921,9 @@ static void execute_trace(int ref, int params, const char *param[]) execute_traceover - execute the trace over command -------------------------------------------------*/ -static void execute_traceover(int ref, int params, const char *param[]) +static void execute_traceover(running_machine *machine, int ref, int params, const char *param[]) { - execute_trace_internal(ref, params, param, 1); + execute_trace_internal(machine, ref, params, param, 1); } @@ -1932,7 +1931,7 @@ static void execute_traceover(int ref, int params, const char *param[]) execute_traceflush - execute the trace flush command -------------------------------------------------*/ -static void execute_traceflush(int ref, int params, const char *param[]) +static void execute_traceflush(running_machine *machine, int ref, int params, const char *param[]) { debug_cpu_flush_traces(); } @@ -1942,7 +1941,7 @@ static void execute_traceflush(int ref, int params, const char *param[]) execute_history - execute the history command -------------------------------------------------*/ -static void execute_history(int ref, int params, const char *param[]) +static void execute_history(running_machine *machine, int ref, int params, const char *param[]) { UINT64 count = DEBUG_HISTORY_SIZE; const debug_cpu_info *info; @@ -1999,12 +1998,12 @@ static void execute_history(int ref, int params, const char *param[]) execute_snap - execute the trace over command -------------------------------------------------*/ -static void execute_snap(int ref, int params, const char *param[]) +static void execute_snap(running_machine *machine, int ref, int params, const char *param[]) { /* if no params, use the default behavior */ if (params == 0) { - video_save_active_screen_snapshots(Machine); + video_save_active_screen_snapshots(machine); debug_console_printf("Saved snapshot\n"); } @@ -2017,7 +2016,7 @@ static void execute_snap(int ref, int params, const char *param[]) int scrnum = (params > 1) ? atoi(param[1]) : 0; astring *fname; - const device_config *screen = device_list_find_by_index(Machine->config->devicelist, VIDEO_SCREEN, scrnum); + const device_config *screen = device_list_find_by_index(machine->config->devicelist, VIDEO_SCREEN, scrnum); if ((screen == NULL) || !render_is_live_screen(screen)) { @@ -2048,9 +2047,9 @@ static void execute_snap(int ref, int params, const char *param[]) execute_source - execute the source command -------------------------------------------------*/ -static void execute_source(int ref, int params, const char *param[]) +static void execute_source(running_machine *machine, int ref, int params, const char *param[]) { - debug_cpu_source_script(Machine, param[0]); + debug_cpu_source_script(machine, param[0]); } @@ -2058,7 +2057,7 @@ static void execute_source(int ref, int params, const char *param[]) execute_map - execute the map command -------------------------------------------------*/ -static void execute_map(int ref, int params, const char *param[]) +static void execute_map(running_machine *machine, int ref, int params, const char *param[]) { UINT64 address, cpunum = cpu_getactivecpu(); const debug_cpu_info *info; @@ -2099,7 +2098,7 @@ static void execute_map(int ref, int params, const char *param[]) execute_memdump - execute the memdump command -------------------------------------------------*/ -static void execute_memdump(int ref, int params, const char **param) +static void execute_memdump(running_machine *machine, int ref, int params, const char **param) { FILE *file; const char *filename; @@ -2128,7 +2127,7 @@ static int CLIB_DECL symbol_sort_compare(const void *item1, const void *item2) return strcmp(str1, str2); } -static void execute_symlist(int ref, int params, const char **param) +static void execute_symlist(running_machine *machine, int ref, int params, const char **param) { const char *namelist[1000]; symbol_table *symtable; @@ -2197,9 +2196,9 @@ static void execute_symlist(int ref, int params, const char **param) execute_softreset - execute the softreset command -------------------------------------------------*/ -static void execute_softreset(int ref, int params, const char **param) +static void execute_softreset(running_machine *machine, int ref, int params, const char **param) { - mame_schedule_soft_reset(Machine); + mame_schedule_soft_reset(machine); } @@ -2207,7 +2206,7 @@ static void execute_softreset(int ref, int params, const char **param) execute_hardreset - execute the hardreset command -------------------------------------------------*/ -static void execute_hardreset(int ref, int params, const char **param) +static void execute_hardreset(running_machine *machine, int ref, int params, const char **param) { - mame_schedule_hard_reset(Machine); + mame_schedule_hard_reset(machine); } diff --git a/src/emu/debug/debugcon.c b/src/emu/debug/debugcon.c index 98cc63a78fa..4142167c8ee 100644 --- a/src/emu/debug/debugcon.c +++ b/src/emu/debug/debugcon.c @@ -15,7 +15,6 @@ #include "debughlp.h" #include "debugvw.h" #include "textbuf.h" -#include "deprecat.h" #include "debugger.h" #include <ctype.h> @@ -44,7 +43,7 @@ struct _debug_command char command[32]; const char * params; const char * help; - void (*handler)(int ref, int params, const char **param); + void (*handler)(running_machine *machine, int ref, int params, const char **param); void (*handler_ex)(int ref); UINT32 flags; int ref; @@ -186,7 +185,7 @@ static void trim_parameter(char **paramptr, int keep_quotes) command -------------------------------------------------*/ -static CMDERR internal_execute_command(int execute, int params, char **param) +static CMDERR internal_execute_command(running_machine *machine, int execute, int params, char **param) { debug_command *cmd, *found = NULL; int i, foundcount = 0; @@ -248,7 +247,7 @@ static CMDERR internal_execute_command(int execute, int params, char **param) /* execute the handler */ if (execute) - (*found->handler)(found->ref, params, (const char **)param); + (*found->handler)(machine, found->ref, params, (const char **)param); return CMDERR_NONE; } @@ -258,7 +257,7 @@ static CMDERR internal_execute_command(int execute, int params, char **param) and either executes or just validates it -------------------------------------------------*/ -static CMDERR internal_parse_command(const char *original_command, int execute) +static CMDERR internal_parse_command(running_machine *machine, const char *original_command, int execute) { char command[MAX_COMMAND_LENGTH], parens[MAX_COMMAND_LENGTH]; char *params[MAX_COMMAND_PARAMS]; @@ -335,7 +334,7 @@ static CMDERR internal_parse_command(const char *original_command, int execute) } else { - result = internal_execute_command(execute, paramcount, ¶ms[0]); + result = internal_execute_command(machine, execute, paramcount, ¶ms[0]); if (result != CMDERR_NONE) return MAKE_CMDERR(CMDERR_ERROR_CLASS(result), command_start - command); } @@ -349,7 +348,7 @@ static CMDERR internal_parse_command(const char *original_command, int execute) command string -------------------------------------------------*/ -CMDERR debug_console_execute_command(const char *command, int echo) +CMDERR debug_console_execute_command(running_machine *machine, const char *command, int echo) { CMDERR result; @@ -358,7 +357,7 @@ CMDERR debug_console_execute_command(const char *command, int echo) debug_console_printf(">%s\n", command); /* parse and execute */ - result = internal_parse_command(command, TRUE); + result = internal_parse_command(machine, command, TRUE); /* display errors */ if (result != CMDERR_NONE) @@ -373,7 +372,7 @@ CMDERR debug_console_execute_command(const char *command, int echo) if (echo) { debug_view_update_all(); - debugger_refresh_display(Machine); + debugger_refresh_display(machine); } return result; } @@ -384,9 +383,9 @@ CMDERR debug_console_execute_command(const char *command, int echo) command string -------------------------------------------------*/ -CMDERR debug_console_validate_command(const char *command) +CMDERR debug_console_validate_command(running_machine *machine, const char *command) { - return internal_parse_command(command, FALSE); + return internal_parse_command(machine, command, FALSE); } @@ -395,12 +394,12 @@ CMDERR debug_console_validate_command(const char *command) command handler -------------------------------------------------*/ -void debug_console_register_command(const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(int ref, int params, const char **param)) +void debug_console_register_command(running_machine *machine, const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(running_machine *machine, int ref, int params, const char **param)) { debug_command *cmd; - assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call debug_console_register_command() at init time!"); - assert_always((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0, "Cannot call debug_console_register_command() when debugger is not running"); + assert_always(mame_get_phase(machine) == MAME_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_malloc(sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd)); diff --git a/src/emu/debug/debugcon.h b/src/emu/debug/debugcon.h index 36ce6457e9f..d62e4b195c6 100644 --- a/src/emu/debug/debugcon.h +++ b/src/emu/debug/debugcon.h @@ -62,7 +62,6 @@ #define MAKE_CMDERR_EXPRESSION_ERROR(x) MAKE_CMDERR(CMDERR_EXPRESSION_ERROR, (x)) - /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ @@ -81,9 +80,9 @@ void debug_console_init(running_machine *machine); void debug_console_exit(running_machine *machine); /* command handling */ -CMDERR debug_console_execute_command(const char *command, int echo); -CMDERR debug_console_validate_command(const char *command); -void debug_console_register_command(const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(int ref, int params, const char **param)); +CMDERR debug_console_execute_command(running_machine *machine, const char *command, int echo); +CMDERR debug_console_validate_command(running_machine *machine, const char *command); +void debug_console_register_command(running_machine *machine, const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(running_machine *machine, int ref, int params, const char **param)); const char * debug_cmderr_to_string(CMDERR error); /* console management */ diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index ff22acc8f3d..d164e2ac0de 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -91,10 +91,10 @@ static debugger_private global; ***************************************************************************/ static void debug_cpu_exit(running_machine *machine); -static void perform_trace(debug_cpu_info *info); +static void perform_trace(running_machine *machine, debug_cpu_info *info); static void prepare_for_step_overout(debug_cpu_info *info); -static void process_source_file(void); -static void breakpoint_check(debug_cpu_info *info, offs_t pc); +static void process_source_file(running_machine *machine); +static void breakpoint_check(running_machine *machine, debug_cpu_info *info, offs_t pc); static void watchpoint_check(running_machine *machine, int cpunum, int spacenum, int type, offs_t address, UINT64 value_to_write, UINT64 mem_mask); static void check_hotspots(int cpunum, int spacenum, offs_t address); @@ -384,7 +384,7 @@ static void compute_debug_flags(running_machine *machine, const debug_cpu_info * /* if any of the watchpoint flags are set and we're live, tell the memory system */ if (global.livecpu != NULL && ((info->flags & DEBUG_FLAG_WATCHPOINT) != 0)) - memory_set_context(-1); + memory_set_context(machine, -1); } @@ -533,7 +533,7 @@ void debug_cpu_instruction_hook(running_machine *machine, offs_t curpc) /* are we tracing? */ if (info->flags & DEBUG_FLAG_TRACING_ANY) - perform_trace(info); + perform_trace(machine, info); /* per-instruction hook? */ if (global.execution_state != EXECUTION_STATE_STOPPED && (info->flags & DEBUG_FLAG_HOOKED) != 0 && (*info->instrhook)(curpc)) @@ -581,7 +581,7 @@ void debug_cpu_instruction_hook(running_machine *machine, offs_t curpc) /* check for execution breakpoints */ else if ((info->flags & DEBUG_FLAG_LIVE_BP) != 0) - breakpoint_check(info, curpc); + breakpoint_check(machine, info, curpc); } /* if we are supposed to halt, do it now */ @@ -613,7 +613,7 @@ void debug_cpu_instruction_hook(running_machine *machine, offs_t curpc) } /* check for commands in the source file */ - process_source_file(); + process_source_file(machine); /* if an event got scheduled, resume */ if (mame_is_scheduled_event_pending(machine)) @@ -976,7 +976,7 @@ static UINT32 dasm_wrapped(char *buffer, offs_t pc) } -static void perform_trace(debug_cpu_info *info) +static void perform_trace(running_machine *machine, debug_cpu_info *info) { offs_t pc = activecpu_get_pc(); int offset, count, i; @@ -1006,7 +1006,7 @@ static void perform_trace(debug_cpu_info *info) /* execute any trace actions first */ if (info->trace.action != NULL) - debug_console_execute_command(info->trace.action, 0); + debug_console_execute_command(machine, info->trace.action, 0); /* print the address */ offset = sprintf(buffer, "%0*X: ", info->space[ADDRESS_SPACE_PROGRAM].logchars, pc); @@ -1083,7 +1083,7 @@ static void prepare_for_step_overout(debug_cpu_info *info) a source file -------------------------------------------------*/ -static void process_source_file(void) +static void process_source_file(running_machine *machine) { /* loop until the file is exhausted or until we are executing again */ while (debug_source_file != NULL && global.execution_state == EXECUTION_STATE_STOPPED) @@ -1116,7 +1116,7 @@ static void process_source_file(void) /* execute the command */ if (buf[0]) - debug_console_execute_command(buf, 1); + debug_console_execute_command(machine, buf, 1); } } @@ -1173,7 +1173,7 @@ static void breakpoint_update_flags(running_machine *machine, debug_cpu_info *in a given CPU -------------------------------------------------*/ -static void breakpoint_check(debug_cpu_info *info, offs_t pc) +static void breakpoint_check(running_machine *machine, debug_cpu_info *info, offs_t pc) { debug_cpu_breakpoint *bp; UINT64 result; @@ -1190,7 +1190,7 @@ static void breakpoint_check(debug_cpu_info *info, offs_t pc) /* if we hit, evaluate the action */ if (bp->action != NULL) - debug_console_execute_command(bp->action, 0); + debug_console_execute_command(machine, bp->action, 0); /* print a notification, unless the action made us go again */ if (global.execution_state == EXECUTION_STATE_STOPPED) @@ -1409,7 +1409,7 @@ static void watchpoint_check(running_machine *machine, int cpunum, int spacenum, /* if we hit, evaluate the action */ if (wp->action != NULL) - debug_console_execute_command(wp->action, 0); + debug_console_execute_command(machine, wp->action, 0); /* print a notification, unless the action made us go again */ if (global.execution_state == EXECUTION_STATE_STOPPED) @@ -2111,7 +2111,7 @@ UINT64 debug_read_opcode(offs_t address, int size, int arg) /* get pointer to data */ /* note that we query aligned to the bus width, and then add back the low bits */ lowbits_mask = info->space[ADDRESS_SPACE_PROGRAM].databytes - 1; - ptr = memory_get_op_ptr(cpu_getactivecpu(), address & ~lowbits_mask, arg); + ptr = memory_get_op_ptr(Machine, cpu_getactivecpu(), address & ~lowbits_mask, arg); if (!ptr) return ~(UINT64)0 & (~(UINT64)0 >> (64 - 8*size)); ptr = (UINT8 *)ptr + (address & lowbits_mask); @@ -2265,7 +2265,7 @@ static UINT64 expression_read_program_direct(int cpuindex, int opcode, offs_t ad /* get the base of memory, aligned to the address minus the lowbits */ if (opcode & 1) - base = memory_get_op_ptr(cpuindex, address & ~lowmask, FALSE); + base = memory_get_op_ptr(Machine, cpuindex, address & ~lowmask, FALSE); else base = memory_get_read_ptr(cpuindex, ADDRESS_SPACE_PROGRAM, address & ~lowmask); @@ -2479,7 +2479,7 @@ static void expression_write_program_direct(int cpuindex, int opcode, offs_t add /* get the base of memory, aligned to the address minus the lowbits */ if (opcode & 1) - base = memory_get_op_ptr(cpuindex, address & ~lowmask, FALSE); + base = memory_get_op_ptr(Machine, cpuindex, address & ~lowmask, FALSE); else base = memory_get_read_ptr(cpuindex, ADDRESS_SPACE_PROGRAM, address & ~lowmask); diff --git a/src/emu/drivers/empty.c b/src/emu/drivers/empty.c index 573a72d4c6a..c545e9e45a9 100644 --- a/src/emu/drivers/empty.c +++ b/src/emu/drivers/empty.c @@ -22,7 +22,7 @@ static MACHINE_START( empty ) { /* force the UI to show the game select screen */ - ui_menu_force_game_select(); + ui_menu_force_game_select(machine); } diff --git a/src/emu/input.c b/src/emu/input.c index 6eaac6dab8d..5f75019ea4b 100644 --- a/src/emu/input.c +++ b/src/emu/input.c @@ -22,7 +22,6 @@ #include "mame.h" #include "emuopts.h" #include "profiler.h" -#include "deprecat.h" @@ -82,6 +81,7 @@ struct _joystick_map /* a single input device */ struct _input_device { + running_machine * machine; /* machine we are attached to */ astring * name; /* string name of device */ input_device_class devclass; /* class of this device */ int devindex; /* device index of this device */ @@ -719,12 +719,12 @@ static void input_frame(running_machine *machine) input_device_add - add a new input device -------------------------------------------------*/ -input_device *input_device_add(input_device_class devclass, const char *name, void *internal) +input_device *input_device_add(running_machine *machine, input_device_class devclass, const char *name, void *internal) { input_device_list *devlist = &device_list[devclass]; input_device *device; - assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call input_device_add at init time!"); + assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call input_device_add at init time!"); assert(name != NULL); assert(devclass != DEVICE_CLASS_INVALID && devclass < DEVICE_CLASS_MAXIMUM); @@ -734,6 +734,7 @@ input_device *input_device_add(input_device_class devclass, const char *name, vo memset(device, 0, sizeof(*device)); /* fill in the data */ + device->machine = machine; device->name = astring_cpyc(auto_astring_alloc(), name); device->devclass = devclass; device->devindex = devlist->count - 1; @@ -761,7 +762,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(Machine) == MAME_PHASE_INIT, "Can only call input_device_item_add at init time!"); + assert_always(mame_get_phase(device->machine) == MAME_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); diff --git a/src/emu/input.h b/src/emu/input.h index 303121cd5ac..7f33b4e5d7f 100644 --- a/src/emu/input.h +++ b/src/emu/input.h @@ -592,7 +592,7 @@ int input_device_set_joystick_map(int devindex, const char *mapstring); /* ----- OSD configuration and access ----- */ /* add a new input device */ -input_device *input_device_add(input_device_class devclass, const char *name, void *internal); +input_device *input_device_add(running_machine *machine, input_device_class devclass, const char *name, void *internal); /* add a new item to an input device */ void input_device_item_add(input_device *device, const char *name, void *internal, input_item_id itemid, item_get_state_func getstate); diff --git a/src/emu/mame.c b/src/emu/mame.c index e8195698e51..066190731f4 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -552,7 +552,7 @@ void mame_schedule_exit(running_machine *machine) if (started_empty && options_get_string(mame_options(), OPTION_GAMENAME)[0] != 0) { options_set_string(mame_options(), OPTION_GAMENAME, "", OPTION_PRIORITY_CMDLINE); - ui_menu_force_game_select(); + ui_menu_force_game_select(machine); } /* otherwise, exit for real */ @@ -1145,9 +1145,8 @@ void CLIB_DECL fatalerror(const char *text, ...) } -void CLIB_DECL fatalerror_exitcode(int exitcode, const char *text, ...) +void CLIB_DECL fatalerror_exitcode(running_machine *machine, int exitcode, const char *text, ...) { - running_machine *machine = Machine; va_list arg; /* dump to the buffer; assume no one writes >2k lines this way */ @@ -1647,7 +1646,7 @@ static TIMER_CALLBACK( soft_reset ) /* set the global time to the current time */ /* this allows 0-time queued callbacks to run before any CPUs execute */ - timer_set_global_time(timer_get_time()); + timer_set_global_time(machine, timer_get_time()); } @@ -1734,7 +1733,7 @@ static void handle_save(running_machine *machine) /* write the default tag */ state_save_push_tag(0); - state_save_save_continue(); + state_save_save_continue(machine); state_save_pop_tag(); /* loop over CPUs */ @@ -1747,14 +1746,14 @@ static void handle_save(running_machine *machine) /* save the CPU data */ state_save_push_tag(cpunum + 1); - state_save_save_continue(); + state_save_save_continue(machine); state_save_pop_tag(); cpuintrf_pop_context(); } /* finish and close */ - state_save_save_finish(); + state_save_save_finish(machine); mame_fclose(file); /* pop a warning if the game doesn't support saves */ @@ -1816,7 +1815,7 @@ static void handle_load(running_machine *machine) /* read tag 0 */ state_save_push_tag(0); - state_save_load_continue(); + state_save_load_continue(machine); state_save_pop_tag(); /* loop over CPUs */ @@ -1829,7 +1828,7 @@ static void handle_load(running_machine *machine) /* load the CPU data */ state_save_push_tag(cpunum + 1); - state_save_load_continue(); + state_save_load_continue(machine); state_save_pop_tag(); /* make sure banking is set */ diff --git a/src/emu/mamecore.h b/src/emu/mamecore.h index ae8c605bc39..fcb4753e217 100644 --- a/src/emu/mamecore.h +++ b/src/emu/mamecore.h @@ -290,7 +290,7 @@ typedef union /* Used by assert(), so definition here instead of mame.h */ DECL_NORETURN void CLIB_DECL fatalerror(const char *text, ...) ATTR_PRINTF(1,2) ATTR_NORETURN; -DECL_NORETURN void CLIB_DECL fatalerror_exitcode(int exitcode, const char *text, ...) ATTR_PRINTF(2,3) ATTR_NORETURN; +DECL_NORETURN void CLIB_DECL fatalerror_exitcode(running_machine *machine, int exitcode, const char *text, ...) ATTR_PRINTF(3,4) ATTR_NORETURN; diff --git a/src/emu/memory.c b/src/emu/memory.c index 8ff44acf52f..76f81a67d54 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -372,8 +372,8 @@ static void address_map_detokenize(address_map *map, const game_driver *driver, static void memory_init_cpudata(running_machine *machine); static void memory_init_preflight(running_machine *machine); static void memory_init_populate(running_machine *machine); -static void space_map_range_private(addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name); -static void space_map_range(addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name); +static void space_map_range_private(running_machine *machine, addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name); +static void space_map_range(running_machine *machine, addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name); static void bank_assign_static(int banknum, int cpunum, int spacenum, read_or_write readorwrite, offs_t bytestart, offs_t byteend); static genf *bank_assign_dynamic(int cpunum, int spacenum, read_or_write readorwrite, offs_t bytestart, offs_t byteend); static UINT8 table_assign_handler(handler_data *table, void *object, genf *handler, const char *handler_name, offs_t bytestart, offs_t byteend, offs_t bytemask); @@ -779,7 +779,7 @@ static void memory_exit(running_machine *machine) memory_set_context - set the memory context -------------------------------------------------*/ -void memory_set_context(int activecpu) +void memory_set_context(running_machine *machine, int activecpu) { addrspace_data *space; @@ -796,8 +796,8 @@ void memory_set_context(int activecpu) /* program address space */ space = &cpudata[activecpu].space[ADDRESS_SPACE_PROGRAM]; active_address_space[ADDRESS_SPACE_PROGRAM].bytemask = space->bytemask; - active_address_space[ADDRESS_SPACE_PROGRAM].readlookup = ((Machine->debug_flags & DEBUG_FLAG_WPR_PROGRAM) != 0) ? wptable : space->read.table; - active_address_space[ADDRESS_SPACE_PROGRAM].writelookup = ((Machine->debug_flags & DEBUG_FLAG_WPW_PROGRAM) != 0) ? wptable : space->write.table; + active_address_space[ADDRESS_SPACE_PROGRAM].readlookup = ((machine->debug_flags & DEBUG_FLAG_WPR_PROGRAM) != 0) ? wptable : space->read.table; + active_address_space[ADDRESS_SPACE_PROGRAM].writelookup = ((machine->debug_flags & DEBUG_FLAG_WPW_PROGRAM) != 0) ? wptable : space->write.table; active_address_space[ADDRESS_SPACE_PROGRAM].readhandlers = space->read.handlers; active_address_space[ADDRESS_SPACE_PROGRAM].writehandlers = space->write.handlers; active_address_space[ADDRESS_SPACE_PROGRAM].accessors = space->accessors; @@ -807,8 +807,8 @@ void memory_set_context(int activecpu) { space = &cpudata[activecpu].space[ADDRESS_SPACE_DATA]; active_address_space[ADDRESS_SPACE_DATA].bytemask = space->bytemask; - active_address_space[ADDRESS_SPACE_DATA].readlookup = ((Machine->debug_flags & DEBUG_FLAG_WPR_DATA) != 0) ? wptable : space->read.table; - active_address_space[ADDRESS_SPACE_DATA].writelookup = ((Machine->debug_flags & DEBUG_FLAG_WPW_DATA) != 0) ? wptable : space->write.table; + active_address_space[ADDRESS_SPACE_DATA].readlookup = ((machine->debug_flags & DEBUG_FLAG_WPR_DATA) != 0) ? wptable : space->read.table; + active_address_space[ADDRESS_SPACE_DATA].writelookup = ((machine->debug_flags & DEBUG_FLAG_WPW_DATA) != 0) ? wptable : space->write.table; active_address_space[ADDRESS_SPACE_DATA].readhandlers = space->read.handlers; active_address_space[ADDRESS_SPACE_DATA].writehandlers = space->write.handlers; active_address_space[ADDRESS_SPACE_DATA].accessors = space->accessors; @@ -819,8 +819,8 @@ void memory_set_context(int activecpu) { space = &cpudata[activecpu].space[ADDRESS_SPACE_IO]; active_address_space[ADDRESS_SPACE_IO].bytemask = space->bytemask; - active_address_space[ADDRESS_SPACE_IO].readlookup = ((Machine->debug_flags & DEBUG_FLAG_WPR_IO) != 0) ? wptable : space->read.table; - active_address_space[ADDRESS_SPACE_IO].writelookup = ((Machine->debug_flags & DEBUG_FLAG_WPW_IO) != 0) ? wptable : space->write.table; + active_address_space[ADDRESS_SPACE_IO].readlookup = ((machine->debug_flags & DEBUG_FLAG_WPR_IO) != 0) ? wptable : space->read.table; + active_address_space[ADDRESS_SPACE_IO].writelookup = ((machine->debug_flags & DEBUG_FLAG_WPW_IO) != 0) ? wptable : space->write.table; active_address_space[ADDRESS_SPACE_IO].readhandlers = space->read.handlers; active_address_space[ADDRESS_SPACE_IO].writehandlers = space->write.handlers; active_address_space[ADDRESS_SPACE_IO].accessors = space->accessors; @@ -1288,7 +1288,7 @@ void *memory_get_write_ptr(int cpunum, int spacenum, offs_t byteaddress) CPU and offset -------------------------------------------------*/ -void *memory_get_op_ptr(int cpunum, offs_t byteaddress, int arg) +void *memory_get_op_ptr(running_machine *machine, int cpunum, offs_t byteaddress, int arg) { addrspace_data *space = &cpudata[cpunum].space[ADDRESS_SPACE_PROGRAM]; offs_t byteoffset; @@ -1302,7 +1302,7 @@ void *memory_get_op_ptr(int cpunum, offs_t byteaddress, int arg) opbase_data saved_opbase = opbase; /* query the handler */ - offs_t new_byteaddress = (*cpudata[cpunum].opbase_handler)(Machine, byteaddress, &opbase); + offs_t new_byteaddress = (*cpudata[cpunum].opbase_handler)(machine, byteaddress, &opbase); /* if it returns ~0, we use whatever data the handler set */ if (new_byteaddress == ~0) @@ -1502,9 +1502,9 @@ void *_memory_install_handler(running_machine *machine, int cpunum, int spacenum if (rhandler >= STATIC_COUNT || whandler >= STATIC_COUNT) fatalerror("fatal: can only use static banks with memory_install_handler()"); if (rhandler != 0) - space_map_range(space, ROW_READ, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)rhandler, machine, rhandler_name); + space_map_range(machine, space, ROW_READ, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)rhandler, machine, rhandler_name); if (whandler != 0) - space_map_range(space, ROW_WRITE, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, machine, whandler_name); + space_map_range(machine, space, ROW_WRITE, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, machine, whandler_name); mem_dump(); return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart)); } @@ -1513,9 +1513,9 @@ UINT8 *_memory_install_handler8(running_machine *machine, int cpunum, int spacen { addrspace_data *space = &cpudata[cpunum].space[spacenum]; if (rhandler != NULL) - space_map_range(space, ROW_READ, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, machine, rhandler_name); + space_map_range(machine, space, ROW_READ, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, machine, rhandler_name); if (whandler != NULL) - space_map_range(space, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, machine, whandler_name); + space_map_range(machine, space, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, machine, whandler_name); mem_dump(); return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart)); } @@ -1524,9 +1524,9 @@ UINT16 *_memory_install_handler16(running_machine *machine, int cpunum, int spac { addrspace_data *space = &cpudata[cpunum].space[spacenum]; if (rhandler != NULL) - space_map_range(space, ROW_READ, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, machine, rhandler_name); + space_map_range(machine, space, ROW_READ, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, machine, rhandler_name); if (whandler != NULL) - space_map_range(space, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, machine, whandler_name); + space_map_range(machine, space, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, machine, whandler_name); mem_dump(); return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart)); } @@ -1535,9 +1535,9 @@ UINT32 *_memory_install_handler32(running_machine *machine, int cpunum, int spac { addrspace_data *space = &cpudata[cpunum].space[spacenum]; if (rhandler != NULL) - space_map_range(space, ROW_READ, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, machine, rhandler_name); + space_map_range(machine, space, ROW_READ, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, machine, rhandler_name); if (whandler != NULL) - space_map_range(space, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, machine, whandler_name); + space_map_range(machine, space, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, machine, whandler_name); mem_dump(); return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart)); } @@ -1546,9 +1546,9 @@ UINT64 *_memory_install_handler64(running_machine *machine, int cpunum, int spac { addrspace_data *space = &cpudata[cpunum].space[spacenum]; if (rhandler != NULL) - space_map_range(space, ROW_READ, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, machine, rhandler_name); + space_map_range(machine, space, ROW_READ, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, machine, rhandler_name); if (whandler != NULL) - space_map_range(space, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, machine, whandler_name); + space_map_range(machine, space, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, machine, whandler_name); mem_dump(); return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart)); } @@ -1566,9 +1566,9 @@ void *_memory_install_device_handler(const device_config *device, int cpunum, in if (rhandler >= STATIC_COUNT || whandler >= STATIC_COUNT) fatalerror("fatal: can only use static banks with memory_install_device_handler()"); if (rhandler != 0) - space_map_range(space, ROW_READ, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)rhandler, (void *)device, rhandler_name); + space_map_range(device->machine, space, ROW_READ, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)rhandler, (void *)device, rhandler_name); if (whandler != 0) - space_map_range(space, ROW_WRITE, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, (void *)device, whandler_name); + space_map_range(device->machine, space, ROW_WRITE, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, (void *)device, whandler_name); mem_dump(); return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart)); } @@ -1577,9 +1577,9 @@ UINT8 *_memory_install_device_handler8(const device_config *device, int cpunum, { addrspace_data *space = &cpudata[cpunum].space[spacenum]; if (rhandler != NULL) - space_map_range(space, ROW_READ, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); + space_map_range(device->machine, space, ROW_READ, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); if (whandler != NULL) - space_map_range(space, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); + space_map_range(device->machine, space, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(); return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart)); } @@ -1588,9 +1588,9 @@ UINT16 *_memory_install_device_handler16(const device_config *device, int cpunum { addrspace_data *space = &cpudata[cpunum].space[spacenum]; if (rhandler != NULL) - space_map_range(space, ROW_READ, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); + space_map_range(device->machine, space, ROW_READ, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); if (whandler != NULL) - space_map_range(space, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); + space_map_range(device->machine, space, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(); return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart)); } @@ -1599,9 +1599,9 @@ UINT32 *_memory_install_device_handler32(const device_config *device, int cpunum { addrspace_data *space = &cpudata[cpunum].space[spacenum]; if (rhandler != NULL) - space_map_range(space, ROW_READ, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); + space_map_range(device->machine, space, ROW_READ, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); if (whandler != NULL) - space_map_range(space, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); + space_map_range(device->machine, space, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(); return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart)); } @@ -1610,9 +1610,9 @@ UINT64 *_memory_install_device_handler64(const device_config *device, int cpunum { addrspace_data *space = &cpudata[cpunum].space[spacenum]; if (rhandler != NULL) - space_map_range(space, ROW_READ, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); + space_map_range(device->machine, space, ROW_READ, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); if (whandler != NULL) - space_map_range(space, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); + space_map_range(device->machine, space, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(); return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart)); } @@ -1856,7 +1856,7 @@ static void memory_init_populate(running_machine *machine) if (object == NULL) fatalerror("Unidentified object in memory map: type=%s tag=%s\n", devtype_name(entry->read_devtype), entry->read_devtag); } - space_map_range_private(space, ROW_READ, bits, entry->read_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, rhandler.generic, object, entry->read_name); + space_map_range_private(machine, space, ROW_READ, bits, entry->read_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, rhandler.generic, object, entry->read_name); } /* install the write handler if present */ @@ -1870,7 +1870,7 @@ static void memory_init_populate(running_machine *machine) if (object == NULL) fatalerror("Unidentified object in memory map: type=%s tag=%s\n", devtype_name(entry->write_devtype), entry->write_devtag); } - space_map_range_private(space, ROW_WRITE, bits, entry->write_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, whandler.generic, object, entry->write_name); + space_map_range_private(machine, space, ROW_WRITE, bits, entry->write_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, whandler.generic, object, entry->write_name); } } } @@ -1885,7 +1885,7 @@ static void memory_init_populate(running_machine *machine) banks to dynamically assigned banks -------------------------------------------------*/ -static void space_map_range_private(addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name) +static void space_map_range_private(running_machine *machine, addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name) { /* translate ROM to RAM/UNMAP here */ if (HANDLER_IS_ROM(handler)) @@ -1909,7 +1909,7 @@ static void space_map_range_private(addrspace_data *space, read_or_write readorw } /* then do a normal installation */ - space_map_range(space, readorwrite, handlerbits, handlerunitmask, addrstart, addrend, addrmask, addrmirror, handler, object, handler_name); + space_map_range(machine, space, readorwrite, handlerbits, handlerunitmask, addrstart, addrend, addrmask, addrmirror, handler, object, handler_name); } @@ -1919,7 +1919,7 @@ static void space_map_range_private(addrspace_data *space, read_or_write readorw space -------------------------------------------------*/ -static void space_map_range(addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name) +static void space_map_range(running_machine *machine, addrspace_data *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name) { table_data *tabledata = (readorwrite == ROW_WRITE) ? &space->write : &space->read; offs_t bytestart, byteend, bytemask, bytemirror; @@ -1960,7 +1960,7 @@ static void space_map_range(addrspace_data *space, read_or_write readorwrite, in /* if this is being installed to a live CPU, update the context */ if (space->cpunum == cur_context) - memory_set_context(cur_context); + memory_set_context(machine, cur_context); } @@ -3003,107 +3003,107 @@ static WRITE64_HANDLER( mwh64_nop ) { } watchpoint memory handlers -------------------------------------------------*/ -INLINE UINT8 watchpoint_read8(int spacenum, offs_t address) +INLINE UINT8 watchpoint_read8(running_machine *machine, int spacenum, offs_t address) { UINT8 result; - debug_cpu_memory_read_hook(Machine, cur_context, spacenum, address, 0xff); + debug_cpu_memory_read_hook(machine, cur_context, spacenum, address, 0xff); active_address_space[spacenum].readlookup = cpudata[cur_context].space[spacenum].read.table; result = read_byte_generic(spacenum, address); active_address_space[spacenum].readlookup = wptable; return result; } -INLINE UINT16 watchpoint_read16(int spacenum, offs_t address, UINT16 mem_mask) +INLINE UINT16 watchpoint_read16(running_machine *machine, int spacenum, offs_t address, UINT16 mem_mask) { UINT16 result; - debug_cpu_memory_read_hook(Machine, cur_context, spacenum, address << 1, mem_mask); + debug_cpu_memory_read_hook(machine, cur_context, spacenum, address << 1, mem_mask); active_address_space[spacenum].readlookup = cpudata[cur_context].space[spacenum].read.table; result = read_word_generic(spacenum, address << 1, mem_mask); active_address_space[spacenum].readlookup = wptable; return result; } -INLINE UINT32 watchpoint_read32(int spacenum, offs_t address, UINT32 mem_mask) +INLINE UINT32 watchpoint_read32(running_machine *machine, int spacenum, offs_t address, UINT32 mem_mask) { UINT32 result; - debug_cpu_memory_read_hook(Machine, cur_context, spacenum, address << 2, mem_mask); + debug_cpu_memory_read_hook(machine, cur_context, spacenum, address << 2, mem_mask); active_address_space[spacenum].readlookup = cpudata[cur_context].space[spacenum].read.table; result = read_dword_generic(spacenum, address << 2, mem_mask); active_address_space[spacenum].readlookup = wptable; return result; } -INLINE UINT64 watchpoint_read64(int spacenum, offs_t address, UINT64 mem_mask) +INLINE UINT64 watchpoint_read64(running_machine *machine, int spacenum, offs_t address, UINT64 mem_mask) { UINT64 result; - debug_cpu_memory_read_hook(Machine, cur_context, spacenum, address << 3, mem_mask); + debug_cpu_memory_read_hook(machine, cur_context, spacenum, address << 3, mem_mask); active_address_space[spacenum].readlookup = cpudata[cur_context].space[spacenum].read.table; result = read_qword_generic(spacenum, address << 3, mem_mask); active_address_space[spacenum].readlookup = wptable; return result; } -INLINE void watchpoint_write8(int spacenum, offs_t address, UINT8 data) +INLINE void watchpoint_write8(running_machine *machine, int spacenum, offs_t address, UINT8 data) { - debug_cpu_memory_write_hook(Machine, cur_context, spacenum, address, data, 0xff); + debug_cpu_memory_write_hook(machine, cur_context, spacenum, address, data, 0xff); active_address_space[spacenum].writelookup = cpudata[cur_context].space[spacenum].write.table; write_byte_generic(spacenum, address, data); active_address_space[spacenum].writelookup = wptable; } -INLINE void watchpoint_write16(int spacenum, offs_t address, UINT16 data, UINT16 mem_mask) +INLINE void watchpoint_write16(running_machine *machine, int spacenum, offs_t address, UINT16 data, UINT16 mem_mask) { - debug_cpu_memory_write_hook(Machine, cur_context, spacenum, address << 1, data, mem_mask); + debug_cpu_memory_write_hook(machine, cur_context, spacenum, address << 1, data, mem_mask); active_address_space[spacenum].writelookup = cpudata[cur_context].space[spacenum].write.table; write_word_generic(spacenum, address << 1, data, mem_mask); active_address_space[spacenum].writelookup = wptable; } -INLINE void watchpoint_write32(int spacenum, offs_t address, UINT32 data, UINT32 mem_mask) +INLINE void watchpoint_write32(running_machine *machine, int spacenum, offs_t address, UINT32 data, UINT32 mem_mask) { - debug_cpu_memory_write_hook(Machine, cur_context, spacenum, address << 2, data, mem_mask); + debug_cpu_memory_write_hook(machine, cur_context, spacenum, address << 2, data, mem_mask); active_address_space[spacenum].writelookup = cpudata[cur_context].space[spacenum].write.table; write_dword_generic(spacenum, address << 2, data, mem_mask); active_address_space[spacenum].writelookup = wptable; } -INLINE void watchpoint_write64(int spacenum, offs_t address, UINT64 data, UINT64 mem_mask) +INLINE void watchpoint_write64(running_machine *machine, int spacenum, offs_t address, UINT64 data, UINT64 mem_mask) { - debug_cpu_memory_write_hook(Machine, cur_context, spacenum, address << 3, data, mem_mask); + debug_cpu_memory_write_hook(machine, cur_context, spacenum, address << 3, data, mem_mask); active_address_space[spacenum].writelookup = cpudata[cur_context].space[spacenum].write.table; write_qword_generic(spacenum, address << 3, data, mem_mask); active_address_space[spacenum].writelookup = wptable; } -static READ8_HANDLER( mrh8_watchpoint_program ) { return watchpoint_read8 (ADDRESS_SPACE_PROGRAM, offset); } -static READ16_HANDLER( mrh16_watchpoint_program ) { return watchpoint_read16(ADDRESS_SPACE_PROGRAM, offset, mem_mask); } -static READ32_HANDLER( mrh32_watchpoint_program ) { return watchpoint_read32(ADDRESS_SPACE_PROGRAM, offset, mem_mask); } -static READ64_HANDLER( mrh64_watchpoint_program ) { return watchpoint_read64(ADDRESS_SPACE_PROGRAM, offset, mem_mask); } +static READ8_HANDLER( mrh8_watchpoint_program ) { return watchpoint_read8 (machine, ADDRESS_SPACE_PROGRAM, offset); } +static READ16_HANDLER( mrh16_watchpoint_program ) { return watchpoint_read16(machine, ADDRESS_SPACE_PROGRAM, offset, mem_mask); } +static READ32_HANDLER( mrh32_watchpoint_program ) { return watchpoint_read32(machine, ADDRESS_SPACE_PROGRAM, offset, mem_mask); } +static READ64_HANDLER( mrh64_watchpoint_program ) { return watchpoint_read64(machine, ADDRESS_SPACE_PROGRAM, offset, mem_mask); } -static WRITE8_HANDLER( mwh8_watchpoint_program ) { watchpoint_write8 (ADDRESS_SPACE_PROGRAM, offset, data); } -static WRITE16_HANDLER( mwh16_watchpoint_program ) { watchpoint_write16(ADDRESS_SPACE_PROGRAM, offset, data, mem_mask); } -static WRITE32_HANDLER( mwh32_watchpoint_program ) { watchpoint_write32(ADDRESS_SPACE_PROGRAM, offset, data, mem_mask); } -static WRITE64_HANDLER( mwh64_watchpoint_program ) { watchpoint_write64(ADDRESS_SPACE_PROGRAM, offset, data, mem_mask); } +static WRITE8_HANDLER( mwh8_watchpoint_program ) { watchpoint_write8 (machine, ADDRESS_SPACE_PROGRAM, offset, data); } +static WRITE16_HANDLER( mwh16_watchpoint_program ) { watchpoint_write16(machine, ADDRESS_SPACE_PROGRAM, offset, data, mem_mask); } +static WRITE32_HANDLER( mwh32_watchpoint_program ) { watchpoint_write32(machine, ADDRESS_SPACE_PROGRAM, offset, data, mem_mask); } +static WRITE64_HANDLER( mwh64_watchpoint_program ) { watchpoint_write64(machine, ADDRESS_SPACE_PROGRAM, offset, data, mem_mask); } -static READ8_HANDLER( mrh8_watchpoint_data ) { return watchpoint_read8 (ADDRESS_SPACE_DATA, offset); } -static READ16_HANDLER( mrh16_watchpoint_data ) { return watchpoint_read16(ADDRESS_SPACE_DATA, offset, mem_mask); } -static READ32_HANDLER( mrh32_watchpoint_data ) { return watchpoint_read32(ADDRESS_SPACE_DATA, offset, mem_mask); } -static READ64_HANDLER( mrh64_watchpoint_data ) { return watchpoint_read64(ADDRESS_SPACE_DATA, offset, mem_mask); } +static READ8_HANDLER( mrh8_watchpoint_data ) { return watchpoint_read8 (machine, ADDRESS_SPACE_DATA, offset); } +static READ16_HANDLER( mrh16_watchpoint_data ) { return watchpoint_read16(machine, ADDRESS_SPACE_DATA, offset, mem_mask); } +static READ32_HANDLER( mrh32_watchpoint_data ) { return watchpoint_read32(machine, ADDRESS_SPACE_DATA, offset, mem_mask); } +static READ64_HANDLER( mrh64_watchpoint_data ) { return watchpoint_read64(machine, ADDRESS_SPACE_DATA, offset, mem_mask); } -static WRITE8_HANDLER( mwh8_watchpoint_data ) { watchpoint_write8 (ADDRESS_SPACE_DATA, offset, data); } -static WRITE16_HANDLER( mwh16_watchpoint_data ) { watchpoint_write16(ADDRESS_SPACE_DATA, offset, data, mem_mask); } -static WRITE32_HANDLER( mwh32_watchpoint_data ) { watchpoint_write32(ADDRESS_SPACE_DATA, offset, data, mem_mask); } -static WRITE64_HANDLER( mwh64_watchpoint_data ) { watchpoint_write64(ADDRESS_SPACE_DATA, offset, data, mem_mask); } +static WRITE8_HANDLER( mwh8_watchpoint_data ) { watchpoint_write8 (machine, ADDRESS_SPACE_DATA, offset, data); } +static WRITE16_HANDLER( mwh16_watchpoint_data ) { watchpoint_write16(machine, ADDRESS_SPACE_DATA, offset, data, mem_mask); } +static WRITE32_HANDLER( mwh32_watchpoint_data ) { watchpoint_write32(machine, ADDRESS_SPACE_DATA, offset, data, mem_mask); } +static WRITE64_HANDLER( mwh64_watchpoint_data ) { watchpoint_write64(machine, ADDRESS_SPACE_DATA, offset, data, mem_mask); } -static READ8_HANDLER( mrh8_watchpoint_io ) { return watchpoint_read8 (ADDRESS_SPACE_IO, offset); } -static READ16_HANDLER( mrh16_watchpoint_io ) { return watchpoint_read16(ADDRESS_SPACE_IO, offset, mem_mask); } -static READ32_HANDLER( mrh32_watchpoint_io ) { return watchpoint_read32(ADDRESS_SPACE_IO, offset, mem_mask); } -static READ64_HANDLER( mrh64_watchpoint_io ) { return watchpoint_read64(ADDRESS_SPACE_IO, offset, mem_mask); } +static READ8_HANDLER( mrh8_watchpoint_io ) { return watchpoint_read8 (machine, ADDRESS_SPACE_IO, offset); } +static READ16_HANDLER( mrh16_watchpoint_io ) { return watchpoint_read16(machine, ADDRESS_SPACE_IO, offset, mem_mask); } +static READ32_HANDLER( mrh32_watchpoint_io ) { return watchpoint_read32(machine, ADDRESS_SPACE_IO, offset, mem_mask); } +static READ64_HANDLER( mrh64_watchpoint_io ) { return watchpoint_read64(machine, ADDRESS_SPACE_IO, offset, mem_mask); } -static WRITE8_HANDLER( mwh8_watchpoint_io ) { watchpoint_write8 (ADDRESS_SPACE_IO, offset, data); } -static WRITE16_HANDLER( mwh16_watchpoint_io ) { watchpoint_write16(ADDRESS_SPACE_IO, offset, data, mem_mask); } -static WRITE32_HANDLER( mwh32_watchpoint_io ) { watchpoint_write32(ADDRESS_SPACE_IO, offset, data, mem_mask); } -static WRITE64_HANDLER( mwh64_watchpoint_io ) { watchpoint_write64(ADDRESS_SPACE_IO, offset, data, mem_mask); } +static WRITE8_HANDLER( mwh8_watchpoint_io ) { watchpoint_write8 (machine, ADDRESS_SPACE_IO, offset, data); } +static WRITE16_HANDLER( mwh16_watchpoint_io ) { watchpoint_write16(machine, ADDRESS_SPACE_IO, offset, data, mem_mask); } +static WRITE32_HANDLER( mwh32_watchpoint_io ) { watchpoint_write32(machine, ADDRESS_SPACE_IO, offset, data, mem_mask); } +static WRITE64_HANDLER( mwh64_watchpoint_io ) { watchpoint_write64(machine, ADDRESS_SPACE_IO, offset, data, mem_mask); } /*------------------------------------------------- diff --git a/src/emu/memory.h b/src/emu/memory.h index 23f4d7c6f20..bead610b6d4 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -833,7 +833,7 @@ extern const char *const address_space_names[ADDRESS_SPACES]; void memory_init(running_machine *machine); /* set the current memory context */ -void memory_set_context(int activecpu); +void memory_set_context(running_machine *machine, int activecpu); /* get a pointer to the set of memory accessor functions based on the address space, databus width, and endianness */ @@ -870,7 +870,7 @@ void memory_set_opbase(offs_t byteaddress); /* return a base pointer to memory */ void * memory_get_read_ptr(int cpunum, int spacenum, offs_t byteaddress); void * memory_get_write_ptr(int cpunum, int spacenum, offs_t byteaddress); -void * memory_get_op_ptr(int cpunum, offs_t byteaddress, int arg); +void * memory_get_op_ptr(running_machine *machine, int cpunum, offs_t byteaddress, int arg); /* memory banking */ void memory_configure_bank(int banknum, int startentry, int numentries, void *base, offs_t stride); diff --git a/src/emu/profiler.c b/src/emu/profiler.c index 70932d9e9cf..9b25697ed64 100644 --- a/src/emu/profiler.c +++ b/src/emu/profiler.c @@ -12,7 +12,6 @@ #include "osdepend.h" #include "driver.h" #include "profiler.h" -#include "deprecat.h" /* in usrintf.c */ @@ -98,7 +97,7 @@ logerror("Profiler error: FILO buffer underflow\n"); } } -const char *profiler_get_text(void) +const char *profiler_get_text(running_machine *machine) { int i,j; UINT64 total,normalize; @@ -174,7 +173,7 @@ const char *profiler_get_text(void) } if (computed || showdelay[i]) { - if (computed) showdelay[i] = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(Machine->primary_screen).attoseconds); + if (computed) showdelay[i] = ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds); showdelay[i]--; if (i < PROFILER_PROFILER) diff --git a/src/emu/profiler.h b/src/emu/profiler.h index dada60c7a25..cc61fb96934 100644 --- a/src/emu/profiler.h +++ b/src/emu/profiler.h @@ -73,13 +73,13 @@ void profiler_mark(int type); /* functions called by usrintf.c */ void profiler_start(void); void profiler_stop(void); -const char *profiler_get_text(void); +const char *profiler_get_text(running_machine *machine); #else #define profiler_mark(type) #define profiler_start() #define profiler_stop() -#define profiler_get_text() "" +#define profiler_get_text(machine) "" #endif diff --git a/src/emu/romload.c b/src/emu/romload.c index 57d215a4cb1..d7367fa839c 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -16,7 +16,6 @@ #include "harddisk.h" #include "config.h" #include "ui.h" -#include "deprecat.h" #define LOG_LOAD 0 @@ -361,10 +360,10 @@ static int count_roms(running_machine *machine) random data -------------------------------------------------*/ -static void fill_random(UINT8 *base, UINT32 length) +static void fill_random(running_machine *machine, UINT8 *base, UINT32 length) { while (length--) - *base++ = mame_rand(Machine); + *base++ = mame_rand(machine); } @@ -502,7 +501,7 @@ static void verify_length_and_hash(rom_load_data *romdata, const char *name, UIN messages about ROM loading to the user -------------------------------------------------*/ -static void display_loading_rom_message(const char *name, rom_load_data *romdata) +static void display_loading_rom_message(running_machine *machine, const char *name, rom_load_data *romdata) { char buffer[200]; @@ -511,7 +510,7 @@ static void display_loading_rom_message(const char *name, rom_load_data *romdata else sprintf(buffer, "Loading Complete"); - ui_set_startup_text(Machine, buffer, FALSE); + ui_set_startup_text(machine, buffer, FALSE); } @@ -520,10 +519,10 @@ static void display_loading_rom_message(const char *name, rom_load_data *romdata results of ROM loading -------------------------------------------------*/ -static void display_rom_load_results(rom_load_data *romdata) +static void display_rom_load_results(running_machine *machine, rom_load_data *romdata) { /* final status display */ - display_loading_rom_message(NULL, romdata); + display_loading_rom_message(machine, NULL, romdata); /* if we had errors, they are fatal */ if (romdata->errors != 0) @@ -531,15 +530,15 @@ static void display_rom_load_results(rom_load_data *romdata) const char *rgntag, *nextrgntag; /* clean up any regions */ - for (rgntag = memory_region_next(Machine, NULL); rgntag != NULL; rgntag = nextrgntag) + for (rgntag = memory_region_next(machine, NULL); rgntag != NULL; rgntag = nextrgntag) { - nextrgntag = memory_region_next(Machine, rgntag); - memory_region_free(Machine, rgntag); + nextrgntag = memory_region_next(machine, rgntag); + memory_region_free(machine, rgntag); } /* create the error message and exit fatally */ strcat(romdata->errorbuf, "ERROR: required files are missing, the "GAMENOUN" cannot be run."); - fatalerror_exitcode(MAMERR_MISSING_FILES, "%s", romdata->errorbuf); + fatalerror_exitcode(machine, MAMERR_MISSING_FILES, "%s", romdata->errorbuf); } /* if we had warnings, output them, but continue */ @@ -600,7 +599,7 @@ static void region_post_process(running_machine *machine, rom_load_data *romdata up the parent and loading by checksum -------------------------------------------------*/ -static int open_rom_file(rom_load_data *romdata, const char *regiontag, const rom_entry *romp) +static int open_rom_file(running_machine *machine, rom_load_data *romdata, const char *regiontag, const rom_entry *romp) { file_error filerr = FILERR_NOT_FOUND; const game_driver *drv; @@ -610,7 +609,7 @@ static int open_rom_file(rom_load_data *romdata, const char *regiontag, const ro /* update status display */ ++romdata->romsloaded; - display_loading_rom_message(ROM_GETNAME(romp), romdata); + display_loading_rom_message(machine, ROM_GETNAME(romp), romdata); /* extract CRC to use for searching */ has_crc = hash_data_extract_binary_checksum(ROM_GETHASHDATA(romp), HASH_CRC, crcbytes); @@ -620,7 +619,7 @@ static int open_rom_file(rom_load_data *romdata, const char *regiontag, const ro /* attempt reading up the chain through the parents. It automatically also attempts any kind of load by checksum supported by the archives. */ romdata->file = NULL; - for (drv = Machine->gamedrv; romdata->file == NULL && drv != NULL; drv = driver_get_clone(drv)) + for (drv = machine->gamedrv; romdata->file == NULL && drv != NULL; drv = driver_get_clone(drv)) if (drv->name != NULL && *drv->name != 0) { astring *fname = astring_assemble_3(astring_alloc(), drv->name, PATH_SEPARATOR, ROM_GETNAME(romp)); @@ -652,7 +651,7 @@ static int open_rom_file(rom_load_data *romdata, const char *regiontag, const ro random data for a NULL file -------------------------------------------------*/ -static int rom_fread(rom_load_data *romdata, UINT8 *buffer, int length) +static int rom_fread(running_machine *machine, rom_load_data *romdata, UINT8 *buffer, int length) { /* files just pass through */ if (romdata->file) @@ -660,7 +659,7 @@ static int rom_fread(rom_load_data *romdata, UINT8 *buffer, int length) /* otherwise, fill with randomness */ else - fill_random(buffer, length); + fill_random(machine, buffer, length); return length; } @@ -671,7 +670,7 @@ static int rom_fread(rom_load_data *romdata, UINT8 *buffer, int length) entry -------------------------------------------------*/ -static int read_rom_data(rom_load_data *romdata, const rom_entry *romp) +static int read_rom_data(running_machine *machine, rom_load_data *romdata, const rom_entry *romp) { int datashift = ROM_GETBITSHIFT(romp); int datamask = ((1 << ROM_GETBITWIDTH(romp)) - 1) << datashift; @@ -699,7 +698,7 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp) /* special case for simple loads */ if (datamask == 0xff && (groupsize == 1 || !reversed) && skip == 0) - return rom_fread(romdata, base, numbytes); + return rom_fread(machine, romdata, base, numbytes); /* chunky reads for complex loads */ skip += groupsize; @@ -711,7 +710,7 @@ static int read_rom_data(rom_load_data *romdata, const rom_entry *romp) /* read as much as we can */ LOG((" Reading %X bytes into buffer\n", bytesleft)); - if (rom_fread(romdata, romdata->tempbuf, bytesleft) != bytesleft) + if (rom_fread(machine, romdata, romdata->tempbuf, bytesleft) != bytesleft) return 0; numbytes -= bytesleft; @@ -802,7 +801,7 @@ static void fill_rom_data(rom_load_data *romdata, const rom_entry *romp) copy_rom_data - copy a region of ROM space -------------------------------------------------*/ -static void copy_rom_data(rom_load_data *romdata, const rom_entry *romp) +static void copy_rom_data(running_machine *machine, rom_load_data *romdata, const rom_entry *romp) { UINT8 *base = romdata->regionbase + ROM_GETOFFSET(romp); const char *srcrgntag = ROM_GETNAME(romp); @@ -819,12 +818,12 @@ 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(Machine, srcrgntag); + srcbase = memory_region(machine, srcrgntag); if (srcbase == 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(Machine, srcrgntag)) + if (srcoffs + numbytes > memory_region_length(machine, srcrgntag)) fatalerror("Error in RomModule definition: COPY out of source memory region space\n"); /* fill the data */ @@ -837,7 +836,7 @@ static void copy_rom_data(rom_load_data *romdata, const rom_entry *romp) for a region -------------------------------------------------*/ -static void process_rom_entries(rom_load_data *romdata, const char *regiontag, const rom_entry *romp) +static void process_rom_entries(running_machine *machine, rom_load_data *romdata, const char *regiontag, const rom_entry *romp) { UINT32 lastflags = 0; @@ -862,7 +861,7 @@ static void process_rom_entries(rom_load_data *romdata, const char *regiontag, c /* handle copies */ else if (ROMENTRY_ISCOPY(romp)) - copy_rom_data(romdata, romp++); + copy_rom_data(machine, romdata, romp++); /* handle files */ else if (ROMENTRY_ISFILE(romp)) @@ -875,7 +874,7 @@ static void process_rom_entries(rom_load_data *romdata, const char *regiontag, c /* open the file */ LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp))); - if (!open_rom_file(romdata, regiontag, romp)) + if (!open_rom_file(machine, romdata, regiontag, romp)) handle_missing_file(romdata, romp); /* loop until we run out of reloads */ @@ -897,7 +896,7 @@ static void process_rom_entries(rom_load_data *romdata, const char *regiontag, c /* attempt to read using the modified entry */ if (!ROMENTRY_ISIGNORE(&modified_romp)) - readresult = read_rom_data(romdata, &modified_romp); + readresult = read_rom_data(machine, romdata, &modified_romp); } while (ROMENTRY_ISCONTINUE(romp) || ROMENTRY_ISIGNORE(romp)); @@ -1082,7 +1081,7 @@ done: for a region -------------------------------------------------*/ -static void process_disk_entries(rom_load_data *romdata, const char *regiontag, const rom_entry *romp) +static void process_disk_entries(running_machine *machine, rom_load_data *romdata, const char *regiontag, const rom_entry *romp) { astring *filename = astring_alloc(); @@ -1105,7 +1104,7 @@ static void process_disk_entries(rom_load_data *romdata, const char *regiontag, /* first open the source drive */ LOG(("Opening disk image: %s\n", astring_c(filename))); - err = open_disk_image(Machine->gamedrv, romp, &chd.origfile, &chd.origchd); + err = open_disk_image(machine->gamedrv, romp, &chd.origfile, &chd.origchd); if (err != CHDERR_NONE) { if (err == CHDERR_FILE_NOT_FOUND) @@ -1144,7 +1143,7 @@ static void process_disk_entries(rom_load_data *romdata, const char *regiontag, if (!DISK_ISREADONLY(romp)) { /* try to open or create the diff */ - err = open_disk_diff(Machine->gamedrv, romp, chd.origchd, &chd.difffile, &chd.diffchd); + err = open_disk_diff(machine->gamedrv, romp, chd.origchd, &chd.difffile, &chd.diffchd); if (err != CHDERR_NONE) { sprintf(&romdata->errorbuf[strlen(romdata->errorbuf)], "%s DIFF CHD ERROR: %s\n", astring_c(filename), chd_error_string(err)); @@ -1243,14 +1242,14 @@ static void process_region_list(running_machine *machine, rom_load_data *romdata #ifdef MAME_DEBUG /* if we're debugging, fill region with random data to catch errors */ else - fill_random(romdata->regionbase, romdata->regionlength); + fill_random(machine, romdata->regionbase, romdata->regionlength); #endif /* now process the entries in the region */ if (ROMREGION_ISROMDATA(region)) - process_rom_entries(romdata, ROMREGION_ISLOADBYNAME(region) ? ROMREGION_GETTAG(region) : NULL, region + 1); + process_rom_entries(machine, romdata, ROMREGION_ISLOADBYNAME(region) ? ROMREGION_GETTAG(region) : NULL, region + 1); else if (ROMREGION_ISDISKDATA(region)) - process_disk_entries(romdata, ROMREGION_GETTAG(region), region + 1); + process_disk_entries(machine, romdata, ROMREGION_GETTAG(region), region + 1); } /* now go back and post-process all the regions */ @@ -1293,7 +1292,7 @@ void rom_init(running_machine *machine) /* display the results and exit */ total_rom_load_warnings = romdata.warnings; - display_rom_load_results(&romdata); + display_rom_load_results(machine, &romdata); } diff --git a/src/emu/sound.c b/src/emu/sound.c index 216b49a0eae..96c62836701 100644 --- a/src/emu/sound.c +++ b/src/emu/sound.c @@ -14,7 +14,6 @@ #include "streams.h" #include "config.h" #include "profiler.h" -#include "deprecat.h" #include "sound/wavwrite.h" @@ -117,8 +116,8 @@ static void sound_pause(running_machine *machine, int pause); 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 ); -static void start_sound_chips(void); -static void route_sound(void); +static void start_sound_chips(running_machine *machine); +static void route_sound(running_machine *machine); static void mixer_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length); static STATE_POSTLOAD( mixer_postload ); @@ -147,9 +146,9 @@ INLINE speaker_info *get_safe_token(const device_config *device) find_speaker_by_tag - find a tagged speaker -------------------------------------------------*/ -INLINE speaker_info *find_speaker_by_tag(const char *tag) +INLINE speaker_info *find_speaker_by_tag(running_machine *machine, const char *tag) { - const device_config *speaker = device_list_find_by_tag(Machine->config->devicelist, SPEAKER_OUTPUT, tag); + const device_config *speaker = device_list_find_by_tag(machine->config->devicelist, SPEAKER_OUTPUT, tag); return (speaker == NULL) ? NULL : speaker->token; } @@ -207,11 +206,11 @@ void sound_init(running_machine *machine) /* now start up the sound chips and tag their streams */ VPRINTF(("start_sound_chips\n")); - start_sound_chips(); + start_sound_chips(machine); /* finally, do all the routing */ VPRINTF(("route_sound\n")); - route_sound(); + route_sound(machine); /* open the output WAV file if specified */ filename = options_get_string(mame_options(), OPTION_WAVWRITE); @@ -264,7 +263,7 @@ static void sound_exit(running_machine *machine) and initialize them -------------------------------------------------*/ -static void start_sound_chips(void) +static void start_sound_chips(running_machine *machine) { int sndnum; @@ -274,7 +273,7 @@ static void start_sound_chips(void) /* start up all the sound chips */ for (sndnum = 0; sndnum < MAX_SOUND; sndnum++) { - const sound_config *msound = &Machine->config->sound[sndnum]; + const sound_config *msound = &machine->config->sound[sndnum]; sound_info *info; int num_regs; int index; @@ -294,7 +293,7 @@ static void start_sound_chips(void) /* start the chip, tagging all its streams */ VPRINTF(("sndnum = %d -- sound_type = %d\n", sndnum, msound->type)); num_regs = state_save_get_reg_count(); - streams_set_tag(Machine, info); + streams_set_tag(machine, info); if (sndintrf_init_sound(sndnum, msound->tag, msound->type, msound->clock, msound->config) != 0) fatalerror("Sound chip #%d (%s) failed to initialize!", sndnum, sndnum_name(sndnum)); @@ -303,7 +302,7 @@ static void start_sound_chips(void) if (num_regs == 0) { logerror("Sound chip #%d (%s) did not register any state to save!\n", sndnum, sndnum_name(sndnum)); - if (Machine->gamedrv->flags & GAME_SUPPORTS_SAVE) + if (machine->gamedrv->flags & GAME_SUPPORTS_SAVE) fatalerror("Sound chip #%d (%s) did not register any state to save!", sndnum, sndnum_name(sndnum)); } @@ -311,7 +310,7 @@ static void start_sound_chips(void) VPRINTF(("Counting outputs\n")); for (index = 0; ; index++) { - sound_stream *stream = stream_find_by_tag(info, index); + sound_stream *stream = stream_find_by_tag(machine, info, index); if (!stream) break; info->outputs += stream_get_outputs(stream); @@ -329,7 +328,7 @@ static void start_sound_chips(void) info->outputs = 0; for (index = 0; ; index++) { - sound_stream *stream = stream_find_by_tag(info, index); + sound_stream *stream = stream_find_by_tag(machine, info, index); int outputs, outputnum; if (!stream) @@ -354,7 +353,7 @@ static void start_sound_chips(void) inputs -------------------------------------------------*/ -static void route_sound(void) +static void route_sound(running_machine *machine) { int sndnum, routenum, outputnum; const device_config *curspeak; @@ -372,7 +371,7 @@ static void route_sound(void) sound_info *sound; /* find the target */ - speaker = find_speaker_by_tag(mroute->target); + speaker = find_speaker_by_tag(machine, mroute->target); sound = find_sound_by_tag(mroute->target); /* if neither found, it's fatal */ @@ -391,14 +390,14 @@ static void route_sound(void) } /* now allocate the mixers and input data */ - streams_set_tag(Machine, NULL); - for (curspeak = speaker_output_first(Machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak)) + streams_set_tag(machine, NULL); + for (curspeak = speaker_output_first(machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak)) { speaker_info *info = curspeak->token; if (info->inputs != 0) { - info->mixer_stream = stream_create(info->inputs, 1, Machine->sample_rate, info, mixer_update); - state_save_register_postload(Machine, mixer_postload, info->mixer_stream); + info->mixer_stream = stream_create(info->inputs, 1, machine->sample_rate, info, mixer_update); + state_save_register_postload(machine, mixer_postload, info->mixer_stream); info->input = auto_malloc(info->inputs * sizeof(*info->input)); info->inputs = 0; } @@ -419,7 +418,7 @@ static void route_sound(void) sound_info *sound; /* find the target */ - speaker = find_speaker_by_tag(mroute->target); + speaker = find_speaker_by_tag(machine, mroute->target); sound = find_sound_by_tag(mroute->target); /* if it's a speaker, set the input */ @@ -437,7 +436,7 @@ static void route_sound(void) namebuf[0] = '\0'; /* speaker name, if more than one speaker */ - if (speaker_output_count(Machine->config) > 1) + if (speaker_output_count(machine->config) > 1) sprintf(namebuf, "%sSpeaker '%s': ", namebuf, speaker->tag); /* device name */ @@ -600,8 +599,8 @@ static void sound_load(running_machine *machine, int config_type, xml_data_node { float defvol = xml_get_attribute_float(channelnode, "defvol", -1000.0); float newvol = xml_get_attribute_float(channelnode, "newvol", -1000.0); - if (fabs(defvol - sound_get_default_gain(mixernum)) < 1e-6 && newvol != -1000.0) - sound_set_user_gain(mixernum, newvol); + if (fabs(defvol - sound_get_default_gain(machine, mixernum)) < 1e-6 && newvol != -1000.0) + sound_set_user_gain(machine, mixernum, newvol); } } } @@ -624,8 +623,8 @@ static void sound_save(running_machine *machine, int config_type, xml_data_node if (parentnode != NULL) for (mixernum = 0; mixernum < MAX_MIXER_CHANNELS; mixernum++) { - float defvol = sound_get_default_gain(mixernum); - float newvol = sound_get_user_gain(mixernum); + float defvol = sound_get_default_gain(machine, mixernum); + float newvol = sound_get_user_gain(machine, mixernum); if (defvol != newvol) { @@ -926,13 +925,13 @@ void sndti_set_output_gain(sound_type type, int index, int output, float gain) a particular input -------------------------------------------------*/ -INLINE speaker_info *index_to_input(int index, int *input) +INLINE speaker_info *index_to_input(running_machine *machine, int index, int *input) { const device_config *curspeak; int count = 0; /* scan through the speakers until we find the indexed input */ - for (curspeak = speaker_output_first(Machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak)) + for (curspeak = speaker_output_first(machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak)) { speaker_info *info = curspeak->token; if (index < count + info->inputs) @@ -953,13 +952,13 @@ INLINE speaker_info *index_to_input(int index, int *input) of user-controllable gain parameters -------------------------------------------------*/ -int sound_get_user_gain_count(void) +int sound_get_user_gain_count(running_machine *machine) { const device_config *curspeak; int count = 0; /* count up the number of speaker inputs */ - for (curspeak = speaker_output_first(Machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak)) + for (curspeak = speaker_output_first(machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak)) { speaker_info *info = curspeak->token; count += info->inputs; @@ -973,10 +972,10 @@ int sound_get_user_gain_count(void) value -------------------------------------------------*/ -void sound_set_user_gain(int index, float gain) +void sound_set_user_gain(running_machine *machine, int index, float gain) { int inputnum; - speaker_info *spk = index_to_input(index, &inputnum); + speaker_info *spk = index_to_input(machine, index, &inputnum); if (spk != NULL) { @@ -991,10 +990,10 @@ void sound_set_user_gain(int index, float gain) value -------------------------------------------------*/ -float sound_get_user_gain(int index) +float sound_get_user_gain(running_machine *machine, int index) { int inputnum; - speaker_info *spk = index_to_input(index, &inputnum); + speaker_info *spk = index_to_input(machine, index, &inputnum); return (spk != NULL) ? spk->input[inputnum].gain : 0; } @@ -1004,10 +1003,10 @@ float sound_get_user_gain(int index) gain of the nth user value -------------------------------------------------*/ -float sound_get_default_gain(int index) +float sound_get_default_gain(running_machine *machine, int index) { int inputnum; - speaker_info *spk = index_to_input(index, &inputnum); + speaker_info *spk = index_to_input(machine, index, &inputnum); return (spk != NULL) ? spk->input[inputnum].default_gain : 0; } @@ -1017,10 +1016,10 @@ float sound_get_default_gain(int index) of the nth user value -------------------------------------------------*/ -const char *sound_get_user_gain_name(int index) +const char *sound_get_user_gain_name(running_machine *machine, int index) { int inputnum; - speaker_info *spk = index_to_input(index, &inputnum); + speaker_info *spk = index_to_input(machine, index, &inputnum); return (spk != NULL) ? spk->input[inputnum].name : NULL; } diff --git a/src/emu/sound.h b/src/emu/sound.h index bb169d3d63f..45b131da923 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -88,11 +88,11 @@ int sound_get_attenuation(void); void sound_global_enable(int enable); /* user gain controls on speaker inputs for mixing */ -int sound_get_user_gain_count(void); -void sound_set_user_gain(int index, float gain); -float sound_get_user_gain(int index); -float sound_get_default_gain(int index); -const char *sound_get_user_gain_name(int index); +int sound_get_user_gain_count(running_machine *machine); +void sound_set_user_gain(running_machine *machine, int index, float gain); +float sound_get_user_gain(running_machine *machine, int index); +float sound_get_default_gain(running_machine *machine, int index); +const char *sound_get_user_gain_name(running_machine *machine, int index); /* misc helpers */ int sound_find_sndnum_by_tag(const char *tag); diff --git a/src/emu/state.c b/src/emu/state.c index b25fa54daf8..a2911d75e82 100644 --- a/src/emu/state.c +++ b/src/emu/state.c @@ -655,7 +655,7 @@ int state_save_save_begin(mame_file *file) current tag -------------------------------------------------*/ -void state_save_save_continue(void) +void state_save_save_continue(running_machine *machine) { ss_entry *entry; ss_func *func; @@ -671,7 +671,7 @@ void state_save_save_continue(void) if (func->tag == ss_current_tag) { count++; - (*func->func.presave)(Machine, func->param); + (*func->func.presave)(machine, func->param); } LOG((" %d functions called\n", count)); @@ -693,7 +693,7 @@ void state_save_save_continue(void) file by writing the header and closing -------------------------------------------------*/ -void state_save_save_finish(void) +void state_save_save_finish(running_machine *machine) { UINT32 signature; UINT8 flags = 0; @@ -710,7 +710,7 @@ void state_save_save_finish(void) ss_dump_array[8] = SAVE_VERSION; ss_dump_array[9] = flags; memset(ss_dump_array+0xa, 0, 10); - strcpy((char *)ss_dump_array+0xa, Machine->gamedrv->name); + strcpy((char *)ss_dump_array+0xa, machine->gamedrv->name); /* copy in the signature */ signature = get_signature(); @@ -768,7 +768,7 @@ int state_save_load_begin(mame_file *file) the current tag -------------------------------------------------*/ -void state_save_load_continue(void) +void state_save_load_continue(running_machine *machine) { ss_entry *entry; ss_func *func; @@ -801,7 +801,7 @@ void state_save_load_continue(void) if (func->tag == ss_current_tag) { count++; - (*func->func.postload)(Machine, func->param); + (*func->func.postload)(machine, func->param); } LOG((" %d functions called\n", count)); } diff --git a/src/emu/state.h b/src/emu/state.h index fbe95becdb9..76cf3deaf97 100644 --- a/src/emu/state.h +++ b/src/emu/state.h @@ -112,10 +112,10 @@ int state_save_load_begin(mame_file *file); void state_save_push_tag(int tag); void state_save_pop_tag(void); -void state_save_save_continue(void); -void state_save_load_continue(void); +void state_save_save_continue(running_machine *machine); +void state_save_load_continue(running_machine *machine); -void state_save_save_finish(void); +void state_save_save_finish(running_machine *machine); void state_save_load_finish(void); /* Helper function for creating a unique name */ diff --git a/src/emu/streams.c b/src/emu/streams.c index b830e1c18ae..fa855369857 100644 --- a/src/emu/streams.c +++ b/src/emu/streams.c @@ -565,9 +565,9 @@ attotime stream_get_sample_period(sound_stream *stream) tag and index -------------------------------------------------*/ -sound_stream *stream_find_by_tag(void *streamtag, int streamindex) +sound_stream *stream_find_by_tag(running_machine *machine, void *streamtag, int streamindex) { - streams_private *strdata = Machine->streams_data; + streams_private *strdata = machine->streams_data; sound_stream *stream; /* scan the list looking for the nth stream that matches the tag */ diff --git a/src/emu/streams.h b/src/emu/streams.h index 8f72bddd886..0b95e78f870 100644 --- a/src/emu/streams.h +++ b/src/emu/streams.h @@ -78,7 +78,7 @@ attotime stream_get_sample_period(sound_stream *stream); /* ----- stream information and control ----- */ /* find a stream using a tag and index */ -sound_stream *stream_find_by_tag(void *streamtag, int streamindex); +sound_stream *stream_find_by_tag(running_machine *machine, void *streamtag, int streamindex); /* return the number of inputs for a given stream */ int stream_get_inputs(sound_stream *stream); diff --git a/src/emu/timer.c b/src/emu/timer.c index 7231d4e57f1..1753fa15f9e 100644 --- a/src/emu/timer.c +++ b/src/emu/timer.c @@ -13,7 +13,6 @@ #include "driver.h" #include "profiler.h" #include "pool.h" -#include "deprecat.h" /*************************************************************************** @@ -328,7 +327,7 @@ attotime timer_next_fire_time(void) time; this is also where we fire the timers -------------------------------------------------*/ -void timer_set_global_time(attotime newbase) +void timer_set_global_time(running_machine *machine, attotime newbase) { emu_timer *timer; @@ -357,7 +356,7 @@ void timer_set_global_time(attotime newbase) { LOG(("Timer %s:%d[%s] fired (expire=%s)\n", timer->file, timer->line, timer->func, attotime_string(timer->expire, 9))); profiler_mark(PROFILER_TIMER_CALLBACK); - (*timer->callback)(Machine, timer->ptr, timer->param); + (*timer->callback)(machine, timer->ptr, timer->param); profiler_mark(PROFILER_END); } diff --git a/src/emu/timer.h b/src/emu/timer.h index cbeab131dce..01c656ec28f 100644 --- a/src/emu/timer.h +++ b/src/emu/timer.h @@ -170,7 +170,7 @@ void timer_destructor(void *ptr, size_t size); attotime timer_next_fire_time(void); /* adjust the global time; this is also where we fire the timers */ -void timer_set_global_time(attotime newbase); +void timer_set_global_time(running_machine *machine, attotime newbase); diff --git a/src/emu/ui.c b/src/emu/ui.c index 9293dd2ba1b..8493699fca2 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -1202,7 +1202,7 @@ static UINT32 handler_ingame(running_machine *machine, UINT32 state) /* draw the profiler if visible */ if (show_profiler) - ui_draw_text_full(profiler_get_text(), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL); + ui_draw_text_full(profiler_get_text(machine), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL); /* if we're single-stepping, pause now */ if (single_step) @@ -1469,16 +1469,16 @@ static slider_state *slider_init(running_machine *machine) tailptr = &(*tailptr)->next; /* add per-channel volume */ - numitems = sound_get_user_gain_count(); + numitems = sound_get_user_gain_count(machine); for (item = 0; item < numitems; item++) { INT32 maxval = 2000; - INT32 defval = sound_get_default_gain(item) * 1000.0f + 0.5f; + INT32 defval = sound_get_default_gain(machine, item) * 1000.0f + 0.5f; if (defval > 1000) maxval = 2 * defval; - astring_printf(string, "%s Volume", sound_get_user_gain_name(item)); + astring_printf(string, "%s Volume", sound_get_user_gain_name(machine, item)); *tailptr = slider_alloc(astring_c(string), 0, defval, maxval, 20, slider_mixervol, (void *)(FPTR)item); tailptr = &(*tailptr)->next; } @@ -1634,10 +1634,10 @@ static INT32 slider_mixervol(running_machine *machine, void *arg, astring *strin { int which = (FPTR)arg; if (newval != SLIDER_NOCHANGE) - sound_set_user_gain(which, (float)newval * 0.001f); + sound_set_user_gain(machine, which, (float)newval * 0.001f); if (string != NULL) - astring_printf(string, "%4.2f", sound_get_user_gain(which)); - return floor(sound_get_user_gain(which) * 1000.0f + 0.5f); + astring_printf(string, "%4.2f", sound_get_user_gain(machine, which)); + return floor(sound_get_user_gain(machine, which) * 1000.0f + 0.5f); } diff --git a/src/emu/uigfx.c b/src/emu/uigfx.c index 99993b4b919..05ecc74cc8e 100644 --- a/src/emu/uigfx.c +++ b/src/emu/uigfx.c @@ -15,7 +15,6 @@ #include "rendfont.h" #include "rendutil.h" #include "uigfx.h" -#include "deprecat.h" @@ -84,13 +83,13 @@ static void palette_handler(running_machine *machine, ui_gfx_state *state); /* graphics set handling */ static void gfxset_handle_keys(running_machine *machine, ui_gfx_state *state, int xcells, int ycells); -static void gfxset_draw_item(const gfx_element *gfx, int index, bitmap_t *bitmap, int dstx, int dsty, int color, int rotate); -static void gfxset_update_bitmap(ui_gfx_state *state, int xcells, int ycells, gfx_element *gfx); +static void gfxset_draw_item(running_machine *machine, const gfx_element *gfx, int index, bitmap_t *bitmap, int dstx, int dsty, int color, int rotate); +static void gfxset_update_bitmap(running_machine *machine, ui_gfx_state *state, int xcells, int ycells, gfx_element *gfx); static void gfxset_handler(running_machine *machine, ui_gfx_state *state); /* tilemap handling */ static void tilemap_handle_keys(running_machine *machine, ui_gfx_state *state, int viswidth, int visheight); -static void tilemap_update_bitmap(ui_gfx_state *state, int width, int height); +static void tilemap_update_bitmap(running_machine *machine, ui_gfx_state *state, int width, int height); static void tilemap_handler(running_machine *machine, ui_gfx_state *state); @@ -570,7 +569,7 @@ static void gfxset_handler(running_machine *machine, ui_gfx_state *state) } /* update the bitmap */ - gfxset_update_bitmap(state, xcells, ycells, gfx); + gfxset_update_bitmap(machine, state, xcells, ycells, gfx); /* add the final quad */ render_ui_add_quad(boxbounds.x0 + 6.0f * chwidth, boxbounds.y0 + 3.5f * chheight, @@ -681,7 +680,7 @@ static void gfxset_handle_keys(running_machine *machine, ui_gfx_state *state, in graphics view bitmap -------------------------------------------------*/ -static void gfxset_update_bitmap(ui_gfx_state *state, int xcells, int ycells, gfx_element *gfx) +static void gfxset_update_bitmap(running_machine *machine, ui_gfx_state *state, int xcells, int ycells, gfx_element *gfx) { int set = state->gfxset.set; int cellxpix, cellypix; @@ -737,7 +736,7 @@ static void gfxset_update_bitmap(ui_gfx_state *state, int xcells, int ycells, gf /* only render if there is data */ if (index < gfx->total_elements) - gfxset_draw_item(gfx, index, state->bitmap, cellbounds.min_x, cellbounds.min_y, state->gfxset.color[set], state->gfxset.rotate[set]); + gfxset_draw_item(machine, gfx, index, state->bitmap, cellbounds.min_x, cellbounds.min_y, state->gfxset.color[set], state->gfxset.rotate[set]); /* otherwise, fill with transparency */ else @@ -762,7 +761,7 @@ static void gfxset_update_bitmap(ui_gfx_state *state, int xcells, int ycells, gf the view -------------------------------------------------*/ -static void gfxset_draw_item(const gfx_element *gfx, int index, bitmap_t *bitmap, int dstx, int dsty, int color, int rotate) +static void gfxset_draw_item(running_machine *machine, const gfx_element *gfx, int index, bitmap_t *bitmap, int dstx, int dsty, int color, int rotate) { static const pen_t default_palette[] = { @@ -771,7 +770,7 @@ static void gfxset_draw_item(const gfx_element *gfx, int index, bitmap_t *bitmap }; int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width; int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height; - const rgb_t *palette = (Machine->config->total_colors != 0) ? palette_entry_list_raw(Machine->palette) : NULL; + const rgb_t *palette = (machine->config->total_colors != 0) ? palette_entry_list_raw(machine->palette) : NULL; UINT32 rowpixels = bitmap->rowpixels; UINT32 palette_mask = ~0; int x, y; @@ -931,7 +930,7 @@ static void tilemap_handler(running_machine *machine, ui_gfx_state *state) } /* update the bitmap */ - tilemap_update_bitmap(state, mapboxwidth / pixelscale, mapboxheight / pixelscale); + tilemap_update_bitmap(machine, state, mapboxwidth / pixelscale, mapboxheight / pixelscale); /* add the final quad */ render_ui_add_quad(mapboxbounds.x0, mapboxbounds.y0, @@ -1032,9 +1031,9 @@ static void tilemap_handle_keys(running_machine *machine, ui_gfx_state *state, i for the tilemap view -------------------------------------------------*/ -static void tilemap_update_bitmap(ui_gfx_state *state, int width, int height) +static void tilemap_update_bitmap(running_machine *machine, ui_gfx_state *state, int width, int height) { - bitmap_format screen_format = video_screen_get_format(Machine->primary_screen); + bitmap_format screen_format = video_screen_get_format(machine->primary_screen); int screen_texformat; /* convert the screen format to a texture format */ diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index a0717a79e34..6e93c234946 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -15,7 +15,6 @@ #include "uiinput.h" #include "uimenu.h" #include "audit.h" -#include "deprecat.h" #include "eminline.h" #ifdef MESS @@ -240,7 +239,7 @@ static const rgb_t mousedown_bgcolor = MAKE_ARGB(0xB0,0x60,0x60,0x00); static void ui_menu_exit(running_machine *machine); /* internal menu processing */ -static void ui_menu_draw(ui_menu *menu, int customonly); +static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly); static void ui_menu_draw_text_box(ui_menu *menu); static void ui_menu_handle_events(ui_menu *menu); static void ui_menu_handle_keys(ui_menu *menu, UINT32 flags); @@ -569,7 +568,7 @@ void ui_menu_item_append(ui_menu *menu, const char *text, const char *subtext, U and returning any interesting events -------------------------------------------------*/ -const ui_menu_event *ui_menu_process(ui_menu *menu, UINT32 flags) +const ui_menu_event *ui_menu_process(running_machine *machine, ui_menu *menu, UINT32 flags) { /* reset the event */ menu->event.iptkey = IPT_INVALID; @@ -581,7 +580,7 @@ const ui_menu_event *ui_menu_process(ui_menu *menu, UINT32 flags) if (menu->numitems > 1 && (menu->item[0].flags & MENU_FLAG_MULTILINE) != 0) ui_menu_draw_text_box(menu); else - ui_menu_draw(menu, (flags & UI_MENU_PROCESS_CUSTOM_ONLY) != 0); + ui_menu_draw(machine, menu, (flags & UI_MENU_PROCESS_CUSTOM_ONLY) != 0); /* process input */ if (!(flags & UI_MENU_PROCESS_NOKEYS)) @@ -721,7 +720,7 @@ void ui_menu_set_selection(ui_menu *menu, void *selected_itemref) ui_menu_draw - draw a menu -------------------------------------------------*/ -static void ui_menu_draw(ui_menu *menu, int customonly) +static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly) { float line_height = ui_get_line_height(); float lr_arrow_width = 0.4f * line_height * render_get_ui_aspect(); @@ -814,7 +813,7 @@ static void ui_menu_draw(ui_menu *menu, int customonly) mouse_button = FALSE; if (!customonly) { - mouse_target = ui_input_find_mouse(Machine, &mouse_target_x, &mouse_target_y, &mouse_button); + mouse_target = ui_input_find_mouse(machine, &mouse_target_x, &mouse_target_y, &mouse_button); if (mouse_target != NULL) if (render_target_map_point_container(mouse_target, mouse_target_x, mouse_target_y, render_container_get_ui(), &mouse_x, &mouse_y)) mouse_hit = TRUE; @@ -1359,22 +1358,22 @@ UINT32 ui_slider_ui_handler(running_machine *machine, UINT32 state) select menu to be visible and inescapable -------------------------------------------------*/ -void ui_menu_force_game_select(void) +void ui_menu_force_game_select(running_machine *machine) { char *gamename = (char *)options_get_string(mame_options(), OPTION_GAMENAME); /* reset the menu stack */ - ui_menu_stack_reset(Machine); + ui_menu_stack_reset(machine); /* add the quit entry followed by the game select entry */ - ui_menu_stack_push(ui_menu_alloc(Machine, menu_quit_game, NULL)); - ui_menu_stack_push(ui_menu_alloc(Machine, menu_select_game, gamename)); + ui_menu_stack_push(ui_menu_alloc(machine, menu_quit_game, NULL)); + ui_menu_stack_push(ui_menu_alloc(machine, menu_select_game, gamename)); /* force the menus on */ ui_show_menu(); /* make sure MAME is paused */ - mame_pause(Machine, TRUE); + mame_pause(machine, TRUE); } @@ -1414,7 +1413,7 @@ static void menu_main(running_machine *machine, ui_menu *menu, void *parameter, menu_main_populate(machine, menu, state); /* process the menu */ - event = ui_menu_process(menu, 0); + event = ui_menu_process(machine, menu, 0); if (event != NULL && event->iptkey == IPT_UI_SELECT) ui_menu_stack_push(ui_menu_alloc(machine, event->itemref, NULL)); } @@ -1507,7 +1506,7 @@ static void menu_input_groups(running_machine *machine, ui_menu *menu, void *par menu_input_groups_populate(machine, menu, state); /* process the menu */ - event = ui_menu_process(menu, 0); + event = ui_menu_process(machine, menu, 0); if (event != NULL && event->iptkey == IPT_UI_SELECT) ui_menu_stack_push(ui_menu_alloc(machine, menu_input_general, event->itemref)); } @@ -1707,7 +1706,7 @@ static void menu_input_common(running_machine *machine, ui_menu *menu, void *par } /* process the menu */ - event = ui_menu_process(menu, (menustate->pollingitem != NULL) ? UI_MENU_PROCESS_NOKEYS : 0); + event = ui_menu_process(machine, menu, (menustate->pollingitem != NULL) ? UI_MENU_PROCESS_NOKEYS : 0); /* if we are polling, handle as a special case */ if (menustate->pollingitem != NULL) @@ -1934,7 +1933,7 @@ static void menu_settings_common(running_machine *machine, ui_menu *menu, void * menu_settings_populate(machine, menu, menustate, type); /* process the menu */ - event = ui_menu_process(menu, 0); + event = ui_menu_process(machine, menu, 0); /* handle events */ if (event != NULL && event->itemref != NULL) @@ -2175,7 +2174,7 @@ static void menu_analog(running_machine *machine, ui_menu *menu, void *parameter menu_analog_populate(machine, menu); /* process the menu */ - event = ui_menu_process(menu, UI_MENU_PROCESS_LR_REPEAT); + event = ui_menu_process(machine, menu, UI_MENU_PROCESS_LR_REPEAT); /* handle events */ if (event != NULL && event->itemref != NULL) @@ -2366,7 +2365,7 @@ static void menu_bookkeeping(running_machine *machine, ui_menu *menu, void *para } /* process the menu */ - ui_menu_process(menu, 0); + ui_menu_process(machine, menu, 0); } #endif @@ -2433,7 +2432,7 @@ static void menu_game_info(running_machine *machine, ui_menu *menu, void *parame } /* process the menu */ - ui_menu_process(menu, 0); + ui_menu_process(machine, menu, 0); } @@ -2450,7 +2449,7 @@ static void menu_cheat(running_machine *machine, ui_menu *menu, void *parameter, menu_cheat_populate(machine, menu); /* process the menu */ - event = ui_menu_process(menu, UI_MENU_PROCESS_LR_REPEAT); + event = ui_menu_process(machine, menu, UI_MENU_PROCESS_LR_REPEAT); /* handle events */ if (event != NULL && event->itemref != NULL) @@ -2549,7 +2548,7 @@ static void menu_memory_card(running_machine *machine, ui_menu *menu, void *para menu_memory_card_populate(machine, menu, *cardnum); /* process the menu */ - event = ui_menu_process(menu, UI_MENU_PROCESS_LR_REPEAT); + event = ui_menu_process(machine, menu, UI_MENU_PROCESS_LR_REPEAT); /* if something was selected, act on it */ if (event != NULL && event->itemref != NULL) @@ -2654,7 +2653,7 @@ static void menu_sliders(running_machine *machine, ui_menu *menu, void *paramete menu_sliders_populate(machine, menu); /* process the menu */ - event = ui_menu_process(menu, UI_MENU_PROCESS_LR_REPEAT | (*hidden ? UI_MENU_PROCESS_CUSTOM_ONLY : 0)); + event = ui_menu_process(machine, menu, UI_MENU_PROCESS_LR_REPEAT | (*hidden ? UI_MENU_PROCESS_CUSTOM_ONLY : 0)); if (event != NULL) { /* handle keys if there is a valid item selected */ @@ -2850,7 +2849,7 @@ static void menu_video_targets(running_machine *machine, ui_menu *menu, void *pa menu_video_targets_populate(machine, menu); /* process the menu */ - event = ui_menu_process(menu, 0); + event = ui_menu_process(machine, menu, 0); if (event != NULL && event->iptkey == IPT_UI_SELECT) ui_menu_stack_push(ui_menu_alloc(machine, menu_video_options, event->itemref)); } @@ -2898,7 +2897,7 @@ static void menu_video_options(running_machine *machine, ui_menu *menu, void *pa menu_video_options_populate(machine, menu, target); /* process the menu */ - event = ui_menu_process(menu, 0); + event = ui_menu_process(machine, menu, 0); if (event != NULL && event->itemref != NULL) { switch ((FPTR)event->itemref) @@ -3049,7 +3048,7 @@ static void menu_select_game(running_machine *machine, ui_menu *menu, void *para ui_input_pressed(machine, IPT_UI_PAUSE); /* process the menu */ - event = ui_menu_process(menu, 0); + event = ui_menu_process(machine, menu, 0); if (event != NULL && event->itemref != NULL) { /* reset the error on any future event */ diff --git a/src/emu/uimenu.h b/src/emu/uimenu.h index 286a6a1e329..2017fc9ed5b 100644 --- a/src/emu/uimenu.h +++ b/src/emu/uimenu.h @@ -103,7 +103,7 @@ int ui_menu_populated(ui_menu *menu); void ui_menu_item_append(ui_menu *menu, const char *text, const char *subtext, UINT32 flags, void *ref); /* process a menu, drawing it and returning any interesting events */ -const ui_menu_event *ui_menu_process(ui_menu *menu, UINT32 flags); +const ui_menu_event *ui_menu_process(running_machine *machine, ui_menu *menu, UINT32 flags); /* configure the menu for custom rendering */ void ui_menu_set_custom_render(ui_menu *menu, ui_menu_custom_func custom, float top, float bottom); @@ -147,7 +147,7 @@ UINT32 ui_menu_ui_handler(running_machine *machine, UINT32 state); UINT32 ui_slider_ui_handler(running_machine *machine, UINT32 state); /* force game select menu */ -void ui_menu_force_game_select(void); +void ui_menu_force_game_select(running_machine *machine); int ui_menu_is_force_game_select(void); diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c index 254292473f8..6d090fc2785 100644 --- a/src/mame/drivers/alg.c +++ b/src/mame/drivers/alg.c @@ -660,7 +660,7 @@ static void alg_init(running_machine *machine) /* set up memory */ memory_configure_bank(1, 0, 1, amiga_chip_ram, 0); - memory_configure_bank(1, 1, 1, memory_region(Machine, "user1"), 0); + memory_configure_bank(1, 1, 1, memory_region(machine, "user1"), 0); } diff --git a/src/mame/drivers/arcadia.c b/src/mame/drivers/arcadia.c index 2bf713f6e52..ab29394ccaa 100644 --- a/src/mame/drivers/arcadia.c +++ b/src/mame/drivers/arcadia.c @@ -631,9 +631,9 @@ ROM_END * *************************************/ -INLINE void generic_decode(const char *tag, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0) +INLINE void generic_decode(running_machine *machine, const char *tag, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0) { - UINT16 *rom = (UINT16 *)memory_region(Machine, tag); + UINT16 *rom = (UINT16 *)memory_region(machine, tag); int i; /* only the low byte of ROMs are encrypted in these games */ @@ -671,12 +671,12 @@ static void arcadia_init(running_machine *machine) /* set up memory */ memory_configure_bank(1, 0, 1, amiga_chip_ram, 0); - memory_configure_bank(1, 1, 1, memory_region(Machine, "user1"), 0); + memory_configure_bank(1, 1, 1, memory_region(machine, "user1"), 0); /* OnePlay bios is encrypted, TenPlay is not */ - biosrom = (UINT16 *)memory_region(Machine, "user2"); + biosrom = (UINT16 *)memory_region(machine, "user2"); if (biosrom[0] != 0x4afc) - generic_decode("user2", 6, 1, 0, 2, 3, 4, 5, 7); + generic_decode(machine, "user2", 6, 1, 0, 2, 3, 4, 5, 7); } @@ -688,16 +688,16 @@ static void arcadia_init(running_machine *machine) *************************************/ static DRIVER_INIT( none ) { arcadia_init(machine); } -static DRIVER_INIT( airh ) { generic_decode("user3", 5, 0, 2, 4, 7, 6, 1, 3); arcadia_init(machine); } -static DRIVER_INIT( bowl ) { generic_decode("user3", 7, 6, 0, 1, 2, 3, 4, 5); arcadia_init(machine); } -static DRIVER_INIT( dart ) { generic_decode("user3", 4, 0, 7, 6, 3, 1, 2, 5); arcadia_init(machine); } -static DRIVER_INIT( ldrba ) { generic_decode("user3", 2, 3, 4, 1, 0, 7, 5, 6); arcadia_init(machine); } -static DRIVER_INIT( ninj ) { generic_decode("user3", 1, 6, 5, 7, 4, 2, 0, 3); arcadia_init(machine); } -static DRIVER_INIT( rdwr ) { generic_decode("user3", 3, 1, 6, 4, 0, 5, 2, 7); arcadia_init(machine); } -static DRIVER_INIT( sdwr ) { generic_decode("user3", 6, 3, 4, 5, 2, 1, 0, 7); arcadia_init(machine); } -static DRIVER_INIT( socc ) { generic_decode("user3", 0, 7, 1, 6, 5, 4, 3, 2); arcadia_init(machine); } -static DRIVER_INIT( sprg ) { generic_decode("user3", 4, 7, 3, 0, 6, 5, 2, 1); arcadia_init(machine); } -static DRIVER_INIT( xeon ) { generic_decode("user3", 3, 1, 2, 4, 0, 5, 6, 7); arcadia_init(machine); } +static DRIVER_INIT( airh ) { generic_decode(machine, "user3", 5, 0, 2, 4, 7, 6, 1, 3); arcadia_init(machine); } +static DRIVER_INIT( bowl ) { generic_decode(machine, "user3", 7, 6, 0, 1, 2, 3, 4, 5); arcadia_init(machine); } +static DRIVER_INIT( dart ) { generic_decode(machine, "user3", 4, 0, 7, 6, 3, 1, 2, 5); arcadia_init(machine); } +static DRIVER_INIT( ldrba ) { generic_decode(machine, "user3", 2, 3, 4, 1, 0, 7, 5, 6); arcadia_init(machine); } +static DRIVER_INIT( ninj ) { generic_decode(machine, "user3", 1, 6, 5, 7, 4, 2, 0, 3); arcadia_init(machine); } +static DRIVER_INIT( rdwr ) { generic_decode(machine, "user3", 3, 1, 6, 4, 0, 5, 2, 7); arcadia_init(machine); } +static DRIVER_INIT( sdwr ) { generic_decode(machine, "user3", 6, 3, 4, 5, 2, 1, 0, 7); arcadia_init(machine); } +static DRIVER_INIT( socc ) { generic_decode(machine, "user3", 0, 7, 1, 6, 5, 4, 3, 2); arcadia_init(machine); } +static DRIVER_INIT( sprg ) { generic_decode(machine, "user3", 4, 7, 3, 0, 6, 5, 2, 1); arcadia_init(machine); } +static DRIVER_INIT( xeon ) { generic_decode(machine, "user3", 3, 1, 2, 4, 0, 5, 6, 7); arcadia_init(machine); } diff --git a/src/mame/drivers/bfcobra.c b/src/mame/drivers/bfcobra.c index 0ec482fcb56..2de7b8357f5 100644 --- a/src/mame/drivers/bfcobra.c +++ b/src/mame/drivers/bfcobra.c @@ -122,7 +122,7 @@ static UINT32 mux_outputlatch; /* Function prototypes */ -INLINE void z80_bank(int num, int data); +INLINE void z80_bank(running_machine *machine, int num, int data); static void update_irqs(running_machine *machine) @@ -380,19 +380,19 @@ static VIDEO_UPDATE( bfcobra ) return 0; } -INLINE UINT8* blitter_get_addr(UINT32 addr) +INLINE UINT8* blitter_get_addr(running_machine *machine, UINT32 addr) { if (addr < 0x10000) { /* Is this region fixed? */ - return (UINT8*)(memory_region(Machine, "user1") + addr); + return (UINT8*)(memory_region(machine, "user1") + addr); } else if(addr < 0x20000) { addr &= 0xffff; addr += (bank[0] & 1) ? 0x10000 : 0; - return (UINT8*)(memory_region(Machine, "user1") + addr + ((bank[0] >> 1) * 0x20000)); + return (UINT8*)(memory_region(machine, "user1") + addr + ((bank[0] >> 1) * 0x20000)); } else if (addr >= 0x20000 && addr < 0x40000) { @@ -410,9 +410,9 @@ INLINE UINT8* blitter_get_addr(UINT32 addr) The Flare One blitter is a simpler design with slightly different parameters and will require hardware tests to figure everything out correctly. */ -static void RunBlit(void) +static void RunBlit(running_machine *machine) { -#define BLITPRG_READ(x) blitter.x = *(blitter_get_addr(blitter.program.addr++)) +#define BLITPRG_READ(x) blitter.x = *(blitter_get_addr(machine, blitter.program.addr++)) int cycles_used = 0; @@ -522,7 +522,7 @@ static void RunBlit(void) blitter.source.addr0 -=blitter.step; } - *blitter_get_addr(blitter.dest.addr) = blitter.pattern; + *blitter_get_addr(machine, blitter.dest.addr) = blitter.pattern; cycles_used++; } while (--innercnt); @@ -536,7 +536,7 @@ static void RunBlit(void) if (LOOPTYPE == 3 && innercnt == blitter.innercnt) { - srcdata = *(blitter_get_addr(blitter.source.addr & 0xfffff)); + srcdata = *(blitter_get_addr(machine, blitter.source.addr & 0xfffff)); blitter.source.loword++; cycles_used++; } @@ -546,7 +546,7 @@ static void RunBlit(void) { if (LOOPTYPE == 0 || LOOPTYPE == 1) { - srcdata = *(blitter_get_addr(blitter.source.addr & 0xfffff)); + srcdata = *(blitter_get_addr(machine, blitter.source.addr & 0xfffff)); cycles_used++; if (blitter.modectl & MODE_SSIGN) @@ -561,7 +561,7 @@ static void RunBlit(void) /* Read destination pixel? */ if (LOOPTYPE == 0) { - dstdata = *blitter_get_addr(blitter.dest.addr & 0xfffff); + dstdata = *blitter_get_addr(machine, blitter.dest.addr & 0xfffff); cycles_used++; } @@ -630,10 +630,10 @@ static void RunBlit(void) The existing destination pixel is used as a lookup into the table and the colours is replaced. */ - UINT8 dest = *blitter_get_addr(blitter.dest.addr); - UINT8 newcol = *(blitter_get_addr((blitter.source.addr + dest) & 0xfffff)); + UINT8 dest = *blitter_get_addr(machine, blitter.dest.addr); + UINT8 newcol = *(blitter_get_addr(machine, (blitter.source.addr + dest) & 0xfffff)); - *blitter_get_addr(blitter.dest.addr) = newcol; + *blitter_get_addr(machine, blitter.dest.addr) = newcol; cycles_used += 3; } else @@ -652,7 +652,7 @@ static void RunBlit(void) if (blitter.compfunc & CMPFUNC_LOG0) final_result |= ~result & ~dstdata; - *blitter_get_addr(blitter.dest.addr) = final_result; + *blitter_get_addr(machine, blitter.dest.addr) = final_result; cycles_used++; } } @@ -888,7 +888,7 @@ static WRITE8_HANDLER( chipset_w ) data &= 0x3f; bank[offset] = data; - z80_bank(offset, data); + z80_bank(machine, offset, data); break; } @@ -945,7 +945,7 @@ static WRITE8_HANDLER( chipset_w ) blitter.command = data; if (data & CMD_RUN) - RunBlit(); + RunBlit(machine); else mame_printf_debug("Blitter stopped by IO.\n"); @@ -963,7 +963,7 @@ static WRITE8_HANDLER( chipset_w ) } } -INLINE void z80_bank(int num, int data) +INLINE void z80_bank(running_machine *machine, int num, int data) { if (data < 0x08) { @@ -976,7 +976,7 @@ INLINE void z80_bank(int num, int data) UINT32 offset = ((bank[0] >> 1) * 0x20000) + offs_table[bank[0] & 0x1][data]; - memory_set_bankptr(num, memory_region(Machine, "user1") + offset); + memory_set_bankptr(num, memory_region(machine, "user1") + offset); } else if (data < 0x10) { @@ -991,9 +991,9 @@ INLINE void z80_bank(int num, int data) static WRITE8_HANDLER( rombank_w ) { bank[0] = data; - z80_bank(1, bank[1]); - z80_bank(2, bank[2]); - z80_bank(3, bank[3]); + z80_bank(machine, 1, bank[1]); + z80_bank(machine, 2, bank[2]); + z80_bank(machine, 3, bank[3]); } diff --git a/src/mame/drivers/btime.c b/src/mame/drivers/btime.c index 2976be52f44..3369b08aece 100644 --- a/src/mame/drivers/btime.c +++ b/src/mame/drivers/btime.c @@ -81,7 +81,7 @@ INLINE UINT8 swap_bits_5_6(UINT8 data) } -static void btime_decrypt(void) +static void btime_decrypt(running_machine *machine) { UINT8 *src, *src1; int addr, addr1; @@ -98,12 +98,12 @@ static void btime_decrypt(void) /* however if the previous instruction was JSR (which caused a write to */ /* the stack), fetch the address of the next instruction. */ addr1 = activecpu_get_previouspc(); - src1 = (addr1 < 0x9000) ? rambase : memory_region(Machine, "main"); + src1 = (addr1 < 0x9000) ? rambase : memory_region(machine, "main"); if (decrypted[addr1] == 0x20) /* JSR $xxxx */ addr = src1[addr1+1] + 256 * src1[addr1+2]; /* If the address of the next instruction is xxxx xxx1 xxxx x1xx, decode it. */ - src = (addr < 0x9000) ? rambase : memory_region(Machine, "main"); + src = (addr < 0x9000) ? rambase : memory_region(machine, "main"); if ((addr & 0x0104) == 0x0104) { /* 76543210 -> 65342710 bit rotation */ @@ -162,7 +162,7 @@ static WRITE8_HANDLER( btime_w ) rambase[offset] = data; - btime_decrypt(); + btime_decrypt(machine); } static WRITE8_HANDLER( zoar_w ) @@ -180,7 +180,7 @@ static WRITE8_HANDLER( zoar_w ) rambase[offset] = data; - btime_decrypt(); + btime_decrypt(machine); } static WRITE8_HANDLER( disco_w ) @@ -194,7 +194,7 @@ static WRITE8_HANDLER( disco_w ) rambase[offset] = data; - btime_decrypt(); + btime_decrypt(machine); } @@ -1640,10 +1640,10 @@ ROM_START( sdtennis ) ROM_LOAD( "ao_04.10f", 0x1000, 0x1000, CRC(921952af) SHA1(4e9248f3493a5f4651278f27c11f507571242317) ) ROM_END -static void decrypt_C10707_cpu(int cpu, const char *cputag) +static void decrypt_C10707_cpu(running_machine *machine, int cpu, const char *cputag) { UINT8 *decrypt = auto_malloc(0x10000); - UINT8 *rom = memory_region(Machine, cputag); + UINT8 *rom = memory_region(machine, cputag); offs_t addr; memory_set_decrypted_region(cpu, 0x0000, 0xffff, decrypt); @@ -1669,9 +1669,9 @@ static READ8_HANDLER( wtennis_reset_hack_r ) return RAM[0xc15f]; } -static void init_rom1(void) +static void init_rom1(running_machine *machine) { - UINT8 *rom = memory_region(Machine, "main"); + UINT8 *rom = memory_region(machine, "main"); decrypted = auto_malloc(0x10000); memory_set_decrypted_region(0, 0x0000, 0xffff, decrypted); @@ -1684,7 +1684,7 @@ static void init_rom1(void) static DRIVER_INIT( btime ) { - init_rom1(); + init_rom1(machine); } static DRIVER_INIT( zoar ) @@ -1697,31 +1697,31 @@ static DRIVER_INIT( zoar ) I'm NOPing it out for now. */ memset(&rom[0xd50a],0xea,8); - init_rom1(); + init_rom1(machine); } static DRIVER_INIT( lnc ) { - decrypt_C10707_cpu(0, "main"); + decrypt_C10707_cpu(machine, 0, "main"); } static DRIVER_INIT( cookrace ) { memcpy(&audio_rambase[0x200], memory_region(machine, "audio") + 0xf200, 0x200); - decrypt_C10707_cpu(0, "main"); + decrypt_C10707_cpu(machine, 0, "main"); } static DRIVER_INIT( wtennis ) { memcpy(&audio_rambase[0x200], memory_region(machine, "audio") + 0xf200, 0x200); memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc15f, 0xc15f, 0, 0, wtennis_reset_hack_r); - decrypt_C10707_cpu(0, "main"); + decrypt_C10707_cpu(machine, 0, "main"); } static DRIVER_INIT( sdtennis ) { - decrypt_C10707_cpu(0, "main"); - decrypt_C10707_cpu(1, "audio"); + decrypt_C10707_cpu(machine, 0, "main"); + decrypt_C10707_cpu(machine, 1, "audio"); } diff --git a/src/mame/drivers/cntsteer.c b/src/mame/drivers/cntsteer.c index e54dab141b3..31c311f0fac 100644 --- a/src/mame/drivers/cntsteer.c +++ b/src/mame/drivers/cntsteer.c @@ -922,10 +922,10 @@ ROM_END /***************************************************************************/ -static void zerotrgt_rearrange_gfx(int romsize, int romarea) +static void zerotrgt_rearrange_gfx(running_machine *machine, int romsize, int romarea) { - UINT8 *src = memory_region(Machine, "gfx4"); - UINT8 *dst = memory_region(Machine, "gfx3"); + UINT8 *src = memory_region(machine, "gfx4"); + UINT8 *dst = memory_region(machine, "gfx3"); int rm; int cnt1; @@ -952,7 +952,7 @@ static void init_cntsteer(void) RAM[0xc2f1]=0x43; RAM[0xc2f2]=0x43; - zerotrgt_rearrange_gfx(0x02000, 0x10000); + zerotrgt_rearrange_gfx(machine, 0x02000, 0x10000); } #endif @@ -963,7 +963,7 @@ static DRIVER_INIT( zerotrgt ) for (i=0; i<ARRAY_LENGTH(newdata); i++) newdata[i] = -1; - zerotrgt_rearrange_gfx(0x02000, 0x10000); + zerotrgt_rearrange_gfx(machine, 0x02000, 0x10000); } diff --git a/src/mame/drivers/ddenlovr.c b/src/mame/drivers/ddenlovr.c index 169650d32f5..2b8ea14f183 100644 --- a/src/mame/drivers/ddenlovr.c +++ b/src/mame/drivers/ddenlovr.c @@ -360,10 +360,10 @@ INLINE void log_draw_error(int src, int cmd) 06 blit_pen_mode (replace values stored in ROM) */ -static int blit_draw(int src,int sx) +static int blit_draw(running_machine *machine, int src,int sx) { - UINT8 *src_data = memory_region(Machine, "gfx1"); - int src_len = memory_region_length(Machine, "gfx1"); + UINT8 *src_data = memory_region(machine, "gfx1"); + int src_len = memory_region_length(machine, "gfx1"); int bit_addr = (src & 0xffffff) * ddenlovr_blit_rom_bits; /* convert to bit address */ int pen_size, arg_size, cmd; int x; @@ -712,7 +712,7 @@ profiler_mark(PROFILER_VIDEO); case 0x14: blit_fill_xy(ddenlovr_blit_x, ddenlovr_blit_y); break; - case 0x10: ddenlovr_blit_address = blit_draw(ddenlovr_blit_address,ddenlovr_blit_x); + case 0x10: ddenlovr_blit_address = blit_draw(machine,ddenlovr_blit_address,ddenlovr_blit_x); break; case 0x13: blit_horiz_line(); @@ -879,7 +879,7 @@ profiler_mark(PROFILER_VIDEO); // case 0x14: blit_fill_xy(ddenlovr_blit_x, ddenlovr_blit_y); // break; - case 0x00/*0x10*/: ddenlovr_blit_address = blit_draw(ddenlovr_blit_address,ddenlovr_blit_x); + case 0x00/*0x10*/: ddenlovr_blit_address = blit_draw(machine,ddenlovr_blit_address,ddenlovr_blit_x); break; case 0x0b: // same as 03? see the drawing of the R in "cRoss hatch" (key test) @@ -1079,7 +1079,7 @@ profiler_mark(PROFILER_VIDEO); case 0x14: blit_fill_xy(ddenlovr_blit_x, ddenlovr_blit_y); break; - case 0x10: ddenlovr_blit_address = blit_draw(ddenlovr_blit_address,ddenlovr_blit_x); + case 0x10: ddenlovr_blit_address = blit_draw(machine,ddenlovr_blit_address,ddenlovr_blit_x); break; case 0x13: blit_horiz_line(); @@ -1232,7 +1232,7 @@ VIDEO_UPDATE(ddenlovr) ddenlovr_blit_pen_mode = 0; ddenlovr_blit_y = 5; ddenlovr_clip_ctrl = 0x0f; - next = blit_draw(base,0); + next = blit_draw(screen->machine,base,0); popmessage("GFX %06x",base); if (input_code_pressed(KEYCODE_S)) base = next; if (input_code_pressed_once(KEYCODE_X)) base = next; @@ -2495,10 +2495,10 @@ static WRITE8_HANDLER( mjchuuka_blitter_w ) static UINT8 mjchuuka_romdata[2]; -static void mjchuuka_get_romdata(void) +static void mjchuuka_get_romdata(running_machine *machine) { - UINT8 *rom = memory_region( Machine, "gfx1" ); - size_t size = memory_region_length( Machine, "gfx1" ); + UINT8 *rom = memory_region( machine, "gfx1" ); + size_t size = memory_region_length( machine, "gfx1" ); int address = (ddenlovr_blit_address & 0xffffff) * 2; if (address >= size) @@ -2513,7 +2513,7 @@ static void mjchuuka_get_romdata(void) static READ8_HANDLER( mjchuuka_gfxrom_0_r ) { - mjchuuka_get_romdata(); + mjchuuka_get_romdata(machine); ddenlovr_blit_address++; return mjchuuka_romdata[0]; } diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c index 6aef270c1d2..859fdeab135 100644 --- a/src/mame/drivers/dynax.c +++ b/src/mame/drivers/dynax.c @@ -1280,9 +1280,9 @@ static WRITE8_HANDLER( tenkai_palette_w ) } } -static void tenkai_update_rombank(void) +static void tenkai_update_rombank(running_machine *machine) { - romptr = memory_region(Machine, "main") + 0x10000 + 0x8000 * rombank; + romptr = memory_region(machine, "main") + 0x10000 + 0x8000 * rombank; // logerror("rombank = %02x\n",rombank); } @@ -1293,12 +1293,12 @@ static READ8_HANDLER( tenkai_p3_r ) static WRITE8_HANDLER( tenkai_p3_w ) { rombank = ((data & 0x04) << 1) | (rombank & 0x07); - tenkai_update_rombank(); + tenkai_update_rombank(machine); } static WRITE8_HANDLER( tenkai_p4_w ) { rombank = (rombank & 0x08) | ((data & 0x0e) >> 1); - tenkai_update_rombank(); + tenkai_update_rombank(machine); } // Added by Whistler - START static READ8_HANDLER( tenkai_p5_r ) @@ -1325,7 +1325,7 @@ static WRITE8_HANDLER( tenkai_p7_w ) static WRITE8_HANDLER( tenkai_p8_w ) { rombank = ((data & 0x08) << 1) | (rombank & 0x0f); - tenkai_update_rombank(); + tenkai_update_rombank(machine); } static READ8_HANDLER( tenkai_p8_r ) { diff --git a/src/mame/drivers/equites.c b/src/mame/drivers/equites.c index 1e0a57df047..dc7b9da48dd 100644 --- a/src/mame/drivers/equites.c +++ b/src/mame/drivers/equites.c @@ -1800,9 +1800,9 @@ ROM_END /******************************************************************************/ // Initializations -static void unpack_block(const char *region, int offset, int size) +static void unpack_block(running_machine *machine, const char *region, int offset, int size) { - UINT8 *rom = memory_region(Machine, region); + UINT8 *rom = memory_region(machine, region); int i; for (i = 0; i < size; ++i) @@ -1812,35 +1812,35 @@ static void unpack_block(const char *region, int offset, int size) } } -static void unpack_region(const char *region) +static void unpack_region(running_machine *machine, const char *region) { - unpack_block(region, 0x0000, 0x2000); - unpack_block(region, 0x4000, 0x2000); + unpack_block(machine, region, 0x0000, 0x2000); + unpack_block(machine, region, 0x4000, 0x2000); } static DRIVER_INIT( equites ) { - unpack_region("gfx2"); - unpack_region("gfx3"); + unpack_region(machine, "gfx2"); + unpack_region(machine, "gfx3"); } static DRIVER_INIT( bullfgtr ) { - unpack_region("gfx2"); - unpack_region("gfx3"); + unpack_region(machine, "gfx2"); + unpack_region(machine, "gfx3"); } static DRIVER_INIT( kouyakyu ) { - unpack_region("gfx2"); - unpack_region("gfx3"); + unpack_region(machine, "gfx2"); + unpack_region(machine, "gfx3"); } static DRIVER_INIT( gekisou ) { - unpack_region("gfx2"); - unpack_region("gfx3"); + unpack_region(machine, "gfx2"); + unpack_region(machine, "gfx3"); // install special handlers for unknown device (protection?) memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x580000, 0x580001, 0, 0, gekisou_unknown_0_w); @@ -1849,12 +1849,12 @@ static DRIVER_INIT( gekisou ) static DRIVER_INIT( splndrbt ) { - unpack_region("gfx3"); + unpack_region(machine, "gfx3"); } static DRIVER_INIT( hvoltage ) { - unpack_region("gfx3"); + unpack_region(machine, "gfx3"); #if HVOLTAGE_DEBUG memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x000038, 0x000039, 0, 0, hvoltage_debug_r); diff --git a/src/mame/drivers/gamecstl.c b/src/mame/drivers/gamecstl.c index fdf4669a441..ad9eade6b2d 100644 --- a/src/mame/drivers/gamecstl.c +++ b/src/mame/drivers/gamecstl.c @@ -162,7 +162,7 @@ static UINT8 mxtc_config_r(int function, int reg) return mxtc_config_reg[reg]; } -static void mxtc_config_w(int function, int reg, UINT8 data) +static void mxtc_config_w(running_machine *machine, int function, int reg, UINT8 data) { // mame_printf_debug("MXTC: write %d, %02X, %02X at %08X\n", function, reg, data, activecpu_get_pc()); @@ -176,7 +176,7 @@ static void mxtc_config_w(int function, int reg, UINT8 data) } else // disable RAM access (reads go to BIOS ROM) { - memory_set_bankptr(1, memory_region(Machine, "user1") + 0x30000); + memory_set_bankptr(1, memory_region(machine, "user1") + 0x30000); } break; } @@ -221,19 +221,19 @@ static void intel82439tx_pci_w(int function, int reg, UINT32 data, UINT32 mem_ma { if (ACCESSING_BITS_24_31) { - mxtc_config_w(function, reg + 3, (data >> 24) & 0xff); + mxtc_config_w(Machine, function, reg + 3, (data >> 24) & 0xff); } if (ACCESSING_BITS_16_23) { - mxtc_config_w(function, reg + 2, (data >> 16) & 0xff); + mxtc_config_w(Machine, function, reg + 2, (data >> 16) & 0xff); } if (ACCESSING_BITS_8_15) { - mxtc_config_w(function, reg + 1, (data >> 8) & 0xff); + mxtc_config_w(Machine, function, reg + 1, (data >> 8) & 0xff); } if (ACCESSING_BITS_0_7) { - mxtc_config_w(function, reg + 0, (data >> 0) & 0xff); + mxtc_config_w(Machine, function, reg + 0, (data >> 0) & 0xff); } } diff --git a/src/mame/drivers/igs_180.c b/src/mame/drivers/igs_180.c index e0072e38c2d..11d2102260d 100644 --- a/src/mame/drivers/igs_180.c +++ b/src/mame/drivers/igs_180.c @@ -262,10 +262,10 @@ static VIDEO_UPDATE(igs_180) Decryption ***************************************************************************/ -static void decrypt_program_rom(int mask, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0) +static void decrypt_program_rom(running_machine *machine, int mask, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0) { - int length = memory_region_length(Machine, "main"); - UINT8 *rom = memory_region(Machine, "main"); + int length = memory_region_length(machine, "main"); + UINT8 *rom = memory_region(machine, "main"); UINT8 *tmp = auto_malloc(length); int i; @@ -342,7 +342,7 @@ static void iqblocka_patch_rom(running_machine *machine) static DRIVER_INIT( iqblocka ) { - decrypt_program_rom(0x11, 7, 6, 5, 4, 3, 2, 1, 0); + decrypt_program_rom(machine, 0x11, 7, 6, 5, 4, 3, 2, 1, 0); iqblocka_patch_rom(machine); expand_sprites(machine); @@ -352,7 +352,7 @@ static DRIVER_INIT( iqblocka ) static DRIVER_INIT( iqblockf ) { - decrypt_program_rom(0x11, 7, 6, 5, 4, 3, 2, 1, 0); + decrypt_program_rom(machine, 0x11, 7, 6, 5, 4, 3, 2, 1, 0); // iqblockf_patch_rom(machine); expand_sprites(machine); @@ -398,7 +398,7 @@ static void tjsb_patch_rom(running_machine *machine) static DRIVER_INIT( tjsb ) { - decrypt_program_rom(0x05, 7, 6, 3, 2, 5, 4, 1, 0); + decrypt_program_rom(machine, 0x05, 7, 6, 3, 2, 5, 4, 1, 0); tjsb_patch_rom(machine); tjsb_decrypt_sprites(machine); diff --git a/src/mame/drivers/jack.c b/src/mame/drivers/jack.c index f697722dd19..558a71427c4 100644 --- a/src/mame/drivers/jack.c +++ b/src/mame/drivers/jack.c @@ -1331,10 +1331,10 @@ ROM_START( striv ) ROM_END -static void treahunt_decode(void) +static void treahunt_decode(running_machine *machine) { int A; - UINT8 *rom = memory_region(Machine, "main"); + UINT8 *rom = memory_region(machine, "main"); UINT8 *decrypt = auto_malloc(0x4000); int data; @@ -1383,7 +1383,7 @@ static DRIVER_INIT( jack ) static DRIVER_INIT( treahunt ) { timer_rate = 128; - treahunt_decode(); + treahunt_decode(machine); } static DRIVER_INIT( zzyzzyxx ) diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c index 8b5567631cb..13169797024 100644 --- a/src/mame/drivers/megadriv.c +++ b/src/mame/drivers/megadriv.c @@ -2617,7 +2617,7 @@ INLINE void overwrite_write(UINT16 *dst, UINT16 d) if (d & 0x000f) { *dst &= ~0x000f; *dst |= d & 0x000f; } } -static UINT32 pm_io(int reg, int write, UINT32 d) +static UINT32 pm_io(running_machine *machine, int reg, int write, UINT32 d) { if (svp.emu_status & SSP_PMC_SET) { @@ -2672,7 +2672,7 @@ static UINT32 pm_io(int reg, int write, UINT32 d) int addr = svp.pmac_read[reg]&0xffff; if ((mode & 0xfff0) == 0x0800) // ROM, inc 1, verified to be correct { - UINT16 *ROM = (UINT16 *) memory_region(Machine, "main"); + UINT16 *ROM = (UINT16 *) memory_region(machine, "main"); svp.pmac_read[reg] += 1; d = ROM[addr|((mode&0xf)<<16)]; } @@ -2701,7 +2701,7 @@ static UINT32 pm_io(int reg, int write, UINT32 d) static READ16_HANDLER( read_PM0 ) { - UINT32 d = pm_io(0, 0, 0); + UINT32 d = pm_io(machine, 0, 0, 0); if (d != (UINT32)-1) return d; d = svp.XST2; svp.XST2 &= ~2; // ? @@ -2710,14 +2710,14 @@ static READ16_HANDLER( read_PM0 ) static WRITE16_HANDLER( write_PM0 ) { - UINT32 r = pm_io(0, 1, data); + UINT32 r = pm_io(machine, 0, 1, data); if (r != (UINT32)-1) return; svp.XST2 = data; // ? } static READ16_HANDLER( read_PM1 ) { - UINT32 r = pm_io(1, 0, 0); + UINT32 r = pm_io(machine, 1, 0, 0); if (r != (UINT32)-1) return r; logerror("svp: PM1 acces in non PM mode?\n"); return 0; @@ -2725,14 +2725,14 @@ static READ16_HANDLER( read_PM1 ) static WRITE16_HANDLER( write_PM1 ) { - UINT32 r = pm_io(1, 1, data); + UINT32 r = pm_io(machine, 1, 1, data); if (r != (UINT32)-1) return; logerror("svp: PM1 acces in non PM mode?\n"); } static READ16_HANDLER( read_PM2 ) { - UINT32 r = pm_io(2, 0, 0); + UINT32 r = pm_io(machine, 2, 0, 0); if (r != (UINT32)-1) return r; logerror("svp: PM2 acces in non PM mode?\n"); return 0; @@ -2740,14 +2740,14 @@ static READ16_HANDLER( read_PM2 ) static WRITE16_HANDLER( write_PM2 ) { - UINT32 r = pm_io(2, 1, data); + UINT32 r = pm_io(machine, 2, 1, data); if (r != (UINT32)-1) return; logerror("svp: PM2 acces in non PM mode?\n"); } static READ16_HANDLER( read_XST ) { - UINT32 d = pm_io(3, 0, 0); + UINT32 d = pm_io(machine, 3, 0, 0); if (d != (UINT32)-1) return d; return svp.XST; @@ -2755,7 +2755,7 @@ static READ16_HANDLER( read_XST ) static WRITE16_HANDLER( write_XST ) { - UINT32 r = pm_io(3, 1, data); + UINT32 r = pm_io(machine, 3, 1, data); if (r != (UINT32)-1) return; svp.XST2 |= 1; @@ -2764,12 +2764,12 @@ static WRITE16_HANDLER( write_XST ) static READ16_HANDLER( read_PM4 ) { - return pm_io(4, 0, 0); + return pm_io(machine, 4, 0, 0); } static WRITE16_HANDLER( write_PM4 ) { - pm_io(4, 1, data); + pm_io(machine, 4, 1, data); } static READ16_HANDLER( read_PMC ) diff --git a/src/mame/drivers/micro3d.c b/src/mame/drivers/micro3d.c index e64dd8165fa..a20070a50e5 100644 --- a/src/mame/drivers/micro3d.c +++ b/src/mame/drivers/micro3d.c @@ -93,7 +93,7 @@ static UINT8 ti_uart[9]; static int ti_uart_mode_cycle=0; static int ti_uart_sync_cycle=0; -static void m68901_int_gen(int source); +static void m68901_int_gen(running_machine *machine, int source); /* 68901 */ enum{ TMRB=0,TXERR,TBE,RXERR,RBF,TMRA,GPIP6,GPIP7, // A Registers @@ -125,15 +125,15 @@ static void data_from_i8031(int data) } -static void changecolor_BBBBBRRRRRGGGGGG(pen_t color,int data) +static void changecolor_BBBBBRRRRRGGGGGG(running_machine *machine,pen_t color,int data) { - palette_set_color_rgb(Machine,color,pal5bit(data >> 6),pal5bit(data >> 1),pal5bit(data >> 11)); + palette_set_color_rgb(machine,color,pal5bit(data >> 6),pal5bit(data >> 1),pal5bit(data >> 11)); } static WRITE16_HANDLER( paletteram16_BBBBBRRRRRGGGGGG_word_w ) { COMBINE_DATA(&paletteram16[offset]); - changecolor_BBBBBRRRRRGGGGGG(offset,paletteram16[offset]); + changecolor_BBBBBRRRRRGGGGGG(machine,offset,paletteram16[offset]); } @@ -392,12 +392,12 @@ INPUT_PORTS_END static void tms_interrupt(int state) { - m68901_int_gen(GPIP4); + m68901_int_gen(Machine, GPIP4); } static INTERRUPT_GEN( micro3d_vblank ) { - m68901_int_gen(GPIP7); + m68901_int_gen(machine, GPIP7); } @@ -407,34 +407,34 @@ static TIMER_CALLBACK( timera_int ) { // timer_set(attotime_mul(ATTOTIME_IN_HZ(M68901_CLK), ((m68901_base[0xf]>>8) & 0xff) * 200),0,timera_int); // Set the timer again. timer_set(ATTOTIME_IN_USEC(1000), NULL,0,timera_int); // Set the timer again. - m68901_int_gen(TMRA); // Fire an interrupt. + m68901_int_gen(machine, TMRA); // Fire an interrupt. } #ifdef UNUSED_FUNCTION static TIMER_CALLBACK( timerb_int ) { timer_set(attotime_mul(ATTOTIME_IN_HZ(M68901_CLK), ((m68901_base[0x10]>>8) & 0xff) * 200),0,timera_int); - m68901_int_gen(TMRB); // Fire an interrupt. + m68901_int_gen(machine, TMRB); // Fire an interrupt. } static TIMER_CALLBACK( timerc_int ) { timer_set(attotime_mul(ATTOTIME_IN_HZ(M68901_CLK), ((m68901_base[0x11]>>8) & 0xff) * 200),0,timera_int); - m68901_int_gen(TMRC); // Fire an interrupt. + m68901_int_gen(machine, TMRC); // Fire an interrupt. } #endif static TIMER_CALLBACK( timerd_int ) { timer_set(ATTOTIME_IN_USEC(250), NULL,0,timerd_int); - m68901_int_gen(TMRD); // Fire an interrupt. + m68901_int_gen(machine, TMRD); // Fire an interrupt. } /* Called by anything that generates a MFD interrupt */ /* Requires: MFD line number */ -static void m68901_int_gen(int source) +static void m68901_int_gen(running_machine *machine, int source) { // logerror("M68901 interrupt %d requested.\n",source); @@ -451,7 +451,7 @@ int bit=1 << (source-8*(int)(source/8)); if(m68901_base[IMASK_REG] & (bit<<8)) // If interrupt is not masked by MFD, trigger a 68k INT { - cpunum_set_input_line(Machine, 0,4, HOLD_LINE); + cpunum_set_input_line(machine, 0,4, HOLD_LINE); // logerror("M68901 interrupt %d serviced.\n",source); } } diff --git a/src/mame/drivers/mpu4drvr.c b/src/mame/drivers/mpu4drvr.c index 6e3490d57c1..20c1de33d39 100644 --- a/src/mame/drivers/mpu4drvr.c +++ b/src/mame/drivers/mpu4drvr.c @@ -668,7 +668,7 @@ static UINT8 scn2674_gfx_enabled; static UINT8 scn2674_display_enabled; static UINT8 scn2674_cursor_enabled; -static void scn2674_write_command(UINT8 data) +static void scn2674_write_command(running_machine *machine, UINT8 data) { UINT8 oprand; int i; @@ -777,7 +777,7 @@ static void scn2674_write_command(UINT8 data) { scn2674_irq_state = 1; } - update_mpu68_interrupts(Machine); + update_mpu68_interrupts(machine); } if ((data&0xe0)==0x80) { @@ -803,7 +803,7 @@ static void scn2674_write_command(UINT8 data) scn2674_irq_state = 1; } } - update_mpu68_interrupts(Machine); + update_mpu68_interrupts(machine); } @@ -828,7 +828,7 @@ static void scn2674_write_command(UINT8 data) scn2674_irq_state = 1; } } - update_mpu68_interrupts(Machine); + update_mpu68_interrupts(machine); } /* Delayed Commands */ @@ -962,7 +962,7 @@ static WRITE16_HANDLER( mpu4_vid_scn2674_w ) break; case 1: - scn2674_write_command(data); + scn2674_write_command(machine, data); break; case 2: scn2674_screen1_l = data; break; diff --git a/src/mame/drivers/namcos21.c b/src/mame/drivers/namcos21.c index 345fb7f570e..3095fadaf0d 100644 --- a/src/mame/drivers/namcos21.c +++ b/src/mame/drivers/namcos21.c @@ -343,9 +343,9 @@ static struct } *mpDspState; static INT32 -ReadPointROMData( unsigned offset ) +ReadPointROMData( running_machine *machine, unsigned offset ) { - const INT32 *pPointData = (INT32 *)memory_region( Machine, "user2" ); + const INT32 *pPointData = (INT32 *)memory_region( machine, "user2" ); INT32 result = pPointData[offset]; return result; } @@ -426,7 +426,7 @@ TransmitWordToSlave( UINT16 data ) } /* TransmitWordToSlave */ static void -TransferDspData( void ) +TransferDspData( running_machine *machine ) { UINT16 addr = mpDspState->masterSourceAddr; int mode = addr&0x8000; @@ -479,20 +479,20 @@ TransferDspData( void ) } else { - INT32 masterAddr = ReadPointROMData(code); + INT32 masterAddr = ReadPointROMData(machine, code); logerror( "OBJ TFR(0x%x)\n", code ); { UINT16 len = namcos21_dspram16[addr++]; for(;;) { - int subAddr = ReadPointROMData(masterAddr++); + int subAddr = ReadPointROMData(machine, masterAddr++); if( subAddr==0xffffff ) { break; } else { - int primWords = (UINT16)ReadPointROMData(subAddr++); + int primWords = (UINT16)ReadPointROMData(machine, subAddr++); if( primWords>2 ) { TransmitWordToSlave( 0 ); /* pad1 */ @@ -505,7 +505,7 @@ TransferDspData( void ) TransmitWordToSlave( primWords+1 ); for( i=0; i<primWords; i++ ) { - TransmitWordToSlave( (UINT16)ReadPointROMData(subAddr+i) ); + TransmitWordToSlave( (UINT16)ReadPointROMData(machine, subAddr+i) ); } } else @@ -603,7 +603,7 @@ static WRITE16_HANDLER( dspram16_w ) offset == 1+(mpDspState->masterSourceAddr&0x7fff) ) { logerror( "IDC-CONTINUE\n" ); - TransferDspData(); + TransferDspData(machine); } else if( namcos2_gametype == NAMCOS21_SOLVALOU && offset == 0x103 && @@ -617,9 +617,9 @@ static WRITE16_HANDLER( dspram16_w ) /************************************************************************************/ static int -InitDSP( void ) +InitDSP( running_machine *machine ) { - UINT16 *pMem = (UINT16 *)memory_region(Machine, "dspmaster"); + UINT16 *pMem = (UINT16 *)memory_region(machine, "dspmaster"); /** * DSP BIOS tests "CPU ID" on startup * "JAPAN (C)1990 NAMCO LTD. by H.F " @@ -643,7 +643,7 @@ static int mbPointRomDataAvailable; static READ16_HANDLER( dsp_port0_r ) { - INT32 data = ReadPointROMData(pointrom_idx++); + INT32 data = ReadPointROMData(machine, pointrom_idx++); mPointRomMSB = (UINT8)(data>>16); mbPointRomDataAvailable = 1; return (UINT16)data; @@ -678,7 +678,7 @@ static WRITE16_HANDLER( dsp_port2_w ) { logerror( "IDC ADDR INIT(0x%04x)\n", data ); mpDspState->masterSourceAddr = data; - TransferDspData(); + TransferDspData(machine); } /* dsp_port2_w */ static READ16_HANDLER( dsp_port3_idc_rcv_enable_r ) @@ -2196,12 +2196,12 @@ ROM_START( winrun91 ) ROM_LOAD("avo3.11e",0x080000,0x80000,CRC(76e22f92) SHA1(0e1b8d35a5b9c20cc3192d935f0c9da1e69679d2) ) ROM_END -static void namcos21_init( int game_type ) +static void namcos21_init( running_machine *machine, int game_type ) { namcos2_gametype = game_type; pointram = auto_malloc(PTRAM_SIZE); - mpDataROM = (UINT16 *)memory_region( Machine, "user1" ); - InitDSP(); + mpDataROM = (UINT16 *)memory_region( machine, "user1" ); + InitDSP(machine); mbNeedsKickstart = 20; if( game_type==NAMCOS21_CYBERSLED ) { @@ -2227,18 +2227,18 @@ static DRIVER_INIT( winrun ) static DRIVER_INIT( aircombt ) { - namcos21_init( NAMCOS21_AIRCOMBAT ); + namcos21_init( machine, NAMCOS21_AIRCOMBAT ); } static DRIVER_INIT( starblad ) { - namcos21_init( NAMCOS21_STARBLADE ); + namcos21_init( machine, NAMCOS21_STARBLADE ); } static DRIVER_INIT( cybsled ) { - namcos21_init( NAMCOS21_CYBERSLED ); + namcos21_init( machine, NAMCOS21_CYBERSLED ); } static DRIVER_INIT( solvalou ) @@ -2249,7 +2249,7 @@ static DRIVER_INIT( solvalou ) mem[0x20cf4/2+1] = 0x4e71; mem[0x20cf4/2+2] = 0x4e71; - namcos21_init( NAMCOS21_SOLVALOU ); + namcos21_init( machine, NAMCOS21_SOLVALOU ); } static DRIVER_INIT( driveyes ) diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c index 3fd0370cae7..dd7bb7d833c 100644 --- a/src/mame/drivers/neogeo.c +++ b/src/mame/drivers/neogeo.c @@ -80,7 +80,6 @@ ****************************************************************************/ #include "driver.h" -#include "deprecat.h" #include "neogeo.h" #include "machine/pd4990a.h" #include "cpu/z80/z80.h" @@ -625,13 +624,13 @@ static void _set_main_cpu_bank_address(running_machine *machine) } -void neogeo_set_main_cpu_bank_address(UINT32 bank_address) +void neogeo_set_main_cpu_bank_address(running_machine *machine, UINT32 bank_address) { if (LOG_MAIN_CPU_BANKING) logerror("MAIN CPU PC %06x: neogeo_set_main_cpu_bank_address %06x\n", safe_activecpu_get_pc(), bank_address); main_cpu_bank_address = bank_address; - _set_main_cpu_bank_address(Machine); + _set_main_cpu_bank_address(machine); } @@ -652,7 +651,7 @@ static WRITE16_HANDLER( main_cpu_bank_select_w ) bank_address = 0x100000; } - neogeo_set_main_cpu_bank_address(bank_address); + neogeo_set_main_cpu_bank_address(machine, bank_address); } } @@ -665,9 +664,9 @@ static void main_cpu_banking_init(running_machine *machine) /* set initial main CPU bank */ if (memory_region_length(machine, "main") > 0x100000) - neogeo_set_main_cpu_bank_address(0x100000); + neogeo_set_main_cpu_bank_address(machine, 0x100000); else - neogeo_set_main_cpu_bank_address(0x000000); + neogeo_set_main_cpu_bank_address(machine, 0x000000); } diff --git a/src/mame/drivers/royalmah.c b/src/mame/drivers/royalmah.c index 53649b5603f..91a330805f7 100644 --- a/src/mame/drivers/royalmah.c +++ b/src/mame/drivers/royalmah.c @@ -734,19 +734,19 @@ static READ8_HANDLER( mjtensin_p3_r ) return 0xff; } -static void mjtensin_update_rombank(void) +static void mjtensin_update_rombank(running_machine *machine) { - memory_set_bankptr( 1, memory_region(Machine, "main") + 0x10000 + rombank * 0x8000 ); + memory_set_bankptr( 1, memory_region(machine, "main") + 0x10000 + rombank * 0x8000 ); } static WRITE8_HANDLER( mjtensin_p4_w ) { rombank = (rombank & 0xf0) | (data & 0x0f); - mjtensin_update_rombank(); + mjtensin_update_rombank(machine); } static WRITE8_HANDLER( mjtensin_6ff3_w ) { rombank = (data << 4) | (rombank & 0x0f); - mjtensin_update_rombank(); + mjtensin_update_rombank(machine); } static ADDRESS_MAP_START( mjtensin_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -776,19 +776,19 @@ ADDRESS_MAP_END Mahjong Cafe Time ****************************************************************************/ -static void cafetime_update_rombank(void) +static void cafetime_update_rombank(running_machine *machine) { - memory_set_bankptr( 1, memory_region(Machine, "main") + 0x10000 + rombank * 0x8000 ); + memory_set_bankptr( 1, memory_region(machine, "main") + 0x10000 + rombank * 0x8000 ); } static WRITE8_HANDLER( cafetime_p4_w ) { rombank = (rombank & 0xf0) | (data & 0x0f); - cafetime_update_rombank(); + cafetime_update_rombank(machine); } static WRITE8_HANDLER( cafetime_p3_w ) { rombank = (rombank & 0x0f) | ((data & 0x0c) << 2); - cafetime_update_rombank(); + cafetime_update_rombank(machine); } static WRITE8_HANDLER( cafetime_dsw_w ) diff --git a/src/mame/drivers/segag80r.c b/src/mame/drivers/segag80r.c index 3f917142c3a..7a3dc0778e3 100644 --- a/src/mame/drivers/segag80r.c +++ b/src/mame/drivers/segag80r.c @@ -1406,14 +1406,14 @@ ROM_END * *************************************/ -static void monsterb_expand_gfx(const char *region) +static void monsterb_expand_gfx(running_machine *machine, const char *region) { UINT8 *temp, *dest; int i; /* expand the background ROMs; A11/A12 of each ROM is independently controlled via */ /* banking */ - dest = memory_region(Machine, region); + dest = memory_region(machine, region); temp = malloc_or_die(0x4000); memcpy(temp, dest, 0x4000); @@ -1488,7 +1488,7 @@ static DRIVER_INIT( monsterb ) /* configure video */ segag80r_background_pcb = G80_BACKGROUND_MONSTERB; - monsterb_expand_gfx("gfx1"); + monsterb_expand_gfx(machine, "gfx1"); /* install background board handlers */ memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xb8, 0xbd, 0, 0, monsterb_back_port_w); @@ -1504,7 +1504,7 @@ static DRIVER_INIT( monster2 ) /* configure video */ segag80r_background_pcb = G80_BACKGROUND_PIGNEWT; - monsterb_expand_gfx("gfx1"); + monsterb_expand_gfx(machine, "gfx1"); /* install background board handlers */ memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xb4, 0xb5, 0, 0, pignewt_back_color_w); @@ -1520,7 +1520,7 @@ static DRIVER_INIT( pignewt ) /* configure video */ segag80r_background_pcb = G80_BACKGROUND_PIGNEWT; - monsterb_expand_gfx("gfx1"); + monsterb_expand_gfx(machine, "gfx1"); /* install background board handlers */ memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xb4, 0xb5, 0, 0, pignewt_back_color_w); diff --git a/src/mame/drivers/srmp6.c b/src/mame/drivers/srmp6.c index d0b6421ba09..ec1629cdace 100644 --- a/src/mame/drivers/srmp6.c +++ b/src/mame/drivers/srmp6.c @@ -92,7 +92,7 @@ static const gfx_layout tiles8x8_layout = 8*64 }; -static void update_palette(void) +static void update_palette(running_machine *machine) { INT8 r, g ,b; int brg = brightness - 0x60; @@ -120,7 +120,7 @@ static void update_palette(void) b += ((0x1F - b) * brg) >> 5; if(b > 0x1F) b = 0x1F; } - palette_set_color(Machine, i, MAKE_RGB(r << 3, g << 3, b << 3)); + palette_set_color(machine, i, MAKE_RGB(r << 3, g << 3, b << 3)); } } @@ -147,14 +147,14 @@ static VIDEO_START(srmp6) /* Debug code */ #ifdef UNUSED_FUNCTION -static void srmp6_decode_charram(void) +static void srmp6_decode_charram(running_machine *machine) { if(input_code_pressed_once(KEYCODE_Z)) { int i; for (i=0;i<(0x100000*16)/0x40;i++) { - decodechar(Machine->gfx[0], i, (UINT8*)tileram); + decodechar(machine->gfx[0], i, (UINT8*)tileram); dirty_tileram[i] = 0; } } @@ -182,7 +182,7 @@ static VIDEO_UPDATE(srmp6) #if 0 /* debug */ - srmp6_decode_charram(); + srmp6_decode_charram(screen->machine); @@ -350,7 +350,7 @@ static WRITE16_HANDLER( video_regs_w ) data = (!data)?0x60:(data == 0x5e)?0x60:data; if(brightness != data) { brightness = data; - update_palette(); + update_palette(machine); } break; diff --git a/src/mame/drivers/taitowlf.c b/src/mame/drivers/taitowlf.c index 0ebca273423..60d0e951fd2 100644 --- a/src/mame/drivers/taitowlf.c +++ b/src/mame/drivers/taitowlf.c @@ -128,7 +128,7 @@ static UINT8 mxtc_config_r(int function, int reg) return mxtc_config_reg[reg]; } -static void mxtc_config_w(int function, int reg, UINT8 data) +static void mxtc_config_w(running_machine *machine, int function, int reg, UINT8 data) { // mame_printf_debug("MXTC: write %d, %02X, %02X at %08X\n", function, reg, data, activecpu_get_pc()); @@ -142,7 +142,7 @@ static void mxtc_config_w(int function, int reg, UINT8 data) } else // disable RAM access (reads go to BIOS ROM) { - memory_set_bankptr(1, memory_region(Machine, "user1") + 0x30000); + memory_set_bankptr(1, memory_region(machine, "user1") + 0x30000); } break; } @@ -187,19 +187,19 @@ static void intel82439tx_pci_w(int function, int reg, UINT32 data, UINT32 mem_ma { if (ACCESSING_BITS_24_31) { - mxtc_config_w(function, reg + 3, (data >> 24) & 0xff); + mxtc_config_w(Machine, function, reg + 3, (data >> 24) & 0xff); } if (ACCESSING_BITS_16_23) { - mxtc_config_w(function, reg + 2, (data >> 16) & 0xff); + mxtc_config_w(Machine, function, reg + 2, (data >> 16) & 0xff); } if (ACCESSING_BITS_8_15) { - mxtc_config_w(function, reg + 1, (data >> 8) & 0xff); + mxtc_config_w(Machine, function, reg + 1, (data >> 8) & 0xff); } if (ACCESSING_BITS_0_7) { - mxtc_config_w(function, reg + 0, (data >> 0) & 0xff); + mxtc_config_w(Machine, function, reg + 0, (data >> 0) & 0xff); } } diff --git a/src/mame/drivers/tumbleb.c b/src/mame/drivers/tumbleb.c index e68ef0af2f5..9f259bc89a4 100644 --- a/src/mame/drivers/tumbleb.c +++ b/src/mame/drivers/tumbleb.c @@ -3282,10 +3282,10 @@ ROM_END /******************************************************************************/ #if TUMBLEP_HACK -void tumblepb_patch_code(UINT16 offset) +void tumblepb_patch_code(running_machine *machine, UINT16 offset) { /* A hack which enables all Dip Switches effects */ - UINT16 *RAM = (UINT16 *)memory_region(Machine, "main"); + UINT16 *RAM = (UINT16 *)memory_region(machine, "main"); RAM[(offset + 0)/2] = 0x0240; RAM[(offset + 2)/2] = 0xffff; // andi.w #$f3ff, D0 } @@ -3318,7 +3318,7 @@ static DRIVER_INIT( tumblepb ) tumblepb_gfx1_rearrange(machine); #if TUMBLEP_HACK - tumblepb_patch_code(0x000132); + tumblepb_patch_code(machine, 0x000132); #endif } @@ -3327,7 +3327,7 @@ static DRIVER_INIT( tumbleb2 ) tumblepb_gfx1_rearrange(machine); #if TUMBLEP_HACK - tumblepb_patch_code(0x000132); + tumblepb_patch_code(machine, 0x000132); #endif memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x100000, 0x100001, 0, 0, tumbleb2_soundmcu_w ); @@ -3339,7 +3339,7 @@ static DRIVER_INIT( jumpkids ) tumblepb_gfx1_rearrange(machine); #if TUMBLEP_HACK - tumblepb_patch_code(0x00013a); + tumblepb_patch_code(machine, 0x00013a); #endif } diff --git a/src/mame/drivers/zn.c b/src/mame/drivers/zn.c index 2a375c40b01..6e93be1936d 100644 --- a/src/mame/drivers/zn.c +++ b/src/mame/drivers/zn.c @@ -271,19 +271,19 @@ static WRITE32_HANDLER( znsecsel_w ) if( ( m_n_znsecsel & 0x80 ) == 0 ) { psx_sio_install_handler( 0, sio_pad_handler ); - psx_sio_input( Machine, 0, PSX_SIO_IN_DSR, 0 ); + psx_sio_input( machine, 0, PSX_SIO_IN_DSR, 0 ); } else if( ( m_n_znsecsel & 0x08 ) == 0 ) { znsec_start( 1 ); psx_sio_install_handler( 0, sio_znsec1_handler ); - psx_sio_input( Machine, 0, PSX_SIO_IN_DSR, 0 ); + psx_sio_input( machine, 0, PSX_SIO_IN_DSR, 0 ); } else if( ( m_n_znsecsel & 0x04 ) == 0 ) { znsec_start( 0 ); psx_sio_install_handler( 0, sio_znsec0_handler ); - psx_sio_input( Machine, 0, PSX_SIO_IN_DSR, 0 ); + psx_sio_input( machine, 0, PSX_SIO_IN_DSR, 0 ); } else { @@ -291,7 +291,7 @@ static WRITE32_HANDLER( znsecsel_w ) m_b_lastclock = 1; psx_sio_install_handler( 0, sio_dip_handler ); - psx_sio_input( Machine, 0, PSX_SIO_IN_DSR, 0 ); + psx_sio_input( machine, 0, PSX_SIO_IN_DSR, 0 ); timer_adjust_oneshot( dip_timer, ATTOTIME_IN_CYCLES( 100, 0 ), 1 ); } @@ -301,7 +301,7 @@ static WRITE32_HANDLER( znsecsel_w ) static TIMER_CALLBACK( dip_timer_fired ) { - psx_sio_input( Machine, 0, PSX_SIO_IN_DSR, param * PSX_SIO_IN_DSR ); + psx_sio_input( machine, 0, PSX_SIO_IN_DSR, param * PSX_SIO_IN_DSR ); if( param ) { diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h index f0fcfe58cd8..172dc622c9e 100644 --- a/src/mame/includes/neogeo.h +++ b/src/mame/includes/neogeo.h @@ -34,7 +34,7 @@ void neogeo_set_display_position_interrupt_control(UINT16 data); void neogeo_set_display_counter_msb(UINT16 data); void neogeo_set_display_counter_lsb(running_machine *machine, UINT16 data); void neogeo_acknowledge_interrupt(running_machine *machine, UINT16 data); -void neogeo_set_main_cpu_bank_address(UINT32 bank_address); +void neogeo_set_main_cpu_bank_address(running_machine *machine, UINT32 bank_address); READ16_HANDLER( neogeo_unmapped_r ); diff --git a/src/mame/machine/fddebug.c b/src/mame/machine/fddebug.c index 1b6f17be973..7b8f3ee0e3b 100644 --- a/src/mame/machine/fddebug.c +++ b/src/mame/machine/fddebug.c @@ -261,24 +261,24 @@ static void fd1094_regenerate_key(void); static int instruction_hook(offs_t curpc); -static void execute_fdsave(int ref, int params, const char **param); -static void execute_fdoutput(int ref, int params, const char **param); -static void execute_fdseed(int ref, int params, const char **param); -static void execute_fdlockguess(int ref, int params, const char **param); -static void execute_fdeliminate(int ref, int params, const char **param); -static void execute_fdunlock(int ref, int params, const char **param); -static void execute_fdignore(int ref, int params, const char **param); -static void execute_fdundo(int ref, int params, const char **param); -static void execute_fdstatus(int ref, int params, const char **param); -static void execute_fdstate(int ref, int params, const char **param); -static void execute_fdpc(int ref, int params, const char **param); -static void execute_fdsearch(int ref, int params, const char **param); -static void execute_fddasm(int ref, int params, const char **param); -static void execute_fdcset(int ref, int params, const char **param); -static void execute_fdclist(int ref, int params, const char **param); -static void execute_fdcsearch(int ref, int params, const char **param); - -static fd1094_possibility *try_all_possibilities(int basepc, int offset, int length, UINT8 *instrbuffer, UINT8 *keybuffer, fd1094_possibility *possdata); +static void execute_fdsave(running_machine *machine, int ref, int params, const char **param); +static void execute_fdoutput(running_machine *machine, int ref, int params, const char **param); +static void execute_fdseed(running_machine *machine, int ref, int params, const char **param); +static void execute_fdlockguess(running_machine *machine, int ref, int params, const char **param); +static void execute_fdeliminate(running_machine *machine, int ref, int params, const char **param); +static void execute_fdunlock(running_machine *machine, int ref, int params, const char **param); +static void execute_fdignore(running_machine *machine, int ref, int params, const char **param); +static void execute_fdundo(running_machine *machine, int ref, int params, const char **param); +static void execute_fdstatus(running_machine *machine, int ref, int params, const char **param); +static void execute_fdstate(running_machine *machine, int ref, int params, const char **param); +static void execute_fdpc(running_machine *machine, int ref, int params, const char **param); +static void execute_fdsearch(running_machine *machine, int ref, int params, const char **param); +static void execute_fddasm(running_machine *machine, int ref, int params, const char **param); +static void execute_fdcset(running_machine *machine, int ref, int params, const char **param); +static void execute_fdclist(running_machine *machine, int ref, int params, const char **param); +static void execute_fdcsearch(running_machine *machine, int ref, int params, const char **param); + +static fd1094_possibility *try_all_possibilities(running_machine *machine, int basepc, int offset, int length, UINT8 *instrbuffer, UINT8 *keybuffer, fd1094_possibility *possdata); static void tag_possibility(fd1094_possibility *possdata, UINT8 status); static void perform_constrained_search(void); @@ -288,8 +288,8 @@ static int does_key_work_for_constraints(const UINT16 *base, UINT8 *key); static UINT32 reconstruct_base_seed(int keybaseaddr, UINT32 startseed); static void build_optable(void); -static int validate_ea(UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 flags); -static int validate_opcode(UINT32 pc, const UINT8 *opdata, int maxwords); +static int validate_ea(running_machine *machine, UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 flags); +static int validate_opcode(running_machine *machine, UINT32 pc, const UINT8 *opdata, int maxwords); @@ -430,14 +430,14 @@ INLINE void print_possibilities(void) 0=no, 1=yes, 2=unlikely -----------------------------------------------*/ -INLINE int pc_is_valid(UINT32 pc, UINT32 flags) +INLINE int pc_is_valid(running_machine *machine, UINT32 pc, UINT32 flags) { /* if we're odd or out of range, fail */ if ((pc & 1) == 1) return 0; if (pc & 0xff000000) return 0; - if (memory_get_op_ptr(cpu_getactivecpu(), pc, 0) == NULL) + if (memory_get_op_ptr(machine, cpu_getactivecpu(), pc, 0) == NULL) return 0; return 1; } @@ -448,11 +448,11 @@ INLINE int pc_is_valid(UINT32 pc, UINT32 flags) valid? 0=no, 1=yes, 2=unlikely -----------------------------------------------*/ -INLINE int addr_is_valid(UINT32 addr, UINT32 flags) +INLINE int addr_is_valid(running_machine *machine, UINT32 addr, UINT32 flags) { /* if this a JMP, the address is a PC */ if (flags & OF_JMP) - return pc_is_valid(addr, flags); + return pc_is_valid(machine, addr, flags); /* if we're odd or out of range, fail */ if ((flags & OF_SIZEMASK) != OF_BYTE && (addr & 1) == 1) @@ -518,23 +518,23 @@ void fd1094_init_debugging(running_machine *machine, const char *cpureg, const c load_overlay_file(machine); /* add some commands */ - debug_console_register_command("fdsave", CMDFLAG_NONE, 0, 0, 0, execute_fdsave); - debug_console_register_command("fdoutput", CMDFLAG_NONE, 0, 1, 1, execute_fdoutput); - debug_console_register_command("fdseed", CMDFLAG_NONE, 0, 2, 2, execute_fdseed); - debug_console_register_command("fdguess", CMDFLAG_NONE, STATUS_GUESS, 1, 1, execute_fdlockguess); - debug_console_register_command("fdlock", CMDFLAG_NONE, STATUS_LOCKED, 1, 1, execute_fdlockguess); - debug_console_register_command("fdeliminate", CMDFLAG_NONE, 0, 1, 10, execute_fdeliminate); - debug_console_register_command("fdunlock", CMDFLAG_NONE, 0, 1, 1, execute_fdunlock); - debug_console_register_command("fdignore", CMDFLAG_NONE, 0, 0, 1, execute_fdignore); - debug_console_register_command("fdundo", CMDFLAG_NONE, 0, 0, 0, execute_fdundo); - debug_console_register_command("fdstatus", CMDFLAG_NONE, 0, 0, 0, execute_fdstatus); - debug_console_register_command("fdstate", CMDFLAG_NONE, 0, 0, 1, execute_fdstate); - debug_console_register_command("fdpc", CMDFLAG_NONE, 0, 0, 1, execute_fdpc); - debug_console_register_command("fdsearch", CMDFLAG_NONE, 0, 0, 0, execute_fdsearch); - debug_console_register_command("fddasm", CMDFLAG_NONE, 0, 1, 1, execute_fddasm); - debug_console_register_command("fdcset", CMDFLAG_NONE, 0, 2, 4, execute_fdcset); - debug_console_register_command("fdclist", CMDFLAG_NONE, 0, 0, 0, execute_fdclist); - debug_console_register_command("fdcsearch", CMDFLAG_NONE, 0, 0, 0, execute_fdcsearch); + debug_console_register_command(machine, "fdsave", CMDFLAG_NONE, 0, 0, 0, execute_fdsave); + debug_console_register_command(machine, "fdoutput", CMDFLAG_NONE, 0, 1, 1, execute_fdoutput); + debug_console_register_command(machine, "fdseed", CMDFLAG_NONE, 0, 2, 2, execute_fdseed); + debug_console_register_command(machine, "fdguess", CMDFLAG_NONE, STATUS_GUESS, 1, 1, execute_fdlockguess); + debug_console_register_command(machine, "fdlock", CMDFLAG_NONE, STATUS_LOCKED, 1, 1, execute_fdlockguess); + debug_console_register_command(machine, "fdeliminate", CMDFLAG_NONE, 0, 1, 10, execute_fdeliminate); + debug_console_register_command(machine, "fdunlock", CMDFLAG_NONE, 0, 1, 1, execute_fdunlock); + debug_console_register_command(machine, "fdignore", CMDFLAG_NONE, 0, 0, 1, execute_fdignore); + debug_console_register_command(machine, "fdundo", CMDFLAG_NONE, 0, 0, 0, execute_fdundo); + debug_console_register_command(machine, "fdstatus", CMDFLAG_NONE, 0, 0, 0, execute_fdstatus); + debug_console_register_command(machine, "fdstate", CMDFLAG_NONE, 0, 0, 1, execute_fdstate); + debug_console_register_command(machine, "fdpc", CMDFLAG_NONE, 0, 0, 1, execute_fdpc); + debug_console_register_command(machine, "fdsearch", CMDFLAG_NONE, 0, 0, 0, execute_fdsearch); + debug_console_register_command(machine, "fddasm", CMDFLAG_NONE, 0, 1, 1, execute_fddasm); + debug_console_register_command(machine, "fdcset", CMDFLAG_NONE, 0, 2, 4, execute_fdcset); + debug_console_register_command(machine, "fdclist", CMDFLAG_NONE, 0, 0, 0, execute_fdclist); + debug_console_register_command(machine, "fdcsearch", CMDFLAG_NONE, 0, 0, 0, execute_fdcsearch); /* set up the instruction hook */ debug_cpu_set_instruction_hook(0, instruction_hook); @@ -722,7 +722,7 @@ static int instruction_hook(offs_t curpc) } /* try all possible decodings at the current pc */ - posscount = try_all_possibilities(curpc, 0, 0, instrbuffer, keybuffer, posslist) - posslist; + posscount = try_all_possibilities(Machine, curpc, 0, 0, instrbuffer, keybuffer, posslist) - posslist; if (keydirty) fd1094_regenerate_key(); @@ -744,9 +744,9 @@ static int instruction_hook(offs_t curpc) execute_fdsave - handle the 'fdsave' command -----------------------------------------------*/ -static void execute_fdsave(int ref, int params, const char **param) +static void execute_fdsave(running_machine *machine, int ref, int params, const char **param) { - save_overlay_file(Machine); + save_overlay_file(machine); debug_console_printf("File saved\n"); } @@ -756,7 +756,7 @@ static void execute_fdsave(int ref, int params, const char **param) to a file -----------------------------------------------*/ -static void execute_fdoutput(int ref, int params, const char **param) +static void execute_fdoutput(running_machine *machine, int ref, int params, const char **param) { file_error filerr; mame_file *file; @@ -780,7 +780,7 @@ static void execute_fdoutput(int ref, int params, const char **param) execute_fdseed - handle the 'fdseed' command -----------------------------------------------*/ -static void execute_fdseed(int ref, int params, const char **param) +static void execute_fdseed(running_machine *machine, int ref, int params, const char **param) { UINT64 num1, num2; @@ -807,7 +807,7 @@ static void execute_fdseed(int ref, int params, const char **param) and 'fdguess' commands -----------------------------------------------*/ -static void execute_fdlockguess(int ref, int params, const char **param) +static void execute_fdlockguess(running_machine *machine, int ref, int params, const char **param) { UINT64 num1; @@ -836,7 +836,7 @@ static void execute_fdlockguess(int ref, int params, const char **param) 'fdeliminate' command -----------------------------------------------*/ -static void execute_fdeliminate(int ref, int params, const char **param) +static void execute_fdeliminate(running_machine *machine, int ref, int params, const char **param) { int pnum, posssrc, possdst; int plist[10]; @@ -887,7 +887,7 @@ static void execute_fdeliminate(int ref, int params, const char **param) command -----------------------------------------------*/ -static void execute_fdunlock(int ref, int params, const char **param) +static void execute_fdunlock(running_machine *machine, int ref, int params, const char **param) { int reps = keystatus_words / KEY_SIZE; int keyaddr, repnum; @@ -924,7 +924,7 @@ static void execute_fdunlock(int ref, int params, const char **param) command -----------------------------------------------*/ -static void execute_fdignore(int ref, int params, const char **param) +static void execute_fdignore(running_machine *machine, int ref, int params, const char **param) { UINT64 offset; @@ -957,7 +957,7 @@ static void execute_fdignore(int ref, int params, const char **param) command -----------------------------------------------*/ -static void execute_fdundo(int ref, int params, const char **param) +static void execute_fdundo(running_machine *machine, int ref, int params, const char **param) { /* copy the undobuffer back and regenerate the key */ memcpy(keystatus, undobuff, keystatus_words * 2); @@ -971,7 +971,7 @@ static void execute_fdundo(int ref, int params, const char **param) command -----------------------------------------------*/ -static void execute_fdstatus(int ref, int params, const char **param) +static void execute_fdstatus(running_machine *machine, int ref, int params, const char **param) { int numreps = keystatus_words / KEY_SIZE; int locked = 4, nomatter = 0, guesses = 0; @@ -1003,7 +1003,7 @@ static void execute_fdstatus(int ref, int params, const char **param) command -----------------------------------------------*/ -static void execute_fdstate(int ref, int params, const char **param) +static void execute_fdstate(running_machine *machine, int ref, int params, const char **param) { UINT64 newstate; @@ -1028,7 +1028,7 @@ static void execute_fdstate(int ref, int params, const char **param) command -----------------------------------------------*/ -static void execute_fdpc(int ref, int params, const char **param) +static void execute_fdpc(running_machine *machine, int ref, int params, const char **param) { UINT64 newpc; @@ -1049,7 +1049,7 @@ static void execute_fdpc(int ref, int params, const char **param) command -----------------------------------------------*/ -static void execute_fdsearch(int ref, int params, const char **param) +static void execute_fdsearch(running_machine *machine, int ref, int params, const char **param) { int pc = activecpu_get_pc(); int length, first = TRUE; @@ -1102,7 +1102,7 @@ static void execute_fdsearch(int ref, int params, const char **param) instrdata[1] = decoded; /* get the opcode */ - length = validate_opcode(pc, instrdata, 1); + length = validate_opcode(machine, pc, instrdata, 1); if (length < 0) length = -length; if (length == 0) @@ -1174,7 +1174,7 @@ static void execute_fdsearch(int ref, int params, const char **param) command -----------------------------------------------*/ -static void execute_fddasm(int ref, int params, const char **param) +static void execute_fddasm(running_machine *machine, int ref, int params, const char **param) { int origstate = fd1094_set_state(keyregion, -1); const char *filename; @@ -1262,7 +1262,7 @@ static void execute_fddasm(int ref, int params, const char **param) if (unknowns > 0) { UINT8 keybuffer[5]; - int posscount = try_all_possibilities(pcaddr * 2, 0, 0, instrbuffer, keybuffer, posslist) - posslist; + int posscount = try_all_possibilities(machine, pcaddr * 2, 0, 0, instrbuffer, keybuffer, posslist) - posslist; for (pnum = 0; pnum < posscount; pnum++) if (strcmp(disasm, posslist[pnum].dasm) != 0) { @@ -1291,7 +1291,7 @@ static void execute_fddasm(int ref, int params, const char **param) command -----------------------------------------------*/ -static void execute_fdcset(int ref, int params, const char **param) +static void execute_fdcset(running_machine *machine, int ref, int params, const char **param) { UINT64 pc, value, mask = 0xffff, state = FD1094_STATE_RESET; int cnum; @@ -1349,7 +1349,7 @@ static void execute_fdcset(int ref, int params, const char **param) command -----------------------------------------------*/ -static void execute_fdclist(int ref, int params, const char **param) +static void execute_fdclist(running_machine *machine, int ref, int params, const char **param) { int cnum; @@ -1368,7 +1368,7 @@ static void execute_fdclist(int ref, int params, const char **param) command -----------------------------------------------*/ -static void execute_fdcsearch(int ref, int params, const char **param) +static void execute_fdcsearch(running_machine *machine, int ref, int params, const char **param) { // debug_console_printf("Searching for possible global keys....\n"); perform_constrained_search(); @@ -1382,7 +1382,7 @@ static void execute_fdcsearch(int ref, int params, const char **param) length -----------------------------------------------*/ -static fd1094_possibility *try_all_possibilities(int basepc, int offset, int length, UINT8 *instrbuffer, UINT8 *keybuffer, fd1094_possibility *possdata) +static fd1094_possibility *try_all_possibilities(running_machine *machine, int basepc, int offset, int length, UINT8 *instrbuffer, UINT8 *keybuffer, fd1094_possibility *possdata) { UINT8 keymask, keystat; UINT16 possvalue[4]; @@ -1457,7 +1457,7 @@ static fd1094_possibility *try_all_possibilities(int basepc, int offset, int len /* first make sure we are a valid instruction */ if ((possvalue[i] & 0xf000) == 0xa000 || (possvalue[i] & 0xf000) == 0xf000) continue; - length = validate_opcode(basepc, instrbuffer, 1); + length = validate_opcode(machine, basepc, instrbuffer, 1); if (length == 0) continue; if (length < 0) @@ -1466,7 +1466,7 @@ static fd1094_possibility *try_all_possibilities(int basepc, int offset, int len /* if we're not at our target length, recursively call ourselves */ if (offset < length - 1) - possdata = try_all_possibilities(basepc, offset + 1, length, instrbuffer, keybuffer, possdata); + possdata = try_all_possibilities(machine, basepc, offset + 1, length, instrbuffer, keybuffer, possdata); /* otherwise, output what we have */ else @@ -1477,7 +1477,7 @@ static fd1094_possibility *try_all_possibilities(int basepc, int offset, int len m68k_disassemble_raw(possdata->dasm, basepc, instrbuffer, instrbuffer, M68K_CPU_TYPE_68000); /* validate the opcode */ - tlen = validate_opcode(basepc, instrbuffer, length); + tlen = validate_opcode(machine, basepc, instrbuffer, length); if (tlen == 0) { printf("Eliminated: %s [", possdata->dasm); @@ -2223,7 +2223,7 @@ static void build_optable(void) valid or not, and return the length -----------------------------------------------*/ -static int validate_ea(UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 flags) +static int validate_ea(running_machine *machine, UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 flags) { UINT32 addr; int valid; @@ -2256,15 +2256,15 @@ static int validate_ea(UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 { case 0: /* (xxx).W -- make sure it is not odd for word/long */ addr = (INT16)((parambase[0] << 8) | parambase[1]); - valid = addr_is_valid(addr & 0xffffff, flags); + valid = addr_is_valid(machine, addr & 0xffffff, flags); return (valid == 0) ? 1000 : (valid == 2) ? -1 : 1; case 1: /* (xxx).L -- make sure it is not odd for word/long, and make sure upper byte of addr is 0 */ - valid = addr_is_valid((parambase[0] << 24) | (parambase[1] << 16) | (parambase[2] << 8) | parambase[3], flags); + valid = addr_is_valid(machine, (parambase[0] << 24) | (parambase[1] << 16) | (parambase[2] << 8) | parambase[3], flags); return (valid == 0) ? 1000 : (valid == 2) ? -2 : 2; case 2: /* (d16,PC) -- make sure it is not odd for word/long */ - valid = addr_is_valid(pc + (INT16)((parambase[0] << 8) | parambase[1]), flags); + valid = addr_is_valid(machine, pc + (INT16)((parambase[0] << 8) | parambase[1]), flags); return (valid == 0) ? 1000 : (valid == 2) ? -1 : 1; case 3: /* (d8,PC,Xn) -- odd displacements are a warning for word/long */ @@ -2293,7 +2293,7 @@ static int validate_ea(UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 the length specified -----------------------------------------------*/ -static int validate_opcode(UINT32 pc, const UINT8 *opdata, int maxwords) +static int validate_opcode(running_machine *machine, UINT32 pc, const UINT8 *opdata, int maxwords) { UINT32 immvalue = 0; int iffy = FALSE; @@ -2370,7 +2370,7 @@ static int validate_opcode(UINT32 pc, const UINT8 *opdata, int maxwords) pc += immvalue; /* if we're odd or out of range, fail */ - valid = pc_is_valid(pc, flags); + valid = pc_is_valid(machine, pc, flags); if (valid == 0) return 0; if (valid == 2) @@ -2381,7 +2381,7 @@ static int validate_opcode(UINT32 pc, const UINT8 *opdata, int maxwords) if (flags & (OF_EASRC | OF_EADST)) { int modereg = opcode & 0x003f; - int ealen = validate_ea(pc + offset*2, modereg, &opdata[offset*2], flags); + int ealen = validate_ea(machine, pc + offset*2, modereg, &opdata[offset*2], flags); /* if the ea was invalid, forward that result */ if (ealen == 1000) @@ -2402,7 +2402,7 @@ static int validate_opcode(UINT32 pc, const UINT8 *opdata, int maxwords) if (flags & OF_MOVE) { int modereg = ((opcode & 0x01c0) >> 3) | ((opcode & 0x0e00) >> 9); - int ealen = validate_ea(pc + offset*2, modereg, &opdata[offset*2], flags); + int ealen = validate_ea(machine, pc + offset*2, modereg, &opdata[offset*2], flags); /* if the ea was invalid, forward that result */ if (ealen == 1000) diff --git a/src/mame/machine/neoboot.c b/src/mame/machine/neoboot.c index bac115c8bd6..e5b8e997648 100644 --- a/src/mame/machine/neoboot.c +++ b/src/mame/machine/neoboot.c @@ -135,12 +135,12 @@ void kog_px_decrypt( running_machine *machine ) static UINT16 kof10thExtraRAMB[0x01000]; -static void kof10thBankswitch(UINT16 nBank) +static void kof10thBankswitch(running_machine *machine, UINT16 nBank) { UINT32 bank = 0x100000 + ((nBank & 7) << 20); if (bank >= 0x700000) bank = 0x100000; - neogeo_set_main_cpu_bank_address(bank); + neogeo_set_main_cpu_bank_address(machine, bank); } static READ16_HANDLER( kof10th_RAMB_r ) @@ -163,7 +163,7 @@ static WRITE16_HANDLER( kof10th_bankswitch_w ) { if (offset >= 0x5F000) { if (offset == 0x5FFF8) { // Standard bankswitch - kof10thBankswitch(data); + kof10thBankswitch(machine, data); } else if (offset == 0x5FFFC && kof10thExtraRAMB[0xFFC] != data) { // Special bankswitch UINT8 *src = memory_region( machine, "main" ); memcpy (src + 0x10000, src + ((data & 1) ? 0x810000 : 0x710000), 0xcffff); @@ -421,7 +421,7 @@ static WRITE16_HANDLER ( cthd2003_bankswitch_w ) if (offset == 0) { bankaddress = 0x100000 + cthd2003_banks[data&7]*0x100000; - neogeo_set_main_cpu_bank_address(bankaddress); + neogeo_set_main_cpu_bank_address(machine, bankaddress); } } @@ -647,7 +647,7 @@ static WRITE16_HANDLER ( ms5plus_bankswitch_w ) if ((offset == 0)&&(data == 0xa0)) { bankaddress=0xa0; - neogeo_set_main_cpu_bank_address(bankaddress); + neogeo_set_main_cpu_bank_address(machine, bankaddress); logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,activecpu_get_pc(),bankaddress); } else if(offset == 2) @@ -655,7 +655,7 @@ static WRITE16_HANDLER ( ms5plus_bankswitch_w ) data=data>>4; //data=data&7; bankaddress=data*0x100000; - neogeo_set_main_cpu_bank_address(bankaddress); + neogeo_set_main_cpu_bank_address(machine, bankaddress); logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,activecpu_get_pc(),bankaddress); } } @@ -832,7 +832,7 @@ static WRITE16_HANDLER( mv0_bankswitch_w ) { UINT32 bankaddress = (mv0_bank_ram[ 0 ] >> 8) + (mv0_bank_ram[ 1 ] << 8) + 0x100000; COMBINE_DATA( &mv0_bank_ram[ offset ] ); - neogeo_set_main_cpu_bank_address( bankaddress ); + neogeo_set_main_cpu_bank_address( machine, bankaddress ); } #endif @@ -862,7 +862,7 @@ static WRITE16_HANDLER( kof2003_w ) cr[BYTE_XOR_LE(0x1ff0)] = 0xa0; cr[BYTE_XOR_LE(0x1ff1)] &= 0xfe; cr[BYTE_XOR_LE(0x1ff3)] &= 0x7f; - neogeo_set_main_cpu_bank_address(address+0x100000); + neogeo_set_main_cpu_bank_address(machine, address+0x100000); mem[BYTE_XOR_LE(0x58196)] = prt; } @@ -879,7 +879,7 @@ static WRITE16_HANDLER( kof2003p_w ) cr[BYTE_XOR_LE(0x1ff0)] &= 0xfe; cr[BYTE_XOR_LE(0x1ff3)] &= 0x7f; - neogeo_set_main_cpu_bank_address(address+0x100000); + neogeo_set_main_cpu_bank_address(machine, address+0x100000); mem[BYTE_XOR_LE(0x58196)] = prt; } diff --git a/src/mame/machine/neoprot.c b/src/mame/machine/neoprot.c index 6fb669506f3..595e0f4d49c 100644 --- a/src/mame/machine/neoprot.c +++ b/src/mame/machine/neoprot.c @@ -213,7 +213,7 @@ static WRITE16_HANDLER( kof99_bankswitch_w ) bankaddress = 0x100000 + bankoffset[data]; - neogeo_set_main_cpu_bank_address(bankaddress); + neogeo_set_main_cpu_bank_address(machine, bankaddress); } @@ -250,7 +250,7 @@ static WRITE16_HANDLER( garou_bankswitch_w ) bankaddress = 0x100000 + bankoffset[data]; - neogeo_set_main_cpu_bank_address(bankaddress); + neogeo_set_main_cpu_bank_address(machine, bankaddress); } @@ -289,7 +289,7 @@ static WRITE16_HANDLER( garouo_bankswitch_w ) bankaddress = 0x100000 + bankoffset[data]; - neogeo_set_main_cpu_bank_address(bankaddress); + neogeo_set_main_cpu_bank_address(machine, bankaddress); } @@ -325,7 +325,7 @@ static WRITE16_HANDLER( mslug3_bankswitch_w ) bankaddress = 0x100000 + bankoffset[data]; - neogeo_set_main_cpu_bank_address(bankaddress); + neogeo_set_main_cpu_bank_address(machine, bankaddress); } @@ -357,7 +357,7 @@ static WRITE16_HANDLER( kof2000_bankswitch_w ) bankaddress = 0x100000 + bankoffset[data]; - neogeo_set_main_cpu_bank_address(bankaddress); + neogeo_set_main_cpu_bank_address(machine, bankaddress); } @@ -490,14 +490,14 @@ static void pvc_prot2( void ) // on writes to e8/e9/ea/eb } -static void pvc_write_bankswitch( void ) +static void pvc_write_bankswitch( running_machine *machine ) { UINT32 bankaddress; bankaddress = ((pvc_cartridge_ram[0xff8]>>8)|(pvc_cartridge_ram[0xff9]<<8)); *(((UINT8 *)pvc_cartridge_ram) + BYTE_XOR_LE(0x1ff0)) = 0xa0; *(((UINT8 *)pvc_cartridge_ram) + BYTE_XOR_LE(0x1ff1)) &= 0xfe; *(((UINT8 *)pvc_cartridge_ram) + BYTE_XOR_LE(0x1ff3)) &= 0x7f; - neogeo_set_main_cpu_bank_address(bankaddress+0x100000); + neogeo_set_main_cpu_bank_address(machine, bankaddress+0x100000); } @@ -512,7 +512,7 @@ static WRITE16_HANDLER( pvc_prot_w ) COMBINE_DATA( &pvc_cartridge_ram[ offset ] ); if (offset == 0xff0)pvc_prot1(); else if(offset >= 0xff4 && offset <= 0xff5)pvc_prot2(); - else if(offset >= 0xff8)pvc_write_bankswitch(); + else if(offset >= 0xff8)pvc_write_bankswitch(machine); } diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c index acd20e1144e..f6d5cb56f5f 100644 --- a/src/osd/windows/debugwin.c +++ b/src/osd/windows/debugwin.c @@ -2460,7 +2460,7 @@ static int disasm_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lpar active_address = debug_view_get_property_UINT32(info->view[0].view, DVP_DASM_ACTIVE_ADDRESS); sprintf(command, "go %X", BYTE2ADDR(active_address, cpuinfo, ADDRESS_SPACE_PROGRAM)); - debug_console_execute_command(command, 1); + debug_console_execute_command(Machine, command, 1); } return 1; @@ -2494,7 +2494,7 @@ static int disasm_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lpar sprintf(command, "bpset %X", BYTE2ADDR(active_address, cpuinfo, ADDRESS_SPACE_PROGRAM)); else sprintf(command, "bpclear %X", bp_num); - debug_console_execute_command(command, 1); + debug_console_execute_command(Machine, command, 1); } return 1; } @@ -2768,7 +2768,7 @@ static void console_process_string(debugwin_info *info, const char *string) // otherwise, just process the command else - debug_console_execute_command(string, 1); + debug_console_execute_command(Machine, string, 1); // clear the edit text box SendMessage(info->editwnd, WM_SETTEXT, 0, (LPARAM)&buffer); diff --git a/src/osd/windows/drawgdi.c b/src/osd/windows/drawgdi.c index 58f53944508..aa5393014fa 100644 --- a/src/osd/windows/drawgdi.c +++ b/src/osd/windows/drawgdi.c @@ -14,6 +14,7 @@ // MAME headers #include "mamecore.h" #include "restrack.h" +#include "deprecat.h" // MAMEOS headers #include "window.h" diff --git a/src/osd/windows/drawnone.c b/src/osd/windows/drawnone.c index 8a315be70b0..2405ffb3071 100644 --- a/src/osd/windows/drawnone.c +++ b/src/osd/windows/drawnone.c @@ -13,6 +13,7 @@ // MAME headers #include "mamecore.h" +#include "deprecat.h" // MAMEOS headers #include "window.h" diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c index ad5a6cb20ea..963138391f4 100644 --- a/src/osd/windows/input.c +++ b/src/osd/windows/input.c @@ -939,7 +939,7 @@ static void win32_init(running_machine *machine) break; // add the device - devinfo->device = input_device_add(DEVICE_CLASS_LIGHTGUN, devinfo->name, devinfo); + devinfo->device = input_device_add(machine, DEVICE_CLASS_LIGHTGUN, devinfo->name, devinfo); // populate the axes for (axisnum = 0; axisnum < 2; axisnum++) @@ -1317,7 +1317,7 @@ static BOOL CALLBACK dinput_keyboard_enum(LPCDIDEVICEINSTANCE instance, LPVOID r goto exit; // add the device - devinfo->device = input_device_add(DEVICE_CLASS_KEYBOARD, devinfo->name, devinfo); + devinfo->device = input_device_add(Machine, DEVICE_CLASS_KEYBOARD, devinfo->name, devinfo); devinfo->poll = dinput_keyboard_poll; // populate it @@ -1389,11 +1389,11 @@ static BOOL CALLBACK dinput_mouse_enum(LPCDIDEVICEINSTANCE instance, LPVOID ref) } // add the device - devinfo->device = input_device_add(DEVICE_CLASS_MOUSE, devinfo->name, devinfo); + devinfo->device = input_device_add(Machine, DEVICE_CLASS_MOUSE, devinfo->name, devinfo); devinfo->poll = dinput_mouse_poll; if (guninfo != NULL) { - guninfo->device = input_device_add(DEVICE_CLASS_LIGHTGUN, guninfo->name, guninfo); + guninfo->device = input_device_add(Machine, DEVICE_CLASS_LIGHTGUN, guninfo->name, guninfo); guninfo->poll = win32_lightgun_poll; } @@ -1493,7 +1493,7 @@ static BOOL CALLBACK dinput_joystick_enum(LPCDIDEVICEINSTANCE instance, LPVOID r devinfo->dinput.caps.dwButtons = MIN(devinfo->dinput.caps.dwButtons, 128); // add the device - devinfo->device = input_device_add(DEVICE_CLASS_JOYSTICK, devinfo->name, devinfo); + devinfo->device = input_device_add(Machine, DEVICE_CLASS_JOYSTICK, devinfo->name, devinfo); devinfo->poll = dinput_joystick_poll; // populate the axes @@ -1926,7 +1926,7 @@ static void rawinput_keyboard_enum(PRAWINPUTDEVICELIST device) return; // add the device - devinfo->device = input_device_add(DEVICE_CLASS_KEYBOARD, devinfo->name, devinfo); + devinfo->device = input_device_add(Machine, DEVICE_CLASS_KEYBOARD, devinfo->name, devinfo); // populate it for (keynum = 0; keynum < MAX_KEYS; keynum++) @@ -1999,10 +1999,10 @@ static void rawinput_mouse_enum(PRAWINPUTDEVICELIST device) } // add the device - devinfo->device = input_device_add(DEVICE_CLASS_MOUSE, devinfo->name, devinfo); + devinfo->device = input_device_add(Machine, DEVICE_CLASS_MOUSE, devinfo->name, devinfo); if (guninfo != NULL) { - guninfo->device = input_device_add(DEVICE_CLASS_LIGHTGUN, guninfo->name, guninfo); + guninfo->device = input_device_add(Machine, DEVICE_CLASS_LIGHTGUN, guninfo->name, guninfo); guninfo->poll = (guninfo == lightgun_list) ? win32_lightgun_poll : NULL; guninfo->mouse.partner = &devinfo->mouse; } diff --git a/src/osd/windows/window.c b/src/osd/windows/window.c index f20009facfc..cc26f812428 100644 --- a/src/osd/windows/window.c +++ b/src/osd/windows/window.c @@ -134,15 +134,15 @@ static int complete_create(running_machine *machine, win_window_info *window); static void create_window_class(void); static void set_starting_view(running_machine *machine, int index, win_window_info *window, const char *view); -static void constrain_to_aspect_ratio(win_window_info *window, RECT *rect, int adjustment); -static void get_min_bounds(win_window_info *window, RECT *bounds, int constrain); -static void get_max_bounds(win_window_info *window, RECT *bounds, int constrain); -static void update_minmax_state(win_window_info *window); -static void minimize_window(win_window_info *window); -static void maximize_window(win_window_info *window); +static void constrain_to_aspect_ratio(running_machine *machine, win_window_info *window, RECT *rect, int adjustment); +static void get_min_bounds(running_machine *mchine, win_window_info *window, RECT *bounds, int constrain); +static void get_max_bounds(running_machine *machine, win_window_info *window, RECT *bounds, int constrain); +static void update_minmax_state(running_machine *machine, win_window_info *window); +static void minimize_window(running_machine *machine, win_window_info *window); +static void maximize_window(running_machine *machine, win_window_info *window); -static void adjust_window_position_after_major_change(win_window_info *window); -static void set_fullscreen(win_window_info *window, int fullscreen); +static void adjust_window_position_after_major_change(running_machine *machine, win_window_info *window); +static void set_fullscreen(running_machine *machine, win_window_info *window, int fullscreen); // temporary hacks @@ -223,7 +223,7 @@ void winwindow_init(running_machine *machine) fatalerror("Failed to create window thread ready event"); // create a thread to run the windows from - temp = _beginthreadex(NULL, 0, thread_entry, NULL, 0, (unsigned *)&window_threadid); + temp = _beginthreadex(NULL, 0, thread_entry, (void*)machine, 0, (unsigned *)&window_threadid); window_thread = (HANDLE)temp; if (window_thread == NULL) fatalerror("Failed to create window thread"); @@ -994,6 +994,7 @@ INLINE int wnd_extra_height(win_window_info *window) static unsigned __stdcall thread_entry(void *param) { MSG message; + running_machine *machine = (running_machine*)param; // make a bogus user call to make us a message thread PeekMessage(&message, NULL, 0, 0, PM_NOREMOVE); @@ -1063,7 +1064,7 @@ static unsigned __stdcall thread_entry(void *param) case WM_USER_FINISH_CREATE_WINDOW: { win_window_info *window = (win_window_info *)message.lParam; - window->init_state = complete_create(Machine, window) ? -1 : 1; + window->init_state = complete_create(machine, window) ? -1 : 1; dispatch = FALSE; break; } @@ -1137,10 +1138,10 @@ static int complete_create(running_machine *machine, win_window_info *window) // maximum or minimize as appropriate if (window->startmaximized) - maximize_window(window); + maximize_window(machine, window); else - minimize_window(window); - adjust_window_position_after_major_change(window); + minimize_window(machine, window); + adjust_window_position_after_major_change(machine, window); // show the window if (!window->fullscreen || window->fullscreen_safe) @@ -1175,7 +1176,7 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar if (window != NULL) { assert(GetCurrentThreadId() == window_threadid); - update_minmax_state(window); + update_minmax_state(Machine, window); } // handle a few messages @@ -1277,7 +1278,7 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar { RECT *rect = (RECT *)lparam; if (video_config.keepaspect && !(GetAsyncKeyState(VK_CONTROL) & 0x8000)) - constrain_to_aspect_ratio(window, rect, wparam); + constrain_to_aspect_ratio(Machine, window, rect, wparam); InvalidateRect(wnd, NULL, FALSE); break; } @@ -1295,11 +1296,11 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar // handle maximize if ((wparam & 0xfff0) == SC_MAXIMIZE) { - update_minmax_state(window); + update_minmax_state(Machine, window); if (window->ismaximized) - minimize_window(window); + minimize_window(Machine, window); else - maximize_window(window); + maximize_window(Machine, window); break; } return DefWindowProc(wnd, message, wparam, lparam); @@ -1345,17 +1346,17 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar // fullscreen set case WM_USER_SET_FULLSCREEN: - set_fullscreen(window, wparam); + set_fullscreen(Machine, window, wparam); break; // minimum size set case WM_USER_SET_MINSIZE: - minimize_window(window); + minimize_window(Machine, window); break; // maximum size set case WM_USER_SET_MAXSIZE: - maximize_window(window); + maximize_window(Machine, window); break; // set focus: if we're not the primary window, switch back @@ -1422,7 +1423,7 @@ static void draw_video_contents(win_window_info *window, HDC dc, int update) // (window thread) //============================================================ -static void constrain_to_aspect_ratio(win_window_info *window, RECT *rect, int adjustment) +static void constrain_to_aspect_ratio(running_machine *machine, win_window_info *window, RECT *rect, int adjustment) { win_monitor_info *monitor = winwindow_video_window_monitor(window, rect); INT32 extrawidth = wnd_extra_width(window); @@ -1538,7 +1539,7 @@ static void constrain_to_aspect_ratio(win_window_info *window, RECT *rect, int a // (window thread) //============================================================ -static void get_min_bounds(win_window_info *window, RECT *bounds, int constrain) +static void get_min_bounds(running_machine *machine, win_window_info *window, RECT *bounds, int constrain) { INT32 minwidth, minheight; @@ -1566,13 +1567,13 @@ static void get_min_bounds(win_window_info *window, RECT *bounds, int constrain) test1.top = test1.left = 0; test1.right = minwidth; test1.bottom = 10000; - constrain_to_aspect_ratio(window, &test1, WMSZ_BOTTOMRIGHT); + constrain_to_aspect_ratio(machine, window, &test1, WMSZ_BOTTOMRIGHT); // then constrain with no width limit test2.top = test2.left = 0; test2.right = 10000; test2.bottom = minheight; - constrain_to_aspect_ratio(window, &test2, WMSZ_BOTTOMRIGHT); + constrain_to_aspect_ratio(machine, window, &test2, WMSZ_BOTTOMRIGHT); // pick the larger if (rect_width(&test1) > rect_width(&test2)) @@ -1602,7 +1603,7 @@ static void get_min_bounds(win_window_info *window, RECT *bounds, int constrain) // (window thread) //============================================================ -static void get_max_bounds(win_window_info *window, RECT *bounds, int constrain) +static void get_max_bounds(running_machine *machine, win_window_info *window, RECT *bounds, int constrain) { RECT maximum; @@ -1628,7 +1629,7 @@ static void get_max_bounds(win_window_info *window, RECT *bounds, int constrain) // constrain to fit if (constrain) - constrain_to_aspect_ratio(window, &maximum, WMSZ_BOTTOMRIGHT); + constrain_to_aspect_ratio(machine, window, &maximum, WMSZ_BOTTOMRIGHT); else { maximum.right -= wnd_extra_width(window); @@ -1649,7 +1650,7 @@ static void get_max_bounds(win_window_info *window, RECT *bounds, int constrain) // (window thread) //============================================================ -static void update_minmax_state(win_window_info *window) +static void update_minmax_state(running_machine *machine, win_window_info *window) { assert(GetCurrentThreadId() == window_threadid); @@ -1658,8 +1659,8 @@ static void update_minmax_state(win_window_info *window) RECT bounds, minbounds, maxbounds; // compare the maximum bounds versus the current bounds - get_min_bounds(window, &minbounds, video_config.keepaspect); - get_max_bounds(window, &maxbounds, video_config.keepaspect); + get_min_bounds(machine, window, &minbounds, video_config.keepaspect); + get_max_bounds(machine, window, &maxbounds, video_config.keepaspect); GetWindowRect(window->hwnd, &bounds); // if either the width or height matches, we were maximized @@ -1682,13 +1683,13 @@ static void update_minmax_state(win_window_info *window) // (window thread) //============================================================ -static void minimize_window(win_window_info *window) +static void minimize_window(running_machine *machine, win_window_info *window) { RECT newsize; assert(GetCurrentThreadId() == window_threadid); - get_min_bounds(window, &newsize, video_config.keepaspect); + get_min_bounds(machine, window, &newsize, video_config.keepaspect); SetWindowPos(window->hwnd, NULL, newsize.left, newsize.top, rect_width(&newsize), rect_height(&newsize), SWP_NOZORDER); } @@ -1699,13 +1700,13 @@ static void minimize_window(win_window_info *window) // (window thread) //============================================================ -static void maximize_window(win_window_info *window) +static void maximize_window(running_machine *machine, win_window_info *window) { RECT newsize; assert(GetCurrentThreadId() == window_threadid); - get_max_bounds(window, &newsize, video_config.keepaspect); + get_max_bounds(machine, window, &newsize, video_config.keepaspect); SetWindowPos(window->hwnd, NULL, newsize.left, newsize.top, rect_width(&newsize), rect_height(&newsize), SWP_NOZORDER); } @@ -1716,7 +1717,7 @@ static void maximize_window(win_window_info *window) // (window thread) //============================================================ -static void adjust_window_position_after_major_change(win_window_info *window) +static void adjust_window_position_after_major_change(running_machine *machine, win_window_info *window) { RECT oldrect, newrect; @@ -1731,7 +1732,7 @@ static void adjust_window_position_after_major_change(win_window_info *window) // constrain the existing size to the aspect ratio newrect = oldrect; if (video_config.keepaspect) - constrain_to_aspect_ratio(window, &newrect, WMSZ_BOTTOMRIGHT); + constrain_to_aspect_ratio(machine, window, &newrect, WMSZ_BOTTOMRIGHT); } // in full screen, make sure it covers the primary display @@ -1764,7 +1765,7 @@ static void adjust_window_position_after_major_change(win_window_info *window) // (window thread) //============================================================ -static void set_fullscreen(win_window_info *window, int fullscreen) +static void set_fullscreen(running_machine *machine, win_window_info *window, int fullscreen) { assert(GetCurrentThreadId() == window_threadid); @@ -1803,7 +1804,7 @@ static void set_fullscreen(win_window_info *window, int fullscreen) else { SetWindowPos(window->hwnd, HWND_TOP, 0, 0, MIN_WINDOW_DIM, MIN_WINDOW_DIM, SWP_NOZORDER); - maximize_window(window); + maximize_window(machine, window); } } @@ -1823,7 +1824,7 @@ static void set_fullscreen(win_window_info *window, int fullscreen) } // adjust the window to compensate for the change - adjust_window_position_after_major_change(window); + adjust_window_position_after_major_change(machine, window); // show ourself if (!window->fullscreen || window->fullscreen_safe) @@ -1835,5 +1836,5 @@ static void set_fullscreen(win_window_info *window, int fullscreen) } // ensure we're still adjusted correctly - adjust_window_position_after_major_change(window); + adjust_window_position_after_major_change(machine, window); } |