A cheating wife caused a man going to go off the rails, taking cocaine and crashing his vehicle, a court heard.