Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. Thank you for your support. Tom Speirs

Patreon

NEStalgia Project (Mini NESpi)


RIP-Felix

Recommended Posts

You can get around all the ID crap by pulling a different device method.  You don't have to use "/dev/input/event#".  I was having a similar problem during my mapping adventures.  I ran into a snag because the "/dev/input/event#" solution I was originally using would go askew depending on if the Xbox360 Wireless controller was powered on or not.  They way I had it, the NES controllers were "event8" and "event9", but if the Xbox controller was off, they changed to "event4" and "event5".  The Xbox dongle was assigning as "event0-3" if it was on, and nothing if it was off.  I tried to get around it by plugging the dongle into a hub, and the NES and SEGA adapters into the Pi directly (as they are enumerated in order Top Left, Bottom Left, Top Right, Bottom RIght, aka 0-3).  That worked some of the time.  But then I started having the Xbox dongle connect at port 8 some times, and then as port 0 others.  I ultimately decided to change to "/dev/input/by-id" for some of the controllers, and "/dev/input/event#" for others.  Once you have everything the way you like it, it's easy to make an SD card backup.

For example purposes, here's what my current "onstart" script looks like:

Spoiler

if [ "$1" = "nes" ]
then
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \
    --evdev /dev/input/event0 \
    --detach-kernel-driver \
    --device-name "NES Pad Player 1 (xboxdrv)" \
    --evdev-absmap ABS_X=x1,ABS_Y=y1 \
    --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=back,BTN_TOP=start \
    --dpad-only \
    --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP \
    --ui-buttonmap start=KEY_T,back=KEY_E,b=KEY_B,a=KEY_A \
&
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \
    --evdev /dev/input/event1 \
    --detach-kernel-driver \
    --device-name "NES Pad Player 2 (xboxdrv)" \
    --evdev-absmap ABS_X=x1,ABS_Y=y1 \
    --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=back,BTN_TOP=start \
    --dpad-only \
    --ui-axismap x1=KEY_G:KEY_H,y1=KEY_J:KEY_I \
    --ui-buttonmap start=KEY_KP0,back=KEY_KP9,b=KEY_M,a=KEY_K \
&
fi

if [ "$1" = "genesis" ] || [ "$1" = "megadrive" ] || [ "$1" = "sega32x" ] || [ "$1" = "segacd" ]
then
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 \
    --device-name "ATARI_SEGA Player 1 (xboxdrv)" \
    --evdev-absmap ABS_HAT0X=x1,ABS_HAT0Y=y1 \
    --evdev-keymap BTN_TR=back,BTN_TR2=start \
    --evdev-keymap BTN_SOUTH=y,BTN_EAST=b,BTN_C=a \
    --evdev-keymap BTN_NORTH=lb,BTN_WEST=x,BTN_TL=rb \
    --dpad-only \
    --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP \
    --ui-buttonmap y=KEY_Y,b=KEY_B,a=KEY_A,lb=KEY_L,x=KEY_X,rb=KEY_R,start=KEY_T,back=KEY_E \
&
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 \
    --device-name "ATARI_SEGA Player 2 (xboxdrv)" \
    --evdev-absmap ABS_HAT0X=x1,ABS_HAT0Y=y1 \
    --evdev-keymap BTN_TR=back,BTN_TR2=start \
    --evdev-keymap BTN_SOUTH=y,BTN_EAST=b,BTN_C=a \
    --evdev-keymap BTN_NORTH=lb,BTN_WEST=x,BTN_TL=rb \
    --dpad-only \
    --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

if [ "$1" = "sorr" ]
then
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_X,a=KEY_C,b=KEY_V,lb=KEY_A,Y=KEY_S,rb=KEY_D \
    --ui-buttonmap guide=KEY_B,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 \
    --device-name "ATARI_SEGA Player 1 (xboxdrv)" \
    --evdev-absmap ABS_HAT0X=x1,ABS_HAT0Y=y1 \
    --evdev-keymap BTN_TR=back,BTN_TR2=start \
    --evdev-keymap BTN_SOUTH=y,BTN_EAST=b,BTN_C=a \
    --evdev-keymap BTN_NORTH=lb,BTN_WEST=x,BTN_TL=rb \
    --dpad-only \
    --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP \
    --ui-buttonmap y=KEY_X,b=KEY_C,a=KEY_V \
    --ui-buttonmap lb=KEY_A,x=KEY_S,rb=KEY_D \
    --ui-buttonmap start=KEY_ENTER,back=KEY_B \
    --ui-buttonmap back+start=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 \
    --device-name "ATARI_SEGA Player 2 (xboxdrv)" \
    --evdev-absmap ABS_HAT0X=x1,ABS_HAT0Y=y1 \
    --evdev-keymap BTN_TR=back,BTN_TR2=start \
    --evdev-keymap BTN_SOUTH=y,BTN_EAST=b,BTN_C=a \
    --evdev-keymap BTN_NORTH=lb,BTN_WEST=x,BTN_TL=rb \
    --dpad-only \
    --ui-axismap x1=KEY_KP4:KEY_KP6,y1=KEY_KP5:KEY_KP8 \
    --ui-buttonmap y=KEY_J,b=KEY_K,a=KEY_L \
    --ui-buttonmap lb=KEY_I,x=KEY_O,rb=KEY_P \
    --ui-buttonmap start=KEY_U,back=KEY_H \
&
fi

if [ "$1" = "atari2600" ]
then
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 \
    --device-name "ATARI_SEGA Player 1 (xboxdrv)" \
    --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-only \
    --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP \
    --ui-buttonmap a=KEY_B \
&
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 \
    --device-name "ATARI_SEGA Player 2 (xboxdrv)" \
    --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-only \
    --ui-axismap x1=KEY_G:KEY_H,y1=KEY_J:KEY_I \
    --ui-buttonmap a=KEY_M \
&
fi

if [ "$1" = "atari7800" ]
then
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 \
    --device-name "ATARI_SEGA Player 1 (xboxdrv)" \
    --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-only \
    --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP \
    --ui-buttonmap a=KEY_B \
&
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 \
    --device-name "ATARI_SEGA Player 2 (xboxdrv)" \
    --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-only \
    --ui-axismap x1=KEY_G:KEY_H,y1=KEY_J:KEY_I \
    --ui-buttonmap a=KEY_M \
&
fi

 

It works great.  Since the NES controllers were always identified as events 0 and 1 with the adapter plugged into port 0, I left it as "/dev/input/event".  The Xbox and Mayflash (Sega) controllers were flip-flopping their event assignments based on whether or not the Xbox controller was on or off during bootup (enumeration).  So to get around it, I switched it over to "dev/input/by-id".  Solved the problem.

I would imagine this solution would work in the case of the bluetooth SNESpro as well.  If the event number changes during different things (controller on/off, or other controllers taking over), using the "by-id" method would eliminate that problem.  It would probably be something simple too, like "/dev/input/by-id/SN30-Pro-BT" etc.  Easily identifiable, and then simple to map and wouldn't ever change.

Link to comment
Share on other sites

SNEStalgia update

     Apparently the SNES classic edition can now have a USB/SD storage device added. You can solder in an SD card (Invasive) or use a micro USB On-The-Go Adapter to extend the storage. The alteration is less user friendly and bugs are still being worked out, but now the sky's the limit for it's library. I'm going to add PS1 to it. From what I understand it's hardware is slightly more impressive than the raspberry Pi 3. So it should be able to swing more (N64?). I like the interface better than emulation station, the save state manager and rewind feature specifically, but it doesn't offer the flexibility RPi does. Regardless, this is a huge leap forward. It's really giving NEStalgia the old Na-Na-Nuh-Boo-Boo-I-Hold-Your-Face-In-Doo_Doo! It can't emulate the cartridge, and never will. So there's that. They are really fighting for Daddy's attention.

  • Like 1
Link to comment
Share on other sites

On 12/25/2017 at 4:43 AM, stigzler said:

Are you coding now, Hans? Hope so as always handy to know a linux coder!

Hardly.  That took months to create.  It involved lots of trial an error, referring back to the walkthrough, and opening up a couple of threads in the RetroPie forums.  I'm getting more familiar with the process, but I'm far from being able to do this on my own with a blank page.

  • Like 1
Link to comment
Share on other sites

Speaking of coding...

HELP!!!

     The USB-HOST MOD that I'm using requires that no special characters be in the romname. My Goodset roms have Parentheses, exclamation points, and hyphens (Battletoads & Double Dragon - The Ultimate Team (U) [!].nes for example). In order for it to be loaded from the USB drive, it needs to be renamed to Battletoads & Double Dragon_The Ultimate Team.nes. I could do this rom by rom, but it would take forever. So I downloaded a bulk renaming tool (RegexRenamer, but I'm not married to it). However it uses general expressions to match patterns and rename. I have no idea how to get it to remove just the special characters. I've already spent too much time watching youtube videos trying to figure it out, to no avail.

  1. How do I remove "(U)" and "(!)" without changing anything else?
  2. How do I replace "-" with underscores?

EDIT:

I Found the following to work:

(.\(.*\])

That searches for "space(" + any number of characters followed by "]". That removes "space(U) [!]" After renaming, I'm left with "Battletoads & Double Dragon - The Ultimate Team.nes". The last thing left is to remove are the hyphens;

(.-.)

That matches "space-space". In the replace bar I put an underscore. It thus becomes "Battletoads & Double Dragon_The Ultimate Team.nes" after renaming again.

Link to comment
Share on other sites

8 hours ago, stigzler said:

Welcome to the magical world of regex. ;)

Yes, I can see the usefulness. It's just masked by the throbbing pain in my neck!

Trouble in SNEStalgia

      The 8BitDo SF30 pro controller isn't perfectly recognized in retroarch on the SNESC yet! R3/L3 and the right analog stick do not bind (are not seen). Everything else is seen. All the regular cores work fine without these controls (NES, SNES, Genesis, Atari 2600, and GB/GBA are the ones I've tested so far). However, PS1 and N64 won't work properly without them. For PS1 I'm using pcsx_rearmed_neon. R3/L3 and the right analog stick are not recognized, so no ape escape! Also, in Metal Gear Solid, L1/L2 act like a momentary switch. It doesn't see me holding the button down, which won't allow me to select weapons/items. It just equips the scope. So PS1 games are unplayable with this controller. Mupen64 is even worse. In addition to the buttons retroarch won't bind, the emu itself doesn't respond to the left analog stick or D-pad, even though they are bound in retroarch.

     Since there is no emulation station or frontend with the SNESC, it makes troubleshooting these things out of my league. There most likely needs to be a core update to modify the controller driver (wherever it's located). I'm using "_km_pcsx_rearmed_neon_12_16_17.hmod" for the PSX core, but I'm not sure that's where the retroarch controller drivers are stored. These cores get installed on the SNESC using Hakchi1, an unforgiving process. Assuming the driver is in the *.hmod, I would need to edit it and hack around inside of it (Linux coding). YUK!!!

Link to comment
Share on other sites

8 hours ago, stigzler said:

Welcome to the magical world of regex. ;)

 

5 minutes ago, RIP-Felix said:

Yes, I can see the usefulness. It's just masked by the throbbing pain in my neck!

Heh. I'm afraid that was good ole fashioned English sarcasm. Yer right - it is useful, but dayum is it a pain in the neck! Especially when you're dealing with escaped characters... 

Link to comment
Share on other sites

4 hours ago, stigzler said:

 

Heh. I'm afraid that was good ole fashioned English sarcasm. Yer right - it is useful, but dayum is it a pain in the neck! Especially when you're dealing with escaped characters... 

Yup, the "\(" escapes the ( command and tells it to literally look for an open parentheses. Same with "\]". I wasted a whole day watching youtube videos trying to figure that out!!! Eventually I managed to whip the romnames into shape. Probably took me more time than it would have to rename them one by one! (breaths deeply)...

Link to comment
Share on other sites

1 hour ago, hansolo77 said:

Meh,  I would have been even lazier and just got a different romset.  Instead of GoodName, I would have gotten No-Intro.

Yeah, but the files actually have to no special characters (The *.gen, *.sfrom, and etc). Most romsets have alternate dumps, hacks, and regions inside of an archive (Goodsets do anyway). I already went through and extracted the US region verified working dumps, those signified with "(USA) [!]". I placed them in a separate folder when I wanted to pair down the full set to the to IGN top 100. This makes finding a good game much easier;) It was a lot of work, but thus are the ones I included on the SD card (once I got them renamed correctly).

I managed to get the L2/R2 momentary press issue sorted. It was pressing L1 and R1. L1/2 and R1/2 are registering as the same buttons respectively. So instead of L2 (Select item) or R2 (Select weapon) it was pressing L1 (Scope) and R1 (nothing, since I couldn't select a weapon). I swapped them in settings and that works, but I can't use L1 and R1 because of it. Also, the left analog stick is just cloning the D-pad. It's not analog at all, retroarch settings doesn't change that. The Wii classic controller works better, but I need to do more testing...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...