Active player (378)
Joined: 9/25/2011
Posts: 652
Hi all, Here are the lua scripts I use for searching and watching memory in JPC-rr:
    1) searchmemory.lua Use this script to search for a particular value in memory. On the first run, it'll run through 2 million memory addresses searching for your value and spit out a file with all the addresses. If you want to narrow your search, do something that changes the value you're looking for in the game and then run the search again, setting the first output file as the input file, and specify a different name for the output file. Note: Don't use the value zero for your first search. I've warned you. :) 2)searchdiffmemory.lua Same as the above, except instead of searching for a specific value, it searches for values that have changed, or values that have stayed the same. First run will always dump all 2 million values, and you'll need to use that output as your input file to do a comparison. 3)stringsearchmemory.lua Use this to search for strings of characters in memory. Outputs the memory address for the start of the string. 4)printmemory.lua Watches values of memory addresses and prints them in the lua window whenever they change. You need to at least move one frame for it to print, but it will keep watching as long as the script is running. 5)printmemoryonce.lua Same as the above, but only prints once and then ends. Doesn't need a frame advance.
Also, FYI, if you ever want to poke a value, create a lua script with one of the following lines:
jpcrr.write_byte(memAddr,value) -- for values up to 255
or
jpcrr.write_word(memAddr,value) -- for values > 255
where memAddr is the address you want to poke to and value is the value you want to poke.
Reviewer, Expert player (2438)
Joined: 5/21/2013
Posts: 414
Good idea. Here's a simple memory poker so you don't have to keep changing the numbers in the script: http://tasvideos.org/userfiles/info/45915235912113848 Just type "write x y" into the console, where x is the address you want to change and y is its new value (bytes only, although this can easily be modified). Feel free to frankenstein this into any script to add memory writing capabilities.