Advertisement
Bond697

Em Inheritance- Broken, Fix Included

Aug 4th, 2012
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.76 KB | None | 0 0
  1. ***to fix the emerald iv inheritance bug, open emerald in a hex editor, go to 0x702A4, and change it to "21 78" from "29 1C".***    
  2.  
  3.  
  4. #define PARENTS 2
  5.     #define IV_INHERIT 3
  6.     #define IV_TOTAL 6
  7.      
  8.      
  9.     u8 iv_array[IV_TOTAL];
  10.     u8 parent_inherit[IV_INHERIT];
  11.      
  12.      
  13.      
  14.     inheritance(iv_array, parent_inherit);
  15.      
  16.      
  17.     void inheritance(u8* inheritance_array, u8* p_array)
  18.     {
  19.             int inheritedIV;
  20.      
  21.             int i;
  22.             for(i = 0, i < IV_TOTAL; ++i)
  23.             {
  24.                     inheritance_array[i] = i;
  25.             }
  26.      
  27.      
  28.             for(i = 0; i < IV_INHERIT; ++i)
  29.             {
  30.                     inheritedIV = rand() % (IV_TOTAL - i);
  31.      
  32.                     doInheritanceCheck(inheritance_array, i); //bug is here- i should be inheritedIV
  33.             }
  34.      
  35.      
  36.             for(i = 0; i < IV_INHERIT; ++i)
  37.             {
  38.                     p_array[i] = (rand() & 1);
  39.             }
  40.            
  41.     }
  42.      
  43.      
  44.      
  45.      
  46.     void doInheritanceCheck(u8* original_inheritance_array, int inheritance)
  47.     {
  48.             original_inheritance_array[inheritance] = 0xFF;
  49.      
  50.             u8 copy_inheritance_array[IV_TOTAL];
  51.      
  52.             for(i = 0; i < IV_TOTAL; ++i)
  53.             {
  54.      
  55.                     copy_inheritance_array[i] = original_inheritance_array[i];
  56.      
  57.             }
  58.      
  59.      
  60.             int j = 0;
  61.      
  62.             for(i = 0; i < IV_TOTAL; ++i)
  63.             {
  64.                     if(copy_inheritance_array[i] != 0xFF)
  65.                     {
  66.                             original_inheritance_array[j] = copy_inheritance_array[i];
  67.                             j++;
  68.                     }
  69.             }
  70.      
  71.     }
  72.  
  73.  
  74. setIVsToEgg();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement