Advertisement
DOGGYWOOF

DOGGY OS BIOS

Jun 30th, 2024 (edited)
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. -- Doggy OS UEFI
  2.  
  3. -- Function to draw a border
  4. local function drawBorder()
  5. term.clear()
  6. local w, h = term.getSize()
  7. for y = 1, h do
  8. term.setCursorPos(1, y)
  9. term.write("|")
  10. term.setCursorPos(w, y)
  11. term.write("|")
  12. end
  13. for x = 1, w do
  14. term.setCursorPos(x, 1)
  15. term.write("-")
  16. term.setCursorPos(x, h)
  17. term.write("-")
  18. end
  19. term.setCursorPos(1, 1)
  20. term.write("+")
  21. term.setCursorPos(w, 1)
  22. term.write("+")
  23. term.setCursorPos(1, h)
  24. term.write("+")
  25. term.setCursorPos(w, h)
  26. term.write("+")
  27. end
  28.  
  29. -- Function to center text on the screen
  30. local function centerText(text, y)
  31. local w, _ = term.getSize()
  32. local x = math.floor((w - #text) / 2) + 1
  33. term.setCursorPos(x, y)
  34. term.write(text)
  35. end
  36.  
  37. -- Function to show the UEFI message
  38. local function showUEFIMessage()
  39. drawBorder()
  40. local _, h = term.getSize()
  41. centerText("Doggy OS UEFI", math.floor(h / 2) - 1)
  42. centerText("Press Enter for boot options", math.floor(h / 2) + 1)
  43. end
  44.  
  45. -- Function to load the boot animation
  46. local function loadBootAnimation()
  47. if fs.exists("/disk/boot/boot-animation") then
  48. shell.run("/disk/boot/boot-animation")
  49. else
  50. print("Boot animation not found!")
  51. end
  52. end
  53.  
  54. -- Function to load the boot options
  55. local function loadBootOptions()
  56. if fs.exists("/disk/boot/boot-options") then
  57. shell.run("/disk/boot/boot-options")
  58. else
  59. print("Boot options not found!")
  60. end
  61. end
  62.  
  63. -- Main function to handle UEFI message and timeout
  64. local function main()
  65. showUEFIMessage()
  66. local timer = os.startTimer(2) -- Set a timer for 2 seconds
  67.  
  68. while true do
  69. local event, param = os.pullEvent()
  70. if event == "key" and param == keys.enter then
  71. -- Load boot options if Enter is pressed
  72. loadBootOptions()
  73. return
  74. elseif event == "timer" and param == timer then
  75. -- Timer expired, load boot animation
  76. loadBootAnimation()
  77. return
  78. end
  79. end
  80. end
  81.  
  82. -- Start the main function
  83. main()
  84.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement