diff --git a/board/sg-nfc-cmd.h b/board/sg-nfc-cmd.h index c44586a..604783b 100644 --- a/board/sg-nfc-cmd.h +++ b/board/sg-nfc-cmd.h @@ -5,19 +5,21 @@ #pragma pack(push, 1) enum { - SG_NFC_CMD_GET_FW_VERSION = 0x30, - SG_NFC_CMD_GET_HW_VERSION = 0x32, - SG_NFC_CMD_RADIO_ON = 0x40, - SG_NFC_CMD_RADIO_OFF = 0x41, - SG_NFC_CMD_POLL = 0x42, - SG_NFC_CMD_MIFARE_SELECT_TAG = 0x43, - SG_NFC_CMD_MIFARE_SET_KEY_BANA = 0x50, - SG_NFC_CMD_MIFARE_READ_BLOCK = 0x52, - SG_NFC_CMD_MIFARE_SET_KEY_AIME = 0x54, - SG_NFC_CMD_MIFARE_AUTHENTICATE = 0x55, /* guess based on time sent */ - SG_NFC_CMD_SEND_HEX_DATA = 0x61, - SG_NFC_CMD_RESET = 0x62, - SG_NFC_CMD_FELICA_ENCAP = 0x71, + SG_NFC_CMD_GET_FW_VERSION = 0x30, + SG_NFC_CMD_GET_HW_VERSION = 0x32, + SG_NFC_CMD_RADIO_ON = 0x40, + SG_NFC_CMD_RADIO_OFF = 0x41, + SG_NFC_CMD_POLL = 0x42, + SG_NFC_CMD_MIFARE_SELECT_TAG = 0x43, + SG_NFC_CMD_MIFARE_SET_KEY_A = 0x50, + SG_NFC_CMD_MIFARE_AUTHENTICATE_A = 0x51, + SG_NFC_CMD_MIFARE_READ_BLOCK = 0x52, + SG_NFC_CMD_MIFARE_SET_KEY_B = 0x54, + SG_NFC_CMD_MIFARE_AUTHENTICATE_B = 0x55, + SG_NFC_CMD_TO_UPDATE_MODE = 0x60, + SG_NFC_CMD_SEND_HEX_DATA = 0x61, + SG_NFC_CMD_RESET = 0x62, + SG_NFC_CMD_FELICA_ENCAP = 0x71, }; struct sg_nfc_res_get_fw_version { @@ -32,7 +34,7 @@ struct sg_nfc_res_get_hw_version { struct sg_nfc_req_mifare_set_key { struct sg_req_header req; - uint8_t key_a[6]; + uint8_t key[6]; }; struct sg_nfc_req_mifare_50 { diff --git a/board/sg-nfc.c b/board/sg-nfc.c index 1f023be..19a6ad6 100644 --- a/board/sg-nfc.c +++ b/board/sg-nfc.c @@ -60,6 +60,11 @@ static HRESULT sg_nfc_cmd_felica_encap( const struct sg_nfc_req_felica_encap *req, struct sg_nfc_res_felica_encap *res); +static HRESULT sg_nfc_cmd_send_hex_data( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_res_header *res); + static HRESULT sg_nfc_cmd_dummy( struct sg_nfc *nfc, const struct sg_req_header *req, @@ -185,12 +190,15 @@ static HRESULT sg_nfc_dispatch( &res->felica_encap); case SG_NFC_CMD_MIFARE_AUTHENTICATE: + case SG_NFC_CMD_SEND_HEX_DATA: + return sg_nfc_cmd_send_hex_data(nfc, &req->simple, &res->simple); + case SG_NFC_CMD_MIFARE_SELECT_TAG: case SG_NFC_CMD_MIFARE_SET_KEY_AIME: case SG_NFC_CMD_MIFARE_SET_KEY_BANA: case SG_NFC_CMD_RADIO_ON: case SG_NFC_CMD_RADIO_OFF: - case SG_NFC_CMD_SEND_HEX_DATA: // TODO: implement? + case SG_NFC_CMD_TO_UPDATE_MODE: return sg_nfc_cmd_dummy(nfc, &req->simple, &res->simple); default: @@ -442,6 +450,22 @@ static HRESULT sg_nfc_cmd_felica_encap( return S_OK; } +static HRESULT sg_nfc_cmd_send_hex_data( + struct sg_nfc *nfc, + const struct sg_req_header *req, + struct sg_res_header *res) +{ + sg_res_init(res, req, 0); + + /* Firmware checksum length? */ + if (req->payload_len == 0x2b) { + /* The firmware is identical flag? */ + res->status = 0x20; + } + + return S_OK; +} + static HRESULT sg_nfc_cmd_dummy( struct sg_nfc *nfc, const struct sg_req_header *req, diff --git a/dist/mu3/segatools.ini b/dist/mu3/segatools.ini index 182e1d8..f24e510 100644 --- a/dist/mu3/segatools.ini +++ b/dist/mu3/segatools.ini @@ -190,7 +190,7 @@ leftSide=0x01 ; Mouse Left rightSide=0x02 ; Mouse Right right1=0x4A ; J -right1=0x4B ; K +right2=0x4B ; K right3=0x4C ; L leftMenu=0x55 ; U