What's new

winteriscoming

Champion
Joined
Feb 16, 2016
Messages
1,431
Reaction score
1,157
Location
Indiana, US
Good news on WMMT. I double checked my wiring and plugged into the completely wrong header... X/

What I was receiving looked a little bit better, but didn't seem to be correct because I wasn't seeing what I expected from the end command 03 followed by a meaningful CRC. I messed around with configurations and found that in order for me to read the commands correctly, I had to change bytesize parity:

ID3 is: 9600bps 8E1 (8 data bits, even parity, 1 stop bit)
WMMT is: 9600bps 7E1 (7 data bits, even parity, 1 stop bit)
EDIT:

WMMT is likely: 9600bps 8N1 (8 data bits, no parity, 1 stop bit)


I would guess those DIP switches on the ID3 reader could be configured accordingly, but other than the DOC manual page that MetalliC linked to earlier, I'm not finding any specific documentation on what these switches do. Until that is figured out, I can't verify whether or not this reader would be compatible.


The other thing is that while the protocol may be the same, the exact commands aren't the same as ID3, so my current script can't handle it. I'd have to change up the way I'm reading in what WMMT sends.
 
Last edited:

winteriscoming

Champion
Joined
Feb 16, 2016
Messages
1,431
Reaction score
1,157
Location
Indiana, US
7E1 looks quite weird, did you tried 8N1 ?
Didn't even know NONE was an option... I just tried and that looks like reads in correctly, so is probably the correct setting.

I guess there's hope for a WMMT reader emulator. I would love to be able to configure my reader to work with it and monitor the communications, but may end up being able to try to give responses that worked in ID3.
 
Last edited:

winteriscoming

Champion
Joined
Feb 16, 2016
Messages
1,431
Reaction score
1,157
Location
Indiana, US
Here's version 1.0 of ID3CARDEMU.

Use at your own risk. I have described in this thread the wiring that worked for me and the serial adapter I used. I can't say for sure that it would work with any other adapters or built-in serial ports on laptops without some kind of accommodation for voltage level differences.

I have only tried it on a Windows 10 and Windows 7 laptop with a TU-S9 adapter.

Any of you who are experts at programming will probably laugh at it. Things were probably handled very inefficiently, but it works. :D

Feel free to modify and redistribute without my permission. Please share any improvements with everyone, though.

At this point, I believe the only thing that's untested is what happens at 50 read/write cycles and the inspection period comes up. I'm not that motivated at the moment to try for that.

I don't know if it handles starting a new game and not purchasing a card. That's not something I tested, so it may end up giving a card r/w error if you tried that. If you get a card r/w error, just go into the service menu and exit to restart the game. The script should also probably be restarted when the game is to make sure variables are initialized as needed (though in retrospect, all variables probably should just be getting initialized when the initialize command comes in...)

It's programmed in Python 3, and I don't think is compatible with other Python versions.

Operation is as follows:
ID3CARDEMU.py -cp COM6 -f NEWCARD1.HEX

With -cp you're just specifying the port, no other info. Everything else defaults to what it should be.

With -f you're specifying the card file name.

If you want to make a new card, just specify a file name that doesn't exist and it will create the card and only allow you to start a new game. If you specify a card file that contains data, it will automatically insert it after you push start.

You have to restart the script to change cards. It should be possible to restart the script during game over mode, but do it quickly as sometimes there is random communication between the game and the reader, and it will give an error if it doesn't get a response back in time.

I haven't done much long-term testing, so not sure if random commands come back at points in the game and I have no response for them.

I only tested it with ID3, so not sure how compatible it is with ID1 and 2. It's likely not compatible with other card r/w games, as I briefly tried it with WMMT and it gave slightly different commands than this script was expecting.
 

Attachments

  • ID3CARDEMU.zip
    4.5 KB · Views: 233

winteriscoming

Champion
Joined
Feb 16, 2016
Messages
1,431
Reaction score
1,157
Location
Indiana, US
I figured out the DIP settings to get the ID3 reader into 8N1 mode and it communicates with WMMT now!

It succeeds during initialization, but It fails most of the tests, though, and likely would need different firmware... :(

I don't think the current reader is going to help me make an emu for WMMT.

For WMMT, the settings are changed on DIP 1:
1. OFF
2. ON
3. OFF
4. OFF
5. OFF
6. ON
7. ON
8. OFF

It was formerly on the following settings for ID3:
1. OFF
2. ON
3. ON
4. OFF
5. OFF
6. ON
7. ON
8. OFF

Metallic, where are you finding the source for Dolphin Triforce branch? I'd be curious to look over it.
 

gamemaster14

Enthusiast
Joined
Feb 23, 2016
Messages
295
Reaction score
55
Location
The Game Nexus (USA)
Glad to see you released it, If I have time tonight I will rig up the serial cable and see what I get since my Naomi 2 Has Initial D 3 already loaded in it (just need to change the serial jumpers under the dim board), Just need to get that crazy large control panel on my desk and do some play testing, not sure at the moment what serial cable I am going to cannibalize in order to do this but I will dig through my old box of junk cables and find one. I also have some junk arcade harness that should have the proper jst connector for the Naomi side, I will report back my results when I get it all up and running. Thanks again for all your work.
 

twistedsymphony

Enlightened
Staff member
Immortal
Joined
Jul 21, 2015
Messages
10,870
Reaction score
11,269
Location
NH, USA
I got my serial adapter over the weekend, but I also got my Lindbergh Multi-kit in so I spent my free time playing around with that :)

Not sure if any of the Lindbergh games uses a similar style card reader but I'd be able to test those too.

Also @winteriscoming If you've got a Chihiro it'd be worth checking the card reader compatibility with Ghost Squad, as I believe that game supports similar style cards.
 

winteriscoming

Champion
Joined
Feb 16, 2016
Messages
1,431
Reaction score
1,157
Location
Indiana, US
So far WMMT on Chihiro is proving to be a pain.

I am handling data flow differently in WMMT. ID3 allowed me to be sloppy, but WMMT doesn't seem to like that.

As MetalliC mentioned much earlier when commenting on my odd ID3 responses, the flow should be:
Game sends command
Reader replies 06 to indicate receipt
Game polls status with 05 (and keeps polling until it's satisfied with final response)
Reader replies to each polling command with status

I can't figure out correct replies to the 78 command that comes in right at boot.

Assuming the Triforce games would work the same as the Chihiro games: If I'm reading the source code for Dolphin - Triforce branch correctly, they reply to 78 commands with:
02 [LEN] 78 00 00 30 00 03 [CRC]

Which I'm calculating as:
02 07 78 00 00 30 00 03 4C

I also tried:
02 06 78 00 00 30 03 4D

After I send that status, the game stops polling and eventually gives a R/W error.

The only thing I've been able to successfully do is get through the initialization test.
 

winteriscoming

Champion
Joined
Feb 16, 2016
Messages
1,431
Reaction score
1,157
Location
Indiana, US
I just found a listing for a WMMT reader on eBay and purchased it. From the pictures, I can tell the ROM is different.

I'll use it to sniff the communication for WMMT and make an emulator for it using the same method I did for ID3. I may also experiment with swapping the WMMT rom into the ID3 reader to see if that makes it work.

My assumption is that WMMT can use the same cards (currently have a large stock of DOC cards I'm using in ID3), but I ordered a few WMMT cards, just in case.
 

MetalliC

Grand Master
Joined
Nov 19, 2015
Messages
1,267
Reaction score
1,199
I can't figure out correct replies to the 78 command that comes in right at boot.Assuming the Triforce games would work the same as the Chihiro games: If I'm reading the source code for Dolphin - Triforce branch correctly, they reply to 78 commands with:02 [LEN] 78 00 00 30 00 03 [CRC]Which I'm calculating as:02 07 78 00 00 30 00 03 4CI also tried:02 06 78 00 00 30 03 4D
is everything ok with you ? you have to return to my original message with packet format description ;)

generic (if command do not expect specific card sensors state) 'OK' reply is
02 06 cmd 00 30 30 03 crc
there is "00" - sensors state, 30 - ok/err state (not equal to 30 means error happened), next 30 - command execution state (30 = completed)

so it must be
02 06 78 00 30 30 03 7D


PS: speaking of this particular MarioKart/WMMT reader - its possible there is slightly different sensors bits.
3 MSB bits (hopper and front door) is same.
but LSB bits may be different, much simpler than ID1-3 CRW, like 1 - card inserted in front; 3 - card pulled in reader

cant be 100% sure here, because crediar's work you can see in Dolphin sources is pure software analysis, so real thing may work different.
 
Last edited:

winteriscoming

Champion
Joined
Feb 16, 2016
Messages
1,431
Reaction score
1,157
Location
Indiana, US
so it must be
02 06 78 00 30 30 03 7D
That one didn't work for me.

I played around with it more, and the following let me get the game to boot:
02 06 78 31 30 30 03 4C

Though it wanted me to eject immediately after.

but LSB bits may be different, much simpler than ID1-3 CRW, like 1 - card inserted in front; 3 - card pulled in reader
I have been playing around with inputting 1, 2 and 3, etc. I think you're right about that. It wasn't until I put "1" in the 78 reply that it accepted it.

Here's the log that lets me get through boot and into game over mode:
2016-03-15 13:15:34.684473: Chihiro
02 07 10 00 00 00 30 03 24
Received Initialization command!
Reader Emulator: Sending: 06
2016-03-15 13:15:35.073495: Chihiro
05
Reader Emulator: Sending INIT: 02 06 10 A0 30 30 03 B5
2016-03-15 13:15:35.259506: Chihiro
02 0C 78 00 00 00 37 31 34 30 30 30 03 75
Received 78 command!
Reader Emulator: Sending: 06
2016-03-15 13:15:35.647527: Chihiro
05
Reader Emulator: Sending: 02 06 78 31 30 30 03 4C
2016-03-15 13:15:35.872541: Chihiro
02 06 80 00 00 00 03 85
Received 80 command!
Reader Emulator: Sending: 06
2016-03-15 13:15:36.068553: Chihiro
05
Reader Emulator: Sending: 80 Reply: 02 06 80 30 30 30 03 B5
2016-03-15 13:15:36.236562: Chihiro
05
Reader Emulator: Sending: 80 Reply: 02 06 80 30 30 30 03 B5

I may end up waiting until my physical reader gets in before I experiment further. This game is sometimes bad about incorrect replies and freezes up.
 

MetalliC

Grand Master
Joined
Nov 19, 2015
Messages
1,267
Reaction score
1,199
I played around with it more, and the following let me get the game to boot:02 06 78 31 30 30 03 4C
yep, right.

WMMT uses slightly different CRW model - CRP-1231LR-10NAB (ID uses CRP-1231BR)
the difference is only reply Result1 byte, from Google-translate:
H30 No device in the card
H31 Apparatus card There 1
H32 Card status abnormal
H33 Apparatus card There are two
H34 Insertion slot card residual

so it seems normal usable values 30 (no card), 31 (card inserted, it is in your reply), 33 (card pulled inside reader)
the rest of protocol is the same

btw, as I see Japanese Derby Owners games expecting same Result1 reply, so most likely "LR" reader was used there as well.
 
Last edited:

MetalliC

Grand Master
Joined
Nov 19, 2015
Messages
1,267
Reaction score
1,199
most interesting for me was part of the doc describing read 33 and write 53 commands parameters.
it appeared this magnetic card consists of 3 data tracks, each 69 bytes.
in read/write cmd parameters can be selected which exactly "tracks" must be read or written.

so for example
33 00 00 00 30 31 36 (in Initial D)
means:
30 - standard 69 byte format,
31 - 8bit encoding
36 - read all 3 tracks ie 69*3 = 207 bytes

with other 3rd parameter number particular "tracks" of card can be R/W separate.
 

winteriscoming

Champion
Joined
Feb 16, 2016
Messages
1,431
Reaction score
1,157
Location
Indiana, US
WMMT uses slightly different CRW model - CRP-1231LR-10NAB (ID uses CRP-1231BR)
the difference is only reply Result1 byte
Do you think that is all driven by the ROM rather than the physical hardware? Like if I put a WMMT rom in the ID3 CRW, it might work correctly?
 

MetalliC

Grand Master
Joined
Nov 19, 2015
Messages
1,267
Reaction score
1,199
highly possible, but its hard to say for sure.

as I see Sanwa doc is missing D0 (door open/close) command, so possible "LR" reader more different, and does this automatically (or doesn't have front door at all?)
 

winteriscoming

Champion
Joined
Feb 16, 2016
Messages
1,431
Reaction score
1,157
Location
Indiana, US
highly possible, but its hard to say for sure.

as I see Sanwa doc is missing D0 (door open/close) command, so possible "LR" reader more different, and does this automatically (or doesn't have front door at all?)
Well, whether or not it was necessary, I'll have both reader units and will compare when I receive the one I ordered. While it might not be that relevant to this emulation project, it might be nice to have that information documented for those looking for physical hardware.

Mario Karts in the US didn't come stock with CRW units, so even though it would work with them, I doubt there's much demand since people don't know about it.

One day I'd like to buy a Triforce and hope my WMMT card reader emulator works with it. :)


Here's a page with some various arcade cards displayed:
http://www.arcadebelgium.be/ab.php?l=en&r=gam&p=iccards

I believe all the cards that have printed data on the front and a silver back are basically the same kind of card and are probably cross compatible with games that use this kind of card. I would think the only unintended consequence would be that one game prints text in an area that's not white, but the printed text has nothing to do with the stored data, AFAIK.
 
Top