[Tutorial] OpenBOR - the complete guide
-
More trying to figure this out. Anybody come across this error? (it crashed ES to terminal)
emulationstation: /home/pi/RetroPie-Setup/tmp/build/emulationstation/es-core/src/InputManager.cpp:80: void InputManager::addJoystickByDeviceIndex(int): Assertion 'id >= 0 && id < SDL_NumJoysticks()' failed.
What I tried to do was use XBOXDRV and create an entry for each of my devices, but naming them all
--device-name "Keyboard (xboxdrv)"
. So I had 4 entries in my on-start script, each mapping to the same keys. My thinking was that if the--detach-kernel-driver
flag merely assigned the controls tonull
, then I should be able to just map them all to the same keys. Doesn't look like that worked though.I may have to come up with a hardware modification. Since I noticed it worked by having either the NES or the SEGA adapters unplugged, I'm going to have to create an inline switch that does the same thing. I don't want to have to keep opening up my case to get to the USB plug. I'll create some kind of pushbutton and mount it somewhere I can get to from the outside. Then just make sure I wire the switch up to the correct wires (data should be it correct?). Switch on, Raspberry Pi detects the adapter. Switch off, Raspberry Pi only sends power and ground. I have a few extra switches laying around. At least I can test it. Sucks I can't make a switch through software.
-
@hansolo77 all mv commands will fit in one line by using ;
Or by logical boolean true with && (be aware with this!)
Or stick to your if clause and writemv file1 location1
mv file2 location2Why do you use & - it just sends the processes to background and is not needed imho
-
@cyperghost said in [Tutorial] OpenBOR - the complete guide
Why do you use & - it just sends the processes to background and is not needed imho
I dunno. It's just the way it works. I built my system with the thought in mind to have ports externally available for original NES and SEGA/ATARI controllers. The only way I could make it work like that was by using XBOXDRV to map those controllers as keyboard keys. Otherwise the whole system screws up because of how it maps them automatically. Sometimes the NES controller would be player 1, while other times it was the SEGA controller. Since I only use those controllers sparingly, it was a huge headache getting it to always map my Xbox controller as my primary player 1. Using XBOXDRV solved all of that. The only problem is, those adapters are permanently connected to the Pi. So OpenBOR comes around, and it chokes trying to enumerate all the different devices. Seems like it can only work with a total of 4 (Keyboard, Xbox, 2 Sega OR Keyboard, Xbox, 2 NES). Makes sense, considering OpenBOR only has controller configs for up to 4 players. I still have the problem though, that it doesn't recognize the XBOX controller as player 1, so I have to use XBOXDRV to map it to a keyboard.
As for the quote and the use of
&
... the explanation in the RetroPie Docs does it that way, so I just followed along. -
WOOOO!!!! I figured out a working command to get the controls to not get enumerated during OpenBOR boot up! All I had to do was my original idea of moving the controller device out of
/dev/input
. I just didn't have the command right. Now I've spent some time testing the command in the terminal BEFORE trying to do it through the script, and then modified theruncommand-onstart.sh
script to make it run automatically.. and it does!if [ "$1" = "openbor" ] then sudo mv /dev/input/event0 ~/inputs/event0 && sudo mv /dev/input/event1 ~/inputs/event1 ## Commands to Launch XBOXDRV for Xbox Mapping go here ## & ## Commands to Launch XBOXDRIV for Sega Mapping go here ## & fi
This works every time. Now, in order to move the controls back, I had to add a segment to the
runcommand-onend.sh
file.sudo killall > /dev/null 2>&1 xboxdrv if [ "$1" = "openbor" ] then sudo mv ~/inputs/event0 /dev/input/event0 && sudo mv ~/inputs/event1 /dev/input/event1 fi
This is basically unloading the XBOXDRV driver. Then, if the system just exited was "OpenBOR", then it moves the devices back to their original locations. It works! I'm so happy I don't have to cut cables and solder a hard switch. :) Now to test things a few more times and make a backup before I screw something else up! :)
-
Glad to hear this worked out.
-
@hansolo77 glad you got it working. Are these the complete scripts? I think the method is solid ground for others.
And yes you are right for a device driver like xboxdrv the & is essential because it have to be active in background but for cp or mv command it is not needed.
The && method is useful
It is working like
mv devive1 to path
&& means true chain connectionSo if device 1 is not available it will stop moving the other devices that come next in the && chain. The code could be refined but the method you elaborated is really great. That's the hard work you did - the bit of scripting fingetricks is now easy to do.
-
@cyperghost said in [Tutorial] OpenBOR - the complete guide:
@hansolo77 glad you got it working. Are these the complete scripts? I think the method is solid ground for others.
Not entirely. In my particular set up, I'm using numerous entries in the
runcommand-onstart.sh
script. However, for the purpose of completeness, should somebody want to copy my working script, I can post it. The working bits of OpenBOR is all I'm including, along with the the additions of the SEGA mapping and the moving out of the NES controllers:/opt/retropie/configs/all/runcommand-onstart.sh
if [ "$1" = "openbor" ] then sudo mv /dev/input/event0 ~/inputs/event0 && sudo mv /dev/input/event1 ~/inputs/event1 sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \ --evdev /dev/input/by-id/usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E1594E70-event-joystick \ --detach-kernel-driver \ --silent \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --dpad-as-button \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_Z=lt,ABS_RZ=rt \ --evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,BTN_TL=lb,BTN_TR=rb,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_MODE=guide,BTN_SELECT=back,BTN_START=start,BTN_TRIGGER_HAPPY3=du,BTN_TRIGGER_HAPPY4=dd,BTN_TRIGGER_HAPPY1=dl,BTN_TRIGGER_HAPPY2=dr \ --ui-buttonmap x=KEY_F,a=KEY_A,b=KEY_D,lb=KEY_Z,Y=KEY_S,rb=KEY_X \ --ui-buttonmap guide=KEY_F12,start=KEY_ENTER,back=KEY_ESC \ --ui-buttonmap du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT \ & sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \ --evdev /dev/input/by-id/usb-Mayflash_Ltd_Mayflash_MD_USB_Adapter-event-joystick \ --detach-kernel-driver \ --mimic-xpad \ --evdev-absmap ABS_HAT0X=x1,ABS_HAT0Y=y1 \ --evdev-keymap BTN_TR=back,BTN_TR2=start \ --evdev-keymap BTN_SOUTH=x,BTN_EAST=a,BTN_C=b \ --evdev-keymap BTN_NORTH=lb,BTN_WEST=y,BTN_TL=rb \ --dpad-as-button \ --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP \ --ui-buttonmap y=KEY_S,b=KEY_D,a=KEY_A,lb=KEY_Z,x=KEY_F,rb=KEY_X,start=KEY_ENTER,back=KEY_ESC \ & sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \ --evdev /dev/input/by-id/usb-Mayflash_Ltd_Mayflash_MD_USB_Adapter-if01-event-joystick \ --detach-kernel-driver \ --mimic-xpad \ --evdev-absmap ABS_HAT0X=x1,ABS_HAT0Y=y1 \ --evdev-keymap BTN_TR=back,BTN_TR2=start \ --evdev-keymap BTN_SOUTH=x,BTN_EAST=a,BTN_C=b \ --evdev-keymap BTN_NORTH=lb,BTN_WEST=y,BTN_TL=rb \ --dpad-as-button \ --ui-axismap x1=KEY_G:KEY_H,y1=KEY_J:KEY_I \ --ui-buttonmap x=KEY_N,a=KEY_K,b=KEY_M,lb=KEY_P,y=KEY_O,rb=KEY_Q \ --ui-buttonmap start=KEY_KP9,back=KEY_KP0 \ & fi
Provided you have XBOXDRV installed, this will create a mapping of an Xbox 360 controller as well as a Mayflash Sega Genesis Adapter (2 Players / 6-button) to keyboard keys. These keys are the default keyboard mapping inside OpenBOR, so it removes the necessary requirements of create a "master" keymap, and the need to have one for new games. This script will also move out the NES Controllers (provided by the Raphnet NES adapter) to a temporary location so OpenBOR doesn't detect it and cause the game engine to crash.
/opt/retropie/configs/all/runcommand-onend.sh
sudo killall > /dev/null 2>&1 xboxdrv if [ "$1" = "openbor" ] then sudo mv ~/inputs/event0 /dev/input/event0 && sudo mv ~/inputs/event1 /dev/input/event1 fi
This script will unload the XBOXDRV driver, making your controllers work like regular controllers again without being mapped to keyboard keys. If the game system that was just running was OpenBOR, it also returns the Raphnet NES controller devices back to their original locations to be available to the system again.
EDIT Sorry, when I first ran through this, I had the script mapping the NES controllers, not the SEGA ones. So the script was not helpful. After switching it over to the SEGA ones, I discovered my maps were all wrong. Then the engine kept crashing. I fixed it all now. The current script works. If you don't have NES or SEGA controllers, you don't need to include those parts, and you don't need to include the added
if
segment to theruncommand-onend.sh
script either. Also, mappings for Player 2 don't exist for keyboard. So you have to map them in-game first. I have it mapped for the Sega Controllers right now, but just because I don't have a 2nd XBOX controller to test with. -
Thanks for the guide! I spent hours trying to figure this out on my own and was finally able to get things working after following this guide!
One question though, I have the ES background music script running and for some reason it doesn't turn off when I run OpenBOR games. I've opened up the script and looked in line 25 for the list of emulators that are supposed to pause the script and "openbor" is listed there. I started up a game, went into SSH, typed "top" and saw that the emulator name was "OpenBOR" and figured that maybe I needed to add in a variant of openbor with that casing but that didn't work either. Not really sure what else to try. Any ideas?
-
@AtTheArcade said in [Tutorial] OpenBOR - the complete guide:
Thanks for the guide! I spent hours trying to figure this out on my own and was finally able to get things working after following this guide!
One question though, I have the ES background music script running and for some reason it doesn't turn off when I run OpenBOR games. I've opened up the script and looked in line 25 for the list of emulators that are supposed to pause the script and "openbor" is listed there. I started up a game, went into SSH, typed "top" and saw that the emulator name was "OpenBOR" and figured that maybe I needed to add in a variant of openbor with that casing but that didn't work either. Not really sure what else to try. Any ideas?
Turns out I just needed to restart ES after I updated the script. It's always something simple with me...
-
@AtTheArcade Glad you got it sorted out using one of the most forgotten, yet one of the most successful troubleshooting steps! Enjoy!
-
I'm getting very confused, so what I do is on emulationstation I press F4 and then type this?
wget "http://raw.githubusercontent.com/crcerror/RetroPie-OpenBOR-scripts/master/OpenBOR - Beats of Rage Engine Selection.sh" -O "/home/pi/RetroPie/roms/ports/OpenBOR - Beats of Rage Engine Selection.sh"
I tried it, but nothing happens. What did I do wrong? is this the correct way, or the easiest best way to do it?
Sorry for the dumb question but I'm abit confused as to how to get this working.If someone out there could make a complete video tutorial step by step it would be so much easier, it really would...
Please can someone make a video how to set this up?As I think what is holding people back (like me who are not experts in using our pi's) from trying this emulator is the install method. how to get it installed.
-
Can anyone assist me. I'm trying to open a Double Dragon Revenge modded game that works on my pc, I'm having trouble on my RPi 3B+. I load OpenBor via experimental packages. I add the .pak to the operbor folder. i run the extract.sh command. Everything seems to go ok, but when the lauch window comes up with the game, i get a quick "Loading" then exits right to the "PORTS" RPi menu screen. No idea where i went wrong.
THanks for any help. -
@therexershow Please follow topic OpenBOR - OpenBeta
-
@cyperghost , your work is amazing! Thank you so much for that.
A strange issue always happening: every time I press "left stick" / "d-pad left" on a controller (tried using the Xbox wired controller and mk_arcade_joystic) when I am inside a game, the game quits suddenly (abnormal end) and trows me back to ES MENU. This happens anytime in the game (even when I'm trying to configure the controller).
So, I am unable to use or configure joysticks (unless I don't tap the left - what is very annoying).
Any clue of what is causing that issue ?
P.s: I'm using the latest version of RetroPie (4.6 buster image) installed on a 3b+.
Thanks in advance!
-
@fredcobain Yes I think I faced the same problem somewhere ... But I can't remember what it was :(
-
@cyperghost my hope now is in you again, please scan your memories hahaha
I'm to close to achieve my goal to play OpenBor using my Arcade Joysticks!
Is there anything I must upload to help you to remember what could be the root cause of that issue?
Thank you so much for your attention
-
@cyperghost said in [Tutorial] OpenBOR - the complete guide:
@spud11 Well as long as there is a
runcommand.sh
call also in Attract mode then it will work, too. But the reboot and restart things won't .... these are specfic to ES.@BiZzAr721 So you see a running
joy2key
session really running if the emulator already started? It is supposed to get finished after all dialog actions are done. So after the grey box is gone away this process should be terminated by runcommand itself. That's the case in my setups and I think that's the usual way.You can try to get PID of joy2key process by typing
ps -a
you see maybe the number 1234 and then withkill 1234
you can terminate this process. After this you can try if OpenBOR still finishes by pressing left DPAD key.Jesus!!! I found it!
I really killed the joy2key.py in a putty terminal after the game loads and the issue is gone!
Should we add a kill command into the Engine Selection Script ?
-
@fredcobain Oh good research ;)
Engine Selection Script...?
I don't know what you are talking about.... Usually the joy2key.py should be killed after the grey box vanishes and I think it's fixed in latest versions.
I think you can set a command
pkill joy2key.py
inruncommand-onstart.sh
. I surly wrote a small hack down the thread you've found. -
@cyperghost by the "Engine Selection Script" I am referring to: http://raw.githubusercontent.com/crcerror/RetroPie-OpenBOR-scripts/master/OpenBOR - Beats of Rage Engine Selection.sh"
It is the script I am using to navigate through the extracted pak files. Does this script is outdated? Do you have a newer version of that?
My solution: I just inserted a "killall joy2key.py" at the very beginning and another one at the end of that script and everything is running perfect now. (sorry about the lack of elegance in my code hahaha)
Are you still maintaining that repo ?
Thanks again.
-
@fredcobain said in [Tutorial] OpenBOR - the complete guide:
It is the script I am using to navigate through the extracted pak files. Does this script is outdated? Do you have a newer version of that?
No - up to date version
My solution: I just inserted a "killall joy2key.py" at the very beginning and another one at the end of that script and everything is running perfect now. (sorry about the lack of elegance in my code hahaha)
Nice one ;)
Are you still maintaining that repo ?
No not this one... the OpenBOR version you are using is really outdated.
We can meanwhile use OpenBOR 6xxx - and then you do not need to unpack the paks ;)
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.