Welcome!

Final Burn Neo => FBN Development => Topic started by: StormedBubbles on January 01, 2022, 02:05:22 PM

Title: split topic : lightgun issues
Post by: StormedBubbles on January 01, 2022, 02:05:22 PM
Hello,

Thanks again for adding Super Russian Roulette! It runs very well in the Libretro port of FBNeo on my Raspberry Pi 4B. I do have a couple questions about the lightgun support for NES. Please pardon my ignorance if there is an easy solution to this that I missed. I browsed the documentation but didn't notice these particular issues.

The game recognizes my Sinden lightgun's trigger, but the gun doesn't move the crosshairs like it does in arcade games when in "Lightgun" mode. It seems that the emulator requires "Port 2" to be where the gun is plugged in (like real NES hardware typically does) for the trigger to be recognized, but only in "Mouse" mode will the crosshairs move. The movement there is a bit erratic. In "Lightgun" mode, the crosshairs seem to be stuck to the middle of the screen and then disappear after some inactivity.

Further, I can't seem to get the game to register an offscreen shot. The "Gun Reload" RetroArch input mapping doesn't seem to function in this game, while "Gun Aux A" also registers an onscreen shot. Unfortunately, the game requires offscreen shots to advance, as onscreen shots only really serve as Easter Eggs. You can destroy stuff in the foreground or agitate/kill the cowboy character.

I was thinking that perhaps I was missing a BIOS file, but it seems that only FDS requires a BIOS for NES-related stuff on FBNeo.
Title: Re: split topic : lightgun issues
Post by: barbudreadmon on January 01, 2022, 05:36:54 PM
Thanks for the report ! There was indeed a problem with nes+lightgun on the libretro port, it should be ok now.
Title: Re: split topic : lightgun issues
Post by: dink on January 01, 2022, 06:07:09 PM
StormedBubbles,
Please bear with us, this game is being feisty.. :)  I'll try to have this offscreen shot issue fixed by later today or tomorrow.

best regards,
- dink
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 01, 2022, 06:12:21 PM
Thank you both so much! Take your time, and I'll be happy to test it out when it's ready.

EDIT: I also noticed that offscreen shots don't seem to work with arcade games either. I typically jump around with different emulators when trying various games and didn't think much about this issue before, but perhaps this is a wider issue than just with NES.
Title: Re: split topic : lightgun issues
Post by: dink on January 01, 2022, 08:17:41 PM
Thank you both so much! Take your time, and I'll be happy to test it out when it's ready.

EDIT: I also noticed that offscreen shots don't seem to work with arcade games either. I typically jump around with different emulators when trying various games and didn't think much about this issue before, but perhaps this is a wider issue than just with NES.

Can you tell me some of the arcade games w/lightgun that have this problem?  also, can you try it with a mouse or gamepad and see if it works?
Most games register offscreen for reloading when the gun retical is all the way to the top, bottom or sides, in some games we've even added a fake "reload" button to make things easier for controller users.

best regards,
- dink
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 01, 2022, 09:36:15 PM
Sure; I will go over my notes over the next day or two and test the various scenarios.
Title: Re: split topic : lightgun issues
Post by: barbudreadmon on January 02, 2022, 04:09:39 AM
Can you tell me some of the arcade games w/lightgun that have this problem?  also, can you try it with a mouse or gamepad and see if it works?
Most games register offscreen for reloading when the gun retical is all the way to the top, bottom or sides, in some games we've even added a fake "reload" button to make things easier for controller users.

best regards,
- dink

It might be yet another feature that poorly translates from the libretro port to the emulation backend, what would be the correct value to inject through BurnGunSetCoords to emulate the offscreen reloading feature ?
Currently the value i'm injecting is probably 0.
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 03, 2022, 11:21:26 AM
After going through a list, it seems that most of the gun games in the FBNeo romset use a pump-action reload or do not require reloading at all. Here are the three games that gave me issues with off-screen reloading:

Lethal Enforcers (lethalen): With a controller, I can reload by shooting at the very top or bottom of the screen. With a Sinden lightgun or a regular mouse in lightgun mode, I can only seem to get the reload to work consistently by firing off the top of the screen.

Lord of Gun (lordgun): With a controller, it works perfectly. I can reload off of any side of the screen without issue. With a Sinden lightgun or a regular mouse in lightgun mode, I can only reload by firing off the top or left side of the screen.

Zero Point 2 (zeropnt2): Regardless of using a controller, Sinden lightgun, or regular mouse, I can only occasionally get reload to work by firing multiple times along the edges of the screen. I do not notice a pattern. This game does have a dip-switch to disable reloading and make it play like Zero Point 1, but the FBNeo default has reload on.

A note on the games in which reload only works on some sides of the screen: when the Sinden gun is pointed away from the screen, the cursor will move to the correct border side, but if that movement is exaggerated even a little, the cursor will sometimes jump to another side of the screen. For example, in Lord of Gun, if I move off the left side of the border with my gun, the cursor usually stays on the left part of the border but will occasionally warp to the bottom of the screen and fail to reload. The lightgun system seems to know that the border was touched and does keep the cursor on the border, so there is no danger of firing an on-screen shot. It's like Pointing a Wii Remote away from the screen. The remote and game both know that the cursor is not being pointed at the game area, but neither knows which side of the border to put the cursor on. It would be a non-issue if all sides of the border activated reload when using the gun controller.
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 03, 2022, 12:35:15 PM
I also want to mention that the updates for Super Russian Roulette pushed to the Libretro version of FBNeo within the last couple of hours fixed the off-screen issues for that game!

The only issue I notice with that game now is when you try to activate the Easter Egg of killing the cowboy. In normal gameplay, if you are in control of the gun and try to shoot at the cowboy, you will miss, and he will pull out another gun and shoot you dead. This portion works in FBNeo.

However, the game has an Easter Egg if you try to shoot again before he shoots you. In normal gameplay, if you fire another shot at him as he is pulling out his gun, you will kill him. It seems that if you try to pull the trigger again at this point in FBNeo, it will skip to him already having his gun out, and pulling the trigger again at that point will skip him shooting and go right to the death screen for the human player.
Title: Re: split topic : lightgun issues
Post by: dink on January 03, 2022, 04:36:55 PM
I also want to mention that the updates for Super Russian Roulette pushed to the Libretro version of FBNeo within the last couple of hours fixed the off-screen issues for that game!

The only issue I notice with that game now is when you try to activate the Easter Egg of killing the cowboy. In normal gameplay, if you are in control of the gun and try to shoot at the cowboy, you will miss, and he will pull out another gun and shoot you dead. This portion works in FBNeo.

However, the game has an Easter Egg if you try to shoot again before he shoots you. In normal gameplay, if you fire another shot at him as he is pulling out his gun, you will kill him. It seems that if you try to pull the trigger again at this point in FBNeo, it will skip to him already having his gun out, and pulling the trigger again at that point will skip him shooting and go right to the death screen for the human player.

Thanks for the infos!  Focusing on SRR for now:
I tried killing the cowboy in another emulator which also supports the game, but I also can't kill him.  I'm thinking that there must be something else to the egg, perhaps progress in the game before he can be killed, or something like that, what do you think?

best regards,
- dink
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 03, 2022, 05:08:59 PM
🤣 I think that you are exactly correct! I don't know the exact pattern, but it seems that you can get him if he's not staring/pointing directly at you. I got it to work in lr-fbneo when he was leaning back in his chair with his feet up on the table. He also blinks in a way that makes me suspicious that he has some Punch-Out-esque tells.

One thing that I noticed in this latest round of testing is that the bottom of the screen still registers an on-screen shot. I missed that before. The other three sides seem to work every time. The cursor sometimes hits the bottom of the screen when I'm, uh, holding the "USB camera controller" to my head for maximum immersion.

By the way, the cowboy's reaction if you are unlucky enough to die on the first turn is pretty funny.
Title: Re: split topic : lightgun issues
Post by: dink on January 03, 2022, 08:53:11 PM
🤣 I think that you are exactly correct! I don't know the exact pattern, but it seems that you can get him if he's not staring/pointing directly at you. I got it to work in lr-fbneo when he was leaning back in his chair with his feet up on the table. He also blinks in a way that makes me suspicious that he has some Punch-Out-esque tells.

One thing that I noticed in this latest round of testing is that the bottom of the screen still registers an on-screen shot. I missed that before. The other three sides seem to work every time. The cursor sometimes hits the bottom of the screen when I'm, uh, holding the "USB camera controller" to my head for maximum immersion.

By the way, the cowboy's reaction if you are unlucky enough to die on the first turn is pretty funny.

hehe nice find, I do believe there are much more things hidden here :)  Here's a funny clip:
https://youtu.be/Q5itiKorPic 

The NES hardware has a "tell" for all the things that are going to respond to the gun: after you pull the trigger, the screen will flash a bright color (usually white) on all the targets - the desk lights up all the way to the bottom of the screen.

best regards,
- dink
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 03, 2022, 09:34:49 PM
LOL! That must have been quite the exit wound for him to end up grasping at his chest.

That is unfortunate with the desk flashing. Hmm, I suppose the only possibility then is to play with the overscan in hopes of there being lines of non-flashing pixels below the desk. Thanks for all of the help!
Title: Re: split topic : lightgun issues
Post by: dink on January 03, 2022, 11:19:42 PM
Well, there's 2 things that could happen with that scene, if you shoot him as he turns around from being hit in the butt, he'll die, but if you're not fast enough, he'll shoot you after doing a funny scene :)

p.s. do you have any good NES game suggestions that we don't have yet?

best regards,
- dink
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 04, 2022, 12:17:58 AM
In keeping with the lightgun theme, I do have two more that are oddities.

One is "Hit Marmot," which is a whack-a-mole game. The other is "Fantasy of Gun," which is part of a multi-cart titled "Super 4 in 1" that also contains games called "Space Fight of Gun" (Zapper), "Abyss of Gloom" (Zapper), and "City Adventure" (controller).

These games do work in other emulators that I have tried in RetroArch, but they don't seem to work fully in those emulators. Their unique trait is that they were apparently made for a clone Famicom system that used a proprietary way of getting two independent gun inputs. My guess is that the clone system either (a) had two expansion ports or (b) used daisy-chained controller/Zapper combos that looked like N64 controllers. It is difficult to find information on these, but it seems that a two-controller, two-gun setup was meant to be possible (Fantasy of Gun appeared in at least one other mega-compilation that mixed controller and gun games).

I know of two dual-Zapper games for the NES that work with 2 independent Zapper inputs both on real hardware and in at least one RetroArch emulator. Those two games are "Chiller" and the pong game in "Zap Ruder." Their configuration is straightforward: a Zapper goes in each controller port of an NES. Each player gets an independent score, so it's not just two guns duplicating one shooting input. Hit Marmot and Fantasy of Gun don't work with that setup, but they definitely have independent score/ammo counters for a second player that cannot be controlled by a controller.

Hit Marmot and Fantasy of Gun aren't great games, but it has become a curiosity for me to see if it is possible to emulate the 2-player behavior. Other RetroArch emulators I have tried treat the Famicom's expansion port as "port 5," so I have just been under the assumption that that port 5 would need to be assigned to some new "dual gun" in order for the whole setup to work.
Title: Re: split topic : lightgun issues
Post by: barbudreadmon on January 04, 2022, 07:10:37 AM
i made a new topic out of the nes zapper issues
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 04, 2022, 10:44:25 AM
Thanks!

Going back to Super Russian Roulette briefly, I noticed that the entire border of the screen, including all parts surrounding the desk, does indeed register as "off screen" when using a mouse (full) or controller to control the cursor. It is only when the control type is set to lightgun that the bottom of the screen + the right side of the desk register as a shot on screen. The left side of the desk seems okay. It is hard for me to eyeball it, but perhaps the cursor isn't allowed to go as far into the border when in lightgun mode? The issue is similar to what happens with some of the arcade games in lightgun mode. It seems that the thresholds for what is and isn't an off-screen shot are different among the various control modes.
Title: Re: split topic : lightgun issues
Post by: barbudreadmon on January 04, 2022, 12:17:08 PM
Are you using the latest version of the core ?
Yesterday i noticed the libretro api specify a value for offscreen (https://github.com/libretro/FBNeo/blob/master/src/burner/libretro/libretro-common/include/libretro.h#L132) and made a change to correctly account for this (i don't have a mean to properly test this since i have no lightgun, and the mouse can't trigger that value for some reason). Where goes the crosshair when you go offscreen ? If RetroArch is correctly returning me -0x8000, i set the position at (0,0), so the crosshair should always appear exactly in the very top left corner, if not then you might have found a RetroArch bug, since it would mean RetroArch isn't sending me the correct value.

Edit : i pushed another attempt at fixing this to github, as it seems there might be a second method to detect if a lightgun is offscreen (https://github.com/libretro/FBNeo/blob/master/src/burner/libretro/libretro-common/include/libretro.h#L230)
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 04, 2022, 08:16:46 PM
Hey, thanks for all of your help. I really appreciate it! Using a device emulating a lightgun like this is a pretty niche thing right now, but hopefully the numbers grow and more people can experience how fun it is  :smilie:

I was on commit f4bf5ef in the libretro version, which is the commit right before the one you mentioned in your message. The method you used is very clever. With the commit you just recently added, I do get the cursor jumping to the top left when I hit the edge of the screen. It returns to where it was before that when I move away. That fixed the issue with Super Russian Roulette, Lord of Gun, and Lethal Enforcers! Thanks!

Zero Point 2 is still a little strange, but I don't think it is because of the same issue. The cursor definitely does go to the top left, but I have to pull the trigger a handful of times to get reload to work. Does that one have off-screen reload accounted for in the code? The first Zero Point game didn't need any reloading, and there's a dipswitch for the second one to disable the need for reloading, so I'm wondering if maybe it was just overlooked. If that one is weird/annoying to update, then I can just play with the reload disabled. It otherwise works great.  :biggrin:

When testing this stuff, it's possible to use a regular mouse when in lightgun mode. The Sinden gun is really just a fancy mouse that uses a camera to place the cursor in a calibrated position. The camera looks for a white border around the game screen, and then, through some software "magic," it places the cursor on screen right where you calibrated your line of sight. To the gun, "off screen" means "can't see a border," and that translates in mouse talk to "cursor on edge of screen." It's amazingly consistent. You can go off screen in one direction and maintain the alignment when you come back from another side of the screen. It allows me to turn off any emulator-generated crosshairs.

Thanks again! I wonder if the mystery of the hidden Famiclone dual gun will be figured out. 🤞
Title: Re: split topic : lightgun issues
Post by: barbudreadmon on January 05, 2022, 02:37:07 AM
I'm glad the libretro offscreen weird behavior was sorted out !
I'll look at Zero Point 2 when i have some time, the obscure nes zapper games might be a bit beyond me.
Title: Re: split topic : lightgun issues
Post by: dink on January 05, 2022, 10:01:31 AM
Zero Point 2 is fixed now :)

best regards,
- dink
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 05, 2022, 11:28:10 AM
Awesome! Thanks! It works well for me.

Is there a different way to turn off the crosshairs for NES games? After finishing testing, I'm now realizing that the core option for the crosshair/cursor toggle doesn't seem to affect NES like it does for arcade games. The cursor is always there.
Title: Re: split topic : lightgun issues
Post by: barbudreadmon on January 05, 2022, 12:06:18 PM
Thanks for the report ! It should be ok now.
Title: Re: split topic : lightgun issues
Post by: Voljega on January 05, 2022, 03:47:48 PM
sorry for the little hijack but which kind of gun are you using @StormedBubbles ?
and does it work with two players and are you happy with it ?
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 05, 2022, 04:41:46 PM
Thanks! I will check that update out later.

@Voljega: I am using two Sinden lightguns. Two definitely work together in RetroArch on a Raspberry Pi. I haven't tried them in any Windows emulators, but they do function on my Windows laptop too. I don't think that there is any software limitation on the Sinden side with how many guns you can use. For example, you should be able to use 3 of them together in Revolution X as long as the emulator supports multiple mice. You just currently need one instance of the software per gun.

I am very happy with them, but they are a little annoying to initially set up. I find that the vast majority of information floating around out there on these is very outdated. The Discord community has the most up-to-date information. Software and firmware improvements have eliminated almost all of the issues I have seen in various videos.
Title: Re: split topic : lightgun issues
Post by: dink on January 05, 2022, 05:43:00 PM
Awesome! Thanks! It works well for me.

Is there a different way to turn off the crosshairs for NES games? After finishing testing, I'm now realizing that the core option for the crosshair/cursor toggle doesn't seem to affect NES like it does for arcade games. The cursor is always there.

Great! :)  I tested disabling of the crosshair in a few nes games, and it worked fine, maybe barbudreadmon has an idea?

best regards,
- dink
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 06, 2022, 02:01:44 AM
The update related to the NES cursor mentioned earlier did the trick! I think it is all good now.
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 14, 2022, 10:32:44 PM
Hi again,

I am tinkering with Lucky & Wild and am having some trouble getting a handle on the controls when adding lightguns to the mix. In the libretro version of fbneo, when port 1 is set to "RetroPad," I can steer with the left stick and aim with the right. L2 brakes, R2 accelerates, and one of the face buttons shoots.

The game seems to handle the gun inputs fine for both players if I set port 1 and port 2 to "llightgun," and I can still use the shoulder buttons of controller 1 for braking and accelerating. However, I can't seem to steer in this configuration.

Is it possible to steer with a separate controller while both player 1 and player 2 are configured to use a lightgun?
Title: Re: split topic : lightgun issues
Post by: barbudreadmon on January 14, 2022, 11:40:07 PM
This game has such a weird layout, i'll try to think of a way to make things work with lightguns, note that if i end up moving steering to another player (i would prefer not because the game should be fully playable with 1 gamepad at the moment) i'll also move brake and accelerate.
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 14, 2022, 11:55:13 PM
Thanks! The steering/shooting combo for player 1 does work really well if using a dual-stick controller with shoulder buttons. I wouldn't want to disrupt that for other players. After seeing this cabinet's bizarre control setup and before trying it in fbneo, I imagined port 1 as controller for driving and ports 2 and 3 as the guns would be a good setup.
Title: Re: split topic : lightgun issues
Post by: barbudreadmon on January 15, 2022, 07:12:10 AM
The fix is in, supposedly if you have a dpad on your lightgun (iirc that's a thing with recent lightguns ?) you should be able to use it for steering.
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on January 15, 2022, 09:19:17 AM
Thank you! RetroArch does have a general "Gun D-pad" set of inputs. I can indeed assign the D-pad on my gun to that and steer the car now. I noticed that the controller can also now steer in lightgun mode, which is good if someone just wants driving duty while 1 or 2 other players shoot. 😃

The standalone controller mode seems unaffected by these changes, so all seems good now.
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on February 19, 2022, 07:47:42 AM
Hi again,

Is there a way to invert the Y axis in Wild Pilot (wildplt) in the libretro port? I didn't see the option in the dipswitch or the test/service menu.
Title: Re: split topic : lightgun issues
Post by: barbudreadmon on February 19, 2022, 09:53:26 AM
Hmmm, it seems we are hardcoding a reversed y axis when using standard control method (analog stick), which translates poorly when directly injecting coordinates. See https://github.com/finalburnneo/FBNeo/blob/9bcc30c42c696f69eb1cc15e29b21f422b438565/src/burn/drv/pst90s/d_cischeat.cpp#L2730-L2733

I'll try to find a better way around this in the next few days.
Title: Re: split topic : lightgun issues
Post by: barbudreadmon on February 20, 2022, 10:23:31 AM
it should be fine now
Title: Re: split topic : lightgun issues
Post by: StormedBubbles on February 20, 2022, 08:05:06 PM
It is. Thanks again  :smilie: