Backport https://github.com/libretro/mednafen-psx-libretro/commit/421d2ab8f5c735e53924669182a3b98e691e8a53