1. New to the forums? Check out our Mentorship Program!
    Our mentors will answer your questions and help you become a part of the community!
  2. Welcome to Smogon Forums! Please take a minute to read the rules.
  3. Welcome to Wi-Fi! Please remember to read the rules and do NOT create a new thread for simple trades or Friend Safari codes.

Past Gen RNG Research

Discussion in 'Wi-Fi' started by mingot, Sep 12, 2009.

  1. Bond697

    Bond697 Dies, died, will die.
    is a Pokemon Researcher

    Joined:
    Jun 20, 2010
    Messages:
    307
    there is 1 main breeding routine in b/w and(in white), it's at 21C390C:

    Show Hide
    Code:
    021C390C B5F8     push    {r3-r7,r14}                        ;1N+1ND+5SD
    021C390E B0A6     add     sp,-#0x98                          ;1S
    021C3910 1C05     mov     r5,r0                              ;1S
    021C3912 982C     ldr     r0,[sp,#0xB0]                      ;1S+1ND+1I
    021C3914 AF01     add     r7,sp,#0x4                         ;1S
    021C3916 9002     str     r0,[sp,#0x8]                       ;1N+1ND
    021C3918 1C38     mov     r0,r7                              ;1S
    021C391A 1C0C     mov     r4,r1                              ;1S
    021C391C 1C16     mov     r6,r2                              ;1S
    021C391E 9301     str     r3,[sp,#0x4]                       ;1N+1ND
    021C3920 F000F87A bl      #0x21C3A18                         ;1N+3S
    021C3924 1C38     mov     r0,r7                              ;1S
    021C3926 F000F899 bl      #0x21C3A5C                         ;1N+3S
    021C392A A803     add     r0,sp,#0xC                         ;1S
    021C392C F000F8B2 bl      #0x21C3A94                         ;1N+3S
    021C3930 1C38     mov     r0,r7                              ;1S
    021C3932 A903     add     r1,sp,#0xC                         ;1S
    021C3934 F000F8B8 bl      #0x21C3AA8                         ;1N+3S
    021C3938 1C38     mov     r0,r7                              ;1S
    021C393A A903     add     r1,sp,#0xC                         ;1S
    021C393C F000F8C2 bl      #0x21C3AC4                         ;1N+3S
    021C3940 1C38     mov     r0,r7                              ;1S
    021C3942 A903     add     r1,sp,#0xC                         ;1S
    021C3944 F000F8D6 bl      #0x21C3AF4                         ;1N+3S
    021C3948 1C38     mov     r0,r7                              ;1S
    021C394A A903     add     r1,sp,#0xC                         ;1S
    021C394C F000F8EA bl      #0x21C3B24                         ;1N+3S
    021C3950 1C38     mov     r0,r7                              ;1S
    021C3952 A903     add     r1,sp,#0xC                         ;1S
    021C3954 F000F8F6 bl      #0x21C3B44                         ;1N+3S
    021C3958 1C38     mov     r0,r7                              ;1S
    021C395A A903     add     r1,sp,#0xC                         ;1S
    021C395C F000F942 bl      #0x21C3BE4                         ;1N+3S
    021C3960 1C38     mov     r0,r7                              ;1S
    021C3962 A903     add     r1,sp,#0xC                         ;1S
    021C3964 F000F942 bl      #0x21C3BEC                         ;1N+3S
    021C3968 1C38     mov     r0,r7                              ;1S
    021C396A A903     add     r1,sp,#0xC                         ;1S
    021C396C F000F956 bl      #0x21C3C1C                         ;1N+3S
    021C3970 1C38     mov     r0,r7                              ;1S
    021C3972 A903     add     r1,sp,#0xC                         ;1S
    021C3974 F000F968 bl      #0x21C3C48                         ;1N+3S
    021C3978 1C38     mov     r0,r7                              ;1S
    021C397A A903     add     r1,sp,#0xC                         ;1S
    021C397C F000F988 bl      #0x21C3C90                         ;1N+3S
    021C3980 1C38     mov     r0,r7                              ;1S
    021C3982 A903     add     r1,sp,#0xC                         ;1S
    021C3984 F000F98C bl      #0x21C3CA0                         ;1N+3S
    021C3988 1C38     mov     r0,r7                              ;1S
    021C398A A903     add     r1,sp,#0xC                         ;1S
    021C398C 1C2A     mov     r2,r5                              ;1S
    021C398E F000F9D1 bl      #0x21C3D34                         ;1N+3S
    021C3992 1C38     mov     r0,r7                              ;1S
    021C3994 A903     add     r1,sp,#0xC                         ;1S
    021C3996 F000FA13 bl      #0x21C3DC0                         ;1N+3S
    021C399A 1C38     mov     r0,r7                              ;1S
    021C399C A903     add     r1,sp,#0xC                         ;1S
    021C399E 1C2A     mov     r2,r5                              ;1S
    021C39A0 F000FA2C bl      #0x21C3DFC                         ;1N+3S
    021C39A4 A803     add     r0,sp,#0xC                         ;1S
    021C39A6 1C29     mov     r1,r5                              ;1S
    021C39A8 F000FA52 bl      #0x21C3E50                         ;1N+3S
    021C39AC 1C38     mov     r0,r7                              ;1S
    021C39AE A903     add     r1,sp,#0xC                         ;1S
    021C39B0 F000FA64 bl      #0x21C3E7C                         ;1N+3S
    021C39B4 1C38     mov     r0,r7                              ;1S
    021C39B6 A903     add     r1,sp,#0xC                         ;1S
    021C39B8 F000FADE bl      #0x21C3F78                         ;1N+3S
    021C39BC 1C38     mov     r0,r7                              ;1S
    021C39BE A903     add     r1,sp,#0xC                         ;1S
    021C39C0 F000FB0A bl      #0x21C3FD8                         ;1N+3S
    021C39C4 1C20     mov     r0,r4                              ;1S
    021C39C6 A903     add     r1,sp,#0xC                         ;1S
    021C39C8 F000FB32 bl      #0x21C4030                         ;1N+3S
    021C39CC 1C38     mov     r0,r7                              ;1S
    021C39CE A903     add     r1,sp,#0xC                         ;1S
    021C39D0 F000FB34 bl      #0x21C403C                         ;1N+3S
    021C39D4 1C38     mov     r0,r7                              ;1S
    021C39D6 A903     add     r1,sp,#0xC                         ;1S
    021C39D8 F000FB36 bl      #0x21C4048                         ;1N+3S
    021C39DC A803     add     r0,sp,#0xC                         ;1S
    021C39DE F000FB5D bl      #0x21C409C                         ;1N+3S
    021C39E2 1C38     mov     r0,r7                              ;1S
    021C39E4 A903     add     r1,sp,#0xC                         ;1S
    021C39E6 1C2A     mov     r2,r5                              ;1S
    021C39E8 F000FB92 bl      #0x21C4110                         ;1N+3S
    021C39EC 1C38     mov     r0,r7                              ;1S
    021C39EE A903     add     r1,sp,#0xC                         ;1S
    021C39F0 F000FBC2 bl      #0x21C4178                         ;1N+3S
    021C39F4 1C38     mov     r0,r7                              ;1S
    021C39F6 A903     add     r1,sp,#0xC                         ;1S
    021C39F8 1C2A     mov     r2,r5                              ;1S
    021C39FA F000FC29 bl      #0x21C4250                         ;1N+3S
    021C39FE 1C38     mov     r0,r7                              ;1S
    021C3A00 A903     add     r1,sp,#0xC                         ;1S
    021C3A02 F000FC67 bl      #0x21C42D4                         ;1N+3S
    021C3A06 982D     ldr     r0,[sp,#0xB4]                      ;1S+1ND+1I
    021C3A08 A903     add     r1,sp,#0xC                         ;1S
    021C3A0A 1C22     mov     r2,r4                              ;1S
    021C3A0C 1C33     mov     r3,r6                              ;1S
    021C3A0E 9500     str     r5,[sp]                            ;1N+1ND
    021C3A10 F000FCA2 bl      #0x21C4358                         ;1N+3S
    021C3A14 B026     add     sp,#0x98                           ;1S
    021C3A16 BDF8     pop     {r3-r7,r15}                        ;1N+2S+1ND+5SD+1I
    


    anything anyone could ever want to know is in there. it includes international breeding (a for-loop that runs 6 times with 6 rng advancements and 6 shiny pid checks, etc) and all quirks of the system.
  2. Bond697

    Bond697 Dies, died, will die.
    is a Pokemon Researcher

    Joined:
    Jun 20, 2010
    Messages:
    307
    something i've been thinking about for awhile: i'm pretty sure that keypresses don't affect timer0 at all in gen 5, and i just wanted to demonstrate why i think so.

    first, let's start with the code:

    parameter fetch (open)
    Code:
    RAM:02088180 ; S U B R O U T I N E =======================================
    RAM:02088180
    RAM:02088180
    RAM:02088180 getParams__                             ; CODE XREF: Seed.Create__+14p
    RAM:02088180                                         ; sub_20595A0+14p
    RAM:02088180                 STMFD   SP!, {R4-R6,LR}
    RAM:02088184                 LDR     R1, VCOUNT      ; VCOUNT @ =0x4000006
    RAM:02088188                 MOV     R5, R0
    RAM:0208818C                 LDRH    R6, [R1]           ; *VCOUNT into R6
    RAM:02088190                 LDR     R4, =0x2FFFC00 ; base value used for grabbing loads of values
    RAM:02088194                 BL      getTimer0__
    RAM:02088198                 ORR     R0, R0, R6,LSL#16 ;(*VCOUNT << 16) | *timer0
    RAM:0208819C                 STR     R0, [R5]
    RAM:020881A0                 LDR     R0, =0x2151358
    RAM:020881A4                 LDRH    R1, [R4,#0xF8]
    RAM:020881A8                 LDR     R2, [R0]
    RAM:020881AC                 LDR     R3, [R0,#4]
    RAM:020881B0                 EOR     R1, R2, R1,LSL#16
    RAM:020881B4                 STR     R1, [R5,#4]
    RAM:020881B8                 LDR     R2, [R0]
    RAM:020881BC                 LDR     R2, GxStat           ; GxStat @ =0x4000600
    RAM:020881C0                 LDR     R1, [R0,#4]
    RAM:020881C4                 LDR     R0, [R4,#0xF4]
    RAM:020881C8                 LDR     R3, [R4,#0x3C]
    RAM:020881CC                 EOR     R0, R1, R0
    RAM:020881D0                 EOR     R3, R3, R0
    RAM:020881D4                 STR     R3, [R5,#8]
    RAM:020881D8                 LDR     R1, [R2]
    RAM:020881DC                 ADD     R0, R4, #0x300
    RAM:020881E0                 EOR     R1, R3, R1
    RAM:020881E4                 STR     R1, [R5,#8]
    RAM:020881E8                 LDR     R1, [R4,#0x1E8] ; grab the date
    RAM:020881EC                 SUB     R2, R2, #0x4D0  ; gxstat(4000600)-4D0 = 4000130(gba-compatible controller input)
    RAM:020881F0                 STR     R1, [R5,#0xC]
    RAM:020881F4                 LDR     R3, [R4,#0x1EC] ; grab the time
    RAM:020881F8                 ADD     R1, R4, #0x3A8  ; 2FFFFA8 - nds-compatible input
    RAM:020881FC                 STR     R3, [R5,#0x10]
    RAM:02088200                 LDRH    R12, [R0,#0x94]
    RAM:02088204                 LDR     R3, [R4,#0x390]
    RAM:02088208                 EOR     R3, R3, R12,LSL#16
    RAM:0208820C                 STR     R3, [R5,#0x14]
    RAM:02088210                 LDRH    R4, [R0,#0xAA]
    RAM:02088214                 LDRH    R3, [R0,#0xAC]
    RAM:02088218                 ORR     R3, R3, R4,LSL#16
    RAM:0208821C                 STR     R3, [R5,#0x18]
    RAM:02088220                 LDRH    R2, [R2]        ; get gba-compatible input
    RAM:02088224                 LDRH    R1, [R1]        ; get nds-only input
    RAM:02088228                 LDRH    R3, [R0,#0x98]
    RAM:0208822C                 ORR     R0, R2, R1      ; OR the inputs together to make 1 number: (3FF | 2C00) = 2FFF, etc
    RAM:02088230                 ORR     R0, R0, R3,LSL#16
    RAM:02088234                 STR     R0, [R5,#0x1C]
    RAM:02088238                 LDMFD   SP!, {R4-R6,PC}
    RAM:02088238 ; End of function getParams__
    RAM:02088238
    RAM:02088238 ; ---------------------------------------------------------------------------
    RAM:0208823C dword_208823C   DCD                     ; DATA XREF: getParams__+4r
    RAM:02088240 dword_2088240   DCD 0x2FFFC00           ; DATA XREF: getParams__+10r
    RAM:02088244 dword_2088244   DCD 0x2151358           ; DATA XREF: getParams__+20r
    RAM:02088248 dword_2088248   DCD                     ; DATA XREF: getParams__+3Cr
    RAM:0208824C
    


    ok, now have a look up at the top.

    timer0 is grabbed at 2088194. keypress data isn't retrieved until 2088220 and 2088224. when it is retrieved, there is no reading of hardware involved. it simply grabs the values at 4000130 and 2FFFFA8, ORs them, and continues.

    i could see making an argument for it being affected if the arm9 processor(that is running this routine) was the same one reading the scankeys() data in and setting those registers. maybe having keys pressed would slow it down then. however, the data retrieved from scankeys() is read/interpreted by the arm7 processor and then set up in the i/o registers for the arm9 cpu to read. it's just grabbing the value and running with it, not doing any interpretation of the data from the hardware.

    i know people have said that they seem to be affected by certain keypresses or whatever, but it just doesn't seem like it's possible.
  3. Bond697

    Bond697 Dies, died, will die.
    is a Pokemon Researcher

    Joined:
    Jun 20, 2010
    Messages:
    307
    the chance of a random battle with no modifier in play is 8%. it becomes a 16% chance with illuminate. now, if you get into a battle on one square and step into an adjacent square where you can also get into a battle,(i.e. get into a fight on grass, take a step into a patch of grass) you will have a 1% chance of a fight, regardless of the modifiers involved. they are all ignored. apparently they were trying to be nice and keep step-battle, step-battle, step-battle rpg annoyance out of it.

    might as well show what i was seeing:

    Code:
    021AA438 2401     mov     r4,#0x1                            ;1S              // compare value for battle test(1 here because i just got out of another battle)
    021AA43A F000F961 bl      #0x21AA700                         ;1N+3S
    
    (not gonna bother pasting the rng advancement or divmod in here again)
    021AA700 B508     push    {r3,r14}                           ;1N+1ND+1SD
    021AA702 4804     ldr     r0,=#0xFFFF                        ;1S+1ND+1I  // this event value gives you (u32 >> 16) -1
    021AA704 F65AFFF2 bl      #0x20056EC                         ;1N+3S     // u32_t rng.event(u32_t event)
    021AA708 2129     mov     r1,#0x29                           ;1S             // set up the divmod
    021AA70A 0109     lsl     r1,r1,#0x4                         ;1S               // here too, same calc as ESV
    021AA70C F6F1EDDC blx     #0x209C2C8                         ;1N+3S   // unsigned divmod
    021AA710 BD08     pop     {r3,r15}                           ;1N+2S+1ND+1SD+1I  // done and heading back
    
    021AA43E 42A0     cmp     r0,r4                              ;1S                result of ((u32 * FFFF) >> 32) / 0x290 compared against the percent chance of an encounter.  8 normally, 0x10 for iluminate, 1 for a post-battle step
    021AA440 D801     bhi     #0x21AA446                         ;1N+2S
    021AA442 2001     mov     r0,#0x1                            ;1S // return 1 if a battle is set
    021AA444 BD10     pop     {r4,r15}                           ;1N+2S+1ND+1SD+1I
    021AA446 2000     mov     r0,#0x0                            ;1S
    021AA448 BD10     pop     {r4,r15}                           ;1N+2S+1ND+1SD+1I
    
  4. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    Emerald Eggs

    I used a vblank removed version, so there may be a blank in between the Initial and Decision as I had one in my R/S Egg PID post. For this post, UpperLower is the format of the egg PID.

    No Everstone Used
    Code:
    [U]The lower half is generated just like RS[/U]
    
    0 - Initial
    1 - Decision (same as RS), if (((SEED) & 0xFFFF) * 0x64) / 0xFFFF < Ratio
    2 - LowerPID (same as RS), ((SEED) & 0xFFFF) + 0x1)
    Code:
    [U]The Upper half is is actually set in Emerald[/U] 
    
    using 0x030022E4, a 16bit delay/frame counter/timer whatever.
    
    Game needs an upper half of egg PID?
      -> Grab Value (Initial +1, having it frozen to initial) 
      -> Advanced once with PRNG to get "magic number"
      -> MagicNumber &0xFFFF (get u16)
      -> Set result as Upper16 of the EggPID.
      -> Put magic number next to the PRNG magic number for whatever reason.

    Eggs generated with Everstones
    Code:
    PRNG[0]   -   Initial
    PRNG[1]   -   Decision
    PRNG[2]   -   Everstone
    PRNG[3]   -   LPID#1, (SEED & 0xFFFF), there isn't a +1 here.
    
    Take the timer, +1, advance it once, and get that value.
    tRNG[0]   -   Timer Value, +1
    tRNG[1]   -   UPID#1
    
    UPID#N_LPID#N = TempPID#N
    For our first iteration we have TempPID#1, (N=1)
    
    TempPID#N % 0x19 == nature of female Pokemon holding Everstone. 
         Else, generate a new TempPID (N=N+1)
    
    Repeat TempPID and check until the % 0x19 matches the Everstone Nature.
    
    Simple Formula for calculating TempPIDs
    TempPID#N: tRNG[N] and PRNG[2+N]

    Code:
    Test Case (Example)
    
    Everstone Nature: Impish
    PRNG[0] =   0xCFB8227E
      PRNG[1] Pass Decision  -- set up timer
    tRNG[0] =    0x0001 +1
      PRNG[2] Pass Everstone -- enable loop until true.
    
    TempPID#1 : tRNG[1]  and PRNG[2+1] -- fail
    ................... more fails
    TempPID#39: tRNG[39] and PRNG[2+39]
        tRNG[39] =  0x[U]362C[/U][size=1]C473[/size]
        PRNG[41] =  0x[U]DFC5[/U][size=1]56E1[/size]
            TempPID#39 = 0x362CDFC5, % 0x19 = 8 (Impish), pass
          set TempPID as the FinalPID
    EverstoneCalc = leftmost bit
    If the calc fails, I assume it just generates the first TempPID and sets it as the final as there is no loop enabled.
    Nature Table (open)
    0 Hardy
    1 Lonely
    2 Brave
    3 Adamant
    4 Naughty
    5 Bold
    6 Docile
    7 Relaxed
    8 Impish
    9 Lax
    10 Timid
    11 Hasty
    12 Serious
    13 Jolly
    14 Naive
    15 Modest
    16 Mild
    17 Quiet
    18 Bashful
    19 Rash
    20 Calm
    21 Gentle
    22 Sassy
    23 Careful
    24 Quirky
  5. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    Somewhat separate thought, but the Emerald PID creation was the cause of the Spinda PID craze. Japanese RNGers would have a Spinda breed (70% chance) to find the offset of PRNG frames relative to the Timer, so that they could estimate and predict frames to aim for for shiny egg PIDs. According to a few posts, the difference between the frame and timer value was ~28 (29 and 30 sparsely, caused by vblanks).

    Breed Spindas, find two halves of PID, find the seeds you hit and the difference between them! So with that it shouldn't be hard to predict egg PIDs once you calibrate for it.

    ==

    Emerald Egg Calibration

    1. Deposit Spinda and Ditto. Use different IDs if you can. Walk 254 steps by counting with repels.
    2. Save.
    3. Soft reset, enter game (quickly) and walk steps to trigger the 255 stepcounter Egg Decision.
    4. See if an egg has been generated.
      • If there is an egg, go get it and hatch it.
      • If not, soft reset and go back to step 3.
    5. Deduce Spinda PID with Spinda Painter.
    6. Using eepid.exe, enter the Decimal PID from the previous step, using a Min/Max of 400-2000.
    7. Observe results.
      • You can repeat by just going back to step 3.
    8. Exit eepid.exe when you are done.


    Test Results (English Emerald):

    Code:
    Zari:      0xBF1ED064 (497/521)   = 24 (English & Red GBA)
    Zari:      0x3CA4525B (503/527)   = 24 (English & Onyx GBA)
    Zari:      0x01F71C18 (506/530)   = 24 (English & Onyx GBA)
    Supe:      0x0014BA75 (541/561)   = 20 (Emulator)
    Supe:      0x88D62D18 (582/602)   = 20 (Emulator)
    Supe:      0xBA878D50 (610/630)   = 20 (Emulator)
    Supe:      0x3E133CBD (612/632)   = 20 (Emulator)
    Nexus:     0xE4AAA5DF (778/797)   = 19 (NDS)
    Kaphotics: 0x962101D5 (878/897)   = 19 (Emulator)
    Supe:      0x8ACD923E (1088/1108) = 20 (Emulator)
    Nexus:     0xD3ADCEAE (1093/1112) = 19 (NDS)
    Discrepancies can be caused by Roaming Pokemon still roaming (the game has to determine where they are so it chews a frame at the start, +1), so it's best to calibrate yourself.
  6. Bond697

    Bond697 Dies, died, will die.
    is a Pokemon Researcher

    Joined:
    Jun 20, 2010
    Messages:
    307
    redownload eepid, fixed it up some more.
  7. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    Emerald Egg PID Prediction

    Use EmeraldEggPID.xlsm (spreadsheet)
    eepid.exe

    Calibrate and put in your Calibration. The spreadsheet is tuned to use the Calibration so that you can actually see your calibrations on the frame you were told! (use the lower "Test" result). ID/SID optional, only if you want to see where you have shinies.

    Bam, spits out the Frame, PID, Nature, Ability, GV, PID%6, Hittability, and Shiny depending on the Decision. You can filter everything you'd want in an egg.

    The spreadsheet is for the first ~2.7 minutes.

    [​IMG]

    Example with old version &amp; Zari's Calibrations (open)
    Code:
    Zari:      0x3CA4525B (503/527)   = 24 (English & Onyx GBA)
    Zari:      0x01F71C18 (506/530)   = 24 (English & Onyx GBA)
    [​IMG]


    Everstone prediction is essentially impossible in Excel due to large number rounding, however using an Everstone would be the best way for someone to use existing IDs for a shiny PID.

    If you want more than 2.7 minutes of prediction, output more PRNG from researcher and extend the hidden columns to your desired frame count.
  8. Bond697

    Bond697 Dies, died, will die.
    is a Pokemon Researcher

    Joined:
    Jun 20, 2010
    Messages:
    307
  9. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    XD PKM Structure

    So I was digging through Dolphin's RAM to try to find my Pokemon, and managed to find this structure. I had Cheat Engine attach to Dolphin's process, and just copypasted with the XX byte view. This might be problematic because of endianness.

    This may not look like typical Research, but the structure is how the game uses the data. It will help us understand how the game gets the data to begin with.

    Show Hide
    [​IMG]


    Basing off of these 5 Pokemon in my party, here's the HEX structure of XDPKM. There are missing things like obedience flag etc, which I obviously can't check.

    Code:
    0x00 - 0x01:   Species
    0x02 - 0x03:   Unused
    0x04 - 0x05:   Current HP
    0x06 - 0x07:   Happiness (2 bytes)
    0x08 - 0x09:   ??? (00 or 0B)
    0x0A - 0x0B:   Unused
    0x0C - 0x0D:   Unused
    0x0E - 0x0F:   Level Obtained & Pokeball Type(?)
    0x10 - 0x11:   Current Level
    0x12 - 0x13:   Unused
    0x14 - 0x15:   Intro Data Closer (00 and FF)
    0x16 - 0x17:   Unused
    0x18 - 0x19:   Unused
    0x1A - 0x1B:   ??? (00 and X8) [gender?]
    0x1C - 0x1D:   ???
    0x1E - 0x1F:   ???
    0x20 - 0x21:   Unused
    0x22 - 0x23:   ???
    0x24 - 0x25:   Secret ID
    0x26 - 0x27:   Trainer ID
    0x28 - 0x2B:   PID.... Vaporeon is Jolly! (0D)
    0x2C - 0x2F:   Unused
    0x30 - 0x38:   ????????????
    0x39 - 0x4D:   OT Namefield
    0x4E - 0x79:   2x Name Field (22 bytes *2)
    0x7A - 0x7B:    ???
    0x7C - 0x7D:   Ribbons (Bitflags)
    0x7E - 0x7F:   ???
    0x80 - 0x81:   Move 1
    0x82 - 0x83:   Move 1 PP
    0x84 - 0x85:   Move 2
    0x86 - 0x87:   Move 2 PP
    0x88 - 0x89:   Move 3
    0x8A - 0x8B:   Move 3 PP
    0x8C - 0x8D:   Move 4
    0x8E - 0x8F:   Move 4 PP
    0x90 - 0x91:   HP Stat
    0x92 - 0x93:   Atk Stat
    0x94 - 0x95:   Def Stat
    0x96 - 0x97:   SpA Stat
    0x98 - 0x99:   SpD Stat
    0x9A - 0x9B:   SpE Stat
    0x9C - 0x9D:   HP EV
    0x9E - 0x9F:   Atk EV
    0xA0 - 0xA1:   Def EV
    0xA2 - 0xA3:   SpA EV   <--not sure on the ordering 
    0xA4 - 0xA5:   SpD EV        of these, didnt keep track
    0xA6 - 0xA7:   SpE EV
    0xA8           HP IV
    0xA9           Atk IV
    0xAA           Def IV
    0xAB           SpA IV   <--not sure on the ordering
    0xAC           SpD IV        of these, didnt keep track
    0xAD           SpE IV
    0xAE - 0xAF:   Unused
    0xB0 - 0xB9:   Unused
    0xBA - 0xBB:   ???
    0xBC - 0xBD:   ???
    0xBE - 0xBF:   ???
    0xC0 - 0xC1:   Unused
    0xC2 - 0xC3:   Party Identify (2 leads 00, Backup 01)
    A total of 194 bytes for a Party XDPKM.

    Implications: IVs may be generated as single numbers one at a time, not using a chunk of hex like in Gens 3/4.

    Hex Table of Move / PKM / Item (open)
    Code:
    Moves
    -----
    0000 - No Move 
    0001 - Pound 
    0002 - Karate Chop 
    0003 - Double Slap 
    0004 - Comet Punch 
    0005 - Mega Punch 
    0006 - Payday 
    0007 - Fire Punch 
    0008 - Ice Punch 
    0009 - Thunder Punch 
    000A - Scratch 
    000B - Vice Grip 
    000C - Guillotine 
    000D - Razor Wind 
    000E - Swords Dance 
    000F - Cut 
    0010 - Gust 
    0011 - Wing Attack 
    0012 - Whirlwind 
    0013 - Fly 
    0014 - Bind 
    0015 - Slam 
    0016 - Vine Whip 
    0017 - Stomp 
    0018 - Double Kick 
    0019 - Mega Kick 
    001A - Jump Kick 
    001B - Rolling Kick 
    001C - Sand Attack 
    001D - Headbutt 
    001E - Horn Attack 
    001F - Fury Attack 
    0020 - Horn Drill 
    0021 - Tackle 
    0022 - Body Slam 
    0023 - Wrap 
    0024 - Take Down 
    0025 - Thrash 
    0026 - Double Edge 
    0027 - Tail Whip 
    0028 - Poison Sting 
    0029 - Twineedle 
    002A - Pin Missile 
    002B - Leer 
    002C - Bite 
    002D - Growl 
    002E - Roar 
    002F - Sing 
    0030 - Super Sonic 
    0031 - Sonicboom 
    0032 - Disable 
    0033 - Acid 
    0034 - Ember 
    0035 - Flamethrower 
    0036 - Mist 
    0037 - Water Gun 
    0038 - Hydro Pump 
    0039 - Surf 
    003A - Ice Beam 
    003B - Blizzard 
    003C - Psybeam 
    003D - BubbleBeam 
    003E - Aurora Beam 
    003F - Hyper Beam 
    0040 - Peck 
    0041 - Drill Peck 
    0042 - Submission 
    0043 - Low Kick 
    0044 - Counter 
    0045 - Seismic Toss 
    0046 - Strength 
    0047 - Absorb 
    0048 - Mega Drain 
    0049 - Leech Seed 
    004A - Growth 
    004B - Razor Leaf 
    004C - Solarbeam 
    004D - Poisonpowder 
    004E - Stun Spore 
    004F - Sleep Powder 
    0050 - Petal Dance 
    0051 - String Shot 
    0052 - Dragon Rage 
    0053 - Fire Spin 
    0054 - Thunder Shock 
    0055 - Thunder Bolt 
    0056 - Thunder Wave 
    0057 - Thunder 
    0058 - Rock Throw 
    0059 - Earthquake 
    005A - Fissure 
    005B - Dig 
    005C - Toxic 
    005D - Confusion 
    005E - Psychic 
    005F - Hypnosis 
    0060 - Meditate 
    0061 - Agillity 
    0062 - Quick Attack 
    0063 - Rage 
    0064 - Teleport 
    0065 - Night Shade 
    0066 - Mimic 
    0067 - Screech 
    0068 - Double Team 
    0069 - Recover 
    006A - Harden 
    006B - Minimize 
    006C - Smokescreen 
    006D - Confuse Ray 
    006E - Withdraw 
    006F - Defense Curl 
    0070 - Barrier 
    0071 - Light Screen 
    0072 - Haze 
    0073 - Reflect 
    0074 - Focus Energy 
    0075 - Bide 
    0076 - Metronome 
    0077 - Mirror Move 
    0078 - Selfdestruct 
    0079 - Egg Bomb 
    007A - Lick 
    007B - Smog 
    007C - Sludge 
    007D - Bone Club 
    007E - Fire Blast 
    007F - Waterfall 
    0080 - Clamp 
    0081 - Swift 
    0082 - Skull Bash 
    0083 - Spike Cannon 
    0084 - Constrict 
    0085 - Amnesia 
    0086 - Kinesis 
    0087 - Softboiled 
    0088 - Hi Jump Kick 
    0089 - Glare 
    008A - Dream Eater 
    008B - Poison Gas 
    008C - Barrage 
    008D - Leech Life 
    008E - Lovely Kiss 
    008F - Sky Attack 
    0090 - Transform 
    0091 - Bubble 
    0092 - Dizzy Punch 
    0093 - Spore 
    0094 - Flash 
    0095 - Psywave 
    0096 - Splash 
    0097 - Acid Armour 
    0098 - Crabhammer 
    0099 - Explosion 
    009A - Fury Swipes 
    009B - Bonemerang 
    009C - Rest 
    009D - Rock Slide 
    009E - Hyper Fang 
    009F - Sharpen 
    00A0 - Conversion 
    00A1 - Tri Attack 
    00A2 - Super Fang 
    00A3 - Slash 
    00A4 - Substitute 
    00A5 - Struggle 
    00A6 - Sketch 
    00A7 - Triple Kick 
    00A8 - Theif 
    00A9 - Spider Web 
    00AA - Mind Reader 
    00AB - Nightmare 
    00AC - Flame Wheel 
    00AD - Snore 
    00AE - Curse 
    00AF - Flail 
    00B0 - Conversion 2 
    00B1 - Arrowblast 
    00B2 - Cotton Spore 
    00B3 - Reversal 
    00B4 - Spite 
    00B5 - Power Snow 
    00B6 - Protect 
    00B7 - Mock Punch 
    00B8 - Scary Face 
    00B9 - Faint Attack 
    00BA - Sweet Kiss 
    00BB - Belly Drum 
    00BC - Sludge Bomb 
    00BD - Mud-Slap 
    00BE - Octazooka 
    00BF - Spikes 
    00C0 - Zap Cannon 
    00C1 - Foresight 
    00C2 - Destiny Bond 
    00C3 - Perish Song 
    00C4 - Icy Wind 
    00C5 - Detect 
    00C6 - Bone Rush 
    00C7 - Lock-On 
    00C8 - Outrage 
    00C9 - Sandstorm 
    00CA - Giga Drain 
    00CB - Indure 
    00CC - Charm 
    00CD - Rollout 
    00CE - False Swipe 
    00CF - Swagger 
    00D0 - Mild Drink 
    00D1 - Spark 
    00D2 - Fury Cutter 
    00D3 - Steel Wing 
    00D4 - Mean Look 
    00D5 - Attract 
    00D6 - Sleep Talk 
    00D7 - Heal Bell 
    00D8 - Return 
    00D9 - Present 
    00DA - Frustration 
    00DB - Safeguard 
    00DC - Pain Split 
    00DD - Sacred Fire 
    00DE - Magnitude 
    00DF - Dynamicpunch 
    00E0 - Megahorn 
    00E1 - Dragonbreath 
    00E2 - Baton Pass 
    00E3 - Encore 
    00E4 - Persuit 
    00E5 - Rapid Spin 
    00E6 - Sweet Scent 
    00E7 - Iron Tail 
    00E8 - Metal Claw 
    00E9 - Vital Throw 
    00EA - Morning Sun 
    00EB - Synthesis 
    00EC - Moonlight 
    00ED - Hidden Power 
    00EE - Cross Chop 
    00EF - Twister 
    00F0 - Rain Dance 
    00F1 - Sunny Day 
    00F2 - Crunch 
    00F3 - Mirror Coat 
    00F4 - Psych Up 
    00F5 - Extremespeed 
    00F6 - Ancientpower 
    00F7 - Shadow Ball 
    00F8 - Future Sight 
    00F9 - Rock Smash 
    00FA - Whirlpool 
    00FB - Beat Up 
    00FC - Fake Out 
    00FD - Uproar 
    00FE - Stockpile 
    00FF - Spit Up 
    0100 - Swallow 
    0101 - Heat Wave 
    0102 - Hail 
    0103 - Torment 
    0104 - Flatter 
    0105 - Will-O-Wisp 
    0106 - Memento 
    0107 - Facade 
    0108 - Focus Punch 
    0109 - Smellingsalt 
    010A - Follow Me 
    010B - Nature Power 
    010C - Charge 
    010D - Taunt 
    010E - Helping Hand 
    010F - Trick 
    0110 - Role Play 
    0111 - Wish 
    0112 - Assist 
    0113 - Ingrain 
    0114 - Superpower 
    0115 - Magic Coat 
    0116 - Recycle 
    0117 - Revenge 
    0118 - Brick Break 
    0119 - Yawn 
    011A - Knock Off 
    011B - Endeavor 
    011C - Eruption 
    011D - Skill Swap 
    011E - Imprison 
    011F - Refresh 
    0120 - Grudge 
    0121 - Snatch 
    0122 - Secret Power 
    0123 - Dive 
    0124 - Arm Thrust 
    0125 - Camoflage 
    0126 - Tail Glow 
    0127 - Luster Purge 
    0128 - Mist Ball 
    0129 - Featherdance 
    012A - Teeter Dance 
    012B - Blaze Kick 
    012C - Mud Sport 
    012D - Ice Ball 
    012E - Needle Arm 
    012F - Slack Off 
    0130 - Hyper Voice 
    0131 - Poison Fang 
    0132 - Crush Claw 
    0133 - Blast Burn 
    0134 - Hydro Cannon 
    0135 - Meteor Mash 
    0136 - Astonish 
    0137 - Weather Ball 
    0138 - Aromatherepy 
    0139 - Fake Tears 
    013A - Aur Cutter 
    013B - Overheat 
    013C - Odor Sleuth 
    013D - Rock Tomb 
    013E - Silver Wind 
    013F - Metal Sound 
    0140 - Grasswhistle 
    0141 - Tickle 
    0142 - Cosmic Power 
    0143 - Water Spout 
    0144 - Signal Beam 
    0145 - Shadow Punch 
    0146 - Extrasensory 
    0147 - Sky Uppercut 
    0148 - Sand Tomb 
    0149 - Sheer Cold 
    014A - Muddy Water 
    014B - Bullet Seed 
    014C - Aerial Ace 
    014D - Icicle Spear 
    014E - Iron Defence 
    014F - Block 
    0150 - Howl 
    0151 - Dragon Claw 
    0152 - Frenzy Plant 
    0153 - Bulk Up 
    0154 - Bounce 
    0155 - Mud Shot 
    0156 - Poison Tail 
    0157 - Covet 
    0158 - Volt Tackle 
    0159 - Magical Leaf 
    015A - Water Sport 
    015B - Calm Mind 
    015C - Leaf Blade 
    015D - Dragon Dance 
    015E - Rock Blast 
    015F - Shock Wave 
    0160 - Water Pulse 
    0161 - Doom Desire 
    0162 - Psycho Boost 
    0163 - No Move 
    
    Pokemon
    -------
    
    *put 2 zero's in front of 2 digits and 1 zero in front of 3 digits*
    
    01 - Bulbasaur
    02 - Ivysaur
    03 - Venusaur
    04 - Charmander
    05 - Charmeleon
    06 - Charizard
    07 - Squirtle
    08 - Wartortle
    09 - Blastoise
    0A - Caterpie
    0B - Metapod
    0C - Butterfree
    0D - Weedle
    0E - Kakuna
    0F - Beedrill
    10 - Pidgey
    11 - Pidgeotto
    12 - Pidgeot
    13 - Rattata
    14 - Raticate
    15 - Spearow
    16 - Fearow
    17 - Ekans
    18 - Arbok
    19 - Pikachu
    1A - Raichu
    1B - Sandshrew
    1C - Sandslash
    1D - Nidoran (F)
    1E - Nidorina
    1F - Nidoqueen
    20 - Nidoran male
    21 - Nidorino
    22 - Nidoking
    23 - Clefairy
    24 - Clefable
    25 - Vulpix
    26 - Ninetails
    27 - Jigglypuff
    28 - Wigglytuff
    29 - Zubat
    2A - Golbat
    2B - Oddish
    2C - Gloom
    2D - Vileplume
    2E - Paras
    2F - Parasect
    30 - Venonat
    31 - Venomoth
    32 - Diglett
    33 - Dugtrio
    34 - Meowth
    35 - Persian
    36 - Psyduck
    37 - Golduck
    38 - Mankey
    39 - Primeape
    3A - Growlithe
    3B - Arcanine
    3C - Poliwag
    3D - Poliwhirl
    3E - Poliwrath
    3F - Abra
    40 - Kadabra
    41 - Alakazam
    42 - Machop
    43 - Machoke
    44 - Machamp
    45 - Bellsprout
    46 - Weepinbell
    47 - Victreebell
    48 - Ventacool
    49 - Tentacruel
    4A - Geodude
    4B - Graveler
    4C - Golem
    4D - Ponyta
    4E - Rapidash
    4F - Slowpoke
    50 - Slowbro
    51 - Magnemite
    52 - Magneton
    53 - Farfetch'd
    54 - Doduo
    55 - Dodrio
    56 - Seel
    57 - Dewgong
    58 - Grimer
    59 - Muk
    5A - Shellder
    5B - Cloyster
    5C - Gastly
    5D - Haunter
    5E - Gengar
    5F - Onix
    60 - Drowzee
    61 - Hypno
    62 - Krabby
    63 - Kingler
    64 - Voltorb
    65 - Electrode
    66 - Exeggcute
    67 - Exeggcutor
    68 - Cubone
    69 - Marowak
    6A - Hitmonlee
    6B - Hitmonchan
    6C - Lickitung
    6D - Koffing
    6E - Weezing
    6F - Rhyhorn
    70 - Rhydon
    71 - Chansey
    72 - Tangela
    73 - Kangaskhan
    74 - Horsea
    75 - Seadra
    76 - Goldeen
    77 - Seaking
    78 - Staryu
    79 - Starmie
    7A - Mr. Mime
    7B - Scyther
    7C - Jynx
    7D - Electabuzz
    7E - Magmar
    7F - Pinsir
    80 - Tauros
    81 - Magikarp
    82 - Gyarados
    83 - Lapras
    84 - Ditto
    85 - Eevee
    86 - Vaporeon
    87 - Jolteon
    88 - Flareon
    89 - Porygon
    8A - Omanyte
    8B - Omastar
    8C - Kabuto
    8D - Kabutops
    8E - Aerodactyl
    8F - Snorlax
    90 - Articunno
    91 - Zapdos
    92 - Moltres
    93 - Dratini
    94 - Dragonair
    95 - Dragonite
    96 - Mewtwo
    97 - Mew
    
    98 - Chikorita
    99 - Bayleef
    9A - Meganium
    9B - Cyndaquil
    9C - Quilava
    9D - Typhlosion
    9E - Totodile
    9F - Croconaw
    A0 - Feraligatr
    A1 - Sentret
    A2 - Furret
    A3 - Hoothoot
    A4 - Noctowl
    A5 - Ledyba
    A6 - Ledian
    A7 - Spinarak
    A8 - Ariados
    A9 - Crobat
    AA - Chinchou
    AB - Lanturn
    AC - Pichu
    AD - Cleffa
    AE - Igglybuff
    AF - Togepi
    B0 - Togetic
    B1 - Natu
    B2 - Xatu
    B3 - Mareep
    B4 - Flaaffy
    B5 - Ampharos
    B6 - Bellossom
    B7 - Marill
    B8 - Azumarill
    B9 - Sudowoodo
    BA - Politoed
    BB - Hoppip
    BC - Skiploom
    BD - Jumpluff
    BE - Aipom
    BF - Sunkern
    C0 - Sunflora
    C1 - Yanma
    C2 - Wooper
    C3 - Quagsire
    C4 - Espeon
    C5 - Umbreon
    C6 - Murkrow
    C7 - Slowking
    C8 - Misdreavus
    C9 - Unown
    CA - Wobbuffet
    CB - Girafarig
    CC - Pineco
    CD - Forretress
    CE - Dunsparce
    CF - Gligar
    D0 - Steelix
    D1 - Snubbull
    D2 - Granbull
    D3 - Qwilfish
    D4 - Scizor
    D5 - Shuckle
    D6 - Heracross
    D7 - Sneasel
    D8 - Teddiursa
    D9 - Ursaring
    DA - Slugma
    DB - Magcargo
    DC - Swinub
    DD - Piloswine
    DE - Corsola
    DF - Remoraid
    E0 - Octillery
    E1 - Delibird
    E2 - Mantine
    E3 - Skarmory
    E4 - Houndour
    E5 - Houndoom
    E6 - Kingdra
    E7 - Phanpy
    E8 - Donphan
    E9 - Porygon2
    EA - Stantler
    EB - Smeargle
    EC - Tyrogue
    ED - Hitmontop
    EE - Smoochum
    EF - Elekid
    F0 - Magby
    F1 - Miltank
    F2 - Blissey
    F3 - Raikou
    F4 - Entei
    F5 - Suicune
    F6 - Larvitar
    F7 - Pupitar
    F8 - Tyranitar
    F9 - Lugia
    FA - Ho-oh
    FB - Celebi
    
    115 - Treecko
    116 - Grovyle
    117 - Sceptile
    118 - Torchic
    119 - Combusken
    11A - Blaziken
    11B - Mudkip
    11C - Marshtomp
    11D - Swampert
    11E - Poochyena
    11F - Mightyena
    120 - Zigzagoon
    121 - Linoone 
    122 - Wurmple
    123 - Silcoon
    124 - Beautifly
    125 - Cascoon
    126 - Dustox
    127 - Lotad
    128 - Lombre
    129 - Ludicolo
    12A - Seedot
    12B - Nuzleaf
    12C - Shiftry
    12D - Nincada
    12E - Ninjask
    12F - Shedinja
    130 - Taillow
    131 - Swellow
    132 - Shroomish
    133 - Breloom
    134 - Spinda
    135 - Wingull
    136 - Pelipper
    137 - Surskit
    138 - Masquerain
    139 - Wailmer
    13A - Wailord
    13B - Skitty
    13C - Delcatty
    13D - Kecleon
    13E - Baltoy
    13F - Claydol
    140 - Nosepass
    141 - Torkoal
    142 - Sableye
    143 - Barboach
    144 - Whiscash
    145 - Luvdisc
    146 - Corphish
    147 - Crawdaunt
    148 - Feebas
    149 - Milotic
    14A - Carvanha
    14B - Sharpedo
    14C - Trapinch
    14D - Vibrava
    14E - Flygon
    14F - Makuhita
    150 - Hariyama
    151 - Electrike
    152 - Manectric
    153 - Numel
    154 - Camerupt
    155 - Spheal
    156 - Sealeo
    157 - Walrein
    158 - Cacnea
    159 - Cacturne
    15A - Snorunt
    15B - Glalie
    15C - Lunatone
    15D - Solrock
    15E - Azuril
    15F - Spoink
    160 - Grumpig
    161 - Plusle
    162 - Minun
    163 - Mawile
    164 - Meditite
    165 - Medicham
    166 - Swablu
    167 - Altaria
    168 - Wynaut
    169 - Duskull
    16A - Dusclops
    16B - Roselia
    16C - Slakoth
    16D - Vigoroth
    16E - Slaking
    16F - Gulpin
    170 - Swalot
    171 - Tropius
    172 - Whismur
    173 - Loudred
    174 - Exploud
    175 - Clamperl
    176 - Huntail
    177 - Gorebyss
    178 - Absol
    179 - Shuppet
    17A - Banette
    17B - Seviper
    17C - Zangoose
    17D - Relicanth
    17E - Aron
    17F - Lairon
    180 - Aggron
    181 - Castform
    182 - Volbeat
    183 - Illumise
    184 - Lileep
    185 - Cradily
    186 - Anorith
    187 - Armaldo
    188 - Ralts 
    189 - Kirlia
    18A - Gardevoir
    18B - Bagon
    18C - Shellgon
    18D - Salamence
    18E - Beldum
    18F - Metang
    190 - Metagross
    191 - Regirock
    192 - Regice
    193 - Registeel
    194 - Kyogre 
    195 - Groudon 
    196 - Rayquaza 
    197 - Latias 
    198 - Latios 
    199 - Jirachi 
    19A - Deoxys 
    19B - Chimecho
    19D - Bonsly
    
    Items
    -----
    000D - Potion
    000E - Antidote
    000F - Burn Heal
    0010 - Ice Heal
    0011 - Awakening
    0012 - Parlyz Heal
    0013 - Full Restor
    0014 - Max Potion
    0015 - Hyper Potio
    0016 - Super Potio
    0017 - Full Heal
    0018 - Revive
    0019 - Max Revive
    001A - Fresh Water
    001B - Soda Pop
    001C - Lemonade
    001D - MooMoo Milk
    001E - Energy Powd
    001F - Energy Root
    0020 - Heal Powder
    0021 - Revival Her
    0022 - Ether
    0023 - Max Ether
    0024 - Elixer
    0025 - Max Elixer
    0026 - Lava Cookie
    0027 - Blue Flute
    0028 - Yellow Flut
    0029 - Red Flute
    002A - Black Flute
    002B - White Flute
    002C - Berry Juice
    002D - Sacred Ash
    002E - Shoal Salt
    002F - Shoal Shell
    0030 - Red Shard
    0031 - Blue Shard
    0032 - Yellow Shard
    0033 - Green Shard
    003F - HP Up
    0040 - Protein
    0041 - Iron
    0042 - Carbos
    0043 - Calcium
    0044 - Rare Candy
    0045 - PP Up
    0046 - Zinc
    0047 - PP Max
    0049 - Guard Spe
    004A - Dire Hit
    004B - X Attack
    004C - X Defend
    004D - X Speedy
    004E - X Accurac
    004F - X Special
    0050 - Poke Doll
    0051 - Fluffy Tail
    0052 - None
    0053 - Super Repel
    0054 - Max Repel
    0055 - Escape Rope
    0056 - Repel
    005D - Sun Stone
    005E - Moon Stone
    005F - Fire Stone
    0060 - Thunder Stone
    0061 - Water Stone
    0062 - Leaf Stone
    0067 - Tiny Mushroom
    0068 - Big Mushroom
    006A - Pearl
    006B - Big Pearl
    006C - Stardust
    006D - Star Piece
    006E - Nugget
    006F - Heart Scale
    00B3 - Bright Powder
    00B4 - White Herb
    00B5 - Macho Brace
    00B6 - Exp Share
    00B7 - Quick Claw
    00B8 - Soothe Bell
    00B9 - Mental Herb
    00BA - Choice Band
    00BB - King's Rock
    00BC - Silver Powder
    00BD - Amulet Coin
    00BE - Cleanse Tag
    00BF - Soul Dew
    00C0 - Deep Sea Tooth
    00C1 - Deep Sea Scale
    00C2 - Smoke Ball
    00C3 - Everstone
    00C4 - Focus Band
    00C5 - Lucky Egg
    00C6 - Scope Lens
    00C7 - Metal Coat
    00C8 - Leftovers
    00C9 - Dragon Scale
    00CA - Light Ball
    00CB - Soft Sand
    00CC - Hard Stone
    00CD - Miracle Seed
    00CE - Black Glasses
    00CF - Black Belt
    00D0 - Magnet
    00D1 - Mystic Water
    00D2 - Sharp Beak
    00D3 - Poison Barb
    00D4 - Nevermelt Ice
    00D5 - Spell Tag
    00D6 - Twisted Spoon
    00D7 - Charcoal
    00D8 - Dragon Fang
    00D9 - Silk Scarf
    00DA - Up-Grade
    00DB - Shell Bell
    00DC - Sea Incense
    00DD - Lax Incense
    00DE - Lucky Punch
    00DF - Metal Powder
    00E0 - Thick Club
    00E1 - Stick
    00FE - Red Scarf
    00FF - Blue Scarf
    0100 - Pink Scarf
    0101 - Green Scarf
    0102 - Yellow Scarf
    01F4 - Safe Key
    01F5 - Elevator Key
    01F6 - Bonsly Card
    01F7 - Machine Card?
    01F8 - Gonzap Key
    01F9 - Data Rom
    01FA - ID Card
    01FB - Music CD
    01FC - Lever
    01FD - Mayor Letter
    01FE - Miror Radar
    01FF - Pokesnack
    0200 - Cologne Case
    0201 - Joy Scent
    0202 - Excite Scent
    0203 - Vivid Scent
    0204 - Sun Shard
    0205 - Moon Shard
    0206 - Bonsly Photo
    0207 - Decoding Machine?
    020B - Krane Memo 1
    020C - Krane Memo 2
    020D - Krane Memo 3
    020E - Krane Memo 4
    020F - Krane Memo 5
    0210 - Voice Capsule 1?
    0211 - Voice Capsule 2?
    0212 - Voice Capsule 3?
    0213 - Voice Capsule 4?
    0214 - Voice Capsule 5?
    0215 - Disc Case
    
    SPECIAL EVENT ITEM CODES *for GBA Pokemon games*
    *doesn't activate events. only gives items.
    113 - Eon Ticket
    172 - Mystery Ticket
    173 - Aurora Ticket
    178 - Old Sea Chart
    from GS Central


    Gotta love knowing the PIDs and memory locations (open)
    [​IMG]
  10. Bond697

    Bond697 Dies, died, will die.
    is a Pokemon Researcher

    Joined:
    Jun 20, 2010
    Messages:
    307
    considering gen 5 makes the ivs separately and yet still stores them as a single dword, it's more than a stretch to say that implies anything about how the game generates the ivs. (and you're confusing a lua operation(bit.band) with a binary string of numbers)
  11. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    Pokemon XD (GoD) Memory Locations

    They may be different depending on pointers of your current setup.
    Code:
    0x004E8610	PRNG State
    
    0x00478EB8	Party PID#1
    0x00478F7C	Party PID#2
    0x00479040	Party PID#3
    0x00479104	Party PID#4
    0x004791C8	Party PID#5
    0x0047928C	Party PID#6
    
    0x004A86F4	OppPID#1 (Battle)
    0x004A8774	OppIVs#1 (Battle)
    Others are nearby.
    Frame chart of the first battle with a Shadow Pokemon (Teddiursa) (open)

    Code:
    0	02570640
    146	311AF64A
    281	490C46FB
    406	74A78F2E
    552	FA20CC28
    687	74C1FB71
    812	86A6B26C
    958	0A9F92D6
    1093	AEF8CEF7
    10822	3611B3DE	The Bwooooommmm sound plays: Battle Scene Starts Swirling
    
    +9746 (wat)
    
    0	2C21B3D8
    9600	2C21B3D8 for some reason I get the same seed. It should be 842D1558
    19200	251576D8
    28800	14DAD858
    38400	597D39D8
    48000	F8FC9B58
    57600	F958FCD8
    67200	60925E58
    76800	34A8BFD8
    86400	34A8BFD8 for some reason I get the same seed. It should be 7B9C2158
    96000	3B6C82D8
    105600	7A19E458
    115200	3DA445D8
    124800	8C0BA758
    134400	6B5008D8
    144000	E1716A58
    153600	F46FCBD8
    163200	AA4B2D58
    172800	09038ED8
    182400	1698F058
    192000	D90B51D8
    201600	565AB358
    211200	948714D8
    220800	99907658
    230400	6B76D7D8
    240000	103A3958
    249600	8DDA9AD8
    259200	EA57FC58
    268800	2BB25DD8
    278400	57E9BF58
    288000	74FE20D8
    297600	88EF8258
    307200	99BDE3D8
    
    +9606 now, to get the next..
    
    0	1C430CF6    area before the oPID is getting data, it is primed with 02000000 00FFFFFF
    9600	A3B4B276
    19200	567B57F6
    28800	4A96FD76
    38400	9607A2F6
    48000	4ECD4876		Still not set
    57600	8AE7EDF6		[previously typo'd as 8EA7EDF6, why we thought seed modding was going on]
    
    57608	C7512C7E		C751 becomes upper PID half
    57609	BF7E9149		BF7E becomes lower PID half
    
    
    57600+9609 [IVs are probably generated now, as we can see for PID]
    
    0	E242D0C9
    9600	04A81049		Tested here, PID/IV is already set.
    19200	A4AE4FC9
    28800	40558F49
    38400	559DCEC9
    48000	62870E49		[previously typo'd as 68270E49]
    
    +9601
    
    0	D2F71968	PID is set in oPID location, IVs as well.
    9600	ABD35AE8
    19200	F3CC9C68
    28800	30E2DDE8
    38400	E9161F68
    48000	A26660E8
    57600	E2D3A268
    67200	305DE3E8
    76800	11052568
    86400	0AC966E8
    
    +9606, no modification
    
    0	9309A586	
    9600	DC262B06	
    19200	42D7B086	
    28800	5D1E3606	
    38401	459B0431	I can start to see the trainer through the swirl
    48002	683647B0	
    57603	44FB7333	
    67204	4E830EAA	Music starts playing
    76805	2192E245	
    86406	23EB7574	
    96007	A2D591E7	
    105608	2297BA8E	
    115209	9ABBC699	
    124810	BD4C1078	
    134411	B8F1E8DB	
    144012	87183DB2	
    153613	3009A52D	
    163214	AF043CBC	
    172815	80B40C0F	
    182416	63A1DC16	
    192017	7F4CB201	
    201618	B1AB5E40	
    211219	6A3DCF83	
    220820	AA1719BA	
    230421	BC056115	
    240022	9F481904	
    249623	D9E34737	
    259224	6643BA9E	
    268825	E8786669	intro music ends (bah dah dah dah dah, dah dah)
    268826	752C4F88	hay, it's +1 now instead of 9601!
    268827	5459D02B	
    268828	4EE59A42	
    Code:
    Excel Formulae to get the 9601's from CSV output
    =INDIRECT("A"&A12*9601+1)
    =INDIRECT("E"&A12*9601+1)
    The 7 lowest bits repeat because that's how LCRNGs work if running in intervals of 9600 frames.
  12. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    Pokemon XD: GoD - Call Structure for PID/IV Generation

    Code:
    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
    See OmegaDonut's post (2 down) for the information. This post was updated after the fact to consolidate information into concise posts.
  13. ΩDonut

    ΩDonut don't glaze me bro
    is a Programmeris a Forum Moderatoris a Community Contributoris a Pokemon Researcheris a Contributor to Smogon
    Moderator

    Joined:
    Aug 23, 2006
    Messages:
    3,727
    This just in: Pokémon caught in XD are never shiny. The game will continue to reroll for a new PID until it is not shiny.

    Code:
    
    Test results:
    
    Frame	RNG Value
    1	BFB03DDD  <- frames 1 and 2 form a PID that should be shiny (BFB04B1B) 
    2	4B1B992C  <- but we know it rerolls to frames 3 and 4
    3	3F07833F  <- frames 3 and 4 also form a PID that should also be shiny with our ID\SID (3F07CBA9).  
    4	CBA9D106  <- we want to know if it only rerolls once, or if it keeps rerolling until not shiny
    5	2BC0C3B1  <- the PID was 2BC0FBF2, so it rerolled until a non-shiny PID occurred on frame 5 and 6.
    6	FBF257B0
    
    
    This debunks the previous belief held by Gold Ursaring and yamipoli that XD Pokémon simply have really low odds of shininess because you'd have to get two shiny PIDs in a row (a 1-in-67108864 chance). However, this is clearly not the case.

    EDIT: We also tried manipulating the opposing trainers' ID\SID to make their Pokemon shiny. This also failed; it rerolled for their ID\SID when the PID\TID combination was found to make the Pokemon shiny.
  14. ΩDonut

    ΩDonut don't glaze me bro
    is a Programmeris a Forum Moderatoris a Community Contributoris a Pokemon Researcheris a Contributor to Smogon
    Moderator

    Joined:
    Aug 23, 2006
    Messages:
    3,727
    IV\PID generation in XD is basically like Method 2 (described here), in reverse. Five RNG calls are made. The first two are used for IVs, the third is unused, and the last two form the PID.

    A quick recap of IV generation in Method 2, from X-Act's article:

    The only difference in XD is that the first two calls form the IVs, and the last two the PID, rather than the other way around.

    Code:
    Frame	RNG Value
    1	[B]171E[/B]A3F5	171E in binary: 0|00101|11000|11110 (Defense 5, Attack 24, HP 30)
    2	[B]CA36[/B]C6E4	CA36 in binary: 1|10010|10001|10110 (SpDef 18, SpAtk 17, Speed 22)
    3	8302DA17	ignored
    4	[B]C751[/B]2C7E	C751 forms the upper half of the PID
    5	[B]BF7E[/B]9149	BF7E forms the lower half of the PID
    
    There is a possibility that there are Method 1 equivalents (four RNG calls with none skipped), but we haven't seen this yet.
  15. Toast++

    Toast++ > Nexus
    is a member of the Site Staffis a Programmeris a Super Moderatoris a Smogon Media Contributoris a Researcher Alumnus
    The Smog Lead

    Joined:
    Mar 9, 2009
    Messages:
    1,686
    I did some research a while ago and just realized that I never made it available here. This is all PIDRNG and NPC related. If I get the time, I'll translate it into an actual post. For now, here is a link to the document I used to record my findings.

    Edit: Any notes about leading 0's has since been proven to be only mostly true. It is rarely possible for other low values to have the same effect.
  16. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    Abilities in XD (and Colo?)

    Since the game generates the IVs before the PID (compared to the regular NDS/GBA method which does PID first), ability is determined differently.

    Code:
    PID		IV		Low Bit (IV)
    19B6E8AF	140109DE	0 (Natural Cure)	Roselia
    D69C5CFF	1C4571D4	0 (Immunity)		Snorlax
    A752AF5C	14959F84	0 (Natural Cure)	Chansey
    CE78165A	94E2F24D	1 (Illuminate)		Starmie
    6AAD7B68	29D51C14	0 (Synchronize)		Ralts
    6DAE2D91	09798D98	0 (Lightningrod)	Rhydon
    8D73B8EA	85625197	1 (Lightningrod)	Manectric
    
    edit: see next page for the actual determination
  17. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    Colosseum PKM Structure and offsets

    Code:
    004088FC	Trainer SID_TID
    
    00408900	Species (half word)
    00408904	PID#1
    00408914	PKM TID/SID
    
    004089A4	IVs (half word each)
    
    00408A3C	PID#2
    
    408A3C-408904 = 312 bytes of data
    XD had 194.
    
    There is some shifting based on how you start up, but it would be nearby if not there.
    PID changing for shininess (open)
    As WildEep pointed out, these guys are locked into male only. I CHANGED THE PID TO WHATEVER I WANTED OK?

    [​IMG]
  18. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    Colosseum PID/IV Relationship

    Code:
    Pre-Generation Seed: A6A0DF7D
    
    277	81559C60	8155	IV Block 1	1 00000 01010 10101
    278	0ECF49A3	0ECF	IV Block 2	0 00011 10110 01111
    279	C0310DDA	C031	????
    280	F0CF5D35	F0CF	UpperPID
    281	5A199B24	5A19	LowerPID
    
    PID:	F0CF5A19
    IVs:	0015	000A	0000	0016	0003	000F
    Binary	10101	01010	00000	10110	00011	01111
    It's the same as in XD. Yay for a universal method!

    It probably has the same Trainer TID/SID Generation.
  19. Missingno. Master

    Missingno. Master

    Joined:
    May 31, 2006
    Messages:
    834
    Does this apply to just the Shadow Pokémon, or are the Poké Spot Pokémon also set to not be shiny?
  20. ΩDonut

    ΩDonut don't glaze me bro
    is a Programmeris a Forum Moderatoris a Community Contributoris a Pokemon Researcheris a Contributor to Smogon
    Moderator

    Joined:
    Aug 23, 2006
    Messages:
    3,727
    We haven't tested Pokéspots, but frankly, they are not a high priority at all since there is nothing special about them. We'd only research them if we get really, really bored.
  21. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    Paralleling XD's antishiny to Colosseum's blunder:

    I've taken the time to figure out why Colosseum has shiny shadow Pokemon that lose shininess upon capture, and why it's possible to actually become shiny after capturing. The answer is simple: Opponent TID/SID.

    As we've seen in XD, if the PID is shiny with your TID/SID or the (randomly generated) Opponent's TID/SID, it is re-rolled. In Colosseum, the game only uses the Opponent TID/SID with the PID when determining shininess. Consider it like an egg. It may be shiny with Trainer A, but with Trainer B, it may not! Conversely, if it's nonshiny with A, it might be shiny with B. This is why the glitch occurs, and I've updated Bulbapedia's entries according to this.

  22. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    XD Togepi:

    Code:
    0	AC3F2930
    ...
    19	43908A15	4390	0 10000 11100 10000	(0x10 0x1C 0x10)
    20	38619484	3861	0 01110 00011 00001	(0x0E 0x03 0x01)
    21	0000F137	0
    22	13DB671E	13DB	UpperPID
    23	41526169	4152	LowerPID
    
    13DB4152
    10 1C 10 03 0E 01
    Even though it is a gift, same method. It has a shiny check on it as well, it uses 1 after the old PID for ???, and then generates the new Upper->Lower PIDs.
  23. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    yeah, ageto celebi to the GC sav file conforms to the XD/Colosseum method
    Same struct.

    That Shiny Lax Ageto Celebi that's been trading for a long time? Hacked.
  24. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    Uploaded a YouTube Video recording me RNGing the Shadow Togepi from HORDEL in Outskirt Stand in XD.

    With audio narration!

    Here's the video!

    [youtube]qOKFkIqPpRI[/youtube]

    Video Detail / Commentary (open)
    I used Camtasia Studio to record my computer screen. It recorded the mouse, and it let me do some cool stuff to help accentuate what I was doing via cursor size and click effects. It stabilized the audio and removed background noise, and I lowered the volume of the narration so it wasn't loud like most of those narrated videos online.

    The Togepi generation framespan was really nice; the game doesn't go through the swirling animation so the frame difference is really low (thus not as hard to find what frame the PID halves came from)!
    [​IMG]

    Use XDC-Legal or any other IV checker to see that these correspond to 31/6/31/31/31/31 Timid.

    [​IMG]

    I ended up recording twice with two different programs, because the first program failed to record properly. I used the states from that run instead just so I wouldn't have to do as much work. It's a good practice to export Researcher's results when looking for the PID halves, as you usually won't know where they are.

    The whole Excel searching part I skipped (because the PID halves were within the first 100 frames from my initial), in addition to target spread/seed selection (the tool remains private:pimp:).

    Memory changing the seed is obviously required, because there's no seed hitting (nanosecond timing? waiting forever? no thanks)
  25. Kaphotics

    Kaphotics Remodeling Kitchens
    is a Pokemon Researcheris a Contributor to Smogon

    Joined:
    Apr 25, 2009
    Messages:
    780
    Japanese Bonus Disc PRNG
    80477098

    You have to select the Colosseum portion of the bonus disc (first one), then the seed is set. Then another menu pops up. Passing this menu screen advances it ~1018 times.

    It's for sure the PRNG state ;)

    finished editing the disc so it will give to english saves.... but I can't get the link going.

    ==

    Abilities in XD/C (99% sure)

    Come from the top bit of the second set of IVs.
    Code:
    iv1   xHHHHH[b]AAAAADDDDD[/b] (binary)
    iv2   a[s]AAAAADDDDD[/s]SSSSS (binary)
    ???
    upid  BEEF
    lpid  CAFE
    The whole ability changing in XD/C is probably because the game doesn't store the ability (it instead stores PID/IV) and thus re-generates it if you re-encounter (with that blank call?). Just a theory.

Users Viewing Thread (Users: 0, Guests: 1)