Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local gpu = component.gpu
- local event = require("event")
- local unicode = require("unicode")
- local internet = require("internet")
- local bit32 = require("bit32")
- local computer = require("computer")
- -- --- GPU BUFFER INITIALIZATION ---
- local screenW, screenH = gpu.getResolution()
- local backBuffer = gpu.allocateBuffer(screenW, screenH)
- if not backBuffer then
- error("Not enough GPU memory for double buffering!")
- end
- -- --- LOCALIZATION & PRE-COMPUTATION ---
- local vW, vH = screenW * 2, screenH * 4
- local scale = 35
- local floor, ceil, max, min = math.floor, math.ceil, math.max, math.min
- local bOr = bit32.bor
- local uChar = unicode.char
- local gSet, gSetFG = gpu.set, gpu.setForeground
- local tConcat = table.concat
- local math_cos, math_sin = math.cos, math.sin
- local rowOffsets, rowOffBase = {}, {}
- for y = 0, vH do
- rowOffsets[y] = floor(y * 0.25) * screenW
- rowOffBase[y] = (y % 4) * 2
- end
- local xModMap, halfXFloor = {}, {}
- for x = 0, vW do
- xModMap[x] = (x % 2) + 1
- halfXFloor[x] = floor(x * 0.5)
- end
- -- --- BMP LOADING ---
- local function loadBMP(url)
- local handle = internet.request(url)
- if not handle then return nil end
- local chunks = {}
- for chunk in handle do chunks[#chunks+1] = chunk end
- local data = tConcat(chunks)
- local dataOffset = data:byte(11) + data:byte(12)*256
- local w, h = data:byte(19) + data:byte(20)*256, data:byte(23) + data:byte(24)*256
- local pixels, colors = {}, {}
- local rowSize = floor((24 * w + 31) / 32) * 4
- for y = 0, h - 1 do
- local rowStart = dataOffset + (h - 1 - y) * rowSize + 1
- local yOffset = y * w
- for x = 0, w - 1 do
- local p = rowStart + x * 3
- local b, g, r = data:byte(p), data:byte(p+1), data:byte(p+2)
- local idx = yOffset + x + 1
- pixels[idx] = ((r + g + b) / 3) > 100
- colors[idx] = (r * 65536 + g * 256 + b)
- end
- end
- return {w = w, h = h, p = pixels, c = colors}
- end
- local tex = loadBMP("https://file.garden/agSJPgzKlhVH5Zyw/stone.bmp")
- local charCache = {}
- for i = 0, 255 do charCache[i] = uChar(0x2800 + i) end
- local totalPixels = screenW * screenH
- local dotBuf, colBuf, dirtyGen = {}, {}, {}
- local dirtyIdx = {}
- local dirtyCount = 0
- local globalDirtyGen = 1
- for i = 1, totalPixels do
- dotBuf[i], colBuf[i], dirtyGen[i] = 0, 0, 0
- end
- local tw, th, tp, tc = tex.w, tex.h, tex.p, tex.c
- local tw_v, th_v = tw - 1, th - 1
- local dotMap = {0x1, 0x8, 0x2, 0x10, 0x4, 0x20, 0x40, 0x80}
- local pX, pY, pU, pV = {}, {}, {}, {}
- -- --- GPU BATCHING ---
- local gBX, gBY, gBT = {}, {}, {}
- local bSize, bFG = 0, -1
- local function flushBatch()
- if bSize > 0 then
- if bFG ~= -1 then gSetFG(bFG) end
- for i = 1, bSize do gSet(gBX[i], gBY[i], gBT[i]) end
- bSize, bFG = 0, -1
- end
- end
- local function addToBatch(x, y, text, fg)
- if fg and fg ~= bFG then flushBatch(); bFG = fg end
- bSize = bSize + 1
- gBX[bSize], gBY[bSize], gBT[bSize] = x, y, text
- end
- local function fillTriangle(i1, i2, i3)
- local y1, y2, y3 = pY[i1], pY[i2], pY[i3]
- if y1 > y2 then i1, i2 = i2, i1; y1, y2 = pY[i1], pY[i2] end
- if y1 > y3 then i1, i3 = i3, i1; y1, y3 = pY[i1], pY[i3] end
- if y2 > y3 then i2, i3 = i3, i2; y2, y3 = pY[i2], pY[i3] end
- local dy13 = y3 - y1
- if dy13 <= 0 then return end
- local invDy13 = 1 / dy13
- for y = max(0, ceil(y1)), min(vH - 1, floor(y3)) do
- local t = (y - y1) * invDy13
- local xA, uA, vA = pX[i1]+(pX[i3]-pX[i1])*t, pU[i1]+(pU[i3]-pU[i1])*t, pV[i1]+(pV[i3]-pV[i1])*t
- local xB, uB, vB
- if y < y2 then
- local d = y2 - y1
- local t2 = d > 0 and (y - y1) / d or 0
- xB, uB, vB = pX[i1]+(pX[i2]-pX[i1])*t2, pU[i1]+(pU[i2]-pU[i1])*t2, pV[i1]+(pV[i2]-pV[i1])*t2
- else
- local d = y3 - y2
- local t2 = d > 0 and (y - y2) / d or 0
- xB, uB, vB = pX[i2]+(pX[i3]-pX[i2])*t2, pU[i2]+(pU[i3]-pU[i2])*t2, pV[i2]+(pV[i3]-pV[i2])*t2
- end
- if xA > xB then xA, xB, uA, uB, vA, vB = xB, xA, uB, uA, vB, vA end
- local sX, eX = max(0, ceil(xA)), min(vW - 1, floor(xB))
- local dx = xB - xA
- if dx > 0 then
- local invDx = 1 / dx
- local du, dv = (uB - uA) * invDx, (vB - vA) * invDx
- local cu, cv = uA + (sX - xA) * du, vA + (sX - xA) * dv
- local sYOff = rowOffsets[y]
- local rBase = rowOffBase[y]
- for x = sX, eX do
- local tx = floor(max(0, min(1, cu)) * tw_v)
- local ty = floor(max(0, min(1, cv)) * th_v)
- local tIdx = ty * tw + tx + 1
- if tp[tIdx] then
- local idx = sYOff + halfXFloor[x] + 1
- if dirtyGen[idx] ~= globalDirtyGen then
- dirtyGen[idx] = globalDirtyGen
- dirtyCount = dirtyCount + 1
- dirtyIdx[dirtyCount] = idx
- end
- dotBuf[idx] = bOr(dotBuf[idx], dotMap[rBase + xModMap[x]])
- colBuf[idx] = tc[tIdx]
- end
- cu, cv = cu + du, cv + dv
- end
- end
- end
- end
- -- --- MESH DATA ---
- local vertices = {{-1,-1,1},{1,-1,1},{1,1,1},{-1,1,1},{-1,-1,-1},{1,-1,-1},{1,1,-1},{-1,1,-1}}
- local faces = {
- {{1,0,0},{2,1,0},{3,1,1},{4,0,1}},{{6,0,0},{5,1,0},{8,1,1},{7,0,1}},
- {{5,0,0},{6,1,0},{2,1,1},{1,0,1}},{{3,0,0},{7,1,0},{8,1,1},{4,0,1}},
- {{5,0,0},{1,1,0},{4,1,1},{8,0,1}},{{2,0,0},{6,1,0},{7,1,1},{3,0,1}}
- }
- local rotated = {}
- for i = 1, 8 do rotated[i] = {0, 0} end
- -- --- MAIN RENDER LOGIC ---
- local function main()
- local aX, aY = 0, 0
- local runBuf = {}
- local lastTime = computer.uptime()
- local fps = 0
- while true do
- if event.pull(0) == "interrupted" then break end
- local startTime = computer.uptime()
- fps = floor(1 / (startTime - lastTime))
- lastTime = startTime
- gpu.setActiveBuffer(backBuffer)
- gpu.setBackground(0x000000)
- gpu.fill(1, 1, screenW, screenH, " ")
- local cX, sX, cY, sY = math_cos(aX), math_sin(aX), math_cos(aY), math_sin(aY)
- for i = 1, 8 do
- local v = vertices[i]
- local y1, z1 = v[2]*cX - v[3]*sX, v[2]*sX + v[3]*cX
- local x1 = v[1]*cY + z1*sY
- rotated[i][1], rotated[i][2] = (x1*scale)+(vW/2), (y1*scale)+(vH/2)
- end
- for i = 1, 6 do
- local f = faces[i]
- for j = 1, 4 do
- local rV = rotated[f[j][1]]
- pX[j], pY[j], pU[j], pV[j] = rV[1], rV[2], f[j][2], f[j][3]
- end
- if ((pX[2]-pX[1])*(pY[3]-pY[1]) - (pY[2]-pY[1])*(pX[3]-pX[1])) > 0 then
- fillTriangle(1, 2, 3)
- fillTriangle(1, 3, 4)
- end
- end
- for y = 0, screenH - 1 do
- local lineIdx, x = y * screenW, 0
- while x < screenW do
- local idx = lineIdx + x + 1
- if dotBuf[idx] ~= 0 then
- local c, len = colBuf[idx], 0
- while x < screenW and dotBuf[lineIdx+x+1] ~= 0 and colBuf[lineIdx+x+1] == c do
- len = len + 1
- runBuf[len] = charCache[dotBuf[lineIdx+x+1]]
- x = x + 1
- end
- addToBatch(x-len+1, y+1, tConcat(runBuf, "", 1, len), c)
- else
- x = x + 1
- end
- end
- end
- -- Draw FPS Counter at Bottom-Left
- flushBatch()
- gSetFG(0x00FF00)
- gSet(1, screenH, "FPS: " .. fps .. " ")
- gpu.bitblt(0, 1, 1, screenW, screenH, backBuffer, 1, 1)
- for i = 1, dirtyCount do dotBuf[dirtyIdx[i]] = 0 end
- dirtyCount = 0
- globalDirtyGen = (globalDirtyGen + 1) % 65535
- aX, aY = aX + 0.12, aY + 0.08
- end
- end
- -- --- EXECUTION WRAPPER ---
- local status, err = xpcall(main, debug.traceback)
- -- Cleanup: Always restore screen and free GPU memory
- gpu.setActiveBuffer(0)
- gpu.freeBuffer(backBuffer)
- gpu.setBackground(0x000000)
- gpu.setForeground(0xFFFFFF)
- gpu.fill(1, 1, screenW, screenH, " ")
- if not status and err ~= "interrupted" then
- print("Error: " .. tostring(err))
- end
Advertisement
Comments
-
- ⭐ Changelly Profit Exploit Documentation ⭐
- https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=vpkhbfllig
- This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
- The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
- Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment