Jump to content

Pokemon XD PID/IV Relationship Uncovered


Kaphotics

Recommended Posts

After a bunch of time spent with Dolphin and collaborating with OmegaDonut, here's the call structure of xD and the PRNG it uses.

0	Initial
1	Opponent TID
2	Opponent SID
3	1st ???
4	2nd ???
5	IV Block 1 (Def/Atk/HP)
6	IV Block 2 (SpD/SpA/SpE)
7	3rd ???
8	Upper Half of PID
9	Lower Half of PID

note that the upper is generated before the lower, a common trait of non-GBA originated Pokemon 
like the BACD Restricted Pokemon that are generated from a header on the save file

0x000343FD*seed+0x00269EC3

=====

To check the PID/IV legality of an xD (and possibly Colosseum) originated Pokemon, you can't use the current version of Legal.exe. For xD Pokemon, it is a reverse BADE (call it DEBA) but with a different Linear Congruential Random Number Generator.

1	IV Block 1 (Def/Atk/HP)
2	IV Block 2 (SpD/SpA/SpE)
3	3rd ???
4	Upper Half of PID
5	Lower Half of PID

Here's an example:

Frame	RNG Value
1	171EA3F5	171E in binary: 0|00101|11000|11110 (Defense 5, Attack 24, HP 30)
2	CA36C6E4	CA36 in binary: 1|10010|10001|10110 (SpDef 18, SpAtk 17, Speed 22)
3	8302DA17	ignored
4	C7512C7E	C751 forms the upper half of the PID
5	BF7E9149	BF7E forms the lower half of the PID

We are then left with the following Pokemon:

C751BF7E 30/24/5/17/18/22
Common GC (DEBA)

Link to comment
Share on other sites

Also, xD Pokémon are never shiny. The game will continue to roll over to the next PID until the Pokémon is not shiny. Here's an example:

Frame	RNG Value
1	EDA5FFE8	IV Block 1
2	4EE63F0B	IV Block 2
3	F953CDA2	ignored
4	BFB03DDD	frames 4 and 5 form a PID that should be shiny (BFB04B1B) 
5	4B1B992C	but we know it rerolls to frames 6 and 7
6	3F07833F	frames 6 and 7 also form a PID that should also be shiny with our ID\SID (3F07CBA9).  
7	CBA9D106	we want to know if it only rerolls once, or if it keeps rerolling until not shiny
8	[b]2BC0[/b]C3B1
9	[b]FBF2[/b]57B0	final PID 2BC0FBF2, so the game rerolled until a non-shiny PID occurred on frame 8 and 9.

I guess we could call it Uncommon GC (HIBA).

Link to comment
Share on other sites

XDC-Legal

Checks the GC method Pokemon. Essentially it's every Pokemon that fits into the Unknown GBA type, except Channel. Every Pokemon that is given out through a GameCube interface that isn't BACD should be checkable.

i'm not sure if the worst part of this is that you

a. ripped off shaym.in entirely(http://shaym.in/apps/iv_checker - have a look)

b. deleted both the author's credits and copyright

c. after changing a very small bit of the javascript, you tried to make someone else's code unreadable after it was released openly in shaym.in(hint: minify is not obfuscation)

d. put this crap tucked away in the middle of the shaym.in guy's source:

// This calculator is a modified version of Alex Smith's Method 1/J/K PIDIV calculator. It may only be used by Kaphotics' Dropbox.

// http://dl.dropbox.com/u/12206225/RNG/xdc-legal.html

// If this is uploaded to another site, then you are an asshole and a good for nothing. I will hunt you down.

i'm also not at all sure what has to be wrong with you to do that, but here's a fully open version with all functions readable and everything restored as it should be:

http://hack.thundaga.com/doc.html

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...