Backport patch https://github.com/libretro/gambatte/commit/96537c1950dc1bca7fc2fc97652dd6741df3619b