-- luafiler v0.10-beta3 (c) 2006 mallchin, http://www.mallchin.com/luafm/
-- You are free to distribute this file without modifications.

-- display splashscreen
showsplash = false
if showsplash then
  splash = Image.load("Media/splash.png")
  screen:blit(0, 0, splash, 0, 0, splash:width(), splash:height(), false)
  screen.flip()
end

-- 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")

-- 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)

-- include settings
dofile("settings.ini")

-- define vars
version = "0.10-beta3"
debug = false
screen_width = 480
screen_height = 272
max_filechars = 51
num_listings = 23
shadow_xoffset = 1
shadow_yoffset = 1
skip_finish_file_operations = false
break_app = false
drives = { Flash0 = "flash0:/", Flash1 = "flash1:/", MemoryStick = "ms0:/", UMD = "disc0:/" }
origdir = System.currentDirectory()
itemtimer = Timer.new()
cut_files = {}
copy_files = {}
selected_files = {}

-- theme
oncol = green			-- highlited items colour
offcol = transparentwhite	-- unselected items colour
cutcol = grey			-- cut items colour
copycol = yellow		-- copied items colour
selectedcol = yellow		-- selected items colour
backgroundimg = "Media/bg.png"	-- set background image

-- load images
background = Image.load(backgroundimg)

-- init file list
menu_pointer = 1
init_files(initpath)
padmode = "filelist"

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

-- render file list
render_filelist()

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

-- read pad
readpad()

-- reset dir
System.currentDirectory(origdir)
