mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Rework xtreme settings and assets implementation
This commit is contained in:
@@ -1 +1 @@
|
||||
--ignore-ccache -C gccarm --rules-config .pvsconfig -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/ST25RFAL002 -e lib/STM32CubeWB -e lib/u8g2 -e lib/nanopb -e */arm-none-eabi/* -e applications/external/dap_link/lib/free-dap
|
||||
--ignore-ccache -C gccarm --rules-config .pvsconfig -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/ST25RFAL002 -e lib/STM32CubeWB -e lib/u8g2 -e lib/xtreme -e lib/nanopb -e */arm-none-eabi/* -e applications/external/dap_link/lib/free-dap
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <m-algo.h>
|
||||
#include <storage/storage.h>
|
||||
#include "toolbox/path.h"
|
||||
#include "xtreme/settings.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define FAP_MANIFEST_MAX_ICON_SIZE 32
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <furi_hal.h>
|
||||
#include <storage/storage.h>
|
||||
#include <lib/toolbox/path.h>
|
||||
#include <xtreme/settings.h>
|
||||
#include <xtreme.h>
|
||||
#include <lib/flipper_format/flipper_format.h>
|
||||
|
||||
#include <bt/bt_service/bt_i.h>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../bad_kb_app.h"
|
||||
#include "furi_hal_power.h"
|
||||
#include "furi_hal_usb.h"
|
||||
#include <xtreme/settings.h>
|
||||
#include <xtreme.h>
|
||||
|
||||
enum VarItemListIndex {
|
||||
VarItemListIndexKeyboardLayout,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../bad_kb_app.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
static void
|
||||
bad_kb_scene_error_event_callback(GuiButtonType result, InputType type, void* context) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <toolbox/path.h>
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define MAX_NAME_LEN 64
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../ibutton_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
static void ibutton_scene_delete_success_popup_callback(void* context) {
|
||||
iButton* ibutton = context;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "../ibutton_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
static void ibutton_scene_read_callback(void* context) {
|
||||
iButton* ibutton = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../ibutton_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
static void ibutton_scene_save_success_popup_callback(void* context) {
|
||||
iButton* ibutton = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../ibutton_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
static void ibutton_scene_write_success_popup_callback(void* context) {
|
||||
iButton* ibutton = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../infrared_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void infrared_scene_edit_rename_done_on_enter(void* context) {
|
||||
Infrared* infrared = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../infrared_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void infrared_scene_learn_done_on_enter(void* context) {
|
||||
Infrared* infrared = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../infrared_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
static void
|
||||
infrared_scene_learn_success_dialog_result_callback(DialogExResult result, void* context) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "../lfrfid_i.h"
|
||||
#include "../helpers/rfid_writer.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
static void writer_initialize(T55xxTiming* t55xxtiming) {
|
||||
t55xxtiming->wait_time = 400;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../lfrfid_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void lfrfid_scene_delete_success_on_enter(void* context) {
|
||||
LfRfid* app = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../lfrfid_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void lfrfid_scene_emulate_on_enter(void* context) {
|
||||
LfRfid* app = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../lfrfid_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define RAW_READ_TIME 5000
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../lfrfid_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void lfrfid_scene_rpc_on_enter(void* context) {
|
||||
LfRfid* app = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../lfrfid_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void lfrfid_scene_save_success_on_enter(void* context) {
|
||||
LfRfid* app = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../lfrfid_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
static void lfrfid_write_callback(LFRFIDWorkerWriteResult result, void* context) {
|
||||
LfRfid* app = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../lfrfid_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void lfrfid_scene_write_success_on_enter(void* context) {
|
||||
LfRfid* app = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void nfc_scene_delete_success_popup_callback(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define NFC_SCENE_EMULATE_UID_LOG_SIZE_MAX (200)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define NFC_MF_CLASSIC_DATA_NOT_CHANGED (0UL)
|
||||
#define NFC_MF_CLASSIC_DATA_CHANGED (1UL)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void nfc_scene_mf_classic_update_success_popup_callback(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void nfc_scene_mf_classic_write_success_popup_callback(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define NFC_MF_UL_DATA_NOT_CHANGED (0UL)
|
||||
#define NFC_MF_UL_DATA_CHANGED (1UL)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void nfc_scene_restore_original_popup_callback(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void nfc_scene_rpc_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void nfc_scene_save_success_popup_callback(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "../subghz_i.h"
|
||||
#include "../helpers/subghz_custom_event.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void subghz_scene_delete_success_popup_callback(void* context) {
|
||||
SubGhz* subghz = context;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <lib/subghz/blocks/custom_btn.h>
|
||||
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
typedef enum {
|
||||
SubGhzRpcStateIdle,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "../subghz_i.h"
|
||||
#include "../helpers/subghz_custom_event.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void subghz_scene_save_success_popup_callback(void* context) {
|
||||
SubGhz* subghz = context;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <assets_icons.h>
|
||||
#include <m-array.h>
|
||||
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define FRAME_HEIGHT 12
|
||||
#define MAX_LEN_PX 111
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../u2f_app_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
static void u2f_scene_error_event_callback(GuiButtonType result, InputType type, void* context) {
|
||||
furi_assert(context);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "u2f_view.h"
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
struct U2fView {
|
||||
View* view;
|
||||
|
||||
@@ -7,7 +7,6 @@ App(
|
||||
requires=[
|
||||
"gui",
|
||||
"dolphin",
|
||||
"xtreme",
|
||||
],
|
||||
stack_size=2 * 1024,
|
||||
icon="A_Xtreme_14",
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
#include <notification/notification_app.h>
|
||||
#include <rgb_backlight/rgb_backlight.h>
|
||||
#include <m-array.h>
|
||||
#include "xtreme/settings.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define XTREME_SUBGHZ_FREQ_BUFFER_SIZE 6
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ App(
|
||||
"crypto_start",
|
||||
"rpc_start",
|
||||
"bt",
|
||||
"xtreme",
|
||||
"desktop",
|
||||
"loader",
|
||||
"power",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <notification/notification_messages.h>
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define TAG "BtSrv"
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "animation_storage.h"
|
||||
#include "animation_manager.h"
|
||||
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define TAG "AnimationManager"
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "animation_storage_i.h"
|
||||
#include <assets_dolphin_internal.h>
|
||||
#include <assets_dolphin_blocking.h>
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
#define ANIMATION_META_FILE "meta.txt"
|
||||
#define BASE_ANIMATION_DIR EXT_PATH("dolphin")
|
||||
#define TAG "AnimationStorage"
|
||||
@@ -20,7 +20,7 @@
|
||||
#define ANIMATION_MANIFEST_FILE ANIMATION_DIR "/manifest.txt"
|
||||
|
||||
*/
|
||||
// 59 Max length = strlen("/ext/dolphin_custom//Anims") + MAX_PACK_NAME_LEN + 1 (Null terminator)
|
||||
// 59 Max length = strlen("/ext/dolphin_custom//Anims") + XTREME_ASSETS_PACK_NAME_LEN + 1 (Null terminator)
|
||||
char ANIMATION_DIR[59];
|
||||
// 72 Max length = ANIMATION_DIR + strlen("/manifest.txt")
|
||||
char ANIMATION_MANIFEST_FILE[72];
|
||||
@@ -36,7 +36,7 @@ void animation_handler_select_manifest(bool force_stock) {
|
||||
FuriString* manifest = furi_string_alloc();
|
||||
bool use_asset_pack = !force_stock && xtreme_settings->asset_pack[0] != '\0';
|
||||
if(use_asset_pack) {
|
||||
furi_string_printf(anim_dir, "%s/%s/Anims", PACKS_DIR, xtreme_settings->asset_pack);
|
||||
furi_string_printf(anim_dir, "%s/%s/Anims", XTREME_ASSETS_PATH, xtreme_settings->asset_pack);
|
||||
furi_string_printf(manifest, "%s/manifest.txt", furi_string_get_cstr(anim_dir));
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
if(storage_common_stat(storage, furi_string_get_cstr(manifest), NULL) == FSE_OK) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "desktop/views/desktop_view_pin_timeout.h"
|
||||
#include "desktop_i.h"
|
||||
#include "helpers/pin_lock.h"
|
||||
#include <xtreme/private.h>
|
||||
|
||||
#define TAG "Desktop"
|
||||
|
||||
@@ -347,6 +348,10 @@ int32_t desktop_srv(void* p) {
|
||||
furi_hal_rtc_reset_flag(FuriHalRtcFlagResetPin);
|
||||
}
|
||||
|
||||
// furi_delay_ms(1000);
|
||||
XTREME_SETTINGS_LOAD();
|
||||
XTREME_ASSETS_LOAD();
|
||||
|
||||
Desktop* desktop = desktop_alloc();
|
||||
|
||||
bool loaded = DESKTOP_SETTINGS_LOAD(&desktop->settings);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "../desktop_i.h"
|
||||
#include <cli/cli.h>
|
||||
#include <cli/cli_vcp.h>
|
||||
#include <xtreme/settings.h>
|
||||
#include <xtreme.h>
|
||||
|
||||
static const NotificationSequence sequence_pin_fail = {
|
||||
&message_display_backlight_on,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <furi_hal.h>
|
||||
|
||||
#include "../desktop_i.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define DesktopFaultEventExit 0x00FF00FF
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <loader/loader.h>
|
||||
// #include <loader/loader_i.h>
|
||||
#include <xtreme/settings.h>
|
||||
#include <xtreme.h>
|
||||
|
||||
#include "../desktop_i.h"
|
||||
#include <desktop/desktop_settings.h>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <furi.h>
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
#include <xtreme/settings.h>
|
||||
#include <xtreme.h>
|
||||
#include <furi_hal_rtc.h>
|
||||
|
||||
#include "../desktop_i.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <assets_icons.h>
|
||||
#include <portmacro.h>
|
||||
#include <locale/locale.h>
|
||||
#include <xtreme/assets.h>
|
||||
#include <xtreme.h>
|
||||
|
||||
#include <desktop/desktop_settings.h>
|
||||
#include "../desktop_i.h"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <furi_hal.h>
|
||||
#include <stdint.h>
|
||||
#include <furi.h>
|
||||
#include <xtreme/settings.h>
|
||||
#include <xtreme.h>
|
||||
#define DOLPHIN_LOCK_EVENT_FLAG (0x1)
|
||||
|
||||
#define TAG "Dolphin"
|
||||
|
||||
@@ -7,7 +7,6 @@ App(
|
||||
requires=[
|
||||
"input",
|
||||
"notification",
|
||||
"xtreme",
|
||||
],
|
||||
stack_size=2 * 1024,
|
||||
order=70,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <furi_hal_rtc.h>
|
||||
#include <stdint.h>
|
||||
#include <u8g2_glue.h>
|
||||
#include <xtreme/settings.h>
|
||||
#include <xtreme.h>
|
||||
|
||||
const CanvasFontParameters canvas_font_params[FontTotalNumber] = {
|
||||
[FontPrimary] = {.leading_default = 12, .leading_min = 11, .height = 8, .descender = 2},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "xtreme/settings.h"
|
||||
#include <xtreme.h>
|
||||
#include "gui_i.h"
|
||||
#include <assets_icons.h>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <core/log.h>
|
||||
#include "m-algo.h"
|
||||
#include <m-array.h>
|
||||
#include "xtreme/settings.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define LIST_ITEMS 5u
|
||||
#define MAX_LEN_PX 110
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <gui/icon_animation_i.h>
|
||||
#include <furi.h>
|
||||
#include <m-array.h>
|
||||
#include <xtreme/settings.h>
|
||||
#include <xtreme.h>
|
||||
#include <m-string.h>
|
||||
|
||||
struct Menu {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <gui/icon_i.h>
|
||||
#include <core/dangerous_defines.h>
|
||||
#include <toolbox/stream/file_stream.h>
|
||||
#include <xtreme/settings.h>
|
||||
#include <xtreme.h>
|
||||
#include <gui/modules/file_browser.h>
|
||||
|
||||
#define TAG "LoaderSrv"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
#include "xtreme/settings.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define POWER_OFF_TIMEOUT 90
|
||||
#define TAG "Power"
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
App(
|
||||
appid="xtreme",
|
||||
name="Xtreme",
|
||||
apptype=FlipperAppType.SERVICE,
|
||||
entry_point="xtreme_srv",
|
||||
cdefines=["SRV_XTREME"],
|
||||
requires=["storage"],
|
||||
stack_size=2 * 1024,
|
||||
order=46,
|
||||
sdk_headers=[
|
||||
"settings.h",
|
||||
"assets.h",
|
||||
],
|
||||
)
|
||||
@@ -1,145 +0,0 @@
|
||||
#include "settings.h"
|
||||
|
||||
#include <lib/flipper_format/flipper_format.h>
|
||||
|
||||
#define TAG "XtremeSettings"
|
||||
|
||||
XtremeSettings* xtreme_settings = NULL;
|
||||
|
||||
XtremeSettings* XTREME_SETTINGS() {
|
||||
if(xtreme_settings == NULL) {
|
||||
XTREME_SETTINGS_LOAD();
|
||||
}
|
||||
return xtreme_settings;
|
||||
}
|
||||
|
||||
void XTREME_SETTINGS_LOAD() {
|
||||
if(xtreme_settings == NULL) {
|
||||
xtreme_settings = malloc(sizeof(XtremeSettings));
|
||||
|
||||
// Set default values
|
||||
memset(xtreme_settings, 0, sizeof(XtremeSettings));
|
||||
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->fallback_anim = true; // ON
|
||||
xtreme_settings->wii_menu = true; // ON
|
||||
xtreme_settings->bad_pins_format = false; // OFF
|
||||
xtreme_settings->lockscreen_time = true; // ON
|
||||
xtreme_settings->lockscreen_seconds = false; // OFF
|
||||
xtreme_settings->lockscreen_date = true; // ON
|
||||
xtreme_settings->lockscreen_statusbar = true; // ON
|
||||
xtreme_settings->lockscreen_prompt = true; // ON
|
||||
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->sort_dirs_first = true; // ON
|
||||
xtreme_settings->dark_mode = false; // OFF
|
||||
xtreme_settings->bad_bt = false; // USB
|
||||
xtreme_settings->bad_bt_remember = false; // OFF
|
||||
xtreme_settings->butthurt_timer = 43200; // 12 H
|
||||
xtreme_settings->rgb_backlight = false; // OFF
|
||||
|
||||
if(!furi_hal_is_normal_boot()) {
|
||||
FURI_LOG_W(TAG, "Load skipped. Device is in special startup mode.");
|
||||
return;
|
||||
}
|
||||
|
||||
XtremeSettings* x = xtreme_settings;
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
if(flipper_format_file_open_existing(file, XTREME_SETTINGS_PATH)) {
|
||||
FuriString* string = furi_string_alloc();
|
||||
if(flipper_format_read_string(file, "asset_pack", string)) {
|
||||
strlcpy(x->asset_pack, furi_string_get_cstr(string), MAX_PACK_NAME_LEN);
|
||||
}
|
||||
furi_string_free(string);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_uint32(file, "anim_speed", &x->anim_speed, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_int32(file, "cycle_anims", &x->cycle_anims, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "unlock_anims", &x->unlock_anims, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "fallback_anim", &x->fallback_anim, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "wii_menu", &x->wii_menu, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "bad_pins_format", &x->bad_pins_format, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lockscreen_time", &x->lockscreen_time, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lockscreen_seconds", &x->lockscreen_seconds, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lockscreen_date", &x->lockscreen_date, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lockscreen_statusbar", &x->lockscreen_statusbar, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lockscreen_prompt", &x->lockscreen_prompt, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_uint32(file, "battery_icon", (uint32_t*)&x->battery_icon, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "status_icons", &x->status_icons, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "bar_borders", &x->bar_borders, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "bar_background", &x->bar_background, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "sort_dirs_first", &x->sort_dirs_first, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "dark_mode", &x->dark_mode, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "bad_bt", &x->bad_bt, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "bad_bt_remember", &x->bad_bt_remember, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_int32(file, "butthurt_timer", &x->butthurt_timer, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "rgb_backlight", &x->rgb_backlight, 1);
|
||||
}
|
||||
flipper_format_free(file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
}
|
||||
|
||||
void XTREME_SETTINGS_SAVE() {
|
||||
if(xtreme_settings == NULL) {
|
||||
XTREME_SETTINGS_LOAD();
|
||||
}
|
||||
|
||||
if(!furi_hal_is_normal_boot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
XtremeSettings* x = xtreme_settings;
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
if(flipper_format_file_open_always(file, XTREME_SETTINGS_PATH)) {
|
||||
flipper_format_write_string_cstr(file, "asset_pack", x->asset_pack);
|
||||
flipper_format_write_uint32(file, "anim_speed", &x->anim_speed, 1);
|
||||
flipper_format_write_int32(file, "cycle_anims", &x->cycle_anims, 1);
|
||||
flipper_format_write_bool(file, "unlock_anims", &x->unlock_anims, 1);
|
||||
flipper_format_write_bool(file, "fallback_anim", &x->fallback_anim, 1);
|
||||
flipper_format_write_bool(file, "wii_menu", &x->wii_menu, 1);
|
||||
flipper_format_write_bool(file, "bad_pins_format", &x->bad_pins_format, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_time", &x->lockscreen_time, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_seconds", &x->lockscreen_seconds, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_date", &x->lockscreen_date, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_statusbar", &x->lockscreen_statusbar, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_prompt", &x->lockscreen_prompt, 1);
|
||||
flipper_format_write_uint32(file, "battery_icon", (uint32_t*)&x->battery_icon, 1);
|
||||
flipper_format_write_bool(file, "status_icons", &x->status_icons, 1);
|
||||
flipper_format_write_bool(file, "bar_borders", &x->bar_borders, 1);
|
||||
flipper_format_write_bool(file, "bar_background", &x->bar_background, 1);
|
||||
flipper_format_write_bool(file, "sort_dirs_first", &x->sort_dirs_first, 1);
|
||||
flipper_format_write_bool(file, "dark_mode", &x->dark_mode, 1);
|
||||
flipper_format_write_bool(file, "bad_bt", &x->bad_bt, 1);
|
||||
flipper_format_write_bool(file, "bad_bt_remember", &x->bad_bt_remember, 1);
|
||||
flipper_format_write_int32(file, "butthurt_timer", &x->butthurt_timer, 1);
|
||||
flipper_format_write_bool(file, "rgb_backlight", &x->rgb_backlight, 1);
|
||||
}
|
||||
flipper_format_free(file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <furi_hal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <storage/storage.h>
|
||||
#include <power/power_service/power.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_PACK_NAME_LEN 32
|
||||
|
||||
#define XTREME_SETTINGS_PATH CFG_PATH("xtreme_settings.txt")
|
||||
|
||||
#define XTREME_APPS_PATH CFG_PATH("xtreme_apps.txt")
|
||||
|
||||
typedef struct {
|
||||
char asset_pack[MAX_PACK_NAME_LEN];
|
||||
uint32_t anim_speed;
|
||||
int32_t cycle_anims;
|
||||
bool unlock_anims;
|
||||
bool fallback_anim;
|
||||
bool wii_menu;
|
||||
bool bad_pins_format;
|
||||
bool lockscreen_time;
|
||||
bool lockscreen_seconds;
|
||||
bool lockscreen_date;
|
||||
bool lockscreen_statusbar;
|
||||
bool lockscreen_prompt;
|
||||
BatteryIcon battery_icon;
|
||||
bool status_icons;
|
||||
bool bar_borders;
|
||||
bool bar_background;
|
||||
bool sort_dirs_first;
|
||||
bool dark_mode;
|
||||
bool bad_bt;
|
||||
bool bad_bt_remember;
|
||||
int32_t butthurt_timer;
|
||||
bool rgb_backlight;
|
||||
} XtremeSettings;
|
||||
|
||||
XtremeSettings* XTREME_SETTINGS();
|
||||
|
||||
void XTREME_SETTINGS_LOAD();
|
||||
|
||||
void XTREME_SETTINGS_SAVE();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
#include "settings.h"
|
||||
#include "assets.h"
|
||||
|
||||
int32_t xtreme_srv(void* p) {
|
||||
UNUSED(p);
|
||||
|
||||
XTREME_SETTINGS_LOAD();
|
||||
XTREME_ASSETS_LOAD();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../bt_settings_app.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
#include <furi_hal_bt.h>
|
||||
|
||||
void bt_settings_app_scene_forget_dev_success_popup_callback(void* context) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "../desktop_settings_app.h"
|
||||
#include <desktop/desktop_settings.h>
|
||||
#include "desktop_settings_scene.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
#define SCENE_EVENT_EXIT (0U)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <gui/gui.h>
|
||||
#include <furi_hal_version.h>
|
||||
#include "dolphin/dolphin.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
#include "math.h"
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../power_settings_app.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
void power_settings_scene_power_off_dialog_callback(DialogExResult result, void* context) {
|
||||
furi_assert(context);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../storage_settings.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <xtreme.h>
|
||||
|
||||
static void
|
||||
storage_settings_scene_unmounted_dialog_callback(DialogExResult result, void* context) {
|
||||
|
||||
@@ -40,8 +40,6 @@ Header,+,applications/services/power/power_service/power.h,,
|
||||
Header,+,applications/services/rgb_backlight/rgb_backlight.h,,
|
||||
Header,+,applications/services/rpc/rpc_app.h,,
|
||||
Header,+,applications/services/storage/storage.h,,
|
||||
Header,+,applications/services/xtreme/assets.h,,
|
||||
Header,+,applications/services/xtreme/settings.h,,
|
||||
Header,+,firmware/targets/f7/furi_hal/furi_hal_clock.h,,
|
||||
Header,+,firmware/targets/f7/furi_hal/furi_hal_console.h,,
|
||||
Header,+,firmware/targets/f7/furi_hal/furi_hal_flash.h,,
|
||||
@@ -218,6 +216,7 @@ Header,+,lib/toolbox/tar/tar_archive.h,,
|
||||
Header,+,lib/toolbox/value_index.h,,
|
||||
Header,+,lib/toolbox/version.h,,
|
||||
Header,+,lib/u8g2/u8g2.h,,
|
||||
Header,+,lib/xtreme/xtreme.h,,
|
||||
Function,-,LL_ADC_CommonDeInit,ErrorStatus,ADC_Common_TypeDef*
|
||||
Function,-,LL_ADC_CommonInit,ErrorStatus,"ADC_Common_TypeDef*, LL_ADC_CommonInitTypeDef*"
|
||||
Function,-,LL_ADC_CommonStructInit,void,LL_ADC_CommonInitTypeDef*
|
||||
@@ -322,9 +321,7 @@ Function,-,SK6805_update,void,
|
||||
Function,-,SystemCoreClockUpdate,void,
|
||||
Function,-,SystemInit,void,
|
||||
Function,+,XTREME_ASSETS,XtremeAssets*,
|
||||
Function,-,XTREME_ASSETS_LOAD,void,
|
||||
Function,+,XTREME_SETTINGS,XtremeSettings*,
|
||||
Function,-,XTREME_SETTINGS_LOAD,void,
|
||||
Function,+,XTREME_SETTINGS_SAVE,void,
|
||||
Function,-,_Exit,void,int
|
||||
Function,-,__assert,void,"const char*, int, const char*"
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <furi_hal_light.h>
|
||||
#include <lp5562.h>
|
||||
#include <stdint.h>
|
||||
#include <xtreme/settings.h>
|
||||
#include <xtreme.h>
|
||||
#include <rgb_backlight/rgb_backlight.h>
|
||||
|
||||
#define LED_CURRENT_RED 50
|
||||
|
||||
@@ -45,6 +45,7 @@ env.Append(
|
||||
)
|
||||
),
|
||||
File("u8g2/u8g2.h"),
|
||||
File("xtreme/xtreme.h"),
|
||||
],
|
||||
CPPDEFINES=[
|
||||
'"M_MEMORY_FULL(x)=abort()"',
|
||||
|
||||
@@ -11,6 +11,7 @@ env.Append(
|
||||
"#/lib/micro-ecc",
|
||||
"#/lib/nanopb",
|
||||
"#/lib/u8g2",
|
||||
"#/lib/xtreme",
|
||||
],
|
||||
CPPDEFINES=[
|
||||
"PB_ENABLE_MALLOC",
|
||||
@@ -32,6 +33,7 @@ libs_recurse = [
|
||||
"micro-ecc",
|
||||
"u8g2",
|
||||
"update_util",
|
||||
"xtreme",
|
||||
]
|
||||
|
||||
for lib in libs_recurse:
|
||||
|
||||
@@ -1,12 +1,40 @@
|
||||
#include "assets.h"
|
||||
#include "xtreme.h"
|
||||
#include "private.h"
|
||||
#include <assets_icons.h>
|
||||
#include <storage/storage.h>
|
||||
#include <core/dangerous_defines.h>
|
||||
|
||||
#define TAG "XtremeAssets"
|
||||
|
||||
#define ICONS_FMT PACKS_DIR "/%s/Icons/%s"
|
||||
#define ICONS_FMT XTREME_ASSETS_PATH "/%s/Icons/%s"
|
||||
|
||||
XtremeAssets* xtreme_assets = NULL;
|
||||
XtremeAssets xtreme_assets = {
|
||||
.A_Levelup_128x64 = &A_Levelup_128x64,
|
||||
.I_BLE_Pairing_128x64 = &I_BLE_Pairing_128x64,
|
||||
.I_DolphinCommon_56x48 = &I_DolphinCommon_56x48,
|
||||
.I_DolphinMafia_115x62 = &I_DolphinMafia_115x62,
|
||||
.I_DolphinNice_96x59 = &I_DolphinNice_96x59,
|
||||
.I_DolphinWait_61x59 = &I_DolphinWait_61x59,
|
||||
.I_iButtonDolphinVerySuccess_108x52 = &I_iButtonDolphinVerySuccess_108x52,
|
||||
.I_DolphinReadingSuccess_59x63 = &I_DolphinReadingSuccess_59x63,
|
||||
.I_Lockscreen = &I_Lockscreen,
|
||||
.I_WarningDolphin_45x42 = &I_WarningDolphin_45x42,
|
||||
.I_NFC_dolphin_emulation_47x61 = &I_NFC_dolphin_emulation_47x61,
|
||||
.I_passport_bad_46x49 = &I_passport_bad_46x49,
|
||||
.I_passport_DB = &I_passport_DB,
|
||||
.I_passport_happy_46x49 = &I_passport_happy_46x49,
|
||||
.I_passport_okay_46x49 = &I_passport_okay_46x49,
|
||||
.I_RFIDDolphinReceive_97x61 = &I_RFIDDolphinReceive_97x61,
|
||||
.I_RFIDDolphinSend_97x61 = &I_RFIDDolphinSend_97x61,
|
||||
.I_RFIDDolphinSuccess_108x57 = &I_RFIDDolphinSuccess_108x57,
|
||||
.I_Cry_dolph_55x52 = &I_Cry_dolph_55x52,
|
||||
.I_Fishing_123x52 = &I_Fishing_123x52,
|
||||
.I_Scanning_123x52 = &I_Scanning_123x52,
|
||||
.I_Auth_62x31 = &I_Auth_62x31,
|
||||
.I_Connect_me_62x31 = &I_Connect_me_62x31,
|
||||
.I_Connected_62x31 = &I_Connected_62x31,
|
||||
.I_Error_62x31 = &I_Error_62x31,
|
||||
};
|
||||
|
||||
void anim(const Icon** replace, const char* name, FuriString* path, File* file) {
|
||||
do {
|
||||
@@ -113,44 +141,9 @@ void swap(XtremeAssets* x, FuriString* p, File* f) {
|
||||
}
|
||||
|
||||
void XTREME_ASSETS_LOAD() {
|
||||
if(xtreme_assets != NULL) return;
|
||||
|
||||
xtreme_assets = malloc(sizeof(XtremeAssets));
|
||||
|
||||
xtreme_assets->A_Levelup_128x64 = &A_Levelup_128x64;
|
||||
xtreme_assets->I_BLE_Pairing_128x64 = &I_BLE_Pairing_128x64;
|
||||
xtreme_assets->I_DolphinCommon_56x48 = &I_DolphinCommon_56x48;
|
||||
xtreme_assets->I_DolphinMafia_115x62 = &I_DolphinMafia_115x62;
|
||||
xtreme_assets->I_DolphinNice_96x59 = &I_DolphinNice_96x59;
|
||||
xtreme_assets->I_DolphinWait_61x59 = &I_DolphinWait_61x59;
|
||||
xtreme_assets->I_iButtonDolphinVerySuccess_108x52 = &I_iButtonDolphinVerySuccess_108x52;
|
||||
xtreme_assets->I_DolphinReadingSuccess_59x63 = &I_DolphinReadingSuccess_59x63;
|
||||
xtreme_assets->I_Lockscreen = &I_Lockscreen;
|
||||
xtreme_assets->I_WarningDolphin_45x42 = &I_WarningDolphin_45x42;
|
||||
xtreme_assets->I_NFC_dolphin_emulation_47x61 = &I_NFC_dolphin_emulation_47x61;
|
||||
xtreme_assets->I_passport_bad_46x49 = &I_passport_bad_46x49;
|
||||
xtreme_assets->I_passport_DB = &I_passport_DB;
|
||||
xtreme_assets->I_passport_happy_46x49 = &I_passport_happy_46x49;
|
||||
xtreme_assets->I_passport_okay_46x49 = &I_passport_okay_46x49;
|
||||
xtreme_assets->I_RFIDDolphinReceive_97x61 = &I_RFIDDolphinReceive_97x61;
|
||||
xtreme_assets->I_RFIDDolphinSend_97x61 = &I_RFIDDolphinSend_97x61;
|
||||
xtreme_assets->I_RFIDDolphinSuccess_108x57 = &I_RFIDDolphinSuccess_108x57;
|
||||
xtreme_assets->I_Cry_dolph_55x52 = &I_Cry_dolph_55x52;
|
||||
xtreme_assets->I_Fishing_123x52 = &I_Fishing_123x52;
|
||||
xtreme_assets->I_Scanning_123x52 = &I_Scanning_123x52;
|
||||
xtreme_assets->I_Auth_62x31 = &I_Auth_62x31;
|
||||
xtreme_assets->I_Connect_me_62x31 = &I_Connect_me_62x31;
|
||||
xtreme_assets->I_Connected_62x31 = &I_Connected_62x31;
|
||||
xtreme_assets->I_Error_62x31 = &I_Error_62x31;
|
||||
|
||||
if(!furi_hal_is_normal_boot()) {
|
||||
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;
|
||||
xtreme_assets.is_nsfw = strncmp(xtreme_settings->asset_pack, "NSFW", strlen("NSFW")) == 0;
|
||||
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
int32_t timeout = 5000;
|
||||
@@ -162,11 +155,11 @@ void XTREME_ASSETS_LOAD() {
|
||||
|
||||
FileInfo info;
|
||||
FuriString* path = furi_string_alloc();
|
||||
furi_string_printf(path, PACKS_DIR "/%s", xtreme_settings->asset_pack);
|
||||
furi_string_printf(path, XTREME_ASSETS_PATH "/%s", xtreme_settings->asset_pack);
|
||||
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);
|
||||
swap(&xtreme_assets, path, file);
|
||||
storage_file_free(file);
|
||||
}
|
||||
furi_string_free(path);
|
||||
@@ -174,8 +167,5 @@ void XTREME_ASSETS_LOAD() {
|
||||
}
|
||||
|
||||
XtremeAssets* XTREME_ASSETS() {
|
||||
if(xtreme_assets == NULL) {
|
||||
XTREME_ASSETS_LOAD();
|
||||
}
|
||||
return xtreme_assets;
|
||||
return &xtreme_assets;
|
||||
}
|
||||
4
lib/xtreme/private.h
Normal file
4
lib/xtreme/private.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
void XTREME_ASSETS_LOAD();
|
||||
void XTREME_SETTINGS_LOAD();
|
||||
126
lib/xtreme/settings.c
Normal file
126
lib/xtreme/settings.c
Normal file
@@ -0,0 +1,126 @@
|
||||
#include "xtreme.h"
|
||||
#include "private.h"
|
||||
#include <furi_hal.h>
|
||||
#include <flipper_format/flipper_format.h>
|
||||
|
||||
#define TAG "XtremeSettings"
|
||||
|
||||
XtremeSettings xtreme_settings = {
|
||||
.asset_pack = "",
|
||||
.anim_speed = 100, // 100%
|
||||
.cycle_anims = 0, // Meta.txt
|
||||
.unlock_anims = false, // OFF
|
||||
.fallback_anim = true, // ON
|
||||
.wii_menu = true, // ON
|
||||
.bad_pins_format = false, // OFF
|
||||
.lockscreen_time = true, // ON
|
||||
.lockscreen_seconds = false, // OFF
|
||||
.lockscreen_date = true, // ON
|
||||
.lockscreen_statusbar = true, // ON
|
||||
.lockscreen_prompt = true, // ON
|
||||
.battery_icon = BatteryIconBarPercent, // Bar %
|
||||
.status_icons = true, // ON
|
||||
.bar_borders = true, // ON
|
||||
.bar_background = false, // OFF
|
||||
.sort_dirs_first = true, // ON
|
||||
.dark_mode = false, // OFF
|
||||
.bad_bt = false, // USB
|
||||
.bad_bt_remember = false, // OFF
|
||||
.butthurt_timer = 43200, // 12 H
|
||||
.rgb_backlight = false, // OFF
|
||||
};
|
||||
|
||||
void XTREME_SETTINGS_LOAD() {
|
||||
XtremeSettings* x = &xtreme_settings;
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
if(flipper_format_file_open_existing(file, XTREME_SETTINGS_PATH)) {
|
||||
FuriString* string = furi_string_alloc();
|
||||
if(flipper_format_read_string(file, "asset_pack", string)) {
|
||||
strlcpy(x->asset_pack, furi_string_get_cstr(string), XTREME_ASSETS_PACK_NAME_LEN);
|
||||
}
|
||||
furi_string_free(string);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_uint32(file, "anim_speed", &x->anim_speed, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_int32(file, "cycle_anims", &x->cycle_anims, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "unlock_anims", &x->unlock_anims, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "fallback_anim", &x->fallback_anim, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "wii_menu", &x->wii_menu, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "bad_pins_format", &x->bad_pins_format, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lockscreen_time", &x->lockscreen_time, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lockscreen_seconds", &x->lockscreen_seconds, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lockscreen_date", &x->lockscreen_date, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lockscreen_statusbar", &x->lockscreen_statusbar, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "lockscreen_prompt", &x->lockscreen_prompt, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_uint32(file, "battery_icon", (uint32_t*)&x->battery_icon, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "status_icons", &x->status_icons, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "bar_borders", &x->bar_borders, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "bar_background", &x->bar_background, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "sort_dirs_first", &x->sort_dirs_first, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "dark_mode", &x->dark_mode, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "bad_bt", &x->bad_bt, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "bad_bt_remember", &x->bad_bt_remember, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_int32(file, "butthurt_timer", &x->butthurt_timer, 1);
|
||||
flipper_format_rewind(file);
|
||||
flipper_format_read_bool(file, "rgb_backlight", &x->rgb_backlight, 1);
|
||||
}
|
||||
flipper_format_free(file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
void XTREME_SETTINGS_SAVE() {
|
||||
if(!furi_hal_is_normal_boot()) return;
|
||||
|
||||
XtremeSettings* x = &xtreme_settings;
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
if(flipper_format_file_open_always(file, XTREME_SETTINGS_PATH)) {
|
||||
flipper_format_write_string_cstr(file, "asset_pack", x->asset_pack);
|
||||
flipper_format_write_uint32(file, "anim_speed", &x->anim_speed, 1);
|
||||
flipper_format_write_int32(file, "cycle_anims", &x->cycle_anims, 1);
|
||||
flipper_format_write_bool(file, "unlock_anims", &x->unlock_anims, 1);
|
||||
flipper_format_write_bool(file, "fallback_anim", &x->fallback_anim, 1);
|
||||
flipper_format_write_bool(file, "wii_menu", &x->wii_menu, 1);
|
||||
flipper_format_write_bool(file, "bad_pins_format", &x->bad_pins_format, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_time", &x->lockscreen_time, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_seconds", &x->lockscreen_seconds, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_date", &x->lockscreen_date, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_statusbar", &x->lockscreen_statusbar, 1);
|
||||
flipper_format_write_bool(file, "lockscreen_prompt", &x->lockscreen_prompt, 1);
|
||||
flipper_format_write_uint32(file, "battery_icon", (uint32_t*)&x->battery_icon, 1);
|
||||
flipper_format_write_bool(file, "status_icons", &x->status_icons, 1);
|
||||
flipper_format_write_bool(file, "bar_borders", &x->bar_borders, 1);
|
||||
flipper_format_write_bool(file, "bar_background", &x->bar_background, 1);
|
||||
flipper_format_write_bool(file, "sort_dirs_first", &x->sort_dirs_first, 1);
|
||||
flipper_format_write_bool(file, "dark_mode", &x->dark_mode, 1);
|
||||
flipper_format_write_bool(file, "bad_bt", &x->bad_bt, 1);
|
||||
flipper_format_write_bool(file, "bad_bt_remember", &x->bad_bt_remember, 1);
|
||||
flipper_format_write_int32(file, "butthurt_timer", &x->butthurt_timer, 1);
|
||||
flipper_format_write_bool(file, "rgb_backlight", &x->rgb_backlight, 1);
|
||||
}
|
||||
flipper_format_free(file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
XtremeSettings* XTREME_SETTINGS() {
|
||||
return &xtreme_settings;
|
||||
}
|
||||
@@ -1,14 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "settings.h"
|
||||
#include <gui/icon_i.h>
|
||||
#include <toolbox/path.h>
|
||||
#include <power/power_service/power.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PACKS_DIR EXT_PATH("dolphin_custom")
|
||||
#define XTREME_SETTINGS_PATH CFG_PATH("xtreme_settings.txt")
|
||||
#define XTREME_ASSETS_PATH EXT_PATH("dolphin_custom")
|
||||
#define XTREME_APPS_PATH CFG_PATH("xtreme_apps.txt")
|
||||
#define XTREME_ASSETS_PACK_NAME_LEN 32
|
||||
|
||||
typedef struct {
|
||||
char asset_pack[XTREME_ASSETS_PACK_NAME_LEN];
|
||||
uint32_t anim_speed;
|
||||
int32_t cycle_anims;
|
||||
bool unlock_anims;
|
||||
bool fallback_anim;
|
||||
bool wii_menu;
|
||||
bool bad_pins_format;
|
||||
bool lockscreen_time;
|
||||
bool lockscreen_seconds;
|
||||
bool lockscreen_date;
|
||||
bool lockscreen_statusbar;
|
||||
bool lockscreen_prompt;
|
||||
BatteryIcon battery_icon;
|
||||
bool status_icons;
|
||||
bool bar_borders;
|
||||
bool bar_background;
|
||||
bool sort_dirs_first;
|
||||
bool dark_mode;
|
||||
bool bad_bt;
|
||||
bool bad_bt_remember;
|
||||
int32_t butthurt_timer;
|
||||
bool rgb_backlight;
|
||||
} XtremeSettings;
|
||||
|
||||
XtremeSettings* XTREME_SETTINGS();
|
||||
void XTREME_SETTINGS_SAVE();
|
||||
|
||||
typedef struct {
|
||||
bool is_nsfw;
|
||||
@@ -39,8 +69,6 @@ typedef struct {
|
||||
const Icon* I_Error_62x31;
|
||||
} XtremeAssets;
|
||||
|
||||
void XTREME_ASSETS_LOAD();
|
||||
|
||||
XtremeAssets* XTREME_ASSETS();
|
||||
|
||||
#ifdef __cplusplus
|
||||
Reference in New Issue
Block a user