summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Miodrag Milanović <mmicko@gmail.com>2014-12-05 11:12:39 +0100
committerGravatarGravatar Miodrag Milanović <mmicko@gmail.com>2014-12-05 11:12:39 +0100
commit6c3f5a6ae1def5ff5dac0158f272bca0e1e10657 (patch) (github)
tree715edf9c598a77bab7336c2037900df7a700a857
parent4214f3b77932790ef29a06ee016e568927375aba (diff)
parent08fdec96740bc8af6ed0de71426ef63057daddba (diff)
downloadmame-6c3f5a6ae1def5ff5dac0158f272bca0e1e10657.tar.bz2
mame-6c3f5a6ae1def5ff5dac0158f272bca0e1e10657.zip
Merge pull request #64 from lucab/lucab/mame-rr
luaengine: add romname() and pause()/unpause()
-rw-r--r--src/emu/luaengine.c29
-rw-r--r--src/emu/luaengine.h3
2 files changed, 32 insertions, 0 deletions
diff --git a/src/emu/luaengine.c b/src/emu/luaengine.c
index 510f29eb8bb..4c27f1bf35f 100644
--- a/src/emu/luaengine.c
+++ b/src/emu/luaengine.c
@@ -207,6 +207,32 @@ int lua_engine::l_emu_gamename(lua_State *L)
}
//-------------------------------------------------
+// emu_romname - returns rom base name
+//-------------------------------------------------
+
+int lua_engine::l_emu_romname(lua_State *L)
+{
+ lua_pushstring(L, luaThis->machine().basename());
+ return 1;
+}
+
+//-------------------------------------------------
+// emu_pause/emu_unpause - pause/unpause game
+//-------------------------------------------------
+
+int lua_engine::l_emu_pause(lua_State *L)
+{
+ luaThis->machine().pause();
+ return 0;
+}
+
+int lua_engine::l_emu_unpause(lua_State *L)
+{
+ luaThis->machine().resume();
+ return 0;
+}
+
+//-------------------------------------------------
// emu_keypost - post keys to natural keyboard
//-------------------------------------------------
@@ -496,6 +522,7 @@ void lua_engine::initialize()
luabridge::getGlobalNamespace (m_lua_state)
.beginNamespace ("emu")
.addCFunction ("gamename", l_emu_gamename )
+ .addCFunction ("romname", l_emu_romname )
.addCFunction ("keypost", l_emu_keypost )
.addCFunction ("hook_output", l_emu_hook_output )
.addCFunction ("time", l_emu_time )
@@ -503,6 +530,8 @@ void lua_engine::initialize()
.addCFunction ("after", l_emu_after )
.addCFunction ("exit", l_emu_exit )
.addCFunction ("start", l_emu_start )
+ .addCFunction ("pause", l_emu_pause )
+ .addCFunction ("unpause", l_emu_unpause )
.beginClass <machine_manager> ("manager")
.addFunction ("machine", &machine_manager::machine)
.addFunction ("options", &machine_manager::options)
diff --git a/src/emu/luaengine.h b/src/emu/luaengine.h
index ad4712d262f..e6263025f19 100644
--- a/src/emu/luaengine.h
+++ b/src/emu/luaengine.h
@@ -79,10 +79,13 @@ private:
static int l_emu_wait(lua_State *L);
static int l_emu_time(lua_State *L);
static int l_emu_gamename(lua_State *L);
+ static int l_emu_romname(lua_State *L);
static int l_emu_keypost(lua_State *L);
static int l_emu_hook_output(lua_State *L);
static int l_emu_exit(lua_State *L);
static int l_emu_start(lua_State *L);
+ static int l_emu_pause(lua_State *L);
+ static int l_emu_unpause(lua_State *L);
void resume(void *L, INT32 param);
void report_errors(int status);