Skip to content

Commit

Permalink
Fix libretro RGB565 rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
drhelius committed Apr 12, 2020
1 parent 4548229 commit 2a177aa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
17 changes: 17 additions & 0 deletions src/GearsystemCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,3 +790,20 @@ void GearsystemCore::Reset()
m_pSmsIOPorts->Reset();
m_bPaused = false;
}

void GearsystemCore::Get16BitFrameBuffer(GS_Color* pFrameBuffer, u16* p16BitFrameBuffer)
{
if (IsValidPointer(pFrameBuffer) && IsValidPointer(p16BitFrameBuffer))
{
int pixels = GS_RESOLUTION_MAX_WIDTH * GS_RESOLUTION_MAX_HEIGHT;


for (int i = 0; i < pixels; i++)
{
GS_Color p = pFrameBuffer[i];

p16BitFrameBuffer[i] = 0;
p16BitFrameBuffer[i] = ((p.red >> 3) << 11) | ((p.green >> 2) << 5) | (p.blue >> 3);
}
}
}
1 change: 1 addition & 0 deletions src/GearsystemCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class GearsystemCore
Memory* GetMemory();
Cartridge* GetCartridge();
void SetSG1000Palette(GS_Color* pSG1000Palette);
void Get16BitFrameBuffer(GS_Color* pFrameBuffer, u16* p16BitFrameBuffer);

private:
void InitMemoryRules();
Expand Down
8 changes: 0 additions & 8 deletions src/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,6 @@ struct GS_Color
u8 blue;
};

enum GS_Color_Format
{
GS_PIXEL_RGB565,
GS_PIXEL_RGB555,
GS_PIXEL_BGR565,
GS_PIXEL_BGR555
};

enum GS_Keys
{
Key_Up = 0,
Expand Down

0 comments on commit 2a177aa

Please sign in to comment.