Backport https://github.com/mupen64plus/mupen64plus-core/commit/7aaf5688991f064edd3cc32ece0f702f852346ae