diff options
author | 2020-12-27 04:27:42 +1100 | |
---|---|---|
committer | 2020-12-27 04:27:42 +1100 | |
commit | a5e6f4ea8d468f8f8e50ad5199a9f8aa9a81e9f1 (patch) | |
tree | 13e47f6a7501b3a5f96d19018e26b0850d1d69ae /src/frontend/mame/luaengine_input.cpp | |
parent | c2f698a95f80512d8fd461bdabf3868cb8edc0c4 (diff) |
Expose a couple more things to Lua so the plugins can show the actual key mapped to UI clear.
Diffstat (limited to 'src/frontend/mame/luaengine_input.cpp')
-rw-r--r-- | src/frontend/mame/luaengine_input.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/frontend/mame/luaengine_input.cpp b/src/frontend/mame/luaengine_input.cpp index 2e13262db78..1dc0f491cb6 100644 --- a/src/frontend/mame/luaengine_input.cpp +++ b/src/frontend/mame/luaengine_input.cpp @@ -142,13 +142,33 @@ void lua_engine::initialize_input(sol::table &emu) auto ioport_manager_type = sol().registry().new_usertype<ioport_manager>("ioport", sol::no_constructor); ioport_manager_type["count_players"] = &ioport_manager::count_players; - ioport_manager_type["type_group"] = &ioport_manager::type_group; - ioport_manager_type["type_seq"] = - [] (ioport_manager &im, ioport_type type, int player, std::string const &seq_type_string) + ioport_manager_type["type_pressed"] = sol::overload( + &ioport_manager::type_pressed, + [] (ioport_manager &im, ioport_type type) { return im.type_pressed(type, 0); }); + ioport_manager_type["type_name"] = sol::overload( + &ioport_manager::type_name, + [] (ioport_manager &im, ioport_type type) { return im.type_name(type, 0); }); + ioport_manager_type["type_group"] = sol::overload( + &ioport_manager::type_group, + [] (ioport_manager &im, ioport_type type) { return im.type_group(type, 0); }); + ioport_manager_type["type_seq"] = sol::overload( + [] (ioport_manager &im, ioport_type type, int player, char const *seq_type_string) + { + input_seq_type seq_type = s_seq_type_parser(seq_type_string); + return im.type_seq(type, player, seq_type); + }, + [] (ioport_manager &im, ioport_type type, int player) { return im.type_seq(type, player, SEQ_TYPE_STANDARD); }, + [] (ioport_manager &im, ioport_type type) { return im.type_seq(type, 0, SEQ_TYPE_STANDARD); }); + ioport_manager_type["token_to_input_type"] = + [] (ioport_manager &im, std::string const &string) { - input_seq_type seq_type = s_seq_type_parser(seq_type_string); - return im.type_seq(type, player, seq_type); + int player; + ioport_type const type = im.token_to_input_type(string.c_str(), player); + return std::make_tuple(type, player); }; + ioport_manager_type["input_type_to_token"] = sol::overload( + &ioport_manager::input_type_to_token, + [] (ioport_manager &im, ioport_type type) { return im.input_type_to_token(type, 0); }); ioport_manager_type["ports"] = sol::property([] (ioport_manager &im) { return tag_object_ptr_map<ioport_list>(im.ports()); }); ioport_manager_type["natkeyboard"] = sol::property(&ioport_manager::natkeyboard); |