Input/Output of Structure Binaries?

Non-platform specific questions.

Input/Output of Structure Binaries?

Postby Cleve_Blakemore » Thu Sep 07, 2006 7:09 am

1. Does the C-Script library support "sizeof" for structures, to determine their length in bytes?

2. Can we output a structure to disk as a binary using the file commands, input it later in the same way and expect it will be byte-aligned and consistent on all export platforms?

3. Can we then import structures from byte-aligned editors using our structure format, also as an entire binary chunk?

I know I can find out all this myself by building tests, Makslane, but I guess I am being lazy and hoping you can answer all these questions for me in one go.

I can throw together editors of all sorts very quickly with binary outputs of structures as big arrays. This would help speed up item and creature editing for my Game Editor isometric game a lot. I can do it as INI style files as well, but this will entail building a little INI parser for Game Editor. It saves a lot of time if I can have a couple of binary files travel with the executable on all platforms and expect the byte aligned structs to import at the same length on all of them. I know the "&" address pointer is supported in Game Editor C-Script.

Thanks for your help in advance.
Cleve_Blakemore
 
Posts: 20
Joined: Sat Aug 05, 2006 7:26 am
Score: 1 Give a positive score

Postby makslane » Thu Sep 07, 2006 12:36 pm

It's a good question. I had serious trouble with struct alignment in the GP2X platform. So, I think save structs will works in all platforms, but not in the GP2X without engine modifications.

Can you make a little test with an struct that contains double, int, char and some array? :wink:
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest