Previous 15994 Revisions Next

r2355 Thursday 10th April, 2008 at 17:33:38 UTC by Firewave
1. Machine -> machine cleanups for osd/windows A8laready submitted to MAMEdev)

2. Fixed compilation with USE_TAPEDLG
[src/mess/osd/windows]dialog.c dialog.h menu.c
[src/osd/windows]debugwin.c drawd3d.c drawdd.c input.c input.h output.c video.c window.c window.h winmain.c

src/osd/windows/output.c
r2354r2355
7474static LRESULT CALLBACK output_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
7575static LRESULT register_client(HWND hwnd, LPARAM id);
7676static LRESULT unregister_client(HWND hwnd, LPARAM id);
77static LRESULT send_id_string(HWND hwnd, LPARAM id);
77static LRESULT send_id_string(running_machine *machine, HWND hwnd, LPARAM id);
7878static void notifier_callback(const char *outname, INT32 value, void *param);
7979
8080
r2354r2355
197197
198198   // get a string for an ID
199199   else if (message == om_mame_get_id_string)
200      return send_id_string((HWND)wparam, lparam);
200      return send_id_string(Machine, (HWND)wparam, lparam);
201201
202202   else
203203      return DefWindowProc(wnd, message, wparam, lparam);
r2354r2355
262262//  send_id_string
263263//============================================================
264264
265static LRESULT send_id_string(HWND hwnd, LPARAM id)
265static LRESULT send_id_string(running_machine *machine, HWND hwnd, LPARAM id)
266266{
267267   copydata_id_string *temp;
268268   COPYDATASTRUCT copydata;
r2354r2355
271271
272272   // id 0 is the name of the game
273273   if (id == 0)
274      name = Machine->gamedrv->name;
274      name = machine->gamedrv->name;
275275   else
276276      name = output_id_to_name(id);
277277
r2354r2355
298298
299299
300300//============================================================
301//  send_id_string
301//  notifier_callback
302302//============================================================
303303
304304static void notifier_callback(const char *outname, INT32 value, void *param)
src/osd/windows/input.c
r2354r2355
3333#include "osdepend.h"
3434#include "driver.h"
3535#include "ui.h"
36#include "deprecat.h"
3637
3738// MAMEOS headers
3839#include "winmain.h"
r2354r2355
422423//  INLINE FUNCTIONS
423424//============================================================
424425
425INLINE void poll_if_necessary(void)
426INLINE void poll_if_necessary(running_machine *machine)
426427{
427428   // make sure we poll at least once every 1/4 second
428429   if (GetTickCount() > last_poll + 1000 / 4)
429      wininput_poll();
430      wininput_poll(machine);
430431}
431432
432433
r2354r2355
493494
494495   // poll once to get the initial states
495496   input_enabled = TRUE;
496   wininput_poll();
497   wininput_poll(machine);
497498}
498499
499500
r2354r2355
528529//  wininput_poll
529530//============================================================
530531
531void wininput_poll(void)
532void wininput_poll(running_machine *machine)
532533{
533534   int hasfocus = winwindow_has_focus() && input_enabled;
534535
r2354r2355
540541
541542      // periodically process events, in case they're not coming through
542543      // this also will make sure the mouse state is up-to-date
543      winwindow_process_events_periodic();
544      winwindow_process_events_periodic(machine);
544545
545546      // track if mouse/lightgun is enabled, for mouse hiding purposes
546547      mouse_enabled = input_device_class_enabled(DEVICE_CLASS_MOUSE);
r2354r2355
874875   BYTE *itemdata = item_internal;
875876
876877   // return the current state
877   poll_if_necessary();
878   poll_if_necessary(Machine);
878879   return *itemdata >> 7;
879880}
880881
r2354r2355
888889   LONG *axisdata = item_internal;
889890
890891   // return the current state
891   poll_if_necessary();
892   poll_if_necessary(Machine);
892893   return *axisdata;
893894}
894895
r2354r2355
15571558   DWORD pov;
15581559
15591560   // get the current state
1560   poll_if_necessary();
1561   poll_if_necessary(Machine);
15611562   pov = devinfo->joystick.state.rgdwPOV[povnum];
15621563
15631564   // if invalid, return 0
r2354r2355
20582059
20592060static void rawinput_mouse_poll(device_info *devinfo)
20602061{
2061   poll_if_necessary();
2062   poll_if_necessary(Machine);
20622063
20632064   // copy the accumulated raw state to the actual state
20642065   osd_lock_acquire(input_lock);
src/osd/windows/winmain.c
r2354r2355
311311      timeEndPeriod(caps.wPeriodMin);
312312
313313   // one last pass at events
314   winwindow_process_events(0);
314   winwindow_process_events(machine, 0);
315315}
316316
317317
src/osd/windows/debugwin.c
r2354r2355
220220//static void generic_create_window(int type);
221221static void generic_recompute_children(debugwin_info *info);
222222
223static void memory_create_window(void);
223static void memory_create_window(running_machine *machine);
224224static void memory_recompute_children(debugwin_info *info);
225225static void memory_process_string(debugwin_info *info, const char *string);
226226static void memory_update_menu(debugwin_info *info);
r2354r2355
235235static int disasm_handle_key(debugwin_info *info, WPARAM wparam, LPARAM lparam);
236236static void disasm_update_caption(HWND wnd);
237237
238static void console_create_window(void);
238static void console_create_window(running_machine *machine);
239239static void console_recompute_children(debugwin_info *info);
240240static void console_process_string(debugwin_info *info, const char *string);
241static void console_set_cpunum(int cpunum);
241static void console_set_cpunum(running_machine *machine, int cpunum);
242242
243243static HMENU create_standard_menubar(void);
244244static int global_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lparam);
r2354r2355
259259
260260   // create a console window
261261   if (main_console == NULL)
262      console_create_window();
262      console_create_window(Machine);
263263
264264   // update the views in the console to reflect the current CPU
265265   if (main_console != NULL)
266      console_set_cpunum(cpu_getactivecpu());
266      console_set_cpunum(Machine, cpu_getactivecpu());
267267
268268   // make sure the debug windows are visible
269269   waiting_for_debugger = TRUE;
270270   smart_show_all(TRUE);
271271
272272   // run input polling to ensure that our status is in sync
273   wininput_poll();
273   wininput_poll(Machine);
274274
275275   // get and process messages
276276   GetMessage(&message, NULL, 0, 0);
r2354r2355
289289
290290      // process everything else
291291      default:
292         winwindow_dispatch_message(&message);
292         winwindow_dispatch_message(Machine, &message);
293293         break;
294294   }
295295
r2354r2355
16731673//  log_create_window
16741674//============================================================
16751675
1676static void log_create_window(void)
1676static void log_create_window(running_machine *machine)
16771677{
16781678   debugwin_info *info;
16791679   char title[256];
r2354r2355
16811681   RECT bounds;
16821682
16831683   // create the window
1684   _snprintf(title, ARRAY_LENGTH(title), "Errorlog: %s [%s]", Machine->gamedrv->description, Machine->gamedrv->name);
1684   _snprintf(title, ARRAY_LENGTH(title), "Errorlog: %s [%s]", machine->gamedrv->description, machine->gamedrv->name);
16851685   info = debug_window_create(title, NULL);
16861686   if (info == NULL || !debug_view_create(info, 0, DVT_LOG))
16871687      return;
r2354r2355
17181718//  memory_determine_combo_items
17191719//============================================================
17201720
1721static void memory_determine_combo_items(void)
1721static void memory_determine_combo_items(running_machine *machine)
17221722{
17231723   memorycombo_item **tail = &memorycombo;
17241724   UINT32 cpunum, spacenum;
r2354r2355
17551755   {
17561756      TCHAR* t_memory_region_name;
17571757      UINT8 *base = memory_region(rgnnum);
1758      UINT32 type = memory_region_type(Machine, rgnnum);
1758      UINT32 type = memory_region_type(machine, rgnnum);
17591759      if (base != NULL && type > REGION_INVALID && (type - REGION_INVALID) < ARRAY_LENGTH(memory_region_names))
17601760      {
17611761         memorycombo_item *ci = malloc_or_die(sizeof(*ci));
1762         UINT32 flags = memory_region_flags(Machine, rgnnum);
1762         UINT32 flags = memory_region_flags(machine, rgnnum);
17631763         UINT8 width, little_endian;
17641764         memset(ci, 0, sizeof(*ci));
17651765         ci->base = base;
r2354r2355
18411841//  memory_create_window
18421842//============================================================
18431843
1844static void memory_create_window(void)
1844static void memory_create_window(running_machine *machine)
18451845{
18461846   int curcpu = cpu_getactivecpu(), cursel = 0;
18471847   memorycombo_item *ci, *selci = NULL;
r2354r2355
19001900
19011901   // populate the combobox
19021902   if (memorycombo == NULL)
1903      memory_determine_combo_items();
1903      memory_determine_combo_items(machine);
19041904   for (ci = memorycombo; ci; ci = ci->next)
19051905   {
19061906      int item = SendMessage(info->otherwnd[0], CB_ADDSTRING, 0, (LPARAM)ci->name);
r2354r2355
25472547//  console_create_window
25482548//============================================================
25492549
2550void console_create_window(void)
2550void console_create_window(running_machine *machine)
25512551{
25522552   debugwin_info *info;
25532553   int bestwidth, bestheight;
r2354r2355
25602560   if (info == NULL)
25612561      return;
25622562   main_console = info;
2563   console_set_cpunum(0);
2563   console_set_cpunum(machine, 0);
25642564
25652565   // create the views
25662566   if (!debug_view_create(info, 0, DVT_DISASSEMBLY))
r2354r2355
26102610   info->minwidth = 0;
26112611   info->maxwidth = 0;
26122612   for (cpunum = MAX_CPU - 1; (INT32)cpunum >= 0; cpunum--)
2613      if (Machine->config->cpu[cpunum].type != CPU_DUMMY)
2613      if (machine->config->cpu[cpunum].type != CPU_DUMMY)
26142614      {
26152615         UINT32 regchars, dischars, conchars;
26162616         UINT32 minwidth, maxwidth;
r2354r2355
27492749//  console_set_cpunum
27502750//============================================================
27512751
2752static void console_set_cpunum(int cpunum)
2752static void console_set_cpunum(running_machine *machine, int cpunum)
27532753{
27542754   char title[256], curtitle[256];
27552755
r2354r2355
27602760      debug_view_set_property_UINT32(main_console->view[1].view, DVP_REGS_CPUNUM, cpunum);
27612761
27622762   // then update the caption
2763   snprintf(title, ARRAY_LENGTH(title), "Debug: %s - CPU %d (%s)", Machine->gamedrv->name, cpu_getactivecpu(), activecpu_name());
2763   snprintf(title, ARRAY_LENGTH(title), "Debug: %s - CPU %d (%s)", machine->gamedrv->name, cpu_getactivecpu(), activecpu_name());
27642764   win_get_window_text_utf8(main_console->wnd, curtitle, ARRAY_LENGTH(curtitle));
27652765   if (strcmp(title, curtitle))
27662766      win_set_window_text_utf8(main_console->wnd, title);
r2354r2355
28222822      switch (LOWORD(wparam))
28232823      {
28242824         case ID_NEW_MEMORY_WND:
2825            memory_create_window();
2825            memory_create_window(Machine);
28262826            return 1;
28272827
28282828         case ID_NEW_DISASM_WND:
r2354r2355
28302830            return 1;
28312831
28322832         case ID_NEW_LOG_WND:
2833            log_create_window();
2833            log_create_window(Machine);
28342834            return 1;
28352835
28362836         case ID_RUN_AND_HIDE:
src/osd/windows/input.h
r2354r2355
1616//============================================================
1717
1818void wininput_init(running_machine *machine);
19void wininput_poll(void);
19void wininput_poll(running_machine *machine);
2020
2121void wininput_handle_mouse_button(int button, int down, int x, int y);
2222BOOL wininput_handle_raw(HANDLE device);
src/osd/windows/drawdd.c
r2354r2355
166166static void blit_to_primary(win_window_info *window, int srcwidth, int srcheight);
167167
168168// video modes
169static int config_adapter_mode(win_window_info *window);
169static int config_adapter_mode(running_machine *machine, win_window_info *window);
170170static void get_adapter_for_monitor(dd_info *dd, win_monitor_info *monitor);
171static void pick_best_mode(win_window_info *window);
171static void pick_best_mode(running_machine *machine, win_window_info *window);
172172
173173// rendering
174174static void drawdd_rgb888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
r2354r2355
255255   window->drawdata = dd;
256256
257257   // configure the adapter for the mode we want
258   if (config_adapter_mode(window))
258   if (config_adapter_mode(Machine, window))
259259      goto error;
260260
261261   // create the ddraw object
r2354r2355
11011101//  config_adapter_mode
11021102//============================================================
11031103
1104static int config_adapter_mode(win_window_info *window)
1104static int config_adapter_mode(running_machine *machine, win_window_info *window)
11051105{
11061106   DDDEVICEIDENTIFIER2 identifier;
11071107   dd_info *dd = window->drawdata;
r2354r2355
11481148
11491149      // if we're allowed to switch resolutions, override with something better
11501150      if (video_config.switchres)
1151         pick_best_mode(window);
1151         pick_best_mode(machine, window);
11521152   }
11531153
11541154   // release the DirectDraw object
r2354r2355
12261226
12271227
12281228//============================================================
1229//  pick_best_mode
1229//  enum_modes_callback
12301230//============================================================
12311231
12321232static HRESULT WINAPI enum_modes_callback(LPDDSURFACEDESC2 desc, LPVOID context)
r2354r2355
12861286//  pick_best_mode
12871287//============================================================
12881288
1289static void pick_best_mode(win_window_info *window)
1289static void pick_best_mode(running_machine *machine, win_window_info *window)
12901290{
1291   const device_config *primary_screen = video_screen_first(Machine->config);
1291   const device_config *primary_screen = video_screen_first(machine->config);
12921292   dd_info *dd = window->drawdata;
12931293   mode_enum_info einfo;
12941294   HRESULT result;
src/osd/windows/video.c
r2354r2355
102102
103103   // create the windows
104104   for (index = 0; index < video_config.numscreens; index++)
105      winwindow_video_window_create(index, pick_monitor(index), &video_config.window[index]);
105      winwindow_video_window_create(machine, index, pick_monitor(index), &video_config.window[index]);
106106   if (video_config.mode != VIDEO_MODE_NONE)
107107      SetForegroundWindow(win_window_list->hwnd);
108108
r2354r2355
209209         winwindow_video_window_update(window);
210210
211211   // poll the joystick values here
212   winwindow_process_events(TRUE);
213   wininput_poll();
212   winwindow_process_events(machine, TRUE);
213   wininput_poll(machine);
214214   check_osd_inputs();
215215}
216216
src/osd/windows/window.c
r2354r2355
129129static void draw_video_contents(win_window_info *window, HDC dc, int update);
130130
131131static unsigned __stdcall thread_entry(void *param);
132static int complete_create(win_window_info *window);
132static int complete_create(running_machine *machine, win_window_info *window);
133133static void create_window_class(void);
134static void set_starting_view(int index, win_window_info *window, const char *view);
134static void set_starting_view(running_machine *machine, int index, win_window_info *window, const char *view);
135135
136136static void constrain_to_aspect_ratio(win_window_info *window, RECT *rect, int adjustment);
137137static void get_min_bounds(win_window_info *window, RECT *bounds, int constrain);
r2354r2355
309309//  (main thread)
310310//============================================================
311311
312void winwindow_process_events_periodic(void)
312void winwindow_process_events_periodic(running_machine *machine)
313313{
314314   DWORD currticks = GetTickCount();
315315
r2354r2355
318318   // update once every 1/8th of a second
319319   if (currticks - last_event_check < 1000 / 8)
320320      return;
321   winwindow_process_events(TRUE);
321   winwindow_process_events(machine, TRUE);
322322}
323323
324324
r2354r2355
345345//  (main thread)
346346//============================================================
347347
348void winwindow_process_events(int ingame)
348void winwindow_process_events(running_machine *machine, int ingame)
349349{
350350   MSG message;
351351
r2354r2355
432432
433433         // dispatch if necessary
434434         if (dispatch)
435            winwindow_dispatch_message(&message);
435            winwindow_dispatch_message(machine, &message);
436436      }
437437   } while (ui_temp_pause > 0);
438438
439439   // update the cursor state after processing events
440   winwindow_update_cursor_state();
440   winwindow_update_cursor_state(machine);
441441}
442442
443443
r2354r2355
447447//  (main thread)
448448//============================================================
449449
450void winwindow_dispatch_message(MSG *message)
450void winwindow_dispatch_message(running_machine *machine, MSG *message)
451451{
452452   assert(GetCurrentThreadId() == main_threadid);
453453
r2354r2355
456456   {
457457      // special case for quit
458458      case WM_QUIT:
459         mame_schedule_exit(Machine);
459         mame_schedule_exit(machine);
460460         break;
461461
462462      // temporary pause from the window thread
463463      case WM_USER_UI_TEMP_PAUSE:
464         winwindow_ui_pause_from_main_thread(message->wParam);
464         winwindow_ui_pause_from_main_thread(machine, message->wParam);
465465         break;
466466
467467      // execute arbitrary function
r2354r2355
535535//  (main thread)
536536//============================================================
537537
538void winwindow_update_cursor_state(void)
538void winwindow_update_cursor_state(running_machine *machine)
539539{
540540   static POINT saved_cursor_pos = { -1, -1 };
541541
r2354r2355
547547   //   2. we also hide the cursor in full screen mode and when the window doesn't have a menu
548548   //   3. we also hide the cursor in windowed mode if we're not paused and
549549   //      the input system requests it
550   if (winwindow_has_focus() && ((!video_config.windowed && !win_has_menu(win_window_list)) || (!mame_is_paused(Machine) && wininput_should_hide_mouse())))
550   if (winwindow_has_focus() && ((!video_config.windowed && !win_has_menu(win_window_list)) || (!mame_is_paused(machine) && wininput_should_hide_mouse())))
551551   {
552552      win_window_info *window = win_window_list;
553553      RECT bounds;
r2354r2355
588588//  (main thread)
589589//============================================================
590590
591void winwindow_video_window_create(int index, win_monitor_info *monitor, const win_window_config *config)
591void winwindow_video_window_create(running_machine *machine, int index, win_monitor_info *monitor, const win_window_config *config)
592592{
593593   win_window_info *window, *win;
594594   char option[20];
r2354r2355
624624
625625   // set the specific view
626626   sprintf(option, "view%d", index);
627   set_starting_view(index, window, options_get_string(mame_options(), option));
627   set_starting_view(machine, index, window, options_get_string(mame_options(), option));
628628
629629   // remember the current values in case they change
630630   window->targetview = render_target_get_view(window->target);
r2354r2355
633633
634634   // make the window title
635635   if (video_config.numscreens == 1)
636      sprintf(window->title, APPNAME ": %s [%s]", Machine->gamedrv->description, Machine->gamedrv->name);
636      sprintf(window->title, APPNAME ": %s [%s]", machine->gamedrv->description, machine->gamedrv->name);
637637   else
638      sprintf(window->title, APPNAME ": %s [%s] - Screen %d", Machine->gamedrv->description, Machine->gamedrv->name, index);
638      sprintf(window->title, APPNAME ": %s [%s] - Screen %d", machine->gamedrv->description, machine->gamedrv->name, index);
639639
640640   // set the initial maximized state
641641   window->startmaximized = options_get_bool(mame_options(), WINOPTION_MAXIMIZE);
r2354r2355
651651         Sleep(1);
652652   }
653653   else
654      window->init_state = complete_create(window) ? -1 : 1;
654      window->init_state = complete_create(machine, window) ? -1 : 1;
655655
656656   // handle error conditions
657657   if (window->init_state == -1)
r2354r2355
840840//  (main thread)
841841//============================================================
842842
843static void set_starting_view(int index, win_window_info *window, const char *view)
843static void set_starting_view(running_machine *machine, int index, win_window_info *window, const char *view)
844844{
845845   const char *defview = options_get_string(mame_options(), WINOPTION_VIEW);
846846   int viewindex = -1;
r2354r2355
873873   // if we don't have a match, default to the nth view
874874   if (viewindex == -1)
875875   {
876      int scrcount = video_screen_count(Machine->config);
876      int scrcount = video_screen_count(machine->config);
877877
878878      // if we have enough screens to be one per monitor, assign in order
879879      if (video_config.numscreens >= scrcount)
r2354r2355
921921//  (main thread)
922922//============================================================
923923
924void winwindow_ui_pause_from_main_thread(int pause)
924void winwindow_ui_pause_from_main_thread(running_machine *machine, int pause)
925925{
926926   int old_temp_pause = ui_temp_pause;
927927
r2354r2355
934934      if (ui_temp_pause++ == 0)
935935      {
936936         // only call mame_pause if we weren't already paused due to some external reason
937         ui_temp_was_paused = mame_is_paused(Machine);
937         ui_temp_was_paused = mame_is_paused(machine);
938938         if (!ui_temp_was_paused)
939            mame_pause(Machine, TRUE);
939            mame_pause(machine, TRUE);
940940
941941         SetEvent(ui_pause_event);
942942      }
r2354r2355
950950      {
951951         // but only do it if we were the ones who initiated it
952952         if (!ui_temp_was_paused)
953            mame_pause(Machine, FALSE);
953            mame_pause(machine, FALSE);
954954
955955         ResetEvent(ui_pause_event);
956956      }
r2354r2355
967967//  (window thread)
968968//============================================================
969969
970void winwindow_ui_pause_from_window_thread(int pause)
970void winwindow_ui_pause_from_window_thread(running_machine *machine, int pause)
971971{
972972   assert(GetCurrentThreadId() == window_threadid);
973973
r2354r2355
984984
985985   // otherwise, we just do it directly
986986   else
987      winwindow_ui_pause_from_main_thread(pause);
987      winwindow_ui_pause_from_main_thread(machine, pause);
988988}
989989
990990
r2354r2355
10161016//  winwindow_ui_is_paused
10171017//============================================================
10181018
1019int winwindow_ui_is_paused(void)
1019int winwindow_ui_is_paused(running_machine *machine)
10201020{
1021   return mame_is_paused(Machine) && ui_temp_was_paused;
1021   return mame_is_paused(machine) && ui_temp_was_paused;
10221022}
10231023
10241024
r2354r2355
11451145            case WM_USER_FINISH_CREATE_WINDOW:
11461146            {
11471147               win_window_info *window = (win_window_info *)message.lParam;
1148               window->init_state = complete_create(window) ? -1 : 1;
1148               window->init_state = complete_create(Machine, window) ? -1 : 1;
11491149               dispatch = FALSE;
11501150               break;
11511151            }
r2354r2355
11691169//  (window thread)
11701170//============================================================
11711171
1172static int complete_create(win_window_info *window)
1172static int complete_create(running_machine *machine, win_window_info *window)
11731173{
11741174   RECT monitorbounds, client;
11751175   int tempwidth, tempheight;
r2354r2355
11831183
11841184   // create the window menu if needed
11851185#if HAS_WINDOW_MENU
1186   if (win_create_menu(Machine, &menu))
1186   if (win_create_menu(machine, &menu))
11871187      return 1;
11881188#endif
11891189
r2354r2355
12951295      case WM_ENTERSIZEMOVE:
12961296         window->resize_state = RESIZE_STATE_RESIZING;
12971297      case WM_ENTERMENULOOP:
1298         winwindow_ui_pause_from_window_thread(TRUE);
1298         winwindow_ui_pause_from_window_thread(Machine, TRUE);
12991299         break;
13001300
13011301      // unpause the system when we stop a menu or resize and force a redraw
13021302      case WM_EXITSIZEMOVE:
13031303         window->resize_state = RESIZE_STATE_PENDING;
13041304      case WM_EXITMENULOOP:
1305         winwindow_ui_pause_from_window_thread(FALSE);
1305         winwindow_ui_pause_from_window_thread(Machine, FALSE);
13061306         InvalidateRect(wnd, NULL, FALSE);
13071307         break;
13081308
src/osd/windows/window.h
r2354r2355
106106void winwindow_init(running_machine *machine);
107107
108108// creation/deletion of windows
109void winwindow_video_window_create(int index, win_monitor_info *monitor, const win_window_config *config);
109void winwindow_video_window_create(running_machine *machine, int index, win_monitor_info *monitor, const win_window_config *config);
110110
111111BOOL winwindow_has_focus(void);
112void winwindow_update_cursor_state(void);
112void winwindow_update_cursor_state(running_machine *machine);
113113void winwindow_video_window_update(win_window_info *window);
114114win_monitor_info *winwindow_video_window_monitor(win_window_info *window, const RECT *proposed);
115115
116116LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
117117void winwindow_toggle_full_screen(void);
118118
119void winwindow_process_events_periodic(void);
120void winwindow_process_events(int ingame);
119void winwindow_process_events_periodic(running_machine *machine);
120void winwindow_process_events(running_machine *machine, int ingame);
121121
122void winwindow_ui_pause_from_window_thread(int pause);
123void winwindow_ui_pause_from_main_thread(int pause);
124int winwindow_ui_is_paused(void);
122void winwindow_ui_pause_from_window_thread(running_machine *machine, int pause);
123void winwindow_ui_pause_from_main_thread(running_machine *machine, int pause);
124int winwindow_ui_is_paused(running_machine *machine);
125125
126126void winwindow_ui_exec_on_main_thread(void (*func)(void *), void *param);
127void winwindow_dispatch_message(MSG *message);
127void winwindow_dispatch_message(running_machine *machine, MSG *message);
128128
129129#if HAS_WINDOW_MENU
130130int win_create_menu(running_machine *machine, HMENU *menus);
src/osd/windows/drawd3d.c
r2354r2355
419419static int device_test_cooperative(d3d_info *d3d);
420420
421421// video modes
422static int config_adapter_mode(win_window_info *window);
422static int config_adapter_mode(running_machine *machine, win_window_info *window);
423423static int get_adapter_for_monitor(d3d_info *d3d, win_monitor_info *monitor);
424static void pick_best_mode(win_window_info *window);
424static void pick_best_mode(running_machine *machine, win_window_info *window);
425425static int update_window_size(win_window_info *window);
426426
427427// drawing
r2354r2355
512512   }
513513
514514   // configure the adapter for the mode we want
515   if (config_adapter_mode(window))
515   if (config_adapter_mode(Machine, window))
516516      goto error;
517517
518518   // create the device immediately for the full screen case (defer for window mode)
r2354r2355
11201120//  config_adapter_mode
11211121//============================================================
11221122
1123static int config_adapter_mode(win_window_info *window)
1123static int config_adapter_mode(running_machine *machine, win_window_info *window)
11241124{
11251125   d3d_adapter_identifier identifier;
11261126   d3d_info *d3d = window->drawdata;
r2354r2355
11841184
11851185      // if we're allowed to switch resolutions, override with something better
11861186      if (video_config.switchres)
1187         pick_best_mode(window);
1187         pick_best_mode(machine, window);
11881188   }
11891189
11901190   // see if we can handle the device type
r2354r2355
12361236//  pick_best_mode
12371237//============================================================
12381238
1239static void pick_best_mode(win_window_info *window)
1239static void pick_best_mode(running_machine *machine, win_window_info *window)
12401240{
1241   const device_config *primary_screen = video_screen_first(Machine->config);
1241   const device_config *primary_screen = video_screen_first(machine->config);
12421242   double target_refresh = 60.0;
12431243   INT32 target_width, target_height;
12441244   d3d_info *d3d = window->drawdata;
src/mess/osd/windows/dialog.c
r2354r2355
11121112   // the Win32 OSD code thinks that we are paused, we need to temporarily
11131113   // unpause ourselves or else we will block
11141114   pause_count = 0;
1115   while(mame_is_paused(Machine) && !winwindow_ui_is_paused())
1115   while(mame_is_paused(Machine) && !winwindow_ui_is_paused(Machine))
11161116   {
1117      winwindow_ui_pause_from_main_thread(FALSE);
1117      winwindow_ui_pause_from_main_thread(Machine, FALSE);
11181118      pause_count++;
11191119   }
11201120
r2354r2355
11421142
11431143   // repause the OSD code
11441144   while(pause_count--)
1145      winwindow_ui_pause_from_main_thread(TRUE);
1145      winwindow_ui_pause_from_main_thread(Machine, TRUE);
11461146}
11471147
11481148
r2354r2355
16551655//   before_display_dialog
16561656//============================================================
16571657
1658static void before_display_dialog(void)
1658static void before_display_dialog(running_machine *machine)
16591659{
16601660#ifdef UNDER_CE
16611661   // on WinCE, suspend GAPI
16621662   gx_suspend();
16631663#endif
16641664
1665   winwindow_ui_pause_from_window_thread(TRUE);
1665   winwindow_ui_pause_from_window_thread(machine, TRUE);
16661666}
16671667
16681668
r2354r2355
16711671//   after_display_dialog
16721672//============================================================
16731673
1674static void after_display_dialog(void)
1674static void after_display_dialog(running_machine *machine)
16751675{
16761676#ifdef UNDER_CE
16771677   // on WinCE, resume GAPI
16781678   gx_resume();
16791679#endif
16801680
1681   winwindow_ui_pause_from_window_thread(FALSE);
1681   winwindow_ui_pause_from_window_thread(machine, FALSE);
16821682}
16831683
16841684
r2354r2355
16871687//   win_dialog_runmodal
16881688//============================================================
16891689
1690void win_dialog_runmodal(HWND wnd, dialog_box *dialog)
1690void win_dialog_runmodal(running_machine *machine, HWND wnd, dialog_box *dialog)
16911691{
16921692   assert(dialog);
16931693
r2354r2355
16951695   dialog_prime(dialog);
16961696
16971697   // show the dialog
1698   before_display_dialog();
1698   before_display_dialog(machine);
16991699#ifndef UNICODE
17001700   if (GetVersion() & 0x80000000)
17011701      DialogBoxIndirectParamA(NULL, dialog->handle, wnd, dialog_proc, (LPARAM) dialog);
17021702   else
17031703#endif // UNICODE
17041704      DialogBoxIndirectParamW(NULL, dialog->handle, wnd, dialog_proc, (LPARAM) dialog);
1705   after_display_dialog();
1705   after_display_dialog(machine);
17061706}
17071707
17081708
r2354r2355
17651765//   win_file_dialog
17661766//============================================================
17671767
1768BOOL win_file_dialog(HWND parent, win_file_dialog_type dlgtype, dialog_box *custom_dialog, const char *filter,
1768BOOL win_file_dialog(running_machine *machine,
1769   HWND parent, win_file_dialog_type dlgtype, dialog_box *custom_dialog, const char *filter,
17691770   const char *initial_dir, char *filename, size_t filename_len)
17701771{
17711772   win_open_file_name ofn;
r2354r2355
17971798
17981799   snprintf(ofn.filename, ARRAY_LENGTH(ofn.filename), "%s", filename);
17991800
1800   before_display_dialog();
1801   before_display_dialog(machine);
18011802   result = win_get_file_name_dialog(&ofn);
1802   after_display_dialog();
1803   after_display_dialog(machine);
18031804
18041805   snprintf(filename, filename_len, "%s", ofn.filename);
18051806   return result;
src/mess/osd/windows/menu.c
r2354r2355
221221      goto done;
222222
223223   /* ...and finally display the dialog */
224   win_dialog_runmodal(wnd, dlg);
224   win_dialog_runmodal(machine, wnd, dlg);
225225
226226done:
227227   if (dlg)
r2354r2355
332332   if (win_dialog_add_standard_buttons(dlg))
333333      goto done;
334334
335   win_dialog_runmodal(wnd, dlg);
335   win_dialog_runmodal(machine, wnd, dlg);
336336
337337done:
338338   if (dlg)
r2354r2355
445445   if (win_dialog_add_standard_buttons(dlg))
446446      goto done;
447447
448   win_dialog_runmodal(wnd, dlg);
448   win_dialog_runmodal(machine, wnd, dlg);
449449
450450done:
451451   if (dlg)
r2354r2355
870870   }
871871
872872   // display the dialog
873   result = win_file_dialog(wnd, is_save ? WIN_FILE_DIALOG_SAVE : WIN_FILE_DIALOG_OPEN,
873   result = win_file_dialog(img->machine, wnd, is_save ? WIN_FILE_DIALOG_SAVE : WIN_FILE_DIALOG_OPEN,
874874      dialog, filter, initial_dir, filename, sizeof(filename) / sizeof(filename[0]));
875875   if (result)
876876   {
r2354r2355
942942
943943static void pause(running_machine *machine)
944944{
945   mame_pause(machine, !winwindow_ui_is_paused());
945   mame_pause(machine, !winwindow_ui_is_paused(machine));
946946}
947947
948948
r2354r2355
12711271
12721272   set_command_state(menu_bar, ID_EDIT_PASTE,            inputx_can_post()                     ? MFS_ENABLED : MFS_GRAYED);
12731273
1274   set_command_state(menu_bar, ID_OPTIONS_PAUSE,         winwindow_ui_is_paused()               ? MFS_CHECKED : MFS_ENABLED);
1274   set_command_state(menu_bar, ID_OPTIONS_PAUSE,         winwindow_ui_is_paused(machine)            ? MFS_CHECKED : MFS_ENABLED);
12751275   set_command_state(menu_bar, ID_OPTIONS_CONFIGURATION,   has_config                           ? MFS_ENABLED : MFS_GRAYED);
12761276   set_command_state(menu_bar, ID_OPTIONS_DIPSWITCHES,      has_dipswitch                        ? MFS_ENABLED : MFS_GRAYED);
12771277   set_command_state(menu_bar, ID_OPTIONS_MISCINPUT,      has_misc                           ? MFS_ENABLED : MFS_GRAYED);
r2354r2355
15141514
15151515#if USE_TAPEDLG
15161516               case DEVOPTION_CASSETTE_DIALOG:
1517                  tapedialog_show(wnd, id);
1517                  tapedialog_show(wnd, image_index_in_device(img));
15181518                  break;
15191519#else
15201520               case DEVOPTION_CASSETTE_REWIND:
r2354r2355
16621662
16631663   // pause while invoking certain commands
16641664   if (pause_for_command(command))
1665      winwindow_ui_pause_from_window_thread(TRUE);
1665      winwindow_ui_pause_from_window_thread(machine, TRUE);
16661666
16671667   switch(command)
16681668   {
r2354r2355
18901890
18911891   // resume emulation
18921892   if (pause_for_command(command))
1893      winwindow_ui_pause_from_window_thread(FALSE);
1893      winwindow_ui_pause_from_window_thread(machine, FALSE);
18941894
18951895   return handled;
18961896}
src/mess/osd/windows/dialog.h
r2354r2355
4141#endif
4242
4343/* dialog operations */
44void win_dialog_runmodal(HWND wnd, dialog_box *dialog);
44void win_dialog_runmodal(running_machine *machine, HWND wnd, dialog_box *dialog);
4545int win_dialog_add_combobox(dialog_box *dialog, const char *item_label, int default_value,
4646   dialog_itemstoreval storeval, void *storeval_param);
4747int win_dialog_add_active_combobox(dialog_box *dialog, const char *item_label, int default_value,
r2354r2355
6767
6868
6969// wrapper for the standard file dialog
70BOOL win_file_dialog(HWND parent, win_file_dialog_type dlgtype, dialog_box *custom_dialog, const char *filter,
70BOOL win_file_dialog(running_machine *machine,
71   HWND parent, win_file_dialog_type dlgtype, dialog_box *custom_dialog, const char *filter,
7172   const char *initial_dir, char *filename, size_t filename_len);
7273
7374#endif /* DIALOG_H */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team