Fix cross-platform compat problem with savestates.
Merge pull request #5111 from unknownbrackets/savestates

Fix cross-platform compat problem with savestates