Commit 9cb3b249 authored by negativeExponent's avatar negativeExponent
Browse files

Minor tweak to frame buffer

parent 650c9474
......@@ -301,31 +301,14 @@ bool retro_load_game(const struct retro_game_info *info)
surf->height = FB_HEIGHT;
surf->pitch = FB_WIDTH;
surf->bpp = system_color_depth;
surf->pixels = (uint16_t*)calloc(4, FB_WIDTH * FB_HEIGHT);
if (system_color_depth == 32)
if (!surf->pixels)
{
surf->pixels = (uint32_t*)calloc(4, FB_WIDTH * FB_HEIGHT);
if (!surf->pixels)
{
free(surf);
surf = NULL;
return false;
}
}
else if (system_color_depth == 16)
{
surf->pixels16 = (uint16_t*)calloc(2, FB_WIDTH * FB_HEIGHT);
if (!surf->pixels16)
{
free(surf);
surf = NULL;
return false;
}
}
else
free(surf);
surf = NULL;
return false;
}
lynxie->DisplaySetAttributes(surf->bpp);
......@@ -499,17 +482,9 @@ void retro_run()
unsigned width = spec.DisplayRect.w;
unsigned height = spec.DisplayRect.h;
unsigned pitch = FB_WIDTH << (system_color_depth >> 4);
if (surf->bpp == 32)
{
const uint32_t *pix = surf->pixels;
video_cb(pix, width, height, FB_WIDTH << 2);
}
else if (surf->bpp == 16)
{
const uint16_t *pix = surf->pixels16;
video_cb(pix, width, height, FB_WIDTH << 1);
}
video_cb(surf->pixels, width, height, pitch);
audio_batch_cb(spec.SoundBuf, spec.SoundBufSize);
......@@ -547,10 +522,6 @@ void retro_deinit()
{
if (surf)
{
if (surf->pixels16)
free(surf->pixels16);
surf->pixels16 = NULL;
if (surf->pixels)
free(surf->pixels);
surf->pixels = NULL;
......
......@@ -68,7 +68,7 @@ struct LYNX_HEADER
struct LYNX_DB
{
uint32 crc32;
char name[100];
const char *name;
uint32 filesize;
uint32 rotation;
uint32 reserved;
......
......@@ -422,7 +422,7 @@ void CMikie::CopyLineSurface(int32 bpp)
{
case 16:
{
uint16 *bitmap_tmp = mpDisplayCurrent->pixels16 + mpDisplayCurrentLine * mpDisplayCurrent->pitch;
uint16 *bitmap_tmp = mpDisplayCurrent->pixels + mpDisplayCurrentLine * mpDisplayCurrent->pitch;
for (uint32 loop = 0; loop < SCREEN_WIDTH / 2; loop++)
{
uint32 source = mpRamPointer[(uint16)mLynxAddr];
......@@ -447,7 +447,7 @@ void CMikie::CopyLineSurface(int32 bpp)
}
case 32:
{
uint32 *bitmap_tmp = mpDisplayCurrent->pixels + mpDisplayCurrentLine * mpDisplayCurrent->pitch;
uint32 *bitmap_tmp = (uint32 *)mpDisplayCurrent->pixels + mpDisplayCurrentLine * mpDisplayCurrent->pitch;
for (uint32 loop = 0; loop < SCREEN_WIDTH / 2; loop++)
{
uint32 source = mpRamPointer[(uint16)mLynxAddr];
......
......@@ -293,7 +293,7 @@ void Emulate(EmulateSpecStruct *espec)
color_black = MAKECOLOR_16(30, 30, 30, 0);
for (int y = 0; y < 102; y++)
{
uint16 *row = espec->surface->pixels16 + y * espec->surface->pitch;
uint16 *row = espec->surface->pixels + y * espec->surface->pitch;
if (!LynxLineDrawn[y])
{
......@@ -307,7 +307,7 @@ void Emulate(EmulateSpecStruct *espec)
color_black = MAKECOLOR_32(30, 30, 30, 0);
for (int y = 0; y < 102; y++)
{
uint32 *row = espec->surface->pixels + y * espec->surface->pitch;
uint32 *row = (uint32*)espec->surface->pixels + y * espec->surface->pitch;
if (!LynxLineDrawn[y])
{
......
......@@ -50,8 +50,7 @@ typedef struct
typedef struct
{
uint16 *pixels16;
uint32 *pixels;
uint16 *pixels;
int32 width;
int32 height;
int32 pitch;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment