Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Doggy OS UEFI
- -- Function to draw a border
- local function drawBorder()
- term.clear()
- local w, h = term.getSize()
- for y = 1, h do
- term.setCursorPos(1, y)
- term.write("|")
- term.setCursorPos(w, y)
- term.write("|")
- end
- for x = 1, w do
- term.setCursorPos(x, 1)
- term.write("-")
- term.setCursorPos(x, h)
- term.write("-")
- end
- term.setCursorPos(1, 1)
- term.write("+")
- term.setCursorPos(w, 1)
- term.write("+")
- term.setCursorPos(1, h)
- term.write("+")
- term.setCursorPos(w, h)
- term.write("+")
- end
- -- Function to center text on the screen
- local function centerText(text, y)
- local w, _ = term.getSize()
- local x = math.floor((w - #text) / 2) + 1
- term.setCursorPos(x, y)
- term.write(text)
- end
- -- Function to show the UEFI message
- local function showUEFIMessage(message)
- drawBorder()
- local _, h = term.getSize()
- centerText("Doggy OS UEFI", math.floor(h / 2) - 1)
- centerText(message, math.floor(h / 2) + 1)
- end
- -- Function to load the boot animation
- local function loadBootAnimation()
- if fs.exists("/disk/boot/boot-animation") then
- shell.run("/disk/boot/boot-animation")
- else
- print("Boot animation not found!")
- end
- end
- -- Function to load the boot options
- local function loadBootOptions()
- if fs.exists("/disk/boot/boot-options") then
- shell.run("/disk/boot/boot-options")
- else
- print("Boot options not found!")
- end
- end
- -- Main function to handle UEFI message and timeout
- local function main()
- showUEFIMessage("Press DEL to show startup options")
- local timer = os.startTimer(2.5) -- Set a timer for 2 seconds
- while true do
- local event, param = os.pullEvent()
- if event == "key" and param == keys.delete then
- -- Update message and load boot options
- showUEFIMessage("Loading startup menu...")
- sleep(2.5) -- Pause for a bit longer to display the message
- loadBootOptions()
- return
- elseif event == "timer" and param == timer then
- -- Timer expired, load boot animation
- loadBootAnimation()
- return
- end
- end
- end
- -- Start the main function
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement