Advertisement
Guest User

Untitled

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