IF I understood this right, you and your W were already separated, the friend that you messed around with early in your marriage, confessed to this activity to your W and this has put what may be the final nail in the marriage coffin....is this Right?
Going from this, the issues that caused the separation from the beginning is something that is going to have to be dealt with...and it's going to be very hard to get your W to do this now. She's going to be either pointing to this incident (the betrayal) and may be incapable of dealing with anything else or she may use this as an extra reason to feel as if there isn't much to save of a marriage that has been touched by cheating.
This is NOT going to be easy. IF...you and your W feel as if the marriage is worth saving, you're going to need some outside guidence...FAST. You've got to deal with whatever issues were there before, plus her anger and pain of the betrayal...which sadly usually takes over the BS to a point where it will sidetrack you from doing the work that needed to be done, before she discovered the betrayal.
You will HAVE to address the betrayal, search your memory for how you were feeling during this time, what you thought, why you allowed this to happen. Give her as many answers as possible to any and all questions. IF needed, ask for time to reflect on your answers so that you can give honest ones with plenty of thought, don't just try to "wing it".
You can save your marriage, you can work out whatever problems you have...IF you BOTH wish to. Good Luck!