Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

"not enough rainbows, 1 star uninstall"

Patchset 3 - Indigo has been removed from the rainbow.

(Rainbow Mode - Easter Egg)

No longer will we get bad reviews on CWM recovery for its lack
of rainbows! Originally design by gweedo767, this patch brings
back the wrap count mechanism from v2.0.2.4 to toggle Rainbow
Mode for the user. In the original design, every character has
a different color, but that method requires modifying graphics.c
which will cause breakage in devices with custom graphics.c.
This Rainbow Mode has a different color for each line, instead.
The wrap_count has been set to 5 instead of the previous 3 so
the toggle won't occur as often, if on accident.

Change-Id: Ie9f6f1b6ed94ee69d4d8d9fe27f9a5417cc3f212
commit af5f065b1f94a43bdd1a586127443e298459783b 1 parent 684696c
@CEnnis91 CEnnis91 authored mikeNG committed
Showing with 51 additions and 0 deletions.
  1. +5 −0 common.h
  2. +16 −0 recovery.c
  3. +30 −0 ui.c
View
5 common.h
@@ -68,6 +68,11 @@ void ui_set_showing_back_button(int showBackButton);
void ui_set_log_stdout(int enabled);
int ui_should_log_stdout();
+
+int ui_get_rainbow_mode();
+void ui_rainbow_mode();
+void ui_set_rainbow_mode(int rainbowMode);
+
// Set the icon (normally the only thing visible besides the progress bar).
enum {
BACKGROUND_ICON_NONE,
View
16 recovery.c
@@ -469,6 +469,7 @@ get_menu_selection(const char** headers, char** items, int menu_only,
int item_count = ui_start_menu(headers, items, initial_selection);
int selected = initial_selection;
int chosen_item = -1; // NO_ACTION
+ int wrap_count = 0;
while (chosen_item < 0 && chosen_item != GO_BACK) {
int key = ui_wait_key();
@@ -522,6 +523,21 @@ get_menu_selection(const char** headers, char** items, int menu_only,
} else if (!menu_only) {
chosen_item = action;
}
+
+ if (abs(selected - old_selected) > 1) {
+ wrap_count++;
+ if (wrap_count == 5) {
+ wrap_count = 0;
+ if (ui_get_rainbow_mode()) {
+ ui_set_rainbow_mode(0);
+ ui_print("Rainbow mode disabled\n");
+ }
+ else {
+ ui_set_rainbow_mode(1);
+ ui_print("Rainbow mode enabled!\n");
+ }
+ }
+ }
}
ui_end_menu();
View
30 ui.c
@@ -120,6 +120,9 @@ static int menu_top = 0, menu_items = 0, menu_sel = 0;
static int menu_show_start = 0; // this is line which menu display is starting at
static int max_menu_rows;
+static int cur_rainbow_color = 0;
+static int gRainbowMode = 0;
+
// Key event input queue
static pthread_mutex_t key_queue_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t key_queue_cond = PTHREAD_COND_INITIALIZER;
@@ -230,6 +233,7 @@ static void draw_progress_locked()
static void draw_text_line(int row, const char* t) {
if (t[0] != '\0') {
+ if (ui_get_rainbow_mode()) ui_rainbow_mode();
gr_text(0, (row+1)*CHAR_HEIGHT-1, t);
}
}
@@ -1075,3 +1079,29 @@ void ui_increment_frame() {
gInstallingFrame =
(gInstallingFrame + 1) % ui_parameters.installing_frames;
}
+
+int ui_get_rainbow_mode() {
+ return gRainbowMode;
+}
+
+void ui_rainbow_mode() {
+ static int colors[] = { 255, 0, 0, // red
+ 255, 127, 0, // orange
+ 255, 255, 0, // yellow
+ 0, 255, 0, // green
+ 60, 80, 255, // blue
+ 143, 0, 255 }; // violet
+
+ gr_color(colors[cur_rainbow_color], colors[cur_rainbow_color+1], colors[cur_rainbow_color+2], 255);
+ cur_rainbow_color += 3;
+ if (cur_rainbow_color >= sizeof(colors)/sizeof(colors[0])) cur_rainbow_color = 0;
+}
+
+void ui_set_rainbow_mode(int rainbowMode) {
+ gRainbowMode = rainbowMode;
+
+ pthread_mutex_lock(&gUpdateMutex);
+ update_screen_locked();
+ pthread_mutex_unlock(&gUpdateMutex);
+}
+

2 comments on commit af5f065

@sndnvaps

i think it was a very cool func.
i like it very much.

@pexcn

so good!
think you very much!

Please sign in to comment.
Something went wrong with that request. Please try again.