diff options
Diffstat (limited to 'backends/platform/ds/arm9')
-rw-r--r-- | backends/platform/ds/arm9/Makefile | 25 | ||||
-rw-r--r-- | backends/platform/ds/arm9/dist/readme_ds.txt | 212 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/dsmain.cpp | 176 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/dsmain.h | 1 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/dsoptions.cpp | 26 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/dsoptions.h | 1 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.cpp | 214 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.h | 10 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/portdefs.h | 17 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/wordcompletion.cpp | 5 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/wordcompletion.h | 1 |
11 files changed, 457 insertions, 231 deletions
diff --git a/backends/platform/ds/arm9/Makefile b/backends/platform/ds/arm9/Makefile index d4e945090b..225278d579 100644 --- a/backends/platform/ds/arm9/Makefile +++ b/backends/platform/ds/arm9/Makefile @@ -90,6 +90,7 @@ vpath %.s $(srcdir) ARM = 1 USE_ARM_SOUND_ASM = 1 USE_ARM_COSTUME_ASM = 1 +#WRAP_MALLOC = 1 ifdef DS_BUILD_A DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM -DUSE_ARM_COSTUME_ASM @@ -173,10 +174,10 @@ CFLAGS = -Wno-multichar -Wall\ -mthumb-interwork -DUSE_ARM_COSTUME_ASM=1 -# -ffast-math +# -ffast-math ifdef USE_DEBUGGER - DEFINES += -DUSE_DEBUGGER + DEFINES += -DUSE_DEBUGGER CFLAGS += -g endif @@ -200,7 +201,7 @@ CXXFLAGS= $(CFLAGS) -Wno-non-virtual-dtor -Wno-unknown-pragmas -Wno-reorder \ ASFLAGS = -mcpu=arm9tdmi -mthumb-interwork -DEFINES += -D__DS__ -DNDS -DARM9 -DNONSTANDARD_PORT -DDISABLE_FANCY_THEMES -DVECTOR_RENDERER_FORMAT=1555 -DDISABLE_DEFAULT_SAVEFILEMANAGER -DARM +DEFINES += -D__DS__ -DNDS -DARM9 -DNONSTANDARD_PORT -DDISABLE_FANCY_THEMES -DVECTOR_RENDERER_FORMAT=1555 -DDISABLE_DOSBOX_OPL -DDISABLE_DEFAULT_SAVEFILEMANAGER -DARM ifdef USE_MAD DEFINES += -DUSE_MAD endif @@ -208,10 +209,15 @@ endif DEFINES += -DREDUCE_MEMORY_USAGE # Removed, as these are done in portdefs.h -# -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE +# -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE LDFLAGS = -specs=ds_arm9.specs -mthumb-interwork -mno-fpu -Wl,-Map,map.txt -Wl,--gc-sections +ifdef WRAP_MALLOC + LDFLAGS += -Wl,--wrap,malloc + DEFINES += -DWRAP_MALLOC +endif + INCLUDES= -I$(portdir)/$(BUILD) -I$(srcdir) -I$(srcdir)/engines \ -I$(portdir)/data -I$(portdir)/../commoninclude \ -I$(portdir)/source -I$(portdir)/source/mad -I$(portdir)/source/libcartreset \ @@ -262,7 +268,7 @@ endif DATA_OBJS := $(portdir)/data/icons.o $(portdir)/data/keyboard.o $(portdir)/data/keyboard_pal.o $(portdir)/data/default_font.o $(portdir)/data/8x8font_tga.o -COMPRESSOR_OBJS := +COMPRESSOR_OBJS := #$(portdir)/source/compressor/lz.o FAT_OBJS := $(portdir)/source/fat/disc_io.o $(portdir)/source/fat/gba_nds_fat.o\ @@ -283,15 +289,16 @@ FAT_OBJS := $(portdir)/source/fat/disc_io.o $(portdir)/source/fat/gba_nds_fat.o # $(portdir)/source/fat/io_sd_common.o $(portdir)/source/fat/io_scsd_s.o \ # $(portdir)/source/fat/io_sc_common.o $(portdir)/source/fat/io_sd_common.o -LIBCARTRESET_OBJS := +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 fmopl.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 #OPTLIST := # Compiler options for files which should be optimised for speed OPT_SPEED := -O3 +#OPT_SPEED := -Os -mthumb # Compiler options for files which should be optimised for space OPT_SIZE := -Os -mthumb @@ -313,7 +320,7 @@ ndsall: include $(srcdir)/Makefile.common semiclean: - $(RM) $(portdir)/source/dsoptions.o $(portdir)/source/dsmain.o $(FAT_OBJS) $(DATA_OBJS) $(portdir)/source/wordcompletion.o $(portdir)/source/dsoptions.o + $(RM) $(portdir)/source/dsoptions.o $(portdir)/source/dsmain.o $(FAT_OBJS) $(DATA_OBJS) $(portdir)/source/wordcompletion.o $(portdir)/source/dsoptions.o clean: $(RM) $(OBJS) $(EXECUTABLE) @@ -375,7 +382,7 @@ endef # export OPTFLAG = ; # echo !!!!!!!! $(OPTFLAG) $(MKDIR) $(*D)/$(DEPDIR) - $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(if $(findstring $(notdir $<), $(OPTLIST)), $(OPT_SPEED), $(OPT_SIZE)) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o + $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(if $(findstring $(notdir $<), $(OPTLIST)), $(OPT_SPEED), $(OPT_SIZE)) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o #--------------------------------------------------------------------------------- diff --git a/backends/platform/ds/arm9/dist/readme_ds.txt b/backends/platform/ds/arm9/dist/readme_ds.txt index f77da418c9..97b5ed74a1 100644 --- a/backends/platform/ds/arm9/dist/readme_ds.txt +++ b/backends/platform/ds/arm9/dist/readme_ds.txt @@ -1,4 +1,4 @@ - + The official port of ScummVM @@ -14,7 +14,7 @@ Visit the main ScummVM website <http://www.scummvm.org> Contents ------------------------------------------------------------------------ - + * What's New? * What is ScummVM DS? @@ -23,8 +23,6 @@ Visit the main ScummVM website <http://www.scummvm.org> * How to Get ScummVM DS Onto Your DS - Simple Explanation o Using a CF/SD/Mini SD/Micro SD card reader and a DLDI driver o Instructions for specific card readers - * What to do if saving doesn't work or your card gets corruped - - force SRAM saves * How to use ScummVM DS * Game Specific Controls * DS Options Screen @@ -43,6 +41,19 @@ Visit the main ScummVM website <http://www.scummvm.org> What's New? ------------------------------------------------------------------------ +ScummVM DS 1.0.0 RC1 + + * Gamma correction feature to improve brightness level of game on the + original DS. + * The usual round of bugfixes + + +ScummVM DS 0.13.1 + + * Support for the ScummVM Global Main Menu (hold select during the game) + * The usual round of bugfixes + + ScummVM DS 0.12.0 * New games supported: Lure of the Temptress, Nippon Safes, Lost in Time. @@ -51,7 +62,7 @@ ScummVM DS 0.12.0 * New option which allows you to drag to hover, tap the touch screen to click, and double tap the screen to right click. * Reorganised DS Options screen into three tabs for clearer navigation - * New top screen scaling options let you choose the scaling factor used + * New top screen scaling options let you choose the scaling factor used on startup. * The usual round of bug fixes. @@ -68,21 +79,21 @@ ScummVM DS 0.11.0 screen (press select during the game). Thanks to Tramboi and Robin Watts for this feature! * Function keys added to virtual keyboard (used in AGI games) - * Plenty of bug fixes + * Plenty of bug fixes What is ScummVM DS? ------------------------------------------------------------------------ ScummVM DS is a part of the ScummVM project. The ScummVM project is an -attempt to re-engineer many classic point and click adventure games of the -80s and 90s to run on modern computer hardware. Technology has changed a -lot since these games were written, and so ScummVM attempts to replicate the +attempt to re-engineer many classic point and click adventure games of the +80s and 90s to run on modern computer hardware. Technology has changed a +lot since these games were written, and so ScummVM attempts to replicate the gameplay of the original games in exacting details, without any of the original code that the game ran on. ScummVM needs a copy of the original game, in order to take the graphics, sound, and scripts that made the game work. ScummVM is written in such a way that it can be 'ported' from one type of -machine to another, and ScummVM DS is a port of ScummVM to the Nintendo DS +machine to another, and ScummVM DS is a port of ScummVM to the Nintendo DS handheld games console. @@ -107,45 +118,59 @@ handheld games console. Nintendo don't want you to run ScummVM on your DS. They control which companies can make games on the DS, and there is an expensive -process to go through in order to be licenced. Having to pay for -this would prevent me from giving away ScummVM for free. +process to go through in order to be licenced. Having to pay for +this would prevent me from giving away ScummVM for free. So, the result is that to run ScummVM on your DS you'll need an -unofficial card reader. There are many of these, and all are different. -Popular models at the time of writing are the R4DS and the M3DS Real, +unofficial card reader. There are many of these, and all are different. +Popular models at the time of writing are the R4DS and the M3DS Real, but many different models work. You need to buy one of these, and at MicroSD card to go with it. There are also slot-2 card readers which fit into the bottom slot on your DS, usually used for Game Boy Advance games. These are less common -these days, and although they have certain advantages, the details of -these are beyond the scope of this website. Information on these is +these days, and although they have certain advantages, the details of +these are beyond the scope of this website. Information on these is quite easy to find by searching. Once you have your card reader and a MicroSD card, you will also need a copy of the game you want to run. ScummVM can run a large variety of games, but you must own a real boxed copy of the game. These games are still under copyright, and it is illegal to copy them from a friend -or download them from the Internet without paying. The exception to +or download them from the Internet without paying. The exception to this are the three Revolution Software games. These are 'Beneath a Steel Sky', 'Lure of the Temptress' and 'Flight of the Amazon Queen'. Revolution have kindly allowed us to give these games away for free. -You can download them from the main ScummVM site at +You can download them from the main ScummVM site at <http://www.scummvm.org/downloads.php> +If you have a modern card reader, like an M3 Real or R4DS, getting +ScummVM to run on your card is as simple as: + 1) Copy the scummvm NDS files on your MicroSD card using your + PC card reader + 2) Copy the games you want to play onto your MicroSD card in any + location, one per folder + 3) Boot the DS with the MicroSD card and card reader inserted + 4) Run the relevent build for the game you want to play (see + 'Which games are compatible with ScummVM DS' below. + 5) Click 'Add Game'. Select the folder where your game is stored. + Click 'OK'. Click 'OK' in the settings dialog. + 6) Click 'Start'. + NOTE: Previous version of ScummVM DS supported a method which used a zip file to run games on unsupported flash card readers. This method is no longer supported. + How to Get ScummVM DS Onto Your DS - Using a CF/SD/Mini SD/Micro SD card reader and a DLDI driver ------------------------------------------------------------------------ -ScummVM DS needs something called a DLDI driver to run on each make +ScummVM DS needs something called a DLDI driver to run on each make and model of card reader. Many modern card readers (R4DS, M3 DS Real) handle this autmatically and for those, you don't have to do anything. -Just running ScummVM on the card will handle this step for you. +Just running ScummVM on the card will handle this step for you. For others, you will need to follow the steps in this section before ScummVM DS will work. @@ -186,7 +211,7 @@ Here is what you need to do: Either way, you should see 'Patched Successfully'. If you don't, you're doing something wrong. - You need to patch one of the builds labeled A - F depending on + You need to patch one of the builds labeled A - H depending on which game you want to run. See the table on the ScummVM DS website to see which games are supported by which build. @@ -196,7 +221,7 @@ Here is what you need to do: * Put your game data in any folder on the card. Do NOT use a zip file. * Boot up your DS and run ScummVM. * Click 'Add Game', browse to the folder with your game data, click - 'Choose', then 'OK'. Click 'Start' to run the game. + 'Choose', then 'OK'. Click 'Start' to run the game. If your copy of ScummVM DS has been successfully patched, you will get a message on the top screen that looks like this: @@ -272,13 +297,10 @@ CANNOT DO THIS. hold the 'select' button during boot to disable FlashMe, which will allow the NinjaDS to work. Due to this, it is not recommended to install FlashMe if you use a NinjaDS. - * *EZ-Flash*: This card reader uses .ds.gba files from the ScummVM - archive. Rename them to .nds before patching them with the DLDI - patcher. * *R4DS*: If you upgrade the firmware for your R4DS to version 1.10 or later, the card will autmatically DLDI patch the game, meaning you don't have to use dlditool to patch the .NDS file. This makes - things a lot easier! + things a lot easier! * *M3DS Real*: This card autmatically DLDI patches the game, meaning that you do not need to do this yourself. @@ -288,12 +310,12 @@ CANNOT DO THIS. ------------------------------------------------------------------------ I'm glad you asked. Here is a list of the compatible games in version -0.12.0. Demo versions of the games listed should work too. +1.0.0 RC1. Demo versions of the games listed should work too. Flight of the Amazon Queen, Beneath a Steel Sky, and Lure of the -Temptress have generously been released as freeware by the original +Temptress have generously been released as freeware by the original authors, Revolution Software <http://www.revolution.co.uk/>. This is a -great thing and we should support Revolution for being so kind to us. +great thing and we should support Revolution for being so kind to us. You can download the game data from the official ScummVM download page <http://www.scummvm.org/downloads.php>. @@ -304,23 +326,23 @@ for a copy, as I am unable to send it to you. Game Build Notes -Manic Mansion A +Manic Mansion A -Zak McKracken and the Alien Mindbenders A +Zak McKracken and the Alien Mindbenders A -Indiana Jones and the Last Crusade A +Indiana Jones and the Last Crusade A -Loom A +Loom A -Passport to Adventure A +Passport to Adventure A -The Secret of Monkey Island A +The Secret of Monkey Island A -Monkey Island 2: LeChuck's Revenge A +Monkey Island 2: LeChuck's Revenge A -Indiana Jones and the Fate of Atlantis A +Indiana Jones and the Fate of Atlantis A -Day of the Tentacle A +Day of the Tentacle A Sam & Max Hit the Road A Some slowdown in a few scenes when MP3 audio is enabled @@ -351,25 +373,25 @@ Elvira 2 C Waxworks (Amiga version) C -Gobliiins D +Gobliiins D -Gobliins 2 D +Gobliins 2 D Goblins 3 D -Ween: The Prophecy D +Ween: The Prophecy D -Bargon Attack D +Bargon Attack D Lost in Time D -Future Wars D +Future Wars D All Sierra AGI games. For a complete list, see this page -<http://wiki.scummvm.org/index.php/AGI> D +<http://wiki.scummvm.org/index.php/AGI> D -Inherit the Earth E +Inherit the Earth E The Legend of Kyrandia F Zoomed view does not follow the speaking character @@ -378,52 +400,20 @@ Lure of the Temptress G Nippon Safes G -There is no support for Full Throttle, The Dig, or The Curse of Monkey -Island because of memory issues. There simply is not enough RAM on the -DS to run these games. Sorry. Also there is no support for Windows Humongous -Entertainment games. The extra code required to make this work uses up -too much RAM. - - - What to do when saving doesn't work or your card gets corrupted - - forcing SRAM Saves - ------------------------------------------------------------------------ - -This method only works for cards which use the Game Boy Advance slot on the -bottom of your DS. - -If ScummVM DS cannot save games to your SD card, or it causes corruption -when it does, you can force it to use GBA SRAM to save the game. This -uses your flash cart reader's GBA features to save the game to a .sav or -.dat file (depending on the reader). Only slot-2 devices can use SRAM saves, -and only ones with support for GBA games. - -If you want to use SRAM save, just create a text file called scummvm.ini -(or scummvmb.ini, scummvmc.ini for builds B or C) in the root of your -card which contains the following: - -[ds] -forcesramsave=true -When you boot your game, ScummVM DS will not save games to your SD card -directly, instead it will save to GBA SRAM. On most cards, you need to -transfer the data to your SD card by rebooting and using your card -reader's boot-up menu. Using this method, around four saves can me made. +Full Throttle and The Dig can run on the DS using an external RAM pack +plugged into slot-2 (the GBA slot). To do this, download the special +build of ScummVM DS from here: http://forums.scummvm.org/viewtopic.php?t=7044 -One disadvantage of forcing SRAM saves is that your settings won't be -saved. You can add games manually to the ini file so that you don't have -to select them on each boot. Just add a section like the following on -for each game on your card. - -[monkey2] -description=Monkey Island 2: LeChuck's Revenge (English/DOS) -path=mp:/MONKEY2 +There is no support for Windows Humongous Entertainment games, Broken Sword, +and all other games that run at 640x480 resolution. The DS cannot cope with +scaling these games down to 256x192, the resolution of the DS screens. How to Use ScummVM ------------------------------------------------------------------------ -Once you've booted up ScummVM, you'll see the start up screen. +Once you've booted up ScummVM, you'll see the start up screen. 1. Tap the 'Add' button with the pen, then browse to the folder containing your game data. Once you have clicked on your folder, you will @@ -433,7 +423,7 @@ Once you've booted up ScummVM, you'll see the start up screen. 2. Click the 'Choose' button. 3. You will get some options for the game. You can usually just click 'Ok' to - this. + this. 4. Now click on the name of the game you want to play from the list and click 'Start'. Your game will start! @@ -572,11 +562,11 @@ of the screen. Useful for Beneath a Steel Sky and Goblins 3. Touch X offset - if your screen doesn't perform properly, this setting allows you to adjust when the cursor appears left or right relative to -the screen's measured touch position. +the screen's measured touch position. Touch Y offset - if your screen doesn't perform properly, this setting allows you to adjust when the cursor appears higher or lower relative to -the screen's measured touch position. +the screen's measured touch position. Use Laptop Trackpad-style cursor control - In this mode, use the lower screen to drag the cursor around, a bit like using a trackpad on a laptop. @@ -661,12 +651,14 @@ free to use your favourite program. The format you need to use is IMA-ADPCM 4-bit Mono. You may use any sample rate. All other formats will be rejected, including uncompressed WAV files. +Since this sound format is a standard, you should be able to create it +in a variety of software. Now I will to describe how to rip your CD tracks with Cdex, which can be found here: Cdex Homepage <http://sourceforge.net/projects/cdexos/>. -Other software can be used to create IMA ADPCM files under Linux or -MacOS. +If you're using MacOS or Linux, I suggest using Audacity +<http://audacity.sourceforge.net>. -To set this up in Cdex, select Settings from the Options menu. On the +To encode audio in Cdex, select Settings from the Options menu. On the Encoder tab, select 'WAV Output Encoder'. Under 'Encoder Options', choose the following: @@ -733,6 +725,17 @@ Tentacle, Monkey Island 2, or a few other games! What do I do? *A:* Hold down the left shoulder button and use D-pad (or the touch screen) to scroll the screen around. +*Q:* I don't get speech or sound effects in my Lucasarts games. What's +wrong? +*A:* Do you have a monster.sog file? If so, this is the wrong kind of +speech file for ScummVM DS. Copy the monster.sou file present on your +original CD or floppies, and you will have speech. + +*Q:* Can ScummVM take advantage of the DSi? +*A:* At the moment, no. While some homebrew does run on the DSi, at +the time of writing, it cannot access any of the DSi's new features. +When it does, a version of ScummVM for the DSi may be possible. + *Q:* I dont see a menu when I press Start in Flight of the Amazon Queen or Simon the Sorcerer. Is ScummVM broken? *A:* No. To save in Simon the Sorcerer, click 'use', then click on the @@ -744,31 +747,17 @@ then click on the journal in your inventory. of ScummVM. Delete the MP3 tracks and reencode them to ADPCM WAV files as described in the CD audio section. -*Q:* When will you support my Mini/Micro SD card reader? I want it! -Pretty please? -*A:* ScummVM uses DLDI drivers. If your card reader manufacturer doesn't -provide a driver, there is nothing I can do about it. The people to ask -are the card reader manufacturers themselves. - *Q:* Can't you use the extra RAM in the M3/Supercard or the official Opera Expansion Pack to support more games like The Dig and Full Throttle? DS Linux has done it, so why can't you? -*A:* Not at the moment. The extra RAM has certain differences to the -build in RAM which makes it difficult to use for general programs. As -ScummVM DS is an official port, the changes to the ScummVM code base -must be minimal to avoid making the code difficult to read for other -users. I do have plans to work on this some time in the future, but -don't nag me about when it'll be done. If and when there's progress with -this, I will post on the ScummVM forums about it. - +*A:* Yes! The Dig and Full Throttle are playable with some limitations. +See the forum thread here for a download: +http://forums.scummvm.org/viewtopic.php?t=7044 *Q:* ScummVM DS turns off my DS when I hit 'Quit' in the game or quit from the frontend. Why doesn't it return to the menu? -*A:* Due to bugs in the ScummVM codebase, many of the ScummVM games -cannot quit cleanly leaving the machine in the same state as when it -started. You will notice that no other versions of ScummVM can quit back -to the menu either. This will be fixed at some time in the future. - +*A:* To return to the game launcher, hold 'Select' during the game +to access the main ScummVM menu, then click 'Return to Launcher' @@ -836,5 +825,10 @@ The executable nds file will build inside 'backends/platform/ds/arm9/SCUMMVM-A'. For other builds, substitute the letters b - g in the above line. +To build everything, type: +make allbuildssafe + + + diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 6ba19cc053..f959074d49 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -61,6 +61,14 @@ // - Make save/restore game screen use scaler buffer +// 1.0.0! +// - Fix text on tabs on config screen +// - Remove ini file debug msg +// - Memory size for ite +// - Try discworld? + + + //#define USE_LIBCARTRESET @@ -103,22 +111,63 @@ extern "C" u32 getExceptionAddress( u32 opcodeAddress, u32 thumbState); extern const char __itcm_start[]; static const char *registerNames[] = { "r0","r1","r2","r3","r4","r5","r6","r7", - "r8 ","r9 ","r10","r11","r12","sp ","lr ","pc " }; + "r8 ","r9 ","r10","r11","r12","sp ","lr ","pc" }; + +#ifdef WRAP_MALLOC -/* extern "C" void* __real_malloc(size_t size); +void* operator new (size_t size) +{ + register unsigned int reg asm("lr"); + volatile unsigned int poo = reg; + + void* res = __real_malloc(size); + + if (!res) + { +// *((u8 *) NULL) = 0; + consolePrintf("Failed alloc (new) %d (%x)\n", size, poo); + return NULL; + } + + return res; +} + + extern "C" void* __wrap_malloc(size_t size) { +/* u32 addr; + + asm("mov %0, lr" + : "=r" (addr) + : + : );*/ + + register unsigned int reg asm("lr"); + volatile unsigned int poo = reg; + + + if (size == 0) + { + static int zeroSize = 0; + consolePrintf("0 size malloc (%d)", zeroSize++); + } + void* res = __real_malloc(size); if (res) { + if (size > 100 * 1024) { + consolePrintf("Allocated %d (%d)\n", size, poo); + } return res; } else { - consolePrintf("Failed alloc %d\n", size); + +// *((u8 *) NULL) = 0; + consolePrintf("Failed alloc %d (%x)\n", size, poo); return NULL; } } -*/ +#endif namespace DS { @@ -197,7 +246,7 @@ bool gameScreenSwap = false; bool isCpuScalerEnabled(); //#define HEAVY_LOGGING -MouseMode mouseMode; +MouseMode mouseMode = MOUSE_LEFT; int storedMouseX = 0; int storedMouseY = 0; @@ -355,6 +404,10 @@ void setSensitivity(int sensitivity) { touchPadSensitivity = sensitivity; } +void setGamma(int gamma) { + OSystem_DS::instance()->setGammaValue(gamma); +} + void setTopScreenZoom(int percentage) { // 100 256 // 150 192 @@ -426,18 +479,18 @@ int getGameHeight() { void initSprites() { for (int i = 0; i < 128; i++) { - sprites[i].attribute[0] = ATTR0_DISABLED; - sprites[i].attribute[1] = 0; - sprites[i].attribute[2] = 0; - sprites[i].filler = 0; - } + sprites[i].attribute[0] = ATTR0_DISABLED; + sprites[i].attribute[1] = 0; + sprites[i].attribute[2] = 0; + sprites[i].filler = 0; + } for (int i = 0; i < 128; i++) { - spritesMain[i].attribute[0] = ATTR0_DISABLED; - spritesMain[i].attribute[1] = 0; - spritesMain[i].attribute[2] = 0; - spritesMain[i].filler = 0; - } + spritesMain[i].attribute[0] = ATTR0_DISABLED; + spritesMain[i].attribute[1] = 0; + spritesMain[i].attribute[2] = 0; + spritesMain[i].filler = 0; + } updateOAM(); } @@ -502,7 +555,6 @@ void initGame() { // static bool firstTime = true; - setOptions(); //strcpy(gameName, ConfMan.getActiveDomain().c_str()); @@ -592,9 +644,9 @@ void displayMode8Bit() { BG3_CR = BG_BMP16_256x256 | BG_BMP_BASE(8); BG3_XDX = 256; - BG3_XDY = 0; - BG3_YDX = 0; - BG3_YDY = (int) ((200.0f / 192.0f) * 256); + BG3_XDY = 0; + BG3_YDX = 0; + BG3_YDY = (int) ((200.0f / 192.0f) * 256); } else { videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); @@ -611,9 +663,9 @@ void displayMode8Bit() { BG3_CR = BG_BMP8_512x256 | BG_BMP_BASE(8); BG3_XDX = (int) (((float) (gameWidth) / 256.0f) * 256); - BG3_XDY = 0; - BG3_YDX = 0; - BG3_YDY = (int) ((200.0f / 192.0f) * 256); + BG3_XDY = 0; + BG3_YDX = 0; + BG3_YDY = (int) ((200.0f / 192.0f) * 256); } SUB_BG3_CR = BG_BMP8_512x256; @@ -625,11 +677,13 @@ void displayMode8Bit() { - if (consoleEnable) { - consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 2, 0, true); - // Move the cursor to the bottom of the screen using ANSI escape code - consolePrintf("\033[23;0f"); - } + consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 2, 0, true); + + // Set this again because consoleinit resets it + videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); + + // Move the cursor to the bottom of the screen using ANSI escape code + consolePrintf("\033[23;0f"); for (int r = 0; r < 32 * 32; r++) { @@ -638,7 +692,9 @@ void displayMode8Bit() { } // ConsoleInit destroys the hardware palette :-( - OSystem_DS::instance()->restoreHardwarePalette(); + if (OSystem_DS::instance()) { + OSystem_DS::instance()->restoreHardwarePalette(); + } // BG_PALETTE_SUB[255] = RGB15(31,31,31);//by default font will be rendered with color 255 @@ -912,12 +968,12 @@ void displayMode16BitFlipBuffer() { } } } else if (isCpuScalerEnabled()) { - //#define SCALER_PROFILE + //#define SCALER_PROFILE - #ifdef SCALER_PROFILE - TIMER1_CR = TIMER_ENABLE | TIMER_DIV_1024; - u16 t0 = TIMER1_DATA; - #endif + #ifdef SCALER_PROFILE + TIMER1_CR = TIMER_ENABLE | TIMER_DIV_1024; + u16 t0 = TIMER1_DATA; + #endif const u8* back = (const u8*)get8BitBackBuffer(); u16* base = BG_GFX + 0x10000; Rescale_320x256xPAL8_To_256x256x1555( @@ -928,19 +984,19 @@ void displayMode16BitFlipBuffer() { BG_PALETTE, getGameHeight() ); - #ifdef SCALER_PROFILE - // 10 pixels : 1ms - u16 t1 = TIMER1_DATA; - TIMER1_CR &= ~TIMER_ENABLE; - u32 dt = t1 - t0; - u32 dt_us = (dt * 10240) / 334; - u32 dt_10ms = dt_us / 100; - int i; - for(i=0; i<dt_10ms; ++i) - base[i] = ((i/10)&1) ? 0xFFFF : 0x801F; - for(; i<256; ++i) - base[i] = 0x8000; - #endif + #ifdef SCALER_PROFILE + // 10 pixels : 1ms + u16 t1 = TIMER1_DATA; + TIMER1_CR &= ~TIMER_ENABLE; + u32 dt = t1 - t0; + u32 dt_us = (dt * 10240) / 334; + u32 dt_10ms = dt_us / 100; + int i; + for(i=0; i<dt_10ms; ++i) + base[i] = ((i/10)&1) ? 0xFFFF : 0x801F; + for(; i<256; ++i) + base[i] = 0x8000; + #endif } #ifdef HEAVY_LOGGING consolePrintf("done\n"); @@ -1209,9 +1265,9 @@ void setKeyboardEnable(bool en) { } } /* - for (int r = 0; r < (512 * 256) >> 1; r++) - BG_GFX_SUB[r] = buffer[r]; - */ + for (int r = 0; r < (512 * 256) >> 1; r++) + BG_GFX_SUB[r] = buffer[r]; +*/ SUB_DISPLAY_CR &= ~DISPLAY_BG1_ACTIVE; // Turn off keyboard layer SUB_DISPLAY_CR |= DISPLAY_BG3_ACTIVE; // Turn on game layer } else { @@ -1597,7 +1653,7 @@ void addEventsToQueue() { doButtonSelectMode(system); } - if (((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) || (indyFightState)) && (displayModeIs8Bit)) { + if (((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) || (indyFightState)) && (displayModeIs8Bit)) { // Controls specific to the control method @@ -2031,9 +2087,9 @@ void VBlankHandler(void) { SUB_BG3_CY = subScY + (shakePos << 8);*/ /*SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256); - SUB_BG3_XDY = 0; - SUB_BG3_YDX = 0; - SUB_BG3_YDY = (int) (subScreenHeight / 192.0f * 256);*/ + SUB_BG3_XDY = 0; + SUB_BG3_YDX = 0; + SUB_BG3_YDY = (int) (subScreenHeight / 192.0f * 256);*/ static int ratio = (320 << 8) / SCUMM_GAME_WIDTH; @@ -2886,7 +2942,6 @@ void powerOff() { void dsExceptionHandler() { consolePrintf("Blue screen of death"); setExceptionHandler(NULL); - while(1); u32 currentMode = getCPSR() & 0x1f; u32 thumbState = ((*(u32*)0x027FFD90) & 0x20); @@ -2918,7 +2973,7 @@ void dsExceptionHandler() { int i; for ( i=0; i < 8; i++ ) { - consolePrintf( " %s: %08X %s: %08X\n", + consolePrintf(" %s: %08X %s: %08X\n", registerNames[i], exceptionRegisters[i], registerNames[i+8],exceptionRegisters[i+8]); } @@ -3025,7 +3080,7 @@ int main(void) { consolePrintf("-------------------------------\n"); consolePrintf("ScummVM DS\n"); consolePrintf("Ported by Neil Millstone\n"); - consolePrintf("Version 0.13.1 beta1 "); + consolePrintf("Version 1.0.0 RC1 "); #if defined(DS_BUILD_A) consolePrintf("build A\n"); consolePrintf("Lucasarts SCUMM games (SCUMM)\n"); @@ -3219,3 +3274,12 @@ int cygprofile_getHBlanks() { return DS::hBlankCount; } #endif + + +extern "C" void consolePrintf(const char * format, ...) { + char buffer[256]; + va_list args; + va_start(args, format); + viprintf(format, args); + va_end(args); +} diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h index 49501a1fdf..223221d80e 100644 --- a/backends/platform/ds/arm9/source/dsmain.h +++ b/backends/platform/ds/arm9/source/dsmain.h @@ -85,6 +85,7 @@ void setTalkPos(int x, int y); void setTopScreenTarget(int x, int y); void set200PercentFixedScale(bool on); void setTopScreenZoom(int percentage); +void setGamma(int gamma); // Timers void setTimerCallback(OSystem_DS::TimerProc proc, int interval); // Setup a callback function at a regular interval diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp index 90f371e0a8..9937e81e61 100644 --- a/backends/platform/ds/arm9/source/dsoptions.cpp +++ b/backends/platform/ds/arm9/source/dsoptions.cpp @@ -94,11 +94,11 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { _tab->addTab("Graphics"); - new GUI::StaticTextWidget(_tab, 5, 70, 180, 15, "Initial top screen scale:", Graphics::kTextAlignLeft); + new GUI::StaticTextWidget(_tab, 5, 67, 180, 15, "Initial top screen scale:", Graphics::kTextAlignLeft); - _100PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 85, 230, 20, "100%", 0x30000001, 'T'); - _150PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 100, 230, 20, "150%", 0x30000002, 'T'); - _200PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 115, 230, 20, "200%", 0x30000003, 'T'); + _100PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 82, 80, 20, "100%", 0x30000001, 'T'); + _150PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 97, 80, 20, "150%", 0x30000002, 'T'); + _200PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 112, 80, 20, "200%", 0x30000003, 'T'); new GUI::StaticTextWidget(_tab, 5, 5, 180, 15, "Main screen scaling:", Graphics::kTextAlignLeft); @@ -106,6 +106,14 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { _cpuScaler = new GUI::CheckboxWidget(_tab, 5, 35, 270, 20, "Software scale (good quality, but slower)", 0x10000002, 'S'); _unscaledCheckbox = new GUI::CheckboxWidget(_tab, 5, 50, 270, 20, "Unscaled (you must scroll left and right)", 0x10000003, 'S'); + new GUI::StaticTextWidget(_tab, 5, 125, 110, 15, "Brightness:", Graphics::kTextAlignLeft); + _gammaCorrection = new GUI::SliderWidget(_tab, 130, 120, 130, 12, 1); + _gammaCorrection->setMinValue(0); + _gammaCorrection->setMaxValue(8); + _gammaCorrection->setValue(0); + + + _tab->addTab("General"); _highQualityAudioCheckbox = new GUI::CheckboxWidget(_tab, 5, 5, 250, 20, "High quality audio (slower) (reboot)", 0, 'T'); @@ -170,6 +178,12 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { _150PercentCheckbox->setState(true); } + if (ConfMan.hasKey("gamma", "ds")) { + _gammaCorrection->setValue(ConfMan.getInt("gamma", "ds")); + } else { + _gammaCorrection->setValue(0); + } + _highQualityAudioCheckbox->setState(confGetBool("22khzaudio", false)); _disablePowerOff->setState(confGetBool("disablepoweroff", false)); @@ -219,6 +233,7 @@ void DSOptionsDialog::updateConfigManager() { ConfMan.setBool("touchpad", _touchPadStyle->getState(), "ds"); ConfMan.setBool("screentaps", _screenTaps->getState(), "ds"); ConfMan.setInt("sensitivity", _sensitivity->getValue(), "ds"); + ConfMan.setInt("gamma", _gammaCorrection->getValue(), "ds"); u32 zoomLevel = 150; @@ -395,6 +410,9 @@ void setOptions() { DS::setTapScreenClicksEnable(confGetBool("screentaps", false)); + DS::setGamma(confGetInt("gamma", 0)); + + if (ConfMan.hasKey("touchpad", "ds")) { bool enable = ConfMan.getBool("touchpad", "ds"); diff --git a/backends/platform/ds/arm9/source/dsoptions.h b/backends/platform/ds/arm9/source/dsoptions.h index d29dd9d8ac..4b3ac36d45 100644 --- a/backends/platform/ds/arm9/source/dsoptions.h +++ b/backends/platform/ds/arm9/source/dsoptions.h @@ -53,6 +53,7 @@ protected: GUI::SliderWidget* _touchX; GUI::SliderWidget* _touchY; GUI::SliderWidget* _sensitivity; + GUI::SliderWidget* _gammaCorrection; GUI::CheckboxWidget* _leftHandedCheckbox; GUI::CheckboxWidget* _unscaledCheckbox; GUI::CheckboxWidget* _100PercentCheckbox; diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 5c5663f872..1654bb31e7 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -38,14 +38,35 @@ #include "touchkeyboard.h" #include "backends/fs/ds/ds-fs-factory.h" +#ifdef ENABLE_AGI +#include "wordcompletion.h" +#endif + #include <time.h> +#if defined(DS_BUILD_A) +#define DEFAULT_CONFIG_FILE "scummvm.ini" +#elif defined(DS_BUILD_B) +#define DEFAULT_CONFIG_FILE "scummvmb.ini" +#elif defined(DS_BUILD_C) +#define DEFAULT_CONFIG_FILE "scummvmc.ini" +#elif defined(DS_BUILD_D) +#define DEFAULT_CONFIG_FILE "scummvmd.ini" +#elif defined(DS_BUILD_E) +#define DEFAULT_CONFIG_FILE "scummvme.ini" +#elif defined(DS_BUILD_F) +#define DEFAULT_CONFIG_FILE "scummvmf.ini" +#elif defined(DS_BUILD_G) +#define DEFAULT_CONFIG_FILE "scummvmg.ini" +#elif defined(DS_BUILD_H) +#define DEFAULT_CONFIG_FILE "scummvmh.ini" +#endif OSystem_DS* OSystem_DS::_instance = NULL; OSystem_DS::OSystem_DS() : eventNum(0), lastPenFrame(0), queuePos(0), _mixer(NULL), _timer(NULL), _frameBufferExists(false), - _disableCursorPalette(true), _graphicsEnable(true) + _disableCursorPalette(true), _graphicsEnable(true), _gammaValue(0) { // eventNum = 0; // lastPenFrame = 0; @@ -161,9 +182,11 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) { u16 paletteValue = red | (green << 5) | (blue << 10); if (DS::getIsDisplayMode8Bit()) { - BG_PALETTE[r] = paletteValue; + int col = applyGamma(paletteValue); + BG_PALETTE[r] = col; + if (!DS::getKeyboardEnable()) { - BG_PALETTE_SUB[r] = paletteValue; + BG_PALETTE_SUB[r] = col; } } @@ -180,10 +203,10 @@ void OSystem_DS::restoreHardwarePalette() // Set the hardware palette up based on the stored palette for (int r = 0; r < 255; r++) { - BG_PALETTE[r] = _palette[r]; - + int col = applyGamma(_palette[r]); + BG_PALETTE[r] = col; if (!DS::getKeyboardEnable()) { - BG_PALETTE_SUB[r] = _palette[r]; + BG_PALETTE_SUB[r] = col; } } } @@ -207,6 +230,7 @@ void OSystem_DS::setCursorPalette(const byte *colors, uint start, uint num) { } _disableCursorPalette = false; + refreshCursor(); } bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) { @@ -271,65 +295,113 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int if (DS::getKeyboardEnable()) { // When they keyboard is on screen, we don't update the subscreen because - // the keyboard image uses the same VRAM addresses. In order to do this, - // I'm going to update the main screen twice. This avoids putting a compare - // in the loop and slowing down the common case. - bgSub = bg; - } + // the keyboard image uses the same VRAM addresses. + + for (int dy = y; dy < y + h; dy++) { + u8* dest = ((u8 *) (bg)) + (dy * stride) + x; + u8* src = (u8 *) buf + (pitch * by); - for (int dy = y; dy < y + h; dy++) { - u8* dest = ((u8 *) (bg)) + (dy * stride) + x; - u8* destSub = ((u8 *) (bgSub)) + (dy * 512) + x; - u8* src = (u8 *) buf + (pitch * by); + u32 dx; - u32 dx; + u32 pixelsLeft = w; - u32 pixelsLeft = w; + if (MISALIGNED16(dest)) { + // Read modify write - if (MISALIGNED16(dest)) { - // Read modify write + dest--; + u16 mix = *((u16 *) dest); - dest--; - u16 mix = *((u16 *) dest); + mix = (mix & 0x00FF) | (*src++ << 8); - mix = (mix & 0x00FF) | (*src++ << 8); + *dest = mix; - *dest = mix; - *destSub = mix; + dest += 2; + pixelsLeft--; + } - dest += 2; - destSub += 2; - pixelsLeft--; - } + // We can now assume dest is aligned + u16* dest16 = (u16 *) dest; - // We can now assume dest is aligned - u16* dest16 = (u16 *) dest; - u16* destSub16 = (u16 *) destSub; + for (dx = 0; dx < pixelsLeft; dx+=2) { + u16 mix; - for (dx = 0; dx < pixelsLeft; dx+=2) { - u16 mix; + mix = *src + (*(src + 1) << 8); + *dest16++ = mix; + src += 2; + } - mix = *src + (*(src + 1) << 8); - *dest16++ = mix; - *destSub16++ = mix; - src += 2; - } + pixelsLeft -= dx; - pixelsLeft -= dx; + // At the end we may have one pixel left over - // At the end we may have one pixel left over + if (pixelsLeft != 0) { + u16 mix = *dest16; - if (pixelsLeft != 0) { - u16 mix = *dest16; + mix = (mix & 0x00FF) | ((*src++) << 8); - mix = (mix & 0x00FF) | ((*src++) << 8); + *dest16 = mix; + } - *dest16 = mix; - *destSub16 = mix; + by++; } - by++; + } else { + // When they keyboard is not on screen, update both vram copies + + for (int dy = y; dy < y + h; dy++) { + u8* dest = ((u8 *) (bg)) + (dy * stride) + x; + u8* destSub = ((u8 *) (bgSub)) + (dy * 512) + x; + u8* src = (u8 *) buf + (pitch * by); + + u32 dx; + + u32 pixelsLeft = w; + + if (MISALIGNED16(dest)) { + // Read modify write + + dest--; + u16 mix = *((u16 *) dest); + + mix = (mix & 0x00FF) | (*src++ << 8); + + *dest = mix; + *destSub = mix; + + dest += 2; + destSub += 2; + pixelsLeft--; + } + + // We can now assume dest is aligned + u16* dest16 = (u16 *) dest; + u16* destSub16 = (u16 *) destSub; + + for (dx = 0; dx < pixelsLeft; dx+=2) { + u16 mix; + + mix = *src + (*(src + 1) << 8); + *dest16++ = mix; + *destSub16++ = mix; + src += 2; + } + pixelsLeft -= dx; + + // At the end we may have one pixel left over + + if (pixelsLeft != 0) { + u16 mix = *dest16; + + mix = (mix & 0x00FF) | ((*src++) << 8); + + *dest16 = mix; + *destSub16 = mix; + } + + by++; + + } } // consolePrintf("Slow method used!\n"); @@ -763,3 +835,53 @@ void OSystem_DS::clearAutoComplete() { void OSystem_DS::setCharactersEntered(int count) { DS::setCharactersEntered(count); } + +Common::SeekableReadStream* OSystem_DS::createConfigReadStream() { + Common::FSNode file(DEFAULT_CONFIG_FILE); +// consolePrintf("R %s", DEFAULT_CONFIG_FILE); + return file.createReadStream(); +} + +Common::WriteStream* OSystem_DS::createConfigWriteStream() { + Common::FSNode file(DEFAULT_CONFIG_FILE); +// consolePrintf("W %s", DEFAULT_CONFIG_FILE); + return file.createWriteStream(); +} + +u16 OSystem_DS::applyGamma(u16 colour) { + // Attempt to do gamma correction (or something like it) to palette entries + // to improve the contrast of the image on the original DS screen. + + // Split the colour into it's component channels + int r = colour & 0x001F; + int g = (colour & 0x03E0) >> 5; + int b = (colour & 0x7C00) >> 10; + + // Caluclate the scaling factor for this colour based on it's brightness + int scale = ((23 - ((r + g + b) >> 2)) * _gammaValue) >> 3; + + // Scale the three components by the scaling factor, with clamping + r = r + ((r * scale) >> 4); + if (r > 31) r = 31; + + g = g + ((g * scale) >> 4); + if (g > 31) g = 31; + + b = b + ((b * scale) >> 4); + if (b > 31) b = 31; + + // Stick them back together into a 555 colour value + return 0x8000 | r | (g << 5) | (b << 10); +} + +void OSystem_DS::engineDone() { + // Scumm games appear not to stop their CD audio, so I stop the CD here. + stopCD(); + +#ifdef ENABLE_AGI + DS::clearAutoCompleteWordList(); +#endif + +} + + diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 760872b0d9..ce55ec2740 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -71,6 +71,8 @@ protected: Graphics::Surface* createTempFrameBuffer(); bool _disableCursorPalette; + int _gammaValue; + public: typedef void (*SoundProc)(byte *buf, int len); typedef int (*TimerProc)(int interval); @@ -171,6 +173,14 @@ public: FilesystemFactory *getFilesystemFactory(); void refreshCursor(); + + Common::WriteStream* createConfigWriteStream(); + Common::SeekableReadStream* createConfigReadStream(); + + u16 applyGamma(u16 colour); + void setGammaValue(int gamma) { _gammaValue = gamma; } + + void engineDone(); }; static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h index 560bd8ab4b..5472b711b8 100644 --- a/backends/platform/ds/arm9/source/portdefs.h +++ b/backends/platform/ds/arm9/source/portdefs.h @@ -55,19 +55,22 @@ typedef signed int s32; #define DISABLE_TEXT_CONSOLE #define DISABLE_COMMAND_LINE +#define STREAM_AUDIO_FROM_DISK + +//#undef assert +//#define assert(expr) consolePrintf("Asserted!") +#define NO_DEBUG_MSGS + + +// This is defined in dsmain.cpp #ifdef __cplusplus extern "C" { #endif -int consolePrintf(const char* s, ...); +void consolePrintf(const char *format, ...); #ifdef __cplusplus } #endif -//#undef assert -//#define assert(expr) consolePrintf("Asserted!") -#define NO_DEBUG_MSGS - -#define consolePrintf iprintf #ifdef assert #undef assert @@ -82,7 +85,7 @@ int consolePrintf(const char* s, ...); #define ITCM_DATA __attribute__((section(".itcm"))) -// Since I can't change the engine at the moment (post lockdown) this define can go here. +// FIXME: Since I can't change the engine at the moment (post lockdown) this define can go here. // This define changes the mouse-relative motion which doesn't make sense on a touch screen to // a more conventional form of input where the menus can be clicked on. #define LURE_CLICKABLE_MENUS diff --git a/backends/platform/ds/arm9/source/wordcompletion.cpp b/backends/platform/ds/arm9/source/wordcompletion.cpp index c66286d64d..035f6a631d 100644 --- a/backends/platform/ds/arm9/source/wordcompletion.cpp +++ b/backends/platform/ds/arm9/source/wordcompletion.cpp @@ -60,6 +60,11 @@ int stringCompare(const void* a, const void* b) { return scumm_stricmp(*as, *bs); } +void clearAutoCompleteWordList() { + wordBufferPtrPos = 0; + wordBufferPos = 0; +} + void sortAutoCompleteWordList() { // Sort the whole word list into alphabetical order qsort((void *)wordBufferPtr, wordBufferPtrPos, 4, stringCompare); diff --git a/backends/platform/ds/arm9/source/wordcompletion.h b/backends/platform/ds/arm9/source/wordcompletion.h index aa689ae8ec..e50bade37b 100644 --- a/backends/platform/ds/arm9/source/wordcompletion.h +++ b/backends/platform/ds/arm9/source/wordcompletion.h @@ -1,5 +1,6 @@ namespace DS { +extern void clearAutoCompleteWordList(); extern bool findWordCompletions(const char *input); extern void addAutoCompleteLine(const char *line); extern void sortAutoCompleteWordList(); |