From 67ecaec76ed7abbf9338e21ce66da2681a6b3e6e Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Fri, 4 Aug 2017 08:25:23 +1000 Subject: [PATCH] updated SEBIOS to have a nicer UI --- sebios.lua | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/sebios.lua b/sebios.lua index c0bc350..31badfb 100644 --- a/sebios.lua +++ b/sebios.lua @@ -65,27 +65,41 @@ do local gP,cy = component.proxy(gA),1 gP.bind(sA) local sx, sy = gP.getResolution() - gP.fill(1,1,sx,sy," ") local function wl(s) gP.set(1,cy,s) cy=cy+1 end - wl("SKS Enhanced BIOS v1") - wl("Memory: "..tostring(computer.totalMemory()/1024).."K") - wl(" ") - for k,v in ipairs(bootdevs) do - wl(tostring(k).." "..v.." "..component.type(v).." "..(component.invoke(v,"getLabel") or "")) + local cba = computer.getBootAddress() + local S = " " + local function rdraw() + gP.fill(1,1,sx,sy," ") + cy=1 + wl("SKS Enhanced BIOS v1") + wl("Memory: "..tostring(computer.totalMemory()/1024).."K") + wl(" ") + for k,v in ipairs(bootdevs) do + if v == cba then S = " * " else S = " " end + wl(S..tostring(k).." "..v.." "..component.type(v).." "..(component.invoke(v,"getLabel") or "")) + end end + rdraw() local timer = 5 + local bhc = false while computer.uptime() < timer do - t,_,c = computer.pullSignal(0.5) + t,_,c,C = computer.pullSignal(0.5) if t == "key_down" and c > 48 and c < 58 then - computer.setBootAddress(bootdevs[c-48]) - wl("Boot device set to "..bootdevs[c-48]) + cba = bootdevs[c-48] + bhc = true + rdraw() elseif t == "key_down" and c == 32 then timer = timer + 10 + elseif t == "key_down" and c == 13 and C == 28 then + timer = 0 end end + if bhc then + computer.setBootAddress(cba) + end end end