[Scummvm-cvs-logs] SF.net SVN: scummvm:[34204] scummvm/branches/branch-0-12-0/backends

agent-q at users.sourceforge.net agent-q at users.sourceforge.net
Fri Aug 29 23:57:18 CEST 2008


Revision: 34204
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34204&view=rev
Author:   agent-q
Date:     2008-08-29 21:57:15 +0000 (Fri, 29 Aug 2008)

Log Message:
-----------
DS: Fix Lure crash and ITE crash

Modified Paths:
--------------
    scummvm/branches/branch-0-12-0/backends/fs/ds/ds-fs.cpp
    scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/makefile
    scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/dsmain.cpp
    scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/osystem_ds.cpp
    scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/osystem_ds.h
    scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/ramsave.cpp
    scummvm/branches/branch-0-12-0/backends/platform/ds/makefile

Modified: scummvm/branches/branch-0-12-0/backends/fs/ds/ds-fs.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/backends/fs/ds/ds-fs.cpp	2008-08-29 21:10:10 UTC (rev 34203)
+++ scummvm/branches/branch-0-12-0/backends/fs/ds/ds-fs.cpp	2008-08-29 21:57:15 UTC (rev 34204)
@@ -399,6 +399,7 @@
 	if (DS::isGBAMPAvailable()) {
 		FAT_chdir("/");
 
+		// Turn all back slashes into forward slashes for gba_nds_fat
 		char* p = realName;
 		while (*p) {
 			if (*p == '\\') *p = '/';
@@ -424,6 +425,7 @@
 	int r = 0;
 	while (handle[r].used) r++;
 
+#ifdef GBA_SRAM_SAVE
 	if (strchr(mode, 'w')) {
 //		consolePrintf("Writing %s\n", realName);
 		handle[r].sramFile = (DSSaveFile *) DSSaveFileManager::instance()->openSavefile(realName, true);
@@ -431,6 +433,7 @@
 //		consolePrintf("Reading %s\n", realName);
 		handle[r].sramFile = (DSSaveFile *) DSSaveFileManager::instance()->openSavefile(realName, false);
 	}
+#endif
 
 	if (handle[r].sramFile) {
 		handle[r].used = true;

Modified: scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/makefile
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/makefile	2008-08-29 21:10:10 UTC (rev 34203)
+++ scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/makefile	2008-08-29 21:57:15 UTC (rev 34204)
@@ -8,25 +8,29 @@
 # Select the build by setting SCUMM_BUILD to a,b,c,d,e,f or g.
 # Anything else gets build a.
 
-ifeq ($(SCUMM_BUILD),g)
+ifeq ($(SCUMM_BUILD),h)
+        DS_BUILD_H = 1
+ else
+ ifeq ($(SCUMM_BUILD),g)
         DS_BUILD_G = 1
-else
- ifeq ($(SCUMM_BUILD),f)
+  else
+  ifeq ($(SCUMM_BUILD),f)
         DS_BUILD_F = 1
- else
-  ifeq ($(SCUMM_BUILD),e)
+  else
+   ifeq ($(SCUMM_BUILD),e)
         DS_BUILD_E = 1
-  else
-   ifeq ($(SCUMM_BUILD),d)
+   else
+    ifeq ($(SCUMM_BUILD),d)
         DS_BUILD_D = 1
-   else
-    ifeq ($(SCUMM_BUILD),c)
+    else
+     ifeq ($(SCUMM_BUILD),c)
         DS_BUILD_C = 1
-    else
-     ifeq ($(SCUMM_BUILD),b)
+     else
+      ifeq ($(SCUMM_BUILD),b)
         DS_BUILD_B = 1
-     else
+      else
         DS_BUILD_A = 1
+      endif
      endif
     endif
    endif
@@ -132,12 +136,18 @@
 ifdef DS_BUILD_G
 	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_G
 	LOGO = logog.bmp
-	ENABLE_PARALLACTION = STATIC_PLUGIN
 	ENABLE_LURE = STATIC_PLUGIN
 	BUILD=scummvm-G
 endif
 
+ifdef DS_BUILD_H
+	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_H
+	LOGO = logog.bmp
+	ENABLE_PARALLACTION = STATIC_PLUGIN
+	BUILD=scummvm-H
+endif
 
+
 ARM7BIN	:= -7 $(CURDIR)/../../arm7/arm7.bin
 ICON		:= -b ../../../logo.bmp "ScummVM;By Neil Millstone;"
 
@@ -147,8 +157,9 @@
 CFLAGS	=	-Wno-multichar -Wall\
 		-Wno-multichar -mcpu=arm9tdmi -mtune=arm9tdmi \
 		-mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer\
-		-mthumb-interwork -DUSE_ARM_COSTUME_ASM=1 -D$(BUILD)
+		-mthumb-interwork -DUSE_ARM_COSTUME_ASM=1 -g -D$(BUILD)
 
+
 # -ffast-math 
 
 ifdef USE_DEBUGGER
@@ -234,7 +245,8 @@
 DATA_OBJS := $(portdir)/data/icons.o $(portdir)/data/keyboard.o $(portdir)/data/keyboard_pal.o $(portdir)/data/default_font.o $(portdir)/data/8x8font_tga.o
 
 
-COMPRESSOR_OBJS := $(portdir)/source/compressor/lz.o
+COMPRESSOR_OBJS := 
+#$(portdir)/source/compressor/lz.o
 
 FAT_OBJS :=  $(portdir)/source/fat/disc_io.o $(portdir)/source/fat/gba_nds_fat.o\
 			$(portdir)/source/fat/io_fcsr.o $(portdir)/source/fat/io_m3cf.o\
@@ -254,7 +266,8 @@
 #			$(portdir)/source/fat/io_sd_common.o $(portdir)/source/fat/io_scsd_s.o \
 #			$(portdir)/source/fat/io_sc_common.o $(portdir)/source/fat/io_sd_common.o
 
-LIBCARTRESET_OBJS := $(portdir)/source/libcartreset/cartreset.o
+LIBCARTRESET_OBJS := 
+#$(portdir)/source/libcartreset/cartreset.o
 
 # Files in this list will be optimisied for speed, otherwise they will be optimised for space
 OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp fmopl.cpp rate.cpp mixer.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp

Modified: scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/dsmain.cpp	2008-08-29 21:10:10 UTC (rev 34203)
+++ scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/dsmain.cpp	2008-08-29 21:57:15 UTC (rev 34204)
@@ -95,7 +95,28 @@
 #include "profiler/cyg-profile.h"
 #endif
 #include "backends/fs/ds/ds-fs.h"
+#include "arm9/exceptions.h"
 
+extern "C" u32 getExceptionAddress( u32 opcodeAddress, u32 thumbState);
+extern const char __itcm_start[];
+static const char *registerNames[] =
+	{	"r0","r1","r2","r3","r4","r5","r6","r7",
+		"r8 ","r9 ","r10","r11","r12","sp ","lr ","pc " };
+
+/*
+extern "C" void* __real_malloc(size_t size);
+
+extern "C" void* __wrap_malloc(size_t size) {
+	void* res = __real_malloc(size);
+	if (res) {
+		return res;
+	} else {
+		consolePrintf("Failed alloc %d\n", size);
+		return NULL;
+	}
+}
+*/
+
 namespace DS {
 
 // From console.c in NDSLib
@@ -2638,6 +2659,8 @@
 	return v;
 }
 
+#ifdef GBA_SRAM_SAVE
+
 void formatSramOption() {
 	consolePrintf("The following files are present in save RAM:\n");
 	DSSaveFileManager::instance()->listFiles();
@@ -2659,8 +2682,8 @@
 		}
 	}
 }
+#endif
 
-
 void setIndyFightState(bool st) {
 	indyFightState = st;
 	indyFightRight = true;
@@ -2834,13 +2857,70 @@
 /////////////////
 
 
+
+void dsExceptionHandler()
+{
+	consolePrintf("Blue screen of death");
+	setExceptionHandler(NULL);
+
+	
+	u32	currentMode = getCPSR() & 0x1f;
+	u32 thumbState = ((*(u32*)0x027FFD90) & 0x20);
+
+	u32 codeAddress, exceptionAddress = 0;
+
+	int offset = 8;
+
+	if ( currentMode == 0x17 ) {
+		consolePrintf("\x1b[10Cdata abort!\n\n");
+		codeAddress = exceptionRegisters[15] - offset;
+		if (	(codeAddress > 0x02000000 && codeAddress < 0x02400000) ||
+				(codeAddress > (u32)__itcm_start && codeAddress < (u32)(__itcm_start + 32768)) )
+			exceptionAddress = getExceptionAddress( codeAddress, thumbState);
+		else
+			exceptionAddress = codeAddress;
+			
+	} else {
+		if (thumbState)
+			offset = 2;
+		else
+			offset = 4;
+		consolePrintf("\x1b[5Cundefined instruction!\n\n");
+		codeAddress = exceptionRegisters[15] - offset;
+		exceptionAddress = codeAddress;
+	}
+
+	consolePrintf("  pc: %08X addr: %08X\n\n",codeAddress,exceptionAddress);
+
+	int i;
+	for ( i=0; i < 8; i++ ) {
+		consolePrintf(	"  %s: %08X   %s: %08X\n",
+					registerNames[i], exceptionRegisters[i],
+					registerNames[i+8],exceptionRegisters[i+8]);
+	}
+//	u32 *stack = (u32 *)exceptionRegisters[13];
+//	for ( i=0; i<10; i++ ) {
+//		consolePrintf( "\x1b[%d;2H%08X: %08X %08X", i + 14, (u32)&stack[i*2],stack[i*2], stack[(i*2)+1] );
+//	}
+
+	memoryReport();
+
+	while(1);
+}
+
+
+
+
 int main(void)
 {
 
 	soundCallback = NULL;
 
+
+
 	initHardware();
 
+	setExceptionHandler(dsExceptionHandler);
 
 #ifdef USE_DEBUGGER
 	for (int r = 0; r < 150; r++) {
@@ -2924,7 +3004,7 @@
 	consolePrintf("-------------------------------\n");
 	consolePrintf("ScummVM DS\n");
 	consolePrintf("Ported by Neil Millstone\n");
-	consolePrintf("Version 0.12.0 ");
+	consolePrintf("Version 0.12.0 beta4 ");
 #if defined(DS_BUILD_A)
 	consolePrintf("build A\n");
 	consolePrintf("Lucasarts SCUMM games (SCUMM)\n");
@@ -2951,8 +3031,12 @@
 	consolePrintf("-------------------------------\n");
 #elif defined(DS_BUILD_G)
 	consolePrintf("build G\n");
-	consolePrintf("PARALLATION, LURE\n");
+	consolePrintf("Lure of the Tempress (LURE)\n");
 	consolePrintf("-------------------------------\n");
+#elif defined(DS_BUILD_H)
+	consolePrintf("build H\n");
+	consolePrintf("Nippon Safes (PARALLATION)\n");
+	consolePrintf("-------------------------------\n");
 #endif
 	consolePrintf("L/R + D-pad/pen:    Scroll view\n");
 	consolePrintf("D-pad left:   Left mouse button\n");
@@ -3069,9 +3153,11 @@
 	g_system = new OSystem_DS();
 	assert(g_system);
 
+#ifdef GBA_SRAM_SAVE
 	if ((keysHeld() & KEY_L) && (keysHeld() & KEY_R)) {
 		formatSramOption();
 	}
+#endif
 
 	IPC->adpcm.semaphore = false;
 
@@ -3092,6 +3178,8 @@
 	const char *argv[] = {"/scummvmds", "--config=scummvmf.ini"};
 #elif defined(DS_BUILD_G)
 	const char *argv[] = {"/scummvmds", "--config=scummvmg.ini"};
+#elif defined(DS_BUILD_H)
+	const char *argv[] = {"/scummvmds", "--config=scummvmh.ini"};
 #endif
 
 	while (1) {

Modified: scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/osystem_ds.cpp	2008-08-29 21:10:10 UTC (rev 34203)
+++ scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/osystem_ds.cpp	2008-08-29 21:57:15 UTC (rev 34204)
@@ -143,6 +143,8 @@
 }
 
 void OSystem_DS::setPalette(const byte *colors, uint start, uint num) {
+//	consolePrintf("Setpal %d, %d\n", start, num);
+
 	for (unsigned int r = start; r < start + num; r++) {
 		int red = *colors;
 		int green = *(colors + 1);
@@ -298,7 +300,7 @@
 			if (pixelsLeft != 0) {
 				u16 mix = *dest16;
 
-				mix = (mix & 0xFF00) | (*src++);
+				mix = (mix & 0x00FF) | ((*src++) << 8);
 
 				*dest16 = mix;
 				*destSub16 = mix;
@@ -631,7 +633,11 @@
 	if (DS::isGBAMPAvailable() && (!forceSram)) {
 		return &mpSaveManager;
 	} else {
+#ifdef GBA_SRAM_SAVE
 		return &saveManager;
+#else
+		return NULL;
+#endif
 	}
 }
 

Modified: scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/osystem_ds.h
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/osystem_ds.h	2008-08-29 21:10:10 UTC (rev 34203)
+++ scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/osystem_ds.h	2008-08-29 21:57:15 UTC (rev 34204)
@@ -52,7 +52,9 @@
 	Common::Event eventQueue[96];
 	int queuePos;
 	
+#ifdef GBA_SRAM_SAVE
 	DSSaveFileManager saveManager;
+#endif
 	GBAMPSaveFileManager mpSaveManager;
 	DSAudioMixer* _mixer;
 	DSTimerManager* _timer;

Modified: scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/ramsave.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/ramsave.cpp	2008-08-29 21:10:10 UTC (rev 34203)
+++ scummvm/branches/branch-0-12-0/backends/platform/ds/arm9/source/ramsave.cpp	2008-08-29 21:57:15 UTC (rev 34204)
@@ -19,7 +19,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  * 
  */
- // Save in order 1,2,3,4,larger 2,5
+#ifdef GBA_SRAM_SAVE
+
+
 #include "ramsave.h"
 #include "nds.h"
 #include "compressor/lz.h"
@@ -27,6 +29,7 @@
 #define CART_RAM ((vu8 *) (0x0A000000))
 #define SRAM_SAVE_MAX (65533)
 
+
 DSSaveFile::DSSaveFile() {
 	ptr = 0;
 	saveCompressed = false;
@@ -522,3 +525,5 @@
 		return 0;
 	}
 }
+
+#endif

Modified: scummvm/branches/branch-0-12-0/backends/platform/ds/makefile
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ds/makefile	2008-08-29 21:10:10 UTC (rev 34203)
+++ scummvm/branches/branch-0-12-0/backends/platform/ds/makefile	2008-08-29 21:57:15 UTC (rev 34204)
@@ -36,6 +36,8 @@
 	make all       SCUMM_BUILD=f
 	make semiclean
 	make all       SCUMM_BUILD=g
+	make semiclean
+	make all       SCUMM_BUILD=h
 
 allbuildssafe:
 	make clean     SCUMM_BUILD=a
@@ -52,3 +54,5 @@
 	make all       SCUMM_BUILD=f
 	make clean     SCUMM_BUILD=g
 	make all       SCUMM_BUILD=g
+	make clean     SCUMM_BUILD=h
+	make all       SCUMM_BUILD=h


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