Goto'ing past variable initializations is undefined behavior.

Work around different gcc versions giving conflicting warnings
about signed/unsigned comparisons involving bit fields.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6290 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-10-20 00:12:41 +00:00
parent 7b45ac6e01
commit 9a03484d64
2 changed files with 24 additions and 23 deletions

View File

@ -590,33 +590,34 @@ void ExecuteCommand(UDICR& _DICR)
{ {
if (iDVDOffset & 0x80000000) // read request to hardware buffer if (iDVDOffset & 0x80000000) // read request to hardware buffer
{ {
u32 len = m_DILENGTH.Length / 4;
switch (iDVDOffset) switch (iDVDOffset)
{ {
case 0x80000000: case 0x80000000:
ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD STATUS (80000000)"); ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD STATUS (80000000)");
for (u32 i = 0; i < m_DILENGTH.Length / 4; i++) for (u32 i = 0; i < len; i++)
Memory::Write_U32(0, m_DIMAR.Address + i * 4); Memory::Write_U32(0, m_DIMAR.Address + i * 4);
break; break;
case 0x80000040: case 0x80000040:
ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD STATUS (2) (80000040)"); ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD STATUS (2) (80000040)");
for (u32 i = 0; i < m_DILENGTH.Length / 4; i++) for (u32 i = 0; i < len; i++)
Memory::Write_U32(~0, m_DIMAR.Address + i * 4); Memory::Write_U32(~0, m_DIMAR.Address + i * 4);
Memory::Write_U32(0x00000020, m_DIMAR.Address); // DIMM SIZE, LE Memory::Write_U32(0x00000020, m_DIMAR.Address); // DIMM SIZE, LE
Memory::Write_U32(0x4743414D, m_DIMAR.Address + 4); // GCAM signature Memory::Write_U32(0x4743414D, m_DIMAR.Address + 4); // GCAM signature
break; break;
case 0x80000120: case 0x80000120:
ERROR_LOG(DVDINTERFACE, "GC-AM: READ FIRMWARE STATUS (80000120)"); ERROR_LOG(DVDINTERFACE, "GC-AM: READ FIRMWARE STATUS (80000120)");
for (u32 i = 0; i < m_DILENGTH.Length / 4; i++) for (u32 i = 0; i < len; i++)
Memory::Write_U32(0x01010101, m_DIMAR.Address + i * 4); Memory::Write_U32(0x01010101, m_DIMAR.Address + i * 4);
break; break;
case 0x80000140: case 0x80000140:
ERROR_LOG(DVDINTERFACE, "GC-AM: READ FIRMWARE STATUS (80000140)"); ERROR_LOG(DVDINTERFACE, "GC-AM: READ FIRMWARE STATUS (80000140)");
for (u32 i = 0; i < m_DILENGTH.Length / 4; i++) for (u32 i = 0; i < len; i++)
Memory::Write_U32(0x01010101, m_DIMAR.Address + i * 4); Memory::Write_U32(0x01010101, m_DIMAR.Address + i * 4);
break; break;
case 0x84000020: case 0x84000020:
ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD STATUS (1) (84000020)"); ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD STATUS (1) (84000020)");
for (u32 i = 0; i < m_DILENGTH.Length / 4; i++) for (u32 i = 0; i < len; i++)
Memory::Write_U32(0x00000000, m_DIMAR.Address + i * 4); Memory::Write_U32(0x00000000, m_DIMAR.Address + i * 4);
break; break;
default: default:

View File

@ -167,6 +167,9 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
unsigned int expandedWidth = (width + bsw) & (~bsw); unsigned int expandedWidth = (width + bsw) & (~bsw);
unsigned int expandedHeight = (height + bsh) & (~bsh); unsigned int expandedHeight = (height + bsh) & (~bsh);
const unsigned int nativeW = width;
const unsigned int nativeH = height;
bool isPow2;
u64 hash_value = 0; u64 hash_value = 0;
u64 texHash = 0; u64 texHash = 0;
@ -175,6 +178,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
const u32 texture_size = TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, texformat); const u32 texture_size = TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, texformat);
const u32 palette_size = TexDecoder_GetPaletteSize(texformat); const u32 palette_size = TexDecoder_GetPaletteSize(texformat);
bool texture_is_dynamic = false; bool texture_is_dynamic = false;
unsigned int texLevels;
PC_TexFormat pcfmt = PC_TEX_FMT_NONE;
// someone who understands this var could rename it :p // someone who understands this var could rename it :p
const bool isC4_C8_C14X2 = (texformat == GX_TF_C4 || texformat == GX_TF_C8 || texformat == GX_TF_C14X2); const bool isC4_C8_C14X2 = (texformat == GX_TF_C4 || texformat == GX_TF_C8 || texformat == GX_TF_C14X2);
@ -272,11 +277,6 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
} }
} }
const unsigned int nativeW = width;
const unsigned int nativeH = height;
PC_TexFormat pcfmt = PC_TEX_FMT_NONE;
if (g_ActiveConfig.bHiresTextures) if (g_ActiveConfig.bHiresTextures)
{ {
// Load Custom textures // Load Custom textures
@ -285,7 +285,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
unsigned int newWidth = width; unsigned int newWidth = width;
unsigned int newHeight = height; unsigned int newHeight = height;
sprintf(texPathTemp, "%s_%08x_%i", globals->unique_id, texHash, texformat); sprintf(texPathTemp, "%s_%08llx_%i", globals->unique_id, texHash, texformat);
pcfmt = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, texformat, temp); pcfmt = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, texformat, temp);
if (pcfmt != PC_TEX_FMT_NONE) if (pcfmt != PC_TEX_FMT_NONE)
@ -302,8 +302,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
pcfmt = TexDecoder_Decode(temp, ptr, expandedWidth, pcfmt = TexDecoder_Decode(temp, ptr, expandedWidth,
expandedHeight, texformat, tlutaddr, tlutfmt, !g_texture_cache->isOGL()); expandedHeight, texformat, tlutaddr, tlutfmt, !g_texture_cache->isOGL());
const bool isPow2 = !((width & (width - 1)) || (height & (height - 1))); isPow2 = !((width & (width - 1)) || (height & (height - 1)));
unsigned int texLevels = (isPow2 && UseNativeMips && maxlevel) ? texLevels = (isPow2 && UseNativeMips && maxlevel) ?
GetPow2(std::max(width, height)) : !isPow2; GetPow2(std::max(width, height)) : !isPow2;
if ((texLevels > (maxlevel + 1)) && maxlevel) if ((texLevels > (maxlevel + 1)) && maxlevel)
@ -381,7 +381,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
if (false == File::Exists(szDir) || false == File::IsDirectory(szDir)) if (false == File::Exists(szDir) || false == File::IsDirectory(szDir))
File::CreateDir(szDir); File::CreateDir(szDir);
sprintf(szTemp, "%s/%s_%08x_%i.png", szDir, globals->unique_id, texHash, texformat); sprintf(szTemp, "%s/%s_%08llx_%i.png", szDir, globals->unique_id, texHash, texformat);
if (false == File::Exists(szTemp)) if (false == File::Exists(szTemp))
entry->Save(szTemp); entry->Save(szTemp);