libretro: range-check port id