BACKENDS: PSP: Support RGBA8888 by swapping bytes
This commit is contained in:
parent
de08002679
commit
6ae4512a42
3 changed files with 15 additions and 0 deletions
|
@ -639,6 +639,7 @@ inline uint32 GuRenderer::convertToGuPixelFormat(PSPPixelFormat::Type format) {
|
||||||
guFormat = GU_PSM_5650;
|
guFormat = GU_PSM_5650;
|
||||||
break;
|
break;
|
||||||
case PSPPixelFormat::Type_8888:
|
case PSPPixelFormat::Type_8888:
|
||||||
|
case PSPPixelFormat::Type_8888_RGBA:
|
||||||
guFormat = GU_PSM_8888;
|
guFormat = GU_PSM_8888;
|
||||||
break;
|
break;
|
||||||
case PSPPixelFormat::Type_Palette_8bit:
|
case PSPPixelFormat::Type_Palette_8bit:
|
||||||
|
|
|
@ -43,6 +43,9 @@ void PSPPixelFormat::set(Type type, bool swap /* = false */) {
|
||||||
bitsPerPixel = 16;
|
bitsPerPixel = 16;
|
||||||
break;
|
break;
|
||||||
case Type_8888:
|
case Type_8888:
|
||||||
|
case Type_8888_RGBA:
|
||||||
|
bitsPerPixel = 32;
|
||||||
|
break;
|
||||||
bitsPerPixel = 32;
|
bitsPerPixel = 32;
|
||||||
break;
|
break;
|
||||||
case Type_Palette_8bit:
|
case Type_Palette_8bit:
|
||||||
|
@ -98,6 +101,8 @@ void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat *
|
||||||
*target = Type_4444;
|
*target = Type_4444;
|
||||||
} else if (pf->gLoss == 0 && pf->gShift == 8) {
|
} else if (pf->gLoss == 0 && pf->gShift == 8) {
|
||||||
*target = Type_8888;
|
*target = Type_8888;
|
||||||
|
} else if (pf->gLoss == 0 && pf->gShift == 16) {
|
||||||
|
*target = Type_8888_RGBA;
|
||||||
} else if ((pf->gLoss == 0 && pf->gShift == 0) ||
|
} else if ((pf->gLoss == 0 && pf->gShift == 0) ||
|
||||||
(pf->gLoss == 8 && pf->gShift == 0)) { // Default CLUT8 can have weird values
|
(pf->gLoss == 8 && pf->gShift == 0)) { // Default CLUT8 can have weird values
|
||||||
*target = Type_5551;
|
*target = Type_5551;
|
||||||
|
@ -154,6 +159,7 @@ Graphics::PixelFormat PSPPixelFormat::convertToScummvmPixelFormat(PSPPixelFormat
|
||||||
pf.bShift = 11;
|
pf.bShift = 11;
|
||||||
break;
|
break;
|
||||||
case Type_8888:
|
case Type_8888:
|
||||||
|
case Type_8888_RGBA:
|
||||||
pf.bytesPerPixel = 4;
|
pf.bytesPerPixel = 4;
|
||||||
pf.aLoss = 0;
|
pf.aLoss = 0;
|
||||||
pf.rLoss = 0;
|
pf.rLoss = 0;
|
||||||
|
|
|
@ -38,6 +38,7 @@ struct PSPPixelFormat {
|
||||||
Type_5551,
|
Type_5551,
|
||||||
Type_5650,
|
Type_5650,
|
||||||
Type_8888,
|
Type_8888,
|
||||||
|
Type_8888_RGBA,
|
||||||
Type_Palette_8bit,
|
Type_Palette_8bit,
|
||||||
Type_Palette_4bit,
|
Type_Palette_4bit,
|
||||||
Type_Unknown
|
Type_Unknown
|
||||||
|
@ -70,6 +71,7 @@ struct PSPPixelFormat {
|
||||||
color = (((b >> 3) << 11) | ((g >> 2) << 5) | ((r >> 3) << 0));
|
color = (((b >> 3) << 11) | ((g >> 2) << 5) | ((r >> 3) << 0));
|
||||||
break;
|
break;
|
||||||
case Type_8888:
|
case Type_8888:
|
||||||
|
case Type_8888_RGBA:
|
||||||
color = (((b >> 0) << 16) | ((g >> 0) << 8) | ((r >> 0) << 0) | ((a >> 0) << 24));
|
color = (((b >> 0) << 16) | ((g >> 0) << 8) | ((r >> 0) << 0) | ((a >> 0) << 24));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -110,6 +112,7 @@ struct PSPPixelFormat {
|
||||||
r = r << 3 | r >> 2;
|
r = r << 3 | r >> 2;
|
||||||
break;
|
break;
|
||||||
case Type_8888:
|
case Type_8888:
|
||||||
|
case Type_8888_RGBA:
|
||||||
a = (color >> 24) & 0xFF;
|
a = (color >> 24) & 0xFF;
|
||||||
b = (color >> 16) & 0xFF;
|
b = (color >> 16) & 0xFF;
|
||||||
g = (color >> 8) & 0xFF;
|
g = (color >> 8) & 0xFF;
|
||||||
|
@ -130,6 +133,7 @@ struct PSPPixelFormat {
|
||||||
color = (color & 0x7FFF) | (((uint32)alpha >> 7) << 15);
|
color = (color & 0x7FFF) | (((uint32)alpha >> 7) << 15);
|
||||||
break;
|
break;
|
||||||
case Type_8888:
|
case Type_8888:
|
||||||
|
case Type_8888_RGBA:
|
||||||
color = (color & 0x00FFFFFF) | ((uint32)alpha << 24);
|
color = (color & 0x00FFFFFF) | ((uint32)alpha << 24);
|
||||||
break;
|
break;
|
||||||
case Type_5650:
|
case Type_5650:
|
||||||
|
@ -200,6 +204,10 @@ struct PSPPixelFormat {
|
||||||
output = (color & 0xff00ff00) |
|
output = (color & 0xff00ff00) |
|
||||||
((color & 0x000000ff) << 16) | ((color & 0x00ff0000) >> 16);
|
((color & 0x000000ff) << 16) | ((color & 0x00ff0000) >> 16);
|
||||||
break;
|
break;
|
||||||
|
case Type_8888_RGBA:
|
||||||
|
output = ((color & 0x000000ff) << 24) | ((color & 0x0000ff00) << 8) |
|
||||||
|
((color & 0x00ff0000) >> 8) | ((color & 0xff000000) >> 24);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
PSP_ERROR("invalid format[%u] for swapping\n", format);
|
PSP_ERROR("invalid format[%u] for swapping\n", format);
|
||||||
output = 0;
|
output = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue