Welcome! Log In Create A New Profile

Advanced

SDL_LoadBMP dumping debug information

Posted by semprance 
SDL_LoadBMP dumping debug information
August 23, 2009 05:08AM
Hi guys,

This is my first post so bare with me please :-) I've used SDL in the past to create a few small games on Windows. Having recently installed the Homebrew channel amongst other things on my Wii, I had a search round and realised I could use SDL.

I've started by just trying to place an image on the screen, but when I do all I get is a load of DUMPed information, and have no idea what the real problem is. After commenting code for a while and remaking/running the program I narrowed it down to this:

Background = Draw::LoadImage("sd:/bg.bmp");

The method it leads to is this:

SDL_Surface* Draw::LoadImage(char* File)
{
    SDL_Surface* Surf_Temp = NULL;
    SDL_Surface* Surf_Return = NULL;

    //Load temp
    Surf_Temp = SDL_LoadBMP(File);
    
	if(Surf_Temp != NULL)
	{
		Surf_Return = SDL_DisplayFormat(Surf_Temp);
		SDL_FreeSurface(Surf_Temp);
	}
	else
	{
		return NULL;
	}
    return Surf_Return;
}


Parts of this were taken from the tutorial found here on WiiBrew. The image I'm using is 320*240, 256 colors, and the display is set to 640*480, 16-bit color, Double-buffering enabled (Do I need to set the Full Screen flag too???).

Can anyone help me with solving this? Is there anyway of getting more information out of the Wii/Programmer's Notepad about what is causing this?

Cheers! Semp
Re: SDL_LoadBMP dumping debug information
August 23, 2009 07:26PM
Hi
Try::
1. whether fat system is initialized correctly
2. path to image is correct [file exists?]
3. Try to set SDL video in another mode, I recommend SDL_SWSURFACE
4. Add some "debug" output like printf("%s", SDL_GetError()) or similiar to your code whether SDL is initialized correctly

5. last (worst) debug code via USB Gecko or analyze exception [svenpeter.blogspot.com]
Re: SDL_LoadBMP dumping debug information
August 23, 2009 08:32PM
Hi Slappy,

I'd already tried the first two and the last thing you said to no avail. Strangely, getting the Loading process to throw an error still resulted in the DUMP info appearing on screen.

The only way round I've found is to compile the program, copy it to a new folder in sd:/apps, and run it from the HBC that way. In doing this, the picture loads fine! and it draws to the screen.

This is great, but if I want to Make and Run straight away, it means I have to mess around transferring to the SD card and putting it back in the Wii every couple of minutes...

I'll try to manipulate the code a bit more by following your third suggestion in other parts of the code as well just incase a Surface somewhere is being returned as NULL, or something similar.

Cheers, Semp
Re: SDL_LoadBMP dumping debug information
August 25, 2009 12:53AM
If it works from the SD card but not from TCP then I highly doubt it's an SDL issue. This sounds like a file is missing or in the wrong place.

Background = Draw::LoadImage("sd:/bg.bmp");
This is on the Root of the SD, right? Not under your app's dir.

Also if you're using the SD, you have initialized the file system using fatInitDefault();.
Re: SDL_LoadBMP dumping debug information
August 25, 2009 03:37AM
I'm certain the file exists and is in the right place as, when the app is run from the SD card, rather than over TCP, it loads fine and draws the image on the screen.

I've just programmed a basic pong game and it's all working fine from the SD card, however, running it from wiiload over TCP results in the same error.

What I can't work out is, where is the SDL_LoadBMP function looking for the bmp files? Is it looking for them in the CWD, the project folder, the drive root? Or is it looking for them on the SD card in the wii? I think it's safe to assume it's not looking for them in the SD slot of the wii, as passing "sd:/a_file_that_exists.bmp" to it results in the same error.

Also what does the fatInitDefault() method do? I'm not using it currently and everything appears to be working fine (when run from SD, of course).

Thanks for the help guys, it's much appreciated. I might be missing something obvious here but I'm fairly new to all this :-)

Cheers, Semp
Re: SDL_LoadBMP dumping debug information
August 26, 2009 03:36AM
I'm still confused about this. I used the fatInitDefault() method, and tried using "fat://filename.ext" but still got the same error. No-one else using SDL seems to have had this problem so I'm assuming there must be a way to fix it.

I just don't know what it is :-(
Sorry, only registered users may post in this forum.

Click here to login