mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
29 lines
726 B
Lua
29 lines
726 B
Lua
|
local dat = {}
|
||
|
local ver, info
|
||
|
local datread = require("data/load_dat")
|
||
|
local space_wid = mame_manager:ui():get_char_width(0x200a)
|
||
|
datread, ver = datread.open("story.dat", "# version")
|
||
|
|
||
|
function dat.check(set, softlist)
|
||
|
if softlist or not datread then
|
||
|
return nil
|
||
|
end
|
||
|
local status
|
||
|
status, info = pcall(datread, "story", "info", set)
|
||
|
if not status or not info then
|
||
|
return nil
|
||
|
end
|
||
|
info = "#jf\n" .. info:gsub("([^%s]-)(%f[_]_+%f[0-9])([0-9.]+)",
|
||
|
function(name, sep, score)
|
||
|
local wid = mame_manager:ui():get_string_width(name .. score, 1.0)
|
||
|
return name .. string.rep(utf8.char(0x200a), math.floor((.4 - wid) / space_wid)) .. score
|
||
|
end)
|
||
|
return "Mamescore"
|
||
|
end
|
||
|
|
||
|
function dat.get()
|
||
|
return info
|
||
|
end
|
||
|
|
||
|
return dat
|