]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/ObjectFile.h
better accessibility of map-related properties
[l2e.git] / src / loader / ObjectFile.h
index 98aff02918aaef733737fd2cc23765fd8f2d0ebc..2bdcb125c63aa5ec2c3a57b5c79fc8126776e669 100644 (file)
@@ -11,7 +11,7 @@ struct Export {
        /// Offset of the identifier in the file.
        unsigned int nameOffset;
        /// Type ID of referenced object.
-       unsigned int typeId;
+       int typeId;
        /// File-offset of the object's actual data.
        unsigned int dataOffset;
 };
@@ -22,9 +22,11 @@ struct External {
        unsigned int nameOffset;
        /// Target position for linking/inlining.
        unsigned int referenceOffset;
-       /// Nonzero if the object should be copied rather that
+       /// Target type.
+       int typeId;
+       /// True if the object should be copied rather that
        /// just writing a reference.
-       unsigned int inlined;
+       bool inlined;
 };
 
 struct Image {
@@ -36,20 +38,29 @@ struct Image {
 };
 
 struct Object {
-       unsigned int typeId;
+       int typeId;
        unsigned int size;
+
        char *RawObject();
        Object *Next();
 };
 
 struct Array {
-       unsigned int typeId;
+       int typeId;
        unsigned int size;
        bool ref;
+
        char *Data();
        Array *Next();
 };
 
+struct Script {
+       unsigned int size;
+
+       char *Text();
+       Script *Next();
+};
+
 struct ObjectFileHeader {
        /// Has to be "L2E\n"
        char ident[4];
@@ -105,6 +116,13 @@ struct ObjectFileHeader {
        unsigned int arraysBegin;
        unsigned int arraysEnd;
 
+       /// File-relative offsets of the script section's begin
+       /// and end respectively.
+       /// Each script is an unsigned int with the length in
+       /// bytes followed by the script text.
+       unsigned int scriptsBegin;
+       unsigned int scriptsEnd;
+
        ObjectFileHeader();
 
        /// Check if there are any problems with the file header.
@@ -120,6 +138,8 @@ struct ObjectFileHeader {
        Object *ObjectsEnd();
        Array *ArraysBegin();
        Array *ArraysEnd();
+       Script *ScriptsBegin();
+       Script *ScriptsEnd();
 
 private:
        bool CheckSection(