DS: Merging accross changes from branch1-0-0 into trunk.

svn-id: r48136
This commit is contained in:
Neil Millstone 2010-02-26 17:29:18 +00:00
parent bcb721cccd
commit 4a8ab4b075
19 changed files with 382 additions and 145 deletions

View File

@ -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

View File

@ -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

View File

@ -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);
@ -491,6 +496,26 @@ bool trackExists(int num) {
consolePrintf("Looking for %s...", path.c_str());
FILE* file;
if ((file = DS::std_fopen(path.c_str(), "r"))) {
consolePrintf("Success!\n");
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);

View File

@ -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 (!(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 +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 ((tapScreenClicks) && (getIsDisplayMode8Bit())) {
if ((!keyboardEnable) || (!isInsideKeyboard(penDownX, penDownY))) {
doScreenTapMode(system);
}
} else {
if (!keyboardEnable) {
doButtonSelectMode(system);
} else if ((!keyboardEnable) || (!isInsideKeyboard(penDownX, penDownY))) {
doScreenTapMode(system);
}
}
if (!keyboardEnable) {
if ((tapScreenClicks) && (getIsDisplayMode8Bit())) {
doScreenTapMode(system);
} else {
doButtonSelectMode(system);
}
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 ((!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 +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

View File

@ -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();

View File

@ -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();

View File

@ -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);
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);
if (selectedCompletion == r) {
tile |= 0x1000;
}
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();

View File

@ -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();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B