@@ -43,8 +43,12 @@ const char *manifest_url = MANIFEST_URL_EON;
4343
4444#define UPDATE_DIR " /data/neoupdate"
4545
46- extern const uint8_t bin_courbd[] asm (" _binary_courbd_ttf_start" );
47- extern const uint8_t bin_courbd_end[] asm (" _binary_courbd_ttf_end" );
46+ extern const uint8_t bin_opensans_regular[] asm (" _binary_opensans_regular_ttf_start" );
47+ extern const uint8_t bin_opensans_regular_end[] asm (" _binary_opensans_regular_ttf_end" );
48+ extern const uint8_t bin_opensans_semibold[] asm (" _binary_opensans_semibold_ttf_start" );
49+ extern const uint8_t bin_opensans_semibold_end[] asm (" _binary_opensans_semibold_ttf_end" );
50+ extern const uint8_t bin_opensans_bold[] asm (" _binary_opensans_bold_ttf_start" );
51+ extern const uint8_t bin_opensans_bold_end[] asm (" _binary_opensans_bold_ttf_end" );
4852
4953namespace {
5054
@@ -148,7 +152,9 @@ struct Updater {
148152
149153 FramebufferState *fb = NULL ;
150154 NVGcontext *vg = NULL ;
151- int font;
155+ int font_regular;
156+ int font_semibold;
157+ int font_bold;
152158
153159 std::thread update_thread_handle;
154160
@@ -182,14 +188,21 @@ struct Updater {
182188
183189 vg = nvgCreateGLES3 (NVG_ANTIALIAS | NVG_STENCIL_STROKES | NVG_DEBUG);
184190 assert (vg);
185- font = nvgCreateFontMem (vg, " courbd" , (unsigned char *)bin_courbd, (bin_courbd_end - bin_courbd), 0 );
186- assert (font >= 0 );
187191
188- b_w = 600 ;
192+ font_regular = nvgCreateFontMem (vg, " opensans_regular" , (unsigned char *)bin_opensans_regular, (bin_opensans_regular_end - bin_opensans_regular), 0 );
193+ assert (font_regular >= 0 );
194+
195+ font_semibold = nvgCreateFontMem (vg, " opensans_semibold" , (unsigned char *)bin_opensans_semibold, (bin_opensans_semibold_end - bin_opensans_semibold), 0 );
196+ assert (font_semibold >= 0 );
197+
198+ font_bold = nvgCreateFontMem (vg, " opensans_bold" , (unsigned char *)bin_opensans_bold, (bin_opensans_bold_end - bin_opensans_bold), 0 );
199+ assert (font_bold >= 0 );
200+
201+ b_w = 640 ;
189202 balt_x = 200 ;
190203 b_x = fb_w-b_w-200 ;
191- b_y = 700 ;
192- b_h = 250 ;
204+ b_y = 720 ;
205+ b_h = 220 ;
193206
194207 state = CONFIRMATION;
195208
@@ -286,14 +299,14 @@ struct Updater {
286299 std::string stage_download (std::string url, std::string hash, std::string name) {
287300 std::string out_fn = UPDATE_DIR " /" + util::base_name (url);
288301
289- set_progress (" downloading " + name + " ..." );
302+ set_progress (" Downloading " + name + " ..." );
290303 bool r = download_file (url, out_fn);
291304 if (!r) {
292305 set_error (" failed to download " + name);
293306 return " " ;
294307 }
295308
296- set_progress (" verifying " + name + " ..." );
309+ set_progress (" Verifying " + name + " ..." );
297310 std::string fn_hash = sha256_file (out_fn);
298311 printf (" got %s hash: %s\n " , name.c_str (), hash.c_str ());
299312 if (fn_hash != hash) {
@@ -323,7 +336,7 @@ struct Updater {
323336
324337 const int EON = (access (" /EON" , F_OK) != -1 );
325338
326- set_progress (" finding latest version..." );
339+ set_progress (" Finding latest version..." );
327340 std::string manifest_s;
328341 if (EON) {
329342 manifest_s = download_string (curl, manifest_url);
@@ -364,10 +377,10 @@ struct Updater {
364377
365378 std::string recovery_fn;
366379 if (recovery_url.empty () || recovery_hash.empty () || recovery_len == 0 ) {
367- set_progress (" skipping recovery flash..." );
380+ set_progress (" Skipping recovery flash..." );
368381 } else {
369382 // only download the recovery if it differs from what's flashed
370- set_progress (" checking recovery..." );
383+ set_progress (" Checking recovery..." );
371384 std::string existing_recovery_hash = sha256_file (RECOVERY_DEV, recovery_len);
372385 printf (" existing recovery hash: %s\n " , existing_recovery_hash.c_str ());
373386
@@ -393,7 +406,7 @@ struct Updater {
393406
394407 if (!recovery_fn.empty ()) {
395408 // flash recovery
396- set_progress (" flashing recovery..." );
409+ set_progress (" Flashing recovery..." );
397410
398411 FILE *flash_file = fopen (recovery_fn.c_str (), " rb" );
399412 if (!flash_file) {
@@ -427,7 +440,7 @@ struct Updater {
427440 fclose (recovery_dev);
428441 fclose (flash_file);
429442
430- set_progress (" verifying flash..." );
443+ set_progress (" Verifying flash..." );
431444 std::string new_recovery_hash = sha256_file (RECOVERY_DEV, recovery_len);
432445 printf (" new recovery hash: %s\n " , new_recovery_hash.c_str ());
433446
@@ -447,7 +460,7 @@ struct Updater {
447460 fprintf (cmd_file, " --update_package=%s\n " , ota_fn.c_str ());
448461 fclose (cmd_file);
449462
450- set_progress (" rebooting " );
463+ set_progress (" Rebooting " );
451464
452465 // remove the continue.sh so we come back into the setup.
453466 // maybe we should go directly into the installer, but what if we don't come back with internet? :/
@@ -462,25 +475,32 @@ struct Updater {
462475 // set_error("failed to reboot into recovery");
463476 }
464477
465- void draw_ack_screen (const char *message, const char *button, const char *altbutton) {
466- nvgFontSize (vg, 96 .0f );
478+ void draw_ack_screen (const char *title, const char *message, const char *button, const char *altbutton) {
467479 nvgFillColor (vg, nvgRGBA (255 ,255 ,255 ,255 ));
468- nvgTextAlign (vg, NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE);
469- nvgTextBox (vg, 50 , 100 , fb_w-100 , message, NULL );
480+ nvgTextAlign (vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE);
481+
482+ nvgFontFace (vg, " opensans_bold" );
483+ nvgFontSize (vg, 120 .0f );
484+ nvgTextBox (vg, 110 , 220 , fb_w-240 , title, NULL );
485+
486+ nvgFontFace (vg, " opensans_regular" );
487+ nvgFontSize (vg, 86 .0f );
488+ nvgTextBox (vg, 130 , 380 , fb_w-260 , message, NULL );
470489
471490 // draw button
472491 if (button) {
473492 nvgBeginPath (vg);
474- nvgFillColor (vg, nvgRGBA (0 , 0 , 0 , 255 ));
493+ nvgFillColor (vg, nvgRGBA (8 , 8 , 8 , 255 ));
475494 nvgRoundedRect (vg, b_x, b_y, b_w, b_h, 20 );
476495 nvgFill (vg);
477496
478497 nvgFillColor (vg, nvgRGBA (255 , 255 , 255 , 255 ));
498+ nvgFontFace (vg, " opensans_semibold" );
479499 nvgTextAlign (vg, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE);
480500 nvgText (vg, b_x+b_w/2 , b_y+b_h/2 , button, NULL );
481501
482502 nvgBeginPath (vg);
483- nvgStrokeColor (vg, nvgRGBA (255 , 255 , 255 , 255 ));
503+ nvgStrokeColor (vg, nvgRGBA (255 , 255 , 255 , 50 ));
484504 nvgStrokeWidth (vg, 5 );
485505 nvgRoundedRect (vg, b_x, b_y, b_w, b_h, 20 );
486506 nvgStroke (vg);
@@ -489,16 +509,17 @@ struct Updater {
489509 // draw button
490510 if (altbutton) {
491511 nvgBeginPath (vg);
492- nvgFillColor (vg, nvgRGBA (0 , 0 , 0 , 255 ));
512+ nvgFillColor (vg, nvgRGBA (8 , 8 , 8 , 255 ));
493513 nvgRoundedRect (vg, balt_x, b_y, b_w, b_h, 20 );
494514 nvgFill (vg);
495515
496516 nvgFillColor (vg, nvgRGBA (255 , 255 , 255 , 255 ));
517+ nvgFontFace (vg, " opensans_semibold" );
497518 nvgTextAlign (vg, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE);
498519 nvgText (vg, balt_x+b_w/2 , b_y+b_h/2 , altbutton, NULL );
499520
500521 nvgBeginPath (vg);
501- nvgStrokeColor (vg, nvgRGBA (255 , 255 , 255 , 255 ));
522+ nvgStrokeColor (vg, nvgRGBA (255 , 255 , 255 , 50 ));
502523 nvgStrokeWidth (vg, 5 );
503524 nvgRoundedRect (vg, balt_x, b_y, b_w, b_h, 20 );
504525 nvgStroke (vg);
@@ -510,23 +531,27 @@ struct Updater {
510531 nvgFontSize (vg, 64 .0f );
511532 nvgFillColor (vg, nvgRGBA (255 ,255 ,255 ,255 ));
512533 nvgTextAlign (vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE);
513- nvgTextBox (vg, 0 , 700 , fb_w, progress_text.c_str (), NULL );
534+ nvgFontFace (vg, " opensans_bold" );
535+ nvgFontSize (vg, 86 .0f );
536+ nvgTextBox (vg, 0 , 380 , fb_w, progress_text.c_str (), NULL );
514537
515538 // draw progress bar
516539 {
517- int progress_width = 800 ;
540+ int progress_width = 1000 ;
518541 int progress_x = fb_w/2 -progress_width/2 ;
519- int progress_y = 768 ;
520- int progress_height = 15 ;
542+ int progress_y = 520 ;
543+ int progress_height = 50 ;
521544
522- int powerprompt_y = 512 ;
523- nvgText (vg, fb_w/2 , powerprompt_y, " Ensure EON is connected to power" , NULL );
545+ int powerprompt_y = 312 ;
546+ nvgFontFace (vg, " opensans_regular" );
547+ nvgFontSize (vg, 64 .0f );
548+ nvgText (vg, fb_w/2 , 740 , " Ensure EON is connected to power." , NULL );
524549
525550 NVGpaint paint = nvgBoxGradient (
526551 vg, progress_x + 1 , progress_y + 1 ,
527- progress_width - 2 , progress_height, 3 , 4 , nvgRGB (0 , 32 , 0 ), nvgRGB (0 , 92 , 0 ));
552+ progress_width - 2 , progress_height, 3 , 4 , nvgRGB (27 , 27 , 27 ), nvgRGB (27 , 27 , 27 ));
528553 nvgBeginPath (vg);
529- nvgRoundedRect (vg, progress_x, progress_y, progress_width, progress_height, 3 );
554+ nvgRoundedRect (vg, progress_x, progress_y, progress_width, progress_height, 12 );
530555 nvgFillPaint (vg, paint);
531556 nvgFill (vg);
532557
@@ -536,12 +561,12 @@ struct Updater {
536561 paint = nvgBoxGradient (
537562 vg, progress_x, progress_y,
538563 bar_pos+1 .5f , progress_height-1 , 3 , 4 ,
539- nvgRGB (220 , 100 , 0 ), nvgRGB (128 , 100 , 0 ));
564+ nvgRGB (245 , 245 , 245 ), nvgRGB (105 , 105 , 105 ));
540565
541566 nvgBeginPath (vg);
542567 nvgRoundedRect (
543568 vg, progress_x+1 , progress_y+1 ,
544- bar_pos, progress_height-2 , 3 );
569+ bar_pos, progress_height-2 , 12 );
545570 nvgFillPaint (vg, paint);
546571 nvgFill (vg);
547572 }
@@ -554,16 +579,16 @@ struct Updater {
554579
555580 switch (state) {
556581 case CONFIRMATION:
557- draw_ack_screen (" An upgrade to NEOS is required.\n\n "
558- " Your device will now be reset and upgraded. You may want to connect to wifi as download is around 1 GB\n Data on device shouldn't be lost." ,
559- " continue " ,
560- " wifi " );
582+ draw_ack_screen (" An update to NEOS is required." ,
583+ " Your device will now be reset and upgraded. You may want to connect to wifi as download is around 1 GB. Existing data on device should not be lost." ,
584+ " Continue " ,
585+ " Connect to WiFi " );
561586 break ;
562587 case RUNNING:
563588 draw_progress_screen ();
564589 break ;
565590 case ERROR:
566- draw_ack_screen ((" ERROR: " + error_text + " \n\n You will need to retry" ).c_str (), NULL , " exit" );
591+ draw_ack_screen (" There was an error. " , (" ERROR: " + error_text + " \n\n You will need to retry" ).c_str (), NULL , " exit" );
567592 break ;
568593 }
569594
@@ -604,9 +629,17 @@ struct Updater {
604629 while (!do_exit) {
605630 ui_update ();
606631
607- glClearColor (0.19 , 0.09 , 0.2 , 1.0 );
632+ glClearColor (0.08 , 0.08 , 0.08 , 1.0 );
608633 glClear (GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
609634
635+ // background
636+ nvgBeginPath (vg);
637+ NVGpaint bg = nvgLinearGradient (vg, fb_w, 0 , fb_w, fb_h,
638+ nvgRGBA (0 , 0 , 0 , 0 ), nvgRGBA (0 , 0 , 0 , 255 ));
639+ nvgFillPaint (vg, bg);
640+ nvgRect (vg, 0 , 0 , fb_w, fb_h);
641+ nvgFill (vg);
642+
610643 glEnable (GL_BLEND);
611644 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
612645
0 commit comments