Turn this into an object to get things cleaner. I'll just make it all global once I make a C version, rarch doesn't do multi-instance anyways.