When I first started with JPC-RR I used CheatEngine to look at values, but wondered how I could get those addresses CE found into a lua script JPC could understand. So I made a small tutorial with lots of pictures for newbs like me. If you have a better method please share it.
Ok so for this example I'm using D/Generation and CheatEngine. Any game will work but I'm not familiar with things other than CheatEngine. Your mem hacker of choice will work if it has the same capabilities.
First off we start the game and start CE. Attach CE to java.exe.
For this example I'm going to be using the Y position of the main char. I'm going to assume you know how to find stuff in CE or whatever. If not, what I did was start with an unknown value, ran down the screen a few pixels and scanned for an increased value, repeated that a few times, then ran up the screen and scanned for decreased values. Here's what I came up with after enough iterations.
54 hits? That's too many. Well, we know the game is running in mode 13 320x200 because we're old and bitter, so surely the Y position of the player can't be over 200. Let's clamp the scan to "smaller than 200".
(Jokes aside. if you can't eyeball the resolution a good thing to do is build or get a debug version of Dosbox and put an interrupt breakpoint on 10h, then look at Ralf Brown's interrupt list and sift through the calls to the VGA to determine what is happening. Thankfully 90% of DOS games are just straight mode 13 320x200. Also this is about a one screen game. If it's a scrolling game, use your intuition about how the value is stored of course).
8 hits. That's more like it. So double click the first value and change it. Hopefully this is the Y position of our character. If it is, the character should snap across the screen. If it's not, it will be one of the others.
Ok, it turns out it was the first value. Don't you love it when things just work out?
So... now we know where the player Y position is in the memory of the JPC-RR process running. How are we going to translate that to something practical? JPC doesn't see memory the same way that CheatEngine does. It has its own internal RAM.
Let's assume you installed JPC-RR to "C:\JPC-RR\". Open notepad and write
jpcrr.ram_dump("ram.dump", true)
print("Dumped")
and save it as "dump.lua" into "C:\JPC-RR\lua\". To be honest I don't remember why the "true" is there and I can't be bothered to read the docs. So just do it! Or don't and write "false" and see what happens. Live on the edge!
So the script is in the default location now, let's run it. JPC has a lua window you can't get rid of, so bring it up and type "dump.lua" into it and click run. If all goes well it should say "Dumped" in the window. If not make sure the script is where JPC wants it.
Now we have a binary dump of JPC's RAM called "ram.dump" inside the "JPC-RR\lua\" folder. There's no question that what we found in CheatEngine is inside that RAM dump, but how do we find it? Easy... maybe.
Go back to CheatEngine and rightclick on the address you determined the player Y position was. Select "Browse this memory region"
Hmm there's a lot of crap here. We need something unique that we can match up to the RAM dump. All those 00's won't do, so scroll up one row. Ah there's some unique characters! Select as many unique characters as you can *while still containing the value you are interested in* and copy them. In this example, the value we're interested in is the very last byte, 0x27. (of course you can select whatever you want as long as you know where your target byte lies in it and it's unique enough).
So now if all is well we have a string of hexadecimal characters copied to the clipboard, which is hopefully unique and not repeated elsewhere.
Open up the ram.dump file in your favourite hex editor and search for the hex string that you've got copied.
Great! Only 1 match in the entire file. We've established that this is the string in CheatEngine, and CE was looking at JPC-RR's memory albeit in a virtual space. So if we can see the same string in the dump of JPC's RAM, we're looking at it exactly how JPC sees it! Good stuff.
Since our target value was the byte on the end, the player's Y position, let's find out what that is. Put your cursor over it and find out that it's at offset 0x2B0D8. (This will be a diff address for you likely).
So the detective work is done! We know that JPC, internally, sees the player's Y position in its RAM as that very address. Let's confirm this.
Open notepad and write
ypos = jpcrr.read_byte(0x2B0D8)
print(ypos)
and save it as whatever you want as long as it's in the lua directory.
When you run it, it should print the Y position.
And that's that! It was a simple tutorial but hopefully it can help someone.