www.tombraiderforums.com

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Modding

Reply
 
Thread Tools
Old 22-12-09, 14:05   #1
Tonttu
Student
 
Tonttu's Avatar
 
Join Date: May 2006
Posts: 130
Default TPFextract - extract TexMod tpf files

I lost some of my source files but I still had the *.tpf file with no way of getting the files out of it.
After spending some time on google I found opentpf
However for some reason I was getting "ZipArchive error: Damaged or not a zip file." on my file so I wrote TPFextract based on opentpf and MiniUnz source code
TPFextract also works faster than opentpf because it doesn't compress the files back to zip like opentpf

TPFextract 1.5 (240.51 kB)
TPFextractGUI 1.4 (2.68 MB)
Source code is included in the archive

Code:
Usage : TPFextract [-e] [-x] [-l] [-f] [-o] file.tpf [file_to_extr.]

  -e  Extract without pathname (junk paths)
  -x  Extract with pathname
  -l  list files
  -f  list files ("filename|filesize|crc-32")
  -o  overwrite files without prompting
TPFextractGUI is a simple GUI for TPFextract
Alternative GUI for TPFextract written by badboy70 can be found here:
http://badboy70.cwahi.net/

Code:
##############
# TPFextract #
##############

1.5
Changed "-f" switch to print to stdout in filelist.txt format: "filename|filesize|crc-32"
        (fix to remove unnecessary disc read/write operation when using the TPFextractGUI)
        if you need filelist.txt you can use "TPFextract -f filename.tpf > filelist.txt"
Executable packed with "upx --ultra-brute"

1.4
Write output of error/info messages to stderr instead of stdout
Modified the build script for Linux
Show version number in info

1.3
Fixed compiling on Linux
Added Makefile for Linux
Added build script for Linux

1.2
Changed filelist.txt format to filename|filesize|crc-32

1.1
Added "-f" switch to write filenames to filelist.txt
Changed the program to read the XORed data from memory instead of temporary file
Lots of code cleanup and some commenting

1.0
Initial version


#################
# TPFextractGUI #
#################

1.4
Support loading files with command-line arguments (right click --> open with... support)
Updated Qt from 4.6.3 to 4.7.0
Static build
Uses TPFextract 1.5

1.3
Changed to read filelist from stdout (fix to remove unnecessary disc read/write operation)
Updated QT libraries from 4.6.0 to 4.6.3
Executable and libraries packed with "upx --ultra-brute" to reduce filesize
Uses TPFextract 1.5

1.2
Fixed the GUI freezing while extracting
Made the text/path field show status while extracting
Uses TPFextract 1.4

1.1
Add filesize and crc-32 info
Uses TPFextract 1.2

1.0
Initial version
Uses TPFextract 1.1

Last edited by Tonttu; 24-05-12 at 18:09.
Tonttu is offline   Reply With Quote
Old 22-12-09, 14:32   #2
badboy70
Relic Hunter
 
badboy70's Avatar
 
Join Date: Aug 2005
Location: Belgium, Bruges
Posts: 6,658
Default

Nice tool, you got PM
__________________
People go smashin' to this.
badboy70 is offline   Reply With Quote
Old 22-12-09, 19:22   #3
fonglee
Hobbyist
 
Join Date: Nov 2008
Posts: 18
Talking

Thank you, works great. I`ve searched for something to do exactly this, off and on for a couple of years now.
fonglee is offline   Reply With Quote
Old 22-12-09, 20:34   #4
Mytly
Tomb Raider
 
Mytly's Avatar
 
Join Date: May 2006
Location: In the unfashionable end of the western spiral arm of the Galaxy
Posts: 14,252
Default

How exactly does this work?
Mytly is offline   Reply With Quote
Old 22-12-09, 21:28   #5
Tonttu
Student
 
Tonttu's Avatar
 
Join Date: May 2006
Posts: 130
Default

New version, link in first post

Changes:
added "-f" switch to write filenames to filelist.txt
changed the program to read the XORed data from memory instead of temporary file
lots of code cleanup and some commenting

Source code is included in the archive
I haven't written anything in C for a long time so there probably is a lot to improve in the code

Quote:
Originally Posted by Mytly View Post
How exactly does this work?
First it XORs tpf data with 0x3FA43FA4 to get zip archive and then extracts the contents
The zip archive is protected with 42 character password using special/control characters
password in hex: 73 2A 63 7D 5F 0A A6 BD 7D 65 7E 67 61 2A 7F 7F 74 61 67 5B 60 70 45 74 5C 22 74 5D 6E 6A 73 41 77 6E 46 47 77 49 0C 4B 46 6F
Tonttu is offline   Reply With Quote
Old 25-12-09, 13:03   #6
badboy70
Relic Hunter
 
badboy70's Avatar
 
Join Date: Aug 2005
Location: Belgium, Bruges
Posts: 6,658
Default

GUI Version 1.2 here

WARNING

Some antivirusses seem te block extract.exe (this gets unpacked after running TPFExtract)
RED = Blocks
GREEN = Does not block

Norton

Microsoft Security Essentials

[IMG]http://i48.************/1t2bl3.jpg[/IMG]
__________________
People go smashin' to this.

Last edited by badboy70; 26-12-09 at 10:04.
badboy70 is offline   Reply With Quote
Old 25-12-09, 19:39   #7
fonglee
Hobbyist
 
Join Date: Nov 2008
Posts: 18
Default

Ok, so I tried your GUI version and every file I try to load comes up with the same error `you can't have spaces in filenames'. Any idea if this is vista related?

Any thoughts?
fonglee is offline   Reply With Quote
Old 25-12-09, 22:28   #8
badboy70
Relic Hunter
 
badboy70's Avatar
 
Join Date: Aug 2005
Location: Belgium, Bruges
Posts: 6,658
Default

Quote:
Originally Posted by fonglee View Post
Ok, so I tried your GUI version and every file I try to load comes up with the same error `you can't have spaces in filenames'. Any idea if this is vista related?

Any thoughts?
Well, does the filename contain spaces?
Does not work: "My Mod.tpf"
Works: "My_Mod.tpf" or "MyMod.tpf"
__________________
People go smashin' to this.
badboy70 is offline   Reply With Quote
Old 26-12-09, 00:00   #9
Tonttu
Student
 
Tonttu's Avatar
 
Join Date: May 2006
Posts: 130
Default

I think it shouldn't be very hard to make it work with spaces, just put quotation marks around the argument when passing it to program.
or escape the spaces with backslash (edit: probably doesn't work on Windows... I've been using Linux too much )

Last edited by Tonttu; 26-12-09 at 00:01.
Tonttu is offline   Reply With Quote
Old 26-12-09, 05:41   #10
fonglee
Hobbyist
 
Join Date: Nov 2008
Posts: 18
Default

Quote:
Originally Posted by badboy70 View Post
Well, does the filename contain spaces?
Does not work: "My Mod.tpf"
Works: "My_Mod.tpf" or "MyMod.tpf"
To be perfectly clear, not 1 file has opened, no matter if it is a single name such as `Anya.tpf' or not.

Does it work on your system? And what OS are you running?

Edit:Ok I've just checked on a computer running XP and it still won't open anything, so it's a no-go in Vista & XP....

The program seems to work fine, right up to the point of loading a TPF, is it possible that the file you put up for download is corrupt?

Last edited by fonglee; 26-12-09 at 06:14.
fonglee is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 00:14.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.