Xbox 360 Controller EventClient
#1
I wrote an EventClient in C++ for the Xbox 360 Controller for Windows. I've tested it in Windows Vista 32bit. From trac:

"This patch adds the C++ code for an Xbox 360 Controller EventClient for Windows (using XINPUT). A new project is added to the XBMC VSE2008 solution from which the EventClient can be compiled. The EventClient has no user interface - it simply sends the data received from the first connected controller to XBMC listening on localhost (using the "XG" [Xbox gamepad] device map). At the moment, I do not have time to add further features, so I'm submitting the patch as the basic functionality is working correctly."
Reply
#2
Can you post a link to the ticket? I've been struggling to get an eventclient to work and I would be very interested to see your code.

Thanks,

John Rennie
Reply
#3
Here's the link to the trac ticket: http://trac.xbmc.org/ticket/5299

To write an EventClient in C++, you use the class CXBMCClient defined in xbmcclient.h. The SendButton method is used to send button presses to XBMC. Be sure to have a look at xbmcclient.h - there you find which flags the SendButton method supports.

That's it in a nutshell. Have a look at the code, it's rather self-explanatory.
Reply
#4
The problem I had was working out what to send. For example I worked out that you have to OR the keycode with 0xF000 by trial and error. Also my example doesn't work unless I include BTN_QUEUE in the flags, but I can't find a description of what this flag means or why it might be necessary. I notice your code does not use it.

John Rennie
Reply
#5
I solved the problem of knowing which strings to send for which buttons by looking at ButtonTranslator.cpp - in the Translate*String functions you can find the names used for the buttons/keys.

I don't know about the BTN_QUEUE flag, though - my code appears to work without it.
Reply
#6
Unfortunately I can't test this due to a missing x360 controller but I'm happy that someone tried the event client method. It would be nice if we could get more event clients also for other remotes and together with topfs we might add missing pieces to the event server.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#7
Having to run separate processes is always going to be clunky. The event server is neat, but I don't think it's ideal for supporting things like IR remotes. I can see a role for controlling XBMC remotely from a different PC, but I doubt this would be a common requirement.

The best solution would be to support event hooks in a dll. This is pretty standard practice in Windows, though I don't know how easy it would be to do cross platform without an untidy maze of #ifdefs.

JR
Reply
#8
@jhsrennie: could you be more specific ? On a low scaled htpc, i can evaluate how task switching may be painful, fe while decoding some hd video... but on a reasonably modern box, i'm pretty confident about multitasking a bunch(3-4) of spinning tasks, and still having good response-time... Is the hd decoding, the worst case situation you're afraid of ?
Awen
you can't hide
Reply
#9
Would it be possible to get it to work on the old Xbox provided you add the wireless receiver via USB available for the pc?
Reply
#10
Can't get this patch applied with tortoiseSVN, it doesn't like line 486 for some reason...
Reply
#11
ultrabrutal Wrote:Would it be possible to get it to work on the old Xbox provided you add the wireless receiver via USB available for the pc?

I do not know this, but my guess would be: no. You would need to ask someone who is more familiar with the Xbox port of XBMC than me to know for sure, though.

bb10 Wrote:Can't get this patch applied with tortoiseSVN, it doesn't like line 486 for some reason...

Well, the patch should apply cleanly to the SVN version from two months ago, when I submitted it Smile

I'll have a look at problem as soon as I can and report back.
Reply
#12
frain Wrote:Well, the patch should apply cleanly to the SVN version from two months ago, when I submitted it Smile

I'll have a look at problem as soon as I can and report back.

Well, to be honest, I tried it 2 months ago and tortoiseSVN didn't like it back then either. I just ignored it as I thought it would be added to SVN anyway.

Last night I thought I would try it again, and it failed. I decided to patch it manually.

I encountered a few problems like the unknown location of xbmcclient.h, so I tried to add it to the headerfiles. That didn't work so I copied it to the xbox360evenclient folder and it compiled (with BuildSetup.bat), but only the eventclient and no XBMC. Tongue

Thanks for the reply though, I'll wait for an updated patch. Smile
Reply
#13
frain Wrote:I do not know this, but my guess would be: no.

Well the XBMC xbox version has the event server built in, so basicly adding a USB receiver to my server and two Xbmc 360 wireless remotes, should make it possible to access these two Xboxes? You see I have 3 xboxes and only one working logitech controller left Sad The two Xboxes are close enough for my PC server to be able to work with the USB receiver I think.
Reply
#14
ultrabrutal Wrote:Well the XBMC xbox version has the event server built in, so basicly adding a USB receiver to my server and two Xbmc 360 wireless remotes, should make it possible to access these two Xboxes? You see I have 3 xboxes and only one working logitech controller left Sad The two Xboxes are close enough for my PC server to be able to work with the USB receiver I think.

Ah, I think I misread your original question. To clarify: I believe it will be impossible to use the XBox360 Controller by connecting the USB receiver directly to the XBox.

On the other hand, using the XBox360 Controller together with the EventClient on Windows and telling the EventClient to send events to the XBMC instance running on the XBox should work! I think this is what you were referring to anyways, I'm sorry that I misunderstood your post!

In any case, I haven't been able to work on updating the patch yet. I hope to be able to do some work on it either this or the next weekend. Sorry about the delay!
Reply
#15
bb10 Wrote:Thanks for the reply though, I'll wait for an updated patch. Smile

I posted an updated diff to http://trac.xbmc.org/ticket/5299. The diff should now apply cleanly to the SVN version (this time, I checked out a fresh copy and verified this fact).
Reply

Logout Mark Read Team Forum Stats Members Help
Xbox 360 Controller EventClient4