Skip to content

Instantly share code, notes, and snippets.

@Joeywp
Created May 24, 2016 17:58
Show Gist options
  • Save Joeywp/54d165e216e57c93a0a68ec91da95722 to your computer and use it in GitHub Desktop.
Save Joeywp/54d165e216e57c93a0a68ec91da95722 to your computer and use it in GitHub Desktop.
Blueprint for 010 editor that allows you to partly read the OVL files of Planet Coaster
//------------------------------------------------
//--- 010 Editor v7.0 Binary Template
//
// File: Overlay
// Authors: Joeywp
// Version: 0.08
// Purpose: Structing the Overlay files for Planet Coaster (Cobra Engine)
// Category:
// File Mask: *.ovl
// ID Bytes:
// History:
//------------------------------------------------
typedef struct {
uint Block1; // Always 0
uint Block2; // Always 0
uint Block3; // Always 0
ushort Block4a;
ushort Block4b; // Always 0
ushort Block5a;
ushort Block5b;
ushort Block6a; // Always 0
ushort Block6b; // Always 0
ushort Block7a;
ushort Block7b;
ushort Block8a;
ushort Block8b;
ushort Block9a;
ushort Block9b; // Always 0
ushort Block10a; // Always 0
ushort Block10b; // Always 0
uint Unknown1; // Some kind of size?
uint CompressedDataSize;
uint DecompressedDataSize;
} BLOCKCOUNT;
typedef struct {
char extraData [3072];
} EXTRADATA <bgcolor=cLtGray>;
typedef struct {
uint StringPointer <comment=StringPointer>;
uint Djb2Hash;
ubyte Unknown1; // Loader type?
ubyte Unknown2;
ubyte Unknown3;
ubyte Unknown4;
} LOADERSYMBOL <bgcolor=cLtRed>;
typedef struct {
uint NameStringPointer <comment=StringPointer>;
uint Unknown1;
uint Hash;
uint LoaderType;
uint StringOffset;
ubyte SymbolsToResolve;
ubyte ExtraDataCount;
ubyte Unknown3;
ubyte Unknown4;
//LOADERSYMBOL symbols [symbolCount];
} LOADER <bgcolor=0xFFFF00>;
typedef struct {
uint magicNumber;
ubyte VersionOrGame; // Seen 0x0 (0) at Elite Dangerous, 0x2 (2) at Disneyland Kinect, 0x8 (8) at Planet Coaster
ubyte Unknown1a; // Seen 0x12 (18)
ubyte BigEndian; // Seen 1 if file uses big-endian, else it uses little-endian
ubyte Unknown1c; // Seen 1
ubyte Unknown2a; // Seen 148
ubyte Unknown2b; // 32
ubyte Unknown2c; // Seen 0
ubyte Unknown2d; // Seen 0
uint Unknown3; // Seen 0
uint StringTableSize;
uint Unknown4; // Seen 0
uint Unknown5; // Seen 0, 1, 9, bitflag? Also seen 3 at ED
ushort Unknown6a; // Seen 0. Seen more at ED
ushort LoaderCount; // Seen 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 29. Also seen 10 at ED
uint FileCount1; // Seen values between 0 and 47968, mostly less then 1000
uint FileCount2; // Same as Unknown7
uint Unknown9; // Seen values between 0 and 57331, rarely more then 1000
uint Unknown10; // Seen the values 1 to 3, also 4 and 5 at ED
uint Unknown11; // Seen the values 0 to 6, also 7 and 8 at ED
uint Unknown12; // Seen numbers between 0 and 2885, mostly less then or equal to 151
uint Unknown13; // Seen numbers between 0 and 2362, mostly less then or equal to 231
uint Unknown14; // Seen numbers between 0 and 2739
uint Unknown15; // Seen values between 0 and 38
ushort Unknown16a; // Seen 0
ushort Unknown16b; // Seen 0
ushort Unknown17a; // Seen 0
ushort Unknown17b; // Seen 0
uint Unknown18; // Seen 0
uint StaticTextLength;
uint FileCount3; // Seen numbers between 0 and 47968
uint Unknown21; // Seen numbers between 0 and 1103, mostly lower then 300
uint Unknown22; // Seen 0
uint Unknown23; // Seen 0
uint Unknown24; // Seen 0
uint Unknown25; // Seen 0
uint Unknown26; // Seen 0
uint Unknown27; // Seen 0
uint Unknown28; // Seen 0
uint Unknown29; // Seen 0
uint Unknown30; // Seen 0
uint Unknown31; // Seen 0
uint Unknown32; // Seen 0
uint Unknown33; // Seen 0
uint Unknown34; // Seen 0
} HEADER <bgcolor=cLtBlue>;
LittleEndian();
HEADER header;
if (header.BigEndian == 1) {
return;
}
local int64 stringTablePosition = FTell();
byte stringtable [header.StringTableSize] <bgcolor=0x00FF00>;
if (header.LoaderCount > 0) {
local int i;
local int j;
local int s;
LOADER loaders [header.LoaderCount] <comment=LoaderComment>;
for (i = 0; i < header.LoaderCount; i++) {
for (s = 0; s < loaders[i].ExtraDataCount; s++) {
EXTRADATA data;
}
for (j = 0; j < loaders[i].SymbolsToResolve; j++) {
LOADERSYMBOL loaderSymbol <comment=SymbolComment>;
}
}
}
char STATIC [header.StaticTextLength] <bgcolor=cLtGray>;
BLOCKCOUNT blockCount <bgcolor=cLtGray>;
// Skip for now as I don't know how to correctly handle the space inbetween
FSeek(FileSize() - blockCount.CompressedDataSize);
char compressedData [blockCount.CompressedDataSize] <bgcolor=0x0000FF>;
//char uncompressedData [blockCount.UncompressedPartSize];
//char compressedData [blockCount.CompressedPartSize] <bgcolor=cLtGray>;
string StringPointer(uint pointer) {
//local string value = "";
local uint i;
local uint count = 0;
for (i = pointer; i < header.StringTableSize; i++) {
if (stringtable[i] == 0) {
break;
}
count ++;
}
char value[count+1];
for (i = 0; i < count; i++) {
value[i] = stringtable[pointer + i];
}
return value;
}
string SymbolComment(LOADERSYMBOL &symbol) {
return StringPointer(symbol.StringPointer);
}
string LoaderComment(LOADER &symbol) {
return StringPointer(symbol.NameStringPointer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment