Backport https://github.com/libretro/mupen64plus-libretro/commit/3ca3eff2b3279888de7779a2aad5e42d8b3e36a5