summaryrefslogtreecommitdiff
path: root/extractor
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-11-29 21:54:32 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-11-29 21:54:32 +0100
commit313afffce7a823c30acf4853b083f9ca5132e879 (patch)
tree5a7370392ebd39314612166b35e6f53e67441c0b /extractor
parente8aa9f50886b66d525307a58d71036e6fd3d4aa1 (diff)
next commit
Diffstat (limited to 'extractor')
-rw-r--r--extractor/grf.gd38
1 files changed, 37 insertions, 1 deletions
diff --git a/extractor/grf.gd b/extractor/grf.gd
index 8cb03c1..27dcab0 100644
--- a/extractor/grf.gd
+++ b/extractor/grf.gd
@@ -1,4 +1,40 @@
class_name GRF
+
class Header:
- var signature: int
+ static var byte_length: int = 46
+
+ ## Byte Length: 15
+ ## Master of Magic
+ var signature: String
+
+ ## Byte Length: 15
+ var encryption: PackedByteArray
+
+ ## Byte Type: u32
+ ## Byte Length: 4
+ var file_table_offset: int
+
+ ## Byte Type: u32
+ ## Byte Length: 4
+ var reserved_files: int
+
+ ## Byte Type: u32
+ ## Byte Length: 4
+ var file_count: int
+
+ ## Byte Type: u32
+ ## Byte Length: 4
+ var version: int
+
+
+ static func from_file(file: FileAccess):
+ var header = Header.new()
+ header.signature = file.get_buffer(15).get_string_from_utf8()
+ header.encryption = file.get_buffer(15)
+ header.file_table_offset = file.get_buffer(4).decode_u32(0)
+ header.reserved_files = file.get_buffer(4).decode_u32(0)
+ header.file_count = file.get_buffer(4).decode_u32(0)
+ header.version = file.get_buffer(4).decode_u32(0)
+
+ return header