Beetle-PSX (mednafen_psx) lightgun support - #16170
Draft
TrickoUK wants to merge 3 commits into
Draft
Conversation
Enable support for lightguns in hardware rendering paths, and expose more of the available core specific options via libretroOptions.py. Add the missing mednafen_psx button-remap block in configureGunInputsForPlayer (parity with pcsx_rearmed) plus a gun_type == "justifier" override in the gun_mapping dict, so the real GunCon's 3-button hardware maps onto RetroArch's generic gun scheme instead of falling through to the fully generic default. That alone isn't enough: Beetle-PSX's GunCon/Justifier emulation is hardware-accurate and samples the actual rendered pixel color at the aim position each scanline to simulate the real light-sensor photodiode. That pixel buffer is only populated under the software renderer - under the HW (Vulkan/OpenGL) renderer this fork defaults to, the position never reaches the game at all. Fix via a new source patch, 002-guncon-justifier-hw-renderer-position-fallback.patch, touching mednafen/psx/frontio.c's two *_GPULineHook functions: when the pixel buffer is unavailable (HW renderer), skip the brightness-sampling loop but still set the hit position directly from the computed aim coordinates - the same "trust the raw position" approach pcsx_rearmed/swanstation already use, applied only when real light detection isn't possible. Software renderer keeps full authentic light-sensor behavior.
Contributor
Author
|
@Tovarichtch , heres another light gun related change I'd like you to look at when you have chance, thanks! |
Collaborator
|
I'm very busy with xemu Chihiro for the past month. I will get back to you once I'm finished with initial support and release of the first playtest. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disclosure, this change was done with Claude.
Lightguns currently work when using the software renderer in Beetle-PSX, this change enable them in hardware rendering paths too, and exposes more of the available core specific options via libretroOptions.py.
For gun support:
Add the missing mednafen_psx button-remap block in configureGunInputsForPlayer (parity with pcsx_rearmed) plus a gun_type == "justifier" override in the gun_mapping dict, so the real GunCon's 3-button hardware maps onto RetroArch's generic gun scheme instead of falling through to the fully generic default.
That alone isn't enough: Beetle-PSX's GunCon/Justifier emulation is hardware-accurate and samples the actual rendered pixel color at the aim position each scanline to simulate the real light-sensor photodiode. That pixel buffer is only populated under the software renderer - under the HW (Vulkan/OpenGL) renderer this fork defaults to, the position never reaches the game at all. Fix via a new source patch, 002-guncon-justifier-hw-renderer-position-fallback.patch, touching mednafen/psx/frontio.c's two *_GPULineHook functions: when the pixel buffer is unavailable (HW renderer), skip the brightness-sampling loop but still set the hit position directly from the computed aim coordinates - the same "trust the raw position" approach pcsx_rearmed/swanstation already use, applied only when real light detection isn't possible. Software renderer keeps full authentic light-sensor behavior.
For extra options:
The extra options added have been grouped how they appear in the retroach core settings themselves, I've put the four new options under a "BEETLE SPECIFIC" sub header for clarity. See attached menu.txt file for reference on how they look in terms of layout.
menu.txt
Tested on X86 build with Sinden light gun.