summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/luaengine.cpp
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-03-29 08:15:17 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-03-29 08:15:17 +0200
commit699fa1462a56d44b77fa3f0ddab8f65b885f4a8c (patch)
tree3fa9bcc6d0b2e13dd78026e42a20a63971a89906 /src/emu/luaengine.cpp
parent1d84a0c3aafa46899a35fcd2945fb6a493037992 (diff)
Add ability for notifiers to add at front, fix for hiscore [Carl]
Diffstat (limited to 'src/emu/luaengine.cpp')
-rw-r--r--src/emu/luaengine.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp
index cd392de3c89..18ae0172bf7 100644
--- a/src/emu/luaengine.cpp
+++ b/src/emu/luaengine.cpp
@@ -1319,6 +1319,11 @@ int lua_engine::register_function(lua_State *L, const char *id)
return 1;
}
+int lua_engine::l_emu_register_prestart(lua_State *L)
+{
+ return register_function(L, "LUA_ON_PRESTART");
+}
+
int lua_engine::l_emu_register_start(lua_State *L)
{
return register_function(L, "LUA_ON_START");
@@ -1344,6 +1349,11 @@ int lua_engine::l_emu_register_frame(lua_State *L)
return register_function(L, "LUA_ON_FRAME");
}
+void lua_engine::on_machine_prestart()
+{
+ execute_function("LUA_ON_PRESTART");
+}
+
void lua_engine::on_machine_start()
{
execute_function("LUA_ON_START");
@@ -1393,6 +1403,7 @@ void lua_engine::update_machine()
void lua_engine::attach_notifiers()
{
+ machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(lua_engine::on_machine_prestart), this), true);
machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(lua_engine::on_machine_start), this));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(lua_engine::on_machine_stop), this));
machine().add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(lua_engine::on_machine_pause), this));
@@ -1439,6 +1450,7 @@ void lua_engine::initialize()
.addCFunction ("start", l_emu_start )
.addCFunction ("pause", l_emu_pause )
.addCFunction ("unpause", l_emu_unpause )
+ .addCFunction ("register_prestart", l_emu_register_prestart )
.addCFunction ("register_start", l_emu_register_start )
.addCFunction ("register_stop", l_emu_register_stop )
.addCFunction ("register_pause", l_emu_register_pause )