Guest User

Untitled

a guest
Mar 27th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.67 KB | None | 0 0
  1. function text(x, y, text, color)
  2.     gui.pixelText(x, y, text,color,0x00000000)
  3. end
  4.  
  5. function box(x,y,x2,y2)
  6.     gui.drawBox(x,y,x2,y2,0xFF000000,0xA0000000)
  7. end
  8.  
  9. function img(path,x,y)
  10.     gui.drawImage(path,x,y)
  11. end
  12.  
  13. ----------------------------------------------------------------------
  14. local drawFrameCountAndInput = function(x,y)
  15.  
  16.     if movie.mode()=="PLAY" then
  17.         text(x, y,emu.framecount().."/"..movie.length(),0xFFFFFFFF)
  18.     else
  19.         text(x, y,emu.framecount(),0xFFFFFFFF)
  20.     end
  21.        
  22.     text(x, y+8,emu.lagcount(),0xFFF05050)
  23.  
  24.     if emu.islagged() then
  25.         text(x+25, y+8,"*",0xFFF05050)
  26.     end
  27.    
  28.     local inputtable = {}
  29.    
  30.     if movie.mode()=="INACTIVE" then
  31.         inputtable = joypad.getimmediate()
  32.     elseif movie.mode()=="PLAY" or movie.mode()=="RECORD" then
  33.         inputtable = movie.getinput(emu.framecount()-1)
  34.     end
  35.    
  36.     local buttons = {["Up"]="^", ["Down"]="v", ["Left"]="<", ["Right"]=">", ["Select"]="s", ["Start"]="S", ["A"]="A", ["B"]="B", ["L"]="L", ["R"]="R"}
  37.     local s = ""
  38.     for k,v in pairs(inputtable) do
  39.         if v==true then
  40.             s=s..buttons[k]
  41.         end
  42.     end
  43.     text(x+34,y+8,s,0xFFffffff)
  44.  
  45. end
  46.  
  47.  
  48.  
  49. client.SetGameExtraPadding(0,28,0,0)
  50.  
  51. event.onloadstate(function()
  52.     XspeedSame=0
  53. end)
  54.  
  55. addressTable={
  56. --   xpos ypos xspeed yspeed xcam ycam
  57. [-1]={-1,-1,-1,-1},
  58. [1]={0x040300,0x040304,0x04030c,0x040310,nil,nil}, --Level1
  59. [2]={0,0,0,0,0,0}, --Level 2
  60. [3]={0,0,0,0,0,0}, --Level 3
  61. [4]={0,0,0,0,0,0}, --Level 4
  62. [5]={0,0,0,0,0,0}, --Level 5
  63. [6]={0,0,0,0,0,0}, --Level 6
  64. [7]={0,0,0,0,0,0}, --Level 7
  65. [8]={0,0,0,0,0,0}, --Level 8
  66. [9]={0,0,0,0,0,0}, --Level 9
  67. [10]={0,0,0,0,0,0}, --Level 10
  68. [11]={0,0,0,0,0,0}, --Level 11
  69. [12]={0,0,0,0,0,0} -- Level 12 are there even so many levels idk
  70. }
  71.  
  72. valueTable={
  73. ["xpos"]=nil,
  74. ["ypos"]=nil,
  75. ["xspeed"]=nil,
  76. ["yspeed"]=nil,
  77. ["xcam"]=nil,
  78. ["ycam"]=nil
  79. }
  80.  
  81. valueNameTable={
  82. [1]="xpos",
  83. [2]="ypos",
  84. [3]="xspeed",
  85. [4]="yspeed",
  86. [5]="xcam",
  87. [6]="ycam"
  88. }
  89.  
  90. while true do
  91.  
  92. memory.usememorydomain("Combined WRAM")
  93. Level=memory.read_u8(0x009784)+1
  94. if Level <0 or Level > 10 then Level=-1 end
  95.  
  96. for i=1,6,1 do
  97.     if addressTable[Level][i]~=nil then
  98.         valueTable[valueNameTable[i]]=memory.read_s32_le(addressTable[Level][i])
  99.         col=0xFFA0A0A0
  100.     else
  101.         valueTable[valueNameTable[i]]="x"
  102.         col=0xFFFFA0A0
  103.     end
  104. end
  105.  
  106.  
  107. drawFrameCountAndInput(10,34)
  108.  
  109. if addressTable[Level][1]~=0 then
  110.     count=1
  111.     for i=1,3,1 do
  112.         for p=1,2,1 do
  113.             text(i*70-60,p*8+2,valueTable[valueNameTable[count]],0xffA0A0A0)
  114.             count=count+1
  115.         end
  116.     end
  117. elseif addressTable[Level][1]==-1 then
  118.     text(60,8,"not a valid address set",0xffA0A0A0)
  119. else
  120.     text(60,8,"sorry, but I guess you have\nsome address finding to do :)",0xffA0A0A0)
  121. end
  122.  
  123. emu.frameadvance()
  124.  
  125. end
Add Comment
Please, Sign In to add comment