Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie
-
Hey everyone. I'm also eagerly awaiting some sort of a solution, as I have the same problem with my Wiimote/Dolphinbar setup. On this emulator, it fires, but I can't move the cursor, and the crosshairs don't show on the screen. I know very little about tweaking codes inside emulators, so I was going to ask what I should try tweaking (like the "gun_cursor" code) because I honestly don't know where to start when tweaking code like this
I will say though that, thanks to the AdvMame update from August (I think), my Wiimote/DolphinBar combo does work with quite a few games (Lethal Enforcers, Operation Wolf, Operation Thunderbolt, to name a few), with just a simple Wiimote (and an 8-dollar plastic gun thing) and a Dolphinbar, plugged into the first USB of my Pi. The games that don't work, seem to be actual rom issues instead of gun issues.
I also wanted to add that I was kind of surprised it even half-worked on this emulator, since I was told by someone on a retro gaming FB group that none of the libretro emulators support light guns, even though I've heard that there was gun support on lr-mame2003 and lr-mame2010, although I haven't gotten anything to work on those yet. The games that do work on my setup are largely through AdvMame 1.4., but still, I really want to find a way to get this working on SMS/Genesis and even NES.
I have tried DGen and Osmose for SMS/Genesis gun roms, and those are the opposite of this emulator. I can move the cursor (it shows up as an actual mouse cursor, not a crosshairs), but I can't shoot. If anyone has any updates/fixes, I'd be eternally grateful!:)
-
@BGallagherLA said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
Hey everyone. I'm also eagerly awaiting some sort of a solution, as I have the same problem with my Wiimote/Dolphinbar setup. On this emulator, it fires, but I can't move the cursor, and the crosshairs don't show on the screen. I know very little about tweaking codes inside emulators, so I was going to ask what I should try tweaking (like the "gun_cursor" code) because I honestly don't know where to start when tweaking code like this
I will say though that, thanks to the AdvMame update from August (I think), my Wiimote/DolphinBar combo does work with quite a few games (Lethal Enforcers, Operation Wolf, Operation Thunderbolt, to name a few), with just a simple Wiimote (and an 8-dollar plastic gun thing) and a Dolphinbar, plugged into the first USB of my Pi. The games that don't work, seem to be actual rom issues instead of gun issues.
I also wanted to add that I was kind of surprised it even half-worked on this emulator, since I was told by someone on a retro gaming FB group that none of the libretro emulators support light guns, even though I've heard that there was gun support on lr-mame2003 and lr-mame2010, although I haven't gotten anything to work on those yet. The games that do work on my setup are largely through AdvMame 1.4., but still, I really want to find a way to get this working on SMS/Genesis and even NES.
I have tried DGen and Osmose for SMS/Genesis gun roms, and those are the opposite of this emulator. I can move the cursor (it shows up as an actual mouse cursor, not a crosshairs), but I can't shoot. If anyone has any updates/fixes, I'd be eternally grateful!:)
If you can actually believe this, I had a solution, and then the MicroSD card I had RetroPie and did my code updates on literally BURNED UP when I brought my Raspberry Pi 3 to a friend's house Sunday night to show off RetroPie. The card I guess shorted when I tried to put the RPI3 in a plastic case that pressed up against the MicroSD card and may have bent/shorted it, causing it to just get extremely hot and die when plugged in.
Guess I should have bought that extra Logitech f310 gamepad for the guys, God's telling me something here. :-P
It's actually an easy fix, unfortunately ekeeke the developer is of the mindset that from a design perspective only an absolute pointer touchscreen should be used, and in a perfect world where there are no driver issues with Linux recognizing touchscreen devices that's great, but in my experience that's not the case so I respectfully disagree. Theoretically even a joypad analog thumb stick could/should be used as a lightgun pointer in a pinch when other hardware options are not available IMHO.
I just changed the code in lr-genesis-plus-gx to reference RETRO_DEVICE_LIGHTGUN instead of RETRO_DEVICE_POINTER on my end, and also put in some code to check the screen position. Although I put in a constant for the screen bounds checking instead of actually looking at a variable, so it worked fine on Missile Defense 3-D, but then when I played T2: The Arcade Game on Genesis my cursor would only go over half the screen (because the Genesis runs at a larger resolution). Easy fix, but I have to rework those sections of code, maybe I'll fork their repo into my own and just share that. I put a VirtualBox VM on this MacBook so I can have a more reliable machine to do code edits from, although VirtualBox isn't giving me Hardware Acceleration over Debian for RetroPie, so... to be continued... Hopefully I'll have that back up within a few days or weeks (I'm in an aggressive job hunt right now trying to find a part time job in programming/support that won't kill me physically because of all that smoking I used to do ended me up pre-diabetic) :( ).
-
@johne79 said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
Easy fix, but I have to rework those sections of code, maybe I'll fork their repo into my own and just share that.
That is fantastic news. I look forward to hearing more on this. Good luck on your job search.
-
@johne79 said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
It's actually an easy fix, unfortunately ekeeke the developer is of the mindset that from a design perspective only an absolute pointer touchscreen should be used, and in a perfect world where there are no driver issues with Linux recognizing touchscreen devices that's great, but in my experience that's not the case so I respectfully disagree.
i'm sort of with ekeeke here. the retroarch udev driver should be able to translate from an absolute device to a relative device and vice versa, if either doesn't exist. i've done this in mame2003 for one purpose.. i would personally prefer to fix it in udev driver eventually, then it helps all cores.
that said, when i got someone to test with a wii mote and sensor bar and a debug version of mame2003, they weren't getting any updates to RETRO_DEVICE_MOUSE, _POINTER, or _LIGHTGUN. this is for some other fault of the udev driver, and in this case you will not be able to work around it without looking into the driver.
-
@johne79 said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
It's actually an easy fix, unfortunately ekeeke the developer is of the mindset that from a design perspective only an absolute pointer touchscreen should be used, and in a perfect world where there are no driver issues with Linux recognizing touchscreen devices that's great, but in my experience that's not the case so I respectfully disagree. Theoretically even a joypad analog thumb stick could/should be used as a lightgun pointer in a pinch when other hardware options are not available IMHO.I just changed the code in lr-genesis-plus-gx to reference RETRO_DEVICE_LIGHTGUN instead of RETRO_DEVICE_POINTER on my end, and also put in some code to check the screen position. Although I put in a constant for the screen bounds checking instead of actually looking at a variable, so it worked fine on Missile Defense 3-D, but then when I played T2: The Arcade Game on Genesis my cursor would only go over half the screen (because the Genesis runs at a larger resolution). Easy fix, but I have to rework those sections of code, maybe I'll fork their repo into my own and just share that.
See, that's the thing... I don't know where to change the RETRO_DEVICE_LIGHTGUN setting. I know next to nothing about tweaking code for emulators.
Plus I saw here (https://wiki.libretro.com/index.php?title=Genesis_Plus_GX) there is an option to turn the crosshairs on, but again, I don't know how to change this. If you could help me out a bit on where to change this code, and the other codes you tweaked, I'd be very grateful.
-
@dankcushions said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
that said, when i got someone to test with a wii mote and sensor bar and a debug version of mame2003, they weren't getting any updates to RETRO_DEVICE_MOUSE, _POINTER, or _LIGHTGUN. this is for some other fault of the udev driver, and in this case you will not be able to work around it without looking into the driver.
If it would be helpful for you to have a wii mote and dolphinbar to work with, I have a set I would be glad to send your way. Get in contact with me if that would be helpful.
-
@markwkidd that's very generous! thanks, but i think i could just buy my own for pretty cheap.
one question, what is the purpose of the dolphin bar? if wiimotes are bluetooth and the sensor bar is just a couple of infrared lights that doesn't commicate with the wii, is it enough to get a usb sensor bar clone, and a knock off chinese wiimote?
if the dolphinbar is way more popular then that's probably reason enough, but i don't think i've always seen it mentioned when talking about wiimotes + pi.
-
@dankcushions said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
what is the purpose of the dolphin bar?
The DolphinBar eliminates the need for any drivers. It not only contains the two necessary infrared lights, but it also pairs directly with the WiiMote's Bluetooth and translates the data into standard USB absolute mouse coordinates and USB keyboard input. It also has a mode that will translate the data to standard USB Joystick input, which is not only useful for the Wiimotes, but also any number of controller accessories that can connect to the bottom ports. For example, when they become more widely available, I plan on picking up four NES controllers for the NES classic and connecting them to the Pi in this way, allowing for what will essentially be four first party Nintendo controllers that are "wireless".
-
@dankcushions said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
@johne79 said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
It's actually an easy fix, unfortunately ekeeke the developer is of the mindset that from a design perspective only an absolute pointer touchscreen should be used, and in a perfect world where there are no driver issues with Linux recognizing touchscreen devices that's great, but in my experience that's not the case so I respectfully disagree.
i'm sort of with ekeeke here. the retroarch udev driver should be able to translate from an absolute device to a relative device and vice versa, if either doesn't exist. i've done this in mame2003 for one purpose.. i would personally prefer to fix it in udev driver eventually, then it helps all cores.
that said, when i got someone to test with a wii mote and sensor bar and a debug version of mame2003, they weren't getting any updates to RETRO_DEVICE_MOUSE, _POINTER, or _LIGHTGUN. this is for some other fault of the udev driver, and in this case you will not be able to work around it without looking into the driver.
There's one caveat to that, and that's that I've found out that a mouse can report ABS_X and ABS_Y without having INPUT_ID_TOUCHSCREEN=1. In fact, trying to set the latter via a udev rule on this particular touchscreen (AR1100 on an Adafruit 5" HDMI Backpack Touchscreen) caused it to stop working in X11, but it was reporting ABS just fine.
What I did before the crash on Sunday was modify the RetroArch code to include ABS_X/Y in the mouse input handling, and translate those coordinates to relative for use in lightgun apps. I used 0,0 as a fixed starting point, and it seems to work fine as long as you're not using both a relative and absolute device at the same time, if you do the coordinates wrestle with each other a bit until one takes over the other it looks like.
I'm coming back around to the code, I've had a monster of a week trying to do some home improvements on my home office including some furniture building, trying to drum up some business, getting a dedicated Debian box up and running, ensuring next time that I have a more stable coding environment and don't stupidly do the code manipulation on the Pi itself since they can be a bit "accident" prone (I've broken 2 RPI's already, one was due to an accidental wiring when I first started learning GPIO, the other was due to about a 3 foot accidental drop), and a host of other things.
In fact I could never get any device to properly detect as a touchscreen, that was a point of frustration for weeks, and no one anywhere could or would give me a hand on that. At the end of the day I think the user needs a better way via an option in RetroArch to specify what device(s) to use as pointers and that should all be handled upstream in RetroArch rather than the core dictating the usage of a device, since it can break functionality unless you go and haphazardly waste money on potentially expensive hardware like ~$100 on AimTrak guns for one or two cores. So you say use RETRO_DEVICE_LIGHTGUN in the core code, but RetroArch lets you pick whether to use an absolute or relative positioning device, and handles all the coordinate translation, and you get a "best of both worlds" situation creating a win both for RetroArch and the core developers.
-
@dankcushions said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
@johne79 said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
It's actually an easy fix, unfortunately ekeeke the developer is of the mindset that from a design perspective only an absolute pointer touchscreen should be used, and in a perfect world where there are no driver issues with Linux recognizing touchscreen devices that's great, but in my experience that's not the case so I respectfully disagree.
i'm sort of with ekeeke here. the retroarch udev driver should be able to translate from an absolute device to a relative device and vice versa, if either doesn't exist. i've done this in mame2003 for one purpose.. i would personally prefer to fix it in udev driver eventually, then it helps all cores.
that said, when i got someone to test with a wii mote and sensor bar and a debug version of mame2003, they weren't getting any updates to RETRO_DEVICE_MOUSE, _POINTER, or _LIGHTGUN. this is for some other fault of the udev driver, and in this case you will not be able to work around it without looking into the driver.
Also a small note, that Dolphinbar probably failed to detect anything for the same reason my touchscreen was failing, because it's giving absolute positioning and it's detected as a mouse not as a touchscreen, which currently in RetroArch will just skip through the switch/case statement (and I fixed that until my MicroSD's unfortunate demise on Sunday).
I don't know what the actual criteria is for udev to properly detect hardware as a touchscreen at the hardware level, surely I'm hoping it's not specific vendors/product IDs in the HID.
-
@BGallagherLA said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
@johne79 said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
It's actually an easy fix, unfortunately ekeeke the developer is of the mindset that from a design perspective only an absolute pointer touchscreen should be used, and in a perfect world where there are no driver issues with Linux recognizing touchscreen devices that's great, but in my experience that's not the case so I respectfully disagree. Theoretically even a joypad analog thumb stick could/should be used as a lightgun pointer in a pinch when other hardware options are not available IMHO.I just changed the code in lr-genesis-plus-gx to reference RETRO_DEVICE_LIGHTGUN instead of RETRO_DEVICE_POINTER on my end, and also put in some code to check the screen position. Although I put in a constant for the screen bounds checking instead of actually looking at a variable, so it worked fine on Missile Defense 3-D, but then when I played T2: The Arcade Game on Genesis my cursor would only go over half the screen (because the Genesis runs at a larger resolution). Easy fix, but I have to rework those sections of code, maybe I'll fork their repo into my own and just share that.
See, that's the thing... I don't know where to change the RETRO_DEVICE_LIGHTGUN setting. I know next to nothing about tweaking code for emulators.
Plus I saw here (https://wiki.libretro.com/index.php?title=Genesis_Plus_GX) there is an option to turn the crosshairs on, but again, I don't know how to change this. If you could help me out a bit on where to change this code, and the other codes you tweaked, I'd be very grateful.
There's a core option in lr-genesis-plus-gx for gun_cursor and you just turn it on. You can either do the RGUI menu in-game (SELECT+X for me), and set it to an override then save your config (you may need to reboot the game), or launch the text-based menus before the game by pressing keys before the game launches then set gun_cursor=yes (or maybe it's true I can't remember) to a ROM option.
-
@mediamogul said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
@dankcushions said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
what is the purpose of the dolphin bar?
The DolphinBar eliminates the need for any drivers. It not only contains the two necessary infrared lights, but it also pairs directly with the WiiMote's Bluetooth and translates the data into standard USB absolute mouse coordinates and USB keyboard input. It also has a mode that will translate the data to standard USB Joystick input, which is not only useful for the Wiimotes, but also any number of controller accessories that can connect to the bottom ports. For example, when they become more widely available, I plan on picking up four NES controllers for the NES classic and connecting them to the Pi in this way, allowing for what will essentially be four first party Nintendo controllers that are "wireless".
I wonder how that works on a dual monitor setup as a mouse? I have 3 monitors in my bedroom (two running from a PC which I may add Linux to that mix, and one close to the ceiling that runs Chromecast/Apple TV), I want to be able to control the dual monitors from WiiMote. All the Windows 10 drivers for my WiiMote didn't seem to work right, at best they would only detect the buttons and not the IR Camera in FreePIE (which is the MOST important feature to me, also I can't find GlovePIE since they stopped development), if they would detect at all (I think I only got FreePIE working, all others failed to connect). I haven't tried a Linux setup yet on those because reading through docs and forum posts it looks like there's only button support in the drivers? I don't know, hopefully they have that working. I want to be able to use the IR Camera on a WiiMote as a RETRO_DEVICE_LIGHTGUN, I've even got a Cabela's Rifle enclosure for the WiiMote.
-
@johne79 said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
@dankcushions said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
@johne79 said in Light Gun (Sega Master System) on lr-genesis-plus-gx for RetroPie:
It's actually an easy fix, unfortunately ekeeke the developer is of the mindset that from a design perspective only an absolute pointer touchscreen should be used, and in a perfect world where there are no driver issues with Linux recognizing touchscreen devices that's great, but in my experience that's not the case so I respectfully disagree.
i'm sort of with ekeeke here. the retroarch udev driver should be able to translate from an absolute device to a relative device and vice versa, if either doesn't exist. i've done this in mame2003 for one purpose.. i would personally prefer to fix it in udev driver eventually, then it helps all cores.
that said, when i got someone to test with a wii mote and sensor bar and a debug version of mame2003, they weren't getting any updates to RETRO_DEVICE_MOUSE, _POINTER, or _LIGHTGUN. this is for some other fault of the udev driver, and in this case you will not be able to work around it without looking into the driver.
There's one caveat to that, and that's that I've found out that a mouse can report ABS_X and ABS_Y without having INPUT_ID_TOUCHSCREEN=1. In fact, trying to set the latter via a udev rule on this particular touchscreen (AR1100 on an Adafruit 5" HDMI Backpack Touchscreen) caused it to stop working in X11, but it was reporting ABS just fine.
What I did before the crash on Sunday was modify the RetroArch code to include ABS_X/Y in the mouse input handling, and translate those coordinates to relative for use in lightgun apps. I used 0,0 as a fixed starting point, and it seems to work fine as long as you're not using both a relative and absolute device at the same time, if you do the coordinates wrestle with each other a bit until one takes over the other it looks like.
I'm coming back around to the code, I've had a monster of a week trying to do some home improvements on my home office including some furniture building, trying to drum up some business, getting a dedicated Debian box up and running, ensuring next time that I have a more stable coding environment and don't stupidly do the code manipulation on the Pi itself since they can be a bit "accident" prone (I've broken 2 RPI's already, one was due to an accidental wiring when I first started learning GPIO, the other was due to about a 3 foot accidental drop), and a host of other things.
In fact I could never get any device to properly detect as a touchscreen, that was a point of frustration for weeks, and no one anywhere could or would give me a hand on that. At the end of the day I think the user needs a better way via an option in RetroArch to specify what device(s) to use as pointers and that should all be handled upstream in RetroArch rather than the core dictating the usage of a device, since it can break functionality unless you go and haphazardly waste money on potentially expensive hardware like ~$100 on AimTrak guns for one or two cores. So you say use RETRO_DEVICE_LIGHTGUN in the core code, but RetroArch lets you pick whether to use an absolute or relative positioning device, and handles all the coordinate translation, and you get a "best of both worlds" situation creating a win both for RetroArch and the core developers.
interesting! i think we're on similar pages.
there's one issue that RETRO_DEVICE_MOUSE/POINTER/LIGHTGUN only handles one device of the same type each (i think if you have multiple mouse/etc devices then they fight, as you say). they should be able to handle N devices, like RETRO_DEVICE_JOYPAD or whatever. issue logged for this: https://github.com/libretro/RetroArch/issues/3443
Also a small note, that Dolphinbar probably failed to detect anything for the same reason my touchscreen was failing, because it's giving absolute positioning and it's detected as a mouse not as a touchscreen, which currently in RetroArch will just skip through the switch/case statement (and I fixed that until my MicroSD's unfortunate demise on Sunday).
I don't know what the actual criteria is for udev to properly detect hardware as a touchscreen at the hardware level, surely I'm hoping it's not specific vendors/product IDs in the HID.
yeah i think fully understanding this part is crucial. if it's a udev problem, then the problem should be reported to udev upstream. if its a udev driver problem, then it's fixable in libretro. i suspect the case statement is faulty, but i don't fully understand the info that udev provides about a device to fix it. there must be SOME sort of reliable information about whether a device is abs or not... you'd hope.
i don't think it should be up to the user to specify whether something is abs or not.. ideally, anyway!
-
@johne79 Thanks John! Currently updating everything to 4.2 so I'll try tweaking with this again when that finishes.
-
@johne79 I've got a little cheap gun enclosure for my Wiimote, just a white plastic one that cost like 8 bucks on Amazon haha. Works great in AdvMame for me, and a ton cheaper than Aimtrak.
-
@johne79 I found the gun cursor setting in Retroarch GUI but it just turned the cursor on, and I still can't move it from center. Do I have to tweak more to calibrate the gun through different settings? I even turned the Player One in retroarch to "MS Light Phaser" but that didn't seem to fix anything.
-
@johne79 There is now a bounty building up for mouse enhancements to the libretro API: https://www.bountysource.com/issues/43321776-multiple-mice-support
Specifically it's about adding support for multiple mice. I remembered you getting pretty far into this analysis of what could be improved in that regard so I just wanted to point the bounty out to you. In case you might be tempted to try for it :)
-
Hi @johne79. I just wanted to mention that @casdevel from the libretro forums and github has added multi-mouse support to RetroArch's udev input driver.
If you are interested in that feature, or if you would like to see if casdevel could help address the need some cores have for absolute coordinates, here's where the discussion is happening: https://github.com/libretro/RetroArch/pull/5010
-
This is great news! It looks as though the PR was merged and casdevel is now considering solutions for absolute coordinates. I may be able to retire my hacked Wii very soon. It's served me very well, but it'll be nice to have a light gun setup that's a bit more portable.
-
@mediamogul what do you think about starting a new thread for people who are experimenting with multiple mouse-type input devices? Right now I only have RetroArch access on Windows, but with the Windows raw input driver the 2-player mouse input experience is already 90% perfect .
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.