From c33c4ff851fcdf4bc9720db174a357edd4a27a41 Mon Sep 17 00:00:00 2001 From: "Lu.Mi" <37594893+Tenkoni@users.noreply.github.com> Date: Fri, 8 May 2020 14:05:14 -0500 Subject: [PATCH 1/2] Adjusting size of source amiibo file When scanning amiibo binaries over 540 bytes like Twilight Princess Link an out of range error is thrown. Just writing up to the byte 540 solves this error. This is similar to TagMo implementation for bigger amiibos. --- joycontrol/ir_nfc_mcu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/joycontrol/ir_nfc_mcu.py b/joycontrol/ir_nfc_mcu.py index e618edd..b76510f 100644 --- a/joycontrol/ir_nfc_mcu.py +++ b/joycontrol/ir_nfc_mcu.py @@ -131,7 +131,7 @@ class IrNfcMcu: else: data = bytes.fromhex('02000927') copyarray(self._bytes, 3, data) - copyarray(self._bytes, 3 + len(data), self._nfc_content[245:]) + copyarray(self._bytes, 3 + len(data), self._nfc_content[245:540]) self.set_action(Action.READ_FINISHED) elif self.get_action() == Action.READ_FINISHED: self._bytes[0] = 0x2a From 509579b268fd9c3a0d0f1abd541d0277b0f89dc8 Mon Sep 17 00:00:00 2001 From: Robert Martin Date: Sat, 16 May 2020 10:51:45 +0200 Subject: [PATCH 2/2] small cleanup --- joycontrol/controller_state.py | 2 +- joycontrol/ir_nfc_mcu.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/joycontrol/controller_state.py b/joycontrol/controller_state.py index 7eef5b7..8dadd55 100644 --- a/joycontrol/controller_state.py +++ b/joycontrol/controller_state.py @@ -177,7 +177,7 @@ class ButtonState: def __iter__(self): """ - @returns iterator over the button bytes + :returns iterator over the button bytes """ yield self._byte_1 yield self._byte_2 diff --git a/joycontrol/ir_nfc_mcu.py b/joycontrol/ir_nfc_mcu.py index b76510f..50b387b 100644 --- a/joycontrol/ir_nfc_mcu.py +++ b/joycontrol/ir_nfc_mcu.py @@ -115,7 +115,7 @@ class IrNfcMcu: self._bytes[5] = 9 self._bytes[6] = 0x31 self._bytes[7] = 0 - elif self.get_action() == Action.READ_TAG or self.get_action() == Action.READ_TAG_2: + elif self.get_action() in (Action.READ_TAG, Action.READ_TAG_2): self._bytes[0] = 0x3a self._bytes[1] = 0 self._bytes[2] = 7