Welcome! Log In Create A New Profile


Porting using Wii SDL

Posted by hybridreality 
Porting using Wii SDL
June 01, 2009 10:17PM
This may seem like a completely noobish question but I'm hitting a point here that's driving me mad.

I've been spending the best part of two days to port over different programs to the wii but I'm having absolutely zero luck.

I've got the newest version of SDL wii in the right place in my devkitpro folder, I have libogc but I can't seem to compile anything properly. I've followed the tutorials on codemii and on wiibrew but nothing has compiled aside from the example in the devkitpro folder.

So could anyone help me with some kind of information on porting over programs to work in sdl wii?
Re: Porting using Wii SDL
June 01, 2009 11:32PM
What errors are you getting? Can you please list them so we can find a solution.
Re: Porting using Wii SDL
June 01, 2009 11:50PM
I was trying to port over an SDL program called airpong as I read on here that it was a very simple SDL program.

I first attempted to simply compile it normally, without messing with any of the code - but I'm getting this error.

"make" : *** [airpong.o] Error 127
Re: Porting using Wii SDL
June 02, 2009 05:03AM
airpong uses SDL + OpenGL. That makes it more difficult.

There are easier things to port out there. For instance, the SDL games at lgames (lpairs, lbreakout, lmarbles) are all easily portable to the Wii. If you're dead set on porting airpong, I believe there's an SDL version compatible with OpenGL (gl2gx), included with the source for Freespace2Wii.

The make error is because make can't find some program it needs to build the app†. If you're using the Makefile included with airpong, it uses 'sdl-config' to figure out your SDL cflags and ldflags, you're likely missing that program. I'm not sure if we have a Wii version of sdl-config, so you would have to modify the makefile.

When I start a port, I first build the app on a PC and take note of the various gcc/g++/ld flags it uses. If the app is fairly simple, I try the standard Wii makefile from devkitpro, adding any important flags I noted from the PC build. If that fails, I try and run the configure script, if present, and then if that fails I hand edit the PC Makefile.

† An example of the make error:

% cat Makefile
some_program_that doesnt_exist #note there's a TAB at the start of this line

% make
make: *** [all] Error 127

Re: Porting using Wii SDL
June 02, 2009 09:23AM
Thanks for the help.

I tried to download one of the games from lgames, breakout to be exact but now the problem I'm having is not being able to find a make command in any of the files.

Running make on the makefile - as it was said to do in the tutorials I've followed just brings up an error that there is no make command.

I get the feeling I'm missing something really ridiculous here.

Edit: I think I managed to get it to build, but all it's doing on the wii is displaying a black screen.

Not sure what's going on.

Edit again: Got it to compile in a different way, this time I'm getting hundreds of error messages from missing things - my feeling is that it's not finding the SDL library, but it's there, and set in the LIBS part of the makefile.

Edited 2 time(s). Last edit at 06/02/2009 03:41PM by hybridreality.
Re: Porting using Wii SDL
June 02, 2009 04:38PM
lbreakout has a configure script. Ideally all you would need to do is run that and type make, but the configure script doesn't know about Wii dev stuff. Since this port is not very complicated, I just use the standard Makefile template from devkitpro and add in the SDL flags, as well as the flags the game needs.

Since this game uses file I/O, you'll need to initialize FAT in main.cpp with 'fatInitDefault()'. This game also tries to read an environmental variable called 'HOME'. Since the Wii doesn't have these, you need to manually set this to where you want 'HOME' to be. I set it to "", so all file access is relative to the the root dir on the SD card. You may want to set this to something else later.

I also had a problem with a missing function, ftime(). ftime() is being used to seed the random number generator, I just temporarily got rid of this call. You'd want to fix this later.

That's as far as I got. Now you'd need to run the dol on the Wii, and see what happens. The likely problem you'll run into is the game will try and access some files it expects, and won't find them. Then you just need to figure out where it's looking and make sure you have those in place on your SD card.

Re: Porting using Wii SDL
June 02, 2009 07:16PM
How did you find out which flags there are?

All the makefile says is @flags@.

Any chance you could post the makefile you were using?
Re: Porting using Wii SDL
June 02, 2009 08:05PM
Asking questions is fine, but you have to do some leg-work yourself. That's how it's done. Take a look through the source, look at the make and config files, and look at what was done for other projects. If you have a specific question, ask then. And Google is your best friend.
Re: Porting using Wii SDL
June 02, 2009 08:08PM
When you run 'configure' on a Linux system, you'll get a working makefile for Linux. I just run that, take a look at the flags on the compile lines and the final link line. If you can't build on working platform, you'd have to dig into the autoconf/automake scripts.

My makefile is just the template makefile from devkit pro + SDL + the few flags this game needs. For SDL, you need to add to your makefile the path to the SDL include files, and link against the SDL library.

Here are the lines specific to this port from my Makefile:
CFLAGS	= 	... -DSRC_DIR=\"lbreakout/\" -DHI_DIR=SRC_DIR -DVERSION=\"0.1\"  \
                              -DWII -DSDL_1_1_5 -I$(SDLDIR)/include

LDFLAGS = ... -L$(SDLDIR)/lib -lSDL -lfat

Re: Porting using Wii SDL
June 02, 2009 08:59PM
This just isn't working, changed the flags to the same as yours, added in the sdl directory to libdirs, tried adding in the entirety of wii sdl to the source folder of the game and no luck.

This is driving me mad, it may not be helping that I'm attempting all this on Windows and it seems as though its easier on linux.
Re: Porting using Wii SDL
June 02, 2009 09:26PM
It sounds like you need to put the SDL porting on hold, and get your dev environment working better. I'd start by trying to compile simple programs you write. If those compile/link fine, then attempt to get SDL working. Here's a simple SDL main program you can use to check that you can compile and link SDL apps:

#include "SDL.h"

int main(int argc, char *argv[]) {

Re: Porting using Wii SDL
June 02, 2009 09:41PM
I'm quite close to getting it to compile now, turns out I was missing out the cxxflags, only problem now is I have a new error code.

cc1plus.exe: error: unrecognised command line option "-fc:/devkitpro/libogc/include"

Reading that, I know there are issues with that kind of file path, but I shouldn't have to modify any exe files?

I'll give it a go with that piece of code - thanks for all the help Michael.

Edit: Tried to compile that, still getting the same error - or similar at least.

cc1.exe: error: unrecognised command line option "-fc:/devkitpro/libogc/include"

Edited 3 time(s). Last edit at 06/02/2009 09:49PM by hybridreality.
Re: Porting using Wii SDL
June 03, 2009 04:27AM
None of the gcc/g++ -f<options> take a path to an include dir. It looks like maybe that -f should have been a -I, which would make more sense. Take a look at your Makefile, and see if there's a '-f' somewhere.

Re: Porting using Wii SDL
June 03, 2009 12:57PM
Looking at it, I think that code is coming up just as a big error that's ruining everything else.

It doesn't seem to be able to find the SDL libraries, even though I have them coded in everywhere I can think they should be.


It's telling me it can't find any of the SDL libraries, and then coming up with a bunch of messages about how the code is wrong - which I assume is because the commands don't exist without the correct libraries.
Re: Porting using Wii SDL
June 03, 2009 07:59PM
I would take Michael's advice and try building an existing SDL project first, that you know should build fine. An example is [code.google.com]

Once you can build that app fine, then go back to your porting.
Re: Porting using Wii SDL
June 03, 2009 08:10PM
Thanks Tantric, I couldn't get the source for that - but I used the source for HandySDL which worked fine compiling.

Although SDL is included with the file in that one.

Oh no wait, it wouldn't compile. Came to an error when it tried to link the elf file.

Edited 1 time(s). Last edit at 06/03/2009 08:10PM by hybridreality.
Re: Porting using Wii SDL
November 01, 2009 12:47AM
I think it was me that may have, accidentally, misled you regarding airpong. The version I was working on was prior to the one that uses openGL. Anyone wanting to try that example should look on the author's site for that old version. I got somewhere very quickly with that, but I never finished it due to other commitments. As best I'm aware, "all" I had left to do was change it so that you could play the game with a wiimote or classic/gamecube controller.

Now I've got a bit more freedom about how I spend my free time I might try to finish that off so that I can get on with porting a few more games. One day, maybe, I might even do an original game, just before hell freezes over :-O

Edited 1 time(s). Last edit at 11/01/2009 12:47AM by CookieNinja.
Sorry, only registered users may post in this forum.

Click here to login