data/data_hiscore: parse more (nw)

luaengine: remove more leftovers (nw)
This commit is contained in:
cracyc 2016-11-03 15:29:19 -05:00
parent fa15cad309
commit e3d02290c1
3 changed files with 18 additions and 14 deletions

View File

@ -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

View File

@ -8,10 +8,7 @@
***************************************************************************/
#include <limits>
#include <thread>
#include <lua.hpp>
#include <signal.h>
#include "emu.h"
#include "mame.h"
#include "drivenum.h"
@ -21,7 +18,6 @@
#include "natkeyboard.h"
#include "uiinput.h"
#include "pluginopts.h"
#include <mutex>
#ifdef __clang__
#pragma clang diagnostic ignored "-Wshift-count-overflow"

View File

@ -109,8 +109,6 @@ private:
std::vector<std::string> m_menu;
std::map<lua_State *, std::pair<lua_State *, int> > thread_registry;
running_machine &machine() const { return *m_machine; }
void on_machine_prestart();