Wiimote Plugin Test

Posted By: FBL

Wiimote Plugin Test - 02/20/08 23:47

I didn't know where to put this,so I decided to place it here. For testing, I compiled as a console application, but the final version will be a DLL for Acknex7.

>>>>> http://www.firoball.de/upload/ackwii_console.exe <<<<<

Console Applications usually look very boring, so sorry - no screenshots
This small executable should be able to detect all connected Wiimotes (including extension controllers) and it lists the current output values of the first Wiimote (the one at index 0 - which might be just about any connected Wiimote depending on your driver).

What I ask from you:
If you own a Wiimote and a bluetooth dongle and are interested in this project, can you please:

- connect your Wiimote(s) and check whether they are detected? The console window will show something like dev: [x], where x is the number of devices

- if connection is successful, the "first" Wiimtoe will be enabled. Check the output values like button presses

- check all your extension controllers you have. Currently supported are Nunchuk, and Classic Controller. The Guitar Hero guitar should be detected as Classic Controller and therefore be usable (buttons are mapped to certain Classic controller buttons)

- if you have the possibility, try out IR support. The first 2 dots are listed (code supports up to 4). To use the sensor bar which comes with Wii, first connect your Wiimotes with the PC, and afterwards turn on your Wii as power supply.

- plug in and out extension devices, try weird things, see what happens


Finally I'd need following data:
- Number of Wiimotes you connected and the extension devices you used for testing

- Your bluetooth driver (two methods are supported, Bluesoleil, MS driver and compatibles should do)

- if my test app. does NOT work I'd need details about your bluetooth driver as well. If you can't connect your Wiimtoe to the PC at all - sorry I can't help. There are some dongles and drivers which have problems with Wiimote.

- Did you experience any delay (output on console window might get slow, but that's not what I mean. Best way is to check how long it takes until a button press is recognized)? Currently I'm polling every 2 ms, sometimes I have some lag. Still searching where it is coming from. Might be a driver or even a compiler issue.


Known issues:
- When using Bluesoleil stack, any detected Wiimote is always listed as connected, even if it is not connected. There seems to be no fix for this.

- MS stack *should* work correctly when searching the devices, but is not yet tested. Please tell me

Remarks:
- When connecting another Wiimote during runtime, it can take up to a minute until the number of connected devices is corrected. This is no bug, it has to do with the way I programmed the console starter. I didn't want to poll this information too often (makes things slow)


Facts and features:
- based on cWiimote 0.2 of Kevin Forbes
- supports multiple Wiimotes
- Nunchuk support
- Classic Controller/Guitar hero controller support
- IR support (up to 4 dots, standard sensor bar delivers two dots)
- IR can be turned off if not needed - increases battery lifetime
- orientation estimation with simple smoothing (vague)
- reading of battery level as raw and percentage value
- changing of extension controller at runtime
- LED control
- Vibration control

Thanks for helping.

It took me some time to get all the new features in (the original source was very basic and had some bugs - but the layout was very nice and understandable). I still need to update the whole interface to A7 for multiple Wiimote support. I hope it will be fun for you to use Wiimote with 3dgs.
Posted By: DoC

Re: Wiimote Plugin Test - 02/21/08 08:02

ehm well you only need a bluetooth usbstick... a bluetooth connection programm like Bluesoleil, ppjoy to say its a virtual jostick and glovepie set the button. Thats it!
And now ^^why a "new Feature BY YOU?" hehheee your funny
Posted By: FBL

Re: Wiimote Plugin Test - 02/21/08 12:21

If you don't have to say something useful then simply don't post. Thanks.
Also I never said I'm the first one ever to implement these things, but I wrote them on my own for this library.

Glove PIE is not really suitable for commercial use. Also it is limited, as you can only do mappings to keyboard/mouse including short scripts.
This is sth. to play around with for fun, but not useable at all for more serious things. Simply NOBODY is going to install Glove PIE for a game which claims to work with Wiimote. It's hard enough to convince people to install ogg filters for music playback, so don't even THINK about expecting them to install some extra app for using Wiimote.
Posted By: Samb

Re: Wiimote Plugin Test - 02/21/08 15:00

wiimote and PC and COMMERCIAL USE...
sure

but interesting for indie freeware devs
Posted By: ulf

Re: Wiimote Plugin Test - 02/21/08 15:50

yep its a nice effort, thumbs up
Posted By: FBL

Re: Wiimote Plugin Test - 02/21/08 16:27

Bugfixes (thanks to ChrisB):
- strange delays are gone now
- Device number is now correctly detected with MS stack

@Samb: I've already done so, no need to laugh.
Posted By: frazzle

Re: Wiimote Plugin Test - 02/21/08 19:45

I would love to experimentate and help you Firo but unfortunately, I don't own it yet
Nevertheless, this is a great project which I will certainly keep an eye on
I apologize for posting this note as it's off-topic since you only need replies which can be salutary for you.

Cheers

Frazzle
Posted By: FBL

Re: Wiimote Plugin Test - 02/26/08 17:58

http://firoball.de/upload/wiimote.zip

Very small sample application. It shows all recieved values inside a panel.

ESC - leave demo (don't use F10 or the x button of the window - it will crash!)
V - toggle vibration (off by default)
I - toggle infrared camera (off by default)
B - update battery status

All bugs found so far are fixed in this version. It should run pretty stable.
Posted By: FBL

Re: Wiimote Plugin Test - 02/28/08 16:51

Beta release!

http://www.firoball.de/upload/ackwii_beta.zip

You may use this with your own Lite-C code for playing around.
I've rewritten the interface to make it as slim as possible.
Most things are now handled directly in the DLL.

Bugfixes:
- infrared X direction data inverted so it fits to the A7 2D coordinate system


How to:
1) Connect Wiimote to PC (otherwise demo will just close)
2) Start SED and run wiimote.c (requires A7.07)
OR
Start wiimote.exe from /bin folder

Have fun!
Posted By: The_Clyde

Re: Wiimote Plugin Test - 08/07/08 05:20

This is really great! It works perfectly with the DIY virtual reality setup I'm building. I've mounted a wiimote and a little video screen to a bike helmet and the head tracking provided by the plugin means that when I move my head, the camera moves!

Thanks!
Posted By: GregoryArndt

Re: Wiimote Plugin Test - 10/17/08 07:50

Great Plug in!! I just started using it and have noticed a few things that you may already know.

I am using A7 v7.5 Commercial. I have gotten the version from the previous post to work great with my Toshiba Bluetooth stack, including separately connecting more than one remote. I have also started to implement this dll into my menu code. Although the wiimote_getdevices(); function does not seem to be returning the correct value. I have also created my own debug panel, so I do not use ackwii.c.

However, when I try to run the version in the latest post, I get no data. When I copy the dll into my project folder, it doesn't read any data from the wiimote. If I recopy the previous version, it works fine. I don't see any major changes to the lite-C files so I am unsure as to the cause. Since I can copy the two dll's into my project folder and one works and the other doesn't, then I don't think it is my code.

I'd love to help you test this out since I am hoping to use it within this new project as the major input device. I have built a USB IR 'Sensor Bar' to fit the front of my notebook. This is one of the best contributions I have seen to 3DGS, and I hope that you continue to develop it.

Here's how I'm using it...I do call wiimote_disconnect(WiiHandle[x]); when I close the program.

Code:
/******************************************

        AW Adventure Main File
                v 1.0

            Gregory Arndt
     (c) 2008 Artistry Entertainment

******************************************/

#define PRAGMA_PATH 		".";
#define PRAGMA_PATH 		"code";
#define PRAGMA_PATH 		"images";
#define PRAGMA_PATH		"maps";
#define PRAGMA_PATH		"models";
#define PRAGMA_PATH		"sounds";
#define PRAGMA_PATH		"textures";
#define PRAGMA_PLUGIN	"code\\lc_fmod_wrap.dll";
#define PRAGMA_PLUGIN	"code\\ackwii.dll";

// Acknex Includes
#include <litec.h>
#include <acknex.h>
#include <default.c>
// FMOD Wrapper Include
#include "LC_FMOD_WRAP.h";
// Wii DLL Include
//#define WII_DEBUG
#include "ackwii.h"
// AWAdventure Includes
#include "AWAdventure.h"
#include "MediaFunctions.c"
#include "PanelFunctions.c"
#include "SystemFunctions.c"


// Main Function
void main()
  { 
   var i;
   
   fps_max = 180;
   video_switch (6, 32, 2);
   video_window(NULL,NULL,112,strGameName);
	vec_set(screen_color, vector(0, 0, 0));
	mouse_pointer = 0;
	
	zero(WiiBuffer);
	
   on_close = on_esc = NextProgramState;
   on_f10 = ToggleInputCoords;
   // assign functions to Wiimote buttons
	WiiBuffer.event.on_1 = toggleIR;
	WiiBuffer.event.on_2 = toggleVibration;
	
   GetSystemInfo();
	wait(10);
	
	LoadSetup();
	wait(10);
	
	InitializeSounds();
	wait(10);
	
   WiiDevices = wiimote_getdevices();
   WiiIndex = 0;
   if (WiiDevices != NULL)
	  {
		/* connect first device */
		for (i = 0; i < 4; i++)
     	  { WiiHandle[WiiIndex+i] = wiimote_connect(WiiIndex+i); }
//		wiimote_ir(WiiHandle[WiiIndex], 1);
  	  }
	
	NextProgramState();
	
	while (1)
	  {		
		// Move Mouse
		if(WiiHandle[WiiIndex] != NULL) 
		  {
		  	wiimote_status(WiiHandle[WiiIndex], &WiiBuffer[WiiIndex]);
	  		mouse_pos.x = WiiBuffer[WiiIndex].ir[0].ir_x;
			mouse_pos.y = WiiBuffer[WiiIndex].ir[0].ir_y;
		  }
		  else {
		  		  mouse_pos.x = mouse_cursor.x;
				  mouse_pos.y = mouse_cursor.y;
				 }
		
		//Check Volume
		if (vBGMVolume != vBGMVolumeSet) UpdateBGMVolume();
		if (vSFXVolume != vSFXVolumeSet) UpdateSFXVolume();
		if (vMasterVolume != vMasterVolumeSet) UpdateMasterVolume();
		
		wait(1);
	  }	
  }


If I can continue to help thoroughly test this DLL, please let me know.

Gregory
Posted By: FBL

Re: Wiimote Plugin Test - 10/17/08 14:50

The DLL will soon be officially released.

I think I did some more fixes, and there was one which was very buggy.
But I don't know anymore which one I posted here.

If you can wait a bit there will be a new version released which worked for everybody up to now.
Maybe you're the exception to the statistics - then I'll have to check further wink

About your code:
wiimote_getdevices() does not return NULL but 0. But I'm pretty sure this is not the problem. As far as I remember Lite-C defines NULL to 0.

Edit:
Here is a console version built this month.
It should also detect the guitar hero guitar properly.

http://www.firoball.de/upload/ackwii_console.exe
Please tell me what it reports on your system.
Posted By: GregoryArndt

Re: Wiimote Plugin Test - 10/18/08 05:42

I've downloaded the console version and seem to be able to read the wiimote data when it is connected. If it is not connected, I can get some more information since the data doesn't stream by so fast. It looks like the console is seeing the number of potential connections that have been created in the bluetooth manager, but not whether they are actually connected. I have two created wiimote connections and the console sees two wiimotes but cannot connect to show data (since they are not truly bluetooth connected).

The version of the dll that works for me was simply titled 'wiimote.zip', and the newer post is titled 'ackwii_beta.zip'. I'm currently re-writting my menus to use the 'A' button and mouse position. This way I can use either the event.on_A = function or the mouse_left function. Then if there is no wiimote, the mouse is active.

Let me know how else I can help.
Posted By: FBL

Re: Wiimote Plugin Test - 10/18/08 11:44

If the number of connected Wiimotes is wrong this can be an issue of your Bluetooth stack. I know Bluesoleil has this problem. If a Wiimote once was conencted, it's always found as connected even if the connection is terminated. Only restarting the Bluetooth stack fixes this.

Because of this, the device number should only be read after all Wiimotes are connected properly - and it should only be read once because it needs to close ans reestablish the connections to all Wiimotes for performing this check. That's very slow.

Important is that in case you connect a Wiimote, a lot of button/sensor data is constantly written on screen.
If this is the case, then the plugin is working fine. In the DLL version you have to take care that IR camera is disabled by default in order to save battery power. You have to turn it on first if you want to use it (var wiimote_ir(var handle, var ir_on);).
This was not the case in older versions of the DLL.
the console version only reads the first connected Wiimote. You won't be able to check multiple Wiimotes with it. It should however detect that they are connected. (Easy way to check: when the data stream starts running, use right click -> "select" to keep the wiimote from spamming the console wink )
Posted By: GregoryArndt

Re: Wiimote Plugin Test - 10/18/08 22:43

I was already leaning toward the stack being the cause of the incorrect number of devices. I will try to confirm whether the stack I have is resetting correctly as well. Then I'll contact the vendor... eek Let me know if there is any driver information that would help you. Not sure what information you could use, if any. It looks like I'm using the Microsoft stack built for Toshiba. If you could suggest a compatible driver I'll see if it will work with my hardware.

I have been connecting the wiimotes before starting the engine and then calling wiimote_getdevices(); only once in the code. I save the return value in a variable and then use this variable to check the number of wiimotes. Did I misunderstand that this always returns 0? I was hoping to use this value to determine if the wiimote is connected and bringing up a warning. Maybe I should use the WiiHandle variable to check this. If none of the four handles are NULL, then the wiimote is connected.

Also, if you have any suggestions on how to properly configure the IR based on sensor bar position, I would be most grateful. After I get the menus converted to use the wiimote, I'll send you the code so you can see what I'm doing with it.

You have done a great thing with this plug in and I will definitely be giving you in-game credit. I would also be willing to donate($) to the cause in any way that I can. Especially once that pesky disclaimer is gone... wink





Posted By: FBL

Re: Wiimote Plugin Test - 10/18/08 23:18

I think there won't happen much when returning your bluetooth Stick.
Normally wiimote_getdevices() should return the number of connected Wiimotes - this means it should only return 0 if there is no Wiimote connected at all.
Depending on your bluetooth stack (driver) it can happen that it detects a device, although it isn't really connected. For Bluesoleil all devices listed in the Bluesoleil window are detected as connected devices - even if your Wiimtoe was powered down meanwhile or ran out of batteries.
I think it is possible to work around this by checking whether the Wiimote actually responds to data requests, but there was some reason why this is not implemented yet. I think it was a structural issue of my implementation. But it shouldn't be an unsolvable problem - it has lower priority than getting Balance Board support completed, though.

If this is not the case there might still be some bug hidden somewhere.
However if you see the data output in the console application then the connection is working fine and you should be able to use your Wiimote in the DLL version as well.

About IR: I already had some thoughts about it, but I haven't yet found time to try this out.
The basic thing is: you need the user to define whether the sensor bar is located on top or on bottom of the screen in order to get a realistic pointer feeling. This however halves your y- resolution as the core area for the IR will always be around the sensor bar - this means you lose half of the resolution (the half which is outside above/below the screen).
By letting the user decide about the sensor bar location you decide whether to take the upper or the lower part of the y sensor resolution into account.
That's the basic conclusion I came too.
I plan to put more features into this DLL time by time.
Posted By: FBL

Re: Wiimote Plugin Test - 10/19/08 21:41

I haven't done any changes to the device detection thingy yet as things seem to be more complicated as I thought, but I have a brand new version with other fixes and improvements.

http://www.firoball.de/upload/ackwii_beta.zip

Please note that you have to update your header file because Balance Board is now supported
Posted By: GregoryArndt

Re: Wiimote Plugin Test - 10/20/08 23:50

I just tried this new version. I dropped the .dll and .h files into the project folder and it ran with no problem. I don't have a balance board yet, but my other peripherals seem to be working (nun chuck and classic). It still appears that I'm reading 0 devices connected even with all four wiimotes on bluetooth, but it sounds like you working on that part. For now I use the handle to test if a wiimote is connected.

I'm working on an algorithm for the proper calculation of the IR data relative to screen position. It is possible to use only one of the data points to control the mouse cursor, but where's the fun in that? Sensor bar position will play a part in this algorithm. Why didn't I pay more attention in math classes?

As mentioned, I am also working on a menu system that will work with the wiimote ir or the mouse. I'm doing my best to make it a drop in code snippet that I will post in the user contributions forum, along with the algorithm, of course.

Thank you again for this plugin. I'm looking forward to the pre-release message going away.
Posted By: FBL

Re: Wiimote Plugin Test - 10/22/08 15:02

Ok this simply must be a bug then, since the HID routines seem to work.
If I find some time I'll check on my Laptop tonight.
Bluesoleil does not show this problem, but maybe MS stack will.
Posted By: FBL

Re: Wiimote Plugin Test - 10/23/08 06:38

I checked the implementation of the device check and I don't understand what is going on on your pc.
The problem is that the connect and the getDevices command basically do the same - they call the same internal device detection routine.

This means you should either be able to get correct device number AND be able to connect all your Wiimotes, or you read 0 devices and can't connect ANY Wiimote.

If you simply connect devices with the next higher index in a loop as long as the returned handle is not NULL, you should get the very same result as with getDevices().

Please grab the consoel version again and list the first few lines here which show "OpenDevice:..." and the like.

Also try to remove the getDevices call from your code and see if the first Wiimote (best try with a single one while no others are connected) still connects on first try.
Posted By: Dark_samurai

Re: Wiimote Plugin Test - 10/27/08 18:03

Can it be that conitec uses your plugin for their wiimote support? Because they moved this to beta state and they said in the past that they would prefer to work together with a user.

Sadly I can't use this great plugin because I don't have a wii...
But keep up your great work!
Posted By: FBL

Re: Wiimote Plugin Test - 11/02/08 01:05

Could be possible
Posted By: charrua

Re: Wiimote Plugin Test - 11/08/08 13:55

Hi, I'm working with the wiimote, doing some research. I wrote via api's of windows from basic my "lib" (bas) to handle HID devices and extracting buttons, ir, accel etc from de packed data of the wiimote.

Now I'm trying liteC and the first I done is test your console, but, I'm seen 4 dots with my soft and only 2 and some times 3 with your. I supose that is becose the ir sensibility.

Does your lib has fucntions to set the sensibility of the IR camera?
Does it handle the size of the ir dots as seen by the wiimote?
Does you manage all formats for ir packets: Basic, Extended and Full?

I'm using 4 ir sources (made by me) and I'm particullary interested in tracking the 3D position of the ir camera and for instance of the wiimote.

I'm moving to litleC and i prefere not to rewrote my code from basic.

Juan
Posted By: FBL

Re: Wiimote Plugin Test - 11/08/08 15:48

- Sensitivity is currently fixed, as the IR part was written when the sensitivity settings were not figured out yet.
- Basic and extended mode are supported up to now (extended mode is selected automatically whenever possible - with conencted expansion device only basic mode is possible). The mode selection can not be influenced, to keep things as simple as possible for the user.
- Size data is extracted for extended mode (basic mode does not carry size info) but currently not written to buffer, meaning it cannot be accessed yet with A7.

I have plans to implement some more IR stuff:
- putting IR dot size data to buffer for reading it with Lite-C/C-script
- recheck the sensitivity settings, maybe make it adjustable.
- add a function which allows to specify whether the sensor bar is located on top or on the bottom of the screen
- depending on the sensor bar position provide an integrated pointing functionality.

Currently I'm very busy finishing some things and doing "normal" jobs in order to keep myself well fed wink
But the actual state is not final, meaning I still want to improve it and add more things to it.
Posted By: charrua

Re: Wiimote Plugin Test - 11/08/08 17:57

Ok, thank's for your feedback
I will check/wait for updates!
and if i can help, here i am.

saludos

Juan
Posted By: FBL

Re: Wiimote Plugin Test - 11/15/08 21:39

Originally Posted By: Firoball
-
- putting IR dot size data to buffer for reading it with Lite-C/C-script
- recheck the sensitivity settings, maybe make it adjustable.
- depending on the sensor bar position provide an integrated pointing functionality.


Done so far.

Only with the sensor bar location I still have a problem. It seems to be set to top position automatically. Until I find out more, only top position will be supported.

Todo: angle correction for IR pointer.
Release will be with one of the next A7 betas...
Posted By: urob

Re: Wiimote Plugin Test - 12/08/08 20:03

Hello, I'd like to know, what kind of devices are recommendet for using this.
(except the Nintendo-stuff)
Which Bluetooth and IR-devices are needed or are preferred?

Great Work! Thanks a lot!

Uwe
Posted By: Dragons_Slayer

Re: Wiimote Plugin Test - 12/09/08 10:24

Sounds great, I was thinking about Wiimote support for 3DGS, I'm going to try it as soon as I'm home, i've got 2 Wiimotes, Nunchuck and Classic Controller. Hopefully it works!

EDIT: It works great! all buttons of the wiimote, nunchuck and classic controller are working, I'm using the build-in bluetooth of a Dell XPS m1710. it's called the "Dell Truemobile 355 bluetooth + EDR". Really great work, I'm looking forward to full wiimote support!
Posted By: FBL

Re: Wiimote Plugin Test - 01/04/09 17:28

Originally Posted By: urob
Hello, I'd like to know, what kind of devices are recommendet for using this.
(except the Nintendo-stuff)
Which Bluetooth and IR-devices are needed or are preferred?

Great Work! Thanks a lot!

Uwe


Any Bluetooth device compatible to Microsoft or Bluesoleil stack should do.
Unfortunately there are too many to test, but I've added support for these two HID drviers (they behave a little different) and checked several other code for accessing Wiimote. I found the same fix I added myself in msot of the other libs as well, so this should be working really good.

-------------

Meanwhile this library is official part of A7. So by downloading the latest A7 update, you'll always have the latest version of this lib.
Posted By: Secret_V

Re: Wiimote Plugin Test - 01/05/09 15:24

Hi, I just connected my WiiMote with my computer and tried to run wiimote.c and everything worked just fine. But now I'd like to use my WiiMote in one of my own projects, but is that possible with your plugin already? If yes, how?
Posted By: FBL

Re: Wiimote Plugin Test - 01/05/09 15:26

Download the latest A7 release from the announcements forum.

A short sample and all function are documented here:

http://www.conitec.net/beta/wiimote.htm


for obtaining the data from the buffer, take a look at ackwii.h - it also has short descriptions which is stored where.
Posted By: The_Clyde

Re: Wiimote Plugin Test - 01/07/09 03:10

I just made a copy of the original project code, renamed it, and deleted the part that brought the debug information onto the screen.

From there its pretty easy to build a project around the Wiimote plugin
Posted By: FBL

Re: Wiimote Plugin Test - 01/07/09 10:32

For getting rid of the debug info you can also just disable the DEBUG define.
Posted By: LoganSteele

Re: Wiimote Plugin Test - 03/26/09 11:38

Well first off, very nice job! I've just been waiting for something like this - and needless to say, I'll probably explore some certain star wars applications wink

Also, do you plan to continue developing this program for the new MotionPlus (when it is released)? I think that would solve most of the remaining movement detection limitations with this controller. If that were to be tackled, the ways in which this hardware could be used in PC applications is limitless (though, I'll blissfully limit myself to VR :P )

Thanks again, this is awesome
Posted By: FBL

Re: Wiimote Plugin Test - 03/26/09 17:41

Depends on when the guys at Wiili and Wiibrew have new information and what my free time allows smile
Posted By: fishhook

Re: Wiimote Plugin Test - 04/24/09 04:51

hi, im having a bit of trouble with the tilt value being returned to the buffer while the wiimote is rolled past 90 degrees.

im using the pre-release version on the plug-in, as the newer version released in the latest version of A7 no longer works with the code i have already written (& is 50KB smaller.....).

any suggestions
Posted By: Dillinger

ackwii with SP3? - 08/23/09 04:40

Hi,
I used the Wiimote pretty seemlessly on my Dell laptop, but the processor was cooking, so I wanted to try it out on my PC running XP. I've tried the Rocketfish Micro and the Abe Dongle from Lego. Nothing seems to work on this system. I know it's connecting. But for some reason, when I launch the app, it doesn't hand it over to the Wii. The Rocketfish insisted on a passcode and wouldn't accept an empty field. The Abe just keeps blinking indefinately.
I've tried everything to get it to connect.
The only thing that I can think of that is different on the PC is that it is running Service Pack 3.
Has anybody gotten the Wiimote to communicate directly with ackwii running SP3?
I'm thinking maybe they handle authentication differently in SP3 or something.
I'm running out of ideas. I REALLY want to get this to work on my PC the same as it did on my laptop. I didn't want to have to use GlovePIE or BlueSoleil if I can find an alternative.
Let me know if you have any suggetions.

Posted By: FBL

Re: ackwii with SP3? - 08/23/09 10:03

I have SP3 installed an it's working fine. sO SP3 alone is not the reason.

The Wiimote however has problems with some Bluetooth dongles.
There used to be a compatibility list at wiili.org, but unfortunately this site seems to be down.

One thing is for sure: The Wiimote must not be used with a Bluetooth key, this will never work. So if your driver is not possible to use no key at all, chances are high, that dongle and driver are not capable of using a Wiimote properly.

I'm afraid there's not much I can do to help you. But try some other driver like Bluesoleil and see what happens. Bluesoleil is the most reliable driver when trying to connect a Wiimot. Also the standard Windows driver should work.
Posted By: Lunchbox

Re: ackwii with SP3? - 08/23/09 14:18

Hi Firoball,

erstmal danke für die Wiimote-Umsetzung grin
Ich habe jetzt neu mit der GS-Entwicklung angefangen und bin irgendwie zu blöd deine Datein zu benutzen.
Ich hab am Anfang vom Code das hier
#include <ackwii.h>;
und hab die ackwii.dll in den SED-Plugin-Ordner geschoben und bei Plugins im SED wird mir auch ackwii angezeigt, aber trotzdem sagt der Compiler unknown keyword WIIMOTE beim starten - was hab ich denn falsch gemacht bzw. vergessen?

Grüße, Lunchbox
Posted By: FBL

Re: ackwii with SP3? - 08/23/09 20:05

hinter #include gehört kein ;

Aber das ist vermutlich nichtmal dein Problem. Normalerweise musst du garnichts rumschieben, da das Plugin ja mittlerweile fester bestandteil von A7 ist, und somit die Pfade passen. Kann höchstens seind ass du die DLL beimPublishen noch händisch rüberkopieren musst, aber ansonsten sollte alles passen.

Unknown keyword kommt jedenfalls nicht von einer fehlenden DLL - da wird das Script nicht gefunden.
Posted By: Lunchbox

Re: ackwii with SP3? - 08/24/09 16:03

und was heißt das genau für mich?
Was muss ich anders machen?
Ich hab mal statt ackwii.h irgendwas adneres geschrieben und es gab auch keinen Fehler - also kann ich nichtmal mit Sicherheit sagen, ob er die Datei lädt...
frown
Posted By: FBL

Re: ackwii with SP3? - 08/26/09 12:42

Dann bau mal bewusst einen Syntaxfehler in die ackwii.h und du weißt es wink

Wird der nicht angemeckert, dann wird auch das File nicht includiert.
Posted By: Dillinger

No Wii connect with Lite-C - 09/01/09 02:03

I isolated the problem:
on my laptop I was running a registered copy of GameStudio. On the PC, I was trying to compile the same using Lite-C. Today I downloaded the GS trial and the wiimote sprang to life like clockwork!
I even uninstalled my copy of Lite-C, downloaded and reinstalled. It comes with the latest ackwii plugins and everything seems to be in order. Sure enough, the wiimote won't pair even though there is clearly a bluetooth connection established.

P.S. Here is the list of compatible bluetooth devices:
Wiimote compatible Bluetooth devices @ Wii Homebrew

Posted By: FBL

Re: No Wii connect with Lite-C - 09/02/09 10:53

Check if there's a difference in the revision of the ackwii.h (see comment block on top).

I haven't done any changes for quite a while, so it should be the same. Also compare sizes of the Ackwii DLL any maybe try out the trial DLL shipping with the retail version.
Make sure you don't start with -nj as this disables the Wiimote.

Posted By: Dillinger

Multiple Wiimotes - 09/05/09 22:01

Hi, Thanks for the good work on the Wiimote plugins. Very exciting.
I was experimenting with trying to connect more than one Wiimote at a time. I basically just tried to declare a second WIIMOTE struct. I pass the handle to it O.K. but it still seems to be showing the data from Wiimote #1. Also, sometimes the second wii shows up in the #2 position, sometimes 3 or 4. I can always cycle through each and detect using a for loop, so no biggie there.
I was wondering if you've done any experimenting with more than 1 wiimote. Perhaps I just don't understand enough about structs.
Posted By: FBL

Re: Multiple Wiimotes - 09/06/09 10:06

Sounds weird, there might be a bug.
I haven't tested with two Wiimotes for quite a while, the last time it seemed to work ok.
Posted By: FBL

Re: Multiple Wiimotes - 09/06/09 16:10

I did a test run on my PC.

The plugin seems to work fine with two Wiimotes.
Maybe there is something odd in your code, can you post it?

My sample code:
Code:
#include <acknex.h>
#include <default.c>

#define WII_DEBUG	//define before including ackwii.h to enable debugging
#include "ackwii.h"



 
/* assigned to '1' button */
void toggleIR (var handle, WIIMOTE* buffer)
{
	/* note: IR sensor requires a sensor bar or adequate replacement */
	wiimote_ir(handle, 1 - buffer->status.ir);		
}

/* assigned to '2' button */
void toggleVibration (var handle, WIIMOTE* buffer)
{
	wiimote_vibration(handle, 1 - buffer->status.vibration);		
}

WIIMOTE buffer;	//needs to be declared globally
WIIMOTE buffer2;	//needs to be declared globally

var curbuf = 0;
void toggle_buffer()
{
#ifdef WII_DEBUG
	if (curbuf == 0)
			wiimote_debug(&buffer);
	else
			wiimote_debug(&buffer2);
#endif
	curbuf = 1-curbuf;
}

void main ()
{
	on_a = toggle_buffer;
	video_mode = 7; 
	screen_color.blue = 150;
	fps_max = 100;
	
	var wii_handle;
	var wii_handle2;
	/* clear buffer before using!! */
	zero(buffer);
	zero(buffer2);

	/* assign functions to Wiimote buttons */
	buffer.event.on_1 = toggleIR;
	buffer.event.on_2 = toggleVibration;
	on_esc = NULL;
	
	/* check if any Wiimote is found */
	if (wiimote_getdevices() > 0)
	{
		/* connect first device */
		wii_handle = wiimote_connect(0);
		wii_handle2 = wiimote_connect(1);
		if(wii_handle != NULL && wii_handle2 != NULL)
		{
			/*
			debug mode: show buffer in panel and assign log function to B button
			of Wiimote. Use F12 to toggle visibility of panel
			*/
#ifdef WII_DEBUG
			wiimote_debug(&buffer);
#endif
	
			/* 
			a value close to 1 results in very soft angle smoothing
			drawback: smoothing delivers the resulting angle delayed
			*/
			wiimote_smoothfac(wii_handle, 0.9);
			while (key_esc != 1)
			{
				/* update buffer with data coming from Wiimote */
				wiimote_status(wii_handle, &buffer);
				wiimote_status(wii_handle2, &buffer2);
				wait(1);
			}
			/*
			IMPORTANT: this function must be called before closing the engine window.
			Otherwise engine will crash! Also wait a few ticks to ensure that DLL is
			not running anymore.
			*/
			wiimote_disconnect(wii_handle);
			wiimote_disconnect(wii_handle2);
			wait(2);
		}
	}	
	sys_exit("");
}



This is a quick hack and it uses wiimote_connect/disconnect which is not necessarily required as A7 also uses it internally.

Use the 'a' key on keyboard to toggle the buffer display between Wiimote 1 and 2.


About the enumeration this might depend on the Bluetooth driver. I know that Bluesoleil leaves dead devices when unplugging batteries of a Wiimote which still are detected by the Wiimote driver, so this is possible.

I ran into this problem during development but could not find a way to sort out all those "false" Wiimotes.

edit: I tried now using wiimote_handle() and got some strange results including engine freeze during startup window. Maybe jcl should recheck what they are doing in this function.

Can you test the snippet I posted above on your system?
Posted By: Dillinger

Re: Multiple Wiimotes - 09/09/09 02:03

of course, how dumb of me.
I had the code all copied into memory and then I forgot to put it in the post.

Code:
// Wii2Vars.c 
// Show Wiimote Variables onscreen

#include <acknex.h>
#include <default.c>
#include <ackwii.h>

fps_max = 60 ; 
WIIMOTE buffer ; // defines a new buffer
WIIMOTE buffer2 ;

var howManyR_Wii = 0 ; // wiimote_getdevices()

var who_wii_R  = 0 ; // wiimote_handle(var)
var who_wii_R2 = 0 ; 
var who_wii_R3 = 0 ; 
var who_wii_R4 = 0 ; 

var wii_R_On  = 0 ;  // wiimote_connected(var)
var wii_R_On2 = 0 ;  
var wii_R_On3 = 0 ;  
var wii_R_On4 = 0 ;

var vibe1 = 1 ;
var vibe2 = 1 ;


PANEL* panButtons =
{
	digits( 60, 10, "Wii Buttons", Arial#28b, 1, 0 ) ; 
	
	digits( 60, 40, "# of Wiis Online = %0.f", Arial#18b, 1, howManyR_Wii ) ; 
//	digits( 60, 60, "NULL = %0.f", Arial#18b, 1, NULL ) ; 
	digits( 60, 80, "WiiMote Handle = %0.f", Arial#18b, 1, who_wii_R ) ; 
	digits( 60, 100, "WiiMote Connected? = %0.f", Arial#18b, 1, wii_R_On ) ; 
	digits( 60, 120, "A button = %0.f", Arial#18b, 1, buffer.buttons.butA ) ; 
	digits( 60, 140, "WiiStick Angle Tilt = %0.f", Arial#18b, 1, buffer.angle1.tilt ) ; 
	digits( 60, 160, "WiiStick Angle Roll = %0.f", Arial#18b, 1, buffer.angle1.roll ) ; 
//	digits( 60, 180, "NULL = %0.f", Arial#18b, 1, NULL ) ; 
	digits( 60, 200, "Wii2 Buttons", Arial#28b, 1, 0 ) ; 
//	digits( 60, 220, "NULL = %0.f", Arial#18b, 1, NULL ) ; 
	digits( 60, 240, "WiiMote2 Connected? = %0.f", Arial#18b, 1, wii_R_On2 ) ; 
	digits( 60, 260, "WiiMote2 Handle = %0.f", Arial#18b, 1, who_wii_R2 ) ; 
	digits( 60, 280, "A button = %0.f", Arial#18b, 1, buffer2.buttons.butA ) ;
	digits( 60, 300, "WiiStick2 Angle Tilt = %0.f", Arial#18b, 1, buffer2.angle1.tilt ) ; 
	digits( 60, 320, "WiiStick2 Angle Roll = %0.f", Arial#18b, 1, buffer2.angle1.roll ) ; 
//	digits( 60, 340, "NULL = %0.f", Arial#18b, 1, NULL ) ; 
	
	red = 1 ; green = 1 ; blue = 1 ; // Change Text color to black
	flags = VISIBLE;
}

PANEL* panMoButtons =
{
	digits( 300, 10, "Wii3 Buttons", Arial#28b, 1, 0 ) ; 
	
//	digits( 300, 60, "NULL = %0.f", Arial#18b, 1, NULL ) ; 
	digits( 300, 80, "WiiMote3 Handle = %0.f", Arial#18b, 1, who_wii_R3 ) ; 
	digits( 300, 100, "WiiMote3 Connected? = %0.f", Arial#18b, 1, wii_R_On3 ) ; 
//	digits( 300, 120, "A button = %0.f", Arial#18b, 1, buffer3.buttons.butA ) ; 
//	digits( 300, 140, "WiiStick Angle Tilt = %0.f", Arial#18b, 1, buffer3.angle1.tilt ) ; 
//	digits( 300, 160, "WiiStick Angle Roll = %0.f", Arial#18b, 1, buffer3.angle1.roll ) ; 
//	digits( 300, 180, "NULL = %0.f", Arial#18b, 1, NULL ) ; 
	digits( 300, 200, "Wii4 Buttons", Arial#28b, 1, 0 ) ; 
//	digits( 300, 220, "NULL = %0.f", Arial#18b, 1, NULL ) ; 
	digits( 300, 240, "WiiMote4 Connected? = %0.f", Arial#18b, 1, wii_R_On4 ) ; 
	digits( 300, 260, "WiiMote4 Handle = %0.f", Arial#18b, 1, who_wii_R4 ) ; 
//	digits( 300, 280, "A button = %0.f", Arial#18b, 1, buffer4.buttons.butA ) ;
//	digits( 300, 300, "WiiStick4 Angle Tilt = %0.f", Arial#18b, 1, buffer4.angle1.tilt ) ; 
//	digits( 300, 320, "WiiStick4 Angle Roll = %0.f", Arial#18b, 1, buffer4.angle1.roll ) ; 
//	digits( 300, 340, "NULL = %0.f", Arial#18b, 1, NULL ) ; 

	red = 1 ; green = 1 ; blue = 1 ; // Change Text color to black
	flags = VISIBLE;
}

action update_Earth()
{
	my.scale_x = .5 ; my.scale_y = .5 ; my.scale_z = .5 ; 
	
	while ( who_wii_R ) 
	{
		my.z = -( buffer.angle1.tilt ) / 2 ; 
		my.y = -( buffer.angle1.roll ) / 2 ; 
		wait(1);
	}
}

void main()
{
	level_load("") ; // Load empty Level
	wait(1);
	sky_color.red = 255 ; sky_color.green = 255 ; sky_color.blue = 255 ; 

	who_wii_R = wiimote_handle(1) ; 
	who_wii_R2 = wiimote_handle(2) ; 
	who_wii_R3 = wiimote_handle(3) ; 
	who_wii_R4 = wiimote_handle(4) ; 
	
	wait(2);
	
//	if ( !who_wii_R ) 
//	{
//		printf( "No WiiMote connected!" ) ; 
//		sys_exit( "G'bye Y'all" ) ;
//	}
//	else
//	{
		ent_create("earth.mdl", vector( 100, -30, 20 ), update_Earth) ; // Create Earth Model


		while( who_wii_R ) 
		{ 
			howManyR_Wii = wiimote_getdevices() ; // Return the number of Wiimotes online
			wait(1);
			
			wiimote_status( who_wii_R, buffer ) ; // Copy all the Wiimote Variables to a Struct named "buffer" 
			wiimote_status( who_wii_R2, buffer2 ) ;

			wii_R_On = wiimote_connected( who_wii_R ) ; // Are Wii Connected? Query by Handle Name
			wii_R_On2 = wiimote_connected( who_wii_R2 ) ;
			
			if ( wii_R_On && vibe1 ) 
			{
				wiimote_vibration( who_wii_R, 1 ) ; // Turn the vibration on (1)
				wait(100) ; 	// Shake until thoroughly agitated
				wiimote_vibration( who_wii_R, 0 ) ;  // Turn the vibration off (0)
				vibe1 = 0 ; // and never do it again
			}	

			if ( wii_R_On2 && vibe2 ) 
			{
				wiimote_vibration( who_wii_R2, 1 ) ; // Turn the vibration on (1)
				wait(100) ; 	// Shake until thoroughly agitated
				wiimote_vibration( who_wii_R2, 0 ) ;  // Turn the vibe off (0)
				vibe2 = 0 ; // and never do it again
			}	

		}
		

//	}
	
	
}



I tried the code sample you posted. All it does is exit immediately.
Pardon my ignorance, but am I supposed to add something to make this work? The code seems to say Connect, then promptly Disconnect and Exit. I'm still pretty green to C.
No BlueSoliel. I'm using default Windows driver at the moment.
Posted By: FBL

Re: Multiple Wiimotes - 09/09/09 06:26

Ok,

if my code exits this means that either the number of returned devices is 0, or one of the handles is NULL. Can you do a printf on these variables to find out?
Also it is necesary for this sample code that two Wiimotes are connected all the time as I check both handles for validity.

Maybe your driver for some reason leaves a gap in the enumeration and thus one of the handles is NULL.

----------------------------

Only thing I see in your code without testing is that you are calling wiimote_getdevices() in a while loop. This is not a good idea as this function is slo, and I think I'm also disconnecting and reconencting all Wiimotes in order to find out the number of Wiimotes.
Call it once before the while loop.
Posted By: msl_manni

Re: Multiple Wiimotes - 09/16/09 02:23

I would like to know your opinion about the motionplus addon for wii remote. Is it any good or not. And one more thing before I buy the wiimote, what accessories should I buy, like sensor bar needed?, nunchuck needed? and any other things that I dont know of, and would it be better to buy two wiimotes instead of wiimote+nunchuck. And should the motes be non-synced with the wii itself? Your opinion is important for me.
Posted By: FBL

Re: Multiple Wiimotes - 09/16/09 06:37

I have not tested the Wiimotion+ yet and the DLL does not yet support it. But I've heard only good things about it up to now.

It's enought hat the Wii is turned off when using the Wiimotes with the PC. Otherwise the Wii will "grab" the Wiimote before you can establish a connection with the PC. Once the Wiimote has been paired with the PC, you can of course turn on the Wii - it won't touch the already connected Wiimote.

- Sensor Bar is mainly needed for thigns like laser pointer function and also for some more exciting stuff liek headtracking. If you don't need anythig like this, you don't need a sensor bar. It's optional.
- Same goes for the Nunchuk. If you want to control a game using analog stick, you can do so by attaching a Nunchuk - it's fully supported (only original ones, 3rd party wireless Nunchuks behave weird and should not be used). But you don't need to. There are also classic controller, guiter hero controller and the balance board which are supported.
- If you want to do a two player game two Wiimotes of course are useful - but otherwise I see no real advantage in having two Wiimotes. Unless you want to do some testing...
Posted By: msl_manni

Re: Multiple Wiimotes - 09/16/09 11:21

Laser pointer and headtracking are surely the most needed features. And yes two Wiimotes for testing too.LOL.
Posted By: msl_manni

Re: Multiple Wiimotes - 09/17/09 02:20

Sensor Bar is mainly needed for thigns like laser pointer function and also for some more exciting stuff liek headtracking.

So how good is the headtracking and laser pointer without the addon - motionplus. And would it be possible for you to do some more efforts with motionplus thing and add it to your dll. And please publish the results so that we might be in better perspective about the whole thing.
Thanks in advance for your efforts and the dll.
Posted By: FBL

Re: Multiple Wiimotes - 09/17/09 06:40

Headtracking and laser pointer should not be influenced by Wiimotion+. It only improves the feedback of the motion sensors.
Headtracking has to be written on your own anyway. The DLL only provides the necessary functions, all the maths and matrix manipulation stuff is your work. But it's possible.

Currently I don't have much free time to work on the plugin, so no date is set.
© 2024 lite-C Forums