Oricutron key mapping - is it possible?
-
The Oric/Atmos emulator Oricutron runs games really well, but because it's not libretro it doesn't have standard Retroarch control mapping and you have to play most games with a keyboard.
If you hit F1 to bring up the menus there's an option called Key Mapping, but if you enable it all it does is bring up a virtual keyboard in the bottom half of the screen that doesn't seem to do anything.
I suspect in the original release you clicked on the keys with the mouse to map them, but even though I do have a mouse pointer that I can move around, it has no effect on the menus.
Is there any way to map keys to the joystick? Apparently there are .KMA files which contain the keymaps but I don't have the slightest idea where they're stored in order to look at the test one and figure out how to make new ones.
-
So I eventually managed to find the emulator (opt>retropie>emulators, duh), but now I can't mess around with the configs because it's all write protected. Can anyone tell me how to once and for all just set permissions in a folder so I can edit it from WinSCP, without having to go into a command shell and dick around with "sudo blah/de/blah/something.something/x" all the time? Because I know ZERO about Linux but I know how to edit a text file and I would quite like my Pi to sod off and stop interfering.
-
eg I did some Googling and tried
chmod -R 755 oricutron
from a shell window in the emulators directory, but just got this:
And if I put "sudo" in front of it it just sits there and does nothing.
-
@JimmyFromTheBay I don't think you should be messing with permissions in the
/opt
folder. -
@sleve_mcdichael said in Oricutron key mapping - is it possible?:
@JimmyFromTheBay I don't think you should be messing with permissions in the
/opt
folder.Except that I need to do this:
"for functions not possible with the pi user"
-
@JimmyFromTheBay said in Oricutron key mapping - is it possible?:
Except that I need to do this:
"for functions not possible with the pi user"
so you need to log in as root (or, yes, use
sudo <something>
from the console as pi) , not change the permissions in your install folder, I think.But anyway, you're trying to map the keyboard keys onto a gamepad, right? If you can't make it work with the emulator's own method, you can almost certainly do it with xboxdrv: https://retropie.org.uk/docs/Universal-Controller-Calibration-%26-Mapping-Using-xboxdrv/
You can map any combination of mouse/keyboard/gamepad inputs onto a single gamepad device. Let me know if you need a hand, as I've already been through it a couple of times.
-
@JimmyFromTheBay I've just installed this emulator for a quick look. I'm not having much luck with the in-game mapping. It does look like you can click on a key and redefine that key to another key, but it doesn't seem to actually work. I'm playing the included demo game
Pulsoids.dsk
and I keep "remapping" the ctrl button onto space or shift or other keys and it keeps saying "key mapping done," but the original ctrl key still starts the game and the new remapped space or shift keys, still do not.Also not sure how you're meant to save this, even if it did work. I can navigate around and select existing files within the install folder, I can enter a subfolder and return, but cannot exit to the [parent]
emulators
folder; I cannot seem to enter a new filename, and of course when I select an existing file within this folder (even a blank file placed specially for this purpose), it is unable to save due to permissions.--- ninja edit: keyboard remapping does sort of work -- just the on-screen image is not mapped properly to where you click on it. I realized I could not click anything right of around the G key or so, as if the whole clickable area were squashed onto the left half. When I clicked on empty space slightly to the left of ctrl key, it still asked me to "press the key you want to use." So I pressed space and lo! space now starts the game! (And ctrl still does too? So it's an "additional," not an "instead-of" mapping.)
If I create a blank file in the install folder and
sudo chown pi:pi
the file to change ownership to the regular user, then I can save a remap to this file; you would have to do this once for each game (or each keyboard layout, at least) that you wanted to remap, and it still doesn't seem to work with gamepads, so I'm not sure what use this is. But it does work. If you can guess where to click. -
@sleve_mcdichael Yep, I discovered the "chown" command and it worked, except then I updated the emulator and it didn't work any more on the new ORICUTRON.CFG file, which was annoying.
But as you say, Oricutron simply doesn't seem to have any meaningful joypad support so it's all a bit moot anyway. I wish I could figure out why so many games are loading, starting and then immediately crashing in MESS. Sadly neither the Retroarch menu nor the Tab menu offer much to experiment with.
xboxdrv may as well be written in Aramaic, dipped in petrol and set on fire for all the sense I've ever been able to make of it, which is a shame as it looks like the solution to a lot of problems. But people who can code and people who can write comprehensible instructions have never in all of human history been the same people.
(I'm sure this makes perfect sense to other code nerds and explains how it's all technically functioning excellently, but a normal human being who just wants to play a game runs away sobbing and screaming "What in the name of Allah are a 'userspace library' and an 'event device' and a 'daemon'? What the bejeesus do I actually DO?"
And if instead they alight on this, they're probably fashioning their belt and/or shoelaces into an improvised noose and looking for a handy ceiling beam.)
-
Solved all my permissions problems now, but even making key remap files in the Windows version of Oriculator and copying them over to the Pi just doesn't seem to be doing anything. I can load the files and the emulator flashes up a little message about reading key mappings, but then my newly-mapped keys simply don't work.
-
xboxdrv may as well be written in Aramaic, dipped in petrol and set on fire for all the sense I've ever been able to make of it,
It can be a lot to process. How far in before you got lost?
What the bejeesus do I actually DO?"
Before anything else, make sure the xboxdrv package is installed and DIS-abled (we don't want a default configuration interfering with the custom one we're about to set up):
RetroPie-Setup > manage packages > driver packages > xboxdrv (install) > configuration/options (disable)
Then first you need to find the gamepad device's event number, as reported by:
cat /proc/bus/input/devices
Look for an entry that represents your device. Scan for the line marked
H: Handlers=
, and make note of the event number. Example:pi@retropie:~ $ cat /proc/bus/input/devices I: Bus=0003 Vendor=046d Product=c21f Version=0305 N: Name="Logitech Gamepad F710" P: Phys=usb-0000:01:00.0-1.2.2/input0 S: Sysfs=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/input/input73 U: Uniq= H: Handlers=event0 js0 B: PROP=0 B: EV=20000b B: KEY=7cdb0000 0 0 0 0 0 0 0 0 0 B: ABS=3003f B: FF=1 7030000 0 0 I: Bus=0003 Vendor=046d Product=c315 Version=0110 N: Name="Logitech Logitech USB Keyboard" P: Phys=usb-0000:01:00.0-1.2.4/input0 S: Sysfs=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2.4/1-1.2.4:1.0/0003:046D:C315.0030/input/input74 U: Uniq= H: Handlers=sysrq kbd leds event1 B: PROP=0 B: EV=120013 B: KEY=10000 7 ff800000 7ff febeffdf ffefffff ffffffff fffffffe B: MSC=10 B: LED=1f
Here, I have two devices connected: the Gamepad and a Keyboard. The gamepad is identified by
N: Name="Logitech Gamepad F710"
, and the Handlers line for that entry reads:H: Handlers=event0 js0
Make note of the event number here,
event0
.Next, optional, we can also make note of the device's event location by name, as reported by
ls /dev/input/by-id/
Look for one that represents your device. If there are more than one, choose the one that says "event". For example:
pi@retropie:~ $ ls /dev/input/by-id/ usb-Logitech_Logitech_USB_Keyboard-event-kbd usb-Logitech_Wireless_Gamepad_F710_AC0899B0-event-joystick usb-Logitech_Wireless_Gamepad_F710_AC0899B0-joystick
There are two entries representing my Logitech Wireless Gamepad, but only one of them says "event" so that's the one I use:
usb-Logitech_Wireless_Gamepad_F710_AC0899B0-event-joystick
You'll use this later. Or if you don't see your device listed, you can just use the event number at that time, instead.
Next, using the event number
event0
discovered earlier, we will useevtest
to map the system events to your physical inputs with:evtest /dev/input/event0
pi@retropie:~ $ evtest /dev/input/event0 Input driver version is 1.0.1 Input device ID: bus 0x3 vendor 0x46d product 0xc21f version 0x305 Input device name: "Logitech Gamepad F710" Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 304 (BTN_SOUTH) Event code 305 (BTN_EAST) Event code 307 (BTN_NORTH) Event code 308 (BTN_WEST) Event code 310 (BTN_TL) Event code 311 (BTN_TR) Event code 314 (BTN_SELECT) Event code 315 (BTN_START) Event code 316 (BTN_MODE) Event code 317 (BTN_THUMBL) Event code 318 (BTN_THUMBR) Event type 3 (EV_ABS) Event code 0 (ABS_X) Value 128 Min -32768 Max 32767 Flat 128 Event code 1 (ABS_Y) Value -129 Min -32768 Max 32767 Flat 128 Event code 2 (ABS_Z) Value 0 Min 0 Max 255 Event code 3 (ABS_RX) Value -643 Min -32768 Max 32767 Fuzz 16 Flat 128 Event code 4 (ABS_RY) Value -129 Min -32768 Max 32767 Fuzz 16 Flat 128 Event code 5 (ABS_RZ) Value 0 Min 0 Max 255 Event code 16 (ABS_HAT0X) Value 0 Min -1 Max 1 Event code 17 (ABS_HAT0Y) Value 0 Min -1 Max 1 Event type 21 (EV_FF) Event code 80 (FF_RUMBLE) Event code 81 (FF_PERIODIC) Event code 88 (FF_SQUARE) Event code 89 (FF_TRIANGLE) Event code 90 (FF_SINE) Event code 96 (FF_GAIN) Properties: Testing ... (interrupt to exit)
In event types 1 and 2, in the various lines marked "Event code", note the values in parentheses such as
BTN_NORTH
,ABS_RY
andABS_HAT0X
. These are all the different input events supported by the device.BTN_
are digital buttons andABS_
are analog axes. As you press some of the inputs on your device, you'll see output like:Event: time 1692403897.376744, type 1 (EV_KEY), code 305 (BTN_EAST), value 1 Event: time 1692403897.376744, -------------- SYN_REPORT ------------ Event: time 1692403897.520692, type 1 (EV_KEY), code 305 (BTN_EAST), value 0 Event: time 1692403897.520692, -------------- SYN_REPORT ------------ Event: time 1692403905.669761, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 1 Event: time 1692403905.669761, -------------- SYN_REPORT ------------ Event: time 1692403905.885787, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 0 Event: time 1692403905.885787, -------------- SYN_REPORT ------------ Event: time 1692403907.750031, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value 1 Event: time 1692403907.750031, -------------- SYN_REPORT ------------ Event: time 1692403908.006065, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value 0 Event: time 1692403908.006065, -------------- SYN_REPORT ------------ ^C
(When you are finished, use ctrl-c to interrupt.)
Next up comes the task of testing and writing down how all of these event codes map onto your device, such as:
BTN_SOUTH = "A" (remember: Xbox layout) BTN_NORTH = "Y" BTN_TR = R1 (bumper) ABS_RZ = R2 (trigger) BTN_THUMBR = R3 (thumbstick) ABS_RY (-/+) = right analog stick (up/down) ABS_HAT0X (-/+) = D-pad (left/right) BTN_MODE = Logitech / "guide" button
...and so on.
Once you've written down all your input event codes, you can start mapping them to the virtual controller.
Open a text file and paste in the following...
...for the
--evdev /dev/input/by-id/(...)
line, replace the name with the "event location by name you (optionally) discovered earlier....if you didn't choose or your device didn't have an event location by name, substitute the event number as discovered in the first step:
--evdev /dev/input/event0 \
...if you're lucky, your controller outputs all the same event codes as this one, and all the rest of these values will work as written. If not, you'll have to substitute your own values as discovered earlier with
evtest
. Put all theABS_
values in the--evdev-absmap
line, and all theBTN_
values in--evdev-keymap
.sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-id/usb-Logitech_Wireless_Gamepad_F710_AC0899B0-event-joystick \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_Z=lt,ABS_RZ=rt,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \ --evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_WEST=x,BTN_NORTH=y,BTN_TL=lb,BTN_TR=rb,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_MODE=guide,BTN_SELECT=back,BTN_START=start \ &
You can save this as a basic template. To do anything useful with it, let's remap some keys. Copy the file, and remove the
&
from the last line for now.For a simple example, let's map some keys for Pulsoids -- player control is with CTRL and cursors. Add F1 for menu and ENTER to make a selection, and you should be able to start, play, and exit the game with just the gamepad.
To do this, we'll add a line (two lines for clarity) to map these keys with
--ui-buttonmap
:--ui-buttonmap du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT \ --ui-buttonmap a=KEY_LEFTCTRL,b=KEY_ENTER,start=KEY_F1 \ &
Follow it up with the trailing
&
that you removed earlier, and save it somewhere on your system, for example:/opt/retropie/configs/all/xboxdrv/Pulsoids.xbd
(Note: filename extensions in Linux are largely irrelevant. This is technically a shell script and custom would dictate a
.sh
extension, but on my system I name them with.xbd
to hint at their function. But you could name it with.zyx
or.who_cares
or not even use an extension if you want, and it would still work just the same.)To enable the configured mapping, run the saved file with
bash
:bash /opt/retropie/configs/all/xboxdrv/Pulsoids.xbd
...to disable it, kill the
xboxdrv
process withsudo killall
:sudo killall xboxdrv
Run a test: enable the mapping (with
bash
) and then manually launch the game with Runcommand, like so:bash /opt/retropie/configs/all/xboxdrv/Pulsoids.xbd /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ oric "$HOME/RetroPie/roms/oric/Pulsoids.dsk"
If all has gone to plan, you should be able to play the game with the A (south) button and D-pad. Start should open the F1 menu, and B (east) should choose the highlighted selection.
Quit the game, and disable the mapping with
sudo killall xboxdrv
. If everything's working as described, next we can work on automating these steps before and after the game is run. If not, let me know where you get hung up. -
@sleve_mcdichael said in Oricutron key mapping - is it possible?:
It can be a lot to process. How far in before you got lost?
Look for an entry that represents your device. Scan for the line marked
H: Handlers=
, and make note of the event number. Example:pi@retropie:~ $ cat /proc/bus/input/devices I: Bus=0003 Vendor=046d Product=c21f Version=0305 N: Name="Logitech Gamepad F710" P: Phys=usb-0000:01:00.0-1.2.2/input0 S: Sysfs=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/input/input73 U: Uniq= H: Handlers=event0 js0 B: PROP=0 B: EV=20000b B: KEY=7cdb0000 0 0 0 0 0 0 0 0 0 B: ABS=3003f B: FF=1 7030000 0 0 I: Bus=0003 Vendor=046d Product=c315 Version=0110 N: Name="Logitech Logitech USB Keyboard" P: Phys=usb-0000:01:00.0-1.2.4/input0 S: Sysfs=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2.4/1-1.2.4:1.0/0003:046D:C315.0030/input/input74 U: Uniq= H: Handlers=sysrq kbd leds event1 B: PROP=0 B: EV=120013 B: KEY=10000 7 ff800000 7ff febeffdf ffefffff ffffffff fffffffe B: MSC=10 B: LED=1f
Truthfully? Here.
(But thank you very much for trying :))
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.