About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
[SOLVED] Unpacking pak file from memory?
Author Message
Dandruff Offline
Member

Post: #1
[SOLVED] Unpacking pak file from memory?
Hello, i am trying to make an application that updates game files and i am wondering how once you finished downloading the .pak file if you can then extract it from memory and phyically overwrite files. Is this possible?

I've tried to look at the file and pak headers for clues but i couldn't find anything.

The downloader
Code:
download.create(S+"clientupdate.servebeer.com/downloads/" +"stuff.pak");

How i loaded the download data to the pak (update).
Code:
update.loadMem(download.data(),download.size());

I then checked to make sure that the pak is downloaded+loaded correctly. The pak loaded fine.
Code:
D.text     (0,0,S+"Files " + update.rootFiles());

Soo again, is there anyway to unpak this using code? Or, if there's an easier/other way to do this please tell me smile Also, Esenthel, how did you make your autoupdater? Using FTP or (a lot of?) downloaders? Thanks!

If this doesn't work i'll just move to FTP so no biggy smile


Currently trying to work with the FTP instead of the downloader but if anything comes up i would like to know.
(This post was last modified: 11-10-2010 01:20 AM by Dandruff.)
11-09-2010 03:21 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Unpacking pak file from memory?
Autoupdate uses a few Download objects.

For a game you shouldn't extract the pak, but write it to physical file
File f; f.write("patch.pak"); f.put(download.data...) f.del()
then add the written pak to the pak database
Paks.add("patch.pak") - now you can automatically use the files

if you do however want to extract the files for some reason, there's function for that in io.h (on the bottom of the header, FCopy or something, that takes as input Pak object, and Str destination target)
11-09-2010 11:36 AM
Find all posts by this user Quote this message in a reply
Dandruff Offline
Member

Post: #3
RE: Unpacking pak file from memory?
Yes! That's exactly what i was looking for, the pak extracted beautifully.

My goal was to do the same thing that your uploader does, albeit differently and less efficient. It is a separate exe from the main program and just downloads a pak file that contains updated files of the game ( Somewhat problematic, and weird to maintain smile), and also overwrites the main application.



I'm a bit curious in what the second parameter of the download.create function, offset, does. How do you use it?
(This post was last modified: 11-10-2010 01:08 AM by Dandruff.)
11-10-2010 01:03 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Unpacking pak file from memory?
it's used when you don't want to download a file from the start, but for example from i-th byte (like continue previous unfinished download)
11-10-2010 01:07 AM
Find all posts by this user Quote this message in a reply
Dandruff Offline
Member

Post: #5
RE: Unpacking pak file from memory?
Ah, that makes sense, thanks for clearing that up
(This post was last modified: 11-10-2010 01:12 AM by Dandruff.)
11-10-2010 01:12 AM
Find all posts by this user Quote this message in a reply
Post Reply