Okay, that's a start at least. Now, that is why I was on about Bluetooth before, and also why I put in that function to select the Bluetooth device in the plug-in...the dialog should be able to see something there, as well. It may be that we can only see the radio, and an unknown device beyond that. (Which may be a Wiimote, Bluetooth phone...anything, really.) Then, it might be best to approach it from the Bluetooth socket angle.
So, then...what happens when you try to use it? Do the normal joystick commands return any information at all? If that's the case, we can probably get at the Wiimote in a much simpler manner.
Here is a function that will control a camera with the joystick interface. Anyone care to try that with the Wiimote after selecting it as an input device?
function jzDoJoystickCameraControl(camera as integer)
local camerax as float
local cameray as float
local cameraz as float
local cameraxangle as float
local camerayangle as float
local camerazangle as float
local twistz as integer
local stickz as integer
local movex as float
local movey as float
local movez as float
local yrotation as float
movex = 0.0
movey = 0.0
movez = 0.0
yrotation = 0.0
camerax = camera position x(camera)
cameray = camera position y(camera)
cameraz = camera position z(camera)
cameraxangle = camera angle x(camera)
camerayangle = camera angle y(camera)
camerazangle = camera angle z(camera)
if joystick fire a()
camerax = 0.0
cameray = 0.0
cameraz = 0.0
cameraxangle = 0.0
camerayangle = 0.0
camerazangle = 0.0
position camera camera, 0.0, 0.0, 0.0
endif
if joystick up()
inc cameraz, 0.05
movez = 0.05
endif
if joystick down()
dec cameraz, 0.05
movez = -0.05
endif
if joystick right()
inc camerax, 0.05
movey = 0.05
yrotation = camerayangle + 90
endif
if joystick left()
dec camerax, 0.05
movey = 0.05
yrotation = camerayangle - 90
endif
twistz = joystick twist z()
if twistz > 32767
inc camerayangle, 0.5
else
if twistz < 32767
dec camerayangle, 0.5
endif
endif
stickz = joystick z()
if stickz < 0
dec cameraxangle, 0.5
else
if stickz > 0
inc cameraxangle, 0.5
endif
endif
xrotate camera camera, 0
move camera camera, movex
xrotate camera camera, cameraxangle
yrotate camera camera, yrotation
move camera camera, movey
yrotate camera camera, camerayangle
zrotate camera camera, 0
move camera camera, movez
zrotate camera camera, camerazangle
endfunction
Actually, here is a little program to allow you to test any device that might be connected. Please let's test it on some things and see what information the standard HID interface will return with Wiimotes, and other devices. The XBox360 wireless controller works with this scheme, and if the Wiimote returns anything, then we can get this going much more quickly.
global i as integer
global j as integer
global devicename as string
empty checklist
perform checklist for control devices
i = checklist quantity()
for j = 1 to i
print "[" + str$(j) + "] " + checklist string$(j)
next j
input "Select a device. 0 to EXIT.", i
print str$(i)
if i = 0
goto exitapp
endif
devicename = checklist string$(i)
set control device devicename
do
cls 0
print devicename
print "Fire A: " + str$(joystick fire a()) + " B: " + str$(joystick fire b()) + " C: " + str$(joystick fire c()) + " D: " + str$(joystick fire d())
print "UP: " + str$(joystick up()) + " DOWN: " + str$(joystick down()) + " LEFT: " + str$(joystick left()) + " RIGHT: " + str$(joystick right())
print "TWIST: " + str$(joystick z()) + " TWIST Z: " + str$(joystick twist z())
loop
exitapp:
end