WiiRd forum

Wii & Gamecube Hacking => Wii Game hacking help => Topic started by: live2play on June 08, 2010, 03:19:53 AM

Title: Activate Deactivate Gecko Code based on trigger
Post by: live2play on June 08, 2010, 03:19:53 AM
I have a 06 codetype code that overwrites a section of memory with new data.  I only want this "overwrite" to occur after a specific opcode has been executed.  I then want the 06 code to stop after another opcode has been executed.  Does the 06 codetype write the data once or does it keep writing it like a 04 code type?  
Title: Re: Activate Deactivate Gecko Code based on trigger
Post by: wiiztec on June 08, 2010, 03:22:04 AM
It writes to the addresses every frame like the 04 code
Title: Re: Activate Deactivate Gecko Code based on trigger
Post by: live2play on June 08, 2010, 03:26:40 AM
Any other method other than rewriting the 06 code in ASM and hooking it where I want it with a C2 code?  Problem is I have 384 bytes of data to write and that would be a pain without the 06 code type.
Title: Re: Activate Deactivate Gecko Code based on trigger
Post by: wiiztec on June 08, 2010, 03:37:55 AM
What do you mean rewrite the 06 code in ASM?
Title: Re: Activate Deactivate Gecko Code based on trigger
Post by: live2play on June 08, 2010, 03:44:35 AM
Because a 06 code type writes the data every frame and I need to only write the data after a specific line of ASM is executed, it looks like I'll need to perform the same function the 06 code type would but with ASM.
Title: Re: Activate Deactivate Gecko Code based on trigger
Post by: wiiztec on June 08, 2010, 04:00:14 AM
Why not just use conditionals?
Title: Re: Activate Deactivate Gecko Code based on trigger
Post by: live2play on June 08, 2010, 05:11:45 AM
Can you give me an example using conditionals with the 06 code type.
Title: Re: Activate Deactivate Gecko Code based on trigger
Post by: wiiztec on June 08, 2010, 05:23:40 AM
22002FF0 00000001
06079674 00000010
77777777 77777777
77777777 77777777
04002FF0 00000001
E0000000 80008000

That would make it so it only writes to the addresses once
Title: Re: Activate Deactivate Gecko Code based on trigger
Post by: live2play on June 08, 2010, 05:51:59 AM
Perfect!  Now how would I get the code above to only run when a particular ASM instruction has been executed?  It would be nice if I could add a C2 hook that contained the execution of the sample code you provided.
Title: Re: Activate Deactivate Gecko Code based on trigger
Post by: dcx2 on June 08, 2010, 06:23:34 PM
Does the code need to execute exactly after the instruction is executed?  If so, you will need to hook with a C2 code that does the reading/writing of the data; the data can be embedded in the C2 code (see the LUT Discussion thread in the USA Wii Codes forum for how to read data embedded in a C2 code).  The C2 code could in theory be very short, if you're looping over lwzu/stwu.

However, if it can execute some time after the instruction (i.e. when the code handler next runs), then you can hook with a C2 code that basically does 04002FF0 00000000, which would then "enable" the 06/16 code for when the code handler ran.
Title: Re: Activate Deactivate Gecko Code based on trigger
Post by: live2play on June 09, 2010, 06:27:18 PM
Thanks for all of the good information.