MEM2 Code Making help needed

Started by g6flavor, November 03, 2008, 02:52:36 AM

Previous topic - Next topic

Panda On Smack

Quote from: TNTkryzt on November 05, 2008, 10:21:08 AM
Have 9,999 Coupons
077F3000 00000014
2C1B0002 40820008
3800270F 90050000
4A97452C 00000000
04167538 4968BAC8

What does an 07 code do?
077F3000 00000014

TNTkryzt

It's the string code incremented to write to the 0x81xxxxxx area;

= CST3 : String Code =

06______ YYYYYYYY : Patch code (ba)
d1d2d3d4 d5d6d7d8...
writes d1d2d3d4 d5d6d7d8... at ba+address.
YYYYYYYY is the number of bytes to write

g6flavor

Quote from: brkirch on November 03, 2008, 06:24:15 AM
Quote from: TNTkryzt on November 03, 2008, 03:55:39 AM
If I'm not mistaken, you'd use 0x91xxxxxx as the base address (ba);

(in example Mem2 16bit write (ba))
42000000 91000000
02531492 000003E7
E0000000 80008000

ba is aligned to be divisible by 0x2000000, so 91000000 won't work as expected.  It should instead be:

42000000 90000000
03531490 000003E7
E0000000 80008000

Of course, that is assuming that you want a 16-bit write.  For 32-bit it would be:

42000000 90000000
05531490 000003E7
E0000000 80008000

Alternatively, you could use po (this example does a 32-bit write):

4A000000 91531490
14000000 000003E7
E0000000 80008000

Or you could use po like this, it would work since po isn't realigned:

4A000000 91000000
14531490 000003E7
E0000000 80008000

Quote from: TNTkryzt on November 03, 2008, 03:55:39 AMMind you I've been using an old version of WiiRD so the handler may have changed.

WiiRD doesn't load the code handler into memory, Gecko OS does.  Only the Gecko OS version will make a difference in regards to which codes do or don't work.
What if I want to add an IF code to the MEM2 code,
example:
The Code
42000000 90000000
03531490 000003E7
E0000000 80008000

I want to make it like IF 91531480 = FFFFFFFF then  write 03E7  to 91531490
how do it do that?

TNTkryzt

20______ YYYYYYYY : 32bits If equal (ba)
increment the 20 to 21 if reading 91 area;

The Code (ba)
42000000 90000000
21531480 FFFFFFFF
03531490 000003E7
E0000000 80008000

g6flavor

Yeah thanks adding 01000000 to the address solve the problem. Learned something new today  :)