Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / pak encryption

Author
Message
MKII
20
Years of Service
User Offline
Joined: 28th May 2004
Location: in a nutshell
Posted: 10th Nov 2005 02:11
ok guys im makeing a program that will save all media in the directory into a single pak file the. I need the code that will read all of the files in a pak file and the code that will write all the files in a directory into a pak file. I hope this made any sense.

Thanks in advance for the help,
Nathan Thomas


MKII PRODUCTIONS Current Projects The perirodic table and the 3d planetarium @home
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Nov 2005 05:01
Yeah it makes perfect sense.

You start off good by saying "i'm making a program" then you go on to talk about how you need the code to do everything you want for the program you're making. I thought YOU were making it... not us.
MKII
20
Years of Service
User Offline
Joined: 28th May 2004
Location: in a nutshell
Posted: 10th Nov 2005 12:51
ok let me rephrase this all. All i need to know is if the code is possible the only was i know to use the pak files is like this



all i need to know is if their is a way to write all the files in the directory with one command ant read them as well.

ps sorry i understand i didnt word the question very well


MKII PRODUCTIONS Current Projects The perirodic table and the 3d planetarium @home
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Nov 2005 20:14 Edited at: 10th Nov 2005 20:19
Quote: "ok let me rephrase this all. All i need to know is if the code is possible the only was i know to use the pak files is like this

all i need to know is if their is a way to write all the files in the directory with one command ant read them as well."


It's definitely possible in Darkbasic... but it won't be on a single line... and not like you wrote. The commands "read file" and "write file" are intended to write a single variable (that uses 4 bytes)... not an entire file.

I looked up what a .pak file is... i've never heard of it before. I found a site that talks about the structure of a pak file and has C++ examples on how to do it. Just looking at it should give you the general idea of what you need to do. If the program you want is intended to use the .pak files you create with other programs (that you didn't write) you'll have to find out exactly what encryption they use.

If it's not for other programs you don't have to go into all the details in the header. Just use a string that your program can read (when you want to unpack) to see if the pak file is made by your program. Then the filenames with the total number of bytes each file takes up, then the files themselves (use the total bytes for each file to determine where to start and stop reading the bytes in the pak file).

Unfortunately this will be a lot harder to do in Classic than in Pro (because you can't use UDT's or make variables as anything other than a string, integer, and float).

http://www.gamedev.net/reference/articles/article1991.asp

Quote: "ps sorry i understand i didnt word the question very well"


It's ok. Sorry about being rude to you.
MKII
20
Years of Service
User Offline
Joined: 28th May 2004
Location: in a nutshell
Posted: 10th Nov 2005 22:25
ok thanks for the help ill look into that asap. You wrent really being rude.


Thenks,
Nathan Thomas


MKII PRODUCTIONS Current Projects The perirodic table and the 3d planetarium @home

Login to post a reply

Server time is: 2025-05-22 14:09:03
Your offset time is: 2025-05-22 14:09:03