avery

all hail eggbug

writes words on the computer for fun and profit • bi and trans • loves ducks and @marbles • post cute pets and we'll be friends • UTAW member • join a union!


iliana
@iliana

here's a patchset for https://github.com/flipperdevices/flipperzero-firmware, applies to the 0.71.1 tag:

[PATCH 1/3] dolphin: clamp max butthurt to 0
From a9201679ee6788c3a771403bb489597ce1bdf01f Mon Sep 17 00:00:00 2001
From: iliana etaoin <iliana@buttslol.net>
Date: Mon, 28 Nov 2022 19:49:52 -0800
Subject: [PATCH 1/3] dolphin: clamp max butthurt to 0

Why the hell would you put a cute hacker dolphin in your firmware and
give it the ability to become sad?

(This change also ensures that the dolphin state does not reset if the
butthurt is non-zero.)
---
 applications/services/dolphin/helpers/dolphin_state.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/applications/services/dolphin/helpers/dolphin_state.c b/applications/services/dolphin/helpers/dolphin_state.c
index 10cb85c2..cc4d4227 100644
--- a/applications/services/dolphin/helpers/dolphin_state.c
+++ b/applications/services/dolphin/helpers/dolphin_state.c
@@ -16,7 +16,7 @@
 #define DOLPHIN_STATE_HEADER_VERSION 0x01
 #define LEVEL2_THRESHOLD 300
 #define LEVEL3_THRESHOLD 1800
-#define BUTTHURT_MAX 14
+#define BUTTHURT_MAX 0
 #define BUTTHURT_MIN 0
 
 DolphinState* dolphin_state_alloc() {
@@ -60,7 +60,9 @@ bool dolphin_state_load(DolphinState* dolphin_state) {
     if(success) {
         if((dolphin_state->data.butthurt > BUTTHURT_MAX) ||
            (dolphin_state->data.butthurt < BUTTHURT_MIN)) {
-            success = false;
+            dolphin_state->data.butthurt =
+                CLAMP(dolphin_state->data.butthurt, BUTTHURT_MAX, BUTTHURT_MIN);
+            dolphin_state->dirty = true;
         }
     }
 
-- 
2.38.1
[PATCH 2/3] dolphin: remove butthurt timer
From 0610d9f4ab77de9ad9772d6b168c00527935b5fe Mon Sep 17 00:00:00 2001
From: iliana etaoin <iliana@buttslol.net>
Date: Mon, 28 Nov 2022 19:52:17 -0800
Subject: [PATCH 2/3] dolphin: remove butthurt timer

If butthurt cannot increase (due to a prior commit on this branch),
there is no point having a timer to increase it every two days of
inactivity.
---
 applications/services/dolphin/dolphin.c   | 17 -----------------
 applications/services/dolphin/dolphin_i.h |  2 --
 2 files changed, 19 deletions(-)

diff --git a/applications/services/dolphin/dolphin.c b/applications/services/dolphin/dolphin.c
index 41eeef3b..b8061d7f 100644
--- a/applications/services/dolphin/dolphin.c
+++ b/applications/services/dolphin/dolphin.c
@@ -44,15 +44,6 @@ void dolphin_flush(Dolphin* dolphin) {
     dolphin_event_send_wait(dolphin, &event);
 }
 
-void dolphin_butthurt_timer_callback(TimerHandle_t xTimer) {
-    Dolphin* dolphin = pvTimerGetTimerID(xTimer);
-    furi_assert(dolphin);
-
-    DolphinEvent event;
-    event.type = DolphinEventTypeIncreaseButthurt;
-    dolphin_event_send_async(dolphin, &event);
-}
-
 void dolphin_flush_timer_callback(TimerHandle_t xTimer) {
     Dolphin* dolphin = pvTimerGetTimerID(xTimer);
     furi_assert(dolphin);
@@ -79,8 +70,6 @@ Dolphin* dolphin_alloc() {
     dolphin->state = dolphin_state_alloc();
     dolphin->event_queue = furi_message_queue_alloc(8, sizeof(DolphinEvent));
     dolphin->pubsub = furi_pubsub_alloc();
-    dolphin->butthurt_timer = xTimerCreate(
-        NULL, HOURS_IN_TICKS(2 * 24), pdTRUE, dolphin, dolphin_butthurt_timer_callback);
     dolphin->flush_timer =
         xTimerCreate(NULL, 30 * 1000, pdFALSE, dolphin, dolphin_flush_timer_callback);
     dolphin->clear_limits_timer = xTimerCreate(
@@ -158,7 +147,6 @@ int32_t dolphin_srv(void* p) {
     furi_record_create(RECORD_DOLPHIN, dolphin);
 
     dolphin_state_load(dolphin->state);
-    xTimerReset(dolphin->butthurt_timer, portMAX_DELAY);
     dolphin_update_clear_limits_timer_period(dolphin);
     xTimerReset(dolphin->clear_limits_timer, portMAX_DELAY);
 
@@ -170,7 +158,6 @@ int32_t dolphin_srv(void* p) {
                 dolphin_state_on_deed(dolphin->state, event.deed);
                 DolphinPubsubEvent event = DolphinPubsubEventUpdate;
                 furi_pubsub_publish(dolphin->pubsub, &event);
-                xTimerReset(dolphin->butthurt_timer, portMAX_DELAY);
                 xTimerReset(dolphin->flush_timer, portMAX_DELAY);
             } else if(event.type == DolphinEventTypeStats) {
                 event.stats->icounter = dolphin->state->data.icounter;
@@ -186,10 +173,6 @@ int32_t dolphin_srv(void* p) {
                 FURI_LOG_I(TAG, "Clear limits");
                 dolphin_state_clear_limits(dolphin->state);
                 dolphin_state_save(dolphin->state);
-            } else if(event.type == DolphinEventTypeIncreaseButthurt) {
-                FURI_LOG_I(TAG, "Increase butthurt");
-                dolphin_state_butthurted(dolphin->state);
-                dolphin_state_save(dolphin->state);
             }
             dolphin_event_release(dolphin, &event);
         } else {
diff --git a/applications/services/dolphin/dolphin_i.h b/applications/services/dolphin/dolphin_i.h
index 4bb0df08..f64c8b76 100644
--- a/applications/services/dolphin/dolphin_i.h
+++ b/applications/services/dolphin/dolphin_i.h
@@ -11,7 +11,6 @@ typedef enum {
     DolphinEventTypeDeed,
     DolphinEventTypeStats,
     DolphinEventTypeFlush,
-    DolphinEventTypeIncreaseButthurt,
     DolphinEventTypeClearLimits,
 } DolphinEventType;
 
@@ -30,7 +29,6 @@ struct Dolphin {
     // Queue
     FuriMessageQueue* event_queue;
     FuriPubSub* pubsub;
-    TimerHandle_t butthurt_timer;
     TimerHandle_t flush_timer;
     TimerHandle_t clear_limits_timer;
 };
-- 
2.38.1
[PATCH 3/3] power: replace sad dolphin
From eddca68b61b868ed5328285750c5aa862a71b84b Mon Sep 17 00:00:00 2001
From: iliana etaoin <iliana@buttslol.net>
Date: Mon, 28 Nov 2022 20:07:07 -0800
Subject: [PATCH 3/3] power: replace sad dolphin

---
 .../scenes/power_settings_scene_power_off.c                   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/applications/settings/power_settings_app/scenes/power_settings_scene_power_off.c b/applications/settings/power_settings_app/scenes/power_settings_scene_power_off.c
index 923ec250..ff4991fd 100644
--- a/applications/settings/power_settings_app/scenes/power_settings_scene_power_off.c
+++ b/applications/settings/power_settings_app/scenes/power_settings_scene_power_off.c
@@ -12,8 +12,8 @@ void power_settings_scene_power_off_on_enter(void* context) {
 
     dialog_ex_set_header(dialog, "Turn Off Device?", 64, 2, AlignCenter, AlignTop);
     dialog_ex_set_text(
-        dialog, "   I will be\nwaiting for\n you here...", 78, 16, AlignLeft, AlignTop);
-    dialog_ex_set_icon(dialog, 21, 13, &I_Cry_dolph_55x52);
+        dialog, "   I'll see\nyou next\n   time!", 83, 16, AlignLeft, AlignTop);
+    dialog_ex_set_icon(dialog, 15, 13, &I_DolphinReadingSuccess_59x63);
     dialog_ex_set_left_button_text(dialog, "Back");
     dialog_ex_set_right_button_text(dialog, "OFF");
     dialog_ex_set_result_callback(dialog, power_settings_scene_power_off_dialog_callback);
-- 
2.38.1

Flipper Zero screenshot with the patched power off screen, with a happy dolphin and "I'll see you next time!"


You must log in to comment.

in reply to @iliana's post:

i think i'm gonna have to install these patches, as much as my pride doesn't want me to

the anxiety i feel about the concept of turning on my flipper zero again and seeing the dolphin upset that i haven't used it in a while is far more than it realistically should be