Update Makefile, uses correct pixel format.

This commit is contained in:
Themaister 2010-06-27 18:24:26 +02:00
parent 50cdc30e1f
commit b53d538d76
3 changed files with 5 additions and 13 deletions

View File

@ -46,7 +46,7 @@ uninstall: $(TARGET)
rm -rf $(PREFIX)/bin/$(TARGET)
clean:
rm -rf $(OBJ)
rm -rf *.o hqflt/*.o
rm -rf $(TARGET)
.PHONY: all install uninstall clean

4
gl.c
View File

@ -144,7 +144,7 @@ static bool gl_frame(void *data, const uint16_t* frame, int width, int height)
glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, frame);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, frame);
glLoadIdentity();
glColor3f(1,1,1);
@ -221,7 +221,7 @@ static void* gl_init(video_info_t *video, const input_driver_t **input)
glBindTexture(GL_TEXTURE_2D, texture);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 256 * video->input_scale);
glTexImage2D(GL_TEXTURE_2D,
0, GL_RGB, 256 * video->input_scale, 256 * video->input_scale, 0, GL_RGBA,
0, GL_RGB, 256 * video->input_scale, 256 * video->input_scale, 0, GL_BGRA,
GL_UNSIGNED_SHORT_1_5_5_5_REV, gl_buffer);
*input = &input_glfw;

12
ssnes.c
View File

@ -150,8 +150,6 @@ static void uninit_video_input(void)
driver.input->free(driver.input_data);
}
// Temporary hack. Needs to do some color space switching for some unknown reason. Worked in 0.064 without hack at least.
#define USE_HACK 1
static inline void process_frame (uint16_t * restrict out, const uint16_t * restrict in, unsigned width, unsigned height)
{
for ( int y = 0; y < height; y++ )
@ -159,18 +157,12 @@ static inline void process_frame (uint16_t * restrict out, const uint16_t * rest
const uint16_t *src = in + y * 1024;
uint16_t *dst = out + y * width;
#if USE_HACK
for ( int x = 0; x < width; x++ )
{
uint16_t color = src[x];
*dst++ = ((color >> 10) & 0x1f) | (color & 0x3e0) | ((color & 0x1f) << 10);
}
#else
memcpy(dst, src, width * sizeof(uint16_t));
#endif
}
}
// libsnes: 0.065
// Format received is 16-bit 0RRRRRGGGGGBBBBB
static void video_frame(const uint16_t *data, unsigned width, unsigned height)
{
if ( !video_active )