Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 840 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 6 1 2 3 4 5 6
Re: Wiimote Plugin Test [Re: FBL] #231832
10/17/08 07:50
10/17/08 07:50
Joined: Apr 2007
Posts: 7
Burbank, CA
GregoryArndt Offline
Newbie
GregoryArndt  Offline
Newbie

Joined: Apr 2007
Posts: 7
Burbank, CA
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

Last edited by GregoryArndt; 10/17/08 11:56. Reason: Testing Update

Gregory Arndt
Artistry Entertainment
** A7 v7.5 Commercial **
Toshiba Satellite X205-SLi3
Vista Ultimate
Re: Wiimote Plugin Test [Re: GregoryArndt] #231882
10/17/08 14:50
10/17/08 14:50
Joined: Sep 2003
Posts: 9,859
F
FBL Offline OP
Senior Expert
FBL  Offline OP
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
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.

Last edited by Firoball; 10/17/08 15:00.
Re: Wiimote Plugin Test [Re: FBL] #231949
10/18/08 05:42
10/18/08 05:42
Joined: Apr 2007
Posts: 7
Burbank, CA
GregoryArndt Offline
Newbie
GregoryArndt  Offline
Newbie

Joined: Apr 2007
Posts: 7
Burbank, CA
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.


Gregory Arndt
Artistry Entertainment
** A7 v7.5 Commercial **
Toshiba Satellite X205-SLi3
Vista Ultimate
Re: Wiimote Plugin Test [Re: GregoryArndt] #231963
10/18/08 11:44
10/18/08 11:44
Joined: Sep 2003
Posts: 9,859
F
FBL Offline OP
Senior Expert
FBL  Offline OP
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
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 )

Re: Wiimote Plugin Test [Re: FBL] #232031
10/18/08 22:43
10/18/08 22:43
Joined: Apr 2007
Posts: 7
Burbank, CA
GregoryArndt Offline
Newbie
GregoryArndt  Offline
Newbie

Joined: Apr 2007
Posts: 7
Burbank, CA
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







Gregory Arndt
Artistry Entertainment
** A7 v7.5 Commercial **
Toshiba Satellite X205-SLi3
Vista Ultimate
Re: Wiimote Plugin Test [Re: GregoryArndt] #232037
10/18/08 23:18
10/18/08 23:18
Joined: Sep 2003
Posts: 9,859
F
FBL Offline OP
Senior Expert
FBL  Offline OP
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
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.

Re: Wiimote Plugin Test [Re: FBL] #232171
10/19/08 21:41
10/19/08 21:41
Joined: Sep 2003
Posts: 9,859
F
FBL Offline OP
Senior Expert
FBL  Offline OP
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
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

Re: Wiimote Plugin Test [Re: FBL] #232294
10/20/08 23:50
10/20/08 23:50
Joined: Apr 2007
Posts: 7
Burbank, CA
GregoryArndt Offline
Newbie
GregoryArndt  Offline
Newbie

Joined: Apr 2007
Posts: 7
Burbank, CA
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.


Gregory Arndt
Artistry Entertainment
** A7 v7.5 Commercial **
Toshiba Satellite X205-SLi3
Vista Ultimate
Re: Wiimote Plugin Test [Re: GregoryArndt] #232583
10/22/08 15:02
10/22/08 15:02
Joined: Sep 2003
Posts: 9,859
F
FBL Offline OP
Senior Expert
FBL  Offline OP
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
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.

Re: Wiimote Plugin Test [Re: FBL] #232681
10/23/08 06:38
10/23/08 06:38
Joined: Sep 2003
Posts: 9,859
F
FBL Offline OP
Senior Expert
FBL  Offline OP
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
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.

Page 2 of 6 1 2 3 4 5 6

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1