mirror of
https://github.com/zenith391/OCEmu.git
synced 2025-09-08 12:25:45 -04:00
Add direct=true information to components
Add direct = true, wherever necessary Add documentation to ocemu component Fix up old list.lua program to output using new mai syste Rename list.lua to gencomp.lua
This commit is contained in:
parent
1a577499e5
commit
d8a4718681
@ -1,10 +1,12 @@
|
|||||||
local args = { ... }
|
local args = { ... }
|
||||||
if #args ~= 1 then
|
if #args ~= 1 then
|
||||||
|
print("Usage: gencomp address")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local component = require("component")
|
local component = require("component")
|
||||||
local address = component.get(args[1])
|
local address = component.get(args[1])
|
||||||
local proxy = component.proxy(address)
|
local proxy = component.proxy(address)
|
||||||
|
local direct = component.methods(address)
|
||||||
print(proxy.type)
|
print(proxy.type)
|
||||||
local keys = {}
|
local keys = {}
|
||||||
for k,v in pairs(proxy) do
|
for k,v in pairs(proxy) do
|
||||||
@ -14,25 +16,18 @@ for k,v in pairs(proxy) do
|
|||||||
end
|
end
|
||||||
table.sort(keys,function(a,b) return a:reverse() < b:reverse() end)
|
table.sort(keys,function(a,b) return a:reverse() < b:reverse() end)
|
||||||
local file = io.open("list.txt","wb")
|
local file = io.open("list.txt","wb")
|
||||||
file = file:write("-- " .. proxy.type .. " component\nlocal obj = {}\n\n")
|
file = file:write("-- " .. proxy.type .. " component\nlocal mai = {}\nlocal obj = {}\n")
|
||||||
for i = 1,#keys do
|
for i = 1,#keys do
|
||||||
local k = keys[i]
|
local k = keys[i]
|
||||||
local doc = ""
|
local doc = ""
|
||||||
local comment = "-- no doc"
|
local comment
|
||||||
if component.doc(address,k) ~= nil then
|
if component.doc(address,k) ~= nil then
|
||||||
doc = component.doc(address,k):match("%((.-)%)"):gsub("[%[%]]","") .. ","
|
doc = component.doc(address,k):match("%((.-)%)"):gsub("[%[%]]","") .. ","
|
||||||
doc = doc:gsub("(.-):.-,",function(a) return a .. "," end):sub(1,-2)
|
doc = doc:gsub("(.-):.-,",function(a) return a .. "," end):sub(1,-2)
|
||||||
comment = component.doc(address,k):match("%-%-.*")
|
comment = component.doc(address,k)
|
||||||
end
|
end
|
||||||
file:write("function obj." .. k .. "(" .. doc .. ") " .. comment .."\n\t--STUB\n\tcprint(\"" .. proxy.type .. "." .. k .. "\"" .. (doc ~= "" and "," or "") .. doc .. ")\nend\n")
|
file:write("\nmai." .. k .. " = {" .. (direct[k] and "direct = true, " or "") .. string.format("doc = %q}\n", comment))
|
||||||
|
file:write("function obj." .. k .. "(" .. doc .. ")\n\t--STUB\n\tcprint(\"" .. proxy.type .. "." .. k .. "\"" .. (doc ~= "" and ", " or "") .. doc .. ")\nend\n")
|
||||||
end
|
end
|
||||||
file:write("\nlocal cec = {}\n\nlocal doc = {\n")
|
file:write("\nreturn obj,nil,mai")
|
||||||
for i = 1,#keys do
|
|
||||||
local k = keys[i]
|
|
||||||
if component.doc(address,k) ~= nil then
|
|
||||||
local doc = component.doc(address,k)
|
|
||||||
file:write(string.format("\t[%q]=%q,\n",k,doc))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
file:write("}\n\nreturn obj,cec,doc")
|
|
||||||
file:close()
|
file:close()
|
@ -2,7 +2,7 @@
|
|||||||
local mai = {}
|
local mai = {}
|
||||||
local obj = {}
|
local obj = {}
|
||||||
|
|
||||||
mai.isRunning = {doc = "function():boolean -- Returns whether the computer is running."}
|
mai.isRunning = {direct = true, doc = "function():boolean -- Returns whether the computer is running."}
|
||||||
function obj.isRunning()
|
function obj.isRunning()
|
||||||
--STUB
|
--STUB
|
||||||
cprint("computer.isRunning")
|
cprint("computer.isRunning")
|
||||||
@ -38,6 +38,12 @@ function obj.start()
|
|||||||
cprint("computer.start")
|
cprint("computer.start")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mai.getDeviceInfo = {direct = true, doc = "function():table -- Collect information on all connected devices."}
|
||||||
|
function obj.getDeviceInfo()
|
||||||
|
--STUB
|
||||||
|
cprint("computer.getDeviceInfo")
|
||||||
|
end
|
||||||
|
|
||||||
mai.getProgramLocations = {doc = "function():table -- Returns a list of available programs and their install disks."}
|
mai.getProgramLocations = {doc = "function():table -- Returns a list of available programs and their install disks."}
|
||||||
function obj.getProgramLocations()
|
function obj.getProgramLocations()
|
||||||
cprint("computer.getProgramLocations")
|
cprint("computer.getProgramLocations")
|
||||||
|
@ -48,7 +48,7 @@ end
|
|||||||
local mai = {}
|
local mai = {}
|
||||||
local obj = {}
|
local obj = {}
|
||||||
|
|
||||||
mai.getData = {doc = "function():string -- Get the currently stored byte array."}
|
mai.getData = {direct = true, doc = "function():string -- Get the currently stored byte array."}
|
||||||
function obj.getData()
|
function obj.getData()
|
||||||
cprint("eeprom.getData")
|
cprint("eeprom.getData")
|
||||||
return data
|
return data
|
||||||
@ -66,19 +66,19 @@ function obj.setData(newdata)
|
|||||||
persist()
|
persist()
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.getDataSize = {doc = "function():string -- Get the storage capacity of this EEPROM."}
|
mai.getDataSize = {direct = true, doc = "function():string -- Get the storage capacity of this EEPROM."}
|
||||||
function obj.getDataSize()
|
function obj.getDataSize()
|
||||||
cprint("eeprom.getDataSize")
|
cprint("eeprom.getDataSize")
|
||||||
return 256
|
return 256
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.getSize = {doc = "function():string -- Get the storage capacity of this EEPROM."}
|
mai.getSize = {direct = true, doc = "function():string -- Get the storage capacity of this EEPROM."}
|
||||||
function obj.getSize()
|
function obj.getSize()
|
||||||
cprint("eeprom.getSize")
|
cprint("eeprom.getSize")
|
||||||
return 4096
|
return 4096
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.getLabel = {doc = "function():string -- Get the label of the EEPROM."}
|
mai.getLabel = {direct = true, doc = "function():string -- Get the label of the EEPROM."}
|
||||||
function obj.getLabel()
|
function obj.getLabel()
|
||||||
cprint("eeprom.getLabel")
|
cprint("eeprom.getLabel")
|
||||||
return label
|
return label
|
||||||
@ -97,13 +97,13 @@ function obj.setLabel(newlabel)
|
|||||||
return label
|
return label
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.getChecksum = {doc = "function():string -- Get the checksum of the data on this EEPROM."}
|
mai.getChecksum = {direct = true, doc = "function():string -- Get the checksum of the data on this EEPROM."}
|
||||||
function obj.getChecksum()
|
function obj.getChecksum()
|
||||||
cprint("eeprom.getChecksum")
|
cprint("eeprom.getChecksum")
|
||||||
return string.format("%08x", tonumber(crc32(code)))
|
return string.format("%08x", tonumber(crc32(code)))
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.get = {doc = "function():string -- Get the currently stored byte array."}
|
mai.get = {direct = true, doc = "function():string -- Get the currently stored byte array."}
|
||||||
function obj.get() -- Get the currently stored byte array.
|
function obj.get() -- Get the currently stored byte array.
|
||||||
cprint("eeprom.get")
|
cprint("eeprom.get")
|
||||||
return code
|
return code
|
||||||
@ -124,7 +124,7 @@ function obj.set(newcode) -- Overwrite the currently stored byte array.
|
|||||||
persist()
|
persist()
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.makeReadonly = {doc = "function(checksum:string):boolean -- Make this EEPROM readonly if it isn't already. This process cannot be reversed!"}
|
mai.makeReadonly = {direct = true, doc = "function(checksum:string):boolean -- Make this EEPROM readonly if it isn't already. This process cannot be reversed!"}
|
||||||
function obj.makeReadonly(checksum) -- Make this EEPROM readonly if it isn't already. This process cannot be reversed!
|
function obj.makeReadonly(checksum) -- Make this EEPROM readonly if it isn't already. This process cannot be reversed!
|
||||||
cprint("eeprom.makeReadonly", checksum)
|
cprint("eeprom.makeReadonly", checksum)
|
||||||
compCheckArg(1,checksum,"string")
|
compCheckArg(1,checksum,"string")
|
||||||
|
@ -44,7 +44,7 @@ end
|
|||||||
local mai = {}
|
local mai = {}
|
||||||
local obj = {}
|
local obj = {}
|
||||||
|
|
||||||
mai.read = {doc = "function(handle:number, count:number):string or nil -- Reads up to the specified amount of data from an open file descriptor with the specified handle. Returns nil when EOF is reached."}
|
mai.read = {direct = true, doc = "function(handle:number, count:number):string or nil -- Reads up to the specified amount of data from an open file descriptor with the specified handle. Returns nil when EOF is reached."}
|
||||||
function obj.read(handle, count)
|
function obj.read(handle, count)
|
||||||
--TODO
|
--TODO
|
||||||
cprint("filesystem.read", handle, count)
|
cprint("filesystem.read", handle, count)
|
||||||
@ -60,7 +60,7 @@ function obj.read(handle, count)
|
|||||||
return table.unpack(ret)
|
return table.unpack(ret)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.lastModified = {doc = "function(path:string):number -- Returns the (real world) timestamp of when the object at the specified absolute path in the file system was modified."}
|
mai.lastModified = {direct = true, doc = "function(path:string):number -- Returns the (real world) timestamp of when the object at the specified absolute path in the file system was modified."}
|
||||||
function obj.lastModified(path)
|
function obj.lastModified(path)
|
||||||
cprint("filesystem.lastModified", path)
|
cprint("filesystem.lastModified", path)
|
||||||
compCheckArg(1,path,"string")
|
compCheckArg(1,path,"string")
|
||||||
@ -71,7 +71,7 @@ function obj.lastModified(path)
|
|||||||
return elsa.filesystem.getLastModified(directory .. "/" .. path) or 0
|
return elsa.filesystem.getLastModified(directory .. "/" .. path) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.spaceUsed = {doc = "function():number -- The currently used capacity of the file system, in bytes."}
|
mai.spaceUsed = {direct = true, doc = "function():number -- The currently used capacity of the file system, in bytes."}
|
||||||
function obj.spaceUsed()
|
function obj.spaceUsed()
|
||||||
--STUB
|
--STUB
|
||||||
cprint("filesystem.spaceUsed")
|
cprint("filesystem.spaceUsed")
|
||||||
@ -105,7 +105,7 @@ function obj.rename(from, to)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.close = {doc = "function(handle:number) -- Closes an open file descriptor with the specified handle."}
|
mai.close = {direct = true, doc = "function(handle:number) -- Closes an open file descriptor with the specified handle."}
|
||||||
function obj.close(handle)
|
function obj.close(handle)
|
||||||
cprint("filesystem.close", handle)
|
cprint("filesystem.close", handle)
|
||||||
compCheckArg(1,handle,"number")
|
compCheckArg(1,handle,"number")
|
||||||
@ -116,7 +116,7 @@ function obj.close(handle)
|
|||||||
handles[handle] = nil
|
handles[handle] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.write = {doc = "function(handle:number, value:string):boolean -- Writes the specified data to an open file descriptor with the specified handle."}
|
mai.write = {direct = true, doc = "function(handle:number, value:string):boolean -- Writes the specified data to an open file descriptor with the specified handle."}
|
||||||
function obj.write(handle, value)
|
function obj.write(handle, value)
|
||||||
cprint("filesystem.write", handle, value)
|
cprint("filesystem.write", handle, value)
|
||||||
compCheckArg(1,handle,"number")
|
compCheckArg(1,handle,"number")
|
||||||
@ -142,7 +142,7 @@ function obj.remove(path)
|
|||||||
return elsa.filesystem.remove(directory .. "/" .. path)
|
return elsa.filesystem.remove(directory .. "/" .. path)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.size = {doc = "function(path:string):number -- Returns the size of the object at the specified absolute path in the file system."}
|
mai.size = {direct = true, doc = "function(path:string):number -- Returns the size of the object at the specified absolute path in the file system."}
|
||||||
function obj.size(path)
|
function obj.size(path)
|
||||||
cprint("filesystem.size", path)
|
cprint("filesystem.size", path)
|
||||||
compCheckArg(1,path,"string")
|
compCheckArg(1,path,"string")
|
||||||
@ -153,7 +153,7 @@ function obj.size(path)
|
|||||||
return elsa.filesystem.getSize(directory .. "/" .. path) or 0
|
return elsa.filesystem.getSize(directory .. "/" .. path) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.seek = {doc = "function(handle:number, whence:string, offset:number):number -- Seeks in an open file descriptor with the specified handle. Returns the new pointer position."}
|
mai.seek = {direct = true, doc = "function(handle:number, whence:string, offset:number):number -- Seeks in an open file descriptor with the specified handle. Returns the new pointer position."}
|
||||||
function obj.seek(handle, whence, offset)
|
function obj.seek(handle, whence, offset)
|
||||||
--TODO
|
--TODO
|
||||||
cprint("filesystem.seek", handle, whence, offset)
|
cprint("filesystem.seek", handle, whence, offset)
|
||||||
@ -166,14 +166,14 @@ function obj.seek(handle, whence, offset)
|
|||||||
return handles[handle][1]:seek(whence, offset)
|
return handles[handle][1]:seek(whence, offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.spaceTotal = {doc = "function():number -- The overall capacity of the file system, in bytes."}
|
mai.spaceTotal = {direct = true, doc = "function():number -- The overall capacity of the file system, in bytes."}
|
||||||
function obj.spaceTotal()
|
function obj.spaceTotal()
|
||||||
--STUB
|
--STUB
|
||||||
cprint("filesystem.spaceTotal")
|
cprint("filesystem.spaceTotal")
|
||||||
return math.huge
|
return math.huge
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.getLabel = {doc = "function():string -- Get the current label of the file system."}
|
mai.getLabel = {direct = true, doc = "function():string -- Get the current label of the file system."}
|
||||||
function obj.getLabel()
|
function obj.getLabel()
|
||||||
cprint("filesystem.getLabel")
|
cprint("filesystem.getLabel")
|
||||||
return label
|
return label
|
||||||
@ -190,7 +190,7 @@ function obj.setLabel(value)
|
|||||||
label = value:sub(1,16)
|
label = value:sub(1,16)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.open = {doc = "function(path:string[, mode:string='r']):number -- Opens a new file descriptor and returns its handle."}
|
mai.open = {direct = true, doc = "function(path:string[, mode:string='r']):number -- Opens a new file descriptor and returns its handle."}
|
||||||
function obj.open(path, mode)
|
function obj.open(path, mode)
|
||||||
cprint("filesystem.open", path, mode)
|
cprint("filesystem.open", path, mode)
|
||||||
if mode == nil then mode = "r" end
|
if mode == nil then mode = "r" end
|
||||||
@ -220,7 +220,7 @@ function obj.open(path, mode)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.exists = {doc = "function(path:string):boolean -- Returns whether an object exists at the specified absolute path in the file system."}
|
mai.exists = {direct = true, doc = "function(path:string):boolean -- Returns whether an object exists at the specified absolute path in the file system."}
|
||||||
function obj.exists(path)
|
function obj.exists(path)
|
||||||
cprint("filesystem.exists", path)
|
cprint("filesystem.exists", path)
|
||||||
compCheckArg(1,path,"string")
|
compCheckArg(1,path,"string")
|
||||||
@ -256,13 +256,13 @@ function obj.list(path)
|
|||||||
return list
|
return list
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.isReadOnly = {doc = "function():boolean -- Returns whether the file system is read-only."}
|
mai.isReadOnly = {direct = true, doc = "function():boolean -- Returns whether the file system is read-only."}
|
||||||
function obj.isReadOnly()
|
function obj.isReadOnly()
|
||||||
cprint("filesystem.isReadOnly")
|
cprint("filesystem.isReadOnly")
|
||||||
return readonly
|
return readonly
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.makeDirectory = {doc = "function(path:string):boolean -- Creates a directory at the specified absolute path in the file system. Creates parent directories, if necessary."}
|
mai.makeDirectory = {direct = true, doc = "function(path:string):boolean -- Creates a directory at the specified absolute path in the file system. Creates parent directories, if necessary."}
|
||||||
function obj.makeDirectory(path)
|
function obj.makeDirectory(path)
|
||||||
cprint("filesystem.makeDirectory", path)
|
cprint("filesystem.makeDirectory", path)
|
||||||
compCheckArg(1,path,"string")
|
compCheckArg(1,path,"string")
|
||||||
@ -276,7 +276,7 @@ function obj.makeDirectory(path)
|
|||||||
return elsa.filesystem.createDirectory(directory .. "/" .. path)
|
return elsa.filesystem.createDirectory(directory .. "/" .. path)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.isDirectory = {doc = "function(path:string):boolean -- Returns whether the object at the specified absolute path in the file system is a directory."}
|
mai.isDirectory = {direct = true, doc = "function(path:string):boolean -- Returns whether the object at the specified absolute path in the file system is a directory."}
|
||||||
function obj.isDirectory(path)
|
function obj.isDirectory(path)
|
||||||
cprint("filesystem.isDirectory", path)
|
cprint("filesystem.isDirectory", path)
|
||||||
compCheckArg(1,path,"string")
|
compCheckArg(1,path,"string")
|
||||||
|
@ -27,7 +27,7 @@ function obj.bind(address)
|
|||||||
bindaddress = address
|
bindaddress = address
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.getForeground = {doc = "function():number, boolean -- Get the current foreground color and whether it's from the palette or not."}
|
mai.getForeground = {direct = true, doc = "function():number, boolean -- Get the current foreground color and whether it's from the palette or not."}
|
||||||
function obj.getForeground()
|
function obj.getForeground()
|
||||||
cprint("gpu.getForeground")
|
cprint("gpu.getForeground")
|
||||||
if bindaddress == nil then
|
if bindaddress == nil then
|
||||||
@ -37,7 +37,7 @@ function obj.getForeground()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
mai.setForeground = {doc = "function(value:number[, palette:boolean]):number, number or nil -- Sets the foreground color to the specified value. Optionally takes an explicit palette index. Returns the old value and if it was from the palette its palette index."}
|
mai.setForeground = {direct = true, doc = "function(value:number[, palette:boolean]):number, number or nil -- Sets the foreground color to the specified value. Optionally takes an explicit palette index. Returns the old value and if it was from the palette its palette index."}
|
||||||
function obj.setForeground(value, palette)
|
function obj.setForeground(value, palette)
|
||||||
cprint("gpu.setForeground", value, palette)
|
cprint("gpu.setForeground", value, palette)
|
||||||
compCheckArg(1,value,"number")
|
compCheckArg(1,value,"number")
|
||||||
@ -54,7 +54,7 @@ function obj.setForeground(value, palette)
|
|||||||
return component.cecinvoke(bindaddress, "setForeground", value, palette)
|
return component.cecinvoke(bindaddress, "setForeground", value, palette)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.getBackground = {doc = "function():number, boolean -- Get the current background color and whether it's from the palette or not."}
|
mai.getBackground = {direct = true, doc = "function():number, boolean -- Get the current background color and whether it's from the palette or not."}
|
||||||
function obj.getBackground()
|
function obj.getBackground()
|
||||||
cprint("gpu.getBackground")
|
cprint("gpu.getBackground")
|
||||||
if bindaddress == nil then
|
if bindaddress == nil then
|
||||||
@ -63,7 +63,7 @@ function obj.getBackground()
|
|||||||
return component.cecinvoke(bindaddress, "getBackground")
|
return component.cecinvoke(bindaddress, "getBackground")
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.setBackground = {doc = "function(value:number[, palette:boolean]):number, number or nil -- Sets the background color to the specified value. Optionally takes an explicit palette index. Returns the old value and if it was from the palette its palette index."}
|
mai.setBackground = {direct = true, doc = "function(value:number[, palette:boolean]):number, number or nil -- Sets the background color to the specified value. Optionally takes an explicit palette index. Returns the old value and if it was from the palette its palette index."}
|
||||||
function obj.setBackground(value, palette)
|
function obj.setBackground(value, palette)
|
||||||
cprint("gpu.setBackground", value, palette)
|
cprint("gpu.setBackground", value, palette)
|
||||||
compCheckArg(1,value,"number")
|
compCheckArg(1,value,"number")
|
||||||
@ -81,7 +81,7 @@ function obj.setBackground(value, palette)
|
|||||||
return component.cecinvoke(bindaddress, "setBackground", value, palette)
|
return component.cecinvoke(bindaddress, "setBackground", value, palette)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.getDepth = {doc = "function():number -- Returns the currently set color depth."}
|
mai.getDepth = {direct = true, doc = "function():number -- Returns the currently set color depth."}
|
||||||
function obj.getDepth()
|
function obj.getDepth()
|
||||||
cprint("gpu.getDepth")
|
cprint("gpu.getDepth")
|
||||||
return depthTbl[component.cecinvoke(bindaddress, "getDepth")]
|
return depthTbl[component.cecinvoke(bindaddress, "getDepth")]
|
||||||
@ -104,13 +104,13 @@ function obj.setDepth(depth)
|
|||||||
return old
|
return old
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.maxDepth = {doc = "function():number -- Get the maximum supported color depth."}
|
mai.maxDepth = {direct = true, doc = "function():number -- Get the maximum supported color depth."}
|
||||||
function obj.maxDepth()
|
function obj.maxDepth()
|
||||||
cprint("gpu.maxDepth")
|
cprint("gpu.maxDepth")
|
||||||
return depthTbl[math.min(component.cecinvoke(bindaddress, "maxDepth"), maxtier)]
|
return depthTbl[math.min(component.cecinvoke(bindaddress, "maxDepth"), maxtier)]
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.fill = {doc = "function(x:number, y:number, width:number, height:number, char:string):boolean -- Fills a portion of the screen at the specified position with the specified size with the specified character."}
|
mai.fill = {direct = true, doc = "function(x:number, y:number, width:number, height:number, char:string):boolean -- Fills a portion of the screen at the specified position with the specified size with the specified character."}
|
||||||
function obj.fill(x, y, width, height, char)
|
function obj.fill(x, y, width, height, char)
|
||||||
cprint("gpu.fill", x, y, width, height, char)
|
cprint("gpu.fill", x, y, width, height, char)
|
||||||
compCheckArg(1,x,"number")
|
compCheckArg(1,x,"number")
|
||||||
@ -127,13 +127,13 @@ function obj.fill(x, y, width, height, char)
|
|||||||
return component.cecinvoke(bindaddress, "fill", x, y, width, height, char)
|
return component.cecinvoke(bindaddress, "fill", x, y, width, height, char)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.getScreen = {doc = "function():string -- Get the address of the screen the GPU is currently bound to."}
|
mai.getScreen = {direct = true, doc = "function():string -- Get the address of the screen the GPU is currently bound to."}
|
||||||
function obj.getScreen()
|
function obj.getScreen()
|
||||||
cprint("gpu.getScreen")
|
cprint("gpu.getScreen")
|
||||||
return bindaddress
|
return bindaddress
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.getResolution = {doc = "function():number, number -- Get the current screen resolution."}
|
mai.getResolution = {direct = true, doc = "function():number, number -- Get the current screen resolution."}
|
||||||
function obj.getResolution()
|
function obj.getResolution()
|
||||||
cprint("gpu.getResolution")
|
cprint("gpu.getResolution")
|
||||||
if bindaddress == nil then
|
if bindaddress == nil then
|
||||||
@ -158,7 +158,7 @@ function obj.setResolution(width, height)
|
|||||||
return component.cecinvoke(bindaddress, "setResolution", width, height)
|
return component.cecinvoke(bindaddress, "setResolution", width, height)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.maxResolution = {doc = "function():number, number -- Get the maximum screen resolution."}
|
mai.maxResolution = {direct = true, doc = "function():number, number -- Get the maximum screen resolution."}
|
||||||
function obj.maxResolution()
|
function obj.maxResolution()
|
||||||
cprint("gpu.maxResolution")
|
cprint("gpu.maxResolution")
|
||||||
if bindaddress == nil then
|
if bindaddress == nil then
|
||||||
@ -169,7 +169,7 @@ function obj.maxResolution()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--STUB: Actually Implement viewport
|
--STUB: Actually Implement viewport
|
||||||
mai.getViewport = {doc = "function():number, number -- Get the current viewport resolution."}
|
mai.getViewport = {direct = true, doc = "function():number, number -- Get the current viewport resolution."}
|
||||||
function obj.getViewport()
|
function obj.getViewport()
|
||||||
cprint("gpu.getViewport")
|
cprint("gpu.getViewport")
|
||||||
if bindaddress == nil then
|
if bindaddress == nil then
|
||||||
@ -195,7 +195,7 @@ function obj.setViewport(width, height)
|
|||||||
return component.cecinvoke(bindaddress, "setResolution", width, height)
|
return component.cecinvoke(bindaddress, "setResolution", width, height)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.getPaletteColor = {doc = "function(index:number):number -- Get the palette color at the specified palette index."}
|
mai.getPaletteColor = {direct = true, doc = "function(index:number):number -- Get the palette color at the specified palette index."}
|
||||||
function obj.getPaletteColor(index)
|
function obj.getPaletteColor(index)
|
||||||
cprint("gpu.getPaletteColor", index)
|
cprint("gpu.getPaletteColor", index)
|
||||||
compCheckArg(1,index,"number")
|
compCheckArg(1,index,"number")
|
||||||
@ -212,7 +212,7 @@ function obj.getPaletteColor(index)
|
|||||||
return component.cecinvoke(bindaddress, "getPaletteColor", index)
|
return component.cecinvoke(bindaddress, "getPaletteColor", index)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.setPaletteColor = {doc = "function(index:number, color:number):number -- Set the palette color at the specified palette index. Returns the previous value."}
|
mai.setPaletteColor = {direct = true, doc = "function(index:number, color:number):number -- Set the palette color at the specified palette index. Returns the previous value."}
|
||||||
function obj.setPaletteColor(index, color)
|
function obj.setPaletteColor(index, color)
|
||||||
cprint("gpu.setPaletteColor", index, color)
|
cprint("gpu.setPaletteColor", index, color)
|
||||||
compCheckArg(1,index,"number")
|
compCheckArg(1,index,"number")
|
||||||
@ -230,7 +230,7 @@ function obj.setPaletteColor(index, color)
|
|||||||
return component.cecinvoke(bindaddress, "setPaletteColor", index, color)
|
return component.cecinvoke(bindaddress, "setPaletteColor", index, color)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.get = {doc = "function(x:number, y:number):string, number, number, number or nil, number or nil -- Get the value displayed on the screen at the specified index, as well as the foreground and background color. If the foreground or background is from the palette, returns the palette indices as fourth and fifth results, else nil, respectively."}
|
mai.get = {direct = true, doc = "function(x:number, y:number):string, number, number, number or nil, number or nil -- Get the value displayed on the screen at the specified index, as well as the foreground and background color. If the foreground or background is from the palette, returns the palette indices as fourth and fifth results, else nil, respectively."}
|
||||||
function obj.get(x, y)
|
function obj.get(x, y)
|
||||||
cprint("gpu.get", x, y)
|
cprint("gpu.get", x, y)
|
||||||
compCheckArg(1,x,"number")
|
compCheckArg(1,x,"number")
|
||||||
@ -245,7 +245,7 @@ function obj.get(x, y)
|
|||||||
return component.cecinvoke(bindaddress, "get", x, y)
|
return component.cecinvoke(bindaddress, "get", x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.set = {doc = "function(x:number, y:number, value:string[, vertical:boolean]):boolean -- Plots a string value to the screen at the specified position. Optionally writes the string vertically."}
|
mai.set = {direct = true, doc = "function(x:number, y:number, value:string[, vertical:boolean]):boolean -- Plots a string value to the screen at the specified position. Optionally writes the string vertically."}
|
||||||
function obj.set(x, y, value, vertical)
|
function obj.set(x, y, value, vertical)
|
||||||
cprint("gpu.set", x, y, value, vertical)
|
cprint("gpu.set", x, y, value, vertical)
|
||||||
compCheckArg(1,x,"number")
|
compCheckArg(1,x,"number")
|
||||||
@ -258,7 +258,7 @@ function obj.set(x, y, value, vertical)
|
|||||||
return component.cecinvoke(bindaddress, "set", x, y, value, vertical)
|
return component.cecinvoke(bindaddress, "set", x, y, value, vertical)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.copy = {doc = "function(x:number, y:number, width:number, height:number, tx:number, ty:number):boolean -- Copies a portion of the screen from the specified location with the specified size by the specified translation."}
|
mai.copy = {direct = true, doc = "function(x:number, y:number, width:number, height:number, tx:number, ty:number):boolean -- Copies a portion of the screen from the specified location with the specified size by the specified translation."}
|
||||||
function obj.copy(x, y, width, height, tx, ty)
|
function obj.copy(x, y, width, height, tx, ty)
|
||||||
cprint("gpu.copy", x, y, width, height, tx, ty)
|
cprint("gpu.copy", x, y, width, height, tx, ty)
|
||||||
compCheckArg(1,x,"number")
|
compCheckArg(1,x,"number")
|
||||||
|
@ -32,13 +32,13 @@ local function checkUri(address, port)
|
|||||||
error("address could not be parsed or no valid port given",4)
|
error("address could not be parsed or no valid port given",4)
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.isTcpEnabled = {doc = "function():boolean -- Returns whether TCP connections can be made (config setting)."}
|
mai.isTcpEnabled = {direct = true, doc = "function():boolean -- Returns whether TCP connections can be made (config setting)."}
|
||||||
function obj.isTcpEnabled()
|
function obj.isTcpEnabled()
|
||||||
cprint("internet.isTcpEnabled")
|
cprint("internet.isTcpEnabled")
|
||||||
return settings.tcpEnabled
|
return settings.tcpEnabled
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.isHttpEnabled = {doc = "function():boolean -- Returns whether HTTP requests can be made (config setting)."}
|
mai.isHttpEnabled = {direct = true, doc = "function():boolean -- Returns whether HTTP requests can be made (config setting)."}
|
||||||
function obj.isHttpEnabled()
|
function obj.isHttpEnabled()
|
||||||
cprint("internet.isHttpEnabled")
|
cprint("internet.isHttpEnabled")
|
||||||
return settings.httpEnabled
|
return settings.httpEnabled
|
||||||
|
@ -437,7 +437,7 @@ function obj.send(address, port, ...)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.getWakeMessage = {doc = "function():string -- Get the current wake-up message."}
|
mai.getWakeMessage = {direct = true, doc = "function():string -- Get the current wake-up message."}
|
||||||
function obj.getWakeMessage()
|
function obj.getWakeMessage()
|
||||||
return wakeMessage
|
return wakeMessage
|
||||||
end
|
end
|
||||||
@ -471,13 +471,13 @@ function obj.close(port)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.maxPacketSize = {doc = "function():number -- Gets the maximum packet size (config setting)."}
|
mai.maxPacketSize = {direct = true, doc = "function():number -- Gets the maximum packet size (config setting)."}
|
||||||
function obj.maxPacketSize()
|
function obj.maxPacketSize()
|
||||||
return settings.maxNetworkPacketSize
|
return settings.maxNetworkPacketSize
|
||||||
end
|
end
|
||||||
|
|
||||||
if wireless then
|
if wireless then
|
||||||
mai.getStrength = {doc = "function():number -- Get the signal strength (range) used when sending messages."}
|
mai.getStrength = {direct = true, doc = "function():number -- Get the signal strength (range) used when sending messages."}
|
||||||
function obj.getStrength()
|
function obj.getStrength()
|
||||||
return strength
|
return strength
|
||||||
end
|
end
|
||||||
@ -489,7 +489,7 @@ if wireless then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.isOpen = {doc = "function(port:number):boolean -- Whether the specified port is open."}
|
mai.isOpen = {direct = true, doc = "function(port:number):boolean -- Whether the specified port is open."}
|
||||||
function obj.isOpen(port)
|
function obj.isOpen(port)
|
||||||
compCheckArg(1,port,"number")
|
compCheckArg(1,port,"number")
|
||||||
return modem_host.open_ports[port] ~= nil
|
return modem_host.open_ports[port] ~= nil
|
||||||
@ -515,7 +515,7 @@ function obj.open(port)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
mai.isWireless = {doc = "function():boolean -- Whether this is a wireless network card."}
|
mai.isWireless = {direct = true, doc = "function():boolean -- Whether this is a wireless network card."}
|
||||||
function obj.isWireless()
|
function obj.isWireless()
|
||||||
return wireless
|
return wireless
|
||||||
end
|
end
|
||||||
|
@ -14,6 +14,7 @@ end
|
|||||||
local mai = {}
|
local mai = {}
|
||||||
local obj = {}
|
local obj = {}
|
||||||
|
|
||||||
|
mai.connect = {direct = true, doc = "function(kind:string, address:string or number or nil, slot:number or nil, ...):boolean -- Attach a component to the emulator."}
|
||||||
function obj.connect(kind, address, slot, ...)
|
function obj.connect(kind, address, slot, ...)
|
||||||
cprint("ocemu.connect", kind, address, slot, ...)
|
cprint("ocemu.connect", kind, address, slot, ...)
|
||||||
compCheckArg(1,kind,"string")
|
compCheckArg(1,kind,"string")
|
||||||
@ -30,12 +31,14 @@ function obj.connect(kind, address, slot, ...)
|
|||||||
return component.connect(kind, address, slot, ...)
|
return component.connect(kind, address, slot, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mai.disconnect = {direct = true, doc = "function(address:string):boolean -- Remove a component from the emulator."}
|
||||||
function obj.disconnect(address)
|
function obj.disconnect(address)
|
||||||
cprint("ocemu.disconnect", address)
|
cprint("ocemu.disconnect", address)
|
||||||
compCheckArg(1,address,"string")
|
compCheckArg(1,address,"string")
|
||||||
return component.disconnect(address)
|
return component.disconnect(address)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mai.lootlist = {direct = true, doc = "function():table -- Get a list of loot disks and disk information."}
|
||||||
function obj.lootlist()
|
function obj.lootlist()
|
||||||
cprint("ocemu.lootlist")
|
cprint("ocemu.lootlist")
|
||||||
local info={}
|
local info={}
|
||||||
@ -59,6 +62,7 @@ function obj.lootlist()
|
|||||||
return dirs
|
return dirs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mai.lootinsert = {direct = true, doc = "function(name:string):boolean or nil, string -- Insert a loot disk into the computer."}
|
||||||
function obj.lootinsert(name)
|
function obj.lootinsert(name)
|
||||||
cprint("ocemu.lootinsert", name)
|
cprint("ocemu.lootinsert", name)
|
||||||
compCheckArg(1,name,"string")
|
compCheckArg(1,name,"string")
|
||||||
@ -82,6 +86,7 @@ function obj.lootinsert(name)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mai.lootremove = {direct = true, doc = "function(name:string):boolean or nil, string -- Remove a loot disk from the computer."}
|
||||||
function obj.lootremove(name)
|
function obj.lootremove(name)
|
||||||
cprint("ocemu.lootremove", name)
|
cprint("ocemu.lootremove", name)
|
||||||
compCheckArg(1,name,"string")
|
compCheckArg(1,name,"string")
|
||||||
@ -103,6 +108,7 @@ function obj.lootremove(name)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mai.lootattached = {direct = true, doc = "function(name:string):boolean or nil, string -- Check if a loot disk is inserted in the computer."}
|
||||||
function obj.lootattached(name)
|
function obj.lootattached(name)
|
||||||
cprint("ocemu.lootattached", name)
|
cprint("ocemu.lootattached", name)
|
||||||
compCheckArg(1,name,"string")
|
compCheckArg(1,name,"string")
|
||||||
@ -117,10 +123,12 @@ function obj.lootattached(name)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mai.biglist = {direct = true, doc = "function() -- Generate a giant useless list of lua information from the computer."}
|
||||||
function obj.biglist()
|
function obj.biglist()
|
||||||
machine.biglistgen=true
|
machine.biglistgen=true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mai.log = {direct = true, doc = "function(...) -- Output a message to the emulator's stdout."}
|
||||||
function obj.log(...)
|
function obj.log(...)
|
||||||
print(...)
|
print(...)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user