mirror of
https://github.com/holub/mame
synced 2025-06-07 05:13:46 +03:00
Exposing ioport_manager::type_group() and ioport_field::keyboard_codes()
to LUA
This commit is contained in:
parent
70f176f74f
commit
225ef45b7d
@ -1709,6 +1709,7 @@ void lua_engine::initialize()
|
|||||||
* manager:machine():ioport()
|
* manager:machine():ioport()
|
||||||
*
|
*
|
||||||
* ioport:count_players() - get count of player controllers
|
* ioport:count_players() - get count of player controllers
|
||||||
|
* ioport:type_group(type, player)
|
||||||
*
|
*
|
||||||
* ioport.ports[] - ioports table (k=tag, v=ioport_port)
|
* ioport.ports[] - ioports table (k=tag, v=ioport_port)
|
||||||
*/
|
*/
|
||||||
@ -1716,6 +1717,9 @@ void lua_engine::initialize()
|
|||||||
sol().registry().new_usertype<ioport_manager>("ioport", "new", sol::no_constructor,
|
sol().registry().new_usertype<ioport_manager>("ioport", "new", sol::no_constructor,
|
||||||
"count_players", &ioport_manager::count_players,
|
"count_players", &ioport_manager::count_players,
|
||||||
"natkeyboard", &ioport_manager::natkeyboard,
|
"natkeyboard", &ioport_manager::natkeyboard,
|
||||||
|
"type_group", [](ioport_manager &im, ioport_type type, int player) {
|
||||||
|
return im.type_group(type, player);
|
||||||
|
},
|
||||||
"ports", sol::property([this](ioport_manager &im) {
|
"ports", sol::property([this](ioport_manager &im) {
|
||||||
sol::table port_table = sol().create_table();
|
sol::table port_table = sol().create_table();
|
||||||
for (auto &port : im.ports())
|
for (auto &port : im.ports())
|
||||||
@ -1795,6 +1799,7 @@ void lua_engine::initialize()
|
|||||||
* field:input_seq(seq_type)
|
* field:input_seq(seq_type)
|
||||||
* field:set_default_input_seq(seq_type, seq)
|
* field:set_default_input_seq(seq_type, seq)
|
||||||
* field:default_input_seq(seq_type)
|
* field:default_input_seq(seq_type)
|
||||||
|
* field:keyboard_codes(which)
|
||||||
*
|
*
|
||||||
* field.device - get associated device_t
|
* field.device - get associated device_t
|
||||||
* field.port - get associated ioport_port
|
* field.port - get associated ioport_port
|
||||||
@ -1846,6 +1851,14 @@ void lua_engine::initialize()
|
|||||||
input_seq_type seq_type = parse_seq_type(seq_type_string);
|
input_seq_type seq_type = parse_seq_type(seq_type_string);
|
||||||
return sol::make_user(f.defseq(seq_type));
|
return sol::make_user(f.defseq(seq_type));
|
||||||
},
|
},
|
||||||
|
"keyboard_codes", [this](ioport_field &f, int which)
|
||||||
|
{
|
||||||
|
sol::table result = sol().create_table();
|
||||||
|
int index = 1;
|
||||||
|
for (char32_t code : f.keyboard_codes(which))
|
||||||
|
result[index++] = code;
|
||||||
|
return result;
|
||||||
|
},
|
||||||
"device", sol::property(&ioport_field::device),
|
"device", sol::property(&ioport_field::device),
|
||||||
"port", sol::property(&ioport_field::port),
|
"port", sol::property(&ioport_field::port),
|
||||||
"name", sol::property(&ioport_field::name),
|
"name", sol::property(&ioport_field::name),
|
||||||
|
Loading…
Reference in New Issue
Block a user