Use 16-bit instead of 15-bit pixel format on Gtk+. Add splash screen with test patterns.
This commit is contained in:
parent
964b4f072f
commit
dcfb7c3ad0
@ -349,7 +349,7 @@ NASM="not_found"
|
||||
ZSNESC4=no
|
||||
ZSNESFX=no
|
||||
|
||||
CFLAGS="$CFLAGS -DPIXEL_FORMAT=RGB555 -DCORRECT_VRAM_READS"
|
||||
CFLAGS="$CFLAGS -DPIXEL_FORMAT=RGB565 -DCORRECT_VRAM_READS"
|
||||
CORRECT_VRAM_READS=1
|
||||
|
||||
if test yes = "$with_debugger"; then
|
||||
|
@ -195,13 +195,13 @@
|
||||
#include <vector>
|
||||
|
||||
#define CONVERT_16_TO_32(pixel) \
|
||||
(((((pixel) >> 10) ) << /*RedShift+3*/ 19) | \
|
||||
((((pixel) >> 5) & 0x1f) << /*GreenShift+3*/11) | \
|
||||
(((((pixel) >> 11) ) << /*RedShift+3*/ 19) | \
|
||||
((((pixel) >> 5) & 0x3f) << /*GreenShift+3*/10) | \
|
||||
(((pixel) & 0x1f) << /*BlueShift+3*/ 3))
|
||||
|
||||
#define CONVERT_32_TO_16(pixel) \
|
||||
(((((pixel) & 0xf80000) >> 9) | \
|
||||
(((pixel) & 0xf800) >> 6) | \
|
||||
(((((pixel) & 0xf80000) >> 8) | \
|
||||
(((pixel) & 0xfc00) >> 5) | \
|
||||
(((pixel) & 0xf8) >> 3)) & 0xffff)
|
||||
|
||||
inline
|
||||
|
@ -19,7 +19,7 @@ static snes_ntsc_t snes_ntsc;
|
||||
static thread_job_t job[8];
|
||||
static GThreadPool *pool;
|
||||
static uint8 *y_table, *u_table, *v_table;
|
||||
static int endianess = ENDIAN_LSB;
|
||||
static int endianess = ENDIAN_NORMAL;
|
||||
|
||||
/* Scanline constants for the NTSC filter */
|
||||
static unsigned int scanline_offsets[] =
|
||||
@ -34,9 +34,9 @@ static unsigned int scanline_offsets[] =
|
||||
static unsigned short scanline_masks[] =
|
||||
{
|
||||
0x0000, /* 0% */
|
||||
0x0C63, /* 12.5% */
|
||||
0x1CE7, /* 25% */
|
||||
0x3DEF, /* 50% */
|
||||
0x18E3, /* 12.5% */
|
||||
0x39E7, /* 25% */
|
||||
0x7BEF, /* 50% */
|
||||
0xffff, /* 100% */
|
||||
};
|
||||
|
||||
@ -173,12 +173,12 @@ internal_convert_16_yuv (void *src_buffer,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
register int x, y;
|
||||
register uint16 *src;
|
||||
register uint8 *dst;
|
||||
register uint16 p0, p1;
|
||||
int x, y;
|
||||
uint16 *src;
|
||||
uint8 *dst;
|
||||
uint16 p0, p1;
|
||||
|
||||
if (endianess == ENDIAN_MSB)
|
||||
if (endianess == ENDIAN_SWAPPED)
|
||||
{
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
@ -197,7 +197,6 @@ internal_convert_16_yuv (void *src_buffer,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
for (y = 0; y < height; y++)
|
||||
@ -236,7 +235,7 @@ internal_convert_mask (void *src_buffer,
|
||||
#ifdef __BIG_ENDIAN__
|
||||
if (endianess == ENDIAN_MSB)
|
||||
#else
|
||||
if (endianess == ENDIAN_LSB)
|
||||
if (endianess == ENDIAN_NORMAL)
|
||||
#endif
|
||||
{
|
||||
switch (bpp)
|
||||
@ -244,20 +243,20 @@ internal_convert_mask (void *src_buffer,
|
||||
case 15:
|
||||
case 16:
|
||||
|
||||
for (register int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint16 *data =
|
||||
uint16 *data =
|
||||
(uint16 *) ((uint8 *) dst_buffer + y * dst_pitch);
|
||||
|
||||
register uint16 *snes =
|
||||
uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
|
||||
*data++ = ((pixel & 0x7c00) << 1) >> inv_rshift
|
||||
| ((pixel & 0x03e0) << 6) >> inv_gshift
|
||||
*data++ = ((pixel & 0xf800) << 0) >> inv_rshift
|
||||
| ((pixel & 0x07e0) << 5) >> inv_gshift
|
||||
| ((pixel & 0x001f) << 11) >> inv_bshift;
|
||||
}
|
||||
}
|
||||
@ -272,39 +271,39 @@ internal_convert_mask (void *src_buffer,
|
||||
if (!(inv_rshift > 8))
|
||||
#endif
|
||||
{
|
||||
for (register int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
*data++ = ((pixel & 0x001f) << 3);
|
||||
*data++ = ((pixel & 0x03e0) >> 2);
|
||||
*data++ = ((pixel & 0x7c00) >> 7);
|
||||
*data++ = ((pixel & 0x07e0) >> 3);
|
||||
*data++ = ((pixel & 0xf800) >> 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
for (register int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
*data++ = ((pixel & 0x7c00) >> 7);
|
||||
*data++ = ((pixel & 0x03e0) >> 2);
|
||||
*data++ = ((pixel & 0xf800) >> 8);
|
||||
*data++ = ((pixel & 0x07e0) >> 3);
|
||||
*data++ = ((pixel & 0x001f) << 3);
|
||||
}
|
||||
}
|
||||
@ -314,20 +313,20 @@ internal_convert_mask (void *src_buffer,
|
||||
|
||||
case 32:
|
||||
|
||||
for (register int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint32 *data =
|
||||
uint32 *data =
|
||||
(uint32 *) ((uint8 *) dst_buffer + y * dst_pitch);
|
||||
|
||||
register uint16 *snes =
|
||||
uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
|
||||
*data++ = ((uint32) (pixel & 0x7c00) << 17) >> inv_rshift
|
||||
| ((uint32) (pixel & 0x03e0) << 22) >> inv_gshift
|
||||
*data++ = ((uint32) (pixel & 0xf800) << 16) >> inv_rshift
|
||||
| ((uint32) (pixel & 0x07e0) << 21) >> inv_gshift
|
||||
| ((uint32) (pixel & 0x001f) << 27) >> inv_bshift;
|
||||
}
|
||||
}
|
||||
@ -343,21 +342,21 @@ internal_convert_mask (void *src_buffer,
|
||||
case 15:
|
||||
case 16:
|
||||
|
||||
for (register int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint16 *data =
|
||||
uint16 *data =
|
||||
(uint16 *) ((uint8 *) dst_buffer + y * dst_pitch);
|
||||
|
||||
register uint16 *snes =
|
||||
uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
register uint16 value;
|
||||
uint16 value;
|
||||
|
||||
value = ((pixel & 0x7c00) << 1) >> inv_rshift
|
||||
| ((pixel & 0x03e0) << 6) >> inv_gshift
|
||||
value = ((pixel & 0xf800) << 0) >> inv_rshift
|
||||
| ((pixel & 0x07e0) << 5) >> inv_gshift
|
||||
| ((pixel & 0x001f) << 11) >> inv_bshift;
|
||||
|
||||
*data++ = ((value & 0xff) << 8)
|
||||
@ -375,19 +374,19 @@ internal_convert_mask (void *src_buffer,
|
||||
if (!(inv_rshift > 8))
|
||||
#endif
|
||||
{
|
||||
for (register int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
*data++ = ((pixel & 0x7c00) >> 7);
|
||||
*data++ = ((pixel & 0x03e0) >> 2);
|
||||
*data++ = ((pixel & 0xf800) >> 8);
|
||||
*data++ = ((pixel & 0x07e0) >> 3);
|
||||
*data++ = ((pixel & 0x001f) << 3);
|
||||
}
|
||||
}
|
||||
@ -395,20 +394,20 @@ internal_convert_mask (void *src_buffer,
|
||||
|
||||
else
|
||||
{
|
||||
for (register int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
*data++ = ((pixel & 0x001f) << 3);
|
||||
*data++ = ((pixel & 0x03e0) >> 2);
|
||||
*data++ = ((pixel & 0x7c00) >> 7);
|
||||
*data++ = ((pixel & 0x07e0) >> 3);
|
||||
*data++ = ((pixel & 0xf800) >> 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -417,21 +416,21 @@ internal_convert_mask (void *src_buffer,
|
||||
|
||||
case 32:
|
||||
|
||||
for (register int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint32 *data =
|
||||
uint32 *data =
|
||||
(uint32 *) ((uint8 *) dst_buffer + y * dst_pitch);
|
||||
|
||||
register uint16 *snes =
|
||||
uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
register uint32 value;
|
||||
uint32 value;
|
||||
|
||||
value = ((uint32) (pixel & 0x7c00) << 17) >> inv_rshift
|
||||
| ((uint32) (pixel & 0x03e0) << 22) >> inv_gshift
|
||||
value = ((uint32) (pixel & 0xf800) << 16) >> inv_rshift
|
||||
| ((uint32) (pixel & 0x07e0) << 21) >> inv_gshift
|
||||
| ((uint32) (pixel & 0x001f) << 27) >> inv_bshift;
|
||||
|
||||
*data++ = ((value & 0x000000ff) << 24)
|
||||
@ -457,71 +456,22 @@ internal_convert (void *src_buffer,
|
||||
int height,
|
||||
int bpp)
|
||||
{
|
||||
if (endianess == ENDIAN_MSB)
|
||||
if (endianess == ENDIAN_SWAPPED)
|
||||
{
|
||||
if (bpp == 15)
|
||||
if (bpp == 24)
|
||||
{
|
||||
/* Format in fourcc is xrrrrrgg gggbbbbb */
|
||||
for (register int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
uint8 *data = (uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
uint16 *snes = (uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
*data++ = (pixel & 0x7c00) >> 8
|
||||
| (pixel & 0x0300) >> 8; /* Top 2 green, 5 red */
|
||||
*data++ = (pixel & 0x00c0)
|
||||
| (pixel & 0x001f); /* Top 3 of last 4 green 5 blue */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (bpp == 16)
|
||||
{
|
||||
/* Format in fourcc is rrrrrggg gggbbbbb */
|
||||
for (register int y = 0; y < height; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
|
||||
*data++ = (pixel & 0x7c00) >> 7
|
||||
| (pixel & 0x0300) >> 7; /* 5 red, first 3 green */
|
||||
*data++ = (pixel & 0x00c0)
|
||||
| (pixel & 0x001f); /* last 3 green, 5 blue */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (bpp == 24)
|
||||
{
|
||||
/* Format in fourcc is rrrrrrrr gggggggg bbbbbbbb */
|
||||
for (register int y = 0; y < height; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
|
||||
*data++ = (pixel & 0x7c00) >> 7; /* Red */
|
||||
*data++ = (pixel & 0x03e0) >> 2; /* Green */
|
||||
*data++ = (pixel & 0x001f) << 3; /* Blue */
|
||||
uint16 pixel = *snes++;
|
||||
*data++ = ((pixel & 0xf800) >> 8) | ((pixel >> 13) & 0x07); /* Red */
|
||||
*data++ = ((pixel & 0x07e0) >> 3) | ((pixel >> 9) & 0x03); /* Green */
|
||||
*data++ = ((pixel & 0x001f) << 3) | ((pixel >> 2) & 0x07); /* Blue */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -529,22 +479,19 @@ internal_convert (void *src_buffer,
|
||||
else if (bpp == 32)
|
||||
{
|
||||
/* Format in fourcc is xxxxxxxx rrrrrrrr gggggggg bbbbbbbb */
|
||||
for (register int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
uint8 *data = (uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
uint16 *snes = (uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
|
||||
uint16 pixel = *snes++;
|
||||
*data++ = 0xff; /* Null */
|
||||
*data++ = (pixel & 0x7c00) >> 7; /* Red */
|
||||
*data++ = (pixel & 0x03e0) >> 2; /* Green */
|
||||
*data++ = (pixel & 0x001f) << 3; /* Blue */
|
||||
*data++ = ((pixel & 0xf800) >> 8) | ((pixel >> 13) & 0x07); /* Red */
|
||||
*data++ = ((pixel & 0x07e0) >> 3) | ((pixel >> 9) & 0x03); /* Green */
|
||||
*data++ = ((pixel & 0x001f) << 3) | ((pixel >> 2) & 0x07); /* Blue */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -552,70 +499,23 @@ internal_convert (void *src_buffer,
|
||||
|
||||
else /* Least significant byte first :-P */
|
||||
{
|
||||
if (bpp == 15)
|
||||
{
|
||||
/* Format in fourcc is xrrrrrgg gggbbbbb */
|
||||
|
||||
for (register int y = 0; y < height; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
*data++ = (pixel & 0x00c0)
|
||||
| (pixel & 0x001f); /* Top 3 of last 4 green 5 blue */
|
||||
*data++ = (pixel & 0x7c00) >> 8
|
||||
| (pixel & 0x0300) >> 8; /* Top 2 green, 5 red */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (bpp == 16)
|
||||
{
|
||||
/* Format in fourcc is rrrrrggg gggbbbbb */
|
||||
for (register int y = 0; y < height; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
|
||||
*data++ = (pixel & 0x00c0)
|
||||
| (pixel & 0x001f); /* last 3 green, 5 blue */
|
||||
*data++ = (pixel & 0x7c00) >> 7
|
||||
| (pixel & 0x0300) >> 7; /* 5 red, first 3 green */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (bpp == 24)
|
||||
if (bpp == 24)
|
||||
{
|
||||
/* Format in fourcc is rrrrrrrr gggggggg bbbbbbbb */
|
||||
for (register int y = 0; y < height; y++)
|
||||
/* Format in fourcc is xxxxxxxx rrrrrrrr gggggggg bbbbbbbb */
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
uint8 *data = (uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
uint16 *snes = (uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
uint16 pixel = *snes++;
|
||||
|
||||
*data++ = (pixel & 0x001f) << 3; /* Blue */
|
||||
*data++ = (pixel & 0x03e0) >> 2; /* Green */
|
||||
*data++ = (pixel & 0x7c00) >> 7; /* Red */
|
||||
*data++ = ((pixel & 0x001f) << 3) | ((pixel >> 2) & 0x07); /* Blue */
|
||||
*data++ = ((pixel & 0x07e0) >> 3) | ((pixel >> 9) & 0x03); /* Green */
|
||||
*data++ = ((pixel & 0xf800) >> 8) | ((pixel >> 13) & 0x07); /* Red */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -623,21 +523,19 @@ internal_convert (void *src_buffer,
|
||||
else if (bpp == 32)
|
||||
{
|
||||
/* Format in fourcc is xxxxxxxx rrrrrrrr gggggggg bbbbbbbb */
|
||||
for (register int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
uint8 *data = (uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
uint16 *snes = (uint16 *) (((uint8 *) src_buffer) + y * src_pitch);
|
||||
|
||||
for (register int x = 0; x < width; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
uint32 pixel = *snes++;
|
||||
uint16 pixel = *snes++;
|
||||
|
||||
*data++ = (pixel & 0x001f) << 3; /* Blue */
|
||||
*data++ = (pixel & 0x03e0) >> 2; /* Green */
|
||||
*data++ = (pixel & 0x7c00) >> 7; /* Red */
|
||||
*data++ = ((pixel & 0x001f) << 3) | ((pixel >> 2) & 0x07); /* Blue */
|
||||
*data++ = ((pixel & 0x07e0) >> 3) | ((pixel >> 9) & 0x03); /* Green */
|
||||
*data++ = ((pixel & 0xf800) >> 8) | ((pixel >> 13) & 0x07); /* Red */
|
||||
*data++ = 0xff; /* Null */
|
||||
}
|
||||
}
|
||||
@ -664,12 +562,12 @@ S9xForceHires (void *buffer,
|
||||
|
||||
if (double_width && double_height)
|
||||
{
|
||||
for (register int y = (height * 2) - 1; y >= 0; y--)
|
||||
for (int y = (height * 2) - 1; y >= 0; y--)
|
||||
{
|
||||
register uint16 *src_line = (uint16 *) ((uint8 *) buffer + (y >> 1) * pitch);
|
||||
register uint16 *dst_line = (uint16 *) ((uint8 *) buffer + y * pitch);
|
||||
uint16 *src_line = (uint16 *) ((uint8 *) buffer + (y >> 1) * pitch);
|
||||
uint16 *dst_line = (uint16 *) ((uint8 *) buffer + y * pitch);
|
||||
|
||||
for (register int x = (width * 2) - 1; x >= 0; x--)
|
||||
for (int x = (width * 2) - 1; x >= 0; x--)
|
||||
{
|
||||
*(dst_line + x) = *(src_line + (x >> 1));
|
||||
}
|
||||
@ -679,11 +577,11 @@ S9xForceHires (void *buffer,
|
||||
}
|
||||
else if (double_width && !double_height)
|
||||
{
|
||||
for (register int y = (height) - 1; y >= 0; y--)
|
||||
for (int y = (height) - 1; y >= 0; y--)
|
||||
{
|
||||
register uint16 *line = (uint16 *) ((uint8 *) buffer + y * pitch);
|
||||
uint16 *line = (uint16 *) ((uint8 *) buffer + y * pitch);
|
||||
|
||||
for (register int x = (width * 2) - 1; x >= 0; x--)
|
||||
for (int x = (width * 2) - 1; x >= 0; x--)
|
||||
{
|
||||
*(line + x) = *(line + (x >> 1));
|
||||
}
|
||||
@ -693,10 +591,10 @@ S9xForceHires (void *buffer,
|
||||
}
|
||||
else if (!double_width && double_height)
|
||||
{
|
||||
for (register int y = (height * 2) - 1; y >= 0; y--)
|
||||
for (int y = (height * 2) - 1; y >= 0; y--)
|
||||
{
|
||||
register uint16 *src_line = (uint16 *) ((uint8 *) buffer + (y >> 1) * pitch);
|
||||
register uint16 *dst_line = (uint16 *) ((uint8 *) buffer + y * pitch);
|
||||
uint16 *src_line = (uint16 *) ((uint8 *) buffer + (y >> 1) * pitch);
|
||||
uint16 *dst_line = (uint16 *) ((uint8 *) buffer + y * pitch);
|
||||
|
||||
memcpy (dst_line, src_line, width * 2);
|
||||
}
|
||||
@ -707,8 +605,8 @@ S9xForceHires (void *buffer,
|
||||
return;
|
||||
}
|
||||
|
||||
#undef AVERAGE_1555
|
||||
#define AVERAGE_1555(el0, el1) (((el0) & (el1)) + ((((el0) ^ (el1)) & 0x7BDE) >> 1))
|
||||
#undef AVERAGE_565
|
||||
#define AVERAGE_565(el0, el1) (((el0) & (el1)) + ((((el0) ^ (el1)) & 0xF7DE) >> 1))
|
||||
static void
|
||||
S9xMergeHires (void *buffer,
|
||||
int pitch,
|
||||
@ -720,14 +618,14 @@ S9xMergeHires (void *buffer,
|
||||
return;
|
||||
}
|
||||
|
||||
for (register int y = 0; y < height; y++)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
register uint16 *input = (uint16 *) ((uint8 *) buffer + y * pitch);
|
||||
register uint16 *output = input;
|
||||
uint16 *input = (uint16 *) ((uint8 *) buffer + y * pitch);
|
||||
uint16 *output = input;
|
||||
|
||||
for (register int x = 0; x < (width >> 1); x++)
|
||||
for (int x = 0; x < (width >> 1); x++)
|
||||
{
|
||||
*output++ = AVERAGE_1555 (input[0], input[1]);
|
||||
*output++ = AVERAGE_565 (input[0], input[1]);
|
||||
input += 2;
|
||||
}
|
||||
}
|
||||
@ -897,10 +795,11 @@ filter_scanlines (void *src_buffer,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
register int x, y;
|
||||
register uint16 *src, *dst_a, *dst_b;
|
||||
int x, y;
|
||||
uint16 *src, *dst_a, *dst_b;
|
||||
|
||||
uint8 shift = scanline_shifts[gui_config->scanline_filter_intensity];
|
||||
uint16 mask = scanline_masks[gui_config->scanline_filter_intensity + 1];
|
||||
|
||||
src = (uint16 *) src_buffer;
|
||||
dst_a = (uint16 *) dst_buffer;
|
||||
@ -910,25 +809,8 @@ filter_scanlines (void *src_buffer,
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
register uint8 rs, gs, bs, /* Source components */
|
||||
rh, gh, bh; /* High (bright) components */
|
||||
|
||||
rs = ((src[x] >> 10) & 0x1f);
|
||||
gs = ((src[x] >> 5) & 0x1f);
|
||||
bs = ((src[x]) & 0x1f);
|
||||
|
||||
rh = rs + (rs >> shift);
|
||||
gh = gs + (gs >> shift);
|
||||
bh = bs + (bs >> shift);
|
||||
|
||||
rh = (rh > 31) ? 31 : rh;
|
||||
gh = (gh > 31) ? 31 : gh;
|
||||
bh = (bh > 31) ? 31 : bh;
|
||||
|
||||
dst_a[x] = (rh << 10) + (gh << 5) + (bh);
|
||||
dst_b[x] = ((rs + rs - rh) << 10) +
|
||||
((gs + gs - gh) << 5) +
|
||||
(bs + bs - bh);
|
||||
dst_a[x] = src[x];
|
||||
dst_b[x] = (src[x] - (src[x] >> shift & mask));
|
||||
}
|
||||
|
||||
src += src_pitch >> 1;
|
||||
|
@ -35,8 +35,8 @@
|
||||
#define NTSC_SVIDEO 1
|
||||
#define NTSC_RGB 2
|
||||
|
||||
#define ENDIAN_LSB 0
|
||||
#define ENDIAN_MSB 1
|
||||
#define ENDIAN_NORMAL 0
|
||||
#define ENDIAN_SWAPPED 1
|
||||
|
||||
#define JOB_FILTER 0
|
||||
#define JOB_CONVERT 1
|
||||
|
@ -168,7 +168,7 @@ S9xGTKDisplayDriver::init (void)
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
S9xSetEndianess (ENDIAN_MSB);
|
||||
S9xSetEndianess (ENDIAN_SWAPPED);
|
||||
|
||||
memset (buffer[0], 0, image_padded_size);
|
||||
memset (buffer[1], 0, scaled_padded_size);
|
||||
|
@ -205,38 +205,35 @@ S9xOpenGLDisplayDriver::update (int width, int height)
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
GL_BGRA,
|
||||
GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_SHORT_5_6_5,
|
||||
BUFFER_OFFSET (0));
|
||||
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
}
|
||||
else if (config->pbo_format == PBO_FMT_24)
|
||||
{
|
||||
/* Complement width to next multiple of 4 to force line size to
|
||||
* be a multiple of 4 bytes. Otherwise, packing fails. */
|
||||
int width_mul_4 = width + ((4 - (width % 4)) % 4);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo);
|
||||
glBufferData (GL_PIXEL_UNPACK_BUFFER,
|
||||
width_mul_4 * height * 3,
|
||||
width * height * 3,
|
||||
NULL,
|
||||
GL_STREAM_DRAW);
|
||||
pboMemory = glMapBuffer (GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
|
||||
|
||||
/* Pixel swizzling in software */
|
||||
S9xSetEndianess (ENDIAN_MSB);
|
||||
S9xSetEndianess (ENDIAN_SWAPPED);
|
||||
S9xConvert (final_buffer,
|
||||
pboMemory,
|
||||
final_pitch,
|
||||
width_mul_4 * 3,
|
||||
width * 3,
|
||||
width,
|
||||
height,
|
||||
24);
|
||||
|
||||
glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, width_mul_4);
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
|
||||
glTexSubImage2D (tex_target,
|
||||
0,
|
||||
0,
|
||||
@ -259,11 +256,7 @@ S9xOpenGLDisplayDriver::update (int width, int height)
|
||||
pboMemory = glMapBuffer (GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
|
||||
|
||||
/* Pixel swizzling in software */
|
||||
#ifdef __BIG_ENDIAN__
|
||||
S9xSetEndianess (ENDIAN_MSB);
|
||||
#else
|
||||
S9xSetEndianess (ENDIAN_LSB);
|
||||
#endif
|
||||
S9xSetEndianess (ENDIAN_NORMAL);
|
||||
S9xConvert (final_buffer,
|
||||
pboMemory,
|
||||
final_pitch,
|
||||
@ -297,8 +290,8 @@ S9xOpenGLDisplayDriver::update (int width, int height)
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
GL_BGRA,
|
||||
GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_SHORT_5_6_5,
|
||||
final_buffer);
|
||||
}
|
||||
|
||||
@ -353,16 +346,16 @@ S9xOpenGLDisplayDriver::clear_buffers (void)
|
||||
memset (buffer[0], 0, image_padded_size);
|
||||
memset (buffer[1], 0, scaled_padded_size);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, scaled_max_width);
|
||||
/* glPixelStorei (GL_UNPACK_ROW_LENGTH, scaled_max_width);
|
||||
glTexSubImage2D (tex_target,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
scaled_max_width,
|
||||
scaled_max_height,
|
||||
GL_BGRA,
|
||||
GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
buffer[1]);
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_SHORT_5_6_5,
|
||||
buffer[1]); */
|
||||
|
||||
return;
|
||||
}
|
||||
@ -380,7 +373,7 @@ S9xOpenGLDisplayDriver::update_texture_size (int width, int height)
|
||||
{
|
||||
glTexImage2D (tex_target,
|
||||
0,
|
||||
config->pbo_format == PBO_FMT_16 ? GL_RGB5_A1 : 4,
|
||||
config->pbo_format == PBO_FMT_16 ? GL_RGB565 : 4,
|
||||
width,
|
||||
height,
|
||||
0,
|
||||
@ -392,12 +385,12 @@ S9xOpenGLDisplayDriver::update_texture_size (int width, int height)
|
||||
{
|
||||
glTexImage2D (tex_target,
|
||||
0,
|
||||
GL_RGB5_A1,
|
||||
GL_RGB565,
|
||||
width,
|
||||
height,
|
||||
0,
|
||||
GL_BGRA,
|
||||
GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_SHORT_5_6_5,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -665,7 +658,7 @@ S9xOpenGLDisplayDriver::opengl_defaults (void)
|
||||
glBindTexture (tex_target, texmap);
|
||||
glTexImage2D (tex_target,
|
||||
0,
|
||||
config->pbo_format == PBO_FMT_16 ? GL_RGB5_A1 : 4,
|
||||
config->pbo_format == PBO_FMT_16 ? GL_RGB565 : 4,
|
||||
texture_width,
|
||||
texture_height,
|
||||
0,
|
||||
@ -688,12 +681,12 @@ S9xOpenGLDisplayDriver::opengl_defaults (void)
|
||||
glBindTexture (tex_target, texmap);
|
||||
glTexImage2D (tex_target,
|
||||
0,
|
||||
GL_RGB5_A1,
|
||||
GL_RGB565,
|
||||
texture_width,
|
||||
texture_height,
|
||||
0,
|
||||
GL_BGRA,
|
||||
GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_SHORT_5_6_5,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,8 @@
|
||||
#else
|
||||
#define PBO_BGRA_NATIVE_ORDER GL_UNSIGNED_BYTE
|
||||
#endif
|
||||
#define PBO_GET_FORMAT(x) (((x) == PBO_FMT_16 || (x) == PBO_FMT_32) ? GL_BGRA : GL_RGB)
|
||||
#define PBO_GET_PACKING(x) (((x) == PBO_FMT_16) ? GL_UNSIGNED_SHORT_1_5_5_5_REV : (((x) == PBO_FMT_24) ? GL_UNSIGNED_BYTE : PBO_BGRA_NATIVE_ORDER))
|
||||
#define PBO_GET_FORMAT(x) (((x) == PBO_FMT_32) ? GL_BGRA : GL_RGB)
|
||||
#define PBO_GET_PACKING(x) (((x) == PBO_FMT_16) ? GL_UNSIGNED_SHORT_5_6_5 : (((x) == PBO_FMT_24) ? GL_UNSIGNED_BYTE : PBO_BGRA_NATIVE_ORDER))
|
||||
|
||||
/* The following are procedure pointer types.
|
||||
* These aren't necessarily guaranteed to be in GL 1.1 */
|
||||
|
@ -358,9 +358,9 @@ S9xXVDisplayDriver::init (void)
|
||||
|
||||
/* on big-endian Xv still seems to like LSB order */
|
||||
if (config->force_inverted_byte_order)
|
||||
S9xSetEndianess (ENDIAN_MSB);
|
||||
S9xSetEndianess (ENDIAN_SWAPPED);
|
||||
else
|
||||
S9xSetEndianess (ENDIAN_LSB);
|
||||
S9xSetEndianess (ENDIAN_NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -376,16 +376,16 @@ S9xXVDisplayDriver::init (void)
|
||||
if (formats[i].byte_order == LSBFirst)
|
||||
{
|
||||
if (config->force_inverted_byte_order)
|
||||
S9xSetEndianess (ENDIAN_MSB);
|
||||
S9xSetEndianess (ENDIAN_SWAPPED);
|
||||
else
|
||||
S9xSetEndianess (ENDIAN_LSB);
|
||||
S9xSetEndianess (ENDIAN_NORMAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (config->force_inverted_byte_order)
|
||||
S9xSetEndianess (ENDIAN_LSB);
|
||||
S9xSetEndianess (ENDIAN_NORMAL);
|
||||
else
|
||||
S9xSetEndianess (ENDIAN_MSB);
|
||||
S9xSetEndianess (ENDIAN_SWAPPED);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -403,8 +403,8 @@ S9xXVDisplayDriver::init (void)
|
||||
int r, g, b;
|
||||
int y, u, v;
|
||||
|
||||
r = (color & 0x7c00) >> 7;
|
||||
g = (color & 0x03e0) >> 2;
|
||||
r = (color & 0xf800) >> 8;
|
||||
g = (color & 0x07e0) >> 3;
|
||||
b = (color & 0x001F) << 3;
|
||||
|
||||
y = (int) ((0.257 * ((double) r)) + (0.504 * ((double) g)) + (0.098 * ((double) b)) + 16.0);
|
||||
|
@ -703,12 +703,12 @@ Snes9xWindow::expose (void)
|
||||
{
|
||||
for (int x = 0; x < 256; x++)
|
||||
{
|
||||
unsigned int red = *splash_ptr++;
|
||||
unsigned int red = *splash_ptr++;
|
||||
unsigned int green = *splash_ptr++;
|
||||
unsigned int blue = *splash_ptr++;
|
||||
unsigned int blue = *splash_ptr++;
|
||||
|
||||
screen_ptr[x] = ((red & 0xF8) << 7) +
|
||||
((green & 0xF8) << 2) +
|
||||
screen_ptr[x] = ((red & 0xF8) << 8) +
|
||||
((green & 0xFC) << 3) +
|
||||
((blue & 0xF8) >> 3);
|
||||
}
|
||||
}
|
||||
|
12168
gtk/src/gtk_splash.cpp
12168
gtk/src/gtk_splash.cpp
File diff suppressed because it is too large
Load Diff
@ -134,7 +134,7 @@ void snes_ntsc_init( snes_ntsc_t* ntsc, snes_ntsc_setup_t const* setup )
|
||||
|
||||
/* 12.5% scanlines like in snes_ntsc example instead of zsnes's 25% */
|
||||
#define PIXEL_OUT( x ) \
|
||||
SNES_NTSC_RGB_OUT( x, value, 15 ); \
|
||||
SNES_NTSC_RGB_OUT( x, value, 16 ); \
|
||||
line_outa[x] = value; \
|
||||
line_outb[x] = value - (value >> scanline_offset & scanline_mask);
|
||||
|
||||
|
@ -4,15 +4,14 @@
|
||||
#define SNES_NTSC_CONFIG_H
|
||||
|
||||
/* Format of source pixels */
|
||||
/* #define SNES_NTSC_IN_FORMAT SNES_NTSC_RGB16
|
||||
#define SNES_NTSC_IN_FORMAT SNES_NTSC_BGR15 */
|
||||
#define SNES_NTSC_IN_FORMAT SNES_NTSC_RGB15
|
||||
#define SNES_NTSC_IN_FORMAT SNES_NTSC_RGB16
|
||||
/* #define SNES_NTSC_IN_FORMAT SNES_NTSC_BGR15 */
|
||||
|
||||
/* The following affect the built-in blitter only; a custom blitter can
|
||||
handle things however it wants. */
|
||||
|
||||
/* Bits per pixel of output. Can be 15, 16, 32, or 24 (same as 32). */
|
||||
#define SNES_NTSC_OUT_DEPTH 15
|
||||
#define SNES_NTSC_OUT_DEPTH 16
|
||||
|
||||
/* Type of input pixel values */
|
||||
#define SNES_NTSC_IN_T unsigned short
|
||||
|
Loading…
Reference in New Issue
Block a user