What's new

winteriscoming

Champion
Joined
Feb 16, 2016
Messages
1,413
Reaction score
1,115
Location
Indiana, US
I wonder if it would have the same effect on a non-erasable thermal print. I suppose it might have to do with how dirty the print head is. But, given that it's done after a long period of time (i.e. over an hour and likely spanning between multiple play sessions if card were ejected in between), I wonder if it produces a noticeable difference. Say it had printed once and I ejected my card and see it has a star. Am I going to notice if I insert it to play at a later point and it prints over top of that star at some point before I eject and look at it again? Even if it made it darker, I'm probably not going to know unless I get another star next to it that's lighter. If that was the intention, I would think a better method would have been to print a star outline and then fill it in on a later print to indicate progress. Hard to say what the intention was.

I've got a physical reader, but am not able to run any tests for this any time soon.
 

stj

Grand Master
Joined
May 4, 2017
Messages
1,251
Reaction score
502
Location
England
the 2 screwdriver ajusted resistors near the heatsink
 

chunksin

Professional
Joined
Jan 21, 2017
Messages
190
Reaction score
361
Location
Birmingham, UK
I'm just not good enough to generate two stars at the same time! Will keep practising but for now I can add the stars from the print packets together and generate them on the card via an integer easily enough.

While the card reader emulator scripts work really well and the result of I don't know how may hours of work (massive thanks to all involved!), one thing that's bugged me is that you always have to start the script with either a saved card file or a new blank one. I've been thinking how I could modify the scripts for a scenario where someone for example has an ID cab and is auto netbooting the game for convenience, they will need to have prechosen their card as the game needs the script running when it boots. Better to let the game boot into attract mode normally and act as if it has no card inserted and allow the player to decide which card to use when they start playing.

So the idea I've got is to run it more like an original cab and allow a card file to be virtually inserted and accepted by the reader at the insert card screen, this way you could use several methods to trigger a card insertion, you could choose via the netbooter web interface in real time that copies a file into a drop folder for processing or maybe using an NFC card to either hold the card save data (although write back might be a challenge, rest it on top of the reader/writer until after the save process is complete?) or simply be linked via it's UID to a card save file on the netbooter so a tap of the card would load the respective save file. If the insert card timer runs down, default to the option to purchase a card and create an auto generated file to save to.

I've managed to get the code working using a polling queue and a drop folder, working out the correct statuses to assign for the card added on the fly was tricky but it seems to be quite happy. Next challenge is to hook up an NFC reader and see if I can trigger a card insertion using that, I have zero experience with the technology so it will be a nice challenge!

Attached is a work in progress, needs a bit more work on file handling to make sure files are where they should be at the right times but I can start this with no filename specified, then at the insert card screen drop a valid save file into the activecard folder during the 10 second countdown and the emulator script picks it up, loads it in and saves it at the end of play.

Edit: I really should have read the previous posts here, I only skimmed looking for technical nuggets of info - looks like this discussion happened about 4 years ago! LLCP and Web NFC look promising
 

Attachments

  • id2cardemutest.txt
    39.6 KB · Views: 13
Last edited:

winteriscoming

Champion
Joined
Feb 16, 2016
Messages
1,413
Reaction score
1,115
Location
Indiana, US
allow a card file to be virtually inserted
This is how I'm doing it in the frontend I put together. I have implemented user profiles and individual card files per profile, so you load up your profile and select your card that will be virtually inserted when the game asks for it. Though I've only got that working for wmmt 1-3dx+ at this point. I also manage card expirations and renewals.
 

chunksin

Professional
Joined
Jan 21, 2017
Messages
190
Reaction score
361
Location
Birmingham, UK
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: 15
Last edited:

chunksin

Professional
Joined
Jan 21, 2017
Messages
190
Reaction score
361
Location
Birmingham, UK
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:

djsheep

Multi Boyz Overlord
Immortal
Multi Boyz
Joined
May 20, 2016
Messages
6,006
Reaction score
8,942
Location
Brisbane, Australia
Dunno if it helps, but I can use my iPhone to write Amiibo cards which are also NTAG215.
 

chunksin

Professional
Joined
Jan 21, 2017
Messages
190
Reaction score
361
Location
Birmingham, UK
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.
 

LayeredRx

New User
Joined
Sep 20, 2021
Messages
1
Reaction score
1
Location
USA
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.
 

zero238

Grand Master
Joined
Nov 3, 2015
Messages
1,094
Reaction score
623
Location
Raleigh, NC
I have fzero cards if you needs scans of them. They might be potato quality though.
 

chunksin

Professional
Joined
Jan 21, 2017
Messages
190
Reaction score
361
Location
Birmingham, UK
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
 

chunksin

Professional
Joined
Jan 21, 2017
Messages
190
Reaction score
361
Location
Birmingham, UK
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:

sTo0z

Beginner
Joined
Sep 19, 2016
Messages
23
Reaction score
12
Location
Massachusetts, USA
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? :(
 

stj

Grand Master
Joined
May 4, 2017
Messages
1,251
Reaction score
502
Location
England
does the triforce have any jumpers near the serial port?
i know the niomi has jumpers to configure for rs232 or rs422
 

rtw

Champion
Joined
Sep 28, 2015
Messages
1,312
Reaction score
1,328
Location
Norway
That is only the NAOMI 2, stock NAOMI 1 is only RS422.
 

MetalliC

Grand Master
Joined
Nov 19, 2015
Messages
1,229
Reaction score
1,118
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.
 

sTo0z

Beginner
Joined
Sep 19, 2016
Messages
23
Reaction score
12
Location
Massachusetts, USA
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?
 

sTo0z

Beginner
Joined
Sep 19, 2016
Messages
23
Reaction score
12
Location
Massachusetts, USA
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.
 
Top