[Scummvm-cvs-logs] SF.net SVN: scummvm: [30925] scummvm/branches/branch-0-11-0/backends/ platform/ds/arm9/source/fat/disc_io.c

agent-q at users.sourceforge.net agent-q at users.sourceforge.net
Sat Feb 23 15:52:57 CET 2008


Revision: 30925
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30925&view=rev
Author:   agent-q
Date:     2008-02-23 06:52:57 -0800 (Sat, 23 Feb 2008)

Log Message:
-----------
DS: Adding workaround for buggy DLDI drivers

Modified Paths:
--------------
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/fat/disc_io.c

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/fat/disc_io.c
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/fat/disc_io.c	2008-02-23 14:42:46 UTC (rev 30924)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/fat/disc_io.c	2008-02-23 14:52:57 UTC (rev 30925)
@@ -499,8 +499,36 @@
 #ifdef DISC_CACHE
 	disc_CacheInit();
 #endif
+
+#define MISALIGNMENT_BODGE
+
+#ifdef MISALIGNMENT_BODGE
+	// This bodge works around problems with some card reader drivers which require data to be
+	// aligned to 2- or 4-byte boundaries it varies which one they require.  This bodge sorts
+	// it but also reduces write speed as it doesn't use the multi-sector write capability any
+	// more.  A better fix will be written for a future version.
+
+	if (active_interface) {
+		u8 sectorBuffer[512];
+		int r;
+
+		for (r = 0; r < numSecs; r++) {
+			memcpy(sectorBuffer, &buffer[r * 512], 512);
+
+			if (!active_interface->fn_WriteSectors(sector + r, 1, sectorBuffer))
+			{
+				return false;
+			}
+		}
+		
+
+		return true;
+	}
+
+#else
 	if (active_interface) return active_interface->fn_WriteSectors(sector,numSecs,buffer) ;
 	return false ;
+#endif
 //#endif
 } 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list