aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ds
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/ds')
-rw-r--r--backends/platform/ds/arm9/data/8x8font.tgabin0 -> 6060 bytes
-rw-r--r--backends/platform/ds/arm9/data/8x8font_tga.rawbin0 -> 6060 bytes
-rw-r--r--backends/platform/ds/arm9/makefile30
-rw-r--r--backends/platform/ds/arm9/source/blitters_arm.s339
-rw-r--r--backends/platform/ds/arm9/source/cdaudio.cpp1
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp182
-rw-r--r--backends/platform/ds/arm9/source/dsmain.h1
-rw-r--r--backends/platform/ds/arm9/source/dsoptions.cpp42
-rw-r--r--backends/platform/ds/arm9/source/dsoptions.h1
-rw-r--r--backends/platform/ds/arm9/source/fat/disc_io.c2
-rw-r--r--backends/platform/ds/arm9/source/fat/disc_io.h5
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.cpp51
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.h6
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp15
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h2
-rw-r--r--backends/platform/ds/arm9/source/portdefs.h21
-rw-r--r--backends/platform/ds/arm9/source/ramsave.h5
-rw-r--r--backends/platform/ds/arm9/source/scummconsole.h3
-rw-r--r--backends/platform/ds/arm9/source/scummhelp.h1
-rw-r--r--backends/platform/ds/arm9/source/touchkeyboard.cpp2
-rw-r--r--backends/platform/ds/arm9/source/touchkeyboard.h1
-rw-r--r--backends/platform/ds/logoa.bmpbin630 -> 630 bytes
-rw-r--r--backends/platform/ds/logob.bmpbin630 -> 630 bytes
-rw-r--r--backends/platform/ds/logoc.bmpbin630 -> 630 bytes
-rw-r--r--backends/platform/ds/logod.bmpbin0 -> 630 bytes
-rw-r--r--backends/platform/ds/logoe.bmpbin0 -> 630 bytes
-rw-r--r--backends/platform/ds/logof.bmpbin0 -> 630 bytes
27 files changed, 633 insertions, 77 deletions
diff --git a/backends/platform/ds/arm9/data/8x8font.tga b/backends/platform/ds/arm9/data/8x8font.tga
new file mode 100644
index 0000000000..3a5c5397f2
--- /dev/null
+++ b/backends/platform/ds/arm9/data/8x8font.tga
Binary files differ
diff --git a/backends/platform/ds/arm9/data/8x8font_tga.raw b/backends/platform/ds/arm9/data/8x8font_tga.raw
new file mode 100644
index 0000000000..3a5c5397f2
--- /dev/null
+++ b/backends/platform/ds/arm9/data/8x8font_tga.raw
Binary files differ
diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile
index bfa0d61527..5be91f9d55 100644
--- a/backends/platform/ds/arm9/makefile
+++ b/backends/platform/ds/arm9/makefile
@@ -11,8 +11,6 @@ DS_BUILD_A = 1
#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 @@ ifdef DS_BUILD_F
# 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 @@ ifdef DS_BUILD_A
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 @@ ifdef DS_BUILD_B
DISABLE_TOUCHE = 1
DISABLE_PARALLACTION = 1
DISABLE_CRUISE = 1
+ DISABLE_DRASCULA = 1
BUILD=scummvm-B
endif
@@ -110,12 +118,13 @@ ifdef DS_BUILD_C
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 @@ ifdef DS_BUILD_D
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 @@ ifdef DS_BUILD_E
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 @@ ifdef DS_BUILD_F
DISABLE_TOUCHE = 1
DISABLE_PARALLACTION = 1
DISABLE_CRUISE = 1
+ DISABLE_DRASCULA = 1
BUILD=scummvm-F
endif
@@ -219,7 +233,7 @@ LDFLAGS = -specs=ds_arm9.specs -mthumb-interwork -mno-fpu -Wl,-Map,map.txt
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
diff --git a/backends/platform/ds/arm9/source/blitters_arm.s b/backends/platform/ds/arm9/source/blitters_arm.s
new file mode 100644
index 0000000000..2f14c5a140
--- /dev/null
+++ b/backends/platform/ds/arm9/source/blitters_arm.s
@@ -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@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}
+
+
diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp
index a550ccf968..2b285e782a 100644
--- a/backends/platform/ds/arm9/source/cdaudio.cpp
+++ b/backends/platform/ds/arm9/source/cdaudio.cpp
@@ -167,6 +167,7 @@ void playTrack(int track, int numLoops, int startFrame, int duration) {
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;
}
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index 1689a3f5f9..7c9e1b503b 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -31,12 +31,33 @@
// - 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>
@@ -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 @@ bool displayModeIs8Bit = false;
// Game id
u8 gameID;
+bool snapToBorder = false;
bool consoleEnable = false;
bool gameScreenSwap = false;
bool isCpuScalerEnabled();
@@ -170,6 +194,7 @@ int touchScX, touchScY, touchX, touchY;
int mouseHotspotX, mouseHotspotY;
bool cursorEnable = false;
bool mouseCursorVisible = true;
+bool rightButtonDown = false;
// Dragging
int dragStartX, dragStartY;
@@ -211,7 +236,7 @@ gameListType gameList[NUM_SUPPORTED_GAMES] = {
{"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 @@ void saveGameBackBuffer() {
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 @@ void setLeftHanded(bool enable) {
leftHandedMode = enable;
}
+void setSnapToBorder(bool enable) {
+ snapToBorder = enable;
+}
+
void setTouchXOffset(int x) {
touchXOffset = x;
}
@@ -1108,12 +1137,21 @@ void addEventsToQueue() {
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 = Common::EVENT_KEYDOWN;
+ system->addEvent(event);
- event.type = getKeyEvent(KEY_B);
+ event.type = Common::EVENT_KEYUP;
system->addEvent(event);
}
@@ -1130,34 +1168,45 @@ void addEventsToQueue() {
}
}
- 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);
- }
-
- if (getKeysChanged() & KEY_RIGHT) {
- event.kbd.keycode = Common::KEYCODE_RIGHT;
- event.kbd.ascii = 0;
- event.type = getKeyEvent(KEY_RIGHT);
- }
-
- if (getKeysChanged() & KEY_UP) {
- event.kbd.keycode = Common::KEYCODE_UP;
- event.kbd.ascii = 0;
- event.type = getKeyEvent(KEY_UP);
- }
+ 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_DOWN) {
- event.kbd.keycode = Common::KEYCODE_DOWN;
- event.kbd.ascii = 0;
- event.type = getKeyEvent(KEY_DOWN);
+ 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);
+ }
}
- system->addEvent(event);
}
if (!((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (!getIndyFightState()) && (!getKeyboardEnable())) {
@@ -1171,8 +1220,18 @@ void addEventsToQueue() {
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 @@ void addEventsToQueue() {
} 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 @@ void addEventsToQueue() {
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 @@ void addEventsToQueue() {
}
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 @@ void addEventsToQueue() {
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 setIcon(int num, int x, int y, int imageNum, int flags, bool enable) {
}
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 @@ void consumePenEvents() {
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 @@ int main(void)
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 @@ int main(void)
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 @@ int main(void)
formatSramOption();
}
+ IPC->adpcm.semaphore = false;
+
// printf("'%s'", Common::ConfigManager::kTransientDomain.c_str());
//printf("'%s'", Common::ConfigManager::kApplicationDomain.c_str());
diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h
index a353a7cec8..1f6e6374ed 100644
--- a/backends/platform/ds/arm9/source/dsmain.h
+++ b/backends/platform/ds/arm9/source/dsmain.h
@@ -125,6 +125,7 @@ void setLeftHanded(bool enable);
void setTouchXOffset(int x);
void setTouchYOffset(int y);
void setUnscaledMode(bool enable);
+void setSnapToBorder(bool enable);
void setIndyFightState(bool st);
bool getIndyFightState();
bool isCpuScalerEnabled();
diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp
index 041b1ba0c6..d65da7c59b 100644
--- a/backends/platform/ds/arm9/source/dsoptions.cpp
+++ b/backends/platform/ds/arm9/source/dsoptions.cpp
@@ -38,8 +38,8 @@ namespace Scumm {
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 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 200 - 20) {
_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 @@ DSOptionsDialog::~DSOptionsDialog() {
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 @@ void setOptions() {
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 {
diff --git a/backends/platform/ds/arm9/source/dsoptions.h b/backends/platform/ds/arm9/source/dsoptions.h
index 87282142f6..c0e87ab630 100644
--- a/backends/platform/ds/arm9/source/dsoptions.h
+++ b/backends/platform/ds/arm9/source/dsoptions.h
@@ -54,6 +54,7 @@ protected:
GUI::CheckboxWidget* _disablePowerOff;
GUI::CheckboxWidget* _cpuScaler;
GUI::CheckboxWidget* _showCursorCheckbox;
+ GUI::CheckboxWidget* _snapToBorderCheckbox;
#ifdef DS_SCUMM_BUILD
Scumm::SaveLoadChooser* _delDialog;
diff --git a/backends/platform/ds/arm9/source/fat/disc_io.c b/backends/platform/ds/arm9/source/fat/disc_io.c
index 3cb70f510b..4128c769e1 100644
--- a/backends/platform/ds/arm9/source/fat/disc_io.c
+++ b/backends/platform/ds/arm9/source/fat/disc_io.c
@@ -355,6 +355,8 @@ void disc_getDldiId(char* id) {
// 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
diff --git a/backends/platform/ds/arm9/source/fat/disc_io.h b/backends/platform/ds/arm9/source/fat/disc_io.h
index 06804afec7..1e1638c3c4 100644
--- a/backends/platform/ds/arm9/source/fat/disc_io.h
+++ b/backends/platform/ds/arm9/source/fat/disc_io.h
@@ -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
diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp
index 0131040e1d..830073e7a7 100644
--- a/backends/platform/ds/arm9/source/gbampsave.cpp
+++ b/backends/platform/ds/arm9/source/gbampsave.cpp
@@ -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(char* name, bool saveOrLoad) {
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 @@ GBAMPSaveFile* GBAMPSaveFileManager::openSavefile(char const* name, bool saveOrL
}
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 @@ void GBAMPSaveFileManager::listSavefiles(char const* prefix, bool* marks, int nu
char path[128];
DS::std_cwd((char *) getSavePath());
-
consolePrintf("Save path: %s\n", getSavePath());
int fileType = FAT_FindFirstFileLFN(name);
@@ -209,3 +209,46 @@ void GBAMPSaveFileManager::listSavefiles(char const* prefix, bool* marks, int nu
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;
+}
+
+
diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h
index b9589a29e6..a131b6beba 100644
--- a/backends/platform/ds/arm9/source/gbampsave.h
+++ b/backends/platform/ds/arm9/source/gbampsave.h
@@ -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 @@ public:
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);
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index ae5d116985..6427f3c079 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -504,15 +504,30 @@ Graphics::Surface *OSystem_DS::lockScreen() {
_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
}
}
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index 512617170b..0dc790030a 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -58,8 +58,6 @@ public:
static OSystem_DS* _instance;
-
-
typedef void (*SoundProc)(void *param, byte *buf, int len);
typedef int (*TimerProc)(int interval);
diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h
index 91310a1479..b4bd15252a 100644
--- a/backends/platform/ds/arm9/source/portdefs.h
+++ b/backends/platform/ds/arm9/source/portdefs.h
@@ -23,7 +23,7 @@
#ifndef _PORTDEFS_H_
#define _PORTDEFS_H_
-
+/*
typedef unsigned char u8;
typedef signed char s8;
@@ -32,8 +32,10 @@ typedef signed short s16;
typedef unsigned int u32;
typedef signed int s32;
+*/
+
+#include "nds/jtypes.h"
-//#define double float
// Somebody removed these from scummsys.h, but they're still required, so I'm adding them here
// in the hope that they'll stay.
@@ -45,11 +47,18 @@ typedef signed int s32;
#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 @@ typedef signed int s32;
#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 @@ typedef signed int s32;
-#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);
diff --git a/backends/platform/ds/arm9/source/ramsave.h b/backends/platform/ds/arm9/source/ramsave.h
index 69e3c7caa7..9145a9b29b 100644
--- a/backends/platform/ds/arm9/source/ramsave.h
+++ b/backends/platform/ds/arm9/source/ramsave.h
@@ -122,7 +122,10 @@ public:
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);
diff --git a/backends/platform/ds/arm9/source/scummconsole.h b/backends/platform/ds/arm9/source/scummconsole.h
index 0bbb2f85f4..01fdfc2f04 100644
--- a/backends/platform/ds/arm9/source/scummconsole.h
+++ b/backends/platform/ds/arm9/source/scummconsole.h
@@ -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);
diff --git a/backends/platform/ds/arm9/source/scummhelp.h b/backends/platform/ds/arm9/source/scummhelp.h
index 54c9558c94..e79c863cbd 100644
--- a/backends/platform/ds/arm9/source/scummhelp.h
+++ b/backends/platform/ds/arm9/source/scummhelp.h
@@ -24,6 +24,7 @@
#define _SCUMMHELP_H_
#include "common/str.h"
+#include "common/util.h"
namespace DS {
diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp
index 26807bfa6a..8b3b651132 100644
--- a/backends/platform/ds/arm9/source/touchkeyboard.cpp
+++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp
@@ -37,7 +37,7 @@ struct key_data {
};
#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
diff --git a/backends/platform/ds/arm9/source/touchkeyboard.h b/backends/platform/ds/arm9/source/touchkeyboard.h
index 42051a1f11..17988e050a 100644
--- a/backends/platform/ds/arm9/source/touchkeyboard.h
+++ b/backends/platform/ds/arm9/source/touchkeyboard.h
@@ -28,6 +28,7 @@ namespace DS {
static const int NUM_WORDS = 12;
+
void drawKeyboard(int tileBase, int mapBase, u16* saveSpace);
void restoreVRAM(int tileBase, int mapBase, u16* saveSpace);
void addKeyboardEvents();
diff --git a/backends/platform/ds/logoa.bmp b/backends/platform/ds/logoa.bmp
index 0e98305d28..8bee29bc17 100644
--- a/backends/platform/ds/logoa.bmp
+++ b/backends/platform/ds/logoa.bmp
Binary files differ
diff --git a/backends/platform/ds/logob.bmp b/backends/platform/ds/logob.bmp
index 9c28f5f0a4..d5ee10d221 100644
--- a/backends/platform/ds/logob.bmp
+++ b/backends/platform/ds/logob.bmp
Binary files differ
diff --git a/backends/platform/ds/logoc.bmp b/backends/platform/ds/logoc.bmp
index 41ec429926..2ecb388db3 100644
--- a/backends/platform/ds/logoc.bmp
+++ b/backends/platform/ds/logoc.bmp
Binary files differ
diff --git a/backends/platform/ds/logod.bmp b/backends/platform/ds/logod.bmp
new file mode 100644
index 0000000000..c1ddb5e72d
--- /dev/null
+++ b/backends/platform/ds/logod.bmp
Binary files differ
diff --git a/backends/platform/ds/logoe.bmp b/backends/platform/ds/logoe.bmp
new file mode 100644
index 0000000000..9d9aec6049
--- /dev/null
+++ b/backends/platform/ds/logoe.bmp
Binary files differ
diff --git a/backends/platform/ds/logof.bmp b/backends/platform/ds/logof.bmp
new file mode 100644
index 0000000000..7706155b56
--- /dev/null
+++ b/backends/platform/ds/logof.bmp
Binary files differ