2016-09-06 04:43:17 +02:00
|
|
|
local dat = {}
|
2022-06-24 20:57:24 +02:00
|
|
|
|
2016-09-06 04:43:17 +02:00
|
|
|
local ver, info
|
2022-06-24 20:57:24 +02:00
|
|
|
local datread = require('data/load_dat')
|
|
|
|
datread, ver = datread.open('story.dat', '# version')
|
2016-09-06 04:43:17 +02:00
|
|
|
|
|
|
|
function dat.check(set, softlist)
|
|
|
|
if softlist or not datread then
|
|
|
|
return nil
|
|
|
|
end
|
2022-06-24 20:57:24 +02:00
|
|
|
local status, data = pcall(datread, 'story', 'info', set)
|
2017-07-28 00:29:22 +02:00
|
|
|
if not status or not data then
|
2016-09-06 04:43:17 +02:00
|
|
|
return nil
|
|
|
|
end
|
2017-07-28 00:29:22 +02:00
|
|
|
local lines = {}
|
2022-06-24 20:57:24 +02:00
|
|
|
data = data:gsub('MAMESCORE records : ([^\n]+)', 'MAMESCORE records :\t\n%1', 1)
|
|
|
|
for line in data:gmatch('[^\n]*') do
|
|
|
|
if (line ~= '') or ((#lines ~= 0) and (lines[#lines] ~= '')) then
|
2022-07-01 19:11:23 +02:00
|
|
|
line = line:gsub('^(.-)_+([0-9.]+)$', '%1\t%2')
|
|
|
|
table.insert(lines, line)
|
2017-07-28 00:29:22 +02:00
|
|
|
end
|
|
|
|
end
|
2022-06-24 20:57:24 +02:00
|
|
|
info = '#j2\n' .. table.concat(lines, '\n')
|
|
|
|
return _p('plugin-data', 'Mamescore')
|
2016-09-06 04:43:17 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function dat.get()
|
|
|
|
return info
|
|
|
|
end
|
|
|
|
|
2016-09-07 05:11:01 +02:00
|
|
|
function dat.ver()
|
|
|
|
return ver
|
|
|
|
end
|
|
|
|
|
2016-09-06 04:43:17 +02:00
|
|
|
return dat
|