Backport https://github.com/libretro/mednafen-psx-libretro/commit/309635e2130459b4a48b8178ab4cbdfe6d81696a