Emuforums.com

Go Back   Emuforums.com > Gamecube Emulation > Dolphin Discussion
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
Old November 11th, 2008   #1 (permalink)
Registered User
 
Join Date: Aug 2008
Location: USA
Posts: 18
Those pesky bit fields

AKA: I fixed the Texture Coordinate 7 bug you didn't know you had.

Code:
Index: Plugin_VideoDX9/Src/VertexLoader.cpp
===================================================================
--- Plugin_VideoDX9/Src/VertexLoader.cpp	(revision 1109)
+++ Plugin_VideoDX9/Src/VertexLoader.cpp	(working copy)
@@ -198,9 +198,12 @@
 		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], 
Index: Plugin_VideoOGL/Src/VertexLoader.cpp
===================================================================
--- Plugin_VideoOGL/Src/VertexLoader.cpp	(revision 1109)
+++ Plugin_VideoOGL/Src/VertexLoader.cpp	(working copy)
@@ -187,9 +187,12 @@
 	}
 
 	// 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++) {
@@ -227,9 +230,12 @@
 	// Colors
 	const int col[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1};
 	// 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
 	const 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
 	};
 	
 	// Reset pipeline
Among the benefits of this fix: Zelda Wind Waker no longer crashes when you view the map.

Last edited by Maratanos; November 11th, 2008 at 02:58.. Reason: added OGL fix
Maratanos is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old November 11th, 2008   #2 (permalink)
Rockman fan
 
RockmanForte's Avatar
 
Join Date: May 2002
Location: Earth!
Posts: 5,098
Please let the developer know about it? Good job.

Anyway, what about picto box ? After you take a picture with the Picto box the game freezes, you know.
__________________
I have:

Wii: Starfall, Neogamma R8 beta 11, and currently on 3.2u
PSP PHAT: 1001k [TA-081] Custom Firmware 5.50 GEN-D2(FULL)

CASE: EagleTech Sidewinder Gaming Tower Case w/420W Power Supply Black
OS: Windows 7 Ultimate 64bit
CPU: Intel core 2 Duo Processor E8400 (2x 3.0GHz/6MB L2 Cache/1333FSB)
Processor Cooling: Thermaltake V1 CPU Cooling Fan System Kit Silent & Overclocking Proof
Graphics Card: NVIDIA GeForce 8800GT 512MB w/DVI + TV Out Video
Memory: 2048GB [1024GB X2] DDR2-800 PC6400 Memory Module Corsair-Value or Major Brand
Sound Card: 3D Premium Surround Sound Onboard
RockmanForte is offline   Reply With Quote
Old November 11th, 2008   #3 (permalink)
Registered User
 
Join Date: Aug 2008
Location: USA
Posts: 18
Yes, this is what we would call a "different bug".
Maratanos is offline   Reply With Quote
Old November 11th, 2008   #4 (permalink)
Rockman fan
 
RockmanForte's Avatar
 
Join Date: May 2002
Location: Earth!
Posts: 5,098
Awesome.

What about this:

Quote:
what about picto box ? After you take a picture with the Picto box the game freezes, you know.
Cheers.
__________________
I have:

Wii: Starfall, Neogamma R8 beta 11, and currently on 3.2u
PSP PHAT: 1001k [TA-081] Custom Firmware 5.50 GEN-D2(FULL)

CASE: EagleTech Sidewinder Gaming Tower Case w/420W Power Supply Black
OS: Windows 7 Ultimate 64bit
CPU: Intel core 2 Duo Processor E8400 (2x 3.0GHz/6MB L2 Cache/1333FSB)
Processor Cooling: Thermaltake V1 CPU Cooling Fan System Kit Silent & Overclocking Proof
Graphics Card: NVIDIA GeForce 8800GT 512MB w/DVI + TV Out Video
Memory: 2048GB [1024GB X2] DDR2-800 PC6400 Memory Module Corsair-Value or Major Brand
Sound Card: 3D Premium Surround Sound Onboard
RockmanForte is offline   Reply With Quote
Old November 11th, 2008   #5 (permalink)
Registered User
 
Join Date: Dec 2006
Location: ß
Posts: 432
nice bugfixin
__________________
AMD X2 5200+(65Watt)@3.2GHz | GTX280 | 4GB RAM | Vista Ultimate x64
shuffle2 is offline   Reply With Quote
Old November 11th, 2008   #6 (permalink)
Emu author
 
Join Date: May 2003
Posts: 417
Nicely spotted! Thanks!!!
ector is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 03:25.

© 2006 - 2008 Emu Forums | About Emu Forums | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.7.6
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5