GXTX / YACardEmu

Software emulator for Sanwa CRP-1231BR-10 / CRP-1231LR-10NAB / CR-S31R-10HS3 card readers.
GNU General Public License v2.0
32 stars 10 forks source link

updated card positions for C1231BR #16

Closed tugpoat closed 1 year ago

tugpoat commented 1 year ago

It works on my machine(tm) now!

Only minor annoyance is that it displays an error intermittently at the title screen for my game. Pretty sure I know why that is (game's fault), need to investigate further on a workaround/fix.

GXTX commented 1 year ago

Thanks!

I wouldn't blame the game. It's likely we're replying some state it's not expecting. You mentioned that it was actuating the shutter and reading to read randomly. Assuming this is the same problem?

tugpoat commented 1 year ago

No problem, happy to help!

That's correct, it is the same issue. I won't know for sure if it's the game or the emulator without getting an analyzer set up.

However...

It's not random, it sets the shutter to open and then attempts to read from a card, while the shutter is already open. It does this on a regular interval.

As I mentioned privately; I think there is a strong probability that there is a bit of an un-emulated state machine present in the physical readers which simply does not respond to commands which are inappropriate to its current state. Meaning that this method of "pinging" the reader would be fine for physical readers, but would cause an error with this code.

My brevity may have provided undue implications, however it's a lot more pleasant to read than this spiel no? :P

GXTX commented 1 year ago

When you get some time could you post the logs of when this is happening.

does not respond to commands which are inappropriate to its current state

What state beyond in the middle of running another command where actuating the shutter would be wrong? I'm not sure I'm convinced here.

bobbydilley commented 1 year ago

Awesome work on getting this in.

https://github.com/bobbydilley/card-emulator/blob/master/src/cardd.c#L174

Just as some backup, with this change you guys now align with the card positions that I got from the Derby Owners Club reader dumps so I think we're both likely correct!

tugpoat commented 1 year ago

When you get some time could you post the logs of when this is happening.

does not respond to commands which are inappropriate to its current state

What state beyond in the middle of running another command where actuating the shutter would be wrong? I'm not sure I'm convinced here.

I'll post logs up when I work on it next. I think it's the read-reply that's messing it up more than the shutter. e.g. The game should never be reading from the card if the shutter is not closed, in normal circumstances. I'll also test out this hypothesis in code.

Awesome work on getting this in.

https://github.com/bobbydilley/card-emulator/blob/master/src/cardd.c#L174

Just as some backup, with this change you guys now align with the card positions that I got from the Derby Owners Club reader dumps so I think we're both likely correct!

Thanks man! Truth be told, I lifted the positions from your code. I wasn't 100% sure what they should have been so I decided to give yours a whirl ---- and it turns out that they work beautifully for the Virtual On Force Terminal. Glad to be able to vote some confidence through testing!