diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index 16962b3e18f..d71683415d7 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -2726,12 +2726,13 @@ void debug_cpu_flush_traces(void) { int cpunum; - for (cpunum = 0; cpunum < ARRAY_LENGTH(Machine->cpu); cpunum++) - if (Machine->cpu[cpunum] != NULL) - { - if (global.cpuinfo[cpunum].trace.file) - fflush(global.cpuinfo[cpunum].trace.file); - } + if (Machine != NULL) + for (cpunum = 0; cpunum < ARRAY_LENGTH(Machine->cpu); cpunum++) + if (Machine->cpu[cpunum] != NULL) + { + if (global.cpuinfo[cpunum].trace.file) + fflush(global.cpuinfo[cpunum].trace.file); + } } diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index 895183f5387..3264b368442 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -3153,7 +3153,7 @@ static void menu_select_game_populate(running_machine *machine, ui_menu *menu, s { ui_menu_item_append(menu, "No "GAMESNOUN" found. Please check the rompath specified in the "CONFIGNAME".ini file.\n\n" "If this is your first time using "APPNAME", please see the config.txt file in " - "the docs directory for information on configuring "APPNAME, NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL); + "the docs directory for information on configuring "APPNAME".", NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL); return; } diff --git a/src/mame/drivers/adp.c b/src/mame/drivers/adp.c index 4fab703f446..720d709e773 100644 --- a/src/mame/drivers/adp.c +++ b/src/mame/drivers/adp.c @@ -148,7 +148,6 @@ Video board has additional chips: #include "video/hd63484.h" #include "machine/microtch.h" #include "machine/68681.h" -#include "deprecat.h" static UINT8 register_active; static struct @@ -182,7 +181,7 @@ static void microtouch_tx(UINT8 data) static UINT8 duart_input(const device_config *device) { - return input_port_read(Machine, "DSW1"); + return input_port_read(device->machine, "DSW1"); } static MACHINE_START( skattv ) diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c index c03e9f5093f..002e02a51d0 100644 --- a/src/osd/windows/debugwin.c +++ b/src/osd/windows/debugwin.c @@ -23,7 +23,6 @@ #include "debug/debugcon.h" #include "debug/debugcpu.h" #include "debugger.h" -#include "deprecat.h" // MAMEOS headers #include "debugwin.h" @@ -153,6 +152,8 @@ struct _debugwin_info int last_history; HWND otherwnd[MAX_OTHER_WND]; + + running_machine * machine; }; @@ -203,7 +204,7 @@ static DWORD last_debugger_update; // PROTOTYPES //============================================================ -static debugwin_info *debug_window_create(LPCSTR title, WNDPROC handler); +static debugwin_info *debug_window_create(running_machine *machine, LPCSTR title, WNDPROC handler); static void debug_window_free(debugwin_info *info); static LRESULT CALLBACK debug_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam); @@ -309,9 +310,9 @@ void osd_wait_for_debugger(running_machine *machine, int firststop) // debugwin_seq_pressed //============================================================ -static int debugwin_seq_pressed(void) +static int debugwin_seq_pressed(running_machine *machine) { - const input_seq *seq = input_type_seq(Machine, IPT_UI_DEBUG_BREAK, 0, SEQ_TYPE_STANDARD); + const input_seq *seq = input_type_seq(machine, IPT_UI_DEBUG_BREAK, 0, SEQ_TYPE_STANDARD); int result = FALSE; int invert = FALSE; int first = TRUE; @@ -488,7 +489,7 @@ void debugwin_update_during_game(running_machine *machine) if (!winwindow_has_focus() && !debug_cpu_is_stopped(machine) && mame_get_phase(machine) == MAME_PHASE_RUNNING) { // see if the interrupt key is pressed and break if it is - if (debugwin_seq_pressed()) + if (debugwin_seq_pressed(machine)) { HWND focuswnd = GetFocus(); debugwin_info *info; @@ -512,7 +513,7 @@ void debugwin_update_during_game(running_machine *machine) // debug_window_create //============================================================ -static debugwin_info *debug_window_create(LPCSTR title, WNDPROC handler) +static debugwin_info *debug_window_create(running_machine *machine, LPCSTR title, WNDPROC handler) { debugwin_info *info = NULL; RECT work_bounds; @@ -539,6 +540,8 @@ static debugwin_info *debug_window_create(LPCSTR title, WNDPROC handler) info->handle_command = global_handle_command; info->handle_key = global_handle_key; strcpy(info->edit_defstr, ""); + + info->machine = machine; // hook us in info->next = window_list; @@ -688,7 +691,7 @@ static LRESULT CALLBACK debug_window_proc(HWND wnd, UINT message, WPARAM wparam, case WM_CHAR: if (info->ignore_char_lparam == (lparam >> 16)) info->ignore_char_lparam = 0; - else if (waiting_for_debugger || !debugwin_seq_pressed()) + else if (waiting_for_debugger || !debugwin_seq_pressed(info->machine)) return DefWindowProc(wnd, message, wparam, lparam); break; @@ -1443,7 +1446,7 @@ static LRESULT CALLBACK debug_view_proc(HWND wnd, UINT message, WPARAM wparam, L { if (info->owner->ignore_char_lparam == (lparam >> 16)) info->owner->ignore_char_lparam = 0; - else if (waiting_for_debugger || !debugwin_seq_pressed()) + else if (waiting_for_debugger || !debugwin_seq_pressed(info->owner->machine)) { if (wparam >= 32 && wparam < 127 && debug_view_get_property_UINT32(info->view, DVP_SUPPORTS_CURSOR)) debug_view_set_property_UINT32(info->view, DVP_CHARACTER, wparam); @@ -1583,7 +1586,7 @@ static LRESULT CALLBACK debug_edit_proc(HWND wnd, UINT message, WPARAM wparam, L // ignore chars associated with keys we've handled if (info->ignore_char_lparam == (lparam >> 16)) info->ignore_char_lparam = 0; - else if (waiting_for_debugger || !debugwin_seq_pressed()) + else if (waiting_for_debugger || !debugwin_seq_pressed(info->machine)) { switch (wparam) { @@ -1720,7 +1723,7 @@ static void log_create_window(running_machine *machine) // create the window _snprintf(title, ARRAY_LENGTH(title), "Errorlog: %s [%s]", machine->gamedrv->description, machine->gamedrv->name); - info = debug_window_create(title, NULL); + info = debug_window_create(machine, title, NULL); if (info == NULL || !debug_view_create(info, 0, DVT_LOG)) return; info->view->is_textbuf = TRUE; @@ -1880,7 +1883,7 @@ static void memory_create_window(running_machine *machine) HMENU optionsmenu; // create the window - info = debug_window_create("Memory", NULL); + info = debug_window_create(machine, "Memory", NULL); if (info == NULL || !debug_view_create(info, 0, DVT_MEMORY)) return; @@ -2212,7 +2215,7 @@ static void disasm_create_window(running_machine *machine) UINT32 cpunum; // create the window - info = debug_window_create("Disassembly", NULL); + info = debug_window_create(machine, "Disassembly", NULL); if (info == NULL || !debug_view_create(info, 0, DVT_DISASSEMBLY)) return; @@ -2412,7 +2415,7 @@ static int disasm_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lpar debug_view_begin_update(info->view[0].view); debug_view_set_property_UINT32(info->view[0].view, DVP_DASM_CPUNUM, cpunum); debug_view_end_update(info->view[0].view); - disasm_update_caption(Machine, info->wnd); + disasm_update_caption(info->machine, info->wnd); } } @@ -2460,7 +2463,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(Machine, command, 1); + debug_console_execute_command(info->machine, command, 1); } return 1; @@ -2494,7 +2497,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(Machine, command, 1); + debug_console_execute_command(info->machine, command, 1); } return 1; } @@ -2568,7 +2571,7 @@ static void disasm_update_caption(running_machine *machine, HWND wnd) cpunum = debug_view_get_property_UINT32(info->view[0].view, DVP_DASM_CPUNUM); // then update the caption - sprintf(title, "Disassembly: CPU #%d \"%s\" (%s)", cpunum, Machine->config->cpu[cpunum].tag, cpu_get_name(machine->cpu[cpunum])); + sprintf(title, "Disassembly: CPU #%d \"%s\" (%s)", cpunum, info->machine->config->cpu[cpunum].tag, cpu_get_name(machine->cpu[cpunum])); win_set_window_text_utf8(wnd, title); } @@ -2587,7 +2590,7 @@ void console_create_window(running_machine *machine) UINT32 cpunum; // create the window - info = debug_window_create("Debug", NULL); + info = debug_window_create(machine, "Debug", NULL); if (info == NULL) return; main_console = info; @@ -2768,7 +2771,7 @@ static void console_process_string(debugwin_info *info, const char *string) // otherwise, just process the command else - debug_console_execute_command(Machine, string, 1); + debug_console_execute_command(info->machine, string, 1); // clear the edit text box SendMessage(info->editwnd, WM_SETTEXT, 0, (LPARAM)&buffer); @@ -2791,7 +2794,7 @@ static void console_set_cpunum(running_machine *machine, int cpunum) debug_view_set_property_UINT32(main_console->view[1].view, DVP_REGS_CPUNUM, cpunum); // then update the caption - snprintf(title, ARRAY_LENGTH(title), "Debug: %s - CPU #%d \"%s\" (%s)", machine->gamedrv->name, cpunum_get_active(), Machine->config->cpu[cpunum_get_active()].tag, cpu_get_name(machine->activecpu)); + snprintf(title, ARRAY_LENGTH(title), "Debug: %s - CPU #%d \"%s\" (%s)", machine->gamedrv->name, cpunum_get_active(), machine->config->cpu[cpunum_get_active()].tag, cpu_get_name(machine->activecpu)); win_get_window_text_utf8(main_console->wnd, curtitle, ARRAY_LENGTH(curtitle)); if (strcmp(title, curtitle)) win_set_window_text_utf8(main_console->wnd, title); @@ -2853,15 +2856,15 @@ static int global_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lpar switch (LOWORD(wparam)) { case ID_NEW_MEMORY_WND: - memory_create_window(Machine); + memory_create_window(info->machine); return 1; case ID_NEW_DISASM_WND: - disasm_create_window(Machine); + disasm_create_window(info->machine); return 1; case ID_NEW_LOG_WND: - log_create_window(Machine); + log_create_window(info->machine); return 1; case ID_RUN_AND_HIDE: @@ -2895,16 +2898,16 @@ static int global_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lpar return 1; case ID_HARD_RESET: - mame_schedule_hard_reset(Machine); + mame_schedule_hard_reset(info->machine); return 1; case ID_SOFT_RESET: - mame_schedule_soft_reset(Machine); + mame_schedule_soft_reset(info->machine); debug_cpu_go(~0); return 1; case ID_EXIT: - mame_schedule_exit(Machine); + mame_schedule_exit(info->machine); return 1; } @@ -2920,7 +2923,7 @@ static int global_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lpar static int global_handle_key(debugwin_info *info, WPARAM wparam, LPARAM lparam) { /* ignore any keys that are received while the debug key is down */ - if (!waiting_for_debugger && debugwin_seq_pressed()) + if (!waiting_for_debugger && debugwin_seq_pressed(info->machine)) return 1; switch (wparam) diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c index 9f85831e585..6e212df17db 100644 --- a/src/osd/windows/drawd3d.c +++ b/src/osd/windows/drawd3d.c @@ -29,7 +29,6 @@ #include "render.h" #include "rendutil.h" #include "options.h" -#include "deprecat.h" // MAMEOS headers #include "d3dintf.h" @@ -419,9 +418,9 @@ static int device_verify_caps(d3d_info *d3d); static int device_test_cooperative(d3d_info *d3d); // video modes -static int config_adapter_mode(running_machine *machine, win_window_info *window); +static int config_adapter_mode(win_window_info *window); static int get_adapter_for_monitor(d3d_info *d3d, win_monitor_info *monitor); -static void pick_best_mode(running_machine *machine, win_window_info *window); +static void pick_best_mode(win_window_info *window); static int update_window_size(win_window_info *window); // drawing @@ -514,7 +513,7 @@ static int drawd3d_window_init(win_window_info *window) } // configure the adapter for the mode we want - if (config_adapter_mode(Machine, window)) + if (config_adapter_mode(window)) goto error; // create the device immediately for the full screen case (defer for window mode) @@ -1123,7 +1122,7 @@ static int device_test_cooperative(d3d_info *d3d) // config_adapter_mode //============================================================ -static int config_adapter_mode(running_machine *machine, win_window_info *window) +static int config_adapter_mode(win_window_info *window) { d3d_adapter_identifier identifier; d3d_info *d3d = window->drawdata; @@ -1187,7 +1186,7 @@ static int config_adapter_mode(running_machine *machine, win_window_info *window // if we're allowed to switch resolutions, override with something better if (video_config.switchres) - pick_best_mode(machine, window); + pick_best_mode(window); } // see if we can handle the device type @@ -1239,9 +1238,9 @@ static int get_adapter_for_monitor(d3d_info *d3d, win_monitor_info *monitor) // pick_best_mode //============================================================ -static void pick_best_mode(running_machine *machine, win_window_info *window) +static void pick_best_mode(win_window_info *window) { - const device_config *primary_screen = video_screen_first(machine->config); + const device_config *primary_screen = video_screen_first(window->machine->config); double target_refresh = 60.0; INT32 target_width, target_height; d3d_info *d3d = window->drawdata; diff --git a/src/osd/windows/drawdd.c b/src/osd/windows/drawdd.c index 2983fd48dcc..e0a9557beaf 100644 --- a/src/osd/windows/drawdd.c +++ b/src/osd/windows/drawdd.c @@ -20,7 +20,6 @@ #include "render.h" #include "rendutil.h" #include "options.h" -#include "deprecat.h" // MAMEOS headers #include "winmain.h" @@ -166,9 +165,9 @@ static void compute_blit_surface_size(win_window_info *window); static void blit_to_primary(win_window_info *window, int srcwidth, int srcheight); // video modes -static int config_adapter_mode(running_machine *machine, win_window_info *window); +static int config_adapter_mode(win_window_info *window); static void get_adapter_for_monitor(dd_info *dd, win_monitor_info *monitor); -static void pick_best_mode(running_machine *machine, win_window_info *window); +static void pick_best_mode(win_window_info *window); // rendering static void drawdd_rgb888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); @@ -255,7 +254,7 @@ static int drawdd_window_init(win_window_info *window) window->drawdata = dd; // configure the adapter for the mode we want - if (config_adapter_mode(Machine, window)) + if (config_adapter_mode(window)) goto error; // create the ddraw object @@ -1101,7 +1100,7 @@ static void blit_to_primary(win_window_info *window, int srcwidth, int srcheight // config_adapter_mode //============================================================ -static int config_adapter_mode(running_machine *machine, win_window_info *window) +static int config_adapter_mode(win_window_info *window) { DDDEVICEIDENTIFIER2 identifier; dd_info *dd = window->drawdata; @@ -1148,7 +1147,7 @@ static int config_adapter_mode(running_machine *machine, win_window_info *window // if we're allowed to switch resolutions, override with something better if (video_config.switchres) - pick_best_mode(machine, window); + pick_best_mode(window); } // release the DirectDraw object @@ -1286,9 +1285,9 @@ static HRESULT WINAPI enum_modes_callback(LPDDSURFACEDESC2 desc, LPVOID context) // pick_best_mode //============================================================ -static void pick_best_mode(running_machine *machine, win_window_info *window) +static void pick_best_mode(win_window_info *window) { - const device_config *primary_screen = video_screen_first(machine->config); + const device_config *primary_screen = video_screen_first(window->machine->config); dd_info *dd = window->drawdata; mode_enum_info einfo; HRESULT result; diff --git a/src/osd/windows/drawgdi.c b/src/osd/windows/drawgdi.c index aa5393014fa..58f53944508 100644 --- a/src/osd/windows/drawgdi.c +++ b/src/osd/windows/drawgdi.c @@ -14,7 +14,6 @@ // 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 2405ffb3071..8a315be70b0 100644 --- a/src/osd/windows/drawnone.c +++ b/src/osd/windows/drawnone.c @@ -13,7 +13,6 @@ // MAME headers #include "mamecore.h" -#include "deprecat.h" // MAMEOS headers #include "window.h" diff --git a/src/osd/windows/window.c b/src/osd/windows/window.c index ebabe4af906..6deee7fd5f5 100644 --- a/src/osd/windows/window.c +++ b/src/osd/windows/window.c @@ -26,7 +26,6 @@ // MAME headers #include "osdepend.h" #include "driver.h" -#include "deprecat.h" #include "uiinput.h" // MAMEOS headers @@ -130,19 +129,19 @@ static void winwindow_video_window_destroy(win_window_info *window); static void draw_video_contents(win_window_info *window, HDC dc, int update); static unsigned __stdcall thread_entry(void *param); -static int complete_create(running_machine *machine, win_window_info *window); +static int complete_create(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 set_starting_view(int index, win_window_info *window, const char *view); -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 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 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); +static void adjust_window_position_after_major_change(win_window_info *window); +static void set_fullscreen(win_window_info *window, int fullscreen); // temporary hacks @@ -223,7 +222,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, (void*)machine, 0, (unsigned *)&window_threadid); + temp = _beginthreadex(NULL, 0, thread_entry, NULL, 0, (unsigned *)&window_threadid); window_thread = (HANDLE)temp; if (window_thread == NULL) fatalerror("Failed to create window thread"); @@ -590,6 +589,7 @@ void winwindow_video_window_create(running_machine *machine, int index, win_moni window->refresh = config->refresh; window->monitor = monitor; window->fullscreen = !video_config.windowed; + window->machine = machine; // see if we are safe for fullscreen window->fullscreen_safe = TRUE; @@ -611,7 +611,7 @@ void winwindow_video_window_create(running_machine *machine, int index, win_moni // set the specific view sprintf(option, "view%d", index); - set_starting_view(machine, index, window, options_get_string(mame_options(), option)); + set_starting_view(index, window, options_get_string(mame_options(), option)); // remember the current values in case they change window->targetview = render_target_get_view(window->target); @@ -638,7 +638,7 @@ void winwindow_video_window_create(running_machine *machine, int index, win_moni Sleep(1); } else - window->init_state = complete_create(machine, window) ? -1 : 1; + window->init_state = complete_create(window) ? -1 : 1; // handle error conditions if (window->init_state == -1) @@ -827,7 +827,7 @@ static void create_window_class(void) // (main thread) //============================================================ -static void set_starting_view(running_machine *machine, int index, win_window_info *window, const char *view) +static void set_starting_view(int index, win_window_info *window, const char *view) { const char *defview = options_get_string(mame_options(), WINOPTION_VIEW); int viewindex; @@ -839,7 +839,7 @@ static void set_starting_view(running_machine *machine, int index, win_window_in view = defview; // query the video system to help us pick a view - viewindex = video_get_view_for_target(machine, window->target, view, index, video_config.numscreens); + viewindex = video_get_view_for_target(window->machine, window->target, view, index, video_config.numscreens); // set the view render_target_set_view(window->target, viewindex); @@ -994,7 +994,6 @@ 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); @@ -1064,7 +1063,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(window) ? -1 : 1; dispatch = FALSE; break; } @@ -1088,7 +1087,7 @@ static unsigned __stdcall thread_entry(void *param) // (window thread) //============================================================ -static int complete_create(running_machine *machine, win_window_info *window) +static int complete_create(win_window_info *window) { RECT monitorbounds, client; int tempwidth, tempheight; @@ -1102,7 +1101,7 @@ static int complete_create(running_machine *machine, win_window_info *window) // create the window menu if needed #if HAS_WINDOW_MENU - if (win_create_menu(machine, &menu)) + if (win_create_menu(window->machine, &menu)) return 1; #endif @@ -1138,10 +1137,10 @@ static int complete_create(running_machine *machine, win_window_info *window) // maximum or minimize as appropriate if (window->startmaximized) - maximize_window(machine, window); + maximize_window(window); else - minimize_window(machine, window); - adjust_window_position_after_major_change(machine, window); + minimize_window(window); + adjust_window_position_after_major_change(window); // show the window if (!window->fullscreen || window->fullscreen_safe) @@ -1176,7 +1175,7 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar if (window != NULL) { assert(GetCurrentThreadId() == window_threadid); - update_minmax_state(Machine, window); + update_minmax_state(window); } // handle a few messages @@ -1212,17 +1211,17 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar // input events case WM_MOUSEMOVE: - ui_input_push_mouse_move_event(Machine, window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + ui_input_push_mouse_move_event(window->machine, window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); break; case WM_MOUSELEAVE: - ui_input_push_mouse_leave_event(Machine, window->target); + ui_input_push_mouse_leave_event(window->machine, window->target); break; case WM_LBUTTONDOWN: { DWORD ticks = GetTickCount(); - ui_input_push_mouse_down_event(Machine, window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + ui_input_push_mouse_down_event(window->machine, window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); // check for a double-click if (ticks - window->lastclicktime < GetDoubleClickTime() && @@ -1230,7 +1229,7 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar GET_Y_LPARAM(lparam) >= window->lastclicky - 4 && GET_Y_LPARAM(lparam) <= window->lastclicky + 4) { window->lastclicktime = 0; - ui_input_push_mouse_double_click_event(Machine, window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + ui_input_push_mouse_double_click_event(window->machine, window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); } else { @@ -1242,25 +1241,25 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar } case WM_LBUTTONUP: - ui_input_push_mouse_up_event(Machine, window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + ui_input_push_mouse_up_event(window->machine, window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); break; case WM_CHAR: - ui_input_push_char_event(Machine, window->target, (unicode_char) wparam); + ui_input_push_char_event(window->machine, window->target, (unicode_char) wparam); break; // pause the system when we start a menu or resize case WM_ENTERSIZEMOVE: window->resize_state = RESIZE_STATE_RESIZING; case WM_ENTERMENULOOP: - winwindow_ui_pause_from_window_thread(Machine, TRUE); + winwindow_ui_pause_from_window_thread(window->machine, TRUE); break; // unpause the system when we stop a menu or resize and force a redraw case WM_EXITSIZEMOVE: window->resize_state = RESIZE_STATE_PENDING; case WM_EXITMENULOOP: - winwindow_ui_pause_from_window_thread(Machine, FALSE); + winwindow_ui_pause_from_window_thread(window->machine, FALSE); InvalidateRect(wnd, NULL, FALSE); break; @@ -1278,7 +1277,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(Machine, window, rect, wparam); + constrain_to_aspect_ratio(window, rect, wparam); InvalidateRect(wnd, NULL, FALSE); break; } @@ -1296,11 +1295,11 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar // handle maximize if ((wparam & 0xfff0) == SC_MAXIMIZE) { - update_minmax_state(Machine, window); + update_minmax_state(window); if (window->ismaximized) - minimize_window(Machine, window); + minimize_window(window); else - maximize_window(Machine, window); + maximize_window(window); break; } return DefWindowProc(wnd, message, wparam, lparam); @@ -1316,7 +1315,7 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar if (multithreading_enabled) PostThreadMessage(main_threadid, WM_QUIT, 0, 0); else - mame_schedule_exit(Machine); + mame_schedule_exit(window->machine); break; // destroy: clean up all attached rendering bits and NULL out our hwnd @@ -1346,17 +1345,17 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar // fullscreen set case WM_USER_SET_FULLSCREEN: - set_fullscreen(Machine, window, wparam); + set_fullscreen(window, wparam); break; // minimum size set case WM_USER_SET_MINSIZE: - minimize_window(Machine, window); + minimize_window(window); break; // maximum size set case WM_USER_SET_MAXSIZE: - maximize_window(Machine, window); + maximize_window(window); break; // set focus: if we're not the primary window, switch back @@ -1423,7 +1422,7 @@ static void draw_video_contents(win_window_info *window, HDC dc, int update) // (window thread) //============================================================ -static void constrain_to_aspect_ratio(running_machine *machine, win_window_info *window, RECT *rect, int adjustment) +static void constrain_to_aspect_ratio(win_window_info *window, RECT *rect, int adjustment) { win_monitor_info *monitor = winwindow_video_window_monitor(window, rect); INT32 extrawidth = wnd_extra_width(window); @@ -1539,7 +1538,7 @@ static void constrain_to_aspect_ratio(running_machine *machine, win_window_info // (window thread) //============================================================ -static void get_min_bounds(running_machine *machine, win_window_info *window, RECT *bounds, int constrain) +static void get_min_bounds(win_window_info *window, RECT *bounds, int constrain) { INT32 minwidth, minheight; @@ -1567,13 +1566,13 @@ static void get_min_bounds(running_machine *machine, win_window_info *window, RE test1.top = test1.left = 0; test1.right = minwidth; test1.bottom = 10000; - constrain_to_aspect_ratio(machine, window, &test1, WMSZ_BOTTOMRIGHT); + constrain_to_aspect_ratio(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(machine, window, &test2, WMSZ_BOTTOMRIGHT); + constrain_to_aspect_ratio(window, &test2, WMSZ_BOTTOMRIGHT); // pick the larger if (rect_width(&test1) > rect_width(&test2)) @@ -1603,7 +1602,7 @@ static void get_min_bounds(running_machine *machine, win_window_info *window, RE // (window thread) //============================================================ -static void get_max_bounds(running_machine *machine, win_window_info *window, RECT *bounds, int constrain) +static void get_max_bounds(win_window_info *window, RECT *bounds, int constrain) { RECT maximum; @@ -1629,7 +1628,7 @@ static void get_max_bounds(running_machine *machine, win_window_info *window, RE // constrain to fit if (constrain) - constrain_to_aspect_ratio(machine, window, &maximum, WMSZ_BOTTOMRIGHT); + constrain_to_aspect_ratio(window, &maximum, WMSZ_BOTTOMRIGHT); else { maximum.right -= wnd_extra_width(window); @@ -1650,7 +1649,7 @@ static void get_max_bounds(running_machine *machine, win_window_info *window, RE // (window thread) //============================================================ -static void update_minmax_state(running_machine *machine, win_window_info *window) +static void update_minmax_state(win_window_info *window) { assert(GetCurrentThreadId() == window_threadid); @@ -1659,8 +1658,8 @@ static void update_minmax_state(running_machine *machine, win_window_info *windo RECT bounds, minbounds, maxbounds; // compare the maximum bounds versus the current bounds - get_min_bounds(machine, window, &minbounds, video_config.keepaspect); - get_max_bounds(machine, window, &maxbounds, video_config.keepaspect); + get_min_bounds(window, &minbounds, video_config.keepaspect); + get_max_bounds(window, &maxbounds, video_config.keepaspect); GetWindowRect(window->hwnd, &bounds); // if either the width or height matches, we were maximized @@ -1683,13 +1682,13 @@ static void update_minmax_state(running_machine *machine, win_window_info *windo // (window thread) //============================================================ -static void minimize_window(running_machine *machine, win_window_info *window) +static void minimize_window(win_window_info *window) { RECT newsize; assert(GetCurrentThreadId() == window_threadid); - get_min_bounds(machine, window, &newsize, video_config.keepaspect); + get_min_bounds(window, &newsize, video_config.keepaspect); SetWindowPos(window->hwnd, NULL, newsize.left, newsize.top, rect_width(&newsize), rect_height(&newsize), SWP_NOZORDER); } @@ -1700,13 +1699,13 @@ static void minimize_window(running_machine *machine, win_window_info *window) // (window thread) //============================================================ -static void maximize_window(running_machine *machine, win_window_info *window) +static void maximize_window(win_window_info *window) { RECT newsize; assert(GetCurrentThreadId() == window_threadid); - get_max_bounds(machine, window, &newsize, video_config.keepaspect); + get_max_bounds(window, &newsize, video_config.keepaspect); SetWindowPos(window->hwnd, NULL, newsize.left, newsize.top, rect_width(&newsize), rect_height(&newsize), SWP_NOZORDER); } @@ -1717,7 +1716,7 @@ static void maximize_window(running_machine *machine, win_window_info *window) // (window thread) //============================================================ -static void adjust_window_position_after_major_change(running_machine *machine, win_window_info *window) +static void adjust_window_position_after_major_change(win_window_info *window) { RECT oldrect, newrect; @@ -1732,7 +1731,7 @@ static void adjust_window_position_after_major_change(running_machine *machine, // constrain the existing size to the aspect ratio newrect = oldrect; if (video_config.keepaspect) - constrain_to_aspect_ratio(machine, window, &newrect, WMSZ_BOTTOMRIGHT); + constrain_to_aspect_ratio(window, &newrect, WMSZ_BOTTOMRIGHT); } // in full screen, make sure it covers the primary display @@ -1765,7 +1764,7 @@ static void adjust_window_position_after_major_change(running_machine *machine, // (window thread) //============================================================ -static void set_fullscreen(running_machine *machine, win_window_info *window, int fullscreen) +static void set_fullscreen(win_window_info *window, int fullscreen) { assert(GetCurrentThreadId() == window_threadid); @@ -1804,7 +1803,7 @@ static void set_fullscreen(running_machine *machine, win_window_info *window, in else { SetWindowPos(window->hwnd, HWND_TOP, 0, 0, MIN_WINDOW_DIM, MIN_WINDOW_DIM, SWP_NOZORDER); - maximize_window(machine, window); + maximize_window(window); } } @@ -1824,7 +1823,7 @@ static void set_fullscreen(running_machine *machine, win_window_info *window, in } // adjust the window to compensate for the change - adjust_window_position_after_major_change(machine, window); + adjust_window_position_after_major_change(window); // show ourself if (!window->fullscreen || window->fullscreen_safe) @@ -1836,5 +1835,5 @@ static void set_fullscreen(running_machine *machine, win_window_info *window, in } // ensure we're still adjusted correctly - adjust_window_position_after_major_change(machine, window); + adjust_window_position_after_major_change(window); } diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h index 48f322a15f6..42cf2f8a1f0 100644 --- a/src/osd/windows/window.h +++ b/src/osd/windows/window.h @@ -78,6 +78,8 @@ struct _win_window_info // drawing data void * drawdata; + + running_machine * machine; };