Homebrew Project SDL 2 port ongoing

JeffRuLz

Well-Known Member
Member
Joined
Sep 14, 2018
Messages
166
Trophies
0
XP
2,682
Country
United States
If you are willing to create a branch of Abbaye which calls SDL_SetWindowDisplayMode to set the video mode, then it will be easier for me to add the missing support.
Apologies dude, I didn't notice you requested this until now. I made a branch here: https://github.com/JeffRuLz/abbayedesmorts-3ds/tree/wii

First of all, I made it so it sets the display mode to 320x240 if it detects a file called 240p.txt (here). I'm not really sure if I did that correctly.
Also, setting SDL_WII_JOYSTICK_SIDEWAYS doesn't seem to change anything. The d-pad is still oriented like the remote is upright. It's set before SDL_Init so I'm not sure what I'm doing wrong there.

And lastly, since this game runs at 256x192 I wanted to display it in the center of the screen with a border filling the remaining space. When the window size doesn't match the logical size then the game is displayed in the top left corner. I believe the standard SDL behavior is to center the screen to the window, but I may be remembering wrong.
 

Fancy2209

Member
Newcomer
Joined
Aug 8, 2021
Messages
17
Trophies
0
Age
23
XP
131
Country
Portugal

Fancy2209

Member
Newcomer
Joined
Aug 8, 2021
Messages
17
Trophies
0
Age
23
XP
131
Country
Portugal
Also, I (succesfully this time) ported Sonic Robo Blast 2.1.25 to the Wii, but the Joystick api reports there are 0 Joysticks avaliable, this prevents me from using any kind of controller, Wii Remote, Classic Controller or GameCube Controller.
Any ideas? It's not that great to need to plug a keyboard in.
This is the repo: https://github.com/Fancy2209/SRB2/tree/Wii2125
 
Last edited by Fancy2209,

mudrik

Member
OP
Newcomer
Joined
Nov 18, 2022
Messages
24
Trophies
0
Age
31
XP
227
Country
Turkey
Also, I (succesfully this time) ported Sonic Robo Blast 2.1.25 to the Wii, but the Joystick api reports there are 0 Joysticks avaliable, this prevents me from using any kind of controller, Wii Remote, Classic Controller or GameCube Controller.
Any ideas? It's not that great to need to plug a keyboard in.
This is the repo: https://github.com/Fancy2209/SRB2/tree/Wii2125
The problem is that joysticks take some time to appear. You can either change to the polling API, or add this at the beginning of the game (after SDL_init()):
while (SDL_NumJoysticks() == 0) { SDL_PumpEvents(); }
 

MoiCJarod

New Member
Newbie
Joined
Jun 15, 2024
Messages
4
Trophies
0
Age
43
XP
35
Country
France
Hello !
I'm a french computer science teacher triing to make my pupils code some retro games on the wii. Since this year I was using GRRLIB for graphics and asndlib for the sound. Found that sound library was not so good (only 1 sound at a time) and was seeking for other solutions. Then I saw that SDL2 was available in pacman for the wii and wanted to give it a try.

So i tried to compile an exemple (SudokuL) but I went into the "undefined reference to `SDL_main'" error.

steps :
Installing SDL2, SDL2_mixer, SDL2_ttf ... from pacman
downloading SudokuL sources and unzipping
renaming makefile_wii to Makefile
launching make then

/opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld: /opt/devkitpro/portlibs/wii/lib/libSDL2main.a(SDL_wii_main.o): in function `main': /home/davem/projects/devkitpro/pacman-packages/wii/SDL2/src/SDL2-2.28.5/_build/../src/main/wii/SDL_wii_main.c:86:(.text.startup.main+0xcc): undefined reference to `SDL_main' collect2: error: ld returned 1 exit status

What am I doing Wrong ?

Thanks in advance :-)

System : Ubuntu 22.04
 
Last edited by MoiCJarod,

Mode8fx

Active Member
Newcomer
Joined
Nov 14, 2019
Messages
32
Trophies
0
XP
295
Country
United States
Hello !
I'm a french computer science teacher triing to make my pupils code some retro games on the wii. Since this year I was using GRRLIB for graphics and asndlib for the sound. Found that sound library was not so good (only 1 sound at a time) and was seeking for other solutions. Then I saw that SDL2 was available in pacman for the wii and wanted to give it a try.

So i tried to compile an exemple (SudokuL) but I went into the "undefined reference to `SDL_main'" error.

steps :
Installing SDL2, SDL2_mixer, SDL2_ttf ... from pacman
downloading SudokuL sources and unzipping
renaming makefile_wii to Makefile
launching make then

/opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld: /opt/devkitpro/portlibs/wii/lib/libSDL2main.a(SDL_wii_main.o): in function `main': /home/davem/projects/devkitpro/pacman-packages/wii/SDL2/src/SDL2-2.28.5/_build/../src/main/wii/SDL_wii_main.c:86:(.text.startup.main+0xcc): undefined reference to `SDL_main' collect2: error: ld returned 1 exit status

What am I doing Wrong ?

Thanks in advance :-)

System : Ubuntu 22.04
You have to also move the makefile up a directory into SuDokuLVS2019. I put the makefiles in their own subdirectory a while back and forgot to update the readme accordingly; sorry about that!
 

Fancy2209

Member
Newcomer
Joined
Aug 8, 2021
Messages
17
Trophies
0
Age
23
XP
131
Country
Portugal
The problem is that joysticks take some time to appear. You can either change to the polling API, or add this at the beginning of the game (after SDL_init()):
while (SDL_NumJoysticks() == 0) { SDL_PumpEvents(); }
The game doesn't seem to call SDL_Init() in the way you expect as this is not working, and I don't want to rewrite SRB2's Gamepad Handling for the Polling API.
Any ideas?
 
Last edited by Fancy2209,

MoiCJarod

New Member
Newbie
Joined
Jun 15, 2024
Messages
4
Trophies
0
Age
43
XP
35
Country
France
You have to also move the makefile up a directory into SuDokuLVS2019. I put the makefiles in their own subdirectory a while back and forgot to update the readme accordingly; sorry about that!
Hello, and thanks for the answer (and sorry to reply so lately, had boiling milk ringing at the door ;)).

So, effectively, putting the makefile one directory up worked. Analysing your makefile made me found that (on my project) some library were missing.

So to compile an sdl2 C file by hand, you have to do :

compilation :
powerpc-eabi-g++ -Wall -g -mhard-float -meabi -Wall -mrvl -mcpu=750 -DGEKKO -I/opt/devkitpro/libogc/include -I/opt/devkitpro/portlibs/wii/include -c main.cpp -o obj/Debug/main.o
linking :
powerpc-eabi-g++ -L/opt/devkitpro/libogc/lib/wii -L/opt/GRRLIB-master/GRRLIB/GRRLIB -L/opt/GRRLIB-master/GRRLIB/lib/pngu -L/opt/devkitpro/portlibs/ppc/lib/ -L/opt/devkitpro/portlibs/wii/lib -o bin/Debug/PrjSonSDL2.elf obj/Debug/main.o -lSDL2_ttf -lharfbuzz -lSDL2_mixer -lvorbisidec -lmodplug -lstdc++ -lmpg123 -lopusfile -lopus -lFLAC -logg -lSDL2_image -lSDL2main -lSDL2 -lwiikeyboard -lbz2 -lpng16 -lfat -ljpeg -laesnd -Wl,-Map,boot.map,--section-start,.init=0x80a00100 -mrvl -mcpu=750 -meabi -mhard-float -lwiiuse -lbte -logc -lm

Did I put some libraries that are not needed ? Did I forget some ? Is the order ok ? I only tried to make an application using the SDL2 sound interface and it is compiling and working well.

Thanks
 

chippiti

New Member
Newbie
Joined
Oct 20, 2020
Messages
4
Trophies
0
Location
hell
XP
93
Country
United States
I can't for the life of me figure out how the wii remote input is supposed to work. I know I opened the joystick and all that stuff. I tested my code with an xbox controller on pc and it worked fine. I tinkered with my joystick initialisation code and found that it is detecting the wii remote, but none of my inputs do anything. Is there some sort of extra step I'm missing for SDL on the wii?
 

MoiCJarod

New Member
Newbie
Joined
Jun 15, 2024
Messages
4
Trophies
0
Age
43
XP
35
Country
France
Hello everyone !
I just upgraded all my devkitpro stuff with a pacman -Sy then pacman -Su command and all my SDL2 projects did not want to compile and link anymore, messages were :
/opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.1.0/../../../../powerpc-eabi/bin/ld: /opt/devkitpro/portlibs/wii/lib/libSDL2.a(SDL_ogcgl.o): in function `SDL_OGC_GL_GetProcAddress': /home/davem/projects/devkitpro/pacman-packages/wii/SDL2/src/SDL2-2.28.5/_build/../src/video/ogc/SDL_ogcgl.c:45:(.text.SDL_OGC_GL_GetProcAddress+0x4): undefined reference to `ogx_get_proc_address' /opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.1.0/../../../../powerpc-eabi/bin/ld: /opt/devkitpro/portlibs/wii/lib/libSDL2.a(SDL_ogcgl.o): in function `SDL_OGC_GL_CreateContext': /home/davem/projects/devkitpro/pacman-packages/wii/SDL2/src/SDL2-2.28.5/_build/../src/video/ogc/SDL_ogcgl.c:58:(.text.SDL_OGC_GL_CreateContext+0x34): undefined reference to `ogx_initialize'

After reverting some of the upgraded packages, I found that there may be a bug in the last wii-sdl2 package (version 2.28.5-13). Backing to version 2.28.5-12 does not show any error linking message and the obtained executable is working well.
 

Mode8fx

Active Member
Newcomer
Joined
Nov 14, 2019
Messages
32
Trophies
0
XP
295
Country
United States
Don't know if this is an SDL2-specific issue, but I also see that after updating my packages recently, my Wii and GC versions of SuDokuL no longer compile, giving this error:

Code:
powerpc-eabi-g++ -Os -Wall -Wextra -DLINUX -DPC -DMOUSE_INPUT `sdl2-config --cflags`   -lSDL2_image -lSDL2_ttf -lSDL2_mixer -lstdc++ -lmikmod `sdl2-config --libs` -o sudokul
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.1.0/../../../../powerpc-eabi/bin/ld.exe: cannot find -lmikmod: No such file or directory
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/d/GitHub/SuDokuL/SuDokuLVS2019/Makefile:23: sudokul] Error 1
make: *** [Makefiles/makefile_gc:112: build_gc] Error 2

It looks like mikmod is missing, but the same code used to compile fine, and I don't see Wii/GC mikmod anywhere in devkitPro. Here's the relevant part of the GC makefile:
Makefile:
CFLAGS    = `$(PREFIX)pkg-config --cflags sdl2 SDL2_ttf SDL2_gfx SDL2_mixer SDL2_image freetype2` -g -O2 -Wall $(MACHDEP) $(INCLUDE) -DGAMECUBE -DCONSOLE
CXXFLAGS    =    $(CFLAGS)

LDFLAGS    =    -g $(MACHDEP) -Wl,-Map,$(notdir $@).map

LIBS    :=    `$(PREFIX)pkg-config --libs sdl2 SDL2_ttf SDL2_gfx SDL2_mixer SDL2_image freetype2` -lfat -logc -lm -lopus
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    DexterYeen @ DexterYeen: also why are there ads , I have patron shit