Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ***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".***
- #define PARENTS 2
- #define IV_INHERIT 3
- #define IV_TOTAL 6
- u8 iv_array[IV_TOTAL];
- u8 parent_inherit[IV_INHERIT];
- inheritance(iv_array, parent_inherit);
- void inheritance(u8* inheritance_array, u8* p_array)
- {
- int inheritedIV;
- int i;
- for(i = 0, i < IV_TOTAL; ++i)
- {
- inheritance_array[i] = i;
- }
- for(i = 0; i < IV_INHERIT; ++i)
- {
- inheritedIV = rand() % (IV_TOTAL - i);
- doInheritanceCheck(inheritance_array, i); //bug is here- i should be inheritedIV
- }
- for(i = 0; i < IV_INHERIT; ++i)
- {
- p_array[i] = (rand() & 1);
- }
- }
- void doInheritanceCheck(u8* original_inheritance_array, int inheritance)
- {
- original_inheritance_array[inheritance] = 0xFF;
- u8 copy_inheritance_array[IV_TOTAL];
- for(i = 0; i < IV_TOTAL; ++i)
- {
- copy_inheritance_array[i] = original_inheritance_array[i];
- }
- int j = 0;
- for(i = 0; i < IV_TOTAL; ++i)
- {
- if(copy_inheritance_array[i] != 0xFF)
- {
- original_inheritance_array[j] = copy_inheritance_array[i];
- j++;
- }
- }
- }
- setIVsToEgg();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement