Added config file for bgcolor.

Added config file for bgcolor.
This commit is contained in:
Rinnegatamante 2016-10-19 19:29:17 +02:00
parent ec1b28bf67
commit c27ff9ea8c

View File

@ -62,39 +62,46 @@ while Timer.getTime(tmr) < 3000 do
-- Getting region, playtime, icon and title name for any game -- Getting region, playtime, icon and title name for any game
for i, file in pairs(tbl) do for i, file in pairs(tbl) do
System.wait(5000) if file.name == "config.lua" then
local titleid = string.sub(file.name,1,-5) dofile("ux0:/data/TrackPlug/"..file.name)
local regioncode = string.sub(file.name,1,4) cfg_idx = i
if regioncode == "PCSA" or regioncode == "PCSE" then
file.region = "USA"
elseif regioncode == "PCSB" then
file.region = "EUR"
elseif regioncode == "PCSF" then
file.region = "AUS"
elseif regioncode == "PCSG" then
file.region = "JPN"
elseif regioncode == "PCSH" then
file.region = "ASN"
else else
file.region = "UNK" local titleid = string.sub(file.name,1,-5)
end local regioncode = string.sub(file.name,1,4)
if System.doesFileExist("ur0:/appmeta/" .. titleid .. "/icon0.png") then if regioncode == "PCSA" or regioncode == "PCSE" then
file.icon = Graphics.loadImage("ur0:/appmeta/" .. titleid .. "/icon0.png") file.region = "USA"
else elseif regioncode == "PCSB" then
file.icon = unk file.region = "EUR"
end elseif regioncode == "PCSF" then
if System.doesFileExist("ux0:/app/" .. titleid .. "/sce_sys/param.sfo") then file.region = "AUS"
fd = io.open("ux0:/app/" .. titleid .. "/sce_sys/param.sfo", FREAD) elseif regioncode == "PCSG" then
file.title = extractTitle(fd) file.region = "JPN"
elseif regioncode == "PCSH" then
file.region = "ASN"
else
file.region = "UNK"
end
if System.doesFileExist("ur0:/appmeta/" .. titleid .. "/icon0.png") then
file.icon = Graphics.loadImage("ur0:/appmeta/" .. titleid .. "/icon0.png")
else
file.icon = unk
end
if System.doesFileExist("ux0:/app/" .. titleid .. "/sce_sys/param.sfo") then
fd = io.open("ux0:/app/" .. titleid .. "/sce_sys/param.sfo", FREAD)
file.title = extractTitle(fd)
io.close(fd)
else
file.title = "Unknown Title"
end
file.id = titleid
fd = io.open("ux0:/data/TrackPlug/" .. file.name, FREAD)
file.rtime = bin2int(io.read(fd, 4))
file.ptime = FormatTime(file.rtime)
io.close(fd) io.close(fd)
else
file.title = "Unknown Title"
end end
file.id = titleid end
fd = io.open("ux0:/data/TrackPlug/" .. file.name, FREAD) if cfg_idx ~= nil then
file.rtime = bin2int(io.read(fd, 4)) table.remove(tbl, cfg_ifx)
file.ptime = FormatTime(file.rtime)
io.close(fd)
end end
end end
@ -111,7 +118,9 @@ local colors = {
{Color.new(255,72,255), Color.new(255,185,255), Color.new(255,72,255)}, -- Magenta {Color.new(255,72,255), Color.new(255,185,255), Color.new(255,72,255)}, -- Magenta
{Color.new(72,72,72), Color.new(0,0,0), Color.new(0,255,0)} -- Black'N'Green {Color.new(72,72,72), Color.new(0,0,0), Color.new(0,255,0)} -- Black'N'Green
} }
col_idx = 1 if col_idx == nil then
col_idx = 6
end
local function LoadWave(height,dim,f,style,x_dim) local function LoadWave(height,dim,f,style,x_dim)
if style == 1 then if style == 1 then
f=f or 0.1 f=f or 0.1
@ -359,6 +368,9 @@ while #tbl > 0 do
col_idx = 1 col_idx = 1
end end
wav:color(Color.getR(colors[col_idx][3]),Color.getG(colors[col_idx][3]),Color.getB(colors[col_idx][3])) wav:color(Color.getR(colors[col_idx][3]),Color.getG(colors[col_idx][3]),Color.getB(colors[col_idx][3]))
fd = io.open("ux0:/data/TrackPlug/config.lua", FCREATE)
io.write(fd, "col_idx="..col_idx, 9)
io.close(fd)
end end
oldpad = pad oldpad = pad
end end