Difference between revisions of "GSD"

From Inkscape Wiki
Jump to navigation Jump to search
 
(11 intermediate revisions by the same user not shown)
Line 2: Line 2:


== The GSD binary file format ==
== The GSD binary file format ==
This is my first try to reverse engineer a binary file format. If you like, you could add your thoughts!
The file must begin with . This is a header to verify that it is the correct file type.
By comparison between different files with the extention .gsd i try to see what data is stored where. It has some parts in ansi-text and the most parts are just binary numbers of different length. As identification, the file starts with the text "GRAPHTEC PRT&CUT". The next line at offset 0000:0010 starts with binary numbers "03 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00" (I don't know if they make any sense there).
===Header===
{|border="0" cellspacing="0" cellpadding="0" align="left"
|0x00-0x0f ||"GRAPHTEC PRT&CUT"
|-
|0x10-0x17 ||0x06 00 00 00 01 00 00 00 00
|-
|0x18-0x7f ||This entire block is padded with zeros. There may be some other information stored, but in every sample file examined the data is simply 0.
|}


* From offset 0000:0080 to offset 0000:00cf is unknown binary data.
===Body===
* From offset 0000:00d3 to offset 0000:00de is binary data, which is exactly repeated from offset 0000:00fb to 0000:0107. It starts with the hex numbers 40 6a 40 which seems to be a marker for file seek. It ends with 40 00 04. Inbetween those bytes is data which funktion is still unknown.
The body consists of a number of blocks of data. Every block starts with a length chunk indicating how many chunks are contained within that block. For more complex data such as the actual lines, polylines, and pen information chunks may contain entire blocks in a hierarchy.


* Every object can have a different color in the 8bit-RGB-color-range. E.g. RGB(254,254,254), but most probably it is only black. RGB(0,0,0).
====Chunks====
The first two bytes of the chunk provide information on the purpos. The following 2 bytes indicate the type of data and the number of data elements of that type.


* The size of the canvas is written in pure ansi text. The value could be "ISO A4" or "Letter".
While the data typically follows this pattern, in some cases (most notably distance measurements) the "datatype" may indicate a different length than is actually used.
{| border="1" cellspacing="0" cellpadding="5" align="center"
!Header !!Description
|-
|00 ||1 byte of data stored in length byte
|-
|01 ||1-byte little endian 8-bit integer. Typically used for boolean values.
|-
|02 ||2-byte little endian 16-bit integer
|-
|03 ||4-byte little endian 32-bit integer
|-
|04 ||8-byte little endian double precision float. Usually for storing a distance in mm units
|-
|05 ||ASCII data chunks
|}


* The hex value 40 seems to be the delimiter between chunks of data of different length. Hex value ff ff ff semms to be a start delimiter and ff ff ff ff semms to be the end delimiter.
Based on several files generated using version 5.10 of the QuicKutz ROBO Master software, the following information has been deduced. In some cases the data observed in a given chunk is provided where the purpose is unknown.
 
{| border="1" cellspacing="0" align="left"
=== Footer ===
|+Drawing Object Types:
The footer is composed of several sections. A header portion, and several blocks of data. These blocks seem to be related to various configuration information, although the exact purpose is unknown. This is followed by a footer section of static length.
!Value !!Type
====Header====
|-
54 bytes - unknown data
|0 ||line
 
|-
====Blocks====
|1 ||polyline
The first two bytes of the block provide information on the purpose of the block. The following 2 bytes indicate the type of data and the number of data elements of that type.
|-
{| border="1" cellspacing="0" cellpadding="5" align="center"
|4 ||elliptical arc
!Header
!Description
|-
|-
|01
|5 ||nurb spline
|1-byte data chunks
|-
|-
|02
|6 ||text
|2-byte data chunks
|-
|-
|03
|7 ||rectangle
|4-byte data chunks
|-
|-
|05
|9 ||rounded rectangle
|ASCII data chunks
|}
|}




{| border="1" cellspacing="0" cellpadding="5" align="center"
 
|+Sample Block Data
{| border="1" cellspacing="0" align="left"
!Prefix !!Type !!Length !!Data
|+Chunk Types
!Prefix !!Suffix !!Description !!DataType !!Data Length
|-
|03
|-
| ||01 ||Number of Drawing Objects
|-
|04
|-
| ||00 ||Drawing Object
|-
| ||01 ||Drawing Object Type
|-
| ||0A ||2D Point
|-
| ||0B ||Polyline Length
|-
| ||0C ||Polyline Point
|-
| ||14 ||Sweep (radians)
|-
| ||15 ||Ecentricity?
|-
|-
|0x0108 ||05 ||13 ||"Graphtec Craft ROBO"
| ||16 ||(0=Open/1=Closed)
|-
|-
|0x0208 ||05 ||13 ||"Graphtec Craft ROBO"
| ||40 ||Bbox (Upper Left)
|-
|-
|0x0408 ||05 ||06 ||"Letter" (or whatever)
| ||41 ||Bbox (Upper Right)  
|-
|-
|0x0508 ||03 ||02 ||56 54 00 00 24 6D 00 00 (unk)
| ||42 ||Bbox (Lower Right)  
|-
|-
|0x1B08 ||01 ||01 ||00
| ||43 ||Bbox (Lower Left)
|-
|-
|0x2708 ||01 ||01 ||00
| ||44 ||Rotation
|-
|-
|0x1A08 ||02 ||01 ||64 00
|05
|-
|-
|0x0908 ||01 ||01 ||00
| ||21 ||Group
|-
|-
|0x0A08 ||03 ||01 ||00 00 00 00
|07
|-
|-
|0x0B08 ||03 ||01 ||00 00 00 00
| ||02 ||Number of Line Styles? ||03 ||01  
|-
|-
|0x0C08 ||01 ||01 ||00
| ||05 ||Dashed Line Pattern Cut Segment Length ||04 ||01 
|-
|-
|0x0D08 ||03 ||01 ||00 00 00 00
| ||06 ||Dashed Line Pattern Spacing Length ||04 ||01
|-
|-
|0x2208 ||01 ||01 ||00
|08
|-
|-
|0x2008 ||01 ||01 ||00
| ||01 ||Name of cutter? ||05 ||var
|-
|-
|0x2108 ||02 ||01 ||00 00
| ||02 ||Name of cutter? ||05 ||var
|-
|-
|0x2308 ||02 ||01 ||01 00
| ||04 ||Text description of paper type ||05 ||var
|-
|-
|0x2408 ||03 ||01 ||6F 08 00 00
| ||05 ||Paper size in 0.01mm units (Width, Height) ||03 ||02
|-
|-
|0x2508 ||03 ||01 ||EA 0A 00 00
| ||08 ||Cutting Rotation Angle ||02 ||01
|-
|-
|0x2608 ||02 ||01 ||01 00
| ||09 ||Offset Enabled ||01 ||01  
|-
|-
|0x0808 ||02 ||01 ||00 00
| ||0A ||Offset X ||03 ||01
|-
|-
|0x0E08 ||01 ||01 ||00
| ||0B ||Offset Y ||03 ||01
|-
|-
|0x0F08 ||01 ||01 ||01
| ||0C ||Weed Border Enabled ||01 ||01  
|-
|-
|0x1008 ||03 ||01 ||00 00 00 00
| ||0D ||Weed Border Distance ||03 ||01  
|-
|-
|0x1E08 ||01 ||01 ||01
| ||0E ||Feed Media Enabled ||01 ||01  
|-
|-
|0x1F08 ||01 ||01 ||01
| ||0F ||Feed Media Source (00-Start, 01-End) ||02 ||01  
|-
|-
|0x1108 ||01 ||01 ||00
| ||10 ||Feed Length ||03 ||01
|-
|-
|0x1C08 ||03 ||01 ||00 00 00 00
| ||11 ||Tiling Enabled ||01 ||01
|-
|-
|0x1D08 ||03 ||01 ||00 00 00 00
| ||14 ||Tiling Overlap ||03 ||01  
|-
|-
|0x1408 ||03 ||01 ||00 00 00 00
| ||1A ||Scaling ||02 ||01
|}
====Footer====
{| border="1" cellspacing="0" cellpadding="5" align="center"
!Length !!Description
|-
|-
|0x34 bytes ||unknown
| ||1C ||Tiling Media Width ||03 ||01
|-
|-
|4 bytes ||unknown (00 0E 00 0A)
| ||1D ||Tiling Media Height ||03 ||01
|-
|-
|5 bytes ||unknown (01 0E 01 01 01)
| ||21 ||Print Rotation Angle ||02 ||01  
|-
|-
|6 bytes ||unknown (02 0E 02 01 01 00)
| ||22 ||Print Cut Lines Enabled ||01 ||01  
|-
|-
|5 bytes ||unknown (03 0E 02 01 01)
| ||23 ||ID for print paper size? ||02 ||01  
|-
|-
|1 byte ||use registration mark (bool)
| ||24 ||Paper Width in 0.1mm units ||03 ||01
|-
|-
|4 bytes ||unknown (0A 0E 04 01)
| ||25 ||Paper Height in 0.1mm units ||03 ||01  
|-
|-
|8 bytes ||unknown dimension
| ||26 ||Paper Orientation (01=Portrait, 02=Landscape) ||02 ||01
|-
|-
|3 bytes ||unknown (0B 0E 02)
|0A
|-
|-
|1 byte ||unknown (0x01)
| ||00 ||Page Style?
|-
|-
|8 bytes ||registration mark size
|0B
|-
|-
|16 bytes ||unknown (0C 0E 03 01)
| ||00 ||Line Style?
|-
|-
|8 bytes ||origin X
|0E
|-
|-
|4 bytes ||unknown (0D 0E 03 01)
| ||00 ||Registration Mark Settings
|-
|-
|8 bytes ||origin Y
| ||01 ||Show Registration Marks Enabled ||01 ||01
|-
|-
|3 bytes ||unknown (0E 0E 03)
| ||02 ||Registration Mode(00=2, 01=3, 02=4) ||02 ||01
|-
|-
|1 byte ||show grid (boolean)
| ||03 ||Registration Pattern(01=Normal, 00=Inward) ||02 ||01
|-
|-
|8 bytes ||Registration Mark distance 1-2
| ||0A ||Registration Size
|-
|-
|4 bytes ||unknown (0F 0E 03 01)
| ||0B ||Registration Thickness
|-
|-
|8 bytes ||Registration mark distance 1-3
| ||0C ||Origin X
|-
|-
|5 bytes ||unknown (11 0E 01 01 00)
| ||0D ||Origin Y
|-
|-
|4 bytes ||unknown (06 06 00 00)
| ||0E ||Distance (1-2)  
|-
|-
|4 bytes ||unknown (00 0F 00 04)
| ||0F ||Distance (2-3)  
|-
|-
|4 bytes ||unknown (01 0F 01 01)
| ||10 ||Exceeds Maximum Recommended Length of 31.5"
|-
|-
|1 byte ||unknown (00)
|0F
|-
|-
|4 bytes ||unknown (02 0F 02 01)
| ||00 ||Grid Settings
|-
|-
|2 bytes ||grid type(0=line, 1=dot)
| ||01 ||Show Grid ||01 ||01
|-
|-
|4 bytes ||unknown (03 0F 04 01)
| ||02 ||Grid Type (00=Line, 01=Dot) ||02 ||01
|-
|-
|8 bytes ||grid size
| ||03 ||Grid Spacing ||04 ||01
|-
|-
|4 bytes ||unknown (04 0F 01 01)
| ||04 ||Grid Snap Enabled ||01 ||01  
|-
|-
|1 byte ||snap to grid(bool)
|10
|-
|-
|8 bytes ||unknown (00 10 03 01 00 00 00 00)
| ||00 ||End of File
|-
|-
|<EOF>
|}
|}

Latest revision as of 19:47, 7 November 2009


The GSD binary file format

The file must begin with . This is a header to verify that it is the correct file type.

Header

0x00-0x0f "GRAPHTEC PRT&CUT"
0x10-0x17 0x06 00 00 00 01 00 00 00 00
0x18-0x7f This entire block is padded with zeros. There may be some other information stored, but in every sample file examined the data is simply 0.

Body

The body consists of a number of blocks of data. Every block starts with a length chunk indicating how many chunks are contained within that block. For more complex data such as the actual lines, polylines, and pen information chunks may contain entire blocks in a hierarchy.

Chunks

The first two bytes of the chunk provide information on the purpos. The following 2 bytes indicate the type of data and the number of data elements of that type.

While the data typically follows this pattern, in some cases (most notably distance measurements) the "datatype" may indicate a different length than is actually used.

Header Description
00 1 byte of data stored in length byte
01 1-byte little endian 8-bit integer. Typically used for boolean values.
02 2-byte little endian 16-bit integer
03 4-byte little endian 32-bit integer
04 8-byte little endian double precision float. Usually for storing a distance in mm units
05 ASCII data chunks

Based on several files generated using version 5.10 of the QuicKutz ROBO Master software, the following information has been deduced. In some cases the data observed in a given chunk is provided where the purpose is unknown.

Drawing Object Types:
Value Type
0 line
1 polyline
4 elliptical arc
5 nurb spline
6 text
7 rectangle
9 rounded rectangle


Chunk Types
Prefix Suffix Description DataType Data Length
03
01 Number of Drawing Objects
04
00 Drawing Object
01 Drawing Object Type
0A 2D Point
0B Polyline Length
0C Polyline Point
14 Sweep (radians)
15 Ecentricity?
16 (0=Open/1=Closed)
40 Bbox (Upper Left)
41 Bbox (Upper Right)
42 Bbox (Lower Right)
43 Bbox (Lower Left)
44 Rotation
05
21 Group
07
02 Number of Line Styles? 03 01
05 Dashed Line Pattern Cut Segment Length 04 01
06 Dashed Line Pattern Spacing Length 04 01
08
01 Name of cutter? 05 var
02 Name of cutter? 05 var
04 Text description of paper type 05 var
05 Paper size in 0.01mm units (Width, Height) 03 02
08 Cutting Rotation Angle 02 01
09 Offset Enabled 01 01
0A Offset X 03 01
0B Offset Y 03 01
0C Weed Border Enabled 01 01
0D Weed Border Distance 03 01
0E Feed Media Enabled 01 01
0F Feed Media Source (00-Start, 01-End) 02 01
10 Feed Length 03 01
11 Tiling Enabled 01 01
14 Tiling Overlap 03 01
1A Scaling 02 01
1C Tiling Media Width 03 01
1D Tiling Media Height 03 01
21 Print Rotation Angle 02 01
22 Print Cut Lines Enabled 01 01
23 ID for print paper size? 02 01
24 Paper Width in 0.1mm units 03 01
25 Paper Height in 0.1mm units 03 01
26 Paper Orientation (01=Portrait, 02=Landscape) 02 01
0A
00 Page Style?
0B
00 Line Style?
0E
00 Registration Mark Settings
01 Show Registration Marks Enabled 01 01
02 Registration Mode(00=2, 01=3, 02=4) 02 01
03 Registration Pattern(01=Normal, 00=Inward) 02 01
0A Registration Size
0B Registration Thickness
0C Origin X
0D Origin Y
0E Distance (1-2)
0F Distance (2-3)
10 Exceeds Maximum Recommended Length of 31.5"
0F
00 Grid Settings
01 Show Grid 01 01
02 Grid Type (00=Line, 01=Dot) 02 01
03 Grid Spacing 04 01
04 Grid Snap Enabled 01 01
10
00 End of File