From 1ceee92770ff9a69c7c145d715b0366f02691c3b Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Tue, 11 Nov 2008 04:44:41 +0000 Subject: [PATCH] Since m_VtxDesc.Text7Coord is broken across a 32 bit word boundary, retrieve its value manually. If we didn't do this, the vertex format would be read as one bit offset from where it should be, making 01 become 00, and 10/11 become 01. Among the benefits of this fix: Zelda Wind Waker no longer crashes when you view the map. see http://forums.ngemu.com/dolphin-discussion/114035-those-pesky-bit-fields.html git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1118 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp | 5 ++++- Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp index aaae5cc904..ed291aeb48 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp @@ -198,9 +198,12 @@ void VertexLoader::Setup() SetupColor(i,col[i], m_VtxAttr.color[i].Comp, m_VtxAttr.color[i].Elements); // TextureCoord + // Since m_VtxDesc.Text7Coord is broken across a 32 bit word boundary, retrieve its value manually. + // If we didn't do this, the vertex format would be read as one bit offset from where it should be, making + // 01 become 00, and 10/11 become 01 int tc[8] = { m_VtxDesc.Tex0Coord, m_VtxDesc.Tex1Coord, m_VtxDesc.Tex2Coord, m_VtxDesc.Tex3Coord, - m_VtxDesc.Tex4Coord, m_VtxDesc.Tex5Coord, m_VtxDesc.Tex6Coord, m_VtxDesc.Tex7Coord, + m_VtxDesc.Tex4Coord, m_VtxDesc.Tex5Coord, m_VtxDesc.Tex6Coord, (m_VtxDesc.Hex >> 31) & 3 }; for (int i = 0; i < 8; i++) SetupTexCoord(i, tc[i], diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp index 4ff74ae6cf..61b5cb35c9 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp @@ -187,9 +187,12 @@ int VertexLoader::ComputeVertexSize() } // TextureCoord + // Since m_VtxDesc.Text7Coord is broken across a 32 bit word boundary, retrieve its value manually. + // If we didn't do this, the vertex format would be read as one bit offset from where it should be, making + // 01 become 00, and 10/11 become 01 int tc[8] = { m_VtxDesc.Tex0Coord, m_VtxDesc.Tex1Coord, m_VtxDesc.Tex2Coord, m_VtxDesc.Tex3Coord, - m_VtxDesc.Tex4Coord, m_VtxDesc.Tex5Coord, m_VtxDesc.Tex6Coord, m_VtxDesc.Tex7Coord, + m_VtxDesc.Tex4Coord, m_VtxDesc.Tex5Coord, m_VtxDesc.Tex6Coord, (m_VtxDesc.Hex >> 31) & 3 }; for (int i = 0; i < 8; i++) {