2017-05-01 16:13:55 +03:00
|
|
|
-- Creating dirs in case they do not exist
|
2020-03-21 20:14:01 +03:00
|
|
|
System.createDirectory("ux0:/data/TrackPlug/")
|
2020-03-21 18:13:25 +03:00
|
|
|
System.createDirectory("ux0:/data/TrackPlug/Records")
|
|
|
|
System.createDirectory("ux0:/data/TrackPlug/Config")
|
|
|
|
System.createDirectory("ux0:/data/TrackPlug/Assets")
|
2020-09-26 03:20:50 +03:00
|
|
|
-- Creating blacklist file if it doesn't exist
|
|
|
|
if not System.doesFileExist("ux0:/data/TrackPlug/blacklist.txt") then
|
|
|
|
local blacklist_file = System.openFile("ux0:/data/TrackPlug/blacklist.txt", FCREATE)
|
|
|
|
System.closeFile(blacklist_file)
|
2020-03-14 14:27:44 +03:00
|
|
|
end
|
2020-09-26 03:20:50 +03:00
|
|
|
-- Reading blacklist file
|
|
|
|
local blacklist_file = System.openFile("ux0:/data/TrackPlug/blacklist.txt", FREAD)
|
|
|
|
local blacklist_fsize = System.sizeFile(blacklist_file)
|
|
|
|
local blacklist_var = System.readFile(blacklist_file, blacklist_fsize)
|
|
|
|
System.closeFile(blacklist_file)
|
|
|
|
-- Removing blacklisted titles
|
|
|
|
for line in blacklist_var:gmatch("([^\n]*)\n?") do
|
|
|
|
System.deleteFile("ux0:/data/TrackPlug/Records/" .. line .. ".bin")
|
|
|
|
end
|
|
|
|
-- Read entries to a table
|
|
|
|
local tbl = System.listDirectory("ux0:/data/TrackPlug/Records")
|
2016-10-19 19:29:18 +03:00
|
|
|
if tbl == nil then
|
2019-08-23 02:18:29 +03:00
|
|
|
tbl = {}
|
2016-10-19 19:29:18 +03:00
|
|
|
end
|
2016-10-17 23:27:03 +03:00
|
|
|
|
2020-03-14 14:54:22 +03:00
|
|
|
-- Convert a 32 bit binary string to an integer
|
2016-10-17 23:27:03 +03:00
|
|
|
function bin2int(str)
|
2019-08-23 02:18:29 +03:00
|
|
|
local b1, b2, b3, b4 = string.byte(str, 1, 4)
|
|
|
|
return bit32.lshift(b4, 24) + bit32.lshift(b3, 16) + bit32.lshift(b2, 8) + b1
|
2016-10-17 23:27:03 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Format raw time data
|
|
|
|
function FormatTime(val)
|
2019-08-23 02:18:29 +03:00
|
|
|
local minutes = math.floor(val/60)
|
|
|
|
local seconds = val%60
|
|
|
|
local hours = math.floor(minutes/60)
|
|
|
|
local minutes = minutes%60
|
|
|
|
local res = ""
|
|
|
|
if hours > 0 then
|
|
|
|
res = hours .. "h "
|
|
|
|
end
|
|
|
|
if minutes > 0 then
|
|
|
|
res = res .. minutes .. "m "
|
|
|
|
end
|
|
|
|
res = res .. seconds .. "s "
|
|
|
|
return res
|
2016-10-17 23:27:03 +03:00
|
|
|
end
|
|
|
|
|
2017-05-01 16:13:55 +03:00
|
|
|
-- Recover title from homebrew database
|
|
|
|
function recoverTitle(tid)
|
2020-03-21 20:14:01 +03:00
|
|
|
local file = System.openFile("ux0:/data/TrackPlug/Assets/" .. tid .. "/title.txt", FREAD)
|
2019-08-23 02:18:29 +03:00
|
|
|
fsize = System.sizeFile(file)
|
|
|
|
local title = System.readFile(file, fsize)
|
|
|
|
System.closeFile(file)
|
|
|
|
return title
|
2017-05-01 16:13:55 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Extracts title name from an SFO file
|
|
|
|
function extractTitle(file, tid)
|
2019-08-23 02:18:29 +03:00
|
|
|
local data = System.extractSfo(file)
|
2020-03-21 20:14:01 +03:00
|
|
|
if System.doesFileExist("ux0:/data/TrackPlug/Assets/" .. tid .. "/title.txt") then
|
|
|
|
System.deleteFile("ux0:/data/TrackPlug/Assets/" .. tid .. "/title.txt")
|
2019-08-23 02:18:29 +03:00
|
|
|
end
|
2020-03-21 20:14:01 +03:00
|
|
|
local file = System.openFile("ux0:/data/TrackPlug/Assets/" .. tid .. "/title.txt", FCREATE)
|
2019-08-23 02:18:29 +03:00
|
|
|
System.writeFile(file, data.title, string.len(data.title))
|
|
|
|
System.closeFile(file)
|
|
|
|
return data.title
|
2016-10-17 23:27:03 +03:00
|
|
|
end
|
|
|
|
|
2020-03-21 16:29:42 +03:00
|
|
|
function copyIcon(titleid)
|
2020-03-21 20:14:01 +03:00
|
|
|
newFile = System.openFile("ux0:/data/TrackPlug/Assets/" .. titleid .. "/icon0.png", FCREATE)
|
2020-03-21 16:29:42 +03:00
|
|
|
oldFile = System.openFile("ur0:/appmeta/" .. titleid .. "/icon0.png", FREAD)
|
|
|
|
fileSize = System.sizeFile(oldFile)
|
|
|
|
icon = System.readFile(oldFile, fileSize)
|
|
|
|
System.writeFile(newFile, icon, fileSize)
|
|
|
|
end
|
2016-10-17 23:27:03 +03:00
|
|
|
|
2019-08-22 05:27:04 +03:00
|
|
|
function getRegion(titleid)
|
2019-08-23 02:18:29 +03:00
|
|
|
local regioncode = string.sub(titleid,1,4)
|
|
|
|
local prefix = string.sub(regioncode,1,2)
|
|
|
|
local region = "Unknown"
|
2019-08-22 05:27:04 +03:00
|
|
|
|
2019-08-23 02:18:29 +03:00
|
|
|
-- PSV common
|
|
|
|
if regioncode == "PCSA" or regioncode == "PCSE" then
|
|
|
|
region = "USA"
|
|
|
|
elseif regioncode == "PCSB" or regioncode == "PCSF" then
|
|
|
|
region = "Europe"
|
|
|
|
elseif regioncode == "PCSC" or regioncode == "PCSG" then
|
|
|
|
region = "Japan"
|
|
|
|
elseif regioncode == "PCSD" or regioncode == "PCSH" then
|
|
|
|
region = "Asia"
|
|
|
|
-- Physical & NP releases (PSV/PSP/PS1)
|
|
|
|
elseif prefix == "VC" or prefix == "VL" or
|
|
|
|
prefix == "UC" or prefix == "UL" or
|
|
|
|
prefix == "SC" or prefix == "SL" or
|
|
|
|
prefix == "NP" then
|
|
|
|
n1 = string.sub(regioncode,1,1)
|
|
|
|
n3 = string.sub(regioncode,3,3)
|
|
|
|
n4 = string.sub(regioncode,4,4)
|
|
|
|
if n3 == "A" then
|
|
|
|
region = "Asia"
|
|
|
|
elseif n3 == "C" then
|
|
|
|
region = "China"
|
|
|
|
elseif n3 == "E" then
|
|
|
|
region = "Europe"
|
|
|
|
elseif n3 == "H" then
|
|
|
|
region = "Hong Kong"
|
|
|
|
elseif n3 == "J" or n3 == "P" then
|
|
|
|
region = "Japan"
|
|
|
|
elseif n3 == "K" then
|
|
|
|
region = "Korea"
|
|
|
|
elseif n3 == "U" then
|
|
|
|
region = "USA"
|
|
|
|
end
|
2019-08-22 05:27:04 +03:00
|
|
|
|
2019-08-23 02:18:29 +03:00
|
|
|
if n1 == "S" then
|
|
|
|
region = region .. " (PS1)"
|
|
|
|
elseif n1 == "U" or
|
|
|
|
(prefix == "NP" and (n4 == "G" or n4 == "H")) then
|
|
|
|
region = region .. " (PSP)"
|
|
|
|
elseif prefix == "NP" then
|
|
|
|
if n4 == "E" or n4 == "F" then
|
|
|
|
region = region .. " (PS1 - PAL)"
|
|
|
|
elseif n4 == "I" or n4 == "J" then
|
|
|
|
region = region .. " (PS1 - NTSC)"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elseif prefix == "PE" then
|
|
|
|
region = "Europe (PS1)"
|
|
|
|
elseif prefix == "PT" then
|
|
|
|
region = "Asia (PS1)"
|
|
|
|
elseif prefix == "PU" then
|
|
|
|
region = "USA (PS1)"
|
2020-03-15 16:55:29 +03:00
|
|
|
elseif string.sub(titleid,1,6) == "PSPEMU" then
|
2019-08-23 02:18:29 +03:00
|
|
|
region = "PSP/PS1"
|
|
|
|
end
|
|
|
|
return region
|
2016-10-17 23:27:03 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Loading unknown icon
|
|
|
|
local unk = Graphics.loadImage("app0:/unk.png")
|
2019-08-23 02:18:29 +03:00
|
|
|
|
2017-05-01 16:13:55 +03:00
|
|
|
-- Getting region, playtime, icon and title name for any game
|
|
|
|
for i, file in pairs(tbl) do
|
2019-08-23 02:18:29 +03:00
|
|
|
if file.name == "config.lua" then
|
|
|
|
dofile("ux0:/data/TrackPlug/"..file.name)
|
|
|
|
cfg_idx = i
|
|
|
|
else
|
|
|
|
local titleid = string.sub(file.name,1,-5)
|
|
|
|
file.region = getRegion(titleid)
|
2020-03-21 20:14:01 +03:00
|
|
|
if System.doesFileExist("ux0:/data/TrackPlug/Assets/" .. titleid .. "/icon0.png") then
|
|
|
|
file.icon = Graphics.loadImage("ux0:/data/TrackPlug/Assets/" .. titleid .. "/icon0.png")
|
2020-03-25 16:12:28 +03:00
|
|
|
else
|
2020-03-21 20:14:01 +03:00
|
|
|
System.createDirectory("ux0:/data/TrackPlug/Assets/" .. titleid .. "")
|
2020-03-25 16:12:28 +03:00
|
|
|
if System.doesFileExist("ur0:/appmeta/" .. titleid .. "/icon0.png") then
|
|
|
|
file.icon = Graphics.loadImage("ur0:/appmeta/" .. titleid .. "/icon0.png")
|
|
|
|
copyIcon(titleid)
|
|
|
|
else
|
|
|
|
file.icon = unk
|
|
|
|
end
|
|
|
|
end
|
2020-03-21 16:29:42 +03:00
|
|
|
|
|
|
|
|
2020-03-25 16:12:28 +03:00
|
|
|
if System.doesFileExist("ux0:/data/TrackPlug/Assets/" .. titleid .. "/title.txt") then
|
2019-08-23 02:18:29 +03:00
|
|
|
file.title = recoverTitle(titleid)
|
|
|
|
elseif System.doesFileExist("ux0:/app/" .. titleid .. "/sce_sys/param.sfo") then
|
|
|
|
file.title = extractTitle("ux0:/app/" .. titleid .. "/sce_sys/param.sfo", titleid)
|
|
|
|
else
|
2020-03-15 16:55:29 +03:00
|
|
|
file.title = "Unknown - " .. titleid
|
2019-08-23 02:18:29 +03:00
|
|
|
end
|
|
|
|
file.id = titleid
|
2020-03-21 18:13:25 +03:00
|
|
|
fd = System.openFile("ux0:/data/TrackPlug/Records/" .. file.name, FREAD)
|
2019-08-23 02:18:29 +03:00
|
|
|
file.rtime = bin2int(System.readFile(fd, 4))
|
|
|
|
file.ptime = FormatTime(file.rtime)
|
|
|
|
System.closeFile(fd)
|
|
|
|
end
|
2016-10-17 23:27:03 +03:00
|
|
|
end
|
|
|
|
|
2016-10-19 19:29:18 +03:00
|
|
|
-- Background wave effect
|
|
|
|
local colors = {
|
2020-03-21 18:13:25 +03:00
|
|
|
{Color.new(72,72,72), Color.new(30,20,25), Color.new(200,180,180)},
|
|
|
|
{Color.new(72,72,72), Color.new(30,20,25), Color.new(200,180,180)},
|
|
|
|
{Color.new(72,72,72), Color.new(30,20,25), Color.new(200,180,180)},
|
|
|
|
{Color.new(72,72,72), Color.new(30,20,25), Color.new(200,180,180)},
|
|
|
|
{Color.new(72,72,72), Color.new(30,20,25), Color.new(200,180,180)}
|
2016-10-19 19:29:18 +03:00
|
|
|
}
|
2020-03-21 18:13:25 +03:00
|
|
|
|
2016-10-19 20:29:17 +03:00
|
|
|
if col_idx == nil then
|
2020-03-14 14:27:44 +03:00
|
|
|
col_idx = 0
|
2016-10-19 20:29:17 +03:00
|
|
|
end
|
2020-03-14 14:27:44 +03:00
|
|
|
|
2020-03-14 14:54:22 +03:00
|
|
|
local function LoadWave(height,dim,f,x_dim)
|
2020-03-15 03:22:00 +03:00
|
|
|
f=f or 0.1
|
|
|
|
local onda={pi=math.pi,Frec=f,Long_onda=dim,Amplitud=height}
|
|
|
|
function onda:color(a,b,c) self.a=a self.b=b self.c=c end
|
|
|
|
function onda:init(desfase)
|
|
|
|
desfase=desfase or 0
|
|
|
|
if not self.contador then
|
|
|
|
self.contador=Timer.new()
|
2020-03-14 14:27:44 +03:00
|
|
|
end
|
2020-03-15 03:22:00 +03:00
|
|
|
if not self.a or not self.b or not self.c then
|
|
|
|
self.a = 255
|
|
|
|
self.b = 200
|
|
|
|
self.c = 220
|
2020-03-14 14:54:22 +03:00
|
|
|
end
|
2020-03-15 03:22:00 +03:00
|
|
|
local t,x,y,i
|
|
|
|
t = Timer.getTime(self.contador)/1000+desfase
|
|
|
|
for x = 0,x_dim,8 do
|
|
|
|
y = 404+self.Amplitud*math.sin(2*self.pi*(t*self.Frec-x/self.Long_onda))
|
|
|
|
i = self.Amplitud*(self.pi/self.Long_onda)*math.cos(2*self.pi*(t*self.Frec-x/self.Long_onda))
|
|
|
|
k = self.Amplitud*(1*self.pi/self.Long_onda)*math.sin(-1*self.pi*(t*self.Frec-x/self.Long_onda))
|
|
|
|
Graphics.drawLine(x-30,x+30,y-i*30,y+i*30,Color.new(self.a,self.b,self.c,math.floor(x/65)))
|
|
|
|
Graphics.drawLine(x-150,x+150,y-k*150,y+k*150,Color.new(self.a-60,self.b-80,self.a-70,math.floor(x/20)))
|
|
|
|
end
|
2020-03-14 14:54:22 +03:00
|
|
|
end
|
2020-03-15 03:22:00 +03:00
|
|
|
function onda:destroy()
|
|
|
|
Timer.destroy(self.contador)
|
|
|
|
end
|
|
|
|
return onda
|
2016-10-19 19:29:18 +03:00
|
|
|
end
|
2020-03-14 14:27:44 +03:00
|
|
|
|
2020-03-14 14:54:22 +03:00
|
|
|
wav = LoadWave(100,1160, 0.1, 1160)
|
2016-10-19 19:29:18 +03:00
|
|
|
|
2016-10-17 23:27:03 +03:00
|
|
|
-- Internal stuffs
|
|
|
|
local list_idx = 1
|
|
|
|
local order_idx = 1
|
|
|
|
local orders = {"Name", "Playtime"}
|
|
|
|
|
|
|
|
-- Ordering titles
|
2020-03-16 00:24:52 +03:00
|
|
|
table.sort(tbl, function (a, b) return (a.rtime > b.rtime ) end)
|
2016-10-17 23:27:03 +03:00
|
|
|
|
|
|
|
-- Internal stuffs
|
|
|
|
local white = Color.new(255, 255, 255)
|
|
|
|
local yellow = Color.new(255, 255, 0)
|
|
|
|
local grey = Color.new(40, 40, 40)
|
|
|
|
|
|
|
|
-- Shows an alarm with selection on screen
|
|
|
|
local alarm_val = 128
|
|
|
|
local alarm_decrease = true
|
|
|
|
function showAlarm(title, select_idx)
|
2019-08-23 02:18:29 +03:00
|
|
|
if alarm_decrease then
|
|
|
|
alarm_val = alarm_val - 4
|
|
|
|
if alarm_val == 40 then
|
|
|
|
alarm_decrease = false
|
|
|
|
end
|
|
|
|
else
|
|
|
|
alarm_val = alarm_val + 4
|
|
|
|
if alarm_val == 128 then
|
|
|
|
alarm_decrease = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local sclr = Color.new(alarm_val, alarm_val, alarm_val)
|
2020-03-21 18:13:25 +03:00
|
|
|
Graphics.fillRect(200, 760, 200, 300, grey)
|
2019-08-23 02:18:29 +03:00
|
|
|
Graphics.debugPrint(205, 205, title, yellow)
|
2020-03-21 18:13:25 +03:00
|
|
|
Graphics.fillRect(200, 760, 235 + select_idx * 20, 255 + select_idx * 20, sclr)
|
|
|
|
Graphics.debugPrint(205, 255, "Yes", white)
|
|
|
|
Graphics.debugPrint(205, 275, "No", white)
|
2016-10-17 23:27:03 +03:00
|
|
|
end
|
|
|
|
-- Scroll-list Renderer
|
|
|
|
local sel_val = 128
|
|
|
|
local decrease = true
|
|
|
|
local freeze = false
|
2020-09-26 03:20:50 +03:00
|
|
|
local freeze_blacklist = false
|
2018-10-11 12:40:41 +03:00
|
|
|
local mov_y = 0
|
|
|
|
local mov_step = 0
|
|
|
|
local new_list_idx = nil
|
|
|
|
local real_i = 1
|
|
|
|
local big_tbl = {}
|
2016-10-17 23:27:03 +03:00
|
|
|
function RenderList()
|
2018-10-11 12:40:41 +03:00
|
|
|
local r_max = 0
|
|
|
|
local r = 0
|
|
|
|
if #tbl < 4 then
|
|
|
|
r_max = 8
|
|
|
|
else
|
|
|
|
r_max = 2
|
|
|
|
end
|
|
|
|
while r < r_max do
|
|
|
|
for k, v in pairs(tbl) do
|
|
|
|
table.insert(big_tbl, v)
|
|
|
|
end
|
|
|
|
r = r + 1
|
|
|
|
end
|
|
|
|
local y = -124
|
|
|
|
local i = list_idx - 1
|
2016-10-17 23:27:03 +03:00
|
|
|
if not freeze then
|
|
|
|
if decrease then
|
|
|
|
sel_val = sel_val - 4
|
|
|
|
if sel_val == 0 then
|
|
|
|
decrease = false
|
|
|
|
end
|
|
|
|
else
|
|
|
|
sel_val = sel_val + 4
|
|
|
|
if sel_val == 128 then
|
|
|
|
decrease = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-03-16 00:24:52 +03:00
|
|
|
if mov_y ~= 0 then
|
|
|
|
if math.abs(mov_y) < 104 then
|
|
|
|
mov_y = math.floor(mov_y*1.298)
|
|
|
|
else
|
2018-10-11 12:40:41 +03:00
|
|
|
mov_y = 0
|
2020-03-16 00:24:52 +03:00
|
|
|
list_idx = new_list_idx
|
|
|
|
i = new_list_idx - 1
|
2016-10-17 23:27:03 +03:00
|
|
|
end
|
2018-10-11 12:40:41 +03:00
|
|
|
end
|
|
|
|
while i <= list_idx + 4 do
|
|
|
|
if i < 1 then
|
|
|
|
real_i = i
|
|
|
|
i = #big_tbl - math.abs(i)
|
|
|
|
end
|
2020-03-15 03:22:00 +03:00
|
|
|
Graphics.fillRect(5, 955, y+mov_y, y+mov_y-4, Color.new(255, 255, 255, 60))
|
|
|
|
if i ~= list_idx + 5 then
|
2018-10-11 12:40:41 +03:00
|
|
|
Graphics.drawImage(5, y + mov_y, big_tbl[i].icon)
|
|
|
|
end
|
2020-09-26 03:20:50 +03:00
|
|
|
Graphics.debugPrint(150, y + 35 + mov_y, string.gsub(big_tbl[i].title, "\n", " "), Color.new(230,140,175))
|
2020-03-15 03:22:00 +03:00
|
|
|
--Graphics.debugPrint(150, y + 45 + mov_y, "Title ID: " .. big_tbl[i].id, white)
|
|
|
|
--Graphics.debugPrint(150, y + 65 + mov_y, "Region: " .. big_tbl[i].region, white)
|
|
|
|
Graphics.debugPrint(150, y + 65 + mov_y, "Playtime: " .. big_tbl[i].ptime, white)
|
2018-10-11 12:40:41 +03:00
|
|
|
local r_idx = i % #tbl
|
|
|
|
if r_idx == 0 then
|
|
|
|
r_idx = #tbl
|
|
|
|
end
|
2020-09-26 03:20:50 +03:00
|
|
|
Graphics.debugPrint(910, y + 100 + mov_y, "#" .. r_idx, white)
|
2016-10-17 23:27:03 +03:00
|
|
|
y = y + 132
|
2018-10-11 12:40:41 +03:00
|
|
|
if real_i <= 0 then
|
|
|
|
i = real_i
|
|
|
|
real_i = 1
|
|
|
|
end
|
2016-10-17 23:27:03 +03:00
|
|
|
i = i + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Main loop
|
|
|
|
local f_idx = 1
|
2020-09-26 03:20:50 +03:00
|
|
|
local f_idx_2 = 1
|
2020-03-16 00:24:52 +03:00
|
|
|
local useless = 0
|
2020-09-26 03:20:50 +03:00
|
|
|
local blacklisted_title = "kek"
|
|
|
|
local blacklisted_title_id = "kek"
|
2016-10-17 23:27:03 +03:00
|
|
|
local oldpad = Controls.read()
|
|
|
|
while #tbl > 0 do
|
|
|
|
Graphics.initBlend()
|
2020-09-26 03:20:50 +03:00
|
|
|
Graphics.fillRect(0,960,0,544,Color.new(10,5,15))
|
|
|
|
Graphics.fillRect(0,960,4,140,Color.new(20,20,20))
|
2016-10-19 19:29:18 +03:00
|
|
|
wav:init()
|
2016-10-17 23:27:03 +03:00
|
|
|
RenderList()
|
2020-03-15 03:22:00 +03:00
|
|
|
if freeze then
|
2020-09-26 03:20:50 +03:00
|
|
|
showAlarm("Do you want to clear playtime of this record? \n" .. string.gsub(tbl[list_idx].title, "\n", " "), f_idx)
|
|
|
|
end
|
|
|
|
if freeze_blacklist then
|
|
|
|
showAlarm("Do you want to blacklist this record? \n" .. blacklisted_title, f_idx_2)
|
|
|
|
end
|
2016-10-17 23:27:03 +03:00
|
|
|
Graphics.termBlend()
|
|
|
|
Screen.flip()
|
|
|
|
Screen.waitVblankStart()
|
2020-03-16 00:24:52 +03:00
|
|
|
local pad = Controls.read()
|
2018-10-11 12:40:41 +03:00
|
|
|
if Controls.check(pad, SCE_CTRL_UP) and mov_y == 0 then
|
2016-10-17 23:27:03 +03:00
|
|
|
if freeze then
|
2020-09-26 03:20:50 +03:00
|
|
|
f_idx = 1
|
|
|
|
elseif freeze_blacklist then
|
|
|
|
f_idx_2 = 1
|
2016-10-17 23:27:03 +03:00
|
|
|
else
|
2018-10-11 12:40:41 +03:00
|
|
|
new_list_idx = list_idx - 1
|
|
|
|
if new_list_idx == 0 then
|
|
|
|
new_list_idx = #tbl
|
2016-10-17 23:27:03 +03:00
|
|
|
end
|
2020-03-16 00:24:52 +03:00
|
|
|
mov_y = 11
|
2016-10-17 23:27:03 +03:00
|
|
|
end
|
2018-10-11 12:40:41 +03:00
|
|
|
elseif Controls.check(pad, SCE_CTRL_DOWN) and mov_y == 0 then
|
2016-10-17 23:27:03 +03:00
|
|
|
if freeze then
|
2020-09-26 03:20:50 +03:00
|
|
|
f_idx = 2
|
|
|
|
elseif freeze_blacklist then
|
|
|
|
f_idx_2 = 2
|
2016-10-17 23:27:03 +03:00
|
|
|
else
|
2018-10-11 12:40:41 +03:00
|
|
|
new_list_idx = list_idx + 1
|
|
|
|
if new_list_idx > #tbl then
|
|
|
|
new_list_idx = 1
|
2016-10-17 23:27:03 +03:00
|
|
|
end
|
2020-03-16 00:24:52 +03:00
|
|
|
mov_y = -11
|
2020-03-15 03:22:00 +03:00
|
|
|
end
|
|
|
|
elseif Controls.check(pad, SCE_CTRL_TRIANGLE) and not Controls.check(oldpad, SCE_CTRL_TRIANGLE) and not freeze then
|
2020-09-26 03:20:50 +03:00
|
|
|
freeze = true
|
|
|
|
f_idx = 2
|
|
|
|
f_idx_2 = 2
|
|
|
|
elseif Controls.check(pad, SCE_CTRL_CROSS) and not Controls.check(oldpad, SCE_CTRL_CROSS) and freeze then
|
|
|
|
freeze = false
|
|
|
|
if f_idx == 1 then -- Delete
|
|
|
|
blacklisted_title_id = tbl[list_idx].id
|
|
|
|
blacklisted_title = string.gsub(tbl[list_idx].title, "\n", " ")
|
|
|
|
System.deleteFile("ux0:/data/TrackPlug/Records/" .. tbl[list_idx].id .. ".bin")
|
|
|
|
freeze_blacklist = true
|
2020-03-15 03:22:00 +03:00
|
|
|
table.remove(tbl, list_idx)
|
|
|
|
big_tbl = {}
|
|
|
|
list_idx = list_idx - 1
|
2020-03-16 00:24:52 +03:00
|
|
|
end
|
2020-09-26 03:20:50 +03:00
|
|
|
elseif Controls.check(pad, SCE_CTRL_CROSS) and not Controls.check(oldpad, SCE_CTRL_CROSS) and freeze_blacklist then
|
|
|
|
freeze_blacklist = false
|
|
|
|
if f_idx_2 == 1 then -- Blacklist
|
|
|
|
local file = System.openFile("ux0:/data/TrackPlug/blacklist.txt", FRDWR)
|
|
|
|
local file_size = System.sizeFile(file)
|
|
|
|
local file_var = System.readFile(file, file_size)
|
|
|
|
System.writeFile(file, blacklisted_title_id .. "\n", string.len(blacklisted_title_id) + 1)
|
|
|
|
System.closeFile(file)
|
|
|
|
end
|
|
|
|
end
|
2016-10-17 23:27:03 +03:00
|
|
|
oldpad = pad
|
|
|
|
end
|
|
|
|
|
|
|
|
-- No games played yet apparently
|
|
|
|
while true do
|
2019-08-23 02:18:29 +03:00
|
|
|
Graphics.initBlend()
|
|
|
|
Screen.clear()
|
2020-03-21 18:13:25 +03:00
|
|
|
Graphics.debugPrint(5, 5, "No games tracked yet. You sure you installed the plugin correctly?", white)
|
2019-08-23 02:18:29 +03:00
|
|
|
Graphics.termBlend()
|
|
|
|
Screen.flip()
|
|
|
|
Screen.waitVblankStart()
|
2020-03-25 16:12:28 +03:00
|
|
|
end
|