Get a good divorce lawyer and find out what the end game is likely to be financially. Then work round that, and insist on joint custody with you having the kids for significant amounts of time.
Finding a ‘good’ lawyer being the difficult bit. The first one I hired was an arrogant rude man whose advice proved utterly useless. I sacked him when that became obvious and got the best lawyer I have ever dealt with. She had loads of court experience, knew exactly what the end game was going to be and we ended out slightly ahead of that. In my case I ‘de facto’ had the kids, although it was shown as joint custody. I ‘de facto’ kept them until they left home, so I count myself lucky, even though it was hard work.
Mine was a truly shit experience, but the Michael Caine/Winston Churchill attitude has to be given precedence in your head…..
If you are going through hell, keep going.
Best of luck – it does get better.