Forums FAQForums FAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin 

PCK packer link PLEASE!!!!!!
 
This topic is locked you cannot edit posts or make replies    DDR Freak Forum Index -> In the Groove
View previous topic :: View next topic  
Author Message
iamben4life
Basic Member
Basic Member


Joined: 06 Mar 2007
0. PostPosted: Tue May 01, 2007 7:30 pm    Post subject: PCK packer link PLEASE!!!!!! Reply with quote

i keep searching in google and i always get a fake or broken link. E19.gif

can i have a working download link for it please?
Back to top
View users profile Send private message AOL Instant Messenger
duskwolf
Trick Member
Trick Member


Joined: 04 Oct 2006
1. PostPosted: Wed May 02, 2007 8:15 pm    Post subject: Reply with quote

Here's mine... obviously, this won't help you much if you want a fancy GUI packer, but I guess I might as well release this anyway.

Code:
#!/usr/bin/python
import struct, sys, zlib, os

if len(sys.argv) not in (4, 5):
    print "Usage: [python] itgpack.py itg-file.pck input-directory identifier [target size]"
    sys.exit(1)

files = []
for dirpath, dirnames, filenames in os.walk(sys.argv[2]):
    for filename in filenames:
        if filename[0] == '.':
            continue # skip dotfiles
        abspath = os.path.join(dirpath, filename)
        files.append((abspath,
                                    abspath.split(os.path.sep, 1)[1],
                                    os.stat(abspath).st_size))

outf = file(sys.argv[1], "w")
outf.write(struct.pack("< 4s 128s L", "PCKF", sys.argv[3], len(files)))
header_offset = outf.tell()

# Write a preliminary header - leave offsets and sizes zero
print "Scanning .",
for abspath, pckpath, filesize in files:
    print ".",
    outf.write(struct.pack("<LLLLL", 0, 0, 0, len(pckpath), 0))
    outf.write(pckpath)
print

print "Writing files . . ."
offsets = []
# Start writing results
for abspath, pckpath, filesize in files:
    data = file(abspath, "r").read()
    cdata = zlib.compress(data, 9)[2:]
    offset = outf.tell()
    outf.write(cdata)
    offsets.append((offset, len(cdata)))
    print "  " + pckpath
eof_offset = outf.tell()

print "Tidying up .",
# Go back and fix the header
outf.seek(header_offset)
for (abspath, pckpath, filesize), (offset, datasize) in zip(files, offsets):
    outf.write(struct.pack("<LLLLL",
        datasize, filesize, offset, len(pckpath), 1))
    outf.write(pckpath)
    print ".",
print

if len(sys.argv) == 5:
    padlen = int(sys.argv[4])
    if padlen < eof_offset:
        print "Too much data to hit target file size. Make less."
        sys.exit(1)
    outf.seek(eof_offset)
    padding = padlen - eof_offset
    while padding > 0:
        padnum = min(padding, 1024)
        padding -= padnum
        outf.write("\0" * padnum)
    print "Written with %d bytes slack space." % (padlen - eof_offset)

print "OK, done. Enjoy."
Back to top
View users profile Send private message
Kalek
Trick Member
Trick Member


Joined: 06 Nov 2004
Location: Pickerington, OH
2. PostPosted: Thu May 03, 2007 12:47 pm    Post subject: Reply with quote

iamben4life

i sent you a pm a couple of days ago in case you didn't notice
Back to top
View users profile Send private message Send email AOL Instant Messenger Yahoo Messenger MSN Messenger
Display posts from previous:   
This topic is locked you cannot edit posts or make replies    DDR Freak Forum Index -> In the Groove All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group