v1.12.0 - Added drivers.
This commit is contained in:
+3
-1
@@ -1,13 +1,14 @@
|
|||||||
local agcfg = {
|
local agcfg = {
|
||||||
["halyde"] = {
|
["halyde"] = {
|
||||||
["maindir"] = "",
|
["maindir"] = "",
|
||||||
["version"] = "1.11.1",
|
["version"] = "1.12.0",
|
||||||
["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.",
|
["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.",
|
||||||
["directories"] = {
|
["directories"] = {
|
||||||
"halyde/apps",
|
"halyde/apps",
|
||||||
"halyde/apps/helpdb",
|
"halyde/apps/helpdb",
|
||||||
"halyde/config/generate",
|
"halyde/config/generate",
|
||||||
"halyde/core",
|
"halyde/core",
|
||||||
|
"halyde/drivers",
|
||||||
"halyde/lib",
|
"halyde/lib",
|
||||||
"home",
|
"home",
|
||||||
"mnt"
|
"mnt"
|
||||||
@@ -46,6 +47,7 @@ local agcfg = {
|
|||||||
"halyde/core/boot.lua",
|
"halyde/core/boot.lua",
|
||||||
"halyde/core/cormgr.lua",
|
"halyde/core/cormgr.lua",
|
||||||
"halyde/core/datatools.lua",
|
"halyde/core/datatools.lua",
|
||||||
|
"halyde/core/drvload.lua",
|
||||||
"halyde/core/evmgr.lua",
|
"halyde/core/evmgr.lua",
|
||||||
"halyde/core/fullkb.lua",
|
"halyde/core/fullkb.lua",
|
||||||
"halyde/core/shell.lua",
|
"halyde/core/shell.lua",
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
Amnt/
|
||||||
Ahome/
|
Ahome/
|
||||||
Ahalyde/lib/
|
Ahalyde/lib/
|
||||||
|
Ahalyde/drivers/
|
||||||
Ahalyde/core/
|
Ahalyde/core/
|
||||||
Ahalyde/config/generate/
|
Ahalyde/config/generate/
|
||||||
Ahalyde/apps/helpdb/
|
Ahalyde/apps/helpdb/
|
||||||
@@ -38,6 +40,7 @@ Ahalyde/config/generate/startupapps.json
|
|||||||
Ahalyde/core/boot.lua
|
Ahalyde/core/boot.lua
|
||||||
Ahalyde/core/cormgr.lua
|
Ahalyde/core/cormgr.lua
|
||||||
Ahalyde/core/datatools.lua
|
Ahalyde/core/datatools.lua
|
||||||
|
Ahalyde/core/drvload.lua
|
||||||
Ahalyde/core/evmgr.lua
|
Ahalyde/core/evmgr.lua
|
||||||
Ahalyde/core/fullkb.lua
|
Ahalyde/core/fullkb.lua
|
||||||
Ahalyde/core/shell.lua
|
Ahalyde/core/shell.lua
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
local loadfile = ...
|
local loadfile = ...
|
||||||
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
|
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
|
||||||
|
|
||||||
_G._OSVERSION = "Halyde 1.11.1"
|
_G._OSVERSION = "Halyde 1.12.0"
|
||||||
_G._OSLOGO = ""
|
_G._OSLOGO = ""
|
||||||
local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil
|
local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil
|
||||||
repeat
|
repeat
|
||||||
@@ -47,6 +47,8 @@ local function preload(module)
|
|||||||
_G[module] = nil
|
_G[module] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
import("/halyde/core/drvload.lua")
|
||||||
|
|
||||||
preload("component")
|
preload("component")
|
||||||
preload("computer")
|
preload("computer")
|
||||||
|
|
||||||
@@ -87,7 +89,7 @@ gpu.setResolution(gpu.maxResolution())
|
|||||||
--handle:close()
|
--handle:close()
|
||||||
|
|
||||||
local fs = import("filesystem")
|
local fs = import("filesystem")
|
||||||
if not fs.exists("/halyde/config/shell.json") then
|
if not fs.exists("/halyde/config/shell.json") then -- Auto-generate configs
|
||||||
fs.copy("/halyde/config/generate/shell.json", "/halyde/config/shell.json")
|
fs.copy("/halyde/config/generate/shell.json", "/halyde/config/shell.json")
|
||||||
end
|
end
|
||||||
if not fs.exists("/halyde/config/startupapps.json") then
|
if not fs.exists("/halyde/config/startupapps.json") then
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
local fs = import("filesystem")
|
||||||
|
|
||||||
|
local driverPath = "/halyde/drivers"
|
||||||
|
|
||||||
|
local drivers = fs.list(driverPath)
|
||||||
|
local driverTypes = {}
|
||||||
|
|
||||||
|
local function loadDriver(drvName)
|
||||||
|
local driverData = import(fs.concat(driverPath, drvName))
|
||||||
|
table.remove(drivers, table.find(drivers, drvName))
|
||||||
|
if driverData.dependencies then
|
||||||
|
for _, dependency in pairs(driverData.dependencies) do
|
||||||
|
if table.find(drivers, dependency) then
|
||||||
|
loadDriver(dependency)
|
||||||
|
elseif table.find(drivers, dependency .. ".lua") then
|
||||||
|
loadDriver(dependency .. ".lua")
|
||||||
|
else
|
||||||
|
for typeLookupDrvName, typeLookupDrvType in pairs(driverTypes) do
|
||||||
|
if typeLookupDrvType == dependency then
|
||||||
|
loadDriver(typeLookupDrvName)
|
||||||
|
-- Don't break, because there can be multiple drivers of the correct type
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--print(drvName)
|
||||||
|
if driverData.onStartup then -- I have no idea why would this not exist, but it's a failsafe
|
||||||
|
driverData.onStartup()
|
||||||
|
end
|
||||||
|
-- More functions to be implemented in the future
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, drvName in pairs(drivers) do -- Get all the driver types
|
||||||
|
local driverData = import(fs.concat(driverPath, drvName))
|
||||||
|
if driverData.type then
|
||||||
|
--print(driverData.type)
|
||||||
|
driverTypes[drvName] = driverData.type -- Not the other way around because there can be multiple drivers of the same type, but there can't be multiple entries with the same key
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, drvName in pairs(drivers) do -- Load the drivers
|
||||||
|
if drvName:sub(-1, -1) ~= "/" then -- Check if it's not a directory. Otherwise it might be driver config
|
||||||
|
loadDriver(drvName)
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user