What's new

MiSTer RFID Reader - Extended

TodoRojo

Grand Master
Joined
Sep 12, 2021
Messages
420
Reaction score
953
Location
UT
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 '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 :P), 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
 
Last edited:
Last update for the time being:

This does not currently work with ROMs that use the .bin file to load. That doesn't mean a .bin file cannot be in the rom folder, it just means if you normally boot a rom by selecting its .bin -- that won't be a game you can add via the `write_card`. I believe JP games for the genesis use .bin, for example. I'll need to add some additional logic for handling those.

Currently supported cores / extensions are:

CoreExtensions
Arcade.mra
PSX.cue .chd
SNES.sfc .smc
NES.nes
Genesis.md .gen
 
Last edited:
I just merged a pretty big update to the main branch. This couldn't have been done without the help of a GitHub user named "Coded_with_Claws" (if you're here, /wave, and a big thank you!)

This update now makes the MiSTer RFID reader / writer work with dang near every console/arcade core you can think of and even takes into account nested folders. I have done my own testing and haven't found any bugs; but if any of you do use this and encounter them, I encourage you to create an issue on the repo so that I can take a look.

I know not many people will probably use this feature, but I'm pretty happy with how well it works. I think this solution is a lot easier for people that aren't regular MiSTer users but still want to play all kinds of games (like visiting friends and family). I do have some spare RFID readers and Arduino boards at home. If there's enough interest, I could solder a few of them together and print a case and sell these readers as a kit with the Arduino code preinstalled. It will come with a single RFID card which will be the "write" card.

I will sit down and calculate a price when I’m not inebriated 😅
 
Last edited:
Back
Top