Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RNG24 = {}
- local RNG26 = {}
- local RNG = {}
- local bit = 0
- local RNGoffset = -70
- local RNGend = 14592
- local RNGpos = -70
- RNG24[RNGoffset] = 4660
- RNG26[RNGoffset] = 120
- RNG[RNGoffset] = 134
- for i=RNGoffset+1,RNGend do
- RNG24[i] = math.floor((RNG24[i-1]+bit)/2)+32768*math.fmod(RNG24[i-1]+bit,2)
- RNG26[i] = math.fmod(RNG26[i-1]+109, 256)
- RNG[i] = math.fmod(math.floor(math.fmod(RNG24[i],256)*RNG26[i]/16),256)
- bit = math.fmod(math.floor(math.fmod(RNG24[i],256)*RNG26[i]/4),4)
- end
- function search_RNGpos()
- local cur24 = memory.readword(0x7E0024)
- local cur26 = memory.readbyte(0x7E0026)
- RNGpos = RNGoffset
- for i=RNGoffset, 256 do
- if(RNG26[i]==cur26) then
- for j=i, RNGend, 256 do
- if(RNG24[j]==cur24) then
- RNGpos = j
- break
- end
- end
- break
- end
- end
- end
- function draw_RNGgraph(x,y,width,height)
- gui.box(x,y,x+width,y+height,"#FFFFFF50")
- gui.line(x+36,y+height+2,x+36,y-2,"#FFFFFF")
- gui.text(210,216,string.format("%5d/%5d",RNGpos,RNGend))
- gui.text(2,172,string.format("RNG: %3d",RNG[RNGpos]))
- for i=0,width do
- local color = "#00FF2080"
- local curRNG = RNG[(RNGpos+i)%14592]
- if curRNG==0 then
- color = "#FF1010FF" -- 1/128 Item Drop
- curRNG=256
- elseif curRNG==128 then
- color = "#FFFF30FF" -- 1/128 Item Drop
- elseif curRNG==255 then
- color = "#0080FFFF" -- MAX
- curRNG=256
- elseif curRNG<=12 then
- color = "#FF5050FF" -- SMAAAASH!!
- elseif curRNG>184 then
- color = "#0030FF90" -- No enemies
- end
- gui.line(x+i,y+height,x+i,y+height-math.floor(curRNG/256*height),color)
- end
- end
- function watch_pos()
- local x,y = 150,146
- local xadr = 0x7E9B26 -- MOTHER 2
- -- local xadr = 0x7E9875 -- EARTH BOUND
- gui.text(x,y,
- string.format("X-Pos: %5d \n",memory.readword(xadr+2))..
- string.format("X-Sub: %5d \n",memory.readword(xadr-0))..
- string.format("Y-Pos: %5d \n",memory.readword(xadr+6))..
- string.format("Y-Sub: %5d \n",memory.readword(xadr+4))
- )
- color = "#00ff80"
- gui.text(208, 146, "No use", color)
- color = "#FF5050FF"
- gui.text(208, 154, "SMAAAASH!!", color)
- color = "#0080FFFF"
- gui.text(208, 162, "No enemies", color)
- color = "#FFFF30FF"
- gui.text(208, 170, "1/128 Item", color)
- m = memory.readwordsigned(0x7E9AE2)
- gui.text(2,144,"Money: "..m)
- atm = memory.readwordsigned(0x7E9AE6)
- gui.text(2,151,"ATM: "..atm)
- ss = memory.readwordsigned(0x7E9AE6)
- gui.text(2,158,"Skip S.: "..ss)
- dr = memory.readwordsigned(0x7EABE5)
- gui.text(2,165,"Drop : "..dr)
- gui.text(66,163,"EnemyHP: "..memory.readword(0x7EA431), color)
- gui.text(66,170,"Ness HP: "..memory.readword(0x7E9CC5), color)
- gui.text(2,216,emu.framecount())
- end
- emu.registerbefore(search_RNGpos)
- gui.register(function()
- draw_RNGgraph(0,182,255,32)
- watch_pos()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement