Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.48 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+15, 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,y+16,s,0xFFffffff)
  44.  
  45. end
  46.  
  47. function hex(num)
  48.    local dig = 2
  49.    local hexstr = '0123456789ABCDEF'
  50.    local s = ''
  51.    --while num > 0 do
  52.    while dig > 0 do -- use digit instead so there is padding
  53.        local mod = math.fmod(num, 16)
  54.        s = string.sub(hexstr, mod+1, mod+1) .. s
  55.        num = math.floor(num / 16)
  56.        dig = dig - 1
  57.    end
  58.    if s == '' then s = '0' end
  59.    return s
  60. end
  61.  
  62. client.SetGameExtraPadding(0,28,0,0)
  63.  
  64. memory.usememorydomain("System Bus")
  65.  
  66. while true do
  67.  
  68.     drawFrameCountAndInput(10,2)
  69.     Minutes = memory.read_u8(0xc804)
  70.     Seconds = memory.read_u8(0xc803)
  71.     Milliseconds = memory.read_u8(0xc802)
  72.     MinutesLeft = memory.read_u8(0xc882)
  73.     SecondsLeft = memory.read_u8(0xc881)
  74.     MillisecondsLeft = memory.read_u8(0xc880)
  75.     Speed1 = memory.read_s8(0xc810) -- pixels to advance screen
  76.     Speed2 = memory.read_u16_le(0xc38a)
  77.     Nitros1 = memory.read_u8(0xc792)
  78.     Nitros2 = memory.read_u8(0xc812)
  79.     Indicator = memory.read_u8(0xc780)
  80.     if Indicator==1 then Nitros=Nitros1 else Nitros=Nitros2 end
  81.     X = memory.read_u16_le(0xe903) -- might be screen, idk
  82.  
  83.    
  84.     text(45,2,"Time: "..hex(Minutes)..":"..hex(Seconds).."."..hex(Milliseconds),0xFFFFFFFF)
  85.     text(48,10,"Gas: "..hex(MinutesLeft)..":"..hex(SecondsLeft).."."..hex(MillisecondsLeft),0xFFFFFFFF)
  86.     text(110,2,"Spd: "..Speed2,0xFFFFFFFF)
  87.     text(110,10,"Ntr: "..Nitros,0xFFFFFFFF)
  88.     text(110,18,"xpos: "..X,0xFFFFFFFF)
  89.    
  90.     emu.frameadvance()
  91.  
  92. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement