mirror of
https://github.com/Adorable-Catgirl/Zorya-NEO.git
synced 2024-12-23 09:28:07 +11:00
All kinds of fun stuff. Fun for translations, too.
This commit is contained in:
parent
953da244ce
commit
2d6f2d5ed8
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
zbsign.pem
|
39
examples/config-example/example.z2c
Normal file
39
examples/config-example/example.z2c
Normal file
@ -0,0 +1,39 @@
|
||||
-- MineOS launcher
|
||||
entry "MineOS"
|
||||
loadmod "biosemu"
|
||||
biosload ".zy2/biosemu/mineos.lua"
|
||||
biosdatload ".zy2/biosemu/mineos.bin"
|
||||
boot
|
||||
|
||||
-- Emulate Zorya v1
|
||||
entry "Zorya v1 Emulation"
|
||||
loadmod "biosemu"
|
||||
biosload ".zy2/biosemu/zorya13.lua"
|
||||
biosdatload ".zy2/biosemu/zorya13.bin"
|
||||
boot
|
||||
|
||||
-- Boot OpenOS
|
||||
entry "OpenOS"
|
||||
loadmod "openos"
|
||||
openos_kload "c2dfc58a-a895-407e-911e-17cc57ff6e17"
|
||||
boot
|
||||
|
||||
-- Boot OEFIv2.1 application
|
||||
entry "OEFI2(c2d): OpenOS.efi2"
|
||||
loadmod "oefi2"
|
||||
oefiload "c2dfc58a-a895-407e-911e-17cc57ff6e17" "OpenOS.efi2"
|
||||
boot
|
||||
|
||||
-- Boot Fuchas NT kernel
|
||||
entry "Fuchas"
|
||||
loadmod "fuchas"
|
||||
fuchas_kload "6e621ed7-97cd-478b-a896-bb7fa42ca8e6"
|
||||
boot
|
||||
|
||||
-- Boot Tsuki kernel
|
||||
entry "Tsuki Kernel 1.0"
|
||||
loadmod "tsuki"
|
||||
load_initramfs "0c6fa9e1-4e4b-44e7-9b80-4d9dff20b6d5" "/boot/tsuki1.0-init.img" "d9e2e89b-5050-47d5-80f0-59914669e37a"
|
||||
tsuki_karg "initramfs=d9e2e89b-5050-47d5-80f0-59914669e37a init=/sbin/init.lua bootaddr=0c6fa9e1-4e4b-44e7-9b80-4d9dff20b6d5"
|
||||
tsuki_kload "0c6fa9e1-4e4b-44e7-9b80-4d9dff20b6d5" "/boot/tsuki1.0.tknl"
|
||||
boot
|
16
src/installerdat/base_modules.xml
Normal file
16
src/installerdat/base_modules.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<modules>
|
||||
<module id="bootmenu" required="true">
|
||||
<file name="bootmenu.zyr" />
|
||||
<name lang="en_US">Boot Menu</name>
|
||||
<name lang="en_GB">Boot Menu</name>
|
||||
<desc lang="en_US">Classic Zorya 1.x style boot menu.</desc>
|
||||
<desc lang="en_GB">Classic Zorya 1.x style boot menu.</desc>
|
||||
</module>
|
||||
<module id="loadfile" required="true">
|
||||
<file name="loadfile.zyr" />
|
||||
<name lang="en_US">Load file</name>
|
||||
<name lang="en_GB">Load file</name>
|
||||
<desc lang="en_US">A module that allows for easy loading of files.</desc>
|
||||
<desc lang="en_GB">A module that allows for easy loading of files.</desc>
|
||||
</module>
|
||||
</modules>
|
4
src/installerdat/installers_extra/README.md
Normal file
4
src/installerdat/installers_extra/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# What is this?
|
||||
This is used for loaders that require extra scripts to run durring the install.
|
||||
|
||||
Currently, no loaders need this folder. But it's still nice to have.
|
4
src/installerdat/languages.xml
Normal file
4
src/installerdat/languages.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<languages>
|
||||
<lang code="en_US">English (US)</lang>
|
||||
<lang code="en_GB">English (UK)</lang>
|
||||
</languages>
|
8
src/installerdat/runtimes.xml
Normal file
8
src/installerdat/runtimes.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<runtimes>
|
||||
<runtime id="eeprom">
|
||||
<name lang="en_US">EEPROM</name>
|
||||
<name lang="en_GB">EEPROM</name>
|
||||
<desc lang="en_US">Basic EEPROM loader.</desc>
|
||||
<desc lang="en_US">Basic EEPROM loader.</desc>
|
||||
</runtime>
|
||||
</runtimes>
|
93
src/modules/biosemu/init.lua
Normal file
93
src/modules/biosemu/init.lua
Normal file
@ -0,0 +1,93 @@
|
||||
local border_chars = {
|
||||
"┌", "─", "┐", "│", "└", "┘"
|
||||
}
|
||||
local w, h = envs.gpu.getViewport()
|
||||
envs.gpu.setBackground(envs.cfg.bgcolor)
|
||||
envs.gpu.setForeground(envs.cfg.fgcolor)
|
||||
envs.cls()
|
||||
--Draw some things
|
||||
envs.gpu.set((w/2)-5, 1, )
|
||||
envs.gpu.set(1, 2, border_chars[1])
|
||||
envs.gpu.set(2, 2, border_chars[2]:rep(w-2))
|
||||
envs.gpu.set(w, 2, border_chars[3])
|
||||
for i=1, h-6 do
|
||||
envs.gpu.set(1, i+2, border_chars[4])
|
||||
envs.gpu.set(w, i+2, border_chars[4])
|
||||
end
|
||||
envs.gpu.set(1, h-3, border_chars[5])
|
||||
envs.gpu.set(2, h-3, border_chars[2]:rep(w-2))
|
||||
envs.gpu.set(w, h-3, border_chars[6])
|
||||
envs.gpu.set(1, h-1, "Use ↑ and ↓ keys to select which entry is highlighted.")
|
||||
envs.gpu.set(1, h, "Use ENTER to boot the selected entry.")
|
||||
local stime = computer.uptime()
|
||||
local autosel = true
|
||||
local ypos = 1
|
||||
local sel = 1
|
||||
local function redraw()
|
||||
envs.gpu.setBackground(envs.cfg.bgcolor)
|
||||
envs.gpu.setForeground(envs.cfg.fgcolor)
|
||||
envs.gpu.fill(1, h-2, w, 1, " ")
|
||||
if (autosel) then
|
||||
envs.gpu.set(1, h-2, "Automatically booting in "..math.floor(envs.cfg.timeout-(computer.uptime()-stime)).."s.")
|
||||
end
|
||||
for i=1, h-6 do
|
||||
local entry = envs.boot[ypos+i-1]
|
||||
if not entry then break end
|
||||
local name = entry[1]
|
||||
if not name then break end
|
||||
local short = name:sub(1, w-2)
|
||||
if (short ~= name) then
|
||||
short = short:sub(1, #sub-3).."..."
|
||||
end
|
||||
if (#short < w-2) then
|
||||
short = short .. string.rep(" ", w-2-#short)
|
||||
end
|
||||
if (sel == ypos+i-1) then
|
||||
envs.gpu.setBackground(envs.cfg.fgcolor)
|
||||
envs.gpu.setForeground(envs.cfg.bgcolor)
|
||||
else
|
||||
envs.gpu.setBackground(envs.cfg.bgcolor)
|
||||
envs.gpu.setForeground(envs.cfg.fgcolor)
|
||||
end
|
||||
envs.gpu.set(2, i+2, short)
|
||||
end
|
||||
end
|
||||
redraw()
|
||||
sel = envs.cfg.default
|
||||
while true do
|
||||
local sig, _, key, code = computer.pullSignal(0.01)
|
||||
if (sig == "key_down") then
|
||||
autosel = false
|
||||
if (key == 0 and code == 200) then
|
||||
sel = sel - 1
|
||||
if (sel < 1) then
|
||||
sel = 1
|
||||
end
|
||||
if (sel < ypos) then
|
||||
ypos = ypos - 1
|
||||
end
|
||||
elseif (key == 0 and code == 208) then
|
||||
sel = sel + 1
|
||||
if (sel > #envs.boot) then
|
||||
sel = #envs.boot
|
||||
end
|
||||
if (sel > ypos+h-7) then
|
||||
ypos = ypos+1
|
||||
end
|
||||
elseif (key == 13 and code == 28) then
|
||||
envs.gpu.setBackground(0)
|
||||
envs.gpu.setForeground(0xFFFFFF)
|
||||
local hand = envs.boot[sel][2]
|
||||
table.remove(envs.boot[sel], 1)
|
||||
table.remove(envs.boot[sel], 1)
|
||||
envs.hand[hand](table.unpack(envs.boot[sel]))
|
||||
end
|
||||
end
|
||||
if (((computer.uptime()-stime) >= envs.cfg.timeout) and autosel) then
|
||||
local hand = envs.boot[sel][2]
|
||||
table.remove(envs.boot[sel], 1)
|
||||
table.remove(envs.boot[sel], 1)
|
||||
envs.hand[hand](table.unpack(envs.boot[sel]))
|
||||
end
|
||||
redraw()
|
||||
end
|
5
src/modules/biosemu/lang.xml
Normal file
5
src/modules/biosemu/lang.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<language-manifest fallback="en_US">
|
||||
<lang code="en_US">
|
||||
<string name="zyemu">Zorya BIOS Emulator</string>
|
||||
</lang>
|
||||
</language-manifest>
|
0
src/modules/biosemu/manifest.ini
Normal file
0
src/modules/biosemu/manifest.ini
Normal file
8
src/modules/bootmenu/lang.xml
Normal file
8
src/modules/bootmenu/lang.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<language-manifest fallback="en_US">
|
||||
<lang code="en_US">
|
||||
<string name="zyname">Zorya NEO BIOS v2.0 (%iK free)</string>
|
||||
<string name="zyautoboot">Automatically booting in %is.</string>
|
||||
<string name="zyusage_1">Use ↑ and ↓ keys to select which entry is highlighted.</string>
|
||||
<string name="zyusage_2">Use ENTER to boot the selected entry.</string>
|
||||
</lang>
|
||||
</language-manifest>
|
5
update/install.lua
Normal file
5
update/install.lua
Normal file
@ -0,0 +1,5 @@
|
||||
local component = component or require("component")
|
||||
local computer = computer or require("computer")
|
||||
|
||||
local inet = component.proxy(component.list("internet")())
|
||||
local
|
@ -6,6 +6,7 @@ end
|
||||
os.execute("mkdir -p build/modules")
|
||||
os.execute("mkdir -p build/loaders")
|
||||
os.execute("mkdir -p build/microruntime")
|
||||
os.execute("mkdir -p build/installerdat")
|
||||
|
||||
local cwd = os.getenv("PWD")
|
||||
|
||||
@ -19,7 +20,7 @@ end
|
||||
print("Building modules...")
|
||||
dir("src/modules", function(entry)
|
||||
print("MOD", entry)
|
||||
os.execute("utils/mkmod.sh src/modules/"..entry.." build/"..entry)
|
||||
os.execute("utils/mkmod.sh src/modules/"..entry.." build/modules/"..entry)
|
||||
end)
|
||||
|
||||
print("Building loaders...")
|
||||
@ -34,6 +35,11 @@ dir("src/microruntime", function(entry)
|
||||
os.execute("cd src/microruntime/"..entry.."; "..cwd.."/utils/luapreproc.lua init.lua "..cwd.."/build/microruntime/"..entry..".urt>/dev/null")
|
||||
end)
|
||||
|
||||
print("Copying installer info...")
|
||||
os.execute("cp -r src/installerdat/* build/installerdat")
|
||||
|
||||
print("Packing...")
|
||||
os.execute("cd build; find * -depth | cpio -o > ../update.zy2 2>/dev/null")
|
||||
print("Packaging complete. See update.zy2.")
|
||||
os.execute("cd build; find * -depth | grep -v .git/ |cpio -o > update.zy2 2>/dev/null")
|
||||
print("Packaging complete. See build/update.zy2.")
|
||||
|
||||
print("Note: Package should probably be signed! Use utils/signupdate.sh...")
|
16
utils/sign.sh
Executable file
16
utils/sign.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
for f in src/modules/*; do
|
||||
if [[ -f "$f/init.lua" ]]; then
|
||||
echo "Siging $f."
|
||||
printf "init.lua\x00" > ".tmp_1"
|
||||
openssl dgst -sha256 -sign zbsign.pem "$f/init.lua" > ".tmp_2"
|
||||
printf "manifest.ini\x00" > ".tmp_3"
|
||||
openssl dgst -sha256 -sign zbsign.pem "$f/manifest.ini" > ".tmp_4"
|
||||
if [[ -f "$f/lang.xml" ]]; then
|
||||
printf "lang.xml\x00" > ".tmp_5"
|
||||
openssl dgst -sha256 -sign zbsign.pem "$f/lang.xml" > ".tmp_6"
|
||||
fi
|
||||
cat .tmp_* > "$f/sig.bin"
|
||||
rm .tmp_*
|
||||
fi
|
||||
done
|
10
utils/signupdate.lua
Normal file
10
utils/signupdate.lua
Normal file
@ -0,0 +1,10 @@
|
||||
local h = io.popen("find build -depth -type f | grep -v sig.bin | grep -v update.zy2", "r")
|
||||
local sigfile = io.open("build/sig.bin", "wb")
|
||||
for line in h:lines() do
|
||||
sigfile:write(line:sub(7).."\0")
|
||||
local s = io.popen("openssl dgst -sha256 -sign zbsign.pem "..line, "r")
|
||||
sigfile:write(s:read("*a"))
|
||||
s:close()
|
||||
end
|
||||
sigfile:close()
|
||||
os.execute("cd build; find * -depth | grep -v update.zy2 | cpio -o > update.zy2")
|
Loading…
Reference in New Issue
Block a user