Index: apps/plugins/rockboy/rockmacros.h =================================================================== --- apps/plugins/rockboy/rockmacros.h (revision 14198) +++ apps/plugins/rockboy/rockmacros.h (working copy) @@ -108,7 +108,7 @@ int A, B, START, SELECT, MENU; int UP, DOWN, LEFT, RIGHT; int frameskip, fps, maxskip; - int sound, fullscreen, showstats; + int sound, scaling, showstats; int rotate; int pal; int dirty; Index: apps/plugins/rockboy/fb.h =================================================================== --- apps/plugins/rockboy/fb.h (revision 14198) +++ apps/plugins/rockboy/fb.h (working copy) @@ -11,14 +11,13 @@ struct fb { fb_data *ptr; +#ifdef HAVE_LCD_COLOR struct { int l, r; } cc[3]; - int enabled; -#if !defined(HAVE_LCD_COLOR) - int mode; #endif + int enabled; }; Index: apps/plugins/rockboy/lcd-gb.h =================================================================== --- apps/plugins/rockboy/lcd-gb.h (revision 14198) +++ apps/plugins/rockboy/lcd-gb.h (working copy) @@ -16,12 +16,10 @@ { int bg[64]; int wnd[64]; -#if LCD_DEPTH == 1 - byte buf[8][256]; -#elif LCD_DEPTH == 2 - byte buf[4][256]; -#elif LCD_DEPTH > 4 +#if LCD_DEPTH > 1 byte buf[256]; +#else + byte buf[8][256]; #endif un16 pal[64]; byte pri[256]; Index: apps/plugins/rockboy/lcd.c =================================================================== --- apps/plugins/rockboy/lcd.c (revision 14198) +++ apps/plugins/rockboy/lcd.c (working copy) @@ -9,7 +9,7 @@ #ifdef USE_ASM #include "asm.h" #endif - + struct lcd lcd; struct scan scan IBSS_ATTR; @@ -17,10 +17,10 @@ #define BG (scan.bg) #define WND (scan.wnd) -#if LCD_DEPTH ==16 +#if LCD_DEPTH > 1 #define BUF (scan.buf) #else -#define BUF (scan.buf[scanline_ind]) +#define BUF (scan.buf[scanline]) #endif #define PRI (scan.pri) @@ -50,10 +50,16 @@ byte patdirty[1024]; byte anydirty; -#if LCD_DEPTH < 16 -static int scanline_ind=0; +#if LCD_DEPTH < 16 +static int scanline = 0; #endif +#if (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == HORIZONTAL_PACKING) +#define DRAW_MASK ~pixmask[cnt & 3] +#elif (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_PACKING) +#define DRAW_MASK ~pixmask[scanline & 3] +#endif + static int dmg_pal[4][4]; fb_data *vdest; @@ -764,8 +770,8 @@ if (VS[i].x > VS[j].x) { ts = VS[i]; - VS[i] = VS[j]; - VS[j] = ts; + VS[i] = VS[j]; + VS[j] = ts; } } } @@ -875,25 +881,26 @@ #endif set_pal(); + vdest=fb.ptr; #ifdef HAVE_LCD_COLOR if(options.rotate) { - if(options.fullscreen == 0) - vdest=fb.ptr+S2R; - else if (options.fullscreen == 1) - vdest=fb.ptr+S3R; + if(options.scaling == 0) + vdest+=S2R; + else if (options.scaling == 1) + vdest+=S3R; else - vdest=fb.ptr+S1R; + vdest+=S1R; } else { - if(options.fullscreen == 0) - vdest=fb.ptr+S2; - else if (options.fullscreen == 1) - vdest=fb.ptr+S3; + if(options.scaling == 0) + vdest+=S2; + else if (options.scaling == 1) + vdest+=S3; else - vdest=fb.ptr+S1; + vdest+=S1; } #endif WY = R_WY; @@ -911,7 +918,7 @@ void setvidmode(void) { #ifdef HAVE_LCD_COLOR - switch(options.fullscreen) + switch(options.scaling) { case 0: if(options.rotate) @@ -977,31 +984,44 @@ sremain=-(((160*SCALEWL)>>16)*LCD_WIDTH+1); else sremain=LCD_WIDTH-swidth; +#else + /* Handled in lcd_refreshline() */ + return; #endif } void lcd_refreshline(void) { -#ifdef HAVE_LCD_COLOR char frameout[30]; -#endif if (!(R_LCDC & 0x80)) return; /* should not happen... */ -#if (LCD_HEIGHT <= 128) && !defined(HAVE_LCD_COLOR) - if ( (fb.mode==0&&(R_LY >= 128)) || - (fb.mode==1&&(R_LY < 16)) || - (fb.mode==2&&(R_LY<8||R_LY>=136)) || - (fb.mode==3&&((R_LY%9)==8)) +#if LCD_DEPTH == 2 + if(scanline == 144) + { + scanline = 0; + rb->lcd_update(); + } +#endif +#if !defined(HAVE_LCD_COLOR) + #if LCD_HEIGHT == 64 - || (R_LY & 1) /* calculate only even lines */ + if ( (options.scaling==0&&(R_LY >= 128)) || (options.scaling==1&&(R_LY < 16)) || + (options.scaling==2&&(R_LY<8||R_LY>=136)) || (options.scaling==3&&((R_LY%9)==8)) || (R_LY & 1) ) +#elif LCD_HEIGHT == 110 + if ( (options.scaling==0&&(R_LY >= 110)) || (options.scaling==1&&(R_LY < 34)) || + (options.scaling==2&&(R_LY<17||R_LY>=127)) || (options.scaling==3&&((R_LY%4)==0) + && (R_LY!=3) && (R_LY != 135 )) ) +#elif LCD_HEIGHT == 128 + if ( (options.scaling==0&&(R_LY >= 128)) || (options.scaling==1&&(R_LY < 16)) || + (options.scaling==2&&(R_LY<8||R_LY>=136)) || (options.scaling==3&&((R_LY%9)==8)) ) #endif - ) - return; -#endif + return; /* line is skipped due to scaling */ +#endif /* HAVE_LCD_COLOR */ + updatepatpix(); L = R_LY; @@ -1042,17 +1062,44 @@ #if !defined(HAVE_LCD_COLOR) #if LCD_DEPTH == 1 - if (scanline_ind == 7) -#elif LCD_DEPTH == 2 - if (scanline_ind == 3) -#endif + if (scanline == 7) { - if(fb.mode!=3) + if(options.scaling!=3) vid_update(L); else vid_update(L-((int)(L/9))); + } +#elif (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == HORIZONTAL_PACKING) + int cnt = 0; + unsigned char pixmask[4] = + { + 0xC0, 0x30, 0x0C, 0x03 + }; + + while (cnt < 160) + { +#if LCD_WIDTH < 160 + if (cnt < LCD_WIDTH) +#endif + vdest[cnt >> 2] = (vdest[cnt >> 2] & DRAW_MASK) | ((BUF[cnt]&0x3) << ((~cnt & 3 )<<1)); + cnt++; + } + vdest += LCD_FBWIDTH; +#elif (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_PACKING) + int cnt = 0; + unsigned char pixmask[4] = + { + 0x03, 0x0C, 0x30, 0xC0 + }; + while (cnt < 160) + { + vdest[cnt] = (vdest[cnt] & DRAW_MASK) | ((BUF[cnt]&0x3) << ((scanline & 3)<<1)); + cnt++; + } + if ((scanline & 3) == 3) + vdest += LCD_FBWIDTH; +#endif #else - { /* Universal Scaling pulled from PrBoom and modified for rockboy */ static int hpt IDATA_ATTR=0x8000; @@ -1075,6 +1122,7 @@ } vdest+=remain; } +#endif if(L==143) { @@ -1083,18 +1131,18 @@ snprintf(frameout,sizeof(frameout),"FPS: %d Frameskip: %d ",options.fps, options.frameskip); rb->lcd_putsxy(0,LCD_HEIGHT-10,frameout); } - +#ifdef HAVE_LCD_COLOR hpt=0x8000; rb->lcd_update(); +#endif } -#endif - } #if LCD_DEPTH == 1 - scanline_ind = (scanline_ind+1) % 8; + scanline = (scanline+1) % 8; #elif LCD_DEPTH == 2 - scanline_ind = (scanline_ind+1) % 4; + scanline++; #endif + } void set_pal(void) @@ -1199,18 +1247,3 @@ vram_dirty(); } - - - - - - - - - - - - - - - Index: apps/plugins/rockboy/menu.c =================================================================== --- apps/plugins/rockboy/menu.c (revision 14198) +++ apps/plugins/rockboy/menu.c (working copy) @@ -10,13 +10,13 @@ #include "lib/oldmenuapi.h" #include "rtc-gb.h" -#if (CONFIG_KEYPAD == IPOD_4G_PAD) +#if CONFIG_KEYPAD == IPOD_4G_PAD #define MENU_BUTTON_UP BUTTON_SCROLL_BACK #define MENU_BUTTON_DOWN BUTTON_SCROLL_FWD #define MENU_BUTTON_LEFT BUTTON_LEFT #define MENU_BUTTON_RIGHT BUTTON_RIGHT -#elif (CONFIG_KEYPAD == IRIVER_H10_PAD) +#elif CONFIG_KEYPAD == IRIVER_H10_PAD #define MENU_BUTTON_UP BUTTON_SCROLL_UP #define MENU_BUTTON_DOWN BUTTON_SCROLL_DOWN #define MENU_BUTTON_LEFT BUTTON_LEFT @@ -347,15 +347,22 @@ { "6 Max", -1 }, }; + static const struct opt_items scaling[]= { #ifdef HAVE_LCD_COLOR - static const struct opt_items fullscreen[]= { { "Scaled", -1 }, { "Scaled - Maintain Ratio", -1 }, #if (LCD_WIDTH>=160) && (LCD_HEIGHT>=144) { "Unscaled", -1 }, #endif +#else + { "Clip Bottom", -1 }, + { "Clip Top", -1 }, + { "Clip Top and Bottom Evenly", -1 }, + { "Skip Lines", -1 }, +#endif }; +#ifdef HAVE_LCD_COLOR static const struct opt_items palette[]= { { "Brown (Default)", -1 }, { "Gray", -1 }, @@ -382,8 +389,8 @@ { "Sound" , NULL }, { "Stats" , NULL }, { "Set Keys (Buggy)", NULL }, + { "Screen Size" , NULL }, #ifdef HAVE_LCD_COLOR - { "Screen Size" , NULL }, { "Screen Rotate" , NULL }, { "Set Palette" , NULL }, #endif @@ -415,12 +422,12 @@ case 3: /* Keys */ setupkeys(); break; -#ifdef HAVE_LCD_COLOR case 4: /* Screen Size */ - rb->set_option(items[4].desc, &options.fullscreen, INT, fullscreen, - sizeof(fullscreen)/sizeof(*fullscreen), NULL ); + rb->set_option(items[4].desc, &options.scaling, INT, scaling, + sizeof(scaling)/sizeof(*scaling), NULL ); setvidmode(); break; +#ifdef HAVE_LCD_COLOR case 5: /* Screen rotate */ rb->set_option(items[5].desc, &options.rotate, INT, onoff, 2, NULL ); setvidmode(); Index: apps/plugins/rockboy/sys_rockbox.c =================================================================== --- apps/plugins/rockboy/sys_rockbox.c (revision 14198) +++ apps/plugins/rockboy/sys_rockbox.c (working copy) @@ -24,14 +24,6 @@ #include "hw.h" #include "config.h" -#if (CONFIG_KEYPAD == SANSA_E200_PAD) - -#define ROCKBOY_SCROLLWHEEL -#define ROCKBOY_SCROLLWHEEL_CC BUTTON_SCROLL_UP -#define ROCKBOY_SCROLLWHEEL_CW BUTTON_SCROLL_DOWN - -#endif - struct fb fb IBSS_ATTR; extern int debug_trace; @@ -86,13 +78,9 @@ released = ~newbuttonstate & oldbuttonstate; pressed = newbuttonstate & ~oldbuttonstate; oldbuttonstate = newbuttonstate; -#if (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && (LCD_DEPTH == 2) - if (rb->button_hold()&~holdbutton) - fb.mode=(fb.mode+1)%4; - holdbutton=rb->button_hold(); -#elif CONFIG_KEYPAD == RECORDER_PAD +#if CONFIG_KEYPAD == RECORDER_PAD if (pressed & BUTTON_ON) - fb.mode=(fb.mode+1)%4; + options.scaling=(options.scaling+1)%4; #endif #ifdef HAVE_WHEEL_POSITION @@ -166,7 +154,7 @@ ev_postevent(&ev); } #endif -#if CONFIG_KEYPAD == IPOD_4G_PAD +#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IRIVER_H100_PAD) if(rb->button_hold()) { #else if(pressed & options.MENU) { @@ -219,23 +207,21 @@ fb.cc[1].l = 5; /* This is the offset to the G bits (16-5-6) */ fb.cc[2].r = 3; /* 8-5 (wasted bits on red) */ fb.cc[2].l = 0; /* This is the offset to the B bits (16-5-6-5) */ -#else - fb.mode=3; #endif } -#if !defined(HAVE_LCD_COLOR) -/* Color targets are handled in lcd.c */ +#if LCD_DEPTH == 1 +/* Color and greyscale targets are handled in lcd.c */ fb_data *frameb; void vid_update(int scanline) { - register int cnt=0; +#if (LCD_HEIGHT == 64) /* Archos */ + register int cnt=0; int scanline_remapped; -#if (LCD_HEIGHT == 64) && (LCD_DEPTH == 1) /* Archos */ int balance = 0; - if (fb.mode==1) + if (options.scaling==1) scanline-=16; - else if (fb.mode==2) + else if (options.scaling==2) scanline-=8; scanline_remapped = scanline / 16; frameb = rb->lcd_framebuffer + scanline_remapped * LCD_WIDTH; @@ -307,22 +293,7 @@ cnt ++; } rb->lcd_update_rect(0, (scanline/2) & ~7, LCD_WIDTH, 8); -#elif (LCD_HEIGHT == 128) && (LCD_DEPTH == 2) /* iriver H1x0 */ - if (fb.mode==1) - scanline-=16; - else if (fb.mode==2) - scanline-=8; - scanline_remapped = scanline / 4; - frameb = rb->lcd_framebuffer + scanline_remapped * LCD_WIDTH; - while (cnt < 160) { - *(frameb++) = (scan.buf[0][cnt]&0x3) | - ((scan.buf[1][cnt]&0x3)<<2) | - ((scan.buf[2][cnt]&0x3)<<4) | - ((scan.buf[3][cnt]&0x3)<<6); - cnt++; - } - rb->lcd_update_rect(0, scanline & ~3, LCD_WIDTH, 4); -#elif defined(HAVE_LCD_COLOR) +#else /* handled in lcd.c now */ #endif /* LCD_HEIGHT */ } Index: apps/plugins/rockboy/rockboy.c =================================================================== --- apps/plugins/rockboy/rockboy.c (revision 14198) +++ apps/plugins/rockboy/rockboy.c (working copy) @@ -146,6 +146,10 @@ options.MENU=BUTTON_MENU; #elif CONFIG_KEYPAD == SANSA_E200_PAD +#define ROCKBOY_SCROLLWHEEL +#define ROCKBOY_SCROLLWHEEL_CC BUTTON_SCROLL_UP +#define ROCKBOY_SCROLLWHEEL_CW BUTTON_SCROLL_DOWN + options.UP=BUTTON_UP; options.DOWN=BUTTON_DOWN; @@ -180,9 +184,9 @@ options.fps=0; options.showstats=0; #if (LCD_WIDTH>=160) && (LCD_HEIGHT>=144) - options.fullscreen=0; + options.scaling=0; #else - options.fullscreen=1; + options.scaling=1; #endif options.sound=1; options.pal=0; Index: apps/plugins/SUBDIRS =================================================================== --- apps/plugins/SUBDIRS (revision 14198) +++ apps/plugins/SUBDIRS (working copy) @@ -9,7 +9,8 @@ #endif #if (CONFIG_KEYPAD == RECORDER_PAD) || defined(HAVE_LCD_COLOR) \ - || defined(IRIVER_H100_SERIES) || defined(IAUDIO_M5) + || defined(IRIVER_H100_SERIES) || defined(IAUDIO_M5) \ + || (CONFIG_KEYPAD == IPOD_4G_PAD) rockboy #endif