From 280b24965708d7db3066bad06a4115d52cfacf31 Mon Sep 17 00:00:00 2001 From: whitertandrek Date: Thu, 15 Mar 2018 22:02:52 +0200 Subject: PINK: Initial commit Implemented skeleton of engine, detection, broFile and started orbFile implementation. --- engines/pink/configure.engine | 3 ++ engines/pink/console.h | 41 +++++++++++++++ engines/pink/detection.cpp | 96 +++++++++++++++++++++++++++++++++ engines/pink/file.cpp | 120 ++++++++++++++++++++++++++++++++++++++++++ engines/pink/file.h | 81 ++++++++++++++++++++++++++++ engines/pink/module.mk | 18 +++++++ engines/pink/pink.cpp | 103 ++++++++++++++++++++++++++++++++++++ engines/pink/pink.h | 84 +++++++++++++++++++++++++++++ 8 files changed, 546 insertions(+) create mode 100644 engines/pink/configure.engine create mode 100644 engines/pink/console.h create mode 100644 engines/pink/detection.cpp create mode 100644 engines/pink/file.cpp create mode 100644 engines/pink/file.h create mode 100644 engines/pink/module.mk create mode 100644 engines/pink/pink.cpp create mode 100644 engines/pink/pink.h diff --git a/engines/pink/configure.engine b/engines/pink/configure.engine new file mode 100644 index 0000000000..80a2df6d60 --- /dev/null +++ b/engines/pink/configure.engine @@ -0,0 +1,3 @@ +# This file is included from the main "configure" script +# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] +add_engine pink "Pink Panther" no "" "" "" diff --git a/engines/pink/console.h b/engines/pink/console.h new file mode 100644 index 0000000000..03f48821b1 --- /dev/null +++ b/engines/pink/console.h @@ -0,0 +1,41 @@ +/* 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. +* +*/ + +#ifndef PINK_CONSOLE_H +#define PINK_CONSOLE_H + +#include "gui/debugger.h" + +namespace Pink { + +class PinkEngine; + +class Console : public GUI::Debugger { +public: + Console(PinkEngine *vm) {} + + virtual ~Console(void) {} +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp new file mode 100644 index 0000000000..16b289b65b --- /dev/null +++ b/engines/pink/detection.cpp @@ -0,0 +1,96 @@ +/* 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. + * + */ + +#include +#include "pink.h" + +static const PlainGameDescriptor pinkGames[] = { + {"peril", "The Pink Panther: Passport to Peril"}, + {"pokus", "The Pink Panther: Hokus Pokus Pink"}, + {0, 0} +}; + +namespace Pink { + +static const ADGameDescription gameDescriptions[] = { + { + "peril", + 0,{ + {"PPTP.ORB", NULL, NULL, -1}, + {"PPTP.BRO", NULL, NULL, -1}, + AD_LISTEND}, + Common::RU_RUS, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO1(GUIO_NONE) + }, + + { + "peril", + 0, + AD_ENTRY1s("hpp.ORB", NULL, -1), + Common::RU_RUS, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO1(GUIO_NONE) + }, + AD_TABLE_END_MARKER +}; + +} // End of namespace Pink + + +class PinkMetaEngine : public AdvancedMetaEngine { +public: + PinkMetaEngine() : AdvancedMetaEngine(Pink::gameDescriptions, sizeof(ADGameDescription), pinkGames) { + _gameIds = pinkGames; + } + + virtual const char *getName() const { + return "Pink Panther Engine"; + } + + virtual const char *getOriginalCopyright() const { + return "Pink Panther Engine (C) Wanderlust Interactive"; + } + + //virtual bool hasFeature(MetaEngineFeature f) const; + //virtual int getMaximumSaveSlot() const { return 0; } + //virtual SaveStateList listSaves(const char *target) const; + //virtual void removeSaveState(const char *target, int slot) const; + //virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; +}; + +bool PinkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { + if (desc) { + *engine = new Pink::PinkEngine(syst, desc); + } + + return desc != 0; +} + +#if PLUGIN_ENABLED_DYNAMIC(PINK) +REGISTER_PLUGIN_DYNAMIC(PINK, PLUGIN_TYPE_ENGINE, PinkMetaEngine); +#else +REGISTER_PLUGIN_STATIC(PINK, PLUGIN_TYPE_ENGINE, PinkMetaEngine); +#endif diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp new file mode 100644 index 0000000000..5bcd8cc089 --- /dev/null +++ b/engines/pink/file.cpp @@ -0,0 +1,120 @@ +/* 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. + * + */ + +#include +#include "pink.h" + +namespace Pink { + +OrbFile::OrbFile() + : File(), _timestamp(0), + _tableOffset(0), + _tableSize(0), + _table(nullptr) +{} + +OrbFile::~OrbFile() { + delete[] _table; +} + +bool OrbFile::open(Common::String &name) { + if (!File::open(name)) + return false; + + if (readUint32BE() != 'ORB\0'){ + close(); + return false; + } + + uint16 minor = readUint16LE(); + uint16 major = readUint16LE(); + //output + if (minor || major != 2){ + return false; + } + + _timestamp = readUint32LE(); + if (!_timestamp){ + return false; + } + //convert to date + //output into debug + + _tableOffset = readUint32LE(); + _tableSize = readUint32LE(); + _table = new ObjectDescription[_tableSize]; + + for (size_t i = 0; i < _tableSize; ++i) { + _table[i].deserialize(*this); + } + + return true; +} + +void OrbFile::LoadGame(PinkEngine *game) { + +} + +void OrbFile::LoadObject(void *obj, Common::String &name) { + +} + +uint32 OrbFile::getTimestamp() { + return _timestamp; +} + +bool BroFile::open(Common::String &name, uint32 orbTimestamp) { + if (!File::open(name) || readUint32BE() != 'BRO\0') + return false; + + uint16 minor = readUint16LE(); + uint16 major = readUint16LE(); + // do output + + if (minor || major != 1){ + return false; + } + + uint32 _timestamp = readUint32LE(); + + return _timestamp == orbTimestamp; +} + +void ObjectDescription::deserialize(Common::File &file) { + file.read(name, sizeof(name)); + file.read(&objectsOffset, sizeof(objectsOffset)); + file.read(&objectsCount, sizeof(objectsCount)); + file.read(&resourcesOffset, sizeof(resourcesOffset)); + file.read(&resourcesCount, sizeof(resourcesCount)); +} + +void ResourseDescription::deserialize(Common::File &file) { + file.read(name, sizeof(name)); + file.read(&offset, sizeof(offset)); + file.read(&size, sizeof(offset)); + + uint16 temp; + file.read(&temp, sizeof(temp)); + InBro = temp ? true : false; +} + +} // End of namespace Pink \ No newline at end of file diff --git a/engines/pink/file.h b/engines/pink/file.h new file mode 100644 index 0000000000..64e3782778 --- /dev/null +++ b/engines/pink/file.h @@ -0,0 +1,81 @@ +/* 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. + * + */ + +#ifndef PINK_FILE_H +#define PINK_FILE_H + +#include + +namespace Pink { + +struct ObjectDescription { + void deserialize(Common::File &file); + + char name[16]; + uint32 objectsOffset; + uint32 objectsCount; + uint32 resourcesOffset; + uint32 resourcesCount; +}; + +struct ResourseDescription { + void deserialize(Common::File &file); + + char name[16]; + uint32 offset; + uint32 size; + bool InBro; // in original it is short. + // Don't know what's better to use.(Perhaps no diffrence because of padding) +}; + +class PinkEngine; + +class OrbFile : public Common::File { +public: + OrbFile(); + virtual ~OrbFile(); + + virtual bool open(Common::String &name); + + void LoadGame(PinkEngine *game); + void LoadObject(void *obj, Common::String &name); + + uint32 getTimestamp(); + +private: + uint32 _timestamp; + uint32 _tableOffset; + uint32 _tableSize; + ObjectDescription *_table; +}; + +class BroFile : public Common::File { +public: + BroFile() = default; + virtual ~BroFile() = default; + + virtual bool open(Common::String &name, uint32 orbId); +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/module.mk b/engines/pink/module.mk new file mode 100644 index 0000000000..754c957feb --- /dev/null +++ b/engines/pink/module.mk @@ -0,0 +1,18 @@ +MODULE := engines/pink + +MODULE_OBJS = \ + pink.o \ + console.o \ + detection.o \ + director.o \ + sound.o \ + file.o \ + + +# This module can be built as a plugin +ifeq ($(ENABLE_PLUMBERS), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules +include $(srcdir)/rules.mk \ No newline at end of file diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp new file mode 100644 index 0000000000..f45afbb6e6 --- /dev/null +++ b/engines/pink/pink.cpp @@ -0,0 +1,103 @@ +/* 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. + * + */ + +#include "pink.h" +#include "console.h" +#include