diff options
Diffstat (limited to 'Scripts/010 Editor/ctb.bt')
-rw-r--r-- | Scripts/010 Editor/ctb.bt | 212 |
1 files changed, 212 insertions, 0 deletions
diff --git a/Scripts/010 Editor/ctb.bt b/Scripts/010 Editor/ctb.bt new file mode 100644 index 0000000..88ddc4b --- /dev/null +++ b/Scripts/010 Editor/ctb.bt @@ -0,0 +1,212 @@ +//------------------------------------------------ +//--- 010 Editor v8.0.1 Binary Template +// +// File: ctb, cbddlp, photon +// Authors: Tiago Conceição +//------------------------------------------------ + +LittleEndian(); + +struct HEADER { + uint Magic <fgcolor=cBlack, bgcolor=cRed>; + uint Version <fgcolor=cBlack, bgcolor=cRed>; + + float BedSizeX <fgcolor=cBlack, bgcolor=cRed>; + float BedSizeY <fgcolor=cBlack, bgcolor=cRed>; + float BedSizeZ <fgcolor=cBlack, bgcolor=cRed>; + + uint Unknown1 <fgcolor=cBlack, bgcolor=cRed>; + uint Unknown2 <fgcolor=cBlack, bgcolor=cRed>; + + float TotalHeightMilimeter <fgcolor=cBlack, bgcolor=cRed>; + float LayerHeightMilimeter <fgcolor=cBlack, bgcolor=cRed>; + float LayerExposureSeconds <fgcolor=cBlack, bgcolor=cRed>; + float BottomExposureSeconds <fgcolor=cBlack, bgcolor=cRed>; + float LightOffDelay <fgcolor=cBlack, bgcolor=cRed>; + uint BottomLayersCount <fgcolor=cBlack, bgcolor=cRed>; + uint ResolutionX <fgcolor=cBlack, bgcolor=cRed>; + uint ResolutionY <fgcolor=cBlack, bgcolor=cRed>; + uint PreviewLargeOffsetAddress <fgcolor=cBlack, bgcolor=cRed>; + uint LayersDefinitionOffsetAddress <fgcolor=cBlack, bgcolor=cRed>; + uint LayerCount <fgcolor=cBlack, bgcolor=cRed>; + uint PreviewSmallOffsetAddress <fgcolor=cBlack, bgcolor=cRed>; + uint PrintTime <fgcolor=cBlack, bgcolor=cRed>; + uint ProjectorType <fgcolor=cBlack, bgcolor=cRed>; + uint PrintParametersOffsetAddress <fgcolor=cBlack, bgcolor=cRed>; + uint PrintParametersSize <fgcolor=cBlack, bgcolor=cRed>; + uint AntiAliasLevel <fgcolor=cBlack, bgcolor=cRed>; + ushort LightPWM <fgcolor=cBlack, bgcolor=cRed>; + ushort BottomLightPWM <fgcolor=cBlack, bgcolor=cRed>; + uint EncryptionKey <fgcolor=cBlack, bgcolor=cRed>; + uint SlicerOffset <fgcolor=cBlack, bgcolor=cRed>; + uint SlicerSize <fgcolor=cBlack, bgcolor=cRed>; +} header; + +struct PREVIEW { + uint ResolutionX <fgcolor=cBlack, bgcolor=cRed>; + uint ResolutionY <fgcolor=cBlack, bgcolor=cRed>; + uint ImageOffset <fgcolor=cBlack, bgcolor=cRed>; + uint ImageLength <fgcolor=cBlack, bgcolor=cRed>; + uint Unknown1 <fgcolor=cBlack, bgcolor=cRed>; + uint Unknown2 <fgcolor=cBlack, bgcolor=cRed>; + uint Unknown3 <fgcolor=cBlack, bgcolor=cRed>; + uint Unknown4 <fgcolor=cBlack, bgcolor=cRed>; + + byte Data[ImageLength] <fgcolor=cBlack, bgcolor=cRed>; +}; + +struct PRINT_PARAMETERS { + float BottomLiftHeight <fgcolor=cBlack, bgcolor=cRed>; + float BottomLiftSpeed <fgcolor=cBlack, bgcolor=cRed>; + float LiftHeight <fgcolor=cBlack, bgcolor=cRed>; + float LiftSpeed <fgcolor=cBlack, bgcolor=cRed>; + float RetractSpeed <fgcolor=cBlack, bgcolor=cRed>; + float VolumeMl <fgcolor=cBlack, bgcolor=cRed>; + float WeightG <fgcolor=cBlack, bgcolor=cRed>; + float CostDollars <fgcolor=cBlack, bgcolor=cRed>; + float BottomLightOffDelay <fgcolor=cBlack, bgcolor=cRed>; + float LightOffDelay <fgcolor=cBlack, bgcolor=cRed>; + + uint BottomLayerCount <fgcolor=cBlack, bgcolor=cRed>; + uint Padding1 <fgcolor=cBlack, bgcolor=cRed>; + uint Padding2 <fgcolor=cBlack, bgcolor=cRed>; + uint Padding3 <fgcolor=cBlack, bgcolor=cRed>; + uint Padding4 <fgcolor=cBlack, bgcolor=cRed>; +}; + +struct SLICER_INFO { + float BottomLiftDistance2 <fgcolor=cBlack, bgcolor=cRed>; + float BottomLiftSpeed2 <fgcolor=cBlack, bgcolor=cRed>; + float LiftHeight2 <fgcolor=cBlack, bgcolor=cRed>; + float LiftSpeed2 <fgcolor=cBlack, bgcolor=cRed>; + float RetractHeight2 <fgcolor=cBlack, bgcolor=cRed>; + float RetractSpeed2 <fgcolor=cBlack, bgcolor=cRed>; + float RestTimeAfterLift <fgcolor=cBlack, bgcolor=cRed>; + + uint MachineNameAddress <fgcolor=cBlack, bgcolor=cRed>; + uint MachineNameSize <fgcolor=cBlack, bgcolor=cRed>; + uint EncryptionMode <fgcolor=cBlack, bgcolor=cRed>; // 0/8 for cbddlp files, 0xF (15) for ctb files, 0x2000000F (536870927) for v3 ctb and 1073741839 for v4 ctb files to allow per layer parameters + uint MysteriousId <fgcolor=cBlack, bgcolor=cRed>; // v3 = 305419896 | v4 lightoff? = 27093086 | v4 rest? = 27093090 + uint AntiAliasLevel <fgcolor=cBlack, bgcolor=cRed>; + uint SoftwareVersion <fgcolor=cBlack, bgcolor=cRed>; // ctb v3 = 17171200 | ctb v4 = 16777216 + float RestTimeAfterRetract <fgcolor=cBlack, bgcolor=cRed>; + float RestTimeAfterLift2 <fgcolor=cBlack, bgcolor=cRed>; + uint TransitionLayerCount <fgcolor=cBlack, bgcolor=cRed>; + uint Padding1 <fgcolor=cBlack, bgcolor=cRed>; + uint Padding2 <fgcolor=cBlack, bgcolor=cRed>; + uint Padding3 <fgcolor=cBlack, bgcolor=cRed>; + + if(MachineNameAddress > 0 && MachineNameSize > 0) + { + char MachineName[MachineNameSize] <fgcolor=cBlack, bgcolor=cRed>; + } +}; + + +if(header.PreviewLargeOffsetAddress > 0) +{ + FSeek(header.PreviewLargeOffsetAddress); + PREVIEW previewLarge <fgcolor=cBlack, bgcolor=cYellow>; +} +if(header.PreviewSmallOffsetAddress > 0) +{ + FSeek(header.PreviewSmallOffsetAddress); + PREVIEW previewSmall <fgcolor=cBlack, bgcolor=cYellow>; +} + +if(header.PrintParametersOffsetAddress > 0){ + FSeek(header.PrintParametersOffsetAddress); + PRINT_PARAMETERS parameters <fgcolor=cBlack, bgcolor=cYellow>; +} + +if(header.SlicerOffset > 0){ + FSeek(header.SlicerOffset); + SLICER_INFO SlicerInfo <fgcolor=cBlack, bgcolor=cYellow>; +} + +if(header.Version >= 4) +{ + struct PRINT_PARAMETERS_V4 + { + char Disclaimer[320] <fgcolor=cBlack, bgcolor=cYellow>; + float BottomRetractSpeed <fgcolor=cWhite, bgcolor=cBlue>; + float BottomRetractSpeed2 <fgcolor=cWhite, bgcolor=cBlue>; + uint Padding1 <fgcolor=cWhite, bgcolor=cBlue>; + float Four1 <fgcolor=cWhite, bgcolor=cBlue>; // 4? + uint Padding2 <fgcolor=cWhite, bgcolor=cBlue>; + float Four2 <fgcolor=cWhite, bgcolor=cBlue>; // 4? + float RestTimeAfterRetract <fgcolor=cWhite, bgcolor=cBlue>; + float RestTimeAfterLift <fgcolor=cWhite, bgcolor=cBlue>; + float RestTimeBeforeLift <fgcolor=cWhite, bgcolor=cBlue>; + float BottomRetractHeight2 <fgcolor=cWhite, bgcolor=cBlue>; + float Unknown1 <fgcolor=cWhite, bgcolor=cBlue>; // 2955.996 or uint:1161347054 but changes + uint Unknown2 <fgcolor=cWhite, bgcolor=cBlue>; // 73470 but changes + uint Unknown3 <fgcolor=cWhite, bgcolor=cBlue>; // 5? + uint Unknown4 <fgcolor=cWhite, bgcolor=cBlue>; // 139 but changes + uint Padding3 <fgcolor=cWhite, bgcolor=cBlue>; + uint Padding4 <fgcolor=cWhite, bgcolor=cBlue>; + uint Padding5 <fgcolor=cWhite, bgcolor=cBlue>; + uint Padding6 <fgcolor=cWhite, bgcolor=cBlue>; + uint Unknown5 <fgcolor=cWhite, bgcolor=cBlue>; // 23047 but changes + uint Unknown6 <fgcolor=cWhite, bgcolor=cBlue>; // 320 but changes + byte Reserved[420] <fgcolor=cWhite, bgcolor=cBlue>; + } printParametersV4; +} + +typedef struct() { + float LayerPositionZ <fgcolor=cBlack, bgcolor=cRed>; + float LayerExposure <fgcolor=cBlack, bgcolor=cRed>; + float LightOffSeconds <fgcolor=cBlack, bgcolor=cRed>; + uint DataAddress <fgcolor=cBlack, bgcolor=cRed>; + uint DataSize <fgcolor=cBlack, bgcolor=cRed>; + uint Unknown1 <fgcolor=cBlack, bgcolor=cRed>; + uint Unknown2 <fgcolor=cBlack, bgcolor=cRed>; + uint Unknown3 <fgcolor=cBlack, bgcolor=cRed>; + uint Unknown4 <fgcolor=cBlack, bgcolor=cRed>; +} LAYER_DATA; + +typedef struct() { + LAYER_DATA LayerData <fgcolor=cBlack, bgcolor=cRed>; + uint TotalSize <fgcolor=cBlack, bgcolor=cRed>; + float LiftHeight <fgcolor=cBlack, bgcolor=cRed>; + float LiftSpeed <fgcolor=cBlack, bgcolor=cRed>; + float LiftHeight2 <fgcolor=cBlack, bgcolor=cRed>; + float LiftSpeed2 <fgcolor=cBlack, bgcolor=cRed>; + float RetractSpeed <fgcolor=cBlack, bgcolor=cRed>; + float RetractHeight2 <fgcolor=cBlack, bgcolor=cRed>; + float RetractSpeed2 <fgcolor=cBlack, bgcolor=cRed>; + float RestTimeBeforeLift <fgcolor=cBlack, bgcolor=cRed>; + float RestTimeAfterLift <fgcolor=cBlack, bgcolor=cRed>; + float RestTimeAfterRetract <fgcolor=cBlack, bgcolor=cRed>; + float LightPWM <fgcolor=cBlack, bgcolor=cRed>; +} LAYER_DATAEX; + + +typedef struct(int size) { + byte layerDataBlock[size] <fgcolor=cBlack, bgcolor=cGreen>; +} LAYER_RLE; + +FSeek(header.LayersDefinitionOffsetAddress); +struct LAYERS { + local int aa; + local int i; + local uint currentPos; + + for( aa = 0; aa < header.AntiAliasLevel; aa++) + { + for( i = 0; i < header.LayerCount; i++ ){ + LAYER_DATA layerData <fgcolor=cBlack, bgcolor=cYellow>; + currentPos = FTell(); + + if(header.Version >= 3) + { + FSeek(layerData.DataAddress - 84); + LAYER_DATAEX layerDataEx; + } + + FSeek(layerData.DataAddress); + LAYER_RLE layerRLE(layerData.DataSize); + FSeek(currentPos); + } + } +} layers; |