From 296aba9a2f1507a8ffd03800455e8f1b90a97e01 Mon Sep 17 00:00:00 2001 From: Ponali Date: Sun, 5 Oct 2025 08:09:14 +0200 Subject: [PATCH] made fetch get the logo, instead of getting preloaded when booting --- halyde/apps/fetch.lua | 28 +++++++++++++++++++--------- halyde/kernel/boot.lua | 8 -------- halyde/kernel/modules/defenv.lua | 5 ++--- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/halyde/apps/fetch.lua b/halyde/apps/fetch.lua index ef387a8..80b80cf 100644 --- a/halyde/apps/fetch.lua +++ b/halyde/apps/fetch.lua @@ -1,5 +1,6 @@ local component = require("component") local computer = require("computer") +local filesystem = require("filesystem") local function printstat(text) local cursorPosX, cursorPosY = terminal.getCursorPos() @@ -7,18 +8,27 @@ local function printstat(text) terminal.write(text .. "\n", false) end -terminal.write(_OSLOGO, false) +local logo = "" +local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil +repeat + tmpdata = handle:read(math.inf or math.maxinteger) + logo = logo .. (tmpdata or "") +until not tmpdata + +terminal.write(logo, false) local cursorPosX, cursorPosY = terminal.getCursorPos() terminal.setCursorPos(cursorPosX, cursorPosY - 17) -printstat("\27[92mOS\27[0m: ".._OSVERSION) -printstat("\27[92mArchitecture\27[0m: ".._VERSION) +printstat("\27[92mOS\27[0m: " .. _OSVERSION) +printstat("\27[92mArchitecture\27[0m: " .. _VERSION) local componentCounter = 0 for _, _ in component.list() do componentCounter = componentCounter + 1 end -printstat("\27[92mComponents\27[0m: "..tostring(componentCounter)) -printstat("\27[92mCoroutines\27[0m: "..tostring(#tsched.getTasks())) -printstat("\27[92mBattery\27[0m: "..tostring(math.floor(computer.energy() / computer.maxEnergy() * 1000 + 0.5) / 10).."%") +printstat("\27[92mComponents\27[0m: " .. tostring(componentCounter)) +printstat("\27[92mCoroutines\27[0m: " .. tostring(#tsched.getTasks())) +printstat( + "\27[92mBattery\27[0m: " .. tostring(math.floor(computer.energy() / computer.maxEnergy() * 1000 + 0.5) / 10) .. "%" +) local totalMemory = computer.totalMemory() local usedMemory = computer.totalMemory() - computer.freeMemory() local totalMemoryString @@ -41,7 +51,7 @@ elseif convert(usedMemory, "B", "KiB") >= 1 then else usedMemoryString = tostring(usedMemory) .. " B" end -printstat("\27[92mMemory\27[0m: "..usedMemoryString.." / "..totalMemoryString) +printstat("\27[92mMemory\27[0m: " .. usedMemoryString .. " / " .. totalMemoryString) local totalDisk = component.invoke(computer.getBootAddress(), "spaceTotal") local usedDisk = component.invoke(computer.getBootAddress(), "spaceUsed") local totalDiskString @@ -64,9 +74,9 @@ elseif convert(usedDisk, "B", "KiB") >= 1 then else usedDiskString = tostring(usedDisk) .. " B" end -printstat("\27[92mDisk\27[0m: "..usedDiskString.." / "..totalDiskString) +printstat("\27[92mDisk\27[0m: " .. usedDiskString .. " / " .. totalDiskString) local width, height = component.invoke(component.list("gpu")(), "getResolution") -printstat("\27[92mResolution\27[0m: "..tostring(width).."x"..tostring(height).."\n") +printstat("\27[92mResolution\27[0m: " .. tostring(width) .. "x" .. tostring(height) .. "\n") printstat("\27[40m \27[41m \27[42m \27[43m \27[44m \27[45m \27[46m \27[47m ") printstat("\27[100m \27[101m \27[102m \27[103m \27[104m \27[105m \27[106m \27[107m ") local cursorPosX, cursorPosY = terminal.getCursorPos() diff --git a/halyde/kernel/boot.lua b/halyde/kernel/boot.lua index 10d984a..72f30e5 100644 --- a/halyde/kernel/boot.lua +++ b/halyde/kernel/boot.lua @@ -1,7 +1,6 @@ local loadfile = ... local filesystem = assert(loadfile("/lib/filesystem.lua")(loadfile)) _G._OSVERSION = "HALYDE VERSION" -- TODO: Put this in a separate config file -_G._OSLOGO = "" _G._PUBLIC = {} _G._PUBLIC.unicode = assert(loadfile("/lib/unicode.lua")(loadfile)) local component = assert(loadfile("/lib/component.lua")(loadfile)) @@ -15,13 +14,6 @@ local log = assert(loadfile("/lib/log.lua")(loadfile)) log.kernel.info("Bound GPU to screen " .. tostring(screenAddress)) -local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil -repeat - tmpdata = handle:read(math.huge) - _OSLOGO = _OSLOGO .. (tmpdata or "") -until not tmpdata -handle:close() - log.kernel.info("Loaded OS logo") _G.package = { ["preloaded"] = {} } diff --git a/halyde/kernel/modules/defenv.lua b/halyde/kernel/modules/defenv.lua index 2844562..fa9a87c 100644 --- a/halyde/kernel/modules/defenv.lua +++ b/halyde/kernel/modules/defenv.lua @@ -1,6 +1,6 @@ local module = {} -module.dependencies = {"terminal"} +module.dependencies = { "terminal" } function module.check() return true -- This module should always be loaded @@ -11,7 +11,6 @@ function module.init() "print", "_VERSION", "_OSVERSION", - "_OSLOGO", "assert", "error", "getmetatable", @@ -39,7 +38,7 @@ function module.init() "table", "checkArg", "utf8", - "convert" + "convert", } for _, value in ipairs(publicTable) do _G._PUBLIC[value] = table.copy(_G[value])