First commit. Not even working prototype yet.

This commit is contained in:
Wahlolly
2025-04-02 19:39:36 +03:00
parent dd3e9e0d6d
commit 4adc959549
7 changed files with 226 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
local gpu = component.proxy(component.list("gpu")())
local resx, resy = gpu.getResolution()
local function loadfile(file)
checkArg(1, file, "string")
local handle = component.invoke(computer.getBootAddress(), "open", file, "r")
local data = ""
repeat
local tmpdata = component.invoke(computer.getBootAddress(), "read", handle, math.huge or math.maxinteger)
data = data .. (tmpdata or "")
until not tmpdata
component.invoke(computer.getBootAddress(), "close", handle)
return(assert(load(data, "=" .. file)))
end
local function handleError(errorMessage)
return(errorMessage.."\n \n"..debug.traceback())
end
function loadthething()
loadfile("/halyde/core/boot.lua")(loadfile)
end
while true do
gpu.setBackground(0x000000)
gpu.fill(1, 1, resx, resy, " ")
local result, reason = xpcall(loadthething, handleError)
if not result then
gpu.setBackground(0x000000)
gpu.fill(1, 1, resx, resy, " ")
gpu.setBackground(0x800000)
gpu.setForeground(0xFFFFFF)
gpu.set(2,2,"A critical error has occurred.")
local i = 4
reason = reason:gsub("\t", " ")
for line in string.gmatch((reason ~= nil and tostring(reason)) or "unknown error", "([^\n]*)\n?") do
gpu.set(2,i,line)
i = i + 1
end
gpu.set(2,i+1, "Press any key to restart.")
local evname = ""
repeat
evname = computer.pullSignal()
until evname == "key_down"
end
end