From 9c1742f6cb2043d0ed6a61ab6de3bef0aad6dc56 Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Tue, 25 Dec 2012 16:00:34 -0500 Subject: Universally use update method 2 for the lower screen and 0 for the upper screen. Method 1 causes problems after about 15 minutes; despite the double-buffering, screen updates start to tear in the middle consistently. --- source/nds/draw.c | 8 ++++---- source/nds/entry.cpp | 6 ++++-- source/nds/gui.c | 27 +++++++++------------------ 3 files changed, 17 insertions(+), 24 deletions(-) (limited to 'source') diff --git a/source/nds/draw.c b/source/nds/draw.c index 9d1b8ec..2a9e440 100644 --- a/source/nds/draw.c +++ b/source/nds/draw.c @@ -811,7 +811,7 @@ u32 draw_yesno_dialog(enum SCREEN_ID screen, u32 sy, char *yes, char *no) // draw_string_vcenter(screen_address, i+1, sy+1, box_width, COLOR_WHITE, no); draw_string_vcenter((unsigned short*)screen_addr, 138, 130, 58, COLOR_WHITE, no); - ds2_flipScreen(screen, 1); + ds2_flipScreen(screen, 2); gui_action_type gui_action = CURSOR_NONE; while((gui_action != CURSOR_SELECT) && (gui_action != CURSOR_BACK)) @@ -860,7 +860,7 @@ void init_progress(enum SCREEN_ID screen, u32 total, char *text) drawboxfill((unsigned short*)screen_addr, progress_sx, progress_sy, progress_ex, progress_ey, COLOR16(15, 15, 15)); - ds2_flipScreen(_progress_screen_id, 1); + ds2_flipScreen(_progress_screen_id, 2); } // update progress bar @@ -883,7 +883,7 @@ void update_progress(void) drawboxfill(screen_addr, progress_sx, progress_sy, progress_sx+width, progress_ey, COLOR16(30, 19, 7)); - ds2_flipScreen(_progress_screen_id, 1); + ds2_flipScreen(_progress_screen_id, 2); } // display progress string @@ -908,7 +908,7 @@ void show_progress(char *text) // if (text[0] != '\0') // print_string_center(progress_sy - 21, COLOR_PROGRESS_TEXT, COLOR_DIALOG, text); - ds2_flipScreen(_progress_screen_id, 1); + ds2_flipScreen(_progress_screen_id, 2); // OSTimeDly(progress_wait); mdelay(500); diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp index ea5f6ce..ce8d732 100644 --- a/source/nds/entry.cpp +++ b/source/nds/entry.cpp @@ -174,7 +174,10 @@ bool8 S9xDeinitUpdate (int Width, int Height, bool8 /*sixteen_bit*/) break; } - ds2_flipScreen(UP_SCREEN, 1); // synchronise to vblank to avoid tearing + ds2_flipScreen(UP_SCREEN, 0); + // A problem with update method 1 (wait, double buffer) means that, after + // about 15 minutes of play time, the screen starts to half-redraw every + // frame. With update method 0, this is mitigated. (Method 2 is too slow.) return (TRUE); } @@ -598,7 +601,6 @@ int sfc_main (int argc, char **argv) if (Settings.Paused) { S9xSetSoundMute (TRUE); - // mdelay(50); // Delete this delay unsigned short screen[256*192]; copy_screen((void*)screen, up_screen_addr, 0, 0, 256, 192); diff --git a/source/nds/gui.c b/source/nds/gui.c index 964944b..3438f62 100644 --- a/source/nds/gui.c +++ b/source/nds/gui.c @@ -1114,7 +1114,7 @@ s32 load_file(char **wildcards, char *result, char *default_dir_name) } redraw = 0; - ds2_flipScreen(DOWN_SCREEN, 2); //not switch down screen buffer + ds2_flipScreen(DOWN_SCREEN, 2); } //end if(0 != redraw) else if(0 != redraw) { unsigned int m, n; @@ -1142,7 +1142,7 @@ s32 load_file(char **wildcards, char *result, char *default_dir_name) } draw_hscroll(m+1, redraw); - ds2_flipScreen(DOWN_SCREEN, 2); //not switch down screen buffer + ds2_flipScreen(DOWN_SCREEN, 2); redraw = 0; } @@ -1162,7 +1162,7 @@ s32 load_file(char **wildcards, char *result, char *default_dir_name) { if(draw_hscroll(0, 1) <= 1) path_scroll = 0x8000; //scroll left } - ds2_flipScreen(DOWN_SCREEN, 2); //not switch down screen buffer + ds2_flipScreen(DOWN_SCREEN, 2); } mdelay(50); //about 50ms @@ -1176,7 +1176,7 @@ s32 load_file(char **wildcards, char *result, char *default_dir_name) manage_filelist_info(&filelist_info, -1); ds2_clearScreen(DOWN_SCREEN, COLOR_BLACK); - ds2_flipScreen(DOWN_SCREEN, 2); //not switch down screen buffer + ds2_flipScreen(DOWN_SCREEN, 2); return return_value; } @@ -3991,22 +3991,14 @@ u32 menu(u16 *screen) save_game_config_file(); } save_emu_config_file(); - // mdelay(100); // Delete this delay set_cpu_clock(clock_speed_number); - // mdelay(200); // Delete this delay - ds2_clearScreen(DUAL_SCREEN, 0); - ds2_flipScreen(DUAL_SCREEN, 1); + ds2_clearScreen(DOWN_SCREEN, 0); + ds2_flipScreen(DOWN_SCREEN, 1); copy_screen(up_screen_addr, (void*) screen, 0, 0, 256, 192); - ds2_flipScreen(UP_SCREEN, 1); // Flip again because otherwise it flickers + ds2_flipScreen(UP_SCREEN, 0); ds2_setBacklight(2); -//save game config -// save_game_config_file(); -// save_emu_config_file(); - - -// ds2_setCPUclocklevel(12); wait_Allkey_release(0); return return_value; @@ -4722,7 +4714,7 @@ void gui_init(u32 lang_id) } show_log(down_screen_addr); - ds2_flipScreen(DOWN_SCREEN, 1); + ds2_flipScreen(DOWN_SCREEN, 2); flag = icon_init(lang_id); if(0 != flag) @@ -4758,8 +4750,7 @@ void gui_init(u32 lang_id) return; gui_init_err: - ds2_flipScreen(DOWN_SCREEN, 1); + ds2_flipScreen(DOWN_SCREEN, 2); wait_Anykey_press(0); quit(); - while(1); } -- cgit v1.2.3