Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local w, h = term.getSize()
- -- Function to center text horizontally
- local function centerText(y, text)
- local x = math.floor((w - #text) / 2)
- term.setCursorPos(x, y)
- term.write(text)
- end
- -- Function to draw the spinner animation
- local function drawSpinner(x, y, duration)
- local spinnerFrames = {
- "[ ]",
- "[= ]",
- "[== ]",
- "[=== ]",
- "[====]",
- "[ ===]",
- "[ ==]",
- "[ =]",
- "[ ]",
- "[ =]",
- "[ ==]",
- "[ ===]",
- "[====]",
- "[=== ]",
- "[== ]",
- "[= ]"
- }
- local delay = 0.1
- local frameCount = #spinnerFrames
- local spinnerX = x
- local spinnerY = y
- local spinnerIndex = 1
- local startTime = os.clock()
- while os.clock() - startTime < duration do
- term.setCursorPos(spinnerX, spinnerY)
- term.write(spinnerFrames[spinnerIndex])
- spinnerIndex = spinnerIndex % frameCount + 1
- os.sleep(delay)
- end
- end
- -- ASCII art dog image
- local dogImage = {
- " |\\_/| ",
- " | @ @ Doggy OS ",
- " | <> _ ",
- " | _/\\------____ ((| |))",
- " | `--' | ",
- " _____|_ ___| |___.' ",
- "/_/_____/____/_______| "
- }
- -- Function to draw the ASCII art
- local function drawASCIIArt(y)
- for i, line in ipairs(dogImage) do
- centerText(y + i - 1, line)
- end
- end
- -- Function to show UEFI messages
- local function showUEFIMessage(message)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setTextColor(colors.white)
- local artHeight = #dogImage
- local artY = math.floor((h - artHeight) / 2)
- drawASCIIArt(artY)
- local messageY = artY + #dogImage + 2
- centerText(messageY, message)
- end
- -- Function to display startup options menu
- local function showStartupMenu()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setTextColor(colors.white)
- centerText(math.floor(h / 2) - 2, "Startup Options")
- local options = {
- "1. Safe Mode",
- "2. Debugging Tools",
- "3. Normal Boot"
- }
- for i, option in ipairs(options) do
- centerText(math.floor(h / 2) + i - 1, option)
- end
- centerText(h - 1, "Press a number to select an option.")
- while true do
- local event, param = os.pullEvent("key")
- if param == keys.one then
- return "safe"
- elseif param == keys.two then
- return "debug"
- elseif param == keys.three then
- return "normal"
- end
- end
- end
- -- Placeholder function for boot options
- local function loadBootOptions()
- local mode = showStartupMenu()
- if mode == "safe" then
- showUEFIMessage("Booting into Safe Mode...")
- os.sleep(2)
- elseif mode == "debug" then
- showUEFIMessage("Launching Debugging Tools...")
- os.sleep(2)
- elseif mode == "normal" then
- showUEFIMessage("Starting Normal Boot...")
- os.sleep(2)
- end
- end
- -- Placeholder function for boot animation
- local function loadBootAnimation()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setTextColor(colors.white)
- local artHeight = #dogImage
- local artY = math.floor((h - artHeight) / 2)
- drawASCIIArt(artY)
- -- Calculate spinner position
- local spinnerX = math.floor(w / 2) - 3
- local spinnerY = artY + artHeight + 2
- -- Start spinner animation
- drawSpinner(spinnerX, spinnerY, 9) -- Spinner runs for 9 seconds
- end
- -- Main function
- local function main()
- showUEFIMessage("Press DEL to show startup options")
- local timer = os.startTimer(2.5) -- Set a timer for 2.5 seconds
- while true do
- local event, param = os.pullEvent()
- if event == "key" and param == keys.delete then
- -- If DELETE key is pressed, load boot options
- showUEFIMessage("Loading startup menu...")
- os.sleep(2.5)
- loadBootOptions()
- return
- elseif event == "timer" and param == timer then
- -- If timer expires, load boot animation
- loadBootAnimation()
- return
- end
- end
- end
- -- Run the main function
- main()
- -- Clear screen after shutdown
- term.setBackgroundColor(colors.black)
- term.clear()
- -- Load lockscreen
- if fs.exists("disk/os/lock.lua") then
- shell.run("disk/os/lock.lua")
- else
- term.setTextColor(colors.red)
- centerText(math.floor(h / 2), "Error: lock.lua not found!")
- os.sleep(3)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement