EMI: Rework attaching and detaching.

This patch reworks attaching and detaching, making them consistent with the retail version. Although there are still rotation bugs, I don't think they're related to attaching and detaching and will be fixed by other PR's.