Reverse Engineering Pink Classes

This post will be about the reversing serialized objects, located in ORB file.They are written in ORB using MFC library.

Firstly, I parsed class names. To do that, I have written simple program in C++.  Each class in Pink starts with letter ‘C’, so program just finds this letter, then reads name as MFC String and checks it for correctness.

I’ve got 48 for Peril and 45 for Pokus.

Secondly, I found out fields names. It was really easy.

When these games were created, developers had program creating the game files. This program wrote data to txt files, but not using MFC serialization, because the game engine has code for executing game from txt files. That’s why each class has virtual method, which writes attribute name and value. For example, CConditionVariable class:

Each class in Pink games can be reversed using this approach.

Pink Files Format

The Pink Panther games use only two data files.

These are ORB and BRO.

 

Structure of ORB file header

1
2
3
4
5
6
7
8
char name[4]; // ORB
uint16 minorVersion;
uint16 majorVersion;
uint32 timestamp;
uint32 tableOffset;
uint32 tableSize;

After header, we will look at the table. It is located at the end of ORB. It contains descriptions of objects. The names in this table are sorted, so the binary search is used for searching.

1
2
3
4
5
6
7
struct ObjectDescription {
    char name[16];
    uint32 objectsOffset;
    uint32 objectsCount;
    uint32 resourcesOffset;
    uint32 resourcesCount;
};

Let’s look at resources table. Each object description has offset to the resource descriptions table.

1
2
3
4
5
6
struct ResourceDescription {
    char name[16];
    uint32 offset;
    uint32 size;
    bool inBro;
};

The last field determines where the resource is located.

BRO file contains only resources and it is only used in Passport to Peril. In Hokus Pokus it is empty.

1
2
3
4
5
6
char name[4]; // BRO
uint16 minorVersion;
uint16 majorVersion;
uint32 timestamp;

The timestamps of BRO and ORB must be equal to each other.

Introduction

This blog is created for the ScummVM project I’m involved as a GSoC student.

 

I will be working on adding support for the Pink Panther: Passport to Peril and Pink Panther: Hokus Pokus Pink games to ScummVM.

These games are using the same engine written in C++ using MFC.  Internal name of engine is OxCart Runtime.

I have already done a big amount of work.

Engine branch

You can contact me via telegram or e-mail (whiterandrek@gmail.com)