mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
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:
@@ -918,6 +918,12 @@ int main_implementation(int argc, char *argv[]) {
|
||||
PIN_MACRO_ENABLED = true;
|
||||
PIN_MACRO_VALUES[1] = options[launcher::Options::Player2PinMacro].value_text();
|
||||
}
|
||||
if (options[launcher::Options::AutoPinMacroTrigger0].is_active()) {
|
||||
AUTO_PIN_MACRO_TRIGGER[0] = options[launcher::Options::AutoPinMacroTrigger0].value_text();
|
||||
}
|
||||
if (options[launcher::Options::AutoPinMacroTrigger1].is_active()) {
|
||||
AUTO_PIN_MACRO_TRIGGER[1] = options[launcher::Options::AutoPinMacroTrigger1].value_text();
|
||||
}
|
||||
|
||||
for (auto &reader : options[launcher::Options::ICCAReaderPort].values_text()) {
|
||||
static int reader_id = 0;
|
||||
|
||||
Reference in New Issue
Block a user