From e22aae63a1993f3f19dac5c48872baea9d342146 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 9 May 2024 04:43:56 +1000 Subject: [PATCH] -merit/mtouchxl.cpp: Added touch-enabled layout. -ui/tapectrl.cpp: Ensure device monitored for media change is up-to-date. -osd/windows: Changed a pointer to a const reference in an API. --- docs/source/techspecs/layout_script.rst | 4 +- plugins/layout/init.lua | 1 + src/frontend/mame/ui/tapectrl.cpp | 14 ++-- src/mame/layout/mtouchxl.lay | 95 +++++++++++++++++++++++++ src/mame/merit/mtouchxl.cpp | 22 ++++-- src/osd/modules/debugger/debugwin.cpp | 2 +- src/osd/windows/window.cpp | 18 ++--- src/osd/windows/window.h | 2 +- 8 files changed, 132 insertions(+), 26 deletions(-) create mode 100644 src/mame/layout/mtouchxl.lay diff --git a/docs/source/techspecs/layout_script.rst b/docs/source/techspecs/layout_script.rst index 7e5b7419bb731..b520a0690a4d3 100644 --- a/docs/source/techspecs/layout_script.rst +++ b/docs/source/techspecs/layout_script.rst @@ -495,8 +495,8 @@ providing what’s needed: * ``emu.print_verbose``, ``emu.print_error``, ``emu.print_warning``, ``emu.print_info`` and ``emu.print_debug`` functions for diagnostic output. * Standard Lua ``tonumber``, ``tostring``, ``pairs`` and ``ipairs`` functions, - and ``table`` and ``string`` objects for manipulating strings, tables and - other containers. + and ``math``, ``table`` and ``string`` objects for manipulating numbers,r + strings, tables and other containers. * Standard Lua ``print`` function for text output to the console. diff --git a/plugins/layout/init.lua b/plugins/layout/init.lua index e4466a1591286..d4c9a535f3498 100644 --- a/plugins/layout/init.lua +++ b/plugins/layout/init.lua @@ -41,6 +41,7 @@ function layout.startplugin() print_info = emu.print_info, print_debug = emu.print_debug }, file = file, + math = math, print = print, pairs = pairs, ipairs = ipairs, diff --git a/src/frontend/mame/ui/tapectrl.cpp b/src/frontend/mame/ui/tapectrl.cpp index b18c680ab3b9c..a80e5856ed1aa 100644 --- a/src/frontend/mame/ui/tapectrl.cpp +++ b/src/frontend/mame/ui/tapectrl.cpp @@ -69,12 +69,6 @@ menu_tape_control::menu_tape_control(mame_ui_manager &mui, render_container &con if (device) { - m_notifier = device->add_media_change_notifier( - [this] (device_image_interface::media_change_event ev) - { - // repopulate the menu if an image is mounted or unmounted - reset(reset_options::REMEMBER_POSITION); - }); } } @@ -94,9 +88,17 @@ menu_tape_control::~menu_tape_control() void menu_tape_control::populate() { + m_notifier.reset(); m_slider_item_index = -1; if (current_device()) { + // repopulate the menu if an image is mounted or unmounted + m_notifier = current_device()->add_media_change_notifier( + [this] (device_image_interface::media_change_event ev) + { + reset(reset_options::REMEMBER_POSITION); + }); + // name of tape item_append(current_display_name(), current_device()->exists() ? current_device()->filename() : "No Tape Image loaded", current_display_flags(), TAPECMD_SELECT); diff --git a/src/mame/layout/mtouchxl.lay b/src/mame/layout/mtouchxl.lay new file mode 100644 index 0000000000000..32b8d1235f642 --- /dev/null +++ b/src/mame/layout/mtouchxl.lay @@ -0,0 +1,95 @@ + + + + + + + + + + + diff --git a/src/mame/merit/mtouchxl.cpp b/src/mame/merit/mtouchxl.cpp index b422d8cc41771..95537dae9e07f 100644 --- a/src/mame/merit/mtouchxl.cpp +++ b/src/mame/merit/mtouchxl.cpp @@ -30,26 +30,30 @@ //#define REAL_PCI_CHIPSET #include "emu.h" + #include "bus/ata/atapicdr.h" #include "bus/ata/hdd.h" #include "bus/isa/isa_cards.h" #include "cpu/i386/i386.h" -#include "machine/at.h" -#include "machine/ram.h" #include "machine/8042kbdc.h" -#include "machine/nvram.h" -#include "machine/ins8250.h" -#include "machine/microtch.h" +#include "machine/at.h" #include "machine/bankdev.h" -#include "machine/intelfsh.h" -#include "machine/ds128x.h" #include "machine/ds1205.h" +#include "machine/ds128x.h" +#include "machine/ins8250.h" +#include "machine/intelfsh.h" +#include "machine/microtch.h" +#include "machine/nvram.h" +#include "machine/ram.h" #ifdef REAL_PCI_CHIPSET #include "machine/sis85c496.h" #endif #include "sound/ad1848.h" + #include "speaker.h" +#include "mtouchxl.lh" + namespace { @@ -287,6 +291,8 @@ void mtxl_state::at486(machine_config &config) // FIXME: This MCFG fragment does not compile. -R //MCFG_SIS85C496_ADD(":pci:05.0", ":maincpu", 32*1024*1024) #endif + + config.set_default_layout(layout_mtouchxl); } void mtxl_state::at486hd(machine_config &config) @@ -346,6 +352,8 @@ void mtxl_state::at486hd(machine_config &config) // FIXME: This MCFG fragment does not compile. -R //MCFG_SIS85C496_ADD(":pci:05.0", ":maincpu", 32*1024*1024) #endif + + config.set_default_layout(layout_mtouchxl); } #ifdef REAL_PCI_CHIPSET diff --git a/src/osd/modules/debugger/debugwin.cpp b/src/osd/modules/debugger/debugwin.cpp index 43d20ae371d4b..6498a95fcd3ac 100644 --- a/src/osd/modules/debugger/debugwin.cpp +++ b/src/osd/modules/debugger/debugwin.cpp @@ -214,7 +214,7 @@ void debugger_windows::wait_for_debugger(device_t &device, bool firststop) // process everything else default: - winwindow_dispatch_message(*m_machine, &message); + winwindow_dispatch_message(*m_machine, message); break; } diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index c4929f1d82c0f..cdd847cca8c5c 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -464,7 +464,7 @@ void windows_osd_interface::process_events(bool ingame, bool nodispatch) // dispatch if necessary if (dispatch) - winwindow_dispatch_message(machine(), &message); + winwindow_dispatch_message(machine(), message); } } while (ui_temp_pause > 0); @@ -480,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: @@ -494,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; } } @@ -2293,17 +2293,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/src/osd/windows/window.h b/src/osd/windows/window.h index bdfd8a79b61ce..ada71f1cba7bd 100644 --- a/src/osd/windows/window.h +++ b/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);