Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Pointers


  • Please log in to reply
2 replies to this topic

#1 loco

loco

    PortingTeam Founder

  • Administrators
  • 1186 posts
  • Graphics Card:NVIDIA GeForce 9400M
  • Operating System:macOS 10.12 (Sierra)

Posted 24 February 2011 - 09:22 AM

Could you provide a little documentation on how to find/use pointers etc?

Follow us on facebook:


#2 Zorg

Zorg

    Professional Member

  • Members
  • PipPipPipPip
  • 147 posts
  • LocationSpace
  • Graphics Card:I don't know.
  • Operating System:Other OS/Not specified
  • I like to play:Arcade, Side Scrollers

Posted 04 March 2011 - 09:32 PM

So, not all data in memory is static. Things may move around. This is kind of why pointers could be useful.

A pointer is a memory address. A pointer variable I suppose is a variable whose value is a memory address, which is pointing to some data in memory.

Say you have the address of a player's location in a game. All of a sudden, you notice that the address is no longer valid after you die and re-spawn (because the value no longer makes sense). There might be a pointer variable though that always holds the correct address of the player's location, which may frequently change.

I made this quick small test program that may help understanding the concept.

Search and find the counter variable in Bit Slicer. Use the increase counter button to change its value.
If you get more than one result, find which variable is the actual legit one and not a dummy one. This can easily be done by changing its value in Bit Slicer and hitting Increase Counter button to update the display. After this is done, delete the dummy variable from the table if there were any.

So the only thing in the table should be the counter variable right now. Un-tick the search box for it so we can start searching for the pointer. Copy the address from the counter variable that you just found, and put that into the search value field, and search with the data type set to 'Pointer'.

Now you have found the pointer variable. In the test program, hit the 'Change pointer' button. Notice the pointer variable's value changes, however, the original counter variable you've found is probably no longer valid.

We can fix this by telling the counter variable where to read from in a dynamic way. Copy the address from the pointer variable, then select the counter variable that we're going to fix, go under Tools->Edit Variable Address, and paste in the address and enclose it with square brackets (it should look something like [0x112F28B80]). In this case, this will tell Bit Slicer to read the pointer at the address enclosed by []'s, and will then read the 32-bit integer at that pointer.

If all goes well, the value should be the counter value. if you hit increase counter, the counter increase as you'd expect. Now if you hit change pointer, note that the memory address of the counter variable changes, and the value of the pointer variable changes, and that they are the same, and that the counter's value is now what you want it to be.

----
So this is a basic example. Often, there might be data that doesn't have pointers pointing to it directly, but by some kind of offset. For example, if 0x112F28B80 is a pointer to a player's x location, and I had to get the player's x location by doing [0x112F28B80] in Bit Slicer, there might be no pointer to the player's y location, so one would maybe have to get it by doing something like [0x112F28B80] + 0x4 (this is a good assumption by the way if each location variable is 4 bytes and if they are packed next to each other in some kind of structure, which is most likely the case).

#3 loco

loco

    PortingTeam Founder

  • Administrators
  • 1186 posts
  • Graphics Card:NVIDIA GeForce 9400M
  • Operating System:macOS 10.12 (Sierra)

Posted 10 March 2011 - 03:32 PM

ah I'm liking that pointer search function. Very useful... Thanks for the tips on pointers.

Every update you do to bit slicer, could you PM me the link to it when you do?

Follow us on facebook:





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users