nonogamer9

OCBIOS-Donut: donut.c for OpenComputers EEPROMS (Throw Your EEPROMS Away!)

Feb 8th, 2025
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.28 KB | Software | 0 0
  1. local component = require("component")
  2. local computer = require("computer")
  3. local eeprom = component.eeprom
  4.  
  5. local donutCode = [[
  6. local c = component
  7. local m = math
  8. local s = string
  9. local gpu = c.proxy(c.list("gpu")())
  10. local screen = c.list("screen")()
  11.  
  12. if gpu and screen then
  13.   gpu.bind(screen)
  14. else
  15.   error("GPU or screen not available")
  16. end
  17.  
  18. local w, h = gpu.getResolution()
  19. local sin, cos = m.sin, m.cos
  20.  
  21. local buffer1 = gpu.allocateBuffer(w, h)
  22. local buffer2 = gpu.allocateBuffer(w, h)
  23. local currentBuffer = buffer1
  24. local backBuffer = buffer2
  25.  
  26. local function swapBuffers()
  27.   gpu.setActiveBuffer(backBuffer)
  28.   local temp = currentBuffer
  29.   currentBuffer = backBuffer
  30.   backBuffer = temp
  31. end
  32.  
  33. local function cls()
  34.   gpu.fill(1, 1, w, h, " ")
  35. end
  36.  
  37. local function donut()
  38.   local A, B = 0, 0
  39.   local z, b = {}, {}
  40.   while true do
  41.     for i = 1, 1760 do b[i] = " " z[i] = 0 end
  42.     for j = 0, 6.28, 0.07 do
  43.       for i = 0, 6.28, 0.02 do
  44.         local sini, cosj = sin(i), cos(j)
  45.         local sinA, sinj, cosA = sin(A), sin(j), cos(A)
  46.         local cosj2 = cosj + 2
  47.         local mess = 1 / (sini * cosj2 * sinA + sinj * cosA + 5)
  48.         local cosi, cosB, sinB = cos(i), cos(B), sin(B)
  49.         local t = sini * cosj2 * cosA - sinj * sinA
  50.         local x = m.floor(40 + 30 * mess * (cosi * cosj2 * cosB - t * sinB))
  51.         local y = m.floor(12 + 15 * mess * (cosi * cosj2 * sinB + t * cosB))
  52.         local o = x + 80 * y
  53.         local N = m.floor(8 * ((sinj * sinA - sini * cosj * cosA) * cosB - sini * cosj * sinA - sinj * cosA - cosi * cosj * sinB))
  54.         if y > 0 and y < 22 and x > 0 and x < 80 and mess > z[o] then
  55.           z[o] = mess
  56.           b[o] = s.sub(".,-~:;=!*#$@", N > 0 and N or 1, N > 0 and N or 1)
  57.         end
  58.       end
  59.     end
  60.    
  61.     gpu.setActiveBuffer(backBuffer)
  62.     cls()
  63.     for k = 1, 1760 do
  64.       if k % 80 ~= 0 then gpu.set(k % 80, m.floor(k / 80), b[k]) end
  65.     end
  66.    
  67.     swapBuffers()
  68.     gpu.setActiveBuffer(0)
  69.     gpu.bitblt(0, 1, 1, w, h, currentBuffer, 1, 1)
  70.    
  71.     A = A + 0.08
  72.     B = B + 0.06
  73.     computer.pullSignal(0.01)
  74.   end
  75. end
  76.  
  77. donut()
  78. ]]
  79.  
  80. eeprom.set(donutCode)
  81. eeprom.setLabel("OCBIOS-Donut")
  82. computer.beep(1000, 0.2)
  83. print("OCBIOS-Donut injected into EEPROM. Rebooting...")
  84. computer.shutdown(true)
  85.  
Add Comment
Please, Sign In to add comment