Previous 15994 Revisions Next

r3758 Sunday 7th December, 2008 at 23:13:48 UTC by Firewave
Use running_machine* from win_window_info
[src/mess/osd/windows]menu.c

src/mess/osd/windows/menu.c
r3757r3758
13081308//   prepare_menus
13091309//============================================================
13101310
1311static void prepare_menus(running_machine *machine, HWND wnd)
1311static void prepare_menus(HWND wnd)
13121312{
13131313   int i;
13141314   char buf[MAX_PATH];
r3757r3758
13431343
13441344   if (!joystick_menu_setup)
13451345   {
1346      setup_joystick_menu(machine, menu_bar);
1346      setup_joystick_menu(window->machine, menu_bar);
13471347      joystick_menu_setup = 1;
13481348   }
13491349
r3757r3758
13531353
13541354   speed = video_get_throttle() ? video_get_speed_factor() : 0;
13551355
1356   has_config      = input_has_input_class(machine, INPUT_CLASS_CONFIG);
1357   has_dipswitch   = input_has_input_class(machine, INPUT_CLASS_DIPSWITCH);
1358   has_keyboard   = input_has_input_class(machine, INPUT_CLASS_KEYBOARD);
1359   has_misc      = input_has_input_class(machine, INPUT_CLASS_MISC);
1356   has_config      = input_has_input_class(window->machine, INPUT_CLASS_CONFIG);
1357   has_dipswitch   = input_has_input_class(window->machine, INPUT_CLASS_DIPSWITCH);
1358   has_keyboard   = input_has_input_class(window->machine, INPUT_CLASS_KEYBOARD);
1359   has_misc      = input_has_input_class(window->machine, INPUT_CLASS_MISC);
13601360
13611361   has_analog = 0;
1362   for (port = machine->portconfig; port != NULL; port = port->next)
1362   for (port = window->machine->portconfig; port != NULL; port = port->next)
13631363   {
13641364      for (field = port->fieldlist; field != NULL; field = field->next)
13651365      {
r3757r3758
13731373
13741374   set_command_state(menu_bar, ID_FILE_SAVESTATE,         state_filename[0] != '\0'               ? MFS_ENABLED : MFS_GRAYED);
13751375
1376   set_command_state(menu_bar, ID_EDIT_PASTE,            inputx_can_post(machine)               ? MFS_ENABLED : MFS_GRAYED);
1376   set_command_state(menu_bar, ID_EDIT_PASTE,            inputx_can_post(window->machine)         ? MFS_ENABLED : MFS_GRAYED);
13771377
1378   set_command_state(menu_bar, ID_OPTIONS_PAUSE,         winwindow_ui_is_paused(machine)            ? MFS_CHECKED : MFS_ENABLED);
1378   set_command_state(menu_bar, ID_OPTIONS_PAUSE,         winwindow_ui_is_paused(window->machine)      ? MFS_CHECKED : MFS_ENABLED);
13791379   set_command_state(menu_bar, ID_OPTIONS_CONFIGURATION,   has_config                           ? MFS_ENABLED : MFS_GRAYED);
13801380   set_command_state(menu_bar, ID_OPTIONS_DIPSWITCHES,      has_dipswitch                        ? MFS_ENABLED : MFS_GRAYED);
13811381   set_command_state(menu_bar, ID_OPTIONS_MISCINPUT,      has_misc                           ? MFS_ENABLED : MFS_GRAYED);
r3757r3758
13891389#endif
13901390
13911391   set_command_state(menu_bar, ID_KEYBOARD_EMULATED,      (has_keyboard) ?
1392                                                (!ui_mess_get_use_natural_keyboard(machine)               ? MFS_CHECKED : MFS_ENABLED)
1392                                                (!ui_mess_get_use_natural_keyboard(window->machine)               ? MFS_CHECKED : MFS_ENABLED)
13931393                                                                                    : MFS_GRAYED);
1394   set_command_state(menu_bar, ID_KEYBOARD_NATURAL,      (has_keyboard && inputx_can_post(machine)) ?                                                (ui_mess_get_use_natural_keyboard(machine)               ? MFS_CHECKED : MFS_ENABLED)
1394   set_command_state(menu_bar, ID_KEYBOARD_NATURAL,      (has_keyboard && inputx_can_post(window->machine)) ?                                                (ui_mess_get_use_natural_keyboard(window->machine)               ? MFS_CHECKED : MFS_ENABLED)
13951395                                                                                    : MFS_GRAYED);
13961396   set_command_state(menu_bar, ID_KEYBOARD_CUSTOMIZE,      has_keyboard                        ? MFS_ENABLED : MFS_GRAYED);
13971397
r3757r3758
14141414   // if we are using categorized input, we need to properly checkmark the categories
14151415   if (use_input_categories)
14161416   {
1417      for (port = machine->portconfig; port != NULL; port = port->next)
1417      for (port = window->machine->portconfig; port != NULL; port = port->next)
14181418      {
14191419         for (field = port->fieldlist; field != NULL; field = field->next)
14201420         {
r3757r3758
14231423               input_field_get_user_settings(field, &settings);
14241424               for (setting = field->settinglist; setting != NULL; setting = setting->next)
14251425               {
1426                  command = ID_INPUT_0 + serial_number_from_input_item(machine, port, field, setting);
1426                  command = ID_INPUT_0 + serial_number_from_input_item(window->machine, port, field, setting);
14271427                  set_command_state(menu_bar, command, (setting->value == settings.value) ? MFS_CHECKED : MFS_ENABLED);
14281428               }
14291429            }
r3757r3758
14561456   remove_menu_items(device_menu);
14571457
14581458   // then set up the actual devices
1459   for (img = image_device_first(machine->config); img != NULL; img = image_device_next(img))
1459   for (img = image_device_first(window->machine->config); img != NULL; img = image_device_next(img))
14601460   {
1461      image_device_info info = image_device_getinfo(machine->config, img);
1461      image_device_info info = image_device_getinfo(window->machine->config, img);
14621462
14631463      new_item = ID_DEVICE_0 + (image_absolute_index(img) * DEVOPTION_MAX);
14641464      flags_for_exists = MF_STRING;
r3757r3758
17451745//   invoke_command
17461746//============================================================
17471747
1748static int invoke_command(running_machine *machine, HWND wnd, UINT command)
1748static int invoke_command(HWND wnd, UINT command)
17491749{
17501750   int handled = 1;
17511751   int dev_command;
r3757r3758
17601760
17611761   // pause while invoking certain commands
17621762   if (pause_for_command(command))
1763      winwindow_ui_pause_from_window_thread(machine, TRUE);
1763      winwindow_ui_pause_from_window_thread(window->machine, TRUE);
17641764
17651765   switch(command)
17661766   {
17671767      case ID_FILE_LOADSTATE:
1768         state_load(wnd, machine);
1768         state_load(wnd, window->machine);
17691769         break;
17701770
17711771      case ID_FILE_SAVESTATE:
1772         state_save(machine);
1772         state_save(window->machine);
17731773         break;
17741774
17751775      case ID_FILE_SAVESTATE_AS:
1776         state_save_as(wnd, machine);
1776         state_save_as(wnd, window->machine);
17771777         break;
17781778
17791779      case ID_FILE_SAVESCREENSHOT:
1780         video_save_active_screen_snapshots(machine);
1780         video_save_active_screen_snapshots(window->machine);
17811781         break;
17821782
17831783      case ID_FILE_EXIT:
1784         mame_schedule_exit(machine);
1784         mame_schedule_exit(window->machine);
17851785         break;
17861786
17871787      case ID_EDIT_PASTE:
r3757r3758
17891789         break;
17901790
17911791      case ID_KEYBOARD_NATURAL:
1792         ui_mess_set_use_natural_keyboard(machine, TRUE);
1792         ui_mess_set_use_natural_keyboard(window->machine, TRUE);
17931793         break;
17941794
17951795      case ID_KEYBOARD_EMULATED:
1796         ui_mess_set_use_natural_keyboard(machine, FALSE);
1796         ui_mess_set_use_natural_keyboard(window->machine, FALSE);
17971797         break;
17981798
17991799      case ID_KEYBOARD_CUSTOMIZE:
1800         customize_keyboard(machine, wnd);
1800         customize_keyboard(window->machine, wnd);
18011801         break;
18021802
18031803      case ID_VIDEO_ROTATE_0:
r3757r3758
18171817         break;
18181818
18191819      case ID_OPTIONS_PAUSE:
1820         pause(machine);
1820         pause(window->machine);
18211821         break;
18221822
18231823      case ID_OPTIONS_HARDRESET:
1824         mame_schedule_hard_reset(machine);
1824         mame_schedule_hard_reset(window->machine);
18251825         break;
18261826
18271827      case ID_OPTIONS_SOFTRESET:
1828         mame_schedule_soft_reset(machine);
1828         mame_schedule_soft_reset(window->machine);
18291829         break;
18301830
18311831#if HAS_PROFILER
r3757r3758
18351835#endif // HAS_PROFILER
18361836
18371837      case ID_OPTIONS_DEBUGGER:
1838         debug_cpu_halt_on_next_instruction(debug_cpu_get_visible_cpu(machine), "User-initiated break\n");
1838         debug_cpu_halt_on_next_instruction(debug_cpu_get_visible_cpu(window->machine), "User-initiated break\n");
18391839         break;
18401840
18411841      case ID_OPTIONS_CONFIGURATION:
1842         customize_configuration(machine, wnd);
1842         customize_configuration(window->machine, wnd);
18431843         break;
18441844
18451845      case ID_OPTIONS_DIPSWITCHES:
1846         customize_dipswitches(machine, wnd);
1846         customize_dipswitches(window->machine, wnd);
18471847         break;
18481848
18491849      case ID_OPTIONS_MISCINPUT:
1850         customize_miscinput(machine, wnd);
1850         customize_miscinput(window->machine, wnd);
18511851         break;
18521852
18531853      case ID_OPTIONS_ANALOGCONTROLS:
1854         customize_analogcontrols(machine, wnd);
1854         customize_analogcontrols(window->machine, wnd);
18551855         break;
18561856
18571857#if HAS_TOGGLEFULLSCREEN
r3757r3758
18871887         break;
18881888
18891889      case ID_HELP_ABOUTSYSTEM:
1890         help_about_thissystem(machine, wnd);
1890         help_about_thissystem(window->machine, wnd);
18911891         break;
18921892
18931893      case ID_THROTTLE_50:
r3757r3758
19231923         else if ((command >= ID_DEVICE_0) && (command < ID_DEVICE_0 + (MAX_DEV_INSTANCES*IO_COUNT*DEVOPTION_MAX)))
19241924         {
19251925            // change device
1926            img = decode_deviceoption(machine, command, &dev_command);
1926            img = decode_deviceoption(window->machine, command, &dev_command);
19271927            device_command(wnd, img, dev_command);
19281928         }
19291929         else if ((command >= ID_JOYSTICK_0) && (command < ID_JOYSTICK_0 + MAX_JOYSTICKS))
19301930         {
19311931            // customize joystick
1932            customize_joystick(machine, wnd, command - ID_JOYSTICK_0);
1932            customize_joystick(window->machine, wnd, command - ID_JOYSTICK_0);
19331933         }
19341934         else if ((command >= ID_VIDEO_VIEW_0) && (command < ID_VIDEO_VIEW_0 + 1000))
19351935         {
19361936            // render views
19371937            render_target_set_view(window->target, command - ID_VIDEO_VIEW_0);
19381938         }
1939         else if (input_item_from_serial_number(machine, command - ID_INPUT_0, NULL, &field, &setting))
1939         else if (input_item_from_serial_number(window->machine, command - ID_INPUT_0, NULL, &field, &setting))
19401940         {
19411941            if ((field != NULL) && (field->type == IPT_CATEGORY) && (setting != NULL))
19421942            {
r3757r3758
19601960                     section = setting->name;
19611961                  }
19621962               }
1963               customize_categorizedinput(machine, wnd, section, category);
1963               customize_categorizedinput(window->machine, wnd, section, category);
19641964            }
19651965            else
19661966            {
r3757r3758
19781978
19791979   // resume emulation
19801980   if (pause_for_command(command))
1981      winwindow_ui_pause_from_window_thread(machine, FALSE);
1981      winwindow_ui_pause_from_window_thread(window->machine, FALSE);
19821982
19831983   return handled;
19841984}
r3757r3758
21442144   switch(message)
21452145   {
21462146      case WM_INITMENU:
2147         prepare_menus(Machine, wnd);
2147         prepare_menus(wnd);
21482148         break;
21492149
21502150      case WM_PASTE:
r3757r3758
21522152         break;
21532153
21542154      case WM_COMMAND:
2155         if (invoke_command(Machine, wnd, wparam))
2155         if (invoke_command(wnd, wparam))
21562156            break;
21572157         /* fall through */
21582158

Previous 15994 Revisions Next


© 1998-2018 The MESS Team