- if (playing)
- {
- LED(LED_GREEN, 0);
- DbpString("Playing");
- for ( ; ; ) {
- WDT_HIT();
- int button_action = BUTTON_HELD(1000);
- if (button_action == 0) { // No button action, proceed with sim
- uint8_t data[512] = {0}; // in case there is a read command received we shouldn't break
- Dbprintf("Simulating ISO14443a tag with uid[0]: %08x, uid[1]: %08x [Bank: %u]", uid_1st[selected],uid_2nd[selected],selected);
- if (hi14a_card[selected].sak == 8 && hi14a_card[selected].atqa[0] == 4 && hi14a_card[selected].atqa[1] == 0) {
- DbpString("Mifare Classic");
- SimulateIso14443aTag(1,uid_1st[selected], uid_2nd[selected], data); // Mifare Classic
- }
- else if (hi14a_card[selected].sak == 0 && hi14a_card[selected].atqa[0] == 0x44 && hi14a_card[selected].atqa[1] == 0) {
- DbpString("Mifare Ultralight");
- SimulateIso14443aTag(2,uid_1st[selected],uid_2nd[selected],data); // Mifare Ultralight
- }
- else if (hi14a_card[selected].sak == 20 && hi14a_card[selected].atqa[0] == 0x44 && hi14a_card[selected].atqa[1] == 3) {
- DbpString("Mifare DESFire");
- SimulateIso14443aTag(3,uid_1st[selected],uid_2nd[selected],data); // Mifare DESFire
- }
- else {
- Dbprintf("Unrecognized tag type -- defaulting to Mifare Classic emulation");
- SimulateIso14443aTag(1,uid_1st[selected], uid_2nd[selected], data);
- }
- }
- else if (button_action == BUTTON_SINGLE_CLICK) {
- selected = (selected + 1) % OPTS;
- Dbprintf("Done playing. Switching to record mode on bank %d",selected);
- iGotoRecord = 1;
- break;
- }
- else if (button_action == BUTTON_HOLD) {
- Dbprintf("Playtime over. Begin cloning...");
- iGotoClone = 1;
- break;
+ LED(LED_GREEN, 0);
+ DbpString("Playing");
+ for ( ; ; ) {
+ WDT_HIT();
+ int button_action = BUTTON_HELD(1000);
+ if (button_action == 0) { // No button action, proceed with sim
+ uint8_t data[512] = {0}; // in case there is a read command received we shouldn't break
+ Dbprintf("Simulating ISO14443a tag with uid[0]: %08x, uid[1]: %08x [Bank: %u]", uid_1st[selected], uid_2nd[selected], selected);
+ if (hi14a_card[selected].sak == 8 && hi14a_card[selected].atqa[0] == 4 && hi14a_card[selected].atqa[1] == 0) {
+ DbpString("Mifare Classic");
+ SimulateIso14443aTag(1, uid_1st[selected], uid_2nd[selected], data); // Mifare Classic
+ } else if (hi14a_card[selected].sak == 0 && hi14a_card[selected].atqa[0] == 0x44 && hi14a_card[selected].atqa[1] == 0) {
+ DbpString("Mifare Ultralight");
+ SimulateIso14443aTag(2, uid_1st[selected], uid_2nd[selected], data); // Mifare Ultralight
+ } else if (hi14a_card[selected].sak == 20 && hi14a_card[selected].atqa[0] == 0x44 && hi14a_card[selected].atqa[1] == 3) {
+ DbpString("Mifare DESFire");
+ SimulateIso14443aTag(3, uid_1st[selected], uid_2nd[selected], data); // Mifare DESFire
+ } else {
+ Dbprintf("Unrecognized tag type -- defaulting to Mifare Classic emulation");
+ SimulateIso14443aTag(1, uid_1st[selected], uid_2nd[selected], data);