Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Luascript for bizhawk 1.11.6
- -- by mugg1991
- -- Motocross Maniacs gb
- function text(x, y, text, color)
- gui.pixelText(x, y, text,color,0x00000000)
- end
- ----------------------------------------------------------------------
- local drawFrameCountAndInput = function(x,y)
- if movie.mode()=="PLAY" then
- text(x, y,emu.framecount().."/"..movie.length(),0xFFFFFFFF)
- else
- text(x, y,emu.framecount(),0xFFFFFFFF)
- end
- text(x, y+8,emu.lagcount(),0xFFF05050)
- if emu.islagged() then
- text(x-5, y+8,"*",0xFFF05050)
- end
- local inputtable = {}
- if movie.mode()=="INACTIVE" then
- inputtable = joypad.getimmediate()
- elseif movie.mode()=="PLAY" or movie.mode()=="RECORD" then
- inputtable = movie.getinput(emu.framecount()-1)
- end
- local buttons = {["Up"]="^", ["Down"]="v", ["Left"]="<", ["Right"]=">", ["Select"]="s", ["Start"]="S", ["A"]="A", ["B"]="B", ["L"]="L", ["R"]="R"}
- local s = ""
- for k,v in pairs(inputtable) do
- if v==true then
- s=s..buttons[k]
- end
- end
- text(x,y+16,s,0xFFffffff)
- end
- function hex(num)
- local dig = 2
- local hexstr = '0123456789ABCDEF'
- local s = ''
- --while num > 0 do
- while dig > 0 do -- use digit instead so there is padding
- local mod = math.fmod(num, 16)
- s = string.sub(hexstr, mod+1, mod+1) .. s
- num = math.floor(num / 16)
- dig = dig - 1
- end
- if s == '' then s = '0' end
- return s
- end
- client.SetGameExtraPadding(0,28,0,0)
- memory.usememorydomain("System Bus")
- itemTable = {
- [-1] = "?",
- [2] = "S",
- [3] = "T",
- [4] = "N",
- [5] = "R",
- [6] = "J",
- [7] = "Biker",
- }
- while true do
- --declare values:
- Minutes = memory.read_u8(0xc804)
- Seconds = memory.read_u8(0xc803)
- Milliseconds = memory.read_u8(0xc802)
- MinutesLeft = memory.read_u8(0xc882)
- SecondsLeft = memory.read_u8(0xc881)
- MillisecondsLeft = memory.read_u8(0xc880)
- Speed1 = memory.read_s8(0xc810) -- pixels to advance screen
- Speed2 = memory.read_u16_le(0xc38a)
- Nitros1 = memory.read_u8(0xc792)
- Nitros2 = memory.read_u8(0xc812)
- Indicator = memory.read_u8(0xc780)
- if Indicator==1 then Nitros=Nitros1 else Nitros=Nitros2 end
- X = memory.read_u16_le(0xe903)
- --Y = ?
- Xcam = memory.read_u24_le(0xc902)
- Ycam = memory.read_u16_le(0xc900)
- --display values:
- text(45,2,"Time",0x80FFFFFF)
- text(65,2,hex(Minutes)..":"..hex(Seconds).."."..hex(Milliseconds),0xFFFFFFFF)
- text(49,10,"Gas",0x80FFFFFF)
- text(65,10,hex(MinutesLeft)..":"..hex(SecondsLeft).."."..hex(MillisecondsLeft),0xFFFFFFFF)
- text(118,2,"Spd",0x80FFFFFF)
- text(134,2,Speed2,0xFFFFFFFF)
- text(118,10,"Ntr",0x80FFFFFF)
- text(134,10,Nitros,0xFFFFFFFF)
- text(118,18,"pos",0x80FFFFFF)
- text(134,18,X,0xFFFFFFFF)
- text(33,18,"cam",0x80FFFFFF)
- text(48,18,Xcam,0xFFFFFFFF)
- text(80,18,Ycam,0xFFFFFFFF)
- --display items:
- for i=0,64,4 do
- item_type = memory.read_u8(0xca00+i)
- if item_type < 2 or item_type > 7 then item_type=-1 end
- item_status = memory.read_u8(0xca01+i)
- item_x = memory.read_u8(0xca03+i)
- item_y = memory.read_u8(0xca02+i)
- item_xcam = item_x-Xcam/256
- item_ycam = item_y-Ycam/256+28
- if item_status~=0 or item_y~=0 then
- gui.drawBox(item_xcam,item_ycam,item_xcam+16,item_ycam+16,0x80FF0000,0xD0FFFFFF)
- text(item_xcam+1,item_ycam+1,itemTable[item_type],0xFF000000)
- text(item_xcam+1,item_ycam+8,item_status,0xFF000000)
- end
- end
- drawFrameCountAndInput(10,2)
- emu.frameadvance()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement