diff options
-rw-r--r-- | audio/softsynth/opl/mame.cpp | 2 | ||||
-rw-r--r-- | backends/platform/ds/arm9/makefile | 6 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/dsmain.cpp | 5 | ||||
-rw-r--r-- | base/commandLine.cpp | 6 | ||||
-rw-r--r-- | common/array.h | 4 | ||||
-rw-r--r-- | engines/saga/font.cpp | 36 | ||||
-rw-r--r-- | engines/saga/font.h | 4 | ||||
-rw-r--r-- | gui/gui-manager.cpp | 9 | ||||
-rw-r--r-- | gui/launcher.cpp | 3 | ||||
-rw-r--r-- | gui/massadd.cpp | 5 | ||||
-rw-r--r-- | gui/options.cpp | 4 | ||||
-rw-r--r-- | gui/saveload.cpp | 13 |
12 files changed, 83 insertions, 14 deletions
diff --git a/audio/softsynth/opl/mame.cpp b/audio/softsynth/opl/mame.cpp index 5d790f924f..e47529aad4 100644 --- a/audio/softsynth/opl/mame.cpp +++ b/audio/softsynth/opl/mame.cpp @@ -757,8 +757,10 @@ static int OPLOpenTable(void) { } static void OPLCloseTable(void) { +#ifndef __DS__ free(TL_TABLE); free(SIN_TABLE); +#endif free(AMS_TABLE); free(VIB_TABLE); free(ENV_CURVE); diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index 781738265c..62473bca6c 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -75,7 +75,7 @@ else ifdef DS_BUILD_K else - # USE_MAD = 1 + USE_MAD = 1 endif endif endif @@ -245,7 +245,7 @@ ifdef USE_MAD DEFINES += -DUSE_MAD endif -DEFINES += -DREDUCE_MEMORY_USAGE -DDISABLE_DEBUGGER -DUSE_TEXT_CONSOLE -DDISABLE_MASS_ADD -DDISABLE_NES_APU +DEFINES += -DREDUCE_MEMORY_USAGE -DDISABLE_DEBUGGER -DUSE_TEXT_CONSOLE -DDISABLE_MASS_ADD -DDISABLE_NES_APU -DNDEBUG LDFLAGS = -specs=ds_arm9.specs -mthumb-interwork -mno-fpu -Wl,-Map,map.txt -Wl,--gc-sections @@ -259,7 +259,7 @@ BACKEND := ds INCLUDES= -I$(portdir)/$(BUILD) -I$(srcdir) -I$(srcdir)/engines \ -I$(portdir)/data -I$(portdir)/../commoninclude \ -I$(portdir)/source -I$(portdir)/source/mad \ - -I$(libndsdir)/include -include $(srcdir)/common/scummsys.h + -I$(libndsdir)/include -include $(portdir)/source/portdefs.h LIBS = -lm -L$(libndsdir)/lib -L$(portdir)/lib -lnds9 diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 303e504873..b94b433373 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -579,7 +579,7 @@ void initGame() { for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) { if (!stricmp(gameName, gameList[r].gameId)) { s_currentGame = &gameList[r]; - // consolePrintf("Game list num: %d\n", s_currentGame); + // consolePrintf("Game list num: %d\n", r); } } } @@ -1672,8 +1672,7 @@ void addEventsToQueue() { if (!keyboardEnable) { - - if ((isScrollingWithDPad() || (indyFightState)) && (displayModeIs8Bit)) { + if ((!isScrollingWithDPad() || (indyFightState)) && (displayModeIs8Bit)) { // Controls specific to the control method if (s_currentGame->control == CONT_SKY) { diff --git a/base/commandLine.cpp b/base/commandLine.cpp index b74370df4c..0808f87fb3 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -50,7 +50,7 @@ static const char USAGE_STRING[] = ; // DONT FIXME: DO NOT ORDER ALPHABETICALLY, THIS IS ORDERED BY IMPORTANCE/CATEGORY! :) -#if defined(__SYMBIAN32__) || defined(__GP32__) || defined(ANDROID) +#if defined(__SYMBIAN32__) || defined(__GP32__) || defined(ANDROID) || defined(__DS__) static const char HELP_STRING[] = "NoUsageString"; // save more data segment space #else static const char HELP_STRING[] = @@ -144,7 +144,7 @@ static void usage(const char *s, ...) { vsnprintf(buf, STRINGBUFLEN, s, va); va_end(va); -#if !(defined(__GP32__) || defined (__SYMBIAN32__)) +#if !(defined(__GP32__) || defined (__SYMBIAN32__) || defined(__DS__)) printf(USAGE_STRING, s_appName, buf, s_appName, s_appName); #endif exit(1); @@ -962,7 +962,7 @@ Common::Error processSettings(Common::String &command, Common::StringMap &settin // environment variable. This is weaker than a --savepath on the // command line, but overrides the default savepath, hence it is // handled here, just before the command line gets parsed. -#if !defined(_WIN32_WCE) && !defined(__GP32__) && !defined(ANDROID) +#if !defined(_WIN32_WCE) && !defined(__GP32__) && !defined(ANDROID) && !defined(__DS__) if (!settings.contains("savepath")) { const char *dir = getenv("SCUMMVM_SAVEPATH"); if (dir && *dir && strlen(dir) < MAXPATHLEN) { diff --git a/common/array.h b/common/array.h index e3aab66dc6..383ecfcec6 100644 --- a/common/array.h +++ b/common/array.h @@ -182,7 +182,11 @@ public: delete[] _storage; _size = array._size; +#ifdef __DS__ + _capacity = _size; +#else _capacity = _size + 32; +#endif _storage = new T[_capacity]; assert(_storage); copy(array._storage, array._storage + _size, _storage); diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp index 2434f7aad8..60e7c98e7a 100644 --- a/engines/saga/font.cpp +++ b/engines/saga/font.cpp @@ -43,14 +43,32 @@ Font::Font(SagaEngine *vm) : _vm(vm) { _fonts.resize(_vm->getFontsCount()); for (i = 0; i < _vm->getFontsCount(); i++) { +#ifdef __DS__ + _fonts[i].outline.font = NULL; + _fonts[i].normal.font = NULL; +#endif loadFont(&_fonts[i], _vm->getFontDescription(i)->fontResourceId); } + + _fontMapping = 0; } Font::~Font() { debug(8, "Font::~Font(): Freeing fonts."); + +#ifdef __DS__ + for (int i = 0; i < _vm->getFontsCount(); i++) { + if (_fonts[i].outline.font) { + free(_fonts[i].outline.font); + } + + if (_fonts[i].normal.font) { + free(_fonts[i].normal.font); + } + } +#endif } @@ -107,9 +125,17 @@ void Font::loadFont(FontData *font, uint32 fontResourceId) { error("Invalid font resource size"); } +#ifndef __DS__ font->normal.font.resize(fontResourceData.size() - FONT_DESCSIZE); memcpy(font->normal.font.getBuffer(), fontResourceData.getBuffer() + FONT_DESCSIZE, fontResourceData.size() - FONT_DESCSIZE); - +#else + if (font->normal.font) { + free(font->normal.font); + } + + font->normal.font = (byte *) malloc(fontResourceData.size() - FONT_DESCSIZE); + memcpy(font->normal.font, fontResourceData.getBuffer() + FONT_DESCSIZE, fontResourceData.size() - FONT_DESCSIZE); +#endif // Create outline font style createOutline(font); @@ -153,7 +179,15 @@ void Font::createOutline(FontData *font) { font->outline.header.rowLength = newRowLength; // Allocate new font representation storage +#ifdef __DS__ + if (font->outline.font) { + free(font->outline.font); + } + + font->outline.font = (byte *) calloc(newRowLength * font->outline.header.charHeight, 1); +#else font->outline.font.resize(newRowLength * font->outline.header.charHeight); +#endif // Generate outline font representation diff --git a/engines/saga/font.h b/engines/saga/font.h index 6f66545756..57e8278c46 100644 --- a/engines/saga/font.h +++ b/engines/saga/font.h @@ -120,7 +120,11 @@ struct FontCharEntry { struct FontStyle { FontHeader header; FontCharEntry fontCharEntry[256]; +#ifndef __DS__ ByteArray font; +#else + byte* font; +#endif }; struct FontData { diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 19ca66b7b1..edab31dfaa 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -77,6 +77,14 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false), ConfMan.registerDefault("gui_renderer", ThemeEngine::findModeConfigName(ThemeEngine::_defaultRendererMode)); ThemeEngine::GraphicsMode gfxMode = (ThemeEngine::GraphicsMode)ThemeEngine::findMode(ConfMan.get("gui_renderer")); +#ifdef __DS__ + // Searching for the theme file takes ~10 seconds on the DS. + // Disable this search here because external themes are not supported. + if (!loadNewTheme("builtin", gfxMode)) { + // Loading the built-in theme failed as well. Bail out + error("Failed to load any GUI theme, aborting"); + } +#else // Try to load the theme if (!loadNewTheme(themefile, gfxMode)) { // Loading the theme failed, try to load the built-in theme @@ -85,6 +93,7 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false), error("Failed to load any GUI theme, aborting"); } } +#endif } GuiManager::~GuiManager() { diff --git a/gui/launcher.cpp b/gui/launcher.cpp index aed57decd3..c80852c77b 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -721,6 +721,8 @@ void LauncherDialog::updateListing() { void LauncherDialog::addGame() { int modifiers = g_system->getEventManager()->getModifierState(); + +#ifndef DISABLE_MASS_ADD const bool massAdd = (modifiers & Common::KBD_SHIFT) != 0; if (massAdd) { @@ -749,6 +751,7 @@ void LauncherDialog::addGame() { updateButtons(); return; } +#endif // Allow user to add a new game to the list. // 1) show a dir selection dialog which lets the user pick the directory diff --git a/gui/massadd.cpp b/gui/massadd.cpp index c5af6c6bb4..ba841158a4 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -34,7 +34,7 @@ #include "gui/widget.h" #include "gui/widgets/list.h" - +#ifndef DISABLE_MASS_ADD namespace GUI { /* @@ -264,3 +264,6 @@ void MassAddDialog::handleTickle() { } // End of namespace GUI +#endif // DISABLE_MASS_ADD + + diff --git a/gui/options.cpp b/gui/options.cpp index 547ab0f3c6..d2369b9764 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -141,8 +141,8 @@ void OptionsDialog::init() { _subSpeedDesc = 0; _subSpeedSlider = 0; _subSpeedLabel = 0; - _oldTheme = ConfMan.get("gui_theme"); - + _oldTheme = g_gui.theme()->getThemeId(); + // Retrieve game GUI options _guioptions = 0; if (ConfMan.hasKey("guioptions", _domain)) { diff --git a/gui/saveload.cpp b/gui/saveload.cpp index 41b6018e3b..9e3c9231f2 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -362,8 +362,19 @@ void SaveLoadChooser::updateSaveList() { } // Fill the rest of the save slots with empty saves + + int maximumSaveSlots = (*_plugin)->getMaximumSaveSlot(); + +#ifdef __DS__ + // Low memory on the DS means too many save slots are impractical, so limit + // the maximum here. + if (maximumSaveSlots > 99) { + maximumSaveSlots = 99; + } +#endif + Common::String emptyDesc; - for (int i = curSlot; i <= (*_plugin)->getMaximumSaveSlot(); i++) { + for (int i = curSlot; i <= maximumSaveSlots; i++) { saveNames.push_back(emptyDesc); SaveStateDescriptor dummySave(i, ""); _saveList.push_back(dummySave); |