From 42899c1de1d6a9c38baf51205c539f1bd3ea7286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20Mudanyal=C4=B1?= Date: Sat, 14 Mar 2020 14:54:22 +0300 Subject: [PATCH] some comment --- app/index.lua | 69 ++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/app/index.lua b/app/index.lua index 9d771e5..a0e9b96 100644 --- a/app/index.lua +++ b/app/index.lua @@ -4,21 +4,21 @@ System.createDirectory("ux0:/data/TrackPlugArchive") -- Scanning TrackPlug folder local tbl = System.listDirectory("ux0:/data/TrackPlug") - +-- Removing apps with no region, may also add livetweet, crunchyroll etc. for i, file in pairs(tbl) do local regcod = string.sub(file.name,1,4) if regcod ~= "PCSA" and regcod ~= "PCSE" and regcod ~= "PCSB" and regcod ~= "PCSF" and regcod ~= "PCSG" and regcod ~= "PCSH" then System.deleteFile("ux0:/data/TrackPlug/"..file.name) end end - +-- Reset the table tbl = System.listDirectory("ux0:/data/TrackPlug") if tbl == nil then tbl = {} end --- Convert a 32 bit binary string to a integer +-- Convert a 32 bit binary string to an integer function bin2int(str) local b1, b2, b3, b4 = string.byte(str, 1, 4) return (b4 << 24) + (b3 << 16) + (b2 << 8) + b1 @@ -117,40 +117,38 @@ if col_idx == nil then col_idx = 0 end -local function LoadWave(height,dim,f,style,x_dim) - if style == 1 then - 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() - end - if not self.a or not self.b or not self.c then - self.a = 255 - self.b = 170 - self.c = 220 - end - local t,x,y,i - t = Timer.getTime(self.contador)/1000+desfase - for x = 0,x_dim,8 do +local function LoadWave(height,dim,f,x_dim) + 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() + end + if not self.a or not self.b or not self.c then + self.a = 255 + self.b = 200 + self.c = 220 + end + 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)) + 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(255,200,220,math.floor(x/65))) - --Graphics.drawLine(x-100,x+100,y+i*100,y-i*100,Color.new(200,120,180,math.floor(x/30))) - Graphics.drawLine(x-150,x+150,y-k*150,y+k*150,Color.new(140,110,170,math.floor(x/20))) + 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 - end - function onda:destroy() - Timer.destroy(self.contador) - end - return onda end + function onda:destroy() + Timer.destroy(self.contador) + end + return onda + end end -wav = LoadWave(100,1160, 0.1, 1, 1160) +wav = LoadWave(100,1160, 0.1, 1160) -- Internal stuffs local list_idx = 1 @@ -161,11 +159,7 @@ local orders = {"Name", "Playtime"} table.sort(tbl, function (a, b) return (a.title:lower() < b.title:lower() ) end) function resortList(o_type, m_idx) local old_id = tbl[m_idx].id - if o_type == 1 then -- Playtime - table.sort(tbl, function (a, b) return (a.rtime > b.rtime ) end) - elseif o_type == 2 then -- Playtime - table.sort(tbl, function (a, b) return (a.rtime > b.rtime ) end) - end + table.sort(tbl, function (a, b) return (a.rtime > b.rtime ) end) for i, title in pairs(tbl) do if title.id == old_id then return i @@ -179,6 +173,7 @@ 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) @@ -200,7 +195,7 @@ function showAlarm(title, select_idx) Graphics.debugPrint(205, 235, "Yes", white) Graphics.debugPrint(205, 255, "No", white) end - +]]-- -- Scroll-list Renderer local sel_val = 128 local decrease = true