Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function s(...) return sleep(...) end
- local function w(...) return write(...) end
- local function p(...) return print(...) end
- local function tw(...) return term.write(...) end
- local function scp(...) return term.setCursorPos(...) end
- local function sbc(...) return term.setBackgroundColor(...) end
- local function stc(...) return term.setTextColor(...) end
- local function tc(...) return term.clear(...) end
- local function tcl(...) return term.clearLine(...) end
- local function r(...) return shell.run(...) end
- local function sp(...) return textutils.slowPrint(...) end
- local function sw(...) return textutils.slowWrite(...) end
- local function fse(...) return fs.exists(...) end
- local function pul(...) return paintutils.loadImage(...) end
- local function pud(...) return paintutils.drawImage(...) end
- local function pfb(...) return paintutils.drawFilledBox(...) end
- local function su(...) return os.shutdown(...) end
- local function re(...) return os.reboot(...) end
- local function pdp(...) return paintutils.drawPixel(...) end
- local w, h = term.getSize()
- function advbios()
- while true do
- sbc(colors.lightGray)
- tc()
- sbc(colors.lightGray)
- pfb(1,1,w,1, colors.gray)
- pfb(1,h,w,h, colors.gray)
- ac = w/2
- stc(colors.white)
- scp(ac-10,1)
- p("Microcraft BIOS")
- pfb(1,2,w,2,colors.black)
- scp(1,2)
- sbc(colors.black)
- stc(colors.white)
- p("Main")
- scp(7,2)
- p("Boot")
- sbc(colors.white)
- stc(colors.black)
- scp(13,2)
- p("Advanced")
- scp(1,4)
- sbc(colors.lightGray)
- stc(colors.white)
- miejsce = fs.getFreeSpace("/")
- miejscekb = miejsce/1024
- p("Microcraft Bootloader")
- local startupBoot = settings.get("shell.allow_startup", "not set")
- local hidden = settings.get("list.show_hidden", "not set")
- local multishell = settings.get("bios.use_multishell", "not set")
- p("Set defaults")
- p("1. Show hidden files: ", hidden)
- p("2. Use multishell: ", multishell)
- scp(1,h)
- sbc(colors.gray)
- stc(colors.white)
- write("Press HERE to reboot.")
- local event, button, x, y = os.pullEvent("mouse_click")
- if x>0 and x<7 and y == 2 then bios() end
- if x>6 and x<12 and y == 2 then bootbios() end
- if x>0 and x<w and y == h then re() end
- if x>0 and x<30 and y == 5 then
- settings.set("shell.allow_startup", true)
- settings.set("list.show_hidden", false)
- settings.set("bios.use_multishell", true)
- settings.save(".settings")
- end
- if x>0 and x<30 and y == 6 and hidden == "not set" or x>0 and x<30 and y == 6 and hidden == false then
- settings.set("list.show_hidden", true)
- settings.save(".settings")
- end
- if x>0 and x<30 and y == 6 and hidden == "not set" or x>0 and x<30 and y == 6 and hidden == true then
- settings.set("list.show_hidden", false)
- settings.save(".settings")
- end
- if x>0 and x<30 and y == 7 and multishell == "not set" or x>0 and x<30 and y == 7 and multishell == false then
- settings.set("bios.use_multishell", true)
- settings.save(".settings")
- end
- if x>0 and x<30 and y == 7 and multishell == "not set" or x>0 and x<30 and y == 7 and multishell == true then
- settings.set("bios.use_multishell", false)
- settings.save(".settings")
- end
- end
- end
- function bios()
- while true do
- sbc(colors.lightGray)
- tc()
- sbc(colors.lightGray)
- pfb(1,1,w,1, colors.gray)
- pfb(1,h,w,h, colors.gray)
- ac = w/2
- stc(colors.white)
- scp(ac-10,1)
- p("Microcraft BIOS")
- pfb(1,2,w,2,colors.black)
- scp(1,2)
- sbc(colors.white)
- stc(colors.black)
- p("Main")
- sbc(colors.black)
- stc(colors.white)
- scp(7,2)
- p("Boot")
- scp(13,2)
- p("Advanced")
- scp(1,4)
- sbc(colors.lightGray)
- stc(colors.white)
- miejsce = fs.getFreeSpace("/")
- miejscekb = math.ceil(miejsce/1024)
- p("Microcraft Bootloader")
- p("BIOS version: 0.2A")
- p("HDD Free space: ", miejscekb, "KB")
- p("CraftOS version: ", os.version())
- local nextui = fse("/os/.next")
- local minecore = fse("/os/.menu")
- local hydra = fse("/hydra/.next")
- p("")
- p("")
- p("Installed operating systems:")
- p("NextUI: ", nextui)
- p("MineCore: ", minecore)
- p("HydraUI: ", hydra)
- scp(1,h)
- sbc(colors.gray)
- stc(colors.white)
- write("Press HERE to reboot.")
- local event, button, x, y = os.pullEvent("mouse_click")
- if x>6 and x<12 and y == 2 then bootbios() end
- if x>12 and x<24 and y == 2 then advbios() end
- if x>0 and x<w and y == h then re() end
- end
- end
- function bootbios()
- while true do
- sbc(colors.lightGray)
- tc()
- sbc(colors.lightGray)
- pfb(1,1,w,1, colors.gray)
- pfb(1,h,w,h, colors.gray)
- ac = w/2
- stc(colors.white)
- scp(ac-10,1)
- p("Microcraft BIOS")
- pfb(1,2,w,2,colors.black)
- sbc(colors.white)
- stc(colors.black)
- scp(7,2)
- p("Boot")
- scp(1,2)
- sbc(colors.black)
- stc(colors.white)
- p("Main")
- scp(13,2)
- p("Advanced")
- scp(1,4)
- sbc(colors.lightGray)
- stc(colors.white)
- p("Microcraft Bootloader")
- local startupBoot = settings.get("shell.allow_startup", "not set")
- local bootFromDisk = settings.get("shell.allow_disk_startup", "not set")
- p("Set defaults")
- p("1. Floppy Disk startup: ", bootFromDisk)
- p("2. Startup from HDD: ", startupBoot)
- scp(1,h)
- sbc(colors.gray)
- stc(colors.white)
- write("Press HERE to reboot.")
- local event, click, x, y = os.pullEvent("mouse_click")
- if x>0 and x<7 and y == 2 then bios() end
- if x>12 and x<24 and y == 2 then advbios() end
- if x>0 and x<30 and y == 5 then
- settings.set("shell.allow_disk_startup", false)
- settings.set("shell.allow_startup", true)
- settings.save(".settings")
- end
- if x>0 and x<25 and y == 6 and bootFromDisk == "not set" or x>0 and x<30 and y == 6 and bootFromDisk == false then
- settings.set("shell.allow_disk_startup", true)
- settings.save(".settings")
- end
- if x>0 and x<25 and y == 6 and bootFromDisk == "not set" or x>0 and x<30 and y == 6 and bootFromDisk == true then
- settings.set("shell.allow_disk_startup", false)
- settings.save(".settings")
- end
- if x>0 and x<30 and y == 7 and startupBoot == "not set" or x>0 and x<30 and y == 7 and startupBoot == false then
- settings.set("shell.allow_startup", true)
- settings.save(".settings")
- end
- if x>0 and x<30 and y == 7 and startupBoot == "not set" or x>0 and x<30 and y == 7 and startupBoot == true then
- settings.set("shell.allow_startup", false)
- settings.save(".settings")
- end
- if x>0 and x<w and y == h then re() end
- end
- end
- function boot()
- tc()
- pfb(1, 1, w, h, colors.gray)
- stc(colors.white)
- if fse("/disk/startup") then dysk = 1 end
- scp(1,1)
- p("Microcraft")
- scp(1,4)
- p("2021 (c) Microcraft")
- p("Bootloader version: Beta 3A")
- s(1)
- sp("Searching for bootable media...")
- s(1)
- while true do
- tc()
- scp(1,1)
- p("Choose operating system to boot")
- if fse("/os/.next") then
- pfb(3, 4, 13, 6, colors.orange)
- scp(3,5)
- stc(colors.white)
- p("NextUI")
- end
- if fse("/os/.menu") then
- pfb(27, 4, 37, 6, colors.cyan)
- scp(27,5)
- stc(colors.white)
- p("MineCore")
- end
- pfb(15, 4, 25, 6, colors.green)
- scp(15,5)
- stc(colors.white)
- p("BIOS")
- if fse("/hydra/.next") then
- pfb(39, 4, 49, 6, colors.red)
- scp(39,5)
- stc(colors.white)
- p("HydraUI")
- end
- scp(1,h)
- write("CraftOS")
- if fse("/disk/startup") then dysk = 1 end
- if dysk == 1 then
- pfb(3, 8, 13, 10, colors.purple)
- scp(3,9)
- stc(colors.white)
- p("Boot disk")
- end
- sbc(colors.black)
- local event, click, x, y = os.pullEvent("mouse_click")
- if x>0 and x<w and y == h then scp(1,1) sbc(colors.black) tc() sbc(colors.black) break end
- if x>2 and x<14 and y>3 and y<7 and fse("/os/.next") then r("/os/.next") break end
- if x>14 and x<26 and y>3 and y<7 then bios() end
- if x>2 and x<14 and y>7 and x<11 and fse("/disk/startup") then r("/disk/startup") break end
- end
- end
- boot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement