Hello everyone,
You may have seen this awesome tweet. Our friend there had taken a bit of someone else's code and altered it for his use; I just did a bit of the same.
ElRojo MiSTer RFID
I loved the idea, but when I looked at the code, I realized there's a lot of repeated steps when adding games. At first I wanted to write a function so that the case statements just needed to be
When setting up the Arduino, you need to supply a MIFARE card ID to the indicated variable. That sets this card up to be a trigger card (write card, in the code). When that card is scanned, the next card to be scanned is "written" to the currently playing game. Really all it does in the background is say “if the last card scanned was the write card, run a different shell script on the next one.” The script then gets the currently running game by running
), but it works! Cards can also be overwritten by scanning them again. This helps keep the code clean and makes it easy to reassign cards.
Example usage:
After you've set up the Arduino, replaced all the necessary variables etc.
- Boot your MiSTercade or other MiSTer JAMMA expander
- Using the keyboard or controls, load up an arcade game
- Once the game has loaded, scan the 'write card'
- scan the card you want to associate with that game
That's it! To reassign a card, just follow the same steps on a different game.
Here it is in action:
https://twitter.com/connera/status/1559692077406904320?s=12&t=1ez8ZYSaGgd63Tu9LS7PRg
You may have seen this awesome tweet. Our friend there had taken a bit of someone else's code and altered it for his use; I just did a bit of the same.
ElRojo MiSTer RFID
I loved the idea, but when I looked at the code, I realized there's a lot of repeated steps when adding games. At first I wanted to write a function so that the case statements just needed to be
'cardNum' 'gameTitle'
. I then decided to see if I could eliminate needing to manually add lines to the script at all, so I added a bit of logic to both the Arduino code and the shell script. There's pretty exhaustive information in the repo, but I'll give a quick breakdown:When setting up the Arduino, you need to supply a MIFARE card ID to the indicated variable. That sets this card up to be a trigger card (write card, in the code). When that card is scanned, the next card to be scanned is "written" to the currently playing game. Really all it does in the background is say “if the last card scanned was the write card, run a different shell script on the next one.” The script then gets the currently running game by running
ps
, and then there's some string manipulation to pull the filename, build a case statement, and insert it into the main script. It's really simple (I'm admittedly horrible at regex so I went with awk
instead 
Example usage:
After you've set up the Arduino, replaced all the necessary variables etc.
- Boot your MiSTercade or other MiSTer JAMMA expander
- Using the keyboard or controls, load up an arcade game
- Once the game has loaded, scan the 'write card'
- scan the card you want to associate with that game
That's it! To reassign a card, just follow the same steps on a different game.
Here it is in action:
https://twitter.com/connera/status/1559692077406904320?s=12&t=1ez8ZYSaGgd63Tu9LS7PRg
Last edited: