diff options
Diffstat (limited to 'src/frontend/mame/luaengine.cpp')
-rw-r--r-- | src/frontend/mame/luaengine.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index 0dde20fe611..6b62cfe726b 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -721,7 +721,7 @@ void lua_engine::initialize() emu["app_version"] = &emulator_info::get_bare_build_version; emu["gamename"] = [this](){ return machine().system().type.fullname(); }; emu["romname"] = [this](){ return machine().basename(); }; - emu["softname"] = [this](){ return machine().options().software_name(); }; + emu["softname"] = [this]() { return machine().options().software_name(); }; emu["keypost"] = [this](const char *keys){ machine().ioport().natkeyboard().post_utf8(keys); }; emu["time"] = [this](){ return machine().time().as_double(); }; emu["start"] = [this](const char *driver) { @@ -1016,9 +1016,11 @@ void lua_engine::initialize() "entries", sol::property([this](core_options &options) { sol::table table = sol().create_table(); int unadorned_index = 0; - for(core_options::entry &curentry : options) + for (auto &curentry : options.entries()) { - const char *name = curentry.name(); + const char *name = curentry->names().size() > 0 + ? curentry->name().c_str() + : nullptr; bool is_unadorned = false; // check if it's unadorned if (name && strlen(name) && !strcmp(name, options.unadorned(unadorned_index))) @@ -1026,8 +1028,8 @@ void lua_engine::initialize() unadorned_index++; is_unadorned = true; } - if (!curentry.is_header() && !curentry.is_command() && !curentry.is_internal() && !is_unadorned) - table[name] = &curentry; + if (curentry->type() != core_options::option_type::HEADER && curentry->type() != core_options::option_type::COMMAND && !is_unadorned) + table[name] = &*curentry; } return table; })); @@ -1068,18 +1070,19 @@ void lua_engine::initialize() e.set_value(val, OPTION_PRIORITY_CMDLINE); }, [this](core_options::entry &e) -> sol::object { - if(!e.type()) + if (e.type() == core_options::option_type::INVALID) return sol::make_object(sol(), sol::nil); switch(e.type()) { - case OPTION_BOOLEAN: + case core_options::option_type::BOOLEAN: return sol::make_object(sol(), atoi(e.value()) != 0); - case OPTION_INTEGER: + case core_options::option_type::INTEGER: return sol::make_object(sol(), atoi(e.value())); - case OPTION_FLOAT: + case core_options::option_type::FLOAT: return sol::make_object(sol(), atof(e.value())); + default: + return sol::make_object(sol(), e.value()); } - return sol::make_object(sol(), e.value()); }), "description", &core_options::entry::description, "default_value", &core_options::entry::default_value, |