I am not really good in IO stuff and have troubles loading the textures and applying them.. The DOC in the ZIP describes an own format and not GU which is not that hard but it says in his textureheader struct:
Code: Select all
typedef struct
{
u32 ID; // == 'PSPT'
u16 bufWidth; //(NOTE! if bufwidth < xsize then so be it! Obey bufwidth always!)
u16 bufHeight; //(OBEY bufHeight too, with these we can achieve nonpow2 textures if we set texcoords appropriately)
u16 flags; //{1=Swizzle}
u8 xsize; //(1<<xsize = texture size in pixels)
u8 ysize;
u8 format;
u8 numMips;
u8 numCluts;
u8 clutSize; // or reserved
//OK we here have 16 bytes. Everything (textures, palettes) needs to be 16-byte aligned
//Here comes a variable number of pointers to fix up
//Then comes the texture data for each level
//All of the texture data are 16-byte aligned
} TextureHeader;
Here comes a variable Number of pointers to fix up
then comes the texture data for each level..
What I successfully can do until now is to load the Texture HEADER (16 bytes) and display this...
But how do I move on and load the actual palette and texture data??
My Load Routine is:
Code: Select all
void *loadTexture(char *filename, TextureHeader *hdr, *texture)
{
SceUID myFile;
myFile = sceIoOpen(filename, PSP_O_RDONLY, 0777);
if(!myFile)
{
pspDebugScreenPrintf("Error loading file %s", filename);
return NULL;
}
sceIoLseek(myFile, 0x00, SEEK_SET);
sceIoRead(myFile, hdr, sizeof(TextureHeader));
sceIoClose(myFile);
return (void *)0xDEADBEEF; // ignore
}
Your help is greatly appreciated!