noob compiling issues

HunterZ
Posts: 19
Joined: Mon Sep 12, 2011 3:58 am
Location: Seattle

Re: noob compiling issues

Post by HunterZ » Wed Sep 21, 2011 6:33 am

Also getting SDL_image IMG_png.c errors:

Code: Select all

cd SDL_image; make -f Makefile
make[1]: Entering directory `/opt/devkitpro/projects/sdl-wii/SDL_image'
Compiling src/IMG_png.c
src/IMG_png.c: In function 'IMG_InitPNG':
src/IMG_png.c(238) :20: warning: assignment from incompatible pointer type [enabled by default]
src/IMG_png.c(239) :21: warning: assignment from incompatible pointer type [enabled by default]
src/IMG_png.c(248) :19: warning: assignment from incompatible pointer type [enabled by default]
src/IMG_png.c: In function 'IMG_LoadPNG_RW':
src/IMG_png.c(348) :21: error: dereferencing pointer to incomplete type
src/IMG_png.c(417) :21: error: dereferencing pointer to incomplete type
src/IMG_png.c(419) :28: error: dereferencing pointer to incomplete type
src/IMG_png.c(427) :22: error: dereferencing pointer to incomplete type
src/IMG_png.c(475) :25: error: dereferencing pointer to incomplete type
src/IMG_png.c(476) :30: error: dereferencing pointer to incomplete type
src/IMG_png.c(477) :23: error: dereferencing pointer to incomplete type
src/IMG_png.c(478) :38: error: dereferencing pointer to incomplete type
src/IMG_png.c(479) :38: error: dereferencing pointer to incomplete type
src/IMG_png.c(480) :38: error: dereferencing pointer to incomplete type
Archiving lib/libSDL_image.a
powerpc-eabi-ar: obj/IMG_png.o: No such file or directory
make[1]: *** [lib/libSDL_image.a] Error 1
make[1]: Leaving directory `/opt/devkitpro/projects/sdl-wii/SDL_image'
make: *** [all] Error 2

WinterMute
Site Admin
Posts: 1845
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: noob compiling issues

Post by WinterMute » Wed Sep 21, 2011 1:08 pm

tueidj wrote:It's probably a bit late to be mentioning this but if you look at the SDL-wii source code I included in the Corsix-TH source package, it includes a rewritten audio backend (using libaesnd for format/rate conversion and correct channel ordering) and substantial changes to the video backend including a widescreen mode (848x480), hardware palette support and on-demand screen refresh (unlike the old code which constantly redraws the screen).
That sounds rather nice actually, how would you feel about attempting to get it into the autotoolized SDL I'm working on? Would be good if you could pop by the blitzed IRC channels too.
HunterZ wrote:Also getting SDL_image IMG_png.c errors:
These look like SDL_image might need updating for latest libpng - I had a few problems with some other projects. I had a quick look at building SDL_image but I'm having some trouble getting the configure to accept that it's being set up to cross compile and picking the wrong libraries.
make[1]: Leaving directory `/opt/devkitpro/projects/sdl-wii/SDL_image'
make: *** [all] Error 2[/code]
Sort of a personal preference here but I keep personal projects in my home directory and out of the devkitpro folder. On windows the installer deletes things in there to avoid building up cruft from modified examples and old toolchains. Ideally I'd like to have an autoupdate process on linux that does something similar.
Help keep devkitPro toolchains free, Donate today

Personal Blog

tueidj
Posts: 40
Joined: Thu Dec 10, 2009 9:26 am

Re: noob compiling issues

Post by tueidj » Wed Sep 21, 2011 2:12 pm

HunterZ wrote:The only other outstanding issue I have is that the Wiimote cursor seems overly-sensitive and tends to stick to the screen edges.
Manually setting the wiimote pointer resolution so it's higher than the video resolution can help with this. Just remember to offset the return pointer values by half the overlap area.
Edit: I'm getting the following error trying to compile your sdl-wii source from CorsixTH-wii-src.zip:

Code: Select all

src/audio/wii/SDL_wiiaudio.c: In function 'WIIAUD_OpenAudio':
src/audio/wii/SDL_wiiaudio.c(154) :13: error: 'VOICE_MONO8_UNSIGNED' undeclared (first use in this function)
src/audio/wii/SDL_wiiaudio.c(154) :13: note: each undeclared identifier is reported only once for each function it appears in
I did a 'find /opt/devkitpro | xargs grep VOICE_MONO8_UNSIGNED' and came up empty, other than the offending line in SDL_wiiaudio.c.

Edit 2: Looks like it's something missing from my version of /opt/devkitpro/libogc/include/aesndlib.h which I think is from the latest libogc 1.8.8?

Code: Select all

#define VOICE_MONO8                             0x00000000
#define VOICE_STEREO8                   0x00000001
#define VOICE_MONO16                    0x00000002
#define VOICE_STEREO16                  0x00000003
My bad, I modified my local copy of libaesnd to handle a few extra formats and never submitted the patches. I'll have to dig out the dsp code from my other PC. I never changed any of the SDL_Image code, that's straight from sdl-wii's SVN.
That sounds rather nice actually, how would you feel about attempting to get it into the autotoolized SDL I'm working on? Would be good if you could pop by the blitzed IRC channels too.
I'm not fussed what gets done with the source. I know Extrems also rewrote most of the video stuff for his OpenTTD port, that might be worth looking at too. I've found games can tend to expect SDL to behave slightly differently when it comes to video (especially with regards to the mouse or the mode flags) so I always have to adjust the code depending on what I'm building.

HunterZ
Posts: 19
Joined: Mon Sep 12, 2011 3:58 am
Location: Seattle

Re: noob compiling issues

Post by HunterZ » Thu Sep 22, 2011 7:12 am

Well I got the CorsixTH custom SDL-Wii code to compile and link into Abuse Wii using stock libaesnd, but I'm seeing some issues:
  • Text that is printf()'d before setting a video mode is not visible on the screen. This is a potential dealbreaker because the game engine has a long startup time (due to having to parse a bunch of lisp scripts).
  • SDL Timidity support seems to be missing, as I'm not getting any music. This is a definite dealbreaker. EDIT: Slight possibility that this could be due to running via wiiload; will need to test with the binary on SD/USB.
  • For some reason, clicking the checkmark ("ok") button to quit the game doesn't register quite right. There's no clicking sound, and I seem to need to click it multiple times before it will register.
I was able to get 848x400 to work (for some reason, 480-pixel height modes cause the game's display to be shifted upwards and partially off-screen, and 400 is an even multiple of the internal 320x200 rendering). Only problem is that I haven't figured out where to inject code that offsets the picture by 104 pixels to the right so that it will be centered. I'm also unsure of the best way to detect the aspect ratio to decide which mode to set and whether to offset; I think there's a GX-level function for it?
tueidj wrote:Manually setting the wiimote pointer resolution so it's higher than the video resolution can help with this. Just remember to offset the return pointer values by half the overlap area.
How would I go about doing this, especially given that SDL is in the mix?

tueidj
Posts: 40
Joined: Thu Dec 10, 2009 9:26 am

Re: noob compiling issues

Post by tueidj » Thu Sep 22, 2011 9:32 am

  • If your app needs a console it should really set one up itself rather than relying on SDL to do it.
  • Timidity support should be working, I didn't change any of the code and I use it in my SDL apps.
  • Not sure about the button clicking, might have something to do with the input event parsing? If you're calling the WPAD_* functions directly it will probably interfere with SDL's joystick polling.
If you want black borders on the left and right sides in widescreen mode, it would be easier to use your original video mode but change the destination rectangle with WII_ChangeSquare. The EFB is always 640x480 (for SDL-wii) therefore the default destination rect is (-320, 240) - (320, -240) to cover the whole area. If you changed it to something like (-240, 240) - (240, -240) you should end up with a 4:3 square in the middle (assuming the tv/display is 16:9) with black borders on the sides. The call to set it would be WII_ChangeSquare(240, 240, 0, 0). You might need to externally define WII_ChangeSquare, not sure if it's exported in any of the headers. Detecting widescreen mode is easy, just include <ogcsys.h> and do this:

Code: Select all

if (CONF_GetAspectRatio() == CONF_ASPECT_16_9)
{
// setup widescreen
}

HunterZ
Posts: 19
Joined: Mon Sep 12, 2011 3:58 am
Location: Seattle

Re: noob compiling issues

Post by HunterZ » Thu Sep 22, 2011 4:21 pm

tueidj wrote:If your app needs a console it should really set one up itself rather than relying on SDL to do it.
Not familiar with libogc, but it looks like maybe CON_Init() is what I would need to use for that?
Timidity support should be working, I didn't change any of the code and I use it in my SDL apps.
It could be that I was running via wiiload, which might prevent SDL_mixer's Timidity loader code from being able to locate the config/patch files on the USB.
Not sure about the button clicking, might have something to do with the input event parsing? If you're calling the WPAD_* functions directly it will probably interfere with SDL's joystick polling.
I'm currently using SDL all the way, and no lower-level libogc stuff. I haven't noticed anything else strange, so I'm wondering if it's maybe something else. I'll have to investigate I guess, although it's been hard to debug anything on the Wii - even in Dolphin.
If you want black borders on the left and right sides in widescreen mode, it would be easier to use your original video mode but change the destination rectangle with WII_ChangeSquare. The EFB is always 640x480 (for SDL-wii) therefore the default destination rect is (-320, 240) - (320, -240) to cover the whole area. If you changed it to something like (-240, 240) - (240, -240) you should end up with a 4:3 square in the middle (assuming the tv/display is 16:9) with black borders on the sides. The call to set it would be WII_ChangeSquare(240, 240, 0, 0). You might need to externally define WII_ChangeSquare, not sure if it's exported in any of the headers. Detecting widescreen mode is easy, just include <ogcsys.h> and do this:

Code: Select all

if (CONF_GetAspectRatio() == CONF_ASPECT_16_9)
{
// setup widescreen
}
I see the definition of that in SDL_wiivideo.c, and the declaration in the corresponding internal SDL header (SDL_wiivideo.h), so I'll play around with it.

I also see that WPAD_SetVRes() might be what I'm looking for to set the mouse coordinate bounding box so that I can effectively change the sensitivity.


Is there an actual libogc/GX API reference somewhere?

HunterZ
Posts: 19
Joined: Mon Sep 12, 2011 3:58 am
Location: Seattle

Re: noob compiling issues

Post by HunterZ » Sat Sep 24, 2011 5:06 pm

Update:

Console:

I had trouble getting CON_Init() to work with tueidj's SDL-Wii mod, as SDL_Init() is called in the middle of the startup routine, and it seems to interfere. I eventually discovered that tueidj had simply commented out SDL-Wii's CON_Init() call, so I uncommented that and got SDL's default console back.


Widescreen:

I decided to put tueidj's SDL-Wii mod aside for now, as it seems to cause the game to stop responding to button clicks when some menus are active, and I don't seem to need it for simple video aspect correction. I think I also noticed a bit of sound clipping that may be due to the fact that I'm using stock libaesnd with it.

I have the aspect correction fully implemented now, but I'm not sure what exactly the results are of mixing SDL's internal 640x400 resolution with WII_ChangeSquare(). As a result, I decided to change the game from rendering internally at 320x200 and stretching to fill the 640x400 SDL resolution, to using a 320x200 SDL resolution and letting SDL handle the scaling. This results in a smoother image (I guess the game's scaler was using nearest-neighbor scaling and SDL is using bilinear interpolation), so I might either add a new command-line parameter or expose existing ones that allow the user to choose between smooth and pixelated looks.


Wiimote sensitivity:

I'm still banging my head on this. Calling WPAD_SetVRes() after telling SDL to set the video mode is not feasible because SDL seems to clip the raw coordinates to fit the SDL screen resolution before exposing them to the caller. I'm not sure if there is some combination of things like toggling fullscreen and mouse grabbing that might disable this clipping, or if I need to bypass SDL's mouse handling and mix in even more libogc-level code. It shouldn't be this difficult/complicated to adjust the sensitivity. :P

Also, I think there might be an issue in libogc's lower-level mouse stuff that's causing the mouse coordinates to not update when you try to run the wiimote along the edges of the WPAD_SetVRes()-defined clipping area. I say this because I tried setting a very small area for the heck of it, and I still got the sticky behavior in the smaller screen area.

HunterZ
Posts: 19
Joined: Mon Sep 12, 2011 3:58 am
Location: Seattle

Re: noob compiling issues

Post by HunterZ » Thu Sep 29, 2011 12:26 am

Giving up on fiddling with the Wiimote sensitivity and sticky cursor issues.

I tried setting a very large virtual clipping box via WPAD_SetVRes() and using libogc/wiiuse functions to get the IR coordinates. I then scaled the results back to the 320x200 game resolution, but this resulted in no sensitivity difference. I guess the IR coordinates are scaled such that the edges of the box always map to the same physical range of the IR sensor system.

I also tried playing with creating a larger-than-320x200 clipping box and centering it over the game's 320x200 screen coordinate system. This alleviates the stickiness at the edges a little, but is not a complete enough solution to be worth using. It also has the deal-breaking side-effect of effectively increasing the IR sensitivity.

At this point I'm ready to revert to using the stock SDL mouse stuff that I was originally using to get the IR coordinates.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests