All pastes #329714 Raw Edit

Unnamed

public text v1 · immutable
#329714 ·published 2007-01-26 23:55 UTC
rendered paste body
Index: apps/plugins/rockboy/cpu.c
===================================================================
--- apps/plugins/rockboy/cpu.c	(revision 12103)
+++ apps/plugins/rockboy/cpu.c	(working copy)
@@ -246,10 +246,10 @@
 
 void cpu_reset(void)
 {
-	union reg acc;
 #ifdef DYNAREC
-        int i;
-        dynapointer=0;
+    union reg acc;
+    int i;
+    dynapointer=0;
 #endif
 	cpu.speed = 0;
 	cpu.halt = 0;
@@ -262,6 +262,7 @@
 	
 	PC = 0x0100;
 	SP = 0xFFFE;
+#ifdef DYNAREC
 	W(acc) = 0x01B0;
 	A=HB(acc);
 	F=LB(acc);
@@ -271,6 +272,11 @@
 	W(acc) = 0x00D8;
 	D=HB(acc);
 	E=LB(acc);
+#else
+	AF = 0x01B0;
+	BC = 0x0013;
+	DE = 0x00D8;
+#endif
 	HL = 0x014D;
 
         if (hw.cgb) A = 0x11;
Index: apps/plugins/rockboy/lcd.c
===================================================================
--- apps/plugins/rockboy/lcd.c	(revision 12103)
+++ apps/plugins/rockboy/lcd.c	(working copy)
@@ -910,12 +910,35 @@
         else pal_expire();
     }
 */
+#if (LCD_WIDTH>=160) && (LCD_HEIGHT>=144)
+#define S1  ((LCD_HEIGHT-144)/2)*LCD_WIDTH + ((LCD_WIDTH-160)/2)
+#define S2  0
 
-    if(options.fullscreen)
-        vdest = fb.ptr;
+#elif (LCD_WIDTH>=160) && (LCD_HEIGHT<=144)
+#define S1  ((LCD_WIDTH-160)/2)
+#define S2  ((LCD_WIDTH-160)/2)
+
+#elif (LCD_WIDTH<=160) && (LCD_HEIGHT>=144)
+#define S1  ((LCD_HEIGHT-144)/2)*LCD_WIDTH
+#define S2  ((LCD_HEIGHT-144)/2)*LCD_WIDTH
+
+#else
+#define S1  0
+#define S2  0
+#endif
+
+#if (LCD_WIDTH>LCD_HEIGHT)
+#define S3  ((LCD_WIDTH-(160*LCD_HEIGHT/144))/2)
+#else
+#define S3  ((LCD_HEIGHT-(144*LCD_WIDTH/160))/2)*LCD_WIDTH
+#endif
+
+    if(options.fullscreen == 0)
+        vdest=fb.ptr+S1;
+    else if (options.fullscreen == 1)
+        vdest=fb.ptr+S2;
     else
-        vdest=fb.ptr+((LCD_HEIGHT-144)/2)*LCD_WIDTH + ((LCD_WIDTH-160)/2);
-
+        vdest=fb.ptr+S3;
     WY = R_WY;
 }
 
@@ -930,11 +953,28 @@
 {
     switch(mode)
     {
-        case 1: /* Full screen scale */
+        case 1:
+#if (LCD_WIDTH>=160) && (LCD_HEIGHT>=144) /* Full screen scale */
             SCALEWL=DX;
             SCALEWS=DXI;
             SCALEHL=DY;
             SCALEHS=DYI;
+#elif (LCD_WIDTH>=160) && (LCD_HEIGHT<144) /* scale the height */
+            SCALEWL=1<<16;
+            SCALEWS=1<<16;
+            SCALEHL=DY;
+            SCALEHS=DYI;
+#elif (LCD_WIDTH<160) && (LCD_HEIGHT>=144) /* scale the width */
+            SCALEWL=DX;
+            SCALEWS=DXI;
+            SCALEHL=1<<16;
+            SCALEHS=1<<16;            
+#else
+            SCALEWL=DX;
+            SCALEWS=DXI;
+            SCALEHL=DY;
+            SCALEHS=DYI;
+#endif
             break;
         case 2: /* Maintain Ratio */
             if (DY<DX)
@@ -952,18 +992,11 @@
                 SCALEHS=DXI;
             }
             break;
-        default: /* No Scaling (or fullscreen for smaller screens) */
-#if LCD_WIDTH>160 
+        default:
             SCALEWL=1<<16;
             SCALEWS=1<<16;
             SCALEHL=1<<16;
             SCALEHS=1<<16;
-#else
-            SCALEWL=DX;
-            SCALEWS=DXI;
-            SCALEHL=DY;
-            SCALEHS=DYI;
-#endif
     }
     swidth=(160*SCALEWL)>>16;
     sremain=LCD_WIDTH-swidth;
@@ -982,7 +1015,7 @@
     if (!(R_LCDC & 0x80))
         return; /* should not happen... */
 
-#if LCD_HEIGHT < 144
+#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)) ||
@@ -1046,8 +1079,7 @@
             vid_update(L-((int)(L/9)));
 #else
     {
-    /*  Universial Scaling pulled from PrBoom and modified for rockboy  */
-    /*  Needs some thought for screens smaller than the gameboy though */
+    /*  Universal Scaling pulled from PrBoom and modified for rockboy  */
 
     static int hpt IDATA_ATTR=0x8000;
 
@@ -1059,9 +1091,24 @@
         register unsigned int remain=sremain;
         while(wcount--)
         {
+#if LCD_HEIGHT<144  /* cut off the bottom part of the screen that won't fit */
+            if (options.fullscreen==0 && (hpt>>16)>LCD_HEIGHT)
+                break;
+#endif
+
+#if LCD_WIDTH<160 /* cut off the right part of the screen that won't fit */
+            if(options.fullscreen==0 && wcount<(160-LCD_WIDTH)) {
+                vdest+=wcount;
+                wcount = 0;
+            }
+#endif
+                
             *vdest++ = scan.pal2[scan.buf[srcpt>>16]];
             srcpt+=SCALEWS;
         }
+#if LCD_HEIGHT<144
+        if (options.fullscreen!=0 || (hpt>>16)<(LCD_HEIGHT))
+#endif
         vdest+=remain;
     }
 
Index: apps/plugins/rockboy/menu.c
===================================================================
--- apps/plugins/rockboy/menu.c	(revision 12103)
+++ apps/plugins/rockboy/menu.c	(working copy)
@@ -13,6 +13,13 @@
 #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)
+#define MENU_BUTTON_UP BUTTON_SCROLL_UP
+#define MENU_BUTTON_DOWN BUTTON_SCROLL_DOWN
+#define MENU_BUTTON_LEFT BUTTON_LEFT
+#define MENU_BUTTON_RIGHT BUTTON_RIGHT
+
 #else
 #define MENU_BUTTON_UP BUTTON_UP
 #define MENU_BUTTON_DOWN BUTTON_DOWN
@@ -322,9 +329,9 @@
     };
 
     static const struct opt_items fullscreen[]= {
-        { "Off", -1 },
-        { "Fullscreen", -1 },
-        { "Full - Maintain Ratio", -1 },
+        { "Unscaled", -1 },
+        { "Scaled", -1 },
+        { "Scaled - Maintain Ratio", -1 },
     };
 
     static const struct opt_items frameskip[]= {
@@ -338,7 +345,7 @@
         { "Max Frameskip", NULL },
         { "Sound"        , NULL },
         { "Stats"        , NULL },
-        { "Fullscreen"   , NULL },
+        { "Screen Options"   , NULL },
         { "Set Keys (Buggy)", NULL },
     };
 
Index: apps/plugins/rockboy/sys_rockbox.c
===================================================================
--- apps/plugins/rockboy/sys_rockbox.c	(revision 12103)
+++ apps/plugins/rockboy/sys_rockbox.c	(working copy)
@@ -32,6 +32,13 @@
 #define ROCKBOY_PAD_UP BUTTON_MENU
 #define ROCKBOY_PAD_DOWN BUTTON_PLAY
 
+#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
+
+#define ROCKBOY_PAD_LEFT BUTTON_LEFT
+#define ROCKBOY_PAD_RIGHT BUTTON_RIGHT
+#define ROCKBOY_PAD_UP BUTTON_SCROLL_UP
+#define ROCKBOY_PAD_DOWN BUTTON_SCROLL_DOWN
+
 #else
 
 #define ROCKBOY_PAD_LEFT BUTTON_LEFT
@@ -178,11 +185,7 @@
 #else
         if(pressed & options.MENU) {
 #endif
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
-    (CONFIG_KEYPAD == IRIVER_H300_PAD) || \
-    (CONFIG_KEYPAD == IPOD_4G_PAD) || \
-    (CONFIG_KEYPAD == GIGABEAT_PAD) || \
-    (CONFIG_KEYPAD == SANSA_E200_PAD)
+#ifdef HAVE_LCD_COLOR
 #ifdef HAVE_WHEEL_POSITION
             rb->wheel_send_events(true);
 #endif
@@ -378,7 +381,7 @@
    elap=mytime-*oldtick;
    *oldtick=mytime;
    return elap;*/
-//   return ((*rb->current_tick-(*oldtick))*1000000)/HZ;
+   //return ((*rb->current_tick-(*oldtick))*1000000)/HZ;
    return *oldtick;
 }
 
Index: apps/plugins/rockboy/rockboy.c
===================================================================
--- apps/plugins/rockboy/rockboy.c	(revision 12103)
+++ apps/plugins/rockboy/rockboy.c	(working copy)
@@ -136,12 +136,30 @@
       options.START=BUTTON_SCROLL_UP;
       options.SELECT=BUTTON_SCROLL_DOWN;
       options.MENU=BUTTON_POWER;
+      
+#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
+      options.A=BUTTON_PLAY;
+      options.B=BUTTON_REC;
+      options.START=BUTTON_SELECT;
+      options.SELECT=BUTTON_NONE;
+      options.MENU=BUTTON_POWER;  
+      
+#elif CONFIG_KEYPAD == IRIVER_H10_PAD
+      options.A=BUTTON_PLAY;
+      options.B=BUTTON_FF;
+      options.START=BUTTON_REW;
+      options.SELECT=BUTTON_NONE;
+      options.MENU=BUTTON_POWER;
 #endif
 
       options.maxskip=4;
       options.fps=0;
       options.showstats=0;
+#if (LCD_WIDTH>=160) && (LCD_HEIGHT>=144)
       options.fullscreen=0;
+#else
+      options.fullscreen=1;
+#endif
       options.sound=1;
    }
    else
Index: apps/plugins/rockboy/main.c
===================================================================
--- apps/plugins/rockboy/main.c	(revision 12103)
+++ apps/plugins/rockboy/main.c	(working copy)
@@ -84,11 +84,8 @@
 	PUTS("Emu reset");
 	emu_reset();
 	PUTS("Emu run");
-#if (LCD_HEIGHT > 144) || (LCD_WIDTH > 160)
     rb->lcd_clear_display();
-//    rb->lcd_drawrect((LCD_WIDTH-160)/2-1, (LCD_HEIGHT-144)/2-1, 162, 146);
     rb->lcd_update();
-#endif
 	emu_run();
 
 	// never reached 
Index: apps/plugins/rockboy/emu.c
===================================================================
--- apps/plugins/rockboy/emu.c	(revision 12103)
+++ apps/plugins/rockboy/emu.c	(working copy)
@@ -45,11 +45,14 @@
 
 /* This mess needs to be moved to another module; it's just here to
  * make things work in the mean time. */
+ 
+//void *sys_timer();
+
 void emu_run(void)
 {
 //	void *timer = sys_timer();
+//	int delay;
     int framesin=0,frames=0,timeten=*rb->current_tick, timehun=*rb->current_tick;
-//	int delay;
 
     setvidmode(options.fullscreen);
     vid_begin();
Index: apps/plugins/SUBDIRS
===================================================================
--- apps/plugins/SUBDIRS	(revision 12103)
+++ apps/plugins/SUBDIRS	(working copy)
@@ -5,11 +5,7 @@
 /* For various targets... */
 #if (CONFIG_KEYPAD == RECORDER_PAD) || \
     (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
-    (CONFIG_KEYPAD == IRIVER_H300_PAD) || \
-    defined(IPOD_COLOR) || \
-    defined(IPOD_VIDEO) || \
-    defined(TOSHIBA_GIGABEAT_F) || \
-    defined(SANSA_E200)
+    defined(HAVE_LCD_COLOR)
 rockboy
 #endif