Joy2Key.py?
-
Howdy Folks
I have been playing with the code for my upcoming TinyPi Project, and someone pointed out an oddity.
After much playing with uinput, i managed to get the gpio connected buttons of the TinyPi board seen to the system as a controller. I thought that this would be the best option, thinking that a controller would be the best direction for the gaming system.
A little bit more testing later, and when you crank up a game, up pops joy2Key.py
so im assuming that this is actually processing the joystick commands, and then converting them into keyboard commands?
Would I actually be better off just creating keyboard events rather than joystick events, or would this code still end up running?
I obviously want to keep things as streamlined as possible, so another program being there pretty much duplicating what I am doing seems weird to me!!
Thanks
Pete :)
-
so im assuming that this is actually processing the joystick commands, and then converting them into keyboard commands?
Correct.
Would I actually be better off just creating keyboard events rather than joystick events, or would this code still end up running?
It would indeed. However,
joy2key.py
is only active during the time that the Runcommand window is active. Once the Runcommand menu exits,joy2key.py
exits as well. For my xboxdrv mappings, I have it scripted to wait forjoy2key.py
to launch, loop until it exits and launch xboxdrv afterwards. This has worked out pretty well for me and allows use of the Runcommand window without another key-mapping program (xboxdrv) interfering. -
@mediamogul @moosepr
Just to make some deeper questions....
Why is joy2key active since an emulator core (retroarch) is running?
This shouldn't be the case.
Do you have some dialogs in background open? -
Thanks for the replies guys.
I was actually seeing it ruining all the time I was playing a game (GBA to be precise). I'm assuming that runcommand is still active because it triggers the emulator, so won't close until the emulator does 🤔
The constant read/write nature of the program does suggest that it has to be running all the time the game is ruining, otherwise the mapping would no longer work
Pete
-
@moosepr said in Joy2Key.py?:
I'm assuming that runcommand is still active because it triggers the emulator, so won't close until the emulator does
The runcommand script should remain active throughout your gaming session. However,
joy2key.py
is supposed to exit alongside the Runcommand menu. Just to be completely clear, is this not the case for you? -
@mediamogul that is what happens. i always assumed runcommand was just a quick run job before the emulator starts, but it makes more sense that its actually triggering the emulator too.
are all the emulators normalised then, to use the same keys as input, or does the Joy2Key run differently for each emulator?
-
@moosepr said in Joy2Key.py?:
are all the emulators normalised then, to use the same keys as input, or does the Joy2Key run differently for each emulator?
No, as @mediamogul said,
joy2key
is not used by any emulators, just by Runcommand (and the RetroPie-Setup menu, when started from ES). -
@mitu The joy2key seems so confusing to many users. A hint in the wiki may be usefull. For what it is and what it does
@moosepr You can see the work of the joy2key in the Midnight Joy [SCRIPTLET]. This script will run MidnightCommander (a file manager for shell) and assign some keyboard keys to joy2key so you can do file actions with your controller.
Otherwise you need a SSH or keyboard connection to control this tool. -
@mitu ah i missunderstood.
So Joy2Key is not needed for the emulator, just for the runcommand menu? If this is the case, then it is sat in the background using cpu when it doesnt need to be
-
@moosepr said in Joy2Key.py?:
If this is the case, then it is sat in the background using cpu when it doesnt need to be
It's only active for the duration of the Runcommand window. After the Runcommand window exits, so does
joy2key.py
. That being the case, it's never really wasting any CPU time. -
@mediamogul but if runcommand triggers the emulator, then it is running for the duration of the emulation session. or at least that is what i saw in my experimentation
-
@moosepr Please add more info about your system - https://retropie.org.uk/forum/topic/3/read-this-first. If you stop your uinput script, does
joy2key
still remain resident ? -
@mitu I will test when i get home
The setup is a Raspberry Pi zero, running the latest Retropie. There is a tft driver (https://github.com/juj/fbcp-ili9341) my own bespoke uinput code emulating a controller and monitoring battery voltage, and running dtoverlay=hifiberry-dac and dtoverlay=i2s-mmap
-
ok so further testing. If i use adafruit retrogame, i see Joy2key appear in Top at about 20% cpu, then after a few seconds it disappears.
Using my own code, Joy2key does the same 20% ish cpu for a few seconds, then it will sit at about 4% cup for as long as im playing a game. it actually remains even when i close the emulator (start + select)
pi@retropie:~ $ udevadm info /dev/input/event0 P: /devices/virtual/input/input0/event0 N: input/event0 E: DEVNAME=/dev/input/event0 E: DEVPATH=/devices/virtual/input/input0/event0 E: ID_INPUT=1 E: ID_INPUT_JOYSTICK=1 E: ID_INPUT_KEY=1 E: ID_SERIAL=noserial E: MAJOR=13 E: MINOR=64 E: SUBSYSTEM=input E: TAGS=:seat:uaccess: E: USEC_INITIALIZED=16949167 pi@retropie:~ $ dmesg | grep -i input [ 16.015469] input: TinyPi-Pro as /devices/virtual/input/input0
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.