Fix the global Core pointer behavior

We have a global Core pointer holding the current instance so that
the environment callback can store data on it.
Set texture image format based on libretro pixel_format