mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-11 11:02:32 +02:00
72d8636d4a
- **(Fix) Layers:** - Round properties before comparing to avoid the precision error - Prevent 'Wait time' properties from having negative values - The `RetractSpeed` or `RetractSpeed2` property wasn't setting the bottom speed for bottom layers, instead the normal retract speed was always used - Set the `RetractHeight2` or `RetractSpeed2` property was not notifing the timer to update the print time no - Propagate global settings to layers now identfies the bottom layers per height instead of layer index - (Add) UVJ: Support TSMC for the file format - (Fix) UVJ: Soft save was not updating the layer settings - (Fix) CTB: TSMC not working properly due incorrect layer `LiftHeight` value calculation
189 lines
4.9 KiB
Plaintext
189 lines
4.9 KiB
Plaintext
//--------------------------------------
|
|
//--- 010 Editor v6.0.3 Binary Template
|
|
//
|
|
// File: ctb
|
|
// Author: Tim Slater
|
|
// Revision: 1
|
|
// Purpose: CTB File Format
|
|
//--------------------------------------
|
|
|
|
struct HEADER {
|
|
uint Magic <fgcolor=cBlack, bgcolor=cRed, format=hex>;
|
|
uint HeaderSize <fgcolor=cBlack, bgcolor=cRed>;
|
|
uint HeaderOffset <fgcolor=cBlack, bgcolor=cRed, format=hex>;
|
|
uint unknown1;
|
|
uint unknown2;
|
|
uint SignatureSize <fgcolor=cBlack, bgcolor=cRed>;
|
|
uint SignatureOffset <fgcolor=cBlack, bgcolor=cRed, format=hex>;
|
|
uint unknown3;
|
|
ushort unknown4;
|
|
ushort unknown5;
|
|
uint unknown6;
|
|
uint unknown7;
|
|
uint unknown9;
|
|
} header;
|
|
|
|
FSeek(header.HeaderOffset);
|
|
|
|
struct DECRYPTED_HEADER {
|
|
uint64 ChecksumValue;
|
|
uint LayerTableOffset;
|
|
float DisplayWidth;
|
|
float DisplayHeight;
|
|
float MachineZ;
|
|
uint Unknown1;
|
|
uint Unknown2;
|
|
float TotalHeightMilimeter;
|
|
float LayerHeight;
|
|
float ExposureTime;
|
|
float BottomExposureTime;
|
|
float LightOffDelay;
|
|
uint BottomLayerCount;
|
|
uint ResolutionX;
|
|
uint ResolutionY;
|
|
uint LayerCount;
|
|
uint LargePreviewOffset;
|
|
uint SmallPreviewOffset;
|
|
uint PrintTime;
|
|
uint ProjectorType;
|
|
float BottomLiftHeight;
|
|
float BottomLiftSpeed;
|
|
float LiftHeight;
|
|
float LiftSpeed;
|
|
float RetractSpeed; /* might be bottom retract speed, need to verify */
|
|
float ModelVolume;
|
|
float ModelWeight;
|
|
float Cost;
|
|
float BottomLightOffDelay;
|
|
uint Unknown3;
|
|
ushort LightPWM; /* these might be in the wrong order */
|
|
ushort BottomLightPWM;
|
|
uint LayerXorKey;
|
|
float BottomLiftHeight2;
|
|
float BottomLiftSpeed2;
|
|
float LiftingHeight2;
|
|
float LiftingSpeed2;
|
|
float RetractHeight2;
|
|
float RetractSpeed2;
|
|
float RestTimeAfterLift;
|
|
uint PrinterNameOffset;
|
|
uint PrinterNameSize;
|
|
uint Unknown4;
|
|
uint unknown5;
|
|
uint unknown6;
|
|
float RestTimeAfterRetract;
|
|
float RestTimeAfterLift;
|
|
uint TransitionLayerCount;
|
|
float BottomRetractSpeed;
|
|
float BottomRetractSpeed2;
|
|
uint Padding1;
|
|
float Four1;
|
|
uint Padding2;
|
|
float Four2;
|
|
float RestTimeAfterRetract;
|
|
float RestTimeAfterLift;
|
|
float RestTimeBeforeLift;
|
|
float BottomRetractHeight;
|
|
float unknown7;
|
|
uint unknown8;
|
|
uint unknown9;
|
|
uint LastLayerIndex;
|
|
uint Padding3;
|
|
uint Padding4;
|
|
uint Padding5;
|
|
uint Padding6;
|
|
uint DisclaimerOffset;
|
|
uint DisclaimerSize;
|
|
uint Padding7;
|
|
uint Padding8;
|
|
uint Padding9;
|
|
uint Padding10;
|
|
};
|
|
|
|
|
|
DECRYPTED_HEADER decryptedHeader;
|
|
|
|
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>;
|
|
|
|
byte Data[ImageLength] <fgcolor=cBlack, bgcolor=cGreen>;
|
|
} LargePreview;
|
|
|
|
PREVIEW SmallPreview;
|
|
|
|
FSeek(decryptedHeader.PrinterNameOffset);
|
|
char MachineName[decryptedHeader.PrinterNameSize] <fgcolor=cBlack, bgcolor=cYellow>;
|
|
|
|
char Disclaimer[320] <fgcolor=cBlack, bgcolor=cPurple>;
|
|
|
|
FSeek(decryptedHeader.LayerTableOffset);
|
|
|
|
/* need to walk the layer index table to get a count of them.
|
|
the actual count field is in the encrypted header */
|
|
|
|
struct LAYER_POINTER {
|
|
uint Offset;
|
|
uint Padding1;
|
|
uint LayerTableSize;
|
|
uint Padding2;
|
|
} layerPointers[decryptedHeader.LayerCount];
|
|
|
|
struct LAYER_HEADER{
|
|
uint LayerMarker <hidden=true>;
|
|
float PositionZ;
|
|
float ExposureTime;
|
|
float LightOffDelay;
|
|
uint LayerDataOffset;
|
|
uint unknown2;
|
|
uint LayerDataLength;
|
|
uint unknown3;
|
|
uint EncryptedDataOffset;
|
|
uint EncryptedDataLength;
|
|
float LiftHeight;
|
|
float LiftSpeed;
|
|
float LiftHeight2;
|
|
float LiftSpeed2;
|
|
float RetractSpeed;
|
|
float RetractHeight2;
|
|
float RetractSpeed2;
|
|
float RestTimeBeforeLift;
|
|
float RestTimeAfterLift;
|
|
float RestTimeAfterRetract;
|
|
float LightPWM; /* just a guess, has value 255 as a float */
|
|
uint unknown6;
|
|
};
|
|
|
|
struct LAYER {
|
|
LAYER_HEADER layerHeader;
|
|
FSeek(layerHeader.LayerDataOffset);
|
|
|
|
/* do we have encrypted data? */
|
|
if (layerHeader.EncryptedDataLength > 0) {
|
|
|
|
if (layerHeader.EncryptedDataOffset > 0) {
|
|
ubyte normalLayerData1[layerHeader.EncryptedDataOffset];
|
|
ubyte encrytedLayerData[layerHeader.EncryptedDataLength];
|
|
ubyte normalLayerData2[layerHeader.LayerDataLength - (layerHeader.EncryptedDataOffset + layerHeader.EncryptedDataLength)];
|
|
} else {
|
|
ubyte encrytedLayerData[layerHeader.EncryptedDataLength];
|
|
ubyte normalLayerData[layerHeader.LayerDataLength - layerHeader.EncryptedDataLength];
|
|
}
|
|
|
|
} else {
|
|
ubyte layerData[layerHeader.LayerDataLength] <format=binary>;
|
|
}
|
|
};
|
|
|
|
struct LAYERS {
|
|
local uint x;
|
|
for(x = 0; x < decryptedHeader.LayerCount; x++) {
|
|
FSeek(layerPointers[x].Offset);
|
|
LAYER layer;
|
|
}
|
|
} layers;
|
|
|
|
ubyte Sha256Hash[0x20]<format=hex>;
|