aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVicent Marti2008-08-01 08:55:21 +0000
committerVicent Marti2008-08-01 08:55:21 +0000
commit7d797c878dd8f880a9e0045a93a3a7c44cb14c04 (patch)
treea5bcb451c87daf2934d132f161fff59e953c3283 /common
parent169c4442d1264c0e807ae7bdccde928fb9e2e9b5 (diff)
parente89a01dc633ccdc821751fc076ae2d83c9315b33 (diff)
downloadscummvm-rg350-7d797c878dd8f880a9e0045a93a3a7c44cb14c04.tar.gz
scummvm-rg350-7d797c878dd8f880a9e0045a93a3a7c44cb14c04.tar.bz2
scummvm-rg350-7d797c878dd8f880a9e0045a93a3a7c44cb14c04.zip
Merged revisions 32701,32705,32727-32728,32730-32733,32737-32738,32742,32744-32745,32747,32750-32759,32762-32764,32769,32777,32783,32785-32786,32789-32791,32798-32799,32801-32807,32809-32812,32816-32817,32819-32821,32823-32830,32832-32836,32838-32844,32846-32850,32852-32854,32858-32859,32865-32868,32873-32874,32879,32883,32895,32899,32902-32904,32910-32912,32923-32924,32930-32931,32938,32940,32948-32949,32951,32960-32964,32966-32970,32972-32974,32976,32978,32983,32986-32990,32992,32994,33002-33004,33006-33007,33009-33010,33014,33017,33021-33023,33030,33033,33052-33053,33056-33058,33061-33064,33068,33070,33072,33075,33078-33079,33083,33086-33087,33089,33094-33096,33098-33099,33104,33108-33109,33114-33117,33120,33135-33146,33160,33162,33165,33167-33169,33188-33189,33191-33193,33196,33198,33202-33203,33206,33210,33212,33218-33220,33222,33224-33226,33229-33243,33246,33248-33250,33252,33258-33261,33263,33266,33270,33272-33283,33285,33287-33290,33295-33298,33321,33325-33330,33332-33335,33337-33340,33342,33345,33347,33349-33350,33352-33357,33359-33367,33369-33371,33373,33375-33377,33379-33380,33383-33385,33387-33389,33392-33394,33400-33402,33404-33405,33407-33410,33412-33416,33418-33419,33425-33427,33432,33436-33438,33444,33446,33452-33453,33455-33459,33463-33464,33466-33471,33473-33474,33478 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk ................ r32701 | Tanoku | 2008-06-14 16:44:06 +0200 (Sat, 14 Jun 2008) | 1 line Updated MS Visual Studio project files for MusicPlugin. ................ r32705 | sev | 2008-06-15 09:15:58 +0200 (Sun, 15 Jun 2008) | 2 lines Make null plugin compilable ................ r32727 | thebluegr | 2008-06-17 20:27:03 +0200 (Tue, 17 Jun 2008) | 1 line Removed duplicate code ................ r32728 | thebluegr | 2008-06-17 23:52:58 +0200 (Tue, 17 Jun 2008) | 1 line Possible fix for bug #1979086 - "DRASCULA: Wrong language detection(?) and crash" ................ r32730 | buddha_ | 2008-06-18 05:31:13 +0200 (Wed, 18 Jun 2008) | 1 line Fixed a small discrepancy in Delphine unpacker's command 00b's documentation (Parameter range is 1..8, not 1..9). ................ r32731 | john_doe | 2008-06-18 13:01:51 +0200 (Wed, 18 Jun 2008) | 4 lines - Fixed sprite drawing in Rodney's Funscreen - Handle mouse button up events and event number fixes in MadeEngine::handleEvents() - Use milliseconds -> game ticks calculation based on Windows version of the original engine - "Rodney's Fun Screen" -> "Rodney's Funscreen" ................ r32732 | fingolfin | 2008-06-18 21:46:50 +0200 (Wed, 18 Jun 2008) | 1 line Setting svn:ignore for backends/fs/wii ................ r32733 | fingolfin | 2008-06-18 23:02:52 +0200 (Wed, 18 Jun 2008) | 1 line Renamed M4Surface::empty() to clear() (two reason: empty is not a verb, and in class String it is used for a bool property) ................ r32737 | drmccoy | 2008-06-19 18:27:49 +0200 (Thu, 19 Jun 2008) | 2 lines Only try playing object videos when the game version supports that (only Woodruff, for now) ................ r32738 | drmccoy | 2008-06-20 00:54:17 +0200 (Fri, 20 Jun 2008) | 2 lines Fixed a palette issue in Lost in Time ................ r32742 | cpage88 | 2008-06-20 22:20:46 +0200 (Fri, 20 Jun 2008) | 117 lines Merged revisions 31992,32088,32094,32129,32203,32208,32219,32236,32329,32332-32333,32357,32504,32519,32525,32566,32578,32641-32642,32673,32675,32677,32679-32680,32718-32719,32721,32739 via svnmerge from https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/branches/gsoc2008-rtl ........ r31992 | cpage88 | 2008-05-10 18:44:46 -0500 (Sat, 10 May 2008) | 1 line Modified game loop to return to launcher, codeblocks layouts update 1.5->1.6 ........ r32088 | cpage88 | 2008-05-13 11:09:57 -0500 (Tue, 13 May 2008) | 1 line used memmove() instead of memcpy() to fix memory overlap error ........ r32094 | cpage88 | 2008-05-13 17:59:19 -0500 (Tue, 13 May 2008) | 1 line Fixed memory leak by deallocating memory used by window->iconPtr ........ r32129 | cpage88 | 2008-05-14 18:26:32 -0500 (Wed, 14 May 2008) | 1 line Fixed memory leak when returning to launcher in AGOS engine by properly creating and deleting midi driver pointer ........ r32203 | cpage88 | 2008-05-20 16:40:53 -0500 (Tue, 20 May 2008) | 1 line AGOS Engine: Began implementation for a new quit event which will cleanly return to the launcher. This replaces the old shutdown() method within delay() ........ r32208 | cpage88 | 2008-05-21 13:52:27 -0500 (Wed, 21 May 2008) | 1 line AGOS: Fixed two memory leaks when returning to the launcher (_mouseData and _zoneBuffers) ........ r32219 | cpage88 | 2008-05-22 18:40:36 -0500 (Thu, 22 May 2008) | 1 line AGOS: Fixed a memory leak from earlier in a better way ........ r32236 | cpage88 | 2008-05-23 19:08:13 -0500 (Fri, 23 May 2008) | 1 line AGI: Fixed two memory leaks when returning to launcher from AGI Engine ........ r32329 | cpage88 | 2008-05-27 15:15:36 -0500 (Tue, 27 May 2008) | 1 line AGI: Modified AGI Engine to shutdown without using system->quit ........ r32332 | cpage88 | 2008-05-27 18:26:48 -0500 (Tue, 27 May 2008) | 1 line CINE: Fixed two memory leaks when shutting down the CINE engine ........ r32333 | cpage88 | 2008-05-27 19:52:45 -0500 (Tue, 27 May 2008) | 1 line CINE: Initialize exitEngine to 0 in mainLoop() to allow replay after returning to the launcher ........ r32357 | cpage88 | 2008-05-28 18:28:11 -0500 (Wed, 28 May 2008) | 1 line LURE: Fixed some memory leaks when returning to the launcher from the LURE engine ........ r32504 | cpage88 | 2008-06-02 16:08:49 -0500 (Mon, 02 Jun 2008) | 1 line PARA: Got rid of calls to system->quit() so that the Parallaction engine can return to the launcher. Also fixed a couple of memory leaks. ........ r32519 | cpage88 | 2008-06-03 13:24:54 -0500 (Tue, 03 Jun 2008) | 1 line PARA: Fixed some memory leaks ........ r32525 | cpage88 | 2008-06-04 00:21:47 -0500 (Wed, 04 Jun 2008) | 1 line QUEEN: Modified engine to use a quit flag instead of system->quit() in order to return to the launcher ........ r32566 | cpage88 | 2008-06-05 19:34:47 -0500 (Thu, 05 Jun 2008) | 1 line TOUCHE: Fixed a memory leak ........ r32578 | cpage88 | 2008-06-06 11:40:39 -0500 (Fri, 06 Jun 2008) | 1 line SKY: Fixed a memory leak in SKY engine ........ r32641 | cpage88 | 2008-06-09 17:26:05 -0500 (Mon, 09 Jun 2008) | 1 line TOUCHE: Reverted some comments that were used for testing purposes ........ r32642 | cpage88 | 2008-06-09 18:15:17 -0500 (Mon, 09 Jun 2008) | 1 line Implemented popAllCursors() in CursorManager to ensure that all unnecessary cursors are removed from the cursor stack when returning to the launcher ........ r32673 | cpage88 | 2008-06-12 11:58:02 -0500 (Thu, 12 Jun 2008) | 1 line SAGA: Fixed memory leaks in the SAGA engine ........ r32675 | cpage88 | 2008-06-12 13:11:09 -0500 (Thu, 12 Jun 2008) | 1 line LURE: Fixed memory leaks in the LURE engine ........ r32677 | cpage88 | 2008-06-12 13:52:43 -0500 (Thu, 12 Jun 2008) | 1 line CINE: Fixed memory leaks in the CINE engine ........ r32679 | cpage88 | 2008-06-12 14:34:32 -0500 (Thu, 12 Jun 2008) | 1 line AGOS: Fixed a memory leak in the AGOS engine ........ r32680 | cpage88 | 2008-06-12 14:43:54 -0500 (Thu, 12 Jun 2008) | 1 line SCUMM: Fixed a memory leak in the SCUMM engine ........ r32718 | cpage88 | 2008-06-16 12:34:58 -0500 (Mon, 16 Jun 2008) | 1 line AGOS: Found a system->quit(), changed to _quit=true ........ r32719 | cpage88 | 2008-06-16 13:47:32 -0500 (Mon, 16 Jun 2008) | 1 line Fixed a problem where the function that I previously implemented, popAllCursors(), was causing the mouse cursor to disapear ........ r32721 | cpage88 | 2008-06-16 14:55:59 -0500 (Mon, 16 Jun 2008) | 1 line Cleaned up some unnecessary comments ........ r32739 | cpage88 | 2008-06-20 14:38:38 -0500 (Fri, 20 Jun 2008) | 1 line Reverting changes to codeblocks layouts made in revision 31992 ........ ................ r32744 | peres001 | 2008-06-22 07:42:22 +0200 (Sun, 22 Jun 2008) | 1 line Circular references between Zone/Animation and Command are now manually removed, to allow the objects - which are stored into SharedPtr's - to be deallocated. ................ r32745 | fingolfin | 2008-06-22 12:26:18 +0200 (Sun, 22 Jun 2008) | 1 line Disabled return to launcher on trunk again ................ r32747 | thebluegr | 2008-06-22 12:29:36 +0200 (Sun, 22 Jun 2008) | 1 line Updated NEWS about Drascula support ................ r32750 | athrxx | 2008-06-22 14:31:05 +0200 (Sun, 22 Jun 2008) | 1 line this should fix bug #1997149: KYRA2: no text in spellbook ................ r32751 | lordhoto | 2008-06-22 14:36:38 +0200 (Sun, 22 Jun 2008) | 2 lines Cleanup. ................ r32752 | lordhoto | 2008-06-22 14:39:40 +0200 (Sun, 22 Jun 2008) | 2 lines Update comment. ................ r32753 | athrxx | 2008-06-22 14:41:46 +0200 (Sun, 22 Jun 2008) | 1 line missed this in last commit (bug fix for #1997149) ................ r32754 | lordhoto | 2008-06-22 14:43:32 +0200 (Sun, 22 Jun 2008) | 2 lines Cleanup. ................ r32755 | lordhoto | 2008-06-22 15:26:22 +0200 (Sun, 22 Jun 2008) | 2 lines Fixed getTotalPlayTime implementation for MP3InputStream. ................ r32756 | peres001 | 2008-06-22 16:31:45 +0200 (Sun, 22 Jun 2008) | 1 line Fixed leak when loading sounds for Amiga version of Nippon Safes. ................ r32757 | peres001 | 2008-06-22 16:46:08 +0200 (Sun, 22 Jun 2008) | 1 line Added constructor and destructor to Dialogue, thus fixing a long standing leak. ................ r32758 | thebluegr | 2008-06-22 19:36:14 +0200 (Sun, 22 Jun 2008) | 1 line Fixed 2 MSVC warnings (potentially undefined behavior and possibly uninitialized variable used) ................ r32759 | thebluegr | 2008-06-22 19:57:06 +0200 (Sun, 22 Jun 2008) | 1 line Turned off overzealous warning 4800 - "forcing value to bool 'true' or 'false' (performance warning)" ................ r32762 | peres001 | 2008-06-24 15:21:22 +0200 (Tue, 24 Jun 2008) | 1 line Fix for bug #2001193. Character confirmation screen didn't appear and game crashed because too many strings were added to the draw list. ................ r32763 | lordhoto | 2008-06-24 15:59:48 +0200 (Tue, 24 Jun 2008) | 2 lines Added const to some static data. ................ r32764 | jvprat | 2008-06-24 16:23:26 +0200 (Tue, 24 Jun 2008) | 2 lines Fixed mktemp usage in BSD systems (as noted in bug #2000931) ................ r32769 | buddha_ | 2008-06-24 22:44:37 +0200 (Tue, 24 Jun 2008) | 7 lines Fixed opcodes: - 0xA0: o2_addGfxElementType20 (Was o2_addGfxElementA0) Implemented opcodes: - 0xA1: o2_removeGfxElementType20 (Was o2_removeGfxElementA0) - 0xA2: o2_addGfxElementType21 (Was o2_opA2) - 0xA3: o2_removeGfxElementType21 (Was o2_opA3) NOTE: Drawing of type 21 overlay elements isn't coded yet. ................ r32777 | thebluegr | 2008-06-25 10:36:07 +0200 (Wed, 25 Jun 2008) | 1 line Possible fix for (for the drascula engine) for bug #2001583 - "WINCE: CRUISE and DRASCULA engines can not be compiled" ................ r32783 | thebluegr | 2008-06-25 14:02:34 +0200 (Wed, 25 Jun 2008) | 1 line Added patch from bug report #2001189 - "DRASCULA: Wrong intro music in Spanish version" ................ r32785 | buddha_ | 2008-06-25 17:09:24 +0200 (Wed, 25 Jun 2008) | 5 lines Implemented opcode: - 0x8D: o2_op8D (Didn't come up with a descriptive name yet) Compares ranges of x, y and mask parameters between two objects. Possibly some kind of an intersection testing function? ................ r32786 | buddha_ | 2008-06-25 19:14:44 +0200 (Wed, 25 Jun 2008) | 4 lines Implemented opcode: - 0x82: o2_modifySeqListElement (Was o2_op82) Seeks a matching element from the seqList and modifies its values. ................ r32789 | buddha_ | 2008-06-25 20:51:44 +0200 (Wed, 25 Jun 2008) | 1 line Added FIXME about the broken implementation of opcode 0x9A (o2_wasZoneChecked). ................ r32790 | buddha_ | 2008-06-25 23:57:08 +0200 (Wed, 25 Jun 2008) | 5 lines Implemented support for zoneQuery (Operation Stealth specific). Fixed opcodes (related to zoneQuery): - 0x08: o1_checkCollision - 0x9A: o2_wasZoneChecked NOTE: Savegame support for the zoneQuery data is broken ................ r32791 | buddha_ | 2008-06-26 00:13:18 +0200 (Thu, 26 Jun 2008) | 1 line Fix for GCC warning (Warned about testing x >= 0 when x is unsigned and therefore the test is always true). ................ r32798 | cyx | 2008-06-26 12:12:12 +0200 (Thu, 26 Jun 2008) | 1 line moved midi driver object creation to MidiPlayer class (to match delete call) ................ r32799 | cyx | 2008-06-26 12:12:47 +0200 (Thu, 26 Jun 2008) | 1 line fix possible oob access ................ r32801 | buddha_ | 2008-06-26 17:16:15 +0200 (Thu, 26 Jun 2008) | 1 line Comments update. ................ r32802 | buddha_ | 2008-06-26 17:44:26 +0200 (Thu, 26 Jun 2008) | 1 line Comments update. ................ r32803 | anotherguest | 2008-06-26 18:51:02 +0200 (Thu, 26 Jun 2008) | 1 line Fixed Symbian buildsystem for new defines. Fixed ARM asm syntax for Symbian build. ................ r32804 | buddha_ | 2008-06-26 19:29:21 +0200 (Thu, 26 Jun 2008) | 4 lines Fixed opcode: - 0x83: o2_isSeqRunning (Should it be named o2_isSeqNotRunning?) -- Added previously missing test part -- Negated the result (It was backwards before!) ................ r32805 | anotherguest | 2008-06-26 20:31:33 +0200 (Thu, 26 Jun 2008) | 1 line Changed default paths ................ r32806 | anotherguest | 2008-06-26 20:45:46 +0200 (Thu, 26 Jun 2008) | 1 line Remove inclusion of .o in mmp.in ................ r32807 | athrxx | 2008-06-26 21:42:59 +0200 (Thu, 26 Jun 2008) | 3 lines - improved hof music support for fm-towns (driver for *.twn tracks) (still needs quite some work) - some PC-98 music support since it uses a very similar driver, but this can't be considered working yet) - Kyra 1 PC-98 music doen't work at all since I haven't figured out yet how to turn track numbers into the corresponding music file names (might require a hard coded track map) ................ r32809 | drmccoy | 2008-06-26 21:56:18 +0200 (Thu, 26 Jun 2008) | 2 lines Fixing compilation for me. There are still lots of "cast casts away constness" warnings, though ................ r32810 | athrxx | 2008-06-26 22:13:04 +0200 (Thu, 26 Jun 2008) | 1 line cleanup ................ r32811 | athrxx | 2008-06-26 22:30:43 +0200 (Thu, 26 Jun 2008) | 1 line more cleanup ................ r32812 | athrxx | 2008-06-26 22:43:23 +0200 (Thu, 26 Jun 2008) | 1 line fix bad const casts ................ r32816 | buddha_ | 2008-06-27 01:30:45 +0200 (Fri, 27 Jun 2008) | 1 line Implemented Operation Stealth's version of addOverlay(objectIndex, overlayType). ................ r32817 | john_doe | 2008-06-27 11:57:38 +0200 (Fri, 27 Jun 2008) | 2 lines - Fixed umlauts in printText - Don't exit when a pmv video couldn't be found ................ r32819 | athrxx | 2008-06-28 15:13:37 +0200 (Sat, 28 Jun 2008) | 2 lines - HOF: bug fix for music driver - KYRA1 PC98: fix music file selection ................ r32820 | peres001 | 2008-06-28 15:31:58 +0200 (Sat, 28 Jun 2008) | 1 line Added comment for fix for bug #2001193. ................ r32821 | athrxx | 2008-06-28 15:40:03 +0200 (Sat, 28 Jun 2008) | 1 line hof: remove debug code ................ r32823 | joostp | 2008-06-28 15:53:39 +0200 (Sat, 28 Jun 2008) | 2 lines add getFilesystemFactory() method to null backend ................ r32824 | fingolfin | 2008-06-28 16:14:16 +0200 (Sat, 28 Jun 2008) | 1 line Removed OSystem::getFilesystemFactory() default implentation, as announced ................ r32825 | fingolfin | 2008-06-28 17:00:27 +0200 (Sat, 28 Jun 2008) | 1 line Removed dead X11 backend ................ r32826 | fingolfin | 2008-06-28 17:13:54 +0200 (Sat, 28 Jun 2008) | 1 line Removed obsolete ::clearSoundCallback() code ................ r32827 | fingolfin | 2008-06-28 17:27:40 +0200 (Sat, 28 Jun 2008) | 1 line Doxygenified a comment ................ r32828 | fingolfin | 2008-06-28 17:28:29 +0200 (Sat, 28 Jun 2008) | 1 line Patch ##1956946 (Audio::Mixer internal API revision) with some tweaks ................ r32829 | athrxx | 2008-06-28 17:36:50 +0200 (Sat, 28 Jun 2008) | 1 line - implement music fading for Hof FM-Towns ................ r32830 | eriktorbjorn | 2008-06-28 18:00:04 +0200 (Sat, 28 Jun 2008) | 2 lines Fixed warning. (Hopefully without breaking anything.) ................ r32832 | marcus_c | 2008-06-29 00:16:51 +0200 (Sun, 29 Jun 2008) | 1 line Set $(DEPDIR). ................ r32833 | peres001 | 2008-06-29 11:30:32 +0200 (Sun, 29 Jun 2008) | 1 line Changed all remaining code to use the GfxObj class to keep frames data. This allows for more uniform processing during rendering, and also fixes the display of dialogue faces for BRA. ................ r32834 | peres001 | 2008-06-29 11:56:44 +0200 (Sun, 29 Jun 2008) | 1 line Merged the three render lists (for animations, doors and objects) into a single one. ................ r32835 | djwillis | 2008-06-29 12:16:20 +0200 (Sun, 29 Jun 2008) | 1 line Small GP2X tidy (mostly svn:executable on scripts) and fixes needed to reflect "Patch ##1956946 (Audio::Mixer internal API revision)" ................ r32836 | marcus_c | 2008-06-29 13:51:47 +0200 (Sun, 29 Jun 2008) | 1 line New Mixer API. ................ r32838 | marcus_c | 2008-06-29 14:10:38 +0200 (Sun, 29 Jun 2008) | 1 line Updated to use new EngineMan.detectGames() API. ................ r32839 | knakos | 2008-06-29 16:40:41 +0200 (Sun, 29 Jun 2008) | 1 line finish up new mixer changes ................ r32840 | knakos | 2008-06-29 16:41:44 +0200 (Sun, 29 Jun 2008) | 1 line fix some quirks of the newer build system ................ r32841 | athrxx | 2008-06-29 17:25:45 +0200 (Sun, 29 Jun 2008) | 2 lines - some more work on the Hof FM-Towns/PC98 music driver - move channels to a separate class ................ r32842 | athrxx | 2008-06-29 17:59:35 +0200 (Sun, 29 Jun 2008) | 1 line cleanup ................ r32843 | athrxx | 2008-06-29 18:07:29 +0200 (Sun, 29 Jun 2008) | 1 line fix warning ................ r32844 | knakos | 2008-06-29 18:58:27 +0200 (Sun, 29 Jun 2008) | 1 line adding a fixme ................ r32846 | joostp | 2008-06-30 01:36:44 +0200 (Mon, 30 Jun 2008) | 2 lines changes required for new mixer API + implement getMillis() and delayMillis() using gettimeofday() and usleep() resp. ................ r32847 | peres001 | 2008-06-30 03:36:50 +0200 (Mon, 30 Jun 2008) | 1 line Small cleanup/shuffling of Gfx code. ................ r32848 | buddha_ | 2008-06-30 05:33:08 +0200 (Mon, 30 Jun 2008) | 1 line Implemented resetGfxEntityEntry and made it used where appropriate (The function wasn't very easy to reverse engineer so it may have flaws still, but let's hope it doesn't ;-)). ................ r32849 | thebluegr | 2008-06-30 10:46:20 +0200 (Mon, 30 Jun 2008) | 1 line Updated MSVC project files for commit #32828 ................ r32850 | buddha_ | 2008-06-30 19:24:23 +0200 (Mon, 30 Jun 2008) | 1 line Fixed addAni (A test before using resetGfxEntityEntry was incorrect). Also added comments and checked that most 8-bit values used in this function are used as signed integers. ................ r32852 | buddha_ | 2008-06-30 20:15:34 +0200 (Mon, 30 Jun 2008) | 1 line Removed TODO from checkCollision: Updating zoneQuery each time checkCollision is called seems to be fine. ................ r32853 | anotherguest | 2008-06-30 21:10:32 +0200 (Mon, 30 Jun 2008) | 1 line del instead of rm command ................ r32854 | athrxx | 2008-06-30 23:55:08 +0200 (Mon, 30 Jun 2008) | 2 lines - this fixes Hof PC98 music initialization - music sounds exactly like FM-Towns for now ................ r32858 | lordhoto | 2008-07-01 01:39:56 +0200 (Tue, 01 Jul 2008) | 2 lines Added support for Spanish fan translation of kyra3 (See fr #1994040 "KYRA3: Add support for Spanish fan translation"). ................ r32859 | lordhoto | 2008-07-01 01:44:33 +0200 (Tue, 01 Jul 2008) | 2 lines Fix game flags for detection entries of installed kyra3 versions. ................ r32865 | fingolfin | 2008-07-01 12:33:25 +0200 (Tue, 01 Jul 2008) | 1 line Fixed unitialized variables ................ r32866 | dreammaster | 2008-07-01 13:46:29 +0200 (Tue, 01 Jul 2008) | 1 line Made corrections to the Italian strings ................ r32867 | dreammaster | 2008-07-01 13:48:06 +0200 (Tue, 01 Jul 2008) | 1 line New lure.dat with corrections to the Italian strings ................ r32868 | fingolfin | 2008-07-01 16:51:44 +0200 (Tue, 01 Jul 2008) | 1 line Reverted accidental commit of Tinsel changes in engines.mk ................ r32873 | peres001 | 2008-07-02 03:41:08 +0200 (Wed, 02 Jul 2008) | 2 lines - Changed labels to be GfxObj's, thus removing the Label object altogether. - Changed Item's to be almost GfxObj's, since ownership and destruction of underlying resource is an issue here (got to think some more about it). ................ r32874 | buddha_ | 2008-07-02 06:31:50 +0200 (Wed, 02 Jul 2008) | 5 lines Fully implemented processSeqListElement - Added parts that were missing and fixed a couple of errors -- One test was backwards and a global variable was written to when it shouldn't have been Added global variable inputVar0 that's used in processSeqListElement NOTE: inputVar0 isn't updated anywhere yet, so that's a TODO ................ r32879 | sev | 2008-07-03 10:44:29 +0200 (Thu, 03 Jul 2008) | 1 line Fix for bug #2008054: Parallaction engine doesn't compile under MSVC9 ................ r32883 | peres001 | 2008-07-03 12:31:25 +0200 (Thu, 03 Jul 2008) | 1 line Changed balloons to use GfxObj as well. Next step is to integrate balloons for BRA. ................ r32895 | drmccoy | 2008-07-03 18:25:59 +0200 (Thu, 03 Jul 2008) | 2 lines Fixing a crash when loading a save made within the cult/bargon building (bug #2005965) ................ r32899 | athrxx | 2008-07-03 23:09:07 +0200 (Thu, 03 Jul 2008) | 1 line minor fix for Towns/PC98 music ................ r32902 | peres001 | 2008-07-04 02:29:21 +0200 (Fri, 04 Jul 2008) | 2 lines - Moved dialogue balloon management code from Gfx to its own class - Added a class to draw balloons in BRA (still without text and with wrong placement) ................ r32903 | Kirben | 2008-07-04 02:35:39 +0200 (Fri, 04 Jul 2008) | 1 line Correct typo. ................ r32904 | buddha_ | 2008-07-04 11:38:03 +0200 (Fri, 04 Jul 2008) | 1 line Updated MSVC project files (Added Parallaction's balloons.cpp). ................ r32910 | sev | 2008-07-05 06:28:17 +0200 (Sat, 05 Jul 2008) | 2 lines Mention merge of Chris Page's memory leak plugging code. ................ r32911 | lordhoto | 2008-07-05 09:47:27 +0200 (Sat, 05 Jul 2008) | 2 lines Added spanish menu strings for spanish fan translation of Kyrandia 3. ................ r32912 | lordhoto | 2008-07-05 10:20:10 +0200 (Sat, 05 Jul 2008) | 2 lines Added support for Italian fan translation of Kyrandia 3. (see fr#2003504 "KYRA: add support for Italian version of Kyrandia 2&3") ................ r32923 | marcus_c | 2008-07-06 00:53:17 +0200 (Sun, 06 Jul 2008) | 1 line Enable all engines. ................ r32924 | dhewg | 2008-07-06 14:04:19 +0200 (Sun, 06 Jul 2008) | 1 line adjustments to the recent mixer api changes ................ r32930 | eriktorbjorn | 2008-07-06 20:37:52 +0200 (Sun, 06 Jul 2008) | 4 lines Implemented Good Enough(TM) XMIDI looping. This is used by Kyrandia 2 (the loop hack is no longer needed, and has been removed), and will be used by Discworld. ................ r32931 | eriktorbjorn | 2008-07-06 21:25:32 +0200 (Sun, 06 Jul 2008) | 4 lines Fixed silly error. The NEXT_BREAK event should, of course, jump to the event *after* the FOR_LOOP event. Apart from simplifying things, this should allow limited number of repeats to work. ................ r32938 | drmccoy | 2008-07-07 15:01:54 +0200 (Mon, 07 Jul 2008) | 2 lines Don't let listSavefiles() search subdirectories. Files with the same name (in different directories) would cause duplicate entries for the same file. ................ r32940 | peres001 | 2008-07-07 16:51:27 +0200 (Mon, 07 Jul 2008) | 1 line Fixed regression after label code refactoring. ................ r32948 | thebluegr | 2008-07-07 21:40:43 +0200 (Mon, 07 Jul 2008) | 1 line Some fixes for warnings under GCC 2.95 ................ r32949 | lordhoto | 2008-07-07 22:40:35 +0200 (Mon, 07 Jul 2008) | 1 line Fix for bug #2012293 "KYRA: Bad Spanish String in menu". ................ r32951 | buddha_ | 2008-07-08 00:02:01 +0200 (Tue, 08 Jul 2008) | 1 line Fix for bathroom door opening crash in Operation Stealth's start. ................ r32960 | fingolfin | 2008-07-08 12:29:35 +0200 (Tue, 08 Jul 2008) | 1 line Remove reference to kPlainSoundType ................ r32961 | sev | 2008-07-08 13:18:44 +0200 (Tue, 08 Jul 2008) | 1 line Shut couple of MSVC warnings ................ r32962 | drmccoy | 2008-07-08 13:35:09 +0200 (Tue, 08 Jul 2008) | 2 lines Modified the EGA story image delay to work for the Mac versions as well ................ r32963 | drmccoy | 2008-07-08 13:36:52 +0200 (Tue, 08 Jul 2008) | 3 lines Added a Gob1 version supplied by raina in the forums. It does look like the Mac version with a DOS executable and stripped music to me, so let's hope the Mac level image workaround works there as well. ................ r32964 | sev | 2008-07-08 13:48:16 +0200 (Tue, 08 Jul 2008) | 1 line One more MSVC warning ................ r32966 | eriktorbjorn | 2008-07-08 18:25:39 +0200 (Tue, 08 Jul 2008) | 4 lines On reading some more about XMIDI, I believe the NEXT and BREAK variants of the controller are mutually exclusive cases, i.e. a BREAK simply means forget about the innermost loop, and continue as if nothing had happened. ................ r32967 | joostp | 2008-07-08 19:20:26 +0200 (Tue, 08 Jul 2008) | 2 lines changes for new Mixer API ................ r32968 | joostp | 2008-07-08 19:41:09 +0200 (Tue, 08 Jul 2008) | 2 lines Enable static engines -- time to start thinking about prx/plugin support! ................ r32969 | joostp | 2008-07-08 19:46:26 +0200 (Tue, 08 Jul 2008) | 2 lines set DEPDIR ................ r32970 | tramboi | 2008-07-09 04:19:57 +0200 (Wed, 09 Jul 2008) | 3 lines New configure flag --enable-profiling to compile and link with -pg (for gprof) ................ r32972 | peres001 | 2008-07-09 04:49:20 +0200 (Wed, 09 Jul 2008) | 1 line Added a couple of NULLity checks. ................ r32973 | fingolfin | 2008-07-09 12:42:47 +0200 (Wed, 09 Jul 2008) | 1 line cleanup / code formatting ................ r32974 | peres001 | 2008-07-09 12:52:46 +0200 (Wed, 09 Jul 2008) | 1 line Fixed regression introduced with GfxObj: the character sprite was sometimes removed from the rendering list. ................ r32976 | peres001 | 2008-07-09 15:27:09 +0200 (Wed, 09 Jul 2008) | 1 line Fixed leaks in NS and BRA. ................ r32978 | agent-q | 2008-07-09 18:50:23 +0200 (Wed, 09 Jul 2008) | 1 line DS: Backend changes for new mixer code ................ r32983 | peres001 | 2008-07-10 04:00:54 +0200 (Thu, 10 Jul 2008) | 1 line Fixed destruction of sprites in BRA. ................ r32986 | lordhoto | 2008-07-10 13:25:43 +0200 (Thu, 10 Jul 2008) | 2 lines Workaround for gcc 2.95 compiler bug. ................ r32987 | lordhoto | 2008-07-10 13:28:51 +0200 (Thu, 10 Jul 2008) | 2 lines Fixed mem leak in MIDI related code. ................ r32988 | lordhoto | 2008-07-10 14:05:38 +0200 (Thu, 10 Jul 2008) | 2 lines Added filename to unknown opcode/command warnings of EMC scripts. ................ r32989 | lordhoto | 2008-07-10 14:12:42 +0200 (Thu, 10 Jul 2008) | 2 lines Added filename to unkown command/opcode warnings for TIM scripts. ................ r32990 | lordhoto | 2008-07-10 14:14:00 +0200 (Thu, 10 Jul 2008) | 2 lines Typo. ................ r32992 | eriktorbjorn | 2008-07-10 18:19:17 +0200 (Thu, 10 Jul 2008) | 2 lines Fixed Kyra 3 detection regression. ................ r32994 | tramboi | 2008-07-10 20:01:54 +0200 (Thu, 10 Jul 2008) | 1 line Fixed a few warnings ................ r33002 | peres001 | 2008-07-11 14:55:08 +0200 (Fri, 11 Jul 2008) | 2 lines Fixed leak in sound code by explicitly deleting the midi driver. ................ r33003 | peres001 | 2008-07-11 15:06:28 +0200 (Fri, 11 Jul 2008) | 3 lines Moved program and command execution code out of the engine, into their own brand new classes. ................ r33004 | buddha_ | 2008-07-11 15:13:28 +0200 (Fri, 11 Jul 2008) | 1 line Update MSVC project files. ................ r33006 | peres001 | 2008-07-11 15:36:22 +0200 (Fri, 11 Jul 2008) | 1 line Cleanup. ................ r33007 | peres001 | 2008-07-11 17:07:13 +0200 (Fri, 11 Jul 2008) | 1 line Added a script (courtesy of salty-horse) to create/set properties for source files under version control by Subversion. Specifically, the mime-type, eol-style and keywords properties are handled. ................ r33009 | fingolfin | 2008-07-11 22:28:14 +0200 (Fri, 11 Jul 2008) | 1 line Don't use kPlainSoundType if you don't have to ................ r33010 | fingolfin | 2008-07-11 22:28:50 +0200 (Fri, 11 Jul 2008) | 1 line cleanup ................ r33014 | drmccoy | 2008-07-12 17:21:38 +0200 (Sat, 12 Jul 2008) | 3 lines Changed tricky variable access from pointers to a new class that minds endianess. This should fix a few regressions with BE games on LE systems and vice versa that I introduced when I changed how variables are stored (which was necessary to get Woodruff work on BE systems). ................ r33017 | tramboi | 2008-07-12 22:35:44 +0200 (Sat, 12 Jul 2008) | 2 lines Minor constness fix to help with aliasing ................ r33021 | peres001 | 2008-07-13 05:30:14 +0200 (Sun, 13 Jul 2008) | 1 line Properly implemented the OFF command. The new rendering order for graphics let this mistake finally surface. ................ r33022 | peres001 | 2008-07-13 05:39:42 +0200 (Sun, 13 Jul 2008) | 1 line Cleanup and improved debugging output for CommandExec::run() ................ r33023 | peres001 | 2008-07-13 08:27:31 +0200 (Sun, 13 Jul 2008) | 1 line Cleanup of walk code. ................ r33030 | athrxx | 2008-07-13 14:20:24 +0200 (Sun, 13 Jul 2008) | 1 line - fix for bug #2016965: KYRA: does not compile in MSVC71 ................ r33033 | peres001 | 2008-07-13 15:04:36 +0200 (Sun, 13 Jul 2008) | 1 line More refactoring of walk code. ................ r33052 | peres001 | 2008-07-14 02:13:31 +0200 (Mon, 14 Jul 2008) | 1 line Made sure characters are not removed from the rendering list during switches. ................ r33053 | peres001 | 2008-07-14 02:21:05 +0200 (Mon, 14 Jul 2008) | 1 line Fixed regression in walk code. Now standing frames are correctly selected when the character encounters an unexpected blocking object in his/her path. ................ r33056 | fingolfin | 2008-07-14 09:54:18 +0200 (Mon, 14 Jul 2008) | 1 line Fixed code formatting ................ r33057 | dreammaster | 2008-07-14 12:33:57 +0200 (Mon, 14 Jul 2008) | 1 line Fix for missing data in the savegame format that could result in not being able to talk to Goewin in the apothecary after restoring a savegame ................ r33058 | peres001 | 2008-07-14 15:35:43 +0200 (Mon, 14 Jul 2008) | 1 line Removed all labels from the rendering list to avoid random crashes after introduction is over. ................ r33061 | fingolfin | 2008-07-14 21:14:26 +0200 (Mon, 14 Jul 2008) | 1 line cleanup (and test for Marwan's branch.... ;) ................ r33062 | tramboi | 2008-07-14 22:34:31 +0200 (Mon, 14 Jul 2008) | 1 line Register spilling avoided in AGOS background drawing (and 2x unrolling) ................ r33063 | wjpalenstijn | 2008-07-14 23:00:39 +0200 (Mon, 14 Jul 2008) | 1 line Don't draw scumm saveload dialog while reflowing layout, as that would use uninitialized values ................ r33064 | wjpalenstijn | 2008-07-14 23:04:42 +0200 (Mon, 14 Jul 2008) | 1 line remove accidentally committed debugging code; fix shadowing warning ................ r33068 | buddha_ | 2008-07-15 01:10:51 +0200 (Tue, 15 Jul 2008) | 8 lines Fix for bug #2016647 (FW: crash with italian amiga version). - Consists of a workaround for a script bug that used local variable 251 when it should've used global variable 251. - Also added a fix for a crash when failing copy protection in Amiga or Atari ST versions of Future Wars. NOTE: That any of the Amiga or Atari ST versions of Future Wars haven't crashed right in the beginning before seems like plain luck because accessing local variable 251 is out of bounds! ................ r33070 | fingolfin | 2008-07-15 12:47:24 +0200 (Tue, 15 Jul 2008) | 1 line config.log and tmp files should be put into the configure (= current) dir, not the source dir ................ r33072 | peres001 | 2008-07-15 12:59:58 +0200 (Tue, 15 Jul 2008) | 1 line Made frame unpacking buffer dynamic (this frees some BSS space). ................ r33075 | fingolfin | 2008-07-15 19:13:06 +0200 (Tue, 15 Jul 2008) | 1 line Implemented audio double buffering (for now OSX only) ................ r33078 | cyx | 2008-07-15 22:26:12 +0200 (Tue, 15 Jul 2008) | 1 line fix bug #1995042: stop previous sfx playback when starting a new sfx (matches original dos code). Also removed the "sound skipping" hack in final bam scene. ................ r33079 | cyx | 2008-07-15 22:31:11 +0200 (Tue, 15 Jul 2008) | 2 lines fix bug #1876741: changed .SB playback rate to 11840Hz (matches dos game) ................ r33083 | tramboi | 2008-07-16 11:08:44 +0200 (Wed, 16 Jul 2008) | 3 lines Split the drawVertImage function in the agos engine to make it clearer and easier to profile ................ r33086 | peres001 | 2008-07-17 02:38:11 +0200 (Thu, 17 Jul 2008) | 1 line Fixed regression bug in dialogue, which de-facto allowed user to skip in-game protection. ................ r33087 | buddha_ | 2008-07-17 09:13:41 +0200 (Thu, 17 Jul 2008) | 1 line Patch #2019455: Patch for reducing the BSS size of Cine engine. ................ r33089 | fingolfin | 2008-07-17 17:56:24 +0200 (Thu, 17 Jul 2008) | 1 line Committing PS2 changes on behalf of the other Max ;) ................ r33094 | eriktorbjorn | 2008-07-18 06:16:00 +0200 (Fri, 18 Jul 2008) | 4 lines Don't crash if you try to use music file #2 as music file #1. When the music wasn't found, it would close the file even if something else was already playing from it. (Some music is in both files.) ................ r33095 | dreammaster | 2008-07-18 11:36:49 +0200 (Fri, 18 Jul 2008) | 2 lines In OSystem_SDL::closeMixer moved the call to SDL_CloseAudio to before the deletion of the _mixer variable in to fix an assert that was being generated in OSystem_SDL::mixCallback ................ r33096 | buddha_ | 2008-07-18 16:01:53 +0200 (Fri, 18 Jul 2008) | 1 line Added savefile position comments to savegame loading routine (Helpful for debugging the formats). ................ r33098 | anotherguest | 2008-07-18 21:02:40 +0200 (Fri, 18 Jul 2008) | 1 line Symbian soundsmixer update. (Compile fix) ................ r33099 | anotherguest | 2008-07-18 22:40:48 +0200 (Fri, 18 Jul 2008) | 1 line Introduced cache for filereading to fix slowness in AGOS among others. ................ r33104 | anotherguest | 2008-07-19 00:07:52 +0200 (Sat, 19 Jul 2008) | 1 line Fixed typo in filehandling ................ r33108 | anotherguest | 2008-07-19 09:08:37 +0200 (Sat, 19 Jul 2008) | 1 line eof was not working properly with caching ................ r33109 | anotherguest | 2008-07-19 09:44:12 +0200 (Sat, 19 Jul 2008) | 1 line Enable support to turn off ALL variations. all variation is most often the one used ................ r33114 | fingolfin | 2008-07-19 23:42:31 +0200 (Sat, 19 Jul 2008) | 1 line Removed -Wundef from the default list of compiler flags, and changed PLUGIN_ENABLED_DYNAMIC to not use 'defined()', thus avoiding compiler problems on e.g. BeOS ................ r33115 | sunmax | 2008-07-20 03:30:47 +0200 (Sun, 20 Jul 2008) | 9 lines 1. Re-added "rpckbd" as in 0.11.0 2. Committed only its source, you will need to do a make inside its folder before being able to compile our beloved PlayStation2 backend. Enjoy, -max ................ r33116 | sunmax | 2008-07-20 03:40:08 +0200 (Sun, 20 Jul 2008) | 4 lines Added the empty "elf" folder for the PS2 scummvm binary, so that developers won't have to mkdir it by hand. ................ r33117 | sunmax | 2008-07-20 03:44:40 +0200 (Sun, 20 Jul 2008) | 5 lines Added "DEPDIR := .deps" in Makefile.ps2 Thanks Max [the other one] for pointing it out! ................ r33120 | knakos | 2008-07-20 13:15:29 +0200 (Sun, 20 Jul 2008) | 1 line workaround for bogus findfirstfile. kyra now starts up correctly ................ r33135 | fingolfin | 2008-07-20 18:27:12 +0200 (Sun, 20 Jul 2008) | 1 line cleanup ................ r33136 | fingolfin | 2008-07-20 18:28:06 +0200 (Sun, 20 Jul 2008) | 1 line Fixed nasty bug in findPlainGameDescriptor -- contrary to is documentation, it would not return 0 upon failure to find a match, but rather a (0,0) record. ................ r33137 | fingolfin | 2008-07-20 18:42:56 +0200 (Sun, 20 Jul 2008) | 1 line Fixed potential issue in Common::String when asserting a substring of a string X back to X (memcpy -> memmove); also added some other sanity checks, and merged some duplicate code into a new method String::initWithCStr ................ r33138 | fingolfin | 2008-07-20 18:47:34 +0200 (Sun, 20 Jul 2008) | 1 line Two new TODO/FIXME comments for class File ................ r33139 | fingolfin | 2008-07-20 18:47:52 +0200 (Sun, 20 Jul 2008) | 1 line New SeekableReadStream::readLine_NEW() method, closely modelled after fgets, w/o the line length limitations of the old eekableReadStream::readLine() (which it will replace, after the feature freeze has been lifted) ................ r33140 | fingolfin | 2008-07-20 18:52:25 +0200 (Sun, 20 Jul 2008) | 1 line Fix for bug #1971499: ALL: config manager crashes when reading too long lines ................ r33141 | knakos | 2008-07-20 18:55:51 +0200 (Sun, 20 Jul 2008) | 1 line modified patch #1882942 - optimize and kill code for really old platforms ................ r33142 | knakos | 2008-07-20 19:04:27 +0200 (Sun, 20 Jul 2008) | 1 line a little more cleanup ................ r33143 | marcus_c | 2008-07-20 19:56:43 +0200 (Sun, 20 Jul 2008) | 1 line Solaris tr does not like character classes in some locales. Use "C" locale. ................ r33144 | marcus_c | 2008-07-20 19:58:14 +0200 (Sun, 20 Jul 2008) | 1 line Deps now go in the .deps directory. ................ r33145 | athrxx | 2008-07-20 20:00:00 +0200 (Sun, 20 Jul 2008) | 1 line KYRA: disable incomplete PC-98 audio support for 0.12.0 release (use towns audio instead) ................ r33146 | eriktorbjorn | 2008-07-20 21:25:16 +0200 (Sun, 20 Jul 2008) | 2 lines Commented out some more PC-98 audio stuff, to avoid warnings. ................ r33160 | sev | 2008-07-21 07:09:29 +0200 (Mon, 21 Jul 2008) | 2 lines This is 0.13.0svn now ................ r33162 | peres001 | 2008-07-21 08:08:30 +0200 (Mon, 21 Jul 2008) | 1 line Massive refactoring of dialogue code, which is now implemented as a finite state machine. Related code in other files has been updated has well. ................ r33165 | peres001 | 2008-07-21 11:25:40 +0200 (Mon, 21 Jul 2008) | 1 line Some refactoring for tracking of floating labels. ................ r33167 | tramboi | 2008-07-21 12:13:44 +0200 (Mon, 21 Jul 2008) | 1 line Avoid branching in the inner loop of AGOS drawVertImageCompressed ................ r33168 | Kirben | 2008-07-21 12:32:20 +0200 (Mon, 21 Jul 2008) | 1 line Spacing. ................ r33169 | buddha_ | 2008-07-21 13:33:30 +0200 (Mon, 21 Jul 2008) | 1 line Silence a warning which complains about using an uninitialized variable. ................ r33188 | peres001 | 2008-07-22 11:00:39 +0200 (Tue, 22 Jul 2008) | 1 line Changed comment display code so that input polling is integrated into the main loop, instead of being performed in a blocking way from a separate routine. ................ r33189 | peres001 | 2008-07-22 11:12:10 +0200 (Tue, 22 Jul 2008) | 1 line Removed unneeded input code. ................ r33191 | peres001 | 2008-07-22 12:12:20 +0200 (Tue, 22 Jul 2008) | 1 line Fixed regression in dialogue code: certain commands weren't executed anymore after dialogue ended. ................ r33192 | buddha_ | 2008-07-22 12:15:58 +0200 (Tue, 22 Jul 2008) | 14 lines Fix for bug #2019355 (FW: broken compatibility with 0.11.1 saves): - Changed savegame loading related functions to use SeekableReadStream rather than InSaveFile so MemoryReadStream can be used transparently. - Fixed loadResourcesFromSave to load multiframe animations correctly and to load 0.11.0/0.11.1 Future Wars savegames which used a slightly different format. - Added a savegame format detector that tries to detect between the old Future Wars savegame format, the new one and a broken revision of the new one. - Changed makeLoad to first load the savegame fully into memory and only then handle it (If the savegame's packed then it's unpacked first). If the packed savegame can't tell its unpacked size (i.e. it's using zlib format) then we'll try to load up to 256kB of the savegame data. Thanks to wjp for his help with nailing this release critical bug. ................ r33193 | peres001 | 2008-07-22 12:17:19 +0200 (Tue, 22 Jul 2008) | 1 line Fix build. ................ r33196 | buddha_ | 2008-07-22 14:17:44 +0200 (Tue, 22 Jul 2008) | 1 line Fix CineSaveGameFormat enumeration's include order (Caused problems at least with GCC). ................ r33198 | peres001 | 2008-07-22 14:35:46 +0200 (Tue, 22 Jul 2008) | 1 line Merged inventory input code from different files. ................ r33202 | fingolfin | 2008-07-22 16:38:54 +0200 (Tue, 22 Jul 2008) | 1 line Fix warnings in CINE ................ r33203 | fingolfin | 2008-07-22 16:39:26 +0200 (Tue, 22 Jul 2008) | 1 line Added String::trim() method ................ r33206 | aquadran | 2008-07-22 17:24:39 +0200 (Tue, 22 Jul 2008) | 1 line shutup valgrind warning ................ r33210 | anotherguest | 2008-07-22 20:52:13 +0200 (Tue, 22 Jul 2008) | 1 line Fixed seek problem when cached data is used. ................ r33212 | anotherguest | 2008-07-22 21:09:10 +0200 (Tue, 22 Jul 2008) | 1 line Disable hashmemory pool for Symbian OS ................ r33218 | anotherguest | 2008-07-22 22:13:57 +0200 (Tue, 22 Jul 2008) | 2 lines AddedAdded MAD as default feature ................ r33219 | peres001 | 2008-07-23 03:07:39 +0200 (Wed, 23 Jul 2008) | 1 line More merging of input code. ................ r33220 | peres001 | 2008-07-23 04:01:15 +0200 (Wed, 23 Jul 2008) | 1 line Fixed mouse cursor when closing inventory. ................ r33222 | drmccoy | 2008-07-23 04:41:02 +0200 (Wed, 23 Jul 2008) | 2 lines More savegame-endianness fixes :/ ................ r33224 | peres001 | 2008-07-23 04:45:09 +0200 (Wed, 23 Jul 2008) | 1 line More decoupling of inventory code. ................ r33225 | peres001 | 2008-07-23 09:31:35 +0200 (Wed, 23 Jul 2008) | 1 line Removed useless event management code and made readInput() more general. ................ r33226 | peres001 | 2008-07-23 09:52:43 +0200 (Wed, 23 Jul 2008) | 1 line Removed the historical waitUntilLeftClick function and adapted code to use the more general readInput and waitForButtonEvent. ................ r33229 | Kirben | 2008-07-23 11:01:33 +0200 (Wed, 23 Jul 2008) | 1 line Update NEWS. ................ r33230 | fingolfin | 2008-07-23 11:02:47 +0200 (Wed, 23 Jul 2008) | 1 line Added Tinsel engine to main repos (no news item for it ON PURPOSE) ................ r33231 | dreammaster | 2008-07-23 11:28:23 +0200 (Wed, 23 Jul 2008) | 1 line Replaced the out of date file list in the MSVC8 project with the proper file list ................ r33232 | dreammaster | 2008-07-23 11:37:15 +0200 (Wed, 23 Jul 2008) | 1 line Added the Tinsel engine to the Scummvm MSVC8 Solution ................ r33233 | buddha_ | 2008-07-23 11:45:44 +0200 (Wed, 23 Jul 2008) | 1 line Updated rest of the MSVC project and solution files for Tinsel. ................ r33234 | fingolfin | 2008-07-23 11:53:29 +0200 (Wed, 23 Jul 2008) | 1 line Fix String::trim to work right for shared strings; augemented test cases to cover this ................ r33235 | fingolfin | 2008-07-23 12:27:24 +0200 (Wed, 23 Jul 2008) | 1 line Got rid of some typedefs ................ r33236 | fingolfin | 2008-07-23 12:29:37 +0200 (Wed, 23 Jul 2008) | 1 line Removed some dead code ................ r33237 | fingolfin | 2008-07-23 12:33:36 +0200 (Wed, 23 Jul 2008) | 1 line cleanup; removed const bNoScroll variable ................ r33238 | dreammaster | 2008-07-23 12:54:59 +0200 (Wed, 23 Jul 2008) | 1 line Added extra defines and include for Tinsel project ................ r33239 | buddha_ | 2008-07-23 14:15:02 +0200 (Wed, 23 Jul 2008) | 1 line Enable Tinsel also for MSVC 7 & 7.1 & 9 in addition to MSVC 8. ................ r33240 | buddha_ | 2008-07-23 16:19:31 +0200 (Wed, 23 Jul 2008) | 3 lines Renamed opcodes 0x49 and 0x68: - Opcode 0x49: setDefaultMenuColor2 -> setDefaultMenuBgColor - Opcode 0x68: setDefaultMenuColor -> setPlayerCommandPosY ................ r33241 | fingolfin | 2008-07-23 16:42:27 +0200 (Wed, 23 Jul 2008) | 1 line Moved POLYGON struct into polygon.cpp; got rid of some more typedefs ................ r33242 | fingolfin | 2008-07-23 16:43:41 +0200 (Wed, 23 Jul 2008) | 1 line Added svn:ignore attribute ................ r33243 | fingolfin | 2008-07-23 16:44:33 +0200 (Wed, 23 Jul 2008) | 1 line Added Tinsel to credits & NEWS ................ r33246 | fingolfin | 2008-07-23 18:33:53 +0200 (Wed, 23 Jul 2008) | 1 line Added convenience method String::makeUnique(); simplified String::operator=(char c); extended String unit tests ................ r33248 | fingolfin | 2008-07-23 18:49:45 +0200 (Wed, 23 Jul 2008) | 1 line Reorder stuff a little bit, moving private String methods together: cleanup ................ r33249 | fingolfin | 2008-07-23 18:55:52 +0200 (Wed, 23 Jul 2008) | 1 line TINSEL: Renamed CoroutineInstall back to ProcessCreate; got rid of yet another typedef; more cleanup ................ r33250 | fingolfin | 2008-07-23 19:01:42 +0200 (Wed, 23 Jul 2008) | 1 line cleanup ................ r33252 | sev | 2008-07-23 21:50:57 +0200 (Wed, 23 Jul 2008) | 2 lines Fix bug which was triggered by file named 'a' in current directory. ................ r33258 | peres001 | 2008-07-24 10:04:17 +0200 (Thu, 24 Jul 2008) | 1 line Can't test a SharedPtr for nullity! ................ r33259 | fingolfin | 2008-07-24 10:59:17 +0200 (Thu, 24 Jul 2008) | 1 line Moved scheduler / process managment code into a new class Scheduler ................ r33260 | peres001 | 2008-07-24 11:24:32 +0200 (Thu, 24 Jul 2008) | 3 lines * Moved end intro and end game sequences code to gui. * Rewrote all gui code to be run inside the main loop * Added code to avoid crashes when a scene with no standard background is drawn ................ r33261 | peres001 | 2008-07-24 11:42:44 +0200 (Thu, 24 Jul 2008) | 1 line Fixed leak in new gui code. ................ r33263 | fingolfin | 2008-07-24 12:31:37 +0200 (Thu, 24 Jul 2008) | 1 line cleanup ................ r33266 | eriktorbjorn | 2008-07-25 00:12:48 +0200 (Fri, 25 Jul 2008) | 2 lines Make sure _musicVolume and _sfxVolume are clipped to fit in a byte. ................ r33270 | peres001 | 2008-07-25 04:37:55 +0200 (Fri, 25 Jul 2008) | 3 lines * Merged old input management flags into a single mouse status variable. * Mouse is now displayed when it is needed, and hidden when it is not ;) ................ r33272 | peres001 | 2008-07-25 08:35:02 +0200 (Fri, 25 Jul 2008) | 1 line Converted BRA to work with the new menu approach. It is not yet well plugged-in as in NS, but it suffices for the moment. ................ r33273 | peres001 | 2008-07-25 10:27:44 +0200 (Fri, 25 Jul 2008) | 1 line Made character visible in BRA. ................ r33274 | fingolfin | 2008-07-25 11:05:04 +0200 (Fri, 25 Jul 2008) | 1 line TINSEL: Updating the palette should only require a call to OSystem::updateScreen and not a blit ................ r33275 | fingolfin | 2008-07-25 11:12:03 +0200 (Fri, 25 Jul 2008) | 1 line TINSEL: Get rid of Graphics::Surface class ................ r33276 | fingolfin | 2008-07-25 11:13:08 +0200 (Fri, 25 Jul 2008) | 1 line TINSEL: ActorTag & PolyTag abused a SCNHANDLE and some global enums to keep a trinary state -- fixed that by introducing a new enum HotSpotTag ................ r33277 | fingolfin | 2008-07-25 11:15:03 +0200 (Fri, 25 Jul 2008) | 1 line cleanup ................ r33278 | fingolfin | 2008-07-25 11:15:32 +0200 (Fri, 25 Jul 2008) | 1 line TINSEL: Got rid of NO_TAG (not used) ................ r33279 | fingolfin | 2008-07-25 11:16:33 +0200 (Fri, 25 Jul 2008) | 1 line Added Common::Rect::isEmpty() method ................ r33280 | fingolfin | 2008-07-25 11:17:47 +0200 (Fri, 25 Jul 2008) | 1 line More tinsel cleanup ................ r33281 | fingolfin | 2008-07-25 11:18:39 +0200 (Fri, 25 Jul 2008) | 1 line TINSEL: Fixed forgotten ClearScreen(0) call ................ r33282 | fingolfin | 2008-07-25 11:19:06 +0200 (Fri, 25 Jul 2008) | 1 line TINSEL: Got rid of PIMAGE, PINT_CONTEXT, PINV_OBJECT, PINV_DEF, PCONFBOX, PCONFINIT ................ r33283 | dreammaster | 2008-07-25 11:36:18 +0200 (Fri, 25 Jul 2008) | 1 line Fix to prevent attempt to delete a non-initialised object during game exit ................ r33285 | joostp | 2008-07-25 12:20:05 +0200 (Fri, 25 Jul 2008) | 2 lines change PPINIT struct to use ScummVM datatypes, so sizeof(PPINIT) is 28 on ppc/OSX as well. ................ r33287 | buddha_ | 2008-07-25 13:39:58 +0200 (Fri, 25 Jul 2008) | 1 line Update MSVC project files for Parallaction. ................ r33288 | drmccoy | 2008-07-25 14:59:46 +0200 (Fri, 25 Jul 2008) | 2 lines Fixed the inventory bug that's been reported in the forums ................ r33289 | peres001 | 2008-07-25 18:01:25 +0200 (Fri, 25 Jul 2008) | 2 lines * Changed walk code to use Common::Point instead of the clumsy WalkNode. * Changed walk code to use object copy instead of managing pointers. ................ r33290 | peres001 | 2008-07-25 18:08:10 +0200 (Fri, 25 Jul 2008) | 1 line Changed the remaining references to Nodes into Points. ................ r33295 | peres001 | 2008-07-26 04:09:50 +0200 (Sat, 26 Jul 2008) | 1 line BRA now parses path data from the scripts. ................ r33296 | peres001 | 2008-07-26 06:01:11 +0200 (Sat, 26 Jul 2008) | 2 lines * Added walk calculations to BRA (doesn't walk yet, though). * Adapted Character and Animation to handle both versions of the engine. ................ r33297 | peres001 | 2008-07-26 07:37:52 +0200 (Sat, 26 Jul 2008) | 1 line Cleanup. ................ r33298 | peres001 | 2008-07-26 07:56:39 +0200 (Sat, 26 Jul 2008) | 1 line More cleanup. ................ r33321 | Kirben | 2008-07-27 03:54:40 +0200 (Sun, 27 Jul 2008) | 1 line Fix buffer overflow in error message. ................ r33325 | peres001 | 2008-07-27 10:35:00 +0200 (Sun, 27 Jul 2008) | 1 line Doug from BRA can now walk in his hotel room. He still stops in bizarre poses, though. ................ r33326 | vinterstum | 2008-07-27 12:15:57 +0200 (Sun, 27 Jul 2008) | 1 line The iPhone backend is now (mostly) up to speed again, and works for firmware 2.0 ................ r33327 | Kirben | 2008-07-27 12:36:26 +0200 (Sun, 27 Jul 2008) | 1 line Search common directory, when loading frames and talks in Amiga verison of BRA. ................ r33328 | peres001 | 2008-07-27 12:37:54 +0200 (Sun, 27 Jul 2008) | 1 line Added rudimental support for location changes when walking through doors. The best part of this commit is that Doug now stops in a normal position. ................ r33329 | Kirben | 2008-07-27 12:43:15 +0200 (Sun, 27 Jul 2008) | 1 line Add music/sound loading in Amiga version of BRA. ................ r33330 | lordhoto | 2008-07-27 13:07:38 +0200 (Sun, 27 Jul 2008) | 1 line Fixed win32 plugin provider. ................ r33332 | lordhoto | 2008-07-27 14:05:40 +0200 (Sun, 27 Jul 2008) | 2 lines Fixed macro. ................ r33333 | lordhoto | 2008-07-27 14:09:10 +0200 (Sun, 27 Jul 2008) | 2 lines Fixed typo. ................ r33334 | lordhoto | 2008-07-27 14:12:40 +0200 (Sun, 27 Jul 2008) | 3 lines - Fixed fadePalette for HoF and Kyra3 - Fixed bug in wsaFrameAnimationStep ................ r33335 | peres001 | 2008-07-27 15:43:40 +0200 (Sun, 27 Jul 2008) | 1 line Inventory icons are now loaded correctly (not yet displayed). BRA doesn't crash anymore when pressing the right button. :) ................ r33337 | peres001 | 2008-07-27 16:21:16 +0200 (Sun, 27 Jul 2008) | 1 line Moved inventory cursor drawing code to InventoryRenderer. ................ r33338 | buddha_ | 2008-07-27 16:33:37 +0200 (Sun, 27 Jul 2008) | 1 line Cut savegame loading into smaller functional parts (resetEngine, loadPlainSave etc). ................ r33339 | buddha_ | 2008-07-27 16:36:53 +0200 (Sun, 27 Jul 2008) | 1 line Clear the confusing usage of NUM_MAX_VAR (It's 255 actually, not 256). ................ r33340 | anotherguest | 2008-07-27 20:22:23 +0200 (Sun, 27 Jul 2008) | 1 line Fix for ftell error when caching. HOF now starts properly ................ r33342 | sev | 2008-07-27 23:14:31 +0200 (Sun, 27 Jul 2008) | 2 lines Patch from bugreport #2020561: "MMNES : Incorrect detection (US/GB)" ................ r33345 | anotherguest | 2008-07-27 23:35:39 +0200 (Sun, 27 Jul 2008) | 1 line Fixed the Symbian default savepath, but adding the needed \ at the end. ................ r33347 | anotherguest | 2008-07-27 23:37:47 +0200 (Sun, 27 Jul 2008) | 1 line Fixed the Symbian default savepath, but adding the needed \ at the end and now as a string. ................ r33349 | buddha_ | 2008-07-28 00:50:36 +0200 (Mon, 28 Jul 2008) | 3 lines Added a preliminary saving routine for Operation Stealth (Disabled by default, needs more work still. WIP!). Added backgrounds' name saving (8 names in Operation Stealth instead of just 1 like in Future Wars). Added 256 color palette saving and restoring (One of the palettes isn't properly handled yet though). ................ r33350 | peres001 | 2008-07-28 04:56:17 +0200 (Mon, 28 Jul 2008) | 1 line Fixed constructor for WindowsFilesystemNode. On Windows, trailing slashes can be added only to directory names. ................ r33352 | peres001 | 2008-07-28 07:18:23 +0200 (Mon, 28 Jul 2008) | 3 lines * Changed Disk code in BRA to use FilesystemNode (duplication has become truly visible!). * Fixed Inventory items loading. ................ r33353 | peres001 | 2008-07-28 07:21:11 +0200 (Mon, 28 Jul 2008) | 1 line Some unneeded references slipped in with the last commit. ................ r33354 | Kirben | 2008-07-28 07:38:24 +0200 (Mon, 28 Jul 2008) | 1 line Fix compile. ................ r33355 | peres001 | 2008-07-28 08:06:35 +0200 (Mon, 28 Jul 2008) | 1 line Inventory is now properly rendered. Item selection is not yet working. ................ r33356 | Kirben | 2008-07-28 08:18:39 +0200 (Mon, 28 Jul 2008) | 1 line There is no mask or path directories for part0 of BRA (Amiga), so always check whether they exist. ................ r33357 | Kirben | 2008-07-28 09:20:55 +0200 (Mon, 28 Jul 2008) | 1 line Add basic support for running Amiga and PC demos of BRA. ................ r33359 | peres001 | 2008-07-28 10:25:06 +0200 (Mon, 28 Jul 2008) | 1 line Some instrumentation for script debugging. ................ r33360 | peres001 | 2008-07-28 10:25:52 +0200 (Mon, 28 Jul 2008) | 1 line Added support for text in BRA DOS demo. ................ r33361 | Kirben | 2008-07-28 10:44:14 +0200 (Mon, 28 Jul 2008) | 1 line Correct character name set by character location parser. ................ r33362 | buddha_ | 2008-07-28 10:44:49 +0200 (Mon, 28 Jul 2008) | 3 lines Made the savegame loading routine choose between loading a Future Wars or an Operation Stealth savegame format. Added a stub for loading the Operation Stealth's temporary savegame format (Not yet implemented). Made mouse cursor change to a disk icon when loading a savegame and back to normal after its done. ................ r33363 | peres001 | 2008-07-28 10:56:37 +0200 (Mon, 28 Jul 2008) | 1 line Added a post processing step to runScripts, so that Animation can be validated after buggy scripts have been executed. ................ r33364 | peres001 | 2008-07-28 11:00:00 +0200 (Mon, 28 Jul 2008) | 1 line Preliminary code for traps. ................ r33365 | buddha_ | 2008-07-28 12:09:00 +0200 (Mon, 28 Jul 2008) | 1 line Now detects temporary Operation Stealth savegame format and saves it. No loading yet. ................ r33366 | buddha_ | 2008-07-28 12:44:54 +0200 (Mon, 28 Jul 2008) | 1 line Cut Future Wars savegame loading routine into parts that can be reused when loading the Operation Stealth savegame format. ................ r33367 | buddha_ | 2008-07-28 12:54:53 +0200 (Mon, 28 Jul 2008) | 1 line Added remaining load functions needed for the Operation Stealth savegame format loading (loadSeqList and loadZoneQuery). Not used yet. ................ r33369 | peres001 | 2008-07-28 13:47:03 +0200 (Mon, 28 Jul 2008) | 1 line Tiny readability aid for parser code. ................ r33370 | peres001 | 2008-07-28 13:48:04 +0200 (Mon, 28 Jul 2008) | 1 line Implemented opcodes for picking up/dropping/opening/closing items. ................ r33371 | peres001 | 2008-07-28 13:50:36 +0200 (Mon, 28 Jul 2008) | 1 line Pick up/drop/open/close actions are now available in game. ................ r33373 | thebluegr | 2008-07-28 14:46:30 +0200 (Mon, 28 Jul 2008) | 1 line Cleanup ................ r33375 | peres001 | 2008-07-28 16:02:46 +0200 (Mon, 28 Jul 2008) | 1 line Fixed loading of static items. ................ r33376 | peres001 | 2008-07-28 16:22:44 +0200 (Mon, 28 Jul 2008) | 1 line Moved validation step from revision 33363, so that it is executed for all animations. ................ r33377 | peres001 | 2008-07-28 16:23:49 +0200 (Mon, 28 Jul 2008) | 1 line Yet another hack to deal with labels... Must rethink this crap from scratch. ................ r33379 | buddha_ | 2008-07-28 18:02:40 +0200 (Mon, 28 Jul 2008) | 6 lines Added loading of temporary Operation Stealth savegames. Needs testing! - Music related settings and adBgVar0 & adBgVar1 aren't loaded currently. Modified resetEngine to also reset more of the Operation Stealth specific variables. Added getter for background scrolling value. Changed additional background indices 1 & 2 from byte to uint16. Made savegame loading functions return !in.ioFailed() as return value instead of true as previously. ................ r33380 | buddha_ | 2008-07-28 18:46:20 +0200 (Mon, 28 Jul 2008) | 1 line Fixed crash when running Operation Stealth introduced in r33339 (There are actually 256 global variables although only 255 of them are saved and loaded from savegames. The last one is VAR_BYPASS_PROTECTION and it is written to in the mainLoop so that's why there was a crash). ................ r33383 | fingolfin | 2008-07-29 00:21:11 +0200 (Tue, 29 Jul 2008) | 1 line Fixing 'warning: comparison of unsigned expression < 0 is always false' ................ r33384 | peres001 | 2008-07-29 01:21:03 +0200 (Tue, 29 Jul 2008) | 1 line Enforcing use of nullZonePtr only for nulling out pointers, as it is useless for comparisons. ................ r33385 | fingolfin | 2008-07-29 02:02:06 +0200 (Tue, 29 Jul 2008) | 1 line SDL: Properly init vars related to mixer double buffering ................ r33387 | fingolfin | 2008-07-29 02:49:44 +0200 (Tue, 29 Jul 2008) | 1 line Changed output of --test-detector: multiple hits with same gameid now only are a warning, not a failure ................ r33388 | fingolfin | 2008-07-29 02:50:12 +0200 (Tue, 29 Jul 2008) | 1 line Changed advanced detector to *always* use the FSNode API for detection (i.e. killed second code path which used File::open trial&error directory 'scanning') ................ r33389 | fingolfin | 2008-07-29 02:54:28 +0200 (Tue, 29 Jul 2008) | 1 line BASE: in runGame, do not set addDefaultDirectory() the game path before invoking createInstance() -- detectors must use FSNode for detection, not rely on File::open ................ r33392 | peres001 | 2008-07-29 05:14:35 +0200 (Tue, 29 Jul 2008) | 2 lines * Fixed positioning of balloons and faces in BRA (dos, at least). * Adapted loading of faces. ................ r33393 | Kirben | 2008-07-29 06:00:07 +0200 (Tue, 29 Jul 2008) | 1 line Add check common directories, in loadScenery() for Amiga version of BRA. ................ r33394 | Kirben | 2008-07-29 06:06:10 +0200 (Tue, 29 Jul 2008) | 1 line Mask files don't always exist in Amiga version of BRA, in paricular NULL.msk. ................ r33400 | lordhoto | 2008-07-29 11:16:53 +0200 (Tue, 29 Jul 2008) | 2 lines Added a reset method to SharedPtr, which allows NULLifying it. ................ r33401 | lordhoto | 2008-07-29 11:23:54 +0200 (Tue, 29 Jul 2008) | 2 lines Formatting. ................ r33402 | peres001 | 2008-07-29 11:44:05 +0200 (Tue, 29 Jul 2008) | 1 line Added dialogue text rendering for BRA. ................ r33404 | buddha_ | 2008-07-29 12:13:53 +0200 (Tue, 29 Jul 2008) | 6 lines Rearranged parts of the Operation Stealth savegame loading routine. - Emulating the Future Wars savegame loading routine and hoping for the best. - Fixes an array out of bounds access when loading the global scripts. Now the loading crashes in the mainloop in processSeqList! But at least we got a bit farther this time. More fixing to come... ................ r33405 | peres001 | 2008-07-29 12:22:50 +0200 (Tue, 29 Jul 2008) | 2 lines * Added flexible verb configuration for both NS and BRA. * Objects can now be really opened and closed in BRA. ................ r33407 | buddha_ | 2008-07-29 14:56:32 +0200 (Tue, 29 Jul 2008) | 1 line Added a debug message to loadTempSaveOS's to check whether we loaded the whole savefile. Made objectStruct's clearing also clear x and y member variables in resetEngine. ................ r33408 | peres001 | 2008-07-29 14:59:55 +0200 (Tue, 29 Jul 2008) | 2 lines * Implemented pause/resume of command execution * Implemented command opcode MOVE (not the script instruction). ................ r33409 | buddha_ | 2008-07-29 15:44:14 +0200 (Tue, 29 Jul 2008) | 7 lines Added purgeSeqList function (Used in mainloop now). Let's see if this helps any... Renamed functions: * addScriptToList0 -> addScriptToGlobalScripts * executeList0 -> executeGlobalScripts * executeList1 -> executeObjectScripts * purgeList1 -> purgeObjectScripts (Also added a clarifying TODO to this function) * purgeList0 -> purgeGlobalScripts (Also added a clarifying TODO to this function) ................ r33410 | buddha_ | 2008-07-29 15:46:42 +0200 (Tue, 29 Jul 2008) | 1 line Make sure processSeqList and purgeSeqList are only called in the main loop when running Operation Stealth. Mostly a precaution as the seqList should be totally empty when running Future Wars as it doesn't use it. ................ r33412 | fingolfin | 2008-07-29 18:09:10 +0200 (Tue, 29 Jul 2008) | 1 line Changed class File (and derived classes) to only support read-only access; added a new class DumpFile for writing ................ r33413 | fingolfin | 2008-07-29 18:12:42 +0200 (Tue, 29 Jul 2008) | 1 line CONFIGMAN: Store domains in the order they were added ................ r33414 | fingolfin | 2008-07-29 18:16:15 +0200 (Tue, 29 Jul 2008) | 1 line Added convenience accessor method GameDescriptor::preferredtarget ................ r33415 | fingolfin | 2008-07-29 18:29:28 +0200 (Tue, 29 Jul 2008) | 1 line Mass detector: sort all newly detected games by target name before adding them to the config manager ................ r33416 | lordhoto | 2008-07-29 19:00:15 +0200 (Tue, 29 Jul 2008) | 2 lines Added documentation for the functions in algorithm.h. ................ r33418 | fingolfin | 2008-07-29 19:38:07 +0200 (Tue, 29 Jul 2008) | 1 line Set svn:ignore for tools/create_drascula ................ r33419 | fingolfin | 2008-07-29 19:42:19 +0200 (Tue, 29 Jul 2008) | 1 line Added two new classes, BufferedReadStream & BufferedSeekableReadStream, as proposed on scummvm-devel ................ r33425 | lordhoto | 2008-07-29 22:09:30 +0200 (Tue, 29 Jul 2008) | 2 lines Documentation for func.h. ................ r33426 | lordhoto | 2008-07-29 22:15:29 +0200 (Tue, 29 Jul 2008) | 2 lines Little fix for documentation. ................ r33427 | lordhoto | 2008-07-29 22:21:54 +0200 (Tue, 29 Jul 2008) | 3 lines - Formatting - Improved Functor#Mem::isValid implementations. ................ r33432 | peres001 | 2008-07-30 08:25:17 +0200 (Wed, 30 Jul 2008) | 1 line Reordered initialization lists to silence warning. ................ r33436 | fingolfin | 2008-07-30 09:39:41 +0200 (Wed, 30 Jul 2008) | 1 line Changed BufferedReadStream to not permanently decrease its buffer size at the end of a stream (this would fail when using BufferedSeekableReadStream and then seeking back from the end); this also fixes a bug which let you seek back beyond the start of a stream (not that we currently support that in other streams) ................ r33437 | peres001 | 2008-07-30 09:58:25 +0200 (Wed, 30 Jul 2008) | 2 lines * Unified implementation of flow control opcodes in NS and BRA * Simplified script execution loop and context ................ r33438 | thebluegr | 2008-07-30 10:23:04 +0200 (Wed, 30 Jul 2008) | 1 line Make sure that save game descriptions are 0-terminated ................ r33444 | buddha_ | 2008-07-30 13:03:52 +0200 (Wed, 30 Jul 2008) | 1 line Added some debug aids related to addAni and the processSeqList crashing. ................ r33446 | buddha_ | 2008-07-30 13:36:14 +0200 (Wed, 30 Jul 2008) | 1 line Debug printing a couple more relevant variables in addAni. ................ r33452 | peres001 | 2008-07-30 17:01:15 +0200 (Wed, 30 Jul 2008) | 1 line Reordered initialization order to kill a ton of warnings. ................ r33453 | fingolfin | 2008-07-30 17:16:57 +0200 (Wed, 30 Jul 2008) | 1 line Advanced detector: split out part of detectGame into a new function detectGameFilebased; some cleanup ................ r33455 | fingolfin | 2008-07-30 17:38:42 +0200 (Wed, 30 Jul 2008) | 1 line Simplified advanced detector file sys scanning code ................ r33456 | fingolfin | 2008-07-30 17:44:34 +0200 (Wed, 30 Jul 2008) | 1 line Revert my accidental commit of the OSystem changes (oops) ................ r33457 | fingolfin | 2008-07-30 17:48:16 +0200 (Wed, 30 Jul 2008) | 1 line Simplify/optimize/cleanup detectGameFilebased further ................ r33458 | peres001 | 2008-07-30 18:06:46 +0200 (Wed, 30 Jul 2008) | 1 line Fixed Win32 build, after Fingolfin's commits (probably because of the revert in revision 33456). ................ r33459 | fingolfin | 2008-07-30 18:26:38 +0200 (Wed, 30 Jul 2008) | 1 line This time properly reverted my accidental commits of the osystem&configman patch (I didn't mean to commit it in the first place, still waiting for any replies to my corresponding scummvm-devel mail). Sorry for messing up so badly ................ r33463 | lordhoto | 2008-07-31 12:47:15 +0200 (Thu, 31 Jul 2008) | 2 lines Committed slightly modified patch #2029395 "KYRA: Lands of Lore Intro + Character selection". ................ r33464 | lordhoto | 2008-07-31 12:52:29 +0200 (Thu, 31 Jul 2008) | 2 lines Removed debugging leftover. ................ r33466 | buddha_ | 2008-07-31 13:16:48 +0200 (Thu, 31 Jul 2008) | 1 line Update MSVC project files for Kyra Lands of Lore additions. ................ r33467 | peres001 | 2008-07-31 13:29:37 +0200 (Thu, 31 Jul 2008) | 1 line Set correct font for dialogues in BRA Amiga. ................ r33468 | peres001 | 2008-07-31 14:26:12 +0200 (Thu, 31 Jul 2008) | 1 line Changed Gfx::_backgroundInfo to be a pointer. This temporarily kills all z-buffering. ................ r33469 | peres001 | 2008-07-31 14:50:43 +0200 (Thu, 31 Jul 2008) | 1 line Made changing of background more flexible, in that the engine can now configure its BackgroundInfo before passing it to Gfx. ................ r33470 | lordhoto | 2008-07-31 15:36:13 +0200 (Thu, 31 Jul 2008) | 3 lines - Added Common::mem_fun_ref for object references instead of pointers. - Added simple tests for a little bit functionallity from common/func.h ................ r33471 | eriktorbjorn | 2008-07-31 15:45:58 +0200 (Thu, 31 Jul 2008) | 4 lines Applied my patch #2030058 ("Workaround for incorrectly compressed FotAQ"), and made a mention in NEWS that speech is played correctly now. Of course, we should still provide a correctly compressed version at some point. ................ r33473 | peres001 | 2008-07-31 16:20:51 +0200 (Thu, 31 Jul 2008) | 1 line Disabled masks in BRA Amiga, because the decoding is not known yet. ................ r33474 | peres001 | 2008-07-31 17:15:42 +0200 (Thu, 31 Jul 2008) | 2 lines * Removed references to the current _backgroundInfo from parser code. * Re-enabled masks (in BRA DOS). ................ r33478 | anotherguest | 2008-07-31 19:33:48 +0200 (Thu, 31 Jul 2008) | 1 line Enabled the correct features for standard builds ................ svn-id: r33486
Diffstat (limited to 'common')
-rw-r--r--common/advancedDetector.cpp272
-rw-r--r--common/advancedDetector.h5
-rw-r--r--common/algorithm.h54
-rw-r--r--common/config-file.cpp6
-rw-r--r--common/config-manager.cpp80
-rw-r--r--common/file.cpp172
-rw-r--r--common/file.h65
-rw-r--r--common/func.h248
-rw-r--r--common/hashmap.h6
-rw-r--r--common/ptr.h22
-rw-r--r--common/rect.h4
-rw-r--r--common/scummsys.h1
-rw-r--r--common/str.cpp210
-rw-r--r--common/str.h20
-rw-r--r--common/stream.cpp134
-rw-r--r--common/stream.h81
-rw-r--r--common/system.cpp25
-rw-r--r--common/system.h11
-rw-r--r--common/unarj.cpp2
-rw-r--r--common/unarj.h2
-rw-r--r--common/xmlparser.h2
21 files changed, 981 insertions, 441 deletions
diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp
index 4387bd199e..8bd019018a 100644
--- a/common/advancedDetector.cpp
+++ b/common/advancedDetector.cpp
@@ -34,7 +34,11 @@
namespace Common {
-using namespace AdvancedDetector;
+/**
+ * A list of pointers to ADGameDescription structs (or subclasses thereof).
+ */
+typedef Array<const ADGameDescription*> ADGameDescList;
+
/**
* Detect games in specified directory.
@@ -48,7 +52,7 @@ using namespace AdvancedDetector;
* @param platform restrict results to specified platform only
* @return list of ADGameDescription (or subclass) pointers corresponding to matched games
*/
-static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &params, Language language, Platform platform, const Common::String extra);
+static ADGameDescList detectGame(const FSList &fslist, const Common::ADParams &params, Language language, Platform platform, const Common::String extra);
/**
@@ -194,7 +198,7 @@ static void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *
}
GameList AdvancedMetaEngine::detectGames(const FSList &fslist) const {
- ADGameDescList matches = detectGame(&fslist, params, Common::UNK_LANG, Common::kPlatformUnknown, "");
+ ADGameDescList matches = detectGame(fslist, params, Common::UNK_LANG, Common::kPlatformUnknown, "");
GameList detectedGames;
// Use fallback detector if there were no matches by other means
@@ -233,7 +237,21 @@ PluginError AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) c
Common::String gameid = ConfMan.get("gameid");
- ADGameDescList matches = detectGame(0, params, language, platform, extra);
+ Common::String path;
+ if (ConfMan.hasKey("path")) {
+ path = ConfMan.get("path");
+ } else {
+ path = ".";
+ warning("No path was provided. Assuming the data files are in the current directory");
+ }
+ FilesystemNode dir(path);
+ FSList files;
+ if (!dir.isDirectory() || !dir.getChildren(files, FilesystemNode::kListAll)) {
+ warning("Game data path does not exist or is not a directory (%s)", path.c_str());
+ return kNoGameDataFoundError;
+ }
+
+ ADGameDescList matches = detectGame(files, params, language, platform, extra);
if (params.singleid == NULL) {
for (uint i = 0; i < matches.size(); i++) {
@@ -268,10 +286,10 @@ PluginError AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) c
return kNoError;
}
-typedef HashMap<String, bool> StringSet;
-typedef HashMap<String, int32> IntMap;
+typedef HashMap<String, bool, IgnoreCase_Hash, IgnoreCase_EqualTo> StringSet;
+typedef HashMap<String, int32, IgnoreCase_Hash, IgnoreCase_EqualTo> IntMap;
-static void reportUnknown(StringMap &filesMD5, IntMap &filesSize) {
+static void reportUnknown(const StringMap &filesMD5, const IntMap &filesSize) {
// TODO: This message should be cleaned up / made more specific.
// For example, we should specify at least which engine triggered this.
//
@@ -287,96 +305,77 @@ static void reportUnknown(StringMap &filesMD5, IntMap &filesSize) {
printf("\n");
}
-static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &params, Language language, Platform platform, const Common::String extra) {
- StringSet filesList;
+static ADGameDescList detectGameFilebased(const StringMap &allFiles, const Common::ADParams &params);
+static ADGameDescList detectGame(const FSList &fslist, const Common::ADParams &params, Language language, Platform platform, const Common::String extra) {
+ StringMap allFiles;
+
+ StringSet detectFiles;
StringMap filesMD5;
IntMap filesSize;
- IntMap allFiles;
-
- File testFile;
- String tstr;
-
- uint i;
- char md5str[32+1];
-
- bool fileMissing;
const ADGameFileDescription *fileDesc;
const ADGameDescription *g;
const byte *descPtr;
debug(3, "Starting detection");
- // First we compose list of files which we need MD5s for
+ // First we compose an efficient to query set of all files in fslist.
+ // Includes nifty stuff like removing trailing dots and ignoring case.
+ for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
+ if (file->isDirectory())
+ continue;
+
+ String tstr = file->getName();
+
+ // Strip any trailing dot
+ if (tstr.lastChar() == '.')
+ tstr.deleteLastChar();
+
+ allFiles[tstr] = file->getPath(); // Record the presence of this file
+ }
+
+ // Compute the set of files for which we need MD5s for. I.e. files which are
+ // included in some ADGameDescription *and* present in fslist.
for (descPtr = params.descs; ((const ADGameDescription *)descPtr)->gameid != 0; descPtr += params.descItemSize) {
g = (const ADGameDescription *)descPtr;
for (fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) {
- tstr = String(fileDesc->fileName);
- tstr.toLowercase();
- filesList[tstr] = true;
+ String tstr = fileDesc->fileName;
+ if (allFiles.contains(tstr))
+ detectFiles[tstr] = true;
}
}
- // TODO/FIXME: Fingolfin says: It's not good that we have two different code paths here,
- // one using a FSList, one using File::open, as that will lead to discrepancies and subtle
- // problems caused by those.
- if (fslist != 0) {
- // Get the information of the existing files
- for (FSList::const_iterator file = fslist->begin(); file != fslist->end(); ++file) {
- if (file->isDirectory()) continue;
- tstr = file->getName();
- tstr.toLowercase();
-
- // Strip any trailing dot
- if (tstr.lastChar() == '.')
- tstr.deleteLastChar();
-
- allFiles[tstr] = true;
-
- debug(3, "+ %s", tstr.c_str());
-
- if (!filesList.contains(tstr)) continue;
+ // Get the information for all detection files, if they exist
+ for (StringSet::const_iterator file = detectFiles.begin(); file != detectFiles.end(); ++file) {
+ String fname = file->_key;
- if (!md5_file_string(*file, md5str, params.md5Bytes))
- continue;
- filesMD5[tstr] = md5str;
+ debug(3, "+ %s", fname.c_str());
- debug(3, "> %s: %s", tstr.c_str(), md5str);
+ char md5str[32+1];
+ if (!md5_file_string(allFiles[fname].c_str(), md5str, params.md5Bytes))
+ continue;
+ filesMD5[fname] = md5str;
- if (testFile.open(file->getPath())) {
- filesSize[tstr] = (int32)testFile.size();
- testFile.close();
- }
- }
- } else {
- // Get the information of the requested files
- for (StringSet::const_iterator file = filesList.begin(); file != filesList.end(); ++file) {
- tstr = file->_key;
+ debug(3, "> %s: %s", fname.c_str(), md5str);
- debug(3, "+ %s", tstr.c_str());
- if (!filesMD5.contains(tstr)) {
- if (testFile.open(tstr) || testFile.open(tstr + ".")) {
- filesSize[tstr] = (int32)testFile.size();
- testFile.close();
-
- if (md5_file_string(file->_key.c_str(), md5str, params.md5Bytes)) {
- filesMD5[tstr] = md5str;
- debug(3, "> %s: %s", tstr.c_str(), md5str);
- }
- }
- }
+ File testFile;
+ if (testFile.open(allFiles[fname])) {
+ filesSize[fname] = (int32)testFile.size();
+ testFile.close();
}
}
+
ADGameDescList matched;
int maxFilesMatched = 0;
// MD5 based matching
+ uint i;
for (i = 0, descPtr = params.descs; ((const ADGameDescription *)descPtr)->gameid != 0; descPtr += params.descItemSize, ++i) {
g = (const ADGameDescription *)descPtr;
- fileMissing = false;
+ bool fileMissing = false;
// Do not even bother to look at entries which do not have matching
// language and platform (if specified).
@@ -385,32 +384,28 @@ static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &p
continue;
}
- if ((params.flags & kADFlagUseExtraAsHint) && extra != "" && g->extra != extra)
+ if ((params.flags & kADFlagUseExtraAsHint) && !extra.empty() && g->extra != extra)
continue;
// Try to match all files for this game
for (fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) {
- tstr = fileDesc->fileName;
- tstr.toLowercase();
+ String tstr = fileDesc->fileName;
if (!filesMD5.contains(tstr)) {
fileMissing = true;
break;
}
- if (fileDesc->md5 != NULL) {
- if (fileDesc->md5 != filesMD5[tstr]) {
- debug(3, "MD5 Mismatch. Skipping (%s) (%s)", fileDesc->md5, filesMD5[tstr].c_str());
- fileMissing = true;
- break;
- }
+
+ if (fileDesc->md5 != NULL && fileDesc->md5 != filesMD5[tstr]) {
+ debug(3, "MD5 Mismatch. Skipping (%s) (%s)", fileDesc->md5, filesMD5[tstr].c_str());
+ fileMissing = true;
+ break;
}
- if (fileDesc->fileSize != -1) {
- if (fileDesc->fileSize != filesSize[tstr]) {
- debug(3, "Size Mismatch. Skipping");
- fileMissing = true;
- break;
- }
+ if (fileDesc->fileSize != -1 && fileDesc->fileSize != filesSize[tstr]) {
+ debug(3, "Size Mismatch. Skipping");
+ fileMissing = true;
+ break;
}
debug(3, "Matched file: %s", tstr.c_str());
@@ -448,85 +443,68 @@ static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &p
}
}
- // We've found a match
- if (!matched.empty())
- return matched;
-
- if (!filesMD5.empty())
- reportUnknown(filesMD5, filesSize);
-
- // Filename based fallback
- if (params.fileBasedFallback != 0) {
- const ADFileBasedFallback *ptr = params.fileBasedFallback;
- const char* const* filenames = 0;
-
- // First we create list of files required for detection.
- // The filenames can be different than the MD5 based match ones.
- for (; ptr->desc; ptr++) {
- filenames = ptr->filenames;
- for (; *filenames; filenames++) {
- tstr = String(*filenames);
- tstr.toLowercase();
-
- if (!allFiles.contains(tstr)) {
- if (testFile.open(tstr) || testFile.open(tstr + ".")) {
- allFiles[tstr] = true;
- testFile.close();
- }
- }
- }
- }
-
- // Then we perform the actual filename matching. If there are
- // several matches, only the one with the maximum numbers of
- // files is considered.
- int maxNumMatchedFiles = 0;
- const ADGameDescription *matchedDesc = 0;
-
- ptr = params.fileBasedFallback;
+ // We didn't find a match
+ if (matched.empty()) {
+ if (!filesMD5.empty())
+ reportUnknown(filesMD5, filesSize);
+
+ // Filename based fallback
+ if (params.fileBasedFallback != 0)
+ matched = detectGameFilebased(allFiles, params);
+ }
- for (; ptr->desc; ptr++) {
- const ADGameDescription *agdesc = (const ADGameDescription *)ptr->desc;
- int numMatchedFiles = 0;
- fileMissing = false;
+ return matched;
+}
- filenames = ptr->filenames;
- for (; *filenames; filenames++) {
- if (fileMissing) {
- continue;
- }
+/**
+ * Check for each ADFileBasedFallback record whether all files listed
+ * in it are present. If multiple pass this test, we pick the one with
+ * the maximal number of matching files. In case of a tie, the entry
+ * coming first in the list is chosen.
+ */
+static ADGameDescList detectGameFilebased(const StringMap &allFiles, const Common::ADParams &params) {
+ const ADFileBasedFallback *ptr;
+ const char* const* filenames;
- tstr = String(*filenames);
- tstr.toLowercase();
+ int maxNumMatchedFiles = 0;
+ const ADGameDescription *matchedDesc = 0;
- debug(3, "++ %s", *filenames);
- if (!allFiles.contains(tstr)) {
- fileMissing = true;
- continue;
- }
+ for (ptr = params.fileBasedFallback; ptr->desc; ++ptr) {
+ const ADGameDescription *agdesc = (const ADGameDescription *)ptr->desc;
+ int numMatchedFiles = 0;
+ bool fileMissing = false;
- numMatchedFiles++;
+ for (filenames = ptr->filenames; *filenames; ++filenames) {
+ debug(3, "++ %s", *filenames);
+ if (!allFiles.contains(*filenames)) {
+ fileMissing = true;
+ break;
}
- if (!fileMissing)
- debug(4, "Matched: %s", agdesc->gameid);
+ numMatchedFiles++;
+ }
- if (!fileMissing && numMatchedFiles > maxNumMatchedFiles) {
+ if (!fileMissing) {
+ debug(4, "Matched: %s", agdesc->gameid);
+
+ if (numMatchedFiles > maxNumMatchedFiles) {
matchedDesc = agdesc;
maxNumMatchedFiles = numMatchedFiles;
-
+
debug(4, "and overriden");
}
}
+ }
- if (matchedDesc) { // We got a match
- matched.push_back(matchedDesc);
- if (params.flags & kADFlagPrintWarningOnFileBasedFallback) {
- printf("Your game version has been detected using filename matching as a\n");
- printf("variant of %s.\n", matchedDesc->gameid);
- printf("If this is an original and unmodified version, please report any\n");
- printf("information previously printed by ScummVM to the team.\n");
- }
+ ADGameDescList matched;
+
+ if (matchedDesc) { // We got a match
+ matched.push_back(matchedDesc);
+ if (params.flags & kADFlagPrintWarningOnFileBasedFallback) {
+ printf("Your game version has been detected using filename matching as a\n");
+ printf("variant of %s.\n", matchedDesc->gameid);
+ printf("If this is an original and unmodified version, please report any\n");
+ printf("information previously printed by ScummVM to the team.\n");
}
}
diff --git a/common/advancedDetector.h b/common/advancedDetector.h
index 48b9e213d7..40f5823d1b 100644
--- a/common/advancedDetector.h
+++ b/common/advancedDetector.h
@@ -69,11 +69,6 @@ struct ADGameDescription {
};
/**
- * A list of pointers to ADGameDescription structs (or subclasses thereof).
- */
-typedef Array<const ADGameDescription*> ADGameDescList;
-
-/**
* End marker for a table of ADGameDescription structs. Use this to
* terminate a list to be passed to the AdvancedDetector API.
*/
diff --git a/common/algorithm.h b/common/algorithm.h
index beae34245f..3b6c63d55c 100644
--- a/common/algorithm.h
+++ b/common/algorithm.h
@@ -29,6 +29,11 @@
namespace Common {
+/**
+ * Copies data from the range [first, last) to [dst, dst + (last - first)).
+ * It requires the range [dst, dst + (last - first)) to be valid.
+ * It also requires dst not to be in the range [first, last).
+ */
template<class In, class Out>
Out copy(In first, In last, Out dst) {
while (first != last)
@@ -36,6 +41,13 @@ Out copy(In first, In last, Out dst) {
return dst;
}
+/**
+ * Copies data from the range [first, last) to [dst - (last - first), dst).
+ * It requires the range [dst - (last - first), dst) to be valid.
+ * It also requires dst not to be in the range [first, last).
+ *
+ * Unlike copy copy_backward copies the data from the end to the beginning.
+ */
template<class In, class Out>
Out copy_backward(In first, In last, Out dst) {
while (first != last)
@@ -43,6 +55,15 @@ Out copy_backward(In first, In last, Out dst) {
return dst;
}
+/**
+ * Copies data from the range [first, last) to [dst, dst + (last - first)).
+ * It requires the range [dst, dst + (last - first)) to be valid.
+ * It also requires dst not to be in the range [first, last).
+ *
+ * Unlike copy or copy_backward it does not copy all data. It only copies
+ * a data element when operator() of the op parameter returns true for the
+ * passed data element.
+ */
template<class In, class Out, class Op>
Out copy_if(In first, In last, Out dst, Op op) {
while (first != last) {
@@ -76,6 +97,9 @@ char *set_to(char *first, char *last, Value val) {
return last;
}
+/**
+ * Sets all elements in the range [first, last) to val.
+ */
template<class In, class Value>
In set_to(In first, In last, Value val) {
while (first != last)
@@ -83,6 +107,10 @@ In set_to(In first, In last, Value val) {
return first;
}
+/**
+ * Finds the first data value in the range [first, last) matching v.
+ * For data comperance it uses operator == of the data elements.
+ */
template<class In, class T>
In find(In first, In last, const T &v) {
while (first != last) {
@@ -93,6 +121,10 @@ In find(In first, In last, const T &v) {
return last;
}
+/**
+ * Finds the first data value in the range [first, last) for which
+ * the specified predicate p returns true.
+ */
template<class In, class Pred>
In find_if(In first, In last, Pred p) {
while (first != last) {
@@ -103,15 +135,22 @@ In find_if(In first, In last, Pred p) {
return last;
}
+/**
+ * Applies the function f on all elements of the range [first, last).
+ * The processing order is from beginning to end.
+ */
template<class In, class Op>
Op for_each(In first, In last, Op f) {
while (first != last) f(*first++);
return f;
}
-// Simple sort function, modeled after std::sort.
-// Use it like this: sort(container.begin(), container.end()).
-// Also work on plain old int arrays etc.
+/**
+ * Simple sort function, modeled after std::sort.
+ * Use it like this: sort(container.begin(), container.end()).
+ * Also works on plain old i.e. int arrays etc. For comperance
+ * operator < is used.
+ */
template<class T>
void sort(T first, T last) {
if (first == last)
@@ -131,8 +170,13 @@ void sort(T first, T last) {
}
}
-// Using this with: Common::Less from common/func.h
-// will give the same results as the function above.
+/**
+ * Simple sort function, modeled after std::sort.
+ * It compares data with the given comparator object comp.
+ *
+ * Note: Using this with: Common::Less from common/func.h
+ * will give the same results as the plain sort function.
+ */
template<class T, class StrictWeakOrdering>
void sort(T first, T last, StrictWeakOrdering comp) {
if (first == last)
diff --git a/common/config-file.cpp b/common/config-file.cpp
index fe827e32dc..9f54c9ddde 100644
--- a/common/config-file.cpp
+++ b/common/config-file.cpp
@@ -58,7 +58,7 @@ void ConfigFile::clear() {
bool ConfigFile::loadFromFile(const String &filename) {
File file;
- if (file.open(filename, File::kFileReadMode))
+ if (file.open(filename))
return loadFromStream(file);
else
return false;
@@ -171,8 +171,8 @@ bool ConfigFile::loadFromStream(SeekableReadStream &stream) {
}
bool ConfigFile::saveToFile(const String &filename) {
- File file;
- if (file.open(filename, File::kFileWriteMode))
+ DumpFile file;
+ if (file.open(filename))
return saveToStream(file);
else
return false;
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index 5afbbad4ae..044474a927 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -176,7 +176,6 @@ void ConfigManager::loadFile(const String &filename) {
if (!cfg_file.open(filename)) {
printf("Creating configuration file: %s\n", filename.c_str());
} else {
- char buf[MAXLINELEN];
String domain;
String comment;
int lineno = 0;
@@ -184,20 +183,28 @@ void ConfigManager::loadFile(const String &filename) {
// TODO: Detect if a domain occurs multiple times (or likewise, if
// a key occurs multiple times inside one domain).
- while (!cfg_file.eof()) {
+ while (!cfg_file.eof() && !cfg_file.ioFailed()) {
lineno++;
- if (!cfg_file.readLine(buf, MAXLINELEN))
- break;
- if (buf[0] == '#') {
+ // Read a line
+ String line;
+ while (line.lastChar() != '\n') {
+ char buf[MAXLINELEN];
+ if (!cfg_file.readLine_NEW(buf, MAXLINELEN))
+ break;
+ line += buf;
+ }
+
+ if (line.size() == 0) {
+ // Do nothing
+ } else if (line[0] == '#') {
// Accumulate comments here. Once we encounter either the start
// of a new domain, or a key-value-pair, we associate the value
// of the 'comment' variable with that entity.
- comment += buf;
- comment += '\n';
- } else if (buf[0] == '[') {
+ comment += line;
+ } else if (line[0] == '[') {
// It's a new domain which begins here.
- char *p = buf + 1;
+ const char *p = line.c_str() + 1;
// Get the domain name, and check whether it's valid (that
// is, verify that it only consists of alphanumerics,
// dashes and underscores).
@@ -209,8 +216,8 @@ void ConfigManager::loadFile(const String &filename) {
error("Config file buggy: missing ] in line %d", lineno);
break;
case ']':
- *p = 0;
- domain = buf + 1;
+ domain = String(line.c_str() + 1, p - (line.c_str() + 1));
+ //domain = String(line.c_str() + 1, p); // TODO: Pending Common::String changes
break;
default:
error("Config file buggy: Invalid character '%c' occured in domain name in line %d", *p, lineno);
@@ -226,10 +233,14 @@ void ConfigManager::loadFile(const String &filename) {
_domainSaveOrder.push_back(domain);
} else {
- // Skip leading & trailing whitespaces
- char *t = rtrim(ltrim(buf));
-
- // Skip empty lines
+ // This line should be a line with a 'key=value' pair, or an empty one.
+
+ // Skip leading whitespaces
+ const char *t = line.c_str();
+ while (isspace(*t))
+ t++;
+
+ // Skip empty lines / lines with only whitespace
if (*t == 0)
continue;
@@ -238,13 +249,30 @@ void ConfigManager::loadFile(const String &filename) {
error("Config file buggy: Key/value pair found outside a domain in line %d", lineno);
}
- // Split string at '=' into 'key' and 'value'.
- char *p = strchr(t, '=');
+ // Split string at '=' into 'key' and 'value'. First, find the "=" delimeter.
+ const char *p = strchr(t, '=');
if (!p)
error("Config file buggy: Junk found in line line %d: '%s'", lineno, t);
- *p = 0;
- String key = rtrim(t);
- String value = ltrim(p + 1);
+
+ // Trim spaces before the '=' to obtain the key
+ const char *p2 = p;
+ while (p2 > t && isspace(*(p2-1)))
+ p2--;
+ String key(t, p2 - t);
+
+ // Skip spaces after the '='
+ t = p + 1;
+ while (isspace(*t))
+ t++;
+
+ // Trim trailing spaces
+ p2 = t + strlen(t);
+ while (p2 > t && isspace(*(p2-1)))
+ p2--;
+
+ String value(t, p2 - t);
+
+ // Finally, store the key/value pair in the active domain
set(key, value, domain);
// Store comment
@@ -261,13 +289,9 @@ void ConfigManager::loadFile(const String &filename) {
void ConfigManager::flushToDisk() {
#ifndef __DC__
- File cfg_file;
+ DumpFile cfg_file;
-// TODO
-// if (!willwrite)
-// return;
-
- if (!cfg_file.open(_filename, File::kFileWriteMode)) {
+ if (!cfg_file.open(_filename)) {
warning("Unable to write configuration file: %s", _filename.c_str());
} else {
// First write the domains in _domainSaveOrder, in that order.
@@ -614,6 +638,10 @@ void ConfigManager::addGameDomain(const String &domName) {
// the given name already exists?
_gameDomains[domName];
+
+ // Add it to the _domainSaveOrder, if it's not already in there
+ if (find(_domainSaveOrder.begin(), _domainSaveOrder.end(), domName) == _domainSaveOrder.end())
+ _domainSaveOrder.push_back(domName);
}
void ConfigManager::removeGameDomain(const String &domName) {
diff --git a/common/file.cpp b/common/file.cpp
index 386777e2c5..5b465b5e01 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -104,7 +104,7 @@
//#define fgets(str, size, file) DS::std_fgets(str, size, file) // not used
//#define getc(handle) DS::std_getc(handle) // not used
//#define getcwd(dir, dunno) DS::std_getcwd(dir, dunno) // not used
- //#define ferror(handle) DS::std_ferror(handle) // not used
+ #define ferror(handle) DS::std_ferror(handle)
#endif
@@ -273,26 +273,14 @@ File::File()
: _handle(0), _ioFailed(false) {
}
-//#define DEBUG_FILE_REFCOUNT
-
File::~File() {
-#ifdef DEBUG_FILE_REFCOUNT
- warning("File::~File on file '%s'", _name.c_str());
-#endif
close();
}
-bool File::open(const String &filename, AccessMode mode) {
- assert(mode == kFileReadMode || mode == kFileWriteMode);
-
- if (filename.empty()) {
- error("File::open: No filename was specified");
- }
-
- if (_handle) {
- error("File::open: This file object already is opened (%s), won't open '%s'", _name.c_str(), filename.c_str());
- }
+bool File::open(const String &filename) {
+ assert(!filename.empty());
+ assert(!_handle);
_name.clear();
clearIOFailed();
@@ -300,32 +288,29 @@ bool File::open(const String &filename, AccessMode mode) {
String fname(filename);
fname.toLowercase();
- const char *modeStr = (mode == kFileReadMode) ? "rb" : "wb";
- if (mode == kFileWriteMode) {
- _handle = fopenNoCase(filename, "", modeStr);
- } else if (_filesMap && _filesMap->contains(fname)) {
+ if (_filesMap && _filesMap->contains(fname)) {
fname = (*_filesMap)[fname];
debug(3, "Opening hashed: %s", fname.c_str());
- _handle = fopen(fname.c_str(), modeStr);
+ _handle = fopen(fname.c_str(), "rb");
} else if (_filesMap && _filesMap->contains(fname + ".")) {
// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
// sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot)
fname = (*_filesMap)[fname + "."];
debug(3, "Opening hashed: %s", fname.c_str());
- _handle = fopen(fname.c_str(), modeStr);
+ _handle = fopen(fname.c_str(), "rb");
} else {
if (_defaultDirectories) {
// Try all default directories
StringIntMap::const_iterator x(_defaultDirectories->begin());
for (; _handle == NULL && x != _defaultDirectories->end(); ++x) {
- _handle = fopenNoCase(filename, x->_key, modeStr);
+ _handle = fopenNoCase(filename, x->_key, "rb");
}
}
// Last resort: try the current directory
if (_handle == NULL)
- _handle = fopenNoCase(filename, "", modeStr);
+ _handle = fopenNoCase(filename, "", "rb");
// Last last (really) resort: try looking inside the application bundle on Mac OS X for the lowercase file.
#if defined(MACOSX) || defined(IPHONE)
@@ -335,7 +320,7 @@ bool File::open(const String &filename, AccessMode mode) {
if (fileUrl) {
UInt8 buf[256];
if (CFURLGetFileSystemRepresentation(fileUrl, false, (UInt8 *)buf, 256)) {
- _handle = fopen((char *)buf, modeStr);
+ _handle = fopen((char *)buf, "rb");
}
CFRelease(fileUrl);
}
@@ -345,26 +330,15 @@ bool File::open(const String &filename, AccessMode mode) {
}
- if (_handle == NULL) {
- if (mode == kFileReadMode)
- debug(2, "File %s not found", filename.c_str());
- else
- debug(2, "File %s not opened", filename.c_str());
- return false;
- }
-
-
- _name = filename;
-
-#ifdef DEBUG_FILE_REFCOUNT
- warning("File::open on file '%s'", _name.c_str());
-#endif
+ if (_handle == NULL)
+ debug(2, "File %s not opened", filename.c_str());
+ else
+ _name = filename;
- return true;
+ return _handle != NULL;
}
-bool File::open(const FilesystemNode &node, AccessMode mode) {
- assert(mode == kFileReadMode || mode == kFileWriteMode);
+bool File::open(const FilesystemNode &node) {
if (!node.exists()) {
warning("File::open: Trying to open a FilesystemNode which does not exist");
@@ -389,25 +363,14 @@ bool File::open(const FilesystemNode &node, AccessMode mode) {
clearIOFailed();
_name.clear();
- const char *modeStr = (mode == kFileReadMode) ? "rb" : "wb";
-
- _handle = fopen(node.getPath().c_str(), modeStr);
-
- if (_handle == NULL) {
- if (mode == kFileReadMode)
- debug(2, "File %s not found", filename.c_str());
- else
- debug(2, "File %s not opened", filename.c_str());
- return false;
- }
+ _handle = fopen(node.getPath().c_str(), "rb");
- _name = filename;
+ if (_handle == NULL)
+ debug(2, "File %s not found", filename.c_str());
+ else
+ _name = filename;
-#ifdef DEBUG_FILE_REFCOUNT
- warning("File::open on file '%s'", _name.c_str());
-#endif
-
- return true;
+ return _handle != NULL;
}
bool File::exists(const String &filename) {
@@ -438,7 +401,7 @@ bool File::exists(const String &filename) {
//Try opening the file inside the local directory as a last resort
File tmp;
- return tmp.open(filename, kFileReadMode);
+ return tmp.open(filename);
}
void File::close() {
@@ -452,36 +415,29 @@ bool File::isOpen() const {
}
bool File::ioFailed() const {
+ // TODO/FIXME: Just use ferror() here?
return _ioFailed != 0;
}
void File::clearIOFailed() {
+ // TODO/FIXME: Just use clearerr() here?
_ioFailed = false;
}
bool File::eof() const {
- if (_handle == NULL) {
- error("File::eof: File is not open!");
- return false;
- }
+ assert(_handle);
return feof((FILE *)_handle) != 0;
}
uint32 File::pos() const {
- if (_handle == NULL) {
- error("File::pos: File is not open!");
- return 0;
- }
+ assert(_handle);
return ftell((FILE *)_handle);
}
uint32 File::size() const {
- if (_handle == NULL) {
- error("File::size: File is not open!");
- return 0;
- }
+ assert(_handle);
uint32 oldPos = ftell((FILE *)_handle);
fseek((FILE *)_handle, 0, SEEK_END);
@@ -492,10 +448,7 @@ uint32 File::size() const {
}
void File::seek(int32 offs, int whence) {
- if (_handle == NULL) {
- error("File::seek: File is not open!");
- return;
- }
+ assert(_handle);
if (fseek((FILE *)_handle, offs, whence) != 0)
clearerr((FILE *)_handle);
@@ -505,10 +458,7 @@ uint32 File::read(void *ptr, uint32 len) {
byte *ptr2 = (byte *)ptr;
uint32 real_len;
- if (_handle == NULL) {
- error("File::read: File is not open!");
- return 0;
- }
+ assert(_handle);
if (len == 0)
return 0;
@@ -521,20 +471,62 @@ uint32 File::read(void *ptr, uint32 len) {
return real_len;
}
-uint32 File::write(const void *ptr, uint32 len) {
- if (_handle == NULL) {
- error("File::write: File is not open!");
- return 0;
- }
+
+DumpFile::DumpFile() : _handle(0) {
+}
+
+DumpFile::~DumpFile() {
+ close();
+}
+
+bool DumpFile::open(const String &filename) {
+ assert(!filename.empty());
+ assert(!_handle);
+
+ String fname(filename);
+ fname.toLowercase();
+
+ _handle = fopenNoCase(filename, "", "wb");
+
+ if (_handle == NULL)
+ debug(2, "Failed to open '%s' for writing", filename.c_str());
+
+ return _handle != NULL;
+}
+
+void DumpFile::close() {
+ if (_handle)
+ fclose((FILE *)_handle);
+ _handle = NULL;
+}
+
+bool DumpFile::isOpen() const {
+ return _handle != NULL;
+}
+
+bool DumpFile::ioFailed() const {
+ assert(_handle);
+ return ferror((FILE *)_handle) != 0;
+}
+
+void DumpFile::clearIOFailed() {
+ assert(_handle);
+ clearerr((FILE *)_handle);
+}
+
+bool DumpFile::eof() const {
+ assert(_handle);
+ return feof((FILE *)_handle) != 0;
+}
+
+uint32 DumpFile::write(const void *ptr, uint32 len) {
+ assert(_handle);
if (len == 0)
return 0;
- if ((uint32)fwrite(ptr, 1, len, (FILE *)_handle) != len) {
- _ioFailed = true;
- }
-
- return len;
+ return (uint32)fwrite(ptr, 1, len, (FILE *)_handle);
}
+
} // End of namespace Common
diff --git a/common/file.h b/common/file.h
index 8a69318128..3c2520b07c 100644
--- a/common/file.h
+++ b/common/file.h
@@ -27,6 +27,7 @@
#define COMMON_FILE_H
#include "common/scummsys.h"
+#include "common/noncopyable.h"
#include "common/str.h"
#include "common/stream.h"
@@ -34,7 +35,10 @@ class FilesystemNode;
namespace Common {
-class File : public SeekableReadStream, public WriteStream {
+/**
+ * TODO: vital to document this core class properly!!! For both users and implementors
+ */
+class File : public SeekableReadStream, public NonCopyable {
protected:
/** File handle to the actual file; 0 if no file is open. */
void *_handle;
@@ -45,19 +49,7 @@ protected:
/** The name of this file, for debugging. */
String _name;
-private:
- // Disallow copying File objects. There is not strict reason for this,
- // except that so far we never had real need for such a feature, and
- // code that accidentally copied File objects tended to break in strange
- // ways.
- File(const File &f);
- File &operator =(const File &f);
-
public:
- enum AccessMode {
- kFileReadMode = 1,
- kFileWriteMode = 2
- };
static void addDefaultDirectory(const String &directory);
static void addDefaultDirectoryRecursive(const String &directory, int level = 4, const String &prefix = "");
@@ -80,8 +72,8 @@ public:
*/
static bool exists(const String &filename);
- virtual bool open(const String &filename, AccessMode mode = kFileReadMode);
- virtual bool open(const FilesystemNode &node, AccessMode mode = kFileReadMode);
+ virtual bool open(const String &filename);
+ virtual bool open(const FilesystemNode &node);
virtual void close();
@@ -114,9 +106,52 @@ public:
virtual uint32 size() const;
void seek(int32 offs, int whence = SEEK_SET);
uint32 read(void *dataPtr, uint32 dataSize);
+};
+
+
+/**
+ * TODO: document this class
+ *
+ * Some design ideas:
+ * - automatically drop all files into dumps/ dir? Might not be desired in all cases
+ */
+class DumpFile : public WriteStream, public NonCopyable {
+protected:
+ /** File handle to the actual file; 0 if no file is open. */
+ void *_handle;
+
+public:
+ DumpFile();
+ virtual ~DumpFile();
+
+ virtual bool open(const String &filename);
+ //virtual bool open(const FilesystemNode &node);
+
+ virtual void close();
+
+ /**
+ * Checks if the object opened a file successfully.
+ *
+ * @return: true if any file is opened, false otherwise.
+ */
+ bool isOpen() const;
+
+
+ bool ioFailed() const;
+ void clearIOFailed();
+ bool eos() const { return eof(); }
+
+ /**
+ * Checks for end of file.
+ *
+ * @return: true if the end of file is reached, false otherwise.
+ */
+ virtual bool eof() const;
+
uint32 write(const void *dataPtr, uint32 dataSize);
};
+
} // End of namespace Common
#endif
diff --git a/common/func.h b/common/func.h
index 95df96123a..6aa5b76ed4 100644
--- a/common/func.h
+++ b/common/func.h
@@ -29,12 +29,18 @@
namespace Common {
+/**
+ * Generic unary function.
+ */
template<class Arg, class Result>
struct UnaryFunction {
typedef Arg ArgumenType;
typedef Result ResultType;
};
+/**
+ * Generic binary function.
+ */
template<class Arg1, class Arg2, class Result>
struct BinaryFunction {
typedef Arg1 FirstArgumentType;
@@ -42,16 +48,25 @@ struct BinaryFunction {
typedef Result ResultType;
};
+/**
+ * Predicate to check for equallity of two data elements.
+ */
template<class T>
struct EqualTo : public BinaryFunction<T, T, bool> {
bool operator()(const T &x, const T &y) const { return x == y; }
};
+/**
+ * Predicate to check for x being less than y.
+ */
template<class T>
struct Less : public BinaryFunction<T, T, bool> {
bool operator()(const T &x, const T &y) const { return x < y; }
};
+/**
+ * Predicate to check for x being greater than y.
+ */
template<class T>
struct Greater : public BinaryFunction<T, T, bool> {
bool operator()(const T &x, const T &y) const { return x > y; }
@@ -63,15 +78,19 @@ private:
Op _op;
typename Op::FirstArgumentType _arg1;
public:
- Binder1st(const Op &op, const typename Op::FirstArgumentType &arg1) : _op(op), _arg1(arg1) {}
+ Binder1st(const Op &op, typename Op::FirstArgumentType arg1) : _op(op), _arg1(arg1) {}
typename Op::ResultType operator()(typename Op::SecondArgumentType v) const {
return _op(_arg1, v);
}
};
-template<class Op, class T>
-inline Binder1st<Op> bind1st(const Op &op, const T &t) {
+/**
+ * Transforms a binary function object into an unary function object.
+ * To achieve that the first parameter is bound to the passed value t.
+ */
+template<class Op>
+inline Binder1st<Op> bind1st(const Op &op, typename Op::FirstArgumentType t) {
return Binder1st<Op>(op, t);
}
@@ -81,15 +100,19 @@ private:
Op _op;
typename Op::SecondArgumentType _arg2;
public:
- Binder2nd(const Op &op, const typename Op::SecondArgumentType &arg2) : _op(op), _arg2(arg2) {}
+ Binder2nd(const Op &op, typename Op::SecondArgumentType arg2) : _op(op), _arg2(arg2) {}
typename Op::ResultType operator()(typename Op::FirstArgumentType v) const {
return _op(v, _arg2);
}
};
-template<class Op, class T>
-inline Binder2nd<Op> bind2nd(const Op &op, const T &t) {
+/**
+ * Transforms a binary function object into an unary function object.
+ * To achieve that the first parameter is bound to the passed value t.
+ */
+template<class Op>
+inline Binder2nd<Op> bind2nd(const Op &op, typename Op::SecondArgumentType t) {
return Binder2nd<Op>(op, t);
}
@@ -119,18 +142,24 @@ public:
}
};
+/**
+ * Creates an unary function object from a function pointer.
+ */
template<class Arg, class Result>
inline PointerToUnaryFunc<Arg, Result> ptr_fun(Result (*func)(Arg)) {
return PointerToUnaryFunc<Arg, Result>(func);
}
+/**
+ * Creates an binary function object from a function pointer.
+ */
template<class Arg1, class Arg2, class Result>
inline PointerToBinaryFunc<Arg1, Arg2, Result> ptr_fun(Result (*func)(Arg1, Arg2)) {
return PointerToBinaryFunc<Arg1, Arg2, Result>(func);
}
template<class Result, class T>
-class MemFunc0 : public UnaryFunction<T*, Result> {
+class MemFunc0 : public UnaryFunction<T *, Result> {
private:
Result (T::*_func)();
public:
@@ -143,20 +172,20 @@ public:
};
template<class Result, class T>
-class ConstMemFunc0 : public UnaryFunction<T*, Result> {
+class ConstMemFunc0 : public UnaryFunction<T *, Result> {
private:
Result (T::*_func)() const;
public:
typedef Result (T::*FuncType)() const;
ConstMemFunc0(const FuncType &func) : _func(func) {}
- Result operator()(T *v) const {
+ Result operator()(const T *v) const {
return (v->*_func)();
}
};
template<class Result, class Arg, class T>
-class MemFunc1 : public BinaryFunction<T*, Arg, Result> {
+class MemFunc1 : public BinaryFunction<T *, Arg, Result> {
private:
Result (T::*_func)(Arg);
public:
@@ -169,40 +198,166 @@ public:
};
template<class Result, class Arg, class T>
-class ConstMemFunc1 : public BinaryFunction<T*, Arg, Result> {
+class ConstMemFunc1 : public BinaryFunction<T *, Arg, Result> {
private:
Result (T::*_func)(Arg) const;
public:
typedef Result (T::*FuncType)(Arg) const;
ConstMemFunc1(const FuncType &func) : _func(func) {}
- Result operator()(T *v1, Arg v2) const {
+ Result operator()(const T *v1, Arg v2) const {
return (v1->*_func)(v2);
}
};
+/**
+ * Creates a unary function object from a class member function pointer.
+ * The parameter passed to the function object is the 'this' pointer to
+ * be used for the function call.
+ */
template<class Result, class T>
inline MemFunc0<Result, T> mem_fun(Result (T::*f)()) {
return MemFunc0<Result, T>(f);
}
+/**
+ * Creates a unary function object from a class member function pointer.
+ * The parameter passed to the function object is the 'this' pointer to
+ * be used for the function call.
+ */
template<class Result, class T>
inline ConstMemFunc0<Result, T> mem_fun(Result (T::*f)() const) {
return ConstMemFunc0<Result, T>(f);
}
+/**
+ * Creates a binary function object from a class member function pointer.
+ * The first parameter passed to the function object is the 'this' pointer to
+ * be used for the function call.
+ * The second one is the parameter passed to the member function.
+ */
template<class Result, class Arg, class T>
inline MemFunc1<Result, Arg, T> mem_fun(Result (T::*f)(Arg)) {
return MemFunc1<Result, Arg, T>(f);
}
+/**
+ * Creates a binary function object from a class member function pointer.
+ * The first parameter passed to the function object is the 'this' pointer to
+ * be used for the function call.
+ * The second one is the parameter passed to the member function.
+ */
template<class Result, class Arg, class T>
inline ConstMemFunc1<Result, Arg, T> mem_fun(Result (T::*f)(Arg) const) {
return ConstMemFunc1<Result, Arg, T>(f);
}
+template<class Result, class T>
+class MemFuncRef0 : public UnaryFunction<T &, Result> {
+private:
+ Result (T::*_func)();
+public:
+ typedef Result (T::*FuncType)();
+
+ MemFuncRef0(const FuncType &func) : _func(func) {}
+ Result operator()(T &v) const {
+ return (v.*_func)();
+ }
+};
+
+template<class Result, class T>
+class ConstMemFuncRef0 : public UnaryFunction<T &, Result> {
+private:
+ Result (T::*_func)() const;
+public:
+ typedef Result (T::*FuncType)() const;
+
+ ConstMemFuncRef0(const FuncType &func) : _func(func) {}
+ Result operator()(const T &v) const {
+ return (v.*_func)();
+ }
+};
+
+template<class Result, class Arg, class T>
+class MemFuncRef1 : public BinaryFunction<T &, Arg, Result> {
+private:
+ Result (T::*_func)(Arg);
+public:
+ typedef Result (T::*FuncType)(Arg);
+
+ MemFuncRef1(const FuncType &func) : _func(func) {}
+ Result operator()(T &v1, Arg v2) const {
+ return (v1.*_func)(v2);
+ }
+};
+
+template<class Result, class Arg, class T>
+class ConstMemFuncRef1 : public BinaryFunction<T &, Arg, Result> {
+private:
+ Result (T::*_func)(Arg) const;
+public:
+ typedef Result (T::*FuncType)(Arg) const;
+
+ ConstMemFuncRef1(const FuncType &func) : _func(func) {}
+ Result operator()(const T &v1, Arg v2) const {
+ return (v1.*_func)(v2);
+ }
+};
+
+/**
+ * Creates a unary function object from a class member function pointer.
+ * The parameter passed to the function object is the object instance to
+ * be used for the function call. Note unlike mem_fun, it takes a reference
+ * as parameter. Note unlike mem_fun, it takes a reference
+ * as parameter.
+ */
+template<class Result, class T>
+inline MemFuncRef0<Result, T> mem_fun_ref(Result (T::*f)()) {
+ return MemFuncRef0<Result, T>(f);
+}
+
+/**
+ * Creates a unary function object from a class member function pointer.
+ * The parameter passed to the function object is the object instance to
+ * be used for the function call. Note unlike mem_fun, it takes a reference
+ * as parameter.
+ */
+template<class Result, class T>
+inline ConstMemFuncRef0<Result, T> mem_fun_Ref(Result (T::*f)() const) {
+ return ConstMemFuncRef0<Result, T>(f);
+}
+
+/**
+ * Creates a binary function object from a class member function pointer.
+ * The first parameter passed to the function object is the object instance to
+ * be used for the function call. Note unlike mem_fun, it takes a reference
+ * as parameter.
+ * The second one is the parameter passed to the member function.
+ */
+template<class Result, class Arg, class T>
+inline MemFuncRef1<Result, Arg, T> mem_fun_ref(Result (T::*f)(Arg)) {
+ return MemFuncRef1<Result, Arg, T>(f);
+}
+
+/**
+ * Creates a binary function object from a class member function pointer.
+ * The first parameter passed to the function object is the object instance to
+ * be used for the function call. Note unlike mem_fun, it takes a reference
+ * as parameter.
+ * The second one is the parameter passed to the member function.
+ */
+template<class Result, class Arg, class T>
+inline ConstMemFuncRef1<Result, Arg, T> mem_fun_ref(Result (T::*f)(Arg) const) {
+ return ConstMemFuncRef1<Result, Arg, T>(f);
+}
+
// functor code
+/**
+ * Generic functor object for function objects without parameters.
+ *
+ * @see Functor1
+ */
template<class Res>
struct Functor0 {
virtual ~Functor0() {}
@@ -211,6 +366,18 @@ struct Functor0 {
virtual Res operator()() const = 0;
};
+/**
+ * Functor object for a class member function without parameter.
+ *
+ * Example creation:
+ *
+ * Foo bar;
+ * Functor0Men<void, Foo> myFunctor(&bar, &Foo::myFunc);
+ *
+ * Example usage:
+ *
+ * myFunctor();
+ */
template<class Res, class T>
class Functor0Mem : public Functor0<Res> {
public:
@@ -218,7 +385,7 @@ public:
Functor0Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
- bool isValid() const { return _func != 0; }
+ bool isValid() const { return _func != 0 && _t != 0; }
Res operator()() const {
return (_t->*_func)();
}
@@ -227,6 +394,38 @@ private:
const FuncType _func;
};
+/**
+ * Generic functor object for unary function objects.
+ *
+ * A typical usage for an unary function object is for executing opcodes
+ * in a script interpreter. To achieve that one can create an Common::Array
+ * object with 'Functor1<Arg, Res> *' as type. Now after the right engine version
+ * has been determined and the opcode table to use is found one could easily
+ * add the opcode implementations like this:
+ *
+ * Common::Array<Functor1<ScriptState, void> *> opcodeTable;
+ * opcodeTable[0] = new Functor1Mem<ScriptState, void, MyEngine_v1>(&myEngine, &MyEngine_v1::o1_foo);
+ * opcodeTable[1] = new Functor1Mem<ScriptState, void, MyEngine_v2>(&myEngine, &MyEngine_v2::o2_foo);
+ * // unimplemented/unused opcode
+ * opcodeTable[2] = 0;
+ * etc.
+ *
+ * This makes it easy to add member functions of different classes as
+ * opcode functions to the function table. Since with the generic
+ * Functor1<ScriptState, void> object the only requirement for an
+ * function to be used is 'ScriptState' as argument and 'void' as return
+ * value.
+ *
+ * Now for calling the opcodes one has simple to do:
+ * if (opcodeTable[opcodeNum] && opcodeTable[opcodeNum]->isValid())
+ * (*opcodeTable[opcodeNum])(scriptState);
+ * else
+ * warning("Unimplemented opcode %d", opcodeNum);
+ *
+ * If you want to see an real world example check the kyra engine.
+ * Files: engines/kyra/script.cpp and .h and engine/kyra/script_*.cpp
+ * are interesting for that matter.
+ */
template<class Arg, class Res>
struct Functor1 : public Common::UnaryFunction<Arg, Res> {
virtual ~Functor1() {}
@@ -235,6 +434,13 @@ struct Functor1 : public Common::UnaryFunction<Arg, Res> {
virtual Res operator()(Arg) const = 0;
};
+/**
+ * Functor object for an unary class member function.
+ * Usage is like with Functor0Mem. The resulting functor object
+ * will take one parameter though.
+ *
+ * @see Functor0Men
+ */
template<class Arg, class Res, class T>
class Functor1Mem : public Functor1<Arg, Res> {
public:
@@ -242,7 +448,7 @@ public:
Functor1Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
- bool isValid() const { return _func != 0; }
+ bool isValid() const { return _func != 0 && _t != 0; }
Res operator()(Arg v1) const {
return (_t->*_func)(v1);
}
@@ -251,6 +457,11 @@ private:
const FuncType _func;
};
+/**
+ * Generic functor object for binary function objects.
+ *
+ * @see Functor1
+ */
template<class Arg1, class Arg2, class Res>
struct Functor2 : public Common::BinaryFunction<Arg1, Arg2, Res> {
virtual ~Functor2() {}
@@ -259,6 +470,13 @@ struct Functor2 : public Common::BinaryFunction<Arg1, Arg2, Res> {
virtual Res operator()(Arg1, Arg2) const = 0;
};
+/**
+ * Functor object for a binary class member function.
+ * Usage is like with Functor0Mem. The resulting functor object
+ * will take two parameter though.
+ *
+ * @see Functor0Men
+ */
template<class Arg1, class Arg2, class Res, class T>
class Functor2Mem : public Functor2<Arg1, Arg2, Res> {
public:
@@ -266,7 +484,7 @@ public:
Functor2Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
- bool isValid() const { return _func != 0; }
+ bool isValid() const { return _func != 0 && _t != 0; }
Res operator()(Arg1 v1, Arg2 v2) const {
return (_t->*_func)(v1, v2);
}
diff --git a/common/hashmap.h b/common/hashmap.h
index 1bae44e98e..ab6e737d74 100644
--- a/common/hashmap.h
+++ b/common/hashmap.h
@@ -58,7 +58,13 @@
#include "common/str.h"
#include "common/util.h"
+// FIXME: Since this define is very system dependant,
+// it should be moved to the appropriate H file instead.
+// Portdefs might be a good location for example
+#if !defined(__SYMBIAN32__)
#define USE_HASHMAP_MEMORY_POOL
+#endif
+
#ifdef USE_HASHMAP_MEMORY_POOL
#include "common/memorypool.h"
// FIXME: we sadly can't assume standard C++ to be present
diff --git a/common/ptr.h b/common/ptr.h
index eea3c39882..c6fcaa4f75 100644
--- a/common/ptr.h
+++ b/common/ptr.h
@@ -121,7 +121,7 @@ public:
~SharedPtr() { decRef(); }
- SharedPtr &operator =(const SharedPtr &r) {
+ SharedPtr &operator=(const SharedPtr &r) {
if (r._refCount)
++(*r._refCount);
decRef();
@@ -134,7 +134,7 @@ public:
}
template<class T2>
- SharedPtr &operator =(const SharedPtr<T2> &r) {
+ SharedPtr &operator=(const SharedPtr<T2> &r) {
if (r._refCount)
++(*r._refCount);
decRef();
@@ -146,8 +146,8 @@ public:
return *this;
}
- ValueType &operator *() const { assert(_pointer); return *_pointer; }
- Pointer operator ->() const { assert(_pointer); return _pointer; }
+ ValueType &operator*() const { assert(_pointer); return *_pointer; }
+ Pointer operator->() const { assert(_pointer); return _pointer; }
/**
* Returns the plain pointer value. Be sure you know what you
@@ -171,6 +171,16 @@ public:
bool unique() const { return refCount() == 1; }
/**
+ * Resets the SharedPtr object to a NULL pointer.
+ */
+ void reset() {
+ decRef();
+ _deletion = 0;
+ _refCount = 0;
+ _pointer = 0;
+ }
+
+ /**
* Returns the number of references to the assigned pointer.
* This should just be used for debugging purposes.
*/
@@ -199,12 +209,12 @@ private:
} // end of namespace Common
template<class T1, class T2>
-bool operator ==(const Common::SharedPtr<T1> &l, const Common::SharedPtr<T2> &r) {
+bool operator==(const Common::SharedPtr<T1> &l, const Common::SharedPtr<T2> &r) {
return l.get() == r.get();
}
template<class T1, class T2>
-bool operator !=(const Common::SharedPtr<T1> &l, const Common::SharedPtr<T2> &r) {
+bool operator!=(const Common::SharedPtr<T1> &l, const Common::SharedPtr<T2> &r) {
return l.get() != r.get();
}
diff --git a/common/rect.h b/common/rect.h
index 01a0a0d431..962069bf48 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -187,6 +187,10 @@ struct Rect {
clip(Rect(0, 0, maxw, maxh));
}
+ bool isEmpty() const {
+ return (left >= right || top >= bottom);
+ }
+
bool isValidRect() const {
return (left <= right && top <= bottom);
}
diff --git a/common/scummsys.h b/common/scummsys.h
index 939f34a5c3..45462a6974 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -54,6 +54,7 @@
#pragma warning( disable : 4505 ) // turn off "unreferenced local function has been removed"
#pragma warning( disable : 4510 ) // turn off "default constructor could not be generated"
#pragma warning( disable : 4610 ) // turn off "struct can never be instantiated - user defined constructor required"
+ #pragma warning( disable : 4800 ) // turn off "forcing value to bool 'true' or 'false' (performance warning)"
// vsnprintf is already defined in Visual Studio 2008
#if (_MSC_VER < 1500)
diff --git a/common/str.cpp b/common/str.cpp
index ad48ef6087..5f8d4ffb7e 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -43,32 +43,43 @@ static int computeCapacity(int len) {
return ((len + 32 - 1) & ~0x1F) - 1;
}
-String::String(const char *str, uint32 len)
-: _len(0), _str(_storage) {
+String::String(const char *str) : _len(0), _str(_storage) {
+ if (str == 0) {
+ _storage[0] = 0;
+ _len = 0;
+ } else
+ initWithCStr(str, strlen(str));
+}
+
+String::String(const char *str, uint32 len) : _len(0), _str(_storage) {
+ initWithCStr(str, len);
+}
+
+String::String(const char *beginP, const char *endP) : _len(0), _str(_storage) {
+ assert(endP >= beginP);
+ initWithCStr(beginP, endP - beginP);
+}
+
+void String::initWithCStr(const char *str, uint32 len) {
+ assert(str);
// Init _storage member explicitly (ie. without calling its constructor)
// for GCC 2.95.x compatibility (see also tracker item #1602879).
_storage[0] = 0;
- if (str && *str) {
- const uint32 tmp = strlen(str);
- assert(len <= tmp);
- if (len <= 0)
- len = tmp;
- _len = len;
-
- if (len >= _builtinCapacity) {
- // Not enough internal storage, so allocate more
- _extern._capacity = computeCapacity(len);
- _extern._refCount = 0;
- _str = (char *)malloc(_extern._capacity+1);
- assert(_str != 0);
- }
-
- // Copy the string into the storage area
- memcpy(_str, str, len);
- _str[len] = 0;
+ _len = len;
+
+ if (len >= _builtinCapacity) {
+ // Not enough internal storage, so allocate more
+ _extern._capacity = computeCapacity(len);
+ _extern._refCount = 0;
+ _str = (char *)malloc(_extern._capacity+1);
+ assert(_str != 0);
}
+
+ // Copy the string into the storage area
+ memmove(_str, str, len);
+ _str[len] = 0;
}
String::String(const String &str)
@@ -91,6 +102,8 @@ String::String(char c)
_storage[0] = c;
_storage[1] = 0;
+ // TODO/FIXME: There is no reason for the following check -- we *do*
+ // allow strings to contain 0 bytes!
_len = (c == 0) ? 0 : 1;
}
@@ -98,6 +111,74 @@ String::~String() {
decRefCount(_extern._refCount);
}
+void String::makeUnique() {
+ ensureCapacity(_len, true);
+}
+
+/**
+ * Ensure that enough storage is available to store at least new_len
+ * characters plus a null byte. In addition, if we currently share
+ * the storage with another string, unshare it, so that we can safely
+ * write to the storage.
+ */
+void String::ensureCapacity(uint32 new_len, bool keep_old) {
+ bool isShared;
+ uint32 curCapacity, newCapacity;
+ char *newStorage;
+ int *oldRefCount = _extern._refCount;
+
+ if (isStorageIntern()) {
+ isShared = false;
+ curCapacity = _builtinCapacity - 1;
+ } else {
+ isShared = (oldRefCount && *oldRefCount > 1);
+ curCapacity = _extern._capacity;
+ }
+
+ // Special case: If there is enough space, and we do not share
+ // the storage, then there is nothing to do.
+ if (!isShared && new_len <= curCapacity)
+ return;
+
+ if (isShared && new_len <= _builtinCapacity - 1) {
+ // We share the storage, but there is enough internal storage: Use that.
+ newStorage = _storage;
+ newCapacity = _builtinCapacity - 1;
+ } else {
+ // We need to allocate storage on the heap!
+
+ // Compute a suitable new capacity limit
+ newCapacity = computeCapacity(new_len);
+
+ // Allocate new storage
+ newStorage = (char *)malloc(newCapacity+1);
+ assert(newStorage);
+ }
+
+ // Copy old data if needed, elsewise reset the new storage.
+ if (keep_old) {
+ assert(_len <= newCapacity);
+ memcpy(newStorage, _str, _len + 1);
+ } else {
+ _len = 0;
+ newStorage[0] = 0;
+ }
+
+ // Release hold on the old storage ...
+ decRefCount(oldRefCount);
+
+ // ... in favor of the new storage
+ _str = newStorage;
+
+ if (!isStorageIntern()) {
+ // Set the ref count & capacity if we use an external storage.
+ // It is important to do this *after* copying any old content,
+ // else we would override data that has not yet been copied!
+ _extern._refCount = 0;
+ _extern._capacity = newCapacity;
+ }
+}
+
void String::incRefCount() const {
assert(!isStorageIntern());
if (_extern._refCount == 0) {
@@ -130,11 +211,14 @@ String& String::operator =(const char *str) {
uint32 len = strlen(str);
ensureCapacity(len, false);
_len = len;
- memcpy(_str, str, len + 1);
+ memmove(_str, str, len + 1);
return *this;
}
String &String::operator =(const String &str) {
+ if (&str == this)
+ return *this;
+
if (str.isStorageIntern()) {
decRefCount(_extern._refCount);
_len = str._len;
@@ -154,7 +238,8 @@ String &String::operator =(const String &str) {
}
String& String::operator =(char c) {
- ensureCapacity(1, false);
+ decRefCount(_extern._refCount);
+ _str = _storage;
_len = 1;
_str[0] = c;
_str[1] = 0;
@@ -237,10 +322,7 @@ void String::deleteLastChar() {
void String::deleteChar(uint32 p) {
assert(p < _len);
- // Call ensureCapacity to make sure we actually *own* the storage
- // to which _str points to -- we wouldn't want to modify a storage
- // which other string objects are sharing, after all.
- ensureCapacity(_len, true);
+ makeUnique();
while (p++ < _len)
_str[p-1] = _str[p];
_len--;
@@ -257,7 +339,7 @@ void String::clear() {
void String::setChar(char c, uint32 p) {
assert(p <= _len);
- ensureCapacity(_len, true);
+ makeUnique();
_str[p] = c;
}
@@ -272,78 +354,36 @@ void String::insertChar(char c, uint32 p) {
}
void String::toLowercase() {
- ensureCapacity(_len, true);
+ makeUnique();
for (uint32 i = 0; i < _len; ++i)
_str[i] = tolower(_str[i]);
}
void String::toUppercase() {
- ensureCapacity(_len, true);
+ makeUnique();
for (uint32 i = 0; i < _len; ++i)
_str[i] = toupper(_str[i]);
}
-/**
- * Ensure that enough storage is available to store at least new_len
- * characters plus a null byte. In addition, if we currently share
- * the storage with another string, unshare it, so that we can safely
- * write to the storage.
- */
-void String::ensureCapacity(uint32 new_len, bool keep_old) {
- bool isShared;
- uint32 curCapacity, newCapacity;
- char *newStorage;
- int *oldRefCount = _extern._refCount;
-
- if (isStorageIntern()) {
- isShared = false;
- curCapacity = _builtinCapacity - 1;
- } else {
- isShared = (oldRefCount && *oldRefCount > 1);
- curCapacity = _extern._capacity;
- }
-
- // Special case: If there is enough space, and we do not share
- // the storage, then there is nothing to do.
- if (!isShared && new_len <= curCapacity)
+void String::trim() {
+ if (_len == 0)
return;
- if (isShared && new_len <= _builtinCapacity - 1) {
- // We share the storage, but there is enough internal storage: Use that.
- newStorage = _storage;
- newCapacity = _builtinCapacity - 1;
- } else {
- // We need to allocate storage on the heap!
-
- // Compute a suitable new capacity limit
- newCapacity = computeCapacity(new_len);
-
- // Allocate new storage
- newStorage = (char *)malloc(newCapacity+1);
- assert(newStorage);
- }
-
- // Copy old data if needed, elsewise reset the new storage.
- if (keep_old) {
- assert(_len <= newCapacity);
- memcpy(newStorage, _str, _len + 1);
- } else {
- _len = 0;
- newStorage[0] = 0;
- }
+ makeUnique();
- // Release hold on the old storage ...
- decRefCount(oldRefCount);
+ // Trim trailing whitespace
+ while (_len >= 1 && isspace(_str[_len-1]))
+ _len--;
+ _str[_len] = 0;
- // ... in favor of the new storage
- _str = newStorage;
+ // Trim leading whitespace
+ char *t = _str;
+ while (isspace(*t))
+ t++;
- if (!isStorageIntern()) {
- // Set the ref count & capacity if we use an external storage.
- // It is important to do this *after* copying any old content,
- // else we would override data that has not yet been copied!
- _extern._refCount = 0;
- _extern._capacity = newCapacity;
+ if (t != _str) {
+ _len -= t - _str;
+ memmove(_str, t, _len + 1);
}
}
diff --git a/common/str.h b/common/str.h
index a92ec34fff..3479fee8e4 100644
--- a/common/str.h
+++ b/common/str.h
@@ -96,10 +96,24 @@ public:
static const char *emptyString;
#endif
+ /** Construct a new empty string. */
String() : _len(0), _str(_storage) { _storage[0] = 0; }
- String(const char *str, uint32 len = 0);
+
+ /** Construct a new string from the given NULL-terminated C string. */
+ String(const char *str);
+
+ /** Construct a new string containing exactly len characters read from address str. */
+ String(const char *str, uint32 len);
+
+ /** Construct a new string containing the characters between beginP (including) and endP (excluding). */
+ String(const char *beginP, const char *endP);
+
+ /** Construct a copy of the given string. */
String(const String &str);
+
+ /** Construct a string consisting of the given character. */
String(char c);
+
~String();
String &operator =(const char *str);
@@ -162,6 +176,8 @@ public:
void toLowercase();
void toUppercase();
+
+ void trim();
uint hash() const;
@@ -186,9 +202,11 @@ public:
}
protected:
+ void makeUnique();
void ensureCapacity(uint32 new_len, bool keep_old);
void incRefCount() const;
void decRefCount(int *oldRefCount);
+ void initWithCStr(const char *str, uint32 len);
};
// Append two strings to form a new (temp) string
diff --git a/common/stream.cpp b/common/stream.cpp
index ab9804d7b6..e06cc28415 100644
--- a/common/stream.cpp
+++ b/common/stream.cpp
@@ -148,6 +148,61 @@ char *SeekableReadStream::readLine(char *buf, size_t bufSize) {
return buf;
}
+char *SeekableReadStream::readLine_NEW(char *buf, size_t bufSize) {
+ assert(buf != 0 && bufSize > 1);
+ char *p = buf;
+ size_t len = 0;
+ char c = 0;
+
+ // If end-of-file occurs before any characters are read, return NULL
+ // and the buffer contents remain unchanged.
+ if (eos() || ioFailed()) {
+ return 0;
+ }
+
+ // Loop as long as the stream has not ended, there is still free
+ // space in the buffer, and the line has not ended
+ while (!eos() && len + 1 < bufSize && c != LF) {
+ c = readByte();
+
+ // If end-of-file occurs before any characters are read, return
+ // NULL and the buffer contents remain unchanged. If an error
+ /// occurs, return NULL and the buffer contents are indeterminate.
+ if (ioFailed() || (len == 0 && eos()))
+ return 0;
+
+ // Check for CR or CR/LF
+ // * DOS and Windows use CRLF line breaks
+ // * Unix and OS X use LF line breaks
+ // * Macintosh before OS X used CR line breaks
+ if (c == CR) {
+ // Look at the next char -- is it LF? If not, seek back
+ c = readByte();
+ if (c != LF && !eos())
+ seek(-1, SEEK_CUR);
+ // Treat CR & CR/LF as plain LF
+ c = LF;
+ }
+
+ *p++ = c;
+ len++;
+ }
+
+ // FIXME:
+ // This should fix a bug while using readLine with Common::File
+ // it seems that it sets the eos flag after an invalid read
+ // and at the same time the ioFailed flag
+ // the config file parser fails out of that reason for the new themes
+ if (eos()) {
+ clearIOFailed();
+ }
+
+ // We always terminate the buffer if no error occured
+ *p = 0;
+ return buf;
+}
+
+
uint32 SubReadStream::read(void *dataPtr, uint32 dataSize) {
dataSize = MIN(dataSize, _end - _pos);
@@ -187,4 +242,83 @@ void SeekableSubReadStream::seek(int32 offset, int whence) {
_parentStream->seek(_pos);
}
+BufferedReadStream::BufferedReadStream(ReadStream *parentStream, uint32 bufSize, bool disposeParentStream)
+ : _parentStream(parentStream),
+ _disposeParentStream(disposeParentStream),
+ _pos(0),
+ _bufSize(0),
+ _realBufSize(bufSize) {
+
+ assert(parentStream);
+ _buf = new byte[bufSize];
+ assert(_buf);
+}
+
+BufferedReadStream::~BufferedReadStream() {
+ if (_disposeParentStream)
+ delete _parentStream;
+ delete _buf;
+}
+
+uint32 BufferedReadStream::read(void *dataPtr, uint32 dataSize) {
+ uint32 alreadyRead = 0;
+ const uint32 bufBytesLeft = _bufSize - _pos;
+
+ // Check whether the data left in the buffer suffices....
+ if (dataSize > bufBytesLeft) {
+ // Nope, we need to read more data
+
+ // First, flush the buffer, if it is non-empty
+ if (0 < bufBytesLeft) {
+ memcpy(dataPtr, _buf + _pos, bufBytesLeft);
+ _pos = _bufSize;
+ alreadyRead += bufBytesLeft;
+ dataPtr = (byte *)dataPtr + bufBytesLeft;
+ dataSize -= bufBytesLeft;
+ }
+
+ // At this point the buffer is empty. Now if the read request
+ // exceeds the buffer size, just satisfy it directly.
+ if (dataSize > _bufSize)
+ return alreadyRead + _parentStream->read(dataPtr, dataSize);
+
+ // Refill the buffer.
+ // If we didn't read as many bytes as requested, the reason
+ // is EOF or an error. In that case we truncate the buffer
+ // size, as well as the number of bytes we are going to
+ // return to the caller.
+ _bufSize = _parentStream->read(_buf, _realBufSize);
+ _pos = 0;
+ if (dataSize > _bufSize)
+ dataSize = _bufSize;
+ }
+
+ // Satisfy the request from the buffer
+ memcpy(dataPtr, _buf + _pos, dataSize);
+ _pos += dataSize;
+ return alreadyRead + dataSize;
+}
+
+BufferedSeekableReadStream::BufferedSeekableReadStream(SeekableReadStream *parentStream, uint32 bufSize, bool disposeParentStream)
+ : BufferedReadStream(parentStream, bufSize, disposeParentStream),
+ _parentStream(parentStream) {
+}
+
+void BufferedSeekableReadStream::seek(int32 offset, int whence) {
+ // If it is a "local" seek, we may get away with "seeking" around
+ // in the buffer only.
+ // Note: We could try to handle SEEK_END and SEEK_SET, too, but
+ // since they are rarely used, it seems not worth the effort.
+ if (whence == SEEK_CUR && (int)_pos + offset >= 0 && _pos + offset <= _bufSize) {
+ _pos += offset;
+ } else {
+ // Seek was not local enough, so we reset the buffer and
+ // just seeks normally in the parent stream.
+ if (whence == SEEK_CUR)
+ offset -= (_bufSize - _pos);
+ _pos = _bufSize;
+ _parentStream->seek(offset, whence);
+ }
+}
+
} // End of namespace Common
diff --git a/common/stream.h b/common/stream.h
index 313a695e82..d07579c2d1 100644
--- a/common/stream.h
+++ b/common/stream.h
@@ -304,13 +304,40 @@ public:
* Read one line of text from a CR or CR/LF terminated plain text file.
* This method is a rough analog of the (f)gets function.
*
+ * @bug A main difference (and flaw) in this function is that there is no
+ * way to detect that a line exceeeds the length of the buffer.
+ * Code which needs this should use the new readLine_NEW() method instead.
+ *
* @param buf the buffer to store into
* @param bufSize the size of the buffer
* @return a pointer to the read string, or NULL if an error occurred
+ *
* @note The line terminator (CR or CR/LF) is stripped and not inserted
* into the buffer.
*/
virtual char *readLine(char *buf, size_t bufSize);
+
+ /**
+ * Reads at most one less than the number of characters specified
+ * by bufSize from the and stores them in the string buf. Reading
+ * stops when the end of a line is reached (CR, CR/LF or LF), at
+ * end-of-file or error. The newline, if any, is retained (CR and
+ * CR/LF are translated to LF = 0xA = '\n'). If any characters are
+ * read and there is no error, a `\0' character is appended to end
+ * the string.
+ *
+ * Upon successful completion, return a pointer to the string. If
+ * end-of-file occurs before any characters are read, returns NULL
+ * and the buffer contents remain unchanged. If an error occurs,
+ * returns NULL and the buffer contents are indeterminate.
+ * This method does not distinguish between end-of-file and error;
+ * callers muse use ioFailed() or eos() to determine which occurred.
+ *
+ * @param buf the buffer to store into
+ * @param bufSize the size of the buffer
+ * @return a pointer to the read string, or NULL if an error occurred
+ */
+ virtual char *readLine_NEW(char *s, size_t bufSize);
};
/**
@@ -323,15 +350,17 @@ public:
class SubReadStream : virtual public ReadStream {
protected:
ReadStream *_parentStream;
+ bool _disposeParentStream;
uint32 _pos;
uint32 _end;
- bool _disposeParentStream;
public:
SubReadStream(ReadStream *parentStream, uint32 end, bool disposeParentStream = false)
: _parentStream(parentStream),
+ _disposeParentStream(disposeParentStream),
_pos(0),
- _end(end),
- _disposeParentStream(disposeParentStream) {}
+ _end(end) {
+ assert(parentStream);
+ }
~SubReadStream() {
if (_disposeParentStream) delete _parentStream;
}
@@ -387,6 +416,48 @@ public:
}
};
+/**
+ * Wrapper class which adds buffering to any given ReadStream.
+ * Users can specify how big the buffer should be, and whether the
+ * wrapped stream should be disposed when the wrapper is disposed.
+ */
+class BufferedReadStream : virtual public ReadStream {
+protected:
+ ReadStream *_parentStream;
+ bool _disposeParentStream;
+ byte *_buf;
+ uint32 _pos;
+ uint32 _bufSize;
+ uint32 _realBufSize;
+
+public:
+ BufferedReadStream(ReadStream *parentStream, uint32 bufSize, bool disposeParentStream = false);
+ ~BufferedReadStream();
+
+ virtual bool eos() const { return (_pos == _bufSize) && _parentStream->eos(); }
+ virtual bool ioFailed() const { return _parentStream->ioFailed(); }
+ virtual void clearIOFailed() { _parentStream->clearIOFailed(); }
+
+ virtual uint32 read(void *dataPtr, uint32 dataSize);
+};
+
+/**
+ * Wrapper class which adds buffering to any given SeekableReadStream.
+ * @see BufferedReadStream
+ */
+class BufferedSeekableReadStream : public BufferedReadStream, public SeekableReadStream {
+protected:
+ SeekableReadStream *_parentStream;
+public:
+ BufferedSeekableReadStream(SeekableReadStream *parentStream, uint32 bufSize, bool disposeParentStream = false);
+
+ virtual uint32 pos() const { return _parentStream->pos() - (_bufSize - _pos); }
+ virtual uint32 size() const { return _parentStream->size(); }
+
+ virtual void seek(int32 offset, int whence = SEEK_SET);
+};
+
+
/**
* Simple memory based 'stream', which implements the ReadStream interface for
@@ -487,9 +558,9 @@ public:
uint32 size() const { return _bufSize; }
};
-/**
+/**
* A sort of hybrid between MemoryWriteStream and Array classes. A stream
- * that grows as it's written to.
+ * that grows as it's written to.
*/
class MemoryWriteStreamDynamic : public Common::WriteStream {
private:
diff --git a/common/system.cpp b/common/system.cpp
index 327b7246e2..8d528258f4 100644
--- a/common/system.cpp
+++ b/common/system.cpp
@@ -121,28 +121,3 @@ void OSystem::clearScreen() {
memset(screen->pixels, 0, screen->h * screen->pitch);
unlockScreen();
}
-
-/*
- * Include header files needed for the getFilesystemFactory() method.
- *
- * TODO: Remove these gradually and move the getFilesystemFactory() implementations
- * to the respective backends. Then turn it into a pure virtual method of OSystem.
- */
-#if defined(PALMOS_MODE)
- #include "backends/fs/palmos/palmos-fs-factory.h"
-#elif defined(__PLAYSTATION2__)
- #include "backends/fs/ps2/ps2-fs-factory.h"
-#endif
-
-FilesystemFactory *OSystem::getFilesystemFactory() {
- #if defined(__amigaos4__) || defined(__DC__) || defined(__SYMBIAN32__) || defined(UNIX) || defined(WIN32) || defined(__WII__) || defined(__PSP__) || defined(__DS__)
- // These ports already implement this function, so it should never be called.
- return 0;
- #elif defined(PALMOS_MODE)
- return &PalmOSFilesystemFactory::instance();
- #elif defined(__PLAYSTATION2__)
- return &Ps2FilesystemFactory::instance();
- #else
- #error Unknown and unsupported backend in OSystem::getFilesystemFactory
- #endif
-}
diff --git a/common/system.h b/common/system.h
index 204ea9383a..b895a5cfba 100644
--- a/common/system.h
+++ b/common/system.h
@@ -814,15 +814,6 @@ public:
*/
virtual Audio::Mixer *getMixer() = 0;
- /**
- * Determine the output sample rate. Audio data provided by the sound
- * callback will be played using this rate.
- * @note Client code other than the sound mixer should _not_ use this
- * method. Instead, call Mixer::getOutputRate()!
- * @return the output sample rate
- */
- virtual int getOutputSampleRate() const = 0;
-
//@}
@@ -911,7 +902,7 @@ public:
*
* @return FilesystemFactory* The specific factory for the current architecture.
*/
- virtual FilesystemFactory *getFilesystemFactory();
+ virtual FilesystemFactory *getFilesystemFactory() = 0;
/**
diff --git a/common/unarj.cpp b/common/unarj.cpp
index f3ac20c285..da88c11fc9 100644
--- a/common/unarj.cpp
+++ b/common/unarj.cpp
@@ -231,7 +231,7 @@ ArjHeader *ArjFile::readHeader() {
}
-bool ArjFile::open(const Common::String &filename, AccessMode mode) {
+bool ArjFile::open(const Common::String &filename) {
if (_isOpen)
error("Attempt to open another instance of archive");
diff --git a/common/unarj.h b/common/unarj.h
index b015999671..c8965968f6 100644
--- a/common/unarj.h
+++ b/common/unarj.h
@@ -110,7 +110,7 @@ public:
void registerArchive(const String &filename);
- bool open(const Common::String &filename, AccessMode mode = kFileReadMode);
+ bool open(const Common::String &filename);
void close();
uint32 read(void *dataPtr, uint32 dataSize);
diff --git a/common/xmlparser.h b/common/xmlparser.h
index 8b2d2ee956..11028dbaa8 100644
--- a/common/xmlparser.h
+++ b/common/xmlparser.h
@@ -319,7 +319,7 @@ public:
bool loadFile(Common::String filename) {
Common::File *f = new Common::File;
- if (!f->open(filename, Common::File::kFileReadMode))
+ if (!f->open(filename))
return false;
_fileName = filename;