christopherbumgarner | 25 Jan 12:35
Picon
Favicon

hachoir

hachoir Don't work nine to five when you can make your own hours http://www.news13cr.com

christopherbumgarner | 17 Jan 09:11
Picon
Favicon

hey

how is everything going hachoir check into this http://www.researchl3now.com/ make sure you look

Picon
Favicon

(unknown)


http://perdepoint.com/lantaid7.html

Picon
Favicon

hey hachoir

yo look into it right now http://www2.homel3iwork.com/1/?date=010512&ref=f later

Louis Granboulan | 22 Nov 19:08
Favicon

Modification of fields

Dear all,

How far from working is the code below?
The idea is to change the field "x" to give it a new value, and to reconstruct the stream with this new value.

https://bitbucket.org/haypo/hachoir/wiki/Ideas apparently explains that it has been envisaged. I
quote: "Event driven system: allow fields to signal modify events up to parent fields, all the way to root".

Regards,
Louis

from hachoir_core.stream import StringInputStream, LITTLE_ENDIAN
from hachoir_core.field import Parser, CString, UInt16
class Point(Parser):
    endian = LITTLE_ENDIAN
    def createFields(self):
        yield CString(self, "name", "Point name")
        yield UInt16(self, "x", "X coordinate")
        yield UInt16(self, "y", "Y coordinate")

d0 = "point\0\3\0\2\0"
p0 = Point(StringInputStream(d0))
d1 = "point\0\8\0\8\0"
p1 = Point(StringInputStream(d1))

p0["x"].value
p0.replaceField("x",p1["x"])

Luc Xation | 16 Nov 10:33
Picon

Re: how to install hachoir_editor

hi
anyone got an idea ??

cheers Luc

2011/11/10 Luc Xation <luc.xation0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
hi
i reinstalled my computer and i don't remember how i installed the library hachoir_editor without setup.py.

Any ideas welcome
cheers
Luc

Luc Xation | 10 Nov 16:58
Picon

how to install hachoir_editor

hi
i reinstalled my computer and i don't remember how i installed the library hachoir_editor without setup.py.

Any ideas welcome
cheers
Luc

Oliver Gerlich | 23 Oct 20:01
Picon
Picon

NDS ROM parser

Hi,

attached are the patches for a Nintendo DS ROM parser. The changes are 
also available at https://bitbucket.org/oliver_g/hachoir . Also, a test 
file is attached. I'd appreciate it if this code could be integrated 
upstream!

Thanks,
Oliver
Attachment (nds-patches-20111023-195427.tgz): application/x-compressed-tar, 12 KiB
Attachment (nitrodir.nds): application/octet-stream, 212 KiB
Oliver Gerlich | 22 Oct 14:18
Picon
Picon

some questions

Hi,

while working on a new parser, some questions came up:

- what is the "magic" field in PARSER_TAGS used for?
- should the validate() function manually validate the size, or is it 
sufficient to specify min_size in PARSER_TAGS?
- when using SeekableFieldSet or RootSeekableFieldSet to parse a file 
with padding, is there a way to get rid of the "found unparsed segment:" 
warnings? Can I specify that all unparsed segments should be treated as 
padding?

Thanks for creating Hachoir, it really makes file debugging much easier!

Regards,
Oliver

Oliver Gerlich | 21 Oct 21:49
Picon
Picon

parser for PAK files from Project: Starfighter game

Hi,

here's a small parser for archive files used by the Project: Starfighter
game... The format is really not widely used :-) and the original game
website has disappeared already; but writing this parser was good for
training, and maybe you'd like to add it to Hachoir. You can also find
the patch at https://bitbucket.org/oliver_g/hachoir/src/0f1b8b65dfac .

Also, a test file is attached, which is also used for the hachoir-parser
test case.

Thanks,
Oliver

Attachment (paktest.pak): application/octet-stream, 10 KiB
# HG changeset patch
# User Oliver Gerlich <oliver.gerlich@...>
# Date 1319131489 -7200
# Branch prs-pak
# Node ID 0f1b8b65dfac325de5d8bd7cee0a6cb12cb11dba
# Parent  b662b521c8b04b4347c1fa739f6bf05b6aaa616c
add parser for PAK files from "Project: Starfighter" game

diff -r b662b521c8b0 -r 0f1b8b65dfac hachoir-parser/hachoir_parser/archive/__init__.py
--- a/hachoir-parser/hachoir_parser/archive/__init__.py	Tue Sep 27 18:57:24 2011 +0200
+++ b/hachoir-parser/hachoir_parser/archive/__init__.py	Thu Oct 20 19:24:49 2011 +0200
@@ -11,3 +11,4 @@
 from hachoir_parser.archive.mar import MarFile
 from hachoir_parser.archive.mozilla_ar import MozillaArchive
 from hachoir_parser.archive.zlib import ZlibData
+from hachoir_parser.archive.prs_pak import PRSPakFile
diff -r b662b521c8b0 -r 0f1b8b65dfac hachoir-parser/hachoir_parser/archive/prs_pak.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hachoir-parser/hachoir_parser/archive/prs_pak.py	Thu Oct 20 19:24:49 2011 +0200
@@ -0,0 +1,46 @@
+"""
+Parallel Realities Starfighter .pak file parser
+
+See http://www.parallelrealities.co.uk/projects/starfighter.php
+or svn://svn.debian.org/svn/pkg-games/packages/trunk/starfighter/
+
+Author: Oliver Gerlich
+"""
+
+from hachoir_parser import Parser
+from hachoir_core.field import (ParserError,
+    UInt32, String, SubFile, FieldSet)
+from hachoir_core.endian import LITTLE_ENDIAN
+from hachoir_core.text_handler import filesizeHandler
+
+class FileEntry(FieldSet):
+    def createFields(self):
+        yield String(self, "filename", 56, truncate="\0")
+        yield filesizeHandler(UInt32(self, "size"))
+        yield SubFile(self, "data", self["size"].value, filename=self["filename"].value)
+
+    def createDescription(self):
+        return self["filename"].value
+
+class PRSPakFile(Parser):
+    PARSER_TAGS = {
+        "id": "prs_pak",
+        "category": "archive",
+        "file_ext": ("pak",),
+        "mime": (u"application/octet-stream",),
+        "min_size": 4*8, # just the identifier
+        "magic": (('PACK', 0),),
+        "description": "Parallel Realities Starfighter .pak archive",
+    }
+
+    endian = LITTLE_ENDIAN
+
+    def validate(self):
+        return (self.stream.readBytes(0, 4) == 'PACK')
+
+    def createFields(self):
+        yield String(self, "magic", 4)
+
+        # all remaining data must be file entries:
+        while self.current_size < self._size:
+            yield FileEntry(self, "file[]")
diff -r b662b521c8b0 -r 0f1b8b65dfac hachoir-parser/tests/download_testcase.py
--- a/hachoir-parser/tests/download_testcase.py	Tue Sep 27 18:57:24 2011 +0200
+++ b/hachoir-parser/tests/download_testcase.py	Thu Oct 20 19:24:49 2011 +0200
@@ -90,6 +90,7 @@
     (u"radpoor.doc", 103936, "114835a03be92e02029c74ece1162c3e"),
     (u"quicktime.mp4", 245779, "dc77a8de8c091c19d86df74280f6feb7"),
     (u"swat.blp", 55753, "a47a2d6ef61c9005c3f5faf1bca253af"),
+    (u"paktest.pak", 10464, "53ded116d139dbb172280f9e267ad3ed"),
 )

 def stringMD5(text):
diff -r b662b521c8b0 -r 0f1b8b65dfac hachoir-parser/tests/run_testcase.py
--- a/hachoir-parser/tests/run_testcase.py	Tue Sep 27 18:57:24 2011 +0200
+++ b/hachoir-parser/tests/run_testcase.py	Thu Oct 20 19:24:49 2011 +0200
@@ -463,6 +463,13 @@
     checkValue(parser, "jpeg_header_len", 10),
 )

+def checkPrsPak(parser): return (
+    checkValue(parser, "/file[0]/filename", "hachoir/png_331x90x8_truncated.png"),
+    checkValue(parser, "/file[0]/size", 100),
+    checkValue(parser, "/file[1]/filename", "hachoir/small_text.tar"),
+    checkValue(parser, "/file[1]/size", 10240),
+)
+
 def checkFile(filename, check_parser):
     sys.stdout.write("  - Create parser: ")
     sys.stdout.flush()
@@ -631,6 +638,7 @@
     # radpoor.doc
     # quicktime.mp4
     (u"swat.blp", checkSwat),
+    (u"paktest.pak", checkPrsPak),
 )

 if __name__ == "__main__":

Picon
Favicon

(unknown)


Gmane