Advertisement
Kirkq

SMRPG Updated Basher

Mar 19th, 2017
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.76 KB | None | 0 0
  1. --Note: You need MemDumpRNGsFULL.txt
  2.  
  3. local posy=7
  4.  
  5. local Array ={}
  6. local Array2 = {}
  7. local thing
  8. local tempthing
  9. local i
  10. globalRNGtoset = 0
  11. globalLockRNG = false
  12.  
  13. function smvinfo()
  14. local hours = math.floor(movie.framecount()/216000)
  15. local minutes = math.floor((movie.framecount() - hours*216000)/3600)
  16. local seconds = math.floor((movie.framecount() - hours*216000 - minutes*3600)/60)
  17. local frames = movie.framecount() - hours*216000 - minutes*3600 - seconds*60
  18.  
  19. if movie.playing () == true then
  20. gui.text(1,1,string.format("frames:%d/%d (%d:%d:%d.%d)\nlags:%d\nrerecords:%d",movie.framecount(), movie.length(),hours,minutes,seconds,frames,emu.lagcount(), movie.rerecordcount ()))
  21. elseif movie.recording() == true then
  22. gui.text(1,1,string.format("frames:%d (%d:%d:%d.%d)\nlags:%d\nrerecords:%d",movie.framecount(),hours,minutes,seconds,frames,emu.lagcount(), movie.rerecordcount ()))
  23. else
  24. gui.text(1,1,string.format("frames:%d (%d:%d:%d.%d,no movie)\nlags:%d",emu.framecount(),hours,minutes,seconds,frames,emu.lagcount()))
  25. end
  26. end
  27.  
  28. function draw()
  29. -- enemy HPs
  30. local e1=memory.readword(0x7EFC11)
  31. local e2=memory.readword(0x7EFC91)
  32. local e3=memory.readword(0x7EFD11)
  33. local e4=memory.readword(0x7EFD91)
  34. local e5=memory.readword(0x7EFE11)
  35. local e6=memory.readword(0x7EFE91)
  36. --party HPs
  37. local p1=memory.readword(0x7EFA91)
  38. local p2=memory.readword(0x7EFB11)
  39. local p3=memory.readword(0x7EFB91)
  40. --position in field
  41. local x=memory.readword(0x702002)
  42. local y=memory.readword(0x702000)
  43. local z=memory.readword(0x702004)
  44. --other infomation
  45. local coin=memory.readword(0x7FF8AF)
  46. local fcoin=memory.readbyte(0x7FF8B3)
  47. local fp=memory.readbyte(0x7EFA0C)
  48. local mfp=memory.readbyte(0x7EFA0D)
  49. local ffp=memory.readbyte(0x7FF8B1) -- Field FP
  50. local fmfp=memory.readbyte(0x7FF8B2) --Fielf maxFP
  51. local jump=memory.readbyte(0x7EE010) -- Jump power
  52. local firec=memory.readbyte(0x702D6C) -- number of fbs you did
  53. local firet=memory.readbyte(0x702D6D)
  54. local damage=memory.readword(0x7E00C2)
  55. local field=memory.readbyte(0x7E000A)
  56. local field2=memory.readbyte(0x7E01D8)
  57. --charactar exps
  58. local mexp=memory.readword(0x7FF80A)
  59. local mexp2=memory.readword(0x7FF85A)
  60. local gexp=memory.readword(0x7FF846)
  61. local bexp=memory.readword(0x7FF832)
  62. local pexp=memory.readword(0x7FF81E)
  63. --charactar LVs and future exp in battle
  64. local mlv=memory.readbyte(0x7FF800)
  65. local mlv2=memory.readbyte(0x7FF850)
  66. local glv=memory.readbyte(0x7FF83C)
  67. local blv=memory.readbyte(0x7FF828)
  68. local plv=memory.readbyte(0x7FF814)
  69. local gaexp=memory.readword(0x7EFA02)
  70. --charactar accessory
  71. local mac=memory.readbyte(0x7FF80E)
  72. local mac2=memory.readbyte(0x7FF85E)
  73. local gac=memory.readbyte(0x7FF84A)
  74. local bac=memory.readbyte(0x7FF836)
  75. local pac=memory.readbyte(0x7FF822)
  76.  
  77.  
  78. if e2 == 21845 then
  79. e2 = 0
  80. end
  81. if e3 == 21845 then
  82. e3 = 0
  83. end
  84. if e4 == 21845 then
  85. e4 = 0
  86. end
  87. if e5 == 21845 then
  88. e5 = 0
  89. end
  90. if e6 == 21845 then
  91. e6 = 0
  92. end
  93.  
  94. if p2 == 21845 then
  95. p2 = 0
  96. end
  97.  
  98. if p3 == 21845 then
  99. p3 = 0
  100. end
  101.  
  102. if firec > 100 or firet > 100 then
  103. firec,firet = 0,0
  104. end
  105.  
  106. if damage > 9000 then
  107. damage=0
  108. end
  109.  
  110. --who equips Exp. Booster
  111. if mac==80 and field == 6 or mac==80 and field ==2 and field2 == 2 then
  112. gui.text(172,9,"*")
  113. elseif pac==80 and field == 6 or pac==80 and field ==2 and field2 == 2 then
  114. gui.text(172,41,"*")
  115. elseif mac2==80 and field == 6 or mac2==80 and field ==2 and field2 == 2 then
  116. gui.text(172,17,"*")
  117. elseif gac==80 and field == 6 or gac==80 and field ==2 and field2 == 2 then
  118. gui.text(172,25,"*")
  119. elseif bac==80 and field == 6 or bac==80 and field ==2 and field2 == 2 then
  120. gui.text(172,33,"*")
  121. end
  122.  
  123. if field == 2 then
  124. gui.text(1,1*posy*4,string.format("x:%d\ny:%d\nz:%d",x,y,z))
  125. gui.text(1,1*posy*8,string.format("coin:%d\nfrog:%d\nfp:%d/%d",coin,fcoin,ffp,fmfp))
  126. if field2 == 2 then
  127. gui.text(180,1,"---exp(lv)---")
  128. gui.text(180,9,string.format("Mario : %d(%d) \nMallow : %d(%d)\n Geno : %d(%d)\nBowser : %d(%d)\nPeach : %d(%d)",mexp,mlv,mexp2,mlv2,gexp,glv,bexp,blv,pexp,plv))
  129. end
  130.  
  131. elseif field == 6 then
  132. gui.text(1,posy*4,"-enemy")
  133. gui.text(1,1+posy*5,string.format("e1:%d\ne2:%d\ne3:%d\ne4:%d\ne5:%d\ne6:%d",e1,e2,e3,e4,e5,e6))
  134. gui.text(1,posy*13,"-party")
  135. gui.text(1,1+posy*14,string.format("p1:%d\np2:%d\np3:%d",p1,p2,p3))
  136. gui.text(1,posy*18,"-misc")
  137. gui.text(1,1+posy*19,string.format("FP:%d/%d\njump:%d",fp,mfp,jump))
  138. gui.text(1,1+posy*22,string.format("FBcount:%d\nFBtimer:%d\ndmg:%d",firec,firet,damage))
  139. gui.text(180,1,"---exp(lv)---")
  140. gui.text(180,9,string.format("Mario : %d(%d) \nMallow : %d(%d)\n Geno : %d(%d)\nBowser : %d(%d)\nPeach : %d(%d)\nexpgain: %d",mexp,mlv,mexp2,mlv2,gexp,glv,bexp,blv,pexp,plv,gaexp))
  141. end
  142. end
  143.  
  144. function initRNGs()
  145. i=0
  146. for line in io.lines("MemDumpRNGsFULL.txt") do
  147. Array[i]=line
  148. i=i+1
  149. end
  150.  
  151. i=0
  152. while i < 65536 do
  153. temp = Array[i]
  154. Array2[temp + 0] = i
  155. i = i+1
  156. end
  157. end
  158.  
  159. function RNGHook()
  160. if globalLockRNG == true then
  161. if memory.readword(0x00302E)~=globalRNGtoset then
  162. memory.writeword(0x00302E,globalRNGtoset)
  163. end
  164. end
  165. end
  166.  
  167. function TestFreebies()
  168. local tempstate = {}
  169. local dumpfile = "FreebieDump.txt"
  170. io.output(dumpfile)
  171. value = 0
  172. tempstate[value] = savestate.create()
  173. savestate.save(tempstate[value])
  174. iterations = 0
  175. emu.speedmode("maximum")
  176.  
  177. while iterations < 65536 do -----------------------------------------
  178. globalRNGtoset = iterations
  179. savestate.load(tempstate[value])
  180. --joypad.set(1,{["X"]=true})
  181. joypad.set(1,{["B"]=true})
  182. emu.frameadvance()
  183.  
  184. for j = 1,32 do --was 680 for rock candy, 400 for punch originally
  185. emu.frameadvance()
  186. end --for
  187. --temp = memory.readbyte(0x7E0B7A) -- or possibly 7E0700
  188. --temp = memory.readbyte(0x704070) -- or possibly 7E0700
  189. temp = memory.readbyte(0x702586) -- or possibly 7E0700
  190. io.write(globalRNGtoset .. " " .. temp, "\n")
  191. iterations = iterations + 1
  192.  
  193. end -- while
  194. io.output():close()
  195. emu.speedmode("normal")
  196. emu.pause()
  197. end --function
  198.  
  199. initRNGs()
  200. memory.registerwrite(0x00302E, RNGHook) --Register function to occur on game's write to address
  201.  
  202. ----------------------------
  203. --MODIFY THIS PART--
  204. ----------------------------
  205. --globalLockRNG = true
  206. --globalRNGtoset = 12
  207. --TestFreebies()
  208. --
  209. ---------------------------
  210. ---------------------------
  211.  
  212. while true do
  213. smvinfo()
  214. draw()
  215.  
  216. tempthing = memory.readword(0x00302E)
  217. gui.text(100,80, "RNG Increment Number: " .. Array2[tempthing])
  218. gui.text(100,90, "Actual RNG: " .. tempthing)
  219. tempthing = memory.readbyte(0x704070)
  220. tempthing = memory.readbyte(0x702586)
  221. gui.text(100,100, "Test: " .. tempthing)
  222.  
  223. emu.frameadvance()
  224. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement