Кароч ебать биос-хуиос там с урл-бутом

This commit is contained in:
IgorTimofeev 2022-05-11 19:27:52 +03:00
parent 183118f1ec
commit 2d2b6a320d
9 changed files with 446 additions and 215 deletions

View File

@ -14,7 +14,6 @@ local event = require("Event")
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
local host = "http://mineos.modder.pw/MineOSAPI/2.04/" local host = "http://mineos.modder.pw/MineOSAPI/2.04/"
local iconCheckReponseTime = 2
local overviewIconsCount = 14 local overviewIconsCount = 14
local overviewAnimationDelay = 0.05 local overviewAnimationDelay = 0.05
@ -206,7 +205,7 @@ end
local function checkContentLength(url) local function checkContentLength(url)
local handle = component.get("internet").request(url) local handle = component.get("internet").request(url)
if handle then if handle then
local deadline, _, _, responseData = computer.uptime() + iconCheckReponseTime local deadline, _, _, responseData = computer.uptime() + 1
repeat repeat
_, _, responseData = handle:response() _, _, responseData = handle:response()
until responseData or computer.uptime() >= deadline until responseData or computer.uptime() >= deadline

View File

@ -13,7 +13,7 @@ local configPath = paths.user.applicationData .. "MultiScreen/Config.cfg"
local elementWidth = 48 local elementWidth = 48
local baseResolutionWidth = 146 local baseResolutionWidth = 146
local baseResolutionHeight = 54 local baseResolutionHeight = 54
local GPUProxy = screen.getGPUProxy() local GPUProxy = component.proxy(screen.getGPUAddress())
local mainScreenAddress = GPUProxy.getScreen() local mainScreenAddress = GPUProxy.getScreen()
local config = { local config = {
@ -148,7 +148,7 @@ local function mainMenu(force)
monitorCornerImageX = (xMonitor - 1) * baseResolutionWidth monitorCornerImageX = (xMonitor - 1) * baseResolutionWidth
-- Биндим гпуху к выбранному монику -- Биндим гпуху к выбранному монику
screen.bind(config.map[yMonitor][xMonitor], false) screen.setScreenAddress(config.map[yMonitor][xMonitor], false)
-- Чистим вилочкой буфер -- Чистим вилочкой буфер
screen.clear(config.backgroundColor) screen.clear(config.backgroundColor)
@ -209,7 +209,7 @@ local function mainMenu(force)
file:close() file:close()
screen.bind(mainScreenAddress, false) screen.setScreenAddress(mainScreenAddress, false)
screen.setResolution(oldWidth, oldHeight) screen.setResolution(oldWidth, oldHeight)
else else
file:close() file:close()

View File

@ -23,7 +23,7 @@ module.onTouch = function()
screen.clear(0x0) screen.clear(0x0)
screen.update() screen.update()
screen.bind(address, false) screen.setScreenAddress(address, false)
system.updateResolution() system.updateResolution()
system.updateWallpaper() system.updateWallpaper()
@ -63,7 +63,7 @@ module.onTouch = function()
layout:addChild(GUI.text(1, 1, 0x2D2D2D, "x")) layout:addChild(GUI.text(1, 1, 0x2D2D2D, "x"))
local heightInput = layout:addChild(GUI.input(1, 1, 17, 3, 0xE1E1E1, 0x696969, 0xA5A5A5, 0xE1E1E1, 0x2D2D2D, "", localization.screenHeight)) local heightInput = layout:addChild(GUI.input(1, 1, 17, 3, 0xE1E1E1, 0x696969, 0xA5A5A5, 0xE1E1E1, 0x2D2D2D, "", localization.screenHeight))
local maxWidth, maxHeight = screen.getGPUProxy().maxResolution() local maxWidth, maxHeight = screen.getMaxResolution()
local limit = maxWidth * maxHeight local limit = maxWidth * maxHeight
local lowerLimit = 30 local lowerLimit = 30
local cykaTextBox = window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0x880000, {string.format(localization.screenInvalidResolution, lowerLimit, limit)}, 1, 0, 0, true, true)) local cykaTextBox = window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0x880000, {string.format(localization.screenInvalidResolution, lowerLimit, limit)}, 1, 0, 0, true, true))
@ -81,7 +81,14 @@ module.onTouch = function()
local function updateCykaTextBox() local function updateCykaTextBox()
local width, height = tonumber(widthInput.text), tonumber(heightInput.text) local width, height = tonumber(widthInput.text), tonumber(heightInput.text)
cykaTextBox.hidden = width and height and width * height <= limit and width > lowerLimit and height > lowerLimit
cykaTextBox.hidden =
width
and height
and width * height <= limit
and width > lowerLimit
and height > lowerLimit
return width, height return width, height
end end
@ -96,6 +103,7 @@ module.onTouch = function()
widthInput.onInputFinished = function() widthInput.onInputFinished = function()
local width, height = updateCykaTextBox() local width, height = updateCykaTextBox()
if cykaTextBox.hidden then if cykaTextBox.hidden then
setResolution(width, height) setResolution(width, height)
else else

View File

@ -1,18 +1,89 @@
local stringsMain, stringsChangeLabel, stringKeyDown, stringsFilesystem, colorsTitle, colorsBackground, colorsText, colorsSelectionBackground, colorsSelectionText, componentProxy, componentList, pullSignal, uptime, tableInsert, mathMax, mathMin, mathHuge, mathFloor = "MineOS EFI", "Change label", "key_down", "filesystem", 0x2D2D2D, 0xE1E1E1, 0x878787, 0x878787, 0xE1E1E1, component.proxy, component.list, computer.pullSignal, computer.uptime, table.insert, math.max, math.min, math.huge, math.floor local
stringsMineOSEFI,
stringsChangeLabel,
stringsKeyDown,
stringsComponentAdded,
stringsFilesystem,
stringsURLBoot,
componentProxy,
componentList,
pullSignal,
uptime,
tableInsert,
mathMax,
mathMin,
mathHuge,
mathFloor,
local eeprom, gpu, internetAddress = componentProxy(componentList("eeprom")()), componentProxy(componentList("gpu")()), componentList("internet")() colorsTitle,
colorsBackground,
colorsText,
colorsSelectionBackground,
colorsSelectionText =
gpu.bind(componentList("screen")(), true) "MineOS EFI",
"Change label",
"key_down",
"component_added",
"filesystem",
"URL boot",
local shutdown, gpuSet, gpuSetBackground, gpuSetForeground, gpuFill, eepromSetData, eepromGetData, screenWidth, screenHeight = computer.shutdown, gpu.set, gpu.setBackground, gpu.setForeground, gpu.fill, eeprom.setData, eeprom.getData, gpu.getResolution() component.proxy,
component.list,
computer.pullSignal,
computer.uptime,
table.insert,
math.max,
math.min,
math.huge,
math.floor,
0x2D2D2D,
0xE1E1E1,
0x878787,
0x878787,
0xE1E1E1
local
eeprom,
gpu,
internetAddress =
componentProxy(componentList("eeprom")()),
componentProxy(componentList("gpu")()),
componentList("internet")()
local
gpuSet,
gpuSetBackground,
gpuSetForeground,
gpuFill,
eepromSetData,
eepromGetData,
screenWidth,
screenHeight =
gpu.set,
gpu.setBackground,
gpu.setForeground,
gpu.fill,
eeprom.setData,
eeprom.getData,
gpu.getResolution()
local
OSList,
bindGPUToScreen,
rectangle,
centrizedText,
menuElement,
runLoop =
local OSList, rectangle, centrizedText, menuElement =
{ {
{ {
"/OS.lua", "/OS.lua"
function()
end
}, },
{ {
"/init.lua", "/init.lua",
@ -21,38 +92,55 @@ local OSList, rectangle, centrizedText, menuElement =
end end
} }
}, },
function()
local screenAddress = componentList("screen")()
if screenAddress then
gpu.bind(screenAddress, true)
end
end,
function(x, y, width, height, color) function(x, y, width, height, color)
gpuSetBackground(color) gpuSetBackground(color)
gpuFill(x, y, width, height, " ") gpuFill(x, y, width, height, " ")
end, end,
function(y, foreground, text) function(y, foreground, text)
local x = mathFloor(screenWidth / 2 - #text / 2)
gpuSetForeground(foreground) gpuSetForeground(foreground)
gpuSet(x, y, text) gpuSet(mathFloor(screenWidth / 2 - #text / 2), y, text)
end, end,
function(text, callback, breakLoop) function(text, callback, breakLoop)
return { return {
s = text, s = text,
c = callback, c = callback,
b = breakLoop b = breakLoop
} }
end,
function(func, ...)
while func({ pullSignal(...) }) == nil do
end
end end
local function title(y, titleText) local function drawTitle(y, title)
y = mathFloor(screenHeight / 2 - y / 2) y = mathFloor(screenHeight / 2 - y / 2)
rectangle(1, 1, screenWidth, screenHeight, colorsBackground) rectangle(1, 1, screenWidth, screenHeight, colorsBackground)
centrizedText(y, colorsTitle, titleText) centrizedText(y, colorsTitle, title)
return y + 2 return y + 2
end end
local function status(titleText, statusText, needWait) local function status(statusText, needWait)
local lines = {} local lines = {}
for line in statusText:gmatch("[^\r\n]+") do for line in statusText:gmatch("[^\r\n]+") do
lines[#lines + 1] = line:gsub("\t", " ") lines[#lines + 1] = line:gsub("\t", " ")
end end
local y = title(#lines, titleText) local y = drawTitle(#lines, stringsMineOSEFI)
for i = 1, #lines do for i = 1, #lines do
centrizedText(y, colorsText, lines[i]) centrizedText(y, colorsText, lines[i])
@ -60,29 +148,41 @@ local function status(titleText, statusText, needWait)
end end
if needWait then if needWait then
repeat while pullSignal() ~= stringsKeyDown do
needWait = pullSignal()
until needWait == stringKeyDown or needWait == "touch" end
end end
end end
local function executeString(...) local function executeString(...)
local result, reason = load(...) local result, reason = load(...)
if result then if result then
result, reason = xpcall(result, debug.traceback) result, reason = xpcall(result, debug.traceback)
if result then if result then
return return
end end
end end
status(stringsMain, reason, 1) status(reason, 1)
end end
local boot, menuBack, menu, input = local
boot,
menuBack,
menu,
input,
internetExecute =
function(proxy) function(proxy)
local OS
for i = 1, #OSList do for i = 1, #OSList do
if proxy.exists(OSList[i][1]) then OS = OSList[i]
status(stringsMain, "Booting from " .. (proxy.getLabel() or proxy.address))
if proxy.exists(OS[1]) then
status("Booting from " .. (proxy.getLabel() or proxy.address))
-- Updating current EEPROM boot address if it's differs from given proxy address -- Updating current EEPROM boot address if it's differs from given proxy address
if eepromGetData() ~= proxy.address then if eepromGetData() ~= proxy.address then
@ -90,10 +190,13 @@ local boot, menuBack, menu, input =
end end
-- Running OS pre-boot function -- Running OS pre-boot function
OSList[i][2]() if OS[2] then
OS[2]()
end
-- Reading boot file -- Reading boot file
local handle, data, chunk, success, reason = proxy.open(OSList[i][1], "rb"), "" local handle, data, chunk, success, reason = proxy.open(OS[1], "rb"), ""
repeat repeat
chunk = proxy.read(handle, mathHuge) chunk = proxy.read(handle, mathHuge)
data = data .. (chunk or "") data = data .. (chunk or "")
@ -102,23 +205,26 @@ local boot, menuBack, menu, input =
proxy.close(handle) proxy.close(handle)
-- Running boot file -- Running boot file
executeString(data, "=" .. OSList[i][1]) executeString(data, "=" .. OS[1])
return 1 return 1
end end
end end
end, end,
function(f) function(f)
return menuElement("Back", f, 1) return menuElement("Back", f, 1)
end, end,
function(titleText, elements)
function(title, elements)
local selectedElement, maxLength = 1, 0 local selectedElement, maxLength = 1, 0
for i = 1, #elements do for i = 1, #elements do
maxLength = math.max(maxLength, #elements[i].s) maxLength = math.max(maxLength, #elements[i].s)
end end
while 1 do runLoop(function(e)
local y, x, eventData = title(#elements + 2, titleText) local y, x = drawTitle(#elements + 2, title)
for i = 1, #elements do for i = 1, #elements do
x = mathFloor(screenWidth / 2 - #elements[i].s / 2) x = mathFloor(screenWidth / 2 - #elements[i].s / 2)
@ -136,75 +242,136 @@ local boot, menuBack, menu, input =
y = y + 1 y = y + 1
end end
eventData = {pullSignal()} if e[1] == stringsKeyDown then
if eventData[1] == stringKeyDown then if e[4] == 200 and selectedElement > 1 then
if eventData[4] == 200 and selectedElement > 1 then
selectedElement = selectedElement - 1 selectedElement = selectedElement - 1
elseif eventData[4] == 208 and selectedElement < #elements then
elseif e[4] == 208 and selectedElement < #elements then
selectedElement = selectedElement + 1 selectedElement = selectedElement + 1
elseif eventData[4] == 28 then
elseif e[4] == 28 then
if elements[selectedElement].c then if elements[selectedElement].c then
elements[selectedElement].c() elements[selectedElement].c()
end end
if elements[selectedElement].b then if elements[selectedElement].b then
return return 1
end end
end end
elseif e[1] == stringsComponentAdded and e[3] == "screen" then
bindGPUToScreen()
end end
end end)
end, end,
function(y, prefix)
local text, state, eblo, eventData, char = "", true function(title, prefix)
while 1 do local
y,
text,
state,
eblo,
char =
drawTitle(2, title),
"",
true
local function draw()
eblo = prefix .. text eblo = prefix .. text
gpuFill(1, y, screenWidth, 1, " ") gpuFill(1, y, screenWidth, 1, " ")
gpuSetForeground(colorsText) gpuSetForeground(colorsText)
gpuSet(mathFloor(screenWidth / 2 - #eblo / 2), y, eblo .. (state and "" or "")) gpuSet(mathFloor(screenWidth / 2 - #eblo / 2), y, eblo .. (state and "" or ""))
end
eventData = {pullSignal(0.5)} draw()
if eventData[1] == stringKeyDown then
if eventData[4] == 28 then runLoop(
return text function(e)
elseif eventData[4] == 14 then if e[1] == stringsKeyDown then
text = text:sub(1, -2) if e[4] == 28 then
else return 1
char = unicode.char(eventData[3])
if char:match("^[%w%d%p%s]+") then elseif e[4] == 14 then
text = text .. char text = text:sub(1, -2)
else
char = unicode.char(e[3])
if char:match("^[%w%d%p%s]+") then
text = text .. char
end
end end
state = true
elseif e[1] == "clipboard" then
text = text .. e[3]
elseif not e[1] then
state = not state
end end
state = true draw()
elseif eventData[1] == "clipboard" then end,
text = text .. eventData[3] 0.5
elseif not eventData[1] then )
state = not state end,
function(url)
local
connection,
data,
result,
reason =
componentProxy(internetAddress).request(url),
""
if connection then
status("Downloading script")
while 1 do
result, reason = connection.read(mathHuge)
if result then
data = data .. result
else
connection.close()
if reason then
status(reason, 1)
else
executeString(data, "=url")
end
break
end
end end
else
status("Invalid URL", 1)
end end
end end
status(stringsMain, "Hold Alt to show boot options")
local deadline, eventData = uptime() + 1 bindGPUToScreen()
status("Hold Alt to show boot options")
-- Waiting 1 sec for user to press Alt key
local deadline, e = uptime() + 1
while uptime() < deadline do while uptime() < deadline do
eventData = {pullSignal(deadline - uptime())} e = { pullSignal(deadline - uptime()) }
if eventData[1] == stringKeyDown and eventData[4] == 56 then if e[1] == stringsKeyDown and e[4] == 56 then
local utilities = { local utilities = {
menuElement("Disk management", function() menuElement("Disk utility", function()
local restrict, filesystems, filesystemOptions = local restrict, filesystems, filesystemOptions =
function(text, limit) function(text, limit)
if #text < limit then return (#text < limit and text .. string.rep(" ", limit - #text) or text:sub(1, limit)) .. " "
text = text .. string.rep(" ", limit - #text)
else
text = text:sub(1, limit)
end
return text .. " "
end, end,
{menuBack()} { menuBack() }
local function updateFilesystems() local function updateFilesystems()
for i = 2, #filesystems do for i = 2, #filesystems do
@ -213,7 +380,12 @@ while uptime() < deadline do
for address in componentList(stringsFilesystem) do for address in componentList(stringsFilesystem) do
local proxy = componentProxy(address) local proxy = componentProxy(address)
local label, isReadOnly, filesystemOptions =
local
label,
isReadOnly,
filesystemOptions =
proxy.getLabel() or "Unnamed", proxy.getLabel() or "Unnamed",
proxy.isReadOnly(), proxy.isReadOnly(),
{ {
@ -225,12 +397,12 @@ while uptime() < deadline do
if not isReadOnly then if not isReadOnly then
tableInsert(filesystemOptions, menuElement(stringsChangeLabel, function() tableInsert(filesystemOptions, menuElement(stringsChangeLabel, function()
proxy.setLabel(input(title(2, stringsChangeLabel), "Enter new name: ")) proxy.setLabel(input(stringsChangeLabel, "New value: "))
updateFilesystems() updateFilesystems()
end, 1)) end, 1))
tableInsert(filesystemOptions, menuElement("Format", function() tableInsert(filesystemOptions, menuElement("Erase", function()
status(stringsMain, "Formatting filesystem " .. address) status("Erasing " .. address)
proxy.remove("") proxy.remove("")
updateFilesystems() updateFilesystems()
end, 1)) end, 1))
@ -241,11 +413,12 @@ while uptime() < deadline do
tableInsert(filesystems, 1, tableInsert(filesystems, 1,
menuElement( menuElement(
(address == eepromGetData() and "> " or " ") .. (address == eepromGetData() and "> " or " ") ..
restrict(label, 12) .. restrict(label, 10) ..
restrict(proxy.spaceTotal() > 1048576 and "HDD" or proxy.spaceTotal() > 65536 and "FDD" or "SYS", 3) .. restrict(proxy.spaceTotal() > 1048575 and "HDD" or proxy.spaceTotal() > 65535 and "FDD" or "SYS", 3) ..
restrict(isReadOnly and "R" or "R/W", 3) .. restrict(isReadOnly and "R " or "R/W", 3) ..
restrict(string.format("%.1f", proxy.spaceUsed() / proxy.spaceTotal() * 100) .. "%", 6) .. restrict(math.ceil(proxy.spaceUsed() / proxy.spaceTotal() * 100) .. "%", 4) ..
address:sub(1, 7) .. "", address:sub(1, 8) .. "",
function() function()
menu(label .. " (" .. address .. ")", filesystemOptions) menu(label .. " (" .. address .. ")", filesystemOptions)
end end
@ -257,63 +430,49 @@ while uptime() < deadline do
updateFilesystems() updateFilesystems()
menu("Select filesystem", filesystems) menu("Select filesystem", filesystems)
end), end),
menuElement("Shutdown", function()
shutdown()
end),
menuBack() menuBack()
} }
if internetAddress then if internetAddress then
tableInsert(utilities, 2, menuElement("Internet recovery", function() tableInsert(utilities, 2, menuElement("System recovery", function()
local handle, data, result, reason = componentProxy(internetAddress).request("https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/Main.lua"), "" internetExecute("https://tinyurl.com/29urhz7z")
end))
if handle then
status(stringsMain, "Downloading recovery script") tableInsert(utilities, 3, menuElement(stringsURLBoot, function()
internetExecute(input(stringsURLBoot, "Address: "))
while 1 do
result, reason = handle.read(mathHuge)
if result then
data = data .. result
else
handle.close()
if reason then
status(stringsMain, reason, 1)
else
executeString(data, "=string")
end
break
end
end
else
status(stringsMain, "invalid URL-address", 1)
end
end)) end))
end end
menu(stringsMain, utilities) menu(stringsMineOSEFI, utilities)
end end
end end
local proxy = componentProxy(eepromGetData()) -- Trying to boot from previously selected fs or from any available
if not (proxy and boot(proxy)) then local bootProxy = componentProxy(eepromGetData())
for address in componentList(stringsFilesystem) do
proxy = componentProxy(address)
if boot(proxy) then if not (bootProxy and boot(bootProxy)) then
break local function tryBootFromAny()
else for address in componentList(stringsFilesystem) do
proxy = nil bootProxy = componentProxy(address)
if boot(bootProxy) then
computer.shutdown()
else
bootProxy = nil
end
end
if not bootProxy then
status("Not boot sources found")
end end
end end
if not proxy then tryBootFromAny()
status(stringsMain, "No bootable mediums found", 1)
end
end
shutdown() runLoop(function(e)
if e[1] == stringsComponentAdded then
tryBootFromAny()
end
end)
end

View File

@ -1 +1 @@
local a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r="MineOS EFI","Change label","key_down","filesystem",0x2D2D2D,0xE1E1E1,0x878787,0x878787,0xE1E1E1,component.proxy,component.list,computer.pullSignal,computer.uptime,table.insert,math.max,math.min,math.huge,math.floor;local s,t,u=j(k("eeprom")()),j(k("gpu")()),k("internet")()t.bind(k("screen")(),true)local v,w,x,y,z,A,B,C,D=computer.shutdown,t.set,t.setBackground,t.setForeground,t.fill,s.setData,s.getData,t.getResolution()local E,F,G,H={{"/OS.lua",function()end},{"/init.lua",function()computer.getBootAddress,computer.setBootAddress=B,A end}},function(I,J,K,L,M)x(M)z(I,J,K,L," ")end,function(J,N,O)local I=r(C/2-#O/2)y(N)w(I,J,O)end,function(O,P,Q)return{s=O,c=P,b=Q}end;local function R(J,S)J=r(D/2-J/2)F(1,1,C,D,f)G(J,e,S)return J+2 end;local function T(S,U,V)local W={}for X in U:gmatch("[^\r\n]+")do W[#W+1]=X:gsub("\t"," ")end;local J=R(#W,S)for Y=1,#W do G(J,g,W[Y])J=J+1 end;if V then repeat V=l()until V==c or V=="touch"end end;local function Z(...)local _,a0=load(...)if _ then _,a0=xpcall(_,debug.traceback)if _ then return end end;T(a,a0,1)end;local a1,a2,a3,a4=function(a5)for Y=1,#E do if a5.exists(E[Y][1])then T(a,"Booting from "..(a5.getLabel()or a5.address))if B()~=a5.address then A(a5.address)end;E[Y][2]()local a6,a7,a8,a9,a0=a5.open(E[Y][1],"rb"),""repeat a8=a5.read(a6,q)a7=a7 ..(a8 or"")until not a8;a5.close(a6)Z(a7,"="..E[Y][1])return 1 end end end,function(aa)return H("Back",aa,1)end,function(S,ab)local ac,ad=1,0;for Y=1,#ab do ad=math.max(ad,#ab[Y].s)end;while 1 do local J,I,ae=R(#ab+2,S)for Y=1,#ab do I=r(C/2-#ab[Y].s/2)if Y==ac then F(r(C/2-ad/2)-2,J,ad+4,1,h)y(i)w(I,J,ab[Y].s)x(f)else y(g)w(I,J,ab[Y].s)end;J=J+1 end;ae={l()}if ae[1]==c then if ae[4]==200 and ac>1 then ac=ac-1 elseif ae[4]==208 and ac<#ab then ac=ac+1 elseif ae[4]==28 then if ab[ac].c then ab[ac].c()end;if ab[ac].b then return end end end end end,function(J,af)local O,ag,ah,ae,ai="",true;while 1 do ah=af..O;z(1,J,C,1," ")y(g)w(r(C/2-#ah/2),J,ah..(ag and""or""))ae={l(0.5)}if ae[1]==c then if ae[4]==28 then return O elseif ae[4]==14 then O=O:sub(1,-2)else ai=unicode.char(ae[3])if ai:match("^[%w%d%p%s]+")then O=O..ai end end;ag=true elseif ae[1]=="clipboard"then O=O..ae[3]elseif not ae[1]then ag=not ag end end end;T(a,"Hold Alt to show boot options")local aj,ae=m()+1;while m()<aj do ae={l(aj-m())}if ae[1]==c and ae[4]==56 then local ak={H("Disk management",function()local al,am,an=function(O,ao)if#O<ao then O=O..string.rep(" ",ao-#O)else O=O:sub(1,ao)end;return O.." "end,{a2()}local function ap()for Y=2,#am do table.remove(am,1)end;for aq in k(d)do local a5=j(aq)local ar,as,an=a5.getLabel()or"Unnamed",a5.isReadOnly(),{H("Set as bootable",function()A(aq)ap()end,1)}if not as then n(an,H(b,function()a5.setLabel(a4(R(2,b),"Enter new name: "))ap()end,1))n(an,H("Format",function()T(a,"Formatting filesystem "..aq)for at,au in ipairs(a5.list("/"))do a5.remove(au)end;ap()end,1))end;n(an,a2())n(am,1,H((aq==B()and"> "or" ")..al(ar,12)..al(a5.spaceTotal()>1048576 and"HDD"or a5.spaceTotal()>65536 and"FDD"or"SYS",3)..al(as and"R"or"R/W",3)..al(string.format("%.1f",a5.spaceUsed()/a5.spaceTotal()*100).."%",6)..aq:sub(1,7).."",function()a3(ar.." ("..aq..")",an)end))end end;ap()a3("Select filesystem",am)end),H("Shutdown",function()v()end),a2()}if u then n(ak,2,H("Internet recovery",function()local a6,a7,_,a0=j(u).request("https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/Main.lua"),""if a6 then T(a,"Downloading recovery script")while 1 do _,a0=a6.read(q)if _ then a7=a7 .._ else a6.close()if a0 then T(a,a0,1)else Z(a7,"=string")end;break end end else T(a,"invalid URL-address",1)end end))end;a3(a,ak)end end;local a5=j(B())if not(a5 and a1(a5))then for aq in k(d)do a5=j(aq)if a1(a5)then break else a5=nil end end;if not a5 then T(a,"No bootable mediums found",1)end end;v() local a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t="MineOS EFI","Change label","key_down","component_added","filesystem","URL boot",component.proxy,component.list,computer.pullSignal,computer.uptime,table.insert,math.max,math.min,math.huge,math.floor,0x2D2D2D,0xE1E1E1,0x878787,0x878787,0xE1E1E1;local u,v,w=g(h("eeprom")()),g(h("gpu")()),h("internet")()local x,y,z,A,B,C,D,E=v.set,v.setBackground,v.setForeground,v.fill,u.setData,u.getData,v.getResolution()local F,G,H,I,J,K={{"/OS.lua"},{"/init.lua",function()computer.getBootAddress,computer.setBootAddress=C,B end}},function()local L=h("screen")()if L then v.bind(L,true)end end,function(M,N,O,P,Q)y(Q)A(M,N,O,P," ")end,function(N,R,S)z(R)x(o(D/2-#S/2),N,S)end,function(S,T,U)return{s=S,c=T,b=U}end,function(V,...)while V({i(...)})==nil do end end;local function W(N,X)N=o(E/2-N/2)H(1,1,D,E,q)I(N,p,X)return N+2 end;local function Y(Z,_)local a0={}for a1 in Z:gmatch("[^\r\n]+")do a0[#a0+1]=a1:gsub("\t"," ")end;local N=W(#a0,a)for a2=1,#a0 do I(N,r,a0[a2])N=N+1 end;if _ then while i()~=c do end end end;local function a3(...)local a4,a5=load(...)if a4 then a4,a5=xpcall(a4,debug.traceback)if a4 then return end end;Y(a5,1)end;local a6,a7,a8,a9,aa=function(ab)local ac;for a2=1,#F do ac=F[a2]if ab.exists(ac[1])then Y("Booting from "..(ab.getLabel()or ab.address))if C()~=ab.address then B(ab.address)end;if ac[2]then ac[2]()end;local ad,ae,af,ag,a5=ab.open(ac[1],"rb"),""repeat af=ab.read(ad,n)ae=ae..(af or"")until not af;ab.close(ad)a3(ae,"="..ac[1])return 1 end end end,function(ah)return J("Back",ah,1)end,function(X,ai)local aj,ak=1,0;for a2=1,#ai do ak=math.max(ak,#ai[a2].s)end;K(function(al)local N,M=W(#ai+2,X)for a2=1,#ai do M=o(D/2-#ai[a2].s/2)if a2==aj then H(o(D/2-ak/2)-2,N,ak+4,1,s)z(t)x(M,N,ai[a2].s)y(q)else z(r)x(M,N,ai[a2].s)end;N=N+1 end;if al[1]==c then if al[4]==200 and aj>1 then aj=aj-1 elseif al[4]==208 and aj<#ai then aj=aj+1 elseif al[4]==28 then if ai[aj].c then ai[aj].c()end;if ai[aj].b then return 1 end end elseif al[1]==d and al[3]=="screen"then G()end end)end,function(X,am)local N,S,an,ao,ap=W(2,X),"",true;local function aq()ao=am..S;A(1,N,D,1," ")z(r)x(o(D/2-#ao/2),N,ao..(an and""or""))end;aq()K(function(al)if al[1]==c then if al[4]==28 then return 1 elseif al[4]==14 then S=S:sub(1,-2)else ap=unicode.char(al[3])if ap:match("^[%w%d%p%s]+")then S=S..ap end end;an=true elseif al[1]=="clipboard"then S=S..al[3]elseif not al[1]then an=not an end;aq()end,0.5)end,function(ar)local as,ae,a4,a5=g(w).request(ar),""if as then Y("Downloading script")while 1 do a4,a5=as.read(n)if a4 then ae=ae..a4 else as.close()if a5 then Y(a5,1)else a3(ae,"=url")end;break end end else Y("Invalid URL",1)end end;G()Y("Hold Alt to show boot options")local at,al=j()+1;while j()<at do al={i(at-j())}if al[1]==c and al[4]==56 then local au={J("Disk utility",function()local av,aw,ax=function(S,ay)return(#S<ay and S..string.rep(" ",ay-#S)or S:sub(1,ay)).." "end,{a7()}local function az()for a2=2,#aw do table.remove(aw,1)end;for aA in h(e)do local ab=g(aA)local aB,aC,ax=ab.getLabel()or"Unnamed",ab.isReadOnly(),{J("Set as bootable",function()B(aA)az()end,1)}if not aC then k(ax,J(b,function()ab.setLabel(a9(b,"New value: "))az()end,1))k(ax,J("Erase",function()Y("Erasing "..aA)ab.remove("")az()end,1))end;k(ax,a7())k(aw,1,J((aA==C()and"> "or" ")..av(aB,10)..av(ab.spaceTotal()>1048575 and"HDD"or ab.spaceTotal()>65535 and"FDD"or"SYS",3)..av(aC and"R "or"R/W",3)..av(math.ceil(ab.spaceUsed()/ab.spaceTotal()*100).."%",4)..aA:sub(1,8).."",function()a8(aB.." ("..aA..")",ax)end))end end;az()a8("Select filesystem",aw)end),a7()}if w then k(au,2,J("System recovery",function()aa("https://tinyurl.com/29urhz7z")end))k(au,3,J(f,function()aa(a9(f,"Address: "))end))end;a8(a,au)end end;local aD=g(C())if not(aD and a6(aD))then local function aE()for aA in h(e)do aD=g(aA)if a6(aD)then computer.shutdown()else aD=nil end end;if not aD then Y("Not boot sources found")end end;aE()K(function(al)if al[1]==d then aE()end end)end

View File

@ -4,18 +4,14 @@ local function getComponentAddress(name)
return component.list(name)() or error("Required " .. name .. " component is missing") return component.list(name)() or error("Required " .. name .. " component is missing")
end end
local function getComponentProxy(name) local EEPROMAddress, internetAddress, GPUAddress =
return component.proxy(getComponentAddress(name)) getComponentAddress("eeprom"),
end getComponentAddress("internet"),
getComponentAddress("gpu")
local EEPROMProxy, internetProxy, GPUProxy =
getComponentProxy("eeprom"),
getComponentProxy("internet"),
getComponentProxy("gpu")
-- Binding GPU to screen in case it's not done yet -- Binding GPU to screen in case it's not done yet
GPUProxy.bind(getComponentAddress("screen")) component.invoke(GPUAddress, "bind", getComponentAddress("screen"))
local screenWidth, screenHeight = GPUProxy.getResolution() local screenWidth, screenHeight = component.invoke(GPUAddress, "getResolution")
local repositoryURL = "https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/" local repositoryURL = "https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/"
local installerURL = "Installer/" local installerURL = "Installer/"
@ -35,9 +31,9 @@ local function centrize(width)
end end
local function centrizedText(y, color, text) local function centrizedText(y, color, text)
GPUProxy.fill(1, y, screenWidth, 1, " ") component.invoke(GPUAddress, "fill", 1, y, screenWidth, 1, " ")
GPUProxy.setForeground(color) component.invoke(GPUAddress, "setForeground", color)
GPUProxy.set(centrize(#text), y, text) component.invoke(GPUAddress, "set", centrize(#text), y, text)
end end
local function title() local function title()
@ -61,10 +57,10 @@ local function progress(value)
local width = 26 local width = 26
local x, y, part = centrize(width), title(), math.ceil(width * value) local x, y, part = centrize(width), title(), math.ceil(width * value)
GPUProxy.setForeground(0x878787) component.invoke(GPUAddress, "setForeground", 0x878787)
GPUProxy.set(x, y, string.rep("", part)) component.invoke(GPUAddress, "set", x, y, string.rep("", part))
GPUProxy.setForeground(0xC3C3C3) component.invoke(GPUAddress, "setForeground", 0xC3C3C3)
GPUProxy.set(x + part, y, string.rep("", width - part)) component.invoke(GPUAddress, "set", x + part, y, string.rep("", width - part))
end end
local function filesystemPath(path) local function filesystemPath(path)
@ -80,7 +76,7 @@ local function filesystemHideExtension(path)
end end
local function rawRequest(url, chunkHandler) local function rawRequest(url, chunkHandler)
local internetHandle, reason = internetProxy.request(repositoryURL .. url:gsub("([^%w%-%_%.%~])", function(char) local internetHandle, reason = component.invoke(internetAddress, "request", repositoryURL .. url:gsub("([^%w%-%_%.%~])", function(char)
return string.format("%%%02X", string.byte(char)) return string.format("%%%02X", string.byte(char))
end)) end))
@ -141,8 +137,8 @@ local function deserialize(text)
end end
-- Clearing screen -- Clearing screen
GPUProxy.setBackground(0xE1E1E1) component.invoke(GPUAddress, "setBackground", 0xE1E1E1)
GPUProxy.fill(1, 1, screenWidth, screenHeight, " ") component.invoke(GPUAddress, "fill", 1, 1, screenWidth, screenHeight, " ")
-- Searching for appropriate temporary filesystem for storing libraries, images, etc -- Searching for appropriate temporary filesystem for storing libraries, images, etc
for address in component.list("filesystem") do for address in component.list("filesystem") do
@ -216,7 +212,7 @@ local text = require("Text")
local number = require("Number") local number = require("Number")
local screen = require("Screen") local screen = require("Screen")
screen.setGPUProxy(GPUProxy) screen.setGPUAddress(GPUAddress)
local GUI = require("GUI") local GUI = require("GUI")
local system = require("System") local system = require("System")
@ -569,9 +565,9 @@ addStage(function()
addTitle(0x969696, localization.flashing) addTitle(0x969696, localization.flashing)
workspace:draw() workspace:draw()
EEPROMProxy.set(request(EFIURL)) component.invoke(EEPROMAddress, "set", request(EFIURL))
EEPROMProxy.setLabel("MineOS EFI") component.invoke(EEPROMAddress, "setLabel", "MineOS EFI")
EEPROMProxy.setData(selectedFilesystemProxy.address) component.invoke(EEPROMAddress, "setData", selectedFilesystemProxy.address)
-- Downloading files -- Downloading files
layout:removeChildren() layout:removeChildren()

View File

@ -4,15 +4,61 @@ local image = require("Image")
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
local bufferWidth, bufferHeight local
local currentFrameBackgrounds, currentFrameForegrounds, currentFrameSymbols, newFrameBackgrounds, newFrameForegrounds, newFrameSymbols componentInvoke,
local drawLimitX1, drawLimitX2, drawLimitY1, drawLimitY2
local GPUProxy, GPUProxyGetResolution, GPUProxySetResolution, GPUProxyGetBackground, GPUProxyGetForeground, GPUProxySetBackground, GPUProxySetForeground, GPUProxyGet, GPUProxySet, GPUProxyFill
local mathCeil, mathFloor, mathModf, mathAbs, mathMin, mathMax = math.ceil, math.floor, math.modf, math.abs, math.min, math.max mathCeil,
local tableInsert, tableConcat = table.insert, table.concat mathFloor,
local colorBlend, colorRGBToInteger, colorIntegerToRGB = color.blend, color.RGBToInteger, color.integerToRGB mathModf,
local unicodeLen, unicodeSub = unicode.len, unicode.sub mathAbs,
mathMin,
mathMax,
tableInsert,
tableConcat,
colorBlend,
colorRGBToInteger,
colorIntegerToRGB,
unicodeLen,
unicodeSub,
bufferWidth,
bufferHeight,
currentFrameBackgrounds,
currentFrameForegrounds,
currentFrameSymbols,
newFrameBackgrounds,
newFrameForegrounds,
newFrameSymbols,
drawLimitX1,
drawLimitX2,
drawLimitY1,
drawLimitY2,
GPUAddress =
component.invoke,
math.ceil,
math.floor,
math.modf,
math.abs,
math.min,
math.max,
table.insert,
table.concat,
color.blend,
color.RGBToInteger,
color.integerToRGB,
unicode.len,
unicode.sub;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -46,7 +92,7 @@ end
local function flush(width, height) local function flush(width, height)
if not width or not height then if not width or not height then
width, height = GPUProxyGetResolution() width, height = componentInvoke(GPUAddress, "getResolution")
end end
currentFrameBackgrounds, currentFrameForegrounds, currentFrameSymbols, newFrameBackgrounds, newFrameForegrounds, newFrameSymbols = {}, {}, {}, {}, {}, {} currentFrameBackgrounds, currentFrameForegrounds, currentFrameSymbols, newFrameBackgrounds, newFrameForegrounds, newFrameSymbols = {}, {}, {}, {}, {}, {}
@ -67,11 +113,44 @@ local function flush(width, height)
end end
end end
local function getGPUAddress()
return GPUAddress
end
local function setGPUAddress(address)
GPUAddress = address
flush()
end
local function getScreenAddress()
return componentInvoke(GPUAddress, "getScreen")
end
local function getMaxResolution()
return componentInvoke(GPUAddress, "maxResolution")
end
local function setResolution(width, height) local function setResolution(width, height)
GPUProxySetResolution(width, height) componentInvoke(GPUAddress, "setResolution", width, height)
flush(width, height) flush(width, height)
end end
local function getDepth()
return componentInvoke(GPUAddress, "getDepth")
end
local function setDepth(...)
return componentInvoke(GPUAddress, "setDepth", ...)
end
local function getMaxDepth(...)
return componentInvoke(GPUAddress, "maxDepth")
end
local function getScreenAspectRatio()
return componentInvoke(getScreenAddress(), "getAspectRatio")
end
local function getResolution() local function getResolution()
return bufferWidth, bufferHeight return bufferWidth, bufferHeight
end end
@ -84,11 +163,12 @@ local function getHeight()
return bufferHeight return bufferHeight
end end
local function bind(address, reset) local function setScreenAddress(address, reset)
local success, reason = GPUProxy.bind(address, reset) local success, reason = componentInvoke(GPUAddress, "bind", address, reset)
if success then if success then
if reset then if reset then
setResolution(GPUProxy.maxResolution()) setResolution(getMaxResolution())
else else
setResolution(bufferWidth, bufferHeight) setResolution(bufferWidth, bufferHeight)
end end
@ -97,30 +177,6 @@ local function bind(address, reset)
end end
end end
local function getGPUProxy()
return GPUProxy
end
local function updateGPUProxyMethods()
GPUProxyGet = GPUProxy.get
GPUProxyGetResolution = GPUProxy.getResolution
GPUProxyGetBackground = GPUProxy.getBackground
GPUProxyGetForeground = GPUProxy.getForeground
GPUProxySet = GPUProxy.set
GPUProxySetResolution = GPUProxy.setResolution
GPUProxySetBackground = GPUProxy.setBackground
GPUProxySetForeground = GPUProxy.setForeground
GPUProxyFill = GPUProxy.fill
end
local function setGPUProxy(proxy)
GPUProxy = proxy
updateGPUProxyMethods()
flush()
end
local function getScaledResolution(scale) local function getScaledResolution(scale)
if not scale or scale > 1 then if not scale or scale > 1 then
scale = 1 scale = 1
@ -128,8 +184,8 @@ local function getScaledResolution(scale)
scale = 0.1 scale = 0.1
end end
local aspectWidth, aspectHeight = component.proxy(GPUProxy.getScreen()).getAspectRatio() local aspectWidth, aspectHeight = getScreenAspectRatio()
local maxWidth, maxHeight = GPUProxy.maxResolution() local maxWidth, maxHeight = getMaxResolution()
local proportion = 2 * (16 * aspectWidth - 4.5) / (16 * aspectHeight - 4.5) local proportion = 2 * (16 * aspectWidth - 4.5) / (16 * aspectHeight - 4.5)
local height = scale * mathMin( local height = scale * mathMin(
@ -700,7 +756,7 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
local function update(force) local function update(force)
local index, indexStepOnEveryLine, changes = bufferWidth * (drawLimitY1 - 1) + drawLimitX1, (bufferWidth - drawLimitX2 + drawLimitX1 - 1), {} local index, indexStepOnEveryLine, changes = bufferWidth * (drawLimitY1 - 1) + drawLimitX1, (bufferWidth - drawLimitX2 + drawLimitX1 - 1), {}
local x, equalChars, equalCharsIndex, charX, charIndex, currentForeground local x, equalChars, equalCharsIndex, charX, charIndex, currentForeground
local currentFrameBackground, currentFrameForeground, currentFrameSymbol, changesCurrentFrameBackground, changesCurrentFrameBackgroundCurrentFrameForeground local currentFrameBackground, currentFrameForeground, currentFrameSymbol, changesCurrentFrameBackground, changesCurrentFrameBackgroundCurrentFrameForeground
@ -769,16 +825,16 @@ local function update(force)
-- Draw grouped pixels on screen -- Draw grouped pixels on screen
for background, foregrounds in pairs(changes) do for background, foregrounds in pairs(changes) do
GPUProxySetBackground(background) componentInvoke(GPUAddress, "setBackground", background)
for foreground, pixels in pairs(foregrounds) do for foreground, pixels in pairs(foregrounds) do
if currentForeground ~= foreground then if currentForeground ~= foreground then
GPUProxySetForeground(foreground) componentInvoke(GPUAddress, "setForeground", foreground)
currentForeground = foreground currentForeground = foreground
end end
for i = 1, #pixels, 3 do for i = 1, #pixels, 3 do
GPUProxySet(pixels[i], pixels[i + 1], pixels[i + 2]) componentInvoke(GPUAddress, "set", pixels[i], pixels[i + 1], pixels[i + 2])
end end
end end
end end
@ -794,10 +850,18 @@ return {
resetDrawLimit = resetDrawLimit, resetDrawLimit = resetDrawLimit,
getDrawLimit = getDrawLimit, getDrawLimit = getDrawLimit,
flush = flush, flush = flush,
setResolution = setResolution, setResolution = setResolution,
bind = bind, getMaxResolution = getMaxResolution,
setGPUProxy = setGPUProxy,
getGPUProxy = getGPUProxy, setScreenAddress = setScreenAddress,
getDepth = getDepth,
setDepth = setDepth,
getMaxDepth = getMaxDepth,
setGPUAddress = setGPUAddress,
getGPUAddress = getGPUAddress,
getScaledResolution = getScaledResolution, getScaledResolution = getScaledResolution,
getResolution = getResolution, getResolution = getResolution,
getWidth = getWidth, getWidth = getWidth,
@ -805,6 +869,9 @@ return {
getCurrentFrameTables = getCurrentFrameTables, getCurrentFrameTables = getCurrentFrameTables,
getNewFrameTables = getNewFrameTables, getNewFrameTables = getNewFrameTables,
getScreenAspectRatio = getScreenAspectRatio,
getScreenAddress = getScreenAddress,
rawSet = rawSet, rawSet = rawSet,
rawGet = rawGet, rawGet = rawGet,
get = get, get = get,

View File

@ -2046,7 +2046,7 @@ function system.execute(path, ...)
GUI.alert("File \"" .. tostring(path) .. "\" doesn't exists") GUI.alert("File \"" .. tostring(path) .. "\" doesn't exists")
end end
component.proxy(screen.getGPUProxy().getScreen()).setPrecise(false) component.invoke(screen.getScreenAddress(), "setPrecise", false)
screen.setResolution(oldScreenWidth, oldScreenHeight) screen.setResolution(oldScreenWidth, oldScreenHeight)
if not success then if not success then
@ -2134,7 +2134,7 @@ function system.updateResolution()
if userSettings.interfaceScreenWidth then if userSettings.interfaceScreenWidth then
screen.setResolution(userSettings.interfaceScreenWidth, userSettings.interfaceScreenHeight) screen.setResolution(userSettings.interfaceScreenWidth, userSettings.interfaceScreenHeight)
else else
screen.setResolution(screen.getGPUProxy().maxResolution()) screen.setResolution(screen.getMaxResolution())
end end
workspace.width, workspace.height = screen.getResolution() workspace.width, workspace.height = screen.getResolution()

34
OS.lua
View File

@ -94,8 +94,8 @@ function require(module)
end end
end end
local GPUProxy = component.proxy(component.list("gpu")()) local GPUAddress = component.list("gpu")()
local screenWidth, screenHeight = GPUProxy.getResolution() local screenWidth, screenHeight = component.invoke(GPUAddress, "getResolution")
-- Displays title and currently required library when booting OS -- Displays title and currently required library when booting OS
local UIRequireTotal, UIRequireCounter = 14, 1 local UIRequireTotal, UIRequireCounter = 14, 1
@ -110,21 +110,22 @@ local function UIRequire(module)
UIRequireCounter = UIRequireCounter + 1 UIRequireCounter = UIRequireCounter + 1
-- Title -- Title
GPUProxy.setForeground(0x2D2D2D) component.invoke(GPUAddress, "setForeground", 0x2D2D2D)
GPUProxy.set(centrize(#title), y, title) component.invoke(GPUAddress, "set", centrize(#title), y, title)
-- Progressbar -- Progressbar
GPUProxy.setForeground(0x878787) component.invoke(GPUAddress, "setForeground", 0x878787)
GPUProxy.set(x, y + 2, string.rep("", part)) component.invoke(GPUAddress, "set", x, y + 2, string.rep("", part))
GPUProxy.setForeground(0xC3C3C3)
GPUProxy.set(x + part, y + 2, string.rep("", width - part)) component.invoke(GPUAddress, "setForeground", 0xC3C3C3)
component.invoke(GPUAddress, "set", x + part, y + 2, string.rep("", width - part))
return require(module) return require(module)
end end
-- Preparing screen for loading libraries -- Preparing screen for loading libraries
GPUProxy.setBackground(0xE1E1E1) component.invoke(GPUAddress, "setBackground", 0xE1E1E1)
GPUProxy.fill(1, 1, screenWidth, screenHeight, " ") component.invoke(GPUAddress, "fill", 1, 1, screenWidth, screenHeight, " ")
-- Loading libraries -- Loading libraries
bit32 = bit32 or UIRequire("Bit32") bit32 = bit32 or UIRequire("Bit32")
@ -148,7 +149,7 @@ local image = UIRequire("Image")
local screen = UIRequire("Screen") local screen = UIRequire("Screen")
-- Setting currently chosen GPU component as screen buffer main one -- Setting currently chosen GPU component as screen buffer main one
screen.setGPUProxy(GPUProxy) screen.setGPUAddress(GPUAddress)
local GUI = UIRequire("GUI") local GUI = UIRequire("GUI")
local system = UIRequire("System") local system = UIRequire("System")
@ -187,20 +188,21 @@ event.addHandler(
event.addHandler( event.addHandler(
function(signalType, componentAddress, componentType) function(signalType, componentAddress, componentType)
if (signalType == "component_added" or signalType == "component_removed") and componentType == "screen" then if (signalType == "component_added" or signalType == "component_removed") and componentType == "screen" then
local GPUProxy = screen.getGPUProxy() local GPUAddress = screen.getGPUAddress()
local function bindScreen(address) local function bindScreen(address)
screen.bind(address, false) screen.setScreenAddress(address, false)
GPUProxy.setDepth(GPUProxy.maxDepth()) screen.setDepth(screen.getMaxDepth())
workspace:draw() workspace:draw()
end end
if signalType == "component_added" then if signalType == "component_added" then
if not GPUProxy.getScreen() then if not component.invoke(GPUAddress, "getScreen") then
bindScreen(componentAddress) bindScreen(componentAddress)
end end
else else
if not GPUProxy.getScreen() then if not component.invoke(GPUAddress, "getScreen") then
local address = component.list("screen")() local address = component.list("screen")()
if address then if address then