aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/ds/Makefile8
-rw-r--r--backends/platform/ds/arm9/Makefile105
-rw-r--r--backends/platform/ds/arm9/source/cdaudio.cpp41
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp275
-rw-r--r--backends/platform/ds/arm9/source/dsmain.h5
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp14
-rw-r--r--backends/platform/ds/arm9/source/touchkeyboard.cpp79
-rw-r--r--backends/platform/ds/arm9/source/touchkeyboard.h2
-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.bmpbin630 -> 630 bytes
-rw-r--r--backends/platform/ds/logoe.bmpbin630 -> 630 bytes
-rw-r--r--backends/platform/ds/logof.bmpbin630 -> 630 bytes
-rw-r--r--backends/platform/ds/logog.bmpbin630 -> 630 bytes
-rw-r--r--backends/platform/ds/logoh.bmpbin0 -> 630 bytes
-rw-r--r--backends/platform/ds/logoi.bmpbin0 -> 630 bytes
-rw-r--r--backends/platform/ds/logoj.bmpbin0 -> 630 bytes
-rw-r--r--backends/platform/ds/logok.bmpbin0 -> 630 bytes
19 files changed, 383 insertions, 146 deletions
diff --git a/backends/platform/ds/Makefile b/backends/platform/ds/Makefile
index 46467b9058..58d6fd4c02 100644
--- a/backends/platform/ds/Makefile
+++ b/backends/platform/ds/Makefile
@@ -38,6 +38,10 @@ allbuilds:
$(MAKE) all SCUMM_BUILD=g
$(MAKE) semiclean
$(MAKE) all SCUMM_BUILD=h
+ $(MAKE) semiclean
+ $(MAKE) all SCUMM_BUILD=i
+ $(MAKE) semiclean
+ $(MAKE) all SCUMM_BUILD=k
allbuildssafe:
$(MAKE) clean SCUMM_BUILD=a
@@ -56,3 +60,7 @@ allbuildssafe:
$(MAKE) all SCUMM_BUILD=g
$(MAKE) clean SCUMM_BUILD=h
$(MAKE) all SCUMM_BUILD=h
+ $(MAKE) clean SCUMM_BUILD=i
+ $(MAKE) all SCUMM_BUILD=i
+ $(MAKE) clean SCUMM_BUILD=k
+ $(MAKE) all SCUMM_BUILD=k
diff --git a/backends/platform/ds/arm9/Makefile b/backends/platform/ds/arm9/Makefile
index 225278d579..86e40c7e2f 100644
--- a/backends/platform/ds/arm9/Makefile
+++ b/backends/platform/ds/arm9/Makefile
@@ -8,31 +8,38 @@ libndsdir = $(DEVKITPRO)/libnds
# Select the build by setting SCUMM_BUILD to a,b,c,d,e,f or g.
# Anything else gets build a.
-ifeq ($(SCUMM_BUILD),i)
- DS_BUILD_I = 1
+ifeq ($(SCUMM_BUILD),k)
+ DS_BUILD_K = 1
else
- ifeq ($(SCUMM_BUILD),h)
- DS_BUILD_H = 1
+ ifeq ($(SCUMM_BUILD),j)
+ DS_BUILD_J = 1
+ else
+ ifeq ($(SCUMM_BUILD),i)
+ DS_BUILD_I = 1
else
- ifeq ($(SCUMM_BUILD),g)
- DS_BUILD_G = 1
+ ifeq ($(SCUMM_BUILD),h)
+ DS_BUILD_H = 1
else
- ifeq ($(SCUMM_BUILD),f)
- DS_BUILD_F = 1
+ ifeq ($(SCUMM_BUILD),g)
+ DS_BUILD_G = 1
else
- ifeq ($(SCUMM_BUILD),e)
- DS_BUILD_E = 1
+ ifeq ($(SCUMM_BUILD),f)
+ DS_BUILD_F = 1
else
- ifeq ($(SCUMM_BUILD),d)
- DS_BUILD_D = 1
+ ifeq ($(SCUMM_BUILD),e)
+ DS_BUILD_E = 1
else
- ifeq ($(SCUMM_BUILD),c)
- DS_BUILD_C = 1
+ ifeq ($(SCUMM_BUILD),d)
+ DS_BUILD_D = 1
else
- ifeq ($(SCUMM_BUILD),b)
- DS_BUILD_B = 1
+ ifeq ($(SCUMM_BUILD),c)
+ DS_BUILD_C = 1
else
- DS_BUILD_A = 1
+ ifeq ($(SCUMM_BUILD),b)
+ DS_BUILD_B = 1
+ else
+ DS_BUILD_A = 1
+ endif
endif
endif
endif
@@ -41,6 +48,7 @@ else
endif
endif
endif
+endif
# To do:
# - FAT cache?
@@ -58,9 +66,18 @@ else
# TODO: Inherit the earth uses so much RAM that I have removed libmad in order to
# claw some back.
+
else
- USE_MAD = 1
+ ifdef DS_BUILD_I
+
+ else
+ ifdef DS_BUILD_K
+
+ else
+ USE_MAD = 1
+ endif
+ endif
endif
endif
@@ -150,28 +167,51 @@ endif
ifdef DS_BUILD_H
DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_H
- LOGO = logog.bmp
+ LOGO = logoh.bmp
ENABLE_PARALLACTION = STATIC_PLUGIN
BUILD=scummvm-H
endif
ifdef DS_BUILD_I
- DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_H
- LOGO = logog.bmp
- ENABLE_TUCKER = STATIC_PLUGIN
- BUILD=scummvm-H
+ DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_I
+ LOGO = logoi.bmp
+ ENABLE_MADE = STATIC_PLUGIN
+ BUILD=scummvm-I
+endif
+
+ifdef DS_BUILD_K
+ DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_K
+ LOGO = logok.bmp
+ ENABLE_CRUISE = STATIC_PLUGIN
+ BUILD=scummvm-K
endif
+
+#ifdef DS_BUILD_L
+# DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_L
+# LOGO = logog.bmp
+# ENABLE_DRASCULA = STATIC_PLUGIN
+# BUILD=scummvm-K
+#endif
+
+#ifdef DS_BUILD_M
+# DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_M
+# LOGO = logog.bmp
+# ENABLE_TUCKER = STATIC_PLUGIN
+# BUILD=scummvm-K
+#endif
+
ARM7BIN := -7 $(CURDIR)/../../arm7/arm7.bin
ICON := -b ../../../logo.bmp "ScummVM;By Neil Millstone;"
CC = arm-eabi-gcc
CXX = arm-eabi-g++
+LD = arm-eabi-g++
CFLAGS = -Wno-multichar -Wall\
-Wno-multichar -mcpu=arm9tdmi -mtune=arm9tdmi \
-mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer\
- -mthumb-interwork -DUSE_ARM_COSTUME_ASM=1
+ -mthumb-interwork -DUSE_ARM_COSTUME_ASM=1 -DDISABLE_SID
# -ffast-math
@@ -187,7 +227,7 @@ ifdef USE_PROFILER
endif
CXXFLAGS= $(CFLAGS) -Wno-non-virtual-dtor -Wno-unknown-pragmas -Wno-reorder \
- -fno-exceptions -fno-rtti -mthumb-interwork -ffunction-sections -fdata-sections
+ -fno-exceptions -fno-rtti -mthumb-interwork -ffunction-sections -fdata-sections -fno-strict-aliasing
# -mthumb
@@ -293,12 +333,19 @@ 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 mame.cpp rate.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp
+OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp mame.cpp rate.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp script.cpp
#OPTLIST :=
# Compiler options for files which should be optimised for speed
-OPT_SPEED := -O3
-#OPT_SPEED := -Os -mthumb
+ifdef DS_BUILD_E
+# Another attempt to save some RAM in ITE
+OPT_SPEED := -O3 -mthumb
+else
+#OPT_SPEED := -O3
+
+OPT_SPEED := -Os -mthumb
+
+endif
# Compiler options for files which should be optimised for space
OPT_SIZE := -Os -mthumb
@@ -315,7 +362,7 @@ MODULE_DIRS += .
ndsall:
@[ -d $(BUILD) ] || mkdir -p $(BUILD)
- $(MAKE) -C ./$(BUILD) -f ../Makefile scummvm.nds
+ make -C ./$(BUILD) -f ../makefile scummvm.nds
include $(srcdir)/Makefile.common
diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp
index 140c709a8c..7756286117 100644
--- a/backends/platform/ds/arm9/source/cdaudio.cpp
+++ b/backends/platform/ds/arm9/source/cdaudio.cpp
@@ -137,18 +137,21 @@ void playTrack(int track, int numLoops, int startFrame, int duration) {
char str[100];
- if (path[strlen(path.c_str()) - 1] == '/') {
- sprintf(str, "track%d.wav", track);
- path = path + str;
- } else {
- sprintf(str, "/track%d.wav", track);
- path = path + str;
+ if (path[strlen(path.c_str()) - 1] != '/') {
+ path = path + "/";
}
+ Common::String fname;
- //1820160
+ sprintf(str, "track%d.wav", track);
+ fname = path + str;
+ file = DS::std_fopen(fname.c_str(), "rb");
- file = DS::std_fopen(path.c_str(), "rb");
+ if (!file) {
+ sprintf(str, "track%02d.wav", track);
+ fname = path + str;
+ file = DS::std_fopen(fname.c_str(), "rb");
+ }
if (!file) {
consolePrintf("Failed to open %s!\n", path.c_str());
@@ -158,6 +161,8 @@ void playTrack(int track, int numLoops, int startFrame, int duration) {
DS::std_fread((const void *) &waveHeader, sizeof(waveHeader), 1, file);
+ consolePrintf("File: %s\n", fname.c_str());
+
consolePrintf("Playing track %d\n", track);
consolePrintf("Format: %d\n", waveHeader.fmtFormatTag);
consolePrintf("Rate : %d\n", waveHeader.fmtSamPerSec);
@@ -496,6 +501,26 @@ bool trackExists(int num) {
setActive(true);
DS::std_fclose(file);
return true;
+ }
+
+ sprintf(fname, "track%02d.wav", num);
+
+ path = ConfMan.get("path");
+
+ if (path[strlen(path.c_str()) - 1] == '/') {
+ path = path + fname;
+ } else {
+ path = path + "/" + fname;
+ }
+
+ consolePrintf("Looking for %s...", path.c_str());
+
+
+ if ((file = DS::std_fopen(path.c_str(), "r"))) {
+ consolePrintf("Success!\n");
+ setActive(true);
+ DS::std_fclose(file);
+ return true;
} else {
setActive(false);
consolePrintf("Failed!\n");
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index f959074d49..4132f4b138 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -117,17 +117,20 @@ static const char *registerNames[] =
extern "C" void* __real_malloc(size_t size);
+int total = 0;
+
void* operator new (size_t size)
{
register unsigned int reg asm("lr");
volatile unsigned int poo = reg;
void* res = __real_malloc(size);
+ total += size;
if (!res)
{
// *((u8 *) NULL) = 0;
- consolePrintf("Failed alloc (new) %d (%x)\n", size, poo);
+ consolePrintf("Failed alloc (new) %d (%d)\n", size, total);
return NULL;
}
@@ -155,18 +158,20 @@ extern "C" void* __wrap_malloc(size_t size) {
void* res = __real_malloc(size);
if (res) {
- if (size > 100 * 1024) {
- consolePrintf("Allocated %d (%d)\n", size, poo);
+ if (size > 50 * 1024) {
+ consolePrintf("Allocated %d (%x)\n", size, poo);
}
+ total += size;
return res;
} else {
// *((u8 *) NULL) = 0;
- consolePrintf("Failed alloc %d (%x)\n", size, poo);
+ consolePrintf("Failed alloc %d (%d)\n", size, total);
return NULL;
}
}
+
#endif
namespace DS {
@@ -545,6 +550,22 @@ int getSoundFrequency() {
return soundFrequency;
}
+void setControls(char* gameName) {
+
+ for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) {
+ if (!stricmp(gameName, gameList[r].gameId)) {
+ currentGame = &gameList[r];
+ consolePrintf("Current game set to: %s\n", gameName);
+ return;
+ }
+ }
+
+ consolePrintf("Failed to set current game to: %s\n", gameName);
+}
+
+void exitGame() {
+ currentGame = NULL;
+}
void initGame() {
// This is a good time to check for left handed mode since the mode change is done as the game starts.
@@ -558,15 +579,18 @@ void initGame() {
setOptions();
//strcpy(gameName, ConfMan.getActiveDomain().c_str());
- strcpy(gameName, ConfMan.get("gameid").c_str());
-// consolePrintf("\n\n\n\nCurrent game: '%s' %d\n", gameName, gameName[0]);
-
- currentGame = &gameList[0]; // Default game
-
- for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) {
- if (!stricmp(gameName, gameList[r].gameId)) {
- currentGame = &gameList[r];
-// consolePrintf("Game list num: %d\n", currentGame);
+ if (currentGame == NULL) {
+
+ strcpy(gameName, ConfMan.get("gameid").c_str());
+ // consolePrintf("\n\n\n\nCurrent game: '%s' %d\n", gameName, gameName[0]);
+
+ currentGame = &gameList[0]; // Default game
+
+ for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) {
+ if (!stricmp(gameName, gameList[r].gameId)) {
+ currentGame = &gameList[r];
+ // consolePrintf("Game list num: %d\n", currentGame);
+ }
}
}
@@ -879,6 +903,8 @@ void displayMode16Bit() {
releaseAllKeys();
+ setKeyboardEnable(false);
+
if (!displayModeIs8Bit) {
for (int r = 0; r < 32 * 32; r++) {
buffer[r] = ((u16 *) SCREEN_BASE_BLOCK_SUB(4))[r];
@@ -1326,32 +1352,34 @@ void doScreenTapMode(OSystem_DS* system)
right = true;
}
-
- if (getKeysDown() & KEY_LEFT) {
- event.type = Common::EVENT_LBUTTONDOWN;
- event.mouse = Common::Point(getPenX(), getPenY());
- system->addEvent(event);
- }
-
- if (getKeysReleased() & KEY_LEFT) {
- event.type = Common::EVENT_LBUTTONUP;
- event.mouse = Common::Point(getPenX(), getPenY());
- system->addEvent(event);
- }
-
-
- if (getKeysDown() & KEY_RIGHT) {
- event.type = Common::EVENT_RBUTTONDOWN;
- event.mouse = Common::Point(getPenX(), getPenY());
- system->addEvent(event);
- }
-
- if (getKeysReleased() & KEY_RIGHT) {
- event.type = Common::EVENT_RBUTTONUP;
- event.mouse = Common::Point(getPenX(), getPenY());
- system->addEvent(event);
+ if (!(getKeysHeld() & (KEY_L | KEY_R))) {
+
+ if (getKeysDown() & KEY_LEFT) {
+ event.type = Common::EVENT_LBUTTONDOWN;
+ event.mouse = Common::Point(getPenX(), getPenY());
+ system->addEvent(event);
+ }
+
+ if (getKeysReleased() & KEY_LEFT) {
+ event.type = Common::EVENT_LBUTTONUP;
+ event.mouse = Common::Point(getPenX(), getPenY());
+ system->addEvent(event);
+ }
+
+
+ if (getKeysDown() & KEY_RIGHT) {
+ event.type = Common::EVENT_RBUTTONDOWN;
+ event.mouse = Common::Point(getPenX(), getPenY());
+ system->addEvent(event);
+ }
+
+ if (getKeysReleased() & KEY_RIGHT) {
+ event.type = Common::EVENT_RBUTTONUP;
+ event.mouse = Common::Point(getPenX(), getPenY());
+ system->addEvent(event);
+ }
}
-
+
event.type = Common::EVENT_MOUSEMOVE;
event.mouse = Common::Point(getPenX(), getPenY());
system->addEvent(event);
@@ -1487,8 +1515,8 @@ void addEventsToQueue() {
OSystem_DS* system = OSystem_DS::instance();
Common::Event event;
-
#ifdef USE_PROFILER
+/*
if (keysDown() & KEY_R) {
cygprofile_begin();
cygprofile_enable();
@@ -1497,9 +1525,11 @@ void addEventsToQueue() {
cygprofile_disable();
cygprofile_end();
}
+*/
#endif
+
if (system->isEventQueueEmpty()) {
/*
@@ -1645,18 +1675,27 @@ void addEventsToQueue() {
Common::Event event;
- if (!keyboardEnable) {
-
- if ((tapScreenClicks) && (getIsDisplayMode8Bit())) {
+ if ((tapScreenClicks) && (getIsDisplayMode8Bit())) {
+ if ((!keyboardEnable) || (!isInsideKeyboard(penDownX, penDownY))) {
doScreenTapMode(system);
- } else {
+ }
+ } else {
+ if (!keyboardEnable) {
doButtonSelectMode(system);
+ } else if ((!keyboardEnable) || (!isInsideKeyboard(penDownX, penDownY))) {
+ doScreenTapMode(system);
}
+ }
+
+
+ if (!keyboardEnable) {
+
if (((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) || (indyFightState)) && (displayModeIs8Bit)) {
// Controls specific to the control method
+
if (currentGame->control == CONT_SKY) {
// Extra controls for Beneath a Steel Sky
if ((getKeysDown() & KEY_DOWN)) {
@@ -1665,6 +1704,26 @@ void addEventsToQueue() {
}
}
+ if (currentGame->control == CONT_AGI) {
+ // Extra controls for Leisure Suit Larry and KQ4
+
+ if ((getKeysHeld() & KEY_UP) && (getKeysHeld() & KEY_START)
+ /*&& (!strcmp(gameName, "LLLLL"))*/) {
+ consolePrintf("Cheat key!\n");
+ event.type = Common::EVENT_KEYDOWN;
+ event.kbd.keycode = (Common::KeyCode)'X'; // Skip age test in LSL
+ event.kbd.ascii = 'X';
+ event.kbd.flags = Common::KBD_ALT;
+ system->addEvent(event);
+
+ event.type = Common::EVENT_KEYUP;
+ system->addEvent(event);
+ }
+
+ }
+
+
+
if (currentGame->control == CONT_SIMON) {
// Extra controls for Simon the Sorcerer
if ((getKeysDown() & KEY_DOWN)) {
@@ -2019,10 +2078,8 @@ void VBlankHandler(void) {
frameCount++;
if ((cursorEnable) && (mouseCursorVisible)) {
- if (!keyboardEnable) {
- storedMouseX = penX;
- storedMouseY = penY;
- }
+ storedMouseX = penX;
+ storedMouseY = penY;
if (gameScreenSwap) {
setIcon(3, storedMouseX - mouseHotspotX, storedMouseY - mouseHotspotY, 8, 0, true);
@@ -2177,20 +2234,20 @@ void VBlankHandler(void) {
int offsX = 0, offsY = 0;
- if (getKeysHeld() & KEY_LEFT) {
- offsX -= 1;
+ if ((getKeysHeld() & KEY_LEFT)) {
+ offsX -= 2;
}
- if (getKeysHeld() & KEY_RIGHT) {
- offsX += 1;
+ if ((getKeysHeld() & KEY_RIGHT)) {
+ offsX += 2;
}
- if (getKeysHeld() & KEY_UP) {
- offsY -= 1;
+ if ((getKeysHeld() & KEY_UP)) {
+ offsY -= 2;
}
- if (getKeysHeld() & KEY_DOWN) {
- offsY += 1;
+ if ((getKeysHeld() & KEY_DOWN)) {
+ offsY += 2;
}
if (((gameScreenSwap) && (getKeysHeld() & KEY_L)) || ((!gameScreenSwap) && (getKeysHeld() & KEY_R))) {
@@ -2491,7 +2548,8 @@ void penUpdate() {
bool penDownThisFrame = (IPC->touchZ1 > 0) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0);
static bool moved = false;
- if ((tapScreenClicks) && (!getKeyboardEnable()) && (getIsDisplayMode8Bit())) {
+ if (( (tapScreenClicks) || getKeyboardEnable() ) && (getIsDisplayMode8Bit())) {
+
if ((tapTimeout >= 0)) {
tapTimeout++;
@@ -2506,7 +2564,7 @@ void penUpdate() {
if ((penHeld) && (!penDownThisFrame)) {
- if ((touchPadStyle) || (moved) || (tapCount == 1)) {
+ if ((touchPadStyle) || (getKeyboardEnable() && (!isInsideKeyboard(penDownX, penDownY))) || (moved) || (tapCount == 1)) {
if ((penDownFrames > 0) && (penDownFrames < 6) && ((tapTimeout == -1) || (tapTimeout > 2))) {
tapCount++;
tapTimeout = 0;
@@ -2518,40 +2576,56 @@ void penUpdate() {
}
+ if ( ((keyboardEnable) || (touchPadStyle)) && (getIsDisplayMode8Bit()) ) {
+ // Relative positioning mode
- if ((touchPadStyle) && (getIsDisplayMode8Bit())) {
-
- if ((penDownFrames > 0)) {
+ if ((penDownFrames > 0) ) {
if ((penHeld)) {
- if (penDownThisFrame)
- {
+ if (penDownThisFrame) {
if (penDownFrames >= 2) {
- int diffX = IPC->touchXpx - penDownX;
- int diffY = IPC->touchYpx - penDownY;
- int speed = ABS(diffX) + ABS(diffY);
-
- if ((ABS(diffX) < 35) && (ABS(diffY) < 35))
- {
-
- if (speed >= 8)
- {
- diffX *= ((speed >> 3) * touchPadSensitivity) >> 3;
- diffY *= ((speed >> 3) * touchPadSensitivity) >> 3;
+ if ((!keyboardEnable) || (!isInsideKeyboard(IPC->touchXpx, IPC->touchYpx))) {
+ int diffX = IPC->touchXpx - penDownX;
+ int diffY = IPC->touchYpx - penDownY;
+
+ int speed = ABS(diffX) + ABS(diffY);
+
+ if ((ABS(diffX) < 35) && (ABS(diffY) < 35)) {
+
+ if (speed >= 8) {
+ diffX *= ((speed >> 3) * touchPadSensitivity) >> 3;
+ diffY *= ((speed >> 3) * touchPadSensitivity) >> 3;
+ }
+
+ penX += diffX;
+ penY += diffY;
+
+ if (penX > 255) {
+ scX -= 255 - penX;
+ penX = 255;
+ }
+
+ if (penX < 0) {
+ scX -= -penX;
+ penX = 0;
+ }
+
+ if (penY > 191) {
+ scY += penY - 191;
+ penY = 191;
+ }
+
+ if (penY < 0) {
+ scY -= -penY;
+ penY = 0;
+ }
}
-
- penX += diffX;
- penY += diffY;
- if (penX > 255) penX = 255;
- if (penX < 0) penX = 0;
- if (penY > 191) penY = 191;
- if (penY < 0) penY = 0;
+
+ // consolePrintf("x: %d y: %d\n", IPC->touchYpx - penDownY, IPC->touchYpx - penDownY);
}
-
-// consolePrintf("x: %d y: %d\n", IPC->touchYpx - penDownY, IPC->touchYpx - penDownY);
penDownX = IPC->touchXpx;
penDownY = IPC->touchYpx;
@@ -2561,7 +2635,6 @@ void penUpdate() {
{
}
-
} else {
penDown = true;
penHeld = true;
@@ -2573,7 +2646,6 @@ void penUpdate() {
penDownY = IPC->touchYpx;
}
}
-
} else {
if (penHeld) {
penReleased = true;
@@ -2585,13 +2657,19 @@ void penUpdate() {
penDown = false;
penHeld = false;
}
- } else {
+
+
+ } else { // Absolute positioning mode
if ((penDownFrames > 1)) { // Is this right? Dunno, but it works for me.
if ((penHeld)) {
penHeld = true;
penDown = false;
} else {
+ if (penDownFrames == 2) {
+ penDownX = IPC->touchXpx;
+ penDownY = IPC->touchYpx;
+ }
penDown = true;
penHeld = true;
penDownSaved = true;
@@ -2604,7 +2682,6 @@ void penUpdate() {
}
-
} else {
if (penHeld) {
penReleased = true;
@@ -2616,8 +2693,6 @@ void penUpdate() {
penDown = false;
penHeld = false;
}
-
-
}
@@ -2971,13 +3046,17 @@ void dsExceptionHandler() {
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]);
}
+ while(1);
u32 *stack = (u32 *)exceptionRegisters[13];
+
+
for ( i=0; i<10; i++ ) {
consolePrintf("%08X %08X %08X\n", stack[i*3], stack[i*3+1], stack[(i*3)+2] );
}
@@ -3007,6 +3086,7 @@ int main(void) {
}
#endif
+
// Let arm9 read cartridge
*((u16 *) (0x04000204)) &= ~0x0080;
@@ -3080,7 +3160,7 @@ int main(void) {
consolePrintf("-------------------------------\n");
consolePrintf("ScummVM DS\n");
consolePrintf("Ported by Neil Millstone\n");
- consolePrintf("Version 1.0.0 RC1 ");
+ consolePrintf("Version 1.0.0 ");
#if defined(DS_BUILD_A)
consolePrintf("build A\n");
consolePrintf("Lucasarts SCUMM games (SCUMM)\n");
@@ -3105,6 +3185,12 @@ int main(void) {
#elif defined(DS_BUILD_H)
consolePrintf("build H\n");
consolePrintf("Nippon Safes (PARALLATION)\n");
+#elif defined(DS_BUILD_I)
+ consolePrintf("build I\n");
+ consolePrintf("Activision Games (MADE)\n");
+#elif defined(DS_BUILD_K)
+ consolePrintf("build K\n");
+ consolePrintf("Cruise for a Corpse (Cruise)\n");
#endif
consolePrintf("-------------------------------\n");
consolePrintf("L/R + D-pad/pen: Scroll view\n");
@@ -3249,13 +3335,21 @@ int main(void) {
const char *argv[] = {"/scummvmds", "--config=scummvmg.ini"};
#elif defined(DS_BUILD_H)
const char *argv[] = {"/scummvmds", "--config=scummvmh.ini"};
+#elif defined(DS_BUILD_I)
+ const char *argv[] = {"/scummvmds", "--config=scummvmi.ini"};
+#elif defined(DS_BUILD_J)
+ const char *argv[] = {"/scummvmds", "--config=scummvmj.ini"};
+#elif defined(DS_BUILD_K)
+ const char *argv[] = {"/scummvmds", "--config=scummvmk.ini"};
#endif
+
while (1) {
scummvm_main(ARRAYSIZE(argv), (char **) &argv);
powerOff();
}
+
return 0;
}
@@ -3273,6 +3367,9 @@ int cygprofile_getHBlanks() __attribute__ ((no_instrument_function));
int cygprofile_getHBlanks() {
return DS::hBlankCount;
}
+
+
+extern "C" void consolePrintf(char * format, ...) __attribute__ ((no_instrument_function));
#endif
diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h
index 223221d80e..beda592ba2 100644
--- a/backends/platform/ds/arm9/source/dsmain.h
+++ b/backends/platform/ds/arm9/source/dsmain.h
@@ -68,6 +68,9 @@ int leftHandedSwap(int keys);
void setGameScreenSwap(bool enable);
void setSensitivity(int sensitivity);
+// Controls options
+void setControls(char* gameName);
+
// Video
void displayMode8Bit(); // Switch to 8-bit mode5
void displayMode16Bit(); // Switch to 16-bit mode5
@@ -151,7 +154,7 @@ int getGameHeight();
void fastRamReset();
void* fastRamAlloc(int size);
-
+void exitGame();
gameListType* getCurrentGame();
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 8ea9b06b23..111f3a888b 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -60,6 +60,12 @@
#define DEFAULT_CONFIG_FILE "scummvmg.ini"
#elif defined(DS_BUILD_H)
#define DEFAULT_CONFIG_FILE "scummvmh.ini"
+#elif defined(DS_BUILD_I)
+#define DEFAULT_CONFIG_FILE "scummvmi.ini"
+#elif defined(DS_BUILD_J)
+#define DEFAULT_CONFIG_FILE "scummvmj.ini"
+#elif defined(DS_BUILD_K)
+#define DEFAULT_CONFIG_FILE "scummvmk.ini"
#endif
OSystem_DS* OSystem_DS::_instance = NULL;
@@ -177,7 +183,7 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) {
green >>= 3;
blue >>= 3;
- //if (r != 255)
+// if (r != 255)
{
u16 paletteValue = red | (green << 5) | (blue << 10);
@@ -265,12 +271,13 @@ void OSystem_DS::grabPalette(unsigned char *colours, uint start, uint num) {
#define MISALIGNED16(ptr) (((u32) (ptr) & 1) != 0)
void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
- //consolePrintf("Copy rect %d, %d %d, %d ", x, y, w, h);
if (!_graphicsEnable) return;
if (w <= 1) return;
if (h < 0) return;
if (!DS::getIsDisplayMode8Bit()) return;
+// consolePrintf("CopyRectToScreen %d\n", w * h);
+
u16* bg;
s32 stride;
u16* bgSub = (u16 *)BG_GFX_SUB;
@@ -452,6 +459,8 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int
}
void OSystem_DS::updateScreen() {
+ static int cnt = 0;
+// consolePrintf("updatescr %d\n", cnt++);
if ((_frameBufferExists) && (DS::getIsDisplayMode8Bit())) {
_frameBufferExists = false;
@@ -883,6 +892,7 @@ u16 OSystem_DS::applyGamma(u16 colour) {
void OSystem_DS::engineDone() {
// Scumm games appear not to stop their CD audio, so I stop the CD here.
stopCD();
+ DS::exitGame();
#ifdef ENABLE_AGI
DS::clearAutoCompleteWordList();
diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp
index ddf182950d..2d4b6a94f4 100644
--- a/backends/platform/ds/arm9/source/touchkeyboard.cpp
+++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp
@@ -156,6 +156,29 @@ char autoCompleteBuffer[128];
int selectedCompletion = -1;
int charactersEntered = 0;
+int typingTimeout = 0;
+
+// Render text onto the tiled screen
+
+void drawText(int tx, int ty, char* string, bool highlight) {
+
+ u16 baseValue = 0;
+
+ if (highlight) {
+ baseValue |= 0x1000;
+ }
+
+ for (int p = 0; *string; string++, p++) {
+ char c = *string;
+
+ if (c != ' ') {
+ int tile = c - 33 + (KEYBOARD_DATA_SIZE / 32);
+ baseAddress[ty * 32 + tx + p] = baseValue | tile;
+ }
+ }
+
+}
+
void restoreVRAM(int tileBase, int mapBase, u16* saveSpace) {
@@ -246,12 +269,16 @@ void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) {
keys[r].pressed = false;
}
+
closed = false;
clearAutoComplete();
+
}
+
void drawAutoComplete() {
+ // Clear the auto complete area at the bottom of the screen.
for (int y = 12; y < 24; y++) {
for (int x = 0; x < 32; x++) {
baseAddress[y * 32 + x] = 0;
@@ -259,23 +286,26 @@ void drawAutoComplete() {
}
- for (int r = 0; r < autoCompleteCount; r++) {
- int y = 12 + (r % 6) * 2;
- int x = 0 + ((r / 6) * 16);
-
- for (int p = 0; autoCompleteWord[r][p] != 0; p++) {
- char c = autoCompleteWord[r][p];
-
- int tile = c - 33 + (KEYBOARD_DATA_SIZE / 32);
+ if ((autoCompleteCount == 0) || (typingTimeout > 0)) {
- if (selectedCompletion == r) {
- tile |= 0x1000;
- }
+ // When there's no completions on the bottom of the screen, it acts like a mouse pad
+ // so this text indicates that
+ drawText(11, 18, "MOUSE AREA", true);
+
- baseAddress[y * 32 + x + p] = tile;
+ } else {
+ consolePrintf("time: %d\n", typingTimeout);
+ // Otherwise, draw autocompletions if one isn't being entered and there are
+ // some available.
+ for (int r = 0; r < autoCompleteCount; r++) {
+ int y = 12 + (r % 6) * 2;
+ int x = 0 + ((r / 6) * 16);
+
+ drawText(x, y, autoCompleteWord[r], selectedCompletion == r);
}
+
}
}
@@ -309,6 +339,12 @@ void setCharactersEntered(int count) {
charactersEntered = count;
}
+bool isInsideKeyboard(int x, int y) {
+ // When completions are available, keyboard covers the whole screen.
+ // otherwise, it only covers the area above KEYBOARD_BOTTOM_Y
+ return (autoCompleteCount > 0) || (y < KEYBOARD_BOTTOM_Y);
+}
+
void clearAutoComplete() {
autoCompleteCount = 0;
selectedCompletion = -1;
@@ -345,10 +381,8 @@ void typeCompletion(int current) {
system->addEvent(event);*/
}
-void updateTypeEvents()
-{
- if (autoCompleteBuffer[0] != '\0')
- {
+void updateTypeEvents() {
+ if (autoCompleteBuffer[0] != '\0') {
Common::Event event;
OSystem_DS* system = OSystem_DS::instance();
@@ -365,6 +399,8 @@ void updateTypeEvents()
{
autoCompleteBuffer[r] = autoCompleteBuffer[r + 1];
}
+
+ typingTimeout = 100;
}
}
@@ -424,6 +460,13 @@ void addKeyboardEvents() {
updateTypeEvents();
+ if (typingTimeout > 0) {
+ typingTimeout--;
+ if (typingTimeout == 0) {
+ drawAutoComplete();
+ }
+ }
+
if (DS::getPenDown()) {
int x = IPC->touchXpx;
int y = IPC->touchYpx;
@@ -443,7 +486,9 @@ void addKeyboardEvents() {
if (selectedCompletion == current) {
typeCompletion(current);
} else {
- selectedCompletion = current;
+ if (current < autoCompleteCount) {
+ selectedCompletion = current;
+ }
}
drawAutoComplete();
diff --git a/backends/platform/ds/arm9/source/touchkeyboard.h b/backends/platform/ds/arm9/source/touchkeyboard.h
index 2894281962..6ceb83bfc7 100644
--- a/backends/platform/ds/arm9/source/touchkeyboard.h
+++ b/backends/platform/ds/arm9/source/touchkeyboard.h
@@ -29,6 +29,7 @@ namespace DS {
static const int NUM_WORDS = 12;
static const int KEYBOARD_DATA_SIZE = 4736 * 2;
+static const int KEYBOARD_BOTTOM_Y = 105;
void createKeyEvent(int keyNum, Common::Event& event);
@@ -36,6 +37,7 @@ void drawKeyboard(int tileBase, int mapBase, u16* saveSpace);
void restoreVRAM(int tileBase, int mapBase, u16* saveSpace);
void addKeyboardEvents();
bool getKeyboardClosed();
+bool isInsideKeyboard(int x, int y);
void addAutoComplete(const char* word);
void clearAutoComplete();
diff --git a/backends/platform/ds/logoa.bmp b/backends/platform/ds/logoa.bmp
index 8bee29bc17..acac9b2272 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 d5ee10d221..64cb1044e5 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 2ecb388db3..ca82c5d083 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
index c1ddb5e72d..02f8765d33 100644
--- a/backends/platform/ds/logod.bmp
+++ b/backends/platform/ds/logod.bmp
Binary files differ
diff --git a/backends/platform/ds/logoe.bmp b/backends/platform/ds/logoe.bmp
index 9d9aec6049..2f6a2b720d 100644
--- a/backends/platform/ds/logoe.bmp
+++ b/backends/platform/ds/logoe.bmp
Binary files differ
diff --git a/backends/platform/ds/logof.bmp b/backends/platform/ds/logof.bmp
index 7706155b56..5f22f164f2 100644
--- a/backends/platform/ds/logof.bmp
+++ b/backends/platform/ds/logof.bmp
Binary files differ
diff --git a/backends/platform/ds/logog.bmp b/backends/platform/ds/logog.bmp
index 9c194d3f82..fe7447058c 100644
--- a/backends/platform/ds/logog.bmp
+++ b/backends/platform/ds/logog.bmp
Binary files differ
diff --git a/backends/platform/ds/logoh.bmp b/backends/platform/ds/logoh.bmp
new file mode 100644
index 0000000000..5441bed5c9
--- /dev/null
+++ b/backends/platform/ds/logoh.bmp
Binary files differ
diff --git a/backends/platform/ds/logoi.bmp b/backends/platform/ds/logoi.bmp
new file mode 100644
index 0000000000..07c5d8c71d
--- /dev/null
+++ b/backends/platform/ds/logoi.bmp
Binary files differ
diff --git a/backends/platform/ds/logoj.bmp b/backends/platform/ds/logoj.bmp
new file mode 100644
index 0000000000..fb1c1a397a
--- /dev/null
+++ b/backends/platform/ds/logoj.bmp
Binary files differ
diff --git a/backends/platform/ds/logok.bmp b/backends/platform/ds/logok.bmp
new file mode 100644
index 0000000000..95130d6da2
--- /dev/null
+++ b/backends/platform/ds/logok.bmp
Binary files differ