2
« on: December 29, 2009, 05:09:51 PM »
I'm working on a wiimote plugin for mach. Im using Ed's plugin wizard and the wiiuse lib. First I must say Ed did a fantastic job with this wizard and the videos gave my a huge leap forward with my learning curve. I have connected the wiimote to mach and displayed limited data in a dialog. Now Im stuck. The code below works great.
WiiMoteStatus^ wiimotestatus = MG::wiimotestatus;
WiiMoteConfig^ wiimoteconfig = MG::wiimoteconfig;
wiimote** wiimotes;
wiimotes = wiiuse_init(wiimoteconfig->maxwiimotes); // Send the max wiimotes to init (max of 1)
//--------------------------------------------------------------------
// find and connect to the wiimotes
//--------------------------------------------------------------------
if (MG::wiimotestatus) // crashes without this line. learned the hard way
{
if (!wiimotestatus->found) // if we found one wiimote stop looking
{
wiimotestatus->found = wiiuse_find(wiimotes, wiimoteconfig->maxwiimotes, 10); // We look for wiimotes (max of one, look for 10sec)
}
if (!wiimotestatus->connected) // if we are connected dont try to connect
{
wiimotestatus->connected = wiiuse_connect(wiimotes, wiimoteconfig->maxwiimotes);
Now my problem is in the next part-------------------------------------------------------------------------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>
wiiuse_poll(wiimotes, 1);
wiiuse_motion_sensing(wiimotes[0], 1);
wiimotestatus->roll = wiimotes[0]->orient.roll;
if (IS_PRESSED(wiimotes[0], WIIMOTE_BUTTON_A))
{
wiimotestatus->debug = (true);
Everything compiles ok but mach crashes. Now wiiuse_poll is the function to poll the data from the wiiuse dll. it seems im having trouble getting to arrays of data returned.
I hope someone has an idea.