diff options
author | cracyc <cracyc@users.noreply.github.com> | 2016-11-03 15:29:19 -0500 |
---|---|---|
committer | cracyc <cracyc@users.noreply.github.com> | 2016-11-03 15:29:19 -0500 |
commit | e3d02290c10bc714dfc4fe58f87da1e6bc448b6b (patch) | |
tree | 02e911aa36555b9aed0b010136fe96812fe38f9c /plugins | |
parent | fa15cad30910694c788e2328516d1cc3adf52fac (diff) |
data/data_hiscore: parse more (nw)
luaengine: remove more leftovers (nw)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/data/data_hiscore.lua | 26 |
1 files changed, 18 insertions, 8 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("<hi2txt>(.*)</ *hi2txt>") @@ -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 |