Jump to content
Sign in to follow this  
Ghost21

WiiMOTE Buttons

Recommended Posts

Ghost21

I would like to use the Wii Remote to control another device but I have to see what button was pushed and distinguish between them. Right now all I get is

some like:

0

0

0

0

0

0

The Zero's are all I see can someone please help me out. ????

#include <RawInput.au3>

#include <WinAPI.au3>

HotKeySet('{ESC}', '_EXIT')

Global $tRID_HID, $pRID_HID, $iRID_HID

Global $tRIH, $iRIH

Global $iNumDevices

Global $hGUI

$hGUI = GUICreate('Test', 100, 100)

GUIRegisterMsg($WM_INPUT, 'OnInput')

$tRID_HID = DllStructCreate($tagRAWINPUTDEVICE)

$pRID_HID = DllStructGetPtr($tRID_HID)

$iRID_HID = DllStructGetSize($tRID_HID)

$tRIH = DllStructCreate($tagRAWINPUTHEADER)

$iRIH = DllStructGetSize($tRIH)

$iNumDevices = 1

DllStructSetData($tRID_HID, 'usUsagePage', 0x01)

DllStructSetData($tRID_HID, 'usUsage', 0x05)

DllStructSetData($tRID_HID, 'dwFlags', $RIDEV_INPUTSINK)

DllStructSetData($tRID_HID, 'hwndTarget', $hGUI)

_RegisterRawInputDevices($pRID_HID, $iNumDevices, $iRID_HID)

While 1

Sleep(20)

WEnd

Func OnInput($hwnd, $iMsg, $iwParam, $ilParam)

Local $tRI_HID, $pRI_HID, $iRI_HID

Local $iErrorCode

$tRIDI_HID = DllStructCreate($tagRIDDEVICEINFO_HID)

$pRIDI_HID = DllStructGetPtr($tRIDI_HID)

$iRIDI_HID = DllStructGetSize($tRIDI_HID)

DllStructSetData($tRIDI_HID, 'cbSize', $iRIDI_HID)

$iErrorCode = _GetRawInputData($ilParam, $RID_INPUT, $pRI_HID, $iRI_HID, $iRIH)

If @error Or $iErrorCode = $__UINT_ERROR Then

ConsoleWrite(_WinAPI_GetLastErrorMessage())

Else

ConsoleWrite(DllStructGetData($tRI_HID, 'hDevice') & @LF)

ConsoleWrite(DllStructGetData($tRI_HID, 'dwCount') & @LF)

ConsoleWrite(DllStructGetData($tRI_HID, 'bRawData') & @LF)

EndIf

$tRI_HID = 0

Return 'GUI_RUNDEFMSG'

EndFunc

Func _EXIT()

GUIDelete()

Exit

EndFunc

Share this post


Link to post
Share on other sites
Ghost21

http://www.dolphin-emu.com/news.php

What does that do for me ??

Share this post


Link to post
Share on other sites
Bert

it is the only site I know of that has info on Wii and Wii controllers being emulated on a PC. It should give you some direction. Note, what you are asking for is very complexed. If anything, thy have already done the work for you, so why reinvent the wheel?

Share this post


Link to post
Share on other sites
Authenticity

Can you run this script and post the console output? First make a run when the controller is disconnected, reconnect and make another run.

Share this post


Link to post
Share on other sites
Ghost21

Can you run this script and post the console output? First make a run when the controller is disconnected, reconnect and make another run.

This one is before it is connected:

[0]|0x000F02BA|2

[1]|0x001103D5|2

[2]|0x00010061|1

[3]|0x0001005F|1

[4]|0x00010049|0

[5]|0x00010047|0

\??\HID#HID_KEYBOARD#2&3a6c912e&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

\??\HID#HIDAVCONTROL#2&34ba8cf0&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

\??\Root#RDP_KBD#0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}

\??\ACPI#PNP0303#4&b310638&0#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}

\??\Root#RDP_MOU#0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}

\??\ACPI#SYN014F#4&b310638&0#{378de44c-56ef-11d1-bc8c-00a0c91405dd}

This is while it is connected:

[0]|0x000F02BA|2

[1]|0x001103D5|2

[2]|0x00010061|1

[3]|0x0001005F|1

[4]|0x00010049|0

[5]|0x00010047|0

\??\HID#HID_KEYBOARD#2&3a6c912e&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

\??\HID#HIDAVCONTROL#2&34ba8cf0&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

\??\Root#RDP_KBD#0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}

\??\ACPI#PNP0303#4&b310638&0#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}

\??\Root#RDP_MOU#0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}

\??\ACPI#SYN014F#4&b310638&0#{378de44c-56ef-11d1-bc8c-00a0c91405dd}

Hope that helps...

Share this post


Link to post
Share on other sites
Authenticity

There is a working program to make your WiiMote to work with the PC. Follow this guide, the driver you need is GlovePIE. Read this as well which explain quite the same as the previous guide. You can use another driver, WiinRemote. After that, if the scripts abilities don't satisfy you, check to see if you can get different output from the first script once when connected, etc...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×