About D1, if the 12v is supplied the diode become forward biased and conducts to mega regulator input pin, so that regulator can make 5v from the 12v supply instead. Nothing wrong with that, if you look at the black power jack on the mega, that is actually the same thing 12v input, and right behind it there is a smd diode that is also named D1, and after that diode its the exact same line, Vin from the Vin pin. So its how it is supposed to be, 12v comes in through a diode, goes to Vin for the regulator.
The Vin pin on mega is provided after the diode, because that is how the mega designer figured to do it. I guess they thought Vin would be a pin to supply 12v from the jack to the "shield" - hence no diode. Ramps instead, uses it in reverse, to provide power to the mega, thats why it has to use an additional diode instead because the D1 on the jack is not used anymore so it has to replace it. Basically the D1 on ramps and the D1 on mega are the same thing: prevent 5v regulator output to discharge in the output stage of the atx psu. In the 5v regulator current normally goes from 12v input to 5v output, but also at shutdown, 12v falls first, then 5v is still up and it discharges back to the 12v line, that is to discharge the caps on the 5v line etc, so the 5v regulator can conduct from 5v to the 12v line when the 12v line is lower than 5. This way if you would supply 5v directly through usb and 12v line is at zero, the D1 diode would not be there, the 5v from usb would go into the atx psu 12v output stage and the caps there, which if are too big could for example draw a turn-on current bigger than what 5v usb can afford. Or dunno, something else, anything can happen, the designer didnt knew what ppls would use as supply.
So both D1 are good to have there, and they sort of make sense.
You can figure out what happens, not all 5v are created perfectly so check the 5vsb if its 4.82v and the regulator on the arduino makes like 4.97v, then you can figure which one is what - and when. If you supply from 5vsb and then supply 12v instead and the 5v on arduino changes value, then that has to be from the regulator. It should be no problem whatsoever, either way. Both 5vsb and what the regulator makes from 12v all of these have same gnd, come from same psu, so there should be no problem or no issues using either or both. Ofc - imo.
The Vin pin on mega is provided after the diode, because that is how the mega designer figured to do it. I guess they thought Vin would be a pin to supply 12v from the jack to the "shield" - hence no diode. Ramps instead, uses it in reverse, to provide power to the mega, thats why it has to use an additional diode instead because the D1 on the jack is not used anymore so it has to replace it. Basically the D1 on ramps and the D1 on mega are the same thing: prevent 5v regulator output to discharge in the output stage of the atx psu. In the 5v regulator current normally goes from 12v input to 5v output, but also at shutdown, 12v falls first, then 5v is still up and it discharges back to the 12v line, that is to discharge the caps on the 5v line etc, so the 5v regulator can conduct from 5v to the 12v line when the 12v line is lower than 5. This way if you would supply 5v directly through usb and 12v line is at zero, the D1 diode would not be there, the 5v from usb would go into the atx psu 12v output stage and the caps there, which if are too big could for example draw a turn-on current bigger than what 5v usb can afford. Or dunno, something else, anything can happen, the designer didnt knew what ppls would use as supply.
So both D1 are good to have there, and they sort of make sense.
You can figure out what happens, not all 5v are created perfectly so check the 5vsb if its 4.82v and the regulator on the arduino makes like 4.97v, then you can figure which one is what - and when. If you supply from 5vsb and then supply 12v instead and the 5v on arduino changes value, then that has to be from the regulator. It should be no problem whatsoever, either way. Both 5vsb and what the regulator makes from 12v all of these have same gnd, come from same psu, so there should be no problem or no issues using either or both. Ofc - imo.