My understanding is that the master switch for sex determination has been identified as the "SRY" gene normally found on the Y chromosome. Active SRY means development heads down the "male" path in the genes; no SRY (or non-functional SRY) means development heads down the "female" path.
SRY can cross over to the X chromosome (resulting in an XX male), but the end result is usually sterile as there are other genes elsewhere on the Y chromosome that are also necessary for complete development.