CCEmuX command
This commit is contained in:
parent
b7e3e9dde9
commit
25aba6c4cd
4
manifest
4
manifest
@ -1,2 +1,2 @@
|
|||||||
{"build":150,"description":"proxy in bin/*.lua","files":{"LICENSES":"f3549d84d66eb53dd4a421a4341d77d3d217c1b117d67e3be8f5211adcda0952","autorun.lua":"64f9199637857ba0191a30a465dbffe965382ad1bb805a9aef38ad187b7ce322","bin/5rot26.lua":"91b66cd6d4b33081b25c456142dd7efcb894e819e842693c9e1e17ff48872ff5","bin/chronometer.lua":"db5363993a04382145aef7db2fbe262f0bf10697a589e1e2d2f9ce0f87430dd8","bin/kristminer.lua":"7e7f9fe2a6493d584ad6926cda915e02c1c3d800dc209680898ce930d0bb0e6f","bin/livegps.lua":"c3d17d495cda01aa1261e4c4fcd43439b29af422671972117ec34f68e32c5bba","bin/loading.lua":"c85f7aa1765170325155b921c1fceeb62643f552f12d41b529a22af3a67f5a97","bin/potatoflight.lua":"2fbb0b6f8d78728d8cb0ec64af1bc598bd00cb55f202378e7acdb86bba71efd1","bin/potatoplex.lua":"86c9e7597bbe23d7de7e7f1bfc976d0b94dcdf3af9e6c7c6c9b18b98596898c8","bin/relay.lua":"261ae6c220b83506e3326e8f2b091d246baae458ff0d2ee87512be2c4e35a75d","bin/tryhaskell.lua":"07810d85145da65a3e434154c79d5a9d72f2dcbe59c8d6829040fb925df878ec","potatobios.lua":"c9d8029487273bd85d3b46e1ea0fb2fb9c694b21dbd3b5cdd53123a329d03322","signing-key.tbl":"b32af5229c23af3bc03d538e42751b26044e404a7b1af064ed89894efe421607","startup":"f17bfb9b4322c4467dc9170d50827f2d75717e5c3125d734f21f3406657917bc","update-key.hex":"8d8afb7a45833bb7d68f929421ad60a211d4d73e0ee03b24dc0106ba1de2e1a0","xlib/00_cbor.lua":"464b075e4f094b8db42506bd4bdaad0db87699ea7fbf80e5b87739b4aa9279af","xlib/01_skynet.lua":"bde95ed86f3108ec56624367deea3e2694c8cfcd9eac220a21bad0b56c8a999b"},"timestamp":1598271203}
|
{"build":152,"description":"ccemux command","files":{"LICENSES":"f3549d84d66eb53dd4a421a4341d77d3d217c1b117d67e3be8f5211adcda0952","autorun.lua":"ec5ff5045da5dc90331c1dbb1797d9106b28e98cd141ef14b6e0dc2a8f6b56d3","bin/5rot26.lua":"91b66cd6d4b33081b25c456142dd7efcb894e819e842693c9e1e17ff48872ff5","bin/ccemux.lua":"239476f58835b86bbcac31ce8af3c3acd3d198a55ab9ada78c62fbf358625a98","bin/chronometer.lua":"db5363993a04382145aef7db2fbe262f0bf10697a589e1e2d2f9ce0f87430dd8","bin/kristminer.lua":"7e7f9fe2a6493d584ad6926cda915e02c1c3d800dc209680898ce930d0bb0e6f","bin/livegps.lua":"c3d17d495cda01aa1261e4c4fcd43439b29af422671972117ec34f68e32c5bba","bin/loading.lua":"c85f7aa1765170325155b921c1fceeb62643f552f12d41b529a22af3a67f5a97","bin/potatoflight.lua":"2fbb0b6f8d78728d8cb0ec64af1bc598bd00cb55f202378e7acdb86bba71efd1","bin/potatoplex.lua":"86c9e7597bbe23d7de7e7f1bfc976d0b94dcdf3af9e6c7c6c9b18b98596898c8","bin/relay.lua":"261ae6c220b83506e3326e8f2b091d246baae458ff0d2ee87512be2c4e35a75d","bin/tryhaskell.lua":"07810d85145da65a3e434154c79d5a9d72f2dcbe59c8d6829040fb925df878ec","potatobios.lua":"c9d8029487273bd85d3b46e1ea0fb2fb9c694b21dbd3b5cdd53123a329d03322","signing-key.tbl":"b32af5229c23af3bc03d538e42751b26044e404a7b1af064ed89894efe421607","startup":"f17bfb9b4322c4467dc9170d50827f2d75717e5c3125d734f21f3406657917bc","update-key.hex":"8d8afb7a45833bb7d68f929421ad60a211d4d73e0ee03b24dc0106ba1de2e1a0","xlib/00_cbor.lua":"464b075e4f094b8db42506bd4bdaad0db87699ea7fbf80e5b87739b4aa9279af","xlib/01_skynet.lua":"bde95ed86f3108ec56624367deea3e2694c8cfcd9eac220a21bad0b56c8a999b"},"timestamp":1598273239}
|
||||||
{"hash":"37031152afe0aa7ce441077ad85edf1cd62f061947228818145f0792a08481f8","sig":"fa7a12af5c8b4f60d47ce5d3b8841f677c75b4e033557b3fde8f22105770841c48b53d2ed96bfb48dd2f"}
|
{"hash":"00bdb680c717309c5ec182abea9f235b3f4ac6ee3b517bcb29841538a676017d","sig":"7acdc6e8288fe854bf73fc1b880ad204f57e012013f2c47c55ea593393d360395f8a64be99a3927fc218"}
|
48
src/bin/ccemux.lua
Normal file
48
src/bin/ccemux.lua
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
local args = {...}
|
||||||
|
local subcommand = table.remove(args, 1)
|
||||||
|
|
||||||
|
if not ccemux then error "For CCEmuX use only." end
|
||||||
|
|
||||||
|
local function assert_args(n, reqd, gte)
|
||||||
|
if (#args ~= n and not gte) or (#args < n and gte) then
|
||||||
|
error(("%d args required: %s"):format(n, reqd), 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if subcommand == "attach" then
|
||||||
|
assert_args(2, "side, peripheral, [options]", true)
|
||||||
|
local side, periph = table.remove(args, 1), table.remove(args, 1)
|
||||||
|
local opts = {}
|
||||||
|
for _, arg in pairs(args) do
|
||||||
|
local k, v = arg:match "^([^=]+)=(.*)$"
|
||||||
|
opts[k] = tonumber(v) or v
|
||||||
|
end
|
||||||
|
local ok, err = pcall(ccemux.attach, side, periph, opts)
|
||||||
|
if not ok then
|
||||||
|
if err:match "Invalid peripheral" then
|
||||||
|
error("invalid peripheral (try disk_drive, wireless_modem)", 0)
|
||||||
|
else
|
||||||
|
error(err, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif subcommand == "detach" then
|
||||||
|
assert_args(1, "side")
|
||||||
|
ccemux.detach(args[1])
|
||||||
|
elseif subcommand == "version" then
|
||||||
|
print(ccemux.getVersion())
|
||||||
|
elseif subcommand == "emu" then
|
||||||
|
ccemux.openEmu(tonumber(args[1]))
|
||||||
|
elseif subcommand == "datadir" then ccemux.openDataDir()
|
||||||
|
elseif subcommand == "config" then ccemux.openConfig()
|
||||||
|
elseif subcommand == "echo" then ccemux.echo(table.concat(args, " "))
|
||||||
|
elseif subcommand == "help" or not subcommand then
|
||||||
|
print([[available commands:
|
||||||
|
attach side, peripheral, [options] - attach virtual peripheral
|
||||||
|
detach side - detach virtual peripheral
|
||||||
|
version - get CCEmuX version
|
||||||
|
emu [ID] - open emulator window with computer with given ID (or next free one)
|
||||||
|
datadir - open CCEmuX data directory
|
||||||
|
config - open CCEmuX config
|
||||||
|
echo - print to CCEmuX console
|
||||||
|
help - print this]])
|
||||||
|
end
|
@ -528,10 +528,10 @@ local function process_disk(disk_side)
|
|||||||
local sig_raw = fread(sig_file)
|
local sig_raw = fread(sig_file)
|
||||||
local sig
|
local sig
|
||||||
if sig_raw:find "{" then sig = textutils.unserialise(sig_raw)
|
if sig_raw:find "{" then sig = textutils.unserialise(sig_raw)
|
||||||
--[[
|
--[[
|
||||||
Fix bug PS#56CB502C
|
Fix bug PS#56CB502C
|
||||||
The table-based signature format supported (more?) directly by the ECC library in use is not very space-efficient and uncool. This makes it support hexadecimal-format signatures, which look nicer.
|
The table-based signature format supported (more?) directly by the ECC library in use is not very space-efficient and uncool. This makes it support hexadecimal-format signatures, which look nicer.
|
||||||
]]
|
]]
|
||||||
else sig = unhexize(sig_raw) end
|
else sig = unhexize(sig_raw) end
|
||||||
disk.eject(disk_side)
|
disk.eject(disk_side)
|
||||||
if verify(code, sig) then
|
if verify(code, sig) then
|
||||||
|
Loading…
Reference in New Issue
Block a user