Loading ...
Sorry, an error occurred while loading the content.

FCW format and existing FCW->SVG code

Expand Messages
  • bcholmes2001
    Hi, I m trying to understand the FCW file format, and I m using the existing FCW to SVG source code (from the attachments area) as a base. Sadly, it s making
    Message 1 of 10 , Feb 18, 2012
    • 0 Attachment
      Hi,

      I'm trying to understand the FCW file format, and I'm using the existing FCW to SVG source code (from the attachments area) as a base. Sadly, it's making me very confused, and I was hoping that clear things up for me.

      I get the overall structure of the code -- my question is a really nitty-gritty.

      When I process each block in the source, I'm able to see the size and type of each block. For example, a type 6 block seems to map to a basic circle (the structure of which is defined in the header.h file). The common header of each block takes about 28 bytes. In addition to the common header, there are three float values, indicating the x, y, and radius of the circle.

      The part that confuses me is that when I try to run this code against some FCW maps, the circle blocks are consistently identifying themselves as 36 byte blocks, whereas the struct seems to be defining a 40-bytes construct.

      Am I somehow miscounting this? (I've done all the obvious things, I think -- I've sizeof'ed Cir2 and double-checked the logic in the file.

      Is this just something that never worked correctly in the original code? Or was the code written against a version of the file format that's no longer valid?

      Any help would be appreciated.

      BC
    • Joseph Slayton
      Make sure that your compiler is honoring the #pragma pack() that defines the structure packing. Also make sure that it s not padding the structure to the next
      Message 2 of 10 , Feb 19, 2012
      • 0 Attachment
        Make sure that your compiler is honoring the #pragma pack() that defines the structure packing. Also make sure that it's not padding the structure to the next packing boundary (for example, natural packing for Pentium Pro and later processors is 8-byte or 16-byte cache lines; some compilers will pack a 36-byte structure to 40 bytes to force 8-byte alignment in some cases).
         
        > To: cc2-dev-l@yahoogroups.com
        > From: bcholmes2001@...
        > Date: Sun, 19 Feb 2012 01:09:23 +0000
        > Subject: [cc2-dev-l] FCW format and existing FCW->SVG code
        >
        > Hi,
        >
        > I'm trying to understand the FCW file format, and I'm using the existing FCW to SVG source code (from the attachments area) as a base. Sadly, it's making me very confused, and I was hoping that clear things up for me.
        >
        > I get the overall structure of the code -- my question is a really nitty-gritty.
        >
        > When I process each block in the source, I'm able to see the size and type of each block. For example, a type 6 block seems to map to a basic circle (the structure of which is defined in the header.h file). The common header of each block takes about 28 bytes. In addition to the common header, there are three float values, indicating the x, y, and radius of the circle.
        >
        > The part that confuses me is that when I try to run this code against some FCW maps, the circle blocks are consistently identifying themselves as 36 byte blocks, whereas the struct seems to be defining a 40-bytes construct.
        >
        > Am I somehow miscounting this? (I've done all the obvious things, I think -- I've sizeof'ed Cir2 and double-checked the logic in the file.
        >
        > Is this just something that never worked correctly in the original code? Or was the code written against a version of the file format that's no longer valid?
        >
        > Any help would be appreciated.
        >
        > BC
        >
      • bcholmes2001
        ... Thanks for the reply! I actually figured out my problem: the format appears to have changed. The file I was working with was an old version (the dbVer in
        Message 3 of 10 , Feb 20, 2012
        • 0 Attachment
          --- In cc2-dev-l@yahoogroups.com, Joseph Slayton <waldronate@...> wrote:
          >
          > Make sure that your compiler is honoring the #pragma pack() that
          > defines the structure packing. Also make sure that it's not padding
          > the structure to the next packing boundary (for example, natural
          > packing for Pentium Pro and later processors is 8-byte or 16-byte
          > cache lines; some compilers will pack a 36-byte structure to 40
          > bytes to force 8-byte alignment in some cases).


          Thanks for the reply!

          I actually figured out my problem: the format appears to have changed. The file I was working with was an old version (the dbVer in the fileId was '21'), whereas the same block type (6) in version '24' is the correct 40 bytes long.

          I have another question: the existing code doesn't support from block types. I've noticed type 5 (which appears to be the type for text labels) and type 0x81 (metadata?). Does anyone know the structure for these types?

          BC
        • bcholmes2001
          ... I ve looked into reverse engineering the format for the text labels, and figured out this much: 0x00 - 0x1B : standard block header 0x1C - 0x1D : ?? 0x1E
          Message 4 of 10 , Feb 20, 2012
          • 0 Attachment
            > I have another question: the existing code doesn't support [for
            > some] block types. I've noticed type 5 (which appears to be the
            > type for text labels) and type 0x81 (metadata?). Does anyone
            > know the structure for these types?

            I've looked into "reverse engineering" the format for the text labels, and figured out this much:

            0x00 - 0x1B : standard block header
            0x1C - 0x1D : ??
            0x1E - 0x25 : Coordinate
            0x26 - 0x3A : ??
            0x3B - varies : null-terminated String text

            I'm sure I can figure out the reference to font id and font size.

            Supporting text introduces a new weirdness, however. CC3's coordinate system is different from SVG's. CC3 uses a "natural" coordinate system, with the largest numbers in the upper right hand corner. SVG uses the (horrible, icky) coordinate system where the largest numbers are in the bottom right hand corner. You'd think it'd be easy to just transform (flip) the entire SVG group, except that makes the text appear upside-down. Le sigh.

            BC
          • Joseph Slayton
            The FCW definition header file in the SVG converter is woefully incomplete. There is an XP development kit that has all of the definitions in it. The
            Message 5 of 10 , Feb 20, 2012
            • 0 Attachment
              The FCW definition header file in the SVG converter is woefully incomplete. There is an XP development kit that has all of the definitions in it. The ProFantasy web site should have more information on the development kit.
               
              Anyhow, the following definitions should help:
               
              // from _geometry.h
              typedef struct
              {
               short Font;
               GPOINT2 Origin;
               float Hght;
               float XScl;
               float BAng;
               float Spacing;
               short TFlags;
               short DFlags;
               short Just;
               char TData[];
              } GTEXT2;

              // from _estruc.h
              typedef struct
              {
               CSTUFF CStuff;  // entity properties
               GTEXT2 Text;
              }TXT2;

              The CSTUFF definition is listed as Common in the header.h in the SVG converter.
               
              > To: cc2-dev-l@yahoogroups.com
              > From: yahoo@...
              > Date: Mon, 20 Feb 2012 21:15:42 +0000
              > Subject: [cc2-dev-l] Re: FCW format and existing FCW->SVG code
              >
              > > I have another question: the existing code doesn't support [for
              > > some] block types. I've noticed type 5 (which appears to be the
              > > type for text labels) and type 0x81 (metadata?). Does anyone
              > > know the structure for these types?
              >
              > I've looked into "reverse engineering" the format for the text labels, and figured out this much:
              >
              > 0x00 - 0x1B : standard block header
              > 0x1C - 0x1D : ??
              > 0x1E - 0x25 : Coordinate
              > 0x26 - 0x3A : ??
              > 0x3B - varies : null-terminated String text
              >
              > I'm sure I can figure out the reference to font id and font size.
              >
              > Supporting text introduces a new weirdness, however. CC3's coordinate system is different from SVG's. CC3 uses a "natural" coordinate system, with the largest numbers in the upper right hand corner. SVG uses the (horrible, icky) coordinate system where the largest numbers are in the bottom right hand corner. You'd think it'd be easy to just transform (flip) the entire SVG group, except that makes the text appear upside-down. Le sigh.
              >
              > BC
              >
              >
              >
              >
              > ------------------------------------
              >
              > To Post a message, send it to: cc2-dev-l@...
              > To Unsubscribe, send a blank message to: cc2-dev-l-unsubscribe@...! Groups Links
              >
              > <*> To visit your group on the web, go to:
              > http://groups.yahoo.com/group/cc2-dev-l/
              >
              > <*> Your email settings:
              > Individual Email | Traditional
              >
              > <*> To change settings online go to:
              > http://groups.yahoo.com/group/cc2-dev-l/join
              > (Yahoo! ID required)
              >
              > <*> To change settings via email:
              > cc2-dev-l-digest@yahoogroups.com
              > cc2-dev-l-fullfeatured@yahoogroups.com
              >
              > <*> To unsubscribe from this group, send an email to:
              > cc2-dev-l-unsubscribe@yahoogroups.com
              >
              > <*> Your use of Yahoo! Groups is subject to:
              > http://docs.yahoo.com/info/terms/
              >
            • L. Lee Saunders
              The latest XP development Kit code (for CC3) is available for download on Peter Olsen s site: http://www.pkdata.se/xp/download/xpdev-cc3.zip This should give
              Message 6 of 10 , Feb 20, 2012
              • 0 Attachment
                The latest XP development Kit code (for CC3) is available for download on Peter Olsen's site:
                 
                http://www.pkdata.se/xp/download/xpdev-cc3.zip

                This should give you a complete "view" into the file format.

                L. Lee Saunders
                 
                "It was only a partial solution, of course, as solutions usually are, and addressed only one specific problem, as solutions usually do. But, as was often also true, it opened the door—if only a crack—for the multitude of solutions to follow." 
                1632 - Eric Flint
                 
                my blog: http://oldschooldotnet.blogspot.com
                Taking Dot Net "Old School" - Playing with old ideas/concepts using the newest tools!
                 
                 


                 

                To: cc2-dev-l@yahoogroups.com
                From: waldronate@...
                Date: Mon, 20 Feb 2012 14:22:16 -0800
                Subject: RE: [cc2-dev-l] Re: FCW format and existing FCW->SVG code

                 
                The FCW definition header file in the SVG converter is woefully incomplete. There is an XP development kit that has all of the definitions in it. The ProFantasy web site should have more information on the development kit.
                 
                Anyhow, the following definitions should help:
                 
                // from _geometry.h
                typedef struct
                {
                 short Font;
                 GPOINT2 Origin;
                 float Hght;
                 float XScl;
                 float BAng;
                 float Spacing;
                 short TFlags;
                 short DFlags;
                 short Just;
                 char TData[];
                } GTEXT2;

                // from _estruc.h
                typedef struct
                {
                 CSTUFF CStuff;  // entity properties
                 GTEXT2 Text;
                }TXT2;

                The CSTUFF definition is listed as Common in the header.h in the SVG converter.
                 
                > To: cc2-dev-l@yahoogroups.com
                > From: yahoo@...
                > Date: Mon, 20 Feb 2012 21:15:42 +0000
                > Subject: [cc2-dev-l] Re: FCW format and existing FCW->SVG code
                >
                > > I have another question: the existing code doesn't support [for
                > > some] block types. I've noticed type 5 (which appears to be the
                > > type for text labels) and type 0x81 (metadata?). Does anyone
                > > know the structure for these types?
                >
                > I've looked into "reverse engineering" the format for the text labels, and figured out this much:
                >
                > 0x00 - 0x1B : standard block header
                > 0x1C - 0x1D : ??
                > 0x1E - 0x25 : Coordinate
                > 0x26 - 0x3A : ??
                > 0x3B - varies : null-terminated String text
                >
                > I'm sure I can figure out the reference to font id and font size.
                >
                > Supporting text introduces a new weirdness, however. CC3's coordinate system is different from SVG's. CC3 uses a "natural" coordinate system, with the largest numbers in the upper right hand corner. SVG uses the (horrible, icky) coordinate system where the largest numbers are in the bottom right hand corner. You'd think it'd be easy to just transform (flip) the entire SVG group, except that makes the text appear upside-down. Le sigh.
                >
                > BC
                >
                >
                >
                >
                > ------------------------------------
                >
                > To Post a message, send it to: cc2-dev-l@...
                > To Unsubscribe, send a blank message to: cc2-dev-l-unsubscribe@...! Groups Links
                >
                > <*> To visit your group on the web, go to:
                > http://groups.yahoo.com/group/cc2-dev-l/
                >
                > <*> Your email settings:
                > Individual Email | Traditional
                >
                > <*> To change settings online go to:
                > http://groups.yahoo.com/group/cc2-dev-l/join
                > (Yahoo! ID required)
                >
                > <*> To change settings via email:
                > cc2-dev-l-digest@yahoogroups.com
                > cc2-dev-l-fullfeatured@yahoogroups.com
                >
                > <*> To unsubscribe from this group, send an email to:
                > cc2-dev-l-unsubscribe@yahoogroups.com
                >
                > <*> Your use of Yahoo! Groups is subject to:
                > http://docs.yahoo.com/info/terms/
                >


              • BC Holmes
                ... [...] ... Oh, awesomecakes! That s tremendously helpful! I ll poke around on the web site for the XP development kit. BCing you -- B.C. Holmes
                Message 7 of 10 , Feb 20, 2012
                • 0 Attachment
                  On 12-02-20 5:22 PM, Joseph Slayton wrote:
                  >
                  > {
                  > short Font;
                  > GPOINT2 Origin;
                  > float Hght;
                  [...]
                  > }TXT2;

                  Oh, awesomecakes! That's tremendously helpful!

                  I'll poke around on the web site for the XP development kit.

                  BCing you
                  --
                  B.C. Holmes \u2625 http://www.bcholmes.org/
                  "All my life I've wanted to be somebody; I guess I should've been
                  more specific." -- Lily Tomlin
                • BC Holmes
                  ... Thanks bunches! I wasn t having much luck finding the kit on the ProFantasy site. BCing you -- B.C. Holmes u2625
                  Message 8 of 10 , Feb 20, 2012
                  • 0 Attachment
                    On 12-02-20 5:35 PM, L. Lee Saunders wrote:
                    >
                    > The latest XP development Kit code (for CC3) is available for
                    > download on Peter Olsen's site:

                    Thanks bunches! I wasn't having much luck finding the kit on the
                    ProFantasy site.

                    BCing you
                    --
                    B.C. Holmes \u2625 http://www.bcholmes.org/
                    "All my life I've wanted to be somebody; I guess I should've been
                    more specific." -- Lily Tomlin
                  • BC Holmes
                    Thanks for all the help, guys. I ve made some progress, and the XP development kit headers have done a lot to clarify the file structure. I m currently
                    Message 9 of 10 , Feb 20, 2012
                    • 0 Attachment
                      Thanks for all the help, guys. I've made some progress, and the XP
                      development kit headers have done a lot to clarify the file structure.

                      I'm currently pulling my hair out trying to figure out how I'm going to
                      handle brush pattern fill styles, but it's been a fun learning experience.

                      BCing you
                      --
                      B.C. Holmes \u2625 http://www.bcholmes.org/
                      "All my life I've wanted to be somebody; I guess I should've been
                      more specific." -- Lily Tomlin
                    • Simon Rogers
                      Mike can t post via yahoo groups, so he asked me to forward this: Entity type 5 is 2d Text. The as built reference is the ESTRUC.CPY file in the XP toolkit.
                      Message 10 of 10 , Feb 21, 2012
                      • 0 Attachment
                        Mike can't post via yahoo groups, so he asked me to forward this:

                        Entity type 5 is 2d Text. The "as built" reference is the ESTRUC.CPY file in
                        the XP toolkit.
                        ESTRUCO.CPY describes some older version entity structures.

                        Reading assembly data structures is not very different from C structures -
                        real4 for float, real8 for double, dword for int/unsigned int, word for
                        short, and byte for char/unsigned char.

                        Type 0x80 contains plot assembly data, and type 0x81 is the NOTE entity
                        structure Types 0x80 and above are non-drawing entities.

                        Brush fills are part of the Fill Style InfoBlock (See FSTYIB.CPY and
                        FSTYLES.CPY).
                        There is no direct service for adding a fill style from a program - you will
                        need to understand and modify the Fill Style InfoBlock record. (EType = 0)
                        (IBType = 7).

                        Mike

                        -----Original Message-----
                        From: cc2-dev-l@yahoogroups.com [mailto:cc2-dev-l@yahoogroups.com] On Behalf
                        Of BC Holmes
                        Sent: 21 February 2012 04:26
                        To: cc2-dev-l@yahoogroups.com
                        Subject: Re: [cc2-dev-l] Re: FCW format and existing FCW->SVG code


                        Thanks for all the help, guys. I've made some progress, and the XP
                        development kit headers have done a lot to clarify the file structure.

                        I'm currently pulling my hair out trying to figure out how I'm going to
                        handle brush pattern fill styles, but it's been a fun learning experience.

                        BCing you
                        --
                        B.C. Holmes \u2625 http://www.bcholmes.org/
                        "All my life I've wanted to be somebody; I guess I should've been more
                        specific." -- Lily Tomlin


                        ------------------------------------

                        To Post a message, send it to: cc2-dev-l@...
                        To Unsubscribe, send a blank message to:
                        cc2-dev-l-unsubscribe@...! Groups Links
                      Your message has been successfully submitted and would be delivered to recipients shortly.