mirror of
https://github.com/Adorable-Catgirl/Zorya-NEO.git
synced 2024-12-23 09:28:07 +11:00
i split it all up
This commit is contained in:
parent
3c18756141
commit
1ffba24166
@ -1,6 +1,14 @@
|
||||
function actions.installer()
|
||||
os.execute("cp utils/ser.lua pkg/init.lua")
|
||||
os.execute("cp -r installer_dat pkg")
|
||||
os.execute("mkdir -p pkg/installer_dat")
|
||||
os.execute("cp installer_dat/bios_list.lua pkg/installer_dat")
|
||||
os.execute("cp installer_dat/package_list.lua pkg/installer_dat")
|
||||
os.execute("mkdir -p pkg/installer_dat/lang")
|
||||
local h = io.popen("ls installer_dat/lang | grep lua", "r")
|
||||
for line in h:lines() do
|
||||
os.execute("luacomp installer_dat/lang/"..line.." -O pkg/lang/"..line)
|
||||
end
|
||||
h:close()
|
||||
makeselfextract("pkg", "release/zorya-neo-installer.lua")
|
||||
end
|
||||
|
||||
|
@ -1,3 +1,43 @@
|
||||
{
|
||||
|
||||
-- BIOSes
|
||||
@[[function add_bios(bios, name, desc)]]
|
||||
["bios_@[{bios}]_name"] = @[{string.format("%q", name)}],
|
||||
["bios_@[{bios}]_desc"] = @[{string.format("%q", desc)}],
|
||||
@[[end]]
|
||||
@[[add_bios("managed", "Low Memory Managed FS Loader", "Loads an image.tsar from a managed filesystem for low memeory systems.")
|
||||
add_bios("initramfs", "Initramfs Managed System Loader", "Loads an image.tsar from a managed filesystem straight into memory.")
|
||||
add_bios("prom", "OSSM PROM Loader", "Loads an image.tsar from an OSSM PROM.")
|
||||
add_bios("osdi", "OSDI Loader", "Loads an image.tsar from an OSDI partition.")]]
|
||||
|
||||
-- Packages.
|
||||
@[[function add_pkg(pkg, name, desc)]]
|
||||
["mod_@[{pkg}]_name"] = @[{string.format("%q", name)}],
|
||||
["mod_@[{pkg}]_desc"] = @[{string.format("%q", desc)}],
|
||||
@[[end]]
|
||||
|
||||
@[[add_pkg("fs_arcfs", "Archive FS", "Use an archive as a filesystem.")
|
||||
add_pkg("fs_foxfs", "FoxFS", "Load from FoxFS volumes.")
|
||||
add_pkg("net_minitel", "Microtel", "Minitel for Zorya NEO!")
|
||||
add_pkg("util_cpio", "CPIO archive loader", "Load CPIOs.")
|
||||
add_pkg("util_osdi", "OSDI library", "Read and write OSDI partition tables.")
|
||||
add_pkg("util_romfs", "RomFS archive loader", "Load RomFS archives.")
|
||||
add_pkg("util_urf", "URF Archive loader", "Load the most awful archive format ever")
|
||||
add_pkg("util_zlan", "zlan 2.0 library", "Load things from zlan.")
|
||||
add_pkg("util_vcomponent", "vComponent", "Virtual components.")
|
||||
add_pkg("fs_fat", "FAT12/16 FS", "FAT12/16 filesystem loader.")
|
||||
add_pkg("core_io", "io library", "PUC Lua compatible io library.")
|
||||
add_pkg("loader_fuchas", "Fuchas kernel loader", "Load Fuchas.")
|
||||
add_pkg("loader_openos", "OpenOS loader", "Load OpenOS and compatible OSes.")
|
||||
add_pkg("loader_tsuki", "Tsuki kernel loader", "Load the Tsuki kernel.")
|
||||
add_pkg("menu_bios", "BIOS Menu", "A menu that looks like a real BIOS.")
|
||||
add_pkg("menu_classic", "Zorya 1.x Menu", "The classic Zorya 1.x menu that looks like discount GRUB.")
|
||||
add_pkg("util_blkdev", "Block device util", "Block devices in Zorya.")
|
||||
add_pkg("util_luaconsole", "Lua Recovery Console", "A Lua recovery console for Zorya.")
|
||||
add_pkg("util_oefiv1", "OEFIv1 library", "OEFIv1 library and loader.")
|
||||
add_pkg("util_oefiv2", "OEFIv2 and 2.1 library", "Library for loading OEFIv2.x executables.")
|
||||
add_pkg("util_searchpaths", "Easy searchpaths", "Easier searchpaths for Zorya.")
|
||||
add_pkg("util_velx", "VELX loader", "VELX executable loaders.")
|
||||
add_pkg("vdev_vbios", "vBIOS library", "Virtual BIOSes in Zorya!")
|
||||
add_pkg("core_vfs", "VFS for Zorya", "Virtual Filesystems")
|
||||
]]
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
{name="zlan", cat="util", path="lib/util_zlan.velx"},
|
||||
{name="cpio", cat="util", path="lib/util_cpio.velx"},
|
||||
{name="velx", cat="util", path="mods/util_velx.velx"},
|
||||
{name="urf", cat="util", path="lib/util_urf.velx"},
|
||||
{name="vcomponent", cat="util", path="lib/util_vcomponent.velx"},
|
||||
{name="oefiv2", cat="util", path="mods/util_oefiv2.velx"},
|
||||
|
@ -41,7 +41,7 @@ function arcfs.make(arc)
|
||||
|
||||
end
|
||||
function proxy.size(path)
|
||||
|
||||
return
|
||||
end
|
||||
function proxy.read(hand, count)
|
||||
|
||||
|
@ -95,4 +95,24 @@ function arc:list_dir(path)
|
||||
return ent
|
||||
end
|
||||
|
||||
function arc:stream()
|
||||
for i=1, #self.tbl do
|
||||
if (self.tbl[i].name == path and self.tbl[i].mode & 32768 > 0) then
|
||||
local pos = 1
|
||||
local function read(amt)
|
||||
self.seek(self.tbl[i].pos-self.seek(0)+pos-1)
|
||||
pos = pos + amt
|
||||
return self.read(amt)
|
||||
end
|
||||
local function seek(amt)
|
||||
pos = pos + amt
|
||||
return pos
|
||||
end
|
||||
local function close()end
|
||||
return read, seek, close
|
||||
end
|
||||
end
|
||||
return nil, "file not found"
|
||||
end
|
||||
|
||||
return cpio
|
@ -301,4 +301,24 @@ function arc:list_dir(path)
|
||||
return objects
|
||||
end
|
||||
|
||||
function arc:stream(path)
|
||||
local obj = path_to_obj(self, path)
|
||||
|
||||
local fpos = self.epos+obj.offset
|
||||
|
||||
local pos = 1
|
||||
local function read(amt)
|
||||
self.seek(self.tbl[i].pos-self.seek(0)+pos-1)
|
||||
pos = pos + amt
|
||||
return self.read(amt)
|
||||
end
|
||||
local function seek(amt)
|
||||
pos = pos + amt
|
||||
return pos
|
||||
end
|
||||
local function close()end
|
||||
return read, seek, close
|
||||
return nil, "file not found"
|
||||
end
|
||||
|
||||
return urf
|
25
mods/util_velx/init.lua
Normal file
25
mods/util_velx/init.lua
Normal file
@ -0,0 +1,25 @@
|
||||
--#include "velx.lua"
|
||||
|
||||
local velx = {}
|
||||
|
||||
function velx.loadstream(read, seek, close, name)
|
||||
return load_velx(read, seek, close, name)
|
||||
end
|
||||
|
||||
function velx.loadfile(addr, file)
|
||||
local fs = component.proxy(addr)
|
||||
local h = fs.open(file, "rb")
|
||||
local function read(a)
|
||||
return fs.read(h, a)
|
||||
end
|
||||
local function seek(a)
|
||||
return fs.seek(h, "cur", a)
|
||||
end
|
||||
local function close()
|
||||
return fs.close(h)
|
||||
end
|
||||
|
||||
return velx.loadstream(read, seek, close, file)
|
||||
end
|
||||
|
||||
return velx
|
38
mods/util_velx/velx.lua
Normal file
38
mods/util_velx/velx.lua
Normal file
@ -0,0 +1,38 @@
|
||||
local function load_velx(read, seek, close, name)
|
||||
-- Load a VELX format library.
|
||||
local magic, fver, compression, lver, osid, arctype, psize, lsize, ssize, rsize = string.unpack(velx_header, read(string.packsize(velx_header)))
|
||||
if (magic ~= "\27VelX") then
|
||||
return nil, "bad magic ("..magic..")"
|
||||
end
|
||||
if (osid & 0x7F ~= 0x5A or osid & 0x7F ~= 0x7F) then
|
||||
return nil, string.format("wrong os (%x)", osid & 0x7F)
|
||||
end
|
||||
if (osid & 0x80 > 0) then
|
||||
return nil, "not an executable"
|
||||
if (compression > 1) then
|
||||
return nil, "bad compression"
|
||||
end
|
||||
if (fver ~= 1) then
|
||||
return nil, "wrong version"
|
||||
end
|
||||
local prog = read(psize)
|
||||
if (compression == 1) then
|
||||
prog = lzss_decompress(prog)
|
||||
end
|
||||
seek(lsize+ssize)
|
||||
local env = {}
|
||||
--[[
|
||||
if (arctype == "tsar") then
|
||||
env._ARCHIVE = tsar.read(read, seek, close)
|
||||
end]]
|
||||
if (arctype ~= "\0\0\0\0") then
|
||||
local arc = krequire("util_"..arctype)
|
||||
if arc then
|
||||
env._ARCHIVE = arc.read(read, seek, close)
|
||||
end
|
||||
elseif (arctype ~= "\0\0\0\0") then
|
||||
return nil, "bad arctype ("..arctype..")"
|
||||
end
|
||||
setmetatable(env, {__index=_G, __newindex=function(_, i, v) _G[i] = v end})
|
||||
return load(prog, "="..(name or "(loaded velx)"), "t", env)
|
||||
end
|
@ -23,7 +23,7 @@ local bootfs = cproxy(baddr)
|
||||
assert(bootfs.exists(".zy2/image.tsar"), "No boot image!")
|
||||
|
||||
local romfs_file = assert(bootfs.open(".zy2/image.tsar", "rb"))
|
||||
local rfs = readfile(bootfs, romfs_file)
|
||||
local rfs = readfile(bootfs.address, romfs_file)
|
||||
|
||||
--[[local romfs_dev = tsar.read(function(a)
|
||||
local c = ""
|
||||
|
16
util/OpenOS/config.d/03_fuchas.lua
Normal file
16
util/OpenOS/config.d/03_fuchas.lua
Normal file
@ -0,0 +1,16 @@
|
||||
local cfgadd = ...
|
||||
local comp = require("component")
|
||||
for fs in comp.list("filesystem") do
|
||||
if comp.invoke(fs, "exists", ".efi/fuchas.efi2") then
|
||||
print("Fuchas discovered on "..fs)
|
||||
cfgadd(string.format([[
|
||||
menu.add("Fuchas on %s", function()
|
||||
local baddr = "%s"
|
||||
local ldr = loadmod("loader_fuchas")(baddr)
|
||||
ldr:karg("--boot-address", baddr)
|
||||
ldr:karg("--bios-compat", "zy-neo")
|
||||
ldr:boot()
|
||||
end)
|
||||
]], fs:sub(1, 3), fs))
|
||||
end
|
||||
end
|
30
util/OpenOS/config.d/04_mineos.lua
Normal file
30
util/OpenOS/config.d/04_mineos.lua
Normal file
@ -0,0 +1,30 @@
|
||||
local cfgadd = ...
|
||||
local comp = require("component")
|
||||
local fs = require("filesystem")
|
||||
for fs in comp.list("filesystem") do
|
||||
if comp.invoke(fs, "exists", "OS.lua") then
|
||||
print("MineOS discovered on "..fs)
|
||||
cfgadd(string.format([[
|
||||
menu.add("MineOS on %s", function()
|
||||
local thd = krequire("thd")
|
||||
local utils = krequire("utils")
|
||||
thd.add("mineos", function()
|
||||
local fsaddr = "%s"
|
||||
local env = utils.make_env()
|
||||
function env.computer.getBootAddress()
|
||||
return fsaddr
|
||||
end
|
||||
function env.computer.setBootAddress()end
|
||||
load(utils.readfile(fsaddr, component.invoke(fsaddr, "open", "OS.lua")), "=OS.lua", "t", env)()
|
||||
computer.pushSignal("mineos_dead")
|
||||
end)
|
||||
while true do
|
||||
if computer.pullSignal() == "mineos_dead" then
|
||||
utils.debug_log("Got signal.")
|
||||
break
|
||||
end
|
||||
end
|
||||
end)
|
||||
]], fs:sub(1, 3), fs))
|
||||
end
|
||||
end
|
@ -1,4 +1,7 @@
|
||||
local cfgadd = ...
|
||||
cfgadd([[
|
||||
menu.add("Lua Console", function()
|
||||
loadmod("util_luaconsole")()
|
||||
end)
|
||||
menu.draw()
|
||||
]])
|
Loading…
Reference in New Issue
Block a user