Welcome! Log In Create A New Profile

Advanced

Final Question Thread

Posted by khjui 
Final Question Thread
January 20, 2010 07:50PM
Hi
Oh look, its me asking for more help, how...diffrent...
I am getting very fed up of homwbrew coding now, I have been searching (& seaching & searching & searching) for hours on end to try and find one function, that when found, doesn't work. Every lib I've tried results in errors, for example:

I use the libwiilight sprite, the following is my code:

#include 
#include 
#include 
#include 
#include 


static void *xfb = NULL;
static GXRModeObj *rmode = NULL;

//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
//---------------------------------------------------------------------------------

	// Initialise the video system
	VIDEO_Init();
	
	// This function initialises the attached controllers
	WPAD_Init();
	
	//Disk Drive Light Intialises
	WIILIGHT_Init();

	
	// Obtain the preferred video mode from the system
	// This will correspond to the settings in the Wii menu
	rmode = VIDEO_GetPreferredMode(NULL);

	// Allocate memory for the display in the uncached region
	xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
	
	// Initialise the console, required for printf
	console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
	
	// Set up the video registers with the chosen mode
	VIDEO_Configure(rmode);
	
	// Tell the video hardware where our display memory is
	VIDEO_SetNextFramebuffer(xfb);
	
	// Make the display visible
	VIDEO_SetBlack(FALSE);

	// Flush the video register changes to the hardware
	VIDEO_Flush();

	// Wait for Video setup to complete
	VIDEO_WaitVSync();
	if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

	WIILIGHT_SetLevel(255);

	// The console understands VT terminal escape codes
	// This positions the cursor on row 2, column 0
	// we can use variables for this with format codes too
	// e.g. printf ("\x1b[%d;%dH", row, column );
	printf("\x1b[2;0H");
	

	printf("Press (A) to toggle the Wii Disk Drive Light");

	while(1) {

		// Call WPAD_ScanPads each loop, this reads the latest controller states
		WPAD_ScanPads();

		// WPAD_ButtonsDown tells us which buttons were pressed in this loop
		// this is a "one shot" state which will not fire again until the button has been released
		u32 pressed = WPAD_ButtonsDown(0);

		// We return to the launcher application via exit
		if ( pressed & WPAD_BUTTON_HOME ) exit(0);
		
		//If the A Button is pressed, then Toggle the Wii Disk Drive Light
		if ( pressed & WPAD_BUTTON_A ) WIILIGHT_Toggle();


		// Wait for the next frame
		VIDEO_WaitVSync();
	}

	return 0;
}

which results in:

"make" 
template.c
linking ... template.elf
template.o: In function `main':
c:/devkitPro/examples/wii/template/source/template.c:22: undefined reference to `WIILIGHT_Init'
c:/devkitPro/examples/wii/template/source/template.c:51: undefined reference to `WIILIGHT_SetLevel'
c:/devkitPro/examples/wii/template/source/template.c:75: undefined reference to `WIILIGHT_Toggle'
collect2: ld returned 1 exit status
make[1]: *** [/c/devkitPro/examples/wii/template/template.elf] Error 1
"make": *** [build] Error 2

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

I am now on the edge of giving up wii homebrew coding. I cannot find anything atall that actually works. Or thats helpful in anyway possible. Seeing as the half of you lot' are all experts..well..atleast compared to me..I was wondering how you got started and if you can provide anyhelp and your opinion on weather I should just give it up.

-Tom
Re: Final Question Thread
January 20, 2010 08:11PM
I've not used WIILIGHT but undefined reference means you're not linking in the lib correctly.


Quote
khjui
I am now on the edge of giving up wii homebrew coding. I cannot find anything atall that actually works. Or thats helpful in anyway possible. Seeing as the half of you lot' are all experts..well..atleast compared to me..I was wondering how you got started and if you can provide anyhelp and your opinion on weather I should just give it up.

That's not a very good attitude. If you feel that way then maybe you should give up.
Re: Final Question Thread
January 20, 2010 08:18PM
Quote
scanff
I've not used WIILIGHT but undefined reference means you're not linking in the lib correctly.


Quote
khjui
I am now on the edge of giving up wii homebrew coding. I cannot find anything atall that actually works. Or thats helpful in anyway possible. Seeing as the half of you lot' are all experts..well..atleast compared to me..I was wondering how you got started and if you can provide anyhelp and your opinion on weather I should just give it up.

That's not a very good attitude. If you feel that way then maybe you should give up.

I followed the instalation from the Wiki page correctly...how else would I install the lib?
Re: Final Question Thread
January 20, 2010 08:18PM
Quote
khjui
"make" 
template.c
linking ... template.elf
template.o: In function `main':
c:/devkitPro/examples/wii/template/source/template.c:22: undefined reference to `WIILIGHT_Init'
c:/devkitPro/examples/wii/template/source/template.c:51: undefined reference to `WIILIGHT_SetLevel'
c:/devkitPro/examples/wii/template/source/template.c:75: undefined reference to `WIILIGHT_Toggle'
collect2: ld returned 1 exit status
make[1]: *** [/c/devkitPro/examples/wii/template/template.elf] Error 1
"make": *** [build] Error 2

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

I'm sure it's because you forgot to add the lib in your Makefile

You need to modify this section:
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS	:=	-lwiiuse -lbte -logc -lm
Re: Final Question Thread
January 20, 2010 08:33PM
Quote
Crayon
Quote
khjui
"make" 
template.c
linking ... template.elf
template.o: In function `main':
c:/devkitPro/examples/wii/template/source/template.c:22: undefined reference to `WIILIGHT_Init'
c:/devkitPro/examples/wii/template/source/template.c:51: undefined reference to `WIILIGHT_SetLevel'
c:/devkitPro/examples/wii/template/source/template.c:75: undefined reference to `WIILIGHT_Toggle'
collect2: ld returned 1 exit status
make[1]: *** [/c/devkitPro/examples/wii/template/template.elf] Error 1
"make": *** [build] Error 2

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

I'm sure it's because you forgot to add the lib in your Makefile

You need to modify this section:
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS	:=	-lwiiuse -lbte -logc -lm

Ahhh, I understand, but what do I need to add? I understand, that the -blah is the lib to include, but how do I find out which -blah I need to add?
Re: Final Question Thread
January 20, 2010 08:40PM
-lwiilight
Re: Final Question Thread
January 20, 2010 08:42PM
Quote
Crayon
-lwiilight
Thanx! One last question, how would I find that out?
Re: Final Question Thread
January 20, 2010 08:43PM
Quote
khjui
Thanx! One last question, how would I find that out?
I tried :)
Re: Final Question Thread
January 20, 2010 09:08PM
Quote
khjui
Quote
Crayon
-lwiilight
Thanx! One last question, how would I find that out?
It's experience. C/C++ is complex, in the beginning, don't try to understand everything. Some thing just are. You'll find out later why they are that way.
Re: Final Question Thread
January 21, 2010 03:41AM
Quote
Daid
Quote
khjui
Quote
Crayon
-lwiilight
Thanx! One last question, how would I find that out?
It's experience. C/C++ is complex, in the beginning, don't try to understand everything. Some thing just are. You'll find out later why they are that way.

Humm, kinda have to side with khjui on this one, if its on the Wiki, it should include what to add to your Makefile so it can reference it. "Some thing just are." just doesn't makes sense to me in this case...

(Cause of this thread, added what you need to write in your Makefile on the installation section of its wiki page).

Don't give up khjui. Lack of documentation is annoying, but just keep trying. Its a great feeling when it actually starts working cause you sticked with it :)



Edited 1 time(s). Last edit at 01/21/2010 03:42AM by Ksmiler.
Re: Final Question Thread
January 21, 2010 04:15PM
Quote
Ksmiler
Quote
Daid
Quote
khjui
Quote
Crayon
-lwiilight
Thanx! One last question, how would I find that out?
It's experience. C/C++ is complex, in the beginning, don't try to understand everything. Some thing just are. You'll find out later why they are that way.

Humm, kinda have to side with khjui on this one, if its on the Wiki, it should include what to add to your Makefile so it can reference it. "Some thing just are." just doesn't makes sense to me in this case...

(Cause of this thread, added what you need to write in your Makefile on the installation section of its wiki page).

Don't give up khjui. Lack of documentation is annoying, but just keep trying. Its a great feeling when it actually starts working cause you sticked with it :)

Thanx, thats the best thing that anyone has said to me in a long time XD...which is kinda sad...

Anyhow, thanks for the motivation!
Re: Final Question Thread
January 22, 2010 05:01AM
Quote
Ksmiler
Lack of documentation is annoying, but just keep trying. Its a great feeling when it actually starts working cause you sticked with it :)
I don't see any lack of documentation. That's the way these things are shown: assuming you know what you must know. There's plenty of sites out there to learn about makefiles and basic compiler-related terms.

I understand your point of view, nobody was born knowing how to code but this forum's main goal isn't to teach people how to code/compile (nice to see there's people who spend their time helping you anyways).

Basically that's my point, there's any lack of documentation. Coding/compiling isn't documented here because that isn't meant to be documented here and there's certainly any lack of documentation about coding/compiling in the internet.


@Topic: I know this is already solved, I just wanted to advise you to "walk the long and hard way" at this, other way you will be asking others about everything everytime. You can't start this road by its half, but don't get scared, you can take the whole trip anyway, can't you? ;)
Re: Final Question Thread
January 22, 2010 01:04PM
Quote
Aruskano
There's plenty of sites out there to learn about makefiles and basic compiler-related terms.

Agreement with that, hence on the Wiki page it just says what to add to a Makefile not how :) . Google are peoples' friend... for now, on finding other extra reading and tutorials.

The lack of documentation in this case was just the"-lwiilight". Thats all. But really it was just supposed to be a general "if info is not there, try try try again"-type statement.

Or you can do what I do and just read a lot of patents all day to learn anything about the Wii / GC, then break down and say "fuck it" :P

EDIT: The patents bit is because GX info sucks cause its limited :D (Bump-mapping and Multi-texturing information? The patents were the only things to comfort me hahaha, and still all my projects are fail... for now :P.)



Edited 1 time(s). Last edit at 01/22/2010 01:11PM by Ksmiler.
Re: Final Question Thread
January 23, 2010 01:19AM
there are no patents in homebrew... most of it is open source so there really isn't any need to get a patent for it. plus that would be $$$.
Re: Final Question Thread
January 23, 2010 04:11PM
The design of the TEV system is patented. I had to read them to understand how to use some of the commands in GX. (It has some examples, not exactly the same way as the Wiibrew teams API, but it was still very very helpful).

EDIT: You can use the free patent browsing libraries on the internet to read them.



Edited 1 time(s). Last edit at 01/23/2010 04:18PM by Ksmiler.
Re: Final Question Thread
January 23, 2010 07:35PM
ahhh, gotcha!
Sorry, only registered users may post in this forum.

Click here to login