System.memclean()
Blanc = Color.new (255,255,255)

fond = Image.load("images/dump.png")
battery1 = Image.load("images/Copie de battery4.png")
battery2 = Image.load("images/Copie de battery3.png")
battery3 = Image.load("images/Copie de battery2.png")
battery4 = Image.load("images/Copie de battery1.png")

function Nil_Pictures()
fond = nil
battery1 = nil
battery2 = nil
battery3 = nil
battery4 = nil
end

X = { X = 10, Vitesse = 2 }

Fleche = "->"

Selected = 0
Y = 105

OldPad = Controls.read()

while true do
screen:clear(Blanc)
Pad = Controls.read()

screen:blit(0,0,fond)

if System.powerGetBatteryLifePercent() >= 0 then batteryL = battery1 end
if System.powerGetBatteryLifePercent() > 30 then batteryL = battery2 end
if System.powerGetBatteryLifePercent() > 50 then batteryL = battery3 end
if System.powerGetBatteryLifePercent() > 70 then batteryL = battery4 end

screen:blit(456,4,batteryL)

screen:print(93,105,"Lancer l'UMD")
screen:print(93,165,"Dumper l'UMD")
screen:print(93,225,"Activer l'USB (Mode UMD)")

screen:print(65,Y,Fleche)

if Pad:up() and not OldPad:up() then
Selected = Selected - 1
end

if Pad:down() and not OldPad:down () then
Selected = Selected + 1
end

if Selected <= 1 then
Selected = 1
Y = 105
end


if Selected == 2 then
Y = 165
end

if Selected >= 3 then
Selected = 3
Y = 225
end

if Pad:cross() and not OldPad:cross() and Selected == 1 then
System.startUMD()
end

if Pad:cross() and not OldPad:cross() and Selected == 2 then
Nil_Pictures()
dofile("Scripts/Dump.lua")
end

if Pad:cross() and not OldPad:cross() and Selected == 3 then
System.usbDevUMD()
System.usbDiskModeActivate()
end

if Pad:circle() and not OldPad:circle() then
System.usbDiskModeDeactivate()
end

if System.usbState(1,0) == 1 then
screen:print(2,262,"USB Active")
end

if Pad:square() then
Nil_Pictures()
dofile("Scripts/menu.lua")
end

screen.waitVblankStart()
screen.flip()
OldPad = Pad
end 