summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2014-04-12 20:52:03 +0000
committer Nathan Woods <npwoods@mess.org>2014-04-12 20:52:03 +0000
commit24026e123e547b8e7c59d67f95c32f4679aebb96 (patch)
tree5826d69d5bba9901c372a4e6eb977cdc3e2f6691 /src/osd
parentd46cefb7910ff6f1a363395a7e954e0a6bca8227 (diff)
Merge of new menubar code
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/osdepend.c9
-rw-r--r--src/osd/osdepend.h2
-rw-r--r--src/osd/sdl/input.c37
-rw-r--r--src/osd/windows/drawd3d.c8
-rw-r--r--src/osd/windows/input.c40
-rw-r--r--src/osd/windows/video.c28
-rw-r--r--src/osd/windows/window.c92
-rw-r--r--src/osd/windows/window.h7
-rw-r--r--src/osd/windows/winmain.c40
-rw-r--r--src/osd/windows/winmain.h7
10 files changed, 200 insertions, 70 deletions
diff --git a/src/osd/osdepend.c b/src/osd/osdepend.c
index 2e6c6e44e2c..458d4912a05 100644
--- a/src/osd/osdepend.c
+++ b/src/osd/osdepend.c
@@ -169,6 +169,15 @@ void osd_interface::customize_input_type_list(simple_list<input_type_entry> &typ
}
+//============================================================
+// customize_menubar
+//============================================================
+
+void osd_interface::customize_menubar(ui_menubar &menu_bar)
+{
+}
+
+
//-------------------------------------------------
// font_open - attempt to "open" a handle to the
// font with the given name
diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h
index d349b9d0e8b..756f8a0972b 100644
--- a/src/osd/osdepend.h
+++ b/src/osd/osdepend.h
@@ -26,6 +26,7 @@
// forward references
class input_type_entry;
class device_t;
+class ui_menubar;
typedef void *osd_font;
@@ -56,6 +57,7 @@ public:
// input overridables
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
+ virtual void customize_menubar(ui_menubar &menubar);
// font overridables
virtual osd_font font_open(const char *name, int &height);
diff --git a/src/osd/sdl/input.c b/src/osd/sdl/input.c
index b93cceb3cfd..618615448cc 100644
--- a/src/osd/sdl/input.c
+++ b/src/osd/sdl/input.c
@@ -2083,25 +2083,6 @@ void sdl_osd_interface::customize_input_type_list(simple_list<input_type_entry>
{
switch (entry->type())
{
- // configurable UI mode switch
- case IPT_UI_TOGGLE_UI:
- uimode = downcast<sdl_options &>(machine().options()).ui_mode_key();
- if(!strcmp(uimode,"auto"))
- {
- #if defined(__APPLE__) && defined(__MACH__)
- mameid_code = lookup_mame_code("ITEM_ID_INSERT");
- #else
- mameid_code = lookup_mame_code("ITEM_ID_SCRLOCK");
- #endif
- }
- else
- {
- snprintf(fullmode, 63, "ITEM_ID_%s", uimode);
- mameid_code = lookup_mame_code(fullmode);
- }
- ui_code = input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, input_item_id(mameid_code));
- entry->defseq(SEQ_TYPE_STANDARD).set(ui_code);
- break;
// alt-enter for fullscreen
case IPT_OSD_1:
entry->configure_osd("TOGGLE_FULLSCREEN", "Toggle Fullscreen");
@@ -2182,7 +2163,23 @@ void sdl_osd_interface::customize_input_type_list(simple_list<input_type_entry>
// disable the config menu if the ALT key is down
// (allows ALT-TAB to switch between apps)
case IPT_UI_CONFIGURE:
- entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::not_code, KEYCODE_LALT, input_seq::not_code, KEYCODE_RALT);
+ // configurable UI mode switch
+ uimode = downcast<sdl_options &>(machine().options()).ui_mode_key();
+ if(!strcmp(uimode,"auto"))
+ {
+ #if defined(__APPLE__) && defined(__MACH__)
+ mameid_code = lookup_mame_code("ITEM_ID_INSERT");
+ #else
+ mameid_code = lookup_mame_code("ITEM_ID_SCRLOCK");
+ #endif
+ }
+ else
+ {
+ snprintf(fullmode, 63, "ITEM_ID_%s", uimode);
+ mameid_code = lookup_mame_code(fullmode);
+ }
+ ui_code = input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, input_item_id(mameid_code));
+ entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::not_code, KEYCODE_LALT, input_seq::not_code, KEYCODE_RALT, input_seq::or_code, ui_code);
break;
// leave everything else alone
diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c
index 9af4111c320..4a561f96938 100644
--- a/src/osd/windows/drawd3d.c
+++ b/src/osd/windows/drawd3d.c
@@ -185,6 +185,7 @@ static render_primitive_list *drawd3d_window_get_primitives(win_window_info *win
static void drawd3d_window_save(win_window_info *window);
static void drawd3d_window_record(win_window_info *window);
static void drawd3d_window_toggle_fsfx(win_window_info *window);
+static bool drawd3d_window_fsfx_enabled(win_window_info *window);
static int drawd3d_window_draw(win_window_info *window, HDC dc, int update);
@@ -224,6 +225,12 @@ static void drawd3d_window_toggle_fsfx(win_window_info *window)
d3d->set_restarting(true);
}
+static bool drawd3d_window_fsfx_enabled(win_window_info *window)
+{
+ d3d::renderer *d3d = (d3d::renderer *)window->drawdata;
+ return d3d->get_shaders() != NULL && d3d->get_shaders()->enabled();
+}
+
static void drawd3d_window_record(win_window_info *window)
{
d3d::renderer *d3d = (d3d::renderer *)window->drawdata;
@@ -301,6 +308,7 @@ int drawd3d_init(running_machine &machine, win_draw_callbacks *callbacks)
callbacks->window_save = drawd3d_window_save;
callbacks->window_record = drawd3d_window_record;
callbacks->window_toggle_fsfx = drawd3d_window_toggle_fsfx;
+ callbacks->window_fsfx_enabled = drawd3d_window_fsfx_enabled;
callbacks->window_destroy = drawd3d_window_destroy;
return 0;
}
diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c
index 29db33e63d4..2c12bf93363 100644
--- a/src/osd/windows/input.c
+++ b/src/osd/windows/input.c
@@ -173,6 +173,7 @@ static bool input_enabled;
static osd_lock * input_lock;
static bool input_paused;
static DWORD last_poll;
+static bool menubar_visible;
// DirectInput variables
static LPDIRECTINPUT dinput;
@@ -532,6 +533,9 @@ void wininput_poll(running_machine &machine)
{
bool hasfocus = winwindow_has_focus() && input_enabled;
+ // check menubar
+ menubar_visible = (machine.phase() > MACHINE_PHASE_INIT) && machine.ui().menubar_visible();
+
// ignore if not enabled
if (input_enabled)
{
@@ -572,7 +576,7 @@ void wininput_poll(running_machine &machine)
bool wininput_should_hide_mouse(void)
{
// if we are paused or disabled, no
- if (input_paused || !input_enabled)
+ if (input_paused || !input_enabled || menubar_visible)
return false;
// if neither mice nor lightguns enabled in the core, then no
@@ -734,7 +738,7 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent
// disable the config menu if the ALT key is down
// (allows ALT-TAB to switch between windows apps)
case IPT_UI_CONFIGURE:
- entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::not_code, KEYCODE_LALT, input_seq::not_code, KEYCODE_RALT);
+ entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::not_code, KEYCODE_LALT, input_seq::not_code, KEYCODE_RALT, input_seq::or_code, KEYCODE_SCRLOCK);
break;
// alt-enter for fullscreen
@@ -748,6 +752,7 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent
entry->configure_osd("RENDER_SNAP", "Take Rendered Snapshot");
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F12, KEYCODE_LALT, input_seq::not_code, KEYCODE_LSHIFT);
break;
+
// add a NOT-lalt to our default F12
case IPT_UI_SNAPSHOT: // emu/input.c: input_seq(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT)
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT, input_seq::not_code, KEYCODE_LALT);
@@ -758,6 +763,7 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent
entry->configure_osd("RENDER_AVI", "Record Rendered Video");
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F12, KEYCODE_LSHIFT, KEYCODE_LALT);
break;
+
// add a NOT-lalt to our default shift-F12
case IPT_UI_RECORD_MOVIE: // emu/input.c: input_seq(KEYCODE_F12, KEYCODE_LSHIFT)
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F12, KEYCODE_LSHIFT, input_seq::not_code, KEYCODE_LALT);
@@ -781,6 +787,36 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent
//============================================================
+// customize_menubar
+//============================================================
+
+void windows_osd_interface::customize_menubar(ui_menubar &menu_bar)
+{
+ // find existing menus
+ ui_menubar::menu_item &root_menu = menu_bar.root_menu();
+ ui_menubar::menu_item &options_menu = root_menu.find_child("Options");
+
+ // Fullscreen
+ ui_menubar::menu_item &fullscreen_menu = options_menu.append("Fullscreen", &windows_osd_interface::toggle_full_screen, *this, IPT_OSD_1);
+ fullscreen_menu.set_checked(video_config.windowed ? false : true);
+
+ // HLSL
+ ui_menubar::menu_item &hlsl_menu = options_menu.append("HLSL");
+
+ // enable HLSL
+ ui_menubar::menu_item &enable_hlsl_menu = hlsl_menu.append("Enable HLSL", &windows_osd_interface::toggle_fsfx, *this, IPT_OSD_4);
+ enable_hlsl_menu.set_enabled(winwindow_can_toggle_fsfx());
+ enable_hlsl_menu.set_checked(winwindow_is_fsfx_enabled());
+
+ // take rendered snapshot
+ hlsl_menu.append("Take Rendered Snapshot", &windows_osd_interface::take_snap, *this, IPT_OSD_2).set_enabled(winwindow_can_take_snap());
+
+ // record rendered video
+ hlsl_menu.append("Record Rendered Video", &windows_osd_interface::take_video, *this, IPT_OSD_3).set_enabled(winwindow_can_take_video());
+}
+
+
+//============================================================
// device_list_poll_devices
//============================================================
diff --git a/src/osd/windows/video.c b/src/osd/windows/video.c
index 2491d74c32e..812ed0ef908 100644
--- a/src/osd/windows/video.c
+++ b/src/osd/windows/video.c
@@ -61,8 +61,6 @@ static void init_monitors(void);
static BOOL CALLBACK monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect, LPARAM data);
static win_monitor_info *pick_monitor(windows_options &options, int index);
-static void check_osd_inputs(running_machine &machine);
-
static void extract_video_config(running_machine &machine);
static float get_aspect(const char *defdata, const char *data, int report_error);
static void get_resolution(const char *defdata, const char *data, win_window_config *config, int report_error);
@@ -190,7 +188,6 @@ void windows_osd_interface::update(bool skip_redraw)
// poll the joystick values here
winwindow_process_events(machine(), TRUE, FALSE);
wininput_poll(machine());
- check_osd_inputs(machine());
}
@@ -325,31 +322,6 @@ finishit:
//============================================================
-// check_osd_inputs
-//============================================================
-
-static void check_osd_inputs(running_machine &machine)
-{
- // check for toggling fullscreen mode
- if (ui_input_pressed(machine, IPT_OSD_1))
- winwindow_toggle_full_screen();
-
- // check for taking fullscreen snap
- if (ui_input_pressed(machine, IPT_OSD_2))
- winwindow_take_snap();
-
- // check for taking fullscreen video
- if (ui_input_pressed(machine, IPT_OSD_3))
- winwindow_take_video();
-
- // check for taking fullscreen video
- if (ui_input_pressed(machine, IPT_OSD_4))
- winwindow_toggle_fsfx();
-}
-
-
-
-//============================================================
// extract_video_config
//============================================================
diff --git a/src/osd/windows/window.c b/src/osd/windows/window.c
index 74a0bbc2222..7283ba7c79d 100644
--- a/src/osd/windows/window.c
+++ b/src/osd/windows/window.c
@@ -464,6 +464,18 @@ void winwindow_dispatch_message(running_machine &machine, MSG *message)
//============================================================
+// winwindow_can_take_snap
+// (main thread)
+//============================================================
+
+bool winwindow_can_take_snap(void)
+{
+ return draw.window_record != NULL;
+}
+
+
+
+//============================================================
// winwindow_take_snap
// (main thread)
//============================================================
@@ -487,6 +499,30 @@ void winwindow_take_snap(void)
//============================================================
+// winwindow_can_toggle_fsfx
+// (main thread)
+//============================================================
+
+bool winwindow_can_toggle_fsfx(void)
+{
+ return draw.window_toggle_fsfx != NULL;
+}
+
+
+
+//============================================================
+// winwindow_is_fsfx_enabled
+// (main thread)
+//============================================================
+
+bool winwindow_is_fsfx_enabled(void)
+{
+ return draw.window_fsfx_enabled != NULL && draw.window_fsfx_enabled(win_window_list);
+}
+
+
+
+//============================================================
// winwindow_toggle_fsfx
// (main thread)
//============================================================
@@ -510,6 +546,18 @@ void winwindow_toggle_fsfx(void)
//============================================================
+// winwindow_can_take_video
+// (main thread)
+//============================================================
+
+bool winwindow_can_take_video(void)
+{
+ return draw.window_record != NULL;
+}
+
+
+
+//============================================================
// winwindow_take_video
// (main thread)
//============================================================
@@ -1272,37 +1320,41 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar
// input events
case WM_MOUSEMOVE:
- ui_input_push_mouse_move_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
+ if (!wininput_should_hide_mouse())
+ 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(window->machine(), window->target);
+ if (!wininput_should_hide_mouse())
+ ui_input_push_mouse_leave_event(window->machine(), window->target);
break;
case WM_LBUTTONDOWN:
- {
- DWORD ticks = GetTickCount();
- 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() &&
- GET_X_LPARAM(lparam) >= window->lastclickx - 4 && GET_X_LPARAM(lparam) <= window->lastclickx + 4 &&
- GET_Y_LPARAM(lparam) >= window->lastclicky - 4 && GET_Y_LPARAM(lparam) <= window->lastclicky + 4)
- {
- window->lastclicktime = 0;
- ui_input_push_mouse_double_click_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
- }
- else
+ if (!wininput_should_hide_mouse())
{
- window->lastclicktime = ticks;
- window->lastclickx = GET_X_LPARAM(lparam);
- window->lastclicky = GET_Y_LPARAM(lparam);
+ DWORD ticks = GetTickCount();
+ 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() &&
+ GET_X_LPARAM(lparam) >= window->lastclickx - 4 && GET_X_LPARAM(lparam) <= window->lastclickx + 4 &&
+ GET_Y_LPARAM(lparam) >= window->lastclicky - 4 && GET_Y_LPARAM(lparam) <= window->lastclicky + 4)
+ {
+ window->lastclicktime = 0;
+ ui_input_push_mouse_double_click_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
+ }
+ else
+ {
+ window->lastclicktime = ticks;
+ window->lastclickx = GET_X_LPARAM(lparam);
+ window->lastclicky = GET_Y_LPARAM(lparam);
+ }
}
break;
- }
case WM_LBUTTONUP:
- ui_input_push_mouse_up_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
+ if (!wininput_should_hide_mouse())
+ ui_input_push_mouse_up_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
break;
case WM_CHAR:
diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h
index b5bf3f3e52a..fcdea00cf21 100644
--- a/src/osd/windows/window.h
+++ b/src/osd/windows/window.h
@@ -92,6 +92,7 @@ struct win_draw_callbacks
void (*window_save)(win_window_info *window);
void (*window_record)(win_window_info *window);
void (*window_toggle_fsfx)(win_window_info *window);
+ bool (*window_fsfx_enabled)(win_window_info *window);
void (*window_destroy)(win_window_info *window);
};
@@ -125,8 +126,14 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar
extern LRESULT CALLBACK winwindow_video_window_proc_ui(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
void winwindow_toggle_full_screen(void);
+
+// HLSL
+bool winwindow_can_take_snap(void);
void winwindow_take_snap(void);
+bool winwindow_can_take_video(void);
void winwindow_take_video(void);
+bool winwindow_can_toggle_fsfx(void);
+bool winwindow_is_fsfx_enabled(void);
void winwindow_toggle_fsfx(void);
void winwindow_process_events_periodic(running_machine &machine);
diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c
index 75fccae21d2..905ef795977 100644
--- a/src/osd/windows/winmain.c
+++ b/src/osd/windows/winmain.c
@@ -965,6 +965,46 @@ bool windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, b
}
+//-------------------------------------------------
+// toggle_full_screen
+//-------------------------------------------------
+
+void windows_osd_interface::toggle_full_screen()
+{
+ winwindow_toggle_full_screen();
+}
+
+
+//-------------------------------------------------
+// take_snap
+//-------------------------------------------------
+
+void windows_osd_interface::take_snap()
+{
+ winwindow_take_snap();
+}
+
+
+//-------------------------------------------------
+// take_video
+//-------------------------------------------------
+
+void windows_osd_interface::take_video()
+{
+ winwindow_take_video();
+}
+
+
+//-------------------------------------------------
+// toggle_fsfx
+//-------------------------------------------------
+
+void windows_osd_interface::toggle_fsfx()
+{
+ winwindow_toggle_fsfx();
+}
+
+
//============================================================
// winmain_dump_stack
//============================================================
diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h
index dc8c3f21f80..4688e91f0b9 100644
--- a/src/osd/windows/winmain.h
+++ b/src/osd/windows/winmain.h
@@ -308,6 +308,7 @@ public:
// input overridables
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
+ virtual void customize_menubar(ui_menubar &menubar);
// font overridables
virtual osd_font font_open(const char *name, int &height);
@@ -318,6 +319,12 @@ private:
static void osd_exit(running_machine &machine);
static const int DEFAULT_FONT_HEIGHT = 200;
+
+ // trampolines to support menu bar
+ void toggle_full_screen();
+ void take_snap();
+ void take_video();
+ void toggle_fsfx();
};