From 6e60af32c1e2c2a91937d9184778dad97182f36e Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 4 Nov 2023 00:37:48 +1100 Subject: sega/sega_beena.cpp: Added basic book page display. sega_beena_cart.xml: Put page scans in individual data areas. frontend/mame/luaengine_mem.cpp: Added a raw read function for memory regions. plugins/layout: Added bitmap classes to layout sandbox. --- docs/source/luascript/ref-mem.rst | 6 + docs/source/techspecs/layout_script.rst | 22 ++ hash/sega_beena_cart.xml | 460 ++++++++++++++++++++++++++++++-- plugins/layout/init.lua | 7 + scripts/src/formats.lua | 23 +- src/frontend/mame/luaengine_mem.cpp | 17 ++ src/mame/layout/beena.lay | 64 ++++- 7 files changed, 564 insertions(+), 35 deletions(-) diff --git a/docs/source/luascript/ref-mem.rst b/docs/source/luascript/ref-mem.rst index 24c16670c47..0987889d3dc 100644 --- a/docs/source/luascript/ref-mem.rst +++ b/docs/source/luascript/ref-mem.rst @@ -419,6 +419,12 @@ manager.machine.devices[tag]:memregion(tag) Methods ~~~~~~~ +region:read(offs, len) + Reads up to the specified length in bytes from the specified offset in the + memory region. The bytes read will be returned as a string. If the + specified length extends beyond the end of the memory region, the returned + string will be shorter than requested. Note that the data will be in host + byte order. region:read_i{8,16,32,64}(offs) Reads a signed integer value of the size in bits from the specified offset in the memory region. The offset is specified in bytes. Reading beyond the diff --git a/docs/source/techspecs/layout_script.rst b/docs/source/techspecs/layout_script.rst index 370b3eac152..d8949c65e7c 100644 --- a/docs/source/techspecs/layout_script.rst +++ b/docs/source/techspecs/layout_script.rst @@ -484,6 +484,10 @@ providing what’s needed: creating :ref:`attotime `, :ref:`bounds ` and :ref:`colour ` objects. +* ``emu.bitmap_ind8``, ``emu.bitmap_ind16``, ``emu.bitmap_ind32``, + ``emu.bitmap_ind64``, ``emu.bitmap_yuy16``, ``emu.bitmap_rgb32`` and + ``emu.bitmap_argb32`` objects for creating + :ref:`bitmaps `. * ``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, @@ -667,3 +671,21 @@ Get item vertical scroll position item; larger values pan down. Call with ``nil`` as the argument to restore the default vertical scroll position handler (based on bindings in the ``yscroll`` child element). + +.. _layscript-events-element: + +Layout element events +~~~~~~~~~~~~~~~~~~~~~ + +Layout element events apply to an individual visual element definition. + +Draw + ``element:set_draw_callback(cb)`` + + Set callback for additional drawing after the element’s components have been + drawn. This gives the script direct control over the final texture when an + element item is drawn. + + The callback is passed two arguments: the element state (an integer) and the + 32-bit ARGB bitmap at the required size. The callback must not attempt to + resize the bitmap. diff --git a/hash/sega_beena_cart.xml b/hash/sega_beena_cart.xml index fb68c500033..68dff3cc05c 100644 --- a/hash/sega_beena_cart.xml +++ b/hash/sega_beena_cart.xml @@ -15,18 +15,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + @@ -41,18 +63,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + @@ -67,18 +111,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + @@ -93,14 +159,28 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + @@ -115,16 +195,34 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + @@ -139,16 +237,34 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + @@ -163,14 +279,28 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + @@ -185,18 +315,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + @@ -211,18 +363,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + @@ -237,16 +411,34 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + @@ -261,16 +453,34 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + @@ -285,18 +495,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + @@ -311,16 +543,34 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + @@ -335,18 +585,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + @@ -361,18 +633,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + @@ -387,14 +681,28 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + @@ -409,18 +717,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + @@ -435,18 +765,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + @@ -461,18 +813,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + @@ -487,18 +861,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + @@ -513,18 +909,40 @@ license:CC0-1.0 - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/layout/init.lua b/plugins/layout/init.lua index a7d3f7fb199..e2da4c196e4 100644 --- a/plugins/layout/init.lua +++ b/plugins/layout/init.lua @@ -22,6 +22,13 @@ function layout.startplugin() attotime = emu.attotime, render_bounds = emu.render_bounds, render_color = emu.render_color, + bitmap_ind8 = emu.bitmap_ind8, + bitmap_ind16 = emu.bitmap_ind16, + bitmap_ind32 = emu.bitmap_ind32, + bitmap_ind64 = emu.bitmap_ind64, + bitmap_yuy16 = emu.bitmap_yuy16, + bitmap_rgb32 = emu.bitmap_rgb32, + bitmap_argb32 = emu.bitmap_argb32, print_verbose = emu.print_verbose, print_error = emu.print_error, print_warning = emu.print_warning, diff --git a/scripts/src/formats.lua b/scripts/src/formats.lua index 1ae8f710479..b9338f16d68 100644 --- a/scripts/src/formats.lua +++ b/scripts/src/formats.lua @@ -1405,6 +1405,18 @@ if opt_tool(FORMATS, "MZ_CAS") then } end +-------------------------------------------------- +-- +--@src/lib/formats/nabupc_dsk.h,FORMATS["NABUPC_DSK"] = true +-------------------------------------------------- + +if opt_tool(FORMATS, "NABUPC_DSK") then + files { + MAME_DIR.. "src/lib/formats/nabupc_dsk.cpp", + MAME_DIR.. "src/lib/formats/nabupc_dsk.h", + } +end + -------------------------------------------------- -- --@src/lib/formats/nanos_dsk.h,FORMATS["NANOS_DSK"] = true @@ -2318,15 +2330,4 @@ if opt_tool(FORMATS, "FS_HP98X5") then } end --------------------------------------------------- --- ---@src/lib/formats/nabupc_dsk.h,FORMATS["NABUPC_DSK"] = true --------------------------------------------------- - -if opt_tool(FORMATS, "NABUPC_DSK") then - files { - MAME_DIR.. "src/lib/formats/nabupc_dsk.cpp", - MAME_DIR.. "src/lib/formats/nabupc_dsk.h", - } -end end diff --git a/src/frontend/mame/luaengine_mem.cpp b/src/frontend/mame/luaengine_mem.cpp index 3689c1c9bc5..4e5fac3341f 100644 --- a/src/frontend/mame/luaengine_mem.cpp +++ b/src/frontend/mame/luaengine_mem.cpp @@ -11,6 +11,8 @@ #include "emu.h" #include "luaengine.ipp" +#include + namespace { @@ -734,6 +736,21 @@ void lua_engine::initialize_memory(sol::table &emu) auto region_type = sol().registry().new_usertype("region", sol::no_constructor); + region_type.set_function( + "read", + [] (memory_region ®ion, sol::this_state s, offs_t offset, offs_t length) + { + // TODO: should this do something special if the offset isn't a multiple of the byte width? + buffer_helper buf(s); + const offs_t limit = std::min(region.bytes(), offset + length); + const offs_t copyable = (limit > offset) ? (limit - offset) : 0; + auto space = buf.prepare(copyable); + if (copyable) + std::memcpy(space.get(), ®ion.as_u8(offset), copyable); + space.add(copyable); + buf.push(); + return sol::make_reference(s, sol::stack_reference(s, -1)); + }); region_type.set_function("read_i8", ®ion_read); region_type.set_function("read_u8", ®ion_read); region_type.set_function("read_i16", ®ion_read); diff --git a/src/mame/layout/beena.lay b/src/mame/layout/beena.lay index 07dfb792c93..bf1b55f7188 100644 --- a/src/mame/layout/beena.lay +++ b/src/mame/layout/beena.lay @@ -3,10 +3,68 @@ license:CC0-1.0 --> - - + + + + + + + + + + + + - + + + + + + + + + + -- cgit v1.2.3