A few things to add:
The only Commodore I know of in the current US Navy is a commander of a submarine squadron. The captain of a submarine is an 0-5 rank (Commander). He is called captain because Navy convention is anyone in charge of a vessel is called captain.
The commodore has the rank of 0-6 captain and is in charge of a submarine squadron.
I don't know for sure but I think if a commodore was on board a boat and the captain was incapable of command the XO would take over command of the vessel not the Commodore. Same goes for admiral/captain aboard an Aircraft Carrier.