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

agent-q at users.sourceforge.net agent-q at users.sourceforge.net
Sat Oct 13 17:40:11 CEST 2007


Revision: 29203
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29203&view=rev
Author:   agent-q
Date:     2007-10-13 08:40:11 -0700 (Sat, 13 Oct 2007)

Log Message:
-----------
Fixed a huge number of compile errors, moved over features from 0.10.0 branch.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/ds/arm9/makefile
    scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h
    scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.h
    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/gbampsave.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.h
    scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
    scummvm/trunk/backends/platform/ds/arm9/source/portdefs.h
    scummvm/trunk/backends/platform/ds/arm9/source/ramsave.h
    scummvm/trunk/backends/platform/ds/arm9/source/scummconsole.h
    scummvm/trunk/backends/platform/ds/arm9/source/scummhelp.h
    scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.h
    scummvm/trunk/backends/platform/ds/logoa.bmp
    scummvm/trunk/backends/platform/ds/logob.bmp
    scummvm/trunk/backends/platform/ds/logoc.bmp

Added Paths:
-----------
    scummvm/trunk/backends/platform/ds/arm9/data/8x8font.tga
    scummvm/trunk/backends/platform/ds/arm9/data/8x8font_tga.raw
    scummvm/trunk/backends/platform/ds/arm9/source/blitters_arm.s
    scummvm/trunk/backends/platform/ds/logod.bmp
    scummvm/trunk/backends/platform/ds/logoe.bmp
    scummvm/trunk/backends/platform/ds/logof.bmp

Copied: scummvm/trunk/backends/platform/ds/arm9/data/8x8font.tga (from rev 28656, scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/data/8x8font.tga)
===================================================================
(Binary files differ)

Copied: scummvm/trunk/backends/platform/ds/arm9/data/8x8font_tga.raw (from rev 28656, scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/data/8x8font_tga.raw)
===================================================================
(Binary files differ)

Modified: scummvm/trunk/backends/platform/ds/arm9/makefile
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/makefile	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/makefile	2007-10-13 15:40:11 UTC (rev 29203)
@@ -11,8 +11,6 @@
 #DS_BUILD_D = 1
 #DS_BUILD_E = 1
 #DS_BUILD_F = 1
-#DS_BUILD_E = 1
-#DS_BUILD_F = 1
 
 # Uncomment the following line to build in support for MP3 audio
 # using libmad:
@@ -21,8 +19,15 @@
 	# TODO: Fix this.  When libmad is compiled in, the Kyrandia resource loading
 	# searches through it's entire index to find an mp3 each time a voice sample is requested
 	# this causes a nasty pause.
-else
-	USE_MAD = 1
+else 
+	ifdef DS_BUILD_E
+	# TODO: Inherit the earth uses so much RAM that I have removed libmad in order to
+	# claw some back.	
+
+
+	else
+		USE_MAD = 1
+	endif
 endif
 
 # Uncomment the following line to enable support for the
@@ -64,6 +69,8 @@
 	DISABLE_PARALLACTION = 1
 	DISABLE_CRUISE = 1
 	USE_ARM_GFX_ASM = 1
+	DISABLE_CRUISE = 1
+	DISABLE_DRASCULA = 1
 	BUILD=scummvm-A
 endif
 
@@ -87,6 +94,7 @@
 	DISABLE_TOUCHE = 1
 	DISABLE_PARALLACTION = 1
 	DISABLE_CRUISE = 1
+	DISABLE_DRASCULA = 1
 	BUILD=scummvm-B
 endif
 
@@ -110,12 +118,13 @@
 	DISABLE_TOUCHE = 1
 	DISABLE_PARALLACTION = 1
 	DISABLE_CRUISE = 1
+	DISABLE_DRASCULA = 1
 	BUILD=scummvm-C
 endif
 
 ifdef DS_BUILD_D
 	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_D
-	LOGO = logoc.bmp
+	LOGO = logod.bmp
 	DISABLE_HE = 1
 	DISABLE_SCUMM = 1
 	DISABLE_SCUMM_7_8 = 1
@@ -133,12 +142,14 @@
 	DISABLE_TOUCHE = 1
 	DISABLE_PARALLACTION = 1
 	DISABLE_CRUISE = 1
+	DISABLE_DRASCULA = 1
 	BUILD=scummvm-D
 endif
 
+
 ifdef DS_BUILD_E
 	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_E
-	LOGO = logoc.bmp
+	LOGO = logoe.bmp
 	DISABLE_HE = 1
 	DISABLE_SCUMM = 1
 	DISABLE_SCUMM_7_8 = 1
@@ -156,12 +167,14 @@
 	DISABLE_TOUCHE = 1
 	DISABLE_PARALLACTION = 1
 	DISABLE_CRUISE = 1
+	DISABLE_DRASCULA = 1
 	BUILD=scummvm-E
 endif
 
+
 ifdef DS_BUILD_F
 	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_F
-	LOGO = logoc.bmp
+	LOGO = logof.bmp
 	DISABLE_HE = 1
 	DISABLE_SCUMM = 1
 	DISABLE_SCUMM_7_8 = 1
@@ -179,6 +192,7 @@
 	DISABLE_TOUCHE = 1
 	DISABLE_PARALLACTION = 1
 	DISABLE_CRUISE = 1
+	DISABLE_DRASCULA = 1
 	BUILD=scummvm-F
 
 endif
@@ -219,7 +233,7 @@
 INCLUDES= -I./ -I$(portdir)/$(BUILD) -I$(srcdir) -I$(srcdir)/common -I$(portdir)/source -I$(portdir)/source/compressor -I$(portdir)/source/fat \
 			-I$(srcdir)/backends/fs  -I$(srcdir)/backends/fs/ds -I$(portdir)/data -I$(libndsdir)/include -I$(portdir)/../commoninclude\
 			-I$(srcdir)/scumm -I$(libndsdir)/include -I$(libndsdir)/include/nds -I$(srcdir)/engines -I$(portdir)/source/mad\
-			-I$(portdir)/source/libcartreset
+			-I$(portdir)/source/libcartreset -include $(srcdir)/common/scummsys.h
 			
 
 LIBS	= -lm -L$(libndsdir)/lib -L$(portdir)/lib -lnds9

Copied: scummvm/trunk/backends/platform/ds/arm9/source/blitters_arm.s (from rev 28656, scummvm/branches/branch-0-10-0/backends/platform/ds/arm9/source/blitters_arm.s)
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/blitters_arm.s	                        (rev 0)
+++ scummvm/trunk/backends/platform/ds/arm9/source/blitters_arm.s	2007-10-13 15:40:11 UTC (rev 29203)
@@ -0,0 +1,339 @@
+@ ScummVM Scumm Interpreter
+@ Copyright (C) 2007 The ScummVM project
+@
+@ This program is free software@ you can redistribute it and/or
+@ modify it under the terms of the GNU General Public License
+@ as published by the Free Software Foundation@ either version 2
+@ of the License, or (at your option) any later version.
+@
+@ This program is distributed in the hope that it will be useful,
+@ but WITHOUT ANY WARRANTY; without even the implied warranty of
+@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+@ GNU General Public License for more details.
+@
+@ You should have received a copy of the GNU General Public License
+@ along with this program@ if not, write to the Free Software
+@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+@
+@ $URL:  $
+@ $Id:  $
+@
+@ @author Robin Watts (robin at wss.co.uk)
+
+	.text
+	
+	.global	asmDrawStripToScreen
+	.global	asmCopy8Col
+	.global	Rescale_320x256xPAL8_To_256x256x1555
+	.global	Rescale_320x256x1555_To_256x256x1555
+
+	@ ARM implementation of asmDrawStripToScreen.
+	@
+	@ C prototype would be:
+	@
+	@ extern "C" void asmDrawStripToScreen(int         height,
+	@                                      int         width,
+	@                                      byte const *text,
+	@                                      byte const *src,
+	@                                      byte       *dst,
+	@                                      int         vsPitch,
+	@                                      int         vsScreenWidth,
+	@                                      int         textSurfacePitch);
+	@
+	@ In addition, we assume that text, src and dst are all word (4 byte)
+	@ aligned. This is the same assumption that the old 'inline' version
+	@ made.
+asmDrawStripToScreen:
+	@ r0 = height
+	@ r1 = width
+	@ r2 = text
+	@ r3 = src
+	MOV	r12,r13
+	STMFD	r13!,{r4-r7,r9-r11,R14}
+	LDMIA	r12,{r4,r5,r6,r7}
+	@ r4 = dst
+	@ r5 = vsPitch
+	@ r6 = vmScreenWidth
+	@ r7 = textSurfacePitch
+
+	CMP	r0,#0			@ If height<=0
+	MOVLE	r0,#1			@    height=1
+	CMP	r1,#4			@ If width<4
+	BLT	end			@    return
+
+	@ Width &= ~4 ? What's that about then? Width &= ~3 I could have
+	@ understood...
+	BIC	r1,r1,#4
+
+	SUB	r5,r5,r1		@ vsPitch          -= width
+	SUB	r6,r6,r1		@ vmScreenWidth    -= width
+	SUB	r7,r7,r1		@ textSurfacePitch -= width
+	MOV	r10,#253
+	ORR	r10,r10,r10,LSL #8
+	ORR	r10,r10,r10,LSL #16	@ r10 = mask
+yLoop:
+	MOV	r14,r1			@ r14 = width
+xLoop:
+	LDR	r12,[r2],#4		@ r12 = [text]
+	LDR	r11,[r3],#4		@ r11 = [src]
+	CMP	r12,r10
+	BNE	singleByteCompare
+	SUBS	r14,r14,#4
+	STR	r11,[r4], #4		@ r4 = [dst]
+	BGT	xLoop
+
+	ADD	r2,r2,r7		@ text += textSurfacePitch
+	ADD	r3,r3,r5		@ src  += vsPitch
+	ADD	r4,r4,r6		@ dst  += vmScreenWidth
+	SUBS	r0,r0,#1
+	BGT	yLoop
+	LDMFD	r13!,{r4-r7,r9-r11,PC}
+
+singleByteCompare:
+	MOV	r9,r12,LSR #24		@ r9 = 1st byte of [text]
+	CMP	r9,r10,LSR #24		@ if (r9 == mask)
+	MOVEQ	r9,r11,LSR #24		@     r9 = 1st byte of [src]
+	ORR	r12,r9,r12,LSL #8	@ r12 = combine r9 and r12
+
+	MOV	r9,r12,LSR #24		@ r9 = 1st byte of [text]
+	CMP	r9,r10,LSR #24		@ if (r9 == mask)
+	MOVEQ	r9,r11,LSR #24		@     r9 = 1st byte of [src]
+	ORR	r12,r9,r12,LSL #8	@ r12 = combine r9 and r12
+
+	MOV	r9,r12,LSR #24		@ r9 = 1st byte of [text]
+	CMP	r9,r10,LSR #24		@ if (r9 == mask)
+	MOVEQ	r9,r11,LSR #24		@     r9 = 1st byte of [src]
+	ORR	r12,r9,r12,LSL #8	@ r12 = combine r9 and r12
+
+	MOV	r9,r12,LSR #24		@ r9 = 1st byte of [text]
+	CMP	r9,r10,LSR #24		@ if (r9 == mask)
+	MOVEQ	r9,r11,LSR #24		@     r9 = 1st byte of [src]
+	ORR	r12,r9,r12,LSL #8	@ r12 = combine r9 and r12
+
+	STR	r12,[r4],#4
+	SUBS	r14,r14,#4
+	BGT	xLoop
+
+	ADD	r2,r2,r7		@ text += textSurfacePitch
+	ADD	r3,r3,r5		@ src  += vsPitch
+	ADD	r4,r4,r6		@ dst  += vmScreenWidth
+	SUBS	r0,r0,#1
+	BGT	yLoop
+end:
+	LDMFD	r13!,{r4-r7,r9-r11,PC}
+
+
+	@ ARM implementation of asmCopy8Col
+	@
+	@ C prototype would be:
+	@
+	@ extern "C" void asmCopy8Col(byte       *dst,
+	@                             int         dstPitch,
+	@                             const byte *src,
+	@                             int         height);
+	@
+	@ In addition, we assume that src and dst are both word (4 byte)
+	@ aligned. This is the same assumption that the old 'inline' version
+	@ made.
+asmCopy8Col:
+	@ r0 = dst
+	@ r1 = dstPitch
+	@ r2 = src
+	@ r3 = height
+	STMFD	r13!,{r14}
+	SUB	r1,r1,#4
+	
+	TST	r3,#1
+	ADDNE   r3,r3,#1
+	BNE	roll2
+yLoop2:
+	LDR	r12,[r2],#4
+	LDR	r14,[r2],r1
+	STR	r12,[r0],#4
+	STR	r14,[r0],r1
+roll2:
+	LDR	r12,[r2],#4
+	LDR	r14,[r2],r1
+	SUBS	r3,r3,#2
+	STR	r12,[r0],#4
+	STR	r14,[r0],r1
+	BNE	yLoop2
+
+	LDMFD	r13!,{PC}
+
+
+	@ ARM implementation of Rescale_320x256x1555_To_256x256x1555
+	@
+	@ C prototype would be:
+	@
+	@ extern "C" void Rescale_320x256x1555_To_256x256x1555(
+	@                                      u16        *dst,
+	@                                      const u16  *src,
+	@                                      int         dstStride,
+	@                                      int         srcStride);
+Rescale_320x256x1555_To_256x256x1555:
+	@ r0 = dst
+	@ r1 = src
+	@ r2 = dstStride
+	@ r3 = srcStride
+	STMFD	r13!,{r4-r5,r8-r11,r14}
+	
+	SUB	r2,r2,#64*5		@ srcStride -= line length
+	SUB	r3,r3,#64*4		@ dstStride -= line length
+
+	MOV	r8,    #0x0000001F
+	ORR	r8, r8,#0x00007C00
+	ORR	r8, r8,#0x03E00000	@ r8 = mask
+	MOV	r5, #200		@ r5 = y
+yLoop3:
+	MOV	r4, #64			@ r4 = x
+xLoop3:	
+	LDRH	r9, [r0],#2		@ r9 = src0
+	LDRH	r10,[r0],#2		@ r10= src1
+	LDRH	r11,[r0],#2		@ r11= src2
+	LDRH	r12,[r0],#2		@ r12= src3
+	LDRH	r14,[r0],#2		@ r14= src4
+
+	ORR	r9, r9, r9, LSL #16	@ r9 = src0 | src0
+	ORR	r10,r10,r10,LSL #16	@ r10= src1 | src1
+	ORR	r11,r11,r11,LSL #16	@ r11= src2 | src2
+	ORR	r12,r12,r12,LSL #16	@ r12= src3 | src3
+	ORR	r14,r14,r14,LSL #16	@ r13= src4 | src4
+
+	AND	r9, r9, r8		@ r9 = 0 | G0 | 0 | B0 | 0 | R0
+	AND	r10,r10,r8		@ r10= 0 | G1 | 0 | B1 | 0 | R1
+	AND	r11,r11,r8		@ r11= 0 | G2 | 0 | B2 | 0 | R2
+	AND	r12,r12,r8		@ r12= 0 | G3 | 0 | B3 | 0 | R3
+	AND	r14,r14,r8		@ r14= 0 | G4 | 0 | B4 | 0 | R4
+
+	ADD	r9, r9, r9, LSL #1	@ r9 = 3*src0
+	ADD	r9, r9, r10		@ r9 = dst0<<2
+	ADD	r10,r10,r11		@ r10= dst1
+	ADD	r11,r11,r12		@ r11= dst2
+	ADD	r12,r12,r14		@ r12= src3 + src4
+	ADD	r12,r12,r14,LSL #1	@ r12= src3 + src4*3 = dst3<<2
+	
+	AND	r9, r8, r9, LSR #2	@ r9 = dst0 (split)
+	AND	r10,r8, r10,LSR #1	@ r10= dst1 (split)
+	AND	r11,r8, r11,LSR #1	@ r11= dst2 (split)
+	AND	r12,r8, r12,LSR #2	@ r12= dst3 (split)
+
+	ORR	r9, r9, r9, LSR #16	@ r9 = dst0
+	ORR	r10,r10,r10,LSR #16	@ r10= dst1
+	ORR	r11,r11,r11,LSR #16	@ r11= dst2
+	ORR	r12,r12,r12,LSR #16	@ r12= dst3
+
+	ORR	r9, r9, #0x8000
+	ORR	r10,r10,#0x8000
+	ORR	r11,r11,#0x8000
+	ORR	r12,r12,#0x8000
+	
+	STRH	r9, [r1],#2
+	STRH	r10,[r1],#2
+	STRH	r11,[r1],#2
+	STRH	r12,[r1],#2
+
+	SUBS	r4,r4,#1
+	BGT	xLoop3
+	
+	ADD	r0,r0,r2,LSL #1
+	ADD	r1,r2,r3,LSL #1
+	SUBS	r5,r5,#1
+	BGT	yLoop3
+
+	LDMFD	r13!,{r4-r5,r8-r11,PC}
+
+	@ ARM implementation of Rescale_320x256xPAL8_To_256x256x1555
+	@
+	@ C prototype would be:
+	@
+	@ extern "C" void Rescale_320x256xPAL8_To_256x256x1555(
+	@                                      u16        *dst,
+	@                                      const u8   *src,
+	@                                      int         dstStride,
+	@                                      int         srcStride,
+	@                                      const u16  *pal);
+	@
+	@ This is a slight reordering of the params from the existing C one.
+	@ Sorry, but it makes the code easier.
+Rescale_320x256xPAL8_To_256x256x1555:
+	@ r0 = dst
+	@ r1 = src
+	@ r2 = dstStride
+	@ r3 = srcStride
+	STMFD	r13!,{r4-r5,r8-r11,r14}
+	MOV	r8,    #0x0000001F
+	ORR	r8, r8,#0x00007C00
+	ORR	r8, r8,#0x03E00000	@ r8 = mask
+	LDR	r9, [r13,#7*4]		@ r9 = palette
+	
+	SUB	r13,r13,#256*4		@ r13 = 1K of space on the stack.
+	MOV	r5, r13			@ r5 points to this space
+	MOV	r14,#256
+palLoop:
+	LDRH	r10,[r9],#2		@ r10 = palette entry
+	SUBS	r14,r14,#1
+	ORR	r10,r10,r10,LSL #16
+	AND	r10,r10,r8		@ r10 = separated palette entry
+	STR	r10,[r5], #4
+	BGT	palLoop
+	
+	SUB	r2,r2,#64*5		@ srcStride -= line length
+	SUB	r3,r3,#64*4		@ dstStride -= line length
+
+	MOV	r5,#200			@ r5 = y
+yLoop4:
+	MOV	r4,#64			@ r4 = x
+xLoop4:	
+	LDRB	r9, [r0],#1		@ r9 = src0
+	LDRB	r10,[r0],#1		@ r10= src1
+	LDRB	r11,[r0],#1		@ r11= src2
+	LDRB	r12,[r0],#1		@ r12= src3
+	LDRB	r14,[r0],#1		@ r14= src4
+
+	LDR	r9, [r13,r9, LSL #2]	@ r9 = pal[src0]
+	LDR	r10,[r13,r10,LSL #2]	@ r10= pal[src1]
+	LDR	r11,[r13,r11,LSL #2]	@ r11= pal[src2]
+	LDR	r12,[r13,r12,LSL #2]	@ r12= pal[src3]
+	LDR	r14,[r13,r14,LSL #2]	@ r13= pal[src4]
+
+	ADD	r9, r9, r9, LSL #1	@ r9 = 3*src0
+	ADD	r9, r9, r10		@ r9 = dst0<<2
+	ADD	r10,r10,r11		@ r10= dst1
+	ADD	r11,r11,r12		@ r11= dst2
+	ADD	r12,r12,r14		@ r12= src3 + src4
+	ADD	r12,r12,r14,LSL #1	@ r12= src3 + src4*3 = dst3<<2
+	
+	AND	r9, r8, r9, LSR #2	@ r9 = dst0 (split)
+	AND	r10,r8, r10,LSR #1	@ r10= dst1 (split)
+	AND	r11,r8, r11,LSR #1	@ r11= dst2 (split)
+	AND	r12,r8, r12,LSR #2	@ r12= dst3 (split)
+
+	ORR	r9, r9, r9, LSR #16	@ r9 = dst0
+	ORR	r10,r10,r10,LSR #16	@ r10= dst1
+	ORR	r11,r11,r11,LSR #16	@ r11= dst2
+	ORR	r12,r12,r12,LSR #16	@ r12= dst3
+
+	ORR	r9, r9, #0x8000
+	ORR	r10,r10,#0x8000
+	ORR	r11,r11,#0x8000
+	ORR	r12,r12,#0x8000
+	
+	STRH	r9, [r1],#2
+	STRH	r10,[r1],#2
+	STRH	r11,[r1],#2
+	STRH	r12,[r1],#2
+
+	SUBS	r4,r4,#1
+	BGT	xLoop4
+	
+	ADD	r0,r0,r2
+	ADD	r1,r2,r3,LSL #1
+	SUBS	r5,r5,#1
+	BGT	yLoop4
+
+	ADD	r13,r13,#256*4
+
+	LDMFD	r13!,{r4-r5,r8-r11,PC}
+
+ 	  	 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp	2007-10-13 15:40:11 UTC (rev 29203)
@@ -167,6 +167,7 @@
 	
 	if ((waveHeader.fmtFormatTag != 17) && (waveHeader.fmtFormatTag != 20)) {
 		consolePrintf("Wave file is in the wrong format!  You must use IMA-ADPCM 4-bit mono.\n");
+		DS::std_fclose(file);
 		return;
 	}
 	

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2007-10-13 15:40:11 UTC (rev 29203)
@@ -31,13 +31,34 @@
 // - Stereo audio?
 // - Delete saves?
 // - Software scaler?
+// - 100% scale
 
+// - Arrow keys cause key events when keyboard enabled - Done
+// - Mouse cursor display - Done
+// - Disable scaler on options menu - Done
+// - Fix scale icons on top screen - Done
+// - Fseek optimisation? - No need
+// - Fix agi hack to be cleaner - done
+// - Fix not typing looong words - Done
+// - Show keyboard by default in AGI games
+// - Fix mouse moving when cursor on keyboard screen - Done
+// - Fix 'fit' thingy always appearing - Done
+// - check cine backbuffer code - Done
+// - Add long filename support - Done
+// - New icons
+// - Add key config for gob engine: Start:F1, Shift-numbers: F keys - Done
+// - Fix [ds] appearing in game menu
+
+// - Find out what's going wrong when you turn the console off
+// - enable console when asserting
+
 // - Alternative controls?
 
 
 
-#define USE_LIBCARTRESET
 
+//#define USE_LIBCARTRESET
+
 #include <nds.h>
 
 //#include <ARM9/console.h> //basic print funcionality
@@ -67,8 +88,10 @@
 #include "blitters.h"
 #include "cartreset_nolibfat.h"
 #include "keys.h"
+#ifdef USE_PROFILER
 #include "profiler/cyg-profile.h"
-#include "blitters.h"
+#endif
+#include "ds-fs.h"
 
 namespace DS {
 
@@ -142,6 +165,7 @@
 // Game id
 u8 gameID;
 
+bool snapToBorder = false;
 bool consoleEnable = false;
 bool gameScreenSwap = false;
 bool isCpuScalerEnabled();
@@ -170,6 +194,7 @@
 int mouseHotspotX, mouseHotspotY;
 bool cursorEnable = false;
 bool mouseCursorVisible = true;
+bool rightButtonDown = false;
 
 // Dragging
 int dragStartX, dragStartY;
@@ -211,7 +236,7 @@
 	{"sky",			CONT_SKY},
 	{"simon1",		CONT_SIMON},
 	{"simon2",		CONT_SIMON},
-	{"gob1",		CONT_SCUMM_ORIGINAL},
+	{"gob",		CONT_GOBLINS},
 	{"queen",		CONT_SCUMM_ORIGINAL},
 	{"cine",		CONT_FUTURE_WARS},
 	{"agi",			CONT_AGI}
@@ -328,7 +353,7 @@
     if (savedBuffer == NULL) savedBuffer = new u8[gameWidth * gameHeight];
     for (int r = 0; r < gameHeight; r++) {
 		memcpy(savedBuffer + (r * gameWidth), ((u8 *) (get8BitBackBuffer())) + (r * 512), gameWidth);
-    }
+	}
 #endif
 }
 
@@ -438,6 +463,10 @@
 	leftHandedMode = enable;
 }
 
+void setSnapToBorder(bool enable) {
+	snapToBorder = enable;
+}
+
 void setTouchXOffset(int x) {
 	touchXOffset = x;
 }
@@ -1108,13 +1137,22 @@
 
 			if (!indyFightState) {
 
-				if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysChanged() & KEY_B)) {	
-					event.kbd.keycode = Common::KEYCODE_ESCAPE;		
-					event.kbd.ascii = 27;		
-					event.kbd.flags = 0;
+				if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) {	
+					if (currentGame->control == CONT_AGI) {
+						event.kbd.keycode = Common::KEYCODE_RETURN;
+						event.kbd.ascii = 13;
+						event.kbd.flags = 0;
+					} else {
+						event.kbd.keycode = Common::KEYCODE_ESCAPE;		
+						event.kbd.ascii = 27;		
+						event.kbd.flags = 0;
+					}
 
-					event.type = getKeyEvent(KEY_B);
+					event.type = Common::EVENT_KEYDOWN;
 					system->addEvent(event);
+
+					event.type = Common::EVENT_KEYUP;
+					system->addEvent(event);
 				}
 		
 			}
@@ -1130,34 +1168,45 @@
 				}
 			}
 	
-			if (!((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (getKeyboardEnable())) {
+			if ((getKeyboardEnable())) {
 				event.kbd.flags = 0;
 
-				if (getKeysChanged() & KEY_LEFT) {
-					event.kbd.keycode = Common::KEYCODE_LEFT;
-					event.kbd.ascii = 0;
-					event.type = getKeyEvent(KEY_LEFT);
-				}
+				bool down = getKeysDown() & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN);
+				bool release = getKeysReleased() & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN);
+				bool shoulders = getKeysHeld() & (KEY_L | KEY_R);
 
-				if (getKeysChanged() & KEY_RIGHT) {
-					event.kbd.keycode = Common::KEYCODE_RIGHT;
-					event.kbd.ascii = 0;
-					event.type = getKeyEvent(KEY_RIGHT);
+				if ( (down && (!shoulders)) || release) 
+				{
+	
+					if (getKeysChanged() & KEY_LEFT) {
+						event.kbd.keycode = Common::KEYCODE_LEFT;
+						event.kbd.ascii = 0;
+						event.type = getKeyEvent(KEY_LEFT);
+						system->addEvent(event);
+					}
+	
+					if (getKeysChanged() & KEY_RIGHT) {
+						event.kbd.keycode = Common::KEYCODE_RIGHT;
+						event.kbd.ascii = 0;
+						event.type = getKeyEvent(KEY_RIGHT);
+						system->addEvent(event);
+					}
+	
+					if (getKeysChanged() & KEY_UP) {
+						event.kbd.keycode = Common::KEYCODE_UP;
+						event.kbd.ascii = 0;
+						event.type = getKeyEvent(KEY_UP);
+						system->addEvent(event);
+					}
+	
+					if (getKeysChanged() & KEY_DOWN) {
+						event.kbd.keycode = Common::KEYCODE_DOWN;
+						event.kbd.ascii = 0;
+						event.type = getKeyEvent(KEY_DOWN);
+						system->addEvent(event);
+					}
 				}
-
-				if (getKeysChanged() & KEY_UP) {
-					event.kbd.keycode = Common::KEYCODE_UP;
-					event.kbd.ascii = 0;
-					event.type = getKeyEvent(KEY_UP);
-				}
-
-				if (getKeysChanged() & KEY_DOWN) {
-					event.kbd.keycode = Common::KEYCODE_DOWN;
-					event.kbd.ascii = 0;
-					event.type = getKeyEvent(KEY_DOWN);
-				}
 					
-				system->addEvent(event);
 			}
 	
 			if (!((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (!getIndyFightState()) && (!getKeyboardEnable())) {
@@ -1171,8 +1220,18 @@
 						mouseMode = MOUSE_LEFT;
 					}
 
+					if (rightButtonDown)
+					{
+						Common::Event event;
+						event.mouse = Common::Point(getPenX(), getPenY());
+						event.type = Common::EVENT_RBUTTONUP;
+						system->addEvent(event);
+						rightButtonDown = false;
+					}
+						
+
 					if (getKeysDown() & KEY_RIGHT) {
-						if ((currentGame->control != CONT_SCUMM_SAMNMAX) && (currentGame->control != CONT_FUTURE_WARS)) {
+						if ((currentGame->control != CONT_SCUMM_SAMNMAX) && (currentGame->control != CONT_FUTURE_WARS) && (currentGame->control != CONT_GOBLINS)) {
 							mouseMode = MOUSE_RIGHT;
 						} else {
 							// If we're playing sam and max, click and release the right mouse
@@ -1186,15 +1245,20 @@
 							} else {
 								event.mouse = Common::Point(getPenX(), getPenY());
 							}
+							
+							rightButtonDown = true;
 
 		
 							event.type = Common::EVENT_RBUTTONDOWN;
 							system->addEvent(event);
 		
-							event.type = Common::EVENT_RBUTTONUP;
-							system->addEvent(event);
+							//event.type = Common::EVENT_RBUTTONUP;
+							//system->addEvent(event);
 						}
 					}
+
+
+
 					if (getKeysDown() & KEY_UP) {
 						mouseMode = MOUSE_HOVER;
 					}
@@ -1285,28 +1349,36 @@
 
 				if (currentGame->control == CONT_SIMON) {
 					// Extra controls for Simon the Sorcerer
-					if ((getKeysChanged() & KEY_DOWN)) {
+					if ((getKeysDown() & KEY_DOWN)) {
 						Common::Event event;
 					
-						event.type = getKeyEvent(KEY_DOWN);
+						event.type = Common::EVENT_KEYDOWN;
 						event.kbd.keycode = Common::KEYCODE_F10;		// F10 or # - show hotspots
 						event.kbd.ascii = Common::ASCII_F10;
 						event.kbd.flags = 0;
 						system->addEvent(event);
 //						consolePrintf("F10\n");
+
+						event.type = Common::EVENT_KEYUP;
+						system->addEvent(event);
 					}
 				}
+
 	
+	
 				if (currentGame->control == CONT_SCUMM_ORIGINAL) {
 					// Extra controls for Scumm v1-5 games
-					if ((getKeysChanged() & KEY_DOWN)) {
+					if ((getKeysDown() & KEY_DOWN)) {
 						Common::Event event;
 					
-						event.type = getKeyEvent(KEY_DOWN);
+						event.type = Common::EVENT_KEYDOWN;
 						event.kbd.keycode = Common::KEYCODE_PERIOD;		// Full stop - skips current dialogue line
 						event.kbd.ascii = '.';
 						event.kbd.flags = 0;
 						system->addEvent(event);
+
+						event.type = Common::EVENT_KEYUP;
+						system->addEvent(event);
 					}
 					
 					if (indyFightState) {
@@ -1338,11 +1410,14 @@
 			}
 
 			if (leftHandedSwap(getKeysDown()) & KEY_A) {
-				event.type = getKeyEvent(leftHandedSwap(KEY_A));
+				event.type = Common::EVENT_KEYDOWN;
 				event.kbd.keycode = Common::KEYCODE_RETURN;
 				event.kbd.ascii = 0;
 				event.kbd.flags = 0;
 				system->addEvent(event);
+
+				event.type = Common::EVENT_KEYUP;
+				system->addEvent(event);
 			}
 		
 		}
@@ -1357,8 +1432,11 @@
 				event.kbd.keycode = Common::KEYCODE_F1;
 				event.kbd.ascii = Common::ASCII_F1;
 //				consolePrintf("!!!!!F1!!!!!");
+			} else if (currentGame->control == CONT_AGI) {
+				event.kbd.keycode = Common::KEYCODE_ESCAPE;
+				event.kbd.ascii = 27;
 			} else {
-				event.kbd.keycode = Common::KEYCODE_F5;
+				event.kbd.keycode = Common::KEYCODE_F5;		// F5
 				event.kbd.ascii = Common::ASCII_F5;
 //				consolePrintf("!!!!!F5!!!!!");
 			}
@@ -1394,7 +1472,7 @@
 }
 
 void setIconMain(int num, int x, int y, int imageNum, int flags, bool enable) {
-	spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0x1FF) | (!enable? ATTR0_DISABLED: 0); 
+	spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0); 
 	spritesMain[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags;
 	spritesMain[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16);
 }
@@ -2171,12 +2249,26 @@
 int getPenX() {
 	int x = ((penX * touchScX) >> 8) + touchX;
 	x = x < 0? 0: (x > gameWidth - 1? gameWidth - 1: x);
+
+	if (snapToBorder)
+	{
+		if (x < 8) x = 0;
+		if (x > gameWidth - 8) x = gameWidth - 1;
+	}
+
 	return x;
 }
 
 int getPenY() {
 	int y = ((penY * touchScY) >> 8) + touchY;
 	y = y < 0? 0: (y > gameHeight - 1? gameHeight - 1: y);
+
+	if (snapToBorder)
+	{
+		if (y < 8) y = 0;
+		if (y > gameHeight - 8) y = gameHeight - 1;
+	}
+
 	return y;
 }
 
@@ -2471,7 +2563,7 @@
 	consolePrintf("-------------------------------\n");
 	consolePrintf("ScummVM DS\n");
 	consolePrintf("Ported by Neil Millstone\n");
-	consolePrintf("Version 0.10.0 beta1 ");
+	consolePrintf("Version 0.11.0SVN ");
 #if defined(DS_BUILD_A)
 	consolePrintf("build A\n");
 	consolePrintf("Lucasarts SCUMM games (SCUMM)\n");
@@ -2594,7 +2686,7 @@
 
 		if (!initGBAMP(mode)) {
 			consolePrintf("\nNo file system was found.\n");
-			consolePrintf("View the README_DLDI.TXT file\n");
+			consolePrintf("View the readme file\n");
 			consolePrintf("for more information.\n");
 
 			while (1);
@@ -2616,6 +2708,8 @@
 		formatSramOption();
 	}
 
+	IPC->adpcm.semaphore = false;
+
 //	printf("'%s'", Common::ConfigManager::kTransientDomain.c_str());
 	//printf("'%s'", Common::ConfigManager::kApplicationDomain.c_str());
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h	2007-10-13 15:40:11 UTC (rev 29203)
@@ -125,6 +125,7 @@
 void 	setTouchXOffset(int x);
 void 	setTouchYOffset(int y);
 void 	setUnscaledMode(bool enable);
+void	setSnapToBorder(bool enable);
 void 	setIndyFightState(bool st);
 bool 	getIndyFightState();
 bool    isCpuScalerEnabled();

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp	2007-10-13 15:40:11 UTC (rev 29203)
@@ -38,8 +38,8 @@
 
 namespace DS {
 
-DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 200 - 20) {
-	addButton(this, 10, 160, "Close", GUI::kCloseCmd, 'C');
+DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 230 - 20) {
+	addButton(this, 10, 175, "Close", GUI::kCloseCmd, 'C');
 	
 #ifdef DS_SCUMM_BUILD
 	if (!DS::isGBAMPAvailable()) {
@@ -57,33 +57,44 @@
 	_disablePowerOff = new GUI::CheckboxWidget(this, 20, 100, 250, 20, "Disable power off on quit", 0, 'T');
 //	_cpuScaler = new GUI::CheckboxWidget(this, 20, 115, 250, 20, "CPU scaler", 0, 'T');
 	_showCursorCheckbox = new GUI::CheckboxWidget(this, 20, 115, 250, 20, "Show mouse cursor", 0, 'T');
+	_snapToBorderCheckbox = new GUI::CheckboxWidget(this, 20, 130, 250, 20, "Snap to border", 0, 'T');
 
-	new GUI::StaticTextWidget(this, 20, 130, 110, 15, "Touch X Offset", GUI::kTextAlignLeft);
-	_touchX = new GUI::SliderWidget(this, 130, 130, 130, 12, 1);
+	new GUI::StaticTextWidget(this, 20, 145, 110, 15, "Touch X Offset", GUI::kTextAlignLeft);
+	_touchX = new GUI::SliderWidget(this, 130, 145, 130, 12, 1);
 	_touchX->setMinValue(-8);
 	_touchX->setMaxValue(+8);
 	_touchX->setValue(0);
 	_touchX->setFlags(GUI::WIDGET_CLEARBG);
 
-	new GUI::StaticTextWidget(this, 20, 145, 110, 15, "Touch Y Offset", GUI::kTextAlignLeft);
-	_touchY = new GUI::SliderWidget(this, 130, 145, 130, 12, 2);
+	new GUI::StaticTextWidget(this, 20, 160, 110, 15, "Touch Y Offset", GUI::kTextAlignLeft);
+	_touchY = new GUI::SliderWidget(this, 130, 160, 130, 12, 2);
 	_touchY->setMinValue(-8);
 	_touchY->setMaxValue(+8);
 	_touchY->setValue(0);
 	_touchY->setFlags(GUI::WIDGET_CLEARBG);
 
-	new GUI::StaticTextWidget(this, 130 + 65 - 10, 160, 20, 15, "0", GUI::kTextAlignCenter);
-	new GUI::StaticTextWidget(this, 130 + 130 - 10, 160, 20, 15, "8", GUI::kTextAlignCenter);
-	new GUI::StaticTextWidget(this, 130 - 10, 160, 20, 15, "-8", GUI::kTextAlignCenter);
+	new GUI::StaticTextWidget(this, 130 + 65 - 10, 175, 20, 15, "0", GUI::kTextAlignCenter);
+	new GUI::StaticTextWidget(this, 130 + 130 - 10, 175, 20, 15, "8", GUI::kTextAlignCenter);
+	new GUI::StaticTextWidget(this, 130 - 10, 175, 20, 15, "-8", GUI::kTextAlignCenter);
 
 #ifdef DS_SCUMM_BUILD
 	_delDialog = new Scumm::SaveLoadChooser("Delete game:", "Delete", false, Scumm::g_scumm);
 #endif
 
+	if (ConfMan.hasKey("snaptoborder", "ds")) {
+		_snapToBorderCheckbox->setState(ConfMan.getBool("snaptoborder", "ds"));
+	} else {
+#ifdef DS_BUILD_D
+		_snapToBorderCheckbox->setState(true);
+#else
+		_snapToBorderCheckbox->setState(false);
+#endif
+	}
+
 	if (ConfMan.hasKey("showcursor", "ds")) {
 		_showCursorCheckbox->setState(ConfMan.getBool("showcursor", "ds"));
 	} else {
-		_showCursorCheckbox->setState(false);
+		_showCursorCheckbox->setState(true);
 	}
 
 	if (ConfMan.hasKey("lefthanded", "ds")) {
@@ -148,6 +159,7 @@
 	ConfMan.setInt("xoffset", _touchX->getValue(), "ds");
 	ConfMan.setInt("yoffset", _touchY->getValue(), "ds");
 	ConfMan.setBool("showcursor", _showCursorCheckbox->getState(), "ds");
+	ConfMan.setBool("snaptoborder", _snapToBorderCheckbox->getState(), "ds");
 	DS::setOptions();
 	DS::setIndyFightState(_indyFightCheckbox->getState());
 	ConfMan.flushToDisk();
@@ -239,6 +251,16 @@
 		DS::setMouseCursorVisible(true);
 	}
 
+	if (ConfMan.hasKey("snaptoborder", "ds")) {
+		DS::setSnapToBorder(ConfMan.getBool("snaptoborder", "ds"));
+	} else {
+#ifdef DS_BUILD_D
+		DS::setSnapToBorder(true);
+#else
+		DS::setSnapToBorder(false);
+#endif
+	}
+
 	if (ConfMan.hasKey("unscaled", "ds")) {
 		DS::setUnscaledMode(ConfMan.getBool("unscaled", "ds"));
 	} else {

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.h	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.h	2007-10-13 15:40:11 UTC (rev 29203)
@@ -54,6 +54,7 @@
 	GUI::CheckboxWidget* _disablePowerOff;
 	GUI::CheckboxWidget* _cpuScaler;
 	GUI::CheckboxWidget* _showCursorCheckbox;
+	GUI::CheckboxWidget* _snapToBorderCheckbox;
 	
 #ifdef DS_SCUMM_BUILD
 	Scumm::SaveLoadChooser* _delDialog;

Modified: scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.c
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.c	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.c	2007-10-13 15:40:11 UTC (rev 29203)
@@ -355,6 +355,8 @@
 // If an interface is found, it is set as the default interace
 // and it returns true. Otherwise the default interface is left
 // untouched and it returns false.
+
+
 bool disc_setDsSlotInterface (void)
 {
 #ifdef ARM9

Modified: scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.h	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.h	2007-10-13 15:40:11 UTC (rev 29203)
@@ -41,6 +41,11 @@
 //#define DISK_CACHE_DMA		// use DMA for cache copies. If this is enabled, the data buffers must be word aligned
 
 
+// This allows the code to build on an earlier version of libnds, before the register was renamed
+#ifndef REG_EXMEMCNT
+#define REG_EXMEMCNT REG_EXEMEMCNT 
+#endif
+
 //----------------------------------------------------------------------
 
 #if defined _CF_USE_DMA && defined _CF_ALLOW_UNALIGNED

Modified: scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.cpp	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.cpp	2007-10-13 15:40:11 UTC (rev 29203)
@@ -22,6 +22,7 @@
 
 #include "gbampsave.h"
 #include "gba_nds_fat.h"
+#include "ds-fs.h"
 
 /////////////////////////
 // GBAMP Save File
@@ -39,7 +40,7 @@
 GBAMPSaveFile::~GBAMPSaveFile() {
 	flushSaveBuffer();
 	if (handle) DS::std_fclose(handle);
-	consolePrintf("Closed file\n");
+//	consolePrintf("Closed file\n");
 }
 
 uint32 GBAMPSaveFile::read(void *buf, uint32 size) {
@@ -164,8 +165,8 @@
 }
 
 void GBAMPSaveFileManager::listSavefiles(char const* prefix, bool* marks, int num) {
-	memset(marks, true, num * sizeof(bool));
-	return;
+//	memset(marks, true, num * sizeof(bool));
+//	return;
 	
 	// Seems like I misunderstood what this function was supposed to do.
 	// I thought I was meant to set the marks[] array according to which
@@ -175,7 +176,6 @@
 	char path[128];
 	
 	DS::std_cwd((char *) getSavePath());
-
 	consolePrintf("Save path: %s\n", getSavePath());
 	
 	int fileType = FAT_FindFirstFileLFN(name);
@@ -209,3 +209,46 @@
 	
 	FAT_chdir("/");
 }
+
+Common::StringList GBAMPSaveFileManager::listSavefiles(const char *regex) { 
+
+	
+
+	enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 };
+	char name[256];
+
+	
+	DS::std_cwd((char *) getSavePath());
+//	consolePrintf("Save path: '%s', regex: '%s'\n", getSavePath(),regex);
+
+	
+	int fileType = FAT_FindFirstFileLFN(name);
+
+	Common::StringList list;
+	
+	
+	do {
+	
+		if (fileType == TYPE_FILE) {
+
+			FAT_GetLongFilename(name);
+
+			for (int r = 0; r < strlen(name); r++) {
+				name[r] = tolower(name[r]);
+			}
+			
+			
+			if (Common::matchString(name, regex)) {
+				list.push_back(name);
+			}
+		}
+	
+	} while ((fileType = FAT_FindNextFileLFN(name)));
+	
+	FAT_chdir("/");
+
+
+	return list;
+}	
+
+

Modified: scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.h	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.h	2007-10-13 15:40:11 UTC (rev 29203)
@@ -24,11 +24,13 @@
 #define _GBAMPSAVE_H_
 
 #include "system.h"
+#include "common/savefile.h"
+#include "ds-fs.h"
 
 #define SAVE_BUFFER_SIZE 100000
 
 class GBAMPSaveFile : public Common::InSaveFile, public Common::OutSaveFile {
-	FILE* handle;
+	DS::fileHandle* handle;
 	char buffer[SAVE_BUFFER_SIZE];
 	int bufferPos;
 	int saveSize;
@@ -70,6 +72,8 @@
 	virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
 	virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
 	
+	virtual bool removeSavefile(const char *filename) { return false; } // TODO: Implement this
+	virtual Common::StringList listSavefiles(const char *regex);
 	
 	void listSavefiles(const char *prefix, bool *marks, int num);
 	

Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2007-10-13 15:40:11 UTC (rev 29203)
@@ -504,15 +504,30 @@
 	_framebuffer.create(DS::getGameWidth(), DS::getGameHeight(), 1);
 
 	// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
+<<<<<<< .working
 	
 
+=======
+	
+    size_t imageStrideInBytes = DS::isCpuScalerEnabled()? DS::getGameWidth() : 512;
+    size_t imageStrideInWords = imageStrideInBytes / 2;
+
+>>>>>>> .merge-right.r28656
 	u16* image = (u16 *) DS::get8BitBackBuffer();
 	for (int y = 0; y <  DS::getGameHeight(); y++)
 	{
+<<<<<<< .working
 		DC_FlushRange(image + (y << 8), DS::getGameWidth());
+=======
+		DC_FlushRange(image + (y * imageStrideInWords), DS::getGameWidth());
+>>>>>>> .merge-right.r28656
 		for (int x = 0; x < DS::getGameWidth() >> 1; x++)
 		{
+<<<<<<< .working
 			*(((u16 *) (_framebuffer.pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y << 8 + x];
+=======
+			*(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x];
+>>>>>>> .merge-right.r28656
 		}
 	}
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h	2007-10-13 15:40:11 UTC (rev 29203)
@@ -58,8 +58,6 @@
 
 
 	static OSystem_DS* _instance;
-
-
 	
 	typedef void (*SoundProc)(void *param, byte *buf, int len);
 	typedef int  (*TimerProc)(int interval);

Modified: scummvm/trunk/backends/platform/ds/arm9/source/portdefs.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/portdefs.h	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/portdefs.h	2007-10-13 15:40:11 UTC (rev 29203)
@@ -23,7 +23,7 @@
 #ifndef _PORTDEFS_H_
 #define _PORTDEFS_H_
 
-
+/*
 typedef unsigned char u8;
 typedef signed char s8;
 
@@ -32,9 +32,11 @@
 
 typedef unsigned int u32;
 typedef signed int s32;
+*/
 
-//#define double float
+#include "nds/jtypes.h"
 
+
 // Somebody removed these from scummsys.h, but they're still required, so I'm adding them here
 // in the hope that they'll stay.
 #include <stdio.h>
@@ -45,11 +47,18 @@
 #include <math.h>
 #include <time.h>
 
+#define double float
 
 #define CT_NO_TRANSPARENCY
-#include "scummconsole.h"
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+void consolePrintf(const char* s, ...);
+#ifdef __cplusplus
+}
+#endif
 
 //#undef assert
 //#define assert(expr) consolePrintf("Asserted!")
@@ -61,7 +70,7 @@
 
 #define assert(s) if (!(s)) consolePrintf("Assertion failed: '##s##' at file %s, line %d\n", __FILE__, __LINE__)
 
-#include "ds-fs.h"
+//#include "ds-fs.h"
 
 //#define debug(fmt, ...) consolePrintf(fmt, ##__VA_ARGS__)
 //#define debug(fmt, ...) debug(0, fmt, ##__VA_ARGS__)
@@ -72,8 +81,8 @@
 
 
 
-#include "common/array.h"
-#include "common/str.h"
+//#include "common/array.h"
+//#include "common/str.h"
 
 time_t DS_time(time_t* t);
 time_t DS_time(long* t);

Modified: scummvm/trunk/backends/platform/ds/arm9/source/ramsave.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/ramsave.h	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/ramsave.h	2007-10-13 15:40:11 UTC (rev 29203)
@@ -122,8 +122,11 @@
 	
 	virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
 	virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
+
+	virtual bool removeSavefile(const char *filename) { return false; } // TODO: Implement this
+	virtual Common::StringList listSavefiles(const char *regex) { return Common::StringList(); }	// TODO: I don't know what this is for!
+		
 	
-	
 	void listSavefiles(const char *prefix, bool *marks, int num);
 	
 	void flushToSaveRAM();

Modified: scummvm/trunk/backends/platform/ds/arm9/source/scummconsole.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/scummconsole.h	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/scummconsole.h	2007-10-13 15:40:11 UTC (rev 29203)
@@ -34,10 +34,13 @@
 
 #define CONSOLE_USE_COLOR255 16
 
+#include "portdefs.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+void poo(u8 p);
 
 void consoleInit(u16* font, u16* charBase, u16 numCharacters, u8 charStart, u16* map, u8 pal, u8 bitDepth);
 void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth);

Modified: scummvm/trunk/backends/platform/ds/arm9/source/scummhelp.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/scummhelp.h	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/scummhelp.h	2007-10-13 15:40:11 UTC (rev 29203)
@@ -24,6 +24,7 @@
 #define _SCUMMHELP_H_
 
 #include "common/str.h"
+#include "common/util.h"
 
 namespace DS {
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp	2007-10-13 15:40:11 UTC (rev 29203)
@@ -37,7 +37,7 @@
 };
 
 #define DS_NUM_KEYS 60
-#define DS_SHIFT 0
+#define DS_SHIFT 2
 #define DS_BACKSPACE 8
 #define DS_RETURN 13
 #define DS_CAPSLOCK 1

Modified: scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.h	2007-10-13 12:42:32 UTC (rev 29202)
+++ scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.h	2007-10-13 15:40:11 UTC (rev 29203)
@@ -28,6 +28,7 @@
 static const int NUM_WORDS = 12;
 
 
+
 void drawKeyboard(int tileBase, int mapBase, u16* saveSpace);
 void restoreVRAM(int tileBase, int mapBase, u16* saveSpace);
 void addKeyboardEvents();

Modified: scummvm/trunk/backends/platform/ds/logoa.bmp
===================================================================
(Binary files differ)

Modified: scummvm/trunk/backends/platform/ds/logob.bmp
===================================================================
(Binary files differ)

Modified: scummvm/trunk/backends/platform/ds/logoc.bmp
===================================================================
(Binary files differ)

Copied: scummvm/trunk/backends/platform/ds/logod.bmp (from rev 28656, scummvm/branches/branch-0-10-0/backends/platform/ds/logod.bmp)
===================================================================
(Binary files differ)

Copied: scummvm/trunk/backends/platform/ds/logoe.bmp (from rev 28656, scummvm/branches/branch-0-10-0/backends/platform/ds/logoe.bmp)
===================================================================
(Binary files differ)

Copied: scummvm/trunk/backends/platform/ds/logof.bmp (from rev 28656, scummvm/branches/branch-0-10-0/backends/platform/ds/logof.bmp)
===================================================================
(Binary files differ)


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