Welcome! Log In Create A New Profile

Advanced

Libwiisprite broken by latest devkitPRO releases?

Posted by Arikado 
Libwiisprite broken by latest devkitPRO releases?
December 08, 2008 04:57PM
Yesterday, I was overjoyed when I discovered the new releases of devkitPRO. I quickly installed the latest versions of devkitPPC, libogc, and libfat. Now, when I attempt to compile my apps (which use libwiisprite of course) it comes up with about 26 lines of errors all in the Draw function of libwiisprite. Each error says something like undefined reference to GX_something. I'll edit this post later with the compilers exact output.

I'm unable to copy and paste the output so I'm slowly retyping it. This is not the complete listing (yet). The listing is now complete.

> "make"
linking ... wiishootinggallery.elf
c:/devkitPRO/libogc/lib/wii\libwiisprite.a(sprite.o): In function'wsp::Sprite::Draw(float, float) const':
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:416: undefined reference to 'GX_Position2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:417: undefined reference to 'GX_Color4u8'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:418: undefined reference to 'GX_TexCoord2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:419: undefined reference to 'GX_Position2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:420: undefined reference to 'GX_Color4u8'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:421: undefined reference to 'GX_TexCoord2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:422: undefined reference to 'GX_Position2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:423: undefined reference to 'GX_Color4u8'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:424: undefined reference to 'GX_TexCoord2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:425: undefined reference to 'GX_Position2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:426: undefined reference to 'GX_Color4u8'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:427: undefined reference to 'GX_TexCoord2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:428: undefined reference to 'GX_End'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:399: undefined reference to 'GX_Position2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:400: undefined reference to 'GX_Color4u8'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:401: undefined reference to 'GX_TexCoord2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:402: undefined reference to 'GX_Position2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:403: undefined reference to 'GX_Color4u8'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:404: undefined reference to 'GX_TexCoord2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:405: undefined reference to 'GX_Position2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:406: undefined reference to 'GX_Color4u8'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:407: undefined reference to 'GX_TexCoord2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:408: undefined reference to 'GX_Position2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:409: undefined reference to 'GX_Color4u8'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:410: undefined reference to 'GX_TexCoord2f32'
/home/chaosteil/code/wii/libwiisprite/source/sprite.cpp:411: undefined reference to 'GX_End'
collect2: ld returned 1 exit status
make[1] *** [/c/projects/wii/wiishootinggallery/wiishootinggallery.elf] Error 1
"make": *** [build] Error 2

>Process Exit Code: 2
>Time Taken: 00:07


Is anyone else experiencing these problems with libwiisprite and the new devkitPRO releases?

LINKS:
Libwiisprite
devkitPRO update



Edited 4 time(s). Last edit at 12/08/2008 11:35PM by Arikado.
Re: Libwiisprite broken by latest devkitPRO releases?
December 08, 2008 11:39PM
The post has been updated with the compilers complete output. As you can see there are only four missing GX variables: GX_TexCoord2f32, GX_Position2f32, GX_Color4u8, and GX_End. I'm assuming that cutting these variables from libogc was an oversight by the developers. If anyone can tell me the values for these variables and what they represent, I should be able to recompile libwiisprite (I have the source from chaosteil from awhile back) with these variables reincluded in the libwiisprite source code.



Edited 2 time(s). Last edit at 12/09/2008 12:04AM by Arikado.
Re: Libwiisprite broken by latest devkitPRO releases?
December 09, 2008 05:39AM
Quote
Arikado
As you can see there are only four missing GX variables: GX_TexCoord2f32, GX_Position2f32, GX_Color4u8, and GX_End.

I updated DevkitPro via the WIndows updater yesterday and I found them in ogc/gx.h.
They are functions:

static inline void GX_TexCoord2f32(f32 s,f32 t)
{
FIFO_PUTF32(s);
FIFO_PUTF32(t);
}

static inline void GX_Position3f32(f32 x,f32 y,f32 z)
{
FIFO_PUTF32(x);
FIFO_PUTF32(y);
FIFO_PUTF32(z);
}

static inline void GX_Color4u8(u8 r,u8 g,u8 b,u8 a)
{
FIFO_PUTU8(r);
FIFO_PUTU8(g);
FIFO_PUTU8(b);
FIFO_PUTU8(a);
}

AND:

static inline void GX_End()
{
}

filedate: Friday, 5. December 2008, 23:46:34 (gmt+1)
Re: Libwiisprite broken by latest devkitPRO releases?
December 09, 2008 02:21PM
Hi.

As some GX functions have been moved into gx.h inline functions, the current wiisprite binary lib release is not linkable anymore.

A new binary release or source is required. I discussed with Chaostail. He was planning to make a new release "within few days".

So, hang on.
Re: Libwiisprite broken by latest devkitPRO releases?
December 09, 2008 04:52PM
Oh, so they got moved! At least they're not gone. Thank you to both of you for your responses.

EDIT:So basically, all I need to do is add the line #include to the libwiisprite headers, recompile, and that will fix the problem?



Edited 1 time(s). Last edit at 12/09/2008 09:19PM by Arikado.
Re: Libwiisprite broken by latest devkitPRO releases?
December 09, 2008 10:32PM
Quote
Arikado
Oh, so they got moved! At least they're not gone. Thank you to both of you for your responses.
No, they became inline, meaning that the symbols for the functions don't exist anymore; their functionality is compiled directly into your program. Read up on inline functions for more info :P

Quote
Arikado
So basically, all I need to do is add the line #include to the libwiisprite headers, recompile, and that will fix the problem?
If you have the libwiisprite source, you shouldn't need to add an include at all. Just recompile against the new libogc and it'll work.
Re: Libwiisprite broken by latest devkitPRO releases?
December 09, 2008 10:34PM
Quote
AerialX
Quote
Arikado
So basically, all I need to do is add the line #include to the libwiisprite headers, recompile, and that will fix the problem?
If you have the libwiisprite source, you shouldn't need to add an include at all. Just recompile against the new libogc and it'll work.

I successfully recompiled libwiisprite, successfully recompiled my apps. But when they run, the images are not being drawn to the screen :(

EDIT:Nevermind, I just realized a mistake I made. I'm gonna try from the begining again.

EDIT 2:Steps I've taken: 1)Removed everything I've done previously 2)Successfully recompiled and reinstalled libwiisprite 3)Successfully compiled my app

When I ran my app none of the images were drawn on the television screen. This leads me to believe that a)There are now bugs with the Draw function or b)There are bugs in the LoadImage function

Thoughts?

EDIT 3: Looking at problems other people are having, libfat seems like an ever more likely source of possible error.



Edited 3 time(s). Last edit at 12/09/2008 11:40PM by Arikado.
Re: Libwiisprite broken by latest devkitPRO releases?
December 10, 2008 11:48PM
Installed the latest version of libfat, recompiled and reinstalled libwiisprite, recompiled my apps, and still no change. The images still do not appear onscreen.
Re: Libwiisprite broken by latest devkitPRO releases?
December 11, 2008 07:10AM
Quote
AerialX
Quote
Arikado
Oh, so they got moved! At least they're not gone. Thank you to both of you for your responses.
No, they became inline, meaning that the symbols for the functions don't exist anymore; their functionality is compiled directly into your program. Read up on inline functions for more info :P
Actually, it's because they're static. gcc treats inline as a hint and may or may not do it, linking inline functions has been possible for a long while regardless.



Edited 2 time(s). Last edit at 12/11/2008 07:12AM by lordzid.
Re: Libwiisprite broken by latest devkitPRO releases?
December 11, 2008 11:45AM
I always thought that inline implied that it was a static function.
Re: Libwiisprite broken by latest devkitPRO releases?
December 14, 2008 08:57AM
It's always been my understanding that "static" means it only exists in this file, and "inline" means the code may be copied directly into the calling function. I'm likely to be completely wrong though. :P
Re: Libwiisprite broken by latest devkitPRO releases?
December 14, 2008 05:13PM
PROBLEMS SOLVED!!!

Heres how to fix libwiisprite:

There are two main problems with libwiisprite and the latest devkitPRO releases. 1)GX 2)libfat

The first problem is fixed by recompiling and then reinstalling the libwiisprite source code.

The second problem is a little trickier. The following code no longer works with libwiisprite:
image1->LoadImage("data/image.png");
It must be changed to:
image1->LoadImage("/apps/FOLDER_YOUR_APP_IS_IN/data/image.png");

After making the preceding changes, your libwisprite programs will work exactly like they did before. I spent the last 5 days straight working on this and I finally figured it out :) May devkitPRO never update again.

Also, for people without the libwiisprite source code I'll upload a recompiled version of 0.3.0b soon.
Re: Libwiisprite broken by latest devkitPRO releases?
December 15, 2008 09:06PM
Re: Libwiisprite broken by latest devkitPRO releases?
January 10, 2009 02:55AM
There's a bug in the 0.3.0b release of libwiisprite's layermanager. I'm sharing it here because it's been frustrating me for days.
void LayerManager::Remove(Layer* layer){
                if(layer == NULL)return;
 
                bool shift = false;
 
                for(u32 i = 0; i < _size; i++){
                        // Layer found and shifting everything forward
                        if(shift){
                                _layers = _layers[i+1];
                                if(i+2 == _size){ // One position before stop
                                        _layers[i+1] = NULL; break;
                                }
                        // Or check if the layers are equal and turn shifting on
                        }else if(layer == _layers){
                                _layers = NULL;
                                shift = true;
                                if(i+1 == _size)break;
                        }
                }
 
                if(shift)_size--; // Success!
        }

The problem is apparent if you walk through where layer = _layers[0] and _size = 2.


_layers = _layers[i+1]; will be _layers[1] = _layers[2];
This will overwrite _layers[1] with garbage, and whatever sprite you had there is now gone. The fixed code is

void LayerManager::Remove(Layer* layer){
                if(layer == NULL)return;
 
                bool shift = false;
 
                for(u32 i = 0; i < _size; i++){
                        // Layer found and shifting everything forward
                        if(shift){
                                _layers[i-1] = _layers;
                                if(i+1 == _size){ // One position before stop
                                        _layers = NULL; break;
                                }
                        // Or check if the layers are equal and turn shifting on
                        }else if(layer == _layers){
                                _layers = NULL;
                                shift = true;
                                if(i+1 == _size)break;
                        }
                }
 
                if(shift)_size--; // Success!
        }
Sorry, only registered users may post in this forum.

Click here to login