Skip to content

USB: Dual Cursor Lightgun - #12697

Draft
RedDevilus wants to merge 3 commits into
PCSX2:masterfrom
RedDevilus:MinorUSBFixes1
Draft

USB: Dual Cursor Lightgun#12697
RedDevilus wants to merge 3 commits into
PCSX2:masterfrom
RedDevilus:MinorUSBFixes1

Conversation

@RedDevilus

Copy link
Copy Markdown
Contributor

Description of Changes

There seems to be an issue with how the MTGS handles the enumeration and drawing, updating for the replaced crosshairs icons that the users provides like in a .png format. Master would be random but tends to only show USB Device 1 crosshair. But now 2 at same time should work. Hopefully gets rid of #11423
2025-05-23_03-36
2025-05-23_03-35
2025-05-23_04-28

Rationale behind Changes

The niche lightgun users also using niche dual replaced icons was certainly a bug as you get ghost inputs if not the texture was carefully drawn.

Suggested Testing Steps

Normal games work, but best in any game that uses GunCon2 aka lightgun games.

Did you use AI to help find, test, or implement this issue or feature?

No, this mess is my own.

@JordanTheToaster JordanTheToaster added this to the Release 2.6 milestone May 23, 2025
@bslenul

bslenul commented May 23, 2025

Copy link
Copy Markdown
Contributor

Thanks for the PR! ❤️

It seems to work fine for me with any renderer but GL, when using GL I'm getting a crash on game start:

GL-crash.zip

@lightningterror

Copy link
Copy Markdown
Contributor

@bslenul Can you create a gs dump with a renderer that works where it would crash and post it here?

@bslenul

bslenul commented May 23, 2025

Copy link
Copy Markdown
Contributor

Sure, this is with "Automatic" (so VK in my case): gun-gs-dump.zip

The dump loads fine with all renderers expect GL (as long as I use at least 1 PNG as a crosshair).

@lightningterror

Copy link
Copy Markdown
Contributor

Dump works fine here, are you sure this dump crashes on gl?

image

@bslenul

bslenul commented May 23, 2025

Copy link
Copy Markdown
Contributor

It won't crash unless you've set a PNG crosshair, which I can't see on your screen.

Basically it looks like this for me with anything but GL (notice the crosshairs in the middle of the screen):

image

edit: Updated screenshot with OSD stuff.

@lightningterror lightningterror left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UpdateSoftwareCursorTexture has to run on the GS thread for thread safety, otherwise it causes race conditions on OpenGL where you create texture without a valid context. All GL API calls must happen on the GS thread.

Try

	if (MTGS::IsOpen())
	{
		MTGS::RunOnGSThread([index]() {
			UpdateSoftwareCursorTexture(index);
		});
	}

@bslenul

bslenul commented May 23, 2025

Copy link
Copy Markdown
Contributor

Can confirm, no more crash with GL with that change! 👍

@bslenul

bslenul commented May 23, 2025

Copy link
Copy Markdown
Contributor

Unrelated with that last change, but any idea why I'm getting this with this PR when running a Debug build?

image

image

@bslenul

bslenul commented May 23, 2025

Copy link
Copy Markdown
Contributor

Can confirm, no more crash with GL with that change! 👍

Argh, no more crash but now P2 cursor doesn't always appear again.

@RedDevilus

Copy link
Copy Markdown
Contributor Author

Can confirm, no more crash with GL with that change! 👍

Argh, no more crash but now P2 cursor doesn't always appear again.

Yup, if you have both crosshairs images with that fix in, it just reverts behaviour. Only shows first player crosshair and before showed both.

Comment thread pcsx2/ImGui/ImGuiManager.cpp Outdated
@gamerx1-cyber

Copy link
Copy Markdown

Is this also related to #4472

@RedDevilus

Copy link
Copy Markdown
Contributor Author

Is this also related to #4472

This doesn't touch firewire and iLink, those are just stubbed aka placebo files in the codes still so we don't do that functionality.

It's just visual indicators for custom crosshairs which doesn't affect in-game parts.

@gamerx1-cyber

Copy link
Copy Markdown

Is this also related to #4472

This doesn't touch firewire and iLink, those are just stubbed aka placebo files in the codes still so we don't do that functionality.

It's just visual indicators for custom crosshairs which doesn't affect in-game parts.

Ahh I see, thank you

@RedDevilus
RedDevilus marked this pull request as draft May 31, 2025 00:36
@RedDevilus
RedDevilus marked this pull request as ready for review May 31, 2025 16:20
@bslenul

bslenul commented May 31, 2025

Copy link
Copy Markdown
Contributor

With the latest changes PCSX2 hangs for me with custom crosshair PNG when launching a game in Big Picture mode.

There seems to be an issue with how the MTGS handles the enumeration and drawing, updating for the replaced crosshairs icons that the users provides like in a .png format. Master would be random but tends to only show USB Device 1 crosshair. But now 2 at same time should work. Hopefully gets rid of PCSX2#11423
TheLastRar: '

This issue of the missing P2 cursor seems to be caused because the GS (and thus MTGS) gets reset shortly after USBopen, causing the command to get dropped.

Putting MTGS::WaitGS() at the end of this function (after the closing bracket for MTGS::RunOnGSThread()) seems enough to fix this.'

Didn't see where it lost the textures before but I did identify it was happening on the MTGS thread somehow. If you uncommented it, it did work but then you get issues with OpenGL renderer.
FSUI waits on itself when switching/launching games in gamelist section but fine in Qt version.
@Mrlinkwii Mrlinkwii removed this from the Release 2.8 milestone Apr 29, 2026
@Mrlinkwii Mrlinkwii added this to the Release 2.X milestone Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants