Skip to content

Commit

Permalink
PINK: Initial commit
Browse files Browse the repository at this point in the history
Implemented skeleton of engine, detection, broFile and started orbFile
implementation.
  • Loading branch information
whitertandrek authored and sev- committed Jun 28, 2018
1 parent a95d133 commit 280b249
Show file tree
Hide file tree
Showing 8 changed files with 546 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 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 "" "" ""
41 changes: 41 additions & 0 deletions 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
96 changes: 96 additions & 0 deletions 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 <gui/EventRecorder.h>
#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
120 changes: 120 additions & 0 deletions 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 <common/str.h>
#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
81 changes: 81 additions & 0 deletions 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 <common/file.h>

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
18 changes: 18 additions & 0 deletions 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

0 comments on commit 280b249

Please sign in to comment.