summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-11-15 03:53:47 +1100
committer Vas Crabb <vas@vastheman.com>2020-11-15 03:53:47 +1100
commit55b8ca317ab1f77850f498c1523355e1f5dd8d03 (patch)
treebada7948236b18684609f47024cc9ca227a5ef89 /src/frontend
parent4db7f0439c3b841eb07d2320e39be38269e6cd56 (diff)
-Switch to building MAME as C++17.
* Updated sol2 to 3.2.2 * Updated pugixml to 1.10 * Increased minimum clang version to 6 * Cleaned up some stuff that can use new features
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/cheat.cpp2
-rw-r--r--src/frontend/mame/luaengine.cpp136
-rw-r--r--src/frontend/mame/luaengine.h5
-rw-r--r--src/frontend/mame/ui/filesel.cpp2
-rw-r--r--src/frontend/mame/ui/inputmap.cpp4
-rw-r--r--src/frontend/mame/ui/miscmenu.cpp6
-rw-r--r--src/frontend/mame/ui/viewgfx.cpp6
7 files changed, 79 insertions, 82 deletions
diff --git a/src/frontend/mame/cheat.cpp b/src/frontend/mame/cheat.cpp
index daf6461b0f4..39846db0099 100644
--- a/src/frontend/mame/cheat.cpp
+++ b/src/frontend/mame/cheat.cpp
@@ -160,7 +160,7 @@ cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols,
util::xml::data_node::int_format const format(itemnode->get_attribute_int_format("value"));
// allocate and append a new item
- item &curitem(*m_itemlist.emplace(m_itemlist.end(), itemnode->get_value(), value, format));
+ item &curitem(m_itemlist.emplace_back(itemnode->get_value(), value, format));
// ensure the maximum expands to suit
m_maxval = std::max(m_maxval, curitem.value());
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index 9afe6827cfd..e0660cb8e5b 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -976,7 +976,7 @@ void lua_engine::initialize()
* file:fullpath() -
*/
- auto file_type = emu.create_simple_usertype<emu_file>(sol::call_constructor, sol::initializers(
+ auto file_type = emu.new_usertype<emu_file>(sol::call_constructor, sol::initializers(
[](emu_file &file, u32 flags) { new (&file) emu_file(flags); },
[](emu_file &file, const char *path, u32 flags) { new (&file) emu_file(path, flags); },
[](emu_file &file, const char *mode) {
@@ -1066,7 +1066,7 @@ void lua_engine::initialize()
file_type.set("size", &emu_file::size);
file_type.set("filename", &emu_file::filename);
file_type.set("fullpath", &emu_file::fullpath);
- emu.set_usertype("file", file_type);
+ emu.set("file", file_type);
/* thread library
@@ -1083,7 +1083,7 @@ void lua_engine::initialize()
* thread.yield - check if thread is yielded
*/
- auto thread_type = emu.create_simple_usertype<context>(sol::call_constructor, sol::constructors<sol::types<>>());
+ auto thread_type = emu.new_usertype<context>(sol::call_constructor, sol::constructors<sol::types<>>());
thread_type.set("start", [](context &ctx, const char *scr) {
std::string script(scr);
if(ctx.busy)
@@ -1136,7 +1136,7 @@ void lua_engine::initialize()
}));
thread_type.set("busy", sol::readonly(&context::busy));
thread_type.set("yield", sol::readonly(&context::yield));
- emu.set_usertype("thread", thread_type);
+ emu.set("thread", thread_type);
/* save_item library
@@ -1151,7 +1151,7 @@ void lua_engine::initialize()
* item:write(offset, value) - write entry value by index
*/
- auto item_type = emu.create_simple_usertype<save_item>(sol::call_constructor, sol::initializers([this](save_item &item, int index) {
+ auto item_type = emu.new_usertype<save_item>(sol::call_constructor, sol::initializers([this](save_item &item, int index) {
if(machine().save().indexed_item(index, item.base, item.size, item.valcount, item.blockcount, item.stride))
{
item.count = item.valcount * item.blockcount;
@@ -1236,7 +1236,7 @@ void lua_engine::initialize()
break;
}
});
- emu.set_usertype("item", item_type);
+ emu.set("item", item_type);
/* core_options library
@@ -1252,7 +1252,7 @@ void lua_engine::initialize()
* options.entries[] - get table of option entries (k=name, v=core_options::entry)
*/
- auto core_options_type = sol().registry().create_simple_usertype<core_options>("new", sol::no_constructor);
+ auto core_options_type = sol().registry().new_usertype<core_options>("new", sol::no_constructor);
core_options_type.set("help", &core_options::output_help);
core_options_type.set("command", &core_options::command);
core_options_type.set("entries", sol::property([this](core_options &options) {
@@ -1275,7 +1275,7 @@ void lua_engine::initialize()
}
return table;
}));
- sol().registry().set_usertype("core_options", core_options_type);
+ sol().registry().set("core_options", core_options_type);
/* core_options::entry library
@@ -1291,7 +1291,7 @@ void lua_engine::initialize()
* entry:has_range() - are min and max valid for entry
*/
- auto core_options_entry_type = sol().registry().create_simple_usertype<core_options::entry>("new", sol::no_constructor);
+ auto core_options_entry_type = sol().registry().new_usertype<core_options::entry>("new", sol::no_constructor);
core_options_entry_type.set("value", sol::overload(
[this](core_options::entry &e, bool val) {
if(e.type() != OPTION_BOOLEAN)
@@ -1337,7 +1337,7 @@ void lua_engine::initialize()
core_options_entry_type.set("minimum", &core_options::entry::minimum);
core_options_entry_type.set("maximum", &core_options::entry::maximum);
core_options_entry_type.set("has_range", &core_options::entry::has_range);
- sol().registry().set_usertype("core_options_entry", core_options_entry_type);
+ sol().registry().set("core_options_entry", core_options_entry_type);
/* running_machine library
@@ -1377,7 +1377,7 @@ void lua_engine::initialize()
* machine.images[] - get available image devices table (k=type, v=device_image_interface)
*/
- auto machine_type = sol().registry().create_simple_usertype<running_machine>("new", sol::no_constructor);
+ auto machine_type = sol().registry().new_usertype<running_machine>("new", sol::no_constructor);
machine_type.set("exit", &running_machine::schedule_exit);
machine_type.set("hard_reset", &running_machine::schedule_hard_reset);
machine_type.set("soft_reset", &running_machine::schedule_soft_reset);
@@ -1466,7 +1466,7 @@ void lua_engine::initialize()
[](running_machine &m, const char *str) { m.popmessage("%s", str); },
[](running_machine &m) { m.popmessage(); }));
machine_type.set("logerror", [](running_machine &m, const char *str) { m.logerror("[luaengine] %s\n", str); } );
- sol().registry().set_usertype("machine", machine_type);
+ sol().registry().set("machine", machine_type);
/* game_driver library
@@ -1495,7 +1495,7 @@ void lua_engine::initialize()
* driver.is_incomplete - official system with blatantly incomplete hardware/software
*/
- auto game_driver_type = sol().registry().create_simple_usertype<game_driver>("new", sol::no_constructor);
+ auto game_driver_type = sol().registry().new_usertype<game_driver>("new", sol::no_constructor);
game_driver_type.set("source_file", sol::property([] (game_driver const &driver) { return &driver.type.source()[0]; }));
game_driver_type.set("parent", sol::readonly(&game_driver::parent));
game_driver_type.set("name", sol::property([] (game_driver const &driver) { return &driver.name[0]; }));
@@ -1555,7 +1555,7 @@ void lua_engine::initialize()
game_driver_type.set("no_sound_hw", sol::property([](game_driver const &driver) { return (driver.flags & machine_flags::NO_SOUND_HW) > 0; }));
game_driver_type.set("mechanical", sol::property([](game_driver const &driver) { return (driver.flags & machine_flags::MECHANICAL) > 0; }));
game_driver_type.set("is_incomplete", sol::property([](game_driver const &driver) { return (driver.flags & machine_flags::IS_INCOMPLETE) > 0; } ));
- sol().registry().set_usertype("game_driver", game_driver_type);
+ sol().registry().set("game_driver", game_driver_type);
/* debugger_manager library (requires debugger to be active)
@@ -1572,7 +1572,7 @@ void lua_engine::initialize()
struct wrap_textbuf { wrap_textbuf(const text_buffer &buf) : textbuf(buf) { } std::reference_wrapper<const text_buffer> textbuf; };
- auto debugger_type = sol().registry().create_simple_usertype<debugger_manager>("new", sol::no_constructor);
+ auto debugger_type = sol().registry().new_usertype<debugger_manager>("new", sol::no_constructor);
debugger_type.set("command", [](debugger_manager &debug, const std::string &cmd) { debug.console().execute_command(cmd, false); });
debugger_type.set("consolelog", sol::property([](debugger_manager &debug) { return wrap_textbuf(debug.console().get_console_textbuf()); }));
debugger_type.set("errorlog", sol::property([](debugger_manager &debug) { return wrap_textbuf(debug.console().get_errorlog_textbuf()); }));
@@ -1589,7 +1589,7 @@ void lua_engine::initialize()
else
debug.cpu().set_execution_running();
}));
- sol().registry().set_usertype("debugger", debugger_type);
+ sol().registry().set("debugger", debugger_type);
/* wrap_textbuf library (requires debugger to be active)
@@ -1624,7 +1624,7 @@ void lua_engine::initialize()
* debug:wplist(space)[] - table of watchpoints (k=index, v=watchpoint)
*/
- auto device_debug_type = sol().registry().create_simple_usertype<device_debug>("new", sol::no_constructor);
+ auto device_debug_type = sol().registry().new_usertype<device_debug>("new", sol::no_constructor);
device_debug_type.set("step", [](device_debug &dev, sol::object num) {
int steps = 1;
if(num.is<int>())
@@ -1682,7 +1682,7 @@ void lua_engine::initialize()
}
return table;
});
- sol().registry().set_usertype("device_debug", device_debug_type);
+ sol().registry().set("device_debug", device_debug_type);
/* device_t library
@@ -1701,7 +1701,7 @@ void lua_engine::initialize()
* device.roms[] - device rom entry table (k=name, v=rom_entry)
*/
- auto device_type = sol().registry().create_simple_usertype<device_t>("new", sol::no_constructor);
+ auto device_type = sol().registry().new_usertype<device_t>("new", sol::no_constructor);
device_type.set("name", &device_t::name);
device_type.set("shortname", &device_t::shortname);
device_type.set("tag", &device_t::tag);
@@ -1761,7 +1761,7 @@ void lua_engine::initialize()
table[rom.name()] = rom;
return table;
}));
- sol().registry().set_usertype("device", device_type);
+ sol().registry().set("device", device_type);
/* addr_space library
@@ -1790,7 +1790,7 @@ void lua_engine::initialize()
* space.map[] - table of address map entries (k=index, v=address_map_entry)
*/
- auto addr_space_type = sol().registry().create_simple_usertype<addr_space>(sol::call_constructor, sol::constructors<sol::types<address_space &, device_memory_interface &>>());
+ auto addr_space_type = sol().registry().new_usertype<addr_space>(sol::call_constructor, sol::constructors<sol::types<address_space &, device_memory_interface &>>());
addr_space_type.set("read_i8", &addr_space::mem_read<int8_t>);
addr_space_type.set("read_u8", &addr_space::mem_read<uint8_t>);
addr_space_type.set("read_i16", &addr_space::mem_read<int16_t>);
@@ -1939,7 +1939,7 @@ void lua_engine::initialize()
}
return map;
}));
- sol().registry().set_usertype("addr_space", addr_space_type);
+ sol().registry().set("addr_space", addr_space_type);
/* ioport_manager library
@@ -1953,7 +1953,7 @@ void lua_engine::initialize()
* ioport.ports[] - ioports table (k=tag, v=ioport_port)
*/
- auto ioport_manager_type = sol().registry().create_simple_usertype<ioport_manager>("new", sol::no_constructor);
+ auto ioport_manager_type = sol().registry().new_usertype<ioport_manager>("new", sol::no_constructor);
ioport_manager_type.set("count_players", &ioport_manager::count_players);
ioport_manager_type.set("natkeyboard", &ioport_manager::natkeyboard);
ioport_manager_type.set("type_group", [](ioport_manager &im, ioport_type type, int player) {
@@ -1968,7 +1968,7 @@ void lua_engine::initialize()
ioport_manager_type.set("type_seq", [](ioport_manager &m, ioport_type type, int player, input_seq_type seqtype) {
return sol::make_user(m.type_seq(type, player, seqtype));
});
- sol().registry().set_usertype("ioport", ioport_manager_type);
+ sol().registry().set("ioport", ioport_manager_type);
/* natural_keyboard library
@@ -1983,13 +1983,13 @@ void lua_engine::initialize()
* natkeyboard.in_use - is the natural keyboard in use?
*/
- auto natkeyboard_type = sol().registry().create_simple_usertype<natural_keyboard>("new", sol::no_constructor);
+ auto natkeyboard_type = sol().registry().new_usertype<natural_keyboard>("new", sol::no_constructor);
natkeyboard_type.set("empty", sol::property(&natural_keyboard::empty));
natkeyboard_type.set("in_use", sol::property(&natural_keyboard::in_use, &natural_keyboard::set_in_use));
natkeyboard_type.set("paste", &natural_keyboard::paste);
natkeyboard_type.set("post", [](natural_keyboard &nat, const std::string &text) { nat.post_utf8(text); });
natkeyboard_type.set("post_coded", [](natural_keyboard &nat, const std::string &text) { nat.post_coded(text); });
- sol().registry().set_usertype("natkeyboard", natkeyboard_type);
+ sol().registry().set("natkeyboard", natkeyboard_type);
/* ioport_port library
@@ -2006,7 +2006,7 @@ void lua_engine::initialize()
* port.fields[] - get ioport_field table (k=name, v=ioport_field)
*/
- auto ioport_port_type = sol().registry().create_simple_usertype<ioport_port>("new", sol::no_constructor);
+ auto ioport_port_type = sol().registry().new_usertype<ioport_port>("new", sol::no_constructor);
ioport_port_type.set("tag", &ioport_port::tag);
ioport_port_type.set("active", &ioport_port::active);
ioport_port_type.set("live", &ioport_port::live);
@@ -2033,7 +2033,7 @@ void lua_engine::initialize()
}
return f_table;
}));
- sol().registry().set_usertype("ioport_port", ioport_port_type);
+ sol().registry().set("ioport_port", ioport_port_type);
/* ioport_field library
@@ -2078,7 +2078,7 @@ void lua_engine::initialize()
* field.settings[] - ioport_setting table (k=value, v=name)
*/
- auto ioport_field_type = sol().registry().create_simple_usertype<ioport_field>("new", sol::no_constructor);
+ auto ioport_field_type = sol().registry().new_usertype<ioport_field>("new", sol::no_constructor);
ioport_field_type.set("set_value", &ioport_field::set_value);
ioport_field_type.set("set_input_seq", [](ioport_field &f, const std::string &seq_type_string, sol::user<input_seq> seq) {
input_seq_type seq_type = s_seq_type_parser(seq_type_string);
@@ -2164,7 +2164,7 @@ void lua_engine::initialize()
result[setting.value()] = setting.name();
return result;
}));
- sol().registry().set_usertype("ioport_field", ioport_field_type);
+ sol().registry().set("ioport_field", ioport_field_type);
/* ioport_field_live library
@@ -2211,7 +2211,7 @@ void lua_engine::initialize()
* video.throttle_rate - throttle rate
*/
- auto video_type = sol().registry().create_simple_usertype<video_manager>("new", sol::no_constructor);
+ auto video_type = sol().registry().new_usertype<video_manager>("new", sol::no_constructor);
video_type.set("begin_recording", sol::overload(
[this](video_manager &vm, const char *filename, const char *format_string) {
std::string fn = process_snapshot_filename(machine(), filename);
@@ -2259,7 +2259,7 @@ void lua_engine::initialize()
video_type.set("frameskip", sol::property(&video_manager::frameskip, &video_manager::set_frameskip));
video_type.set("throttled", sol::property(&video_manager::throttled, &video_manager::set_throttled));
video_type.set("throttle_rate", sol::property(&video_manager::throttle_rate, &video_manager::set_throttle_rate));
- sol().registry().set_usertype("video", video_type);
+ sol().registry().set("video", video_type);
/* sound_manager library
@@ -2275,7 +2275,7 @@ void lua_engine::initialize()
* sound.attenuation - sound attenuation
*/
- auto sound_type = sol().registry().create_simple_usertype<sound_manager>("new", sol::no_constructor);
+ auto sound_type = sol().registry().new_usertype<sound_manager>("new", sol::no_constructor);
sound_type.set("start_recording", &sound_manager::start_recording);
sound_type.set("stop_recording", &sound_manager::stop_recording);
sound_type.set("ui_mute", &sound_manager::ui_mute);
@@ -2291,7 +2291,7 @@ void lua_engine::initialize()
return sol::make_reference(L, sol::stack_reference(L, -1));
});
sound_type.set("attenuation", sol::property(&sound_manager::attenuation, &sound_manager::set_attenuation));
- sol().registry().set_usertype("sound", sound_type);
+ sol().registry().set("sound", sound_type);
/* input_manager library
@@ -2314,7 +2314,7 @@ void lua_engine::initialize()
* input.device_classes - returns device classes
*/
- auto input_type = sol().registry().create_simple_usertype<input_manager>("new", sol::no_constructor);
+ auto input_type = sol().registry().new_usertype<input_manager>("new", sol::no_constructor);
input_type.set("code_from_token", [](input_manager &input, const char *token) { return sol::make_user(input.code_from_token(token)); });
input_type.set("code_pressed", [](input_manager &input, sol::user<input_code> code) { return input.code_pressed(code); });
input_type.set("code_to_token", [](input_manager &input, sol::user<input_code> code) { return input.code_to_token(code); });
@@ -2379,7 +2379,7 @@ void lua_engine::initialize()
}
return result;
}));
- sol().registry().set_usertype("input", input_type);
+ sol().registry().set("input", input_type);
/* input_class library
@@ -2392,7 +2392,7 @@ void lua_engine::initialize()
* devclass.devices[]
*/
- auto input_class_type = sol().registry().create_simple_usertype<input_class>("new", sol::no_constructor);
+ auto input_class_type = sol().registry().new_usertype<input_class>("new", sol::no_constructor);
input_class_type.set("name", sol::property(&input_class::name));
input_class_type.set("enabled", sol::property(&input_class::enabled, &input_class::enable));
input_class_type.set("multi", sol::property(&input_class::multi, &input_class::set_multi));
@@ -2407,7 +2407,7 @@ void lua_engine::initialize()
}
return result;
}));
- sol().registry().set_usertype("input_class", input_class_type);
+ sol().registry().set("input_class", input_class_type);
/* input_device library
@@ -2419,7 +2419,7 @@ void lua_engine::initialize()
* device.items[]
*/
- auto input_device_type = sol().registry().create_simple_usertype<input_device>("new", sol::no_constructor);
+ auto input_device_type = sol().registry().new_usertype<input_device>("new", sol::no_constructor);
input_device_type.set("name", sol::property(&input_device::name));
input_device_type.set("id", sol::property(&input_device::id));
input_device_type.set("devindex", sol::property(&input_device::devindex));
@@ -2433,7 +2433,7 @@ void lua_engine::initialize()
}
return result;
}));
- sol().registry().set_usertype("input_device", input_device_type);
+ sol().registry().set("input_device", input_device_type);
/* input_device_item library
@@ -2444,14 +2444,14 @@ void lua_engine::initialize()
* item:code()
*/
- auto input_device_item_type = sol().registry().create_simple_usertype<input_device_item>("new", sol::no_constructor);
+ auto input_device_item_type = sol().registry().new_usertype<input_device_item>("new", sol::no_constructor);
input_device_item_type.set("name", sol::property(&input_device_item::name));
input_device_item_type.set("token", sol::property(&input_device_item::token));
input_device_item_type.set("code", [](input_device_item &item) {
input_code code(item.device().devclass(), item.device().devindex(), item.itemclass(), ITEM_MODIFIER_NONE, item.itemid());
return sol::make_user(code);
});
- sol().registry().set_usertype("input_device_item", input_device_item_type);
+ sol().registry().set("input_device_item", input_device_item_type);
/* ui_input_manager library
@@ -2463,7 +2463,7 @@ void lua_engine::initialize()
* uiinput.presses_enabled - enable/disable ui key presses
*/
- auto uiinput_type = sol().registry().create_simple_usertype<ui_input_manager>("new", sol::no_constructor);
+ auto uiinput_type = sol().registry().new_usertype<ui_input_manager>("new", sol::no_constructor);
uiinput_type.set("find_mouse", [](ui_input_manager &ui) {
int32_t x, y;
bool button;
@@ -2472,7 +2472,7 @@ void lua_engine::initialize()
});
uiinput_type.set("pressed", &ui_input_manager::pressed);
uiinput_type.set("presses_enabled", sol::property(&ui_input_manager::presses_enabled, &ui_input_manager::set_presses_enabled));
- sol().registry().set_usertype("uiinput", uiinput_type);
+ sol().registry().set("uiinput", uiinput_type);
/* render_target library
@@ -2496,7 +2496,7 @@ void lua_engine::initialize()
* target.zoom - enable zoom
*/
- auto target_type = sol().registry().create_simple_usertype<render_target>("new", sol::no_constructor);
+ auto target_type = sol().registry().new_usertype<render_target>("new", sol::no_constructor);
target_type.set("view_bounds", [](render_target &rt) {
const render_bounds b = rt.current_view().bounds();
return std::tuple<float, float, float, float>(b.x0, b.x1, b.y0, b.y1);
@@ -2513,7 +2513,7 @@ void lua_engine::initialize()
target_type.set("orientation", sol::property(&render_target::orientation, &render_target::set_orientation));
target_type.set("screen_overlay", sol::property(&render_target::screen_overlay_enabled, &render_target::set_screen_overlay_enabled));
target_type.set("zoom", sol::property(&render_target::zoom_to_screen, &render_target::set_zoom_to_screen));
- sol().registry().set_usertype("target", target_type);
+ sol().registry().set("target", target_type);
/* render_container library
@@ -2528,14 +2528,14 @@ void lua_engine::initialize()
* container:is_empty()
*/
- auto render_container_type = sol().registry().create_simple_usertype<render_container>("new", sol::no_constructor);
+ auto render_container_type = sol().registry().new_usertype<render_container>("new", sol::no_constructor);
render_container_type.set("orientation", &render_container::orientation);
render_container_type.set("xscale", &render_container::xscale);
render_container_type.set("yscale", &render_container::yscale);
render_container_type.set("xoffset", &render_container::xoffset);
render_container_type.set("yoffset", &render_container::yoffset);
render_container_type.set("is_empty", &render_container::is_empty);
- sol().registry().set_usertype("render_container", render_container_type);
+ sol().registry().set("render_container", render_container_type);
/* render_manager library
@@ -2549,7 +2549,7 @@ void lua_engine::initialize()
* render.targets[] - render_target table
*/
- auto render_type = sol().registry().create_simple_usertype<render_manager>("new", sol::no_constructor);
+ auto render_type = sol().registry().new_usertype<render_manager>("new", sol::no_constructor);
render_type.set("max_update_rate", &render_manager::max_update_rate);
render_type.set("ui_target", &render_manager::ui_target);
render_type.set("ui_container", &render_manager::ui_container);
@@ -2560,7 +2560,7 @@ void lua_engine::initialize()
target_table[tc++] = &curr_rt;
return target_table;
}));
- sol().registry().set_usertype("render", render_type);
+ sol().registry().set("render", render_type);
/* screen_device library
@@ -2590,7 +2590,7 @@ void lua_engine::initialize()
* screen:time_until_pos(vpos, hpos) - get the time until this screen pos is reached
*/
- auto screen_dev_type = sol().registry().create_simple_usertype<screen_device>("new", sol::no_constructor);
+ auto screen_dev_type = sol().registry().new_usertype<screen_device>("new", sol::no_constructor);
screen_dev_type.set("draw_box", [](screen_device &sdev, float x1, float y1, float x2, float y2, uint32_t bgcolor, uint32_t fgcolor) {
int sc_width = sdev.visible_area().width();
int sc_height = sdev.visible_area().height();
@@ -2717,7 +2717,7 @@ void lua_engine::initialize()
return sol::make_reference(L, sol::stack_reference(L, -1));
});
screen_dev_type.set("time_until_pos", [](screen_device &sdev, int vpos, int hpos) { return sdev.time_until_pos(vpos, hpos).as_double(); });
- sol().registry().set_usertype("screen_dev", screen_dev_type);
+ sol().registry().set("screen_dev", screen_dev_type);
/* mame_ui_manager library
@@ -2736,7 +2736,7 @@ void lua_engine::initialize()
* ui.show_profiler - profiler display enabled
*/
- auto ui_type = sol().registry().create_simple_usertype<mame_ui_manager>("new", sol::no_constructor);
+ auto ui_type = sol().registry().new_usertype<mame_ui_manager>("new", sol::no_constructor);
ui_type.set("is_menu_active", &mame_ui_manager::is_menu_active);
ui_type.set("options", [](mame_ui_manager &m) { return static_cast<core_options *>(&m.options()); });
ui_type.set("show_fps", sol::property(&mame_ui_manager::show_fps, &mame_ui_manager::set_show_fps));
@@ -2747,7 +2747,7 @@ void lua_engine::initialize()
// sol converts char32_t to a string
ui_type.set("get_char_width", [](mame_ui_manager &m, uint32_t utf8char) { return m.get_char_width(utf8char); });
ui_type.set("set_aggressive_input_focus", [](mame_ui_manager &m, bool aggressive_focus) { osd_set_aggressive_input_focus(aggressive_focus); });
- sol().registry().set_usertype("ui", ui_type);
+ sol().registry().set("ui", ui_type);
/* device_state_entry library
@@ -2761,7 +2761,7 @@ void lua_engine::initialize()
* state.value - get device state value
*/
- auto dev_space_type = sol().registry().create_simple_usertype<device_state_entry>("new", sol::no_constructor);
+ auto dev_space_type = sol().registry().new_usertype<device_state_entry>("new", sol::no_constructor);
dev_space_type.set("name", &device_state_entry::symbol);
dev_space_type.set("value", sol::property(
[this](device_state_entry &entry) -> uint64_t {
@@ -2783,7 +2783,7 @@ void lua_engine::initialize()
}));
dev_space_type.set("is_visible", &device_state_entry::visible);
dev_space_type.set("is_divider", &device_state_entry::divider);
- sol().registry().set_usertype("dev_space", dev_space_type);
+ sol().registry().set("dev_space", dev_space_type);
/* rom_entry library
@@ -2797,13 +2797,13 @@ void lua_engine::initialize()
* rom:flags() - see romentry.h
*/
- auto rom_entry_type = sol().registry().create_simple_usertype<rom_entry>("new", sol::no_constructor);
+ auto rom_entry_type = sol().registry().new_usertype<rom_entry>("new", sol::no_constructor);
rom_entry_type.set("name", &rom_entry::name);
rom_entry_type.set("hashdata", &rom_entry::hashdata);
rom_entry_type.set("offset", &rom_entry::get_offset);
rom_entry_type.set("length", &rom_entry::get_length);
rom_entry_type.set("flags", &rom_entry::get_flags);
- sol().registry().set_usertype("rom_entry", rom_entry_type);
+ sol().registry().set("rom_entry", rom_entry_type);
/* memory_manager library
@@ -2815,7 +2815,7 @@ void lua_engine::initialize()
* memory.shares[] - table of memory shares (k=tag, v=memory_share)
*/
- auto memory_type = sol().registry().create_simple_usertype<memory_manager>("new", sol::no_constructor);
+ auto memory_type = sol().registry().new_usertype<memory_manager>("new", sol::no_constructor);
memory_type.set("banks", sol::property([this](memory_manager &mm) {
sol::table table = sol().create_table();
for (auto &bank : mm.banks())
@@ -2834,7 +2834,7 @@ void lua_engine::initialize()
table[share.first] = share.second.get();
return table;
}));
- sol().registry().set_usertype("memory", memory_type);
+ sol().registry().set("memory", memory_type);
/* memory_region library
@@ -2848,7 +2848,7 @@ void lua_engine::initialize()
* region.size
*/
- auto region_type = sol().registry().create_simple_usertype<memory_region>("new", sol::no_constructor);
+ auto region_type = sol().registry().new_usertype<memory_region>("new", sol::no_constructor);
region_type.set("read_i8", &region_read<int8_t>);
region_type.set("read_u8", &region_read<uint8_t>);
region_type.set("read_i16", &region_read<int16_t>);
@@ -2866,7 +2866,7 @@ void lua_engine::initialize()
region_type.set("write_i64", &region_write<int64_t>);
region_type.set("write_u64", &region_write<uint64_t>);
region_type.set("size", sol::property(&memory_region::bytes));
- sol().registry().set_usertype("region", region_type);
+ sol().registry().set("region", region_type);
/* memory_share library
@@ -2880,7 +2880,7 @@ void lua_engine::initialize()
* region.size
*/
- auto share_type = sol().registry().create_simple_usertype<memory_share>("new", sol::no_constructor);
+ auto share_type = sol().registry().new_usertype<memory_share>("new", sol::no_constructor);
share_type.set("read_i8", &share_read<int8_t>);
share_type.set("read_u8", &share_read<uint8_t>);
share_type.set("read_i16", &share_read<int16_t>);
@@ -2898,7 +2898,7 @@ void lua_engine::initialize()
share_type.set("write_i64", &share_write<int64_t>);
share_type.set("write_u64", &share_write<uint64_t>);
share_type.set("size", sol::property(&memory_share::bytes));
- sol().registry().set_usertype("share", share_type);
+ sol().registry().set("share", share_type);
/* output_manager library
@@ -2913,7 +2913,7 @@ void lua_engine::initialize()
* outputs:id_to_name(index) - get name for index
*/
- auto output_type = sol().registry().create_simple_usertype<output_manager>("new", sol::no_constructor);
+ auto output_type = sol().registry().new_usertype<output_manager>("new", sol::no_constructor);
output_type.set("set_value", &output_manager::set_value);
output_type.set("set_indexed_value", [](output_manager &o, char const *basename, int index, int value) {
o.set_value(util::string_format("%s%d", basename, index).c_str(), value);
@@ -2924,7 +2924,7 @@ void lua_engine::initialize()
});
output_type.set("name_to_id", &output_manager::name_to_id);
output_type.set("id_to_name", &output_manager::id_to_name);
- sol().registry().set_usertype("output", output_type);
+ sol().registry().set("output", output_type);
/* device_image_interface library
@@ -2956,7 +2956,7 @@ void lua_engine::initialize()
* image.must_be_loaded
*/
- auto image_type = sol().registry().create_simple_usertype<device_image_interface>("new", sol::no_constructor);
+ auto image_type = sol().registry().new_usertype<device_image_interface>("new", sol::no_constructor);
image_type.set("exists", &device_image_interface::exists);
image_type.set("filename", &device_image_interface::filename);
image_type.set("longname", &device_image_interface::longname);
@@ -2982,7 +2982,7 @@ void lua_engine::initialize()
image_type.set("is_creatable", sol::property(&device_image_interface::is_creatable));
image_type.set("is_reset_on_load", sol::property(&device_image_interface::is_reset_on_load));
image_type.set("must_be_loaded", sol::property(&device_image_interface::must_be_loaded));
- sol().registry().set_usertype("image", image_type);
+ sol().registry().set("image", image_type);
/* mame_machine_manager library
diff --git a/src/frontend/mame/luaengine.h b/src/frontend/mame/luaengine.h
index 28bf3b60ca2..a158b496bdd 100644
--- a/src/frontend/mame/luaengine.h
+++ b/src/frontend/mame/luaengine.h
@@ -22,9 +22,8 @@
#pragma GCC diagnostic ignored "-Wnoexcept-type"
#endif
-#define SOL_SAFE_USERTYPE
-//#define SOL_CHECK_ARGUMENTS
-#include "sol2/sol.hpp"
+#define SOL_SAFE_USERTYPE 1
+#include "sol/sol.hpp"
struct lua_State;
diff --git a/src/frontend/mame/ui/filesel.cpp b/src/frontend/mame/ui/filesel.cpp
index 19567b33659..2461cd9d231 100644
--- a/src/frontend/mame/ui/filesel.cpp
+++ b/src/frontend/mame/ui/filesel.cpp
@@ -202,7 +202,7 @@ menu_file_selector::file_selector_entry &menu_file_selector::append_entry(
entry.fullpath = std::move(entry_fullpath);
// find the end of the list
- return *m_entrylist.emplace(m_entrylist.end(), std::move(entry));
+ return m_entrylist.emplace_back(std::move(entry));
}
diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp
index bfb68e40da0..c0a36642e5d 100644
--- a/src/frontend/mame/ui/inputmap.cpp
+++ b/src/frontend/mame/ui/inputmap.cpp
@@ -84,7 +84,7 @@ void menu_input_general::populate(float &customtop, float &custombottom)
for (input_seq_type seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; ++seqtype)
{
// build an entry for the standard sequence
- input_item_data &item(*data.emplace(data.end()));
+ input_item_data &item(data.emplace_back());
item.ref = &entry;
item.seqtype = seqtype;
item.seq = machine().ioport().type_seq(entry.type(), entry.player(), seqtype);
@@ -155,7 +155,7 @@ void menu_input_specific::populate(float &customtop, float &custombottom)
for (input_seq_type seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; ++seqtype)
{
// build an entry for the standard sequence
- input_item_data &item(*data.emplace(data.end()));
+ input_item_data &item(data.emplace_back());
item.ref = &field;
item.seqtype = seqtype;
item.seq = field.seq(seqtype);
diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp
index 5cdff331c21..e5c5d1862ae 100644
--- a/src/frontend/mame/ui/miscmenu.cpp
+++ b/src/frontend/mame/ui/miscmenu.cpp
@@ -367,7 +367,7 @@ void menu_crosshair::populate(float &customtop, float &custombottom)
if (crosshair.is_used())
{
// CROSSHAIR_ITEM_VIS - allocate a data item and fill it
- crosshair_item_data &visdata(*m_data.emplace(m_data.end()));
+ crosshair_item_data &visdata(m_data.emplace_back());
visdata.crosshair = &crosshair;
visdata.type = CROSSHAIR_ITEM_VIS;
visdata.player = player;
@@ -376,7 +376,7 @@ void menu_crosshair::populate(float &customtop, float &custombottom)
visdata.defvalue = CROSSHAIR_VISIBILITY_DEFAULT;
// CROSSHAIR_ITEM_PIC - allocate a data item and fill it
- crosshair_item_data &picdata(*m_data.emplace(m_data.end()));
+ crosshair_item_data &picdata(m_data.emplace_back());
picdata.crosshair = &crosshair;
picdata.type = CROSSHAIR_ITEM_PIC;
picdata.player = player;
@@ -385,7 +385,7 @@ void menu_crosshair::populate(float &customtop, float &custombottom)
}
// CROSSHAIR_ITEM_AUTO_TIME - allocate a data item and fill it
- crosshair_item_data &timedata(*m_data.emplace(m_data.end()));
+ crosshair_item_data &timedata(m_data.emplace_back());
timedata.type = CROSSHAIR_ITEM_AUTO_TIME;
timedata.min = CROSSHAIR_VISIBILITY_AUTOTIME_MIN;
timedata.max = CROSSHAIR_VISIBILITY_AUTOTIME_MAX;
diff --git a/src/frontend/mame/ui/viewgfx.cpp b/src/frontend/mame/ui/viewgfx.cpp
index bc6dee9cd47..fb3ecc1cacd 100644
--- a/src/frontend/mame/ui/viewgfx.cpp
+++ b/src/frontend/mame/ui/viewgfx.cpp
@@ -307,9 +307,8 @@ again:
break;
}
- // fall through...
state.mode++;
-
+ [[fallthrough]];
case UI_GFX_GFXSET:
// if we have graphics sets, display them
if (state.gfxset.devcount > 0)
@@ -318,9 +317,8 @@ again:
break;
}
- // fall through...
state.mode++;
-
+ [[fallthrough]];
case UI_GFX_TILEMAP:
// if we have tilemaps, display them
if (mui.machine().tilemap().count() > 0)