bayangan1991 / PYXInput

Python Library for Creating and Analysing XInput devices
https://pypi.python.org/pypi/PYXInput
MIT License
87 stars 22 forks source link

Test Virtual Controller - Cannot PlugIn the virtual controller #7

Closed GoelBiju closed 6 years ago

GoelBiju commented 6 years ago

I am trying to use the pyxinput library to emulate the input from a Xbox 360 controller, however when I import pyxinput and run pyxinput.test_virtual() I am faced with the following error:

Testings multiple connections
Traceback (most recent call last):
Connecting Controller:
  File "C:/Users/Goel/Desktop/Individual Learning/xinput-python/test.py", line 3, in <module>
    pyxinput.test_virtual()
  File "C:\Users\Goel\Desktop\Individual Learning\xinput-python\venv\lib\site-packages\pyxinput\virtual_controller.py", line 142, in main
    cons.append(vController())
  File "C:\Users\Goel\Desktop\Individual Learning\xinput-python\venv\lib\site-packages\pyxinput\virtual_controller.py", line 45, in __init__
    self.PlugIn()
  File "C:\Users\Goel\Desktop\Individual Learning\xinput-python\venv\lib\site-packages\pyxinput\virtual_controller.py", line 60, in PlugIn
    ids = self.available_ids()
  File "C:\Users\Goel\Desktop\Individual Learning\xinput-python\venv\lib\site-packages\pyxinput\virtual_controller.py", line 54, in available_ids
    1, 5) if _xinput.isControllerExists(c_int(x)) == 0]
  File "C:\Users\Goel\Desktop\Individual Learning\xinput-python\venv\lib\site-packages\pyxinput\virtual_controller.py", line 54, in <listcomp>
    1, 5) if _xinput.isControllerExists(c_int(x)) == 0]
ValueError: Procedure probably called with too many arguments (4 bytes in excess)
Exception ignored in: <function vController.__del__ at 0x02C564B0>
Traceback (most recent call last):
  File "C:\Users\Goel\Desktop\Individual Learning\xinput-python\venv\lib\site-packages\pyxinput\virtual_controller.py", line 49, in __del__
    self.UnPlug()
  File "C:\Users\Goel\Desktop\Individual Learning\xinput-python\venv\lib\site-packages\pyxinput\virtual_controller.py", line 75, in UnPlug
    _xinput.UnPlug(c_uint(self.id))
ValueError: Procedure probably called with too many arguments (4 bytes in excess)

I am running this in Python 3.7.0 which the pyxinput module installed from pypi.

When running test_read() everything is fine and it gets the values from the controller, it would be great if I could get the virtual controller to work.

GoelBiju commented 6 years ago

I ran the virtual controller and it is detected successfully with Python 3.6.1 64-bit.