Talk:Cheat Code

From Custom Mario Kart
Jump to navigation Jump to search

Opcode format and masking.

Mainly @Leseratte, you changed the mask from (ba & 0xfe000000) + XXXXXX to ba + (X & 0x1ffffff) which as far as I know is completely wrong. Do you have some evidence that your modification is correct. I get what you're saying about X only being a 25 bit value (because the opcode is 7 bits) but is ba not masked? Is it not (ba & 0xfe000000) + (X & 0x1ffffff)?

Separately, you edited the article to present the opcode as 04/05, but this isn't really the case, as the article makes the point that the opcode is only 7 bits (displayed shifted left one place) so 04 = 05. I see what you mean though, that the first byte of the instruction is 04 or 05, but the 7 bit opcode is the same in each case (0x02) which shift left one place to give 0x04. It's a minor complaint, but it doesn’t make sense currently how it's written (to me), but I have a rather formal view on these things. Perhaps it would be better to reword the article in terms of bytes, but this is a wiki rather than a how-to so I felt a formal encyclopedic approach was more appropriate. Chadderz (talk) 21:59, 4 May 2016 (UTC)

Cite from gecko codes for 04: "For values of ______ >= 0x01000000, add one to the codetype." So "X & 0x1ffffff" is correct.
However, if looking into the source code, then I can find "rlwinm r3,r3,0,7,31" (r3 is the first word of the code line) and later "rlwinm r12,r12,0,0,29" → "X & 0x01fffffc" is correct if writing a 32 bit number.
-- Wiimm (talk) 22:48, 4 May 2016 (UTC)
The geckocodes page clearly states "04______ XXXXXXXX: Writes the value XXXXXXXX to ba+______". And if I recall correctly, I have tested this in the past by setting ba to 80______ and using "04000000 XXXXXXXX". Leseratte (talk) 07:12, 5 May 2016 (UTC)
Quoting from codetypes.html (part of Wiird's documentation) "Each time the ba is added to a code address, the code handler do : address = address + (ba & 0xFE000000). You can modify it, however if you do, don't forget to reset it to its original value after.". This imples ba is masked, but I haven't tested that this is true and Leseratte seems to be suggesting that this is not true in practice. Maybe different codehandlers even do different things? Also, according to the codetypes.html document geckocodes.org is wrong, the 'code type' or opcode as I've called it is 7 bits so you do not add 1 to it. The msb of the address overlaps the lsb of the first byte which contains the code type which I believe is the source of the confusion. geckocodes.org seems to imply that the code type is the first byte of the instruction. Chadderz (talk) 10:06, 5 May 2016 (UTC)

Broken link

The link to geckocodes.org is broken. I'm not really sure what to do about it since I'm new, so I report it here. Hopefully someone who knows what they're doing will fix it. Cealgair (talk) 17:23, 9 December 2020 (UTC)

Yeah, geckocodes shut down a couple weeks ago. Check out codes.rc24.xyz, that should be a copy of geckocodes' last version. -- Leseratte (talk) 17:24, 9 December 2020 (UTC)