summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2020-02-16 17:57:39 -0500
committer AJR <ajrhacker@users.noreply.github.com>2020-02-16 17:59:44 -0500
commit94c03c61eec2349df6182890f092a640a8911d55 (patch)
tree7e18d33bea8aa66139337b8802c8760bba52f48e
parent60857a8ebee46b21feaf16ab290faf0cd4807b93 (diff)
luaengine: Expose osd_subst_env as emu.subst_env (nw)
This is intended as a functional replacement for lfs.env_replace, but that is now used in a fair number of plugins whose code structure I don't know well enough to trust that the simple substitution is correct.
-rw-r--r--src/frontend/mame/luaengine.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index 993be513940..7530c18ac2c 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -785,6 +785,7 @@ void lua_engine::initialize()
* emu.keypost(keys) - post keys to natural keyboard
* emu.wait(len) - wait for len within coroutine
* emu.lang_translate(str) - get translation for str if available
+ * emu.subst_env(str) - substitute environment variables with values for str
*
* emu.register_prestart(callback) - register callback before reset
* emu.register_start(callback) - register callback after reset
@@ -879,6 +880,11 @@ void lua_engine::initialize()
});
emu["lang_translate"] = &lang_translate;
emu["pid"] = &osd_getpid;
+ emu["subst_env"] = [](const std::string &str) {
+ std::string result;
+ osd_subst_env(result, str);
+ return result;
+ };
/* emu_file library
@@ -1529,7 +1535,7 @@ void lua_engine::initialize()
dev.single_step(steps);
});
device_debug_type.set("go", &device_debug::go);
- device_debug_type.set("bpset", [](device_debug &dev, offs_t addr, const char *cond, const char *act) { return dev.breakpoint_set(addr, cond, act); });
+ device_debug_type.set("bpset", [](device_debug &dev, offs_t addr) { return dev.breakpoint_set(addr); });
device_debug_type.set("bpclr", &device_debug::breakpoint_clear);
device_debug_type.set("bplist", [this](device_debug &dev) {
sol::table table = sol().create_table();
@@ -1544,13 +1550,13 @@ void lua_engine::initialize()
}
return table;
});
- device_debug_type.set("wpset", [](device_debug &dev, addr_space &sp, const std::string &type, offs_t addr, offs_t len, const char *cond, const char *act) {
+ device_debug_type.set("wpset", [](device_debug &dev, addr_space &sp, const std::string &type, offs_t addr, offs_t len) {
read_or_write wptype = read_or_write::READ;
if(type == "w")
wptype = read_or_write::WRITE;
else if((type == "rw") || (type == "wr"))
wptype = read_or_write::READWRITE;
- return dev.watchpoint_set(sp.space, wptype, addr, len, cond, act);
+ return dev.watchpoint_set(sp.space, wptype, addr, len);
});
device_debug_type.set("wpclr", &device_debug::watchpoint_clear);
device_debug_type.set("wplist", [this](device_debug &dev, addr_space &sp) {