forked from Hyperion/HyperionOS
e
This commit is contained in:
@@ -1,33 +1,35 @@
|
|||||||
local args={...}
|
local args={...}
|
||||||
|
local apis=args[2]
|
||||||
local term=args[4]
|
local term=args[4]
|
||||||
local getfile=args[5]
|
local getfile=args[5]
|
||||||
local computer=args[7]
|
local computer=args[7]
|
||||||
local timeout = 5
|
local timeout = computer.time()+5000
|
||||||
local time = 0
|
|
||||||
|
|
||||||
term.print("HBoot V1.0.0 //\n")
|
term.print("HBoot V1.0.0 //\n")
|
||||||
local w,h = term.getSize()
|
local w,h = term.getSize()
|
||||||
local kernel = load(getfile("/boot/Hyprkrnl.sys").readAllText())
|
local kernel = load(getfile("/boot/Hyprkrnl.sys").readAllText())
|
||||||
local recovery = load(getfile("/boot/util/shell").readAllText())
|
local recovery = load(getfile("/boot/util/shell").readAllText())
|
||||||
|
local dbg = {}
|
||||||
local entries = {
|
local entries = {
|
||||||
["HyperionOS"]=function() kernel(args) end,
|
{"HyperionOS",function() kernel(args) end},
|
||||||
["HyperionOS (Debug options)"]={
|
{"HyperionOS (Debug options)",dbg}
|
||||||
["Boot HyperionOS in debug mode"]=function() kernel(args, true) end,
|
|
||||||
["Boot as shell"]=function() kernel(args, true, true) end,
|
|
||||||
["Boot in recovery"]=function() recovery(args) end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbg = {
|
||||||
|
{"Back",entries},
|
||||||
|
{"Boot HyperionOS in debug mode",function() kernel(args, true) end},
|
||||||
|
{"Boot as shell",function() kernel(args, true, true) end},
|
||||||
|
{"Boot in recovery",function() recovery(args) end}
|
||||||
}
|
}
|
||||||
|
|
||||||
local function render(table, select)
|
local function render(table, select)
|
||||||
term.clear()
|
term.clear()
|
||||||
term.print("HBoot V1.0.0 //\n")
|
term.print("HBoot V1.0.0 //\n")
|
||||||
local idx=0
|
for i,v in pairs(table) do
|
||||||
for i,_ in pairs(table) do
|
if select=i then
|
||||||
idx=idx+1
|
term.print("- "..v[1])
|
||||||
if select=idx then
|
|
||||||
term.print("- "..i)
|
|
||||||
else
|
else
|
||||||
term.print(" "..i)
|
term.print(" "..v[1])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -40,15 +42,35 @@ while not exit do
|
|||||||
timeout=math.huge
|
timeout=math.huge
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
if timeout<=computer.time() then
|
||||||
|
exit=true
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if exit then
|
local cerent=entries
|
||||||
|
local cersel=1
|
||||||
|
if not exit then
|
||||||
while true do
|
while true do
|
||||||
local ret={computer.getMachineEvent()}
|
local ret={computer.getMachineEvent()}
|
||||||
if ret[1]="keyPressed" then
|
if ret[1]="keyTyped" then
|
||||||
elseif ret[1]="keyTyped" then
|
|
||||||
if ret[3]=="\n" then
|
if ret[3]=="\n" then
|
||||||
|
if type(cerent[cersel][2])=="function" then
|
||||||
|
cerent[cersel][2]()
|
||||||
|
elseif type(cerent[cersel][2])=="table" then
|
||||||
|
cerent=cerent[cersel][2]
|
||||||
|
cersel=1
|
||||||
|
end
|
||||||
|
elseif ret[3]=="\x1b[A" then
|
||||||
|
if cersel>1 then
|
||||||
|
cersel=cersel-1
|
||||||
|
end
|
||||||
|
elseif ret[3]=="\x1b[B" then
|
||||||
|
if cersel<#cerent then
|
||||||
|
cersel=cersel+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
kernel(args)
|
kernel(args)
|
||||||
|
|||||||
@@ -133,6 +133,10 @@ local lkeys={}
|
|||||||
lkeys[apis.keys.enter]="\n"
|
lkeys[apis.keys.enter]="\n"
|
||||||
lkeys[apis.keys.backspace]="\b"
|
lkeys[apis.keys.backspace]="\b"
|
||||||
lkeys[apis.keys.tab]="\t"
|
lkeys[apis.keys.tab]="\t"
|
||||||
|
lkeys[apis.keys.up]="\x1b[A"
|
||||||
|
lkeys[apis.keys.down]="\x1b[B"
|
||||||
|
lkeys[apis.keys.right]="\x1b[C"
|
||||||
|
lkeys[apis.keys.left]="\x1b[D"
|
||||||
|
|
||||||
local computer={}
|
local computer={}
|
||||||
computer.beep=function() end
|
computer.beep=function() end
|
||||||
|
|||||||
Reference in New Issue
Block a user