3

I've played with using software like cheat engine to modify memory, null out code and even inject some code of my own. However finding the right spot to modify is always a difficulty. I'd like to be able to identify the code that is run when I click my mouse on an object (eventually to simulate the entire process). Is there a tool or method for doing this that anyone could suggest?

I've used ollydb and cheat engine a fair bit in the past.

2
  • This depends on the framework used to build the game. As an example, unity3d games are .net based, so .net tools(decompilers/debuggers/tracers/etc) should be used. Using Olly or Cheat Engine is possible but difficult.
    – 0xec
    Aug 30, 2015 at 4:41
  • 3
    See Highlight Executed Basic Blocks in IDA Aug 30, 2015 at 15:31

2 Answers 2

5
  1. On windows you can

    find winproc function, search click messages within it and add breakpoint/trace from there...

  2. On different OS

    trace mouse handlers ...

  3. If OpenGL is used

    The Object selection is often done by it directly during rendering. You can trace calls to those functions used.

  4. If any framework is used

    learn what function for mouse it has and trace its calls ...

2

An effective method in these cases (although not necessarily straightforward) is to use differential debugging.

The core principle is to run the application twice and record traces of the functions being executed, or even basic blocks if you need to get so granular.

The idea boils down to:

  • The first time you record a trace try to exercise as much functionality as possible, except what you are interested in (in your case, do not press that button!).
  • The second time you go directly for what you are interested in, press that button!

  • Now you can filter the noise out of the second trace by looking for hits that appear exclusively in the second (and not in the first)

This is not a perfect method but it works pretty well to narrow the search in several scenarios.

Shameless plug: Here a link to my blog where I discuss a similar (in nature) problem. There is even some old code to get you started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.