Jump to content

Generating shiny PID, PHP script


Vlad

Recommended Posts

*Edit*

Never mind, I figured out the issue and it works now. :P

But, I still can't quite get the IV out of a PID. Could someone that knows make a quick guide how you turn PID into IV? I know and I read on smogon.com about it but it was still complicated to me. :(

I bet you want a taste, well here you go: http://vlacula.no-ip.com/pokemon/pid/?tid=28404&sid=20506&max=20

Basically tid is trainer id, sid is secret id and max is how many results to show. It caps at 5000 because my PHP script can not allocate more space in the memory buffer. It's like a simpler version of the PID calculation program, at least I try to make it like that. :P

Link to comment
Share on other sites

Thanks SCV but it's the same as I saw on smogon.com, and this part is still confusing to me:

Suppose that we start with a PID, 0x45A6738F, 0x45A6 are the high bits of some X[2] and 0x738F are the high bits of some X[1].

Let X[1]=0x738F0000 and see whether the high bits of X[2] are 0x45A6.

If they are then we proceed to calculate X[3], X[4], X[5] and then the possible IVs from them.

Let X[1]=0x738F0001 and see whether the high bits of X[2] are 0x45A6.

If they are then we proceed to calculate X[3], X[4], X[5] and then the possible IVs from them.

Let X[1]=0x738F0002 and see whether the high bits of X[2] are 0x45A6.

If they are then we procceed to calculate X[3], X[4], X[5] and then the possible IVs from them.

....

Let X[1]=0x738FFFFF and see whether the high bits of X[2] are 0x45A6.

If they are then we procceed to calculate X[3], X[4], X[5] and then the possible IVs from them.

After finishing those 65,536 cases we will know all the possible PID/IV conbinations for these algorithms

You basically take the PID, convert it to hex, split it in half. You got L and H. I got the forumla ready in a PHP forumla but I don't know how to do it properly.

Let's say we have 3213254321 PID, we make it to 0xBF865EB1 and split and get H=BF86 and L=5EB1 and now, what to do step by step?

function rng_calc($hex) {
 return (0x41C64E6D * rng_calc($hex-1) + 0x6073) % 0xFFFFFFFF;
}

What am I looking for? Would be nice with a practical example kinda, at least for the first steps. Perhaps C++, VB, Java, e.g. sample code -just so I can see the syntax/structure.

I unfortunately fail to see what we are after. It says "calculate X[3] and check whether the high bits of X[3] are 0x7FFF" but I don't get it... what a shame.

Link to comment
Share on other sites

Thanks SCV but it's the same as I saw on smogon.com, and this part is still confusing to me:

Suppose that we start with a PID, 0x45A6738F, 0x45A6 are the high bits of some X[2] and 0x738F are the high bits of some X[1].

You basically take the PID, convert it to hex, split it in half. You got L and H. I got the forumla ready in a PHP forumla but I don't know how to do it properly.

Let's say we have 3213254321 PID, we make it to 0xBF865EB1 and split and get H=BF86 and L=5EB1 and now, what to do step by step?

You do exactly what you quoted.

You take the L and use L<<16.

Then you make a loop.

L=L<<16;
for($i=0;$i<0x10000;i++)
{
   if( ( (0x41C64E6D * ( $L+$i)+ 0x6073) % 0xFFFFFFFF)>>16==H )
   {
       //Calculate IVs here seeding with $L+$i
   }
}

I unfortunately fail to see what we are after. It says "calculate X[3] and check whether the high bits of X[3] are 0x7FFF" but I don't get it... what a shame.

This is similar to the above except with you start with a different stage of the RNG. (L and H are different)

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...