From 106c09b80d4af81abed1f0ddb4758510f6b96f05 Mon Sep 17 00:00:00 2001 From: masterchan777 Date: Mon, 13 Mar 2017 16:47:20 +0000 Subject: [PATCH 001/114] Rejected commit: Default --- .../com/hiddenramblings/tagmo/EditorTP.java | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 app/src/main/java/com/hiddenramblings/tagmo/EditorTP.java diff --git a/app/src/main/java/com/hiddenramblings/tagmo/EditorTP.java b/app/src/main/java/com/hiddenramblings/tagmo/EditorTP.java new file mode 100644 index 000000000..3505b4297 --- /dev/null +++ b/app/src/main/java/com/hiddenramblings/tagmo/EditorTP.java @@ -0,0 +1,103 @@ +package com.hiddenramblings.tagmo; + +import android.app.Activity; +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.util.Log; +import android.widget.ArrayAdapter; +import android.widget.Spinner; +import android.widget.Toast; + +import org.androidannotations.annotations.AfterViews; +import org.androidannotations.annotations.EActivity; +import org.androidannotations.annotations.OptionsItem; +import org.androidannotations.annotations.OptionsMenu; +import org.androidannotations.annotations.ViewById; + +import com.hiddenramblings.tagmo.EditorTP; + +@EActivity(R.layout.activity_editor_tp) +@OptionsMenu({R.menu.editor_menu}) +public class EditorTP extends AppCompatActivity { + private static final String TAG = "EditorTP"; + + @ViewById(R.id.spnShadowCaveLevel) + Spinner spnShadowCaveLevel; + @ViewById(R.id.spnHearts) + Spinner spnHearts; + + KeyManager keyManager; + + @AfterViews + void afterViews() { + setListForSpinners(new Spinner[]{spnShadowCaveLevel}, + R.array.editor_tp_levels, android.R.layout.simple_list_item_1); + setListForSpinners(new Spinner[]{spnHearts}, + R.array.editor_tp_hearts, android.R.layout.simple_list_item_1); + + keyManager = new KeyManager(this); + + try { + byte[] tagData = getIntent().getByteArrayExtra(Actions.EXTRA_TAG_DATA); + tagData = TagUtil.decrypt(keyManager, tagData); + this.loadData(tagData); + } catch (Exception e) { + Log.d(TAG, "Error decyrpting data", e); + finish(); + } + } + + + //all offsets for decrypted (internal) format of tags + private static final int OFFSET_APP_DATA = 0xED; + + private static final int OFFSET_LEVEL = OFFSET_APP_DATA; + private static final int OFFSET_HEARTS = OFFSET_APP_DATA + 0x01; + + + void loadData(final byte[] data) { + try { + if (data[OFFSET_LEVEL] < 0 || data[OFFSET_LEVEL] > spnShadowCaveLevel.getAdapter().getCount()) { + throw new IndexOutOfBoundsException("OFFSET_LEVEL Value invalid: "+data[OFFSET_LEVEL]); + } + if (data[OFFSET_HEARTS] < 0 || data[OFFSET_HEARTS] > spnHearts.getAdapter().getCount()) { + throw new IndexOutOfBoundsException("OFFSET_HEARTS Value invalid: "+data[OFFSET_HEARTS]); + } + + spnShadowCaveLevel.setSelection(data[OFFSET_LEVEL]); + spnHearts.setSelection(data[OFFSET_HEARTS]); + } catch (IndexOutOfBoundsException e) { + Log.d(TAG, "Error loading data", e); + Toast.makeText(this, R.string.editor_error_outofbounds, Toast.LENGTH_SHORT).show(); + finish(); + } + } + + void updateData(byte[] data) { + data[OFFSET_LEVEL] = (byte) spnShadowCaveLevel.getSelectedItemPosition(); + data[OFFSET_HEARTS] = (byte) spnHearts.getSelectedItemPosition(); + } + + void setListForSpinners(Spinner[] controls, int list, int layout) { + for (Spinner control : controls) { + ArrayAdapter adapter = ArrayAdapter.createFromResource(this, list, layout); + control.setAdapter(adapter); + } + } + + @OptionsItem(R.id.mnu_save) + void save() { + try { + byte[] tagData = getIntent().getByteArrayExtra(Actions.EXTRA_TAG_DATA); + tagData = TagUtil.decrypt(keyManager, tagData); + this.updateData(tagData); + tagData = TagUtil.encrypt(keyManager, tagData); + Intent intent = new Intent(Actions.ACTION_EDIT_COMPLETE); + intent.putExtra(Actions.EXTRA_TAG_DATA, tagData); + setResult(Activity.RESULT_OK, intent); + } catch (Exception e) { + Log.d(TAG, "Error encrypting data", e); + } + finish(); + } +} From 192dcb14375f74efa438212f19b35f95d2a13eba Mon Sep 17 00:00:00 2001 From: masterchan777 Date: Mon, 13 Mar 2017 16:50:33 +0000 Subject: [PATCH 002/114] added: Wolf Link Editor by @possi --- app/src/main/java/com/hiddenramblings/tagmo/EditorTP.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/hiddenramblings/tagmo/EditorTP.java b/app/src/main/java/com/hiddenramblings/tagmo/EditorTP.java index 3505b4297..582608ad2 100644 --- a/app/src/main/java/com/hiddenramblings/tagmo/EditorTP.java +++ b/app/src/main/java/com/hiddenramblings/tagmo/EditorTP.java @@ -31,9 +31,9 @@ public class EditorTP extends AppCompatActivity { @AfterViews void afterViews() { setListForSpinners(new Spinner[]{spnShadowCaveLevel}, - R.array.editor_tp_levels, android.R.layout.simple_list_item_1); + //R.array.editor_tp_levels, android.R.layout.simple_list_item_1); setListForSpinners(new Spinner[]{spnHearts}, - R.array.editor_tp_hearts, android.R.layout.simple_list_item_1); + //R.array.editor_tp_hearts, android.R.layout.simple_list_item_1); keyManager = new KeyManager(this); From d3652e1ef395609c2625df448c8509694281e49a Mon Sep 17 00:00:00 2001 From: masterchan777 Date: Mon, 13 Mar 2017 16:51:45 +0000 Subject: [PATCH 003/114] added: Wolf Link Editor by @possi --- .../java/com/hiddenramblings/tagmo/AmiiboDictionary.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/hiddenramblings/tagmo/AmiiboDictionary.java b/app/src/main/java/com/hiddenramblings/tagmo/AmiiboDictionary.java index 83b468dab..76a4f0963 100644 --- a/app/src/main/java/com/hiddenramblings/tagmo/AmiiboDictionary.java +++ b/app/src/main/java/com/hiddenramblings/tagmo/AmiiboDictionary.java @@ -149,7 +149,7 @@ public class AmiiboDictionary { idList.put(0x005A, "Cheri (ACC1)"); idList.put(0x005B, "Kyle (ACC1)"); idList.put(0x005C, "Al (ACC1)"); - idList.put(0x005D, "Renée (ACC1)"); + idList.put(0x005D, "Renée (ACC1)"); idList.put(0x005E, "Lopez (ACC1)"); idList.put(0x005F, "Jambette (ACC1)"); idList.put(0x0060, "Rasher (ACC1)"); @@ -640,6 +640,9 @@ public class AmiiboDictionary { idList.put(0x034F, "8-bit Link (The Legend of Zelda) (LOZ)"); idList.put(0x0350, "Toon Link (The Wind Waker) (LOZ)"); idList.put(0x0352, "Toon Zelda (The Wind Waker) (LOZ)"); + idList.put(0x034C, "Link (Majora's Mask) (LOZ)"); + idList.put(0x034D, "Link (Twilight Princess) (LOZ)"); + idList.put(0x034E, "Link (Skyward Sword) (LOZ)"); idList.put(0x0353, "Link (Archer) (BOTW)"); idList.put(0x0354, "Link (Rider) (BOTW)"); idList.put(0x0355, "Guardian (BOTW)"); @@ -1466,4 +1469,4 @@ static AmiiboIdData parseid(byte[] data) { return new AmiiboIdData(brand, variant, type, model, series); } -} +} \ No newline at end of file From 3f0b964f669404a2fa8aa2f3fcaae452e23b4f3a Mon Sep 17 00:00:00 2001 From: masterchan777 Date: Mon, 13 Mar 2017 16:52:10 +0000 Subject: [PATCH 004/114] added: Wolf Link Editor by @possi --- .../hiddenramblings/tagmo/MainActivity.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/app/src/main/java/com/hiddenramblings/tagmo/MainActivity.java b/app/src/main/java/com/hiddenramblings/tagmo/MainActivity.java index 23ad37baf..a8abadf35 100644 --- a/app/src/main/java/com/hiddenramblings/tagmo/MainActivity.java +++ b/app/src/main/java/com/hiddenramblings/tagmo/MainActivity.java @@ -21,6 +21,7 @@ import android.widget.CheckBox; import android.widget.TextView; import android.widget.Toast; +import android.view.View; import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.Background; @@ -190,12 +191,38 @@ void updateStatus() { String charId = AmiiboDictionary.getDisplayName(charIdData); String uid = Util.bytesToHex(TagUtil.uidFromPages(this.currentTagData)); txtTagId.setText("TagId: " + charId + " / " + uid); + onTagLoaded(charIdData); } else { txtTagId.setText("TagId: "); + onTagLoaded(null); } } catch (Exception e) { LogError("Error parsing tag id", e); txtTagId.setText("TagID: "); + onTagLoaded(null); + } + } + + void onTagLoaded(byte[] charIdData) { + //Button edit_ssb = (Button) findViewById(R.id.btnEditDataSSB); + Button edit_tp = (Button) findViewById(R.id.btnEditDataTP); + + if (charIdData == null) { + //edit_ssb.setVisibility(View.INVISIBLE); + edit_tp.setVisibility(View.INVISIBLE); + } else { + AmiiboDictionary.AmiiboIdData ad = AmiiboDictionary.parseid(charIdData); + int id = (ad.Brand << 16) + (ad.Variant << 8) + ad.Type; + switch (id) { + case 0x01030000: // Wolf Link; TODO: Make AmiiboDictinary IDS an enum + //edit_ssb.setVisibility(View.INVISIBLE); + edit_tp.setVisibility(View.VISIBLE); + break; + default: + //edit_ssb.setVisibility(View.VISIBLE); + edit_tp.setVisibility(View.INVISIBLE); + break; + } } } From 73c8640ce67bd3294842db232b31ccef44fdfcd2 Mon Sep 17 00:00:00 2001 From: masterchan777 Date: Mon, 13 Mar 2017 16:52:24 +0000 Subject: [PATCH 005/114] added: Wolf Link Editor by @possi --- app/src/main/res/values/strings.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 961e53f68..e483f9c95 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4,4 +4,8 @@ Place the Tag under the Phone NFC Icon Moving bar indicating the scanning process + Shadow Cave progress + Hearts + Edit TP Data + Amiibo contains an invalid current state. From 46b716269b0563a0f1c57d8dd78c1959b9044996 Mon Sep 17 00:00:00 2001 From: masterchan777 Date: Mon, 13 Mar 2017 16:52:36 +0000 Subject: [PATCH 006/114] added: Wolf Link Editor by @possi --- app/src/main/AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index bc4efe50e..ae16f6c8d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,6 +23,7 @@ + From e490b53ed85e880bb9953f63463670f28970d157 Mon Sep 17 00:00:00 2001 From: masterchan777 Date: Mon, 13 Mar 2017 16:53:59 +0000 Subject: [PATCH 007/114] added: Wolf Link Editor by @possi --- app/src/main/res/layout/activity_main.xml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 0466d656b..7f0449e88 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -143,13 +143,24 @@ android:visibility="gone" />