WiiRd forum

Wii & Gamecube Hacking => Wii Game hacking help => Topic started by: Bully@Wiiplaza on October 19, 2010, 11:56:59 AM

Title: Use Serial Codestype + avoid writing to single adresses?
Post by: Bully@Wiiplaza on October 19, 2010, 11:56:59 AM
Hey guys,
someone made a code, which is very long for really no purpoise.
It writes the 00000001 to a lot of adresses, and between them are other adresses which shouldn´t be overwritten...
How can I achive the same effect with the shortest possible code, but still only write to the adresses in the code? (serial codestype)

[spoiler]
All Weapons [FullMetalKirby]
4A000000 92B82A0C
30000000 00000000
4A000000 90D39890
14000004 00000001
14000008 00000001
1400000C 00000001
14000010 00000001
14000014 00000001
E2000001 80008000
4A000000 92B82A0C
30000000 00000001
4A000000 90D39890
14000004 00000001
1400000C 00000001
14000018 00000001
1400001C 00000001
14000020 00000001
E2000001 80008000
4A000000 92B82A0C
30000000 00000002
4A000000 90D39890
14000004 00000001
14000024 00000001
14000028 00000001
14000030 00000001
14000034 00000001
E2000001 80008000
4A000000 92B82A0C
30000000 00000003
4A000000 90D39890
1400000C 00000001
14000010 00000001
14000018 00000001
14000020 00000001
14000028 00000001
E2000001 80008000
4A000000 92B82A0C
30000000 00000004
4A000000 90D39890
14000008 00000001
14000010 00000001
1400001C 00000001
14000020 00000001
14000028 00000001
E2000001 80008000
4A000000 92B82A0C
30000000 00000005
4A000000 90D39890
14000004 00000001
1400000C 00000001
14000018 00000001
14000028 00000001
14000030 00000001
E2000001 80008000
4A000000 92B82A0C
30000000 00000006
4A000000 90D39890
14000014 00000001
14000018 00000001
14000020 00000001
14000030 00000001
14000034 00000001
E2000001 80008000
4A000000 92B82A0C
30000000 00000007
4A000000 90D39890
14000008 00000001
14000018 00000001
1400001C 00000001
14000024 00000001
14000028 00000001
E2000001 80008000
[/spoiler]

Example for serial:

[spoiler]
Inf. Ammo [Ozelot]
4A000000 80784640 -> startadress is 80784640
60000063 00000000
18000000 63636363 -> write value 63636363
20550004 00000000 -> overwrite 55 (hex!) adresses in a row
62000000 00000000
E0000000 80008000 -> End[/spoiler]

Since I am not that sure about it, some help or better ideas would be nice ;)
Title: Re: Use Serial Codestype + avoid writing to single adresses?
Post by: dcx2 on October 19, 2010, 02:48:41 PM
Don't post uncredited codes.  Edit that and give credit to the hacker who wrote it.

Also, that code is not just writing 1 to a lot of addresses.  It's much more complicated.  He's loading the pointer with 4A, if-equals with 30, loading another pointer with 4A, and writing to the pointer.  If the ifequals was false, the E2 ends that if, and he then does another pointer test.

if ([92B82A0C] == 0) {14-codetypes}
else if ([92B82A0C] == 1) {14-codetypes}
else if ([92B82A0C] == 2) {14-codetypes}
else if ([92B82A0C] == 3) {14-codetypes}
etc.
Title: Re: Use Serial Codestype + avoid writing to single adresses?
Post by: Bully@Wiiplaza on October 19, 2010, 05:43:21 PM
done (I could have used any adresses though)
You mean that this code can´t be shortened a lot? :(
Title: Re: Use Serial Codestype + avoid writing to single adresses?
Post by: dcx2 on October 19, 2010, 06:20:22 PM
I'm sure a C0 code could shorten it up significantly.  Other than that, the writes are too discontinuous for the serial code to work effectively.  You might be able to rewrite a few of them, like the first one in particular.

Other than that, you could use the ba instead of the po for the if-equal's.  That gets rid of 21 lines, I think.  This should get you started...

42000000 92000000 # load ba
4A000000 90D39890 # load po
20B82A0C 00000000 # if [92B82A0C] == 0

14000004 00000001
14000008 00000001
1400000C 00000001
14000010 00000001
14000014 00000001
20B82A0D 00000001 # if [92B82A0C] == 1; NOTE THE ENDIF
14000004 00000001
1400000C 00000001
14000018 00000001
1400001C 00000001
14000020 00000001
20B82A0D 00000002 # if [92B82A0C] == 2; NOTE THE ENDIF
etc.
E0000000 80008000
Title: Re: Use Serial Codestype + avoid writing to single adresses?
Post by: Bully@Wiiplaza on October 19, 2010, 09:27:55 PM
k, this is useful thx.
But I think that these 7 compares aren´t needed in that game.
To find that out, I´ll need to look through mem. viewer...