PAK extractor with source code in C

Want to share your mod with the world? Feel free!

PAK extractor with source code in C

Postby CUE » Sat Sep 29, 2012 11:53 am

This is my PAK extractor for the game.

Also include:
- source code
- .PAK file structure
- .PAK.MAN file structure

Updated link: http://www.mediafire.com/?ds7bw6wwbn0o6no

Code: Select all
PACK is a command line tool to unpack/pack the file DATA.PAK

Usage: PACK source [target [n]]

* unpack 'source.pak' using 'source.pak.man' if no 'target' is specified
* pack 'target.pak' and 'target.pak.man' using unpacked 'source' files
* the optional 'n' parameter is the compression level, 0-9

* the unpacked data are stored in the same folder as the tool
* you should not specify the file extensions
* 'source' file must be different from 'target' file
* 'source.pak.man' file must be in the same folder as 'source.pak' file
* if 'n' is not specified or has an invalid value, use the default value
Last edited by CUE on Sun Sep 30, 2012 1:11 pm, edited 1 time in total.
User avatar
CUE
 
Posts: 15
Joined: Sat Sep 29, 2012 11:50 am
Location: Valladolid, Spain

Re: PAK extractor with source code in C

Postby cienislaw » Sat Sep 29, 2012 12:22 pm

kudos! and thanx for source code.
User avatar
cienislaw
 
Posts: 234
Joined: Wed Nov 04, 2009 5:25 am

Re: PAK extractor with source code in C

Postby Archanoth » Sat Sep 29, 2012 4:57 pm

What folder should the program extract the files to?
Image
User avatar
Archanoth
 
Posts: 76
Joined: Wed Sep 09, 2009 2:08 am
Location: Portugal

Re: PAK extractor with source code in C

Postby CUE » Sun Sep 30, 2012 3:50 am

The program is a command line tool. You need specify the path: pack -u "C:\Program Files\Torchlight II\PAKS\DATA.PAK".

Soon, maybe tonight, an updated version. Now you can unpack/pack the PAK/MAN files.
User avatar
CUE
 
Posts: 15
Joined: Sat Sep 29, 2012 11:50 am
Location: Valladolid, Spain

Re: PAK extractor with source code in C

Postby Archanoth » Sun Sep 30, 2012 4:07 am

Yes, I did that and it successfully extracted the files. The problem is that they're not in the same folder as the extractor/pak file, and I can't seem to find them anywhere else.
Image
User avatar
Archanoth
 
Posts: 76
Joined: Wed Sep 09, 2009 2:08 am
Location: Portugal

Re: PAK extractor with source code in C

Postby cracrayol » Sun Sep 30, 2012 5:10 am

CUE wrote:Soon, maybe tonight, an updated version. Now you can unpack/pack the PAK/MAN files.


And if you can add, also, a patch option, like in Torchlight2Extractor, it would be great !!
My website : http://www.cracrayol.org
TL2 French Translation Project : http://sourceforge.net/projects/transmod2/
User avatar
cracrayol
 
Posts: 34
Joined: Thu Nov 05, 2009 1:49 am
Location: Toulouse, France

Re: PAK extractor with source code in C

Postby CUE » Sun Sep 30, 2012 6:45 am

cracrayol wrote:And if you can add, also, a patch option, like in Torchlight2Extractor, it would be great !!

Nope, I'm sorry. The tool repack the files unsorted and you can indicate the compression level, so a patch has no sense.
But the source code is available and anyone can add more options.


~~~ ADDED ~~~
Updated the first post with the new link and a description.
User avatar
CUE
 
Posts: 15
Joined: Sat Sep 29, 2012 11:50 am
Location: Valladolid, Spain

Re: PAK extractor with source code in C

Postby Wikus » Mon Oct 01, 2012 1:44 am

Gracias señor CUE!
User avatar
Wikus
 
Posts: 35
Joined: Thu Aug 23, 2012 3:49 pm

Re: PAK extractor with source code in C

Postby Espionage724 » Mon Oct 01, 2012 4:23 am

Image
Image
Evolve can track how long you play Torchlight 2 for, take screenshots of your awesome loot, record you epic boss fights, and has a VPN better then Tunngle and Hamachi combined, all for free (and with other games too)! What is Evolve? Find out here :)
User avatar
Espionage724
 
Posts: 81
Joined: Thu May 24, 2012 4:23 am
Location: Charleroi, PA

Re: PAK extractor with source code in C

Postby cienislaw » Mon Oct 01, 2012 4:34 am

if you RUN if from \PAKS folder dont use full path but just a file name.
Code: Select all
C:\Program Files (x86)\Steam\steamapps\common\Torchlight II\PAKS> pack -u DATA.PAK
User avatar
cienislaw
 
Posts: 234
Joined: Wed Nov 04, 2009 5:25 am

Re: PAK extractor with source code in C

Postby CUE » Mon Oct 01, 2012 5:00 am

CUE wrote:
Code: Select all
...
Usage: PACK source [target [n]]
...
* you should not specify the file extensions
...

Easy, remove the -u and the .PAK :)

To unpack: PACK "C:\....\PAKS\DATA"
To pack: PACK "C:\....\PAKS\DATA" NEW_DATA
Last edited by CUE on Mon Oct 01, 2012 5:02 am, edited 2 times in total.
User avatar
CUE
 
Posts: 15
Joined: Sat Sep 29, 2012 11:50 am
Location: Valladolid, Spain

Re: PAK extractor with source code in C

Postby Espionage724 » Mon Oct 01, 2012 5:00 am

cienislaw wrote:if you RUN if from \PAKS folder dont use full path but just a file name.
Code: Select all
C:\Program Files (x86)\Steam\steamapps\common\Torchlight II\PAKS> pack -u DATA.PAK


Same thing:

Image

Edit:
CUE wrote:
CUE wrote:
Code: Select all
...
Usage: PACK source [target [n]]
...
* you should not specify the file extensions
...

Easy, remove the -u and the .PAK :)

To unpack: PACK "C:\....\PAKS\DATA"
To pack: PACK "C:\....\PAKS\DATA" NEW_DATA

That works :)
Image
Evolve can track how long you play Torchlight 2 for, take screenshots of your awesome loot, record you epic boss fights, and has a VPN better then Tunngle and Hamachi combined, all for free (and with other games too)! What is Evolve? Find out here :)
User avatar
Espionage724
 
Posts: 81
Joined: Thu May 24, 2012 4:23 am
Location: Charleroi, PA

Re: PAK extractor with source code in C

Postby cienislaw » Mon Oct 01, 2012 5:18 am

CUE wrote:
CUE wrote:Easy, remove the -u and the .PAK :)

ahh, you removed switches. i still use first version;-)
User avatar
cienislaw
 
Posts: 234
Joined: Wed Nov 04, 2009 5:25 am

Re: PAK extractor with source code in C

Postby KirasiN91 » Mon Oct 01, 2012 6:31 am

Can't seem to be able to pack.

I have successfully unpacked the file. Yet me and a friend can't pack it.

This is how it looks like: C:\Users\Me\Downloads\CUE> pack "MEDIA" NEWDATA 0
Gives me a file open error, I'm running it as admin.

EDIT: Figured it out, PACK "DATA" [MEDIA [0]]
Last edited by KirasiN91 on Mon Oct 01, 2012 6:40 am, edited 1 time in total.
User avatar
KirasiN91
 
Posts: 199
Joined: Fri Feb 03, 2012 1:14 am

Re: PAK extractor with source code in C

Postby CUE » Mon Oct 01, 2012 6:40 am

KirasiN91 wrote:Can't seem to be able to pack.

I have successfully unpacked the file. Yet me and a friend can't pack it.

This is how it looks like: C:\Users\Me\Downloads\CUE> pack "MEDIA" NEWDATA 0
Gives me a file open error, I'm running it as admin.

Use the same syntax, but adding the new name: PAK "C:\Progr....\PAKS\DATA" D:\TEMP\NEW and now you have NEW.PAK and NEW.PAK.MAN in D:\TEMP

Compression level 0 is for no comrpession (very bog DATA.PAK file).
User avatar
CUE
 
Posts: 15
Joined: Sat Sep 29, 2012 11:50 am
Location: Valladolid, Spain

Re: PAK extractor with source code in C

Postby capa14 » Mon Oct 01, 2012 11:03 am

Can someone post full line examples?

I succeeded in unpack and the media folder is there...But im not understanding the syntax to pack it again.

Thanks
"Battles that could have been memorable, turned into our worst nightmare in stop motion" - CAPA
ASUS M4A87TD; AMD Phenom II x 6 1090T Black 3.2 Ghz ; AMD XFX Radeon 6970 2GB GDDR5 880 Mhz/1375 Mhz; 4 x 2GB Kingston Hyper-X 1600Mhz
capa14
 
Posts: 115
Joined: Thu Sep 27, 2012 10:52 am

Re: PAK extractor with source code in C

Postby Archanoth » Mon Oct 01, 2012 11:09 am

I still can't see the unpacked folder.
I'm using <pack.exe file path> D:\...\DATA as the syntax, and the program supposedly extracts all the files and finishes the task, but the extracted folder is nowhere to be found.
Image
User avatar
Archanoth
 
Posts: 76
Joined: Wed Sep 09, 2009 2:08 am
Location: Portugal

Re: PAK extractor with source code in C

Postby boot » Mon Oct 01, 2012 11:51 am

Confused by paths? I have used this extractor, works fine if you read instructions.
Let's say your only path is C:\Torchlight2
Put DATA.PAK, DATA.PAK.MAN and pack.exe program in that folder.
Open cmd, run "cd C:\Torchlight2" then run "pack.exe DATA" it will extract into C:\Torchlight2\MEDIA
To pack it again just run "pack.exe DATA NEW 0" for no compression or "pack.exe DATA NEW 5" for compression rate of "5"
This will create NEW.PAK and NEW.PAK.MAN which you can rename to DATA.PAK and DATA.PAK.MAN and use in your game until the next patch.
Image
User avatar
boot
 
Posts: 267
Joined: Sun Jun 24, 2012 12:21 pm
Location: North of the wall

Re: PAK extractor with source code in C

Postby Archanoth » Mon Oct 01, 2012 11:57 am

Oh, it works now.
The reason is that I was running the program from my D: drive instead of my main C: drive.
Thanks for the help! :)
Image
User avatar
Archanoth
 
Posts: 76
Joined: Wed Sep 09, 2009 2:08 am
Location: Portugal

Re: PAK extractor with source code in C

Postby capa14 » Mon Oct 01, 2012 12:10 pm

boot wrote:Confused by paths? I have used this extractor, works fine if you read instructions.
Let's say your only path is C:\Torchlight2
Put DATA.PAK, DATA.PAK.MAN and pack.exe program in that folder.
Open cmd, run "cd C:\Torchlight2" then run "pack.exe DATA" it will extract into C:\Torchlight2\MEDIA
To pack it again just run "pack.exe DATA NEW 0" for no compression or "pack.exe DATA NEW 5" for compression rate of "5"
This will create NEW.PAK and NEW.PAK.MAN which you can rename to DATA.PAK and DATA.PAK.MAN and use in your game until the next patch.


Thanks man!

I thought you had to point the media folder in some point... i guess it just needs the original DATA as "template"

Could repack it now!
"Battles that could have been memorable, turned into our worst nightmare in stop motion" - CAPA
ASUS M4A87TD; AMD Phenom II x 6 1090T Black 3.2 Ghz ; AMD XFX Radeon 6970 2GB GDDR5 880 Mhz/1375 Mhz; 4 x 2GB Kingston Hyper-X 1600Mhz
capa14
 
Posts: 115
Joined: Thu Sep 27, 2012 10:52 am

Next

Return to Mod Showcase

Who is online

Users browsing this forum: No registered users and 4 guests