From ba197c26a8a72d29201232f7fbf5df1909d19f93 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Thu, 30 May 2024 13:42:30 +1000 Subject: [PATCH] Files for 266. --- docs/release/build/uprel.bat | 2 +- .../src/osd/modules/lib/osdobj_common.cpp | 29 ++++- docs/release/src/osd/windows/window.cpp | 111 ++++++++---------- docs/release/src/osd/windows/window.h | 2 +- docs/release/src/osd/windows/winmain.h | 6 +- docs/release/src/version.cpp | 2 +- makefile | 4 +- src/version.cpp | 2 +- 8 files changed, 81 insertions(+), 77 deletions(-) diff --git a/docs/release/build/uprel.bat b/docs/release/build/uprel.bat index a63079d4d07..40b025c743f 100644 --- a/docs/release/build/uprel.bat +++ b/docs/release/build/uprel.bat @@ -1,6 +1,6 @@ \goto end git fetch upstream -git merge upstream/release0265 +git merge upstream/release0266 git checkout master :end pause diff --git a/docs/release/src/osd/modules/lib/osdobj_common.cpp b/docs/release/src/osd/modules/lib/osdobj_common.cpp index d4d44aab5e7..ade829c067f 100644 --- a/docs/release/src/osd/modules/lib/osdobj_common.cpp +++ b/docs/release/src/osd/modules/lib/osdobj_common.cpp @@ -308,6 +308,7 @@ void osd_common_t::register_options() REGISTER_MODULE(m_mod_man, MOUSEINPUT_WIN32); REGISTER_MODULE(m_mod_man, MOUSE_NONE); + REGISTER_MODULE(m_mod_man, LIGHTGUNINPUT_SDL); REGISTER_MODULE(m_mod_man, LIGHTGUN_X11); REGISTER_MODULE(m_mod_man, LIGHTGUNINPUT_RAWINPUT); REGISTER_MODULE(m_mod_man, LIGHTGUNINPUT_WIN32); @@ -462,9 +463,6 @@ void osd_common_t::update(bool skip_redraw) // if (m_watchdog != nullptr) m_watchdog->reset(); - - update_slider_list(); - } @@ -567,6 +565,31 @@ void osd_common_t::customize_input_type_list(std::vector &type std::vector osd_common_t::get_slider_list() { + // check if any window has dirty sliders + bool dirty = false; + for (const auto &window : window_list()) + { + if (window->has_renderer() && window->renderer().sliders_dirty()) + { + dirty = true; + break; + } + } + + if (dirty) + { + m_sliders.clear(); + + for (const auto &window : osd_common_t::window_list()) + { + if (window->has_renderer()) + { + std::vector window_sliders = window->renderer().get_slider_list(); + m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end()); + } + } + } + return m_sliders; } diff --git a/docs/release/src/osd/windows/window.cpp b/docs/release/src/osd/windows/window.cpp index 4cfbcd5eb6c..b1e39be7735 100644 --- a/docs/release/src/osd/windows/window.cpp +++ b/docs/release/src/osd/windows/window.cpp @@ -146,39 +146,12 @@ bool windows_osd_interface::window_init() return true; } -void windows_osd_interface::update_slider_list() -{ - for (const auto &window : osd_common_t::window_list()) - { - // check if any window has dirty sliders - if (window->has_renderer() && window->renderer().sliders_dirty()) - { - build_slider_list(); - return; - } - } -} int windows_osd_interface::window_count() { return osd_common_t::window_list().size(); } -void windows_osd_interface::build_slider_list() -{ - m_sliders.clear(); - - for (const auto &window : osd_common_t::window_list()) - { - if (window->has_renderer()) - { - // take the sliders of the first window - std::vector window_sliders = window->renderer().get_slider_list(); - m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end()); - } - } -} - void windows_osd_interface::add_audio_to_recording(const int16_t *buffer, int samples_this_frame) { auto const &window = osd_common_t::window_list().front(); // We only record on the first window @@ -186,6 +159,7 @@ void windows_osd_interface::add_audio_to_recording(const int16_t *buffer, int sa window->renderer().add_audio_to_recording(buffer, samples_this_frame); } + //============================================================ // winwindow_exit // (main thread) @@ -297,7 +271,7 @@ void win_window_info::show_pointer() s_saved_cursor_pos.x = s_saved_cursor_pos.y = -1; } - while (ShowCursor(TRUE) < 1) {}; + while (ShowCursor(TRUE) < 1) { } ShowCursor(FALSE); } @@ -342,7 +316,7 @@ void windows_osd_interface::process_events() // is_mame_window //============================================================ -static bool is_mame_window(HWND hwnd) +inline bool is_mame_window(HWND hwnd) { for (const auto &window : osd_common_t::window_list()) if (dynamic_cast(*window).platform_window() == hwnd) @@ -351,50 +325,50 @@ static bool is_mame_window(HWND hwnd) return false; } -inline static BOOL handle_mouse_button(windows_osd_interface *osd, int button, int down, int x, int y) +inline BOOL handle_mouse_button(windows_osd_interface &osd, int button, int down, LPARAM lparam) { MouseUpdateEventArgs args; args.pressed = (down ? 1 : 0) << button; args.released = (down ? 0 : 1) << button; args.vdelta = 0; args.hdelta = 0; - args.xpos = x; - args.ypos = y; + args.xpos = GET_X_LPARAM(lparam); + args.ypos = GET_Y_LPARAM(lparam); - bool handled = osd->handle_input_event(INPUT_EVENT_MOUSE_BUTTON, &args); + bool const handled = osd.handle_input_event(INPUT_EVENT_MOUSE_BUTTON, &args); // When in lightgun mode or mouse mode, the mouse click may be routed to the input system // because the mouse interactions in the UI are routed from the video_window_proc below // we need to make sure they aren't suppressed in these cases. - return handled && !osd->options().lightgun() && !osd->options().mouse(); + return handled && !osd.options().lightgun() && !osd.options().mouse(); } -inline static BOOL handle_mouse_wheel(windows_osd_interface *osd, int v, int h, int x, int y) +inline BOOL handle_mouse_wheel(windows_osd_interface &osd, int v, int h, LPARAM lparam) { MouseUpdateEventArgs args; args.pressed = 0; args.released = 0; args.vdelta = v; args.hdelta = h; - args.xpos = x; - args.ypos = y; + args.xpos = GET_X_LPARAM(lparam); + args.ypos = GET_Y_LPARAM(lparam); - bool handled = osd->handle_input_event(INPUT_EVENT_MOUSE_WHEEL, &args); + bool const handled = osd.handle_input_event(INPUT_EVENT_MOUSE_WHEEL, &args); // When in lightgun mode or mouse mode, the mouse wheel may be routed to the input system // because the mouse interactions in the UI are routed from the video_window_proc below // we need to make sure they aren't suppressed in these cases. - return handled && !osd->options().lightgun() && !osd->options().mouse(); + return handled && !osd.options().lightgun() && !osd.options().mouse(); } -inline static BOOL handle_keypress(windows_osd_interface *osd, int vkey, int down, int scancode, BOOL extended_key) +inline BOOL handle_keypress(windows_osd_interface &osd, int vkey, int down, LPARAM lparam) { KeyPressEventArgs args; args.event_id = down ? INPUT_EVENT_KEYDOWN : INPUT_EVENT_KEYUP; - args.scancode = MAKE_DI_SCAN(scancode, extended_key); + args.scancode = MAKE_DI_SCAN(SCAN_CODE(lparam), IS_EXTENDED(lparam)); args.vkey = vkey; - return osd->handle_input_event(args.event_id, &args); + return osd.handle_input_event(args.event_id, &args); } //============================================================ @@ -435,61 +409,62 @@ void windows_osd_interface::process_events(bool ingame, bool nodispatch) // forward mouse button downs to the input system case WM_LBUTTONDOWN: - dispatch = !handle_mouse_button(this, 0, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam)); + dispatch = !handle_mouse_button(*this, 0, TRUE, message.lParam); break; case WM_RBUTTONDOWN: - dispatch = !handle_mouse_button(this, 1, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam)); + dispatch = !handle_mouse_button(*this, 1, TRUE, message.lParam); break; case WM_MBUTTONDOWN: - dispatch = !handle_mouse_button(this, 2, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam)); + dispatch = !handle_mouse_button(*this, 2, TRUE, message.lParam); break; case WM_XBUTTONDOWN: - dispatch = !handle_mouse_button(this, 3, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam)); + dispatch = !handle_mouse_button(*this, (GET_XBUTTON_WPARAM(message.wParam) == XBUTTON1) ? 3 : 4, TRUE, message.lParam); break; // forward mouse button ups to the input system case WM_LBUTTONUP: - dispatch = !handle_mouse_button(this, 0, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam)); + dispatch = !handle_mouse_button(*this, 0, FALSE, message.lParam); break; case WM_RBUTTONUP: - dispatch = !handle_mouse_button(this, 1, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam)); + dispatch = !handle_mouse_button(*this, 1, FALSE, message.lParam); break; case WM_MBUTTONUP: - dispatch = !handle_mouse_button(this, 2, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam)); + dispatch = !handle_mouse_button(*this, 2, FALSE, message.lParam); break; case WM_XBUTTONUP: - dispatch = !handle_mouse_button(this, 3, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam)); + dispatch = !handle_mouse_button(*this, (GET_XBUTTON_WPARAM(message.wParam) == XBUTTON1) ? 3 : 4, FALSE, message.lParam); break; // forward mouse wheel movement to the input system case WM_MOUSEWHEEL: - dispatch = !handle_mouse_wheel(this, GET_WHEEL_DELTA_WPARAM(message.wParam), 0, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam)); + dispatch = !handle_mouse_wheel(*this, GET_WHEEL_DELTA_WPARAM(message.wParam), 0, message.lParam); break; case WM_MOUSEHWHEEL: - dispatch = !handle_mouse_wheel(this, 0, GET_WHEEL_DELTA_WPARAM(message.wParam), GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam)); + dispatch = !handle_mouse_wheel(*this, 0, GET_WHEEL_DELTA_WPARAM(message.wParam), message.lParam); break; + // forward keystrokes to the input system case WM_KEYDOWN: if (NOT_ALREADY_DOWN(message.lParam)) - dispatch = !handle_keypress(this, message.wParam, TRUE, SCAN_CODE(message.lParam), IS_EXTENDED(message.lParam)); + dispatch = !handle_keypress(*this, message.wParam, TRUE, message.lParam); break; case WM_KEYUP: - dispatch = !handle_keypress(this, message.wParam, FALSE, SCAN_CODE(message.lParam), IS_EXTENDED(message.lParam)); + dispatch = !handle_keypress(*this, message.wParam, FALSE, message.lParam); break; } } // dispatch if necessary if (dispatch) - winwindow_dispatch_message(machine(), &message); + winwindow_dispatch_message(machine(), message); } } while (ui_temp_pause > 0); @@ -505,12 +480,12 @@ void windows_osd_interface::process_events(bool ingame, bool nodispatch) // (main thread) //============================================================ -void winwindow_dispatch_message(running_machine &machine, MSG *message) +void winwindow_dispatch_message(running_machine &machine, MSG const &message) { assert(GetCurrentThreadId() == main_threadid); // dispatch our special communication messages - switch (message->message) + switch (message.message) { // special case for quit case WM_QUIT: @@ -519,8 +494,8 @@ void winwindow_dispatch_message(running_machine &machine, MSG *message) // everything else dispatches normally default: - TranslateMessage(message); - DispatchMessage(message); + TranslateMessage(&message); + DispatchMessage(&message); break; } } @@ -1247,6 +1222,16 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR case WM_POINTERCAPTURECHANGED: window->pointer_capture_changed(wparam, lparam); break; + // TODO: other pointer events? + //case WM_POINTERACTIVATE: + //case WM_POINTERDEVICECHANGE: + //case WM_POINTERDEVICEINRANGE: + //case WM_POINTERDEVICEOUTOFRANGE: + //case WM_POINTERROUTEDAWAY: + //case WM_POINTERROUTEDRELEASED: + //case WM_POINTERROUTEDTO: + //case WM_POINTERWHEEL: + //case WM_POINTERHWHEEL: // pause the system when we start a menu or resize case WM_ENTERSIZEMOVE: @@ -2335,17 +2320,17 @@ std::vector::iterator win_window_info::find_m bool winwindow_qt_filter(void *message) { - MSG *msg = (MSG *)message; + MSG *const msg = reinterpret_cast(message); - if(is_mame_window(msg->hwnd) || (!msg->hwnd && (msg->message >= WM_USER))) + if (is_mame_window(msg->hwnd) || (!msg->hwnd && (msg->message >= WM_USER))) { LONG_PTR ptr; - if(msg->hwnd) // get the machine associated with this window + if (msg->hwnd) // get the machine associated with this window ptr = GetWindowLongPtr(msg->hwnd, GWLP_USERDATA); else // any one will have to do ptr = (LONG_PTR)osd_common_t::window_list().front().get(); - winwindow_dispatch_message(((win_window_info *)ptr)->machine(), msg); + winwindow_dispatch_message(reinterpret_cast(ptr)->machine(), *msg); return true; } return false; diff --git a/docs/release/src/osd/windows/window.h b/docs/release/src/osd/windows/window.h index e9a1e9c12cf..b3e4d02b636 100644 --- a/docs/release/src/osd/windows/window.h +++ b/docs/release/src/osd/windows/window.h @@ -207,7 +207,7 @@ void winwindow_toggle_fsfx(void); void winwindow_ui_pause(running_machine &machine, int pause); int winwindow_ui_is_paused(running_machine &machine); -void winwindow_dispatch_message(running_machine &machine, MSG *message); +void winwindow_dispatch_message(running_machine &machine, MSG const &message); extern int win_create_menu(running_machine &machine, HMENU *menus); // MESSUI extern LRESULT CALLBACK winwindow_video_window_proc_ui(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam); // MESSUI diff --git a/docs/release/src/osd/windows/winmain.h b/docs/release/src/osd/windows/winmain.h index 8701cc279a2..0e7b6461989 100644 --- a/docs/release/src/osd/windows/winmain.h +++ b/docs/release/src/osd/windows/winmain.h @@ -84,7 +84,7 @@ class windows_osd_interface : public osd_common_t void extract_video_config(); // windows OSD specific - bool handle_input_event(input_event eventid, void *eventdata) const; + bool handle_input_event(input_event eventid, const void *eventdata) const; bool should_hide_mouse() const; virtual bool has_focus() const override; @@ -96,10 +96,6 @@ class windows_osd_interface : public osd_common_t using osd_common_t::poll_input_modules; // Win32 debugger calls this directly, which it shouldn't -protected: - virtual void build_slider_list() override; - virtual void update_slider_list() override; - private: void process_events(bool ingame, bool nodispatch); virtual void osd_exit() override; diff --git a/docs/release/src/version.cpp b/docs/release/src/version.cpp index d115b710799..5159c14a2f9 100644 --- a/docs/release/src/version.cpp +++ b/docs/release/src/version.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ -#define BARE_BUILD_VERSION "0.265.0" +#define BARE_BUILD_VERSION "0.266.0" extern const char bare_build_version[]; extern const char build_version[]; diff --git a/makefile b/makefile index cbad775408c..561db3f79e5 100644 --- a/makefile +++ b/makefile @@ -1578,7 +1578,7 @@ endif ifeq (posix,$(SHELLTYPE)) $(GENDIR)/version.cpp: makefile $(GENDIR)/git_desc | $(GEN_FOLDERS) - @echo '#define BARE_BUILD_VERSION "0.265"' > $@ + @echo '#define BARE_BUILD_VERSION "0.266.0"' > $@ @echo '#define BARE_VCS_REVISION "$(NEW_GIT_VERSION)"' >> $@ @echo 'extern const char bare_build_version[];' >> $@ @echo 'extern const char bare_vcs_revision[];' >> $@ @@ -1588,7 +1588,7 @@ $(GENDIR)/version.cpp: makefile $(GENDIR)/git_desc | $(GEN_FOLDERS) @echo 'const char build_version[] = BARE_BUILD_VERSION " (" BARE_VCS_REVISION ")";' >> $@ else $(GENDIR)/version.cpp: makefile $(GENDIR)/git_desc | $(GEN_FOLDERS) - @echo #define BARE_BUILD_VERSION "0.265.x" > $@ + @echo #define BARE_BUILD_VERSION "0.266.0" > $@ @echo #define BARE_VCS_REVISION "$(NEW_GIT_VERSION)" >> $@ @echo extern const char bare_build_version[]; >> $@ @echo extern const char bare_vcs_revision[]; >> $@ diff --git a/src/version.cpp b/src/version.cpp index 2c982e9c272..5159c14a2f9 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ -#define BARE_BUILD_VERSION "0.265.x" +#define BARE_BUILD_VERSION "0.266.0" extern const char bare_build_version[]; extern const char build_version[];