What's new
Should really move away from reply attacks like these scripts use.
I agree but I'm afraid my programming skills are not up to that!

I've updated the ID script to handle the classic start up mode and the on demand drop folder method when a filename is not provided, the id_card_data scripts referred to are generating my php card data based on the game type. I should be able to condense it down to a single script for the emulator and one for processing the print data. I've tested it pretty extensively with ID, ID2 and ID3 and I think I've covered most scenarios, once a card is saved and ejected, the data is cleared so it's ready to accept another card. Card names are generated automatically in a very simple format at the moment, I'll add a card management function into the web front end for backup and deletions.
 

Attachments

  • idcardemu.txt
    41.8 KB · Views: 117
Last edited:
I picked up a cheap NFC card reader/writer last week along with some NTAG215 cards for testing integration with the card emulator, I was hoping to use nfcpy/pynfc but I found out afterwards that the reader I bought was specifically listed as not recommended! It's an ACR122U which is probably the cheapest USB reader you can buy and is fully supported on raspbian buster. I've managed to get the card data written to the card and read back in the correct formats, I'm using a python library called pyscard which has lots of functionality but is pretty low level and really only handles the communications side, I had to dig into the card reader manual for the commands and build them on the fly. It certainly looks like it's going to work and write backs are handled with no problem, you can rest the card on the reader during play and my script makes the light flash red and beep three times when the card is being written to and the script will also wait for the card to be present if it's been removed before saving. Screenshot below shows the binary card data and a sample php file I generated for the card printing. I'll add a check card function in the web frontend so you can scan a card and it will show a printed version in the browser, the card data can either be saved on the card only or to both the Pi and the card.

The end game with be if you have an ID/ID2/ID3 cab you can power on the cab, auto netboot the game, the card emulator script will start up and you can swipe your NFC card with your save data on without having to interact with the Pi at all :D I picked up a Triforce last week so will start working on F-Zero AX card printing once the ID scripts are all complete and tested.

1632214422802.png
 
Last edited:
Dunno if it helps, but I can use my iPhone to write Amiibo cards which are also NTAG215.
 
Web NFC via Chrome looks like it might work, it supports writing and reading NFC via NDEF, the only caveat being you need to be using SSL to drive it from the netbooter web frontend. That would be super slick though, only issue is certificate issuing and updates from a trusted public CA.
 
I picked up a cheap NFC card reader/writer last week along with some NTAG215 cards for testing integration with the card emulator, I was hoping to use nfcpy/pynfc but I found out afterwards that the reader I bought was specifically listed as not recommended! It's an ACR122U which is probably the cheapest USB reader you can buy and is fully supported on raspbian buster. I've managed to get the card data written to the card and read back in the correct formats, I'm using a python library called pyscard which has lots of functionality but is pretty low level and really only handles the communications side, I had to dig into the card reader manual for the commands and build them on the fly. It certainly looks like it's going to work and write backs are handled with no problem, you can rest the card on the reader during play and my script makes the light flash red and beep three times when the card is being written to and the script will also wait for the card to be present if it's been removed before saving. Screenshot below shows the binary card data and a sample php file I generated for the card printing. I'll add a check card function in the web frontend so you can scan a card and it will show a printed version in the browser, the card data can either be saved on the card only or to both the Pi and the card.

The end game with be if you have an ID/ID2/ID3 cab you can power on the cab, auto netboot the game, the card emulator script will start up and you can swipe your NFC card with your save data on without having to interact with the Pi at all :D I picked up a Triforce last week so will start working on F-Zero AX card printing once the ID scripts are all complete and tested.
This is actually my goal down the road also. except I wanted to look into a basic android app for the cards so you could switch between them on you phone, and hopefully leverage the printing to show the image of the card too.

On that note I have been very slowly working through the script to make more of a state based emulator to try to better simulate the card reader. I don't actually own a cabinet but have a friend who has one without a card reader. hopefully Ill get it closer to a usable state and maybe one of you will be able to work with me to test it out.
 
I have fzero cards if you needs scans of them. They might be potato quality though.
 
I have fzero cards if you needs scans of them. They might be potato quality though.
Thanks very much, I may take you up on that, have some feelers out already
This is actually my goal down the road also. except I wanted to look into a basic android app for the cards so you could switch between them on you phone, and hopefully leverage the printing to show the image of the card too.

On that note I have been very slowly working through the script to make more of a state based emulator to try to better simulate the card reader. I don't actually own a cabinet but have a friend who has one without a card reader. hopefully Ill get it closer to a usable state and maybe one of you will be able to work with me to test it out.
I'd be happy to help with any testing you need doing, drop me a PM when you're ready

Quick update on NFC progress, my card write code worked fine but I had to rewrite the card reading process from scratch as I'd approached it all wrong, it worked for a single good read but if a partial read happened due to the card being removed too early the script would stall. All working well now, just need to finish the writeback workflow:

View: https://youtu.be/gZXR5f0oqEM
 
Turns out adding NFC into the workflow caused all sorts of issues around renewals and upgrades but all working OK now based on my testing. If a card is inserted using a physical NFC card, the card data is always saved back, including the new copy of the upgraded/renewed card. A copy is also backed up locally on the Pi and if inserted via the web interface it won't attempt to write it back to an NFC card so there is no risk of accidental overwrites. If there is already a card inserted into the reader emulator you can't overwrite with another one until it goes through the ejection sequence and bad data/blank cards/partial reads are all handled by a separate script running in the background with specific beep and light codes. I've also added a card management function where you can remove used cards and copy any stored on the Pi to an NFC card plus check the existing contents of a card which uses the print engine to display the correct version and data. To insert an NFC card you can hold it over the reader or place it on the reader during play, write back is automatic and you have 10 seconds after the card ejection screen to update your card if you've removed it - easiest option is to leave it on there!

It's pretty much ready for release and I'll share all code via GitHub - doesn't make sense to attach it here as a lot of it will seem out of context due to references to ancillary scripts and flags.

Edit: forgot to mention, I found on the Pi that the emulator script pegs one CPU core at 100% which isn't good on a Pi4 that gets quite hot, I introduced a 1ms sleep between serial reads that dropped CPU down to 9% on one core. The upshot is on card print packets I receive an additional 05 at the start of the packet which I ignore in processing
 
Last edited:
I am trying to use the MKGP card emulator but only receive "E51 CARD R/W LINK ERROR" when attempting to use the card reader.

I know my cable I made works because I also use it for Wangan and works 100% fine.

Is there something I'm missing or something else to try? Or is my Triforce damaged? :(
 
does the triforce have any jumpers near the serial port?
i know the niomi has jumpers to configure for rs232 or rs422
 
That is only the NAOMI 2, stock NAOMI 1 is only RS422.
 
right, for RS422 there should be some chip physically implementing it, like 315-6146 MCU in NAOMI, or 315-5338A or 315-5649 I/O controllers. as far as I know Triforce base board have none of these.
 
And just to make sure I cover absolutely everything, even the dumb stuff, let me ask a couple dumb questions.

There's no issue that this is a Type 1, right?

And I assume I'm reading the pins correctly, and the #1 pin starts on the right. So pin #3 is the 3rd from the right, yes?
 
I wasn't aware Mario Kart could even run on a Type 1. Are you getting it to run without the card reader enabled?

Yes it runs completely fine. I was also surprised by this but OpenJVS dev @bobbydilley made me aware that it runs fine, and I am able to netboot it without issue.
 
Hi! :)

Still not a Card Reader emulator for Cobra The Arcade on Namco System 246/256 or a Patched Dongle ?
 
patched dongle?
you mean there is a flag to enable/disable card readers in the dongle??
 
Well I decided to re-do my cable to prepare it for F-Zero to test that.

F-Zero acts a little wonky but seems to accept, and I went back to test MK1/2 with the new cable and seems to work fine now!

Can’t really explain that, but I’ll consider it a win.. :D

I think I’m all good now!
 
I've started work on F-Zero AX and wow, what a game! not played it much before and it plays really well. I've managed to extract the card icons from the game code so far and done a bit of work on the workflow, it'll be more of a challenge than the ID games as the font icons don't all load up front, they are loaded on demand based on what is about to be printed on the card, plus it prints in three separate messages for each area of the card. Lots to think about ...

1633393877181.png
 
After a week of head scratching I'm starting to get somewhere, I've got the main emulator script to process and export the font packet data into a csv file, that then act as a real time reference as to which icon is currently in which font slot. If more font information appears later on, the originals get bumped out of the file if they occupy an incoming slot. Then I run another script after the print packets appear that captures them and holds a master reference of all the icons based on their hex values. Compare the two and it generates a single character in the correct location for each icon. I've created a custom font using font forge with all of the 62 images in, a-z, A-Z and 0-9 cover them all. Hopefully I'll have some real card print images to share over the weekend with a code release next week if all goes well.
 
Back
Top