Giter Site home page Giter Site logo

Comments (11)

WhiteMagic avatar WhiteMagic commented on September 13, 2024 1

When you have more then two devices connected are they all distinguishable from each other by the number of axis, buttons and hats? Gremlin needs to create a mapping from vJoy devices to SDL2 (library used to read joystick data) as vJoy doesn't provide the windows id of the devices (last I checked).

To get this mapping which is needed to handle more then a single vjoy device Gremlin attempts to associate vJoy and SDL devices based on the number of axis, buttons, and hats. So if say two devices have identical inputs this mapping is impossible to make and gremlin quits with a sadly somewhat uninformative message, which is a thing I need to fix, see #37. Let me know if this is the issue you're seeing.

from joystickgremlin.

mzngr avatar mzngr commented on September 13, 2024

Yes that sounds like it was the issue I had, thanks for the fast response.
I've read #37 where you say:

All that is required for this mapping to work is that each vJoy device is slightly different from each other based on the number of axes, buttons and hats available on the vJoy device. As such having three devices with 100, 101, and 102 buttons is sufficient for the mapping to succeed.

I then tried adding a couple of vJoy device instances with different combinations of buttons/axes but the Gremlin wouldn't still start correctly. So this is also planned but not implemented yet?

from joystickgremlin.

WhiteMagic avatar WhiteMagic commented on September 13, 2024

Hmm that is odd, the issue I quoted is for me to improve the error reporting to the user as at the moment it should show a warning to the effect of: "Indistinguishable vJoy devices present" though it doesn't even do that as the UI isn't fully initialized at the point of the error.

Can you check what the error log says you can find that one under %userprofile%\Joystick Gremlin\system.log it should contain something like:
Traceback (most recent call last): File "joystick_gremlin.py", line 1083, in <module> File "gremlin\util.py", line 226, in joystick_devices gremlin.error.GremlinError: 'Indistinguishable vJoy devices present'
at the end which would indicate that somehow it was unable to distinguish the vjoy devices. I've quickly played with different button counts and it was fine with that but maybe there is a combination that it doesn't handle properly. I'll look at the code again and see if I find something obvious there.

from joystickgremlin.

mzngr avatar mzngr commented on September 13, 2024

Same err log message

2017-01-11 10:57:43      ERROR Uncaught exception:

Traceback (most recent call last):
   File "joystick_gremlin.py", line 1083, in <module>
   File "gremlin\util.py", line 250, in joystick_devices
 gremlin.error.GremlinError: 'Unable to match vJoy device to windows device data'

and these where the 2 instance of vJoy i created (with relative reg keys config)

vjoy1

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vjoy\Parameters\Device01]
"HidReportDesctiptor"=hex:05,01,15,00,09,04,a1,01,05,01,85,01,09,01,15,00,26,\
  ff,7f,75,20,95,01,a1,00,81,01,81,01,81,01,09,33,81,02,09,34,81,02,09,35,81,\
  02,81,01,81,01,c0,15,00,25,03,35,00,46,0e,01,65,14,75,04,95,01,09,39,81,02,\
  95,1f,81,01,05,09,15,00,25,01,55,00,65,00,19,01,29,08,75,01,95,08,81,02,75,\
  78,95,01,81,01,c0
"HidReportDesctiptorSize"=dword:00000062

vjoy2

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vjoy\Parameters\Device02]
"HidReportDesctiptor"=hex:05,01,15,00,09,04,a1,01,05,01,85,02,09,01,15,00,26,\
  ff,7f,75,20,95,01,a1,00,09,30,81,02,09,31,81,02,09,32,81,02,81,01,81,01,81,\
  01,81,01,81,01,c0,15,00,25,03,35,00,46,0e,01,65,14,75,04,95,01,09,39,81,02,\
  95,1f,81,01,05,09,15,00,25,01,55,00,65,00,19,01,29,06,75,01,95,06,81,02,75,\
  7a,95,01,81,01,c0
"HidReportDesctiptorSize"=dword:00000062

I also updated vJoy to last version before making a new test to make sure we were using the same version (and by chance stumbled on a very fresh new version, 2.18b33), disabled any other device proprietary control apps (logitech, thrustmaster, tobii and relative services) to eliminates possible variables but results are the same.

Thanks for your work!

from joystickgremlin.

WhiteMagic avatar WhiteMagic commented on September 13, 2024

Thanks for the screenshots they actually allowed me to figure out what's going wrong in your configuration. You have set the hats to "4 Directions" rather then "Continuous". For Gremlin to work hats have to be set to "Continuous" as "4 Directions" really are only the four directions and not the diagonal ones.

When I reproduced your setup with "4 Directions" Gremlin failed to start but changing over to "Continuous" allowed it to start. This is one of the things I mention somewhere in the documentation but it is easy to check from within Gremlin if this is set correctly so I should add that to the "check if everything has been configured properly" part and show a proper helpful error message.

from joystickgremlin.

mzngr avatar mzngr commented on September 13, 2024

Yes it works, thank you. Also found out where you mention it in the documentation, my bad.

By the way, there might be another restriction, I've seen it wouldn't also start if any vJoy instance is devoid of X and Y axes, like as some implicit minimum requirements. See if you can reproduce this or is just a glitch on my end, anyway issue solved for what it matters.

Thank you again!

from joystickgremlin.

WhiteMagic avatar WhiteMagic commented on September 13, 2024

Gremlin will now, implemented in a0bcb4a

  • display the name of the virtual axis, using Windows' joy.cpl terminology
  • properly handle non continuous axis selections

It should also be better at informing users when the hat setup is wrong, or what the "Unable to match vJoy device to windows device data" and related errors mean.

from joystickgremlin.

taichi154 avatar taichi154 commented on September 13, 2024

I have the same error, but I see the vJoy is set as HAT as "0" "Continuous".

Inside the xml, I found 8 buttons . .

Can you give me an example for code written in Python in which I can Handle a Hat ?

Thanks

[email protected]

from joystickgremlin.

WhiteMagic avatar WhiteMagic commented on September 13, 2024

You shouldn't be getting an error when the vJoy device is configured to have 0 hats. It should only complain when a device is using the 4 directions setting with 1 or more hats. The other bit that can cause an issue is if two or more vJoy devices have the same number of axes, buttons, and hats.

If you want to use a physical hat to map to virtual joystick buttons you shouldn't need code anymore as the latest version of Gremlin (R8) can now do this via the UI directly. A somewhat outdated version of what Gremlin generates for this can be found here https://github.com/WhiteMagic/JoystickGremlinModules/blob/48b2b8ef44296f80edc4185161252cc3ee4ead5b/hats2buttons.py If you want to use python code to handle hat remappings I can write up a more current version of this script that makes use of the things added to Gremlin to support hat to button mappings in a nicer way.

from joystickgremlin.

taichi154 avatar taichi154 commented on September 13, 2024

from joystickgremlin.

WhiteMagic avatar WhiteMagic commented on September 13, 2024

Here is a simple example of using hats as button with R8, though if you use a complex action it might be a bit trickier then the example. https://github.com/WhiteMagic/JoystickGremlinModules/blob/master/hat_buttons.py

The crash caused by AltGr is due to that key causing two events being emitted which I didn't realize as my keyboard has the standard US layout which doesn't have an AltGr key. I've fixed the issue in the current development branch of Gremlin together with a few other things and I'm probably going to test the changes I've made since R8 to release a bugfix version which should fix the keyboard issues as well as a few other things.

It seems that github removed the code attachment, maybe it dislikes zip files?

from joystickgremlin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.