Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into master-MC1.7.10

This commit is contained in:
Florian Nücke 2015-02-16 22:01:58 +01:00
commit debc62a941
4 changed files with 58 additions and 3 deletions

View File

@ -1,9 +1,18 @@
local version = "OpenLoader 0.2EE"
local eeprom = [[
_G._OSVERSION = "OpenLoader 0.1EE"
_G._OSVERSION = "]] .. version .. [["
local component = component or require('component')
local computer = computer or require('computer')
local unicode = unicode or require('unicode')
local eeprom = component.list("eeprom")()
computer.getBootAddress = function()
return component.invoke(eeprom, "getData")
end
computer.setBootAddress = function(address)
return component.invoke(eeprom, "setData", address)
end
local gpu = component.list("gpu")()
local w, h
@ -147,7 +156,7 @@ say ("Do you really want to flash openloader to EEPROM("..tostring(#eeprom).." b
if options.q or options.quiet or io.read():lower() == "y" then
say("Flashing... Do not reboot now!")
component.eeprom.set(eeprom)
component.eeprom.setLabel((type(options.label) == "string" and options.label) or "OpenLoader")
component.eeprom.setLabel((type(options.label) == "string" and options.label) or version)
if options.r or options.reboot then
computer.shutdown(true)
else

View File

@ -1,8 +1,15 @@
_G._OSVERSION = "OpenLoader 0.1"
_G._OSVERSION = "OpenLoader 0.2"
local component = component or require('component')
local computer = computer or require('computer')
local unicode = unicode or require('unicode')
local eeprom = component.list("eeprom")()
computer.getBootAddress = function()
return component.invoke(eeprom, "getData")
end
computer.setBootAddress = function(address)
return component.invoke(eeprom, "setData", address)
end
local gpu = component.list("gpu")()
local w, h

View File

@ -0,0 +1,33 @@
local event = require "event"
local component = require "component"
local keyboard = require "keyboard"
local interactive = io.output() == io.stdout
local color, isPal, evt
if interactive then
color, isPal = component.gpu.getForeground()
end
io.write("Press 'q' to exit\n")
pcall(function()
repeat
evt = table.pack(event.pull())
if interactive then component.gpu.setForeground(0xCC2200) end
io.write("[" .. os.date("%T") .. "] ")
if interactive then component.gpu.setForeground(0x44CC00) end
io.write(tostring(evt[1]) .. string.rep(" ", math.max(10 - #tostring(evt[1]), 0) + 1))
if interactive then component.gpu.setForeground(0xB0B00F) end
io.write(tostring(evt[2]) .. string.rep(" ", 37 - #tostring(evt[2])))
if interactive then component.gpu.setForeground(0xFFFFFF) end
if evt.n > 2 then
for i = 3, evt.n do
io.write(" " .. tostring(evt[i]))
end
end
io.write("\n")
until evt[1] == "key_down" and evt[4] == keyboard.keys.q
end)
if interactive then
component.gpu.setForeground(color, isPal)
end

View File

@ -0,0 +1,6 @@
NAME
dmesg - display messages(events)
SYNOPIS
dmesg