F6 Search Address into Gecko Register?

Started by live2play, July 06, 2010, 11:36:49 PM

Previous topic - Next topic

live2play

Is there a way to have the address returned by an F6 code's search of memory written to a Gecko register so that it can be used by another piece of code?  The desired pseudo code is as follows:

1) Search for a specific value in memory
2) Store the address of that value in a Gecko register
3) Button activate the following sequence:

  • Read the address from the Gecko register
  • Change the value at that address to see its affect on the game
  • On pressing another button, change the value back to its original value
4) Repeat the process.

dcx2

Sure, that's not too hard.  A successful F6 code will replace the F6 line with F60003NN; the 3 means success.  It will then replace the next code word with the address where it found the Z values...and it will place that address into the po!

Use the 90 codetype to load the po into Gecko Register N.

9001000N 00000000

You can also use the 92 codetype (9221000N) to load the "original value" into a second Gecko Register so that it can be restored "on pressing another button".

Though, you should be careful about "repeating the process", because the F6 code stops searching once it finds the *first* result.  So you must alter the values at the address so that they don't match the F6 code's Z values, or it will keep finding the same address.

live2play

Thanks!  Is there a way to have the F6 start at a specific address in memory?  If so, I could then have it start searching from the last value it found instead of from the very beginning.

dcx2

The second code word on the F6 line is originally XXXXYYYY.  It specifies the specifies the starting and ending search regions.  Start at XXXX0000, end at YYYY0000.

In theory, you could try to adjust XXXX so that it points to after the most recent search result.  However...

Let's say that you're searching for a value that is found at 80001000.  But the actual value you want to find is at 80002000.  There is no way to specify XXXX so that it avoids the first but finds the second.

live2play

Would it be possible to instead have the F6 code write all of the addresses it found to Gecko registers and use a field separator like "*" for instance?  I could then write a C2 hook that would parse the lists in the Gecko registers.

dcx2

Technically, it is possible.  You would need to use a 4E code type to over-write the F60003NN with F60000NN, which will reset the search and make it run again.

The problem is that the F6 search will still stop at the first instance of Z that it finds.  This is not normally a problem, because you're supposed to make sure the Z values are unique.

In order to find every address, you will need to modify the Z values at the found address after each successful search so that the F6 code can get past each result.  Then, when you reset the F6 code, it can get past the result that you just modified.

You could then probably use a C2 code with brkirch's blr/mflr technique.  With it, you can create a small data area.  Then, you can publish a pointer to this data area into a Gecko Register, and another code could read that pointer to the data area and write the search results there.  You'd still need another Gecko Register that keeps track of how many results have been stored so far.