When determining shinyness for an egg the game will look at additional PIDs when you are using the Masuda Method(5 more) and shiny charm(3 more) and take the first shiny PID it finds.
Fun trivia: The reason that you need to use either Shiny Charm or Masuda Method is because if you don't the PIDs of your eggs are determined by an entirely different RNG which has no connection to the egg RNG. The game will always discard this PID when using either Shiny Charm or Masuda Method(yes even if it's shiny!) and replace it with one that comes from the main egg RNG.
I'm currently working on possibly wrong software but...
1) it says 2 rolls for charm, 6 rolls for Masuda, 8 for both. Are you sure of your 3/5?
2) there's a roll before MM/SC PID rolls, which is labeled as PID... I wonder
- whether PID when not using SC/MM is really from a different RNG (which I would find strange, especially if there's an unused roll at this exact step in the egg generation),
- whether they use a different function to compute the egg shininess value from PID when you use SC/MM tan when you don't
- whether the original roll is indeed for the PID, the PID>ESV function is the same, but the roll result>PID is not the same for non-SC/MM roll and for SC/MM rolls.
I really need to look more into the assembly.
(I have to much work to go on farther, but I have a rough software that explore the egg tree to find the shortest path to a target, I hope I'll be able to make it work... I just dread the part where I'll have to do the 127 magikarp thing to get my seed to do real tests :/ )