mirror of
https://github.com/holub/mame
synced 2025-10-04 08:28:39 +03:00
luaengine: remove now unnecessary stuff since a copy of searchpath is made and it won't be garbage collected from underneath us (nw)
This commit is contained in:
parent
7d5ee75620
commit
53962aff61
@ -14,7 +14,7 @@ local function xml_parse(data)
|
||||
local arr = {}
|
||||
while str ~= "" do
|
||||
local tag, attr, stop
|
||||
tag, attr, stop, str = str:match("<([%w!-]+) ?(.-)(/?)[ -]->(.*)")
|
||||
tag, attr, stop, str = str:match("<([%w!%-]+) ?(.-)(/?)[ %-]->(.*)")
|
||||
|
||||
if not tag then
|
||||
return arr
|
||||
@ -26,7 +26,7 @@ local function xml_parse(data)
|
||||
nest, str = str:match("(.-)</ *" .. tag .. " *>(.*)")
|
||||
local children = get_tags(nest)
|
||||
if not next(children) then
|
||||
nest = nest:gsub("<!--.--->", "")
|
||||
nest = nest:gsub("<!--.-%-%->", "")
|
||||
nest = nest:gsub("^%s*(.-)%s*$", "%1")
|
||||
block["text"] = nest
|
||||
else
|
||||
|
@ -1724,12 +1724,12 @@ int lua_engine::lua_screen::l_draw_text(lua_State *L)
|
||||
|
||||
int lua_engine::lua_emu_file::l_emu_file_read(lua_State *L)
|
||||
{
|
||||
lua_emu_file *file = luabridge::Stack<lua_emu_file *>::get(L, 1);
|
||||
emu_file *file = luabridge::Stack<emu_file *>::get(L, 1);
|
||||
luaL_argcheck(L, lua_isnumber(L, 2), 2, "length (integer) expected");
|
||||
int ret, len = lua_tonumber(L, 2);
|
||||
luaL_Buffer buff;
|
||||
char *ptr = luaL_buffinitsize(L, &buff, len);
|
||||
ret = file->file.read(ptr, len);
|
||||
ret = file->read(ptr, len);
|
||||
luaL_pushresultsize(&buff, ret);
|
||||
return 1;
|
||||
}
|
||||
@ -2675,15 +2675,17 @@ void lua_engine::initialize()
|
||||
.addProperty <bool> ("is_creatable", &device_image_interface::is_creatable)
|
||||
.addProperty <bool> ("is_reset_on_load", &device_image_interface::is_reset_on_load)
|
||||
.endClass()
|
||||
.beginClass <lua_emu_file> ("file")
|
||||
.addConstructor <void (*)(const char *, UINT32)> ()
|
||||
.beginClass <lua_emu_file> ("lua_file")
|
||||
.addCFunction ("read", &lua_emu_file::l_emu_file_read)
|
||||
.addFunction ("open", &lua_emu_file::open)
|
||||
.addFunction ("open_next", &lua_emu_file::open_next)
|
||||
.addFunction ("seek", &lua_emu_file::seek)
|
||||
.addFunction ("size", &lua_emu_file::size)
|
||||
.addFunction ("filename", &lua_emu_file::filename)
|
||||
.addFunction ("fullpath", &lua_emu_file::fullpath)
|
||||
.endClass()
|
||||
.deriveClass <emu_file, lua_emu_file> ("file")
|
||||
.addConstructor <void (*)(const char *, UINT32)> ()
|
||||
.addFunction ("open", static_cast<osd_file::error (emu_file::*)(const std::string &)>(&emu_file::open))
|
||||
.addFunction ("open_next", &emu_file::open_next)
|
||||
.addFunction ("seek", &emu_file::seek)
|
||||
.addFunction ("size", &emu_file::size)
|
||||
.addFunction ("filename", &emu_file::filename)
|
||||
.addFunction ("fullpath", &emu_file::fullpath)
|
||||
.endClass()
|
||||
.beginClass <lua_item> ("item")
|
||||
.addConstructor <void (*)(int)> ()
|
||||
|
@ -226,20 +226,7 @@ private:
|
||||
};
|
||||
|
||||
struct lua_emu_file {
|
||||
lua_emu_file(const char *searchpath, UINT32 openflags) :
|
||||
path(searchpath),
|
||||
file(path.c_str(), openflags) {}
|
||||
|
||||
int l_emu_file_read(lua_State *L);
|
||||
osd_file::error open(const std::string &name) {return file.open(name);}
|
||||
osd_file::error open_next() {return file.open_next();}
|
||||
int seek(INT64 offset, int whence) {return file.seek(offset, whence);}
|
||||
UINT64 size() {return file.size();}
|
||||
const char *filename() {return file.filename();}
|
||||
const char *fullpath() {return file.fullpath();}
|
||||
|
||||
std::string path;
|
||||
emu_file file;
|
||||
};
|
||||
|
||||
struct lua_item {
|
||||
|
Loading…
Reference in New Issue
Block a user