Advertisement
Guest User

Star Saver Lua

a guest
Sep 7th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. function round(num, idp)
  2.   local mult = 10^(idp or 0)
  3.   return math.floor(num * mult + 0.5) / mult
  4. end
  5.  
  6. function text(x, y, text, color, backcolor)
  7.     if backcolor==nil then backcolor=0x00000000 end
  8.     gui.drawText(x, y, text,color,backcolor,8,"SF Intermosaic B")
  9. end
  10.  
  11. while true do
  12. framecount = emu.framecount()
  13. calculated_lag = (framecount / 3)- ((framecount-100) % (emu.lagcount()+100))
  14.  
  15. gui.drawBox(52,18,156,34,0x80106060,0x80106060)
  16. gui.drawBox(130,36,156,43,0x80106060,0x80106060)
  17. text(54,17, "Emu " ..emu.lagcount())
  18. text(54,24, "Calc " ..round(calculated_lag,1))
  19. text(120,18,"x " .. memory.read_u8(0xc126)+memory.read_u8(0xc127)*256)
  20. text(120,25,"y " .. memory.read_u8(0xc12a)+memory.read_u8(0xc12b)*256)
  21. text(144,34, memory.read_u8(0xc142) %128 )
  22. --text(144,34, memory.read_u8(0xc170) %128 )
  23.  
  24. --wind pixels:
  25. --[[
  26. camcounter= memory.read_u8(0xC0BE)
  27. ycam = memory.read_u8(0xc0A4)
  28. xcam = memory.read_u8(0xc0A5) + 256*camcounter
  29. startAddress=0xc14f
  30. text(100,50, "xcam ".. xcam,0xFFFFFFFF,0x80000000)
  31. text(100,58, "ycam ".. ycam,0xFFFFFFFF,0x80000000)
  32. for i=0,9,1 do
  33.     increase=49
  34.     xpos=memory.read_u16_le((startAddress)+increase*i)
  35.     ypos=memory.read_u16_le(startAddress+4+increase*i)
  36.     posx=xpos-xcam
  37.     posy=ypos-ycam
  38.     gui.drawBox(posx,posy,posx+2,posy+2,0xFFFF0000)
  39. end
  40. --]]
  41.  
  42. emu.frameadvance()
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement