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

Extracting data from ITGPC2 (and probably ITGPC as well)
Goto page 1, 2  Next  
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
duskwolf
Trick Member
Trick Member


Joined: 04 Oct 2006
0. PostPosted: Thu Oct 05, 2006 1:57 am    Post subject: Extracting data from ITGPC2 (and probably ITGPC as well) Reply with quote

If you folks haven't noticed already, Roxor's made the ITGPC to ITGPC2 upgrade available for free. (There's a link to it from stepmania.com.) I haven't looked at the Windows package, but the Mac package - which can be viewed under Windows; don't worry - contains several interesting-looking .PCK files. I've reverse-engineered the format and written an unpacker (in Python), which I've attached.

I wasn't forced to agree to any licensing terms in order to download the patch, so the legal situation on the files that you can extract using this tool is distinctly unclear. It's probably legal to possess them, but not to distribute them. The tool itself, though, is free and clear - I wrote it without looking at the ITG binary at all, so it's considered a "clean-room" reimplementation of the format.

The two files that really matter in the package are:
  • Contents/Resources/Patch/Contents/Resources/pcks/packa/D1513758.PCK - background movies
  • Contents/Resources/Patch/Contents/Resources/pcks/packa/DC37F75E.PCK - songfiles and music
There are a couple of other interesting PCK files in the patch; you can probably find them for yourself. The tool will probably work on the ITG1 .PCK files as well. I don't have a copy of the game, though, so I can't test that.

Please note that this tool requires Python, and operates from the command line. I do not plan to write a GUI, as it would be overkill - you really only need to use it a few times.

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

def mkpath(p):
  if os.path.exists(p): return
  b,d = os.path.split(p)
  if b:
    mkpath(b)
  os.mkdir(p)

def mkpathto(p):
  d,f = os.path.split(p)
  mkpath(d)

def do_header(f):
  hdr = f.read(0x88)
  ident, packname, filecount = struct.unpack("< 4s 128s L", hdr)
  packname = packname.strip("\0")
  if ident != "PCKF":
    print "That doesn't look like a ITG PCK file..."
    sys.exit(1)
  print "Package %s contains %d files." % (repr(packname), filecount)
  print
  return filecount

def get_files(f, filecount):
  files = []
  for i in range(filecount):
    hdr = f.read(20)
    dsize, fsize, offset, fnlen, compress = struct.unpack("<LLLLL", hdr)
    fn = f.read(fnlen)
    files.append((i, fn, dsize, fsize, compress))
  return files

def do_file(f, finfo):
  i, fn, dsize, fsize, compress = finfo
  if compress:
    print "%-4d: %10d from %-10d | %s" % (i, dsize, fsize, fn)
  elif dsize != fsize:
    print "%-4d: %10d !!!! %-10d | %s" % (i, dsize, fsize, fn)
    print "!!! Decompressed size != compressed size for uncompressed file. Corrupt?"
    sys.exit(1)
  else:
    print "%-4d: %10d      %-10s | %s" % (i, dsize, "", fn)
  dat = f.read(dsize)
  fname = os.path.join(outdir, fn)
  mkpathto(fname)
  if compress:
    dat = zlib.decompress(dat, -15)
    if len(dat) != fsize:
      print "!!! Length of decompressed data doesn't match up! (Was %d, should be %d)" % (len(dat), fsize)
      sys.exit(1)
  of = file(fname, "w")
  of.write(dat)
  of.flush()
  of.close()

def main(args):
  global outdir
  if len(args) != 3:
    print "Usage: [python] itgunpack.py itg-file.pck output-directory"
  f = file(args[1], "r")
  outdir = args[2]
  filecount = do_header(f)
  files = get_files(f, filecount)
  for finfo in files:
    do_file(f, finfo)
  print
  print "Done!"
  sys.exit(0)

main(sys.argv)
Back to top
View users profile Send private message
Travelsonic
Trick Member
Trick Member


Joined: 08 Oct 2005
1. PostPosted: Thu Oct 05, 2006 10:02 am    Post subject: Reply with quote

If this code works with ITG1 pcks, that'd be cool.
_________________
I'll believe that when me **** turns purple, and smells like rainbow sherbet.
Back to top
View users profile Send private message AOL Instant Messenger
Kalek
Trick Member
Trick Member


Joined: 06 Nov 2004
Location: Pickerington, OH
2. PostPosted: Thu Oct 05, 2006 10:29 am    Post subject: Reply with quote

We already have a PCK V2 extracting tool.

But, thanks for the thought...


Its in the "How To Unpack ITG PS2" thread somewhere.
Back to top
View users profile Send private message Send email AOL Instant Messenger Yahoo Messenger MSN Messenger
duskwolf
Trick Member
Trick Member


Joined: 04 Oct 2006
3. PostPosted: Thu Oct 05, 2006 11:44 am    Post subject: Reply with quote

D'oh. I could've sworn I'd seen something about that version not working with ITGPC files, but I guess I just didn't read enough of the thread.

Any case, this one's not Windows-only, in case anyone cares about that. It's also a script, so if anyone's wondering how the format works, now they can figure it out. Sort of. E1.gif
Back to top
View users profile Send private message
Kalek
Trick Member
Trick Member


Joined: 06 Nov 2004
Location: Pickerington, OH
4. PostPosted: Thu Oct 05, 2006 12:03 pm    Post subject: Reply with quote

duskwolf wrote:
D'oh. I could've sworn I'd seen something about that version not working with ITGPC files, but I guess I just didn't read enough of the thread.

Any case, this one's not Windows-only, in case anyone cares about that. It's also a script, so if anyone's wondering how the format works, now they can figure it out. Sort of. E1.gif
Well, since its not just windows only, I guess this is still very helpful E1.gif

You probably read the whole thing about it not working on PCKSuite, not the PCK V2 extractor mentioned somewhere in the thread.

BTW, do you know how to get Python scripts running on an Intel Mac?
Back to top
View users profile Send private message Send email AOL Instant Messenger Yahoo Messenger MSN Messenger
duskwolf
Trick Member
Trick Member


Joined: 04 Oct 2006
5. PostPosted: Thu Oct 05, 2006 2:24 pm    Post subject: Reply with quote

Just launch it from the terminal - you get a copy of Python installed by default (in /usr/bin). There isn't anything specific you need to do to get it working.
Back to top
View users profile Send private message
Cutriss
Staff Member
Staff Member


Joined: 24 Jan 2002
6. PostPosted: Fri Oct 06, 2006 5:31 am    Post subject: Reply with quote

I like the idea of having it in a Python script. It creates a barrier-to-entry that I think should be enforced in topics like this. E10.gif You'll always have people like videoCWK whose interests say "Programming" but they can't figure out how to use CLI tools and don't know common file formats...

Of course, someone will likely come along and write a wrapper for it anyway and ruin the fun...
_________________

Sentient Mode is capable...
Back to top
View users profile Send private message Visit posters website AOL Instant Messenger Xbox Live Gamertag
duskwolf
Trick Member
Trick Member


Joined: 04 Oct 2006
7. PostPosted: Fri Oct 06, 2006 12:37 pm    Post subject: Reply with quote

A friend with a copy of ITGPC confirms that it will successfully extract those files too. However, the theme files do not work with Stepmania (current CVS) "out of the box".
Back to top
View users profile Send private message
Eric S!!
Trick Member
Trick Member


Joined: 16 Apr 2002
8. PostPosted: Thu Oct 12, 2006 9:05 pm    Post subject: Reply with quote

I just got a copy if ITGPC and I downloaded python and everything, but I have no clue what to do. Is there anyone out here that can provide detailed instructions on how to extract these files?
Back to top
View users profile Send private message Send email AOL Instant Messenger Yahoo Messenger
duskwolf
Trick Member
Trick Member


Joined: 04 Oct 2006
9. PostPosted: Thu Oct 12, 2006 9:16 pm    Post subject: Reply with quote

Run the script. It'll tell you how to use it, more or less.
Back to top
View users profile Send private message
Eric S!!
Trick Member
Trick Member


Joined: 16 Apr 2002
10. PostPosted: Sun Oct 15, 2006 9:51 am    Post subject: Reply with quote

I typed in the script exactly and nothing happpened, I believe I got 1 or 2 error messages. NOTE: I am trying to run this under Windows, do I need to do anything different compared to the mac version?
Back to top
View users profile Send private message Send email AOL Instant Messenger Yahoo Messenger
duskwolf
Trick Member
Trick Member


Joined: 04 Oct 2006
11. PostPosted: Sun Oct 15, 2006 12:04 pm    Post subject: Reply with quote

You're supposed to save it to a file and run it as a script...
Back to top
View users profile Send private message
Eric S!!
Trick Member
Trick Member


Joined: 16 Apr 2002
12. PostPosted: Wed Oct 25, 2006 10:42 am    Post subject: Reply with quote

Well for us computer illeterate people (I dont know programming), can you provide detailed steps on how to extract the files, from saving it as a script and to running it?
Back to top
View users profile Send private message Send email AOL Instant Messenger Yahoo Messenger
duskwolf
Trick Member
Trick Member


Joined: 04 Oct 2006
13. PostPosted: Wed Oct 25, 2006 10:50 am    Post subject: Reply with quote

Save as .py file. Run. See "usage" message. Use accordingly.
Back to top
View users profile Send private message
Scarenormous!
Trick Member
Trick Member


Joined: 30 Jul 2003
Location: here
14. PostPosted: Tue Oct 31, 2006 6:51 pm    Post subject: Reply with quote

Cutriss wrote:
I like the idea of having it in a Python script. It creates a barrier-to-entry that I think should be enforced in topics like this. E10.gif You'll always have people like videoCWK whose interests say "Programming" but they can't figure out how to use CLI tools and don't know common file formats...

Quote:
Well for us computer illeterate people (I dont know programming), can you provide detailed steps on how to extract the files, from saving it as a script and to running it?

nerd.gif
Ah the torrent is so bad, why does no one seed? Has anywhere hosted this file or am I going to have to stick out the 17 kb/s?
_________________
Back to top
View users profile Send private message Send email Visit posters website AOL Instant Messenger MSN Messenger
duskwolf
Trick Member
Trick Member


Joined: 04 Oct 2006
15. PostPosted: Tue Oct 31, 2006 8:00 pm    Post subject: Reply with quote

Torrents? I see no torrent here. The only file involved is inline at the top of the thread.
Back to top
View users profile Send private message
Scarenormous!
Trick Member
Trick Member


Joined: 30 Jul 2003
Location: here
16. PostPosted: Wed Nov 01, 2006 7:07 pm    Post subject: Reply with quote

The download for R2 is a torrent.
_________________
Back to top
View users profile Send private message Send email Visit posters website AOL Instant Messenger MSN Messenger
duskwolf
Trick Member
Trick Member


Joined: 04 Oct 2006
17. PostPosted: Wed Nov 01, 2006 7:33 pm    Post subject: Reply with quote

Oh, right. I grabbed a copy from here: http://stepmania.naota3k.com/index.php?dir=ITG%20PC/
Back to top
View users profile Send private message
Scarenormous!
Trick Member
Trick Member


Joined: 30 Jul 2003
Location: here
18. PostPosted: Thu Nov 02, 2006 12:53 pm    Post subject: Reply with quote

Thanks that was helpful
_________________
Back to top
View users profile Send private message Send email Visit posters website AOL Instant Messenger MSN Messenger
eaglefan101
Trick Member
Trick Member


Joined: 15 Jun 2005
Location: Somewheres
19. PostPosted: Sat Nov 04, 2006 6:00 pm    Post subject: Reply with quote

Okay. I'm confused... do I just type this into the command line?

Or is there something specific that is needed to be done?

I sure wish you could copy + paste into the command line. frown.gif
_________________
Formerly known as "piemaster"



Yeah this is the end of my sig. You can stop reading it now.
Back to top
View users profile Send private message Visit posters website
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
Goto page 1, 2  Next
Page 1 of 2

 
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