diff --git a/desmume/src/OGLRender.cpp b/desmume/src/OGLRender.cpp index bc95d9c8c..9c7edb80b 100644 --- a/desmume/src/OGLRender.cpp +++ b/desmume/src/OGLRender.cpp @@ -1451,7 +1451,7 @@ static void OGLGetLine(int line, int start, int end_inclusive, u16* dst, u8* dst // u32 dstpixel; dst[j] = (screen3D[t+2] | (screen3D[t+1] << 5) | (screen3D[t+0] << 10) | ((screen3D[t+3] > 0) ? 0x8000 : 0x0000)); - dstAlpha[j] = (screen3D[t+3] / 2); + dstAlpha[j] = alpha_5bit_to_4bit[screen3D[t+3]]; //old debug reminder: display alpha channel //u32 r = screen3D[t+3]; diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index 22bb7ab39..fedce1168 100644 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -65,6 +65,25 @@ CACHE_ALIGN const u8 material_3bit_to_8bit[] = { 0x00, 0x24, 0x49, 0x6D, 0x92, 0xB6, 0xDB, 0xFF }; +CACHE_ALIGN const u8 alpha_5bit_to_4bit[] = { + 0x00, 0x00, + 0x01, 0x01, + 0x02, 0x02, + 0x03, 0x03, + 0x04, 0x04, + 0x05, 0x05, + 0x06, 0x06, + 0x07, 0x07, + 0x08, 0x08, + 0x09, 0x09, + 0x0A, 0x0A, + 0x0B, 0x0B, + 0x0C, 0x0C, + 0x0D, 0x0D, + 0x0E, 0x0E, + 0x10, 0x10 +}; + //private acceleration tables static float float16table[65536]; static float float10Table[1024]; diff --git a/desmume/src/gfx3d.h b/desmume/src/gfx3d.h index f1f19622d..f3dee07da 100644 --- a/desmume/src/gfx3d.h +++ b/desmume/src/gfx3d.h @@ -152,6 +152,7 @@ extern CACHE_ALIGN u8 mixTable555[32][32][32]; extern CACHE_ALIGN const int material_5bit_to_31bit[32]; extern CACHE_ALIGN const u8 material_5bit_to_8bit[32]; extern CACHE_ALIGN const u8 material_3bit_to_8bit[8]; +extern CACHE_ALIGN const u8 alpha_5bit_to_4bit[32]; //GE commands: void gfx3d_glViewPort(unsigned long v);