font = Font.load("Geek a byte 2.ttf")
font:setPixelSizes(20,25)


Bild = Image.load("1background.jpg")


rot = Color.new(255,0,0)
blau = Color.new(0,0,255)
weiss = Color.new(255,255,255)


battr = System.powerGetBatteryLifePercent()

current = 1
oldpad = Controls.read()
umdgroesse = UMD.getSize()
msspeicherplatz = System.getFreeSpace("ms0:")
while true do
    pad =Controls.read()
    screen:clear()
	screen:blit(0,0,Bild,true)

  
screen:fontPrint(font,20,100,"Rip UMD",blau)
screen:fontPrint(font,20,120,"Start UMD!",blau)
screen:fontPrint(font,20,140,"Back to the LUA-Tool!",blau)

	if current == 1 then
    screen:fontPrint(font,20,100,"Rip UMD",rot)
    end
	if current == 2 then
	screen:fontPrint(font,20,120,"Start UMD!",rot)
	end
	if current == 3 then
	screen:fontPrint(font,20,140,"Back to the LUA-Tool!",rot)
	end

if pad:up() and oldpad:up() ~= pad:up() then
    current = current - 1
    end
    if pad:down() and oldpad:down() ~= pad:down() then
    current = current + 1
    end



if pad:cross() and current == 1 then
if msspeicherplatz > umdgroesse then
    cso = System.startOSK("ms0:/ISO/CSOName.cso","Please enter the UMD name!") end
    
if msspeicherplatz > umdgroesse then
    UMD.ripISO(cso) end
        
if msspeicherplatz < umdgroesse then
    System.message("Not enough Free Space!",0)
    dofile("LUATool.lua")
  end    
  
  end  
  

if pad:cross() and current == 2 then
System.startUMD()
end

if pad:cross() and current == 3 then
Bild = nil
dofile("LUATool.lua")
end

 if current == 0 then
    current = 3
    end
    if current == 4 then
    current = 1
    end


screen:print(300, 10, "Batterie-Status:", weiss)
screen:print(440, 10, battr , rot)
screen:print(460, 10, "%", rot)

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