Technical Code Type Document

Started by Nuke, July 25, 2008, 09:26:55 AM

Previous topic - Next topic

Nuke

Here is a document of all the code types in Gecko OS and used with WiiRD.

http://wiird.l0nk.org/codetypes.html

The document was written by kenobi, i just made it into an html format for easier reading or printing.

please use this thread for discussion or advice of these code types.
0xFFFFFFuuuuuuu

Volderbeek

I haven't been able to get the Goto codetypes to work. Any more details on how to use these?

Apache81

#2
Hi to everyone !!!
Someone could please tell me where to find documentation? The link you posted seems to be brocken !!!

THANKS !!!  :)

[EDIT] now the link works again !!!


All my codes are made to work with Gecko, Coverfloader and WiiFlow... not sure about others !!!


[wt]Will.S

wow FOXX you saved my life i amm ssooo happy know i did 5 coads for CAll of duty online and they work but the problem is that i dont really understand the pointer search! O0 O0 O0
I am A PAL user!!!
CoD WaW :0560-0234-3931 9th prestige lvl 56.
The CONDUIT:0388-6981-8157 lvl 24
MKWii:3265-5798-7634
[wt]RED40>how come you shoot so fast with ure weapon
[wt]Will.S>i play electric guitar and mastur**** .lolz
1547 posts on tehske

mugwhump

#5
This thread would be a good place to post errors/clarifications for the codetype documentation. Here's the ones I know, from personal experience and searching through other people's posts:

grN : "Gecko Register N". It's not a real register, like r0 or r1. It's a 32-bits value, for which the Gecko has reserved a place in
memory. N can range from 0x0 to 0xF. You can store/load anything in it, however be careful that other codes could overwrite your value.
Don't expect it to be the same each time the code handler is executed. If you want to store a value that must not change, try to use a
"real" address ouside of the code handler, or use the 46/4E code types along with a goto code type. Note that grN are stored before the
gecko/code handler. That mean they should always be accessible at a static address : 0x80001804. [0x80001804]=gr0,
[0x80001808]=gr1,...,[0x80001840]=grF. That way you can access them directly, when inserting an asm routine for example.

As of gecko 1.9.1 (dunno if it changed earlier, that's all I've tested), gr0 is at [0x80001808]. So they're all moved up one. bN should also be moved up then.
Also, the gecko registers initialize to zero, if you're wondering.


CST3 : Gecko Register / Direct Value operations

86TY000N XXXXXXXX: Direct value operations
86T0 : grN = (grN ? XXXXXXXX)
86T1 : grN = ([grN] ? XXXXXXXX)
86T2 : grN = (grN ? [XXXXXXXX])
86T3 : grN = ([grN] ? [XXXXXXXX])

? = T :
0 : add (+)
1 : mul (*)
2 : or (|)
3 : and (&)
4 : xor (^)
5 : slw (<<)
6 : srw (>>)
7 : rol (rotate left)
8 : asr (arithmetic shift right)
A : fadds (single float add)
B : fmuls (single float mul)

This SHOULD be:

86TY000N XXXXXXXX: Direct value operations
86T0 : grN = (grN ? XXXXXXXX)
86T1 : [grN] = ([grN] ? XXXXXXXX)
86T2 : grN = (grN ? [XXXXXXXX])
86T3 : [grN] = ([grN] ? [XXXXXXXX])

? = T :
0 : add (+)
1 : mul (*)
2 : or (|)
3 : and (&)
4 : xor (^)
5 : slw (<<)
6 : srw (>>)
7 : rol (rotate left)
8 : asr (arithmetic shift right)
9 : fadds (single float add)
A : fmuls (single float mul)

So operations A and B should be 9 and A, and 86T1 and 86T3 read values and save results to the ADDRESS stored in grN. Same for CST4.

CST2 : 16bits (endif, then) If greater

A4______ NM00YYYY : 16bits If greater 16bits compares if ([grN] and not(YYYY))>([grM] and not(YYYY)). If yes, codes are executed (else code execution set to false).

A4_____1 NM00YYYY : Endif, then 16bits If greater Makes one endif, then 16bits compares if ([grN] and not(YYYY))>([grM] and not(YYYY)). If yes, codes are executed (else code execution set to false).

CST3 : 16bits (endif, then) If lower

A6______ NM00YYYY : 16bits If lower 16bits compares if ([grN] and not(YYYY))<([grM] and not(YYYY)). If yes, codes are executed (else code execution set to false).

A6_____1 NM00YYYY : Endif, then 16bits If lower Makes one endif, then 16bits compares if ([grN] and not(YYYY))<([grM] and not(YYYY)). If yes, codes are executed (else code execution set to false).

A4 and A6 are backwards. Also, remember that this compares the value stored at the ADDRESS stored in grN, not the value in grN itself.
BTW, what happens if you put F for both N and M?

CLARIFICATIONS

CST0: 8bits Write & Fill

00______ YYYY00XX : 8bits ram write and fill (ba) writes XX YYYY+1 times at ba+address

This sounds like it writes the same value to the same address multiple times, which would be kinda useless. :p
It actually increments the address it's writing to YYYY times (for the 8bit code, it increments it by 1, since addresses are bytes. For the 16bit version, it would increment it by 2).
So 00111116 0003002A would set 80111116, 80111117, 80111118, and 8011119 to 2A.

CST2 : Save Gecko Register to

84UYZZZN XXXXXXXX:
8400 : writes the 8bits in grN ZZZ times+1 at [XXXXXXXX]
8401 : writes the 8bits in grN ZZZ times+1 at [XXXXXXXX+ba]
9401 : writes the 8bits in grN ZZZ times+1 at [XXXXXXXX+po]
8410 : writes the 16bits in grN ZZZ times+1 at [XXXXXXXX]
8411 : writes the 16bits in grN ZZZ times+1 at [XXXXXXXX+ba]
9411 : writes the 16bits in grN ZZZ times+1 at [XXXXXXXX+po]
8420 : writes the 32bits in grN ZZZ times+1 at [XXXXXXXX]
8421 : writes the 32bits in grN ZZZ times+1 at [XXXXXXXX+ba]
9421 : writes the 32bits in grN ZZZ times+1 at [XXXXXXXX+po]

This might make you think it writes grN to the address stored in [XXXXXXXX] (which is an address itself). It doesn't.
84000000 80123456 would simply write grN to the location 80123456.

QuoteI haven't been able to get the Goto codetypes to work. Any more details on how to use these?
Yeah I dunno how to work them either, at least when jumping backwards. Maybe you need to use Set Repeat to store the code? Is 00111116 0003002A considered 1 line of code?

Someone should fix the codetype doc up, that'd be cool.

edit: looks like somebody did, the one dcx2 posted fixed everything. Good jorb guys 

dcx2

#6
CT2 Base Address/Pointer Operations
CST7 : Put grN's location into the Pointer

4E000000 XXXXXXXX = po will hold the address at which the next line of code is stored
+ XXXX (XXXX is a signed 16bits value : 0xFFFF=-1).
4E000000 00000000 = po points to next code's first 32bits.
4E000004 00000000 = po points to next code's second 32bits.


The text is okay, just the heading is wrong...4E code type has nothing to do with grN.

EDIT:

GeckoCodes also hosts a version of the codetype doc with some updates and a few examples.

http://www.geckocodes.org/index.php?arsenal=1

mugwhump

#7
edit: I suck at editing posts

Dephinix

I'm familiar with hexadecimal, but as far as how to use this and what for is what confuses me? Do I need to put this in a game config folder/text file?

dcx2

If you're just using codes, then you don't ever need to understand any of this.  Some hacker has already done all the work for you.

The code type document is a resource for hackers when they are writing codes.

Dephinix

Ah ok, I'll worry about it at a much later time then. The Gecko OS "docs" folder made it sound like you did when you make a gameconfig.txt folder for the games. I noticed Brawl Minus had it and thought MH3 would need the same. Thanks for the help!

mugwhump

Found 2 more things:

Quote16 bits (endif, then) If counter value greater
AC0ZZZZT MMMMXXXX
(...)
Condition : If (XXXX and not(MMMM))>ZZZZ
If ZZZZ is the counter value, then the description's backwards. Same for its sister code "if counter value lower."

QuoteStore Pointer Address at
4C0YZ00N XXXXXXXX

4C000 : [XXXXXXXX] = po
I last tested this like 8 months ago, but I think what this code actually uses for the address is [XXXXXXXX + ba]. So it functions the same as the 4C010 type.

daijoda

Yeah, ^ that Store Pointer Address at code adds an additional ba to the address as well.