Commits

oliver_g committed 3d52850

nds parser: require only a minimal header

This fixes parsing of TinyFB.nds ROM, which tries to be as small as possible.

  • Participants
  • Parent commits 46bd835

Comments (0)

Files changed (1)

hachoir-parser/hachoir_parser/program/nds.py

 
 
 class Header(FieldSet):
-    static_size = 512 * 8
     def createFields(self):
         yield String(self, "game_title", 12, truncate="\0")
         yield String(self, "game_code", 4)
         yield UInt16(self, "logo_crc16")
         yield UInt16(self, "header_crc16")
 
-        yield RawBytes(self, "reserved", 160)
-
 
 class NdsFile(Parser):
     PARSER_TAGS = {
         "category": "program",
         "file_ext": ("nds",),
         "mime": (u"application/octet-stream",),
-        "min_size": 512 * 8, # just a minimal header
+        "min_size": 352 * 8, # just a minimal header
         "description": "Nintendo DS game file",
     }
 
     def validate(self):
         return (self.stream.readBytes(0, 1) != "\0"
             and ((self["header"]["device_code"].value & 7) == 0)
-            and self["header"]["header_size"].value >= 512
+            and self["header"]["header_size"].value >= 352
             and self["header"]["arm9_bin_size"].value > 0
             and self["header"]["arm7_bin_size"].value > 0
             and self["header"]["arm9_source"].value + self["header"]["arm9_bin_size"].value < self._size