--- Begin Message ---
Hi there.
The attached patch against XMAME 0.55.2 does the following things:
* Arbitrary Y-scaling feature. See -arbheight option.
* Optimize fallback general-case scaling to avoid GCC generating
superflous reloads from memory and modulos -- up to 50% faster
* Very basic start of blit/blitcore sanitising
The arbheight stuff works on the X11 (window, dga1, dga2) and
SVGAlib drivers. Other drivers will require similarly-flavoured
changes to play nicely.
--Adam
--
Adam D. Moss . ,,^^ [EMAIL PROTECTED] http://www.foxbox.org/ co:3
diff -u -r -d ./src/unix/effect.c ../../xmame-0.55.2-adam5/src/unix/effect.c
--- ./src/unix/effect.c Sun Oct 7 11:15:28 2001
+++ ../../xmame-0.55.2-adam5/src/unix/effect.c Sat Oct 6 13:17:49 2001
@@ -11,6 +11,9 @@
*
* HISTORY:
*
+ * 2001-10-06:
+ * - minor changes to make -effect option trump -arbheight option <[EMAIL PROTECTED]>
+ *
* 2001-10-01:
* - should now compile with all video drivers,
* though effects won't work except with
@@ -39,10 +42,9 @@
* - scale2x smooth scaling effect
*/
+#include "xmame.h"
#include "osd_cpu.h"
#include "effect.h"
-#include "stdio.h"
-#include "stdlib.h"
/* divide R, G, and B to darken pixels */
#define SHADE16_HALF(P) (((P)>>1) & 0x7bef)
@@ -89,24 +91,35 @@
/* called from config.c to set scale parameters */
void effect_init1()
{
+ int disable_arbscale = 0;
+
switch (effect) {
case EFFECT_SCALE2X:
case EFFECT_SCAN2:
normal_widthscale = 2;
normal_heightscale = 2;
+ disable_arbscale = 1;
break;
case EFFECT_RGBSTRIPE:
normal_widthscale = 3;
normal_heightscale = 2;
+ disable_arbscale = 1;
break;
case EFFECT_RGBSCAN:
normal_widthscale = 2;
normal_heightscale = 3;
+ disable_arbscale = 1;
break;
case EFFECT_SCAN3:
normal_widthscale = 3;
normal_heightscale = 3;
+ disable_arbscale = 1;
break;
+ }
+
+ if (yarbsize && disable_arbscale) {
+ printf("Using effects -- disabling arbitrary scaling\n");
+ yarbsize = 0;
}
}
diff -u -r -d ./src/unix/mode.c ../../xmame-0.55.2-adam5/src/unix/mode.c
--- ./src/unix/mode.c Sat Aug 25 20:53:24 2001
+++ ../../xmame-0.55.2-adam5/src/unix/mode.c Sat Oct 6 12:54:27 2001
@@ -109,15 +109,16 @@
else
{
pixel_aspect_ratio = (visual_width * widthscale) /
- (visual_height * heightscale * game_aspect_ratio);
+ (yarbsize ? yarbsize :
+ (visual_height * heightscale * game_aspect_ratio));
}
/* should we maximize the used height, or the used width? */
if (display_aspect_ratio >= game_aspect_ratio)
{
- *height = visual_height * heightscale;
- *width = *height * pixel_aspect_ratio * display_aspect_ratio;
+ *height = yarbsize ? yarbsize : (visual_height * heightscale);
+ *width = *height * pixel_aspect_ratio * display_aspect_ratio;
}
else
{
@@ -150,7 +151,7 @@
/* does the game fit at all ? */
if(width < (visual_width * widthscale) ||
- height < (visual_height * heightscale))
+ height < (yarbsize ? yarbsize : (visual_height * heightscale)))
return 0;
return ( 100 *
diff -u -r -d ./src/unix/sysdep/blit_2.h
../../xmame-0.55.2-adam5/src/unix/sysdep/blit_2.h
--- ./src/unix/sysdep/blit_2.h Sat Aug 25 20:53:24 2001
+++ ../../xmame-0.55.2-adam5/src/unix/sysdep/blit_2.h Sun Sep 30 19:51:37 2001
@@ -27,6 +27,8 @@
This routines use long copy's so everything should always be long aligned.
*/
+#error unused
+
#ifdef PACK_BITS
/* scale destptr delta's by 3/4 since we're using 32 bits ptr's for a 24 bits
dest */
diff -u -r -d ./src/unix/video-drivers/blit.h
../../xmame-0.55.2-adam5/src/unix/video-drivers/blit.h
--- ./src/unix/video-drivers/blit.h Sun Oct 7 11:15:28 2001
+++ ../../xmame-0.55.2-adam5/src/unix/video-drivers/blit.h Sat Oct 6 19:35:21
+2001
@@ -38,6 +38,346 @@
#define CORRECTED_DEST_WIDTH DEST_WIDTH
#endif
+if (yarbsize) /* using arbitrary Y-scaling (Adam D. Moss <[EMAIL PROTECTED]>) */
+{
+ switch(widthscale)
+ {
+#ifdef INDIRECT
+
+#ifdef BLIT_16BPP_HACK
+#define COPY_LINE2(SRC, END, DST) \
+ {\
+ unsigned short *src = (unsigned short *)(SRC); \
+ unsigned short *end = (unsigned short *)(END); \
+ unsigned int *dst = (unsigned int *)(DST); \
+ for(;src<end;src+=4,dst+=4) \
+ { \
+ *(dst ) = INDIRECT[*(src )]; \
+ *(dst+1) = INDIRECT[*(src+1)]; \
+ *(dst+2) = INDIRECT[*(src+2)]; \
+ *(dst+3) = INDIRECT[*(src+3)]; \
+ }\
+ }
+#elif defined PACK_BITS
+#define COPY_LINE2(SRC, END, DST) \
+ {\
+ SRC_PIXEL *src = SRC; \
+ SRC_PIXEL *end = END; \
+ DEST_PIXEL *dst = DST; \
+ for(;src<end;dst+=3,src+=4) \
+ { \
+ *(dst ) = (INDIRECT[*(src )] ) | (INDIRECT[*(src+1)]<<24); \
+ *(dst+1) = (INDIRECT[*(src+1)]>> 8) | (INDIRECT[*(src+2)]<<16); \
+ *(dst+2) = (INDIRECT[*(src+2)]>>16) | (INDIRECT[*(src+3)]<< 8); \
+ }\
+ }
+#else /* normal indirect */
+#define COPY_LINE2(SRC, END, DST) \
+ {\
+ SRC_PIXEL *src = SRC; \
+ SRC_PIXEL *end = END; \
+ DEST_PIXEL *dst = DST; \
+ for(;src<end;src+=8,dst+=8) \
+ { \
+ *(dst ) = INDIRECT[*(src )]; \
+ *(dst+1) = INDIRECT[*(src+1)]; \
+ *(dst+2) = INDIRECT[*(src+2)]; \
+ *(dst+3) = INDIRECT[*(src+3)]; \
+ *(dst+4) = INDIRECT[*(src+4)]; \
+ *(dst+5) = INDIRECT[*(src+5)]; \
+ *(dst+6) = INDIRECT[*(src+6)]; \
+ *(dst+7) = INDIRECT[*(src+7)]; \
+ }\
+ }
+#endif /* dga_16bpp_hack / packed / normal indirect */
+
+#else /* not indirect */
+#define COPY_LINE2(SRC, END, DST) \
+ memcpy(DST, SRC, ((END)-(SRC))*DEST_PIXEL_SIZE);
+#endif /* indirect */
+
+#define SCALE_Y(Y) (((Y)*yarbsize)/visual_height)
+#define REPS_FOR_Y(N,YV,YMAX) ((N)* ( (((YV)+1)*yarbsize)/(YMAX) -
+((YV)*yarbsize)/(YMAX)))
+
+ case 1:
+#define SCALE_X(X) (X)
+#ifdef DOUBLEBUFFER
+
+#ifdef INDIRECT
+#define COPY_LINE_FOR_Y(YV, YMAX, SRC, END, DST) \
+{ \
+ int reps = REPS_FOR_Y(1, YV, YMAX); \
+ if (reps >0) COPY_LINE2(SRC, END, (DEST_PIXEL *)doublebuffer_buffer); \
+ while (reps-- >0) { memcpy((DST)+(reps*(CORRECTED_DEST_WIDTH)),
+doublebuffer_buffer, ((END)-(SRC))*DEST_PIXEL_SIZE*SCALE_X(1)); } \
+}
+#else
+#define COPY_LINE_FOR_Y(YV, YMAX, SRC, END, DST) \
+{ \
+ int reps = REPS_FOR_Y(1, YV, YMAX); \
+ while (reps-- >0) COPY_LINE2(SRC, END, (DST)+(reps*(CORRECTED_DEST_WIDTH)));\
+}
+#endif
+
+#else
+#define COPY_LINE_FOR_Y(YV, YMAX, SRC, END, DST) \
+{ \
+ int reps = REPS_FOR_Y(1, YV, YMAX); \
+ if (reps >0) COPY_LINE2(SRC, END, DST); \
+ while (reps-- >1) memcpy((DST)+(reps*(CORRECTED_DEST_WIDTH)), DST,
+((END)-(SRC))*DEST_PIXEL_SIZE*SCALE_X(1)); \
+}
+#endif
+//#define COPY_LINE(SRC, END, DST) { COPY_LINE2(SRC, END, DST) }
+#include "blit_core.h"
+break;
+
+#undef SCALE_X
+#undef COPY_LINE2
+
+
+
+
+case 2:
+#define SCALE_X(X) ((X)*2)
+#ifdef INDIRECT
+
+#ifdef PACK_BITS
+#define COPY_LINE2(SRC, END, DST) \
+{ \
+ SRC_PIXEL *src = SRC; \
+ SRC_PIXEL *end = END; \
+ DEST_PIXEL *dst = DST; \
+ for(;src<end; src+=2, dst+=3) \
+ { \
+ *(dst ) = (INDIRECT[*(src )] ) | (INDIRECT[*(src )]<<24); \
+ *(dst+1) = (INDIRECT[*(src )]>> 8) | (INDIRECT[*(src+1)]<<16); \
+ *(dst+2) = (INDIRECT[*(src+1)]>>16) | (INDIRECT[*(src+1)]<<8); \
+ } \
+}
+#else /* not pack bits */
+#define COPY_LINE2(SRC, END, DST) \
+{ \
+ SRC_PIXEL *src = SRC; \
+ SRC_PIXEL *end = END; \
+ DEST_PIXEL *dst = DST; \
+ for(;src<end; src+=8, dst+=16) \
+ { \
+ *(dst ) = *(dst+ 1) = INDIRECT[*(src )]; \
+ *(dst+ 2) = *(dst+ 3) = INDIRECT[*(src+1)]; \
+ *(dst+ 4) = *(dst+ 5) = INDIRECT[*(src+2)]; \
+ *(dst+ 6) = *(dst+ 7) = INDIRECT[*(src+3)]; \
+ *(dst+ 8) = *(dst+ 9) = INDIRECT[*(src+4)]; \
+ *(dst+10) = *(dst+11) = INDIRECT[*(src+5)]; \
+ *(dst+12) = *(dst+13) = INDIRECT[*(src+6)]; \
+ *(dst+14) = *(dst+15) = INDIRECT[*(src+7)]; \
+ } \
+}
+#endif /* pack bits */
+
+#else /* not indirect */
+
+#define COPY_LINE2(SRC, END, DST) \
+{ \
+ SRC_PIXEL *src = SRC; \
+ SRC_PIXEL *end = END; \
+ DEST_PIXEL *dst = DST; \
+ for(;src<end; src+=8, dst+=16) \
+ { \
+ *(dst ) = *(dst+ 1) = *(src ); \
+ *(dst+ 2) = *(dst+ 3) = *(src+1); \
+ *(dst+ 4) = *(dst+ 5) = *(src+2); \
+ *(dst+ 6) = *(dst+ 7) = *(src+3); \
+ *(dst+ 8) = *(dst+ 9) = *(src+4); \
+ *(dst+10) = *(dst+11) = *(src+5); \
+ *(dst+12) = *(dst+13) = *(src+6); \
+ *(dst+14) = *(dst+15) = *(src+7); \
+ } \
+}
+#endif
+#include "blit_core.h"
+break;
+
+#undef SCALE_X
+#undef COPY_LINE2
+
+
+
+
+case 3:
+#define SCALE_X(X) ((X)*3)
+#ifdef INDIRECT
+
+#define COPY_LINE2(SRC, END, DST) \
+{ \
+ SRC_PIXEL *src = SRC; \
+ SRC_PIXEL *end = END; \
+ DEST_PIXEL *dst = DST; \
+ for(;src<end; src+=8, dst+=24) \
+ { \
+ *(dst ) = *(dst+ 1) = *(dst+ 2) = INDIRECT[*(src )]; \
+ *(dst+ 3) = *(dst+ 4) = *(dst+ 5) = INDIRECT[*(src+1)]; \
+ *(dst+ 6) = *(dst+ 7) = *(dst+ 8) = INDIRECT[*(src+2)]; \
+ *(dst+ 9) = *(dst+10) = *(dst+11) = INDIRECT[*(src+3)]; \
+ *(dst+12) = *(dst+13) = *(dst+14) = INDIRECT[*(src+4)]; \
+ *(dst+15) = *(dst+16) = *(dst+17) = INDIRECT[*(src+5)]; \
+ *(dst+18) = *(dst+19) = *(dst+20) = INDIRECT[*(src+6)]; \
+ *(dst+21) = *(dst+22) = *(dst+23) = INDIRECT[*(src+7)]; \
+ } \
+}
+#else /* not indirect */
+#define COPY_LINE2(SRC, END, DST) \
+{ \
+ SRC_PIXEL *src = SRC; \
+ SRC_PIXEL *end = END; \
+ DEST_PIXEL *dst = DST; \
+ for(;src<end; src+=8, dst+=24) \
+ { \
+ *(dst ) = *(dst+ 1) = *(dst+ 2) = *(src ); \
+ *(dst+ 3) = *(dst+ 4) = *(dst+ 5) = *(src+1); \
+ *(dst+ 6) = *(dst+ 7) = *(dst+ 8) = *(src+2); \
+ *(dst+ 9) = *(dst+10) = *(dst+11) = *(src+3); \
+ *(dst+12) = *(dst+13) = *(dst+14) = *(src+4); \
+ *(dst+15) = *(dst+16) = *(dst+17) = *(src+5); \
+ *(dst+18) = *(dst+19) = *(dst+20) = *(src+6); \
+ *(dst+21) = *(dst+22) = *(dst+23) = *(src+7); \
+ } \
+}
+#endif
+#include "blit_core.h"
+break;
+
+#undef SCALE_X
+#undef COPY_LINE2
+
+
+
+
+default:
+#define SCALE_X(X) ((X)*widthscale)
+
+#ifdef INDIRECT
+
+#ifdef PACK_BITS
+#define COPY_LINE2(SRC, END, DST) \
+{ \
+ SRC_PIXEL *src = SRC; \
+ SRC_PIXEL *end = END; \
+ DEST_PIXEL *dst = DST; \
+ DEST_PIXEL pixel; \
+ int i, step=0; \
+ for(;src<end;src++) \
+ { \
+ pixel = INDIRECT[*src]; \
+ for(i=0; i<widthscale; i++,step=(step+1)&3) \
+ { \
+ switch(step) \
+ { \
+ case 0: \
+ *(dst ) = pixel; \
+ break; \
+ case 1: \
+ *(dst ) |= pixel << 24; \
+ *(dst+1) = pixel >> 8; \
+ break; \
+ case 2: \
+ *(dst+1) |= pixel << 16; \
+ *(dst+2) = pixel >> 16; \
+ break; \
+ case 3: \
+ *(dst+2) |= pixel << 8; \
+ dst+=3; \
+ break; \
+ } \
+ } \
+ } \
+}
+#else
+#define COPY_LINE2(SRC, END, DST) \
+{ \
+ SRC_PIXEL *src = SRC; \
+ SRC_PIXEL *end = END; \
+ DEST_PIXEL *dst = DST; \
+ int i; \
+ for(;src<end;src++) \
+ { \
+ const DEST_PIXEL v = INDIRECT[*(src)]; \
+ i=(widthscale+7)/8; \
+ dst+=widthscale&7; \
+ switch (widthscale&7) \
+ { \
+ case 0: do{ dst+=8; \
+ *(dst-8) = v; \
+ case 7: *(dst-7) = v; \
+ case 6: *(dst-6) = v; \
+ case 5: *(dst-5) = v; \
+ case 4: *(dst-4) = v; \
+ case 3: *(dst-3) = v; \
+ case 2: *(dst-2) = v; \
+ case 1: *(dst-1) = v; \
+ } while(--i>0); \
+ } \
+ } \
+}
+#endif
+
+#else
+#define COPY_LINE2(SRC, END, DST) \
+{ \
+ SRC_PIXEL *src = SRC; \
+ SRC_PIXEL *end = END; \
+ DEST_PIXEL *dst = DST; \
+ int i; \
+ for(;src<end;src++) \
+ { \
+ const DEST_PIXEL v = *(src); \
+ i=(widthscale+7)/8; \
+ dst+=widthscale&7; \
+ switch (widthscale&7) \
+ { \
+ case 0: do{ dst+=8; \
+ *(dst-8) = v; \
+ case 7: *(dst-7) = v; \
+ case 6: *(dst-6) = v; \
+ case 5: *(dst-5) = v; \
+ case 4: *(dst-4) = v; \
+ case 3: *(dst-3) = v; \
+ case 2: *(dst-2) = v; \
+ case 1: *(dst-1) = v; \
+ } while(--i>0); \
+ } \
+ } \
+}
+#endif
+#include "blit_core.h"
+break;
+
+#undef SCALE_X
+#undef COPY_LINE2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#undef COPY_LINE
+
+#undef SCALE_Y
+#undef REPS_FOR_Y
+#undef COPY_LINE_FOR_Y
+
+#define COPY_LINE_FOR_Y(YV,YMAX, SRC,END,DST) COPY_LINE(SRC,END,DST)
+#define REPS_FOR_Y(N,YV,YMAX) SCALE_Y(N)
+ }
+}
+else
switch (heightscale | (widthscale << 8) | (use_scanlines << 16))
{
/* 1x1 */
@@ -91,9 +431,7 @@
#endif /* indirect */
#define SCALE_X(X) (X)
-#define SCALE_X_8(X) ((X)<<3)
#define SCALE_Y(Y) (Y)
-#define SCALE_Y_8(Y) ((Y)<<3)
/* 1x1 we don't do scanlines with 1x1 */
case 0x00101:
@@ -104,12 +442,10 @@
break;
#undef SCALE_Y
-#undef SCALE_Y_8
/* 1x2 */
#define SCALE_Y(Y) ((Y)<<1)
-#define SCALE_Y_8(Y) ((Y)<<4)
/* 1x2 no scanlines */
case 0x00102:
@@ -152,9 +488,7 @@
#undef COPY_LINE2
#undef SCALE_X
-#undef SCALE_X_8
#undef SCALE_Y
-#undef SCALE_Y_8
/* 2x2 */
@@ -210,9 +544,7 @@
#endif
#define SCALE_X(X) ((X)<<1)
-#define SCALE_X_8(X) ((X)<<4)
#define SCALE_Y(Y) ((Y))
-#define SCALE_Y_8(Y) ((Y)<<3)
/* 2x1 no scanlines */
case 0x00201:
@@ -235,14 +567,10 @@
break;
#undef SCALE_X
-#undef SCALE_X_8
#undef SCALE_Y
-#undef SCALE_Y_8
#define SCALE_X(X) ((X)<<1)
-#define SCALE_X_8(X) ((X)<<4)
#define SCALE_Y(Y) ((Y)<<1)
-#define SCALE_Y_8(Y) ((Y)<<4)
/* 2x2 no scanlines */
case 0x00202:
@@ -285,9 +613,7 @@
#undef COPY_LINE2
#undef SCALE_X
-#undef SCALE_X_8
#undef SCALE_Y
-#undef SCALE_Y_8
#ifndef PACK_BITS
/* 3x3 */
@@ -329,9 +655,7 @@
#endif
#define SCALE_X(X) ((X)*3)
-#define SCALE_X_8(X) ((X)*24)
#define SCALE_Y(Y) ((Y))
-#define SCALE_Y_8(Y) ((Y)<<3)
/* 3x1 no scanlines */
case 0x00301:
@@ -354,14 +678,10 @@
break;
#undef SCALE_X
-#undef SCALE_X_8
#undef SCALE_Y
-#undef SCALE_Y_8
#define SCALE_X(X) ((X)*3)
-#define SCALE_X_8(X) ((X)*24)
#define SCALE_Y(Y) ((Y)*3)
-#define SCALE_Y_8(Y) ((Y)*24)
/* 3x3 no scanlines */
case 0x00303:
@@ -413,9 +733,7 @@
#undef COPY_LINE2
#undef SCALE_X
-#undef SCALE_X_8
#undef SCALE_Y
-#undef SCALE_Y_8
/* 4x4 */
@@ -455,9 +773,7 @@
#endif
#define SCALE_X(X) ((X)<<2)
-#define SCALE_X_8(X) ((X)<<5)
#define SCALE_Y(Y) ((Y)<<2)
-#define SCALE_Y_8(Y) ((Y)<<5)
/* 4x4 no scanlines */
case 0x00404:
@@ -513,9 +829,7 @@
#undef COPY_LINE2
#undef SCALE_X
-#undef SCALE_X_8
#undef SCALE_Y
-#undef SCALE_Y_8
#endif /* #ifndef PACK_BITS */
@@ -538,7 +852,7 @@
for(;src<end;src++) \
{ \
pixel = INDIRECT[*src]; \
- for(i=0; i<widthscale; i++,step=(step+1)%4) \
+ for(i=0; i<widthscale; i++,step=(step+1)&3) \
{ \
switch(step) \
{ \
@@ -568,19 +882,20 @@
int i; \
for(;src<end;src++) \
{ \
+ const DEST_PIXEL v = INDIRECT[*(src)]; \
i=(widthscale+7)/8; \
- dst+=widthscale%8; \
- switch (widthscale%8) \
+ dst+=widthscale&7; \
+ switch (widthscale&7) \
{ \
case 0: do{ dst+=8; \
- *(dst-8) = INDIRECT[*(src)]; \
- case 7: *(dst-7) = INDIRECT[*(src)]; \
- case 6: *(dst-6) = INDIRECT[*(src)]; \
- case 5: *(dst-5) = INDIRECT[*(src)]; \
- case 4: *(dst-4) = INDIRECT[*(src)]; \
- case 3: *(dst-3) = INDIRECT[*(src)]; \
- case 2: *(dst-2) = INDIRECT[*(src)]; \
- case 1: *(dst-1) = INDIRECT[*(src)]; \
+ *(dst-8) = v; \
+ case 7: *(dst-7) = v; \
+ case 6: *(dst-6) = v; \
+ case 5: *(dst-5) = v; \
+ case 4: *(dst-4) = v; \
+ case 3: *(dst-3) = v; \
+ case 2: *(dst-2) = v; \
+ case 1: *(dst-1) = v; \
} while(--i>0); \
} \
}
@@ -594,28 +909,27 @@
int i; \
for(;src<end;src++) \
{ \
+ const DEST_PIXEL v = *(src); \
i=(widthscale+7)/8; \
- dst+=widthscale%8; \
- switch (widthscale%8) \
+ dst+=widthscale&7; \
+ switch (widthscale&7) \
{ \
case 0: do{ dst+=8; \
- *(dst-8) = *(src); \
- case 7: *(dst-7) = *(src); \
- case 6: *(dst-6) = *(src); \
- case 5: *(dst-5) = *(src); \
- case 4: *(dst-4) = *(src); \
- case 3: *(dst-3) = *(src); \
- case 2: *(dst-2) = *(src); \
- case 1: *(dst-1) = *(src); \
+ *(dst-8) = v; \
+ case 7: *(dst-7) = v; \
+ case 6: *(dst-6) = v; \
+ case 5: *(dst-5) = v; \
+ case 4: *(dst-4) = v; \
+ case 3: *(dst-3) = v; \
+ case 2: *(dst-2) = v; \
+ case 1: *(dst-1) = v; \
} while(--i>0); \
} \
}
#endif
#define SCALE_X(X) ((X)*widthscale)
-#define SCALE_X_8(X) ((X)*widthscale*8)
#define SCALE_Y(Y) ((Y)*heightscale)
-#define SCALE_Y_8(Y) ((Y)*heightscale*8)
/* should we use doublebuffering ? */
#ifdef DOUBLEBUFFER
@@ -643,9 +957,7 @@
#undef COPY_LINE2
#undef SCALE_X
-#undef SCALE_X_8
#undef SCALE_Y
-#undef SCALE_Y_8
break;
}
@@ -655,3 +967,7 @@
#endif
#undef DEST_PIXEL_SIZE
#undef CORRECTED_DEST_WIDTH
+
+
+#undef REPS_FOR_Y
+#undef COPY_LINE_FOR_Y
Only in ../../xmame-0.55.2-adam5/src/unix/video-drivers: blit.h~
diff -u -r -d ./src/unix/video-drivers/blit_core.h
../../xmame-0.55.2-adam5/src/unix/video-drivers/blit_core.h
--- ./src/unix/video-drivers/blit_core.h Sun Oct 7 11:15:28 2001
+++ ../../xmame-0.55.2-adam5/src/unix/video-drivers/blit_core.h Sat Oct 6 17:05:33
+2001
@@ -1,20 +1,20 @@
-/* this file is used by blit.h don't use it directly ! */
+/* this file is used by blit.h -- don't use it directly ! */
#ifdef DEST_SCALE
#define DEST_SCALE_X(X) (SCALE_X(X) *DEST_SCALE)
-#define DEST_SCALE_X_8(X) (SCALE_X_8(X)*DEST_SCALE)
#define DEST_SCALE_Y(Y) (SCALE_Y(Y) *DEST_SCALE)
-#define DEST_SCALE_Y_8(Y) (SCALE_Y_8(Y)*DEST_SCALE)
#else
#define DEST_SCALE_X(X) SCALE_X(X)
-#define DEST_SCALE_X_8(X) SCALE_X_8(X)
#define DEST_SCALE_Y(Y) SCALE_Y(Y)
-#define DEST_SCALE_Y_8(Y) SCALE_Y_8(Y)
#endif
+
if (effect) {
- if (effect == EFFECT_SCALE2X) {
+ switch(effect) {
+ default:
+ case EFFECT_SCALE2X:
+ {
# ifdef DEST
int src_width = (((SRC_PIXEL *)bitmap->line[1]) - ((SRC_PIXEL
*)bitmap->line[0]));
SRC_PIXEL *line_src = (SRC_PIXEL *)bitmap->line[visual.min_y] + visual.min_x;
@@ -44,10 +44,11 @@
# ifdef PUT_IMAGE
PUT_IMAGE(0, 0, SCALE_X(visual_width), SCALE_Y(visual_height))
# endif
- } else
-
- if (effect == EFFECT_SCAN2) {
+ }
+ break;
+ case EFFECT_SCAN2:
+ {
# ifdef DEST
int src_width = (((SRC_PIXEL *)bitmap->line[1]) - ((SRC_PIXEL
*)bitmap->line[0]));
SRC_PIXEL *line_src = (SRC_PIXEL *)bitmap->line[visual.min_y] + visual.min_x;
@@ -77,10 +78,11 @@
# ifdef PUT_IMAGE
PUT_IMAGE(0, 0, SCALE_X(visual_width), SCALE_Y(visual_height))
# endif
- } else
-
- if (effect == EFFECT_RGBSTRIPE) {
+ }
+ break;
+ case EFFECT_RGBSTRIPE:
+ {
# ifdef DEST
int src_width = (((SRC_PIXEL *)bitmap->line[1]) - ((SRC_PIXEL
*)bitmap->line[0]));
SRC_PIXEL *line_src = (SRC_PIXEL *)bitmap->line[visual.min_y] + visual.min_x;
@@ -110,10 +112,11 @@
# ifdef PUT_IMAGE
PUT_IMAGE(0, 0, SCALE_X(visual_width), SCALE_Y(visual_height))
# endif
- } else
-
- if (effect == EFFECT_RGBSCAN) {
+ }
+ break;
+ case EFFECT_RGBSCAN:
+ {
# ifdef DEST
int src_width = (((SRC_PIXEL *)bitmap->line[1]) - ((SRC_PIXEL
*)bitmap->line[0]));
SRC_PIXEL *line_src = (SRC_PIXEL *)bitmap->line[visual.min_y] + visual.min_x;
@@ -143,10 +146,11 @@
# ifdef PUT_IMAGE
PUT_IMAGE(0, 0, SCALE_X(visual_width), SCALE_Y(visual_height))
# endif
- } else
-
- if (effect == EFFECT_SCAN3) {
+ }
+ break;
+ case EFFECT_SCAN3:
+ {
# ifdef DEST
int src_width = (((SRC_PIXEL *)bitmap->line[1]) - ((SRC_PIXEL
*)bitmap->line[0]));
SRC_PIXEL *line_src = (SRC_PIXEL *)bitmap->line[visual.min_y] + visual.min_x;
@@ -176,29 +180,33 @@
# ifdef PUT_IMAGE
PUT_IMAGE(0, 0, SCALE_X(visual_width), SCALE_Y(visual_height))
# endif
+ }
+ break;
+ }
}
-}
-
else /* no effect */
if (!use_dirty)
{
/* non dirty */
#ifdef DEST
- int src_width = (((SRC_PIXEL *)bitmap->line[1]) -
- ((SRC_PIXEL *)bitmap->line[0]));
- SRC_PIXEL *line_src = (SRC_PIXEL *)bitmap->line[visual.min_y] + visual.min_x;
- SRC_PIXEL *line_end = (SRC_PIXEL *)bitmap->line[visual.max_y+1] + visual.min_x;
- DEST_PIXEL *line_dest = (DEST_PIXEL *)(DEST);
-
- for (;line_src < line_end; line_dest+=DEST_SCALE_Y(DEST_WIDTH),
- line_src+=src_width)
- COPY_LINE(line_src, line_src+visual_width, line_dest)
+ int y = visual.min_y;
+ int src_width = (((SRC_PIXEL *)bitmap->line[1]) -
+ ((SRC_PIXEL *)bitmap->line[0]));
+ SRC_PIXEL *line_src = (SRC_PIXEL *)bitmap->line[visual.min_y] + visual.min_x;
+ SRC_PIXEL *line_end = (SRC_PIXEL *)bitmap->line[visual.max_y+1] + visual.min_x;
+ DEST_PIXEL *line_dest = (DEST_PIXEL *)(DEST);
+
+ for (;line_src < line_end;
+ line_dest+=REPS_FOR_Y(DEST_WIDTH,y,visual_height),
+ line_src+=src_width, y++)
+ COPY_LINE_FOR_Y(y,visual_height,
+ line_src, line_src+visual_width, line_dest);
#endif
#ifdef PUT_IMAGE
- PUT_IMAGE(0, 0, SCALE_X(visual_width), SCALE_Y(visual_height))
-#endif
+ PUT_IMAGE(0, 0, SCALE_X(visual_width), SCALE_Y(visual_height))
+#endif
}
else
{
@@ -206,9 +214,11 @@
int y, max_y = (visual.max_y+1) >> 3;
#ifdef DEST
DEST_PIXEL *line_dest = (DEST_PIXEL *)(DEST) - DEST_SCALE_X(visual.min_x);
- for (y=visual.min_y>>3; y<max_y; y++, line_dest+=DEST_SCALE_Y_8(DEST_WIDTH))
+ for (y=visual.min_y>>3; y<max_y;
+ line_dest += DEST_WIDTH * (SCALE_Y((y+1)<<3) - SCALE_Y(y<<3)),
+ y++)
#else
- for (y=visual.min_y>>3;y<max_y; y++)
+ for (y=visual.min_y>>3; y<max_y; y++)
#endif
{
if (dirty_lines[y])
@@ -222,7 +232,7 @@
int min_x;
#ifdef DEST
int max_x, h, max_h;
- DEST_PIXEL *block_dest = line_dest + DEST_SCALE_X_8(x);
+ DEST_PIXEL *block_dest = line_dest + DEST_SCALE_X(x<<3);
#endif
min_x = x << 3;
do {
@@ -235,16 +245,30 @@
max_x = x << 3;
h = y << 3;
max_h = h + 8;
- for (; h<max_h; h++, block_dest += DEST_SCALE_Y(DEST_WIDTH))
- COPY_LINE((SRC_PIXEL *)bitmap->line[h]+min_x,
- (SRC_PIXEL *)bitmap->line[h]+max_x, block_dest)
+ for (; h < max_h;
+ block_dest += REPS_FOR_Y(DEST_WIDTH,h,visual_height),
+ h++)
+ {
+ COPY_LINE_FOR_Y(h,visual_height,
+ (SRC_PIXEL *)bitmap->line[h]+min_x,
+ (SRC_PIXEL *)bitmap->line[h]+max_x,
+ block_dest);
+ }
#endif
#ifdef PUT_IMAGE
- PUT_IMAGE(
- SCALE_X( min_x - visual.min_x),
- SCALE_Y((y<<3) - visual.min_y),
- SCALE_X((x<<3) - min_x),
- SCALE_Y(8))
+ {
+ int put_height =
+ SCALE_Y((y<<3) - visual.min_y + 8) -
+ SCALE_Y((y<<3) - visual.min_y);
+
+ if (put_height > 0)
+ PUT_IMAGE(
+ SCALE_X( min_x - visual.min_x),
+ SCALE_Y((y<<3) - visual.min_y),
+ SCALE_X((x<<3) - min_x),
+ put_height
+ );
+ }
#endif
}
}
@@ -254,6 +278,15 @@
}
#undef DEST_SCALE_X
-#undef DEST_SCALE_X_8
#undef DEST_SCALE_Y
-#undef DEST_SCALE_Y_8
+
+
+
+
+
+
+
+
+
+
+
Only in ../../xmame-0.55.2-adam5/src/unix/video-drivers: blit_core.h~
diff -u -r -d ./src/unix/video-drivers/x11_window.c
../../xmame-0.55.2-adam5/src/unix/video-drivers/x11_window.c
--- ./src/unix/video-drivers/x11_window.c Sun Oct 7 11:15:28 2001
+++ ../../xmame-0.55.2-adam5/src/unix/video-drivers/x11_window.c Sat Oct 6
+12:54:52 2001
@@ -239,9 +239,9 @@
pseudo_color_warn_low_on_colors = TRUE;
window_width = widthscale * visual_width;
- window_height = heightscale * visual_height;
+ window_height = yarbsize ? yarbsize : (heightscale * visual_height);
image_width = widthscale * visual_width;
- image_height = heightscale * visual_height;
+ image_height = yarbsize ? yarbsize : (heightscale * visual_height);
orig_widthscale = widthscale;
orig_heightscale = heightscale;
screen = DefaultScreenOfDisplay (display);
diff -u -r -d ./src/unix/video-drivers/xf86_dga1.c
../../xmame-0.55.2-adam5/src/unix/video-drivers/xf86_dga1.c
--- ./src/unix/video-drivers/xf86_dga1.c Sun Oct 7 11:15:28 2001
+++ ../../xmame-0.55.2-adam5/src/unix/video-drivers/xf86_dga1.c Sat Oct 6 12:54:45
+2001
@@ -304,8 +304,12 @@
xf86ctx.addr = (unsigned char*)xf86ctx.base_addr;
xf86ctx.addr += (((modeinfo->hdisplay - visual_width*widthscale) / 2) & ~7)
* sizeof_pixel;
- xf86ctx.addr += ((modeinfo->vdisplay - visual_height*heightscale) / 2)
- * xf86ctx.width * sizeof_pixel;
+ if (yarbsize)
+ xf86ctx.addr += ((modeinfo->vdisplay - yarbsize) / 2)
+ * xf86ctx.width * sizeof_pixel;
+ else
+ xf86ctx.addr += ((modeinfo->vdisplay - visual_height*heightscale) / 2)
+ * xf86ctx.width * sizeof_pixel;
return OSD_OK;
}
@@ -357,7 +361,8 @@
if (x11_init_palette_info() != OSD_OK)
return OSD_NOT_OK;
- if (widthscale != 1 || heightscale != 1)
+ if (widthscale != 1 || heightscale != 1 ||
+ yarbsize > visual_height)
{
doublebuffer_buffer = malloc (visual_width * widthscale * depth / 8);
if (doublebuffer_buffer == NULL)
Only in ../../xmame-0.55.2-adam5/src/unix/video-drivers: xf86_dga1.c~
diff -u -r -d ./src/unix/video-drivers/xf86_dga2.c
../../xmame-0.55.2-adam5/src/unix/video-drivers/xf86_dga2.c
--- ./src/unix/video-drivers/xf86_dga2.c Sun Oct 7 11:15:28 2001
+++ ../../xmame-0.55.2-adam5/src/unix/video-drivers/xf86_dga2.c Sat Oct 6 12:54:39
+2001
@@ -270,10 +270,16 @@
sizeof_pixel = depth / 8;
xf86ctx.addr = (unsigned char*)xf86ctx.base_addr;
+#if 1
xf86ctx.addr += (((modeinfo.viewportWidth - visual_width*widthscale) / 2) & ~7)
* sizeof_pixel;
- xf86ctx.addr += ((modeinfo.viewportHeight - visual_height*heightscale) / 2)
- * modeinfo.bytesPerScanline;
+ if (yarbsize)
+ xf86ctx.addr += ((modeinfo.viewportHeight - yarbsize) / 2)
+ * modeinfo.bytesPerScanline;
+ else
+ xf86ctx.addr += ((modeinfo.viewportHeight - visual_height*heightscale) / 2)
+ * modeinfo.bytesPerScanline;
+#endif
return OSD_OK;
}
@@ -340,7 +346,8 @@
if (x11_init_palette_info() != OSD_OK)
return OSD_NOT_OK;
- if (widthscale != 1 || heightscale != 1)
+ if (widthscale != 1 || heightscale != 1 ||
+ yarbsize > visual_height)
{
doublebuffer_buffer = malloc (visual_width * widthscale * depth / 8);
if (doublebuffer_buffer == NULL)
Only in ../../xmame-0.55.2-adam5/src/unix/video-drivers: xf86_dga2.c~
diff -u -r -d ./src/unix/video.c ../../xmame-0.55.2-adam5/src/unix/video.c
--- ./src/unix/video.c Sun Oct 7 11:15:28 2001
+++ ../../xmame-0.55.2-adam5/src/unix/video.c Sat Oct 6 12:55:52 2001
@@ -23,6 +23,7 @@
static const int safety = 16;
static float beam_f;
int normal_widthscale = 1, normal_heightscale = 1;
+int yarbsize = 0;
static char *vector_res = NULL;
static int use_auto_double = 1;
static int frameskipper = 0;
@@ -62,6 +63,9 @@
{ "bpp", "b", rc_int, &options.color_depth,
"0", 0, 0, video_verify_bpp,
"Specify the colordepth the core should render, one of: auto(0), 8, 16" },
+ { "arbheight", "ah", rc_int, &yarbsize,
+ "0", 0, 4096, NULL,
+ "Scale video to exactly this height (0 = disable)" },
{ "heightscale", "hs", rc_int, &normal_heightscale,
"1", 1, 8, NULL,
"Set Y-Scale aspect ratio" },
diff -u -r -d ./src/unix/xmame.h ../../xmame-0.55.2-adam5/src/unix/xmame.h
--- ./src/unix/xmame.h Wed Sep 5 05:04:09 2001
+++ ../../xmame-0.55.2-adam5/src/unix/xmame.h Sat Oct 6 12:54:22 2001
@@ -80,7 +80,8 @@
EXTERN int sound_enabled;
EXTERN int widthscale; /* X scale */
-EXTERN int heightscale; /* Y SCALE */
+EXTERN int heightscale; /* Y scale */
+EXTERN int yarbsize; /* arbitrary height */
EXTERN int video_colors_used; /* max colors used by any palette */
EXTERN int video_fps;
EXTERN char *home_dir;
diff -u -r -d ./src/unix/video-drivers/svgalib.c
../../xmame-0.55.2-adam5/src/unix/video-drivers/svgalib.c
--- ./src/unix/video-drivers/svgalib.c Sun Oct 7 11:15:28 2001
+++ ../../xmame-0.55.2-adam5/src/unix/video-drivers/svgalib.c Sun Oct 7 11:28:35
+2001
@@ -186,7 +186,7 @@
video_mem += startx * video_modeinfo.bytesperpixel;
video_mem += starty * video_modeinfo.width *
video_modeinfo.bytesperpixel;
- if ((widthscale > 1 || heightscale > 1) &&
+ if ((widthscale > 1 || heightscale > 1 || yarbsize) &&
doublebuffer_buffer == NULL)
{
doublebuffer_buffer = malloc(scaled_visual_width *
@@ -203,13 +203,14 @@
else
#endif
{
- if((widthscale == 1) && (heightscale == 1))
+ if((widthscale == 1) && (heightscale == 1) && (yarbsize == 0))
update_function=2;
else
update_function=3;
/* we might need the doublebuffer_buffer for 1x1 in 16bpp, since it
could be paletised */
- if( ((widthscale > 1) || (heightscale > 1) || (video_modeinfo.bytesperpixel
== 2))
+ if( ((widthscale > 1) || (heightscale > 1) || (yarbsize) ||
+ (video_modeinfo.bytesperpixel == 2))
&& !doublebuffer_buffer)
{
doublebuffer_buffer = malloc(scaled_visual_width*scaled_visual_height*
@@ -253,7 +254,7 @@
doublebuffer_buffer = NULL;
scaled_visual_width = visual_width * widthscale;
- scaled_visual_height = visual_height * heightscale;
+ scaled_visual_height = yarbsize ? yarbsize : visual_height * heightscale;
for (i=1; (my_modeinfo=vga_getmodeinfo(i)); i++)
{
@@ -268,7 +269,7 @@
if(my_modeinfo->colors != 256)
continue;
if((my_modeinfo->flags & IS_MODEX) &&
- (!use_planar || widthscale != 1 || heightscale != 1))
+ (!use_planar || widthscale != 1 || heightscale != 1 || yarbsize))
continue;
}
if (!vga_hasmode(i))
@@ -299,7 +300,7 @@
if (mode_disabled(tweaked_modes[i].width, tweaked_modes[i].height, depth))
continue;
if((tweaked_modes[i].planar) &&
- (!use_planar || widthscale != 1 || heightscale != 1))
+ (!use_planar || widthscale != 1 || heightscale != 1 || yarbsize))
continue;
if (tweaked_modes[i].horizontal_squashed)
display_aspect_ratio = display_aspect_ratio * 9.0 / 16.0;
--- End Message ---