1 registered members (AndrewAMD),
992
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
Newbie
|
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.
/******************************************
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
FBL
OP
Senior Expert
|
OP
Senior Expert
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 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.exePlease 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
Newbie
|
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
FBL
OP
Senior Expert
|
OP
Senior Expert
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 )
|
|
|
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
Newbie
|
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... 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...
Gregory Arndt Artistry Entertainment ** A7 v7.5 Commercial ** Toshiba Satellite X205-SLi3 Vista Ultimate
|
|
|
Re: Wiimote Plugin Test
[Re: FBL]
#232171
10/19/08 21:41
10/19/08 21:41
|
Joined: Sep 2003
Posts: 9,859
FBL
OP
Senior Expert
|
OP
Senior Expert
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.zipPlease 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
Newbie
|
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
|
|
|
|