[Scummvm-cvs-logs] SF.net SVN: scummvm:[44728] scummvm/branches/branch-1-0-0/backends/platform /ds/arm9/source
agent-q at users.sourceforge.net
agent-q at users.sourceforge.net
Wed Oct 7 14:33:46 CEST 2009
Revision: 44728
http://scummvm.svn.sourceforge.net/scummvm/?rev=44728&view=rev
Author: agent-q
Date: 2009-10-07 12:33:45 +0000 (Wed, 07 Oct 2009)
Log Message:
-----------
DS port:
- Adding mouse pad undeneath onscreen keyboard
- Add ability to scroll when cursor reaches edge of screen (in mouse pad mode)
- Make cd audio read from track01.wav as well as track1.wav
- Fix bug with switching modes with keyboard active
Modified Paths:
--------------
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/cdaudio.cpp
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.cpp
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.h
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/osystem_ds.cpp
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/touchkeyboard.cpp
scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/touchkeyboard.h
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/cdaudio.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/cdaudio.cpp 2009-10-07 12:27:21 UTC (rev 44727)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/cdaudio.cpp 2009-10-07 12:33:45 UTC (rev 44728)
@@ -137,18 +137,21 @@
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 @@
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,7 +501,27 @@
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");
return false;
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.cpp 2009-10-07 12:27:21 UTC (rev 44727)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.cpp 2009-10-07 12:33:45 UTC (rev 44728)
@@ -545,7 +545,23 @@
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.
// There's probably a better way, but hey.
@@ -558,15 +574,18 @@
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 +898,8 @@
releaseAllKeys();
+ setKeyboardEnable(false);
+
if (!displayModeIs8Bit) {
for (int r = 0; r < 32 * 32; r++) {
buffer[r] = ((u16 *) SCREEN_BASE_BLOCK_SUB(4))[r];
@@ -1326,32 +1347,34 @@
right = true;
}
-
- if (getKeysDown() & KEY_LEFT) {
- event.type = Common::EVENT_LBUTTONDOWN;
- 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);
+ }
}
-
- 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 +1510,8 @@
OSystem_DS* system = OSystem_DS::instance();
Common::Event event;
-
#ifdef USE_PROFILER
+/*
if (keysDown() & KEY_R) {
cygprofile_begin();
cygprofile_enable();
@@ -1497,9 +1520,11 @@
cygprofile_disable();
cygprofile_end();
}
+*/
#endif
+
if (system->isEventQueueEmpty()) {
/*
@@ -1645,18 +1670,27 @@
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 +1699,26 @@
}
}
+ 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 +2073,8 @@
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 +2229,20 @@
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,8 +2543,9 @@
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 +2559,7 @@
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 +2571,56 @@
}
+ 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 ((!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 ((ABS(diffX) < 35) && (ABS(diffY) < 35))
- {
+ if (penX > 255) {
+ scX -= 255 - penX;
+ penX = 255;
+ }
- if (speed >= 8)
- {
- diffX *= ((speed >> 3) * touchPadSensitivity) >> 3;
- diffY *= ((speed >> 3) * touchPadSensitivity) >> 3;
+ 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 +2630,6 @@
{
}
-
} else {
penDown = true;
penHeld = true;
@@ -2573,7 +2641,6 @@
penDownY = IPC->touchYpx;
}
}
-
} else {
if (penHeld) {
penReleased = true;
@@ -2585,13 +2652,19 @@
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 +2677,6 @@
}
-
} else {
if (penHeld) {
penReleased = true;
@@ -2616,8 +2688,6 @@
penDown = false;
penHeld = false;
}
-
-
}
@@ -2971,6 +3041,8 @@
consolePrintf(" pc: %08X addr: %08X\n\n",codeAddress,exceptionAddress);
+ while(1);
+
int i;
for ( i=0; i < 8; i++ ) {
consolePrintf(" %s: %08X %s: %08X\n",
@@ -2978,6 +3050,8 @@
registerNames[i+8],exceptionRegisters[i+8]);
}
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 +3081,7 @@
}
#endif
+
// Let arm9 read cartridge
*((u16 *) (0x04000204)) &= ~0x0080;
@@ -3080,7 +3155,7 @@
consolePrintf("-------------------------------\n");
consolePrintf("ScummVM DS\n");
consolePrintf("Ported by Neil Millstone\n");
- consolePrintf("Version 1.0.0 RC1 ");
+ consolePrintf("Version 1.0.0 beta3 ");
#if defined(DS_BUILD_A)
consolePrintf("build A\n");
consolePrintf("Lucasarts SCUMM games (SCUMM)\n");
@@ -3249,13 +3324,19 @@
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"};
#endif
+
while (1) {
scummvm_main(ARRAYSIZE(argv), (char **) &argv);
powerOff();
}
+
return 0;
}
@@ -3273,6 +3354,9 @@
int cygprofile_getHBlanks() {
return DS::hBlankCount;
}
+
+
+extern "C" void consolePrintf(char * format, ...) __attribute__ ((no_instrument_function));
#endif
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.h
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.h 2009-10-07 12:27:21 UTC (rev 44727)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/dsmain.h 2009-10-07 12:33:45 UTC (rev 44728)
@@ -68,6 +68,9 @@
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 @@
void fastRamReset();
void* fastRamAlloc(int size);
-
+void exitGame();
gameListType* getCurrentGame();
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/osystem_ds.cpp 2009-10-07 12:27:21 UTC (rev 44727)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/osystem_ds.cpp 2009-10-07 12:33:45 UTC (rev 44728)
@@ -60,6 +60,10 @@
#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"
#endif
OSystem_DS* OSystem_DS::_instance = NULL;
@@ -177,7 +181,7 @@
green >>= 3;
blue >>= 3;
- //if (r != 255)
+// if (r != 255)
{
u16 paletteValue = red | (green << 5) | (blue << 10);
@@ -265,12 +269,13 @@
#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 +457,8 @@
}
void OSystem_DS::updateScreen() {
+ static int cnt = 0;
+// consolePrintf("updatescr %d\n", cnt++);
if ((_frameBufferExists) && (DS::getIsDisplayMode8Bit())) {
_frameBufferExists = false;
@@ -877,6 +884,7 @@
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();
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/touchkeyboard.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/touchkeyboard.cpp 2009-10-07 12:27:21 UTC (rev 44727)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/touchkeyboard.cpp 2009-10-07 12:33:45 UTC (rev 44728)
@@ -156,8 +156,31 @@
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) {
/* for (int r = 0; r < 32 * 32; r++) {
((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = *saveSpace++;
@@ -246,12 +269,16 @@
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 @@
}
- for (int r = 0; r < autoCompleteCount; r++) {
- int y = 12 + (r % 6) * 2;
- int x = 0 + ((r / 6) * 16);
+ if ((autoCompleteCount == 0) || (typingTimeout > 0)) {
- for (int p = 0; autoCompleteWord[r][p] != 0; p++) {
- char c = autoCompleteWord[r][p];
+ // 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);
+
- int tile = c - 33 + (KEYBOARD_DATA_SIZE / 32);
+ } else {
- if (selectedCompletion == r) {
- tile |= 0x1000;
- }
+ consolePrintf("time: %d\n", typingTimeout);
- baseAddress[y * 32 + x + p] = tile;
-
-
+ // 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 @@
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 @@
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 @@
{
autoCompleteBuffer[r] = autoCompleteBuffer[r + 1];
}
+
+ typingTimeout = 100;
}
}
@@ -424,6 +460,13 @@
updateTypeEvents();
+ if (typingTimeout > 0) {
+ typingTimeout--;
+ if (typingTimeout == 0) {
+ drawAutoComplete();
+ }
+ }
+
if (DS::getPenDown()) {
int x = IPC->touchXpx;
int y = IPC->touchYpx;
@@ -443,7 +486,9 @@
if (selectedCompletion == current) {
typeCompletion(current);
} else {
- selectedCompletion = current;
+ if (current < autoCompleteCount) {
+ selectedCompletion = current;
+ }
}
drawAutoComplete();
Modified: scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/touchkeyboard.h
===================================================================
--- scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/touchkeyboard.h 2009-10-07 12:27:21 UTC (rev 44727)
+++ scummvm/branches/branch-1-0-0/backends/platform/ds/arm9/source/touchkeyboard.h 2009-10-07 12:33:45 UTC (rev 44728)
@@ -29,6 +29,7 @@
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 restoreVRAM(int tileBase, int mapBase, u16* saveSpace);
void addKeyboardEvents();
bool getKeyboardClosed();
+bool isInsideKeyboard(int x, int y);
void addAutoComplete(const char* word);
void clearAutoComplete();
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