Automated PIN Macro after auto-inserting a card (#698)

## Description of change
Adds a way to automatically use the PIN Macro for P1, P2 or both when
Auto Card Insert is used.

### Launcher changes: 
 - Added a checkbox to enable/disable the feature
 - Added a textbox for each player to set what to look for in the logs.

### How it works:
The feature requires Auto Card Insert and PIN Macro to be enabled and
set.
It uses the Auto Card Insert value to enable the feature for P1, P2 or
both, with a "master" checkbox to completely disable the feature. It
then relies on the current PIN Macro code to send the PIN to the games.

The games logs send a message when a new scene is loaded with the name
of the scene. By hooking on the logs, we can see when a PIN is required
and send the relevant macro. Games have different scene names, and
sometimes one for each player, so the field is configurable per game per
player. These could be hard-coded in a lookup table but I didn't want to
recompile the project every time I wanted to test, and I don't have all
the games to get this info from.

The PIN Macro thread is used to hook to the logs and check if the
defined string appears, which triggers the PIN macro just like a button
press would.

Setting nothing for the log trigger disables the feature for that
player. It's useful if someone wants to have Auto Card Insert enabled
for both players but only Auto Pin on 1 player, but is mainly there so
the check won't happen if nothing is set.

## Testing
I used SDVX and DDR to have a single and a two player test with the
feature both enabled and disabled. I also tested multiple combinations
of PIN Macro settings and Auto Card Insert settings with no apparent
issues. The PIN is automatically entered as soon as the game requests
it.

## Discussion

I know that hooking to the logs might not be the best solution. I'm very
open to discussions about this, and understand that this might be a deal
breaker for this feature. I made this to use with my setup and thought
I'd try opening this PR to see if the feature would be useful for
others.

I haven't found another way to make sure we're on the correct screen to
launch the PIN Macro, and sending the macro every time the Auto Card
Insert finishes had sync issues where the end of the PIN would actually
be registered by the game.

It would also be much more convenient for the users to hardcode a lookup
table for every games' log-trigger but I don't have the games currently
so I can't check the logs to see what would be best.

---------

Co-authored-by: Maxime St-Pierre <maxime.stpierre@ticketmaster.com>
This commit is contained in:
Biduleman
2026-05-25 19:00:06 -04:00
committed by GitHub
parent f69e40fa26
commit c59d399ab8
5 changed files with 77 additions and 3 deletions
+22
View File
@@ -2464,6 +2464,28 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
{"both", ""},
},
},
{
// AutoPinMacroTrigger0
.title = "Auto PIN Macro Trigger Log String (P1)",
.name = "autopinmacrotrigger0",
.desc =
"Substring matched against game log output to detect when Player 1's PIN entry "
"screen is ready. When the substring appears in any log line, the PIN macro is "
"typed for Player 1 only. Leave blank to disable auto-trigger for P1.",
.type = OptionType::Text,
.category = "Network (Advanced)",
},
{
// AutoPinMacroTrigger1
.title = "Auto PIN Macro Trigger Log String (P2)",
.name = "autopinmacrotrigger1",
.desc =
"Substring matched against game log output to detect when Player 2's PIN entry "
"screen is ready. When the substring appears in any log line, the PIN macro is "
"typed for Player 2 only. Leave blank to disable auto-trigger for P2.",
.type = OptionType::Text,
.category = "Network (Advanced)",
},
{
// spice2x_LowLatencySharedAudio
.title = "Low Latency Shared Audio",