

bios_opc=1
transcolor=255
maron=color.new(130,0,0,transcolor)
dir_color=1
lng="AUTO"


function user_ac()
if files.exists("SYSTEM/config.ini") then files.remove("SYSTEM/config.ini") end
files.copy("SYSTEM/BiosROM/config.ini","SYSTEM/config.ini")
end

function estandarsetup()
ini.write("SYSTEM/BiosROM/bios.ini","starts",1)
ini.write("SYSTEM/BiosROM/bios.ini","passtart",1)
ini.write("SYSTEM/BiosROM/bios.ini","language",1)
dofile("SYSTEM/BiosROM/bios.ini")
end

function estandarpsp()
user_ac()
estandarsetup()
end

function savebios()
ini.write("SYSTEM/BiosROM/bios.ini","starts",starts)
ini.write("SYSTEM/BiosROM/bios.ini","passtart",passtart)
ini.write("SYSTEM/BiosROM/bios.ini","language",language)
end

tema=tonumber(ini.read("SYSTEM/config.ini","tema",2))
dofile("SYSTEM/BiosROM/bios.ini")


function bios()
while true do
controls.read()
blackred=color.new(139,69,19,transcolor)
if dir_color==1 then transcolor=transcolor-2.25 else transcolor=transcolor+2.25 end
if transcolor<100 then dir_color=2 end
if transcolor>280 then dir_color=1 end
draw.fillrect(0,0,480,272,azul)
screen.print(200,10,"ROM BIOS",0.8,blanco,0)
draw.rect(10,25,460,207,blanco)
screen.print(30,242,"PAD: MOVE     X: ENTER     O: EXIT     START: TURN OFF",0.6,blanco,0)
draw.rect(10,235,460,27,blanco)

for i=1,10 do
	if i==bios_opc then draw.fillrect(39,14+20*i,270,15,blackred) end
end

if controls.press("start") then power.suspend() end
if controls.press("circle") then presentacion() end

if language==1 then lng="[AUTO]" end
if language==2 then lng="[Catalá]" end
if language==3 then lng="[Euskadi]" end
if language==4 then language=1 end

if starts==2 then starts=0 end
if passtart==2 then passtart=0 end

if controls.press("cross") then
	if bios_opc==1 then estandarpsp() end
	if bios_opc==2 then starts=starts+1 end
	if bios_opc==3 then user_ac() end
	if bios_opc==4 then passtart=passtart+1 end
	if bios_opc==5 then language=language+1 end
	if bios_opc==6 then estandarsetup() end
	if bios_opc==7 then savebios() end
	if bios_opc==8 then dofile("SYSTEM/BiosROM/bios.ini") end
	if bios_opc==9 then 
		tema=tema+1 
		if tema>3 then tema=1 end
		ini.write("SYSTEM/config.ini","tema",tema)
	end
	if bios_opc==10 then presentacion() end
end

screen.print(40,37,"STANDARD HB SETUP",0.7,blanco,0)
screen.print(40,57,"START SCREEN STATE ["..starts.."]",0.7,blanco,0)
screen.print(40,77,"REMOVE USER ACCOUNTS",0.7,blanco,0)
screen.print(40,97,"PASSWORD STATE ["..passtart.."]",0.7,blanco,0)
screen.print(40,117,"LANGUAGE "..lng,0.7,blanco,0)
screen.print(40,137,"STANDARD BIOS SETUP",0.7,blanco,0)
screen.print(40,157,"SAVE BIOS DEFAULT",0.7,blanco,0)
screen.print(40,177,"LOAD BIOS DEFAULT",0.7,blanco,0)

if tema==1 then 
	screen.print(40,197,"THEME SETUP [ESTANDARD]",0.7,blanco,0) 
elseif tema==2 then
	screen.print(40,197,"THEME SETUP [BLACK&WHITE]",0.7,blanco,0) 
else
	screen.print(40,197,"THEME SETUP [CLASSIC]",0.7,blanco,0) 
end

screen.print(40,217,"EXIT",0.7,blanco,0)


if controls.press("up") then bios_opc=bios_opc-1 end
if controls.press("down") then bios_opc=bios_opc+1 end
if bios_opc>10 then bios_opc=1 elseif bios_opc<1 then bios_opc=10 end

screen.flip()
end
end
