Ticket #8865: updated_rtz_patch.diff

File updated_rtz_patch.diff, 22.9 KB (added by SF/mthreepwood, 16 years ago)

Updated Patch

  • common/util.cpp

     
    288288        {"macintosh", "mac", "mac", "Macintosh", kPlatformMacintosh},
    289289        {"pce", "pce", "pce", "PC-Engine", kPlatformPCEngine },
    290290        {"nes", "nes", "nes", "NES", kPlatformNES},
     291        {"saturn", "saturn", "saturn", "Sega Saturn", kPlatformSaturn},
    291292        {"segacd", "segacd", "sega", "SegaCD", kPlatformSegaCD},
    292293        {"windows", "win", "win", "Windows", kPlatformWindows},
    293294
  • common/util.h

     
    207207        kPlatformSegaCD,
    208208        kPlatform3DO,
    209209        kPlatformPCEngine,
    210 
    211210        kPlatformApple2GS,
    212211        kPlatformPC98,
     212        kPlatformSaturn,
    213213
    214214        kPlatformUnknown = -1
    215215};
  • 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->eof(); 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                case Common::EVENT_QUIT:
     142                        _vm->_quit = true;
     143                        _abort = true;
     144                        break;
     145                default:
     146                        break;
     147                }
     148        }
     149}
     150
     151void CpkPlayer::updateScreen() {
     152        _vm->_system->copyRectToScreen((const byte*)_surface->pixels, _surface->pitch,
     153                                                                        (320 - _surface->w) / 2, (200 - _surface->h) / 2, _surface->w, _surface->h);
     154        _vm->_system->updateScreen();
     155}
     156
     157}
  • engines/made/cpkplayer.h

     
     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

     
    245245        return _objData + 6;
    246246}
    247247
     248int ObjectSegaSaturn::load(Common::SeekableReadStream &source) {
     249        _freeData = true;
     250        source.readUint16BE(); // skip flags
     251        uint16 type = source.readUint16BE();
     252        if (type == 0x7FFF) {
     253                _objSize = source.readUint16BE();
     254        } else if (type == 0x7FFE) {
     255                _objSize = source.readUint16BE() * 2;
     256        } else if (type < 0x7FFE) {
     257                byte count1 = source.readByte();
     258                byte count2 = source.readByte();
     259                _objSize = (count1 + count2) * 2;
     260        }
     261        source.seek(-6, SEEK_CUR);
     262        _objSize += 6;
     263        _objData = new byte[_objSize];
     264        source.read(_objData, _objSize);
     265        return _objSize;
     266}
    248267
     268int ObjectSegaSaturn::load(byte *source) {
     269        _objData = source;
     270        _freeData = false;
     271        if (getClass() < 0x7FFE) {
     272                _objSize = (getCount1() + getCount2()) * 2;
     273        } else {
     274                _objSize = getSize();
     275        }
     276        _objSize += 6;
     277        return _objSize;
     278}
    249279
     280int ObjectSegaSaturn::save(Common::WriteStream &dest) {
     281        // Not implemented/used for version 3 objects
     282        return 0;
     283}
     284
     285uint16 ObjectSegaSaturn::getFlags() {
     286        return READ_BE_UINT16(_objData);
     287}
     288
     289uint16 ObjectSegaSaturn::getClass() {
     290        return READ_BE_UINT16(_objData + 2);
     291}
     292
     293uint16 ObjectSegaSaturn::getSize() {
     294        return READ_BE_UINT16(_objData + 4);
     295}
     296
     297byte ObjectSegaSaturn::getCount1() {
     298        return _objData[4];
     299}
     300
     301byte ObjectSegaSaturn::getCount2() {
     302        return _objData[5];
     303}
     304
     305byte *ObjectSegaSaturn::getData() {
     306        return _objData + 6;
     307}
     308
     309int16 ObjectSegaSaturn::getVectorItem(int16 index) {
     310        if (getClass() == 0x7FFF) {
     311                byte *vector = (byte*)getData();
     312                return vector[index];
     313        } else if (getClass() == 0x7FFE) {
     314                int16 *vector = (int16*)getData();
     315                return READ_BE_UINT16(&vector[index]);
     316        } else if (getClass() < 0x7FFE) {
     317                int16 *vector = (int16*)getData();
     318                return READ_BE_UINT16(&vector[index]);
     319        } else {
     320                // should never reach here
     321                error("Unknown object class");
     322                return 0;
     323        }
     324}
     325
     326void ObjectSegaSaturn::setVectorItem(int16 index, int16 value) {
     327        if (getClass() == 0x7FFF) {
     328                byte *vector = (byte*)getData();
     329                vector[index] = value;
     330        } else if (getClass() <= 0x7FFE) {
     331                int16 *vector = (int16*)getData();
     332                WRITE_BE_UINT16(&vector[index], value);
     333        }
     334}
     335
     336
    250337GameDatabase::GameDatabase(MadeEngine *vm) : _vm(vm) {
    251338}
    252339
     
    680767        return NULL;
    681768}
    682769
     770// GameDatabaseSegaSaturn
     771
     772GameDatabaseSegaSaturn::GameDatabaseSegaSaturn(MadeEngine *vm) : GameDatabase(vm) {
     773}
     774
     775int16 GameDatabaseSegaSaturn::getVar(int16 index) {
     776        return (int16)READ_BE_UINT16(_gameState + index * 2);
     777}
     778
     779void GameDatabaseSegaSaturn::setVar(int16 index, int16 value) {
     780        WRITE_BE_UINT16(_gameState + index * 2, value);
     781}
     782
     783int16 GameDatabaseSegaSaturn::getObjectProperty(int16 objectIndex, int16 propertyId) {
     784        if (objectIndex == 0)
     785                return 0;
     786
     787        int16 propertyFlag;
     788        int16 *property = getObjectPropertyPtr(objectIndex, propertyId, propertyFlag);
     789
     790        if (property) {
     791                return (int16)READ_BE_UINT16(property);
     792        } else {
     793                return 0;
     794        }
     795}
     796
     797int16 GameDatabaseSegaSaturn::setObjectProperty(int16 objectIndex, int16 propertyId, int16 value) {
     798        if (objectIndex == 0)
     799                return 0;
     800
     801        int16 propertyFlag;
     802        int16 *property = getObjectPropertyPtr(objectIndex, propertyId, propertyFlag);
     803
     804        if (property) {
     805                if (propertyFlag == 1) {
     806                        WRITE_BE_UINT16(property, value);
     807                } else {
     808                        warning("GameDatabase::setObjectProperty(%04X, %04X, %04X) Trying to set constant property\n",
     809                                objectIndex, propertyId, value);
     810                }
     811                return value;
     812        } else {
     813                return 0;
     814        }
     815}
     816
     817void GameDatabaseSegaSaturn::load(Common::SeekableReadStream &sourceS) {
     818        // TODO: Read/verify header
     819
     820        sourceS.seek(0x1E);
     821
     822        uint32 objectIndexOffs = sourceS.readUint32BE();
     823        uint16 objectCount = sourceS.readUint16BE();
     824        uint32 gameStateOffs = sourceS.readUint32BE();
     825        _gameStateSize = sourceS.readUint32BE();
     826        uint32 objectsOffs = sourceS.readUint32BE();
     827        uint32 objectsSize = sourceS.readUint32BE();
     828        _mainCodeObjectIndex = sourceS.readUint16BE();
     829
     830        debug(2, "objectIndexOffs = %08X; objectCount = %d; gameStateOffs = %08X; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d\n", objectIndexOffs, objectCount, gameStateOffs, _gameStateSize, objectsOffs, objectsSize);
     831
     832        _gameState = new byte[_gameStateSize];
     833        sourceS.seek(gameStateOffs);
     834        sourceS.read(_gameState, _gameStateSize);
     835
     836        Common::Array<uint32> objectOffsets;
     837        sourceS.seek(objectIndexOffs);
     838        for (uint32 i = 0; i < objectCount; i++)
     839                objectOffsets.push_back(sourceS.readUint32BE());
     840
     841        for (uint32 i = 0; i < objectCount; i++) {
     842                Object *obj = new ObjectSegaSaturn();
     843
     844                // The LSB indicates if it's a constant or variable object.
     845                // Constant objects are loaded from disk, while variable objects exist
     846                // in the _gameState buffer.
     847
     848                if (objectOffsets[i] & 1) {
     849                        sourceS.seek(objectsOffs + objectOffsets[i] - 1);
     850                        obj->load(sourceS);
     851                } else {
     852                        obj->load(_gameState + objectOffsets[i]);
     853                }
     854                _objects.push_back(obj);
     855        }
     856}
     857
     858bool GameDatabaseSegaSaturn::getSavegameDescription(const char *filename, Common::String &description) {
     859        Common::InSaveFile *in;
     860        char desc[64];
     861        if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
     862                return false;
     863        }
     864        in->skip(4); // TODO: Verify marker 'SGAM'
     865        in->skip(4); // TODO: Verify size
     866        in->skip(2); // TODO: Verify version
     867        in->read(desc, 64);
     868        description = desc;
     869        delete in;
     870        return true;
     871}
     872
     873int16 GameDatabaseSegaSaturn::savegame(const char *filename, const char *description, int16 version) {
     874        Common::OutSaveFile *out;
     875        char desc[64];
     876        int16 result = 0;
     877        uint32 size = 4 + 4 + 2 + _gameStateSize;
     878        if (!(out = g_system->getSavefileManager()->openForSaving(filename))) {
     879                warning("Can't create file '%s', game not saved", filename);
     880                return 6;
     881        }
     882        strncpy(desc, description, 64);
     883        out->writeUint32BE(MKID_BE('SGAM'));
     884        out->writeUint32LE(size);
     885        out->writeUint16LE(version);
     886        out->write(desc, 64);
     887        out->write(_gameState, _gameStateSize);
     888        delete out;
     889        return result;
     890}
     891
     892int16 GameDatabaseSegaSaturn::loadgame(const char *filename, int16 version) {
     893        Common::InSaveFile *in;
     894        int16 result = 0;
     895        //uint32 expectedSize = 4 + 4 + 2 + _gameStateSize;
     896        if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
     897                warning("Can't open file '%s', game not loaded", filename);
     898                return 1;
     899        }
     900        in->skip(4); // TODO: Verify marker 'SGAM'
     901        in->skip(4); // TODO: Verify size
     902        in->skip(2); // TODO: Verify version
     903        in->skip(64); // skip savegame description
     904        in->read(_gameState, _gameStateSize);
     905        delete in;
     906        return result;
     907}
     908
     909int16 *GameDatabaseSegaSaturn::getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
     910        Object *obj = getObject(objectIndex);
     911
     912        int16 *prop = (int16*)obj->getData();
     913        byte count1 = obj->getCount1();
     914        byte count2 = obj->getCount2();
     915
     916        int16 *propPtr1 = prop + count1;
     917        int16 *propPtr2 = prop + count2;
     918
     919        // First see if the property exists in the given object
     920        while (count2-- > 0) {
     921                if ((READ_BE_UINT16(prop) & 0x3FFF) == propertyId) {
     922                        if (READ_BE_UINT16(prop) & 0x4000) {
     923                                propertyFlag = 1;
     924                                return (int16*)_gameState + READ_BE_UINT16(propPtr1);
     925                        } else {
     926                                propertyFlag = obj->getFlags() & 1;
     927                                return propPtr1;
     928                        }
     929                }
     930                prop++;
     931                propPtr1++;
     932        }
     933
     934        // Now check in the object hierarchy of the given object
     935        int16 parentObjectIndex = obj->getClass();
     936        if (parentObjectIndex == 0) {
     937                return NULL;
     938        }
     939
     940        while (parentObjectIndex != 0) {
     941
     942                obj = getObject(parentObjectIndex);
     943
     944                prop = (int16*)obj->getData();
     945                count1 = obj->getCount1();
     946                count2 = obj->getCount2();
     947
     948                propPtr1 = propPtr2 + count1 - count2;
     949                int16 *propertyPtr = prop + count1;
     950
     951                while (count2-- > 0) {
     952                        if (!(READ_BE_UINT16(prop) & 0x8000)) {
     953                                if ((READ_BE_UINT16(prop) & 0x3FFF) == propertyId) {
     954                                        if (READ_BE_UINT16(prop) & 0x4000) {
     955                                                propertyFlag = 1;
     956                                                return (int16*)_gameState + READ_BE_UINT16(propPtr1);
     957                                        } else {
     958                                                propertyFlag = obj->getFlags() & 1;
     959                                                return propPtr1;
     960                                        }
     961                                } else {
     962                                        propPtr1++;
     963                                }
     964                        } else {
     965                                if ((READ_BE_UINT16(prop) & 0x3FFF) == propertyId) {
     966                                        if (READ_BE_UINT16(prop) & 0x4000) {
     967                                                propertyFlag = 1;
     968                                                return (int16*)_gameState + READ_BE_UINT16(propertyPtr);
     969                                        } else {
     970                                                propertyFlag = obj->getFlags() & 1;
     971                                                return propertyPtr;
     972                                        }
     973                                }
     974                        }
     975                        prop++;
     976                        propertyPtr++;
     977                }
     978
     979                parentObjectIndex = obj->getClass();
     980
     981        }
     982
     983        return NULL;
     984       
     985}
     986
     987const char *GameDatabaseSegaSaturn::getString(uint16 offset) {
     988        // Not used in version 3 games
     989        return NULL;
     990}
     991
    683992} // End of namespace Made
  • engines/made/database.h

     
    107107       
    108108};
    109109
     110class ObjectSegaSaturn : public Object {
     111public:
     112        int load(Common::SeekableReadStream &source);
     113        int load(byte *source);
     114        int save(Common::WriteStream &dest);
     115        uint16 getFlags();
     116        uint16 getClass();
     117        uint16 getSize();
     118        byte getCount1();
     119        byte getCount2();
     120        byte *getData();
     121       
     122        int16 getVectorItem(int16 index);
     123        void setVectorItem(int16 index, int16 value);
     124       
     125        bool isConstant() {
     126                return !(getFlags() & 1);
     127        }
     128       
     129};
     130
    110131class GameDatabase {
    111132public:
    112133
     
    180201        void load(Common::SeekableReadStream &sourceS);
    181202};
    182203
     204class GameDatabaseSegaSaturn : public GameDatabase {
     205public:
     206        GameDatabaseSegaSaturn(MadeEngine *vm);
     207        int16 *getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag);
     208        const char *getString(uint16 offset);
     209        bool getSavegameDescription(const char *filename, Common::String &description);
     210        int16 savegame(const char *filename, const char *description, int16 version);
     211        int16 loadgame(const char *filename, int16 version);
     212       
     213        int16 getVar(int16 index);
     214        void setVar(int16 index, int16 value);
     215       
     216        int16 getObjectProperty(int16 objectIndex, int16 propertyId);
     217        int16 setObjectProperty(int16 objectIndex, int16 propertyId, int16 value);
     218protected:
     219        char *_gameText;
     220        void load(Common::SeekableReadStream &sourceS);
     221};
     222
    183223} // End of namespace Made
    184224
    185225#endif /* MADE_H */
  • engines/made/detection.cpp

     
    227227                GF_FLOPPY,
    228228                0,
    229229        },
     230       
     231        {
     232                // Return to Zork - Japanese Sega Saturn version
     233                {
     234                        "rtz",
     235                        "",
     236                        AD_ENTRY1("rtz.dat", "023e46f6b43913792bd535558cce7bf7"),
     237                        Common::JA_JPN,
     238                        Common::kPlatformSaturn,
     239                        Common::ADGF_NO_FLAGS
     240                },
     241                GID_RTZ,
     242                0,
     243                GF_FLOPPY,
     244                0,
     245        },
    230246
    231247        {
    232248                // Return to Zork - Demo
  • engines/made/made.cpp

     
    8484                _system->openCD(cd_num);
    8585               
    8686        _pmvPlayer = new PmvPlayer(this, _mixer);
     87        _cpkPlayer = new CpkPlayer(this, _mixer);
    8788        _res = new ProjectReader();
    8889        _screen = new Screen(this);
    8990
    9091        if (getGameID() == GID_LGOP2 || getGameID() == GID_MANHOLE) {
    9192                _dat = new GameDatabaseV2(this);
    9293        } else if (getGameID() == GID_RTZ) {
    93                 _dat = new GameDatabaseV3(this);
     94                if (getPlatform() == Common::kPlatformSaturn)
     95                        _dat = new GameDatabaseSegaSaturn(this);
     96                else
     97                        _dat = new GameDatabaseV3(this);
    9498        } else {
    9599                error("Unknown GameID");
    96100        }
  • engines/made/made.h

     
    4545
    4646#include "engines/engine.h"
    4747
     48#include "made/cpkplayer.h"
     49
    4850namespace Made {
    4951
    5052enum MadeGameID {
     
    6567struct MadeGameDescription;
    6668
    6769class ProjectReader;
     70class CpkPlayer;
    6871class PmvPlayer;
    6972class Screen;
    7073class ScriptInterpreter;
     
    97100private:
    98101public:
    99102        PmvPlayer *_pmvPlayer;
     103        CpkPlayer *_cpkPlayer;
    100104        ProjectReader *_res;
    101105        Screen *_screen;
    102106        GameDatabase *_dat;
  • engines/made/module.mk

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

     
    191191        _runningScriptObjectIndex = scriptObjectIndex;
    192192
    193193        _localStackPos = _stack.getStackPos();
    194 
     194       
    195195        _codeBase = _vm->_dat->getObject(_runningScriptObjectIndex)->getData();
    196196        _codeIp = _codeBase;
    197197       
     
    215215}
    216216
    217217int16 ScriptInterpreter::readInt16() {
    218         int16 temp = (int16)READ_LE_UINT16(_codeIp);
     218        int16 temp;
     219        if (_vm->getPlatform() == Common::kPlatformSaturn)
     220                temp = (int16)READ_BE_UINT16(_codeIp);
     221        else
     222                temp = (int16)READ_LE_UINT16(_codeIp);
    219223        _codeIp += 2;
    220224        debug(4, "readInt16() value = %04X", temp);
    221225        return temp;
  • engines/made/scriptfuncs.cpp

     
    4545        _externalFuncs.push_back(new ExternalScriptFunc(this, &ScriptFunctions::x));  \
    4646        _externalFuncNames.push_back(#x);
    4747void ScriptFunctions::setupExternalsTable() {
    48 
    4948        External(sfSystemCall);
    5049        External(sfInitGraf);
    5150        External(sfRestoreGraf);
     
    115114        }
    116115       
    117116        if (_vm->getGameID() == GID_RTZ) {
    118                 External(sfPrintf);
     117                if (_vm->getPlatform() != Common::kPlatformSaturn)
     118                        External(sfPrintf);
    119119                External(sfClearMono);
    120120                External(sfGetSoundEnergy);
    121121                External(sfClearText);
     
    150150                External(sfReadMenu);
    151151                External(sfDrawMenu);
    152152                External(sfGetMenuCount);
    153                 External(sfSaveGame);
    154                 External(sfLoadGame);
    155                 External(sfGetGameDescription);
     153                if (_vm->getPlatform() == Common::kPlatformSaturn) {
     154                        External(sfFaceIcon);
     155                } else {
     156                        External(sfSaveGame);
     157                        External(sfLoadGame);
     158                        External(sfGetGameDescription);
     159                }
    156160                External(sfShakeScreen);
    157161                External(sfPlaceMenu);
    158162                External(sfSetSoundVolume);
     
    875879
    876880}
    877881
     882int16 ScriptFunctions::sfFaceIcon(int16 argc, int16 *argv) {
     883        // RTZ Sega Saturn
     884        warning("Unimplemented opcode: sfFaceIcon");
     885        return 0;
     886}
     887
    878888int16 ScriptFunctions::sfShakeScreen(int16 argc, int16 *argv) {
    879889        // TODO: Used in RTZ
    880890        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);