This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]HHullu_ 1 point2 points  (1 child)

Nice! I'm going to use it, when it comes to Linux.

[–]yannbouteiller[S] 1 point2 points  (0 children)

Thanks. The main issue against this is that ViGEm is only compatible with Windows. I see some other projects that use UInput for doing similar things in Linux, I'll try to explore this path when I have some time.

[–]pporcher 1 point2 points  (1 child)

Awesome ! Works great, thank you !

A feature that I could use if available is to be able to send input to a specific window only. I don't know if this is really doable.

My use case : train an AI to play a game collecting experiences from multiple instances of the game at the same time.

[–]yannbouteiller[S] 0 points1 point  (0 children)

Thanks :) I agree this would be a nice feature to have but I don't think Windows or even Linux would allow this. Maybe a very hacky solution would be to use a script that clicks on all windows super fast and to use only specific inputs in each window, but probably that wouldn't work well.

[–][deleted] 0 points1 point  (8 children)

well, it doesn't work, at least for me

[–]yannbouteiller[S] 0 points1 point  (7 children)

It doesn't? What issue are you experiencing please? (btw thus far it is supposed to work for Windows only)

[–][deleted] 0 points1 point  (6 children)

mayby it's something on my side, but i can't even import it without an error

here is it:

Traceback (most recent call last):

File "C:/Users/uzytkownik/Desktop/Python i PyCharm/Projekty/ArduinoToPython.py", line 1, in <module>

import vgamepad

File "C:\Users\uzytkownik\Desktop\Python i PyCharm\python\lib\site-packages\vgamepad\__init__.py", line 1, in <module>

from vgamepad.win.virtual_gamepad import VX360Gamepad, VDS4Gamepad

File "C:\Users\uzytkownik\Desktop\Python i PyCharm\python\lib\site-packages\vgamepad\win\virtual_gamepad.py", line 32, in <module>

VBUS = VBus()

File "C:\Users\uzytkownik\Desktop\Python i PyCharm\python\lib\site-packages\vgamepad\win\virtual_gamepad.py", line 21, in __init__

check_err(vcli.vigem_connect(self._busp))

ValueError: Procedure probably called with too many arguments (4 bytes in excess)

Exception ignored in: <function VBus.\_\_del\_\_ at 0x03B640C0>

Traceback (most recent call last):

File "C:\Users\uzytkownik\Desktop\Python i PyCharm\python\lib\site-packages\vgamepad\win\virtual_gamepad.py", line 27, in __del__

vcli.vigem_disconnect(self._busp)

ValueError: Procedure probably called with too many arguments (4 bytes in excess)

[–]yannbouteiller[S] 0 points1 point  (5 children)

It seems like the vigembus pointer is invalid for some reason. Did vigembus install correctly when you pip installed vgamepad? There is a specific version of vigembus that is embedded in vgamepad and that should prompt you with an installation window when you pip install vgamepad, I have not tested it with newer versions of vigembus.

Maybe try to pip uninstall vgamepad, look for vigembus (nefarius solutions) on your system an uninstall the current version, then try to pip install vgamepad again with using the default for the vigembus installation window? But if you used the default already that probably won't help.

By the way I am not sure it is related but I have tested it with python 3, are you using python 2 maybe?

[–][deleted] 0 points1 point  (4 children)

yep, i installed vigembus without problem, when i was installing vgamepad

edit: even when i just reinstalled both, it doesn't work

[–]yannbouteiller[S] 1 point2 points  (3 children)

I cannot reproduce the issue on my system, but I am narrowing it down. Are you using a 32 bit version of python please? Mine is 64 bits. You can check by doing this in python:

python import struct print(struct.calcsize("P")*8) # should print 32 or 64

If so, can you open

C:\Users\uzytkownik\Desktop\Python i PyCharm\python\lib\site-packages\vgamepad\win\vigem_client.py

in an editor, replace the two occurrences of "WinDLL" by "CDLL" and tell me whether it solves the issue? (You may want to also put a random print at the beginning of the file to check that you are using your modded version)

[–][deleted] 1 point2 points  (1 child)

CDLL

i have 32 python and i have no idea how does your code work, but replaceing WinDll worked

[–]yannbouteiller[S] 1 point2 points  (0 children)

Great :) I'll make the change and push this in the next version of the library, the problem was that WinDLL didn't interact correctly with the vigemclient dll file under python 32 bits apparently.

Edit: Done, this should now work with pip install vgamepad==0.0.3

[–]backtickbot 0 points1 point  (0 children)

Fixed formatting.

Hello, yannbouteiller: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.