--config.se.lua

System.memclean()
System.setHigh()

tpsexit = Timer.new()
tpsexit:stop()

------------------------------------------------------------------


while true do

screen:clear()
screen.flip()
screen:clear()
screen.flip()
screen:clear()

screen:fontPrint(sanssherif,20,20,"Checking ...",blanc)
screen.flip()
screen:fontPrint(sanssherif,20,20,"Checking ...",blanc)
screen.flip()

--vérif
if System.powerGetBatteryLifePercent() < 15 then
   tpsexit:start()
   break
end

--start

if System.powerGetBatteryLifePercent() > 15 then

screen:fontPrint(sanssherif,20,35,"Unassigning flash1:/",blanc)
screen.flip()
screen:fontPrint(sanssherif,20,35,"Unassigning flash1:/",blanc)
screen.flip()

System.unassign("flash1:")
System.assign("flash1:","lflash0:0,1","flashfat1:")


screen:fontPrint(sanssherif,20,50,"Reassigning flash1:/",blanc)
screen.flip()
screen:fontPrint(sanssherif,20,50,"Reassigning flash1:/",blanc)
screen.flip()

System.sleep(100)

screen:fontPrint(sanssherif,20,65,"Delete file flash1:/config.se",blanc)
screen.flip()
screen:fontPrint(sanssherif,20,65,"Delete file flash1:/config.se",blanc)
screen.flip()

--supp config.se

check = System.doesFileExist("flash1:/config.se") 
if check == 1 then
System.removeFile("flash1:/config.se")
end

screen:fontPrint(sanssherif,20,80,"Done!",blanc)
screen:fontPrint(sanssherif,20,110,"Shutdown the PSP in 2 sec...",rouge)
screen.flip()
screen:fontPrint(sanssherif,20,80,"Done!",blanc)
screen:fontPrint(sanssherif,20,110,"Shutdown the PSP in 2 sec...",rouge)
screen.flip()

System.sleep(2000)

System.shutdown()


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

------------------------------------------------------------------

while true do
screen:clear()
screen:fontPrint(sanssherif,20,15,"The battery has to be at least 15% charged!",blanc)

if tpsexit:time() > 2500 then
   dofile("ms0:/PSP/GAME/F1Dumper & Manager/script/mainmenu.lua")
end


screen.flip()
screen.waitVblankStart()
end 