You have not failed. This isn't about you at all. What do you do? You live your life to the fullest and treat him like you would a friend. When he wants to talk, listen to what he has to say and validate him whenever you can. But, please understand...YOU CAN'T FIX HIM. He has to do that himself.
The more you try to fix your situation, the deeper the hole is going to be. The best thing to do is just be yourself and allow him time to figure things out for himself. Fixing him is on him to do. If you have some things that you don't like about yourself, work on them...but whatever changes you make, you make for you...not to win him back. When he begins to sense that you are moving forward and you become more independent, he will come sniffing around once again to see if your changes are real or if they aren't. Right now, you are trying to pretzel yourself and you shouldn't be doing that. Just leave the man alone and when he wants to talk...listen.
Keep the focus on you.
Sit quietly, the answers will reveal themselves when you least expect them to. The past is gone, the present is a gift and you need to focus on today, allow the future to reveal itself when it is ready.