Add state serialization and an in-memory save state.

 - Add a framework for serializing system state into a memory buffer.
   Saves APU, CPU, PPU, controller, and mapper-specific state.

 - Add a single in-memory save state slot. 'S' saves, 'L' loads.

 - Rename the mapper make_effective() functions to apply_state().

 - Piggy-backed:

   * Simplify declarations of mappers in mappers.cpp by automatically
     declaring the relevant functions just before their address is taken
     and enforcing a consistent naming scheme.

   * The event lock was in the wrong location and did not protect
     controller reads from the emulation thread.

   * Print a message for graceful exits from main().