Program crash with new devkitpro version

support for the powerpc toolchain
Post Reply
George
Posts: 4
Joined: Tue Sep 02, 2008 8:33 pm

Program crash with new devkitpro version

Post by George » Mon Dec 15, 2008 9:45 pm

The following program runs fine on the WII when compiled with the old version of devkitPro and crashes on the WII when compiled with the new version. The bmp file is located in the root of the SD card since the program is sent via WIILoad. What should be done? Regards, Georg

#include <stdio.h>
#include <stdlib.h>

// ***************************************************

#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define SCREEN_DEPTH 8

#include <wiiuse/wpad.h>
#include <ogc/lwp_watchdog.h>
#include <SDL/SDL.h>

// *************************************************
// User Global Variables
// *************************************************

static Uint32 p_key;
static SDL_Surface *sf;
static SDL_Surface *bmpimg;
static SDL_Rect area;



// *************************************************
// Main Program
// *************************************************

int main(int argc, char *argv[])
{
// Initialize SDL
if(SDL_Init(SDL_INIT_VIDEO)<0)
{
fprintf(stderr,"Couldn't initialize SDL: %s",SDL_GetError());
return 1;
}
SDL_ShowCursor(SDL_DISABLE);

// Set the video mode
sf=SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_DEPTH,SDL_SWSURFACE);
if(sf==NULL)
{
fprintf(stderr,"Couldn't set display mode: %s",SDL_GetError());
return 3;
}

// Load test.bmp
bmpimg=SDL_LoadBMP("test.bmp");
// Draw the image to 10, 20
area.x=10;
area.y=20;
area.w=bmpimg->w;
area.h=bmpimg->h;
SDL_BlitSurface(bmpimg,0,sf,&area);
SDL_Flip(sf);
//printf("\n");
//printf("%s\n","Please press HOME to exit");
while(1)
{
WPAD_ScanPads();
p_key=WPAD_ButtonsDown(0);
if((p_key&WPAD_BUTTON_HOME))
{
SDL_Quit();
return 0; //end program
}
}
return 0; // End of main program
}

WinterMute
Site Admin
Posts: 1859
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Program crash with new devkitpro version

Post by WinterMute » Mon Dec 15, 2008 11:52 pm

Use the latest version of libfat, 1.0.3
Help keep devkitPro toolchains free, Donate today

Personal Blog

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 46 guests