WiiDesktopVr & Wiimotelib 1.2.1 & Visual c# 2008 Express & x64 env (works also for x86)

I man­aged, after about an hour of work on it, to run the wiidesk­topvr (devel­oped by Johnny Chung Lee) on my Vista 64bit.

NOTE: i’m plan­ning to release an updated ver­sion that uses 1.8beta library which sup­ports wiimo­tion plus :)

BLUESOLEIL USERS: update to the lat­est ver­sion to avoid prob­lems run­ning the application!!!

Causes:

  1. The soft­ware is unable to start because the com­piler pre­de­fined tar­get machine is set to 64bit and you can’t change inside visual c# express […]
  2. The soft­ware is unable to find my wiimote (proper con­nected, i checked using WiimoteLib_1.2.1 (and also the 1.2) util­ity wiimotetest.exe), this issue went away switch­ing the wiimote lib to 1.2.1 instead of the embed­ded 1.1

Pre­req­ui­sites

  • Wii Remote
  • Blue­tooth Enabled and wii sync-ed
  • Wii con­trol bar / Home made con­trol bar
  • Visual c# 2008 Express
  • DirectX SDK April 2007 or later (i’m using Novem­ber 2007), if i’m not wrong the visual c# asked to down­load in the instal­la­tion phase, check if is true in the Add/Remove Pro­grams after the visual c# installation.

Sim­pler way

FIXED LINK::down­load the pack­age i cre­ated (about 2MB);

Not so sim­ple way

:: fol­low the instruc­tion below:

Begin:

  • down­load wiidesk­topvr and wiimotelib sources 1.2.1 (devel­oped by Brian Peek),
    (if you use the 1.2 you will have to remove ir3 and ir4 calls, two if/else that checked these infrared devices and an event cap­ture, i man­aged to run both but the 1.2.1 avoid to mod­ify the code) ;
  • unpack both zip in dif­fer­ent folders;

step 1: com­pile under x64 enviroment

  1. open the wiidesk­topvr­folder, and dou­ble click the wiidesktopvr.csproj, let the visual c# 2008 and let it con­vert (don’t let it cre­ate backup files, you have the zip)
  2. close visual c# and in the wiidesk­topvr folder open with notepad/text edi­tor the wiidesktopvr.csproj file: search for
    (there are two occur­rences of these entries one for debug and the other for release so replace both for secu­rity)

    image_16

    and add the fol­low­ing line

    image_18

Now, when you build/rebuild the project it will be x86 and will works. But for me this wasn’t enough.

step 2: Replac­ing wiimotelib from 1.1 to 1.2.1

  1. now we need to replace the 1.1 lib with the 1.2.1 ver­sion.
  2. with the wiidesk­topvr project open, on the right exclude from the project (right click ->exclude from project) except
    image_12
  3. Keep only these:
    • datatype.cs
    • events.cs
    • hidimports.cs
    • wiimote.cs

image_2

  1. close the c# editor
  2. if there is the wiimotelib folder inside the wiidesk­topvr folder, enter and delete all files left inside (some­times it hap­pens because i keep them opened with other appz),oth­er­wise cre­ate WiimoteLib folder again (must be empty) under the wiidesk­topvr main folder (the path is WiiDesktopVR\WiimoteLib)
  3. copy all the files from the WiimoteLib_1.2.1_src\src\WiimoteCS\WiimoteLib into the wiimotelib folder inside wiidesk­topvr folder (the folder cre­ated before wasWiiDesktopVR\WiimoteLib). Below the new con­tent of the folder (over­wite if asked):
    image_20
  4. reopen wiidesk­topvr project with visual c# (if you find some files with excla­ma­tion marks the solu­tion is to right click on those files  again ->Exclude from project or delete them) remem­ber always to keep those 4 .cs files.
  5. You will get some errors due to some changes in the lib interface:
    1. Get­Bat­teryLevel() not found -> replace with get­Sta­tus() (for remote2 and remote instances)
    2. OnWi­imoteChanged -> replace with WiimoteChanged (for remote2 and remote instances)
  6. You’ll get now after com­pil­ing only 5 warn­ing on “error list” tab: don’t care.

Finally:

  1. Build project, and start it.

If you get a wii not con­nected or unable to find it in HID list (to close these mes­sages if your mouse doesn’t work, alt+F4 twice and you will go back to the project) : resync your wiimote, and check using wiimotelib util­ity (taken from the run­time library pack­age) if the wiimote transmit.

Adden­dum: error open­ing in design mode wiidesktopVR.cs or other gui files

If you try to open WiiDesktopVR.cs form you will get the fol­low­ing error:

image_8

C# express 2008 needs the visual class on top of other classes.

The solu­tion is to cut and paste the top class that isn’t the gui class under the gui class, keep­ing the gui class on top; in this case, hav­ing only two classes into the file we need to put at bot­tom of the file :

class Point2D
{
pub­lic float x = 0.0f;
pub­lic float y = 0.0f;
pub­lic void set(float x, float y)
{
this.x = x;
this.y = y;
}
}

needs to be moved to (reach the end of the file):

}
}
}
}

//End of file

put the point2D class here:

}
}
}


}

//End of file

so it will be:

}
}
}

class Point2D
{
pub­lic float x = 0.0f;
pub­lic float y = 0.0f;
pub­lic void set(float x, float y)
{
this.x = x;
this.y = y;
}
}

}

Save e reopen the wiidesktopvr.cs, now you’ll see with­out errors:

image_10

Leave a comment

Your comment