djhackersdev / segatools

Loaders and hardware emulators for SEGA games that run on the Nu and ALLS platforms
The Unlicense
51 stars 6 forks source link

Fix the default response of felica_transact #23

Closed icex2 closed 1 year ago

icex2 commented 2 years ago

In GitLab by @Sucareto on Oct 12, 2021, 14:00

In the sg_nfc_cmd_felica_encap function, the default case of the felica_transact function does not respond, which will cause the main program of the game to fail to read the card. Adding a simple reply should solve this problem.

By comparing the actual serial port data of the card reader, I found that the card reader will reply with an empty data packet with status=1, and the main game program can skip the check.

Data received:
E0 [unknown length] 00 [  ] (71) [  ] [ 8 byte IDm ] [ payload_len ] (  ) [ unknown data ] [  ]
Data sent:
E0 [06] 00 [  ] (71) [01] 00 [  ]

I made a card reader simulation program for testing, and found that the fix can be used for mu3, diva and sinmai, allowing real aime and felica cards to be read on these programs.

icex2 commented 2 years ago

In GitLab by @Sucareto on Oct 12, 2021, 14:04

It is found that when mu3 reads the Amusement IC, the FELICA_ENCAP phase will send the two codes 0x06 and 0x08, which can be skipped by the reply method mentioned above.