From 4559069d081382c3a9b082096d34186d13089cda Mon Sep 17 00:00:00 2001 From: Jane Roxanne Date: Thu, 5 Mar 2020 16:30:59 -0500 Subject: [PATCH] Plenty of tweaks and changes and additions. --- lib/fs_foxfs/dirent.lua | 0 lib/fs_foxfs/geometry.lua | 15 +++ lib/fs_foxfs/init.lua | 0 lib/fs_foxfs/inode.lua | 11 ++ lib/fs_proxfs/init.lua | 0 lib/util_osdi/init.lua | 40 +++++++ lib/util_urf/init.lua | 10 +- mods/loader_fuchas/init.lua | 21 +++- mods/loader_removable_media/init.lua | 2 +- mods/loader_tsuki/init.lua | 42 +++++++ mods/util_oefiv2/bios.lua | 2 +- mods/util_oefiv2/init.lua | 11 +- mods/vdev_biosdev/init.lua | 9 +- release.lua | 4 +- src/loader.lua | 2 +- src/zy-neo/builtins/init_romfs/init.lua | 13 ++- src/zy-neo/utils.lua | 2 + src/zy-neo/zinit.lua | 17 +-- test.lua | Bin 0 -> 3350 bytes utils/makezbios.lua | 139 ++++++++++++++++++++++++ 20 files changed, 308 insertions(+), 32 deletions(-) create mode 100644 lib/fs_foxfs/dirent.lua create mode 100644 lib/fs_foxfs/geometry.lua create mode 100644 lib/fs_foxfs/init.lua create mode 100644 lib/fs_foxfs/inode.lua create mode 100644 lib/fs_proxfs/init.lua create mode 100644 lib/util_osdi/init.lua create mode 100644 test.lua create mode 100644 utils/makezbios.lua diff --git a/lib/fs_foxfs/dirent.lua b/lib/fs_foxfs/dirent.lua new file mode 100644 index 0000000..e69de29 diff --git a/lib/fs_foxfs/geometry.lua b/lib/fs_foxfs/geometry.lua new file mode 100644 index 0000000..e9f2609 --- /dev/null +++ b/lib/fs_foxfs/geometry.lua @@ -0,0 +1,15 @@ +local function foxfs_getgroups(prox) + +end + +local function foxfs_getnodespergroup(prox) + +end + +local function foxfs_getnodes(prox) + +end + +local function foxfs_getgrouploc(prox, id) + +end \ No newline at end of file diff --git a/lib/fs_foxfs/init.lua b/lib/fs_foxfs/init.lua new file mode 100644 index 0000000..e69de29 diff --git a/lib/fs_foxfs/inode.lua b/lib/fs_foxfs/inode.lua new file mode 100644 index 0000000..c716daf --- /dev/null +++ b/lib/fs_foxfs/inode.lua @@ -0,0 +1,11 @@ +local function foxfs_getnodes(prox, sec) + +end + +local function foxfs_readnode(prox, sec) + +end + +local function foxfs_update(prox, sec, data) + +end \ No newline at end of file diff --git a/lib/fs_proxfs/init.lua b/lib/fs_proxfs/init.lua new file mode 100644 index 0000000..e69de29 diff --git a/lib/util_osdi/init.lua b/lib/util_osdi/init.lua new file mode 100644 index 0000000..0714a96 --- /dev/null +++ b/lib/util_osdi/init.lua @@ -0,0 +1,40 @@ +local component = component +local osdi = {} + +local function decode_entry(ent) + local start, size, ptype, flags, name = string.unpack("/dev/null 2>&1")) then for l in io.popen("ls mods"):lines() do status("MOD\t"..l) - os.execute("zsh -c 'cd mods/"..l.."; luacomp init.lua -mnone | lua ../../utils/zlua.lua > ../../pkg/mods/"..l..".zy2m'") + os.execute("zsh -c 'cd mods/"..l.."; luacomp init.lua -mluamin | lua ../../utils/zlua.lua > ../../pkg/mods/"..l..".zy2m'") end end status("Module build complete.\n\nBuilding libraries.") if (os.execute("stat lib 1>/dev/null 2>&1")) then for l in io.popen("ls lib"):lines() do status("LIB\t"..l) - os.execute("zsh -c 'cd lib/"..l.."; luacomp init.lua -mnone | lua ../../utils/zlua.lua > ../../pkg/lib/"..l..".zy2l'") + os.execute("zsh -c 'cd lib/"..l.."; luacomp init.lua -mluamin | lua ../../utils/zlua.lua > ../../pkg/lib/"..l..".zy2l'") end end status("Library build complete.\n\nBuilding installer...") diff --git a/src/loader.lua b/src/loader.lua index 76ce4f5..e22c18b 100644 --- a/src/loader.lua +++ b/src/loader.lua @@ -22,4 +22,4 @@ function status(msg) end end status("Decompressing image...") -return load(lzss_decompress($[[luacomp src/zy-neo/zinit.lua -mluamin 2>/dev/null | sed "s/\]\]/]\ ]/g" | lua5.3 src/lzssc.lua | lua utils/mkluastring.lua ]]), "=bios.lua")(lzss_decompress) \ No newline at end of file +return load(lzss_decompress($[[luacomp src/zy-neo/zinit.lua -mluamin 2>/dev/null | sed "s/\]\]/]\ ]/g" | lua5.3 utils/makezbios.lua ]]), "=bios.lua")(lzss_decompress) \ No newline at end of file diff --git a/src/zy-neo/builtins/init_romfs/init.lua b/src/zy-neo/builtins/init_romfs/init.lua index d51d024..57990bc 100644 --- a/src/zy-neo/builtins/init_romfs/init.lua +++ b/src/zy-neo/builtins/init_romfs/init.lua @@ -1 +1,12 @@ ---#error "Not implemented." \ No newline at end of file +--#error "Not implemented." +local rfs = {} + +local bfs = {} + +function bfs.getfile(path) + +end + +function bfs.exists(path) + +end \ No newline at end of file diff --git a/src/zy-neo/utils.lua b/src/zy-neo/utils.lua index da22d25..59947d1 100644 --- a/src/zy-neo/utils.lua +++ b/src/zy-neo/utils.lua @@ -30,6 +30,8 @@ function utils.readfile(f,h) return b end +utils.load_lua = load_lua + -- Hell yeah, deepcopy time. function utils.deepcopy(src, dest) dest = dest or {} diff --git a/src/zy-neo/zinit.lua b/src/zy-neo/zinit.lua index d1eb9e0..ba487a3 100644 --- a/src/zy-neo/zinit.lua +++ b/src/zy-neo/zinit.lua @@ -14,11 +14,19 @@ local computer = computer local booted = false local zcfg = {} function log(...) - component.proxy(component.list("ocemu")()).log(...) + component.proxy(component.list("ocemu")() or component.list("sandbox")()).log(...) end local th_i = 0 local function th_a(func) thd.add("zyneo$"..th_i, func) + th_i = th_i + 1 +end + +local function load_lua(src, ...) + if (src:sub(1, 4) == "\27ZLSS") then + src = lzss_decompress(src:sub(5)) + end + return load(src, ...) end local builtins = {} @@ -70,13 +78,6 @@ end)()) --#include "src/zy-neo/init.lua" -local function load_lua(src, ...) - if (src:sub(1, 4) == "\27ZLS") then - src = lzss_decompress(src:sub(5)) - end - return load(src, ...) -end - -- Zorya's handler thread. th_a(function() local er diff --git a/test.lua b/test.lua new file mode 100644 index 0000000000000000000000000000000000000000..8fda379a195c4b3799f82655759418819aec4f5a GIT binary patch liter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G%B!jzsws=FX@dv;ude@QFJ1if6V!&{vUu!{ z%CooFGju<6sm#`9IGrp~zDnA=@MZ?J@S=7__vZ`eq3@HN5yKH9@G`ta Nuu;m0{rDpZ`xjbrr1}5= literal 0 HcmV?d00001 diff --git a/utils/makezbios.lua b/utils/makezbios.lua new file mode 100644 index 0000000..1d20aa3 --- /dev/null +++ b/utils/makezbios.lua @@ -0,0 +1,139 @@ +local f = io.stdin:read("*a") + +--[[---------------------------------------------------------------------------- + LZSS - encoder / decoder + This is free and unencumbered software released into the public domain. + Anyone is free to copy, modify, publish, use, compile, sell, or + distribute this software, either in source code form or as a compiled + binary, for any purpose, commercial or non-commercial, and by any + means. + In jurisdictions that recognize copyright laws, the author or authors + of this software dedicate any and all copyright interest in the + software to the public domain. We make this dedication for the benefit + of the public at large and to the detriment of our heirs and + successors. We intend this dedication to be an overt act of + relinquishment in perpetuity of all present and future rights to this + software under copyright law. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + For more information, please refer to +--]]---------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +local M = {} +local string, table = string, table + +-------------------------------------------------------------------------------- +local POS_BITS = 12 +local LEN_BITS = 16 - POS_BITS +local POS_SIZE = 1 << POS_BITS +local LEN_SIZE = 1 << LEN_BITS +local LEN_MIN = 3 + +-------------------------------------------------------------------------------- +function M.compress(input) + local offset, output = 1, {} + local window = '' + + local function search() + for i = LEN_SIZE + LEN_MIN - 1, LEN_MIN, -1 do + local str = string.sub(input, offset, offset + i - 1) + local pos = string.find(window, str, 1, true) + if pos then + return pos, str + end + end + end + + while offset <= #input do + local flags, buffer = 0, {} + + for i = 0, 7 do + if offset <= #input then + local pos, str = search() + if pos and #str >= LEN_MIN then + local tmp = ((pos - 1) << LEN_BITS) | (#str - LEN_MIN) + buffer[#buffer + 1] = string.pack('>I2', tmp) + else + flags = flags | (1 << i) + str = string.sub(input, offset, offset) + buffer[#buffer + 1] = str + end + window = string.sub(window .. str, -POS_SIZE) + offset = offset + #str + else + break + end + end + + if #buffer > 0 then + output[#output + 1] = string.char(flags) + output[#output + 1] = table.concat(buffer) + end + end + + return table.concat(output) +end + +-------------------------------------------------------------------------------- +function M.decompress(input) + local offset, output = 1, {} + local window = '' + + while offset <= #input do + local flags = string.byte(input, offset) + offset = offset + 1 + + for i = 1, 8 do + local str = nil + if (flags & 1) ~= 0 then + if offset <= #input then + str = string.sub(input, offset, offset) + offset = offset + 1 + end + else + if offset + 1 <= #input then + local tmp = string.unpack('>I2', input, offset) + offset = offset + 2 + local pos = (tmp >> LEN_BITS) + 1 + local len = (tmp & (LEN_SIZE - 1)) + LEN_MIN + str = string.sub(window, pos, pos + len - 1) + end + end + flags = flags >> 1 + if str then + output[#output + 1] = str + window = string.sub(window .. str, -POS_SIZE) + end + end + end + + return table.concat(output) +end + +local function mkstr(d) + local dat = "\"" + for i=1, #f do + if (d:byte(i) == 0) then + dat = dat .. "\0" + elseif (d:sub(i,i) == "\\") then + dat = dat .. ("\\\\") + elseif (d:sub(i,i) == "\"") then + dat = dat .. ("\\\"") + elseif (d:sub(i,i) == "\n") then + dat = dat .. ("\\n") + elseif (d:sub(i,i) == "\r") then + dat = dat .. ("\\r") + else + dat = dat .. (d:sub(i,i)) + end + end + dat = dat .. ("\"") + return dat +end + +io.stdout:write(mkstr(M.compress(f))) \ No newline at end of file