Guest User

yoshi topsy turvy lua bizhawk 2.x

a guest
Nov 18th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.66 KB | None | 0 0
  1. local ScriptInfo = {"Yoshi's Universal Gravitation",
  2.                     "Lua script by Mugg1991",
  3.                     "v0.1",
  4.                     "18th Nov 2017",}
  5.  
  6. --[[ todo:
  7.     axis
  8.     address lists
  9.     find position addresses automatically?
  10.     flags
  11.     tilt by pressing key
  12.     enemies / objects
  13. ]]
  14.    
  15. local analog_sets = {}
  16. local keyboard = {}
  17. local offset = 0
  18. local offsetBefore = 0
  19. local xposBefore = 0
  20. local yposBefore = 0
  21.  
  22. local AddressTableGeneral= {
  23. [1] = {1,"X-Pos",0xFFFFE0A0,"IWRAM",0x4C1,2,true},
  24. [2] = {1,"Y-Pos",0xFFFFE0A0,"IWRAM",0x4C5,2,true},
  25. [3] = {1,"X-Sub",0xFFFFE0A0,"IWRAM",0x4C0,1,true},
  26. [4] = {1,"Y-Sub",0xFFFFE0A0,"IWRAM",0x4C4,1,true},
  27. [5] = {1,"X-Cam",0xFFFFE0A0,"IWRAM",0x1e00,2,true},
  28. [6] = {1,"Y-Cam",0xFFFFE0A0,"IWRAM",0x1e02,2,true},
  29. [7] = {1,"Level",0xFFFFE0A0,"IWRAM",0x3d9,1,true}
  30. }
  31.  
  32. local AddressTableDynamic= {
  33. [1] = {1,"X-Spd",0xFFFFE0A0,"EWRAM",0x0,4,true,true},
  34. [2] = {1,"Y-Spd",0xFFFFE0A0,"EWRAM",0x0,4,true,true},
  35. [3] = {1,"Angle",0xFFFFE0A0,"EWRAM",0x0,1,true}
  36. }
  37.  
  38. local Displays = {
  39.     -- Name, active, col, x, y, width, height, offset of list, edit mode, table, entries shown
  40.     [1]= {"General", false, 0xFFFFE0A0, 40, 40, 146, 56, 0, false, AddressTableGeneral,5},
  41.     [2]= {"Dynamic", false, 0xFFFFE0A0, 40, 40, 146, 40, 0, false, AddressTableDynamic,3},
  42.     [3]= {"show info", true, 0xFFC0C0C0, nil},
  43.     [4]= {"press E/R to Tilt", true, 0xFFC0C0C0, nil},
  44.     [5]= {"Framecount/Input",true,0xFFc0c0c0,nil}
  45. }
  46.  
  47. local Mouse = {
  48.     X               = 0,
  49.     Y               = 0,
  50.     XBefore         = 0,
  51.     YBefore         = 0,
  52.     clickedFrames   = 0,
  53.     clicked         = false
  54. }
  55.  
  56. local Color = {
  57.     Selected    = 0xB0A0A0A0,
  58.     Normal      = 0xA0303030,
  59.     Grey        = 0xA0C0C0C0
  60. }
  61.  
  62. function text(x, y, text, color, backcolor)
  63.     if backcolor==nil then backcolor=0x00000000 end
  64.     gui.drawText(x, y, text,color,backcolor,10,"Arial")
  65. end
  66.  
  67. function box(x,y,x2,y2)
  68.     gui.drawBox(x,y,x2,y2,0x00000000,0xD0000000)
  69. end
  70.  
  71. function boxNormal(x,y,x2,y2)
  72.     gui.drawBox(x,y,x2,y2,0xFF000000,0xA0000000)
  73. end
  74.  
  75. function boxSelected(x,y,x2,y2)
  76.     gui.drawBox(x,y,x2,y2,0xFF000000,0xA0505050)
  77. end
  78.  
  79. function arrowDown(xpos,ypos,col)
  80.     gui.drawLine(xpos,ypos,xpos+6,ypos,col)
  81.     gui.drawLine(xpos+1,ypos+1,xpos+5,ypos+1,col)
  82.     gui.drawLine(xpos+2,ypos+2,xpos+4,ypos+2,col)
  83.     gui.drawPixel(xpos+3,ypos+3,col)
  84. end
  85.  
  86. function arrowUp(xpos,ypos,col)
  87.     gui.drawLine(xpos,ypos,xpos+6,ypos,col)
  88.     gui.drawLine(xpos+1,ypos-1,xpos+5,ypos-1,col)
  89.     gui.drawLine(xpos+2,ypos-2,xpos+4,ypos-2,col)
  90.     gui.drawPixel(xpos+3,ypos-3,col)
  91. end
  92.  
  93. function drawDisplayBox(id,bordercolor,color)
  94.     posx=Displays[id][4]
  95.     posy=Displays[id][5]
  96.     width=Displays[id][6]
  97.     height=Displays[id][7]
  98.    
  99.     if Mouse.clicked then
  100.  
  101.         if Mouse.X > posx and Mouse.X < posx+width and Mouse.Y > posy and Mouse.Y < posy+height then
  102.  
  103.             if Mouse.clickedFrames > 0 then
  104.                 menuscreen=0 -- close menu
  105.                
  106.                 posy = posy + (Mouse.Y-Mouse.YBefore) -- enables mouse drag
  107.                 posx = posx + (Mouse.X-Mouse.XBefore)
  108.  
  109.                 if posy < 0 then posy=0 -- prevents display from going offscreen
  110.                 elseif posy > 159-height then posy=159-height end
  111.                 if posx < 0 then posx=0
  112.                 elseif posx > 239-width then posx=239-width end
  113.            
  114.                 Displays[id][4]=posx
  115.                 Displays[id][5]=posy
  116.             end
  117.         end
  118.     end
  119.     gui.drawBox(posx,posy,posx+width,posy+height,bordercolor,color)
  120.     text(posx+3,posy-1,Displays[id][1],0xFF808080)
  121. end
  122.        
  123. function drawCloseButton(id)
  124.     width=Displays[id][6]
  125.     x=Displays[id][4]
  126.     y=Displays[id][5]
  127.    
  128.     drawButton(x+width-10,y,10,10,"x",Color.Grey,15,function()
  129.         Displays[id][2] = false
  130.     end)
  131. end
  132.  
  133. function drawEditButton(id)
  134.  
  135.     width=Displays[id][6]
  136.     x=Displays[id][4]
  137.     y=Displays[id][5]
  138.     if Displays[id][9] then col=Color.Selected
  139.     else col=Color.Normal end
  140.    
  141.     drawButton(x+width-25,y,12,10,"e",col,15,function()
  142.         Displays[id][9]=not Displays[id][9]
  143.     end)
  144. end
  145.  
  146. function drawButton(posx,posy,width,height,label,color,frequency,clickedfunction)
  147.     if Mouse.X>posx and Mouse.X<posx+width and Mouse.Y>posy and Mouse.Y<posy+height then
  148.             if Mouse.clicked and Mouse.clickedFrames%frequency==1 then  
  149.                 clickedfunction()
  150.             end
  151.         gui.drawBox(posx,posy,posx+width,posy+height,color-0x00303030,color+0x30303030)
  152.     else
  153.         gui.drawBox(posx,posy,posx+width,posy+height,color-0x00303030,color)
  154.     end
  155.     text(posx+1,posy-2,label,0xFFFFFFFF)
  156. end
  157.  
  158. function drawMenuButton(posx,posy,width,height,label,z,drawindicator,indicator,col,clickedfunction)
  159.     if Mouse.X>posx and Mouse.X<posx+width and Mouse.Y>posy and Mouse.Y<posy+height then
  160.         if Mouse.clicked and Mouse.clickedFrames==z then
  161.             menuscreen=0
  162.             clickedfunction()
  163.         end
  164.         boxSelected(posx,posy,posx+width,posy+height)
  165.     else
  166.         boxNormal(posx,posy,posx+width,posy+height)
  167.     end
  168.     text(posx+2,posy-1,label,col)
  169.    
  170.     if drawindicator then
  171.         if indicator then text(posx+width-10,posy,"o",0xFF80FF80)
  172.         else text(posx+width-10,posy-1,"x",0xFFFF9090) end
  173.     end
  174. end
  175.  
  176. local getChangeAmount = function(valueChangeAmount)
  177.     if Mouse.clickedFrames>540 then
  178.         valueChangeAmount=valueChangeAmount*1000000
  179.     elseif Mouse.clickedFrames>450 then
  180.         valueChangeAmount=valueChangeAmount*100000
  181.     elseif Mouse.clickedFrames>360 then
  182.         valueChangeAmount=valueChangeAmount*10000
  183.     elseif Mouse.clickedFrames>270 then
  184.         valueChangeAmount=valueChangeAmount*1000
  185.     elseif Mouse.clickedFrames>180 then
  186.         valueChangeAmount=valueChangeAmount*100
  187.     elseif Mouse.clickedFrames>90 then
  188.         valueChangeAmount=valueChangeAmount*10
  189.     end
  190.     return valueChangeAmount
  191. end
  192.  
  193. local addressTableSetValue = function(address, addressSize, addressEndian, newvalue)
  194.  
  195.     if addressSize==1 then
  196.         memory.write_u8(address,newvalue)
  197.     elseif addressSize==2 then
  198.         if addressEndian then
  199.             memory.write_u16_le(address,newvalue)
  200.         else
  201.             memory.write_u16_be(address,newvalue)
  202.         end            
  203.     elseif addressSize==3 then
  204.         if addressEndian then
  205.             memory.write_u24_le(address,newvalue)
  206.         else
  207.             memory.write_u24_be(address,newvalue)
  208.         end
  209.     elseif addressSize==4 then
  210.         if addressEndian then
  211.             memory.write_u32_le(address,newvalue)
  212.         else
  213.             memory.write_u32_be(address,newvalue)
  214.         end
  215.     end
  216.    
  217. end
  218.  
  219. local addressTableGetValue = function(address, addressSize, addressEndian, addressSigned)
  220.  
  221.     if addressSigned then
  222.         if addressSize==1 then
  223.             value=memory.read_s8(address)
  224.         elseif addressSize==2 then
  225.             if addressEndian then
  226.                 value=memory.read_s16_le(address)
  227.             else
  228.                 value=memory.read_s16_be(address)
  229.             end            
  230.         elseif addressSize==3 then
  231.             if addressEndian then
  232.                 value=memory.read_s24_le(address)
  233.             else
  234.                 value=memory.read_s24_be(address)
  235.             end
  236.         elseif addressSize==4 then
  237.             if addressEndian then
  238.                 value=memory.read_s32_le(address)
  239.             else
  240.                 value=memory.read_s32_be(address)
  241.             end
  242.         end
  243.     else
  244.         if addressSize==1 then
  245.             value=memory.read_u8(address)
  246.         elseif addressSize==2 then
  247.             if addressEndian then
  248.                 value=memory.read_u16_le(address)
  249.             else
  250.                 value=memory.read_u16_be(address)
  251.             end            
  252.         elseif addressSize==3 then
  253.             if addressEndian then
  254.                 value=memory.read_u24_le(address)
  255.             else
  256.                 value=memory.read_u24_be(address)
  257.             end
  258.         elseif addressSize==4 then
  259.             if addressEndian then
  260.                 value=memory.read_u32_le(address)
  261.             else
  262.                 value=memory.read_u32_be(address)
  263.             end
  264.         end
  265.     end
  266.    
  267.     return value   
  268. end
  269.  
  270. local DisplayAddressTable = function(display_id, has_arrows,  has_buttons,  display_description,  description_offset,  arrows_offset,  buttons_offset)
  271.    
  272.     inputTable=Displays[display_id][10]
  273.     xpos=Displays[display_id][4]
  274.     ypos=Displays[display_id][5]
  275.     memorydomainBefore=memory.getcurrentmemorydomain()
  276.     tableSize=table.getn(inputTable)
  277.     table_start=1
  278.     table_end=Displays[display_id][11]
  279.     table_iterations = 1
  280.     offset=Displays[display_id][8]
  281.     list_height = 8*(table_end - table_start)+14
  282.  
  283.     --display arrows:
  284.     if has_arrows then
  285.         --bottom arrow button
  286.         if (tableSize - offset) > table_end then
  287.             if Mouse.X>xpos+arrows_offset and Mouse.X<xpos+arrows_offset+12 and Mouse.Y>ypos+list_height and Mouse.Y<ypos+list_height+6 then
  288.                 if Mouse.clicked and Mouse.clickedFrames%3==1 then
  289.                     Displays[display_id][8]=offset+1
  290.                 end
  291.                 arrowDown(xpos+arrows_offset+2,ypos+list_height,0xFFFFFFFF)
  292.             else
  293.                 arrowDown(xpos+arrows_offset+2,ypos+list_height,0xA0FFFFFF)
  294.             end
  295.         else
  296.             if offset < 0 then
  297.                 Displays[display_id][8]=0
  298.             end
  299.         end
  300.            
  301.         --top arrow button
  302.         if offset > 0 then
  303.             if Mouse.X>xpos+arrows_offset and Mouse.X<xpos+arrows_offset+12 and Mouse.Y>ypos+list_height-10 and Mouse.Y<ypos+list_height-4 then
  304.                 if Mouse.clicked and Mouse.clickedFrames%3==1 then
  305.                     Displays[display_id][8]=offset-1
  306.                 end
  307.                 arrowUp(xpos+arrows_offset+2,ypos+list_height-6,0xFFFFFFFF)
  308.             else
  309.                 arrowUp(xpos+arrows_offset+2,ypos+list_height-6,0xA0FFFFFF)
  310.             end
  311.         end
  312.     end
  313.     -- applying display offset
  314.     table_start = table_start + offset
  315.     table_end   = table_end + offset
  316.  
  317.     -- going through the table
  318.     for i=table_start,table_end do --show a part of the list
  319.  
  320.         contenttype=inputTable[i][1]
  321.         description=inputTable[i][2]
  322.         textColor=inputTable[i][3]
  323.         memorydomain=inputTable[i][4]
  324.        
  325.         if contenttype==0 then  -- TITLE
  326.                
  327.             gui.drawBox(5+xpos,4+ypos+table_iterations*8,arrows_offset+xpos,12+ypos+table_iterations*8,0x00000000,0xFF505050)
  328.    
  329.         elseif contenttype==7 then -- BINARY
  330.            
  331.             memory.usememorydomain(memorydomain)
  332.             address=inputTable[i][5]
  333.             currentbit=inputTable[i][6]
  334.             value=memory.read_u8(address)
  335.  
  336.             value=bit.check(value, currentbit)
  337.            
  338.             if value then
  339.                 value="Yes"
  340.                 valueColor=0xFF80FF80
  341.             else
  342.                 value="No"
  343.                 valueColor=0xFFFF9090
  344.             end
  345.            
  346.             text(5+xpos,3+ypos+table_iterations*8,value,valueColor)
  347.        
  348.         else    -- OTHER TYPES 
  349.             memory.usememorydomain(memorydomain)
  350.             address=inputTable[i][5]
  351.             addressSize=inputTable[i][6]
  352.             addressEndian=inputTable[i][7] -- true:little endian, false:big endian
  353.             addressSigned=inputTable[i][8]
  354.             valueChangeAmount=1                  
  355.             value = addressTableGetValue(address,addressSize,addressEndian, addressSigned)
  356.             text(5+xpos,3+ypos+table_iterations*8,value, textColor)
  357.         end
  358.        
  359.         if display_description then
  360.             text(xpos+description_offset,3+ypos+table_iterations*8,description, textColor)
  361.         end
  362.  
  363.         if has_buttons then
  364.            
  365.             if contenttype==7 then -- binary
  366.            
  367.                 drawButton(xpos+buttons_offset,4+ypos+table_iterations*8,21,8,"Set",Color.Normal,8,function()
  368.    
  369.                     currentvalue=memory.read_u8(address)
  370.  
  371.                     if bit.check(currentvalue,currentbit) then
  372.                         memory.write_u8(address, bit.clear(currentvalue,currentbit))
  373.                     else
  374.                         memory.write_u8(address, bit.set(currentvalue,currentbit)) 
  375.                     end
  376.                
  377.                 end)
  378.            
  379.             elseif contenttype~=0 then -- normal values
  380.            
  381.                 drawButton(xpos+buttons_offset,4+ypos+table_iterations*8,9,8,"-",Color.Normal,5,function()
  382.                     valueChangeAmount = getChangeAmount(valueChangeAmount) -- increases when holding mouse key 
  383.                     newvalue = value - valueChangeAmount
  384.                     addressTableSetValue(address,addressSize,addressEndian,newvalue)                   
  385.                 end)
  386.  
  387.                 drawButton(12+xpos+buttons_offset,4+ypos+table_iterations*8,9,8,"+",Color.Normal,5,function()
  388.                     valueChangeAmount = getChangeAmount(valueChangeAmount) -- increases when holding mouse key         
  389.                     newvalue = value + valueChangeAmount
  390.                     addressTableSetValue(address,addressSize,addressEndian,newvalue)               
  391.                 end)
  392.             end        
  393.         end
  394.         table_iterations=table_iterations+1
  395.     end
  396.     memory.usememorydomain(memorydomainBefore)
  397. end
  398.    
  399. local drawDisplay = function(id)
  400.     if Displays[id][4]~=nil then
  401.         drawDisplayBox(id, 0xFF202020,0xA0000000)
  402.         drawCloseButton(id)
  403.         drawEditButton(id)
  404.         if Displays[id][9] then
  405.             DisplayAddressTable(id,true,true,true,66,132,42)   
  406.         else
  407.             DisplayAddressTable(id,true,false,true,46,132,0)
  408.         end
  409.     end
  410. end
  411.  
  412. local Menu = {
  413.     [1] =       {   [0] = "Script",
  414.                     [1] = 1,
  415.                     [2] = 2,
  416.                     [3] = 3,
  417.                     [4] = 4,
  418.                     [5] = 5
  419.                 }
  420. }
  421.  
  422. local drawMenu = function()
  423.  
  424.     verticalOffset=0
  425.  
  426.     for a=1,table.getn(Menu),1 do
  427.         drawMenuButton(-38+a*45,7,40,11,Menu[a][0],2,false,true,0xFFFFFFFF,function()
  428.             menuscreen=a
  429.         end)   
  430.        
  431.         if menuscreen==a then
  432.            
  433.             for b=1,table.getn(Menu[a]),1 do
  434.            
  435.                 id              = Menu[a][b]
  436.                 title           = Displays[id][1]
  437.                 indicator       = Displays[id][2]
  438.                 col             = Displays[id][3]
  439.                
  440.                 drawMenuButton(7,22+verticalOffset*10,92,10,title,1,true,indicator,col,function()
  441.                     Displays[id][2] = not indicator
  442.                 end)           
  443.                
  444.                 verticalOffset=verticalOffset+1
  445.             end        
  446.         end
  447.     end
  448.    
  449.     if Mouse.clicked and Mouse.clickedFrames==1 then
  450.            menuscreen = 0
  451.     end
  452. end
  453.  
  454. menuscreen=0
  455. frames=0
  456. console.clear()
  457. for i=1,table.getn(ScriptInfo),1 do
  458.     print(ScriptInfo[i])
  459. end
  460.  
  461. local updateDynamicMemoryAddresses = function()
  462.  
  463.     memory.usememorydomain("Combined WRAM")
  464.     offset = memory.read_u16_le(0x404BC)
  465.     -- possible offsets: 0x404BC (used)      0x404DC      0x404F0
  466.    
  467.     if offset ~= offsetBefore then
  468.         --update list
  469.         AddressTableDynamic[1][5] = 0x30 + offset --xspd
  470.         AddressTableDynamic[2][5] = 0x34 + offset --yspd
  471.         AddressTableDynamic[3][5] = 0x1A + offset --angle
  472.     end
  473.     offsetBefore = offset
  474. end
  475.  
  476. local drawInfo = function()
  477.     memory.usememorydomain("IWRAM")
  478.     xpos = memory.read_u16_le(0x4C1)
  479.     ypos = memory.read_u16_le(0x4C5)
  480.     xcam = memory.read_u16_le(0x1e00)
  481.     ycam = memory.read_u16_le(0x1e02)
  482.     Xscreen = xpos - xcam
  483.     Yscreen = ypos - ycam
  484.     memory.usememorydomain("EWRAM")
  485.     angle = memory.read_u8(AddressTableDynamic[3][5])
  486.     Xspd = memory.read_s32_le(AddressTableDynamic[1][5])
  487.     Yspd = memory.read_s32_le(AddressTableDynamic[2][5])
  488.     AngleDegree = angle * 1.40625
  489.     RPD = 0.0174532925 -- radians per degree
  490.    
  491.     des1 = math.sin(AngleDegree*RPD)*-400 -- draw line yoshi to here
  492.     des2 = math.cos(-AngleDegree*RPD)*400
  493.     des3 = math.sin((AngleDegree+90)*RPD)*-400
  494.     des4 = math.cos(-(AngleDegree+90)*RPD)*400
  495.    
  496.     gui.drawLine(Xscreen,Yscreen,Xscreen+des1,Yscreen+des2,0xFFFFFFFF) -- below yoshi
  497.     gui.drawLine(Xscreen,Yscreen,Xscreen-des1,Yscreen-des2,0xFFFFFFFF) -- above yoshi
  498.     gui.drawLine(Xscreen,Yscreen,Xscreen+des3,Yscreen+des4,0xFFFFFFFF) -- left of yoshi
  499.     gui.drawLine(Xscreen,Yscreen,Xscreen-des3,Yscreen-des4,0xFFFFFFFF) -- right of yoshi
  500.  
  501.     --add subposition
  502.     memory.usememorydomain("IWRAM")
  503.     xpos = xpos + memory.read_u8(0x4C0)/256
  504.     ypos = ypos + memory.read_u8(0x4C4)/256
  505.    
  506.     --drawbox
  507.     gui.drawBox(58,-1,240,28,0xFF202020,0xA0000000)
  508.     text(62,8,"x",0xFFFFE0A0)
  509.     text(62,16,"y",0xFFFFE0A0)
  510.     text(76,-2,"pos        posdiff   vel      angle",0xFFFFE0A0)
  511.     text(76,8,string.sub(string.format("%.3f",xpos),0,-2),0xFFFFFFFF)
  512.     text(76,17,string.sub(string.format("%.3f",ypos),0,-2),0xFFFFFFFF)
  513.     text(118,8,string.sub(string.format("%.3f",xposBefore-xpos),0,-2),0xFFFFFFFF)
  514.     text(118,17,string.sub(string.format("%.3f",yposBefore-ypos),0,-2),0xFFFFFFFF)
  515.     text(156,8,Xspd,0xFFFFFFFF)
  516.     text(156,17,Yspd,0xFFFFFFFF)
  517.     text(188,8,angle,0xFFFFFFFF)
  518.     text(188,17,string.sub(string.format("%.3f",AngleDegree),0,-2),0xFFFFFFFF)
  519.     xposBefore=xpos
  520.     yposBefore=ypos
  521. end
  522.  
  523. local doTilt = function()
  524.     keyboard = input.get()
  525.     if keyboard.E then  
  526.         analog_sets["Tilt X"] = "-4000"
  527.     elseif keyboard.R then
  528.         analog_sets["Tilt X"] = "4000"
  529.     else
  530.         analog_sets["Tilt X"] = "0"
  531.     end
  532.     joypad.setanalog(analog_sets)
  533. end
  534.  
  535. local drawFramesAndInput = function()
  536.     x=0
  537.     y=0
  538.     if movie.mode()=="PLAY" then
  539.         text(x+8, y+30,emu.framecount().."/"..movie.length(),0xFFFFFFFF)
  540.     else
  541.         text(x+8, y+30,emu.framecount(),0xFFFFFFFF)
  542.     end
  543.        
  544.     text(x+8, y+38,emu.lagcount(),0xFFF08080)
  545.  
  546.     if emu.islagged() then
  547.         text(x+34, y+38,"*",0xFFF08080)
  548.     end
  549.    
  550.     local inputtable = {}
  551.    
  552.     if movie.mode()=="INACTIVE" then
  553.         inputtable = joypad.getimmediate()
  554.     elseif movie.mode()=="PLAY" or movie.mode()=="RECORD" then
  555.         inputtable = movie.getinput(emu.framecount()-1)
  556.     end
  557.    
  558.     local buttons = {["Up"]="^", ["Down"]="v", ["Left"]="<", ["Right"]=">", ["Select"]="s", ["Start"]="S", ["A"]="A", ["B"]="B", ["L"]="L", ["R"]="R"}
  559.     local s = ""
  560.     for k,v in pairs(inputtable) do
  561.         if v==true then
  562.             s=s..buttons[k]
  563.         end
  564.     end
  565.  
  566.     text(x+8,y+46,s,0xFFffffff)
  567. end
  568.  
  569.  
  570. while true do
  571.  
  572.     Mouse.X = input.getmouse().X
  573.     Mouse.Y = input.getmouse().Y
  574.     Mouse.clicked = input.getmouse().Left
  575.    
  576.     updateDynamicMemoryAddresses()
  577.     if Displays[3][2] then -- "info" is active
  578.         drawInfo()
  579.     end
  580.     if Displays[4][2] then -- "tilt" is active
  581.         doTilt()
  582.     end
  583.     if Displays[5][2] then -- "frames and input" is active
  584.         drawFramesAndInput()
  585.     end
  586.    
  587.     for i=1,table.getn(Displays) do -- all displays
  588.         if Displays[i][2] then
  589.             drawDisplay(i)
  590.         end
  591.     end
  592.        
  593.     drawMenu() -- menu
  594.  
  595.     Mouse.XBefore=Mouse.X
  596.     Mouse.YBefore=Mouse.Y
  597.     if Mouse.clicked then Mouse.clickedFrames = Mouse.clickedFrames + 1
  598.     else Mouse.clickedFrames = 0 end
  599.    
  600. --  if client.ispaused() then
  601. --      gui.DrawFinish()
  602. --      emu.yield()
  603. --  else
  604.         emu.frameadvance()
  605. --  end
  606.    
  607.     frames=frames+1
  608. end
Advertisement
Add Comment
Please, Sign In to add comment