Skip to content

Commit

Permalink
-luaengine.cpp: Expose UI controls toggle state.
Browse files Browse the repository at this point in the history
-ui/ui.cpp: Honour UI enable for machines without keyboards.
  • Loading branch information
cuavas committed Mar 22, 2023
1 parent 00f317b commit dda5f71
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/source/techspecs/luareference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ machine:logerror(msg)
Properties
^^^^^^^^^^

machine.ui_active (read/write)
A Boolean indicating whether UI control inputs are currently enabled.
machine.time (read-only)
The elapsed emulated time for the current session as an
:ref:`attotime <luareference-core-attotime>`.
Expand Down
2 changes: 1 addition & 1 deletion src/emu/machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ running_machine::running_machine(const machine_config &_config, machine_manager
m_exit_pending(false),
m_soft_reset_timer(nullptr),
m_rand_seed(0x9d14abd7),
m_ui_active(_config.options().ui_active()),
m_ui_active(true),
m_basename(_config.gamedrv().name),
m_sample_rate(_config.options().sample_rate()),
m_saveload_schedule(saveload_schedule::NONE),
Expand Down
1 change: 1 addition & 0 deletions src/frontend/mame/luaengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,7 @@ void lua_engine::initialize()
m.popmessage();
});
machine_type.set_function("logerror", [] (running_machine &m, char const *str) { m.logerror("[luaengine] %s\n", str); });
machine_type["ui_active"] = sol::property(&running_machine::ui_active, &running_machine::set_ui_active);
machine_type["time"] = sol::property(&running_machine::time);
machine_type["system"] = sol::property(&running_machine::system);
machine_type["parameters"] = sol::property(&running_machine::parameters);
Expand Down
5 changes: 3 additions & 2 deletions src/frontend/mame/ui/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ void mame_ui_manager::config_save(config_type cfg_type, util::xml::data_node *pa
void mame_ui_manager::initialize(running_machine &machine)
{
m_machine_info = std::make_unique<ui::machine_info>(machine);
machine.set_ui_active(!machine_info().has_keyboard() || machine.options().ui_active());

// initialize the on-screen display system
slider_list = slider_init(machine);
Expand Down Expand Up @@ -1241,8 +1242,8 @@ uint32_t mame_ui_manager::handler_ingame(render_container &container)
}

// determine if we should disable the rest of the UI
bool has_keyboard = machine_info().has_keyboard();
bool ui_disabled = (has_keyboard && !machine().ui_active());
bool const has_keyboard = machine_info().has_keyboard();
bool const ui_disabled = !machine().ui_active();

// is ScrLk UI toggling applicable here?
if (has_keyboard)
Expand Down

0 comments on commit dda5f71

Please sign in to comment.