Wii-ing yourself isnt always fun
- February 16th, 2010
- Posted in Dissertation . University Work . Wii
- By admin
- Write comment
Had some major problems this week porting my project over to the framework scott and I made for AGT, originally i was using the 2D boy framework but i decided i might want to do some 3D stuff so i figured i may as well port it over….wasnt quite as easy as i had anticipated!
I was initially using the wii yourself library and when i first set it up i had some major problems getting it to play nice, eventually i got it going and i was quite happy with it. However when i ported it over to the new engine all those teething problems were showing their ugly faces again and i thought i would have a look to see if there was a better solution instead of spending hours getting it running again…only for it to break on a different computer.
I found wiiuse which felt a lot nicer and was intially very easy to set up so i quickly integrated that into my engine and made relevant changes.
Alas as i got up to the part where i wanted to render points again i came across a problem, wiiuse has some great stuff for Wiimote I.R. tracking but it automatically works out the average dot and stuff based on the position of the sensor bar for you, which is great….if you want that, however i wanted to access each I.R. dot individually…which it didnt seem to give access to sooooo it looked like it was back to wiiyourself.
I went back to my old gamedev posts to re-find the solution, the basic problem is, wiiyourself needs the windows ddk (for the hidpi stuff) and the windows ddk seems to need the msdn sdk (although that might not actually be true, it could be it just seems that way) however there is some sort of confliction in the .h files of at least the windows ddk with another include which is a default include. The fix is to order them in a particular way:
Of course this is not ideal so what i did was build wiiyourself into some libs and use them instead =]! And anyone reading this who wants to do a similar thing i would recommend you do the same, i might put the libs up for download at some point with a full tutorial on getting started with the Wii and C++ after i email wiiyourselfs creator and ask if thats ok.
Saying all this and the title sort of puts WiiYourself in a bad light but its not a bad library, the complete opposite in fact, its actually quite nice to use, especially for what im doing, if you were doing stuff that literally involved creating a wii game then i would say go with wiiusecpp, however if you want to do I.R. tracking and generally a bit more then go with wiiyourself. If i was to sum up id say the wiiusecpp is more high level and so slightly more user friendly perhaps, but wiiyourself lets you get a little bit more nitty gritty with it which is always something that appeals to a C++ programmer =]!
The problem isnt really wiiyourselfs its the microsoft ddk, and these strange conflicts it likes to have, and it definatley does not like being in the same include list as Direct X stuff ooohh no!
Definatley make a nice library for yourself, it will save alot of headache! trust me!
I’m happy to report that i now have it all integrated (its a bit messy and needs cleaning up) and i have some nice debug stuff including drawing of the I.R points (again a little messy, ogre primatives are a bit ugly when u haven’t wrapped it up in a derived/manager class).
For some reason im having some problems getting the average point to work properly, it constantly thinks all I.Rs are visible, which means that its always adding the values of the I.Rs that arnt there i.e. 0,0 and dividing by 4, when at the moment im only using 2 I.R.s which is annoying! And also cegui doesnt seem to have a “set mouse cursor” which is annoying because im forced to use “inject mouse move” and sort of adjust it via I.R changes. which makes controlling the mouse via I.R a litle annoying aswell!
However i have set up a thing were you can click by pinching ur fingers which is cool to use with CEGUI, even though it requires a little patience =P! its all a little jittery and theres plenty of teething problems but im getting there!
EDIT: For anyone who needs it, here is the pre-built wiiyourself libs, for 2005, 2008 debug and release versions! Download: WiiYourselfLib


I am currently working on a wiimote project myself using ‘wiiuse’. I might have missunderstood you but i don’t see any problem accessing the individual IRs via
int i,j;
wiimotes[i]->ir.dot[j].x; wiimotes[i]->ir.dot[j].y;
Anyway, I had problems recompiling wiiuse as i couldn’t really figure out the DDK. I’ll try it now with help i found in your article.
Thanks a lot.
Hi, i found that in wiiuse i could only get the average dot information, maybe its cause i was using the C++ version?
As for the problems, i would recomend opening up the demo project, if it doesnt run, then go to your includes and pretty much make it look like the one in the post, take out extra libraries that arnt shown for now and see if it runs if not check your library directories and make sure they are pretty bare of extra libraries too and make sure you have this line: “(directory)WinDDK\7600.16385.0\lib\wxp\i386″ its also important to know that the WDK is different to the original DDK that i know WiiYourself (and maybe wiiuse, i dont know) was written for, it still works with it but it has slightly different includes to what the DDK would have wanted. Once you get it running in the demo, make a new empty static library project, make sure the set up is the same, put the code files in and built it into a libary of your own, if you continue to use that, in theory you wont have any problems even if you re-jig the set up for a different library!
If your having any more problems, post up and ill try and help, i may also make a full tutorial on how i did it at some point!
Good Luck!
P.s. have you tried the C# library thats available (brian peeks) its pretty damn good and the one WiiYourself was built off (well its a port), and C# is generally less of a (insert bad word here) when it comes to external libraries and stuff…even though i still prefer C++, i sometimes i wish id done thsi project in C#
Hey,
actually your article was help enough to get the DDK + wiiuse running, so thanks a lot. IT would have save me quite some time if i stumbled on this blog earlier
I started all the wiimote stuff with the C# library but managed code isn’t an option as I have to integrate it into some other huge project. Platform independency is another reason that makes me avoid .NET where ever I can. I tried wiiyourself first, but didn’t manage to compile it (DDK problems addressed in this article). Then i found wiiuse which was compiled and good enough to get my project running. Unfortunately i needed a 64bit version of it, thus I had to recompile it, which now works thanks to you
Regarding the IR, i didn’t really spend much time looking into it. I’m using IR-leds attached to shutter glasses with a self-built usb power supply. For some reason the results for my head tracking algorithm were good enough. I have to admit I am not even sure how those values are being average. Though what i wrote before in my other comment wasn’t true. I am NOT using .x/.y for the IR positions. I am using .rx/.ry which is supposed to be the raw data according to the header files.
Anyway I would be interested in trying wiiyourself as well. So if you find the time to upload that lib you created I would be very grateful. Ill keep checking this blog for updates.
Thanks again for this article
Cheers
Hi Again,
Im really glad it helped!
! And ur post has brightened my day, so thank you for taking the time to post, its appreciated! Ill pop them up on the dissertation page, they were built in Visual studios 2008, on a 32 bit machine so ive also included the project i used/use to make the lib so u should be able to re-make it using the said configuration if need be
Your very welcome!
Hi,
I would just like to say THANK YOU for posting the solution to being able to compile the wii.yourself stuff. I’ve been trying to get it to work for weeks to no avail with various combinations of include paths. Yours worked first time.
THANKS
Your very welcome, im glad it helped!
I’m the WiiYourself! author. You never asked me if it’s OK to publish the libs
.
No problem, but it’s not a good solution. The problem is the order in which VC parses the various include and library paths. Different SDKs or different versions can conflict with one another if the most important/recent version isn’t parsed first.
The WinDDK contains some Platform SDK stuff that’s now seriously out of date, so just move it below all the other paths (it also works fine with DirectX).
So sorry bout that, i completely forgot, i got in a bit of a fluster, i didnt put them up cause i was going to ask you and then someone asked about them and i had forgotten the reason why i hadnt put them up :S i hope this is ok, i can happily remove them if you like?
Im honoured that you found my little post and have some advice! I would like to take this opportunity to say thank you for your library, my dissertation project probably would not have been possible without you, its been a huge pain but playing with the wii library stuff was the most fun! The wii hacking community owes you a lot! so thank you sincerly
Im having a lot of problems with VC++ 2010 and Wiiyourself.
error with ctype.h, windef.h, excpt.h and crtdefs.h
Anyone help me?
Sorry only just got your message, whats the problem your getting? have you built the libs yourself?
@admin
I am also trying to compile the lib on VS 2010, getting LOTS of errors (202) with .h files – stupid things like “missing ‘)’ before ‘const’ in crtdefs.h”
Will your 2008 lib likely work in VS2010? Is there any chance of you uploading a 2010 version if not?
Thanks, Simon.
OK i *THINK* i fixed it. The problem was that VS 2010 holds all inherited include directories separate from the custom directories, making it impossible to move the WDDK directory below the other ones.
The solution was to turn off ‘inherit values’ and copy the inherited values into the custom ones. From there you can order them as you like!
This page helped
http://stackoverflow.com/questions/1356653/multiple-compiling-errors-with-basic-c-application-on-vs2010-beta-1
Hope this helps!
Well, if my library works, then I am having trouble implementing it! How does a custom library work? Do I still need all the original wiimote .h files?
I have included the directory of my 2010 lib and added it as an additional dependancy, yet the compiler is still complaining that i need all the WDDK h and lib files – i thought that was the whole point of making the lib, to avoid that?
Any help appreciated!
Also forgot to mention that it still needs the wiimote.cpp file, so my library DEFINITELY isn’t getting picked up…
Fixed it! the compilation error was because in the wiimote.h file i was using it didn’t have a VIRTUAL destructor, whereas the lib had been compiled with a different header which DID have one.
Not exactly the right place for this but as I’m here and have already bothered you so much, is there any special trick to getting the wiimote to see the sensor bar? My code always returns false on dot.bVisible. I’ve tried searching the demo for reference but to no avail!
Don’t worry – fixed it. Wow i should come here and rely my problems to a blank comment page more often! This time I was forgetting to call remote.RefreshState(), so it’s all good now.
Me again – my dot.y value is always off the scale! i mean like an invalid number. dot.X is fine, which is wierd… tried restarting several times over, again the demo works fine D:
I have tried the C# library as you said its pretty good. But C# implementations can still be attacked by Microsoft’s patents: the Community Promise is designed to give the company several outs, if it wants them.
Me again – it appears that WiiYourself is not meant for VS 2010 – my 2010 version of the Demo built with the same source code, but will not even recognise the wiimote’s pitch and roll! (One thing I did not test in my IR app.)
I also get Assert failures at line 656 (SetReportType) in wiimote.cpp when remote.connect() is called, unless the remote has just been through the working Demo.
As I have invested so much time in WiiYourself, I will spend at most the next few hours trying other Wiimote APIs before concluding that I must revert to VS 2008, which also means installing a different version of OpenSceneGraph…
This day could be fun. I understand if this library is no longer being updated, just thought i’d bounce my thoughts on your wall. Simon.
Me again – went through building EVERYTHING again (including OpenSceneGraph and WiiYourself) only to find that I had the same problem in VS2008. I have, however, fixed my problem.
My problem was caused by the wiimote.cpp file in you libary download – i don’t know when and i don’t know why, but you modified WiiYourself’s original wiimote.cpp file so that the StateChange callback never happens, and the IR info buggers up.
It’s weird: I have developed a love-hate relationship with this page; I love it because I would not have even gotten a reading out of the accelerometer without it, but it led me into 2 whole days of dispairing over why my code wouldn’t work when the Demo code was exactly the same. The answer: they were not. All because of your .cpp file!
Anyway, thanks for this place of joy and turmoil. I love and hate it here. Like Marmite. But i do love Marmite. Anywho, I’d better get back to work. I bid you adue.
Simon.
very apt article name, btw!
Sir, i have a problem with the wiiyourself (without your library).
The thing is i am not that advance in VS c++. So can you you please publish a tutorial in this thread of how to setup the wiiyourself library with directx.
I am having trouble with the directx conflicting with it. The errors are:
1>c:\winddk\7600.16385.1\inc\api\objidl.h(11280) : error C2061: syntax error : identifier ‘__RPC__out_xcount_part’
1>c:\winddk\7600.16385.1\inc\api\objidl.h(11280) : error C2059: syntax error : ‘)’
1>c:\winddk\7600.16385.1\inc\api\objidl.h(11280) : fatal error C1903: unable to recover from previous error(s); stopping compilation
A tutorial would be awsome.
Thanks.
@Simon
Hi Simon,
Im really sorry i haven’t been replying to your posts, I have not been updating my website at all this year.
One thing i must point out is that I didnt write the WiiYourself Lib, i only used it and wanted to express my experience with it and also upload the VS 2008 libs to save other people the inevitable head ache of building the libs…sorry to hear that it caused you some headaches!
It sounds like you found out an awful lot of useful things yourself, you might want to get in contact with gliter the WiiYourself author and mention some of the issues.
Again sorry for not replying for so long!
-Thanks, Chris
@Arif
Hi Sorry about not replying,
Sadly i do not think i will be putting up a tutorial as i am not really qualified, certainly not now, i havent used the lib in over a year. You would be best asking glitter the original author
However your issues do sound painfully familiar.
Personally i think i got round the problem by reordering the libs, as i mentioned above but glitter did comment saying it wasnt a good solution:
“No problem, but it’s not a good solution. The problem is the order in which VC parses the various include and library paths. Different SDKs or different versions can conflict with one another if the most important/recent version isn’t parsed first.
The WinDDK contains some Platform SDK stuff that’s now seriously out of date, so just move it below all the other paths (it also works fine with DirectX).”