Previous 15994 Revisions Next

r876 Saturday 25th August, 2007 at 20:05:30 UTC by Nathan Woods
[Windows] Created a maximum speed feature, allowing manual control of the
emulation speed.
[docs]messnew.txt
[src/emu]video.c video.h
[src/mess/osd/windows]menu.c mess.rc messres.h

src/emu/video.c
r875r876
11351135
11361136
11371137/*-------------------------------------------------
1138    video_set_speed_factor - sets the speed
1139    factor as an integer * 100
1140-------------------------------------------------*/
1141
1142void video_set_speed_factor(int speed)
1143{
1144   global.speed = speed;
1145}
1146
1147
1148/*-------------------------------------------------
11381149    video_get_speed_text - print the text to
11391150    be displayed in the upper-right corner
11401151-------------------------------------------------*/
src/emu/video.h
r875r876
125125/* are we skipping the current frame? */
126126int video_skip_this_frame(void);
127127
128/* return the speed factor as an integer * 100 */
128/* get/set the speed factor as an integer * 100 */
129129int video_get_speed_factor(void);
130void video_set_speed_factor(int speed);
130131
131132/* return text to display about the current speed */
132133const char *video_get_speed_text(void);
src/mess/osd/windows/menu.c
r875r876
12191219   UINT16 in_cat_value = 0;
12201220   int frameskip;
12211221   int orientation;
1222   int speed;
12221223   LONG_PTR ptr = GetWindowLongPtr(wnd, GWLP_USERDATA);
12231224   win_window_info *window = (win_window_info *)ptr;
12241225   const char *view_name;
r875r876
12381239
12391240   orientation = render_target_get_orientation(window->target);
12401241
1242   speed = video_get_throttle() ? video_get_speed_factor() : 0;
1243
12411244   has_config      = input_has_input_class(INPUT_CLASS_CONFIG);
12421245   has_dipswitch   = input_has_input_class(INPUT_CLASS_DIPSWITCH);
12431246   has_keyboard   = input_has_input_class(INPUT_CLASS_KEYBOARD);
r875r876
12581261   set_command_state(menu_bar, ID_EDIT_PASTE,            inputx_can_post()                     ? MFS_ENABLED : MFS_GRAYED);
12591262
12601263   set_command_state(menu_bar, ID_OPTIONS_PAUSE,         winwindow_ui_is_paused()               ? MFS_CHECKED : MFS_ENABLED);
1261   set_command_state(menu_bar, ID_OPTIONS_THROTTLE,      video_get_throttle()                        ? MFS_CHECKED : MFS_ENABLED);
12621264   set_command_state(menu_bar, ID_OPTIONS_CONFIGURATION,   has_config                           ? MFS_ENABLED : MFS_GRAYED);
12631265   set_command_state(menu_bar, ID_OPTIONS_DIPSWITCHES,      has_dipswitch                        ? MFS_ENABLED : MFS_GRAYED);
12641266   set_command_state(menu_bar, ID_OPTIONS_MISCINPUT,      has_misc                           ? MFS_ENABLED : MFS_GRAYED);
r875r876
12841286   set_command_state(menu_bar, ID_VIDEO_ROTATE_180,      (orientation == ROT180)                  ? MFS_CHECKED : MFS_ENABLED);
12851287   set_command_state(menu_bar, ID_VIDEO_ROTATE_270,      (orientation == ROT270)                  ? MFS_CHECKED : MFS_ENABLED);
12861288
1289   set_command_state(menu_bar, ID_THROTTLE_50,            (speed == 50)                        ? MFS_CHECKED : MFS_ENABLED);
1290   set_command_state(menu_bar, ID_THROTTLE_100,         (speed == 100)                        ? MFS_CHECKED : MFS_ENABLED);
1291   set_command_state(menu_bar, ID_THROTTLE_200,         (speed == 200)                        ? MFS_CHECKED : MFS_ENABLED);
1292   set_command_state(menu_bar, ID_THROTTLE_500,         (speed == 500)                        ? MFS_CHECKED : MFS_ENABLED);
1293   set_command_state(menu_bar, ID_THROTTLE_1000,         (speed == 1000)                        ? MFS_CHECKED : MFS_ENABLED);
1294   set_command_state(menu_bar, ID_THROTTLE_UNTHROTTLED,   (speed == 0)                        ? MFS_CHECKED : MFS_ENABLED);
1295
12871296   set_command_state(menu_bar, ID_FRAMESKIP_AUTO,         (frameskip < 0)                        ? MFS_CHECKED : MFS_ENABLED);
12881297   for (i = 0; i < frameskip_level_count(); i++)
12891298      set_command_state(menu_bar, ID_FRAMESKIP_0 + i,      (frameskip == i)                     ? MFS_CHECKED : MFS_ENABLED);
r875r876
13931402
13941403
13951404//============================================================
1405//   set_seped
1406//============================================================
1407
1408static void set_speed(int speed)
1409{
1410   if (speed != 0)
1411      video_set_speed_factor(speed);
1412   video_set_throttle(speed != 0);
1413}
1414
1415
1416
1417//============================================================
13961418//   win_toggle_menubar
13971419//============================================================
13981420
r875r876
16921714         mame_schedule_soft_reset(Machine);
16931715         break;
16941716
1695      case ID_OPTIONS_THROTTLE:
1696         video_set_throttle(!video_get_throttle());
1697         break;
1698
16991717#if HAS_PROFILER
17001718      case ID_OPTIONS_PROFILER:
17011719         ui_set_show_profiler(!ui_get_show_profiler());
r875r876
17601778         help_about_thissystem(wnd);
17611779         break;
17621780
1781      case ID_THROTTLE_50:
1782         set_speed(50);
1783         break;
1784
1785      case ID_THROTTLE_100:
1786         set_speed(100);
1787         break;
1788
1789      case ID_THROTTLE_200:
1790         set_speed(200);
1791         break;
1792
1793      case ID_THROTTLE_500:
1794         set_speed(500);
1795         break;
1796
1797      case ID_THROTTLE_1000:
1798         set_speed(1000);
1799         break;
1800
1801      case ID_THROTTLE_UNTHROTTLED:
1802         set_speed(0);
1803         break;
1804
17631805      default:
17641806         // quickly come up with a port count, so we can upper bound commands
17651807         // near ID_INPUT_0
src/mess/osd/windows/messres.h
r875r876
1313#define ID_OPTIONS_CONFIGURATION        109
1414#define ID_OPTIONS_DIPSWITCHES          110
1515#define ID_OPTIONS_MISCINPUT            111
16#define ID_OPTIONS_USEMOUSE             112   
16#define ID_OPTIONS_USEMOUSE             112
1717#define ID_OPTIONS_TOGGLEMENUBAR        113
1818#define ID_OPTIONS_SOFTRESET            114
1919#define ID_OPTIONS_HARDRESET            115
20#define ID_OPTIONS_THROTTLE             116
21#define ID_OPTIONS_FRAMESKIP            117
22#define ID_OPTIONS_PAUSE                118
23#define ID_OPTIONS_JOYSTICKS            119
24#define ID_OPTIONS_ANALOGCONTROLS       120
25#define ID_OPTIONS_FULLSCREEN           121
26#define ID_OPTIONS_PROFILER             122
27#define ID_OPTIONS_TOGGLEFPS            123
28#define ID_OPTIONS_DEBUGGER             124   
29#define ID_KEYBOARD_EMULATED            125
30#define ID_KEYBOARD_NATURAL             126
31#define ID_KEYBOARD_CUSTOMIZE           127
32#define ID_VIDEO_ROTATE_0               128
33#define ID_VIDEO_ROTATE_90              129
34#define ID_VIDEO_ROTATE_180             130
35#define ID_VIDEO_ROTATE_270             131
36#define ID_FRAMESKIP_AUTO               132
37#define ID_DEVICES                      133
38#define ID_HELP_ABOUT                   134
39#define ID_HELP_ABOUTSYSTEM             135
20#define ID_OPTIONS_FRAMESKIP            116
21#define ID_OPTIONS_PAUSE                117
22#define ID_OPTIONS_JOYSTICKS            118
23#define ID_OPTIONS_ANALOGCONTROLS       119
24#define ID_OPTIONS_FULLSCREEN           120
25#define ID_OPTIONS_PROFILER             121
26#define ID_OPTIONS_TOGGLEFPS            122
27#define ID_OPTIONS_DEBUGGER             123
28#define ID_KEYBOARD_EMULATED            124
29#define ID_KEYBOARD_NATURAL             125
30#define ID_KEYBOARD_CUSTOMIZE           126
31#define ID_VIDEO_ROTATE_0               127
32#define ID_VIDEO_ROTATE_90              128
33#define ID_VIDEO_ROTATE_180             129
34#define ID_VIDEO_ROTATE_270             130
35#define ID_THROTTLE_50                  131
36#define ID_THROTTLE_100                 132
37#define ID_THROTTLE_200                 133
38#define ID_THROTTLE_500                 134
39#define ID_THROTTLE_1000                135
40#define ID_THROTTLE_UNTHROTTLED         136
41#define ID_FRAMESKIP_AUTO               137
42#define ID_DEVICES                      138
43#define ID_HELP_ABOUT                   139
44#define ID_HELP_ABOUTSYSTEM             140
4045#define IDD_TAPEDIALOG                  500
4146#define IDI_ICON_CART                   1000
4247#define IDI_ICON_HARD                   1001
r875r876
5863#ifdef APSTUDIO_INVOKED
5964#ifndef APSTUDIO_READONLY_SYMBOLS
6065#define _APS_NEXT_RESOURCE_VALUE        129
61#define _APS_NEXT_COMMAND_VALUE         40001
66#define _APS_NEXT_COMMAND_VALUE         40008
6267#define _APS_NEXT_CONTROL_VALUE         6006
6368#define _APS_NEXT_SYMED_VALUE           101
6469#endif
src/mess/osd/windows/mess.rc
r875r876
7272        BEGIN
7373            MENUITEM "Auto",                        ID_FRAMESKIP_AUTO
7474        END
75        MENUITEM "&Throttle",                   ID_OPTIONS_THROTTLE
76        MENUITEM "&Show FPS",                   ID_OPTIONS_TOGGLEFPS
75        POPUP "Maximum &Speed"
76        BEGIN
77            MENUITEM "50%",                         ID_THROTTLE_50
78            MENUITEM "100%",                        ID_THROTTLE_100
79            MENUITEM "200%",                        ID_THROTTLE_200
80            MENUITEM "500%",                        ID_THROTTLE_500
81            MENUITEM "1000%",                       ID_THROTTLE_1000
82            MENUITEM "Unlimited",                   ID_THROTTLE_UNTHROTTLED
83        END
84        MENUITEM "Show &FPS",                   ID_OPTIONS_TOGGLEFPS
7785        MENUITEM SEPARATOR
7886        MENUITEM "&Hide Menubar\tScrLk",        ID_OPTIONS_TOGGLEMENUBAR
7987        MENUITEM "&Full Screen\tAlt+Enter",     ID_OPTIONS_FULLSCREEN
docs/messnew.txt
r875r876
2323
2424User Interface Changes:
2525-----------------------
26(none)
26- [Windows] Created a maximum speed feature, allowing manual control of the
27  emulation speed.  [Nate Woods]
2728
2829
2930

Previous 15994 Revisions Next


© 1998-2018 The MESS Team