Advertisement
Guest User

a-week-with-garfield.lua

a guest
Apr 1st, 2022
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. local types = {
  2.   [0] = "+5",
  3.   [1] = "Invinc.",
  4.   [2] = "Key",
  5.   [3] = "+2",
  6.   [4] = "Shoes",
  7.   [5] = "W3",
  8.   [6] = "W1",
  9.   [7] = "-2",
  10.   [9] = "W2"
  11. }
  12. emu.addEventCallback(function ()
  13.     local x = (emu.read(0x333, emu.memType.cpuDebug)*0x100) + ((emu.read(0x332, emu.memType.cpuDebug)-0x20)*8) + (emu.read(0x334, emu.memType.cpuDebug)%8)
  14.     if (x>=0) then
  15.         emu.drawRectangle(-1,33,(x/15)-2,5,0x50A0FF,0x50A0FF)
  16.         for i=0,63 do
  17.             local p = 0xB9e0+i*4
  18.             local px = (emu.read(p,emu.memType.cpuDebug)*16) + math.floor(emu.read(p+1, emu.memType.cpuDebug)/16)
  19.             local py = emu.read(p+1,emu.memType.cpuDebug)%16
  20.             local pt = emu.read(p+2,emu.memType.cpuDebug)
  21.             if (px>=256) then break end
  22.             emu.drawRectangle(px*16-x,py*16+40,15,25,0)
  23.             if (types[pt]) then
  24.                 emu.drawString(px*16-x+1,py*16+41,types[pt])
  25.             else
  26.                 emu.drawString(px*16-x+1,py*16+41,pt)
  27.             end
  28.         end
  29.     end
  30. end, emu.eventType.nmi)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement