https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk ........ r42578 | dreammaster | 2009-07-18 11:22:43 +1000 (Sat, 18 Jul 2009) | 1 line Minor tweak to prevent mouse clicks that close a user wait message also being further interpreted as a user walk destination ........ r42587 | wjpalenstijn | 2009-07-18 22:51:12 +1000 (Sat, 18 Jul 2009) | 1 line SCI: Fix stepping in debugger ........ r42588 | drmccoy | 2009-07-18 23:05:36 +1000 (Sat, 18 Jul 2009) | 1 line Adding a workaround for the guard house card game "game over" screen in Woodruff ........ r42589 | wjpalenstijn | 2009-07-18 23:05:39 +1000 (Sat, 18 Jul 2009) | 1 line SCI: don't leave debugger after bt ........ r42590 | Kirben | 2009-07-18 23:39:21 +1000 (Sat, 18 Jul 2009) | 1 line Add workaround for bug #1668393 - ZAK FM-TOWNS: Crash when entering Hostel from outside. ........ r42591 | fingolfin | 2009-07-19 01:11:19 +1000 (Sun, 19 Jul 2009) | 1 line AGOS: Fixed backspace under OS X in Personal Nightmare ........ r42592 | fingolfin | 2009-07-19 01:12:54 +1000 (Sun, 19 Jul 2009) | 1 line AGOS: Get rid of one setjmp in PN code (needs testing) ........ r42593 | fingolfin | 2009-07-19 01:15:26 +1000 (Sun, 19 Jul 2009) | 1 line AGOS: Removed second setjmp in PN code (untested!) ........ r42596 | cyx | 2009-07-19 07:26:44 +1000 (Sun, 19 Jul 2009) | 2 lines add "-IQ" suffix test to SO_LOAD_STRING (same as SO_SAVE_STRING) ; fixes french version of atlantis ........ r42597 | wjpalenstijn | 2009-07-19 08:17:56 +1000 (Sun, 19 Jul 2009) | 1 line Fix crash in tab completion if one command is a prefix of another. ........ r42598 | wjpalenstijn | 2009-07-19 08:19:07 +1000 (Sun, 19 Jul 2009) | 1 line SCI: Fix disasm_addr option parsing ........ r42599 | wjpalenstijn | 2009-07-19 08:46:07 +1000 (Sun, 19 Jul 2009) | 1 line SCI: Fix breakpoints ........ r42606 | Kirben | 2009-07-19 19:09:56 +1000 (Sun, 19 Jul 2009) | 1 line Add patch #2823590 - Fix music crashes in Waxworks (PC). ........ r42608 | Kirben | 2009-07-19 19:13:17 +1000 (Sun, 19 Jul 2009) | 1 line Update Waxworks. ........ r42609 | wjpalenstijn | 2009-07-19 20:50:14 +1000 (Sun, 19 Jul 2009) | 1 line SCI: check shouldQuit() in main loop ........ r42610 | cyx | 2009-07-19 21:07:17 +1000 (Sun, 19 Jul 2009) | 2 lines fix bug #2597980 - TUCKER: Sprite glitch ........ r42611 | dreammaster | 2009-07-19 22:52:19 +1000 (Sun, 19 Jul 2009) | 1 line Added the GUIO_NOSFX and GUIO_NOMUSIC flags to the first Discworld 1 demo entry ........ r42614 | Kirben | 2009-07-20 00:03:35 +1000 (Mon, 20 Jul 2009) | 1 line Change generic save game name. ........ r42615 | knakos | 2009-07-20 00:46:11 +1000 (Mon, 20 Jul 2009) | 1 line remove dead code leftover ........ r42619 | knakos | 2009-07-20 02:10:55 +1000 (Mon, 20 Jul 2009) | 1 line whoops, fix non-arm build (why? :-) ) ........ r42623 | wjpalenstijn | 2009-07-20 07:06:25 +1000 (Mon, 20 Jul 2009) | 1 line Fix compilation with USE_CONSOLE = 0 ........ r42624 | fingolfin | 2009-07-20 15:02:17 +1000 (Mon, 20 Jul 2009) | 1 line AGOS: Fixed badload(); some whitespace cleanup ........ r42625 | sev | 2009-07-20 18:31:40 +1000 (Mon, 20 Jul 2009) | 3 lines Moved new ports section to more appropriate place. And force buildbot to recompile :) ........ r42626 | dreammaster | 2009-07-20 19:19:27 +1000 (Mon, 20 Jul 2009) | 1 line Bugfix for hangs on scene changes in Discworld 1 after having loaded a savegame from the GMM when the title screens are displayed ........ r42632 | wjpalenstijn | 2009-07-21 06:55:28 +1000 (Tue, 21 Jul 2009) | 4 lines Make ScummFile::eos() consistent with Stream::eos(). Remove usage of ioFailed from SCUMM engine. Fix reading up to the end of a SCUMM SubFile. This hopefully fixes #2820957. ........ r42633 | mthreepwood | 2009-07-21 06:59:35 +1000 (Tue, 21 Jul 2009) | 1 line Fixing bug #2823854: Mickey's space adventure crash. There's one too many space characters in a string which causes it to be drawn off the screen. ........ r42634 | sev | 2009-07-21 08:15:37 +1000 (Tue, 21 Jul 2009) | 2 lines Proper implementation of microscope puzzle. ........ r42635 | lordhoto | 2009-07-21 08:26:41 +1000 (Tue, 21 Jul 2009) | 2 lines Fix gcc warning (hopefully this is correct). ........ r42636 | Kirben | 2009-07-21 17:02:18 +1000 (Tue, 21 Jul 2009) | 1 line Update GUI flags for AGOS game engine. ........ r42637 | wjpalenstijn | 2009-07-21 19:39:58 +1000 (Tue, 21 Jul 2009) | 1 line Use a BufferedReadStream to buffer ArjFile's input to reduce memory usage ........ r42638 | Kirben | 2009-07-21 20:37:58 +1000 (Tue, 21 Jul 2009) | 1 line Fix fade effects in Waxworks. ........ r42639 | Kirben | 2009-07-21 20:48:32 +1000 (Tue, 21 Jul 2009) | 1 line Fix bug #2823818 - GUI: unable to select subtitles and speech for Simon 2. ........ r42640 | drmccoy | 2009-07-21 21:26:31 +1000 (Tue, 21 Jul 2009) | 1 line Making some static const uint32s public, older GCC versions don't seem to like nested classes to access their parents' protected members ........ r42641 | drmccoy | 2009-07-21 21:58:58 +1000 (Tue, 21 Jul 2009) | 1 line Fixing "Game "hangs" after first level" (bug #2824414) ........ r42642 | drmccoy | 2009-07-21 22:14:36 +1000 (Tue, 21 Jul 2009) | 1 line Fixing the text input in Gob1 (the loading code wasn't printed as you typed anymore) ........ r42645 | robinwatts | 2009-07-22 05:39:24 +1000 (Wed, 22 Jul 2009) | 4 lines Add ARM code implementation of Scaler2x, and enable it for the WinCE port. ........ r42654 | Kirben | 2009-07-22 19:52:44 +1000 (Wed, 22 Jul 2009) | 1 line Simplify fade code. ........ r42655 | Kirben | 2009-07-22 20:23:58 +1000 (Wed, 22 Jul 2009) | 1 line Change the default target to CD version, for games which offer floppy and CD versions. So all GUI options are still available in fan translations. ........ r42656 | Kirben | 2009-07-22 20:32:35 +1000 (Wed, 22 Jul 2009) | 1 line Update video script debug table for Waxworks. ........ r42658 | sev | 2009-07-22 21:48:51 +1000 (Wed, 22 Jul 2009) | 2 lines Fix bug #2823762: "AGI: PQ1 All function keys are broken after restart" ........ r42659 | sev | 2009-07-22 22:24:55 +1000 (Wed, 22 Jul 2009) | 2 lines Fix bug #2823759: "AGI: PQ1 help not showing the first time you press F1" ........ r42660 | sev | 2009-07-22 22:36:08 +1000 (Wed, 22 Jul 2009) | 2 lines Mention microscope puzzle improvement in T7G ........ r42661 | lordhoto | 2009-07-22 22:38:34 +1000 (Wed, 22 Jul 2009) | 1 line Since Kyra PC98 version is japanese only don't mention it explicitly. ........ r42662 | sev | 2009-07-23 01:55:33 +1000 (Thu, 23 Jul 2009) | 2 lines Move functions from agi.cpp to more appropriate files. ........ r42663 | sev | 2009-07-23 02:26:53 +1000 (Thu, 23 Jul 2009) | 2 lines Fix bug #2798797: "AGI: larry 1 doesn't restart after dying" ........ r42664 | sev | 2009-07-23 05:25:53 +1000 (Thu, 23 Jul 2009) | 7 lines Fix bug #1745396: "MI: Saved game from the credits sequence fails to load". Now we specifically disallow saves in room 0 for all v4+ games. Original has exactly this check in all versions, and such games are impossible to load. Still the problem is not resolved for v0-v3 and HE games. ........ r42668 | sev | 2009-07-23 06:37:48 +1000 (Thu, 23 Jul 2009) | 2 lines Fix bug #2825252: "GUI: Low Res Bugs" ........ r42671 | Kirben | 2009-07-23 15:48:20 +1000 (Thu, 23 Jul 2009) | 1 line Simplify the code to check whether loading or saving a game is possible. ........ r42672 | Kirben | 2009-07-23 15:57:00 +1000 (Thu, 23 Jul 2009) | 1 line Simplify the code to check whether loading or saving a game is possible. ........ r42673 | Kirben | 2009-07-23 17:49:28 +1000 (Thu, 23 Jul 2009) | 1 line Correct error in revision 26678. ........ r42674 | Kirben | 2009-07-23 20:31:06 +1000 (Thu, 23 Jul 2009) | 1 line Remove keyboard support for mouse buttons, since it interferes with load/save scripts in HE games and input scripts in others games (COMI, FT). It isn't much use anyway, since we dropped support for cursor movement via keyboard long ago. ........ r42675 | Kirben | 2009-07-23 20:33:13 +1000 (Thu, 23 Jul 2009) | 1 line Fix bug #1726909 - HE Games: Glitches after loading saved games, by restircting HE games to their original load/save interface. ........ r42676 | dreammaster | 2009-07-23 20:49:30 +1000 (Thu, 23 Jul 2009) | 1 line Bugfix for player blocking room entrance causing NPCs trying to enter getting an excessive number of action entries ........ r42677 | Kirben | 2009-07-23 20:54:12 +1000 (Thu, 23 Jul 2009) | 1 line Only autosave in supported scenes. ........ r42679 | drmccoy | 2009-07-24 05:50:13 +1000 (Fri, 24 Jul 2009) | 1 line Fixing a bug in the V4 save file handler, produced by a "neat" feature in Woodruff: The saves remember their position within the list and use that information to load the "correct" screen properties, making it impossible to load reordered saves correctly -.- ........ r42681 | Kirben | 2009-07-24 14:59:21 +1000 (Fri, 24 Jul 2009) | 1 line Bear Stormin' is the full mini game, and not a demo. ........ r42685 | Kirben | 2009-07-24 15:20:44 +1000 (Fri, 24 Jul 2009) | 1 line Fix cursor position, when entering a save game name in HE games. ........ r42690 | drmccoy | 2009-07-24 20:45:25 +1000 (Fri, 24 Jul 2009) | 1 line Adding transparency for VMD video block type 2, fixing bug #2037158 ("n-Game animation shifted(?)"). The problem was that the animation in question has an one pixel wide transparent bar on the left ........ r42693 | Kirben | 2009-07-24 22:28:53 +1000 (Fri, 24 Jul 2009) | 1 line Add workaround for bug #2826144 - SAM: Game hangs when talking to bigfoot guard. ........ r42695 | Kirben | 2009-07-24 23:30:26 +1000 (Fri, 24 Jul 2009) | 1 line Adjust workaround for bug #2826144, to use hard coded offset, that should be safe in all language versions. ........ r42696 | wjpalenstijn | 2009-07-25 04:58:15 +1000 (Sat, 25 Jul 2009) | 3 lines SAGA: Instead of trying to detect duplicate glyphs, simply generate duplicate outline glyphs. This should fix #2826697. ........ r42697 | eriktorbjorn | 2009-07-25 05:24:15 +1000 (Sat, 25 Jul 2009) | 2 lines Removed unused variable. ........ r42699 | sev | 2009-07-25 05:56:46 +1000 (Sat, 25 Jul 2009) | 2 lines This is 1.1.0svn ........ r42701 | sev | 2009-07-25 06:21:49 +1000 (Sat, 25 Jul 2009) | 2 lines re-enable SCI engine ........ r42704 | drmccoy | 2009-07-25 07:29:41 +1000 (Sat, 25 Jul 2009) | 1 line Adding support for ADPCM sound data (yet another IMA ADPCM variant). What we've called ADPCM before is more like DPCM ........ r42705 | drmccoy | 2009-07-25 07:31:00 +1000 (Sat, 25 Jul 2009) | 1 line Adding subtitle support to Woodruff ........ r42706 | drmccoy | 2009-07-25 07:31:58 +1000 (Sat, 25 Jul 2009) | 1 line Caching the subtitle font and color, because some don't assign those ........ r42707 | drmccoy | 2009-07-25 07:32:45 +1000 (Sat, 25 Jul 2009) | 1 line Calculating the number of data bytes per initial sound slice, because relying on the standard amount doesn't work for some videos ........ r42708 | drmccoy | 2009-07-25 07:33:22 +1000 (Sat, 25 Jul 2009) | 1 line Properly reading the video codec fourcc, in case we need other codecs in the future ........ r42709 | drmccoy | 2009-07-25 07:33:55 +1000 (Sat, 25 Jul 2009) | 1 line Adding ADL playback to the demoplayer ........ r42710 | drmccoy | 2009-07-25 07:34:17 +1000 (Sat, 25 Jul 2009) | 1 line Adding stubs for newer VMDs found in Addy 5 ........ r42711 | drmccoy | 2009-07-25 07:34:43 +1000 (Sat, 25 Jul 2009) | 1 line Added a method to easily dump resources to file ........ r42712 | drmccoy | 2009-07-25 07:35:06 +1000 (Sat, 25 Jul 2009) | 1 line Fixing bytes per pixel detection ........ r42713 | drmccoy | 2009-07-25 07:35:57 +1000 (Sat, 25 Jul 2009) | 1 line Renaming getAnchor() to getFrameCoords() ........ r42714 | drmccoy | 2009-07-25 07:36:16 +1000 (Sat, 25 Jul 2009) | 1 line Moving all implementations into the cpp ........ r42715 | drmccoy | 2009-07-25 07:36:42 +1000 (Sat, 25 Jul 2009) | 1 line CoktelVideo cleanup: Splitting up some IMD methods and removing the obsolete notifyPaused() ........ r42716 | drmccoy | 2009-07-25 07:36:59 +1000 (Sat, 25 Jul 2009) | 1 line Merging Map_v4 into Map_v2 ........ r42717 | lordhoto | 2009-07-25 10:58:44 +1000 (Sat, 25 Jul 2009) | 1 line Add new event dispatching API. ........ r42718 | lordhoto | 2009-07-25 10:59:03 +1000 (Sat, 25 Jul 2009) | 1 line Replace "EventProvider" class of the DefaultEventManager implementation with "Common::EventSource". ........ r42719 | lordhoto | 2009-07-25 10:59:18 +1000 (Sat, 25 Jul 2009) | 1 line Got rid of EventManger::artificialEventQueue. ........ r42720 | lordhoto | 2009-07-25 10:59:30 +1000 (Sat, 25 Jul 2009) | 1 line Add function "allowMapping" to EventSource, for testing whether the event source allows mapping (via the Keymapper for example.) ........ r42721 | lordhoto | 2009-07-25 10:59:39 +1000 (Sat, 25 Jul 2009) | 1 line Prevent EventMapper events from being mapped. ........ r42722 | lordhoto | 2009-07-25 10:59:53 +1000 (Sat, 25 Jul 2009) | 1 line Replaced "_artificialEventQueue" by an EventSource. ........ r42723 | lordhoto | 2009-07-25 11:00:12 +1000 (Sat, 25 Jul 2009) | 1 line Made DefaultEventManager a subclass of EventObserver. ........ r42724 | lordhoto | 2009-07-25 11:00:24 +1000 (Sat, 25 Jul 2009) | 2 lines - Add marco to easily access the EventDispatcher instance. - Add events.cpp to module.mk ........ r42725 | lordhoto | 2009-07-25 11:00:37 +1000 (Sat, 25 Jul 2009) | 1 line Change DefaultEventManager to use EventDispatcher. ........ r42726 | lordhoto | 2009-07-25 11:00:47 +1000 (Sat, 25 Jul 2009) | 1 line Moved ArtificialEventSource to common/events.h. ........ r42727 | lordhoto | 2009-07-25 11:01:05 +1000 (Sat, 25 Jul 2009) | 2 lines - Adapt DefaultEventManager to use Common::ArtificialEventSource - Adapt Keymapper to implement EventMapper interface ........ r42728 | lordhoto | 2009-07-25 11:01:22 +1000 (Sat, 25 Jul 2009) | 2 lines - EventDispatcher is no longer a singleton. - Add "getEventDispatcher" method to EventManager. ........ r42729 | lordhoto | 2009-07-25 11:01:41 +1000 (Sat, 25 Jul 2009) | 1 line Add enum which marks global priorites of the EventManager event dispatcher. ........ r42736 | Kirben | 2009-07-25 15:39:57 +1000 (Sat, 25 Jul 2009) | 1 line Add patch #2816140 - MM C64 Costume Animation. ........ r42737 | Kirben | 2009-07-25 16:27:41 +1000 (Sat, 25 Jul 2009) | 1 line Add patch #2821100 - MM C64 Objects / Verb fixes, with minor clean up applied. ........ r42738 | Kirben | 2009-07-25 16:36:41 +1000 (Sat, 25 Jul 2009) | 1 line Update credits. ........ r42739 | eriktorbjorn | 2009-07-25 16:55:28 +1000 (Sat, 25 Jul 2009) | 2 lines Fixed GCC warnings. ........ r42740 | Kirben | 2009-07-25 17:17:37 +1000 (Sat, 25 Jul 2009) | 1 line Whitespace changes. ........ r42742 | fingolfin | 2009-07-25 19:36:16 +1000 (Sat, 25 Jul 2009) | 1 line Whitespace fixes ........ r42743 | wjpalenstijn | 2009-07-25 20:25:57 +1000 (Sat, 25 Jul 2009) | 1 line Add Common::String::printf to format a string ........ r42744 | wjpalenstijn | 2009-07-25 20:26:17 +1000 (Sat, 25 Jul 2009) | 1 line Use new Common::String::printf ........ r42746 | sev | 2009-07-25 20:37:20 +1000 (Sat, 25 Jul 2009) | 2 lines Formatting ........ r42747 | joostp | 2009-07-25 22:28:45 +1000 (Sat, 25 Jul 2009) | 1 line fix unaligned writes ........ r42748 | joostp | 2009-07-25 22:41:46 +1000 (Sat, 25 Jul 2009) | 1 line remove implicit SoundDigital::Sound ctor call, which is redundant because the required initialisation is done below -- this fixes a linker error with mipspro ........ r42751 | lordhoto | 2009-07-25 22:59:46 +1000 (Sat, 25 Jul 2009) | 1 line Move the event recorder to its own class (EventRecoder inside common/EventRecorder.[h/cpp]). ........ r42752 | lordhoto | 2009-07-25 23:00:09 +1000 (Sat, 25 Jul 2009) | 1 line Strip trailing whitespaces. ........ r42753 | joostp | 2009-07-25 23:07:17 +1000 (Sat, 25 Jul 2009) | 1 line fix another aligned write ........ r42755 | eriktorbjorn | 2009-07-25 23:07:50 +1000 (Sat, 25 Jul 2009) | 2 lines Added word-wrapping to Drascula's conversation options. Fixes bug #2826607. ........ r42757 | eriktorbjorn | 2009-07-25 23:17:31 +1000 (Sat, 25 Jul 2009) | 2 lines Don't hog the CPU while waiting for the player to pick a conversation option. ........ r42759 | lordhoto | 2009-07-25 23:23:51 +1000 (Sat, 25 Jul 2009) | 1 line Fix gp2x port building. ........ r42761 | lordhoto | 2009-07-26 00:09:58 +1000 (Sun, 26 Jul 2009) | 1 line Yet another fix for the GP2x backend. ........ r42765 | lordhoto | 2009-07-26 01:31:11 +1000 (Sun, 26 Jul 2009) | 1 line Adept savegame name creation code to use Common::String::printf. ........ r42766 | drmccoy | 2009-07-26 02:07:29 +1000 (Sun, 26 Jul 2009) | 1 line Added a workaround to fix the Last Dynasty video greenness for now ........ r42767 | drmccoy | 2009-07-26 02:08:31 +1000 (Sun, 26 Jul 2009) | 1 line Moved the decision whether subtitles should be displayed, so that the broken subtitles in The Last Dynasty aren't shown ........ r42768 | drmccoy | 2009-07-26 02:09:19 +1000 (Sun, 26 Jul 2009) | 1 line Fixing Woodruff videos again after enabling block type 2 transparency ........ r42771 | lordhoto | 2009-07-26 02:34:01 +1000 (Sun, 26 Jul 2009) | 1 line Fix palette regression in Kyra2. ........ r42773 | lordhoto | 2009-07-26 02:37:25 +1000 (Sun, 26 Jul 2009) | 1 line Implement missing bits in KyraEngine_HoF::setCauldronState. ........ r42776 | eriktorbjorn | 2009-07-26 03:48:51 +1000 (Sun, 26 Jul 2009) | 5 lines Make sure that "buf" is properly terminated. Actually, we could probably get rid of "buf" completely, and replace it with face = syncChar[p] - '0', assuming that syncChar only contains digits. But for now, let's make a minimal change. This might fix bug #2826611 ("DRASCULA: Crash when smashing church window"). ........ r42780 | joostp | 2009-07-26 04:35:27 +1000 (Sun, 26 Jul 2009) | 2 lines use READ_UINT16 macro ........ r42782 | drmccoy | 2009-07-26 04:44:06 +1000 (Sun, 26 Jul 2009) | 1 line Adding support for (new-style) stereo in DPCM audio ........ r42783 | drmccoy | 2009-07-26 04:44:24 +1000 (Sun, 26 Jul 2009) | 1 line Adding more sanity checks to Vmd::renderFrame() ........ r42785 | djwillis | 2009-07-26 05:07:28 +1000 (Sun, 26 Jul 2009) | 1 line GP2X Backend: Volume control code cleanup. ........ r42787 | wjpalenstijn | 2009-07-26 09:36:24 +1000 (Sun, 26 Jul 2009) | 2 lines Add optional readline support to the text debugger console. Make text/graphical console selectable with an option to configure. ........ r42790 | dreammaster | 2009-07-26 10:27:32 +1000 (Sun, 26 Jul 2009) | 1 line Changed the events.cpp file to EventDispatcher.cpp, to avoid MSVC name clashes with sdl/events.cpp ........ r42791 | dreammaster | 2009-07-26 10:31:28 +1000 (Sun, 26 Jul 2009) | 1 line Fixed compilation from file changes to common and gob engine ........ r42792 | lordhoto | 2009-07-26 17:07:35 +1000 (Sun, 26 Jul 2009) | 1 line Formatting. ........ r42793 | peres001 | 2009-07-26 18:37:03 +1000 (Sun, 26 Jul 2009) | 1 line Moved parser functions arrays to file scope, as they were tripping up the obsolete gcc used for the BeOS/Haiku port. If anybody can work out a better solution please apply it, because this makes me sick. ........ r42795 | dreammaster | 2009-07-26 19:09:07 +1000 (Sun, 26 Jul 2009) | 1 line Added a delay to the in-game menu loop to prevent 100% CPU usage ........ r42798 | dreammaster | 2009-07-26 19:40:35 +1000 (Sun, 26 Jul 2009) | 1 line Bugfix for mouse button clicks getting counted multiple times ........ r42799 | dreammaster | 2009-07-26 19:48:52 +1000 (Sun, 26 Jul 2009) | 1 line Added a debug line to allow tracking of script execution ........ r42801 | eriktorbjorn | 2009-07-26 20:10:08 +1000 (Sun, 26 Jul 2009) | 4 lines 78 bytes isn't enough for some of the longer conversation options. 128 might not be enough either, but at least it fixes bug #2827170 ("DRASCULA: Conversation error"). ........ r42807 | djwillis | 2009-07-26 22:58:22 +1000 (Sun, 26 Jul 2009) | 2 lines Virtual Keyboard: Update default keyboard pack using slightly tweaked versions of the graphics very kindly provided by Carl Mitchell. Also update xml file to make best use of the keyboard graphics and add the 'delete' event in addition the passing backspace back to the calling textarea. ........ r42809 | drmccoy | 2009-07-26 23:50:18 +1000 (Sun, 26 Jul 2009) | 1 line Reverting my fix for bug #2037158 ("In-Game animation shifted(?)"), because it breaks Woodruff's intro ........ r42812 | lordhoto | 2009-07-27 00:16:51 +1000 (Mon, 27 Jul 2009) | 1 line Create base class FontSJIS16x16 for our own SJIS font. ........ r42813 | lordhoto | 2009-07-27 00:17:06 +1000 (Mon, 27 Jul 2009) | 1 line Add support for our custom SJIS font. ........ r42814 | lordhoto | 2009-07-27 00:17:21 +1000 (Mon, 27 Jul 2009) | 1 line Change KYRA to use our SJIS font, when it's available. ........ r42815 | lordhoto | 2009-07-27 00:17:40 +1000 (Mon, 27 Jul 2009) | 1 line Change the way the font data for SJIS fonts is load. ........ r42816 | lordhoto | 2009-07-27 00:17:54 +1000 (Mon, 27 Jul 2009) | 1 line Add a factory method, which tries to open different SJIS fonts/ROMs and returns a font for the first present data. ........ r42817 | lordhoto | 2009-07-27 00:18:06 +1000 (Mon, 27 Jul 2009) | 1 line Print warning, when client code does try to draw an unsupported SJIS char. ........ r42818 | lordhoto | 2009-07-27 00:18:21 +1000 (Mon, 27 Jul 2009) | 1 line Specify that the chars passed to FontSJIS::drawChar should be little endian. ........ r42819 | lordhoto | 2009-07-27 00:18:34 +1000 (Mon, 27 Jul 2009) | 1 line Add way to overwrite default SJIS font. ........ r42820 | lordhoto | 2009-07-27 00:18:49 +1000 (Mon, 27 Jul 2009) | 1 line Simplify KYRA's SJIS font loading code. ........ r42821 | lordhoto | 2009-07-27 00:19:02 +1000 (Mon, 27 Jul 2009) | 1 line Reflect code to test the magic bytes in the sjis.fnt header. ........ r42822 | lordhoto | 2009-07-27 00:24:45 +1000 (Mon, 27 Jul 2009) | 1 line Add NEWS entry about new SJIS code. ........ r42823 | lordhoto | 2009-07-27 00:40:03 +1000 (Mon, 27 Jul 2009) | 1 line Instead of only printing a warning, when no SJIS char data is present, just return to the caller. ........ r42824 | lordhoto | 2009-07-27 00:40:44 +1000 (Mon, 27 Jul 2009) | 1 line Add a todo to FontSJIS::drawChar taking an Graphics::Surface. ........ r42825 | marcus_c | 2009-07-27 06:41:33 +1000 (Mon, 27 Jul 2009) | 1 line Create IP.BIN. ........ r42826 | joostp | 2009-07-27 07:06:53 +1000 (Mon, 27 Jul 2009) | 1 line fix/workaround for cruise crash on OSX ........ r42842 | wjpalenstijn | 2009-07-28 02:04:35 +1000 (Tue, 28 Jul 2009) | 2 lines Fix format string issues (and compiler warnings). Patch by salty-horse. ........ r42843 | robinwatts | 2009-07-28 02:29:36 +1000 (Tue, 28 Jul 2009) | 7 lines Add ARM code version of Normal2x scaler. Add ARM only aspect ratio correcting version of Normal2x scaler. Make WinCE port use Normal2x by default if the screen is large enough. Make WinCE port use aspect ratio correcting version if panel is hidden. ........ r42844 | lordhoto | 2009-07-28 03:04:06 +1000 (Tue, 28 Jul 2009) | 1 line Formatting. ........ r42845 | lordhoto | 2009-07-28 03:48:40 +1000 (Tue, 28 Jul 2009) | 1 line Fix bug #2827459 "ITE: Ingame GUI does not list slots 96-99", by defining in SagaMetaEngine that the last valid save slot for SAGA is slot 95. ........ r42847 | djwillis | 2009-07-28 04:05:16 +1000 (Tue, 28 Jul 2009) | 1 line GP2XWiz: Update GP2X Wiz bundle.sh to copy libraries into the distribution file from the tool chain where the libraries are broken on the device. Also add LD_LIBRARY_PATH 'hack' to launch script to ensure bundled libraries are used over system ones. ........ r42849 | lordhoto | 2009-07-28 04:19:16 +1000 (Tue, 28 Jul 2009) | 1 line Oops enabled HACK to prevent multiple OPL instances again. ........ r42851 | drmccoy | 2009-07-28 05:01:17 +1000 (Tue, 28 Jul 2009) | 1 line Abstracting off the block types from Imd::renderFrame() and Vmd::renderFrame() ........ r42856 | drmccoy | 2009-07-29 01:05:44 +1000 (Wed, 29 Jul 2009) | 1 line Silencing two "empty loop body" warnings ........ r42857 | drmccoy | 2009-07-29 01:19:55 +1000 (Wed, 29 Jul 2009) | 1 line Changing stuff around a bit so alignment requirements won't increase ........ r42858 | drmccoy | 2009-07-29 02:28:32 +1000 (Wed, 29 Jul 2009) | 1 line More alignment-related changes ........ r42859 | eriktorbjorn | 2009-07-29 03:19:33 +1000 (Wed, 29 Jul 2009) | 3 lines Fixed drawing subtitles for cutscenes that are narrower than the screen, and erase the subtitles manually if they are drawn outside the frame. ........ r42861 | eriktorbjorn | 2009-07-29 03:53:59 +1000 (Wed, 29 Jul 2009) | 3 lines Broken Sword 2, unsurprisingly, had the same subtitle drawing glitch for small cutscenes that Broken Sword 1 had. And a memory leak. This should fix both. ........ r42863 | djwillis | 2009-07-29 06:22:38 +1000 (Wed, 29 Jul 2009) | 1 line GP2XWiz: Add downscale support to the backend using the PocketPCHalfARM scaler from the WinCE backend (Maybe this should be moved into /graphics/scalers at some point?). Also enable all the ARM optemised routines in this and the GP2X backend. ........ r42866 | fingolfin | 2009-07-29 08:28:40 +1000 (Wed, 29 Jul 2009) | 1 line SCI: Avoid using perror (it's not portable) ........ r42868 | fingolfin | 2009-07-29 08:42:08 +1000 (Wed, 29 Jul 2009) | 1 line Patch #2828644: Support for mingw32ce 0.5.1 toolchain in configure script ........ r42870 | fingolfin | 2009-07-29 09:19:33 +1000 (Wed, 29 Jul 2009) | 2 lines SCUMM: Moved _inventoryOffset to ScummEngine_v2 and save it. Fixes bug #2828417: Zak V2: inventory position isn't reset when loading. ........ r42880 | fingolfin | 2009-07-29 18:55:04 +1000 (Wed, 29 Jul 2009) | 1 line SCUMM: cleanup ........ r42881 | fingolfin | 2009-07-29 18:55:17 +1000 (Wed, 29 Jul 2009) | 1 line GUI: When clicking in a scrollbar to page up/down, don't scroll a full page; rather scroll a full page minus one line (see FR #2821508). This matches the behavior of the page up/down keys ........ r42886 | fingolfin | 2009-07-29 19:19:56 +1000 (Wed, 29 Jul 2009) | 1 line Sort audio output rates numerically (see FR #2821525) ........ r42887 | drmccoy | 2009-07-29 20:17:44 +1000 (Wed, 29 Jul 2009) | 1 line Adding a SoundType parameter to SmackerDecoder, defaulting to kSFXSoundType ........ r42889 | fingolfin | 2009-07-29 21:48:20 +1000 (Wed, 29 Jul 2009) | 1 line SCUMM: Rewrote ScummEngine::inventoryScriptIndy3Mac for clarity ........ r42890 | lordhoto | 2009-07-30 00:54:27 +1000 (Thu, 30 Jul 2009) | 1 line Fix animation script sound effect opcode implementation in Kyra3. ........ r42892 | lordhoto | 2009-07-30 01:31:23 +1000 (Thu, 30 Jul 2009) | 1 line Fix saving of item in hand in HoF and MR. ........ r42894 | drmccoy | 2009-07-30 01:57:50 +1000 (Thu, 30 Jul 2009) | 1 line Oops, fixing a regression I created with the Map_v4/Map_v2-merge ........ r42895 | lordhoto | 2009-07-30 02:24:07 +1000 (Thu, 30 Jul 2009) | 1 line Fix a little bug in KyraEngine_MR::showBadConscience, which prevented Gunther's mouse shapes from showing up. ........ r42898 | fingolfin | 2009-07-30 04:35:34 +1000 (Thu, 30 Jul 2009) | 1 line SCUMM: Enable looping in Indy3Mac sound effects ........ r42900 | lordhoto | 2009-07-30 05:39:03 +1000 (Thu, 30 Jul 2009) | 1 line Fix regression, which prevented saving in COMI. ........ r42904 | lordhoto | 2009-07-30 06:03:46 +1000 (Thu, 30 Jul 2009) | 1 line Fix typo, which made our "floorf" macro use "floorf" instead of "floor" on systems without "floorf". ........ r42907 | fingolfin | 2009-07-30 06:35:50 +1000 (Thu, 30 Jul 2009) | 1 line SCUMM: Fix verb/sentence handling in Indy3 mac (there, a double click must be used to trigger a verb/sentence) ........ r42910 | fingolfin | 2009-07-30 07:39:00 +1000 (Thu, 30 Jul 2009) | 1 line Removed last traces of clearIOFailed. Yay :) ........ r42911 | fingolfin | 2009-07-30 07:39:16 +1000 (Thu, 30 Jul 2009) | 1 line Removed redundant File::ioFailed() implementation; also turned ReadStream::ioFailed from a virtual into an inline method ........ r42912 | fingolfin | 2009-07-30 07:39:34 +1000 (Thu, 30 Jul 2009) | 1 line SWORD1 & SWORD2: Replaced ioFailed by err+eos ........ r42918 | fingolfin | 2009-07-30 19:36:50 +1000 (Thu, 30 Jul 2009) | 1 line Patch #2818501: enable scale2x mmx on x86_64 ........ r42920 | dreammaster | 2009-07-30 21:03:16 +1000 (Thu, 30 Jul 2009) | 1 line Added the character lookup table for the Spanish font ........ r42922 | peres001 | 2009-07-30 23:41:22 +1000 (Thu, 30 Jul 2009) | 1 line Use SaveFileMan::listSaveFiles() to build list of old savegames for Nippon Safes. ........ r42923 | peres001 | 2009-07-30 23:42:08 +1000 (Thu, 30 Jul 2009) | 1 line Fixed typo in user message. ........ r42924 | peres001 | 2009-07-30 23:44:50 +1000 (Thu, 30 Jul 2009) | 1 line Cleanup the header file as I removed one function in r42922. ........ r42926 | lordhoto | 2009-07-31 00:24:23 +1000 (Fri, 31 Jul 2009) | 1 line Fix bug which caused the mouse cursor not to update in some cases. ........ r42929 | lordhoto | 2009-07-31 01:12:42 +1000 (Fri, 31 Jul 2009) | 1 line Add tanoku to our GUI credits section. ........ r42932 | lordhoto | 2009-07-31 01:19:15 +1000 (Fri, 31 Jul 2009) | 1 line Prevent our "credits" make target updating Credits.rtf, which in fact is not present in SVN anymore, and the outdated docbook. ........ r42934 | lordhoto | 2009-07-31 02:43:25 +1000 (Fri, 31 Jul 2009) | 1 line Fix bug #2829737: "GUI: Wrong background colours on dialog screens (IRIX)". ........ r42935 | lordhoto | 2009-07-31 02:51:53 +1000 (Fri, 31 Jul 2009) | 1 line Fixed missing clearing of the low bit of the alpha mask in the "dim" screen shading function. ........ r42937 | fingolfin | 2009-07-31 03:48:03 +1000 (Fri, 31 Jul 2009) | 1 line NDS: Changed jtypes.h to ndstypes.h (this 'newer' name has been in effect even in the older versions of DevKitPro used for compiling ScummVM...) ........ r42938 | fingolfin | 2009-07-31 03:52:44 +1000 (Fri, 31 Jul 2009) | 1 line minor cleanup to scale2x, to avoid confusing the compiler about potential pointer aliasing (only the tip of the iceberg, of course... ;) ........ r42939 | fingolfin | 2009-07-31 04:27:50 +1000 (Fri, 31 Jul 2009) | 1 line DS: Started work on a new build system for the Nintendo DS port, based on configure (and thus suitable for buildbot). Currently only the ARM7 part is 'done' ........ r42940 | lordhoto | 2009-07-31 05:43:36 +1000 (Fri, 31 Jul 2009) | 1 line Change code to use our fractional utilities. ........ r42941 | lordhoto | 2009-07-31 05:43:53 +1000 (Fri, 31 Jul 2009) | 1 line Fix Browser dialog name. ........ r42943 | fingolfin | 2009-07-31 06:46:43 +1000 (Fri, 31 Jul 2009) | 1 line Overhauled the credits: Retired members are now (partially) back to their old sections, to make sure people really see all people who contribute to an engine/backend. Also added&fixed some entries, and moved the FreeSCI section ........ r42946 | fingolfin | 2009-07-31 06:58:32 +1000 (Fri, 31 Jul 2009) | 1 line Changed 10rdH070's nick back to LordHoto, and added Hkz to the credits ........ r42947 | fingolfin | 2009-07-31 07:04:46 +1000 (Fri, 31 Jul 2009) | 1 line Added Strangerke to credits, and moved wjp from Gob to SCI on his request ........ r42950 | fingolfin | 2009-07-31 07:45:09 +1000 (Fri, 31 Jul 2009) | 1 line Patch #2828669: CRUISE: Fix cruise compilation with mingw32ce toolchain ........ r42951 | fingolfin | 2009-07-31 07:56:04 +1000 (Fri, 31 Jul 2009) | 1 line SCUMM: Properly detect & distinguish the three FM-TOWNS double-demos ........ r42952 | fingolfin | 2009-07-31 07:56:18 +1000 (Fri, 31 Jul 2009) | 1 line cleanup ........ r42953 | tanoku | 2009-07-31 09:42:12 +1000 (Fri, 31 Jul 2009) | 2 lines Fixed corrupted theme files. ........ r42955 | tanoku | 2009-07-31 10:22:46 +1000 (Fri, 31 Jul 2009) | 2 lines Prevent high-resolution layouts to be loaded on low resolutions. ........ r42958 | peres001 | 2009-07-31 22:39:31 +1000 (Fri, 31 Jul 2009) | 1 line When renaming old savefiles for Nippon Safes, don't assert if a file that matches the pattern game.* and is not a savefile is found in the savepath. ........ r42959 | djwillis | 2009-07-31 23:01:28 +1000 (Fri, 31 Jul 2009) | 1 line GP2X: Clean up README-GP2X and remove HTML version of it from SVN (no one ever reads it and the WiKi is more upto date). ........ r42964 | djwillis | 2009-08-01 03:10:20 +1000 (Sat, 01 Aug 2009) | 1 line GP2XWiz: Small cleanup of render code to slave as much of loadGFXMode() code back to the OSystem_SDL::loadGFXMode(). version. Also update README-GP2XWIZ. ........ r42965 | dreammaster | 2009-08-01 09:27:19 +1000 (Sat, 01 Aug 2009) | 1 line Fix bug with the event loop that was discarding pending events rather than leaving them to be processed in the following frame ........ r42973 | buddha_ | 2009-08-01 19:53:21 +1000 (Sat, 01 Aug 2009) | 1 line Remove obsolete comment from Cine::Palette::saturatedAddColor. ........ r42974 | eriktorbjorn | 2009-08-02 01:42:42 +1000 (Sun, 02 Aug 2009) | 4 lines Added some more information to the "Compressed sound ... invalid" error. Maybe this will help in determining what's causing bug #2830364. (It sounds like a bad data file, but who knows...) ........ r42995 | drmccoy | 2009-08-02 20:40:27 +1000 (Sun, 02 Aug 2009) | 1 line When ESCing videos, seek to the last frame that was meant to be played. Fixes graphical glitches (bug #2830985) and crashes (bug #2830988) ........ r42996 | drmccoy | 2009-08-02 20:40:48 +1000 (Sun, 02 Aug 2009) | 1 line Removing _frameWaitLag. It broke normal animation speed in pre-v4 games and didn't even do what it was supposed to in v4+ games anyway. (bug #2830985) ........ r42999 | eriktorbjorn | 2009-08-02 22:49:57 +1000 (Sun, 02 Aug 2009) | 2 lines Show a message if saving or loading a game fails. ........ r43001 | drmccoy | 2009-08-02 23:54:06 +1000 (Sun, 02 Aug 2009) | 1 line Show a message if saving or loading a game fails. ........ r43003 | knakos | 2009-08-03 03:34:57 +1000 (Mon, 03 Aug 2009) | 1 line rework mixer (re)init. fixes bug #2694722 ........ r43005 | joostp | 2009-08-03 03:58:48 +1000 (Mon, 03 Aug 2009) | 1 line align memory handles to sizeof(void*) instead of 4 (which is just good enough for 32-bit) - this fixes DW2 on 64-bit systems that require alignment ........ r43007 | djwillis | 2009-08-03 05:46:18 +1000 (Mon, 03 Aug 2009) | 1 line GP2XWiz: More cleanup of render code and fix silly screen update bug when reverting to a 320*2xx game from a 640*4xx game. Dirty rect code for downscaled images still needs work. ........ r43008 | knakos | 2009-08-03 05:50:24 +1000 (Mon, 03 Aug 2009) | 1 line clean up and fix vga aspect scaler routines ........ r43010 | djwillis | 2009-08-03 07:18:25 +1000 (Mon, 03 Aug 2009) | 1 line GP2XWiz/SDL: Fix 2 small typos. ........ r43011 | joostp | 2009-08-03 07:22:46 +1000 (Mon, 03 Aug 2009) | 1 line Fix AGI crashes on 64-bit systems that require alignment ........ r43013 | joostp | 2009-08-03 07:44:21 +1000 (Mon, 03 Aug 2009) | 1 line Make MemoryReAlloc() 64-bit alignment safe ........ r43020 | scott_t | 2009-08-03 11:19:36 +1000 (Mon, 03 Aug 2009) | 1 line T7G: Fix bug #2831046 where save names not shown after loading a save from launcher ........ r43023 | dreammaster | 2009-08-03 19:28:06 +1000 (Mon, 03 Aug 2009) | 1 line Bugfix to correctly reset the music tempo when loading a savegame ........ r43025 | buddha_ | 2009-08-04 03:18:18 +1000 (Tue, 04 Aug 2009) | 6 lines Fix for bug #2828333 (AGI: KQ1: Greensleeves always plays): - Made all savegame loading in AGI do the same pre-load and post-load stuff. - Moved load/saveGameState from AgiBase to AgiEngine - Added rudimentary error handling to load/saveGameState - Incidentally also fixes the hanging note from bug #2798797. ........ r43027 | buddha_ | 2009-08-04 03:52:07 +1000 (Tue, 04 Aug 2009) | 8 lines Fix for #2824798 (FW: crash when clicking "load" in the GUI): - Fixed CineMetaEngine::listSaves(const char *target) which was broken. - Also added explicit initialization of savegame descriptions to empty strings for safety reasons (e.g. arrays on stack aren't initialized to zero). - Added explicit trailing zero setting to savegame descriptions (Previously using GMM you could write a description of length >= 20 that had no trailing zero when written to description file (e.g. fw.dir)). ........ r43029 | djwillis | 2009-08-04 04:38:46 +1000 (Tue, 04 Aug 2009) | 1 line GP2XWiz: Fix bug with downscaled cursors. ........ r43033 | knakos | 2009-08-04 22:02:07 +1000 (Tue, 04 Aug 2009) | 1 line add bindings for cruise engine ........ r43035 | knakos | 2009-08-04 22:19:30 +1000 (Tue, 04 Aug 2009) | 1 line support made engine ........ r43037 | knakos | 2009-08-04 22:39:33 +1000 (Tue, 04 Aug 2009) | 1 line update Makefile ........ r43039 | knakos | 2009-08-04 22:51:17 +1000 (Tue, 04 Aug 2009) | 1 line update readme (draft) ........ r43041 | knakos | 2009-08-04 23:17:33 +1000 (Tue, 04 Aug 2009) | 1 line commit slightly modified patch #2828646: WINCE: Integrate Windows CE with the master build system ........ r43042 | thebluegr | 2009-08-05 00:20:38 +1000 (Wed, 05 Aug 2009) | 1 line Cleaned up the MSVC project files of the gob engine ........ r43043 | knakos | 2009-08-05 00:53:43 +1000 (Wed, 05 Aug 2009) | 1 line got rid of superfluous semicolons ........ r43048 | thebluegr | 2009-08-05 03:22:18 +1000 (Wed, 05 Aug 2009) | 1 line Removed the superfluous VGA buffer, replacing it with direct writes to the video buffer ........ r43056 | thebluegr | 2009-08-05 07:56:59 +1000 (Wed, 05 Aug 2009) | 1 line Cleanup ........ svn-id: r43062
1899 lines
57 KiB
C++
1899 lines
57 KiB
C++
/* ScummVM - Graphic Adventure Engine
|
|
*
|
|
* ScummVM is the legal property of its developers, whose names
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
* file distributed with this source distribution.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*
|
|
* $URL$
|
|
* $Id$
|
|
*
|
|
*/
|
|
|
|
#include <time.h> // for ScummEngine::saveInfos / ScummEngine::loadInfos
|
|
|
|
#include "common/config-manager.h"
|
|
#include "common/savefile.h"
|
|
#include "common/system.h"
|
|
#include "common/zlib.h"
|
|
|
|
#include "scumm/actor.h"
|
|
#include "scumm/charset.h"
|
|
#include "scumm/imuse_digi/dimuse.h"
|
|
#include "scumm/imuse/imuse.h"
|
|
#include "scumm/he/intern_he.h"
|
|
#include "scumm/object.h"
|
|
#include "scumm/resource.h"
|
|
#include "scumm/saveload.h"
|
|
#include "scumm/scumm_v0.h"
|
|
#include "scumm/scumm_v7.h"
|
|
#include "scumm/sound.h"
|
|
#include "scumm/he/sprite_he.h"
|
|
#include "scumm/verbs.h"
|
|
|
|
#include "sound/audiocd.h"
|
|
#include "sound/mixer.h"
|
|
|
|
#include "graphics/thumbnail.h"
|
|
|
|
namespace Scumm {
|
|
|
|
struct SaveGameHeader {
|
|
uint32 type;
|
|
uint32 size;
|
|
uint32 ver;
|
|
char name[32];
|
|
};
|
|
|
|
struct SaveInfoSection {
|
|
uint32 type;
|
|
uint32 version;
|
|
uint32 size;
|
|
|
|
uint32 timeTValue; // Obsolete since version 2, but kept for compatibility
|
|
uint32 playtime;
|
|
|
|
uint32 date;
|
|
uint16 time;
|
|
};
|
|
|
|
#define SaveInfoSectionSize (4+4+4 + 4+4 + 4+2)
|
|
|
|
#define INFOSECTION_VERSION 2
|
|
|
|
#pragma mark -
|
|
|
|
Common::Error ScummEngine::loadGameState(int slot) {
|
|
requestLoad(slot);
|
|
return Common::kNoError;
|
|
}
|
|
|
|
bool ScummEngine::canLoadGameStateCurrently() {
|
|
// FIXME: For now always allow loading in V0-V3 games
|
|
// FIXME: Actually, we might wish to support loading in more places.
|
|
// As long as we are sure it won't cause any problems... Are we
|
|
// aware of *any* spots where loading is not supported?
|
|
|
|
// HE games are limited to original load and save interface only,
|
|
// due to numerous glitches (see bug #1726909) that can occur.
|
|
if (_game.heversion >= 60)
|
|
return false;
|
|
|
|
// COMI always disables saving/loading (to tell the truth:
|
|
// the main menu) via its scripts, thus we need to make an
|
|
// exception here. This the same forced overwriting of the
|
|
// script decisions as in ScummEngine::processKeyboard.
|
|
if (_game.id == GID_CMI)
|
|
return true;
|
|
|
|
return (VAR_MAINMENU_KEY == 0xFF || VAR(VAR_MAINMENU_KEY) != 0);
|
|
}
|
|
|
|
Common::Error ScummEngine::saveGameState(int slot, const char *desc) {
|
|
requestSave(slot, desc);
|
|
return Common::kNoError;
|
|
}
|
|
|
|
bool ScummEngine::canSaveGameStateCurrently() {
|
|
// FIXME: For now always allow loading in V0-V3 games
|
|
// TODO: Should we disallow saving in some more places,
|
|
// e.g. when a SAN movie is playing? Not sure whether the
|
|
// original EXE allowed this.
|
|
|
|
// HE games are limited to original load and save interface only,
|
|
// due to numerous glitches (see bug #1726909) that can occur.
|
|
if (_game.heversion >= 60)
|
|
return false;
|
|
|
|
// COMI always disables saving/loading (to tell the truth:
|
|
// the main menu) via its scripts, thus we need to make an
|
|
// exception here. This the same forced overwriting of the
|
|
// script decisions as in ScummEngine::processKeyboard.
|
|
if (_game.id == GID_CMI)
|
|
return true;
|
|
|
|
// SCUMM v4+ doesn't allow saving in room 0 or if
|
|
// VAR(VAR_MAINMENU_KEY) to set to zero.
|
|
return (VAR_MAINMENU_KEY == 0xFF || (VAR(VAR_MAINMENU_KEY) != 0 && _currentRoom != 0));
|
|
}
|
|
|
|
|
|
void ScummEngine::requestSave(int slot, const char *name) {
|
|
_saveLoadSlot = slot;
|
|
_saveTemporaryState = false;
|
|
_saveLoadFlag = 1; // 1 for save
|
|
assert(name);
|
|
strncpy(_saveLoadName, name, sizeof(_saveLoadName));
|
|
_saveLoadName[sizeof(_saveLoadName) - 1] = 0;
|
|
}
|
|
|
|
void ScummEngine::requestLoad(int slot) {
|
|
_saveLoadSlot = slot;
|
|
_saveTemporaryState = false;
|
|
_saveLoadFlag = 2; // 2 for load
|
|
}
|
|
|
|
static bool saveSaveGameHeader(Common::OutSaveFile *out, SaveGameHeader &hdr) {
|
|
hdr.type = MKID_BE('SCVM');
|
|
hdr.size = 0;
|
|
hdr.ver = CURRENT_VER;
|
|
|
|
out->writeUint32BE(hdr.type);
|
|
out->writeUint32LE(hdr.size);
|
|
out->writeUint32LE(hdr.ver);
|
|
out->write(hdr.name, sizeof(hdr.name));
|
|
return true;
|
|
}
|
|
|
|
bool ScummEngine::saveState(Common::OutSaveFile *out, bool writeHeader) {
|
|
SaveGameHeader hdr;
|
|
|
|
if (writeHeader) {
|
|
memcpy(hdr.name, _saveLoadName, sizeof(hdr.name));
|
|
saveSaveGameHeader(out, hdr);
|
|
}
|
|
#if !defined(__DS__) /* && !defined(__PLAYSTATION2__) */
|
|
Graphics::saveThumbnail(*out);
|
|
#endif
|
|
saveInfos(out);
|
|
|
|
Serializer ser(0, out, CURRENT_VER);
|
|
saveOrLoad(&ser);
|
|
return true;
|
|
}
|
|
|
|
bool ScummEngine::saveState(int slot, bool compat) {
|
|
bool saveFailed;
|
|
Common::String filename;
|
|
Common::OutSaveFile *out;
|
|
|
|
if (_saveLoadSlot == 255) {
|
|
// Allow custom filenames for save game system in HE Games
|
|
filename = _saveLoadFileName;
|
|
} else {
|
|
filename = makeSavegameName(slot, compat);
|
|
}
|
|
if (!(out = _saveFileMan->openForSaving(filename)))
|
|
return false;
|
|
|
|
saveFailed = false;
|
|
if (!saveState(out))
|
|
saveFailed = true;
|
|
|
|
out->finalize();
|
|
if (out->err())
|
|
saveFailed = true;
|
|
delete out;
|
|
|
|
if (saveFailed) {
|
|
debug(1, "State save as '%s' FAILED", filename.c_str());
|
|
return false;
|
|
}
|
|
debug(1, "State saved as '%s'", filename.c_str());
|
|
return true;
|
|
}
|
|
|
|
|
|
void ScummEngine_v4::prepareSavegame() {
|
|
Common::MemoryWriteStreamDynamic *memStream;
|
|
Common::WriteStream *writeStream;
|
|
|
|
// free memory of the last prepared savegame
|
|
delete _savePreparedSavegame;
|
|
_savePreparedSavegame = NULL;
|
|
|
|
// store headerless savegame in a compressed memory stream
|
|
memStream = new Common::MemoryWriteStreamDynamic();
|
|
writeStream = Common::wrapCompressedWriteStream(memStream);
|
|
if (saveState(writeStream, false)) {
|
|
// we have to finalize the compression-stream first, otherwise the internal
|
|
// memory-stream pointer will be zero (Important: flush() does not work here!).
|
|
writeStream->finalize();
|
|
if (!writeStream->err()) {
|
|
// wrap uncompressing MemoryReadStream around the savegame data
|
|
_savePreparedSavegame = Common::wrapCompressedReadStream(
|
|
new Common::MemoryReadStream(memStream->getData(), memStream->size(), true));
|
|
}
|
|
}
|
|
// free the CompressedWriteStream and MemoryWriteStreamDynamic
|
|
// but not the memory stream's internal buffer
|
|
delete writeStream;
|
|
}
|
|
|
|
bool ScummEngine_v4::savePreparedSavegame(int slot, char *desc) {
|
|
bool success;
|
|
Common::String filename;
|
|
Common::OutSaveFile *out;
|
|
SaveGameHeader hdr;
|
|
uint32 nread, nwritten;
|
|
|
|
out = 0;
|
|
success = true;
|
|
|
|
// check if savegame was successfully stored in memory
|
|
if (!_savePreparedSavegame)
|
|
success = false;
|
|
|
|
// open savegame file
|
|
if (success) {
|
|
filename = makeSavegameName(slot, false);
|
|
if (!(out = _saveFileMan->openForSaving(filename))) {
|
|
success = false;
|
|
}
|
|
}
|
|
|
|
// write header to file
|
|
if (success) {
|
|
memset(hdr.name, 0, sizeof(hdr.name));
|
|
strncpy(hdr.name, desc, sizeof(hdr.name)-1);
|
|
success = saveSaveGameHeader(out, hdr);
|
|
}
|
|
|
|
// copy savegame from memory-stream to file
|
|
if (success) {
|
|
_savePreparedSavegame->seek(0, SEEK_SET);
|
|
byte buffer[1024];
|
|
while ((nread = _savePreparedSavegame->read(buffer, sizeof(buffer)))) {
|
|
nwritten = out->write(buffer, nread);
|
|
if (nwritten < nread) {
|
|
success = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (out) {
|
|
out->finalize();
|
|
if (out->err())
|
|
success = false;
|
|
delete out;
|
|
}
|
|
|
|
if (!success) {
|
|
debug(1, "State save as '%s' FAILED", filename.c_str());
|
|
return false;
|
|
} else {
|
|
debug(1, "State saved as '%s'", filename.c_str());
|
|
return true;
|
|
}
|
|
}
|
|
|
|
static bool loadSaveGameHeader(Common::SeekableReadStream *in, SaveGameHeader &hdr) {
|
|
hdr.type = in->readUint32BE();
|
|
hdr.size = in->readUint32LE();
|
|
hdr.ver = in->readUint32LE();
|
|
in->read(hdr.name, sizeof(hdr.name));
|
|
return !in->err() && hdr.type == MKID_BE('SCVM');
|
|
}
|
|
|
|
bool ScummEngine::loadState(int slot, bool compat) {
|
|
Common::String filename;
|
|
Common::SeekableReadStream *in;
|
|
int i, j;
|
|
SaveGameHeader hdr;
|
|
int sb, sh;
|
|
|
|
if (_saveLoadSlot == 255) {
|
|
// Allow custom filenames for save game system in HE Games
|
|
filename = _saveLoadFileName;
|
|
} else {
|
|
filename = makeSavegameName(slot, compat);
|
|
}
|
|
if (!(in = _saveFileMan->openForLoading(filename)))
|
|
return false;
|
|
|
|
if (!loadSaveGameHeader(in, hdr)) {
|
|
warning("Invalid savegame '%s'", filename.c_str());
|
|
delete in;
|
|
return false;
|
|
}
|
|
|
|
// In older versions of ScummVM, the header version was not endian safe.
|
|
// We account for that by retrying once with swapped byte order in case
|
|
// we see a version that is higher than anything we'd expect...
|
|
if (hdr.ver > 0xFFFFFF)
|
|
hdr.ver = SWAP_BYTES_32(hdr.ver);
|
|
|
|
// Reject save games which are too old or too new. Note that
|
|
// We do not really support V7 games, but still accept them here
|
|
// to work around a bug from the stone age (see below for more
|
|
// information).
|
|
if (hdr.ver < VER(7) || hdr.ver > CURRENT_VER) {
|
|
warning("Invalid version of '%s'", filename.c_str());
|
|
delete in;
|
|
return false;
|
|
}
|
|
|
|
// We (deliberately) broke HE savegame compatibility at some point.
|
|
if (hdr.ver < VER(50) && _game.heversion >= 71) {
|
|
warning("Unsupported version of '%s'", filename.c_str());
|
|
delete in;
|
|
return false;
|
|
}
|
|
|
|
// Since version 52 a thumbnail is saved directly after the header.
|
|
if (hdr.ver >= VER(52)) {
|
|
// Prior to version 75 we always required an thumbnail to be present
|
|
if (hdr.ver <= VER(74)) {
|
|
if (!Graphics::checkThumbnailHeader(*in)) {
|
|
warning("Can not load thumbnail");
|
|
delete in;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
Graphics::skipThumbnailHeader(*in);
|
|
}
|
|
|
|
// Since version 56 we save additional information about the creation of
|
|
// the save game and the save time.
|
|
if (hdr.ver >= VER(56)) {
|
|
InfoStuff infos;
|
|
if (!loadInfos(in, &infos)) {
|
|
warning("Info section could not be found");
|
|
delete in;
|
|
return false;
|
|
}
|
|
|
|
_engineStartTime = _system->getMillis() / 1000 - infos.playtime;
|
|
} else {
|
|
// start time counting
|
|
_engineStartTime = _system->getMillis() / 1000;
|
|
}
|
|
|
|
// Due to a bug in scummvm up to and including 0.3.0, save games could be saved
|
|
// in the V8/V9 format but were tagged with a V7 mark. Ouch. So we just pretend V7 == V8 here
|
|
if (hdr.ver == VER(7))
|
|
hdr.ver = VER(8);
|
|
|
|
memcpy(_saveLoadName, hdr.name, sizeof(hdr.name));
|
|
|
|
// Unless specifically requested with _saveSound, we do not save the iMUSE
|
|
// state for temporary state saves - such as certain cutscenes in DOTT,
|
|
// FOA, Sam and Max, etc.
|
|
//
|
|
// Thus, we should probably not stop music when restoring from one of
|
|
// these saves. This change stops the Mole Man theme from going quiet in
|
|
// Sam & Max when Doug tells you about the Ball of Twine, as mentioned in
|
|
// patch #886058.
|
|
//
|
|
// If we don't have iMUSE at all we may as well stop the sounds. The previous
|
|
// default behavior here was to stopAllSounds on all state restores.
|
|
|
|
if (!_imuse || _saveSound || !_saveTemporaryState)
|
|
_sound->stopAllSounds();
|
|
|
|
#ifdef ENABLE_SCUMM_7_8
|
|
if (_imuseDigital) {
|
|
_imuseDigital->stopAllSounds();
|
|
_imuseDigital->resetState();
|
|
}
|
|
#endif
|
|
|
|
_sound->stopCD();
|
|
|
|
_sound->pauseSounds(true);
|
|
|
|
closeRoom();
|
|
|
|
memset(_inventory, 0, sizeof(_inventory[0]) * _numInventory);
|
|
memset(_newNames, 0, sizeof(_newNames[0]) * _numNewNames);
|
|
|
|
// Because old savegames won't fill the entire gfxUsageBits[] array,
|
|
// clear it here just to be sure it won't hold any unforseen garbage.
|
|
memset(gfxUsageBits, 0, sizeof(gfxUsageBits));
|
|
|
|
// Nuke all resources
|
|
for (i = rtFirst; i <= rtLast; i++)
|
|
if (i != rtTemp && i != rtBuffer && (i != rtSound || _saveSound || !compat))
|
|
for (j = 0; j < _res->num[i]; j++) {
|
|
_res->nukeResource(i, j);
|
|
}
|
|
|
|
resetScummVars();
|
|
|
|
if (_game.features & GF_OLD_BUNDLE)
|
|
loadCharset(0); // FIXME - HACK ?
|
|
|
|
//
|
|
// Now do the actual loading
|
|
//
|
|
Serializer ser(in, 0, hdr.ver);
|
|
saveOrLoad(&ser);
|
|
delete in;
|
|
|
|
// Update volume settings
|
|
syncSoundSettings();
|
|
|
|
// Init NES costume data
|
|
if (_game.platform == Common::kPlatformNES) {
|
|
if (hdr.ver < VER(47))
|
|
_NESCostumeSet = 0;
|
|
NES_loadCostumeSet(_NESCostumeSet);
|
|
}
|
|
|
|
// Normally, _vm->_screenTop should always be >= 0, but for some old save games
|
|
// it is not, hence we check & correct it here.
|
|
if (_screenTop < 0)
|
|
_screenTop = 0;
|
|
|
|
// WORKAROUND bug #795214: For unknown reasons, object 819 sometimes is in
|
|
// state 1 in old save games, implying it should be drawn. This in turn
|
|
// results in a crash when entering the church, as object 819 is part of the
|
|
// exitof the church and there are no graphics assigned to it.
|
|
if (_game.id == GID_MONKEY_VGA) {
|
|
putState(819, 0);
|
|
}
|
|
|
|
if (hdr.ver < VER(33) && _game.version >= 7) {
|
|
// For a long time, we didn't set these vars to default values.
|
|
VAR(VAR_DEFAULT_TALK_DELAY) = 60;
|
|
if (_game.version == 7)
|
|
VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1;
|
|
}
|
|
|
|
if (hdr.ver < VER(30)) {
|
|
// For a long time, we used incorrect location, causing it to default to zero.
|
|
if (_game.version == 8)
|
|
_scummVars[VAR_CHARINC] = (_game.features & GF_DEMO) ? 3 : 1;
|
|
// Needed due to subtitle speed changes
|
|
_defaultTalkDelay /= 20;
|
|
}
|
|
|
|
// For a long time, we used incorrect locations for some camera related
|
|
// scumm vars. We now know the proper locations. To be able to properly use
|
|
// old save games, we update the old (bad) variables to the new (correct)
|
|
// ones.
|
|
if (hdr.ver < VER(28) && _game.version == 8) {
|
|
_scummVars[VAR_CAMERA_MIN_X] = _scummVars[101];
|
|
_scummVars[VAR_CAMERA_MAX_X] = _scummVars[102];
|
|
_scummVars[VAR_CAMERA_MIN_Y] = _scummVars[103];
|
|
_scummVars[VAR_CAMERA_MAX_Y] = _scummVars[104];
|
|
_scummVars[VAR_CAMERA_THRESHOLD_X] = _scummVars[105];
|
|
_scummVars[VAR_CAMERA_THRESHOLD_Y] = _scummVars[106];
|
|
_scummVars[VAR_CAMERA_SPEED_X] = _scummVars[107];
|
|
_scummVars[VAR_CAMERA_SPEED_Y] = _scummVars[108];
|
|
_scummVars[VAR_CAMERA_ACCEL_X] = _scummVars[109];
|
|
_scummVars[VAR_CAMERA_ACCEL_Y] = _scummVars[110];
|
|
}
|
|
|
|
// For a long time, we used incorrect values for some camera related
|
|
// scumm vars. We now know the proper values. To be able to properly use
|
|
// old save games, we update the old (bad) values to the new (correct)
|
|
// ones.
|
|
if (hdr.ver < VER(77) && _game.version >= 7) {
|
|
_scummVars[VAR_CAMERA_THRESHOLD_X] = 100;
|
|
_scummVars[VAR_CAMERA_THRESHOLD_Y] = 70;
|
|
_scummVars[VAR_CAMERA_ACCEL_X] = 100;
|
|
_scummVars[VAR_CAMERA_ACCEL_Y] = 100;
|
|
}
|
|
|
|
// With version 22, we replaced the scale items with scale slots. So when
|
|
// loading such an old save game, try to upgrade the old to new format.
|
|
if (hdr.ver < VER(22)) {
|
|
// Convert all rtScaleTable resources to matching scale items
|
|
for (i = 1; i < _res->num[rtScaleTable]; i++) {
|
|
convertScaleTableToScaleSlot(i);
|
|
}
|
|
}
|
|
|
|
// Reset the palette.
|
|
resetPalette();
|
|
|
|
if (hdr.ver < VER(35) && _game.id == GID_MANIAC && _game.version <= 1)
|
|
resetV1ActorTalkColor();
|
|
|
|
// Load the static room data
|
|
setupRoomSubBlocks();
|
|
|
|
if (_game.version < 7) {
|
|
camera._last.x = camera._cur.x;
|
|
}
|
|
|
|
sb = _screenB;
|
|
sh = _screenH;
|
|
|
|
// Restore the virtual screens and force a fade to black.
|
|
initScreens(0, _screenHeight);
|
|
|
|
VirtScreen *vs = &_virtscr[kMainVirtScreen];
|
|
memset(vs->getPixels(0, 0), 0, vs->pitch * vs->h);
|
|
vs->setDirtyRange(0, vs->h);
|
|
updateDirtyScreen(kMainVirtScreen);
|
|
updatePalette();
|
|
initScreens(sb, sh);
|
|
|
|
_completeScreenRedraw = true;
|
|
|
|
// Reset charset mask
|
|
_charset->_hasMask = false;
|
|
clearTextSurface();
|
|
|
|
_lastCodePtr = NULL;
|
|
_drawObjectQueNr = 0;
|
|
_verbMouseOver = 0;
|
|
|
|
cameraMoved();
|
|
|
|
initBGBuffers(_roomHeight);
|
|
|
|
if (VAR_ROOM_FLAG != 0xFF)
|
|
VAR(VAR_ROOM_FLAG) = 1;
|
|
|
|
// Sync with current config setting
|
|
if (VAR_VOICE_MODE != 0xFF)
|
|
VAR(VAR_VOICE_MODE) = ConfMan.getBool("subtitles");
|
|
|
|
debug(1, "State loaded from '%s'", filename.c_str());
|
|
|
|
_sound->pauseSounds(false);
|
|
|
|
// WORKAROUND: Original save/load script ran this script
|
|
// after game load, and o2_loadRoomWithEgo() does as well
|
|
// this script starts character-dependent music
|
|
//
|
|
// Fixes bug #1766072: MANIACNES: Music Doesn't Start On Load Game
|
|
if (_game.platform == Common::kPlatformNES) {
|
|
runScript(5, 0, 0, 0);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
Common::String ScummEngine::makeSavegameName(const Common::String &target, int slot, bool temporary) {
|
|
char extension[6];
|
|
snprintf(extension, sizeof(extension), ".%c%02d", temporary ? 'c' : 's', slot);
|
|
return (target + extension);
|
|
}
|
|
|
|
void ScummEngine::listSavegames(bool *marks, int num) {
|
|
assert(marks);
|
|
|
|
char slot[3];
|
|
int slotNum;
|
|
Common::StringList files;
|
|
|
|
Common::String prefix = makeSavegameName(99, false);
|
|
prefix.setChar('*', prefix.size()-2);
|
|
prefix.setChar(0, prefix.size()-1);
|
|
memset(marks, false, num * sizeof(bool)); //assume no savegames for this title
|
|
files = _saveFileMan->listSavefiles(prefix);
|
|
|
|
for (Common::StringList::const_iterator file = files.begin(); file != files.end(); ++file) {
|
|
//Obtain the last 2 digits of the filename, since they correspond to the save slot
|
|
slot[0] = file->c_str()[file->size()-2];
|
|
slot[1] = file->c_str()[file->size()-1];
|
|
slot[2] = 0;
|
|
|
|
slotNum = atoi(slot);
|
|
if (slotNum >= 0 && slotNum < num)
|
|
marks[slotNum] = true; //mark this slot as valid
|
|
}
|
|
}
|
|
|
|
bool getSavegameName(Common::InSaveFile *in, Common::String &desc, int heversion);
|
|
|
|
bool ScummEngine::getSavegameName(int slot, Common::String &desc) {
|
|
Common::InSaveFile *in = 0;
|
|
bool result = false;
|
|
|
|
desc.clear();
|
|
Common::String filename = makeSavegameName(slot, false);
|
|
in = _saveFileMan->openForLoading(filename);
|
|
if (in) {
|
|
result = Scumm::getSavegameName(in, desc, _game.heversion);
|
|
delete in;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
bool getSavegameName(Common::InSaveFile *in, Common::String &desc, int heversion) {
|
|
SaveGameHeader hdr;
|
|
|
|
if (!loadSaveGameHeader(in, hdr)) {
|
|
desc = "Invalid savegame";
|
|
return false;
|
|
}
|
|
|
|
if (hdr.ver > CURRENT_VER)
|
|
hdr.ver = TO_LE_32(hdr.ver);
|
|
if (hdr.ver < VER(7) || hdr.ver > CURRENT_VER) {
|
|
desc = "Invalid version";
|
|
return false;
|
|
}
|
|
|
|
// We (deliberately) broke HE savegame compatibility at some point.
|
|
if (hdr.ver < VER(57) && heversion >= 60) {
|
|
desc = "Unsupported version";
|
|
return false;
|
|
}
|
|
|
|
hdr.name[sizeof(hdr.name) - 1] = 0;
|
|
desc = hdr.name;
|
|
return true;
|
|
}
|
|
|
|
Graphics::Surface *ScummEngine::loadThumbnailFromSlot(const char *target, int slot) {
|
|
Common::SeekableReadStream *in;
|
|
SaveGameHeader hdr;
|
|
|
|
if (slot < 0)
|
|
return 0;
|
|
|
|
Common::String filename = ScummEngine::makeSavegameName(target, slot, false);
|
|
if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
|
|
return 0;
|
|
}
|
|
|
|
if (!loadSaveGameHeader(in, hdr)) {
|
|
delete in;
|
|
return 0;
|
|
}
|
|
|
|
if (hdr.ver > CURRENT_VER)
|
|
hdr.ver = TO_LE_32(hdr.ver);
|
|
if (hdr.ver < VER(52)) {
|
|
delete in;
|
|
return 0;
|
|
}
|
|
|
|
Graphics::Surface *thumb = 0;
|
|
if (Graphics::checkThumbnailHeader(*in)) {
|
|
thumb = new Graphics::Surface();
|
|
assert(thumb);
|
|
if (!Graphics::loadThumbnail(*in, *thumb)) {
|
|
delete thumb;
|
|
thumb = 0;
|
|
}
|
|
}
|
|
|
|
delete in;
|
|
return thumb;
|
|
}
|
|
|
|
bool ScummEngine::loadInfosFromSlot(const char *target, int slot, InfoStuff *stuff) {
|
|
Common::SeekableReadStream *in;
|
|
SaveGameHeader hdr;
|
|
|
|
if (slot < 0)
|
|
return 0;
|
|
|
|
Common::String filename = makeSavegameName(target, slot, false);
|
|
if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
|
|
return false;
|
|
}
|
|
|
|
if (!loadSaveGameHeader(in, hdr)) {
|
|
delete in;
|
|
return false;
|
|
}
|
|
|
|
if (hdr.ver > CURRENT_VER)
|
|
hdr.ver = TO_LE_32(hdr.ver);
|
|
if (hdr.ver < VER(56)) {
|
|
delete in;
|
|
return false;
|
|
}
|
|
|
|
if (!Graphics::skipThumbnailHeader(*in)) {
|
|
delete in;
|
|
return false;
|
|
}
|
|
|
|
if (!loadInfos(in, stuff)) {
|
|
delete in;
|
|
return false;
|
|
}
|
|
|
|
delete in;
|
|
return true;
|
|
}
|
|
|
|
bool ScummEngine::loadInfos(Common::SeekableReadStream *file, InfoStuff *stuff) {
|
|
memset(stuff, 0, sizeof(InfoStuff));
|
|
|
|
SaveInfoSection section;
|
|
section.type = file->readUint32BE();
|
|
if (section.type != MKID_BE('INFO')) {
|
|
return false;
|
|
}
|
|
|
|
section.version = file->readUint32BE();
|
|
section.size = file->readUint32BE();
|
|
|
|
// If we ever extend this we should add a table containing the sizes corresponding to each
|
|
// version, so that we are able to properly verify their correctness.
|
|
if (section.version == INFOSECTION_VERSION && section.size != SaveInfoSectionSize) {
|
|
warning("Info section is corrupt");
|
|
file->skip(section.size);
|
|
return false;
|
|
}
|
|
|
|
section.timeTValue = file->readUint32BE();
|
|
section.playtime = file->readUint32BE();
|
|
|
|
// For header version 1, we load the data in with our old method
|
|
if (section.version == 1) {
|
|
//time_t tmp = section.timeTValue;
|
|
//tm *curTime = localtime(&tmp);
|
|
//stuff->date = (curTime->tm_mday & 0xFF) << 24 | ((curTime->tm_mon + 1) & 0xFF) << 16 | (curTime->tm_year + 1900) & 0xFFFF;
|
|
//stuff->time = (curTime->tm_hour & 0xFF) << 8 | (curTime->tm_min) & 0xFF;
|
|
stuff->date = 0;
|
|
stuff->time = 0;
|
|
}
|
|
|
|
if (section.version >= 2) {
|
|
section.date = file->readUint32BE();
|
|
section.time = file->readUint16BE();
|
|
|
|
stuff->date = section.date;
|
|
stuff->time = section.time;
|
|
}
|
|
|
|
stuff->playtime = section.playtime;
|
|
|
|
// Skip over the remaining (unsupported) data
|
|
if (section.size > SaveInfoSectionSize)
|
|
file->skip(section.size - SaveInfoSectionSize);
|
|
|
|
return true;
|
|
}
|
|
|
|
void ScummEngine::saveInfos(Common::WriteStream* file) {
|
|
SaveInfoSection section;
|
|
section.type = MKID_BE('INFO');
|
|
section.version = INFOSECTION_VERSION;
|
|
section.size = SaveInfoSectionSize;
|
|
|
|
// still save old format for older versions
|
|
section.timeTValue = time(0);
|
|
section.playtime = _system->getMillis() / 1000 - _engineStartTime;
|
|
|
|
tm curTime;
|
|
_system->getTimeAndDate(curTime);
|
|
|
|
section.date = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
|
|
section.time = ((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF);
|
|
|
|
file->writeUint32BE(section.type);
|
|
file->writeUint32BE(section.version);
|
|
file->writeUint32BE(section.size);
|
|
file->writeUint32BE(section.timeTValue);
|
|
file->writeUint32BE(section.playtime);
|
|
file->writeUint32BE(section.date);
|
|
file->writeUint16BE(section.time);
|
|
}
|
|
|
|
void ScummEngine::saveOrLoad(Serializer *s) {
|
|
const SaveLoadEntry objectEntries[] = {
|
|
MKLINE(ObjectData, OBIMoffset, sleUint32, VER(8)),
|
|
MKLINE(ObjectData, OBCDoffset, sleUint32, VER(8)),
|
|
MKLINE(ObjectData, walk_x, sleUint16, VER(8)),
|
|
MKLINE(ObjectData, walk_y, sleUint16, VER(8)),
|
|
MKLINE(ObjectData, obj_nr, sleUint16, VER(8)),
|
|
MKLINE(ObjectData, x_pos, sleInt16, VER(8)),
|
|
MKLINE(ObjectData, y_pos, sleInt16, VER(8)),
|
|
MKLINE(ObjectData, width, sleUint16, VER(8)),
|
|
MKLINE(ObjectData, height, sleUint16, VER(8)),
|
|
MKLINE(ObjectData, actordir, sleByte, VER(8)),
|
|
MKLINE(ObjectData, parentstate, sleByte, VER(8)),
|
|
MKLINE(ObjectData, parent, sleByte, VER(8)),
|
|
MKLINE(ObjectData, state, sleByte, VER(8)),
|
|
MKLINE(ObjectData, fl_object_index, sleByte, VER(8)),
|
|
MKLINE(ObjectData, flags, sleByte, VER(46)),
|
|
MKEND()
|
|
};
|
|
|
|
const SaveLoadEntry verbEntries[] = {
|
|
MKLINE(VerbSlot, curRect.left, sleInt16, VER(8)),
|
|
MKLINE(VerbSlot, curRect.top, sleInt16, VER(8)),
|
|
MKLINE(VerbSlot, curRect.right, sleInt16, VER(8)),
|
|
MKLINE(VerbSlot, curRect.bottom, sleInt16, VER(8)),
|
|
MKLINE(VerbSlot, oldRect.left, sleInt16, VER(8)),
|
|
MKLINE(VerbSlot, oldRect.top, sleInt16, VER(8)),
|
|
MKLINE(VerbSlot, oldRect.right, sleInt16, VER(8)),
|
|
MKLINE(VerbSlot, oldRect.bottom, sleInt16, VER(8)),
|
|
|
|
MKLINE_OLD(VerbSlot, verbid, sleByte, VER(8), VER(11)),
|
|
MKLINE(VerbSlot, verbid, sleInt16, VER(12)),
|
|
|
|
MKLINE(VerbSlot, color, sleByte, VER(8)),
|
|
MKLINE(VerbSlot, hicolor, sleByte, VER(8)),
|
|
MKLINE(VerbSlot, dimcolor, sleByte, VER(8)),
|
|
MKLINE(VerbSlot, bkcolor, sleByte, VER(8)),
|
|
MKLINE(VerbSlot, type, sleByte, VER(8)),
|
|
MKLINE(VerbSlot, charset_nr, sleByte, VER(8)),
|
|
MKLINE(VerbSlot, curmode, sleByte, VER(8)),
|
|
MKLINE(VerbSlot, saveid, sleByte, VER(8)),
|
|
MKLINE(VerbSlot, key, sleByte, VER(8)),
|
|
MKLINE(VerbSlot, center, sleByte, VER(8)),
|
|
MKLINE(VerbSlot, prep, sleByte, VER(8)),
|
|
MKLINE(VerbSlot, imgindex, sleUint16, VER(8)),
|
|
MKEND()
|
|
};
|
|
|
|
const SaveLoadEntry mainEntries[] = {
|
|
MKARRAY(ScummEngine, _gameMD5[0], sleUint8, 16, VER(39)),
|
|
MK_OBSOLETE(ScummEngine, _roomWidth, sleUint16, VER(8), VER(50)),
|
|
MK_OBSOLETE(ScummEngine, _roomHeight, sleUint16, VER(8), VER(50)),
|
|
MK_OBSOLETE(ScummEngine, _ENCD_offs, sleUint32, VER(8), VER(50)),
|
|
MK_OBSOLETE(ScummEngine, _EXCD_offs, sleUint32, VER(8), VER(50)),
|
|
MK_OBSOLETE(ScummEngine, _IM00_offs, sleUint32, VER(8), VER(50)),
|
|
MK_OBSOLETE(ScummEngine, _CLUT_offs, sleUint32, VER(8), VER(50)),
|
|
MK_OBSOLETE(ScummEngine, _EPAL_offs, sleUint32, VER(8), VER(9)),
|
|
MK_OBSOLETE(ScummEngine, _PALS_offs, sleUint32, VER(8), VER(50)),
|
|
MKLINE(ScummEngine, _curPalIndex, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, _currentRoom, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, _roomResource, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, _numObjectsInRoom, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, _currentScript, sleByte, VER(8)),
|
|
MK_OBSOLETE_ARRAY(ScummEngine, _localScriptOffsets[0], sleUint32, _numLocalScripts, VER(8), VER(50)),
|
|
|
|
|
|
// vm.localvar grew from 25 to 40 script entries and then from
|
|
// 16 to 32 bit variables (but that wasn't reflect here)... and
|
|
// THEN from 16 to 25 variables.
|
|
MKARRAY2_OLD(ScummEngine, vm.localvar[0][0], sleUint16, 17, 25, (byte*)vm.localvar[1] - (byte*)vm.localvar[0], VER(8), VER(8)),
|
|
MKARRAY2_OLD(ScummEngine, vm.localvar[0][0], sleUint16, 17, 40, (byte*)vm.localvar[1] - (byte*)vm.localvar[0], VER(9), VER(14)),
|
|
|
|
// We used to save 25 * 40 = 1000 blocks; but actually, each 'row consisted of 26 entry,
|
|
// i.e. 26 * 40 = 1040. Thus the last 40 blocks of localvar where not saved at all. To be
|
|
// able to load this screwed format, we use a trick: We load 26 * 38 = 988 blocks.
|
|
// Then, we mark the followin 12 blocks (24 bytes) as obsolete.
|
|
MKARRAY2_OLD(ScummEngine, vm.localvar[0][0], sleUint16, 26, 38, (byte*)vm.localvar[1] - (byte*)vm.localvar[0], VER(15), VER(17)),
|
|
MK_OBSOLETE_ARRAY(ScummEngine, vm.localvar[39][0], sleUint16, 12, VER(15), VER(17)),
|
|
|
|
// This was the first proper multi dimensional version of the localvars, with 32 bit values
|
|
MKARRAY2_OLD(ScummEngine, vm.localvar[0][0], sleUint32, 26, 40, (byte*)vm.localvar[1] - (byte*)vm.localvar[0], VER(18), VER(19)),
|
|
|
|
// Then we doubled the script slots again, from 40 to 80
|
|
MKARRAY2(ScummEngine, vm.localvar[0][0], sleUint32, 26, NUM_SCRIPT_SLOT, (byte*)vm.localvar[1] - (byte*)vm.localvar[0], VER(20)),
|
|
|
|
|
|
MKARRAY(ScummEngine, _resourceMapper[0], sleByte, 128, VER(8)),
|
|
MKARRAY(ScummEngine, _charsetColorMap[0], sleByte, 16, VER(8)),
|
|
|
|
// _charsetData grew from 10*16, to 15*16, to 23*16 bytes
|
|
MKARRAY_OLD(ScummEngine, _charsetData[0][0], sleByte, 10 * 16, VER(8), VER(9)),
|
|
MKARRAY_OLD(ScummEngine, _charsetData[0][0], sleByte, 15 * 16, VER(10), VER(66)),
|
|
MKARRAY(ScummEngine, _charsetData[0][0], sleByte, 23 * 16, VER(67)),
|
|
|
|
MK_OBSOLETE(ScummEngine, _curExecScript, sleUint16, VER(8), VER(62)),
|
|
|
|
MKLINE(ScummEngine, camera._dest.x, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, camera._dest.y, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, camera._cur.x, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, camera._cur.y, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, camera._last.x, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, camera._last.y, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, camera._accel.x, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, camera._accel.y, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, _screenStartStrip, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, _screenEndStrip, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, camera._mode, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, camera._follows, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, camera._leftTrigger, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, camera._rightTrigger, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, camera._movingToActor, sleUint16, VER(8)),
|
|
|
|
MKLINE(ScummEngine, _actorToPrintStrFor, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, _charsetColor, sleByte, VER(8)),
|
|
|
|
// _charsetBufPos was changed from byte to int
|
|
MKLINE_OLD(ScummEngine, _charsetBufPos, sleByte, VER(8), VER(9)),
|
|
MKLINE(ScummEngine, _charsetBufPos, sleInt16, VER(10)),
|
|
|
|
MKLINE(ScummEngine, _haveMsg, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, _haveActorSpeechMsg, sleByte, VER(61)),
|
|
MKLINE(ScummEngine, _useTalkAnims, sleByte, VER(8)),
|
|
|
|
MKLINE(ScummEngine, _talkDelay, sleInt16, VER(8)),
|
|
MKLINE(ScummEngine, _defaultTalkDelay, sleInt16, VER(8)),
|
|
MK_OBSOLETE(ScummEngine, _numInMsgStack, sleInt16, VER(8), VER(27)),
|
|
MKLINE(ScummEngine, _sentenceNum, sleByte, VER(8)),
|
|
|
|
MKLINE(ScummEngine, vm.cutSceneStackPointer, sleByte, VER(8)),
|
|
MKARRAY(ScummEngine, vm.cutScenePtr[0], sleUint32, 5, VER(8)),
|
|
MKARRAY(ScummEngine, vm.cutSceneScript[0], sleByte, 5, VER(8)),
|
|
MKARRAY(ScummEngine, vm.cutSceneData[0], sleInt16, 5, VER(8)),
|
|
MKLINE(ScummEngine, vm.cutSceneScriptIndex, sleInt16, VER(8)),
|
|
|
|
MKLINE(ScummEngine, vm.numNestedScripts, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, _userPut, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, _userState, sleUint16, VER(17)),
|
|
MKLINE(ScummEngine, _cursor.state, sleByte, VER(8)),
|
|
MK_OBSOLETE(ScummEngine, _gdi->_cursorActive, sleByte, VER(8), VER(20)),
|
|
MKLINE(ScummEngine, _currentCursor, sleByte, VER(8)),
|
|
MKARRAY(ScummEngine, _grabbedCursor[0], sleByte, 8192, VER(20)),
|
|
MKLINE(ScummEngine, _cursor.width, sleInt16, VER(20)),
|
|
MKLINE(ScummEngine, _cursor.height, sleInt16, VER(20)),
|
|
MKLINE(ScummEngine, _cursor.hotspotX, sleInt16, VER(20)),
|
|
MKLINE(ScummEngine, _cursor.hotspotY, sleInt16, VER(20)),
|
|
MKLINE(ScummEngine, _cursor.animate, sleByte, VER(20)),
|
|
MKLINE(ScummEngine, _cursor.animateIndex, sleByte, VER(20)),
|
|
MKLINE(ScummEngine, _mouse.x, sleInt16, VER(20)),
|
|
MKLINE(ScummEngine, _mouse.y, sleInt16, VER(20)),
|
|
|
|
MKARRAY(ScummEngine, _colorUsedByCycle[0], sleByte, 256, VER(60)),
|
|
MKLINE(ScummEngine, _doEffect, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, _switchRoomEffect, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, _newEffect, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, _switchRoomEffect2, sleByte, VER(8)),
|
|
MKLINE(ScummEngine, _bgNeedsRedraw, sleByte, VER(8)),
|
|
|
|
// The state of palManipulate is stored only since V10
|
|
MKLINE(ScummEngine, _palManipStart, sleByte, VER(10)),
|
|
MKLINE(ScummEngine, _palManipEnd, sleByte, VER(10)),
|
|
MKLINE(ScummEngine, _palManipCounter, sleUint16, VER(10)),
|
|
|
|
// gfxUsageBits grew from 200 to 410 entries. Then 3 * 410 entries:
|
|
MKARRAY_OLD(ScummEngine, gfxUsageBits[0], sleUint32, 200, VER(8), VER(9)),
|
|
MKARRAY_OLD(ScummEngine, gfxUsageBits[0], sleUint32, 410, VER(10), VER(13)),
|
|
MKARRAY(ScummEngine, gfxUsageBits[0], sleUint32, 3 * 410, VER(14)),
|
|
|
|
MK_OBSOLETE(ScummEngine, _gdi->_transparentColor, sleByte, VER(8), VER(50)),
|
|
MKARRAY(ScummEngine, _currentPalette[0], sleByte, 768, VER(8)),
|
|
MKARRAY(ScummEngine, _darkenPalette[0], sleByte, 768, VER(53)),
|
|
|
|
// Sam & Max specific palette replaced by _shadowPalette now.
|
|
MK_OBSOLETE_ARRAY(ScummEngine, _proc_special_palette[0], sleByte, 256, VER(8), VER(33)),
|
|
|
|
MKARRAY(ScummEngine, _charsetBuffer[0], sleByte, 256, VER(8)),
|
|
|
|
MKLINE(ScummEngine, _egoPositioned, sleByte, VER(8)),
|
|
|
|
// _gdi->_imgBufOffs grew from 4 to 5 entries. Then one day we realized
|
|
// that we don't have to store it since initBGBuffers() recomputes it.
|
|
MK_OBSOLETE_ARRAY(ScummEngine, _gdi->_imgBufOffs[0], sleUint16, 4, VER(8), VER(9)),
|
|
MK_OBSOLETE_ARRAY(ScummEngine, _gdi->_imgBufOffs[0], sleUint16, 5, VER(10), VER(26)),
|
|
|
|
// See _imgBufOffs: _numZBuffer is recomputed by initBGBuffers().
|
|
MK_OBSOLETE(ScummEngine, _gdi->_numZBuffer, sleByte, VER(8), VER(26)),
|
|
|
|
MKLINE(ScummEngine, _screenEffectFlag, sleByte, VER(8)),
|
|
|
|
MK_OBSOLETE(ScummEngine, _randSeed1, sleUint32, VER(8), VER(9)),
|
|
MK_OBSOLETE(ScummEngine, _randSeed2, sleUint32, VER(8), VER(9)),
|
|
|
|
// Converted _shakeEnabled to boolean and added a _shakeFrame field.
|
|
MKLINE_OLD(ScummEngine, _shakeEnabled, sleInt16, VER(8), VER(9)),
|
|
MKLINE(ScummEngine, _shakeEnabled, sleByte, VER(10)),
|
|
MKLINE(ScummEngine, _shakeFrame, sleUint32, VER(10)),
|
|
|
|
MKLINE(ScummEngine, _keepText, sleByte, VER(8)),
|
|
|
|
MKLINE(ScummEngine, _screenB, sleUint16, VER(8)),
|
|
MKLINE(ScummEngine, _screenH, sleUint16, VER(8)),
|
|
|
|
MKLINE(ScummEngine, _NESCostumeSet, sleUint16, VER(47)),
|
|
|
|
MK_OBSOLETE(ScummEngine, _cd_track, sleInt16, VER(9), VER(9)),
|
|
MK_OBSOLETE(ScummEngine, _cd_loops, sleInt16, VER(9), VER(9)),
|
|
MK_OBSOLETE(ScummEngine, _cd_frame, sleInt16, VER(9), VER(9)),
|
|
MK_OBSOLETE(ScummEngine, _cd_end, sleInt16, VER(9), VER(9)),
|
|
|
|
MKEND()
|
|
};
|
|
|
|
const SaveLoadEntry scriptSlotEntries[] = {
|
|
MKLINE(ScriptSlot, offs, sleUint32, VER(8)),
|
|
MKLINE(ScriptSlot, delay, sleInt32, VER(8)),
|
|
MKLINE(ScriptSlot, number, sleUint16, VER(8)),
|
|
MKLINE(ScriptSlot, delayFrameCount, sleUint16, VER(8)),
|
|
MKLINE(ScriptSlot, status, sleByte, VER(8)),
|
|
MKLINE(ScriptSlot, where, sleByte, VER(8)),
|
|
MKLINE(ScriptSlot, freezeResistant, sleByte, VER(8)),
|
|
MKLINE(ScriptSlot, recursive, sleByte, VER(8)),
|
|
MKLINE(ScriptSlot, freezeCount, sleByte, VER(8)),
|
|
MKLINE(ScriptSlot, didexec, sleByte, VER(8)),
|
|
MKLINE(ScriptSlot, cutsceneOverride, sleByte, VER(8)),
|
|
MKLINE(ScriptSlot, cycle, sleByte, VER(46)),
|
|
MK_OBSOLETE(ScriptSlot, unk5, sleByte, VER(8), VER(10)),
|
|
MKEND()
|
|
};
|
|
|
|
const SaveLoadEntry nestedScriptEntries[] = {
|
|
MKLINE(NestedScript, number, sleUint16, VER(8)),
|
|
MKLINE(NestedScript, where, sleByte, VER(8)),
|
|
MKLINE(NestedScript, slot, sleByte, VER(8)),
|
|
MKEND()
|
|
};
|
|
|
|
const SaveLoadEntry sentenceTabEntries[] = {
|
|
MKLINE(SentenceTab, verb, sleUint8, VER(8)),
|
|
MKLINE(SentenceTab, preposition, sleUint8, VER(8)),
|
|
MKLINE(SentenceTab, objectA, sleUint16, VER(8)),
|
|
MKLINE(SentenceTab, objectB, sleUint16, VER(8)),
|
|
MKLINE(SentenceTab, freezeCount, sleUint8, VER(8)),
|
|
MKEND()
|
|
};
|
|
|
|
const SaveLoadEntry stringTabEntries[] = {
|
|
// Then _default/restore of a StringTab entry becomes a one liner.
|
|
MKLINE(StringTab, xpos, sleInt16, VER(8)),
|
|
MKLINE(StringTab, _default.xpos, sleInt16, VER(8)),
|
|
MKLINE(StringTab, ypos, sleInt16, VER(8)),
|
|
MKLINE(StringTab, _default.ypos, sleInt16, VER(8)),
|
|
MKLINE(StringTab, right, sleInt16, VER(8)),
|
|
MKLINE(StringTab, _default.right, sleInt16, VER(8)),
|
|
MKLINE(StringTab, color, sleInt8, VER(8)),
|
|
MKLINE(StringTab, _default.color, sleInt8, VER(8)),
|
|
MKLINE(StringTab, charset, sleInt8, VER(8)),
|
|
MKLINE(StringTab, _default.charset, sleInt8, VER(8)),
|
|
MKLINE(StringTab, center, sleByte, VER(8)),
|
|
MKLINE(StringTab, _default.center, sleByte, VER(8)),
|
|
MKLINE(StringTab, overhead, sleByte, VER(8)),
|
|
MKLINE(StringTab, _default.overhead, sleByte, VER(8)),
|
|
MKLINE(StringTab, no_talk_anim, sleByte, VER(8)),
|
|
MKLINE(StringTab, _default.no_talk_anim, sleByte, VER(8)),
|
|
MKLINE(StringTab, wrapping, sleByte, VER(71)),
|
|
MKLINE(StringTab, _default.wrapping, sleByte, VER(71)),
|
|
MKEND()
|
|
};
|
|
|
|
const SaveLoadEntry colorCycleEntries[] = {
|
|
MKLINE(ColorCycle, delay, sleUint16, VER(8)),
|
|
MKLINE(ColorCycle, counter, sleUint16, VER(8)),
|
|
MKLINE(ColorCycle, flags, sleUint16, VER(8)),
|
|
MKLINE(ColorCycle, start, sleByte, VER(8)),
|
|
MKLINE(ColorCycle, end, sleByte, VER(8)),
|
|
MKEND()
|
|
};
|
|
|
|
const SaveLoadEntry scaleSlotsEntries[] = {
|
|
MKLINE(ScaleSlot, x1, sleUint16, VER(13)),
|
|
MKLINE(ScaleSlot, y1, sleUint16, VER(13)),
|
|
MKLINE(ScaleSlot, scale1, sleUint16, VER(13)),
|
|
MKLINE(ScaleSlot, x2, sleUint16, VER(13)),
|
|
MKLINE(ScaleSlot, y2, sleUint16, VER(13)),
|
|
MKLINE(ScaleSlot, scale2, sleUint16, VER(13)),
|
|
MKEND()
|
|
};
|
|
|
|
// MSVC6 FIX (Jamieson630):
|
|
// MSVC6 has a problem with any notation that involves
|
|
// more than one set of double colons ::
|
|
// The following MKLINE macros expand to such things
|
|
// as AudioCDManager::Status::playing, and MSVC6 has
|
|
// a fit with that. This typedef simplifies the notation
|
|
// to something MSVC6 can grasp.
|
|
typedef Audio::AudioCDManager::Status AudioCDManager_Status;
|
|
const SaveLoadEntry audioCDEntries[] = {
|
|
MKLINE(AudioCDManager_Status, playing, sleUint32, VER(24)),
|
|
MKLINE(AudioCDManager_Status, track, sleInt32, VER(24)),
|
|
MKLINE(AudioCDManager_Status, start, sleUint32, VER(24)),
|
|
MKLINE(AudioCDManager_Status, duration, sleUint32, VER(24)),
|
|
MKLINE(AudioCDManager_Status, numLoops, sleInt32, VER(24)),
|
|
MKEND()
|
|
};
|
|
|
|
int i, j;
|
|
int var120Backup;
|
|
int var98Backup;
|
|
uint8 md5Backup[16];
|
|
|
|
// MD5 Operations: Backup on load, compare, and reset.
|
|
if (s->isLoading())
|
|
memcpy(md5Backup, _gameMD5, 16);
|
|
|
|
|
|
//
|
|
// Save/load main state (many members of class ScummEngine get saved here)
|
|
//
|
|
s->saveLoadEntries(this, mainEntries);
|
|
|
|
// MD5 Operations: Backup on load, compare, and reset.
|
|
if (s->isLoading()) {
|
|
char md5str1[32+1], md5str2[32+1];
|
|
for (j = 0; j < 16; j++) {
|
|
sprintf(md5str1 + j*2, "%02x", (int)_gameMD5[j]);
|
|
sprintf(md5str2 + j*2, "%02x", (int)md5Backup[j]);
|
|
}
|
|
|
|
debug(2, "Save version: %d", s->getVersion());
|
|
debug(2, "Saved game MD5: %s", (s->getVersion() >= 39) ? md5str1 : "unknown");
|
|
|
|
if (memcmp(md5Backup, _gameMD5, 16) != 0) {
|
|
warning("Game was saved with different gamedata - you may encounter problems");
|
|
debug(1, "You have %s and save is %s.", md5str2, md5str1);
|
|
memcpy(_gameMD5, md5Backup, 16);
|
|
}
|
|
}
|
|
|
|
|
|
// Starting V14, we extended the usage bits, to be able to cope with games
|
|
// that have more than 30 actors (up to 94 are supported now, in theory).
|
|
// Since the format of the usage bits was changed by this, we have to
|
|
// convert them when loading an older savegame.
|
|
if (s->isLoading() && s->getVersion() < VER(14))
|
|
upgradeGfxUsageBits();
|
|
|
|
// When loading, move the mouse to the saved mouse position.
|
|
if (s->isLoading() && s->getVersion() >= VER(20)) {
|
|
updateCursor();
|
|
_system->warpMouse(_mouse.x, _mouse.y);
|
|
}
|
|
|
|
// Before V61, we re-used the _haveMsg flag to handle "alternative" speech
|
|
// sound files (see charset code 10).
|
|
if (s->isLoading() && s->getVersion() < VER(61)) {
|
|
if (_haveMsg == 0xFE) {
|
|
_haveActorSpeechMsg = false;
|
|
_haveMsg = 0xFF;
|
|
} else {
|
|
_haveActorSpeechMsg = true;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Save/load actors
|
|
//
|
|
for (i = 0; i < _numActors; i++)
|
|
_actors[i]->saveLoadWithSerializer(s);
|
|
|
|
|
|
//
|
|
// Save/load sound data
|
|
//
|
|
_sound->saveLoadWithSerializer(s);
|
|
|
|
|
|
//
|
|
// Save/load script data
|
|
//
|
|
if (s->getVersion() < VER(9))
|
|
s->saveLoadArrayOf(vm.slot, 25, sizeof(vm.slot[0]), scriptSlotEntries);
|
|
else if (s->getVersion() < VER(20))
|
|
s->saveLoadArrayOf(vm.slot, 40, sizeof(vm.slot[0]), scriptSlotEntries);
|
|
else
|
|
s->saveLoadArrayOf(vm.slot, NUM_SCRIPT_SLOT, sizeof(vm.slot[0]), scriptSlotEntries);
|
|
|
|
if (s->getVersion() < VER(46)) {
|
|
// When loading an old savegame, make sure that the 'cycle'
|
|
// field is set to something sensible, otherwise the scripts
|
|
// that were running probably won't be.
|
|
|
|
for (i = 0; i < NUM_SCRIPT_SLOT; i++) {
|
|
vm.slot[i].cycle = 1;
|
|
}
|
|
}
|
|
|
|
|
|
//
|
|
// Save/load local objects
|
|
//
|
|
s->saveLoadArrayOf(_objs, _numLocalObjects, sizeof(_objs[0]), objectEntries);
|
|
if (s->isLoading() && s->getVersion() < VER(13)) {
|
|
// Since roughly v13 of the save games, the objs storage has changed a bit
|
|
for (i = _numObjectsInRoom; i < _numLocalObjects; i++) {
|
|
_objs[i].obj_nr = 0;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//
|
|
// Save/load misc stuff
|
|
//
|
|
s->saveLoadArrayOf(_verbs, _numVerbs, sizeof(_verbs[0]), verbEntries);
|
|
s->saveLoadArrayOf(vm.nest, 16, sizeof(vm.nest[0]), nestedScriptEntries);
|
|
s->saveLoadArrayOf(_sentence, 6, sizeof(_sentence[0]), sentenceTabEntries);
|
|
s->saveLoadArrayOf(_string, 6, sizeof(_string[0]), stringTabEntries);
|
|
s->saveLoadArrayOf(_colorCycle, 16, sizeof(_colorCycle[0]), colorCycleEntries);
|
|
if (s->getVersion() >= VER(13))
|
|
s->saveLoadArrayOf(_scaleSlots, 20, sizeof(_scaleSlots[0]), scaleSlotsEntries);
|
|
|
|
|
|
//
|
|
// Save/load resources
|
|
//
|
|
int type, idx;
|
|
if (s->getVersion() >= VER(26)) {
|
|
// New, more robust resource save/load system. This stores the type
|
|
// and index of each resource. Thus if we increase e.g. the maximum
|
|
// number of script resources, savegames won't break.
|
|
if (s->isSaving()) {
|
|
for (type = rtFirst; type <= rtLast; type++) {
|
|
if (_res->mode[type] != 1 && type != rtTemp && type != rtBuffer) {
|
|
s->saveUint16(type); // Save the res type...
|
|
for (idx = 0; idx < _res->num[type]; idx++) {
|
|
// Only save resources which actually exist...
|
|
if (_res->address[type][idx]) {
|
|
s->saveUint16(idx); // Save the index of the resource
|
|
saveResource(s, type, idx);
|
|
}
|
|
}
|
|
s->saveUint16(0xFFFF); // End marker
|
|
}
|
|
}
|
|
s->saveUint16(0xFFFF); // End marker
|
|
} else {
|
|
while ((type = s->loadUint16()) != 0xFFFF) {
|
|
while ((idx = s->loadUint16()) != 0xFFFF) {
|
|
assert(0 <= idx && idx < _res->num[type]);
|
|
loadResource(s, type, idx);
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
// Old, fragile resource save/load system. Doesn't save resources
|
|
// with index 0, and breaks whenever we change the limit on a given
|
|
// resource type.
|
|
for (type = rtFirst; type <= rtLast; type++)
|
|
if (_res->mode[type] != 1 && type != rtTemp && type != rtBuffer) {
|
|
// For V1-V5 games, there used to be no object name resources.
|
|
// At some point this changed. But since old savegames rely on
|
|
// unchanged resource counts, we have to hard code the following check
|
|
if (_game.version < 6 && type == rtObjectName)
|
|
continue;
|
|
for (idx = 1; idx < _res->num[type]; idx++)
|
|
saveLoadResource(s, type, idx);
|
|
}
|
|
}
|
|
|
|
|
|
//
|
|
// Save/load global object state
|
|
//
|
|
s->saveLoadArrayOf(_objectOwnerTable, _numGlobalObjects, sizeof(_objectOwnerTable[0]), sleByte);
|
|
s->saveLoadArrayOf(_objectStateTable, _numGlobalObjects, sizeof(_objectStateTable[0]), sleByte);
|
|
if (_objectRoomTable)
|
|
s->saveLoadArrayOf(_objectRoomTable, _numGlobalObjects, sizeof(_objectRoomTable[0]), sleByte);
|
|
|
|
|
|
//
|
|
// Save/load palette data
|
|
//
|
|
if (_shadowPaletteSize) {
|
|
s->saveLoadArrayOf(_shadowPalette, _shadowPaletteSize, 1, sleByte);
|
|
// _roomPalette didn't show up until V21 save games
|
|
if (s->getVersion() >= VER(21) && _game.version < 5)
|
|
s->saveLoadArrayOf(_roomPalette, sizeof(_roomPalette), 1, sleByte);
|
|
}
|
|
|
|
// PalManip data was not saved before V10 save games
|
|
if (s->getVersion() < VER(10))
|
|
_palManipCounter = 0;
|
|
if (_palManipCounter) {
|
|
if (!_palManipPalette)
|
|
_palManipPalette = (byte *)calloc(0x300, 1);
|
|
if (!_palManipIntermediatePal)
|
|
_palManipIntermediatePal = (byte *)calloc(0x600, 1);
|
|
s->saveLoadArrayOf(_palManipPalette, 0x300, 1, sleByte);
|
|
s->saveLoadArrayOf(_palManipIntermediatePal, 0x600, 1, sleByte);
|
|
}
|
|
|
|
// darkenPalette was not saved before V53
|
|
if (s->isLoading() && s->getVersion() < VER(53)) {
|
|
memcpy(_darkenPalette, _currentPalette, 768);
|
|
}
|
|
|
|
// _colorUsedByCycle was not saved before V60
|
|
if (s->isLoading() && s->getVersion() < VER(60)) {
|
|
memset(_colorUsedByCycle, 0, sizeof(_colorUsedByCycle));
|
|
}
|
|
|
|
//
|
|
// Save/load more global object state
|
|
//
|
|
s->saveLoadArrayOf(_classData, _numGlobalObjects, sizeof(_classData[0]), sleUint32);
|
|
|
|
|
|
//
|
|
// Save/load script variables
|
|
//
|
|
var120Backup = _scummVars[120];
|
|
var98Backup = _scummVars[98];
|
|
|
|
if (s->getVersion() > VER(37))
|
|
s->saveLoadArrayOf(_roomVars, _numRoomVariables, sizeof(_roomVars[0]), sleInt32);
|
|
|
|
// The variables grew from 16 to 32 bit.
|
|
if (s->getVersion() < VER(15))
|
|
s->saveLoadArrayOf(_scummVars, _numVariables, sizeof(_scummVars[0]), sleInt16);
|
|
else
|
|
s->saveLoadArrayOf(_scummVars, _numVariables, sizeof(_scummVars[0]), sleInt32);
|
|
|
|
if (_game.id == GID_TENTACLE) // Maybe misplaced, but that's the main idea
|
|
_scummVars[120] = var120Backup;
|
|
if (_game.id == GID_INDY4)
|
|
_scummVars[98] = var98Backup;
|
|
|
|
s->saveLoadArrayOf(_bitVars, _numBitVariables >> 3, 1, sleByte);
|
|
|
|
|
|
//
|
|
// Save/load a list of the locked objects
|
|
//
|
|
if (s->isSaving()) {
|
|
for (i = rtFirst; i <= rtLast; i++)
|
|
for (j = 1; j < _res->num[i]; j++) {
|
|
if (_res->isLocked(i, j)) {
|
|
s->saveByte(i);
|
|
s->saveUint16(j);
|
|
}
|
|
}
|
|
s->saveByte(0xFF);
|
|
} else {
|
|
while ((i = s->loadByte()) != 0xFF) {
|
|
j = s->loadUint16();
|
|
_res->lock(i, j);
|
|
}
|
|
}
|
|
|
|
|
|
//
|
|
// Save/load the Audio CD status
|
|
//
|
|
if (s->getVersion() >= VER(24)) {
|
|
Audio::AudioCDManager::Status info;
|
|
if (s->isSaving())
|
|
info = AudioCD.getStatus();
|
|
s->saveLoadArrayOf(&info, 1, sizeof(info), audioCDEntries);
|
|
// If we are loading, and the music being loaded was supposed to loop
|
|
// forever, then resume playing it. This helps a lot when the audio CD
|
|
// is used to provide ambient music (see bug #788195).
|
|
if (s->isLoading() && info.playing && info.numLoops < 0)
|
|
AudioCD.play(info.track, info.numLoops, info.start, info.duration);
|
|
}
|
|
|
|
|
|
//
|
|
// Save/load the iMuse status
|
|
//
|
|
if (_imuse && (_saveSound || !_saveTemporaryState)) {
|
|
_imuse->save_or_load(s, this);
|
|
}
|
|
|
|
//
|
|
// Save/load the charset renderer state
|
|
//
|
|
if (s->getVersion() >= VER(73)) {
|
|
_charset->saveLoadWithSerializer(s);
|
|
} else if (s->isLoading()) {
|
|
if (s->getVersion() == VER(72)) {
|
|
_charset->setCurID(s->loadByte());
|
|
} else {
|
|
// Before V72, the charset id wasn't saved. This used to cause issues such
|
|
// as the one described in the bug report #1722153. For these savegames,
|
|
// we reinitialize the id using a, hopefully, sane value.
|
|
_charset->setCurID(_string[0]._default.charset);
|
|
}
|
|
}
|
|
}
|
|
|
|
void ScummEngine_v0::saveOrLoad(Serializer *s) {
|
|
ScummEngine_v2::saveOrLoad(s);
|
|
|
|
const SaveLoadEntry v0Entrys[] = {
|
|
MKLINE(ScummEngine_v0, _currentMode, sleByte, VER(78)),
|
|
MKLINE(ScummEngine_v0, _currentLights, sleByte, VER(78)),
|
|
MKEND()
|
|
};
|
|
s->saveLoadEntries(this, v0Entrys);
|
|
}
|
|
|
|
|
|
void ScummEngine_v2::saveOrLoad(Serializer *s) {
|
|
ScummEngine::saveOrLoad(s);
|
|
|
|
const SaveLoadEntry v2Entrys[] = {
|
|
MKLINE(ScummEngine_v2, _inventoryOffset, sleUint16, VER(79)),
|
|
MKEND()
|
|
};
|
|
s->saveLoadEntries(this, v2Entrys);
|
|
|
|
// In old saves we didn't store _inventoryOffset -> reset it to
|
|
// a sane default when loading one of those.
|
|
if (s->getVersion() < 79 && s->isLoading()) {
|
|
_inventoryOffset = 0;
|
|
}
|
|
}
|
|
|
|
void ScummEngine_v5::saveOrLoad(Serializer *s) {
|
|
ScummEngine::saveOrLoad(s);
|
|
|
|
const SaveLoadEntry cursorEntries[] = {
|
|
MKARRAY2(ScummEngine_v5, _cursorImages[0][0], sleUint16, 16, 4, (byte*)_cursorImages[1] - (byte*)_cursorImages[0], VER(44)),
|
|
MKARRAY(ScummEngine_v5, _cursorHotspots[0], sleByte, 8, VER(44)),
|
|
MKEND()
|
|
};
|
|
|
|
// This is probably only needed for Loom.
|
|
s->saveLoadEntries(this, cursorEntries);
|
|
}
|
|
|
|
#ifdef ENABLE_SCUMM_7_8
|
|
void ScummEngine_v7::saveOrLoad(Serializer *s) {
|
|
ScummEngine::saveOrLoad(s);
|
|
|
|
const SaveLoadEntry subtitleQueueEntries[] = {
|
|
MKARRAY(SubtitleText, text[0], sleByte, 256, VER(61)),
|
|
MKLINE(SubtitleText, charset, sleByte, VER(61)),
|
|
MKLINE(SubtitleText, color, sleByte, VER(61)),
|
|
MKLINE(SubtitleText, xpos, sleInt16, VER(61)),
|
|
MKLINE(SubtitleText, ypos, sleInt16, VER(61)),
|
|
MKLINE(SubtitleText, actorSpeechMsg, sleByte, VER(61)),
|
|
MKEND()
|
|
};
|
|
|
|
const SaveLoadEntry V7Entries[] = {
|
|
MKLINE(ScummEngine_v7, _subtitleQueuePos, sleInt32, VER(61)),
|
|
MK_OBSOLETE(ScummEngine_v7, _verbCharset, sleInt32, VER(68), VER(68)),
|
|
MKLINE(ScummEngine_v7, _verbLineSpacing, sleInt32, VER(68)),
|
|
MKEND()
|
|
};
|
|
|
|
_imuseDigital->saveOrLoad(s);
|
|
|
|
s->saveLoadArrayOf(_subtitleQueue, ARRAYSIZE(_subtitleQueue), sizeof(_subtitleQueue[0]), subtitleQueueEntries);
|
|
s->saveLoadEntries(this, V7Entries);
|
|
|
|
if (s->getVersion() <= VER(68) && s->isLoading()) {
|
|
// WORKAROUND bug #1846049: Reset the default charset color to a sane value.
|
|
_string[0]._default.charset = 1;
|
|
}
|
|
}
|
|
#endif
|
|
|
|
void ScummEngine_v60he::saveOrLoad(Serializer *s) {
|
|
ScummEngine::saveOrLoad(s);
|
|
|
|
s->saveLoadArrayOf(_arraySlot, _numArray, sizeof(_arraySlot[0]), sleByte);
|
|
}
|
|
|
|
void ScummEngine_v70he::saveOrLoad(Serializer *s) {
|
|
ScummEngine_v60he::saveOrLoad(s);
|
|
|
|
const SaveLoadEntry HE70Entries[] = {
|
|
MKLINE(ScummEngine_v70he, _heSndSoundId, sleInt32, VER(51)),
|
|
MKLINE(ScummEngine_v70he, _heSndOffset, sleInt32, VER(51)),
|
|
MKLINE(ScummEngine_v70he, _heSndChannel, sleInt32, VER(51)),
|
|
MKLINE(ScummEngine_v70he, _heSndFlags, sleInt32, VER(51)),
|
|
MKEND()
|
|
};
|
|
|
|
s->saveLoadEntries(this, HE70Entries);
|
|
}
|
|
|
|
#ifdef ENABLE_HE
|
|
void ScummEngine_v71he::saveOrLoad(Serializer *s) {
|
|
ScummEngine_v70he::saveOrLoad(s);
|
|
|
|
const SaveLoadEntry polygonEntries[] = {
|
|
MKLINE(WizPolygon, vert[0].x, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, vert[0].y, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, vert[1].x, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, vert[1].y, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, vert[2].x, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, vert[2].y, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, vert[3].x, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, vert[3].y, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, vert[4].x, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, vert[4].y, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, bound.left, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, bound.top, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, bound.right, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, bound.bottom, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, id, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, numVerts, sleInt16, VER(40)),
|
|
MKLINE(WizPolygon, flag, sleByte, VER(40)),
|
|
MKEND()
|
|
};
|
|
|
|
s->saveLoadArrayOf(_wiz->_polygons, ARRAYSIZE(_wiz->_polygons), sizeof(_wiz->_polygons[0]), polygonEntries);
|
|
}
|
|
|
|
void ScummEngine_v90he::saveOrLoad(Serializer *s) {
|
|
ScummEngine_v71he::saveOrLoad(s);
|
|
|
|
const SaveLoadEntry floodFillEntries[] = {
|
|
MKLINE(FloodFillParameters, box.left, sleInt32, VER(51)),
|
|
MKLINE(FloodFillParameters, box.top, sleInt32, VER(51)),
|
|
MKLINE(FloodFillParameters, box.right, sleInt32, VER(51)),
|
|
MKLINE(FloodFillParameters, box.bottom, sleInt32, VER(51)),
|
|
MKLINE(FloodFillParameters, x, sleInt32, VER(51)),
|
|
MKLINE(FloodFillParameters, y, sleInt32, VER(51)),
|
|
MKLINE(FloodFillParameters, flags, sleInt32, VER(51)),
|
|
MK_OBSOLETE(FloodFillParameters, unk1C, sleInt32, VER(51), VER(62)),
|
|
MKEND()
|
|
};
|
|
|
|
const SaveLoadEntry HE90Entries[] = {
|
|
MKLINE(ScummEngine_v90he, _curMaxSpriteId, sleInt32, VER(51)),
|
|
MKLINE(ScummEngine_v90he, _curSpriteId, sleInt32, VER(51)),
|
|
MKLINE(ScummEngine_v90he, _curSpriteGroupId, sleInt32, VER(51)),
|
|
MK_OBSOLETE(ScummEngine_v90he, _numSpritesToProcess, sleInt32, VER(51), VER(63)),
|
|
MKLINE(ScummEngine_v90he, _heObject, sleInt32, VER(51)),
|
|
MKLINE(ScummEngine_v90he, _heObjectNum, sleInt32, VER(51)),
|
|
MKLINE(ScummEngine_v90he, _hePaletteNum, sleInt32, VER(51)),
|
|
MKEND()
|
|
};
|
|
|
|
_sprite->saveOrLoadSpriteData(s);
|
|
|
|
s->saveLoadArrayOf(&_floodFillParams, 1, sizeof(_floodFillParams), floodFillEntries);
|
|
|
|
s->saveLoadEntries(this, HE90Entries);
|
|
}
|
|
|
|
void ScummEngine_v99he::saveOrLoad(Serializer *s) {
|
|
ScummEngine_v90he::saveOrLoad(s);
|
|
|
|
s->saveLoadArrayOf(_hePalettes, (_numPalettes + 1) * _hePaletteSlot, sizeof(_hePalettes[0]), sleUint8);
|
|
}
|
|
|
|
void ScummEngine_v100he::saveOrLoad(Serializer *s) {
|
|
ScummEngine_v99he::saveOrLoad(s);
|
|
|
|
const SaveLoadEntry HE100Entries[] = {
|
|
MKLINE(ScummEngine_v100he, _heResId, sleInt32, VER(51)),
|
|
MKLINE(ScummEngine_v100he, _heResType, sleInt32, VER(51)),
|
|
MKEND()
|
|
};
|
|
|
|
s->saveLoadEntries(this, HE100Entries);
|
|
}
|
|
#endif
|
|
|
|
void ScummEngine::saveLoadResource(Serializer *ser, int type, int idx) {
|
|
byte *ptr;
|
|
uint32 size;
|
|
|
|
if (!_res->mode[type]) {
|
|
if (ser->isSaving()) {
|
|
ptr = _res->address[type][idx];
|
|
if (ptr == NULL) {
|
|
ser->saveUint32(0);
|
|
return;
|
|
}
|
|
|
|
size = ((MemBlkHeader *)ptr)->size;
|
|
|
|
ser->saveUint32(size);
|
|
ser->saveBytes(ptr + sizeof(MemBlkHeader), size);
|
|
|
|
if (type == rtInventory) {
|
|
ser->saveUint16(_inventory[idx]);
|
|
}
|
|
if (type == rtObjectName && ser->getVersion() >= VER(25)) {
|
|
ser->saveUint16(_newNames[idx]);
|
|
}
|
|
} else {
|
|
size = ser->loadUint32();
|
|
if (size) {
|
|
_res->createResource(type, idx, size);
|
|
ser->loadBytes(getResourceAddress(type, idx), size);
|
|
if (type == rtInventory) {
|
|
_inventory[idx] = ser->loadUint16();
|
|
}
|
|
if (type == rtObjectName && ser->getVersion() >= VER(25)) {
|
|
// Paranoia: We increased the possible number of new names
|
|
// to fix bugs #933610 and #936323. The savegame format
|
|
// didn't change, but at least during the transition
|
|
// period there is a slight chance that we try to load
|
|
// more names than we have allocated space for. If so,
|
|
// discard them.
|
|
if (idx < _numNewNames)
|
|
_newNames[idx] = ser->loadUint16();
|
|
}
|
|
}
|
|
}
|
|
} else if (_res->mode[type] == 2 && ser->getVersion() >= VER(23)) {
|
|
// Save/load only a list of resource numbers that need to be reloaded.
|
|
if (ser->isSaving()) {
|
|
ser->saveUint16(_res->address[type][idx] ? 1 : 0);
|
|
} else {
|
|
if (ser->loadUint16())
|
|
ensureResourceLoaded(type, idx);
|
|
}
|
|
}
|
|
}
|
|
|
|
void ScummEngine::saveResource(Serializer *ser, int type, int idx) {
|
|
assert(_res->address[type][idx]);
|
|
|
|
if (_res->mode[type] == 0) {
|
|
byte *ptr = _res->address[type][idx];
|
|
uint32 size = ((MemBlkHeader *)ptr)->size;
|
|
|
|
ser->saveUint32(size);
|
|
ser->saveBytes(ptr + sizeof(MemBlkHeader), size);
|
|
|
|
if (type == rtInventory) {
|
|
ser->saveUint16(_inventory[idx]);
|
|
}
|
|
if (type == rtObjectName) {
|
|
ser->saveUint16(_newNames[idx]);
|
|
}
|
|
}
|
|
}
|
|
|
|
void ScummEngine::loadResource(Serializer *ser, int type, int idx) {
|
|
if (_game.heversion >= 60 && ser->getVersion() <= VER(65) &&
|
|
((type == rtSound && idx == 1) || (type == rtSpoolBuffer))) {
|
|
uint32 size = ser->loadUint32();
|
|
assert(size);
|
|
_res->createResource(type, idx, size);
|
|
ser->loadBytes(getResourceAddress(type, idx), size);
|
|
} else if (_res->mode[type] == 0) {
|
|
uint32 size = ser->loadUint32();
|
|
assert(size);
|
|
_res->createResource(type, idx, size);
|
|
ser->loadBytes(getResourceAddress(type, idx), size);
|
|
|
|
if (type == rtInventory) {
|
|
_inventory[idx] = ser->loadUint16();
|
|
}
|
|
if (type == rtObjectName) {
|
|
_newNames[idx] = ser->loadUint16();
|
|
}
|
|
} else if (_res->mode[type] == 2) {
|
|
// HE Games use sound resource 1 for speech
|
|
if (_game.heversion >= 60 && idx == 1)
|
|
return;
|
|
|
|
ensureResourceLoaded(type, idx);
|
|
}
|
|
}
|
|
|
|
void Serializer::saveBytes(void *b, int len) {
|
|
_saveStream->write(b, len);
|
|
}
|
|
|
|
void Serializer::loadBytes(void *b, int len) {
|
|
_loadStream->read(b, len);
|
|
}
|
|
|
|
void Serializer::saveUint32(uint32 d) {
|
|
_saveStream->writeUint32LE(d);
|
|
}
|
|
|
|
void Serializer::saveUint16(uint16 d) {
|
|
_saveStream->writeUint16LE(d);
|
|
}
|
|
|
|
void Serializer::saveByte(byte b) {
|
|
_saveStream->writeByte(b);
|
|
}
|
|
|
|
uint32 Serializer::loadUint32() {
|
|
return _loadStream->readUint32LE();
|
|
}
|
|
|
|
uint16 Serializer::loadUint16() {
|
|
return _loadStream->readUint16LE();
|
|
}
|
|
|
|
byte Serializer::loadByte() {
|
|
return _loadStream->readByte();
|
|
}
|
|
|
|
void Serializer::saveArrayOf(void *b, int len, int datasize, byte filetype) {
|
|
byte *at = (byte *)b;
|
|
uint32 data;
|
|
|
|
// speed up byte arrays
|
|
if (datasize == 1 && filetype == sleByte) {
|
|
if (len > 0) {
|
|
saveBytes(b, len);
|
|
}
|
|
return;
|
|
}
|
|
|
|
while (--len >= 0) {
|
|
if (datasize == 0) {
|
|
// Do nothing for obsolete data
|
|
data = 0;
|
|
} else if (datasize == 1) {
|
|
data = *(byte *)at;
|
|
at += 1;
|
|
} else if (datasize == 2) {
|
|
data = *(uint16 *)at;
|
|
at += 2;
|
|
} else if (datasize == 4) {
|
|
data = *(uint32 *)at;
|
|
at += 4;
|
|
} else {
|
|
error("saveArrayOf: invalid size %d", datasize);
|
|
}
|
|
switch (filetype) {
|
|
case sleByte:
|
|
saveByte((byte)data);
|
|
break;
|
|
case sleUint16:
|
|
case sleInt16:
|
|
saveUint16((int16)data);
|
|
break;
|
|
case sleInt32:
|
|
case sleUint32:
|
|
saveUint32(data);
|
|
break;
|
|
default:
|
|
error("saveArrayOf: invalid filetype %d", filetype);
|
|
}
|
|
}
|
|
}
|
|
|
|
void Serializer::loadArrayOf(void *b, int len, int datasize, byte filetype) {
|
|
byte *at = (byte *)b;
|
|
uint32 data;
|
|
|
|
// speed up byte arrays
|
|
if (datasize == 1 && filetype == sleByte) {
|
|
loadBytes(b, len);
|
|
return;
|
|
}
|
|
|
|
while (--len >= 0) {
|
|
switch (filetype) {
|
|
case sleByte:
|
|
data = loadByte();
|
|
break;
|
|
case sleUint16:
|
|
data = loadUint16();
|
|
break;
|
|
case sleInt16:
|
|
data = (int16)loadUint16();
|
|
break;
|
|
case sleUint32:
|
|
data = loadUint32();
|
|
break;
|
|
case sleInt32:
|
|
data = (int32)loadUint32();
|
|
break;
|
|
default:
|
|
error("loadArrayOf: invalid filetype %d", filetype);
|
|
}
|
|
if (datasize == 0) {
|
|
// Do nothing for obsolete data
|
|
} else if (datasize == 1) {
|
|
*(byte *)at = (byte)data;
|
|
at += 1;
|
|
} else if (datasize == 2) {
|
|
*(uint16 *)at = (uint16)data;
|
|
at += 2;
|
|
} else if (datasize == 4) {
|
|
*(uint32 *)at = data;
|
|
at += 4;
|
|
} else {
|
|
error("loadArrayOf: invalid size %d", datasize);
|
|
}
|
|
}
|
|
}
|
|
|
|
void Serializer::saveLoadArrayOf(void *b, int num, int datasize, const SaveLoadEntry *sle) {
|
|
byte *data = (byte *)b;
|
|
|
|
if (isSaving()) {
|
|
while (--num >= 0) {
|
|
saveEntries(data, sle);
|
|
data += datasize;
|
|
}
|
|
} else {
|
|
while (--num >= 0) {
|
|
loadEntries(data, sle);
|
|
data += datasize;
|
|
}
|
|
}
|
|
}
|
|
|
|
void Serializer::saveLoadArrayOf(void *b, int len, int datasize, byte filetype) {
|
|
if (isSaving())
|
|
saveArrayOf(b, len, datasize, filetype);
|
|
else
|
|
loadArrayOf(b, len, datasize, filetype);
|
|
}
|
|
|
|
void Serializer::saveLoadEntries(void *d, const SaveLoadEntry *sle) {
|
|
if (isSaving())
|
|
saveEntries(d, sle);
|
|
else
|
|
loadEntries(d, sle);
|
|
}
|
|
|
|
void Serializer::saveEntries(void *d, const SaveLoadEntry *sle) {
|
|
byte type;
|
|
byte *at;
|
|
int size;
|
|
|
|
while (sle->offs != 0xFFFF) {
|
|
at = (byte *)d + sle->offs;
|
|
size = sle->size;
|
|
type = (byte) sle->type;
|
|
|
|
if (sle->maxVersion != CURRENT_VER) {
|
|
// Skip obsolete entries
|
|
if (type & 128)
|
|
sle++;
|
|
} else {
|
|
// save entry
|
|
int columns = 1;
|
|
int rows = 1;
|
|
int rowlen = 0;
|
|
if (type & 128) {
|
|
sle++;
|
|
columns = sle->offs;
|
|
rows = sle->type;
|
|
rowlen = sle->size;
|
|
type &= ~128;
|
|
}
|
|
while (rows--) {
|
|
saveArrayOf(at, columns, size, type);
|
|
at += rowlen;
|
|
}
|
|
}
|
|
sle++;
|
|
}
|
|
}
|
|
|
|
void Serializer::loadEntries(void *d, const SaveLoadEntry *sle) {
|
|
byte type;
|
|
byte *at;
|
|
int size;
|
|
|
|
while (sle->offs != 0xFFFF) {
|
|
at = (byte *)d + sle->offs;
|
|
size = sle->size;
|
|
type = (byte) sle->type;
|
|
|
|
if (_savegameVersion < sle->minVersion || _savegameVersion > sle->maxVersion) {
|
|
// Skip entries which are not present in this save game version
|
|
if (type & 128)
|
|
sle++;
|
|
} else {
|
|
// load entry
|
|
int columns = 1;
|
|
int rows = 1;
|
|
int rowlen = 0;
|
|
|
|
if (type & 128) {
|
|
sle++;
|
|
columns = sle->offs;
|
|
rows = sle->type;
|
|
rowlen = sle->size;
|
|
type &= ~128;
|
|
}
|
|
while (rows--) {
|
|
loadArrayOf(at, columns, size, type);
|
|
at += rowlen;
|
|
}
|
|
}
|
|
sle++;
|
|
}
|
|
}
|
|
|
|
} // End of namespace Scumm
|