Difference between revisions of "Talk:SDL Wii"

From WiiBrew
Jump to navigation Jump to search
m
 
(32 intermediate revisions by 17 users not shown)
Line 1: Line 1:
News from [http://www.dcemu.co.uk/sdl-wii-ports-released-127263.html DCEmu]
+
{{Archive box|[[/Archive 1]]}}
  
==SDL Wii Ports Released==
+
{{notice|'''This page is reserved for feature requests, and general discussion about the page itself. Please ask questions on the [http://forum.wiibrew.org WiiBrew Forums], and please report bugs on the official [http://code.google.com/p/sdl-wii/issues/ Google Code] site.'''}}
  
July 31st, 2008, 03:09 Posted By: wraggster
+
__TOC__
  
ilidrissiamine has released several new items of interest to wii developers:
+
== 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.
 +
--[[User:Woku|Woku]] 13:07, 12 January 2009 (UTC)
  
This project will introduce many ports of SDL games to the Nintendo Wii and will provide various libraries for SDL developers that extend it.  
+
To port a game, you must first have its source code. Then change the events that use the keyboard or the mouse and replace them with wiimote controls from wiiuse. --[[User:Salehhamadeh|Sal3000]] 11:20, 24 April 2009 (UTC)
 +
: Someone should write a more thorough tutorial! There's still lots of SDL stuff people could port. --[[User:Tantric|Tantric]] 15:34, 24 April 2009 (UTC)
 +
:: As someone who just finished re-writing a great portion of SDL-Wii I think you're a great candidate! ;) Seriously though I would love to see a good tutorial or even just an API reference written. I am madly reading the main SDL tutorial in the hope of figuring out if I can attempt to port the Intellivision emulator jzInTV to the Wii, a programme that thankfully already uses SDL. My biggest problem, aside from never using SDL before, is emulation of the 12+ button keypad. Anyway bring on a good tutorial / reference it would certainly help me in my quest - if I ever really start it. [[User:Ensign R|Ensign R]] 02:07, 1 May 2009 (UTC)
  
* SDL_gfx-2.0.17.7z SDL_gfx port to the Nintendo Wii
+
== __static_initialization_and_destruction_0 error ==
* SDL_ttf-2.0.9.7z 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
 
  
 +
When my program is about to begin linking it gets this error:
 +
<pre>
 +
File:main.o: In function `__static_initialization_and_destruction_0':
 +
j:/D0g_Engine/source/main.cpp:11: undefined reference to `Timer::Timer()'
 +
main.o: In function `SDL_main':
 +
j:/D0g_Engine/source/main.cpp:15: undefined reference to `cGFXCore::cGFXCore()'
 +
j:/D0g_Engine/source/main.cpp:22: undefined reference to `cObjectController::cObjectController()'
 +
j:/D0g_Engine/source/main.cpp:25: undefined reference to `initInput()'
 +
</pre>
 +
And so on...
  
http://code.google.com/p/sdl-wii-ports/downloads/list
 
  
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. --[[User:Vader347|vader347]] 00:19, 1 August 2008 (CEST)
+
So in short, basically every function/class I've defined doesn't appear to exist to the linker, this code compiles fine for Windows so is there a setting in the makefile or something else I missed to avoid this?
  
Ah you are right. Somehow I missed the second download link! [[User:CarstenK|CarstenK]] 05:03, 1 August 2008 (CEST)
+
Thanks in advance, [[User:Doogie|Doogie]] 10:31, 3 May 2009 (UTC)
  
==Example?==
+
== Cannot compile the template ==
  
Can someone please write an example of how SDL works with devkitpro please?
+
I copied the template and all the sdl includes with the libs and dependencies into the libogc folder. I tried to compile it using programmers notepad.
Thanks ahead of time!
 
  
[[User:Akirahedgehog|Akirahedgehog]] 09:49, 12 August 2008 (Central Time)
+
This is the output:  
 +
<pre>
 +
> "make"
 +
template.c
  
 +
linking ... SDL_template.elf
  
----
+
c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wii_main.o): In function `main':
  
There are no many differances with a pc version.  
+
C:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/main/wii/SDL_wii_main.c:68: undefined reference to `MOUSE_Init'
Just include devkitppc headers to use with sdl (fat, wiiuse...)
 
Anyway, there is a blue screen exemple, quit with HOME
 
  
 +
C:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/main/wii/SDL_wii_main.c:69: undefined reference to `KEYBOARD_Init'
  
<source lang="C">
+
c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wiievents.o): In function `PumpEvents':
#include <stdlib.h>
 
#include <time.h>
 
  
#include <SDL/sdl.h>
+
C:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/video/wii/SDL_wiievents.c:64: undefined reference to `KEYBOARD_GetEvent'
//#include <SDL/sdl_mixer.h>
 
//#include <SDL/sdl_ttf.h>
 
  
#include <gccore.h>
+
C:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/video/wii/SDL_wiievents.c:65: undefined reference to `MOUSE_GetEvent'
#include <wiiuse/wpad.h>
 
  
 +
collect2: ld returned 1 exit status
  
int main(int argc, char** argv)
+
make[1]: *** [/c/devkitPro/examples/wii/SDL_template/SDL_template.elf] Error 1
{
 
    SDL_Surface *screen=NULL;
 
    srand(time(NULL));
 
 
 
    // initialize SDL video
 
    if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0 )
 
    {
 
        fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError() );
 
        exit(EXIT_FAILURE);
 
    }
 
 
 
fatInitDefault(); //for read files (level, serialized structs...)
 
WPAD_Init();
 
 
    // make sure SDL cleans up before exit
 
    atexit(SDL_Quit);
 
    SDL_ShowCursor(SDL_DISABLE);
 
 
 
    // create a new window
 
    screen = SDL_SetVideoMode(640, 480, 16, SDL_DOUBLEBUF);
 
    if ( !screen )
 
    {
 
        fprintf(stderr, "Unable to set video: %s\n", SDL_GetError());
 
        exit(EXIT_FAILURE);
 
    }
 
 
 
state_in_game(screen);
 
 
 
 
    return 0;
 
}
 
 
 
void state_in_game(SDL_Surface *screen)
 
{
 
    int tick_count=0;
 
    int tick_trigger=15;
 
bool done = false;
 
 
 
    SDL_EnableKeyRepeat(10,10);
 
 
 
 
 
    while (!done)
 
    {
 
        SDL_Event event;
 
 
 
        while (SDL_PollEvent(&event))
 
        {
 
            switch ( event.type )
 
            {
 
            case SDL_QUIT:
 
                done = true;
 
                break;
 
            }
 
        }
 
  
        //With SDL_Event, the wiimote is detected as a mouse, to use wiiuse/wpad to handle inputs
+
"make": *** [build] Error 2
WPAD_ScanPads();
 
        u32 held = WPAD_ButtonsHeld(WPAD_CHAN_0);
 
 
if(held & WPAD_BUTTON_HOME){
 
done=true;
 
}
 
  
        tick_count = SDL_GetTicks();
+
> Process Exit Code: 2
        if (tick_count > tick_trigger)
 
        {
 
            tick_trigger = tick_count;
 
            SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 50, 150));
 
  
            SDL_Flip(screen);
+
> Time Taken: 00:02
        }  //end tick
+
</pre>
 
    }  //end while
 
 
SDL_Quit();
 
exit(EXIT_SUCCESS);
 
}
 
</source>
 
  
--[[User:TheDrev|TheDrev]] 18:24, 21 October 2008 (UTC)
+
That question was asked on my SDL Tutorial talk page. I also had that error so I reinstalled Devkit with the older SDL version. How do I update Libogc to the SVN version the right way? So without having this error? [[User:GabberNL|GabberNL]] 17:02, 18 June 2009 (UTC)
 +
:Just do a checkout with this path: https://devkitpro.svn.sourceforge.net/svnroot/devkitpro/trunk/libogc<br />It's explain here:https://sourceforge.net/scm/?type=svn&group_id=114505 -[[User:Crayon|Crayon]] 18:45, 18 June 2009 (UTC)
  
== Bad libs order ? ==
+
:Very important is order of libs. If wiikeyboard is before SDL it does not work
 +
Try this:
 +
-lSDL_ttf -lSDL_gfx -lSDL_mixer -lsmpeg -lSDL_image -lfreetype -ljpeg -lpng -lSDL -lz -lfat -lwiiuse -lwiikeyboard -lbte -logc -lm
 +
-[[User:Slappy|Slappy]] <span style="font-size: smaller;" class="autosigned">—Preceding undated comment added 12:08, 31 July 2009 (UTC).</span><!--Template:Undated-->
  
I got the following error :  
+
== SDL_mixer not in the root makefile ==
 +
Had to make / make install it separately - caused me some pain until I figured it out.[[User:Madmanguruman|Madmanguruman]] 02:07, 28 July 2009 (UTC)
  
linking ... blastguy_wii_b1.elf
+
== couple of things ==
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  
+
1) I'm getting an error with devkitPPC_r17-i686-linux.tar.bz2 and SDL Wii 08-04-2009.zip
 +
/devkitPPC/bin/../lib/gcc/powerpc-gekko/4.2.4/../../../../powerpc-gekko/include/stdint.h:244: error: conflicting types for 'uintptr_t'
 +
/libogc/include/SDL/SDL_config_minimal.h:39: error: previous declaration of 'uintptr_t' was here
 +
I commented out that declaration in SDL since they are identical
 +
2) the article says to include -lwiikeybord but that library does not seem to be part of latest released libogc (171a?)
 +
3) sdl-config would really be great to have. I can share what I'm using, although I don't include a lot of libraries mentioned in Usage section
 +
[[User:Spec|Spec]] 02:38, 13 August 2009 (UTC)
  
LIBS := -lSDL_ttf -lSDL_mixer -lSDL_image -ljpeg -lpng -lz -lSDL -lfreetype -lfat -lwiiuse -lbte -logc -lm
+
== SDL_Mixer: Mix_PlayMusic playback is very slow ==
 +
Hi. I have a strange bug with the SDL_Mixer. When I use the couple of fonction Mix_LoadMUS and Mix_PlayMusic with audio files (Wav or MP3) the SDL lib behaves strangely: All played musics are slowed down and if I whant to get a "good" result I have to increase manualy the pitch of my audio files (+35%)... Someone have an idea ?
 +
--[[User:BScrk|BScrk]] <span style="font-size: smaller;" class="autosigned">—Preceding undated comment added 02:50, 21 October 2009 (UTC).</span><!--Template:Undated-->
 +
: That's not a bug. Your files should be encoded to 32khz or 48khz, the audio port code doesn't handle conversion. --[[User:Tantric|Tantric]] 04:59, 21 October 2009 (UTC)
 +
:: Indeed, it's work fine using 32Khz encoding ! Thank you --[[User:BScrk|BScrk]] 22 October 2009
  
I changed the lib order in the main page
+
== sdl_gfx ==
  
--[[User:TheDrev|TheDrev]] 15:25, 15 October 2008 (CEST)
+
Any chance the sdl_gfx library will ever be fixed for Wii? My program relies heavily on the primitive drawing functions and I'm getting dumps. *sigh* if only sdl_draw supported triangles... [[User:Aeron|Aeron]] 03:20, 6 March 2010 (UTC)
  
:Your libfreetype is either buggy, or was built incorrectly.  You shouldn't have a main() in this library.--[[User:Michael|Michael]] 15:05, 13 April 2009 (UTC)
 
  
I grabbed the lib included in libwiisprite, Apparently a .o having a main function comes from a test program is included in the .a
+
== This Tutorial Is Broken ==
I've removed the object with $ ar d libfreetype.a gxvfgen.o  It should have resolved the linker error
+
This tutorial no longer seems to work. I'm getting an assortment of errors.  Could someone please add version number or file links that are compatible with this tutorial? <small>—Preceding unsigned comment added by [[User:Wiibrew111|Wiibrew111]] ([[User talk:Wiibrew111|talk]] • [[Special:Contributions/Wiibrew111|contribs]]) 20:39, 26 May 2012 (CEST)</small>
--[[User:TheDrev|TheDrev]] 09:07, 15 April 2009 (UTC)
+
I noticed that in the WII SDL page (http://wiibrew.org/wiki/SDL_Wii ) the gamecube controller support is not documented.
:Nice, thanks for that tip with ar. That's useful to know. --[[User:Michael|Michael]]
 
  
== Threads? ==
+
== Gamecube controller support==
  
This is a great port, and I'm sure it will help porting go a lot smoother for some people.
+
It is not documented, but from the code it seems that SDL Wii should support also the gamecube controllers which should be mapped to SDL joystick 4-7 (Wii controllers are mapped to 0-3), the stick axes and the pad are associated as in the Wii classsic controller and the buttons are with this order:
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 --[[User:SquidMan|SquidMan]] 02:00, 17 December 2008 (UTC)
 
  
[[User:Yohanes|Yohanes]] has '''added threads''' and '''USB keyboard''' support to the SDL library while porting [[WiiApple|an apple ][e SDL based emulator]] to the wii.  You can find his SDL code here [http://tinyhack.com/wii/wiiapple/ http://tinyhack.com/wii/wiiapple/] 11, January, 2009. <small>—Preceding unsigned comment added by [[User:Nowhereman|Nowhereman]] ([[User talk:Nowhereman|talk]] • [[Special:Contributions/Nowhereman|contribs]]) 21:53, 11 January 2009 (UTC)</small>
+
BUTTON 0 = A,
 +
BUTTON 1 = B,
 +
BUTTON 2 = X,
 +
BUTTON 3 = Y,
 +
BUTTON 4 = Z,
 +
BUTTON 5 = R,
 +
BUTTON 6 = L,
 +
BUTTON 7 = START
  
== sdl-config ==
+
I can not say if the support works since I do not have a gamecube controller to test
  
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.
+
[[User:Oibaf|Oibaf]] 1 Jan 2013 (UTC)
  
:Right, sdl-config is just a shell script for handling includes, flags, etc more easily, the important thing is just to have sdl-config in your PATH
+
There were some bugs in the code. Not it is fixed.
  --with-sdl-prefix=PFX  Prefix where SDL is installed (optional)
 
  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)
 
are maybe what set the path before compiling the lib...  
 
  
 
+
[[User:Oibaf|Oibaf]] 28 Oct 2013 (UTC)
--[[User:TheDrev|TheDrev]] 09:24, 15 April 2009 (UTC)
 
 
 
== 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.
 
--[[User:Woku|Woku]] 13:07, 12 January 2009 (UTC)
 

Latest revision as of 23:08, 28 October 2013

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)

To port a game, you must first have its source code. Then change the events that use the keyboard or the mouse and replace them with wiimote controls from wiiuse. --Sal3000 11:20, 24 April 2009 (UTC)

Someone should write a more thorough tutorial! There's still lots of SDL stuff people could port. --Tantric 15:34, 24 April 2009 (UTC)
As someone who just finished re-writing a great portion of SDL-Wii I think you're a great candidate! ;) Seriously though I would love to see a good tutorial or even just an API reference written. I am madly reading the main SDL tutorial in the hope of figuring out if I can attempt to port the Intellivision emulator jzInTV to the Wii, a programme that thankfully already uses SDL. My biggest problem, aside from never using SDL before, is emulation of the 12+ button keypad. Anyway bring on a good tutorial / reference it would certainly help me in my quest - if I ever really start it. Ensign R 02:07, 1 May 2009 (UTC)

__static_initialization_and_destruction_0 error

When my program is about to begin linking it gets this error:

File:main.o: In function `__static_initialization_and_destruction_0':
j:/D0g_Engine/source/main.cpp:11: undefined reference to `Timer::Timer()'
main.o: In function `SDL_main':
j:/D0g_Engine/source/main.cpp:15: undefined reference to `cGFXCore::cGFXCore()'
j:/D0g_Engine/source/main.cpp:22: undefined reference to `cObjectController::cObjectController()'
j:/D0g_Engine/source/main.cpp:25: undefined reference to `initInput()'

And so on...


So in short, basically every function/class I've defined doesn't appear to exist to the linker, this code compiles fine for Windows so is there a setting in the makefile or something else I missed to avoid this?

Thanks in advance, Doogie 10:31, 3 May 2009 (UTC)

Cannot compile the template

I copied the template and all the sdl includes with the libs and dependencies into the libogc folder. I tried to compile it using programmers notepad.

This is the output:

> "make" 
template.c

linking ... SDL_template.elf

c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wii_main.o): In function `main':

C:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/main/wii/SDL_wii_main.c:68: undefined reference to `MOUSE_Init'

C:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/main/wii/SDL_wii_main.c:69: undefined reference to `KEYBOARD_Init'

c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wiievents.o): In function `PumpEvents':

C:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/video/wii/SDL_wiievents.c:64: undefined reference to `KEYBOARD_GetEvent'

C:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/video/wii/SDL_wiievents.c:65: undefined reference to `MOUSE_GetEvent'

collect2: ld returned 1 exit status

make[1]: *** [/c/devkitPro/examples/wii/SDL_template/SDL_template.elf] Error 1

"make": *** [build] Error 2

> Process Exit Code: 2

> Time Taken: 00:02

That question was asked on my SDL Tutorial talk page. I also had that error so I reinstalled Devkit with the older SDL version. How do I update Libogc to the SVN version the right way? So without having this error? GabberNL 17:02, 18 June 2009 (UTC)

Just do a checkout with this path: https://devkitpro.svn.sourceforge.net/svnroot/devkitpro/trunk/libogc
It's explain here:https://sourceforge.net/scm/?type=svn&group_id=114505 -Crayon 18:45, 18 June 2009 (UTC)
Very important is order of libs. If wiikeyboard is before SDL it does not work

Try this: -lSDL_ttf -lSDL_gfx -lSDL_mixer -lsmpeg -lSDL_image -lfreetype -ljpeg -lpng -lSDL -lz -lfat -lwiiuse -lwiikeyboard -lbte -logc -lm -Slappy —Preceding undated comment added 12:08, 31 July 2009 (UTC).

SDL_mixer not in the root makefile

Had to make / make install it separately - caused me some pain until I figured it out.Madmanguruman 02:07, 28 July 2009 (UTC)

couple of things

1) I'm getting an error with devkitPPC_r17-i686-linux.tar.bz2 and SDL Wii 08-04-2009.zip /devkitPPC/bin/../lib/gcc/powerpc-gekko/4.2.4/../../../../powerpc-gekko/include/stdint.h:244: error: conflicting types for 'uintptr_t' /libogc/include/SDL/SDL_config_minimal.h:39: error: previous declaration of 'uintptr_t' was here I commented out that declaration in SDL since they are identical 2) the article says to include -lwiikeybord but that library does not seem to be part of latest released libogc (171a?) 3) sdl-config would really be great to have. I can share what I'm using, although I don't include a lot of libraries mentioned in Usage section Spec 02:38, 13 August 2009 (UTC)

SDL_Mixer: Mix_PlayMusic playback is very slow

Hi. I have a strange bug with the SDL_Mixer. When I use the couple of fonction Mix_LoadMUS and Mix_PlayMusic with audio files (Wav or MP3) the SDL lib behaves strangely: All played musics are slowed down and if I whant to get a "good" result I have to increase manualy the pitch of my audio files (+35%)... Someone have an idea ? --BScrk —Preceding undated comment added 02:50, 21 October 2009 (UTC).

That's not a bug. Your files should be encoded to 32khz or 48khz, the audio port code doesn't handle conversion. --Tantric 04:59, 21 October 2009 (UTC)
Indeed, it's work fine using 32Khz encoding ! Thank you --BScrk 22 October 2009

sdl_gfx

Any chance the sdl_gfx library will ever be fixed for Wii? My program relies heavily on the primitive drawing functions and I'm getting dumps. *sigh* if only sdl_draw supported triangles... Aeron 03:20, 6 March 2010 (UTC)


This Tutorial Is Broken

This tutorial no longer seems to work. I'm getting an assortment of errors. Could someone please add version number or file links that are compatible with this tutorial? —Preceding unsigned comment added by Wiibrew111 (talkcontribs) 20:39, 26 May 2012 (CEST) I noticed that in the WII SDL page (http://wiibrew.org/wiki/SDL_Wii ) the gamecube controller support is not documented.

Gamecube controller support

It is not documented, but from the code it seems that SDL Wii should support also the gamecube controllers which should be mapped to SDL joystick 4-7 (Wii controllers are mapped to 0-3), the stick axes and the pad are associated as in the Wii classsic controller and the buttons are with this order:

BUTTON 0 = A, BUTTON 1 = B, BUTTON 2 = X, BUTTON 3 = Y, BUTTON 4 = Z, BUTTON 5 = R, BUTTON 6 = L, BUTTON 7 = START

I can not say if the support works since I do not have a gamecube controller to test

Oibaf 1 Jan 2013 (UTC)

There were some bugs in the code. Not it is fixed.

Oibaf 28 Oct 2013 (UTC)