From e3d02290c10bc714dfc4fe58f87da1e6bc448b6b Mon Sep 17 00:00:00 2001 From: cracyc Date: Thu, 3 Nov 2016 15:29:19 -0500 Subject: [PATCH] data/data_hiscore: parse more (nw) luaengine: remove more leftovers (nw) --- plugins/data/data_hiscore.lua | 26 ++++++++++++++++++-------- src/frontend/mame/luaengine.cpp | 4 ---- src/frontend/mame/luaengine.h | 2 -- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/plugins/data/data_hiscore.lua b/plugins/data/data_hiscore.lua index 5f2214d814d..c2dcf0ca370 100644 --- a/plugins/data/data_hiscore.lua +++ b/plugins/data/data_hiscore.lua @@ -11,13 +11,8 @@ function dat.check(set, softlist) return nil end local datpath - local function xml_parse() - local file = emu.file(lfs.env_replace(mame_manager:ui():options().entries.historypath:value():gsub("([^;]+)", "%1/hi2txt")), 1) - local ret = file:open(set .. ".xml") + local function xml_parse(file) local table - if ret then - return nil - end datpath = file:fullpath():gsub(".zip", "/") local data = file:read(file:size()) data = data:match("(.*)") @@ -494,6 +489,9 @@ function dat.check(set, softlist) if fld["line-ignore"] then igncol, ignval = fld["line-ignore"]:match("([^:]*):(.*)") end + if fld["field"] and not fld["column"] then -- ???? + fld["column"] = fld["field"] + end for num2, col in ipairs(fld["column"]) do if not col["display"] or col["display"] == "always" then if not col["src"] then @@ -501,7 +499,7 @@ function dat.check(set, softlist) end if not loopcnt and col["src"] ~= "index" then table.insert(dat, 1, "for i = 1, #arr['" .. col["src"] .. "'] do") - table.insert(dat, 2, "index = arr['" .. col["src"] .. "'][i].index") + table.insert(dat, 2, "index = arr['" .. col["src"] .. "'][i].index or i - 1") table.insert(dat, 3, "line = ''") loopcnt = true end @@ -768,10 +766,22 @@ function dat.check(set, softlist) local ret = scrfile:open(set .. ".lua") local script if ret then - local xml = xml_parse() + function get_xml_table(fileset) + local file = emu.file(lfs.env_replace(mame_manager:ui():options().entries.historypath:value():gsub("([^;]+)", "%1/hi2txt")), 1) + local ret = file:open(fileset .. ".xml") + if ret then + return nil + end + local xml = xml_parse(file) + return xml + end + local xml = get_xml_table(set) if not xml then return nil end + if xml.sameas then + xml = get_xml_table(xml.sameas[1].id) + end local status status, script = pcall(parse_table, xml) if not status then diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index 52da46ae113..10a4280b597 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -8,10 +8,7 @@ ***************************************************************************/ -#include -#include #include -#include #include "emu.h" #include "mame.h" #include "drivenum.h" @@ -21,7 +18,6 @@ #include "natkeyboard.h" #include "uiinput.h" #include "pluginopts.h" -#include #ifdef __clang__ #pragma clang diagnostic ignored "-Wshift-count-overflow" diff --git a/src/frontend/mame/luaengine.h b/src/frontend/mame/luaengine.h index f381edcfc87..aa2b155650c 100644 --- a/src/frontend/mame/luaengine.h +++ b/src/frontend/mame/luaengine.h @@ -109,8 +109,6 @@ private: std::vector m_menu; - std::map > thread_registry; - running_machine &machine() const { return *m_machine; } void on_machine_prestart();