When I try to display the 11th image, I get a: "Couldn't open name_of_the_image.bmp". And it doesn't matter if I'm displaying small or full screen images. I'm also monitoring amount of free memory and I think there's no problem there.
Code: Select all
int displayImageUsingSDL(SDL_Surface *screen, const char* imageName, int posX, int posY){
SDL_Surface *image = NULL;
SDL_RWops *rwop = NULL;
rwop=SDL_RWFromFile(imageName, "rb");
image=IMG_LoadBMP_RW(rwop);
if(!image){
pspDebugScreenInit();
pspDebugScreenPrintf("ERROR: %s\n", IMG_GetError());
return -1;
}
//else drawtile(image, 0, 0, image->w, image->h, posX, posY, 0, 0, screen);
//sceDisplayWaitVblankStart();
//SDL_Flip(screen);
SDL_FreeRW(rwop);
SDL_FreeSurface(image);
return 0;
}
In the main program I have this:
Code: Select all
while(1){
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CIRCLE) break;
else if(pad.Buttons & PSP_CTRL_CROSS) displayImageUsingSDL(screen, "fullscreen.bmp", 0, 0);
else if(pad.Buttons & PSP_CTRL_TRIANGLE) displayImageUsingSDL(screen, "small.bmp", 0, 0);
else if(pad.Buttons & PSP_CTRL_SQUARE) printMemory();
SDL_Delay(100);
}