From 2e12bd5e345c552b0186e0e3a395bfad3a7ea71c Mon Sep 17 00:00:00 2001 From: pierre Date: Mon, 24 May 2010 14:53:27 +0000 Subject: [PATCH] Fix a few compiler/valgrind warnings, kill check for 17th texenv registers, and one problem reading a truncated sram file. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5474 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp | 7 +++- .../Core/Src/PowerPC/Jit64/Jit_Integer.cpp | 5 +++ .../Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp | 2 ++ .../Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp | 1 + .../Src/PowerPC/Jit64IL/JitIL_LoadStore.cpp | 2 +- Source/Core/VideoCommon/Src/BPStructs.cpp | 33 +++++++++++-------- .../Src/ConfigDiagBitmaps.cpp | 2 +- 7 files changed, 35 insertions(+), 17 deletions(-) diff --git a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp index c996b60b20..ea1d63ce21 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp @@ -144,6 +144,8 @@ CEXIIPL::CEXIIPL() : m_count(0), m_FontsLoaded(false) { + memset(m_szBuffer,0,sizeof(m_szBuffer)); + // Determine region m_bNTSC = SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC; @@ -175,7 +177,10 @@ CEXIIPL::CEXIIPL() : FILE *file = fopen(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strSRAM.c_str(), "rb"); if (file != NULL) { - fread(&m_SRAM, 1, 64, file); + if (fread(&m_SRAM, 1, 64, file) < 64) { + ERROR_LOG(EXPANSIONINTERFACE, "EXI IPL-DEV: Could not read all of SRAM"); + m_SRAM = sram_dump; + } fclose(file); } else diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp index d36bc6f0fd..1b1d788d1c 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp @@ -174,6 +174,11 @@ void Jit64::cmpXX(UGeckoInstruction inst) less_than = CC_L; greater_than = CC_G; comparand = Imm32((s32)(s16)inst.UIMM); + } else { + PanicAlert("cmpXX"); + less_than = CC_O; + greater_than = CC_O; + comparand = Imm32(0); } } diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp index 40c392bedf..3ce0e12ef3 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp @@ -452,6 +452,8 @@ void Jit64::stXx(UGeckoInstruction inst) case 151: accessSize = 32; break; case 407: accessSize = 16; break; case 215: accessSize = 8; break; + default: PanicAlert("stXx: invalid access size"); + accessSize = 0; break; } MOV(32, R(ECX), gpr.R(s)); diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp index 3867c6cc04..ec12db09b3 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp @@ -1551,6 +1551,7 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, bool UseProfile, bool Mak case ICmpSlt: flag = CC_GE; break; case ICmpSge: flag = CC_L; break; case ICmpSle: flag = CC_G; break; + default: PanicAlert("cmpXX"); flag = CC_O; break; } FixupBranch cont = Jit->J_CC(flag); regWriteExit(RI, getOp2(I)); diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStore.cpp index 41ee60502e..b82702037e 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStore.cpp @@ -62,7 +62,7 @@ void JitIL::lXz(UGeckoInstruction inst) case 32: val = ibuild.EmitLoad32(addr); break; //lwz case 40: val = ibuild.EmitLoad16(addr); break; //lhz case 34: val = ibuild.EmitLoad8(addr); break; //lbz - lbzu crashes GFZP01 @ 0x8008575C - default: PanicAlert("lXz: invalid access size"); + default: PanicAlert("lXz: invalid access size"); val = 0; break; } ibuild.EmitStoreGReg(val, inst.RD); } diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index aea5d43c48..2a0fecf0a3 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -274,6 +274,11 @@ void BPWritten(const BPCmd& bp) break; } case BPMEM_FOGRANGE: // Fog Settings Control + case BPMEM_FOGRANGE+1: + case BPMEM_FOGRANGE+2: + case BPMEM_FOGRANGE+3: + case BPMEM_FOGRANGE+4: + case BPMEM_FOGRANGE+5: case BPMEM_FOGPARAM0: case BPMEM_FOGBMAGNITUDE: case BPMEM_FOGBEXPONENT: @@ -547,32 +552,32 @@ void BPWritten(const BPCmd& bp) case BPMEM_TEV_ALPHA_ENV+2: case BPMEM_TEV_COLOR_ENV+4: // Texture Environment 3 case BPMEM_TEV_ALPHA_ENV+4: - case BPMEM_TEV_COLOR_ENV+8: // Texture Environment 4 + case BPMEM_TEV_COLOR_ENV+6: // Texture Environment 4 + case BPMEM_TEV_ALPHA_ENV+6: + case BPMEM_TEV_COLOR_ENV+8: // Texture Environment 5 case BPMEM_TEV_ALPHA_ENV+8: - case BPMEM_TEV_COLOR_ENV+10: // Texture Environment 5 + case BPMEM_TEV_COLOR_ENV+10: // Texture Environment 6 case BPMEM_TEV_ALPHA_ENV+10: - case BPMEM_TEV_COLOR_ENV+12: // Texture Environment 6 + case BPMEM_TEV_COLOR_ENV+12: // Texture Environment 7 case BPMEM_TEV_ALPHA_ENV+12: - case BPMEM_TEV_COLOR_ENV+14: // Texture Environment 7 + case BPMEM_TEV_COLOR_ENV+14: // Texture Environment 8 case BPMEM_TEV_ALPHA_ENV+14: - case BPMEM_TEV_COLOR_ENV+16: // Texture Environment 8 + case BPMEM_TEV_COLOR_ENV+16: // Texture Environment 9 case BPMEM_TEV_ALPHA_ENV+16: - case BPMEM_TEV_COLOR_ENV+18: // Texture Environment 9 + case BPMEM_TEV_COLOR_ENV+18: // Texture Environment 10 case BPMEM_TEV_ALPHA_ENV+18: - case BPMEM_TEV_COLOR_ENV+20: // Texture Environment 10 + case BPMEM_TEV_COLOR_ENV+20: // Texture Environment 11 case BPMEM_TEV_ALPHA_ENV+20: - case BPMEM_TEV_COLOR_ENV+22: // Texture Environment 11 + case BPMEM_TEV_COLOR_ENV+22: // Texture Environment 12 case BPMEM_TEV_ALPHA_ENV+22: - case BPMEM_TEV_COLOR_ENV+24: // Texture Environment 12 + case BPMEM_TEV_COLOR_ENV+24: // Texture Environment 13 case BPMEM_TEV_ALPHA_ENV+24: - case BPMEM_TEV_COLOR_ENV+26: // Texture Environment 13 + case BPMEM_TEV_COLOR_ENV+26: // Texture Environment 14 case BPMEM_TEV_ALPHA_ENV+26: - case BPMEM_TEV_COLOR_ENV+28: // Texture Environment 14 + case BPMEM_TEV_COLOR_ENV+28: // Texture Environment 15 case BPMEM_TEV_ALPHA_ENV+28: - case BPMEM_TEV_COLOR_ENV+30: // Texture Environment 15 + case BPMEM_TEV_COLOR_ENV+30: // Texture Environment 16 case BPMEM_TEV_ALPHA_ENV+30: - case BPMEM_TEV_COLOR_ENV+32: // Texture Environment 16 - case BPMEM_TEV_ALPHA_ENV+32: break; default: WARN_LOG(VIDEO, "Unknown BP opcode: address = 0x%08x value = 0x%08x", bp.address, bp.newvalue); diff --git a/Source/Plugins/InputPluginCommon/Src/ConfigDiagBitmaps.cpp b/Source/Plugins/InputPluginCommon/Src/ConfigDiagBitmaps.cpp index 0bb5d3294c..4e422ad79d 100644 --- a/Source/Plugins/InputPluginCommon/Src/ConfigDiagBitmaps.cpp +++ b/Source/Plugins/InputPluginCommon/Src/ConfigDiagBitmaps.cpp @@ -204,7 +204,7 @@ void ConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event)) dc.DrawRectangle(n*12, 0, 14, 12); } - delete bitmasks; + delete[] bitmasks; } break;