
-- include functions
dofile("System/functions/generic.lua")
dofile("System/functions/misc.lua")
dofile("System/functions/readpad.lua")
dofile("System/functions/render.lua")
dofile("System/functions/file_actions.lua")
dofile("System/functions/file_operations.lua")
dofile("System/functions/display_help.lua")
dofile("System/functions/display_credits.lua")
dofile("System/functions/usb.lua")
-- include settings
dofile("settings.ini")

-- define colours
black = Color.new(0, 0, 0)
white = Color.new(255, 255, 255)
red = Color.new(255, 0, 0)
green = Color.new(0, 255, 0)
blue = Color.new(0, 0, 255)
darkblue = Color.new(0, 0, 192)
grey = Color.new(192, 192, 192)
yellow = Color.new(255, 255, 0)
brown = Color.new(150, 143, 86)
purple = Color.new(92, 59, 90)
transparentwhite = Color.new(255, 255, 255, 128)

-- define vars
version = "FLASHX 0.5XP"
debug = false
screen_width = 480
screen_height = 272
max_filechars = 51
num_listings = 23
oncol = green
offcol = transparentwhite
cutcol = grey
copycol = yellow
selectedcol = yellow
shadow_xoffset = 1
shadow_yoffset = 1
menu_pointer = 1
origdir = System.currentDirectory()
cut_files = {}
copy_files = {}
selected_files = {}

-- load images
background = Image.load("Media/bg.png")

-- get file list
System.currentDirectory(section)
update_files()

-- pause
if showsplash then
  screen.waitVblankStart(120)
end

-- render file list
render_filelist()

-- flip screen
screen.flip()
screen.waitVblankStart()

-- read pad
padmode = "filelist"
readpad()

-- reset dir
System.currentDirectory(origdir)