WiiRd forum

Wii & Gamecube Hacking => Wii Game hacking help => Topic started by: Mathew_Wi on July 26, 2010, 12:24:24 AM

Title: Pointer - offset
Post by: Mathew_Wi on July 26, 2010, 12:24:24 AM
I have run into a problem. I've found a pointer for what I'm looking for, but it has a negative offset.

[80AF8920]-151998

How would I go about doing this with a code? I know 14XXXXXX adds the offset, but how to you subtract?
Title: Re: Pointer - offset
Post by: Deathwolf on July 26, 2010, 12:30:31 AM
lol better you try to make it to a ASM C2 code.
it's pointerless
Title: Re: Pointer - offset
Post by: dcx2 on July 26, 2010, 12:40:37 AM
Use the 5A code type and the two's complement of your negative offset.

5A010 : po = po+XXXXXXXX

Your code probably looks something like this

48000000 80AF8920 # get [80AF8920] and put it into the po
5A010000 FFFDAE42 # po = po - 151988
14000000 YYYYYYYY # write Y to [80AF8920]-151998
Title: Re: Pointer - offset
Post by: Deathwolf on July 26, 2010, 12:42:13 AM
codetype 5A010 substract?

48000000 80AF8920
5A010000 FFFDAE42<-- why FFFDAE42? how did you substract it?
14000000 YYYYYYYY
E0000000 80008000
Title: Re: Pointer - offset
Post by: Deathwolf on July 26, 2010, 12:47:46 AM
oh okay.
yep just try dcx2's code^^
Title: Re: Pointer - offset
Post by: dcx2 on July 26, 2010, 12:50:48 AM
FFFDAE42 = -151998

It's called "two's complement".  When you add a negative number to something it's like subtracting, right?

Use Windows Calculator.  Make sure you're in Scientific Mode (View -> Scientific).  Copy and paste -151998.  Hit F5 to convert to Hex.  It will give you 64 bits, so just use the last half.
Title: Re: Pointer - offset
Post by: Deathwolf on July 26, 2010, 12:54:01 AM
it says : 251BE  :confused:
Title: Re: Pointer - offset
Post by: dcx2 on July 26, 2010, 01:00:04 AM
You didn't hit -

Also, if you type it in by hand, you have to hit enter before F5.  If you copy and paste, you don't have to hit enter.
Title: Re: Pointer - offset
Post by: Deathwolf on July 26, 2010, 01:02:00 AM
yes if I hit F5 it change it to hex.
Title: Re: Pointer - offset
Post by: dcx2 on July 26, 2010, 01:42:37 AM
You can also use the data converter in the arsenal on the code database to convert negative numbers to hex.

http://geckocodes.org/index.php?arsenal=3
Title: Re: Pointer - offset
Post by: dcx2 on July 26, 2010, 07:06:11 PM
Don't use a - in front of hex.  Convert the hex to decimal, then put the - in front of it and use James' tool.

Or, if you're in Windows Calculator, and you want to convert a hex number to its twos-complement negative equivalent

1) make sure you're in Hex mode (F5)
2) Enter the hex value
3) Press F9 or click the +/- button.