Can you tell us what state you live in (if you're in the U.S.)? Divorce laws and custody laws differ greatly from state to state.
Do you want full custody of the kids? There are some states that have come a long way from the days when the woman was automatically granted custody. If you live in a state that puts the needs of the children first, then documenting everything you've described is crucial-- particularly if you can get an audio or audio/visual recording of her yelling at the kids or treating them so badly that you need to remove them from the situation.
Are the photos of adultery you found date/time stamped? If so, you could correlate them against what was happening in the kids' lives at that time-- i.e., if she was off having sex and missing a school function, or leaving you in a situation where you unexpectedly couldn't get work done, or whatever, that becomes valid evidence of her fitness to have custody.
What you need most is a really good lawyer. You need to ask family/friends/coworkers for recommendations, find online forums for your geographic area, etc.; use whatever means are at your disposal, but find a really good divorce lawyer, not just the first one someone recommends. I cannot stress this enough. If your wife is actively seeking to take you for all she can, rather than trying to achieve a settlement that's fair for both sides, the difference between you having a 'good' lawyer and a 'great' lawyer will impact you and your children for a decade or more. It's work doing the research, and it's unpleasant, and it's easy to procrastinate or avoid; you can't afford those luxuries right now. You need to be in cave-man-with-a-big-club mode: someone/something is threatening you and your children, and there's no one else around to fight for you. Dig deep, find the necessary courage and motivation, and find a great divorce lawyer ASAP. Once you do, stop following legal advice you get on this forum, and trust the lawyer. You would be shocked at the number of things you can do or say in the next few weeks and months that can be used against you in ways that you could never imagine; you need that expert advice to keep from screwing yourself over.
Beyond that, there are a few pieces of advice that you should follow, that are true in every situation like yours:
1. Drink a lot of water. Like, a lot. However much you think you need to drink, double that.
2. Stay away from alcohol and weed. If you absolutely must drink alcohol, don't drink enough to get buzzed. But really, this is a crucial time for you and your children, suck it up and just avoid it altogether.
3. Get at least 8 hours of sleep, 7 at the minimum. Solid sleep, not waking up every 10 minutes. If you can't do that for more than three days in a row, call your doctor and leave a message explaining that you are under enormous stress from a family situation, and need something to help you sleep. Your doctor should either find a way to quickly squeeze you in for a visit, or else phone in the prescription to your pharmacy without a visit. These days, any decent doctor realizes the importance of sleep, and how damaging just a week of bad sleep can be, so unless you've got an old, inflexible MD who doesn't keep up with the times, this just shouldn't be a problem.
4. Move your body. Exercise if you can, even if it's 'just' taking a walk. If for some reason you can't exercise, then at least stand up from your desk once and hour and pace for a minute, stretch, etc. If you're doing this, it's a great time to finish any water left in your glass, and refill the glass for the coming hour. But actual exercise will be enormously helpful, if you can manage it.
I'm sorry that you're going through this. Many people on this site have experienced similar levels of betrayal, and can relate to how you must be feeling; many of them have healed and moved on, and over time, you may find their stories to be inspirational.
Good luck, and remember we're here for you; if you just need emotional support, rather than advice, then come right out and ask for it directly-- we're pretty decent at that, too.