I would say that my gameboy emulator is the most complex software project I’ve ever undertaken. It consumed my entire winter break last year and has yet to reach a state where I can release it to the market. It works fairly well on higher end devices (Galaxy Nexus or above) but suffers from performance issues on low end devices that are perfectly capable of running other emulators. I’ve combed through the code many many times optimizing routines and eliminating bloat. I really don’t think there is much room for improvement with the current codebase, at least not to the extent that is needed. At this point a complete overhaul of the engine is going to be required.
Fortunately all of my modules (CPU,GPU,Memory Mapper, etc) are already written and optimized pretty well. What is going to have to change is the way these components interact, which is going to be a chore in and of itself. As it stands now each section of the gameboy is it’s own class. All the code is nice and organized like an object oriented program should be. What I didn’t think about was the performance impact that would occur from having to jump in and out of these nested classes thousands of times per second. To fix this I’m going to need to start bringing things a lot closer to the CPU code, which is likely going to turn into a pretty big mess.
Before any of this is worthwhile I have to tackle my biggest Android fear, OpenGL. I’m sure it’s actually not that bad but so far I’ve glazed over every time I look through a tutorial. I’ve been wanting to switch over from canvas for a while though, and I don’t want to bother with rewriting any code without having an opengl display ready for use.