Added GUI settings for control Joystick usage.
Some addition to CJoystick class - identical to CStatMouse.
Now Joystick can be enabled/disabled (and Initialized/deinitialized) by calling g_Joystick.SetEnable (true / false)
Also can be used as workaround for popular iMON (SoundGraph) hardware on Windows, which with latest DirectInput patches falls into endless Remove/Insert loop. That's make remote iMon control and display unusable.
I don't think that I like that. As I can see from the imon thread this is a bug in the imon firmware and I don't want to fix their shit in our code.
Since I can't test it I would appreciate a real and more general fix if possible.
btw for your next pr please make sure that you don't have the merge branch thingies in. Try something like git pull --rebase upstream master to get your changes on top without the merge.
iMon claims that this it the bug in DirectX. See 'Cause' in http://www.soundgraph.com/forums/faq.php?faq=sg_faq_sw_imon_manager_g_01#faq_sg_faq_software_products_gamecontrol
But anyway - it's unfixable because firmware isn't upgradeable. At least until Microsoft rewrote DirectInput code. :)
So, until that it's not possible to use iMON hardware with XBMC (with DirectInput Joystick). I'm sure that a lot of users will be unhappy if this will go to release.
My solution is relatively simple, doesn't broke anything and add small feature, that can be used even by users without iMON hardware.
Putting aside the issue of whether we want it, the above 3 commits could be squashed into one, plus some of the checks (in ProcessEventClient) aren't needed - they don't actually use the joystick hardware stuff, rather they use the joystick keymapping stuff. Also, there's some whitespace issues on the last commit.
To squash into one, git rebase -i HEAD~3 and change the last 2 commits to squash. You'll then get to rewrite the commit message.
To get you into thinking, is there a possibility to detect the firmware in question? Maybe via a key in the registry or a certain dll which is there?
OK, I'll combine all commits in one, fix whitespaces and remove some checks.
It's possible to detect hardware via USB HID properties, but I don't have a lists of buggy and bug-free firmwares.
I'm ready to write detection module. Could you advise something about lists of the hardware?
Started development thread for discussion: http://forum.xbmc.org/showthread.php?tid=135218
Rewrote from the scratch.
Now it looks like elegant solution, not like a hack as before
[osx] bring in 'SDL: Fixed bug #1111', invalid inline assembly in src…
I like the idea with the gui settings but you mixed too many different changes into one commit which makes it difficult to review. One commit for the gui setting and one commit for the cosmetic changes please.
I don't know what the asm fix has to do with the joystick class nor this pr in general.
There are just a few cosmetic points.
One of them - duplicated Reset, other - code for one function move from .h to .cpp and third one - move g_Joystick to SystemGlobal.
Do you really need separate commits?
@jmarshallnz what do you think? can this go in?
OK. I'll split it to several commits. :)
Just two are fine :)
Too late. :)
@jmarshallnz . Fine?
Karlson2k: yes - please squash that one down, remove the russian translation, fix the Reset issue, and separate out your one-line if()'s onto two lines.
It was done already, except squash.
Looks fine - please squash the fixups into the appropriate commits and I'll pull it in.
Move g_Joystick to SystemGlobals.cpp
Fix init & clarification in CJoystick classes
Prevent of using uninitialized joystick variables in Application.cpp
@jmarshallnz finally done!
Add support to CJoystick for IsEnabled Just like in CStatMouse
Add new GUI setting for Joystick and use that setting
This breaks the configurations with --disable-joystick:
SystemGlobals.cpp:68:3: error: ‘CJoystick’ does not name a type
Looks like just the || defined HAS_EVENT_SERVER needs removing on the include and g_Joystick?
That indeed fixed it for me and so far the compiled binary seem to work fine. Is there any other reason for having the HAS_EVENT_SERVER there?
HAS_EVENT_SERVER is there because the apple remote uses the joystick interface. If you break that, then the Apple remote will not work anymore if --disable-joystick is used which ios does in configure.in
Doesn't it just use the joystick translation stuff, not the actual joystick object (g_Joystick) ?
was that moved out ? from what I remember, there are functions there that the eventserver called which is why there was an || HAS_EVENT_SERVER
and it's osx not ios that uses the joystick/eventserver. other eventclients might also be using it.
Looks like "|| HAS_EVENT_SERVER" could be removed from SystemGlobals.cpp and from Application.cpp.
Now SystemGlobals just reflect include schema from Application.cpp.
CApplication::ProcessEventServer calls CApplication::ProcessJoystickEvent which one calls g_Joystick.Reset() (only ifdef HAS_SDL_JOYSTICK) and calls CButtonTranslator::GetInstance().TranslateJoystickString which one is using only defines JACTIVE_ from WIN/SDLJoystick.h
So now it doesn't break anything, but could be optimized.
Could someone test compilation on MacOS/iOS and Linux platforms to be sure?
I can confirm that Linux builds and works fine with || HASEVENT_SERVER removed when configured with --disabled-joystick (my standard build configuration)
Still need MacOS/iOS confirmation.
Confirmed - removing the || HASEVENT_SERVER fixes compilation on ios/osx too.
Created PR #1140