Core:
- Do more explicit casting to fix build errors on C++11 compilers. - Fix bug with libfat string handling.
This commit is contained in:
parent
0fc37d2c06
commit
e1f7039f1b
|
@ -1409,7 +1409,7 @@ Render3DError OpenGLRenderer_3_2::ClearUsingValues(const FragmentColor &clearCol
|
|||
const GLfloat oglColor[4] = {divide5bitBy31_LUT[clearColor.r], divide5bitBy31_LUT[clearColor.g], divide5bitBy31_LUT[clearColor.b], divide5bitBy31_LUT[clearColor.a]};
|
||||
const GLfloat oglDepth[4] = {(GLfloat)(clearAttributes.depth & 0x000000FF)/255.0f, (GLfloat)((clearAttributes.depth >> 8) & 0x000000FF)/255.0f, (GLfloat)((clearAttributes.depth >> 16) & 0x000000FF)/255.0f, 1.0};
|
||||
const GLfloat oglPolyID[4] = {(GLfloat)clearAttributes.opaquePolyID/63.0f, 0.0, 0.0, 1.0};
|
||||
const GLfloat oglFogAttr[4] = {clearAttributes.isFogged, 0.0, 0.0, 1.0};
|
||||
const GLfloat oglFogAttr[4] = {(GLfloat)clearAttributes.isFogged, 0.0, 0.0, 1.0};
|
||||
|
||||
glClearBufferfi(GL_DEPTH_STENCIL, 0, (GLfloat)clearAttributes.depth / (GLfloat)0x00FFFFFF, clearAttributes.opaquePolyID);
|
||||
glClearBufferfv(GL_COLOR, 0, oglColor); // texGColorID
|
||||
|
|
|
@ -3845,12 +3845,12 @@ static LUTValues PackLUTValues(const uint8_t p0, const uint8_t p1, const uint8_t
|
|||
{
|
||||
const uint8_t wR = 256 / (w0 + w1 + w2);
|
||||
return (LUTValues) {
|
||||
p0*31,
|
||||
p1*31,
|
||||
p2*31,
|
||||
(w1 == 0 && w2 == 0) ? 255 : w0*wR,
|
||||
w1*wR,
|
||||
w2*wR
|
||||
(uint8_t)(p0*31),
|
||||
(uint8_t)(p1*31),
|
||||
(uint8_t)(p2*31),
|
||||
(uint8_t)((w1 == 0 && w2 == 0) ? 255 : w0*wR),
|
||||
(uint8_t)(w1*wR),
|
||||
(uint8_t)(w2*wR)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1262,24 +1262,24 @@ static void gfx3d_glNormal(s32 v)
|
|||
|
||||
//apply lighting model
|
||||
u8 diffuse[3] = {
|
||||
(dsDiffuse)&0x1F,
|
||||
(dsDiffuse>>5)&0x1F,
|
||||
(dsDiffuse>>10)&0x1F };
|
||||
(u8)( dsDiffuse & 0x1F),
|
||||
(u8)((dsDiffuse >> 5) & 0x1F),
|
||||
(u8)((dsDiffuse >> 10) & 0x1F) };
|
||||
|
||||
u8 ambient[3] = {
|
||||
(dsAmbient)&0x1F,
|
||||
(dsAmbient>>5)&0x1F,
|
||||
(dsAmbient>>10)&0x1F };
|
||||
(u8)( dsAmbient & 0x1F),
|
||||
(u8)((dsAmbient >> 5) & 0x1F),
|
||||
(u8)((dsAmbient >> 10) & 0x1F) };
|
||||
|
||||
u8 emission[3] = {
|
||||
(dsEmission)&0x1F,
|
||||
(dsEmission>>5)&0x1F,
|
||||
(dsEmission>>10)&0x1F };
|
||||
(u8)( dsEmission & 0x1F),
|
||||
(u8)((dsEmission >> 5) & 0x1F),
|
||||
(u8)((dsEmission >> 10) & 0x1F) };
|
||||
|
||||
u8 specular[3] = {
|
||||
(dsSpecular)&0x1F,
|
||||
(dsSpecular>>5)&0x1F,
|
||||
(dsSpecular>>10)&0x1F };
|
||||
(u8)( dsSpecular & 0x1F),
|
||||
(u8)((dsSpecular >> 5) & 0x1F),
|
||||
(u8)((dsSpecular >> 10) & 0x1F) };
|
||||
|
||||
int vertexColor[3] = { emission[0], emission[1], emission[2] };
|
||||
|
||||
|
@ -1288,9 +1288,9 @@ static void gfx3d_glNormal(s32 v)
|
|||
if (!((lightMask>>i)&1)) continue;
|
||||
|
||||
u8 _lightColor[3] = {
|
||||
(lightColor[i])&0x1F,
|
||||
(lightColor[i]>>5)&0x1F,
|
||||
(lightColor[i]>>10)&0x1F };
|
||||
(u8)( lightColor[i] & 0x1F),
|
||||
(u8)((lightColor[i] >> 5) & 0x1F),
|
||||
(u8)((lightColor[i] >> 10) & 0x1F) };
|
||||
|
||||
//This formula is the one used by the DS
|
||||
//Reference : http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters
|
||||
|
|
|
@ -139,7 +139,7 @@ static size_t _FAT_directory_mbstoucs2 (ucs2_t* dst, const char* src, size_t len
|
|||
int bytes;
|
||||
size_t count = 0;
|
||||
|
||||
while (count < len-1 && src != '\0') {
|
||||
while (count < len-1 && *src != '\0') {
|
||||
bytes = mbrtowc (&tempChar, src, MB_CUR_MAX, &ps);
|
||||
if (bytes > 0) {
|
||||
*dst = (ucs2_t)tempChar;
|
||||
|
|
|
@ -277,8 +277,8 @@ std::string BytesToString(const void* data, int len)
|
|||
{
|
||||
Base64Table[ input[0] >> 2 ],
|
||||
Base64Table[ ((input[0] & 0x03) << 4) | (input[1] >> 4) ],
|
||||
n<2 ? '=' : Base64Table[ ((input[1] & 0x0F) << 2) | (input[2] >> 6) ],
|
||||
n<3 ? '=' : Base64Table[ input[2] & 0x3F ]
|
||||
(unsigned char)(n<2 ? '=' : Base64Table[ ((input[1] & 0x0F) << 2) | (input[2] >> 6) ]),
|
||||
(unsigned char)(n<3 ? '=' : Base64Table[ input[2] & 0x3F ])
|
||||
};
|
||||
ret.append(output, output+4);
|
||||
}
|
||||
|
@ -342,9 +342,9 @@ bool StringToBytes(const std::string& str, void* data, int len)
|
|||
}
|
||||
unsigned char outpacket[3] =
|
||||
{
|
||||
(converted[0] << 2) | (converted[1] >> 4),
|
||||
(converted[1] << 4) | (converted[2] >> 2),
|
||||
(converted[2] << 6) | (converted[3])
|
||||
(unsigned char)((converted[0] << 2) | (converted[1] >> 4)),
|
||||
(unsigned char)((converted[1] << 4) | (converted[2] >> 2)),
|
||||
(unsigned char)((converted[2] << 6) | (converted[3]))
|
||||
};
|
||||
int outlen = (input[2] == '=') ? 1 : (input[3] == '=' ? 2 : 3);
|
||||
if(outlen > len) outlen = len;
|
||||
|
|
Loading…
Reference in New Issue