Include the input state in save states.

This ensures that frames played back while rewinding exactly match the
corresponding forward-direction frames, which is important when
reversing sound.

Move button state calculation to calc_logical_dpad_state() and rename
it to calc_controller_state().