Backport patch https://github.com/libretro/gambatte/commit/39f7b2e618faf495e8349024eb65d5cc5cffbc13