[Scummvm-cvs-logs] SF.net SVN: scummvm: [25617] scummvm/trunk/backends/platform/ds/arm9/source

agent-q at users.sourceforge.net agent-q at users.sourceforge.net
Fri Feb 16 00:23:06 CET 2007


Revision: 25617
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25617&view=rev
Author:   agent-q
Date:     2007-02-15 15:23:03 -0800 (Thu, 15 Feb 2007)

Log Message:
-----------
Changes made for 0.9.1a beta2 release backported to trunk

Modified Paths:
--------------
    scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.c
    scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.h
    scummvm/trunk/backends/platform/ds/arm9/source/fat/io_dldi.h
    scummvm/trunk/backends/platform/ds/arm9/source/fat/io_dldi.s

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2007-02-15 23:12:33 UTC (rev 25616)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2007-02-15 23:23:03 UTC (rev 25617)
@@ -44,6 +44,7 @@
 // - 100% scale
 
 #define USE_LIBCARTRESET
+//#define USE_BUILT_IN_DRIVER_SELECTION
 
 #include <nds.h>
 
@@ -1995,19 +1996,21 @@
 
 bool GBAMPAvail = false;
 
-void initGBAMP(int mode) {	
+bool initGBAMP(int mode) {	
 	if (FAT_InitFiles()) {
 		if (mode == 2)	{
 			disc_IsInserted();
 		}
 		GBAMPAvail = true;
-		consolePrintf("Found flash card reader!\n");
+//		consolePrintf("Found flash card reader!\n");
+		return true;
 	} else {
 		GBAMPAvail = false;
-		consolePrintf("Flash card reader not found!\n");
+//		consolePrintf("Flash card reader not found!\n");
+		return false;
 	}
 }
-	 
+
 bool isGBAMPAvailable() {
 	return GBAMPAvail;
 }
@@ -2038,46 +2041,52 @@
 #endif
 
 #ifdef USE_LIBCARTRESET
+
+struct cardTranslate {
+	int cartResetId;
+	int svmId;
+	char dldiId[5];
+};
+
+#define NUM_CARD_READERS 7
+
+cardTranslate cardReaderTable[] = {
+	{DEVICE_TYPE_M3SD,		DEVICE_M3SD,	"M3SD"},
+	{DEVICE_TYPE_M3CF,		DEVICE_M3CF,	"M3CF"},
+	{DEVICE_TYPE_MPCF,		DEVICE_MPCF,	"MPCF"},
+	{DEVICE_TYPE_SCCF,		DEVICE_SCCF,	"SCCF"},
+	{DEVICE_TYPE_SCSD,		DEVICE_SCSD,	"SCSD"},
+	{DEVICE_TYPE_SCSD,		DEVICE_SCSD,	"SCLT"},
+	{DEVICE_TYPE_NMMC,		DEVICE_NMMC,	"NMMC"},
+};
+
 void reboot() {
 	int deviceType = -1;
 
-	switch (disc_getDeviceId()) {
-		case DEVICE_M3SD: {
-			deviceType = DEVICE_TYPE_M3SD;
-			break;
+	
+	if (disc_getDeviceId() == DEVICE_DLDI) {
+
+		char id[6];
+		disc_getDldiId(id);
+
+		consolePrintf("DLDI Device ID: %s\n", id);
+
+		for (int r = 0; r < NUM_CARD_READERS; r++) {
+			if (!stricmp(id, cardReaderTable[r].dldiId)) {
+				deviceType = cardReaderTable[r].cartResetId;
+			}
 		}
-		case DEVICE_MMCF: {
-			deviceType = -1;
-			break;
+	} else {
+		for (int r = 0; r < NUM_CARD_READERS; r++) {
+			if (disc_getDeviceId() == cardReaderTable[r].svmId) {
+				deviceType = cardReaderTable[r].cartResetId;
+			}
 		}
-		case DEVICE_M3CF: {
-			deviceType = DEVICE_TYPE_M3CF;
-			break;
-		}
-		case DEVICE_MPCF: {
-			deviceType = DEVICE_TYPE_MPCF;
-			break;
-		}
-		case DEVICE_SCCF: {
-			deviceType = DEVICE_TYPE_SCCF;
-			break;
-		}
-		case DEVICE_NJSD: {
-			deviceType = -1;
-			break;
-		}
-		case DEVICE_SCSD: {
-			deviceType = DEVICE_TYPE_SCSD;
-			break;
-		}
-		case DEVICE_NMMC: {
-			deviceType = DEVICE_TYPE_NMMC;
-			break;
-		}
 	}
 
-	consolePrintf("Device: %x\n", deviceType);
 
+	consolePrintf("Device number: %x\n", deviceType);
+
 	if (deviceType == -1) {
 		IPC->reset = true;				// Send message to ARM7 to turn power off
 	} else {
@@ -2202,35 +2211,36 @@
 	
 
 	
-	consolePrintf("---------------------------\n");
+	consolePrintf("-------------------------------\n");
 	consolePrintf("ScummVM DS\n");
 	consolePrintf("Ported by Neil Millstone\n");
 	consolePrintf("Version 0.10.0SVN ");
 #if defined(DS_BUILD_A)
 	consolePrintf("build A\n");
 	consolePrintf("Supports: Lucasarts SCUMM\n");
-	consolePrintf("---------------------------\n");
+	consolePrintf("-------------------------------\n");
 #elif defined(DS_BUILD_B)
 	consolePrintf("build B\n");
 	consolePrintf("Supports: BASS, QUEEN\n");
-	consolePrintf("---------------------------\n");
+	consolePrintf("-------------------------------\n");
 #elif defined(DS_BUILD_C)
 	consolePrintf("build C\n");
-	consolePrintf("---------------------------\n");
 	consolePrintf("Supports: SIMON, KYRA, GOB\n");
+	consolePrintf("-------------------------------\n");
 #endif
-	consolePrintf("L/R + D-pad/pen: Scroll view\n");
-	consolePrintf("D-pad left:  Left mouse button\n");
+	consolePrintf("L/R + D-pad/pen:    Scroll view\n");
+	consolePrintf("D-pad left:   Left mouse button\n");
 	consolePrintf("D-pad right: Right mouse button\n");
-	consolePrintf("D-pad up:    Hover mouse\n");
-	consolePrintf("B button:    Skip cutscenes\n");
-	consolePrintf("Select:		DS Options menu\n");
-	consolePrintf("Start:       Game menu\n");
-	consolePrintf("Y (in game): Toggle console\n");
-	consolePrintf("X:           Toggle keyboard\n");
-	consolePrintf("A:			Swap screens\n");
-	consolePrintf("L+R (on start): Clear SRAM\n");
+	consolePrintf("D-pad up:           Hover mouse\n");
+	consolePrintf("B button:        Skip cutscenes\n");
+	consolePrintf("Select:		   DS Options menu\n");
+	consolePrintf("Start:   Game menu (some games)\n");
+	consolePrintf("Y (in game):     Toggle console\n");
+	consolePrintf("X:              Toggle keyboard\n");
+	consolePrintf("A:                 Swap screens\n");
+	consolePrintf("L+R (on start):      Clear SRAM\n");
 
+
 #if defined(DS_BUILD_A)
 	consolePrintf("For a complete key list see the\n");
 	consolePrintf("help screen.\n\n");
@@ -2239,6 +2249,7 @@
 #endif
 
 	
+#ifdef USE_BUILT_IN_DRIVER_SELECTION
 	// Do M3 detection selectioon
 	int extraData = DSSaveFileManager::getExtraData();
 	bool present = DSSaveFileManager::isExtraDataPresent();
@@ -2275,8 +2286,13 @@
 
 	disc_setEnable(mode);
 	DSSaveFileManager::setExtraData(mode);
+#else
+	
+	int mode = 0;
 
+#endif
 
+
 /*
 	if ((present) && (extraData & 0x00000001)) {
 
@@ -2306,6 +2322,14 @@
 	if (!node->getZip() || (!node->getZip()->isReady())) {
 		// If not found, init CF/SD driver
 		initGBAMP(mode);
+
+		if (!initGBAMP(mode)) {
+			consolePrintf("\nNo file system was found.\n");
+			consolePrintf("View the README_DLDI.TXT file\n");
+			consolePrintf("for more information.\n");
+
+			while (1);
+		}
 	}
 	delete node;
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.c
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.c	2007-02-15 23:12:33 UTC (rev 25616)
+++ scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.c	2007-02-15 23:23:03 UTC (rev 25617)
@@ -92,6 +92,8 @@
 */
 int discDetect = 0;
 
+int dldiFound = FALSE;
+
 #ifdef DISC_CACHE
 
 #include <string.h>
@@ -339,6 +341,15 @@
 	return currentDevice;
 }
 
+void disc_getDldiId(char* id) {
+	char* driverId = (char *) &_io_dldi;
+	id[0] = driverId[0];
+	id[1] = driverId[1];
+	id[2] = driverId[2];
+	id[3] = driverId[3];
+	id[4] = '\0';
+}
+
 #ifdef NDS
 // Check the DS card slot for a valid memory card interface
 // If an interface is found, it is set as the default interace
@@ -355,6 +366,17 @@
 
 	active_interface = DLDI_GetInterface();
 
+	if (stricmp(&_dldi_driver_name, "Default (No interface)")) {
+		char name[48];
+		memcpy(name, &_dldi_driver_name, 48);
+		name[47] = '\0';
+		consolePrintf("DLDI Device:\n'%s'\n", name);
+		dldiFound = TRUE;
+	} else {
+		consolePrintf("DLDI Driver not patched!\n");
+		dldiFound = FALSE;
+	}
+
 	if (active_interface->fn_StartUp()) {
 		consolePrintf("DLDI Driver Initialised OK!\n");
 		currentDevice = DEVICE_DLDI;

Modified: scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.h	2007-02-15 23:12:33 UTC (rev 25616)
+++ scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.h	2007-02-15 23:23:03 UTC (rev 25617)
@@ -105,6 +105,7 @@
 
 extern void disc_setEnable(int en);
 extern FATDevice disc_getDeviceId();
+void disc_getDldiId(char* id);
 
 /*-----------------------------------------------------------------
 disc_ReadSectors

Modified: scummvm/trunk/backends/platform/ds/arm9/source/fat/io_dldi.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/fat/io_dldi.h	2007-02-15 23:12:33 UTC (rev 25616)
+++ scummvm/trunk/backends/platform/ds/arm9/source/fat/io_dldi.h	2007-02-15 23:23:03 UTC (rev 25617)
@@ -23,6 +23,8 @@
 
 extern IO_INTERFACE _io_dldi;
 
+extern u8 _dldi_driver_name;
+
 // export interface
 static inline LPIO_INTERFACE DLDI_GetInterface(void) {
 #ifdef NDS

Modified: scummvm/trunk/backends/platform/ds/arm9/source/fat/io_dldi.s
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/fat/io_dldi.s	2007-02-15 23:12:33 UTC (rev 25616)
+++ scummvm/trunk/backends/platform/ds/arm9/source/fat/io_dldi.s	2007-02-15 23:23:03 UTC (rev 25617)
@@ -2,6 +2,7 @@
 	.align	4
 	.arm
 	.global _io_dldi
+	.global _dldi_driver_name
 @---------------------------------------------------------------------------------
 .equ FEATURE_MEDIUM_CANREAD,		0x00000001
 .equ FEATURE_MEDIUM_CANWRITE,		0x00000002
@@ -21,6 +22,7 @@
 @---------------------------------------------------------------------------------
 @ Text identifier - can be anything up to 47 chars + terminating null -- 16 bytes
 	.align	4
+_dldi_driver_name:
 	.asciz "Default (No interface)"
 
 @---------------------------------------------------------------------------------


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