summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Buren <braewoods+rb@braewoods.net>2020-10-30 06:40:46 +0000
committerJames Buren <braewoods+rb@braewoods.net>2020-10-30 15:55:36 +0000
commit2d85c7215169780168032617603e9e7b06d7ba25 (patch)
tree39bf94968b55bbac04a096b432be7bde3beb1527
parentfa3184f95144076baba2032860d61ca5aab2e831 (diff)
downloadrockbox-2d85c7215169780168032617603e9e7b06d7ba25.tar.gz
rockbox-2d85c7215169780168032617603e9e7b06d7ba25.zip
iriver_flash: fix issues with DoUserDialog
First the argument should be const since the original parameter is. Second the pointer arithmetic for detecting whether rockbox is running from ROM or not is incorrect. It ends up being at a location twice as far as intended since the arithmetic does not account for the pointer type's underlying size. It should also be dependent on the target's FLASH_SIZE. Third the LCD setup is moved to the entry point since it is the best place to setup and restore the LCD changes. Change-Id: If9ddaf2cd937f1edf61c82a8a27f48d01807068a
-rw-r--r--apps/plugins/iriver_flash.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/plugins/iriver_flash.c b/apps/plugins/iriver_flash.c
index aa1bdb62b8..9d1c3456a6 100644
--- a/apps/plugins/iriver_flash.c
+++ b/apps/plugins/iriver_flash.c
@@ -701,11 +701,12 @@ int load_romdump(const char *filename)
701} 701}
702 702
703/* Kind of our main function, defines the application flow. */ 703/* Kind of our main function, defines the application flow. */
704void DoUserDialog(char* filename) 704static void DoUserDialog(const char* filename)
705{ 705{
706 /* this can only work if Rockbox runs in DRAM, not flash ROM */ 706 /* check whether we're running from ROM */
707 if ((uint16_t*)rb >= FB && (uint16_t*)rb < FB + 4096*1024) /* 4 MB max */ 707 uint16_t* RB = (uint16_t*) rb;
708 { /* we're running from flash */ 708 if (RB >= FB && RB < FB + (FLASH_SIZE / sizeof(*FB)))
709 {
709 rb->splash(HZ*3, "Not from ROM"); 710 rb->splash(HZ*3, "Not from ROM");
710 return; /* exit */ 711 return; /* exit */
711 } 712 }
@@ -717,14 +718,13 @@ void DoUserDialog(char* filename)
717 return; /* exit */ 718 return; /* exit */
718 } 719 }
719 720
720 rb->lcd_setfont(FONT_SYSFIXED);
721 if (!show_info()) 721 if (!show_info())
722 return ; 722 return; /* exit */
723 723
724 if (filename == NULL) 724 if (filename == NULL)
725 { 725 {
726 rb->splash(HZ*3, "Please use this plugin with \"Open with...\""); 726 rb->splash(HZ*3, "Please use this plugin with \"Open with...\"");
727 return ; 727 return; /* exit */
728 } 728 }
729 729
730 audiobuf = rb->plugin_get_audio_buffer((size_t *)&audiobuf_size); 730 audiobuf = rb->plugin_get_audio_buffer((size_t *)&audiobuf_size);
@@ -752,7 +752,9 @@ enum plugin_status plugin_start(const void* parameter)
752 752
753 /* now go ahead and have fun! */ 753 /* now go ahead and have fun! */
754 oldmode = rb->system_memory_guard(MEMGUARD_NONE); /*disable memory guard */ 754 oldmode = rb->system_memory_guard(MEMGUARD_NONE); /*disable memory guard */
755 DoUserDialog((char*) parameter); 755 rb->lcd_setfont(FONT_SYSFIXED);
756 DoUserDialog(parameter);
757 rb->lcd_setfont(FONT_UI);
756 rb->system_memory_guard(oldmode); /* re-enable memory guard */ 758 rb->system_memory_guard(oldmode); /* re-enable memory guard */
757 759
758 return PLUGIN_OK; 760 return PLUGIN_OK;