cls() function _init() --main init loop mode=0 --define vars p=1 e=0 c=0 dir="" dirt="/" odir={} end function _update() --main update loop flip() if dirt==nil then dirt="/" end if mode==0 then --check if mode=0 flip() fil=ls(dirt.."/") --set fil to current dir path if fil==nil then end dir=fil[p+e] --set dir to current file+extention+location mode=1 --set mode to 1 a=#fil --set a to fil table if a>24 then --check if total # of files is more then display size a=24 end elseif mode==1 then --check if mode=1 flip() cls(1) --clear screen to color 1 for i=1+e,a+e do --for i=1+selected file, (incremented by total files+scroll amount) t=fil[i] --set t to index number of current file c=2 if sub(t,-4)==".p64" then --check for carts c=14 elseif sub(t,-4)==".txt" then --txt c=6 elseif sub(t,-4)==".lua" then --check for .lua c=12 elseif sub(t,-4)==".sfx" then --check for sfx c=8 elseif sub(t,-4)==".gfx" then -- gfx c=9 elseif sub(t,-4)==".map" then --map c=23 elseif sub(t,-4)==".pod" then --pods c=30 else c=21 t=fil[i].."/" end if p==i-e then t="\^i"..t end print(t,12,-4+(i-e)*10,c) end if btn(2) and p+e>1 then p=p-1 if p==0 then p=1 e=e-1 end elseif btn(3) and p+e<#fil then p=p+1 if p==24 and p+e<#fil then p=23 e=e+1 end elseif btn(1) then p=a e=abs(a-#fil) elseif btn(0) then p=1 e=0 elseif btn(4) then flip() mode=2 add(odir,dirt) end elseif mode==2 then ext=sub(fil[p+e],-4) dir=fil[p+e] cls(1) color(6) if ext==".p64" then run_terminal_command("load ".."/"..dirt.."/"..fil[p+e]) notifyload_stop_cart() elseif ext==".lua" or ext==".txt" then run_terminal_command("code ".."/"..dirt.."/"..fil[p+e]) notifyload_stop_cart() elseif ext==".gfx" then run_terminal_command("gfx ".."/"..dirt.."/"..fil[p+e]) notifyload_stop_cart() elseif ext==".map" then run_terminal_command("map ".."/"..dirt.."/"..fil[p+e]) notifyload_stop_cart() elseif ext==".sfx" then run_terminal_command("sfx ".."/"..dirt.."/"..fil[p+e]) notifyload_stop_cart() end if dir==nil then dir="/" elseif not(sub(ext,1,1)==".") then p=1 e=0 dirt=dirt.."/"..dir mode=0 end end if p>a then p=a end rect(0,0,478,269,7) rect(1,1,479,268,7) line(0,252,480,252) line(0,251,480,251) if btn(5) then flip() dirt=odir[#odir] del(odir,odir[#odir]) mode=0 p=1 e=0 cls() flip() end --go back a dir on x press print("z to open selected file | x to go back a dir | up/down to scroll | left/right to goto end/start",3,253) --print instructions (end-user) print(dirt,3,260) line(478,#fil+3,478,4,13) line(479,#fil+3,479,4,13) line(479,(p+e+3),470,(p+e+3),24) if dir==nil then panic() end color(7) end function panic() dirt=odir[#odir] del(odir,odir[#odir]) mode=0 p=1 e=0 notify_user("Filetype not supported or Directory is Empty!!") end function notifyload_stop_cart() notify_user("Loaded "..dirt.."/"..fil[p+e].." !") stop() end