summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--docs/source/luascript/ref-common.rst20
-rw-r--r--src/frontend/mame/luaengine.cpp16
-rw-r--r--src/mame/sega/sega_beena.cpp2
3 files changed, 15 insertions, 23 deletions
diff --git a/docs/source/luascript/ref-common.rst b/docs/source/luascript/ref-common.rst
index a68a832b88f..85bd580a144 100644
--- a/docs/source/luascript/ref-common.rst
+++ b/docs/source/luascript/ref-common.rst
@@ -58,23 +58,21 @@ classes are also available as properties of the emulator interface.
Methods
~~~~~~~
-emu.wait(duration, …)
+emu.wait(duration)
Yields for the specified duration in terms of emulated time. The duration
may be specified as an :ref:`attotime <luascript-ref-attotime>` or a number
- in seconds. Any additional arguments are returned to the caller. Returns a
- Boolean indicating whether the duration expired normally.
+ in seconds. Returns a Boolean indicating whether the duration expired
+ normally.
All outstanding calls to ``emu.wait`` will return ``false`` immediately if a
saved state is loaded or the emulation session ends. Calling this function
from callbacks that are not run as coroutines will raise an error.
-emu.wait_next_update(…)
- Yields until the next video/UI update. Any arguments are returned to the
- caller. Calling this function from callbacks that are not run as coroutines
- will raise an error.
-emu.wait_next_frame(…)
- Yields until the next emulated frame completes. Any arguments are returned
- to the caller. Calling this function from callbacks that are not run as
- coroutines will raise an error.
+emu.wait_next_update()
+ Yields until the next video/UI update. Calling this function from callbacks
+ that are not run as coroutines will raise an error.
+emu.wait_next_frame()
+ Yields until the next emulated frame completes. Calling this function from
+ callbacks that are not run as coroutines will raise an error.
emu.add_machine_reset_notifier(callback)
Add a callback to receive notifications when the emulated system is reset.
Returns a :ref:`notifier subscription <luascript-ref-notifiersub>`.
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index d0d98419061..9a570b1803a 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -679,8 +679,7 @@ void lua_engine::on_machine_frame()
{
std::vector<int> tasks = std::move(m_frame_tasks);
m_frame_tasks.clear();
- for (int ref : tasks)
- resume(ref);
+ resume_tasks(m_lua_state, tasks, true); // TODO: doesn't need to return anything
m_notifiers->on_frame();
@@ -816,7 +815,7 @@ void lua_engine::initialize()
sol::table emu = sol().create_named_table("emu");
emu["wait"] = sol::yielding(
- [this] (sol::this_state s, sol::object duration, sol::variadic_args args)
+ [this] (sol::this_state s, sol::object duration)
{
attotime delay;
if (!duration)
@@ -849,26 +848,22 @@ void lua_engine::initialize()
if (m_waiting_tasks.begin() == pos)
m_timer->reset(delay);
m_waiting_tasks.emplace(pos, expiry, ref);
-
- return sol::variadic_results(args.begin(), args.end());
});
emu["wait_next_update"] = sol::yielding(
- [this] (sol::this_state s, sol::variadic_args args)
+ [this] (sol::this_state s)
{
int const ret = lua_pushthread(s);
if (ret == 1)
luaL_error(s, "cannot wait from outside coroutine");
m_update_tasks.emplace_back(luaL_ref(s, LUA_REGISTRYINDEX));
- return sol::variadic_results(args.begin(), args.end());
});
emu["wait_next_frame"] = sol::yielding(
- [this] (sol::this_state s, sol::variadic_args args)
+ [this] (sol::this_state s)
{
int const ret = lua_pushthread(s);
if (ret == 1)
luaL_error(s, "cannot wait from outside coroutine");
m_frame_tasks.emplace_back(luaL_ref(s, LUA_REGISTRYINDEX));
- return sol::variadic_results(args.begin(), args.end());
});
emu.set_function("add_machine_reset_notifier", make_notifier_adder(m_notifiers->on_reset, "machine reset"));
emu.set_function("add_machine_stop_notifier", make_notifier_adder(m_notifiers->on_stop, "machine stop"));
@@ -2144,8 +2139,7 @@ bool lua_engine::frame_hook()
{
std::vector<int> tasks = std::move(m_update_tasks);
m_update_tasks.clear();
- for (int ref : tasks)
- resume(ref);
+ resume_tasks(m_lua_state, tasks, true); // TODO: doesn't need to return anything
return execute_function("LUA_ON_FRAME_DONE");
}
diff --git a/src/mame/sega/sega_beena.cpp b/src/mame/sega/sega_beena.cpp
index b1058da6e8a..daad7124a1f 100644
--- a/src/mame/sega/sega_beena.cpp
+++ b/src/mame/sega/sega_beena.cpp
@@ -2228,5 +2228,5 @@ ROM_END
} // anonymous namespace
// year, name, parent, compat, machine, input, class, init, company, fullname, flags
-CONS( 2005, beena, 0, 0, sega_beena, sega_beena, sega_beena_state, empty_init, "Sega", "Advanced Pico BEENA", MACHINE_REQUIRES_ARTWORK|MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_TIMING|MACHINE_IMPERFECT_SOUND )
+CONS( 2005, beena, 0, 0, sega_beena, sega_beena, sega_beena_state, empty_init, "Sega", "Advanced Pico BEENA", MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_TIMING|MACHINE_IMPERFECT_SOUND )
CONS( 2005, tvochken, 0, 0, sega_9h0_0008, tvochken, tvochken_state, empty_init, "Sega", "TV Ocha-Ken", MACHINE_REQUIRES_ARTWORK|MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_TIMING|MACHINE_IMPERFECT_SOUND )