Merge branch 'dev' of github.com:ClaraCrazy/Flipper-Xtreme into fix-bad_kb_bt-flipper_app-conflict

This commit is contained in:
yocvito
2023-02-18 19:40:11 +01:00
91 changed files with 754 additions and 523 deletions
+3 -2
View File
@@ -11,9 +11,10 @@
"args": {
"useSingleResult": true,
"env": {
"PATH": "${workspaceFolder};${env:PATH}"
"PATH": "${workspaceFolder};${env:PATH}",
"FBT_QUIET": 1
},
"command": "./fbt get_blackmagic",
"command": "fbt get_blackmagic",
"description": "Get Blackmagic device",
}
}
+10 -6
View File
@@ -152,17 +152,21 @@ Note: This repo is always updated with OFW & Unleashed. No need to mention all t
<br>
<h2 align="center">Install:</h2>
**NOTE: If you are coming from a different FW, it is recommended to delete / clear your "apps" folder on the SD card prior to updating. This folder houses all the .fap files, which do not update to the correct API versions by default if old ones are present (Thanks flipper devs). This does `NOT` remove any of your saved files!**
**This is the recommended install procedure. Please follow these steps EXACTLY and CAREFULLY to ensure you install correctly.**
**This process will NOT delete any saved files and simply ensures the install goes smoothly.**
<br><br>
- Download the latest release (.zip) from [The releases tab](https://github.com/ClaraCrazy/Flipper-Xtreme/releases/latest)
- Extract the archive. This is now your new Firmware folder
- Open [qFlipper](https://flipperzero.one/update), head to `SD/Update` and simply move the firmware folder there
- On the Flipper, hit the `Arrow Down` button, this will get you to the file menu. Hit `Arrow Left` once, and then simply search for your updates folder
- Inside that folder, select the Firmware you just moved onto it, and run the file thats simply called `Update`
- Download the latest release (`.tgz`) from [the release page](https://github.com/ClaraCrazy/Flipper-Xtreme/releases/latest)
- Open [qFlipper](https://flipperzero.one/update) and connect your Flipper Zero
- Go to the files tab, into SD Card, and DELETE THE `apps` AND `update` FOLDERS
- Go back to the device tab
- Click `Install from file...` and select the downloaded file (`.tgz`)
- Enjoy!
**If you have issues or crashes with that process, you can try to use `Settings > Storage > Factory Reset` then retry the install.**
**Doing that will NOT remove your saved files, it will only forget some settings and paired devices.**
----
<br>
<h2 align="center">Build it yourself:</h2>
@@ -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_ignore_dirs) {
if(XTREME_SETTINGS()->sort_dirs_first) {
if(a->type == ArchiveFileTypeFolder && b->type != ArchiveFileTypeFolder) {
return -1;
}
+1 -1
View File
@@ -32,7 +32,7 @@ static void nfc_cli_detect(Cli* cli, FuriString* args) {
while(!cmd_exit) {
cmd_exit |= cli_cmd_interrupt_received(cli);
if(furi_hal_nfc_detect(&dev_data, 400)) {
printf("found: %s ", nfc_get_dev_type(dev_data.type));
printf("Found: %s ", nfc_get_dev_type(dev_data.type));
printf("UID length: %d, UID:", dev_data.uid_len);
for(size_t i = 0; i < dev_data.uid_len; i++) {
printf("%02X", dev_data.uid[i]);
+1
View File
@@ -6,6 +6,7 @@ App(
"crypto_start",
"rpc_start",
"bt",
"xtreme",
"desktop",
"loader",
"power",
@@ -528,7 +528,6 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
animation->active_cycles = u32value;
if(!flipper_format_read_uint32(ff, "Frame rate", &u32value, 1)) break;
uint16_t anim_speed = XTREME_SETTINGS()->anim_speed;
anim_speed = (anim_speed == 0 ? 100 : 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;
+1 -1
View File
@@ -56,7 +56,7 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) {
return true;
case DesktopGlobalAutoLock:
if(!loader_is_locked(desktop->loader)) {
if(desktop->settings.pin_code.length > 0) {
if(desktop->settings.auto_lock_with_pin && desktop->settings.pin_code.length > 0) {
desktop_pin_lock(&desktop->settings);
}
desktop_lock(desktop);
@@ -54,4 +54,5 @@ typedef struct {
PinCode pin_code;
uint8_t is_locked;
uint32_t auto_lock_delay_ms;
bool auto_lock_with_pin;
} DesktopSettings;
+3 -1
View File
@@ -7,6 +7,7 @@
#include <stdint.h>
#include <furi.h>
#include "furi_hal_random.h"
#include <xtreme/settings.h>
#define DOLPHIN_LOCK_EVENT_FLAG (0x1)
#define TAG "Dolphin"
@@ -92,8 +93,9 @@ Dolphin* dolphin_alloc() {
dolphin->state = dolphin_state_alloc();
dolphin->event_queue = furi_message_queue_alloc(8, sizeof(DolphinEvent));
dolphin->pubsub = furi_pubsub_alloc();
int32_t butthurt = XTREME_SETTINGS()->butthurt_timer;
dolphin->butthurt_timer = xTimerCreate(
NULL, HOURS_IN_TICKS(2 * 24), pdTRUE, dolphin, dolphin_butthurt_timer_callback);
NULL, (butthurt > 0) ? (butthurt * 1000) : -1, pdTRUE, dolphin, dolphin_butthurt_timer_callback);
dolphin->flush_timer =
xTimerCreate(NULL, 30 * 1000, pdFALSE, dolphin, dolphin_flush_timer_callback);
dolphin->clear_limits_timer = xTimerCreate(
@@ -91,7 +91,7 @@ static int BrowserItem_t_cmp(const BrowserItem_t* a, const BrowserItem_t* b) {
if(b->type == BrowserItemTypeBack) {
return 1;
}
if(!XTREME_SETTINGS()->sort_ignore_dirs) {
if(XTREME_SETTINGS()->sort_dirs_first) {
if(a->type == BrowserItemTypeFolder && b->type != BrowserItemTypeFolder) {
return -1;
}
@@ -26,14 +26,14 @@ typedef enum {
} PowerEventType;
typedef enum {
BatteryIconOff = 1,
BatteryIconBar = 2,
BatteryIconPercent = 3,
BatteryIconInvertedPercent = 4,
BatteryIconRetro3 = 5,
BatteryIconRetro5 = 6,
BatteryIconBarPercent = 0,
BatteryIconCount = 7,
BatteryIconOff,
BatteryIconBar,
BatteryIconPercent,
BatteryIconInvertedPercent,
BatteryIconRetro3,
BatteryIconRetro5,
BatteryIconBarPercent,
BatteryIconCount,
} BatteryIcon;
typedef union {
@@ -7,7 +7,7 @@ App(
requires=["storage_settings"],
provides=["storage_start"],
stack_size=3 * 1024,
order=120,
order=44,
sdk_headers=["storage.h"],
)
+6 -6
View File
@@ -1,10 +1,10 @@
App(
appid="xtreme",
apptype=FlipperAppType.STARTUP,
entry_point="xtreme_on_system_start",
name="Xtreme",
apptype=FlipperAppType.SERVICE,
entry_point="xtreme_srv",
cdefines=["SRV_XTREME"],
requires=["storage"],
order=1000,
provides=[
"xtreme",
],
stack_size=1 * 1024,
order=46,
)
+18 -3
View File
@@ -2,6 +2,8 @@
#include <assets_icons.h>
#include <core/dangerous_defines.h>
#define TAG "XtremeAssets"
#define ICONS_FMT PACKS_DIR "/%s/Icons/%s"
XtremeAssets* xtreme_assets = NULL;
@@ -111,7 +113,6 @@ void XTREME_ASSETS_LOAD() {
if(xtreme_assets != NULL) return;
xtreme_assets = malloc(sizeof(XtremeAssets));
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
xtreme_assets->A_Levelup_128x64 = &A_Levelup_128x64;
xtreme_assets->I_BLE_Pairing_128x64 = &I_BLE_Pairing_128x64;
@@ -136,20 +137,34 @@ void XTREME_ASSETS_LOAD() {
xtreme_assets->I_Connected_62x31 = &I_Connected_62x31;
xtreme_assets->I_Error_62x31 = &I_Error_62x31;
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
FURI_LOG_W(TAG, "Load skipped. Device is in special startup mode.");
return;
}
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
if(xtreme_settings->asset_pack[0] == '\0') return;
xtreme_assets->is_nsfw = strncmp(xtreme_settings->asset_pack, "NSFW", strlen("NSFW")) == 0;
Storage* storage = furi_record_open(RECORD_STORAGE);
int32_t timeout = 5000;
while(timeout > 0) {
if(storage_sd_status(storage) == FSE_OK) break;
furi_delay_ms(250);
timeout -= 250;
}
FileInfo info;
FuriString* path = furi_string_alloc();
furi_string_printf(path, PACKS_DIR "/%s", xtreme_settings->asset_pack);
Storage* storage = furi_record_open(RECORD_STORAGE);
if(storage_common_stat(storage, furi_string_get_cstr(path), &info) == FSE_OK &&
info.flags & FSF_DIRECTORY) {
File* file = storage_file_alloc(storage);
swap(xtreme_assets, path, file);
storage_file_free(file);
}
furi_record_close(RECORD_STORAGE);
furi_string_free(path);
furi_record_close(RECORD_STORAGE);
}
XtremeAssets* XTREME_ASSETS() {
+34 -10
View File
@@ -1,5 +1,7 @@
#include "settings.h"
#define TAG "XtremeSettings"
XtremeSettings* xtreme_settings = NULL;
XtremeSettings* XTREME_SETTINGS() {
@@ -9,28 +11,50 @@ XtremeSettings* XTREME_SETTINGS() {
return xtreme_settings;
}
bool XTREME_SETTINGS_LOAD() {
void XTREME_SETTINGS_LOAD() {
if(xtreme_settings == NULL) {
xtreme_settings = malloc(sizeof(XtremeSettings));
bool loaded = saved_struct_load(
XTREME_SETTINGS_PATH,
xtreme_settings,
sizeof(XtremeSettings),
XTREME_SETTINGS_MAGIC,
XTREME_SETTINGS_VERSION);
bool loaded;
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
FURI_LOG_W(TAG, "Load skipped. Device is in special startup mode.");
loaded = false;
} else {
loaded = saved_struct_load(
XTREME_SETTINGS_PATH,
xtreme_settings,
sizeof(XtremeSettings),
XTREME_SETTINGS_MAGIC,
XTREME_SETTINGS_VERSION);
}
if(!loaded) {
memset(xtreme_settings, 0, sizeof(XtremeSettings));
loaded = XTREME_SETTINGS_SAVE();
strlcpy(xtreme_settings->asset_pack, "", MAX_PACK_NAME_LEN); // SFW
xtreme_settings->anim_speed = 100; // 100%
xtreme_settings->cycle_anims = 0; // Meta.txt
xtreme_settings->unlock_anims = false; // OFF
xtreme_settings->battery_icon = BatteryIconBarPercent; // Bar %
xtreme_settings->status_icons = true; // ON
xtreme_settings->bar_borders = true; // ON
xtreme_settings->bar_background = false; // OFF
xtreme_settings->bad_bt = false; // USB
xtreme_settings->sort_dirs_first = true; // ON
xtreme_settings->butthurt_timer = 43200; // 12 H
}
return loaded;
}
return true;
}
bool XTREME_SETTINGS_SAVE() {
if(xtreme_settings == NULL) {
XTREME_SETTINGS_LOAD();
}
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
return true;
}
return saved_struct_save(
XTREME_SETTINGS_PATH,
xtreme_settings,
+4 -3
View File
@@ -11,7 +11,7 @@
#define MAX_PACK_NAME_LEN 32
#define XTREME_SETTINGS_VERSION (2)
#define XTREME_SETTINGS_VERSION (3)
#define XTREME_SETTINGS_PATH INT_PATH(XTREME_SETTINGS_FILE_NAME)
#define XTREME_SETTINGS_MAGIC (0x69)
@@ -28,11 +28,12 @@ typedef struct {
bool bar_borders;
bool bar_background;
bool bad_bt;
bool sort_ignore_dirs;
bool sort_dirs_first;
int32_t butthurt_timer;
} XtremeSettings;
XtremeSettings* XTREME_SETTINGS();
bool XTREME_SETTINGS_LOAD();
void XTREME_SETTINGS_LOAD();
bool XTREME_SETTINGS_SAVE();
@@ -1,7 +1,11 @@
#include "settings.h"
#include "assets.h"
void xtreme_on_system_start() {
int32_t xtreme_srv(void* p) {
UNUSED(p);
XTREME_SETTINGS_LOAD();
XTREME_ASSETS_LOAD();
return 0;
}
@@ -42,7 +42,7 @@ void desktop_settings_scene_favorite_on_enter(void* context) {
submenu_reset(submenu);
uint32_t primary_favorite =
scene_manager_get_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite) == SCENE_EVENT_SELECT_FAVORITE_PRIMARY;
scene_manager_get_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite);
uint32_t pre_select_item = 0;
for(size_t i = 0; i < FLIPPER_APPS_COUNT; i++) {
@@ -81,7 +81,7 @@ bool desktop_settings_scene_favorite_on_event(void* context, SceneManagerEvent e
FuriString* temp_path = furi_string_alloc_set_str(EXT_PATH("apps"));
uint32_t primary_favorite =
scene_manager_get_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite) == SCENE_EVENT_SELECT_FAVORITE_PRIMARY;
scene_manager_get_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite);
if(event.type == SceneManagerEventTypeCustom) {
if(strcmp(FLIPPER_APPS[event.event].name, FAP_LOADER_APP_NAME) != 0) {
@@ -39,6 +39,14 @@ static void desktop_settings_scene_start_auto_lock_delay_changed(VariableItem* i
app->settings.auto_lock_delay_ms = auto_lock_delay_value[index];
}
static void desktop_settings_scene_start_auto_lock_pin_changed(VariableItem* item) {
DesktopSettingsApp* app = variable_item_get_context(item);
uint8_t value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
app->settings.auto_lock_with_pin = value;
}
void desktop_settings_scene_start_on_enter(void* context) {
DesktopSettingsApp* app = context;
VariableItemList* variable_item_list = app->variable_item_list;
@@ -46,9 +54,9 @@ void desktop_settings_scene_start_on_enter(void* context) {
VariableItem* item;
uint8_t value_index;
variable_item_list_add(variable_item_list, "Primary Fav. App (UP)", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "Primary Fav App (Up)", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "Secondary Fav. App (DOWN)", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "Secondary Fav App (Down)", 1, NULL, NULL);
// variable_item_list_add(variable_item_list, "Favorite Game", 1, NULL, NULL);
@@ -66,6 +74,16 @@ void desktop_settings_scene_start_on_enter(void* context) {
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, auto_lock_delay_text[value_index]);
item = variable_item_list_add(
variable_item_list,
"Auto Lock Pin",
2,
desktop_settings_scene_start_auto_lock_pin_changed,
app);
variable_item_set_current_value_index(item, app->settings.auto_lock_with_pin);
variable_item_set_current_value_text(item, app->settings.auto_lock_with_pin ? "ON" : "OFF");
variable_item_list_set_enter_callback(
variable_item_list, desktop_settings_scene_start_var_list_enter_callback, app);
view_dispatcher_switch_to_view(app->view_dispatcher, DesktopSettingsAppViewVarItemList);
@@ -78,12 +96,12 @@ bool desktop_settings_scene_start_on_event(void* context, SceneManagerEvent sme)
if(sme.type == SceneManagerEventTypeCustom) {
switch(sme.event) {
case SCENE_EVENT_SELECT_FAVORITE_PRIMARY:
scene_manager_set_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite, SCENE_EVENT_SELECT_FAVORITE_PRIMARY);
scene_manager_set_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite, true);
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
consumed = true;
break;
case SCENE_EVENT_SELECT_FAVORITE_SECONDARY:
scene_manager_set_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite, SCENE_EVENT_SELECT_FAVORITE_SECONDARY);
scene_manager_set_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite, false);
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
consumed = true;
break;
@@ -1 +1,6 @@
ADD_SCENE(xtreme_app, main, Main)
ADD_SCENE(xtreme_app, start, Start)
ADD_SCENE(xtreme_app, graphics, Graphics)
ADD_SCENE(xtreme_app, statusbar, Statusbar)
ADD_SCENE(xtreme_app, protocols, Protocols)
ADD_SCENE(xtreme_app, dolphin, Dolphin)
ADD_SCENE(xtreme_app, misc, Misc)
@@ -0,0 +1,78 @@
#include "../xtreme_app.h"
static void xtreme_app_scene_dolphin_xp_level_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
app->dolphin_level = variable_item_get_current_value_index(item) + 1;
char level_str[4];
snprintf(level_str, 4, "%i", app->dolphin_level);
variable_item_set_current_value_text(item, level_str);
app->save_level = true;
}
const char* const butthurt_timer_names[] = {
"OFF",
"30 M",
"1 H",
"2 H",
"4 H",
"6 H",
"8 H",
"12 H",
"24 H",
"48 H"};
const int32_t butthurt_timer_values[COUNT_OF(butthurt_timer_names)] =
{-1, 1800, 3600, 7200, 14400, 21600, 28800, 43200, 86400, 172800};
static void xtreme_app_scene_dolphin_butthurt_timer_changed(VariableItem* item) {
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];
app->save_settings = true;
app->require_reboot = true;
}
void xtreme_app_scene_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;
char level_str[4];
snprintf(level_str, 4, "%i", app->dolphin_level);
item = variable_item_list_add(
var_item_list,
"XP Level",
DOLPHIN_LEVEL_COUNT + 1,
xtreme_app_scene_dolphin_xp_level_changed,
app);
variable_item_set_current_value_index(item, app->dolphin_level - 1);
variable_item_set_current_value_text(item, level_str);
item = variable_item_list_add(
var_item_list,
"Butthurt Timer",
COUNT_OF(butthurt_timer_names),
xtreme_app_scene_dolphin_butthurt_timer_changed,
app);
value_index = value_index_int32(
xtreme_settings->butthurt_timer, butthurt_timer_values, COUNT_OF(butthurt_timer_names));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, butthurt_timer_names[value_index]);
variable_item_list_set_selected_item(var_item_list, 0);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_dolphin_on_event(void* context, SceneManagerEvent event) {
UNUSED(context);
UNUSED(event);
bool consumed = false;
return consumed;
}
void xtreme_app_scene_dolphin_on_exit(void* context) {
XtremeApp* app = context;
variable_item_list_reset(app->var_item_list);
}
@@ -0,0 +1,120 @@
#include "../xtreme_app.h"
static void xtreme_app_scene_graphics_asset_pack_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(
item, index == 0 ? "SFW" : *asset_packs_get(app->asset_packs, index - 1));
strlcpy(
XTREME_SETTINGS()->asset_pack,
index == 0 ? "" : *asset_packs_get(app->asset_packs, index - 1),
MAX_PACK_NAME_LEN);
app->asset_pack = index;
app->save_settings = true;
app->require_reboot = true;
}
const char* const anim_speed_names[] =
{"25%", "50%", "75%", "100%", "125%", "150%", "175%", "200%", "225%", "250%", "275%", "300%"};
const int32_t anim_speed_values[COUNT_OF(anim_speed_names)] =
{25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300};
static void xtreme_app_scene_graphics_anim_speed_changed(VariableItem* item) {
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];
app->save_settings = true;
}
const char* const cycle_anims_names[] = {
"OFF",
"Meta.txt",
"30 S",
"1 M",
"5 M",
"10 M",
"15 M",
"30 M",
"1 H",
"2 H",
"6 H",
"12 H",
"24 H"};
const int32_t cycle_anims_values[COUNT_OF(cycle_anims_names)] =
{-1, 0, 30, 60, 300, 600, 900, 1800, 3600, 7200, 21600, 43200, 86400};
static void xtreme_app_scene_graphics_cycle_anims_changed(VariableItem* item) {
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];
app->save_settings = true;
}
static void xtreme_app_scene_graphics_unlock_anims_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()->unlock_anims = value;
app->save_settings = true;
}
void xtreme_app_scene_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;
item = variable_item_list_add(
var_item_list,
"Asset Pack",
asset_packs_size(app->asset_packs) + 1,
xtreme_app_scene_graphics_asset_pack_changed,
app);
variable_item_set_current_value_index(item, app->asset_pack);
variable_item_set_current_value_text(
item, app->asset_pack == 0 ? "SFW" : *asset_packs_get(app->asset_packs, app->asset_pack - 1));
item = variable_item_list_add(
var_item_list,
"Anim Speed",
COUNT_OF(anim_speed_names),
xtreme_app_scene_graphics_anim_speed_changed,
app);
value_index = value_index_int32(
xtreme_settings->anim_speed, anim_speed_values, COUNT_OF(anim_speed_names));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, anim_speed_names[value_index]);
item = variable_item_list_add(
var_item_list,
"Cycle Anims",
COUNT_OF(cycle_anims_names),
xtreme_app_scene_graphics_cycle_anims_changed,
app);
value_index = value_index_int32(
xtreme_settings->cycle_anims, cycle_anims_values, COUNT_OF(cycle_anims_names));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, cycle_anims_names[value_index]);
item = variable_item_list_add(
var_item_list, "Unlock Anims", 2, xtreme_app_scene_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_list_set_selected_item(var_item_list, 0);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_graphics_on_event(void* context, SceneManagerEvent event) {
UNUSED(context);
UNUSED(event);
bool consumed = false;
return consumed;
}
void xtreme_app_scene_graphics_on_exit(void* context) {
XtremeApp* app = context;
variable_item_list_reset(app->var_item_list);
}
@@ -1,319 +0,0 @@
#include "../xtreme_app.h"
#include <lib/toolbox/value_index.h>
#include <power/power_service/power.h>
#include <lib/toolbox/version.h>
static void xtreme_app_scene_main_asset_pack_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(
item, index == 0 ? "SFW" : *asset_packs_get(app->asset_packs, index - 1));
strlcpy(
XTREME_SETTINGS()->asset_pack,
index == 0 ? "" : *asset_packs_get(app->asset_packs, index - 1),
MAX_PACK_NAME_LEN);
app->settings_changed = true;
app->assets_changed = true;
}
const char* const anim_speed_names[] =
{"25%", "50%", "75%", "100%", "125%", "150%", "175%", "200%", "225%", "250%", "275%", "300%"};
const int32_t anim_speed_values[COUNT_OF(anim_speed_names)] =
{25, 50, 75, 0, 125, 150, 175, 200, 225, 250, 275, 300};
static void xtreme_app_scene_main_anim_speed_changed(VariableItem* item) {
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];
app->settings_changed = true;
}
const char* const cycle_anims_names[] = {
"OFF",
"Meta.txt",
"30 S",
"1 M",
"5 M",
"10 M",
"15 M",
"30 M",
"1 H",
"2 H",
"6 H",
"12 H",
"24 H"};
const int32_t cycle_anims_values[COUNT_OF(cycle_anims_names)] =
{-1, 0, 30, 60, 300, 600, 900, 1800, 3600, 7200, 21600, 43200, 86400};
static void xtreme_app_scene_main_cycle_anims_changed(VariableItem* item) {
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];
app->settings_changed = true;
}
static void xtreme_app_scene_main_unlock_anims_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()->unlock_anims = value;
app->settings_changed = true;
}
const char* const battery_icon_names[] =
{"OFF", "Bar", "%", "Inv. %", "Retro 3", "Retro 5", "Bar %"};
static void xtreme_app_scene_main_battery_icon_changed(VariableItem* item) {
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 + 1) % BatteryIconCount;
app->settings_changed = true;
}
static void xtreme_app_scene_main_status_icons_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()->status_icons = value;
app->settings_changed = true;
}
static void xtreme_app_scene_main_bar_borders_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()->bar_borders = value;
app->settings_changed = true;
}
static void xtreme_app_scene_main_bar_background_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()->bar_background = value;
app->settings_changed = true;
}
static void xtreme_app_scene_main_bad_bk_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 ? "BT" : "USB");
XTREME_SETTINGS()->bad_bt = value;
app->settings_changed = true;
}
static void xtreme_app_scene_main_subghz_extend_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
app->subghz_extend = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, app->subghz_extend ? "ON" : "OFF");
app->subghz_changed = true;
}
static void xtreme_app_scene_main_subghz_bypass_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
app->subghz_bypass = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, app->subghz_bypass ? "ON" : "OFF");
app->subghz_changed = true;
}
static void xtreme_app_scene_main_sort_folders_before_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()->sort_ignore_dirs = !value;
app->settings_changed = true;
}
static void xtreme_app_scene_main_xp_level_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
app->dolphin_level = variable_item_get_current_value_index(item) + 1;
char level_str[4];
snprintf(level_str, 4, "%i", app->dolphin_level);
variable_item_set_current_value_text(item, level_str);
app->level_changed = true;
}
void xtreme_app_scene_main_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;
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
DolphinStats stats = dolphin_stats(dolphin);
furi_record_close(RECORD_DOLPHIN);
app->dolphin_level = stats.level;
Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* subghz_range = flipper_format_file_alloc(storage);
app->subghz_extend = false;
app->subghz_bypass = false;
if(flipper_format_file_open_existing(subghz_range, "/ext/subghz/assets/extend_range.txt")) {
flipper_format_read_bool(
subghz_range, "use_ext_range_at_own_risk", &app->subghz_extend, 1);
flipper_format_read_bool(subghz_range, "ignore_default_tx_region", &app->subghz_bypass, 1);
}
flipper_format_free(subghz_range);
uint current_pack = 0;
asset_packs_init(app->asset_packs);
File* folder = storage_file_alloc(storage);
FileInfo info;
char* name = malloc(MAX_PACK_NAME_LEN);
if(storage_dir_open(folder, PACKS_DIR)) {
while(storage_dir_read(folder, &info, name, MAX_PACK_NAME_LEN)) {
if(info.flags & FSF_DIRECTORY) {
char* copy = malloc(MAX_PACK_NAME_LEN);
strlcpy(copy, name, MAX_PACK_NAME_LEN);
uint idx = 0;
if(strcmp(copy, "NSFW") != 0) {
for(; idx < asset_packs_size(app->asset_packs); idx++) {
char* comp = *asset_packs_get(app->asset_packs, idx);
if(strcasecmp(copy, comp) < 0 && strcmp(comp, "NSFW") != 0) {
break;
}
}
}
asset_packs_push_at(app->asset_packs, idx, copy);
if(current_pack != 0) {
if(idx < current_pack) current_pack++;
} else {
if(strcmp(copy, xtreme_settings->asset_pack) == 0) current_pack = idx + 1;
}
}
}
}
free(name);
storage_file_free(folder);
furi_record_close(RECORD_STORAGE);
item = variable_item_list_add(
var_item_list,
"Asset Pack",
asset_packs_size(app->asset_packs) + 1,
xtreme_app_scene_main_asset_pack_changed,
app);
variable_item_set_current_value_index(item, current_pack);
variable_item_set_current_value_text(
item, current_pack == 0 ? "SFW" : *asset_packs_get(app->asset_packs, current_pack - 1));
item = variable_item_list_add(
var_item_list,
"Anim Speed",
COUNT_OF(anim_speed_names),
xtreme_app_scene_main_anim_speed_changed,
app);
value_index = value_index_int32(
xtreme_settings->anim_speed, anim_speed_values, COUNT_OF(anim_speed_names));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, anim_speed_names[value_index]);
item = variable_item_list_add(
var_item_list,
"Cycle Anims",
COUNT_OF(cycle_anims_names),
xtreme_app_scene_main_cycle_anims_changed,
app);
value_index = value_index_int32(
xtreme_settings->cycle_anims, cycle_anims_values, COUNT_OF(cycle_anims_names));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, cycle_anims_names[value_index]);
item = variable_item_list_add(
var_item_list, "Unlock Anims", 2, xtreme_app_scene_main_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_list_add(var_item_list, " = Status Bar =", 0, NULL, app);
item = variable_item_list_add(
var_item_list,
"Battery Icon",
BatteryIconCount,
xtreme_app_scene_main_battery_icon_changed,
app);
value_index = (xtreme_settings->battery_icon + BatteryIconCount - 1) % BatteryIconCount;
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, battery_icon_names[value_index]);
item = variable_item_list_add(
var_item_list, "Status Icons", 2, xtreme_app_scene_main_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");
item = variable_item_list_add(
var_item_list, "Bar Borders", 2, xtreme_app_scene_main_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");
item = variable_item_list_add(
var_item_list, "Bar Background", 2, xtreme_app_scene_main_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_list_add(var_item_list, " = Protocols =", 0, NULL, app);
item = variable_item_list_add(
var_item_list, "Bad KB Mode", 2, xtreme_app_scene_main_bad_bk_mode_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");
item = variable_item_list_add(
var_item_list, "SubGHz Extend", 2, xtreme_app_scene_main_subghz_extend_changed, app);
variable_item_set_current_value_index(item, app->subghz_extend);
variable_item_set_current_value_text(item, app->subghz_extend ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list, "SubGHz Bypass", 2, xtreme_app_scene_main_subghz_bypass_changed, app);
variable_item_set_current_value_index(item, app->subghz_bypass);
variable_item_set_current_value_text(item, app->subghz_bypass ? "ON" : "OFF");
variable_item_list_add(var_item_list, " = Misc =", 0, NULL, app);
item = variable_item_list_add(
var_item_list,
"Sort Dirs First",
2,
xtreme_app_scene_main_sort_folders_before_changed,
app);
variable_item_set_current_value_index(item, !xtreme_settings->sort_ignore_dirs);
variable_item_set_current_value_text(item, !xtreme_settings->sort_ignore_dirs ? "ON" : "OFF");
char level_str[4];
snprintf(level_str, 4, "%i", app->dolphin_level);
item = variable_item_list_add(
var_item_list,
"XP Level",
DOLPHIN_LEVEL_COUNT + 1,
xtreme_app_scene_main_xp_level_changed,
app);
variable_item_set_current_value_index(item, app->dolphin_level - 1);
variable_item_set_current_value_text(item, level_str);
FuriString* version_tag = furi_string_alloc_printf(
"%s %s", version_get_gitbranchnum(NULL), version_get_builddate(NULL));
variable_item_list_add(var_item_list, furi_string_get_cstr(version_tag), 0, NULL, app);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_main_on_event(void* context, SceneManagerEvent event) {
UNUSED(context);
UNUSED(event);
bool consumed = false;
return consumed;
}
void xtreme_app_scene_main_on_exit(void* context) {
XtremeApp* app = context;
asset_packs_it_t it;
for(asset_packs_it(it, app->asset_packs); !asset_packs_end_p(it); asset_packs_next(it)) {
free(*asset_packs_cref(it));
}
asset_packs_clear(app->asset_packs);
variable_item_list_reset(app->var_item_list);
}
@@ -0,0 +1,41 @@
#include "../xtreme_app.h"
static void xtreme_app_scene_misc_sort_folders_before_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()->sort_dirs_first = 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;
item = variable_item_list_add(
var_item_list,
"Sort Dirs First",
2,
xtreme_app_scene_misc_sort_folders_before_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_list_set_selected_item(var_item_list, 0);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_misc_on_event(void* context, SceneManagerEvent event) {
UNUSED(context);
UNUSED(event);
bool consumed = false;
return consumed;
}
void xtreme_app_scene_misc_on_exit(void* context) {
XtremeApp* app = context;
variable_item_list_reset(app->var_item_list);
}
@@ -0,0 +1,61 @@
#include "../xtreme_app.h"
static void xtreme_app_scene_protocols_bad_bk_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 ? "BT" : "USB");
XTREME_SETTINGS()->bad_bt = value;
app->save_settings = true;
}
static void xtreme_app_scene_protocols_subghz_extend_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
app->subghz_extend = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, app->subghz_extend ? "ON" : "OFF");
app->save_subghz = true;
}
static void xtreme_app_scene_protocols_subghz_bypass_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
app->subghz_bypass = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, app->subghz_bypass ? "ON" : "OFF");
app->save_subghz = true;
}
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, "Bad KB Mode", 2, xtreme_app_scene_protocols_bad_bk_mode_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");
item = variable_item_list_add(
var_item_list, "SubGHz Extend", 2, xtreme_app_scene_protocols_subghz_extend_changed, app);
variable_item_set_current_value_index(item, app->subghz_extend);
variable_item_set_current_value_text(item, app->subghz_extend ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list, "SubGHz Bypass", 2, xtreme_app_scene_protocols_subghz_bypass_changed, app);
variable_item_set_current_value_index(item, app->subghz_bypass);
variable_item_set_current_value_text(item, app->subghz_bypass ? "ON" : "OFF");
variable_item_list_set_selected_item(var_item_list, 0);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_protocols_on_event(void* context, SceneManagerEvent event) {
UNUSED(context);
UNUSED(event);
bool consumed = false;
return consumed;
}
void xtreme_app_scene_protocols_on_exit(void* context) {
XtremeApp* app = context;
variable_item_list_reset(app->var_item_list);
}
@@ -0,0 +1,69 @@
#include "../xtreme_app.h"
enum VarItemListIndex {
VarItemListIndexGraphics,
VarItemListIndexStatusbar,
VarItemListIndexProtocols,
VarItemListIndexDolphin,
VarItemListIndexMisc,
};
void xtreme_app_scene_start_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
void xtreme_app_scene_start_on_enter(void* context) {
XtremeApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
variable_item_list_add(var_item_list, "Graphics", 0, NULL, app);
variable_item_list_add(var_item_list, "Statusbar", 0, NULL, app);
variable_item_list_add(var_item_list, "Protocols", 0, NULL, app);
variable_item_list_add(var_item_list, "Dolphin", 0, NULL, app);
variable_item_list_add(var_item_list, "Misc", 0, NULL, app);
variable_item_list_add(var_item_list, furi_string_get_cstr(app->version_tag), 0, NULL, app);
variable_item_list_set_enter_callback(var_item_list, xtreme_app_scene_start_var_item_list_callback, app);
variable_item_list_set_selected_item(var_item_list, scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneStart));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_start_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneStart, event.event);
consumed = true;
switch(event.event) {
case VarItemListIndexGraphics:
scene_manager_next_scene(app->scene_manager, XtremeAppSceneGraphics);
break;
case VarItemListIndexStatusbar:
scene_manager_next_scene(app->scene_manager, XtremeAppSceneStatusbar);
break;
case VarItemListIndexProtocols:
scene_manager_next_scene(app->scene_manager, XtremeAppSceneProtocols);
break;
case VarItemListIndexDolphin:
scene_manager_next_scene(app->scene_manager, XtremeAppSceneDolphin);
break;
case VarItemListIndexMisc:
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMisc);
break;
default:
break;
}
}
return consumed;
}
void xtreme_app_scene_start_on_exit(void* context) {
XtremeApp* app = context;
variable_item_list_reset(app->var_item_list);
}
@@ -0,0 +1,82 @@
#include "../xtreme_app.h"
const char* const battery_icon_names[] =
{"OFF", "Bar", "%", "Inv. %", "Retro 3", "Retro 5", "Bar %"};
static void xtreme_app_scene_statusbar_battery_icon_changed(VariableItem* item) {
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;
app->save_settings = true;
}
static void xtreme_app_scene_statusbar_status_icons_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()->status_icons = value;
app->save_settings = true;
}
static void xtreme_app_scene_statusbar_bar_borders_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()->bar_borders = value;
app->save_settings = true;
}
static void xtreme_app_scene_statusbar_bar_background_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()->bar_background = value;
app->save_settings = true;
}
void xtreme_app_scene_statusbar_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,
"Battery Icon",
BatteryIconCount,
xtreme_app_scene_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]);
item = variable_item_list_add(
var_item_list, "Status Icons", 2, xtreme_app_scene_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");
item = variable_item_list_add(
var_item_list, "Bar Borders", 2, xtreme_app_scene_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");
item = variable_item_list_add(
var_item_list, "Bar Background", 2, xtreme_app_scene_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_list_set_selected_item(var_item_list, 0);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_statusbar_on_event(void* context, SceneManagerEvent event) {
UNUSED(context);
UNUSED(event);
bool consumed = false;
return consumed;
}
void xtreme_app_scene_statusbar_on_exit(void* context) {
XtremeApp* app = context;
variable_item_list_reset(app->var_item_list);
}
+87 -22
View File
@@ -15,36 +15,37 @@ static bool xtreme_app_back_event_callback(void* context) {
furi_assert(context);
XtremeApp* app = context;
if(app->level_changed) {
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
DolphinStats stats = dolphin_stats(dolphin);
if(app->dolphin_level != stats.level) {
if(!scene_manager_has_previous_scene(app->scene_manager, XtremeAppSceneStart)) {
if(app->save_level) {
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
int xp = app->dolphin_level > 1 ? dolphin_get_levels()[app->dolphin_level - 2] : 0;
dolphin->state->data.icounter = xp + 1;
dolphin->state->dirty = true;
dolphin_state_save(dolphin->state);
furi_record_close(RECORD_DOLPHIN);
}
furi_record_close(RECORD_DOLPHIN);
}
if(app->subghz_changed) {
Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* subghz_range = flipper_format_file_alloc(storage);
if(flipper_format_file_open_existing(subghz_range, "/ext/subghz/assets/extend_range.txt")) {
flipper_format_insert_or_update_bool(
subghz_range, "use_ext_range_at_own_risk", &app->subghz_extend, 1);
flipper_format_insert_or_update_bool(
subghz_range, "ignore_default_tx_region", &app->subghz_bypass, 1);
if(app->save_subghz) {
Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* subghz_range = flipper_format_file_alloc(storage);
if(flipper_format_file_open_existing(subghz_range, "/ext/subghz/assets/extend_range.txt")) {
flipper_format_insert_or_update_bool(
subghz_range, "use_ext_range_at_own_risk", &app->subghz_extend, 1);
flipper_format_insert_or_update_bool(
subghz_range, "ignore_default_tx_region", &app->subghz_bypass, 1);
}
flipper_format_free(subghz_range);
furi_record_close(RECORD_STORAGE);
}
flipper_format_free(subghz_range);
furi_record_close(RECORD_STORAGE);
}
if(app->settings_changed) {
XTREME_SETTINGS_SAVE();
if(app->assets_changed) {
if(app->save_settings) {
XTREME_SETTINGS_SAVE();
}
if(app->require_reboot) {
popup_set_header(app->popup, "Rebooting...", 64, 26, AlignCenter, AlignCenter);
popup_set_text(app->popup, "Swapping assets...", 64, 40, AlignCenter, AlignCenter);
popup_set_text(app->popup, "Applying changes...", 64, 40, AlignCenter, AlignCenter);
popup_set_callback(app->popup, xtreme_app_reboot);
popup_set_context(app->popup, app);
popup_set_timeout(app->popup, 1000);
@@ -52,6 +53,7 @@ static bool xtreme_app_back_event_callback(void* context) {
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewPopup);
return true;
}
}
return scene_manager_handle_back_event(app->scene_manager);
@@ -84,6 +86,59 @@ XtremeApp* xtreme_app_alloc() {
app->popup = popup_alloc();
view_dispatcher_add_view(app->view_dispatcher, XtremeAppViewPopup, popup_get_view(app->popup));
// Settings init
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
DolphinStats stats = dolphin_stats(dolphin);
app->dolphin_level = stats.level;
furi_record_close(RECORD_DOLPHIN);
Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* subghz_range = flipper_format_file_alloc(storage);
app->subghz_extend = false;
app->subghz_bypass = false;
if(flipper_format_file_open_existing(subghz_range, "/ext/subghz/assets/extend_range.txt")) {
flipper_format_read_bool(subghz_range, "use_ext_range_at_own_risk", &app->subghz_extend, 1);
flipper_format_read_bool(subghz_range, "ignore_default_tx_region", &app->subghz_bypass, 1);
}
flipper_format_free(subghz_range);
app->asset_pack = 0;
asset_packs_init(app->asset_packs);
File* folder = storage_file_alloc(storage);
FileInfo info;
char* name = malloc(MAX_PACK_NAME_LEN);
if(storage_dir_open(folder, PACKS_DIR)) {
while(storage_dir_read(folder, &info, name, MAX_PACK_NAME_LEN)) {
if(info.flags & FSF_DIRECTORY) {
char* copy = malloc(MAX_PACK_NAME_LEN);
strlcpy(copy, name, MAX_PACK_NAME_LEN);
uint idx = 0;
if(strcmp(copy, "NSFW") != 0) {
for(; idx < asset_packs_size(app->asset_packs); idx++) {
char* comp = *asset_packs_get(app->asset_packs, idx);
if(strcasecmp(copy, comp) < 0 && strcmp(comp, "NSFW") != 0) {
break;
}
}
}
asset_packs_push_at(app->asset_packs, idx, copy);
if(app->asset_pack != 0) {
if(idx < app->asset_pack) app->asset_pack++;
} else {
if(strcmp(copy, xtreme_settings->asset_pack) == 0) app->asset_pack = idx + 1;
}
}
}
}
free(name);
storage_file_free(folder);
furi_record_close(RECORD_STORAGE);
app->version_tag = furi_string_alloc_printf("%s %s", version_get_gitbranchnum(NULL), version_get_builddate(NULL));
return app;
}
@@ -100,6 +155,16 @@ void xtreme_app_free(XtremeApp* app) {
view_dispatcher_free(app->view_dispatcher);
scene_manager_free(app->scene_manager);
// Settings deinit
asset_packs_it_t it;
for(asset_packs_it(it, app->asset_packs); !asset_packs_end_p(it); asset_packs_next(it)) {
free(*asset_packs_cref(it));
}
asset_packs_clear(app->asset_packs);
furi_string_free(app->version_tag);
// Records
furi_record_close(RECORD_GUI);
free(app);
@@ -108,7 +173,7 @@ void xtreme_app_free(XtremeApp* app) {
extern int32_t xtreme_app(void* p) {
UNUSED(p);
XtremeApp* app = xtreme_app_alloc();
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMain);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneStart);
view_dispatcher_run(app->view_dispatcher);
xtreme_app_free(app);
return 0;
@@ -8,6 +8,7 @@
#include <assets_icons.h>
#include <gui/modules/variable_item_list.h>
#include <gui/modules/popup.h>
#include <lib/toolbox/value_index.h>
#include "scenes/xtreme_app_scene.h"
#include "dolphin/helpers/dolphin_state.h"
#include "dolphin/dolphin.h"
@@ -28,11 +29,13 @@ typedef struct {
int dolphin_level;
bool subghz_extend;
bool subghz_bypass;
bool settings_changed;
bool assets_changed;
bool subghz_changed;
bool level_changed;
bool save_settings;
bool require_reboot;
bool save_subghz;
bool save_level;
uint asset_pack;
asset_packs_t asset_packs;
FuriString* version_tag;
} XtremeApp;
typedef enum {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

@@ -1,23 +0,0 @@
Filetype: Flipper Animation
Version: 1
Width: 128
Height: 64
Passive frames: 10
Active frames: 18
Frames order: 0 1 2 1 0 1 2 1 0 1 2 3 4 5 6 5 4 7 2 8 9 10 11 10 9 10 11 12
Active cycles: 1
Frame rate: 2
Duration: 360
Active cooldown: 7
Bubble slots: 1
Slot: 0
X: 11
Y: 19
Text: HAPPY\nHOLIDAYS!
AlignH: Right
AlignV: Center
StartFrame: 22
EndFrame: 27
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

-23
View File
@@ -1,23 +0,0 @@
Filetype: Flipper Animation
Version: 1
Width: 128
Height: 64
Passive frames: 18
Active frames: 19
Frames order: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
Active cycles: 1
Frame rate: 2
Duration: 360
Active cooldown: 7
Bubble slots: 1
Slot: 0
X: 21
Y: 25
Text: AAAAaAAAAHHh!!
AlignH: Right
AlignV: Bottom
StartFrame: 30
EndFrame: 32
+17 -31
View File
@@ -15,13 +15,6 @@ Min level: 2
Max level: 30
Weight: 3
Name: L1_Sleigh_ride_128x64
Min butthurt: 0
Max butthurt: 14
Min level: 4
Max level: 30
Weight: 4
Name: L1_Sleep_128x64
Min butthurt: 0
Max butthurt: 10
@@ -36,13 +29,6 @@ Min level: 7
Max level: 30
Weight: 3
Name: L1_Happy_holidays_128x64
Min butthurt: 0
Max butthurt: 14
Min level: 8
Max level: 30
Weight: 4
Name: L1_Furippa1_128x64
Min butthurt: 0
Max butthurt: 6
@@ -53,7 +39,7 @@ Weight: 3
Name: L1_Read_books_128x64
Min butthurt: 0
Max butthurt: 8
Min level: 11
Min level: 8
Max level: 30
Weight: 3
@@ -67,21 +53,21 @@ Weight: 3
Name: L1_Boxing_128x64
Min butthurt: 10
Max butthurt: 13
Min level: 14
Min level: 3
Max level: 30
Weight: 3
Name: L1_Mad_fist_128x64
Min butthurt: 9
Max butthurt: 13
Min level: 15
Min level: 4
Max level: 30
Weight: 3
Name: L1_Mods_128x64
Min butthurt: 0
Max butthurt: 9
Min level: 17
Min level: 15
Max level: 30
Weight: 4
@@ -92,13 +78,6 @@ Min level: 18
Max level: 30
Weight: 3
Name: L2_Furippa2_128x64
Min butthurt: 0
Max butthurt: 6
Min level: 20
Max level: 30
Weight: 3
Name: L1_Leaving_sad_128x64
Min butthurt: 14
Max butthurt: 14
@@ -113,6 +92,13 @@ Min level: 22
Max level: 30
Weight: 4
Name: L2_Furippa2_128x64
Min butthurt: 0
Max butthurt: 6
Min level: 20
Max level: 30
Weight: 3
Name: L2_Hacking_pc_128x64
Min butthurt: 0
Max butthurt: 8
@@ -127,10 +113,10 @@ Min level: 25
Max level: 30
Weight: 3
Name: L3_Lab_research_128x54
Name: L3_Furippa3_128x64
Min butthurt: 0
Max butthurt: 10
Min level: 27
Max butthurt: 6
Min level: 30
Max level: 30
Weight: 3
@@ -141,9 +127,9 @@ Min level: 28
Max level: 30
Weight: 3
Name: L3_Furippa3_128x64
Name: L3_Lab_research_128x54
Min butthurt: 0
Max butthurt: 6
Min level: 30
Max butthurt: 10
Min level: 27
Max level: 30
Weight: 3
+17 -31
View File
@@ -15,13 +15,6 @@ Min level: 2
Max level: 30
Weight: 3
Name: L1_Sleigh_ride_128x64
Min butthurt: 0
Max butthurt: 14
Min level: 4
Max level: 30
Weight: 4
Name: L1_Sleep_128x64
Min butthurt: 0
Max butthurt: 10
@@ -36,13 +29,6 @@ Min level: 7
Max level: 30
Weight: 3
Name: L1_Happy_holidays_128x64
Min butthurt: 0
Max butthurt: 14
Min level: 8
Max level: 30
Weight: 4
Name: L1_Furippa1_128x64
Min butthurt: 0
Max butthurt: 6
@@ -53,7 +39,7 @@ Weight: 3
Name: L1_Read_books_128x64
Min butthurt: 0
Max butthurt: 8
Min level: 11
Min level: 8
Max level: 30
Weight: 3
@@ -67,21 +53,21 @@ Weight: 3
Name: L1_Boxing_128x64
Min butthurt: 10
Max butthurt: 13
Min level: 14
Min level: 3
Max level: 30
Weight: 3
Name: L1_Mad_fist_128x64
Min butthurt: 9
Max butthurt: 13
Min level: 15
Min level: 4
Max level: 30
Weight: 3
Name: L1_Mods_128x64
Min butthurt: 0
Max butthurt: 9
Min level: 17
Min level: 15
Max level: 30
Weight: 4
@@ -92,13 +78,6 @@ Min level: 18
Max level: 30
Weight: 3
Name: L2_Furippa2_128x64
Min butthurt: 0
Max butthurt: 6
Min level: 20
Max level: 30
Weight: 3
Name: L1_Leaving_sad_128x64
Min butthurt: 14
Max butthurt: 14
@@ -113,6 +92,13 @@ Min level: 22
Max level: 30
Weight: 4
Name: L2_Furippa2_128x64
Min butthurt: 0
Max butthurt: 6
Min level: 20
Max level: 30
Weight: 3
Name: L2_Hacking_pc_128x64
Min butthurt: 0
Max butthurt: 8
@@ -127,10 +113,10 @@ Min level: 25
Max level: 30
Weight: 3
Name: L3_Lab_research_128x54
Name: L3_Furippa3_128x64
Min butthurt: 0
Max butthurt: 10
Min level: 27
Max butthurt: 6
Min level: 30
Max level: 30
Weight: 3
@@ -141,9 +127,9 @@ Min level: 28
Max level: 30
Weight: 3
Name: L3_Furippa3_128x64
Name: L3_Lab_research_128x54
Min butthurt: 0
Max butthurt: 6
Min level: 30
Max butthurt: 10
Min level: 27
Max level: 30
Weight: 3
Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 656 B

+8 -3
View File
@@ -6,16 +6,21 @@ set -eu;
# private variables
SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd -P)";
SCONS_DEFAULT_FLAGS="-Q --warn=target-not-built";
SCONS_EP="python3 -m SCons"
SCONS_DEFAULT_FLAGS="--warn=target-not-built";
SCONS_EP="python3 -m SCons";
# public variables
FBT_NOENV="${FBT_NOENV:-""}";
FBT_NO_SYNC="${FBT_NO_SYNC:-""}";
FBT_TOOLCHAIN_PATH="${FBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}";
FBT_VERBOSE="${FBT_VERBOSE:-""}";
if [ -z "$FBT_NOENV" ]; then
. "$SCRIPT_PATH/scripts/toolchain/fbtenv.sh";
FBT_VERBOSE="$FBT_VERBOSE" . "$SCRIPT_PATH/scripts/toolchain/fbtenv.sh";
fi
if [ -z "$FBT_VERBOSE" ]; then
SCONS_DEFAULT_FLAGS="$SCONS_DEFAULT_FLAGS -Q";
fi
if [ -z "$FBT_NO_SYNC" ]; then
+6 -1
View File
@@ -12,5 +12,10 @@ if [%FBT_NO_SYNC%] == [] (
)
)
set "SCONS_DEFAULT_FLAGS=-Q --warn=target-not-built"
set "SCONS_DEFAULT_FLAGS=--warn=target-not-built"
if not defined FBT_VERBOSE (
set "SCONS_DEFAULT_FLAGS=%SCONS_DEFAULT_FLAGS% -Q"
)
%SCONS_EP% %SCONS_DEFAULT_FLAGS% %*
-2
View File
@@ -23,7 +23,6 @@ def _convert_image(source_filename: str):
class DolphinBubbleAnimation:
FILE_TYPE = "Flipper Animation"
FILE_VERSION = 1
@@ -251,7 +250,6 @@ class DolphinBubbleAnimation:
class DolphinManifest:
FILE_TYPE = "Flipper Animation Manifest"
FILE_VERSION = 1
+1
View File
@@ -1,5 +1,6 @@
import serial.tools.list_ports as list_ports
# Returns a valid port or None, if it cannot be found
def resolve_port(logger, portname: str = "auto"):
if portname != "auto":
+2
View File
@@ -173,12 +173,14 @@ class Templite:
"""Renders the template according to the given namespace."""
stack = []
namespace["__file__"] = self.file
# add write method
def write(*args):
for value in args:
stack.append(str(value))
namespace["write"] = write
# add include method
def include(file):
if not os.path.isabs(file):
+6
View File
@@ -31,7 +31,13 @@ if not exist "%FBT_TOOLCHAIN_VERSION_FILE%" (
set /p REAL_TOOLCHAIN_VERSION=<"%FBT_TOOLCHAIN_VERSION_FILE%"
if not "%REAL_TOOLCHAIN_VERSION%" == "%FLIPPER_TOOLCHAIN_VERSION%" (
echo FBT: starting toolchain upgrade process..
powershell -ExecutionPolicy Bypass -File "%FBT_ROOT%\scripts\toolchain\windows-toolchain-download.ps1" %flipper_toolchain_version% "%FBT_TOOLCHAIN_ROOT%"
set /p REAL_TOOLCHAIN_VERSION=<"%FBT_TOOLCHAIN_VERSION_FILE%"
)
if defined FBT_VERBOSE (
echo FBT: using toolchain version %REAL_TOOLCHAIN_VERSION%
)
set "HOME=%USERPROFILE%"
+24 -11
View File
@@ -7,13 +7,14 @@ DEFAULT_SCRIPT_PATH="$(pwd -P)";
SCRIPT_PATH="${SCRIPT_PATH:-$DEFAULT_SCRIPT_PATH}";
FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"19"}";
FBT_TOOLCHAIN_PATH="${FBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}";
FBT_VERBOSE="${FBT_VERBOSE:-""}";
fbtenv_show_usage()
{
echo "Running this script manually is wrong, please source it";
echo "Example:";
printf "\tsource scripts/toolchain/fbtenv.sh\n";
echo "To restore your environment source fbtenv.sh with '--restore'."
echo "To restore your environment, source fbtenv.sh with '--restore'."
echo "Example:";
printf "\tsource scripts/toolchain/fbtenv.sh --restore\n";
}
@@ -35,15 +36,16 @@ fbtenv_restore_env()
PATH="$(echo "$PATH" | /usr/bin/sed "s/$TOOLCHAIN_ARCH_DIR_SED\/bin://g")";
PATH="$(echo "$PATH" | /usr/bin/sed "s/$TOOLCHAIN_ARCH_DIR_SED\/protobuf\/bin://g")";
PATH="$(echo "$PATH" | /usr/bin/sed "s/$TOOLCHAIN_ARCH_DIR_SED\/openocd\/bin://g")";
PATH="$(echo "$PATH" | /usr/bin/sed "s/$TOOLCHAIN_ARCH_DIR_SED\/openssl\/bin://g")";
if [ -n "${PS1:-""}" ]; then
PS1="$(echo "$PS1" | sed 's/\[fbt\]//g')";
elif [ -n "${PROMPT:-""}" ]; then
PROMPT="$(echo "$PROMPT" | sed 's/\[fbt\]//g')";
fi
PYTHONNOUSERSITE="$SAVED_PYTHONNOUSERSITE";
PYTHONPATH="$SAVED_PYTHONPATH";
PYTHONHOME="$SAVED_PYTHONHOME";
export PYTHONNOUSERSITE="$SAVED_PYTHONNOUSERSITE";
export PYTHONPATH="$SAVED_PYTHONPATH";
export PYTHONHOME="$SAVED_PYTHONHOME";
unset SAVED_PYTHONNOUSERSITE;
unset SAVED_PYTHONPATH;
@@ -131,7 +133,7 @@ fbtenv_get_kernel_type()
TOOLCHAIN_URL=$FBT_TOOLS_CUSTOM_LINK;
fi
elif echo "$SYS_TYPE" | grep -q "MINGW"; then
echo "In MinGW shell use \"[u]fbt.cmd\" instead of \"[u]fbt\"";
echo "In MinGW shell, use \"[u]fbt.cmd\" instead of \"[u]fbt\"";
return 1;
else
echo "Your system configuration is not supported. Sorry.. Please report us your configuration.";
@@ -258,6 +260,7 @@ fbtenv_check_download_toolchain()
elif [ ! -f "$TOOLCHAIN_ARCH_DIR/VERSION" ]; then
fbtenv_download_toolchain || return 1;
elif [ "$(cat "$TOOLCHAIN_ARCH_DIR/VERSION")" -ne "$FBT_TOOLCHAIN_VERSION" ]; then
echo "FBT: starting toolchain upgrade process.."
fbtenv_download_toolchain || return 1;
fi
return 0;
@@ -279,6 +282,13 @@ fbtenv_download_toolchain()
return 0;
}
fbtenv_print_version()
{
if [ -n "$FBT_VERBOSE" ]; then
echo "FBT: using toolchain version $(cat "$TOOLCHAIN_ARCH_DIR/VERSION")";
fi
}
fbtenv_main()
{
fbtenv_check_sourced || return 1;
@@ -291,18 +301,21 @@ fbtenv_main()
fbtenv_check_script_path || return 1;
fbtenv_check_download_toolchain || return 1;
fbtenv_set_shell_prompt;
fbtenv_print_version;
PATH="$TOOLCHAIN_ARCH_DIR/python/bin:$PATH";
PATH="$TOOLCHAIN_ARCH_DIR/bin:$PATH";
PATH="$TOOLCHAIN_ARCH_DIR/protobuf/bin:$PATH";
PATH="$TOOLCHAIN_ARCH_DIR/openocd/bin:$PATH";
PATH="$TOOLCHAIN_ARCH_DIR/openssl/bin:$PATH";
export PATH;
SAVED_PYTHONNOUSERSITE="${PYTHONNOUSERSITE:-""}";
SAVED_PYTHONPATH="${PYTHONPATH:-""}";
SAVED_PYTHONHOME="${PYTHONHOME:-""}";
export SAVED_PYTHONNOUSERSITE="${PYTHONNOUSERSITE:-""}";
export SAVED_PYTHONPATH="${PYTHONPATH:-""}";
export SAVED_PYTHONHOME="${PYTHONHOME:-""}";
PYTHONNOUSERSITE=1;
PYTHONPATH=;
PYTHONHOME=;
export PYTHONNOUSERSITE=1;
export PYTHONPATH=;
export PYTHONHOME=;
}
fbtenv_main "${1:-""}";