//------------------------------------------------ //--- 010 Editor v8.0.1 Binary Template // // File: osf (vlare) // Authors: Tiago Conceição //------------------------------------------------ BigEndian(); enum BOOL { False, True }; struct PREVIEW { BitfieldDisablePadding(); uint PreviewLength:24 ; ubyte PreviewData[PreviewLength] ; }; struct HEADER { uint HeaderLength ; ushort Version ; // 1 ubyte ImageLog ; // log 2 PREVIEW preview; PREVIEW preview; PREVIEW preview; PREVIEW preview; ushort ResolutionX ; ushort ResolutionY ; ushort PixelUmMagnified100Times ; // (um, magnification 100 times: such as 100um write 10000, the same below) //ubyte Mirror ; // (0x00 not mirrored, 0x01 X-axis mirroring, 0x02 Y-axis mirroring, 0x03 XY-axis mirroring) enum { None, Horizontally, Vertically, Both } Mirror ; ubyte BottomLightPWM ; ubyte LightPWM ; BOOL AntiAliasEnabled ; BOOL DistortionEnabled ; BOOL DelayedExposureActivationEnabled ; uint LayerCount ; ushort NumberParameterSets ; // 1 uint LastLayerIndex ; uint LayerHeightUmMagnified100Times:24 ; // (um magnification 100 times) ubyte BottomLayersCount ; uint ExposureTimeMagnified100Times:24 ; // s * 100 uint BottomExposureTimeMagnified100Times:24 ; // s * 100 uint SupportDelayTimeMagnified100Times:24 ; // s * 100 uint BottomSupportDelayTimeMagnified100Times:24 ; // s * 100 ubyte TransitionLayers ; ubyte TransitionType ; // (0x00 linear transition) uint TransitionLayerIntervalTimeDifferenceMagnified100Times:24 ; // s * 100 uint WaitTimeAfterCureMagnified100Times:24 ; // s * 100 uint WaitTimeAfterLiftMagnified100Times:24 ; // s * 100 uint WaitTimeBeforeCureMagnified100Times:24 ; // s * 100 uint BottomLiftHeightSlowMagnified1000Times:24 ; // (magnification 1000 times) uint BottomLiftHeightTotalMagnified1000Times:24 ; // (magnification 1000 times) uint LiftHeightSlowMagnified1000Times:24 ; // (magnification 1000 times) uint LiftHeightTotalMagnified1000Times:24 ; // (magnification 1000 times) uint BottomRetractHeightSlowMagnified1000Times:24 ; // (magnification 1000 times) uint BottomRetractHeightTotalMagnified1000Times:24 ; // (magnification 1000 times) uint RetractHeightSlowMagnified1000Times:24 ; // (magnification 1000 times) uint RetractHeightTotalMagnified1000Times:24 ; // (magnification 1000 times) ubyte AccelerationType ; // (0x00: S-shaped acceleration, 0x01: T-shaped acceleration, Default Value: S-shaped acceleration, currently only supports S-shaped acceleration) ushort BottomLiftSpeedStart ; ushort BottomLiftSpeedSlow ; ushort BottomLiftSpeedFast ; ubyte BottomLiftAccelerationChange ; // 5 ushort LiftSpeedStart ; ushort LiftSpeedSlow ; ushort LiftSpeedFast ; ubyte LiftAccelerationChange ; // 5 ushort BottomRetractSpeedStart ; ushort BottomRetractSpeedSlow ; ushort BottomRetractSpeedFast ; ubyte BottomRetractAccelerationChange ; // 5 ushort RetractSpeedStart ; ushort RetractSpeedSlow ; ushort RetractSpeedFast ; ubyte RetractAccelerationChange ; // 5 ushort BottomLiftSpeedEnd ;// 7 ubyte BottomLiftDecelerationChange ; // 5 ushort LiftSpeedEnd ;// 7 ubyte LiftDecelerationChange ; // 5 ushort BottomRetractSpeedEnd ;// 7 ubyte BottomRetractDecelerationChange ; // 5 ushort RetractSpeedEnd ; // 7 ubyte RetractDecelerationChange ; // 5 ushort BottomWaitTimeAfterCureMagnified100Times ; // s * 100 ushort BottomWaitTimeAfterLiftMagnified100Times ; // s * 100 ushort BottomWaitTimeBeforeCureMagnified100Times ; // s * 100 ushort Reserved ; ubyte ProtocolType ; // 0 local int leftover = HeaderLength - 350001; /*if(HeaderLength == 350013) // VLR { uint Unknown ; // 350054 ubyte Unknown1[8] ; leftover -= 12; }*/ if(leftover > 0) { ubyte LeftOvers[leftover] ; } } header; struct LAYER_DEF { ushort Mark ; // (OD OA begins, indicating that the model + support is included; the beginning of 0D 0B, indicating that the layer only has support data) uint NumberOfLines ; ushort StartY ; local long currentPos = FTell(); local long rleSize = 0; if (NumberOfLines > 0) { local byte buffer; local byte slen; while(!FEof()) { buffer = ReadByte(); if ((buffer & 0x01) == 0x01) // It's a run { FSkip(1); slen = ReadByte(); if (buffer == 0x0D && (slen == 0x0A || slen == 0x0B)) { break; } FSkip(1); rleSize += 2; if ((slen & 0x80) == 0) {} else if ((slen & 0xc0) == 0x80) { rleSize++; FSkip(1); } else if ((slen & 0xe0) == 0xc0) { rleSize += 2; FSkip(2); } else if ((slen & 0xf0) == 0xe0) { rleSize += 3; FSkip(3); } } else { rleSize++; FSkip(1); } } FSeek(currentPos); ubyte RLE[rleSize] ; } }; FSeek(header.HeaderLength); struct LAYERS { local int i = 0; for( i = 0; i < header.LayerCount; i++ ){ LAYER_DEF layerDef ; } } layers;