Improve VGA emulation.
Move some header related #ifdefs to more appropriate places.