Skip to content

Instantly share code, notes, and snippets.

@komiga
Created October 27, 2012 17:36
Show Gist options
  • Select an option

  • Save komiga/3965457 to your computer and use it in GitHub Desktop.

Select an option

Save komiga/3965457 to your computer and use it in GitHub Desktop.
pli.format
// Unknown-purpose PLI format
// Overview
// 1. PLI format
// a. Layout
// b. Layer
// *****************************
// 1. PLI format
// 1.a. Layout
layout {
const cstring signature = "PLI" // Signature
const rdata<6, 0x00> _reserved0 // Reserved space. 6 bytes of 0x00
rstring<16, 0x00> author // Author. Only observed value is "Author : Seraph"
int _unk0 // TODO: Unknown purpose. Only observed value is 0
short _unk1 // TODO: Unknown purpose. Only observed value is 1
short _unk2 // TODO: Unknown purpose. Only observed value is 1
byte layercount // Number of layers
rstring<5, 0x00> primary // Primary name
Layer layers[layercount] // Layers
const rdata<32, 0x00> _reserved1 // Reserved space. 32 bytes of 0x00. TODO: Inspect PLIs to see if this is ever different (might be an rcstring)
short statecount // The number of state orders. This should be the same as the PLI's set's state count.
// The PLI state entry is defined in 0000_001.pli
// Now we need to read the frame order for the layers
operation { // Inline operation
short framecount;
int e, s;
// Initialize the layers
for (e = 0; e < layercount; ++e) {
layers[e].order = new byte[][statecount]; // Create the state array
}
// Read the indices
for (s = 0; s < statecount; ++s) {
framecount.in(); // The number of frames in the state
// Initialize the layers' frame-index arrays
for (e = 0; e < layercount; ++e) {
layers[e].order[s] = new byte[framecount]; // Create the frame array for the current state
}
for (int frame = 0; frame < framecount; ++frame) {
for (e = 0; e < layercount; ++e) {
layers[e].order[s][frame].in(); // Read the index byte
}
}
}
}
}
// 1.b. Layer
define Layer {
rstring<5, 0x00> name // Name of element. See pli_header.notes
rstring<5, 0x00> index // TODO: Unknown purpose. Usually "001", "002", "003", etc.
noread unsigned byte order[][] // Frame order. This is read later on in the layout. TODO: These values are probably drawing orders for animations
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment