1
0
mirror of https://github.com/Adorable-Catgirl/Zorya-NEO.git synced 2024-11-24 03:08:05 +11:00
Zorya-NEO/mods/loader_openos/init.lua

48 lines
1.3 KiB
Lua
Raw Normal View History

2020-01-15 12:07:27 +11:00
local zy = krequire("zorya")
--zy.loadmod("vdev_biosdev")
local utils = krequire("utils")
2020-06-06 10:45:08 +10:00
local thd = krequire("thd")
2020-01-15 12:07:27 +11:00
--local vdev = krequire("zorya").loadmod("util_vdev")
2020-03-13 08:01:05 +11:00
local vdev = krequire("util_vcomponent")
2020-06-06 10:45:08 +10:00
local function proxytable(t)
return setmetatable({}, {__index=function(self, i)
if (type(t[i]) == "table") then
self[i] = proxytable(t[i])
return rawget(self, i)
else
return t[i]
end
end})
end
local openos_count = 0
2020-01-15 12:07:27 +11:00
return function(addr)
local fs = component.proxy(addr)
--vdev.overwrite(_G)
2020-03-13 08:01:05 +11:00
--[[function computer.getBootAddress()
2020-01-15 12:07:27 +11:00
return addr
end
function computer.setBootAddress()end
2020-03-13 08:01:05 +11:00
local env = utils.deepcopy(_G)
env._ENV = env
env._G = env
env.krequire = nil]]
--vdev.install(env)
2020-01-15 12:07:27 +11:00
--log(env, env.computer, env.computer.getBootAddress, env.computer.getBootAddress())
2020-06-06 10:45:08 +10:00
-- local env = proxytable(_G)
thd.add("openos$"..openos_count, function()
local env = utils.make_env()
function env.computer.getBootAddress()
return addr
end
function env.computer.setBootAddress()end
local old_dl = utils.debug_log
load(utils.readfile(fs.address, fs.open("init.lua")), "=init.lua", "t", env)()
computer.pushSignal("openos_dead")
end)
while true do
if computer.pullSignal() == "openos_dead" then
utils.debug_log("Got signal.")
break
end
2020-03-13 08:01:05 +11:00
end
2020-01-15 12:07:27 +11:00
end