mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 15:58:36 -07:00
Restructure xtreme settings app
This commit is contained in:
@@ -1,13 +1,14 @@
|
|||||||
ADD_SCENE(xtreme_app, start, Start)
|
ADD_SCENE(xtreme_app, start, Start)
|
||||||
ADD_SCENE(xtreme_app, graphics, Graphics)
|
ADD_SCENE(xtreme_app, interface, Interface)
|
||||||
ADD_SCENE(xtreme_app, mainmenu, Mainmenu)
|
ADD_SCENE(xtreme_app, interface_graphics, InterfaceGraphics)
|
||||||
ADD_SCENE(xtreme_app, mainmenu_add, MainmenuAdd)
|
ADD_SCENE(xtreme_app, interface_mainmenu, InterfaceMainmenu)
|
||||||
ADD_SCENE(xtreme_app, statusbar, Statusbar)
|
ADD_SCENE(xtreme_app, interface_mainmenu_add, InterfaceMainmenuAdd)
|
||||||
|
ADD_SCENE(xtreme_app, interface_statusbar, InterfaceStatusbar)
|
||||||
|
ADD_SCENE(xtreme_app, interface_common, InterfaceCommon)
|
||||||
ADD_SCENE(xtreme_app, protocols, Protocols)
|
ADD_SCENE(xtreme_app, protocols, Protocols)
|
||||||
ADD_SCENE(xtreme_app, protocols_frequencies, ProtocolsFrequencies)
|
ADD_SCENE(xtreme_app, protocols_frequencies, ProtocolsFrequencies)
|
||||||
ADD_SCENE(xtreme_app, protocols_frequencies_static, ProtocolsFrequenciesStatic)
|
ADD_SCENE(xtreme_app, protocols_frequencies_static, ProtocolsFrequenciesStatic)
|
||||||
ADD_SCENE(xtreme_app, protocols_frequencies_hopper, ProtocolsFrequenciesHopper)
|
ADD_SCENE(xtreme_app, protocols_frequencies_hopper, ProtocolsFrequenciesHopper)
|
||||||
ADD_SCENE(xtreme_app, protocols_frequencies_add, ProtocolsFrequenciesAdd)
|
ADD_SCENE(xtreme_app, protocols_frequencies_add, ProtocolsFrequenciesAdd)
|
||||||
ADD_SCENE(xtreme_app, dolphin, Dolphin)
|
|
||||||
ADD_SCENE(xtreme_app, misc, Misc)
|
ADD_SCENE(xtreme_app, misc, Misc)
|
||||||
ADD_SCENE(xtreme_app, misc_rename, MiscRename)
|
ADD_SCENE(xtreme_app, misc_rename, MiscRename)
|
||||||
|
|||||||
@@ -1,92 +0,0 @@
|
|||||||
#include "../xtreme_app.h"
|
|
||||||
|
|
||||||
enum VarItemListIndex {
|
|
||||||
VarItemListIndexXpLevel,
|
|
||||||
VarItemListIndexButthurtTimer,
|
|
||||||
};
|
|
||||||
|
|
||||||
void xtreme_app_scene_dolphin_var_item_list_callback(void* context, uint32_t index) {
|
|
||||||
XtremeApp* app = context;
|
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
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_enter_callback(
|
|
||||||
var_item_list, xtreme_app_scene_dolphin_var_item_list_callback, app);
|
|
||||||
|
|
||||||
variable_item_list_set_selected_item(
|
|
||||||
var_item_list, scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneDolphin));
|
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool xtreme_app_scene_dolphin_on_event(void* context, SceneManagerEvent event) {
|
|
||||||
XtremeApp* app = context;
|
|
||||||
bool consumed = false;
|
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
|
||||||
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneDolphin, event.event);
|
|
||||||
consumed = true;
|
|
||||||
switch(event.event) {
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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,64 @@
|
|||||||
|
#include "../xtreme_app.h"
|
||||||
|
|
||||||
|
enum VarItemListIndex {
|
||||||
|
VarItemListIndexGraphics,
|
||||||
|
VarItemListIndexMainmenu,
|
||||||
|
VarItemListIndexStatusbar,
|
||||||
|
VarItemListIndexCommon,
|
||||||
|
};
|
||||||
|
|
||||||
|
void xtreme_app_scene_interface_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_interface_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, "Mainmenu", 0, NULL, app);
|
||||||
|
variable_item_list_add(var_item_list, "Statusbar", 0, NULL, app);
|
||||||
|
variable_item_list_add(var_item_list, "Common", 0, NULL, app);
|
||||||
|
|
||||||
|
variable_item_list_set_enter_callback(
|
||||||
|
var_item_list, xtreme_app_scene_interface_var_item_list_callback, app);
|
||||||
|
|
||||||
|
variable_item_list_set_selected_item(
|
||||||
|
var_item_list, scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneInterface));
|
||||||
|
|
||||||
|
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool xtreme_app_scene_interface_on_event(void* context, SceneManagerEvent event) {
|
||||||
|
XtremeApp* app = context;
|
||||||
|
bool consumed = false;
|
||||||
|
|
||||||
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
|
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneInterface, event.event);
|
||||||
|
consumed = true;
|
||||||
|
switch(event.event) {
|
||||||
|
case VarItemListIndexGraphics:
|
||||||
|
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceGraphics);
|
||||||
|
break;
|
||||||
|
case VarItemListIndexMainmenu:
|
||||||
|
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceMainmenu);
|
||||||
|
break;
|
||||||
|
case VarItemListIndexStatusbar:
|
||||||
|
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceStatusbar);
|
||||||
|
break;
|
||||||
|
case VarItemListIndexCommon:
|
||||||
|
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceCommon);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return consumed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void xtreme_app_scene_interface_on_exit(void* context) {
|
||||||
|
XtremeApp* app = context;
|
||||||
|
variable_item_list_reset(app->var_item_list);
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
#include "../xtreme_app.h"
|
||||||
|
|
||||||
|
enum VarItemListIndex {
|
||||||
|
VarItemListIndexSortDirsFirst,
|
||||||
|
VarItemListIndexDarkMode,
|
||||||
|
VarItemListIndexLeftHanded,
|
||||||
|
};
|
||||||
|
|
||||||
|
void xtreme_app_scene_interface_common_var_item_list_callback(void* context, uint32_t index) {
|
||||||
|
XtremeApp* app = context;
|
||||||
|
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void xtreme_app_scene_interface_common_sort_dirs_first_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void xtreme_app_scene_interface_common_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;
|
||||||
|
app->save_settings = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void xtreme_app_scene_interface_common_left_handed_changed(VariableItem* item) {
|
||||||
|
bool value = variable_item_get_current_value_index(item);
|
||||||
|
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||||
|
if(value) {
|
||||||
|
furi_hal_rtc_set_flag(FuriHalRtcFlagHandOrient);
|
||||||
|
} else {
|
||||||
|
furi_hal_rtc_reset_flag(FuriHalRtcFlagHandOrient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void xtreme_app_scene_interface_common_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_interface_common_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");
|
||||||
|
|
||||||
|
item = variable_item_list_add(
|
||||||
|
var_item_list, "Dark Mode", 2, xtreme_app_scene_interface_common_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");
|
||||||
|
|
||||||
|
item = variable_item_list_add(
|
||||||
|
var_item_list, "Left Handed", 2, xtreme_app_scene_interface_common_left_handed_changed, app);
|
||||||
|
bool value = furi_hal_rtc_is_flag_set(FuriHalRtcFlagHandOrient);
|
||||||
|
variable_item_set_current_value_index(item, value);
|
||||||
|
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||||
|
|
||||||
|
variable_item_list_set_enter_callback(
|
||||||
|
var_item_list, xtreme_app_scene_interface_common_var_item_list_callback, app);
|
||||||
|
|
||||||
|
variable_item_list_set_selected_item(
|
||||||
|
var_item_list, scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneInterfaceCommon));
|
||||||
|
|
||||||
|
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool xtreme_app_scene_interface_common_on_event(void* context, SceneManagerEvent event) {
|
||||||
|
XtremeApp* app = context;
|
||||||
|
bool consumed = false;
|
||||||
|
|
||||||
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
|
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneInterfaceCommon, event.event);
|
||||||
|
consumed = true;
|
||||||
|
switch(event.event) {
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return consumed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void xtreme_app_scene_interface_common_on_exit(void* context) {
|
||||||
|
XtremeApp* app = context;
|
||||||
|
variable_item_list_reset(app->var_item_list);
|
||||||
|
}
|
||||||
@@ -7,21 +7,21 @@ enum VarItemListIndex {
|
|||||||
VarItemListIndexUnlockAnims,
|
VarItemListIndexUnlockAnims,
|
||||||
};
|
};
|
||||||
|
|
||||||
void xtreme_app_scene_graphics_var_item_list_callback(void* context, uint32_t index) {
|
void xtreme_app_scene_interface_graphics_var_item_list_callback(void* context, uint32_t index) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xtreme_app_scene_graphics_asset_pack_changed(VariableItem* item) {
|
static void xtreme_app_scene_interface_graphics_asset_pack_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(
|
variable_item_set_current_value_text(
|
||||||
item, index == 0 ? "SFW" : *CharList_get(app->asset_packs, index - 1));
|
item, index == 0 ? "SFW" : *CharList_get(app->asset_pack_names, index - 1));
|
||||||
strlcpy(
|
strlcpy(
|
||||||
XTREME_SETTINGS()->asset_pack,
|
XTREME_SETTINGS()->asset_pack,
|
||||||
index == 0 ? "" : *CharList_get(app->asset_packs, index - 1),
|
index == 0 ? "" : *CharList_get(app->asset_pack_names, index - 1),
|
||||||
MAX_PACK_NAME_LEN);
|
MAX_PACK_NAME_LEN);
|
||||||
app->asset_pack = index;
|
app->asset_pack_index = index;
|
||||||
app->save_settings = true;
|
app->save_settings = true;
|
||||||
app->require_reboot = true;
|
app->require_reboot = true;
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ const char* const anim_speed_names[] =
|
|||||||
{"25%", "50%", "75%", "100%", "125%", "150%", "175%", "200%", "225%", "250%", "275%", "300%"};
|
{"25%", "50%", "75%", "100%", "125%", "150%", "175%", "200%", "225%", "250%", "275%", "300%"};
|
||||||
const int32_t anim_speed_values[COUNT_OF(anim_speed_names)] =
|
const int32_t anim_speed_values[COUNT_OF(anim_speed_names)] =
|
||||||
{25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300};
|
{25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300};
|
||||||
static void xtreme_app_scene_graphics_anim_speed_changed(VariableItem* item) {
|
static void xtreme_app_scene_interface_graphics_anim_speed_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(item, anim_speed_names[index]);
|
variable_item_set_current_value_text(item, anim_speed_names[index]);
|
||||||
@@ -54,7 +54,7 @@ const char* const cycle_anims_names[] = {
|
|||||||
"24 H"};
|
"24 H"};
|
||||||
const int32_t cycle_anims_values[COUNT_OF(cycle_anims_names)] =
|
const int32_t cycle_anims_values[COUNT_OF(cycle_anims_names)] =
|
||||||
{-1, 0, 30, 60, 300, 600, 900, 1800, 3600, 7200, 21600, 43200, 86400};
|
{-1, 0, 30, 60, 300, 600, 900, 1800, 3600, 7200, 21600, 43200, 86400};
|
||||||
static void xtreme_app_scene_graphics_cycle_anims_changed(VariableItem* item) {
|
static void xtreme_app_scene_interface_graphics_cycle_anims_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(item, cycle_anims_names[index]);
|
variable_item_set_current_value_text(item, cycle_anims_names[index]);
|
||||||
@@ -62,7 +62,7 @@ static void xtreme_app_scene_graphics_cycle_anims_changed(VariableItem* item) {
|
|||||||
app->save_settings = true;
|
app->save_settings = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xtreme_app_scene_graphics_unlock_anims_changed(VariableItem* item) {
|
static void xtreme_app_scene_interface_graphics_unlock_anims_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
bool value = variable_item_get_current_value_index(item);
|
bool value = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||||
@@ -70,7 +70,7 @@ static void xtreme_app_scene_graphics_unlock_anims_changed(VariableItem* item) {
|
|||||||
app->save_settings = true;
|
app->save_settings = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xtreme_app_scene_graphics_on_enter(void* context) {
|
void xtreme_app_scene_interface_graphics_on_enter(void* context) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
||||||
VariableItemList* var_item_list = app->var_item_list;
|
VariableItemList* var_item_list = app->var_item_list;
|
||||||
@@ -80,19 +80,19 @@ void xtreme_app_scene_graphics_on_enter(void* context) {
|
|||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list,
|
var_item_list,
|
||||||
"Asset Pack",
|
"Asset Pack",
|
||||||
CharList_size(app->asset_packs) + 1,
|
CharList_size(app->asset_pack_names) + 1,
|
||||||
xtreme_app_scene_graphics_asset_pack_changed,
|
xtreme_app_scene_interface_graphics_asset_pack_changed,
|
||||||
app);
|
app);
|
||||||
variable_item_set_current_value_index(item, app->asset_pack);
|
variable_item_set_current_value_index(item, app->asset_pack_index);
|
||||||
variable_item_set_current_value_text(
|
variable_item_set_current_value_text(
|
||||||
item,
|
item,
|
||||||
app->asset_pack == 0 ? "SFW" : *CharList_get(app->asset_packs, app->asset_pack - 1));
|
app->asset_pack_index == 0 ? "SFW" : *CharList_get(app->asset_pack_names, app->asset_pack_index - 1));
|
||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list,
|
var_item_list,
|
||||||
"Anim Speed",
|
"Anim Speed",
|
||||||
COUNT_OF(anim_speed_names),
|
COUNT_OF(anim_speed_names),
|
||||||
xtreme_app_scene_graphics_anim_speed_changed,
|
xtreme_app_scene_interface_graphics_anim_speed_changed,
|
||||||
app);
|
app);
|
||||||
value_index = value_index_int32(
|
value_index = value_index_int32(
|
||||||
xtreme_settings->anim_speed, anim_speed_values, COUNT_OF(anim_speed_names));
|
xtreme_settings->anim_speed, anim_speed_values, COUNT_OF(anim_speed_names));
|
||||||
@@ -103,7 +103,7 @@ void xtreme_app_scene_graphics_on_enter(void* context) {
|
|||||||
var_item_list,
|
var_item_list,
|
||||||
"Cycle Anims",
|
"Cycle Anims",
|
||||||
COUNT_OF(cycle_anims_names),
|
COUNT_OF(cycle_anims_names),
|
||||||
xtreme_app_scene_graphics_cycle_anims_changed,
|
xtreme_app_scene_interface_graphics_cycle_anims_changed,
|
||||||
app);
|
app);
|
||||||
value_index = value_index_int32(
|
value_index = value_index_int32(
|
||||||
xtreme_settings->cycle_anims, cycle_anims_values, COUNT_OF(cycle_anims_names));
|
xtreme_settings->cycle_anims, cycle_anims_values, COUNT_OF(cycle_anims_names));
|
||||||
@@ -111,25 +111,25 @@ void xtreme_app_scene_graphics_on_enter(void* context) {
|
|||||||
variable_item_set_current_value_text(item, cycle_anims_names[value_index]);
|
variable_item_set_current_value_text(item, cycle_anims_names[value_index]);
|
||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list, "Unlock Anims", 2, xtreme_app_scene_graphics_unlock_anims_changed, app);
|
var_item_list, "Unlock Anims", 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_index(item, xtreme_settings->unlock_anims);
|
||||||
variable_item_set_current_value_text(item, xtreme_settings->unlock_anims ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, xtreme_settings->unlock_anims ? "ON" : "OFF");
|
||||||
|
|
||||||
variable_item_list_set_enter_callback(
|
variable_item_list_set_enter_callback(
|
||||||
var_item_list, xtreme_app_scene_graphics_var_item_list_callback, app);
|
var_item_list, xtreme_app_scene_interface_graphics_var_item_list_callback, app);
|
||||||
|
|
||||||
variable_item_list_set_selected_item(
|
variable_item_list_set_selected_item(
|
||||||
var_item_list, scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneGraphics));
|
var_item_list, scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneInterfaceGraphics));
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
|
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool xtreme_app_scene_graphics_on_event(void* context, SceneManagerEvent event) {
|
bool xtreme_app_scene_interface_graphics_on_event(void* context, SceneManagerEvent event) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneGraphics, event.event);
|
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneInterfaceGraphics, event.event);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
default:
|
default:
|
||||||
@@ -140,7 +140,7 @@ bool xtreme_app_scene_graphics_on_event(void* context, SceneManagerEvent event)
|
|||||||
return consumed;
|
return consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xtreme_app_scene_graphics_on_exit(void* context) {
|
void xtreme_app_scene_interface_graphics_on_exit(void* context) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
variable_item_list_reset(app->var_item_list);
|
variable_item_list_reset(app->var_item_list);
|
||||||
}
|
}
|
||||||
@@ -7,14 +7,14 @@ enum VarItemListIndex {
|
|||||||
VarItemListIndexAddApp,
|
VarItemListIndexAddApp,
|
||||||
};
|
};
|
||||||
|
|
||||||
void xtreme_app_scene_mainmenu_var_item_list_callback(
|
void xtreme_app_scene_interface_mainmenu_var_item_list_callback(
|
||||||
void* context,
|
void* context,
|
||||||
uint32_t index) {
|
uint32_t index) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xtreme_app_scene_mainmenu_wii_menu_changed(VariableItem* item) {
|
static void xtreme_app_scene_interface_mainmenu_wii_menu_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
bool value = variable_item_get_current_value_index(item);
|
bool value = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||||
@@ -22,33 +22,33 @@ static void xtreme_app_scene_mainmenu_wii_menu_changed(VariableItem* item) {
|
|||||||
app->save_settings = true;
|
app->save_settings = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xtreme_app_scene_mainmenu_app_changed(VariableItem* item) {
|
static void xtreme_app_scene_interface_mainmenu_app_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
app->mainmenu_app_index = variable_item_get_current_value_index(item);
|
app->mainmenu_app_index = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(item, *CharList_get(app->mainmenu_apps_names, app->mainmenu_app_index));
|
variable_item_set_current_value_text(item, *CharList_get(app->mainmenu_app_names, app->mainmenu_app_index));
|
||||||
}
|
}
|
||||||
|
|
||||||
void xtreme_app_scene_mainmenu_on_enter(void* context) {
|
void xtreme_app_scene_interface_mainmenu_on_enter(void* context) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
||||||
VariableItemList* var_item_list = app->var_item_list;
|
VariableItemList* var_item_list = app->var_item_list;
|
||||||
VariableItem* item;
|
VariableItem* item;
|
||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list, "Wii menu", 2, xtreme_app_scene_mainmenu_wii_menu_changed, app);
|
var_item_list, "Wii menu", 2, xtreme_app_scene_interface_mainmenu_wii_menu_changed, app);
|
||||||
variable_item_set_current_value_index(item, xtreme_settings->wii_menu);
|
variable_item_set_current_value_index(item, xtreme_settings->wii_menu);
|
||||||
variable_item_set_current_value_text(item, xtreme_settings->wii_menu ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, xtreme_settings->wii_menu ? "ON" : "OFF");
|
||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list,
|
var_item_list,
|
||||||
"App",
|
"App",
|
||||||
CharList_size(app->mainmenu_apps_names),
|
CharList_size(app->mainmenu_app_names),
|
||||||
xtreme_app_scene_mainmenu_app_changed,
|
xtreme_app_scene_interface_mainmenu_app_changed,
|
||||||
app);
|
app);
|
||||||
app->mainmenu_app_index = 0;
|
app->mainmenu_app_index = 0;
|
||||||
variable_item_set_current_value_index(item, app->mainmenu_app_index);
|
variable_item_set_current_value_index(item, app->mainmenu_app_index);
|
||||||
if(CharList_size(app->mainmenu_apps_names)) {
|
if(CharList_size(app->mainmenu_app_names)) {
|
||||||
variable_item_set_current_value_text(item, *CharList_get(app->mainmenu_apps_names, app->mainmenu_app_index));
|
variable_item_set_current_value_text(item, *CharList_get(app->mainmenu_app_names, app->mainmenu_app_index));
|
||||||
} else {
|
} else {
|
||||||
variable_item_set_current_value_text(item, "None");
|
variable_item_set_current_value_text(item, "None");
|
||||||
}
|
}
|
||||||
@@ -58,37 +58,37 @@ void xtreme_app_scene_mainmenu_on_enter(void* context) {
|
|||||||
variable_item_list_add(var_item_list, "Add App", 0, NULL, app);
|
variable_item_list_add(var_item_list, "Add App", 0, NULL, app);
|
||||||
|
|
||||||
variable_item_list_set_enter_callback(
|
variable_item_list_set_enter_callback(
|
||||||
var_item_list, xtreme_app_scene_mainmenu_var_item_list_callback, app);
|
var_item_list, xtreme_app_scene_interface_mainmenu_var_item_list_callback, app);
|
||||||
|
|
||||||
variable_item_list_set_selected_item(
|
variable_item_list_set_selected_item(
|
||||||
var_item_list,
|
var_item_list,
|
||||||
scene_manager_get_scene_state(
|
scene_manager_get_scene_state(
|
||||||
app->scene_manager, XtremeAppSceneMainmenu));
|
app->scene_manager, XtremeAppSceneInterfaceMainmenu));
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
|
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool xtreme_app_scene_mainmenu_on_event(void* context, SceneManagerEvent event) {
|
bool xtreme_app_scene_interface_mainmenu_on_event(void* context, SceneManagerEvent event) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
scene_manager_set_scene_state(
|
scene_manager_set_scene_state(
|
||||||
app->scene_manager, XtremeAppSceneMainmenu, event.event);
|
app->scene_manager, XtremeAppSceneInterfaceMainmenu, event.event);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case VarItemListIndexRemoveApp:
|
case VarItemListIndexRemoveApp:
|
||||||
if(!CharList_size(app->mainmenu_apps_names)) break;
|
if(!CharList_size(app->mainmenu_app_names)) break;
|
||||||
if(!CharList_size(app->mainmenu_apps_paths)) break;
|
if(!CharList_size(app->mainmenu_app_paths)) break;
|
||||||
CharList_remove_v(app->mainmenu_apps_names, app->mainmenu_app_index, app->mainmenu_app_index + 1);
|
CharList_remove_v(app->mainmenu_app_names, app->mainmenu_app_index, app->mainmenu_app_index + 1);
|
||||||
CharList_remove_v(app->mainmenu_apps_paths, app->mainmenu_app_index, app->mainmenu_app_index + 1);
|
CharList_remove_v(app->mainmenu_app_paths, app->mainmenu_app_index, app->mainmenu_app_index + 1);
|
||||||
app->save_mainmenu_apps = true;
|
app->save_mainmenu_apps = true;
|
||||||
app->require_reboot = true;
|
app->require_reboot = true;
|
||||||
scene_manager_previous_scene(app->scene_manager);
|
scene_manager_previous_scene(app->scene_manager);
|
||||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMainmenu);
|
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceMainmenu);
|
||||||
break;
|
break;
|
||||||
case VarItemListIndexAddApp:
|
case VarItemListIndexAddApp:
|
||||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMainmenuAdd);
|
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceMainmenuAdd);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -98,7 +98,7 @@ bool xtreme_app_scene_mainmenu_on_event(void* context, SceneManagerEvent event)
|
|||||||
return consumed;
|
return consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xtreme_app_scene_mainmenu_on_exit(void* context) {
|
void xtreme_app_scene_interface_mainmenu_on_exit(void* context) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
variable_item_list_reset(app->var_item_list);
|
variable_item_list_reset(app->var_item_list);
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ enum FileBrowserResult {
|
|||||||
FileBrowserResultOk,
|
FileBrowserResultOk,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool xtreme_app_scene_mainmenu_add_file_browser_callback(
|
static bool xtreme_app_scene_interface_mainmenu_add_file_browser_callback(
|
||||||
FuriString* file_path,
|
FuriString* file_path,
|
||||||
void* context,
|
void* context,
|
||||||
uint8_t** icon_ptr,
|
uint8_t** icon_ptr,
|
||||||
@@ -16,7 +16,7 @@ static bool xtreme_app_scene_mainmenu_add_file_browser_callback(
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xtreme_app_scene_mainmenu_add_on_enter(void* context) {
|
void xtreme_app_scene_interface_mainmenu_add_on_enter(void* context) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
FuriString* string = furi_string_alloc_set_str(EXT_PATH("apps"));
|
FuriString* string = furi_string_alloc_set_str(EXT_PATH("apps"));
|
||||||
|
|
||||||
@@ -24,17 +24,17 @@ void xtreme_app_scene_mainmenu_add_on_enter(void* context) {
|
|||||||
.extension = ".fap",
|
.extension = ".fap",
|
||||||
.skip_assets = true,
|
.skip_assets = true,
|
||||||
.hide_ext = true,
|
.hide_ext = true,
|
||||||
.item_loader_callback = xtreme_app_scene_mainmenu_add_file_browser_callback,
|
.item_loader_callback = xtreme_app_scene_interface_mainmenu_add_file_browser_callback,
|
||||||
.item_loader_context = app,
|
.item_loader_context = app,
|
||||||
.base_path = EXT_PATH("apps"),
|
.base_path = EXT_PATH("apps"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if(dialog_file_browser_show(app->dialogs, string, string, &browser_options)) {
|
if(dialog_file_browser_show(app->dialogs, string, string, &browser_options)) {
|
||||||
CharList_push_back(app->mainmenu_apps_paths, strdup(furi_string_get_cstr(string)));
|
CharList_push_back(app->mainmenu_app_paths, strdup(furi_string_get_cstr(string)));
|
||||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
fap_loader_load_name_and_icon(string, storage, NULL, string);
|
fap_loader_load_name_and_icon(string, storage, NULL, string);
|
||||||
furi_record_close(RECORD_STORAGE);
|
furi_record_close(RECORD_STORAGE);
|
||||||
CharList_push_back(app->mainmenu_apps_names, strdup(furi_string_get_cstr(string)));
|
CharList_push_back(app->mainmenu_app_names, strdup(furi_string_get_cstr(string)));
|
||||||
app->save_mainmenu_apps = true;
|
app->save_mainmenu_apps = true;
|
||||||
app->require_reboot = true;
|
app->require_reboot = true;
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ void xtreme_app_scene_mainmenu_add_on_enter(void* context) {
|
|||||||
view_dispatcher_send_custom_event(app->view_dispatcher, FileBrowserResultOk);
|
view_dispatcher_send_custom_event(app->view_dispatcher, FileBrowserResultOk);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool xtreme_app_scene_mainmenu_add_on_event(void* context, SceneManagerEvent event) {
|
bool xtreme_app_scene_interface_mainmenu_add_on_event(void* context, SceneManagerEvent event) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
|
|
||||||
@@ -62,6 +62,6 @@ bool xtreme_app_scene_mainmenu_add_on_event(void* context, SceneManagerEvent eve
|
|||||||
return consumed;
|
return consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xtreme_app_scene_mainmenu_add_on_exit(void* context) {
|
void xtreme_app_scene_interface_mainmenu_add_on_exit(void* context) {
|
||||||
UNUSED(context);
|
UNUSED(context);
|
||||||
}
|
}
|
||||||
@@ -7,14 +7,14 @@ enum VarItemListIndex {
|
|||||||
VarItemListIndexbarBackground,
|
VarItemListIndexbarBackground,
|
||||||
};
|
};
|
||||||
|
|
||||||
void xtreme_app_scene_statusbar_var_item_list_callback(void* context, uint32_t index) {
|
void xtreme_app_scene_interface_statusbar_var_item_list_callback(void* context, uint32_t index) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* const battery_icon_names[] =
|
const char* const battery_icon_names[] =
|
||||||
{"OFF", "Bar", "%", "Inv. %", "Retro 3", "Retro 5", "Bar %"};
|
{"OFF", "Bar", "%", "Inv. %", "Retro 3", "Retro 5", "Bar %"};
|
||||||
static void xtreme_app_scene_statusbar_battery_icon_changed(VariableItem* item) {
|
static void xtreme_app_scene_interface_statusbar_battery_icon_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
uint8_t index = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(item, battery_icon_names[index]);
|
variable_item_set_current_value_text(item, battery_icon_names[index]);
|
||||||
@@ -22,7 +22,7 @@ static void xtreme_app_scene_statusbar_battery_icon_changed(VariableItem* item)
|
|||||||
app->save_settings = true;
|
app->save_settings = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xtreme_app_scene_statusbar_status_icons_changed(VariableItem* item) {
|
static void xtreme_app_scene_interface_statusbar_status_icons_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
bool value = variable_item_get_current_value_index(item);
|
bool value = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||||
@@ -30,7 +30,7 @@ static void xtreme_app_scene_statusbar_status_icons_changed(VariableItem* item)
|
|||||||
app->save_settings = true;
|
app->save_settings = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xtreme_app_scene_statusbar_bar_borders_changed(VariableItem* item) {
|
static void xtreme_app_scene_interface_statusbar_bar_borders_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
bool value = variable_item_get_current_value_index(item);
|
bool value = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||||
@@ -38,7 +38,7 @@ static void xtreme_app_scene_statusbar_bar_borders_changed(VariableItem* item) {
|
|||||||
app->save_settings = true;
|
app->save_settings = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xtreme_app_scene_statusbar_bar_background_changed(VariableItem* item) {
|
static void xtreme_app_scene_interface_statusbar_bar_background_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
bool value = variable_item_get_current_value_index(item);
|
bool value = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||||
@@ -46,7 +46,7 @@ static void xtreme_app_scene_statusbar_bar_background_changed(VariableItem* item
|
|||||||
app->save_settings = true;
|
app->save_settings = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xtreme_app_scene_statusbar_on_enter(void* context) {
|
void xtreme_app_scene_interface_statusbar_on_enter(void* context) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
||||||
VariableItemList* var_item_list = app->var_item_list;
|
VariableItemList* var_item_list = app->var_item_list;
|
||||||
@@ -56,41 +56,41 @@ void xtreme_app_scene_statusbar_on_enter(void* context) {
|
|||||||
var_item_list,
|
var_item_list,
|
||||||
"Battery Icon",
|
"Battery Icon",
|
||||||
BatteryIconCount,
|
BatteryIconCount,
|
||||||
xtreme_app_scene_statusbar_battery_icon_changed,
|
xtreme_app_scene_interface_statusbar_battery_icon_changed,
|
||||||
app);
|
app);
|
||||||
variable_item_set_current_value_index(item, 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]);
|
variable_item_set_current_value_text(item, battery_icon_names[xtreme_settings->battery_icon]);
|
||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list, "Status Icons", 2, xtreme_app_scene_statusbar_status_icons_changed, app);
|
var_item_list, "Status Icons", 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_index(item, xtreme_settings->status_icons);
|
||||||
variable_item_set_current_value_text(item, xtreme_settings->status_icons ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, xtreme_settings->status_icons ? "ON" : "OFF");
|
||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list, "Bar Borders", 2, xtreme_app_scene_statusbar_bar_borders_changed, app);
|
var_item_list, "Bar Borders", 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_index(item, xtreme_settings->bar_borders);
|
||||||
variable_item_set_current_value_text(item, xtreme_settings->bar_borders ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, xtreme_settings->bar_borders ? "ON" : "OFF");
|
||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list, "Bar Background", 2, xtreme_app_scene_statusbar_bar_background_changed, app);
|
var_item_list, "Bar Background", 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_index(item, xtreme_settings->bar_background);
|
||||||
variable_item_set_current_value_text(item, xtreme_settings->bar_background ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, xtreme_settings->bar_background ? "ON" : "OFF");
|
||||||
|
|
||||||
variable_item_list_set_enter_callback(
|
variable_item_list_set_enter_callback(
|
||||||
var_item_list, xtreme_app_scene_statusbar_var_item_list_callback, app);
|
var_item_list, xtreme_app_scene_interface_statusbar_var_item_list_callback, app);
|
||||||
|
|
||||||
variable_item_list_set_selected_item(
|
variable_item_list_set_selected_item(
|
||||||
var_item_list, scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneStatusbar));
|
var_item_list, scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneInterfaceStatusbar));
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
|
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool xtreme_app_scene_statusbar_on_event(void* context, SceneManagerEvent event) {
|
bool xtreme_app_scene_interface_statusbar_on_event(void* context, SceneManagerEvent event) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
|
|
||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneStatusbar, event.event);
|
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneInterfaceStatusbar, event.event);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
default:
|
default:
|
||||||
@@ -101,7 +101,7 @@ bool xtreme_app_scene_statusbar_on_event(void* context, SceneManagerEvent event)
|
|||||||
return consumed;
|
return consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xtreme_app_scene_statusbar_on_exit(void* context) {
|
void xtreme_app_scene_interface_statusbar_on_exit(void* context) {
|
||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
variable_item_list_reset(app->var_item_list);
|
variable_item_list_reset(app->var_item_list);
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
#include "../xtreme_app.h"
|
#include "../xtreme_app.h"
|
||||||
|
|
||||||
enum VarItemListIndex {
|
enum VarItemListIndex {
|
||||||
VarItemListIndexSortDirsFirst,
|
|
||||||
VarItemListIndexChangeDeviceName,
|
VarItemListIndexChangeDeviceName,
|
||||||
VarItemListIndexExperimentalOptions,
|
VarItemListIndexXpLevel,
|
||||||
VarItemListIndexDarkMode,
|
VarItemListIndexButthurtTimer,
|
||||||
VarItemListIndexLeftHanded,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void xtreme_app_scene_misc_var_item_list_callback(void* context, uint32_t index) {
|
void xtreme_app_scene_misc_var_item_list_callback(void* context, uint32_t index) {
|
||||||
@@ -13,30 +11,26 @@ void xtreme_app_scene_misc_var_item_list_callback(void* context, uint32_t index)
|
|||||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xtreme_app_scene_misc_sort_dirs_first_changed(VariableItem* item) {
|
static void xtreme_app_scene_misc_xp_level_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
bool value = variable_item_get_current_value_index(item);
|
app->xp_level = variable_item_get_current_value_index(item) + 1;
|
||||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
char level_str[4];
|
||||||
XTREME_SETTINGS()->sort_dirs_first = value;
|
snprintf(level_str, 4, "%li", app->xp_level);
|
||||||
app->save_settings = true;
|
variable_item_set_current_value_text(item, level_str);
|
||||||
|
app->save_level = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xtreme_app_scene_misc_dark_mode_changed(VariableItem* item) {
|
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_misc_butthurt_timer_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
bool value = variable_item_get_current_value_index(item);
|
uint8_t index = variable_item_get_current_value_index(item);
|
||||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, butthurt_timer_names[index]);
|
||||||
XTREME_SETTINGS()->dark_mode = value;
|
XTREME_SETTINGS()->butthurt_timer = butthurt_timer_values[index];
|
||||||
app->save_settings = true;
|
app->save_settings = true;
|
||||||
}
|
app->require_reboot = true;
|
||||||
|
|
||||||
static void xtreme_app_scene_misc_left_handed_changed(VariableItem* item) {
|
|
||||||
bool value = variable_item_get_current_value_index(item);
|
|
||||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
|
||||||
if(value) {
|
|
||||||
furi_hal_rtc_set_flag(FuriHalRtcFlagHandOrient);
|
|
||||||
} else {
|
|
||||||
furi_hal_rtc_reset_flag(FuriHalRtcFlagHandOrient);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void xtreme_app_scene_misc_on_enter(void* context) {
|
void xtreme_app_scene_misc_on_enter(void* context) {
|
||||||
@@ -44,26 +38,31 @@ void xtreme_app_scene_misc_on_enter(void* context) {
|
|||||||
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
||||||
VariableItemList* var_item_list = app->var_item_list;
|
VariableItemList* var_item_list = app->var_item_list;
|
||||||
VariableItem* item;
|
VariableItem* item;
|
||||||
|
uint8_t value_index;
|
||||||
item = variable_item_list_add(
|
|
||||||
var_item_list, "Sort Dirs First", 2, xtreme_app_scene_misc_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_list_add(var_item_list, "Change Device Name", 0, NULL, app);
|
variable_item_list_add(var_item_list, "Change Device Name", 0, NULL, app);
|
||||||
|
|
||||||
variable_item_list_add(var_item_list, " Experimental Options:", 0, NULL, app);
|
char level_str[4];
|
||||||
|
snprintf(level_str, 4, "%li", app->xp_level);
|
||||||
|
item = variable_item_list_add(
|
||||||
|
var_item_list,
|
||||||
|
"XP Level",
|
||||||
|
DOLPHIN_LEVEL_COUNT + 1,
|
||||||
|
xtreme_app_scene_misc_xp_level_changed,
|
||||||
|
app);
|
||||||
|
variable_item_set_current_value_index(item, app->xp_level - 1);
|
||||||
|
variable_item_set_current_value_text(item, level_str);
|
||||||
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list, "Dark Mode", 2, xtreme_app_scene_misc_dark_mode_changed, app);
|
var_item_list,
|
||||||
variable_item_set_current_value_index(item, xtreme_settings->dark_mode);
|
"Butthurt Timer",
|
||||||
variable_item_set_current_value_text(item, xtreme_settings->dark_mode ? "ON" : "OFF");
|
COUNT_OF(butthurt_timer_names),
|
||||||
|
xtreme_app_scene_misc_butthurt_timer_changed,
|
||||||
item = variable_item_list_add(
|
app);
|
||||||
var_item_list, "Left Handed", 2, xtreme_app_scene_misc_left_handed_changed, app);
|
value_index = value_index_int32(
|
||||||
bool value = furi_hal_rtc_is_flag_set(FuriHalRtcFlagHandOrient);
|
xtreme_settings->butthurt_timer, butthurt_timer_values, COUNT_OF(butthurt_timer_names));
|
||||||
variable_item_set_current_value_index(item, value);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, butthurt_timer_names[value_index]);
|
||||||
|
|
||||||
variable_item_list_set_enter_callback(
|
variable_item_list_set_enter_callback(
|
||||||
var_item_list, xtreme_app_scene_misc_var_item_list_callback, app);
|
var_item_list, xtreme_app_scene_misc_var_item_list_callback, app);
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ static void xtreme_app_scene_protocols_frequencies_add_text_input_callback(void*
|
|||||||
bool is_hopper =
|
bool is_hopper =
|
||||||
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneProtocolsFrequenciesAdd);
|
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneProtocolsFrequenciesAdd);
|
||||||
if(is_hopper) {
|
if(is_hopper) {
|
||||||
FrequencyList_push_back(app->subghz_hopper_frequencies, value);
|
FrequencyList_push_back(app->subghz_hopper_freqs, value);
|
||||||
} else {
|
} else {
|
||||||
FrequencyList_push_back(app->subghz_static_frequencies, value);
|
FrequencyList_push_back(app->subghz_static_freqs, value);
|
||||||
}
|
}
|
||||||
app->save_subghz_frequencies = true;
|
app->save_subghz_frequencies = true;
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, TextInputResultOk);
|
view_dispatcher_send_custom_event(app->view_dispatcher, TextInputResultOk);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ void xtreme_app_scene_protocols_frequencies_hopper_var_item_list_callback(
|
|||||||
static void xtreme_app_scene_protocols_frequencies_hopper_frequency_changed(VariableItem* item) {
|
static void xtreme_app_scene_protocols_frequencies_hopper_frequency_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
app->subghz_hopper_index = variable_item_get_current_value_index(item);
|
app->subghz_hopper_index = variable_item_get_current_value_index(item);
|
||||||
uint32_t value = *FrequencyList_get(app->subghz_hopper_frequencies, app->subghz_hopper_index);
|
uint32_t value = *FrequencyList_get(app->subghz_hopper_freqs, app->subghz_hopper_index);
|
||||||
char text[10] = {0};
|
char text[10] = {0};
|
||||||
snprintf(text, sizeof(text), "%lu.%02lu", value / 1000000, (value % 1000000) / 10000);
|
snprintf(text, sizeof(text), "%lu.%02lu", value / 1000000, (value % 1000000) / 10000);
|
||||||
variable_item_set_current_value_text(item, text);
|
variable_item_set_current_value_text(item, text);
|
||||||
@@ -30,14 +30,14 @@ void xtreme_app_scene_protocols_frequencies_hopper_on_enter(void* context) {
|
|||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list,
|
var_item_list,
|
||||||
"Hopper Freq",
|
"Hopper Freq",
|
||||||
FrequencyList_size(app->subghz_hopper_frequencies),
|
FrequencyList_size(app->subghz_hopper_freqs),
|
||||||
xtreme_app_scene_protocols_frequencies_hopper_frequency_changed,
|
xtreme_app_scene_protocols_frequencies_hopper_frequency_changed,
|
||||||
app);
|
app);
|
||||||
app->subghz_hopper_index = 0;
|
app->subghz_hopper_index = 0;
|
||||||
variable_item_set_current_value_index(item, app->subghz_hopper_index);
|
variable_item_set_current_value_index(item, app->subghz_hopper_index);
|
||||||
if(FrequencyList_size(app->subghz_hopper_frequencies)) {
|
if(FrequencyList_size(app->subghz_hopper_freqs)) {
|
||||||
uint32_t value =
|
uint32_t value =
|
||||||
*FrequencyList_get(app->subghz_hopper_frequencies, app->subghz_hopper_index);
|
*FrequencyList_get(app->subghz_hopper_freqs, app->subghz_hopper_index);
|
||||||
char text[10] = {0};
|
char text[10] = {0};
|
||||||
snprintf(text, sizeof(text), "%lu.%02lu", value / 1000000, (value % 1000000) / 10000);
|
snprintf(text, sizeof(text), "%lu.%02lu", value / 1000000, (value % 1000000) / 10000);
|
||||||
variable_item_set_current_value_text(item, text);
|
variable_item_set_current_value_text(item, text);
|
||||||
@@ -70,14 +70,14 @@ bool xtreme_app_scene_protocols_frequencies_hopper_on_event(void* context, Scene
|
|||||||
consumed = true;
|
consumed = true;
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case VarItemListIndexRemoveHopperFreq:
|
case VarItemListIndexRemoveHopperFreq:
|
||||||
if(!FrequencyList_size(app->subghz_hopper_frequencies)) break;
|
if(!FrequencyList_size(app->subghz_hopper_freqs)) break;
|
||||||
uint32_t value =
|
uint32_t value =
|
||||||
*FrequencyList_get(app->subghz_hopper_frequencies, app->subghz_hopper_index);
|
*FrequencyList_get(app->subghz_hopper_freqs, app->subghz_hopper_index);
|
||||||
FrequencyList_it_t it;
|
FrequencyList_it_t it;
|
||||||
FrequencyList_it(it, app->subghz_hopper_frequencies);
|
FrequencyList_it(it, app->subghz_hopper_freqs);
|
||||||
while(!FrequencyList_end_p(it)) {
|
while(!FrequencyList_end_p(it)) {
|
||||||
if(*FrequencyList_ref(it) == value) {
|
if(*FrequencyList_ref(it) == value) {
|
||||||
FrequencyList_remove(app->subghz_hopper_frequencies, it);
|
FrequencyList_remove(app->subghz_hopper_freqs, it);
|
||||||
} else {
|
} else {
|
||||||
FrequencyList_next(it);
|
FrequencyList_next(it);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ void xtreme_app_scene_protocols_frequencies_static_var_item_list_callback(
|
|||||||
static void xtreme_app_scene_protocols_frequencies_static_frequency_changed(VariableItem* item) {
|
static void xtreme_app_scene_protocols_frequencies_static_frequency_changed(VariableItem* item) {
|
||||||
XtremeApp* app = variable_item_get_context(item);
|
XtremeApp* app = variable_item_get_context(item);
|
||||||
app->subghz_static_index = variable_item_get_current_value_index(item);
|
app->subghz_static_index = variable_item_get_current_value_index(item);
|
||||||
uint32_t value = *FrequencyList_get(app->subghz_static_frequencies, app->subghz_static_index);
|
uint32_t value = *FrequencyList_get(app->subghz_static_freqs, app->subghz_static_index);
|
||||||
char text[10] = {0};
|
char text[10] = {0};
|
||||||
snprintf(text, sizeof(text), "%lu.%02lu", value / 1000000, (value % 1000000) / 10000);
|
snprintf(text, sizeof(text), "%lu.%02lu", value / 1000000, (value % 1000000) / 10000);
|
||||||
variable_item_set_current_value_text(item, text);
|
variable_item_set_current_value_text(item, text);
|
||||||
@@ -30,14 +30,14 @@ void xtreme_app_scene_protocols_frequencies_static_on_enter(void* context) {
|
|||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
var_item_list,
|
var_item_list,
|
||||||
"Static Freq",
|
"Static Freq",
|
||||||
FrequencyList_size(app->subghz_static_frequencies),
|
FrequencyList_size(app->subghz_static_freqs),
|
||||||
xtreme_app_scene_protocols_frequencies_static_frequency_changed,
|
xtreme_app_scene_protocols_frequencies_static_frequency_changed,
|
||||||
app);
|
app);
|
||||||
app->subghz_static_index = 0;
|
app->subghz_static_index = 0;
|
||||||
variable_item_set_current_value_index(item, app->subghz_static_index);
|
variable_item_set_current_value_index(item, app->subghz_static_index);
|
||||||
if(FrequencyList_size(app->subghz_static_frequencies)) {
|
if(FrequencyList_size(app->subghz_static_freqs)) {
|
||||||
uint32_t value =
|
uint32_t value =
|
||||||
*FrequencyList_get(app->subghz_static_frequencies, app->subghz_static_index);
|
*FrequencyList_get(app->subghz_static_freqs, app->subghz_static_index);
|
||||||
char text[10] = {0};
|
char text[10] = {0};
|
||||||
snprintf(text, sizeof(text), "%lu.%02lu", value / 1000000, (value % 1000000) / 10000);
|
snprintf(text, sizeof(text), "%lu.%02lu", value / 1000000, (value % 1000000) / 10000);
|
||||||
variable_item_set_current_value_text(item, text);
|
variable_item_set_current_value_text(item, text);
|
||||||
@@ -70,14 +70,14 @@ bool xtreme_app_scene_protocols_frequencies_static_on_event(void* context, Scene
|
|||||||
consumed = true;
|
consumed = true;
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case VarItemListIndexRemoveStaticFreq:
|
case VarItemListIndexRemoveStaticFreq:
|
||||||
if(!FrequencyList_size(app->subghz_static_frequencies)) break;
|
if(!FrequencyList_size(app->subghz_static_freqs)) break;
|
||||||
uint32_t value =
|
uint32_t value =
|
||||||
*FrequencyList_get(app->subghz_static_frequencies, app->subghz_static_index);
|
*FrequencyList_get(app->subghz_static_freqs, app->subghz_static_index);
|
||||||
FrequencyList_it_t it;
|
FrequencyList_it_t it;
|
||||||
FrequencyList_it(it, app->subghz_static_frequencies);
|
FrequencyList_it(it, app->subghz_static_freqs);
|
||||||
while(!FrequencyList_end_p(it)) {
|
while(!FrequencyList_end_p(it)) {
|
||||||
if(*FrequencyList_ref(it) == value) {
|
if(*FrequencyList_ref(it) == value) {
|
||||||
FrequencyList_remove(app->subghz_static_frequencies, it);
|
FrequencyList_remove(app->subghz_static_freqs, it);
|
||||||
} else {
|
} else {
|
||||||
FrequencyList_next(it);
|
FrequencyList_next(it);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
#include "../xtreme_app.h"
|
#include "../xtreme_app.h"
|
||||||
|
|
||||||
enum VarItemListIndex {
|
enum VarItemListIndex {
|
||||||
VarItemListIndexGraphics,
|
VarItemListIndexInterface,
|
||||||
VarItemListIndexMainmenu,
|
|
||||||
VarItemListIndexStatusbar,
|
|
||||||
VarItemListIndexProtocols,
|
VarItemListIndexProtocols,
|
||||||
VarItemListIndexDolphin,
|
|
||||||
VarItemListIndexMisc,
|
VarItemListIndexMisc,
|
||||||
|
VarItemListIndexVersion,
|
||||||
};
|
};
|
||||||
|
|
||||||
void xtreme_app_scene_start_var_item_list_callback(void* context, uint32_t index) {
|
void xtreme_app_scene_start_var_item_list_callback(void* context, uint32_t index) {
|
||||||
@@ -18,13 +16,9 @@ void xtreme_app_scene_start_on_enter(void* context) {
|
|||||||
XtremeApp* app = context;
|
XtremeApp* app = context;
|
||||||
VariableItemList* var_item_list = app->var_item_list;
|
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, "Interface", 0, NULL, app);
|
||||||
variable_item_list_add(var_item_list, "Mainmenu", 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, "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, "Misc", 0, NULL, app);
|
||||||
|
|
||||||
variable_item_list_add(var_item_list, furi_string_get_cstr(app->version_tag), 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(
|
variable_item_list_set_enter_callback(
|
||||||
@@ -44,21 +38,12 @@ bool xtreme_app_scene_start_on_event(void* context, SceneManagerEvent event) {
|
|||||||
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneStart, event.event);
|
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneStart, event.event);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
switch(event.event) {
|
switch(event.event) {
|
||||||
case VarItemListIndexGraphics:
|
case VarItemListIndexInterface:
|
||||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneGraphics);
|
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterface);
|
||||||
break;
|
|
||||||
case VarItemListIndexMainmenu:
|
|
||||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMainmenu);
|
|
||||||
break;
|
|
||||||
case VarItemListIndexStatusbar:
|
|
||||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneStatusbar);
|
|
||||||
break;
|
break;
|
||||||
case VarItemListIndexProtocols:
|
case VarItemListIndexProtocols:
|
||||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneProtocols);
|
scene_manager_next_scene(app->scene_manager, XtremeAppSceneProtocols);
|
||||||
break;
|
break;
|
||||||
case VarItemListIndexDolphin:
|
|
||||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneDolphin);
|
|
||||||
break;
|
|
||||||
case VarItemListIndexMisc:
|
case VarItemListIndexMisc:
|
||||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMisc);
|
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMisc);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -22,19 +22,15 @@ static bool xtreme_app_back_event_callback(void* context) {
|
|||||||
Stream* stream = file_stream_alloc(storage);
|
Stream* stream = file_stream_alloc(storage);
|
||||||
if(file_stream_open(stream, XTREME_APPS_PATH, FSAM_READ_WRITE, FSOM_CREATE_ALWAYS)){
|
if(file_stream_open(stream, XTREME_APPS_PATH, FSAM_READ_WRITE, FSOM_CREATE_ALWAYS)){
|
||||||
CharList_it_t it;
|
CharList_it_t it;
|
||||||
CharList_it(it, app->mainmenu_apps_paths);
|
CharList_it(it, app->mainmenu_app_paths);
|
||||||
for(uint i = 0; i < CharList_size(app->mainmenu_apps_paths); i++) {
|
for(uint i = 0; i < CharList_size(app->mainmenu_app_paths); i++) {
|
||||||
stream_write_format(stream, "%s\n", *CharList_get(app->mainmenu_apps_paths, i));
|
stream_write_format(stream, "%s\n", *CharList_get(app->mainmenu_app_paths, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_stream_close(stream);
|
file_stream_close(stream);
|
||||||
stream_free(stream);
|
stream_free(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(app->save_subghz) {
|
|
||||||
furi_hal_subghz_set_extend_settings(app->subghz_extend, app->subghz_bypass);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(app->save_subghz_frequencies) {
|
if(app->save_subghz_frequencies) {
|
||||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||||
do {
|
do {
|
||||||
@@ -54,33 +50,28 @@ static bool xtreme_app_back_event_callback(void* context) {
|
|||||||
if(!flipper_format_rewind(file)) break;
|
if(!flipper_format_rewind(file)) break;
|
||||||
while(flipper_format_delete_key(file, "Frequency"))
|
while(flipper_format_delete_key(file, "Frequency"))
|
||||||
;
|
;
|
||||||
FrequencyList_it(it, app->subghz_static_frequencies);
|
FrequencyList_it(it, app->subghz_static_freqs);
|
||||||
for(uint i = 0; i < FrequencyList_size(app->subghz_static_frequencies); i++) {
|
for(uint i = 0; i < FrequencyList_size(app->subghz_static_freqs); i++) {
|
||||||
flipper_format_write_uint32(
|
flipper_format_write_uint32(
|
||||||
file, "Frequency", FrequencyList_get(app->subghz_static_frequencies, i), 1);
|
file, "Frequency", FrequencyList_get(app->subghz_static_freqs, i), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!flipper_format_rewind(file)) break;
|
if(!flipper_format_rewind(file)) break;
|
||||||
while(flipper_format_delete_key(file, "Hopper_frequency"))
|
while(flipper_format_delete_key(file, "Hopper_frequency"))
|
||||||
;
|
;
|
||||||
for(uint i = 0; i < FrequencyList_size(app->subghz_hopper_frequencies); i++) {
|
for(uint i = 0; i < FrequencyList_size(app->subghz_hopper_freqs); i++) {
|
||||||
flipper_format_write_uint32(
|
flipper_format_write_uint32(
|
||||||
file,
|
file,
|
||||||
"Hopper_frequency",
|
"Hopper_frequency",
|
||||||
FrequencyList_get(app->subghz_hopper_frequencies, i),
|
FrequencyList_get(app->subghz_hopper_freqs, i),
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
} while(false);
|
} while(false);
|
||||||
flipper_format_free(file);
|
flipper_format_free(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(app->save_level) {
|
if(app->save_subghz) {
|
||||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
furi_hal_subghz_set_extend_settings(app->subghz_extend, app->subghz_bypass);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(app->save_name) {
|
if(app->save_name) {
|
||||||
@@ -114,6 +105,15 @@ static bool xtreme_app_back_event_callback(void* context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(app->save_level) {
|
||||||
|
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||||
|
int32_t xp = app->xp_level > 1 ? dolphin_get_levels()[app->xp_level - 2] : 0;
|
||||||
|
dolphin->state->data.icounter = xp + 1;
|
||||||
|
dolphin->state->dirty = true;
|
||||||
|
dolphin_state_save(dolphin->state);
|
||||||
|
furi_record_close(RECORD_DOLPHIN);
|
||||||
|
}
|
||||||
|
|
||||||
if(app->save_settings) {
|
if(app->save_settings) {
|
||||||
XTREME_SETTINGS_SAVE();
|
XTREME_SETTINGS_SAVE();
|
||||||
}
|
}
|
||||||
@@ -171,8 +171,8 @@ XtremeApp* xtreme_app_alloc() {
|
|||||||
|
|
||||||
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
||||||
|
|
||||||
app->asset_pack = 0;
|
app->asset_pack_index = 0;
|
||||||
CharList_init(app->asset_packs);
|
CharList_init(app->asset_pack_names);
|
||||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
File* folder = storage_file_alloc(storage);
|
File* folder = storage_file_alloc(storage);
|
||||||
FileInfo info;
|
FileInfo info;
|
||||||
@@ -184,18 +184,18 @@ XtremeApp* xtreme_app_alloc() {
|
|||||||
strlcpy(copy, name, MAX_PACK_NAME_LEN);
|
strlcpy(copy, name, MAX_PACK_NAME_LEN);
|
||||||
uint idx = 0;
|
uint idx = 0;
|
||||||
if(strcmp(copy, "NSFW") != 0) {
|
if(strcmp(copy, "NSFW") != 0) {
|
||||||
for(; idx < CharList_size(app->asset_packs); idx++) {
|
for(; idx < CharList_size(app->asset_pack_names); idx++) {
|
||||||
char* comp = *CharList_get(app->asset_packs, idx);
|
char* comp = *CharList_get(app->asset_pack_names, idx);
|
||||||
if(strcasecmp(copy, comp) < 0 && strcmp(comp, "NSFW") != 0) {
|
if(strcasecmp(copy, comp) < 0 && strcmp(comp, "NSFW") != 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CharList_push_at(app->asset_packs, idx, copy);
|
CharList_push_at(app->asset_pack_names, idx, copy);
|
||||||
if(app->asset_pack != 0) {
|
if(app->asset_pack_index != 0) {
|
||||||
if(idx < app->asset_pack) app->asset_pack++;
|
if(idx < app->asset_pack_index) app->asset_pack_index++;
|
||||||
} else {
|
} else {
|
||||||
if(strcmp(copy, xtreme_settings->asset_pack) == 0) app->asset_pack = idx + 1;
|
if(strcmp(copy, xtreme_settings->asset_pack) == 0) app->asset_pack_index = idx + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,17 +203,17 @@ XtremeApp* xtreme_app_alloc() {
|
|||||||
free(name);
|
free(name);
|
||||||
storage_file_free(folder);
|
storage_file_free(folder);
|
||||||
|
|
||||||
CharList_init(app->mainmenu_apps_names);
|
CharList_init(app->mainmenu_app_names);
|
||||||
CharList_init(app->mainmenu_apps_paths);
|
CharList_init(app->mainmenu_app_paths);
|
||||||
Stream* stream = file_stream_alloc(storage);
|
Stream* stream = file_stream_alloc(storage);
|
||||||
FuriString* line = furi_string_alloc();
|
FuriString* line = furi_string_alloc();
|
||||||
if(file_stream_open(stream, XTREME_APPS_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) {
|
if(file_stream_open(stream, XTREME_APPS_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) {
|
||||||
while(stream_read_line(stream, line)) {
|
while(stream_read_line(stream, line)) {
|
||||||
furi_string_replace_all(line, "\r", "");
|
furi_string_replace_all(line, "\r", "");
|
||||||
furi_string_replace_all(line, "\n", "");
|
furi_string_replace_all(line, "\n", "");
|
||||||
CharList_push_back(app->mainmenu_apps_paths, strdup(furi_string_get_cstr(line)));
|
CharList_push_back(app->mainmenu_app_paths, strdup(furi_string_get_cstr(line)));
|
||||||
fap_loader_load_name_and_icon(line, storage, NULL, line);
|
fap_loader_load_name_and_icon(line, storage, NULL, line);
|
||||||
CharList_push_back(app->mainmenu_apps_names, strdup(furi_string_get_cstr(line)));
|
CharList_push_back(app->mainmenu_app_names, strdup(furi_string_get_cstr(line)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
furi_string_free(line);
|
furi_string_free(line);
|
||||||
@@ -221,8 +221,8 @@ XtremeApp* xtreme_app_alloc() {
|
|||||||
stream_free(stream);
|
stream_free(stream);
|
||||||
|
|
||||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||||
FrequencyList_init(app->subghz_static_frequencies);
|
FrequencyList_init(app->subghz_static_freqs);
|
||||||
FrequencyList_init(app->subghz_hopper_frequencies);
|
FrequencyList_init(app->subghz_hopper_freqs);
|
||||||
app->subghz_use_defaults = true;
|
app->subghz_use_defaults = true;
|
||||||
do {
|
do {
|
||||||
uint32_t temp;
|
uint32_t temp;
|
||||||
@@ -233,14 +233,14 @@ XtremeApp* xtreme_app_alloc() {
|
|||||||
if(!flipper_format_rewind(file)) break;
|
if(!flipper_format_rewind(file)) break;
|
||||||
while(flipper_format_read_uint32(file, "Frequency", &temp, 1)) {
|
while(flipper_format_read_uint32(file, "Frequency", &temp, 1)) {
|
||||||
if(furi_hal_subghz_is_frequency_valid(temp)) {
|
if(furi_hal_subghz_is_frequency_valid(temp)) {
|
||||||
FrequencyList_push_back(app->subghz_static_frequencies, temp);
|
FrequencyList_push_back(app->subghz_static_freqs, temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!flipper_format_rewind(file)) break;
|
if(!flipper_format_rewind(file)) break;
|
||||||
while(flipper_format_read_uint32(file, "Hopper_frequency", &temp, 1)) {
|
while(flipper_format_read_uint32(file, "Hopper_frequency", &temp, 1)) {
|
||||||
if(furi_hal_subghz_is_frequency_valid(temp)) {
|
if(furi_hal_subghz_is_frequency_valid(temp)) {
|
||||||
FrequencyList_push_back(app->subghz_hopper_frequencies, temp);
|
FrequencyList_push_back(app->subghz_hopper_freqs, temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while(false);
|
} while(false);
|
||||||
@@ -249,13 +249,13 @@ XtremeApp* xtreme_app_alloc() {
|
|||||||
|
|
||||||
furi_hal_subghz_get_extend_settings(&app->subghz_extend, &app->subghz_bypass);
|
furi_hal_subghz_get_extend_settings(&app->subghz_extend, &app->subghz_bypass);
|
||||||
|
|
||||||
|
strlcpy(app->device_name, furi_hal_version_get_name_ptr(), NAMECHANGER_TEXT_STORE_SIZE);
|
||||||
|
|
||||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||||
DolphinStats stats = dolphin_stats(dolphin);
|
DolphinStats stats = dolphin_stats(dolphin);
|
||||||
app->dolphin_level = stats.level;
|
app->xp_level = stats.level;
|
||||||
furi_record_close(RECORD_DOLPHIN);
|
furi_record_close(RECORD_DOLPHIN);
|
||||||
|
|
||||||
strlcpy(app->device_name, furi_hal_version_get_name_ptr(), NAMECHANGER_TEXT_STORE_SIZE);
|
|
||||||
|
|
||||||
app->version_tag =
|
app->version_tag =
|
||||||
furi_string_alloc_printf("%s %s", version_get_version(NULL), version_get_builddate(NULL));
|
furi_string_alloc_printf("%s %s", version_get_version(NULL), version_get_builddate(NULL));
|
||||||
|
|
||||||
@@ -280,21 +280,22 @@ void xtreme_app_free(XtremeApp* app) {
|
|||||||
// Settings deinit
|
// Settings deinit
|
||||||
|
|
||||||
CharList_it_t it;
|
CharList_it_t it;
|
||||||
for(CharList_it(it, app->asset_packs); !CharList_end_p(it); CharList_next(it)) {
|
for(CharList_it(it, app->asset_pack_names); !CharList_end_p(it); CharList_next(it)) {
|
||||||
free(*CharList_cref(it));
|
free(*CharList_cref(it));
|
||||||
}
|
}
|
||||||
CharList_clear(app->asset_packs);
|
CharList_clear(app->asset_pack_names);
|
||||||
for(CharList_it(it, app->mainmenu_apps_names); !CharList_end_p(it); CharList_next(it)) {
|
|
||||||
free(*CharList_cref(it));
|
|
||||||
}
|
|
||||||
CharList_clear(app->mainmenu_apps_names);
|
|
||||||
for(CharList_it(it, app->mainmenu_apps_paths); !CharList_end_p(it); CharList_next(it)) {
|
|
||||||
free(*CharList_cref(it));
|
|
||||||
}
|
|
||||||
CharList_clear(app->mainmenu_apps_paths);
|
|
||||||
|
|
||||||
FrequencyList_clear(app->subghz_static_frequencies);
|
for(CharList_it(it, app->mainmenu_app_names); !CharList_end_p(it); CharList_next(it)) {
|
||||||
FrequencyList_clear(app->subghz_hopper_frequencies);
|
free(*CharList_cref(it));
|
||||||
|
}
|
||||||
|
CharList_clear(app->mainmenu_app_names);
|
||||||
|
for(CharList_it(it, app->mainmenu_app_paths); !CharList_end_p(it); CharList_next(it)) {
|
||||||
|
free(*CharList_cref(it));
|
||||||
|
}
|
||||||
|
CharList_clear(app->mainmenu_app_paths);
|
||||||
|
|
||||||
|
FrequencyList_clear(app->subghz_static_freqs);
|
||||||
|
FrequencyList_clear(app->subghz_hopper_freqs);
|
||||||
|
|
||||||
furi_string_free(app->version_tag);
|
furi_string_free(app->version_tag);
|
||||||
|
|
||||||
|
|||||||
@@ -36,27 +36,29 @@ typedef struct {
|
|||||||
VariableItemList* var_item_list;
|
VariableItemList* var_item_list;
|
||||||
TextInput* text_input;
|
TextInput* text_input;
|
||||||
Popup* popup;
|
Popup* popup;
|
||||||
uint asset_pack;
|
|
||||||
CharList_t asset_packs;
|
CharList_t asset_pack_names;
|
||||||
CharList_t mainmenu_apps_names;
|
uint8_t asset_pack_index;
|
||||||
CharList_t mainmenu_apps_paths;
|
CharList_t mainmenu_app_names;
|
||||||
|
CharList_t mainmenu_app_paths;
|
||||||
uint8_t mainmenu_app_index;
|
uint8_t mainmenu_app_index;
|
||||||
bool subghz_use_defaults;
|
bool subghz_use_defaults;
|
||||||
FrequencyList_t subghz_static_frequencies;
|
FrequencyList_t subghz_static_freqs;
|
||||||
uint8_t subghz_static_index;
|
uint8_t subghz_static_index;
|
||||||
FrequencyList_t subghz_hopper_frequencies;
|
FrequencyList_t subghz_hopper_freqs;
|
||||||
uint8_t subghz_hopper_index;
|
uint8_t subghz_hopper_index;
|
||||||
char subghz_freq_buffer[XTREME_SUBGHZ_FREQ_BUFFER_SIZE];
|
char subghz_freq_buffer[XTREME_SUBGHZ_FREQ_BUFFER_SIZE];
|
||||||
bool subghz_extend;
|
bool subghz_extend;
|
||||||
bool subghz_bypass;
|
bool subghz_bypass;
|
||||||
int dolphin_level;
|
|
||||||
char device_name[NAMECHANGER_TEXT_STORE_SIZE];
|
char device_name[NAMECHANGER_TEXT_STORE_SIZE];
|
||||||
|
int32_t xp_level;
|
||||||
FuriString* version_tag;
|
FuriString* version_tag;
|
||||||
|
|
||||||
bool save_mainmenu_apps;
|
bool save_mainmenu_apps;
|
||||||
bool save_subghz;
|
|
||||||
bool save_subghz_frequencies;
|
bool save_subghz_frequencies;
|
||||||
bool save_level;
|
bool save_subghz;
|
||||||
bool save_name;
|
bool save_name;
|
||||||
|
bool save_level;
|
||||||
bool save_settings;
|
bool save_settings;
|
||||||
bool require_reboot;
|
bool require_reboot;
|
||||||
} XtremeApp;
|
} XtremeApp;
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ void XTREME_SETTINGS_LOAD() {
|
|||||||
xtreme_settings->status_icons = true; // ON
|
xtreme_settings->status_icons = true; // ON
|
||||||
xtreme_settings->bar_borders = true; // ON
|
xtreme_settings->bar_borders = true; // ON
|
||||||
xtreme_settings->bar_background = false; // OFF
|
xtreme_settings->bar_background = false; // OFF
|
||||||
|
xtreme_settings->sort_dirs_first = true; // ON
|
||||||
|
xtreme_settings->dark_mode = false; // OFF
|
||||||
xtreme_settings->bad_bt = false; // USB
|
xtreme_settings->bad_bt = false; // USB
|
||||||
xtreme_settings->bad_bt_remember = false; // OFF
|
xtreme_settings->bad_bt_remember = false; // OFF
|
||||||
xtreme_settings->butthurt_timer = 43200; // 12 H
|
xtreme_settings->butthurt_timer = 43200; // 12 H
|
||||||
xtreme_settings->sort_dirs_first = true; // ON
|
|
||||||
xtreme_settings->dark_mode = false; // OFF
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,16 +15,13 @@ extern "C" {
|
|||||||
|
|
||||||
#define MAX_PACK_NAME_LEN 32
|
#define MAX_PACK_NAME_LEN 32
|
||||||
|
|
||||||
#define XTREME_SETTINGS_VERSION (6)
|
#define XTREME_SETTINGS_VERSION (7)
|
||||||
#define XTREME_SETTINGS_PATH_OLD INT_PATH(XTREME_SETTINGS_FILE_NAME)
|
#define XTREME_SETTINGS_PATH_OLD INT_PATH(XTREME_SETTINGS_FILE_NAME)
|
||||||
#define XTREME_SETTINGS_PATH EXT_PATH(XTREME_SETTINGS_FILE_NAME)
|
#define XTREME_SETTINGS_PATH EXT_PATH(XTREME_SETTINGS_FILE_NAME)
|
||||||
#define XTREME_SETTINGS_MAGIC (0x69)
|
#define XTREME_SETTINGS_MAGIC (0x69)
|
||||||
|
|
||||||
#define XTREME_APPS_PATH EXT_PATH(XTREME_APPS_FILE_NAME)
|
#define XTREME_APPS_PATH EXT_PATH(XTREME_APPS_FILE_NAME)
|
||||||
|
|
||||||
// Some settings function backwards (logically) in
|
|
||||||
// order to fit the default value we want
|
|
||||||
// (values will default to 0 / false)
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char asset_pack[MAX_PACK_NAME_LEN];
|
char asset_pack[MAX_PACK_NAME_LEN];
|
||||||
uint16_t anim_speed;
|
uint16_t anim_speed;
|
||||||
@@ -35,11 +32,11 @@ typedef struct {
|
|||||||
bool status_icons;
|
bool status_icons;
|
||||||
bool bar_borders;
|
bool bar_borders;
|
||||||
bool bar_background;
|
bool bar_background;
|
||||||
|
bool sort_dirs_first;
|
||||||
|
bool dark_mode;
|
||||||
bool bad_bt;
|
bool bad_bt;
|
||||||
bool bad_bt_remember;
|
bool bad_bt_remember;
|
||||||
int32_t butthurt_timer;
|
int32_t butthurt_timer;
|
||||||
bool sort_dirs_first;
|
|
||||||
bool dark_mode;
|
|
||||||
} XtremeSettings;
|
} XtremeSettings;
|
||||||
|
|
||||||
XtremeSettings* XTREME_SETTINGS();
|
XtremeSettings* XTREME_SETTINGS();
|
||||||
|
|||||||
Reference in New Issue
Block a user