(libretro) Rewrite some palette get/surface copying functions