diff -u -r ines_original/InfoNES.c ines/InfoNES.c --- ines_original/InfoNES.c 2007-09-14 21:13:10.000000000 -0600 +++ ines/InfoNES.c 2007-10-08 13:40:25.781250000 -0600 @@ -779,6 +779,7 @@ int nNameTable; BYTE *pbyNameTable; BYTE *pbyChrData; + BYTE *pbyChrDataStart; BYTE *pSPRRAM; int nAttr; int nSprCnt; @@ -857,15 +858,15 @@ pbyChrData = PPU_BG_Base + ( *pbyNameTable << 6 ) + nYBit; pPalTbl = &PalTable[ ( ( ( pAttrBase[ nX >> 2 ] >> ( ( nX & 2 ) + nY4 ) ) & 3 ) << 2 ) ]; - pPoint[ 0 ] = pPalTbl[ pbyChrData[ 0 ] ]; - pPoint[ 1 ] = pPalTbl[ pbyChrData[ 1 ] ]; - pPoint[ 2 ] = pPalTbl[ pbyChrData[ 2 ] ]; - pPoint[ 3 ] = pPalTbl[ pbyChrData[ 3 ] ]; - pPoint[ 4 ] = pPalTbl[ pbyChrData[ 4 ] ]; - pPoint[ 5 ] = pPalTbl[ pbyChrData[ 5 ] ]; - pPoint[ 6 ] = pPalTbl[ pbyChrData[ 6 ] ]; - pPoint[ 7 ] = pPalTbl[ pbyChrData[ 7 ] ]; - pPoint += 8; + pbyChrDataStart = pbyChrData; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; // Callback at PPU read/write MapperPPU( PATTBL( pbyChrData ) ); @@ -888,15 +889,15 @@ pbyChrData = PPU_BG_Base + ( *pbyNameTable << 6 ) + nYBit; pPalTbl = &PalTable[ ( ( ( pAttrBase[ nX >> 2 ] >> ( ( nX & 2 ) + nY4 ) ) & 3 ) << 2 ) ]; - pPoint[ 0 ] = pPalTbl[ pbyChrData[ 0 ] ]; - pPoint[ 1 ] = pPalTbl[ pbyChrData[ 1 ] ]; - pPoint[ 2 ] = pPalTbl[ pbyChrData[ 2 ] ]; - pPoint[ 3 ] = pPalTbl[ pbyChrData[ 3 ] ]; - pPoint[ 4 ] = pPalTbl[ pbyChrData[ 4 ] ]; - pPoint[ 5 ] = pPalTbl[ pbyChrData[ 5 ] ]; - pPoint[ 6 ] = pPalTbl[ pbyChrData[ 6 ] ]; - pPoint[ 7 ] = pPalTbl[ pbyChrData[ 7 ] ]; - pPoint += 8; + pbyChrDataStart = pbyChrData; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; + *pPoint++ = pPalTbl[ *pbyChrDataStart++ ]; // Callback at PPU read/write MapperPPU( PATTBL( pbyChrData ) ); diff -u -r ines_original/InfoNES_System_Rockbox.c ines/InfoNES_System_Rockbox.c --- ines_original/InfoNES_System_Rockbox.c 2007-09-17 21:10:52.000000000 -0600 +++ ines/InfoNES_System_Rockbox.c 2007-10-09 14:15:00.937500000 -0600 @@ -155,14 +155,14 @@ size_t size = 0xffff; unsigned int i,vmode; - - rb = api; start_menu = 0; + #ifndef SIMULATOR /* not for the simulator */ rb->cpu_boost(true); + #endif - //ROM = 0x28000000; + //ROM = 0x28000000; //ApuEventQueue = rb->plugin_get_audio_buffer(&size); VROM = (BYTE*)rb->plugin_get_audio_buffer(&size); ROM = (BYTE*) VROM + 0xffff * 8; @@ -177,9 +177,16 @@ //rb->strcpy(temp, "/.rockbox/rocks/test.nes"); //argv[1] = temp; + rb->lcd_set_backdrop(NULL); + rb->lcd_set_background(LCD_BLACK); + rb->lcd_set_drawmode(DRMODE_SOLID); + rb->lcd_clear_display(); + /* Turn off backlight timeout */ + backlight_force_on(rb); /* backlight control in lib/helper.c */ - - +#ifdef HAVE_WHEEL_POSITION + rb->wheel_send_events(false); +#endif /* for(i=0; i<64; ++i) { @@ -194,6 +201,8 @@ { if ( start_application(argv[1]) ) { + FrameSkip = 2; + /* MainLoop */ InfoNES_Main(); @@ -213,6 +222,12 @@ rb->splash(stime, "SDL Ports by mata.\n"); rb->splash(stime, "%s. Usage: %s [NES format file]\n", VERSION, argv[0] ); } +#ifdef HAVE_WHEEL_POSITION + rb->wheel_send_events(true); +#endif + + /* Turn on backlight timeout (revert to settings) */ + backlight_use_settings(rb); /* backlight control in lib/helper.c */ return 0; } @@ -506,16 +521,39 @@ BYTE *p,*pl; WORD *pw; -#if 0 //actual size of NES screan +#if (LCD_WIDTH >= 256) && (LCD_HEIGHT >= 240) // as large or larger than NES screen + fb_data* src_line = WorkFrame; + fb_data* dest_line = rb->lcd_framebuffer + (LCD_WIDTH - NES_DISP_WIDTH) / 2; + fb_data* src_pixel; + fb_data* dest_pixel; + for(y = 0; y < NES_DISP_HEIGHT; y++) { +/* +// memcpy version is probably faster. + src_pixel = src_line; + dest_pixel = dest_line; for(x = 0; x < NES_DISP_WIDTH; x++){ - rb->lcd_set_foreground(WorkFrame[x + y * NES_DISP_WIDTH]); - rb->lcd_drawpixel(x, y); - } + *dest_pixel++ = *src_pixel++; + } +*/ + rb->memcpy(dest_line, src_line, NES_DISP_WIDTH * sizeof(fb_data)); + src_line += NES_DISP_WIDTH; + dest_line += LCD_WIDTH; } +#else +//scaled to fit screen. no interpolation. +for(y = 0; y < LCD_HEIGHT; y++) + { + for(x = 0; x < LCD_WIDTH; x++) + { + // direct frame buffer access may help here. + rb->lcd_set_foreground(WorkFrame[x * NES_DISP_WIDTH / LCD_WIDTH + y * NES_DISP_HEIGHT / LCD_HEIGHT * NES_DISP_WIDTH]); + rb->lcd_drawpixel(x, y); + } + } #endif -#if 0 //1/2 size of NES screan +#if 0 //1/2 size of NES screen for(y = 0; y < NES_DISP_HEIGHT; y += 2) { for(x = 0; x < NES_DISP_WIDTH; x += 2){ rb->lcd_set_foreground(WorkFrame[x + y * NES_DISP_WIDTH]); @@ -547,17 +585,6 @@ } #endif -#if 1 //scaled to fit screan. no interpolation. -for(y = 0; y < LCD_HEIGHT; y++) - { - for(x = 0; x < LCD_WIDTH; x++) - { - rb->lcd_set_foreground(WorkFrame[x * NES_DISP_WIDTH / LCD_WIDTH + y * NES_DISP_HEIGHT / LCD_HEIGHT * NES_DISP_WIDTH]); - rb->lcd_drawpixel(x, y); - } - } -#endif - #if 0 //scaled to fit screan with interpolation. should be redone //WORD wf[LCD_HEIGHT * LCD_WIDTH]; @@ -596,6 +623,7 @@ #endif rb->lcd_update(); + rb->yield(); //rb->splash(stime, "mapper no: %d", MapperNo); /* SDL_LockSurface(screen); pl=(BYTE *)screen->pixels; pw = WorkFrame; @@ -628,6 +656,69 @@ bs = rb->button_status(); +#if (CONFIG_KEYPAD == IPOD_4G_PAD) || \ + (CONFIG_KEYPAD == IPOD_3G_PAD) || \ + (CONFIG_KEYPAD == IPOD_1G2G_PAD) + + int oldwheel = -1, wheel; + int wheel_pressed[8] = {0,0,0,0,0,0,0,0}; + + // Get the current wheel position - 0..95 or -1 for untouched + wheel = rb->wheel_status(); + + // Convert to number from 0 to 7 - clockwise from top + if ( wheel > 0 ){ + wheel += 6; + wheel /= 12; + if ( wheel > 7 ) wheel = 0; + + if ( wheel != oldwheel ) { + + if (oldwheel >= 0) { + wheel_pressed[oldwheel] = 0; + } + + if (wheel >= 0) { + wheel_pressed[wheel] = 1; + } + } + oldwheel = wheel; + } + + if(wheel_pressed[0] == 1) //up + dwPad1 |= 1 << 4; + else + dwPad1 &= ~(1 << 4); + if(wheel_pressed[4] == 1) //down + dwPad1 |= 1 << 5; + else + dwPad1 &= ~(1 << 5); + if(wheel_pressed[6] == 1) //left + dwPad1 |= 1 << 6; + else + dwPad1 &= ~(1 << 6); + if(wheel_pressed[2] == 1) //right + dwPad1 |= 1 << 7; + else + dwPad1 &= ~(1 << 7); + if(bs & BUTTON_SELECT) //a //upper right + dwPad1 |= 1 << 1; + else + dwPad1 &= ~(1 << 1); + if(bs & (~BUTTON_SELECT)) //b //mid right + dwPad1 |= 1 << 0; + else + dwPad1 &= ~(1 << 0); + if(wheel_pressed[5] == 1) //select //low right + dwPad1 |= 1 << 2; + else + dwPad1 &= ~(1 << 2); + if(wheel_pressed[3] == 1) //start //left + dwPad1 |= 1 << 3; + else + dwPad1 &= ~(1 << 3); + +#else if(bs & 0x40) //up dwPad1 |= 1 << 4; else @@ -661,6 +752,7 @@ else dwPad1 &= ~(1 << 3); +#endif /* //switch(rb->button_get(0) switch(rb->button_status()) Only in ines: InfoNES_System_Rockbox.c.bak