Talk:SDL Wii

From WiiBrew
Jump to navigation Jump to search

News from DCEmu

SDL Wii Ports Released

July 31st, 2008, 03:09 Posted By: wraggster

ilidrissiamine has released several new items of interest to wii developers:

This project will introduce many ports of SDL games to the Nintendo Wii and will provide various libraries for SDL developers that extend it.

  • SDL_gfx- SDL_gfx port to the Nintendo Wii
  • SDL_ttf- SDL_ttf port to the Nintendo Wii with its Freetype port
  • SDL_image.7z Slightly modified SDL_image port to accept various types (libjpeg required)
  • libjpeg.7z libjpeg port to the Nintendo Wii

Those are the ones are already on the page. I think that the only reason wraggster made that post was because he saw this wiki page. --vader347 00:19, 1 August 2008 (CEST)

Ah you are right. Somehow I missed the second download link! CarstenK 05:03, 1 August 2008 (CEST)


Can someone please write an example of how SDL works with devkitpro please? Thanks ahead of time!

Akirahedgehog 09:49, 12 August 2008 (Central Time)

There are no many differances with a pc version. Just include devkitppc headers to use with sdl (fat, wiiuse...) Anyway, there is a blue screen exemple, quit with HOME

#include <stdlib.h>
#include <time.h>

#include <SDL/sdl.h>
//#include <SDL/sdl_mixer.h>
//#include <SDL/sdl_ttf.h>

#include <gccore.h>
#include <wiiuse/wpad.h>

int main(int argc, char** argv)
    SDL_Surface *screen=NULL;

    // initialize SDL video
    if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0 )
        fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError() );

	fatInitDefault();	//for read files (level, serialized structs...)
    // make sure SDL cleans up before exit

    // create a new window
    screen = SDL_SetVideoMode(480, 480, 16, SDL_DOUBLEBUF);
    if ( !screen )
        fprintf(stderr, "Unable to set video: %s\n", SDL_GetError());


    return 0;

void state_in_game(SDL_Surface *screen)
    int tick_count=0;
    int tick_trigger=15;
	bool done = false;


    while (!done)
        SDL_Event event;

        while (SDL_PollEvent(&event))
            switch ( event.type )
            case SDL_QUIT:
                done = true;

        u32 held = WPAD_ButtonsHeld(WPAD_CHAN_0); 
		if(held & WPAD_BUTTON_HOME){

        tick_count = SDL_GetTicks();
        if (tick_count > tick_trigger)
            tick_trigger = tick_count;
            SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 50, 150));

        }   //end thick
    }   //end while

--TheDrev 18:24, 21 October 2008 (UTC)

Bad libs order ?

I got the following error :

linking ... blastguy_wii_b1.elf i:/usr/devkitpro/libogc/lib\libSDL.a(SDL_gamecube_main.o): In function `main': c:\dev\apps\devkitPro\SDL-Port/src/main/gamecube/SDL_gamecube_main.c:59: multipl e definition of `main' i:/usr/devkitpro/libogc/lib\libfreetype.a(gxvfgen.o):d:/Programming/WiiDev/freet ype-2.3.6/source/gxvalid/gxvfgen.c:444: first defined here i:/usr/devkitpro/libogc/lib\libfreetype.a(gxvfgen.o): In function `main': gxvfgen.c:(.text.main+0xc4): undefined reference to `ft_strncmp' collect2: ld returned 1 exit status make[1]: *** [/i/Documents/developpement/test_sdl_plus_ttf.elf] Error 1 make: *** [build] Error 2

when -lfreetype is included before -lSDL, the right order should be

LIBS := -lSDL_ttf -lSDL_mixer -lSDL_image -ljpeg -lpng -lz -lSDL -lfreetype -lfat -lwiiuse -lbte -logc -lm

Please confime that before make the change on the page.

--TheDrev 15:25, 15 October 2008 (CEST)


This is a great port, and I'm sure it will help porting go a lot smoother for some people. However, there is no threads support. I did find a way around this (although, it makes it slower, because no threads) but I would greatly appreciate if someone added thread support to this. It'll make a bunch of ports a lot faster. Thanks --SquidMan 02:00, 17 December 2008 (UTC)

Yohanes has added threads and USB keyboard support to the SDL library while porting an apple ][e SDL based emulator to the wii. You can find his SDL code here 11, January, 2009. —Preceding unsigned comment added by Nowhereman (talkcontribs) 21:53, 11 January 2009 (UTC)


It looks like sdl-config needs to be located in bin/ not in lib/. It worked for me after putting it in $DEVKITPPC/bin. The paths in sdl-config seems to be hard-coded "-L/c/dev/apps/devkitPro/libogc/lib/wii" etc - should be dependent on location of libogc and devkitpro.

How to port?

Hi. How do I port games with this? Would I be able to port e.g. SuperTux? What is need and what is to do? Ehhhm, I just read I should use my good old friend google to find out. --Woku 13:07, 12 January 2009 (UTC)

Where's a list of libSDL.a bugs?

The new warning box at the top of the Wiki page makes it clear that there are some serious bugs in the SDL port. The Wiki page only lists one bug, and that's in an add-on library. I did a search of the forums, and didn't see anything as serious as a crash.

Can the author of the new warning or the dev experiencing the crash please provide more details so we can address the issue? I'll take a look if there's something to look at. If there are no crashing bugs, is there another list of functional bugs someplace else I can look at? --Michael 16:01, 26 March 2009 (UTC)