noir = Color.new(0,0,0)
splash0_en = Image.load("Images/splash0_en.png")
fleche = Image.load("Images/fleche.png")
select = 1
maj = "ms0:/PSP/GAME/ErrorF/Maj_en/EBOOT.PBP"

file = io.open("Cfg/maj_decompte.cfg", "r")
decompte = file:read()
file:close()
file = io.open("Cfg/passfix.cfg", "r")
pass = file:read()
file:close()

if pass == "true" then
dofile("splash_en.lua")
elseif pass ~= "true" or pass == "false" then
if decompte >= "1" and decompte <= "9" and decompte ~= "now" then
  file = io.open("Cfg/maj_decompte.cfg", "w")
  file:write(decompte - 1)
  file:close()
end
if decompte == "0" then
  file = io.open("Cfg/maj.cfg", "r")
  mode = file:read()
  file:close()
  file = io.open("Cfg/maj_decompte.cfg", "w")
  file:write(mode)
  file:close()
  System.runeboot(maj)
end
if mode == "no" then
  dofile("splash_en.lua")
end
end

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

screen:blit(0,0,splash0_en)
screen:print(2,262,"Next automatic update in "..decompte.." restart(s)",noir)

if select == 1 then
screen:clear()
screen:blit(0,0,splash0_en)
screen:print(2,262,"Next automatic update in "..decompte.." restart(s)",noir)
screen:blit(130,100,fleche)
end

if select == 2 then
screen:clear()
screen:blit(0,0,splash0_en)
screen:print(2,262,"Next automatic update in "..decompte.." restart(s)",noir)
screen:blit(130,129,fleche)
end

if pad:down() then
select = select + 1
end

if pad:up() then
select = select - 1
end

if select == 3 then
select = 1
end

if select == 0 then
select = 2
end

if pad:cross() then

if select == 1 then
screen.flip()
screen.waitVblankStart(7) 
dofile("splash_en.lua")
end

if select == 2 then
screen.flip()
screen.waitVblankStart(7)
System.runeboot(maj)
end

end

screen.flip()
screen.waitVblankStart(7) 
end
