diff options
-rw-r--r-- | docs/source/techspecs/layout_script.rst | 4 | ||||
-rw-r--r-- | plugins/layout/init.lua | 1 | ||||
-rw-r--r-- | src/frontend/mame/ui/tapectrl.cpp | 14 | ||||
-rw-r--r-- | src/mame/layout/mtouchxl.lay | 95 | ||||
-rw-r--r-- | src/mame/merit/mtouchxl.cpp | 22 | ||||
-rw-r--r-- | src/osd/modules/debugger/debugwin.cpp | 2 | ||||
-rw-r--r-- | src/osd/windows/window.cpp | 18 | ||||
-rw-r--r-- | src/osd/windows/window.h | 2 |
8 files changed, 132 insertions, 26 deletions
diff --git a/docs/source/techspecs/layout_script.rst b/docs/source/techspecs/layout_script.rst index 7e5b7419bb7..b520a0690a4 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 e4466a15912..d4c9a535f34 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 b18c680ab3b..a80e5856ed1 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 00000000000..32b8d1235f6 --- /dev/null +++ b/src/mame/layout/mtouchxl.lay @@ -0,0 +1,95 @@ +<?xml version="1.0"?> +<!-- +license:CC0-1.0 +--> +<mamelayout version="2"> + <view name="Touch-Enabled" showpointers="yes"> + <screen id="screen" index="0"> + <bounds left="0" top="0" right="4" bottom="3" /> + </screen> + </view> + + <script><![CDATA[ + file:set_resolve_tags_callback( + function () + -- get the touchscreen I/O port fields + local tsdev = file.device:subdevice('microtouch') + local btn_field = tsdev:ioport('TOUCH'):field(0x01) + local x_field = tsdev:ioport('TOUCH_X'):field(0x3fff) + local y_field = tsdev:ioport('TOUCH_Y'):field(0x3fff) + + -- for mapping coordinates + local view = file.views['Touch-Enabled'] + local scr_item = view.items['screen'] + local floor = math.floor + local l, r, t, b + local x_scale, y_scale + + -- pointer state + local ptr_id = nil + local inside = false + + local function release_touch() + btn_field:clear_value() + x_field:clear_value() + y_field:clear_value() + end + + local function recomputed() + local bounds = scr_item.bounds + l = bounds.x0 + r = bounds.x1 + t = bounds.y0 + b = bounds.y1 + x_scale = 0x3fff / bounds.width + y_scale = 0x3fff / bounds.height + end + + local function check_pointer(x, y) + if (x >= l) and (x < r) and (y >= t) and (y < b) then + inside = true + btn_field:set_value(1) + x_field:set_value(floor((x - l) * x_scale)) + y_field:set_value(floor((y - t) * y_scale)) + elseif inside then + inside = false + release_touch() + end + end + + local function forget_pointer() + if inside then + release_touch() + end + ptr_id = nil + inside = false + end + + local function pointer_updated(type, id, dev, x, y, btn, dn, up, cnt) + if ptr_id == id then + if (btn & 0x01) == 0 then + forget_pointer() + else + check_pointer(x, y) + end + elseif (not ptr_id) and ((dn & 0x01) ~= 0) then + ptr_id = id + check_pointer(x, y) + end + end + + local function pointer_lost(type, id, dev, x, y, up, cnt) + if ptr_id == id then + forget_pointer() + end + end + + -- attach callbacks to view + view:set_recomputed_callback(recomputed) + view:set_pointer_updated_callback(pointer_updated) + view:set_pointer_left_callback(pointer_lost) + view:set_pointer_aborted_callback(pointer_lost) + view:set_forget_pointers_callback(forget_pointer) + end) + ]]></script> +</mamelayout> diff --git a/src/mame/merit/mtouchxl.cpp b/src/mame/merit/mtouchxl.cpp index b422d8cc417..95537dae9e0 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 43d20ae371d..6498a95fcd3 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 c4929f1d82c..cdd847cca8c 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<win_window_info::win_pointer_info>::iterator win_window_info::find_m bool winwindow_qt_filter(void *message) { - MSG *msg = (MSG *)message; + MSG *const msg = reinterpret_cast<MSG *>(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<win_window_info *>(ptr)->machine(), *msg); return true; } return false; diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h index bdfd8a79b61..ada71f1cba7 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); |