Revert some settings handling to how they work in OFW

This commit is contained in:
Willy-JL
2024-08-06 19:34:49 +02:00
parent 9adb1478e6
commit 083c17f09d
26 changed files with 72 additions and 81 deletions

View File

@@ -68,8 +68,7 @@ static void animation_manager_start_new_idle(AnimationManager* animation_manager
static bool animation_manager_check_blocking(AnimationManager* animation_manager);
static bool animation_manager_is_valid_idle_animation(
const StorageAnimationManifestInfo* info,
const DolphinStats* stats,
const bool unlock);
const DolphinStats* stats);
static void animation_manager_switch_to_one_shot_view(AnimationManager* animation_manager);
static void animation_manager_switch_to_animation_view(AnimationManager* animation_manager);
@@ -148,8 +147,7 @@ void animation_manager_check_blocking_process(AnimationManager* animation_manage
const StorageAnimationManifestInfo* manifest_info =
animation_storage_get_meta(animation_manager->current_animation);
bool valid = animation_manager_is_valid_idle_animation(
manifest_info, &stats, momentum_settings.unlock_anims);
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
if(!valid) {
animation_manager_start_new_idle(animation_manager);
@@ -343,8 +341,7 @@ View* animation_manager_get_animation_view(AnimationManager* animation_manager)
static bool animation_manager_is_valid_idle_animation(
const StorageAnimationManifestInfo* info,
const DolphinStats* stats,
const bool unlock) {
const DolphinStats* stats) {
furi_assert(info);
furi_assert(info->name);
@@ -364,7 +361,7 @@ static bool animation_manager_is_valid_idle_animation(
result = (sd_status == FSE_NOT_READY);
}
if(!unlock) {
if(!momentum_settings.unlock_anims) {
if((stats->butthurt < info->min_butthurt) || (stats->butthurt > info->max_butthurt)) {
result = false;
}
@@ -394,13 +391,12 @@ static StorageAnimation*
uint32_t whole_weight = 0;
// Filter valid animations
bool unlock = momentum_settings.unlock_anims;
StorageAnimationList_it_t it;
for(StorageAnimationList_it(it, animation_list); !StorageAnimationList_end_p(it);) {
StorageAnimation* storage_animation = *StorageAnimationList_ref(it);
const StorageAnimationManifestInfo* manifest_info =
animation_storage_get_meta(storage_animation);
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats, unlock);
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
if(strcmp(manifest_info->name, HARDCODED_ANIMATION_NAME) == 0) {
// Dont pick error anim randomly
@@ -546,8 +542,7 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
furi_record_close(RECORD_DOLPHIN);
const StorageAnimationManifestInfo* manifest_info =
animation_storage_get_meta(restore_animation);
bool valid = animation_manager_is_valid_idle_animation(
manifest_info, &stats, momentum_settings.unlock_anims);
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
// Restore only if anim is valid and not the error anim
if(valid && strcmp(manifest_info->name, HARDCODED_ANIMATION_NAME) != 0) {
animation_manager_replace_current_animation(
@@ -559,11 +554,10 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
animation_manager->idle_animation_timer,
animation_manager->freezed_animation_time_left);
} else {
const BubbleAnimation* bubble_animation =
animation_storage_get_bubble_animation(
animation_manager->current_animation);
const BubbleAnimation* animation = animation_storage_get_bubble_animation(
animation_manager->current_animation);
int32_t duration = (momentum_settings.cycle_anims == 0) ?
(bubble_animation->duration) :
(animation->duration) :
(momentum_settings.cycle_anims);
furi_timer_start(
animation_manager->idle_animation_timer,

View File

@@ -57,6 +57,7 @@ static bool animation_storage_load_single_manifest_info(
const char* name) {
furi_assert(manifest_info);
animation_handler_select_manifest();
bool result = false;
Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* file = flipper_format_file_alloc(storage);

View File

@@ -0,0 +1,3 @@
#pragma once
#define SLIDESHOW_FILE_NAME ".slideshow"

View File

@@ -13,6 +13,7 @@ struct DesktopSlideshowView {
DesktopSlideshowViewCallback callback;
void* context;
FuriTimer* timer;
FuriTimer* auto_timer;
};

View File

@@ -3,9 +3,10 @@
#include <gui/view.h>
#include "desktop_events.h"
#include "../helpers/slideshow_filename.h"
#include <storage/storage.h>
#define SLIDESHOW_FS_PATH EXT_PATH(".slideshow")
#define SLIDESHOW_FS_PATH INT_PATH(SLIDESHOW_FILE_NAME)
typedef struct DesktopSlideshowView DesktopSlideshowView;