Improved and tidied up the SDL window loading

Added some extra error checking so that it doesn't segfault when no display modes can be found. Also tidied up the mess of code at the start of the files.
Added flags to generate SSE2 instructions (#349)