Apply dolphin customizations without reboot

This commit is contained in:
Willy-JL
2024-08-07 21:26:41 +02:00
parent d4ceb95b28
commit 06cb63f4bf
6 changed files with 20 additions and 4 deletions

View File

@@ -97,7 +97,7 @@ bool momentum_app_apply(MomentumApp* app) {
}
}
if(app->save_level || app->save_angry) {
if(app->save_dolphin) {
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
if(app->save_level) {
int32_t xp = app->dolphin_level > 1 ? DOLPHIN_LEVELS[app->dolphin_level - 2] : 0;
@@ -107,7 +107,8 @@ bool momentum_app_apply(MomentumApp* app) {
dolphin->state->data.butthurt = app->dolphin_angry;
}
dolphin->state->dirty = true;
dolphin_state_save(dolphin->state);
dolphin_flush(dolphin);
dolphin_reload_state(dolphin);
furi_record_close(RECORD_DOLPHIN);
}

View File

@@ -75,6 +75,7 @@ typedef struct {
bool save_name;
bool save_level;
bool save_angry;
bool save_dolphin;
bool save_backlight;
bool save_settings;
bool apply_pack;

View File

@@ -18,6 +18,7 @@ static void momentum_app_scene_misc_dolphin_dolphin_level_changed(VariableItem*
snprintf(level_str, 4, "%li", app->dolphin_level);
variable_item_set_current_value_text(item, level_str);
app->save_level = true;
app->save_dolphin = true;
}
static void momentum_app_scene_misc_dolphin_dolphin_angry_changed(VariableItem* item) {
@@ -27,6 +28,7 @@ static void momentum_app_scene_misc_dolphin_dolphin_angry_changed(VariableItem*
snprintf(angry_str, 4, "%li", app->dolphin_angry);
variable_item_set_current_value_text(item, angry_str);
app->save_angry = true;
app->save_dolphin = true;
}
const char* const butthurt_timer_names[] = {
@@ -59,7 +61,7 @@ static void momentum_app_scene_misc_dolphin_butthurt_timer_changed(VariableItem*
variable_item_set_current_value_text(item, butthurt_timer_names[index]);
momentum_settings.butthurt_timer = butthurt_timer_values[index];
app->save_settings = true;
app->require_reboot = true;
app->save_dolphin = true;
}
void momentum_app_scene_misc_dolphin_on_enter(void* context) {