From 25ffd2e1463473910adc8cb24c5e9f0fbfe5ff69 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Tue, 26 Sep 2006 08:36:54 +0000 Subject: do not update border when we don't see it. some more cleanup. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11055 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/zxbox/ChangeLog | 2 + apps/plugins/zxbox/spect.c | 4 ++ apps/plugins/zxbox/spmain.c | 120 ++++++++++++++++++++----------------------- apps/plugins/zxbox/spperif.c | 1 - apps/plugins/zxbox/spperif.h | 1 - apps/plugins/zxbox/spscr.c | 33 ++++-------- apps/plugins/zxbox/spscr.h | 1 - 7 files changed, 71 insertions(+), 91 deletions(-) (limited to 'apps') diff --git a/apps/plugins/zxbox/ChangeLog b/apps/plugins/zxbox/ChangeLog index 2986d97eda..ce31728f36 100644 --- a/apps/plugins/zxbox/ChangeLog +++ b/apps/plugins/zxbox/ChangeLog @@ -1,3 +1,5 @@ +26.09.2006 do not update border when we don't see it. some more cleanup. + 25.09.2006 yet more code cleanup, quick snapshot feature,sound should no longer crash,light optimizations 04.09.2006 code cleanup; now using IRAM correctly (i hope) diff --git a/apps/plugins/zxbox/spect.c b/apps/plugins/zxbox/spect.c index 8e9291f704..47715fa9fd 100644 --- a/apps/plugins/zxbox/spect.c +++ b/apps/plugins/zxbox/spect.c @@ -60,11 +60,15 @@ int SPNM(halfframe)(int firsttick, int numlines) /* Check if updating screen */ if(SPNM(updating)) { +#if LCD_WIDTH == 320 && ( LCD_HEIGHT == 240 || LCD_HEIGHT == 200 ) border = SPNM(lastborder); if((feport & 0x07) != border) { SPNM(border_update) = 2; SPNM(lastborder) = feport & 0x07; } +#else + SPNM(border_update) = 0; +#endif scrptr = update_screen_line(scrptr, SPNM(coli)[scline], DANM(next_scri), border, &cmark); diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c index 030047cc94..3a702abb71 100644 --- a/apps/plugins/zxbox/spmain.c +++ b/apps/plugins/zxbox/spmain.c @@ -84,7 +84,7 @@ static struct configdata config[] = }; int spcf_read_conf_file(const char *filename) { - settings.volume = 10; + settings.volume = 10; settings.showfps=1; settings.keymap[0]='2'; settings.keymap[1]='w'; @@ -93,8 +93,8 @@ int spcf_read_conf_file(const char *filename) settings.keymap[4]='z'; settings.kempston = 1 ; settings.invert_colors=0; - settings.sound = 0; - settings.frameskip = 0; + settings.sound = 0; + settings.frameskip = 0; configfile_init(rb); @@ -112,17 +112,17 @@ int spcf_read_conf_file(const char *filename) /* Keep a copy of the saved version of the settings - so we can check if the settings have changed when we quit */ old_settings = settings; - sound_on = settings.sound; - showframe = settings.frameskip+1; - int i; + sound_on = settings.sound; + showframe = settings.frameskip+1; + int i; for ( i=0 ; i<5 ; i++){ - if (settings.keymap[i] == 'E') - intkeys[i]=SK_KP_Enter; - else if ( settings.keymap[i] == 'S' ) - intkeys[i]=SK_KP_Space; - else - intkeys[i] = (unsigned) settings.keymap[i]; - } + if (settings.keymap[i] == 'E') + intkeys[i]=SK_KP_Enter; + else if ( settings.keymap[i] == 'S' ) + intkeys[i]=SK_KP_Space; + else + intkeys[i] = (unsigned) settings.keymap[i]; + } return 1; } @@ -131,7 +131,7 @@ int spcf_read_conf_file(const char *filename) /* set keys */ static void set_keys(void){ int m; - char c; + char c; int result; int menu_quit=0; static const struct menu_item items[] = { @@ -198,8 +198,8 @@ static void select_keymap(void){ int menu_quit=0; static const struct menu_item items[] = { { "2w90z", NULL }, - { "qaopS", NULL }, - { "7658S", NULL }, + { "qaopS", NULL }, + { "7658S", NULL }, }; m = rb->menu_init(items, sizeof(items) / sizeof(*items), @@ -213,15 +213,15 @@ static void select_keymap(void){ switch(result) { case 0: - rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[0].desc , sizeof(items[0].desc)); + rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[0].desc , sizeof(items[0].desc)); menu_quit=1; break; case 1: - rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[1].desc , sizeof(items[1].desc)); + rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[1].desc , sizeof(items[1].desc)); menu_quit=1; break; case 2: - rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[2].desc , sizeof(items[2].desc)); + rb->memcpy ( (void*)&settings.keymap[0] , (void*)items[2].desc , sizeof(items[2].desc)); menu_quit=1; break; default: @@ -247,9 +247,9 @@ static void options_menu(void){ { "Map Keys to kempston", NULL }, { "Display Speed", NULL }, { "Invert Colors", NULL }, - { "Frameskip", NULL }, - { "Sound", NULL }, - { "Volume", NULL }, + { "Frameskip", NULL }, + { "Sound", NULL }, + { "Volume", NULL }, { "Predefined keymap", NULL }, { "Custom keymap", NULL }, }; @@ -257,15 +257,15 @@ static void options_menu(void){ { "0", NULL }, { "1", NULL }, { "2", NULL }, - { "3", NULL }, - { "4", NULL }, - { "5", NULL }, + { "3", NULL }, + { "4", NULL }, + { "5", NULL }, { "6", NULL }, { "7", NULL }, - { "8", NULL }, - { "9", NULL }, + { "8", NULL }, + { "9", NULL }, }; - + m = rb->menu_init(items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); @@ -299,34 +299,34 @@ static void options_menu(void){ settings.invert_colors=new_setting; rb->splash(HZ, true , "Restart to see effect"); break; - case 3: + case 3: new_setting = settings.frameskip; rb->set_option("Frameskip",&new_setting,INT, frameskip_items, 10, NULL); if (new_setting != settings.frameskip ) settings.frameskip=new_setting; break; - case 4: + case 4: new_setting = settings.sound; rb->set_option("Sound",&new_setting,INT, no_yes, 2, NULL); if (new_setting != settings.sound ) settings.sound=new_setting; #if CODEC == SWCODEC && !defined SIMULATOR - rb->pcm_play_stop(); + rb->pcm_play_stop(); #endif break; - case 5: + case 5: new_setting = 9 - settings.volume; rb->set_option("Volume",&new_setting,INT, frameskip_items, 10, NULL); - new_setting = 9 - new_setting; + new_setting = 9 - new_setting; if (new_setting != settings.volume ) settings.volume=new_setting; break; case 6: - select_keymap(); - break; + select_keymap(); + break; case 7: set_keys(); break; @@ -353,8 +353,8 @@ static bool zxbox_menu(void) static const struct menu_item items[] = { { "VKeyboard", NULL }, { "Play/Pause Tape", NULL }, - { "Save quick snapshot", NULL }, - { "Load quick snapshot", NULL }, + { "Save quick snapshot", NULL }, + { "Load quick snapshot", NULL }, { "Save Snapshot", NULL }, { "Toggle \"fast\" mode", NULL }, { "Options", NULL }, @@ -383,14 +383,14 @@ static bool zxbox_menu(void) pause_play(); menu_quit=1; break; - case 2: - save_quick_snapshot(); - menu_quit = 1; - break; - case 3: - load_quick_snapshot(); - menu_quit = 1; - break; + case 2: + save_quick_snapshot(); + menu_quit = 1; + break; + case 3: + load_quick_snapshot(); + menu_quit = 1; + break; case 4: save_snapshot(); break; @@ -416,15 +416,15 @@ static bool zxbox_menu(void) rb->cpu_boost(true); #endif - int i; + int i; for ( i=0 ; i<5 ; i++){ - if (settings.keymap[i] == 'E') - intkeys[i]=SK_KP_Enter; - else if ( settings.keymap[i] == 'S' ) - intkeys[i]=SK_KP_Space; - else - intkeys[i] = (unsigned) settings.keymap[i]; - } + if (settings.keymap[i] == 'E') + intkeys[i]=SK_KP_Enter; + else if ( settings.keymap[i] == 'S' ) + intkeys[i]=SK_KP_Space; + else + intkeys[i] = (unsigned) settings.keymap[i]; + } #ifdef USE_GRAY gray_show(true); #endif @@ -476,20 +476,10 @@ static void run_singlemode(void) exit_requested = 0; video_frames=-1; start_time = *rb->current_tick; - sound_on = settings.sound; - showframe = settings.frameskip+1; + sound_on = settings.sound; + showframe = settings.frameskip+1; spti_reset(); } - if(sp_paused) { - autoclose_sound(); - while(sp_paused) { - spkb_process_events(1); - spti_sleep(SKIPTICKS); - translate_screen(); - update(); - } - spti_reset(); - } halfsec = !(sp_int_ctr % 25); evenframe = !(sp_int_ctr & 1); diff --git a/apps/plugins/zxbox/spperif.c b/apps/plugins/zxbox/spperif.c index 6255ba689a..33f43608b4 100644 --- a/apps/plugins/zxbox/spperif.c +++ b/apps/plugins/zxbox/spperif.c @@ -48,7 +48,6 @@ int SPNM(scri)[PORT_TIME_NUM]; int SPNM(coli)[PORT_TIME_NUM]; int SPNM(playing_tape) = 0; -int SPNM(paused) = 0; char *SPNM(image); int SPNM(updating); diff --git a/apps/plugins/zxbox/spperif.h b/apps/plugins/zxbox/spperif.h index cb0d550072..f2ccb57be4 100644 --- a/apps/plugins/zxbox/spperif.h +++ b/apps/plugins/zxbox/spperif.h @@ -55,7 +55,6 @@ extern int SPNM(load_trapped); extern qbyte SPNM(scr_mark)[]; extern byte SPNM(fe_inport_high)[]; extern int SPNM(playing_tape); -extern int SPNM(paused); extern int SPNM(scline); diff --git a/apps/plugins/zxbox/spscr.c b/apps/plugins/zxbox/spscr.c index 4cae8654ae..6b85904d11 100644 --- a/apps/plugins/zxbox/spscr.c +++ b/apps/plugins/zxbox/spscr.c @@ -82,6 +82,7 @@ byte *update_screen_line(byte *scrp, int coli, int scri, int border, cmark = *cmarkp; scrptr = (qbyte *) scrp; if(scri >= 0) { /* normal line */ +#if LCD_WIDTH == 320 && ( LCD_HEIGHT == 240 || LCD_HEIGHT == 200 ) if(SPNM(border_update)) { brd_color = SPNM(colors)[border]; brd_color |= brd_color << 8; @@ -91,7 +92,10 @@ byte *update_screen_line(byte *scrp, int coli, int scri, int border, for(i = 8; i; i--) *scrptr++ = brd_color; scrptr -= 0x48; } - else scrptr += 0x08; + else +#endif + scrptr += 0x08; + tmptr = SPNM(scr_mark) + 0x2C0 + (coli >> 3); mark = *tmptr; if(!(coli & 0x07)) { @@ -129,40 +133,23 @@ byte *update_screen_line(byte *scrp, int coli, int scri, int border, else scrptr += 0x48; } else if(scri == -1) { /* only border */ +#if LCD_WIDTH == 320 && ( LCD_HEIGHT == 240 || LCD_HEIGHT == 200 ) if(SPNM(border_update)) { brd_color = SPNM(colors)[border]; brd_color |= brd_color << 8; brd_color |= brd_color << 16; for(i = 0x50; i; i--) *scrptr++ = brd_color; } - else scrptr += 0x50; + else +#endif + scrptr += 0x50; + } *cmarkp = cmark; return (byte *) scrptr; } -void translate_screen(void) -{ - int border, scline; - byte *scrptr; - qbyte cmark = 0; - - scrptr = (byte *) SPNM(image); - - border = DANM(ula_outport) & 0x07; - if(border != SPNM(lastborder)) { - SPNM(border_update) = 2; - SPNM(lastborder) = border; - } - - for(scline = 0; scline < (TMNUM / 2); scline++) - scrptr = update_screen_line(scrptr, SPNM(coli)[scline], SPNM(scri)[scline], - border, &cmark); - -} - - void spscr_init_mask_color(void) { int clb; diff --git a/apps/plugins/zxbox/spscr.h b/apps/plugins/zxbox/spscr.h index 82161dea15..b90dabd7f4 100644 --- a/apps/plugins/zxbox/spscr.h +++ b/apps/plugins/zxbox/spscr.h @@ -30,7 +30,6 @@ extern void init_spect_scr(void); extern void destroy_spect_scr(void); extern void update_screen(void); extern void flash_change(void); -extern void translate_screen(void); extern byte *update_screen_line(byte *scrp, int coli, int scri, int border, qbyte *cmarkp); -- cgit v1.2.3