diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2016-11-06 14:08:46 -0500 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2016-11-06 14:08:46 -0500 |
| commit | 173d9fb38b029122e85610a69334ddb44107bd78 (patch) | |
| tree | b50eb4fe26cc230499f2132bfa376ed91bcc5f91 /apps/plugins | |
| parent | 48bca52ac76c44c4faa011b41943714e3dffbd0d (diff) | |
| download | rockbox-173d9fb38b029122e85610a69334ddb44107bd78.zip rockbox-173d9fb38b029122e85610a69334ddb44107bd78.tar.gz rockbox-173d9fb38b029122e85610a69334ddb44107bd78.tar.bz2 rockbox-173d9fb38b029122e85610a69334ddb44107bd78.tar.xz | |
boost selectively
Change-Id: Ic11542cef53716869c5348c18a2846308b4e867b
Diffstat (limited to 'apps/plugins')
| -rw-r--r-- | apps/plugins/xworld/sys.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c index ea3dacd..53f6b78 100644 --- a/apps/plugins/xworld/sys.c +++ b/apps/plugins/xworld/sys.c @@ -231,7 +231,6 @@ static void do_video_settings(struct System* sys) } break; case 5: - rb->lcd_clear_display(); sys_save_settings(sys); return; } @@ -296,6 +295,38 @@ static int mainmenu_cb(int action, const struct menu_item_ex *this_item) return action; } +static bool is_boosted = false; + +void sys_boost(struct System *sys) +{ + (void) sys; +#ifdef HAVE_ADJUSTABLE_CPU_FREQ + if(!is_boosted) + { + rb->cpu_boost(true); + is_boosted = true; + } +#endif +} + +void sys_unboost(struct System *sys) +{ + (void) sys; +#ifdef HAVE_ADJUSTABLE_CPU_FREQ + if(is_boosted) + { + rb->cpu_boost(false); + is_boosted = false; + } +#endif +} + +static void boost_if_needed(struct System *sys) +{ + if(sys->e->vm._fastMode || sys->settings.scaling_quality == 2) + sys_boost(sys); +} + static AudioCallback audio_callback = NULL; static void get_more(const void** start, size_t* size); static void* audio_param; @@ -377,16 +408,16 @@ void sys_menu(struct System* sys) break; } } - rb->lcd_clear_display(); + + /* boost CPU if necessary */ + boost_if_needed(sys); + sys_startAudio(sys, audio_callback, audio_param); } void sys_init(struct System* sys, const char* title) { (void) title; -#ifdef HAVE_ADJUSTABLE_CPU_FREQ - rb->cpu_boost(true); -#endif backlight_ignore_timeout(); rb_atexit(exit_handler); save_sys = sys; @@ -621,6 +652,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16 static void do_pause_menu(struct System* sys) { sys_stopAudio(sys); + sys_unboost(sys); int sel = 0; MENUITEM_STRINGLIST(menu, "XWorld Menu", NULL, "Resume Game", /* 0 */ @@ -685,7 +717,9 @@ static void do_pause_menu(struct System* sys) break; } } - rb->lcd_clear_display(); + + boost_if_needed(sys); + sys_startAudio(sys, audio_callback, audio_param); } |