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