From 8949c1e30949cfe8736ee59b19b31cf378fae20d Mon Sep 17 00:00:00 2001 From: Soren Jorvang Date: Wed, 26 May 2010 21:03:42 +0000 Subject: [PATCH] If the format is not one of the expected ones, just return rather than proceeding with uninitialized data. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5495 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp | 3 +++ Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp | 5 +++++ Source/Plugins/Plugin_VideoSoftware/Src/TransformUnit.cpp | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp index a4f8904fbe..cb0895dd89 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp @@ -538,6 +538,9 @@ void CCodeWindow::OnToggleDLLWindow(int Id, bool _Show, int i) PLUGINTYPE = PLUGIN_TYPE_VIDEO; Title = wxT("Video"); break; + default: + PanicAlert("CCodeWindow::OnToggleDLLWindow"); + return; } if (_Show) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp index 00594ea3cf..2ba9f38c11 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp @@ -516,6 +516,9 @@ void Tev::Indirect(unsigned int stageNum, s32 s, s32 t) indcoord[2] = (indmap[GRN_C] & 0x07) + bias[2]; AlphaBump = AlphaBump & 0xf8; break; + default: + PanicAlert("Tev::Indirect"); + return; } s64 indtevtrans[2] = { 0,0 }; @@ -547,6 +550,8 @@ void Tev::Indirect(unsigned int stageNum, s32 s, s32 t) indtevtrans[0] = s * indcoord[1]; indtevtrans[1] = t * indcoord[1]; break; + default: + return; } indtevtrans[0] = shift >= 0 ? indtevtrans[0] >> shift : indtevtrans[0] << -shift; diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/TransformUnit.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/TransformUnit.cpp index c8bf7648bb..3ae2e456a1 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/TransformUnit.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/TransformUnit.cpp @@ -259,6 +259,9 @@ void LightColor(const Vec3 &pos, const Vec3 &normal, u8 lightNum, const LitChann float cosAtt = max(0.0f, light->cosatt * ldir); float distAtt = light->distatt * ldir; attn = SafeDivide(max(0.0f, cosAtt), distAtt); + } else { + PanicAlert("LightColor"); + return; } switch (chan.diffusefunc) { @@ -324,7 +327,7 @@ void LightAlpha(const Vec3 &pos, const Vec3 &normal, u8 lightNum, const LitChann float distAtt = light->distatt.x + (light->distatt.y * dist) + (light->distatt.z * dist2); attn = SafeDivide(max(0.0f, cosAtt), distAtt); } - else if (chan.attnfunc == 1) { // specular + else /* if (chan.attnfunc == 1) */ { // specular // donko - what is going on here? 655.36 is a guess but seems about right. attn = (light->pos * normal) > -655.36 ? max(0.0f, (light->dir * normal)) : 0; ldir.set(1.0f, attn, attn * attn);