Ticket #8865: rtz_saturn_5-22-09.diff

File rtz_saturn_5-22-09.diff, 25.7 KB (added by SF/mthreepwood, 15 years ago)

Patch (5/22/09)

  • common/util.cpp

     
    250250
    251251
    252252const PlatformDescription g_platforms[] = {
    253         {"2gs", "2gs", "2gs", "Apple IIgs", kPlatformApple2GS },
     253        {"2gs", "2gs", "2gs", "Apple IIgs", kPlatformApple2GS},
    254254        {"3do", "3do", "3do", "3DO", kPlatform3DO},
    255255        {"acorn", "acorn", "acorn", "Acorn", kPlatformAcorn},
    256256        {"amiga", "ami", "amiga", "Amiga", kPlatformAmiga},
    257257        {"atari", "atari-st", "st", "Atari ST", kPlatformAtariST},
    258258        {"c64", "c64", "c64", "Commodore 64", kPlatformC64},
    259         {"pc", "dos", "ibm", "DOS", kPlatformPC},
    260         {"pc98", "pc98", "pc98", "PC-98", kPlatformPC98},
    261         {"wii", "wii", "wii", "Nintendo Wii", kPlatformWii},
    262259
    263260        // The 'official' spelling seems to be "FM-TOWNS" (e.g. in the Indy4 demo).
    264261        // However, on the net many variations can be seen, like "FMTOWNS",
     
    267264
    268265        {"linux", "linux", "linux", "Linux", kPlatformLinux},
    269266        {"macintosh", "mac", "mac", "Macintosh", kPlatformMacintosh},
    270         {"pce", "pce", "pce", "PC-Engine", kPlatformPCEngine },
    271267        {"nes", "nes", "nes", "NES", kPlatformNES},
     268        {"pc", "dos", "ibm", "DOS", kPlatformPC},
     269        {"pc98", "pc98", "pc98", "PC-98", kPlatformPC98},
     270        {"pce", "pce", "pce", "PC-Engine", kPlatformPCEngine},
     271        {"playstation", "psx", "PSX", "Playstation", kPlatformPSX},
     272        {"saturn", "saturn", "saturn", "Sega Saturn", kPlatformSaturn},
    272273        {"segacd", "segacd", "sega", "SegaCD", kPlatformSegaCD},
    273274        {"windows", "win", "win", "Windows", kPlatformWindows},
    274         {"playstation", "psx", "PSX", "Playstation", kPlatformPSX},
     275        {"wii", "wii", "wii", "Nintendo Wii", kPlatformWii},
    275276
    276277
    277278        {0, 0, 0, "Default", kPlatformUnknown}
  • common/util.h

     
    210210        kPlatformSegaCD,
    211211        kPlatform3DO,
    212212        kPlatformPCEngine,
    213 
    214213        kPlatformApple2GS,
    215214        kPlatformPC98,
    216215        kPlatformWii,
    217216        kPlatformPSX,
     217        kPlatformSaturn,
    218218
    219219        kPlatformUnknown = -1
    220220};
  • engines/made/cpkplayer.cpp

     
     1/* ScummVM - Graphic Adventure Engine
     2 *
     3 * ScummVM is the legal property of its developers, whose names
     4 * are too numerous to list here. Please refer to the COPYRIGHT
     5 * file distributed with this source distribution.
     6 *
     7 * This program is free software; you can redistribute it and/or
     8 * modify it under the terms of the GNU General Public License
     9 * as published by the Free Software Foundation; either version 2
     10 * of the License, or (at your option) any later version.
     11
     12 * This program is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     20 *
     21 * $URL$
     22 * $Id$
     23 *
     24 */
     25
     26#include "common/scummsys.h"
     27#include "common/endian.h"
     28 
     29#include "made/cpkplayer.h"
     30#include "made/screen.h"
     31
     32#include "sound/adpcm.h"
     33
     34namespace Made {
     35
     36CpkPlayer::CpkPlayer(MadeEngine *vm, Audio::Mixer *mixer) : _fd(NULL), _vm(vm), _mixer(mixer) {
     37}
     38
     39CpkPlayer::~CpkPlayer() {
     40}
     41
     42struct SampleTableEntry {
     43        uint32 offset;
     44        uint32 length;
     45        uint32 sampleInfo1;
     46        uint32 sampleInfo2;
     47};
     48
     49void CpkPlayer::play(const char *filename) {
     50
     51        // Note: Most of this code is based off the document from http://wiki.multimedia.cx/index.php?title=Sega_FILM
     52
     53        _abort = false;
     54        _surface = new Graphics::Surface();
     55
     56        _fd = new Common::File();
     57        _fd->open(filename);
     58
     59        // FILM Chunk
     60        assert(_fd->readUint32BE() == MKID_BE('FILM'));
     61        uint32 filmHeaderLength = _fd->readUint32BE();
     62        uint32 filmVersion = _fd->readUint32BE();
     63        _fd->readUint32BE(); // Reserved???
     64       
     65        // FDSC Chunk
     66        assert(_fd->readUint32BE() == MKID_BE('FDSC'));
     67        uint32 fdscChunkSize = _fd->readUint32BE();
     68        uint32 videoCodec = _fd->readUint32BE();
     69        uint32 height = _fd->readUint32BE();
     70        uint32 width = _fd->readUint32BE();
     71        _fd->readByte(); // Unknown
     72        byte audioChannels = _fd->readByte();
     73        byte audioSamplingBits = _fd->readByte();
     74        _fd->readByte(); // Unknown
     75        uint16 audioFrequency = _fd->readUint16BE();
     76       
     77        // STAB Chunk
     78        assert(_fd->readUint32BE() == MKID_BE('STAB'));
     79        uint32 stabChunkSize = _fd->readUint32BE();
     80        uint32 frameRateBaseFreq = _fd->readUint32BE();
     81        uint32 sampleTableEntryCount = _fd->readUint32BE();
     82        SampleTableEntry *sampleTableEntries = new SampleTableEntry[sampleTableEntryCount];
     83        for (uint32 i = 0; i < sampleTableEntryCount; i++) {
     84                sampleTableEntries[i].offset = _fd->readUint32BE();
     85                sampleTableEntries[i].length = _fd->readUint32BE();
     86                sampleTableEntries[i].sampleInfo1 = _fd->readUint32BE();
     87                sampleTableEntries[i].sampleInfo2 = _fd->readUint32BE();
     88        }
     89       
     90        // Where's the actual frame rate? There is none! It's variable and can differ between frames.
     91
     92        _mixer->stopAll();
     93
     94        byte audioFlags = 0;
     95        if (audioChannels == 2)
     96                audioFlags |= Audio::Mixer::FLAG_STEREO;
     97        if (audioSamplingBits == 16)
     98                audioFlags |= Audio::Mixer::FLAG_16BITS;
     99       
     100        _audioStream = Audio::makeAppendableAudioStream(audioFrequency, audioFlags);
     101       
     102       
     103        // Uh-oh.... is it 8bpp???
     104        _surface->create(width, height, 1);
     105
     106        for (uint32 i = 0; i < sampleTableEntryCount && !_abort && !_fd->eos(); i++) {
     107                _fd->seek(sampleTableEntries[i].offset + filmHeaderLength);
     108               
     109                // Audio Data
     110                if (sampleTableEntries[i].sampleInfo1 == (uint32)~0) {
     111                        Common::SeekableSubReadStream *soundData = new Common::SeekableSubReadStream(_fd, 0, sampleTableEntries[i].length);
     112                        Audio::AudioStream *adpcmStream = Audio::makeADPCMStream(soundData, false, 0, Audio::kADPCMMS, audioFrequency, audioChannels, 0);
     113                        // TODO: L R L R L R L R
     114                        // The Sound data alternates left/right
     115                } else {
     116                // Video Data
     117                        // TODO: Cinepak for SEGA
     118                }
     119
     120                handleEvents();
     121                updateScreen();
     122        }
     123
     124        _audioStream->finish();
     125        _mixer->stopHandle(_audioStreamHandle);
     126       
     127        //delete _audioStream;
     128        delete _fd;
     129        delete _surface;
     130
     131}
     132
     133void CpkPlayer::handleEvents() {
     134        Common::Event event;
     135        while (_vm->_system->getEventManager()->pollEvent(event)) {
     136                switch (event.type) {
     137                case Common::EVENT_KEYDOWN:
     138                        if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
     139                                _abort = true;
     140                        break;
     141                default:
     142                        break;
     143                }
     144        }
     145}
     146
     147void CpkPlayer::updateScreen() {
     148        _vm->_system->copyRectToScreen((const byte*)_surface->pixels, _surface->pitch,
     149                                                                        (320 - _surface->w) / 2, (200 - _surface->h) / 2, _surface->w, _surface->h);
     150        _vm->_system->updateScreen();
     151}
     152
     153}
  • engines/made/cpkplayer.h

    Property changes on: engines\made\cpkplayer.cpp
    ___________________________________________________________________
    Name: svn:mime-type
       + text/plain
    Name: svn:keywords
       + Date Rev Author URL Id
    Name: svn:eol-style
       + native
    
     
     1/* ScummVM - Graphic Adventure Engine
     2 *
     3 * ScummVM is the legal property of its developers, whose names
     4 * are too numerous to list here. Please refer to the COPYRIGHT
     5 * file distributed with this source distribution.
     6 *
     7 * This program is free software; you can redistribute it and/or
     8 * modify it under the terms of the GNU General Public License
     9 * as published by the Free Software Foundation; either version 2
     10 * of the License, or (at your option) any later version.
     11
     12 * This program is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     20 *
     21 * $URL$
     22 * $Id$
     23 *
     24 */
     25
     26#ifndef MADE_CPKPLAYER_H
     27#define MADE_CPKPLAYER_H
     28
     29#include "common/system.h"
     30#include "common/events.h"
     31#include "common/file.h"
     32#include "common/endian.h"
     33#include "graphics/surface.h"
     34#include "sound/mixer.h"
     35#include "sound/audiostream.h"
     36
     37#include "made/graphics.h"
     38#include "made/sound.h"
     39#include "made/made.h"
     40
     41namespace Made {
     42
     43class MadeEngine;
     44
     45class CpkPlayer {
     46public:
     47        CpkPlayer(MadeEngine *vm, Audio::Mixer *mixer);
     48        ~CpkPlayer();
     49        void play(const char *filename);
     50protected:
     51        MadeEngine *_vm;
     52        Audio::Mixer *_mixer;
     53        Common::File *_fd;
     54        Audio::AppendableAudioStream *_audioStream;
     55        Audio::SoundHandle _audioStreamHandle;
     56        Graphics::Surface *_surface;
     57        bool _abort;
     58        void handleEvents();
     59        void updateScreen();
     60};
     61
     62}
     63
     64#endif
  • engines/made/database.cpp

    Property changes on: engines\made\cpkplayer.h
    ___________________________________________________________________
    Name: svn:mime-type
       + text/plain
    Name: svn:keywords
       + Date Rev Author URL Id
    Name: svn:eol-style
       + native
    
     
    249249        return _objData + 6;
    250250}
    251251
     252int ObjectSegaSaturn::load(Common::SeekableReadStream &source) {
     253        _freeData = true;
     254        source.readUint16BE(); // skip flags
     255        uint16 type = source.readUint16BE();
     256        if (type == 0x7FFF) {
     257                _objSize = source.readUint16BE();
     258        } else if (type == 0x7FFE) {
     259                _objSize = source.readUint16BE() * 2;
     260        } else if (type < 0x7FFE) {
     261                byte count1 = source.readByte();
     262                byte count2 = source.readByte();
     263                _objSize = (count1 + count2) * 2;
     264        }
     265        source.seek(-6, SEEK_CUR);
     266        _objSize += 6;
     267        _objData = new byte[_objSize];
     268        source.read(_objData, _objSize);
     269        return _objSize;
     270}
    252271
     272int ObjectSegaSaturn::load(byte *source) {
     273        _objData = source;
     274        _freeData = false;
     275        if (getClass() < 0x7FFE) {
     276                _objSize = (getCount1() + getCount2()) * 2;
     277        } else {
     278                _objSize = getSize();
     279        }
     280        _objSize += 6;
     281        return _objSize;
     282}
    253283
     284int ObjectSegaSaturn::save(Common::WriteStream &dest) {
     285        // Not implemented/used for version 3 objects
     286        return 0;
     287}
     288
     289uint16 ObjectSegaSaturn::getFlags() {
     290        return READ_BE_UINT16(_objData);
     291}
     292
     293uint16 ObjectSegaSaturn::getClass() {
     294        return READ_BE_UINT16(_objData + 2);
     295}
     296
     297uint16 ObjectSegaSaturn::getSize() {
     298        return READ_BE_UINT16(_objData + 4);
     299}
     300
     301byte ObjectSegaSaturn::getCount1() {
     302        return _objData[4];
     303}
     304
     305byte ObjectSegaSaturn::getCount2() {
     306        return _objData[5];
     307}
     308
     309byte *ObjectSegaSaturn::getData() {
     310        return _objData + 6;
     311}
     312
     313int16 ObjectSegaSaturn::getVectorItem(int16 index) {
     314        if (getClass() == 0x7FFF) {
     315                byte *vector = (byte*)getData();
     316                return vector[index];
     317        } else if (getClass() == 0x7FFE) {
     318                int16 *vector = (int16*)getData();
     319                return READ_BE_UINT16(&vector[index]);
     320        } else if (getClass() < 0x7FFE) {
     321                int16 *vector = (int16*)getData();
     322                return READ_BE_UINT16(&vector[index]);
     323        } else {
     324                // should never reach here
     325                error("Unknown object class");
     326                return 0;
     327        }
     328}
     329
     330void ObjectSegaSaturn::setVectorItem(int16 index, int16 value) {
     331        if (getClass() == 0x7FFF) {
     332                byte *vector = (byte*)getData();
     333                vector[index] = value;
     334        } else if (getClass() <= 0x7FFE) {
     335                int16 *vector = (int16*)getData();
     336                WRITE_BE_UINT16(&vector[index], value);
     337        }
     338}
     339
     340
    254341GameDatabase::GameDatabase(MadeEngine *vm) : _vm(vm) {
    255342}
    256343
     
    809896        return NULL;
    810897}
    811898
     899// GameDatabaseSegaSaturn
     900
     901GameDatabaseSegaSaturn::GameDatabaseSegaSaturn(MadeEngine *vm) : GameDatabase(vm) {
     902}
     903
     904int16 GameDatabaseSegaSaturn::getVar(int16 index) {
     905        return (int16)READ_BE_UINT16(_gameState + index * 2);
     906}
     907
     908void GameDatabaseSegaSaturn::setVar(int16 index, int16 value) {
     909        WRITE_BE_UINT16(_gameState + index * 2, value);
     910}
     911
     912int16 GameDatabaseSegaSaturn::getObjectProperty(int16 objectIndex, int16 propertyId) {
     913        if (objectIndex == 0)
     914                return 0;
     915
     916        int16 propertyFlag;
     917        int16 *property = findObjectProperty(objectIndex, propertyId, propertyFlag);
     918
     919        if (property) {
     920                return (int16)READ_BE_UINT16(property);
     921        } else {
     922                return 0;
     923        }
     924}
     925
     926int16 GameDatabaseSegaSaturn::setObjectProperty(int16 objectIndex, int16 propertyId, int16 value) {
     927        if (objectIndex == 0)
     928                return 0;
     929
     930        int16 propertyFlag;
     931        int16 *property = findObjectProperty(objectIndex, propertyId, propertyFlag);
     932
     933        if (property) {
     934                if (propertyFlag == 1) {
     935                        WRITE_BE_UINT16(property, value);
     936                } else {
     937                        warning("GameDatabase::setObjectProperty(%04X, %04X, %04X) Trying to set constant property\n",
     938                                objectIndex, propertyId, value);
     939                }
     940                return value;
     941        } else {
     942                return 0;
     943        }
     944}
     945
     946void GameDatabaseSegaSaturn::load(Common::SeekableReadStream &sourceS) {
     947        char header[6];
     948        sourceS.read(header, 6);
     949        if (strncmp(header, "ADVSYS", 6))
     950                warning ("Unexpected database header, expected ADVSYS");
     951
     952        /*uint32 unk = */sourceS.readUint32LE();
     953
     954        sourceS.skip(20);
     955
     956        uint32 objectIndexOffs = sourceS.readUint32BE();
     957        uint16 objectCount = sourceS.readUint16BE();
     958        _gameStateOffs = sourceS.readUint32BE();
     959        _gameStateSize = sourceS.readUint32BE();
     960        uint32 objectsOffs = sourceS.readUint32BE();
     961        uint32 objectsSize = sourceS.readUint32BE();
     962        _mainCodeObjectIndex = sourceS.readUint16BE();
     963
     964        debug(2, "objectIndexOffs = %08X; objectCount = %d; gameStateOffs = %08X; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d\n", objectIndexOffs, objectCount, _gameStateOffs, _gameStateSize, objectsOffs, objectsSize);
     965
     966        _gameState = new byte[_gameStateSize];
     967        sourceS.seek(_gameStateOffs);
     968        sourceS.read(_gameState, _gameStateSize);
     969
     970        Common::Array<uint32> objectOffsets;
     971        sourceS.seek(objectIndexOffs);
     972        for (uint32 i = 0; i < objectCount; i++)
     973                objectOffsets.push_back(sourceS.readUint32BE());
     974
     975        for (uint32 i = 0; i < objectCount; i++) {
     976                Object *obj = new ObjectSegaSaturn();
     977
     978                // The LSB indicates if it's a constant or variable object.
     979                // Constant objects are loaded from disk, while variable objects exist
     980                // in the _gameState buffer.
     981
     982                if (objectOffsets[i] & 1) {
     983                        sourceS.seek(objectsOffs + objectOffsets[i] - 1);
     984                        obj->load(sourceS);
     985                } else {
     986                        obj->load(_gameState + objectOffsets[i]);
     987                }
     988                _objects.push_back(obj);
     989        }
     990}
     991
     992void GameDatabaseSegaSaturn::reloadFromStream(Common::SeekableReadStream &sourceS) {
     993        sourceS.seek(_gameStateOffs);
     994        sourceS.read(_gameState, _gameStateSize);
     995}
     996
     997bool GameDatabaseSegaSaturn::getSavegameDescription(const char *filename, Common::String &description) {
     998        Common::InSaveFile *in;
     999        char desc[64];
     1000        if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
     1001                return false;
     1002        }
     1003        in->skip(4); // TODO: Verify marker 'SGAM'
     1004        in->skip(4); // TODO: Verify size
     1005        in->skip(2); // TODO: Verify version
     1006        in->read(desc, 64);
     1007        description = desc;
     1008        delete in;
     1009        return true;
     1010}
     1011
     1012int16 GameDatabaseSegaSaturn::savegame(const char *filename, const char *description, int16 version) {
     1013        Common::OutSaveFile *out;
     1014        char desc[64];
     1015        int16 result = 0;
     1016        uint32 size = 4 + 4 + 2 + _gameStateSize;
     1017        if (!(out = g_system->getSavefileManager()->openForSaving(filename))) {
     1018                warning("Can't create file '%s', game not saved", filename);
     1019                return 6;
     1020        }
     1021        strncpy(desc, description, 64);
     1022        out->writeUint32BE(MKID_BE('SGAM'));
     1023        out->writeUint32LE(size);
     1024        out->writeUint16LE(version);
     1025        out->write(desc, 64);
     1026        out->write(_gameState, _gameStateSize);
     1027        delete out;
     1028        return result;
     1029}
     1030
     1031int16 GameDatabaseSegaSaturn::loadgame(const char *filename, int16 version) {
     1032        Common::InSaveFile *in;
     1033        int16 result = 0;
     1034        //uint32 expectedSize = 4 + 4 + 2 + _gameStateSize;
     1035        if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
     1036                warning("Can't open file '%s', game not loaded", filename);
     1037                return 1;
     1038        }
     1039        in->skip(4); // TODO: Verify marker 'SGAM'
     1040        in->skip(4); // TODO: Verify size
     1041        in->skip(2); // TODO: Verify version
     1042        in->skip(64); // skip savegame description
     1043        in->read(_gameState, _gameStateSize);
     1044        delete in;
     1045        return result;
     1046}
     1047
     1048int16 *GameDatabaseSegaSaturn::findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
     1049        Object *obj = getObject(objectIndex);
     1050
     1051        int16 *prop = (int16*)obj->getData();
     1052        byte count1 = obj->getCount1();
     1053        byte count2 = obj->getCount2();
     1054
     1055        int16 *propPtr1 = prop + count1;
     1056        int16 *propPtr2 = prop + count2;
     1057
     1058        // First see if the property exists in the given object
     1059        while (count2-- > 0) {
     1060                if ((READ_BE_UINT16(prop) & 0x3FFF) == propertyId) {
     1061                        if (READ_BE_UINT16(prop) & 0x4000) {
     1062                                propertyFlag = 1;
     1063                                return (int16*)_gameState + READ_BE_UINT16(propPtr1);
     1064                        } else {
     1065                                propertyFlag = obj->getFlags() & 1;
     1066                                return propPtr1;
     1067                        }
     1068                }
     1069                prop++;
     1070                propPtr1++;
     1071        }
     1072
     1073        // Now check in the object hierarchy of the given object
     1074        int16 parentObjectIndex = obj->getClass();
     1075        if (parentObjectIndex == 0) {
     1076                return NULL;
     1077        }
     1078
     1079        while (parentObjectIndex != 0) {
     1080
     1081                obj = getObject(parentObjectIndex);
     1082
     1083                prop = (int16*)obj->getData();
     1084                count1 = obj->getCount1();
     1085                count2 = obj->getCount2();
     1086
     1087                propPtr1 = propPtr2 + count1 - count2;
     1088                int16 *propertyPtr = prop + count1;
     1089
     1090                while (count2-- > 0) {
     1091                        if (!(READ_BE_UINT16(prop) & 0x8000)) {
     1092                                if ((READ_BE_UINT16(prop) & 0x3FFF) == propertyId) {
     1093                                        if (READ_BE_UINT16(prop) & 0x4000) {
     1094                                                propertyFlag = 1;
     1095                                                return (int16*)_gameState + READ_BE_UINT16(propPtr1);
     1096                                        } else {
     1097                                                propertyFlag = obj->getFlags() & 1;
     1098                                                return propPtr1;
     1099                                        }
     1100                                } else {
     1101                                        propPtr1++;
     1102                                }
     1103                        } else {
     1104                                if ((READ_BE_UINT16(prop) & 0x3FFF) == propertyId) {
     1105                                        if (READ_BE_UINT16(prop) & 0x4000) {
     1106                                                propertyFlag = 1;
     1107                                                return (int16*)_gameState + READ_BE_UINT16(propertyPtr);
     1108                                        } else {
     1109                                                propertyFlag = obj->getFlags() & 1;
     1110                                                return propertyPtr;
     1111                                        }
     1112                                }
     1113                        }
     1114                        prop++;
     1115                        propertyPtr++;
     1116                }
     1117
     1118                parentObjectIndex = obj->getClass();
     1119
     1120        }
     1121
     1122        return NULL;
     1123       
     1124}
     1125
     1126const char *GameDatabaseSegaSaturn::getString(uint16 offset) {
     1127        // Not used in version 3 games
     1128        return NULL;
     1129}
     1130
    8121131} // End of namespace Made
  • engines/made/database.h

     
    6161        bool isVector();
    6262
    6363        int16 getVectorSize();
    64         int16 getVectorItem(int16 index);
    65         void setVectorItem(int16 index, int16 value);
     64        virtual int16 getVectorItem(int16 index);
     65        virtual void setVectorItem(int16 index, int16 value);
    6666
    6767        void dump(const char *filename);
    6868
     
    112112
    113113};
    114114
     115class ObjectSegaSaturn : public Object {
     116public:
     117        int load(Common::SeekableReadStream &source);
     118        int load(byte *source);
     119        int save(Common::WriteStream &dest);
     120        uint16 getFlags();
     121        uint16 getClass();
     122        uint16 getSize();
     123        byte getCount1();
     124        byte getCount2();
     125        byte *getData();
     126       
     127        int16 getVectorItem(int16 index);
     128        void setVectorItem(int16 index, int16 value);
     129       
     130        bool isConstant() {
     131                return !(getFlags() & 1);
     132        }
     133       
     134};
     135
    115136class GameDatabase {
    116137public:
    117138
     
    134155
    135156        int16 getMainCodeObjectIndex() const { return _mainCodeObjectIndex; }
    136157
    137         int16 getVar(int16 index);
    138         void setVar(int16 index, int16 value);
     158        virtual int16 getVar(int16 index);
     159        virtual void setVar(int16 index, int16 value);
    139160
    140161        const char *getObjectString(int16 index);
    141162        void setObjectString(int16 index, const char *str);
    142163
    143164        virtual int16 *findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) = 0;
    144165        virtual const char *getString(uint16 offset) = 0;
    145         virtual bool getSavegameDescription(const char *filename, Common::String &description, int16 version) = 0;
     166        virtual bool getSavegameDescription(const char *filename, Common::String &description, int16 version) { return false; }
    146167        virtual int16 savegame(const char *filename, const char *description, int16 version) = 0;
    147168        virtual int16 loadgame(const char *filename, int16 version) = 0;
    148169
    149         int16 getObjectProperty(int16 objectIndex, int16 propertyId);
    150         int16 setObjectProperty(int16 objectIndex, int16 propertyId, int16 value);
     170        virtual int16 getObjectProperty(int16 objectIndex, int16 propertyId);
     171        virtual int16 setObjectProperty(int16 objectIndex, int16 propertyId, int16 value);
    151172
    152173        void dumpObject(int16 index);
    153174
     
    193214        void reloadFromStream(Common::SeekableReadStream &sourceS);
    194215};
    195216
     217class GameDatabaseSegaSaturn : public GameDatabase {
     218public:
     219        GameDatabaseSegaSaturn(MadeEngine *vm);
     220        int16 *findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag);
     221        const char *getString(uint16 offset);
     222        bool getSavegameDescription(const char *filename, Common::String &description);
     223        int16 savegame(const char *filename, const char *description, int16 version);
     224        int16 loadgame(const char *filename, int16 version);
     225       
     226        int16 getVar(int16 index);
     227        void setVar(int16 index, int16 value);
     228       
     229        int16 getObjectProperty(int16 objectIndex, int16 propertyId);
     230        int16 setObjectProperty(int16 objectIndex, int16 propertyId, int16 value);
     231protected:
     232        char *_gameText;
     233        uint32 _gameStateOffs;
     234        void load(Common::SeekableReadStream &sourceS);
     235        void reloadFromStream(Common::SeekableReadStream &sourceS);
     236};
     237
    196238} // End of namespace Made
    197239
    198240#endif /* MADE_H */
  • engines/made/detection.cpp

     
    294294                GF_FLOPPY,
    295295                3,
    296296        },
     297       
     298        {
     299                // Return to Zork - Japanese Sega Saturn version
     300                {
     301                        "rtz",
     302                        "",
     303                        AD_ENTRY1("rtz.dat", "023e46f6b43913792bd535558cce7bf7"),
     304                        Common::JA_JPN,
     305                        Common::kPlatformSaturn,
     306                        ADGF_NO_FLAGS
     307                },
     308                GID_RTZ,
     309                0,
     310                GF_FLOPPY,
     311                3,
     312        },
    297313
    298314        {
    299315                // Return to Zork - Demo
     
    308324                GID_RTZ,
    309325                0,
    310326                GF_DEMO,
    311                 3,
     327                3
    312328        },
    313329
    314330        {
  • engines/made/made.cpp

     
    8282
    8383        _pmvPlayer = new PmvPlayer(this, _mixer);
    8484        _res = new ResourceReader();
     85        _cpkPlayer = new CpkPlayer(this, _mixer);
    8586        _screen = new Screen(this);
    8687
    87         if (getGameID() == GID_LGOP2 || getGameID() == GID_MANHOLE || getGameID() == GID_RODNEY) {
     88        if (getVersion() == 1 || getVersion() == 2) {
    8889                _dat = new GameDatabaseV2(this);
    89         } else if (getGameID() == GID_RTZ) {
    90                 _dat = new GameDatabaseV3(this);
     90        } else if (getVersion() == 3) {
     91                if (getPlatform() == Common::kPlatformSaturn)
     92                        _dat = new GameDatabaseSegaSaturn(this);
     93                else
     94                        _dat = new GameDatabaseV3(this);
    9195        } else {
    9296                error("Unknown GameID");
    9397        }
  • engines/made/made.h

     
    4747
    4848#include "made/sound.h"
    4949
     50#include "made/cpkplayer.h"
     51
    5052namespace Made {
    5153
    5254enum MadeGameID {
     
    6870struct MadeGameDescription;
    6971
    7072class ResourceReader;
     73class CpkPlayer;
    7174class PmvPlayer;
    7275class Screen;
    7376class ScriptInterpreter;
     
    103106private:
    104107public:
    105108        PmvPlayer *_pmvPlayer;
     109        CpkPlayer *_cpkPlayer;
    106110        ResourceReader *_res;
    107111        Screen *_screen;
    108112        GameDatabase *_dat;
     
    134138        Common::String getSavegameFilename(int16 saveNum);
    135139
    136140        void handleEvents();
    137 
    138141};
    139142
    140143} // End of namespace Made
  • engines/made/module.mk

     
    11MODULE := engines/made
    22
    33MODULE_OBJS = \
     4        cpkplayer.o \
    45        database.o \
    56        detection.o \
    67        graphics.o \
  • engines/made/scriptfuncs.cpp

     
    4646        _externalFuncs.push_back(new ExternalScriptFunc(this, &ScriptFunctions::x));  \
    4747        _externalFuncNames.push_back(#x);
    4848void ScriptFunctions::setupExternalsTable() {
    49 
    5049        External(sfSystemCall);
    5150        External(sfInitGraf);
    5251        External(sfRestoreGraf);
     
    116115        }
    117116
    118117        if (_vm->getGameID() == GID_RTZ) {
    119                 External(sfPrintf);
     118                if (_vm->getPlatform() != Common::kPlatformSaturn)
     119                        External(sfPrintf);
    120120                External(sfClearMono);
    121121                External(sfGetSoundEnergy);
    122122                External(sfClearText);
     
    151151                External(sfReadMenu);
    152152                External(sfDrawMenu);
    153153                External(sfGetMenuCount);
    154                 External(sfSaveGame);
    155                 External(sfLoadGame);
    156                 External(sfGetGameDescription);
     154                if (_vm->getPlatform() == Common::kPlatformSaturn) {
     155                        External(sfFaceIcon);
     156                } else {
     157                        External(sfSaveGame);
     158                        External(sfLoadGame);
     159                        External(sfGetGameDescription);
     160                }
    157161                External(sfShakeScreen);
    158162                External(sfPlaceMenu);
    159163                External(sfSetSoundVolume);
     
    929933
    930934}
    931935
     936int16 ScriptFunctions::sfFaceIcon(int16 argc, int16 *argv) {
     937        // TODO: Used in RTZ Sega Saturn
     938        warning("Unimplemented opcode: sfFaceIcon");
     939        return 0;
     940}
     941
    932942int16 ScriptFunctions::sfShakeScreen(int16 argc, int16 *argv) {
    933943        // TODO: Used in RTZ
    934944        warning("Unimplemented opcode: sfShakeScreen");
  • engines/made/scriptfuncs.h

     
    161161        int16 sfSaveGame(int16 argc, int16 *argv);
    162162        int16 sfLoadGame(int16 argc, int16 *argv);
    163163        int16 sfGetGameDescription(int16 argc, int16 *argv);
     164        int16 sfFaceIcon(int16 argc, int16 *argv);
    164165        int16 sfShakeScreen(int16 argc, int16 *argv);
    165166        int16 sfPlaceMenu(int16 argc, int16 *argv);
    166167        int16 sfSetSoundVolume(int16 argc, int16 *argv);