Glitch City Laboratories Forums

Lab δ: Tech => Tech Help => Topic started by: iamnguyen on July 16, 2016, 06:17:45 pm

Title: Gameshark code limit
Post by: iamnguyen on July 16, 2016, 06:17:45 pm
Hello, I am new to Gameshark code. Any help is much appreciated.

I wonder how stat modifier works. For example:

Quote
Special Modifier
01??C0DA
01??C1DA

What do I change for each line? Let's say I want to change the special of my pokemon to 999, what value do I need to have? Please help. Thank you very much in advance.
Title: Re: Gameshark code limit
Post by: TheUnReturned on July 16, 2016, 09:49:40 pm
Hello, I am new to Gameshark code. Any help is much appreciated.

I wonder how stat modifier works. For example:

Quote
Special Modifier
01??C0DA
01??C1DA

What do I change for each line? Let's say I want to change the special of my pokemon to 999, what value do I need to have? Please help. Thank you very much in advance.
First of all, it'll be actually 01??C1DA + 01??C2DA
This is used to change the special of the third Pokemon.
If I remembered correctly, the final special will be the sum of the both ??
Example: 01FFC1DA + 0102C2DA
Then the third Pokemon's special will be FF(255) + 02(2) = 257 special
The whole hex-to-number can be viewed here:
http://forum.renoise.com/uploads/post-1028-0-62901100-1416239611.png
Title: Re: Gameshark code limit
Post by: iamnguyen on July 16, 2016, 11:27:13 pm
Thank you for your response, but does that mean the limit will be 510, not 999?
Title: Re: Gameshark code limit
Post by: TheUnReturned on July 17, 2016, 12:32:42 am
Thank you for your response, but does that mean the limit will be 510, not 999?
sadly, I think that's the case.
Title: Re: Gameshark code limit
Post by: TheZZAZZGlitch on July 17, 2016, 12:44:49 am
Nope.

Take the value you want to get, let's say 456, divide it by 256, and only take the whole part (this is "integer division"):
456 div 256 = 1
Then take the original value again, divide it by 256 and take the remainder (this is "modulo"):
456 mod 256 = 200
Convert the results into hex:
01 C8
And finally, replace the ?? spots in the GameShark codes:
0101C0DA
01C8C1DA
If it works incorrectly, try putting the bytes in a reverse order (Gen I is very inconsistent with its endianness, the least significant byte sometimes goes first, sometimes goes last).
Although I'm not sure where you got the codes in the first place, they point to the second PC Pokemon's moves.

Alternatively, you can just convert the target value into hex and split it every two numbers, adding a leading zero if necessary:
456 = 0x1C8 = 0x01C8
So the values are: 01, C8

Without entering any math details, the first number is the "multiples of 256", and the second is added to the first number. So with 01 C8:
1 * 256 + 0xC8 = 256 + 200 = 456
Title: Re: Gameshark code limit
Post by: iamnguyen on July 17, 2016, 01:13:52 am
Thank you, the famed TheZZAZZGlitch. This makes perfect sense. I'm trying to use Gameshark codes through arbitrary code execution (I know this is lame, I'm really a beginner).