Advertisement
Guest User

yoshi topsy turvy lua bizhawk 2.x

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