forked from Embroidermodder/libembroidery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformat-bro.c
54 lines (45 loc) · 1.79 KB
/
format-bro.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*! Reads a file with the given \a fileName and loads the data into \a pattern.
* Returns \c true if successful, otherwise returns \c false. */
static int readBro(EmbPattern* pattern, EmbFile* file, const char* fileName)
{
unsigned char x55;
short unknown1, unknown2, unknown3, unknown4, moreBytesToEnd;
char name[8];
int stitchType;
embPattern_loadExternalColorFile(pattern, fileName);
x55 = binaryReadByte(file);
unknown1 = binaryReadInt16(file); /* TODO: determine what this unknown data is */
embFile_read(name, 1, 8, file);
unknown2 = binaryReadInt16(file); /* TODO: determine what this unknown data is */
unknown3 = binaryReadInt16(file); /* TODO: determine what this unknown data is */
unknown4 = binaryReadInt16(file); /* TODO: determine what this unknown data is */
moreBytesToEnd = binaryReadInt16(file);
embFile_seek(file, 0x100, SEEK_SET);
while (1) {
short b1, b2;
stitchType = NORMAL;
b1 = binaryReadByte(file);
b2 = binaryReadByte(file);
if (b1 == -128) {
unsigned char bCode = binaryReadByte(file);
b1 = binaryReadInt16(file);
b2 = binaryReadInt16(file);
if (bCode == 2) {
stitchType = STOP;
} else if (bCode == 3) {
stitchType = TRIM;
} else if (bCode == 0x7E) {
break;
}
}
embPattern_addStitchRel(pattern, b1 / 10.0, b2 / 10.0, stitchType, 1);
}
embPattern_end(pattern);
return 1;
}
/*! Writes the data from \a pattern to a file with the given \a fileName.
* Returns \c true if successful, otherwise returns \c false. */
static int writeBro(EmbPattern* pattern, EmbFile* file, const char* fileName)
{
return 0; /*TODO: finish writeBro */
}