-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emulate a phazer with the mouse #34
Comments
Similar devices (would be nice for support to be generic enough to emulate any of them): |
And another one mentioned in #214: |
amstrad cpc has this guns that i know: Any possibility to add mouse / actual guns support? i have a sinden lightgun and will be a very nice nostalgia moment Best regards |
Right, the Westphaser: I'll look into mouse support when time permits. It should work for Sinden lightgun too as it behaves as a mouse. |
thanks a lot, i have a arcade machine with retroarch so if you compile it in libretro core for windows i appreciate so much Sorry for a lot a requests Edit: sorry refloating this topic, any news about phaser support? |
Sorry, any news on lightguns support? i know it's not prioritary but i hope some day |
I gave it a try but couldn't find a clean way to do it. We'd need to activate the input (Joystick Up, Joystick Down, CRTC Light Pen Input depending on the model emulated) at this place in the code: Line 1066 in ac440f5
This would require identify which pixel we're drawing which, interestingly, is not that easy in the current code.
I'm not 100% sure how well this would work. I'd need a game, or even better a test program to validate it. I'm not sure if we can do better. This code would need some better documentation which, at this point, means some reverse engineering. I'll see if I find some time to give it a try in the coming weeks. |
thanks a lot. For a reference, the real hardware when you push trigger gun the game shows white rectangles on shootable objects. If the gun sees this white bright rectangle, then impacts. Every rectangle is shown in order. for example, if you have 3 objects, when you pull the trigger, 3 rectangles appear but not at the same time, if the gun sees one in that frame time, the object is hit. Maybe you can trace this rectangles too and if the cursor mouse is in on one of them at the proper time it hits This is high level function, how to implement it i don't know Sorry my english |
That's not how emulation works :-) I have to emulate what the hardware is doing. The rectangles are drawn by the software running on the CPC. What I need to do is:
My assumption that it's not possible to have a precision to the pixel is confirmed by the technical specifications:
|
I started to look into this and the first finding is that it requires specific games to support it. For example, the Magnum Phazer was sold with 6 games supporting it: This can be found in ROMs where there are many versions and one is identified as the LIGHTGUN one: When trying it on Caprice, every other frame is completely white. Not sure whether it's a bug in Caprice or a consequence of not having a Phazer "plugged". Testing another game ("Mission" on the compilation disk) there's the same huge white rectangle in the whole area where you can shoot every other frame. IIUC, these white areas should only display when pressing the phazer button? |
here in spain we have "gunstick" with games like: Bestial Warrior and that i remember, when you press the trigger the white areas flash very quick and in order, and the gun if sees one, send the message to computer that can determine what objet is hit by the frametime gun says it saw a white rectangle PD: i loaded target plus in retroarch caprice 32, and every time i press the button white squares flashes |
So, good news is that I have some code that works for one gun (Amstrad Magnum Phazer) with one game from the compilation (Mission) when running in windowed mode. I know this sounds promising, but it relies on some weird hardcoded values and there's still a lot of things that are not well understood... In particular, it doesn't work in mode 0 (and probably not in mode 2). It doesn't work in fullscreen (because the mouse coordinates are different in this case). And I'm pretty sure it wouldn't work well with overscan or other weird CRTC parameters. |
thanks a lot for the effort It's more difficult than i thought |
I'm currently testing for light gun support on a frontend I'm helping with and I'm very interested to see where this is going ! Caprice32 with light gun support would be amazing for GX 4000 / CPC+. I wish I could help, but I have no coding knowledge. |
Experimental support is now in for Amstrad Magnum Phaser (https://www.cpcwiki.eu/index.php/Amstrad_Magnum_Phaser). To try it, press Shift+F7 and use the mouse. This requires games that specially support the Amstrad Magnum Phaser (and not another lightgun as these are likely working differently) |
Great news ! I would love to try it, but latest release on Windows is from november 2021. Sadly, I don't know how to compile myself. If you can update the binaries so I can test it, that would be great ! |
Yeah Windows release was broken. There were multiple issues but it's now fixed: |
Added the support for Trojan Light Phazer. I tested it with all the supported games:
|
I've tested the same games as you listed above my comment, plus the other unsupported ones (West Phaser and Gunstick games). Good news is : Amstrad Magnum Phaser and Trojan Light Phazer games are working very well ! So I confirm your play test. Trojan Light Phazer does trigger the fire for Gunstick/West Phaser light gun games. That's at least something to look into. Almost working. Well done on adding light gun support ! I know people that will be really happy to hear that. |
Yeah Gunstick works differently. I don't yet understand how, it's very poorly documented. |
You are right. Almost all the docs are in spanish with almost no details. Several emulators have this integrated already like CPCEC, CPCEPower, CaPriCe Forever and even WiiTuka (for Wii), maybe their code could reveal something interesting ? There are lot of links in the description of this youtube video with a full demonstration of the hardware here. |
Yeah I was having a look at WiiTuka but I'm not sure whether their implementation is really faithful to the hardware. I'll check how the other emulators implement it. |
Detecting the clicked (or hovered ?) pixel and setting the light pen input high when the CRTC reaches it:
http://www.cpcwiki.eu/index.php/Trojan_Light_Phazer
The text was updated successfully, but these errors were encountered: