Determine Next Address to be executed

Started by live2play, March 07, 2010, 04:53:46 PM

Previous topic - Next topic

live2play

It's nice that a game can be paused and then Next can be used to step through the game.  However, it would be nice to see the address of the next instruction to be processed each time Next is selected.  Is there a way to do this with WiiRD?

Romaap

I'm not sure, but I think the thing you mean is already in WiiRD.
Its in the breakpoint tab in the bottom left, above the checkbox saying "update registers".

live2play

I truly appreciate the reply.  Ok, I'll check that out.  I don't need to set a breakpoint though, right?  SDo the registers update on every Next that I perform?  Also, is it only the registers that can be updated?  Can I not also have the Memory Viewer updated so I know where in memory the current instruction is?

Romaap

You have to set a breakpoint first, the pause button doesn't actually stops the game's ASM but the breakpoint does.
If you wanted to see the instruction which is executed at a given moment you wouldn't have a clue what it is doing because like thousand instructions are executed per second.

dcx2

Quote from: live2play on March 08, 2010, 01:45:51 AM
I truly appreciate the reply.  Ok, I'll check that out.  I don't need to set a breakpoint though, right?  SDo the registers update on every Next that I perform?  Also, is it only the registers that can be updated?  Can I not also have the Memory Viewer updated so I know where in memory the current instruction is?

I do know that if the game locks up due to, say, a null pointer, you can press "Get BP Data" and it will show you the instruction that's locking the game up.  There have been a few times where I knew what the pointer should have been, fixed it, and the game un-locked...I must say I feel pretty badass when that works.

The only place with the address of the current instruction is the disassembly window of the Breakpoints tab.

live2play

However, the disassembly window of the Breakpoints tab doesn't update on a Next does it?

dcx2

It doesn't automatically update, but you could try pressing Get BP Data anyway.

The Next button in WiiRD GUI is a little flakey...sometimes it goes two frames.  I much prefer Romaap's suggestion; find an instruction that's getting called once per frame and set an execute breakpoint on it.

Link

Quote from: dcx2 on March 08, 2010, 05:20:24 PM
It doesn't automatically update, but you could try pressing Get BP Data anyway.

The Next button in WiiRD GUI is a little flakey...sometimes it goes two frames.  I much prefer Romaap's suggestion; find an instruction that's getting called once per frame and set an execute breakpoint on it.

If you use VBI hooks or most regular hooks (basically all except for OSSleepThread) you could set a breakpoint to 800018A8 and it should work for that purpose.. 800018A8 is the entry point of the code handler and should be executed once every frame!

live2play

Thank you all again for your replies.  So, if my intention is to try and find the assembly code that is performing a particular action in a game (e.g explosion), and I have paused the game just prior to the event occuring, is there a way to step through the assembly that is being executed as I perform a Next operation?  It seems that the answer is no.  If that is the case, is the best that could be done is to view the register values on each Next?

dcx2

Quote from: live2play on March 08, 2010, 09:01:29 PM
if my intention is to try and find the assembly code that is performing a particular action in a game (e.g explosion), and I have paused the game just prior to the event occuring, is there a way to step through the assembly that is being executed as I perform a Next operation?  It seems that the answer is no.  If that is the case, is the best that could be done is to view the register values on each Next?

Next is not the button you want.  You're looking for Step.

Unfortunately, pausing the game "just before an explosion" isn't going to happen.  That would be like trying to stick your finger in a fan that's spinning at 10,000,000 RPM and getting it right between the blades on your first try.

Instead, you need a lead.  Usually, explosions reduce health.  Set a write breakpoint on your health value, and then the game will pause when it touches your health value.  Now you're near the "explosion" section of code, so you can cruise the disassembly and try to become one with the Matrix.

live2play

dcx2:  That helps alot.  I will try the new approach and see where that gets me.  I like the Matrix bit too.  :smileyface:

live2play

So, when would using Pause/Next be beneficial?

dcx2

Let's say you want to skip several frames into the future, but your breakpoint is on something that breaks several times per frame (especially common when finding some instruction that is reading a very commonly read variable).  You might try to spam the "Set Breakpoint" button by pressing it very quickly.  This inevitably ends in failure, because "Cancel Breakpoint" appears right behind it, and so you inadvertently cancel, and then WiiRD GUI locks up, and then your game is frozen and you scream and yell and kick and reset.

In contrast, Next is a very spam-friendly button...that's pretty much the only reason I use it.  In such instances as above when I want to move a few frames ahead in a very controlled manner, instead of raging against the breakpoint I use "Next" to get me most of the way, within say 2 or 3 frames of my target.  Then it's much less painful to carefully and patiently press "Set Breakpoint" or wait for one of the breakpoint register conditions to become true.

live2play