+ Reply to Thread
Results 1 to 5 of 5

Thread: Generating shiny PID, PHP script

  1. #1
    Member Vlad's Avatar
    Join Date
    Apr 2009
    Location
    In your closet
    Age
    23
    Posts
    109

    Generating shiny PID, PHP script

    *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...d=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
    Vlad's GTS (PHP and Python DNS repository)

  2. #2
    4th Gen Game Researcher DeveloperGame Save ResearcherROM ResearcherRAM ResearcherIRC OwnerAdministrator SCV's Avatar
    Join Date
    Mar 2009
    Location
    Mexico D.F.
    Age
    26
    Posts
    459

    Re: Generating shiny PID, PHP script


  3. #3
    Member Vlad's Avatar
    Join Date
    Apr 2009
    Location
    In your closet
    Age
    23
    Posts
    109

    Re: Generating shiny PID, PHP script

    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?

    Code:
    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.
    Vlad's GTS (PHP and Python DNS repository)

  4. #4
    4th Gen Game Researcher DeveloperGame Save ResearcherROM ResearcherRAM ResearcherIRC OwnerAdministrator SCV's Avatar
    Join Date
    Mar 2009
    Location
    Mexico D.F.
    Age
    26
    Posts
    459

    Re: Generating shiny PID, PHP script

    Quote Originally Posted by Vlad View Post
    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.
    PHP Code:
    L=L<<16;
    for(
    $i=0;$i<0x10000;i++)
    {
        if( ( (
    0x41C64E6D * ( $L+$i)+ 0x6073) % 0xFFFFFFFF)>>16==)
        {
            
    //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)

  5. #5
    Member Vlad's Avatar
    Join Date
    Apr 2009
    Location
    In your closet
    Age
    23
    Posts
    109

    Re: Generating shiny PID, PHP script

    Thanks mate, great help!
    Vlad's GTS (PHP and Python DNS repository)

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
PPN Top 50