Last active
September 6, 2024 19:57
-
-
Save brecert/312fedeffe926fbfa1931d29ebfaea65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma endian big | |
import type.magic; | |
import std.array; | |
using f32 = float; | |
fn relative_to_parent(u128 offset) { | |
return addressof(parent) + offset; | |
}; | |
struct Header { | |
type::Magic<"PMPF">; | |
$ = relative_to_parent(0x10); | |
u16 objectCount; | |
u16 routeCount; | |
u16 pointCount; | |
$ = relative_to_parent(0x40); | |
u32 objectDataOffset; | |
u32 routeDataOffset; | |
u32 pointDataOffset; | |
}; | |
struct Object { | |
u16 objectGroupId; | |
u16 objectId; | |
u32; | |
f32 position[3]; | |
f32 scale[3]; | |
std::Array<f32, 3> transformationMatrix[3]; | |
u32; | |
u8 parameters[0x10] [[sealed]]; | |
}; | |
struct Route { | |
u16 pointCount; | |
u32; | |
u16 routeGroupId; | |
char routeName[]; | |
$ = relative_to_parent(0x1A); | |
u16 routePointIndex; | |
u32; | |
}; | |
struct Point { | |
f32 position[3]; | |
padding[8]; | |
}; | |
struct PMP { | |
Header header; | |
Object objectData[header.objectCount] @ header.objectDataOffset; | |
Route routeData[header.routeCount] @ header.routeDataOffset; | |
Point pointData[header.pointCount] @ header.pointDataOffset; | |
}; | |
PMP pmp @ 0x00; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment