libretro / opera-libretro

Port of 4DO/libfreedo to libretro.
63 stars 36 forks source link

2-players lightgun games #180

Open phasermaniac83 opened 2 years ago

phasermaniac83 commented 2 years ago

Hi! Is this possible? I have read it is currently not working. There are some 3do 2-player games but especially Shootout at old Tucson would be amazing to play with a friend. Thanks

trapexit commented 2 years ago

It's been some time since I worked on the lightgun. There is a bug in the implementation that needs to be worked on but I had thought that 2 player was working. I'll have to investigate. Do make sure that the controller player count is greater than 1 in the settings.

phasermaniac83 commented 2 years ago

Many thanks for the info Trapexit. I tested a little bit more: Mad Dog 2 works for 2 gun players (3do Lightguns). But for me, Shootout old Tucson (Arcade Lightgun) player2 (left side) doesn't work. No aiming nor button presses in service menu or ingame.

Darknior commented 2 years ago

Cool thanks a lot for this report, i will try too. I'm also working for now on Gun configuration for all my emulators :)

jdeath commented 2 years ago

Is there anyway to get the libretro crosshair a little bigger? It is a tiny blue dot for me.

trapexit commented 2 years ago

No. Not currently. IIRC it's a 5 pixel crosshair. Something to just get a sense of where you were. I just mimicked some other core when I wrote it. It is more intended for those mouse based lightguns where you wouldn't be using them. This is using a normal mouse? For games without mouse support?

jdeath commented 2 years ago

Thanks. Sorry to hijack, I'll look around in lr_input_crosshair.* and see if I can make it bigger than 5 pixels. I don't mind compiling my own. I am using it on an arcade setup with a mayflash/wii lightgun. Just starting to use this core, so only tried a couple games and not all the lightgun options. For the couple games I tried, the game crosshair only updates when I hit the trigger, thus the need for bigger crosshair. The wii lightgun is not accurate enough to shoot without it.

phasermaniac83 commented 1 year ago

Hi! Sorry to insist, could you to take a look at this, @trapexit? Shootout at Old Tucson is a good and rare game, would be amazing to be able to play it with a friend. Anyway, did anyone tried to play it 2p? maybe the problem is at my side, I don't know actually.

trapexit commented 1 year ago

I will. I've been busy with other 3DO development. The 3DO dev community is very small and I maintain a large portion of the projects. Only have so many cycles... but it's on my todo.

Darknior commented 1 year ago

I will. I've been busy with other 3DO development. The 3DO dev community is very small and I maintain a large portion of the projects. Only have so many cycles... but it's on my todo.

Thanks a lot. And please, if you can, add a real cross to the 3DO emulator. For now it is only a pixel and for my part i can't see it most of time and games are impossible to play :(

phasermaniac83 commented 1 year ago

Many thanks @trapexit. If you have lightguns @Darknior, I recommend you to play without crosshairs, this way is how (for me) lightgun games are really fun, because with a crosshair you actually don't aim, you only drag the cursor.

Darknior commented 1 year ago

Many thanks @trapexit. If you have lightguns @Darknior, I recommend you to play without crosshairs, this way is how (for me) lightgun games are really fun, because with a crosshair you actually don't aim, you only drag the cursor.

Yes i know, but some time it help if the gun is not fine configured. And i also play gun games with my little girl, and it is very hard for a little children to play without a cross. It help a lot to learn how to use a gun.

trapexit commented 1 year ago

Thanks a lot. And please, if you can, add a real cross to the 3DO emulator. For now it is only a pixel and for my part i can't see it most of time and games are impossible to play :(

Do you have a core that does what you're talking about so I can use it as reference?

jdeath commented 1 year ago

lr-mame, lr-mame2003, nestopia, fceumm have it. Actually, most of the cores listed here: https://wiki.batocera.org/emulators:lightgun_games except stella, vice64, mesen, bsnes Alot of cores have option to turn off crosshair as well.

Darknior commented 1 year ago

Thanks a lot. And please, if you can, add a real cross to the 3DO emulator. For now it is only a pixel and for my part i can't see it most of time and games are impossible to play :(

Do you have a core that does what you're talking about so I can use it as reference?

Nestopia can be a good exemple for you https://github.com/libretro/nestopia/search?q=crosshair

Tovarichtch commented 1 year ago

The best examples for crosshairs are SNES9X and Genesis Plus GX cores. They are just perfect with the correct color and visibility.

trapexit commented 1 year ago

Nestopia can be a good exemple for you https://github.com/libretro/nestopia/search?q=crosshair

https://github.com/libretro/nestopia/blob/9fc815e9d0cf6a166aa2e98c693cd90147d3c4c8/libretro/libretro.cpp#L221

They do pretty much what I do just with black and white and likely bigger.

Darknior commented 1 year ago

Yes, I guess there are not 50 possible methods. Yours works overall well, for me the most embarrassing thing is not having a CROSS on the screen to aim, like with the others, it should be optional if possible. Thanks

trapexit commented 1 year ago

Sure, optional is fine. I didn't make it optional because it was added before mouse based guns became more popular and didn't need them. I'm just trying to get a preferred style. Provide similarity with another core.

StormedBubbles commented 1 year ago

Hello, I wish I could help more with this issue, but I did notice something in this YouTube video. The user is controlling player 1 (left) using the mouse/gun assigned to port 1 (blue crosshair). For me with lr-opera, the port 1 gun controls player 2 (right) in SAOT, and I am unable to control player 1 at all (just like someone else mentioned above).

The most recent changes to the lightgun code were the reload adjustments I made last year, but those should not have affected this behavior at all. Just throwing this out there in case it gives a hint to a solution for 2-player SAOT.

StormedBubbles commented 1 year ago

Wishes do come true sometimes 😆 #185

Codes4Fun commented 1 year ago

I discovered something interesting... currently opera-libretro writes 4 bytes, while portfolio_os reads 5 bytes !

https://github.com/trapexit/portfolio_os/blob/bee7b0c8e4287083c73cb5497b658880c9e7af8e/src/input/LightGunRom.c#L142

I tried modifying opera-libretro to 5 bytes with a zero, and in games when pulling the trigger the screen would flash but no hits... so I set it to one instead and it works as usually. I suspect that means the lightgun hit a scanline on the screen.

I suspect though this is why there may be issues with having a lightgun and a second lightgun/controller at the same time.

trapexit commented 1 year ago

Yes, I've mentioned somewhere that the version of the code implementing the lightgun in Opera is wrong. It was RE'ed in place before I got a signal analyzer and got OS code. I document all the details https://3dodev.com/documentation/hardware/opera/pbus

StormedBubbles commented 1 year ago

@Codes4Fun Hey, I actually got all 2-player lightgun features working for every NTSC console and arcade game (didn't test PAL) and also fixed the offscreen-reloading behavior in Mad Dog McCree and Space Pirates. I made core options to manually set offsets so that you don't have to calibrate. I figured my changes were not what was desired upstream, and I don't really have a full understanding of why it works, so I didn't try submitting as a pull request. But this makes everything playable from what I can tell. I haven't seen anything breaking happen.

I called it a "hacks" branch because I figured that's exactly what I made 😆

Hopefully, there is something useful in the link for others to use and fix up the lightgun implementation here.

https://github.com/StormedBubbles/opera-libretro/tree/hacks

Codes4Fun commented 1 year ago

@StormedBubbles That's awesome ! I do see a potential overflow bug, the buffer size check wasn't updated to 5 for both functions:

https://github.com/StormedBubbles/opera-libretro/blob/55cad4d052080b0f3ef756e742a9baa941871cf7/libopera/opera_pbus.c#L156

I'll try it out !

drewjbx1 commented 6 months ago

@StormedBubbles I came across this trying to find a solution for 2 player light gun support. I am mostly an end-user and know very little about coding, just simple configs and scripting. I did download your opera-hack but do not know how to compile it? I was hoping to simply download a modified opera_libretro.dll file for Win10. Any suggestions or tips would be appreciated!

StormedBubbles commented 6 months ago

Hey, you can compile this using the same instructions as for MAME. Those are the clearest instructions I could find out there on the web. I compiled it for Windows 11 64-bit and tested the result on my Windows 10 64-bit laptop. It seems to operate fine. I can't seem to post a dll here natively, so here's a link to download what I compiled:

https://pixeldrain.com/u/Hf3CCHfN

This contains the various lightgun edits I made for my own build on top of the latest upstream source from the main branch here. I want to reiterate that I do not know how to properly fix the lightgun system and that I happened to find through trial-and-error something that appears to work for me. My hope is that someone nabs the good parts of these edits and does a more accurate take on emulating the lightgun functionality of the 3DO and its derivative arcade hardware.

I think VLDP Pixel Format = XRG8888 and having 2 input devices active are the only changes to default core options I made on my system (I use a Raspberry Pi 5). Other than that, you should just have to enable the 3DO Lightgun (Arcade Lightgun for Shootout at Old Tucson and Mad Dog 2: The Lost Gold [arcade version]) for each player, have the appropriate BIOS, enable the "raw" input driver if using Windows, set your mouse indices, and have at it. For my own convenience, I added manual offset adjustments to the core options so that I wouldn't have to calibrate every game every time.

drewjbx1 commented 6 months ago

Ok I will try this out, originally I do have the 1 lightgun working as the 2nd player with the official core. Would be nice to get this merged into the official for all the lightgun users out there as we always try to get the most possible gun games working correctly. Thanks for the good info and modified core!