X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FObjectFile.h;h=56319a4dd444050681fb0aef7a8886893e91c3d6;hb=8ef435410d1f8aff339e4afef87a5757e77eba45;hp=178180a2f8c3eafe27926766cfe25b0c8546482c;hpb=8c8061a4f8b88410d6d93c039afe6affc4b69cf2;p=l2e.git diff --git a/src/loader/ObjectFile.h b/src/loader/ObjectFile.h index 178180a..56319a4 100644 --- a/src/loader/ObjectFile.h +++ b/src/loader/ObjectFile.h @@ -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,21 +22,34 @@ 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 { + /// File-relative offset to the image's path string. + unsigned int pathOffset; + /// File-relative offset of the target position of the + /// image's reference. + unsigned int destOffset; }; struct Object { - unsigned int typeId; + int typeId; unsigned int size; + char *RawObject(); Object *Next(); }; struct Array { + int typeId; unsigned int size; bool ref; + char *Data(); Array *Next(); }; @@ -68,6 +81,12 @@ struct ObjectFileHeader { unsigned int externalsBegin; unsigned int externalsEnd; + /// File-relative offsets of the image section's begin and + /// end respectively. + /// Denotes an array of Image structs. + unsigned int imagesBegin; + unsigned int imagesEnd; + /// File-relative offsets of the objet section's begin /// and end respectively. /// Each object begins with its type ID followed by its @@ -99,10 +118,18 @@ struct ObjectFileHeader { Export *ExportsEnd(); External *ExternalsBegin(); External *ExternalsEnd(); + Image *ImagesBegin(); + Image *ImagesEnd(); Object *ObjectsBegin(); Object *ObjectsEnd(); Array *ArraysBegin(); Array *ArraysEnd(); + +private: + bool CheckSection( + unsigned int begin, + unsigned int end, + unsigned int fsize) const; }; struct LoadedExport {