Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: The pak system, need a bit of help :)  (Read 15102 times)
Aurora
Community Member
*
Posts: 36


WWW
« on: January 18, 2009, 08:45:36 AM »

So ive been playing with making a pak content program in C#, but this line crashes the editor

// this basicly all in the program at test stage

TVPackage pkg = new TVPackage();
int id = pkg.CreatePackage("c:\\test.pak"); //<---- crash

error is (translated from danish)

System.AccessViolationException: Attempt to Read/Write Protected Memory,
   at CTVPackage.CreatePackage(CTVPackage* , SByte* )
   at MTV3D65.TVPackage.CreatePackage(String sPackageName)

Anyone else experience this in C# (or c++ or whatever) ?

Do i need to init the engine or anything else before using TVPackage ? (right now im only doing those 2 lines above).

Thanks Smiley
Logged

ASUS P5E AiLifestyle /w Intel Core 2 Quad Q9550 @ 3.6 Ghz
4GB Mushkin PC-8500, Asus Gforce Asus GTX295 1792MB, 1.95 TB HDD
28" ViewSonic VX2835wm 3ms on Windows Vista Home Premium x64.

Ninnea Online - http://www.Ninnea-Online.com (In progress)
nadjibus
Community Member
*
Posts: 250

Heavy Dev Process


« Reply #1 on: January 18, 2009, 08:51:44 AM »

Yes you need to init the engine. use TV.Init3DNoRender  Wink
Logged

Aurora
Community Member
*
Posts: 36


WWW
« Reply #2 on: January 18, 2009, 08:53:57 AM »

Excellent, thought it was something wierd like that Tongue

Thanks  Grin
Logged

ASUS P5E AiLifestyle /w Intel Core 2 Quad Q9550 @ 3.6 Ghz
4GB Mushkin PC-8500, Asus Gforce Asus GTX295 1792MB, 1.95 TB HDD
28" ViewSonic VX2835wm 3ms on Windows Vista Home Premium x64.

Ninnea Online - http://www.Ninnea-Online.com (In progress)
Aurora
Community Member
*
Posts: 36


WWW
« Reply #3 on: January 18, 2009, 01:02:22 PM »

And im gonna have to be stupid and ask another question (i did search forums first).

The pak file is now made, how do i get a "filelist" of files in the pack ?

I usually do a (in C#)

like foreach(string file in thisthing) or similar, but i cant seem to find a array that holds the filenames or fileid's.

Thanks (again) Smiley
Logged

ASUS P5E AiLifestyle /w Intel Core 2 Quad Q9550 @ 3.6 Ghz
4GB Mushkin PC-8500, Asus Gforce Asus GTX295 1792MB, 1.95 TB HDD
28" ViewSonic VX2835wm 3ms on Windows Vista Home Premium x64.

Ninnea Online - http://www.Ninnea-Online.com (In progress)
nadjibus
Community Member
*
Posts: 250

Heavy Dev Process


« Reply #4 on: January 18, 2009, 01:27:00 PM »

   
Code:
int ip = Package.OpenPackage(PATH_TEXTURES + "Temp\\maptexture.dvt");
   
    int filecount = Package.GetFileCount;
    string[] filenames = new string[filecount];
    for (i = 1; i <= filecount; i++) {
        filenames(i - 1) = Package.GetFileName(ip, i);
    }

Hope it helps (I'm away from my home computer, I can't test the code right now, but it should work)
Logged

Aurora
Community Member
*
Posts: 36


WWW
« Reply #5 on: January 19, 2009, 03:23:07 AM »

Thanks Smiley with a few minor modifications it worked like a charm. Grin
Logged

ASUS P5E AiLifestyle /w Intel Core 2 Quad Q9550 @ 3.6 Ghz
4GB Mushkin PC-8500, Asus Gforce Asus GTX295 1792MB, 1.95 TB HDD
28" ViewSonic VX2835wm 3ms on Windows Vista Home Premium x64.

Ninnea Online - http://www.Ninnea-Online.com (In progress)
Aurora
Community Member
*
Posts: 36


WWW
« Reply #6 on: January 19, 2009, 11:32:41 AM »

Any way of scrambling (encrypting) the content in the pak file ?

Right now its just as unsecure as if it was unpacked...
Logged

ASUS P5E AiLifestyle /w Intel Core 2 Quad Q9550 @ 3.6 Ghz
4GB Mushkin PC-8500, Asus Gforce Asus GTX295 1792MB, 1.95 TB HDD
28" ViewSonic VX2835wm 3ms on Windows Vista Home Premium x64.

Ninnea Online - http://www.Ninnea-Online.com (In progress)
Raine
Customers
Community Member
*****
Posts: 1212


« Reply #7 on: January 19, 2009, 12:29:04 PM »

Zip it with a password before unpacking. However, consider that tools like DX Ripper can nullify your efforts in no time - provided we're talking about game assets, otherwise TVPak isn't the greatest security tool in the world.
Logged

nadjibus
Community Member
*
Posts: 250

Heavy Dev Process


« Reply #8 on: January 19, 2009, 02:25:55 PM »

Why not encrypting them BEFORE packing?
Logged

Aurora
Community Member
*
Posts: 36


WWW
« Reply #9 on: January 19, 2009, 02:56:08 PM »

How would i do that.

I mean, i know how to encrypt the file data when putting it into the pack, but how would i go about loading the encrypted data into engine ?

Load Pak -> (string) GetFile(?1) -> Decrypt string -> Use it in engine (?2)

?1, returns the data inside file is my guess, but then
?2, how do you load data into engine to use eg LoadTexture(the_decrypted_string....??)

I dont understand how it will work encrypting data without having to extract and decrypt the files when you wish to use them onto disk.

As i understand it, it does all the file data handling internally

Load Pak
LoadTexture (filename,...) and it loads directly from pak via filename.

If you could do some psudo code or explain that a bit i would be grateful.

Thanks Smiley
« Last Edit: January 19, 2009, 03:00:54 PM by Aurora » Logged

ASUS P5E AiLifestyle /w Intel Core 2 Quad Q9550 @ 3.6 Ghz
4GB Mushkin PC-8500, Asus Gforce Asus GTX295 1792MB, 1.95 TB HDD
28" ViewSonic VX2835wm 3ms on Windows Vista Home Premium x64.

Ninnea Online - http://www.Ninnea-Online.com (In progress)
Raine
Customers
Community Member
*****
Posts: 1212


« Reply #10 on: January 19, 2009, 04:09:24 PM »

Whoa, well, it was worded poorly. I really meant to zip + password the whole pack, then unzip and use it normally.

In any case, almost every game out there has had its assets ripped in a way or the other, I wouldn't really bother unless you're trying to conceal sensitive data...
Logged

nadjibus
Community Member
*
Posts: 250

Heavy Dev Process


« Reply #11 on: January 19, 2009, 04:39:25 PM »

hmm Like Raine said, why are you trying to encrypt your data? it's really unnecessary since  any hacker can crack it... or you can just start developing your application/game because there is really more important things (and more difficult) awaiting you... when you finish your game you can return to this point and try to find a solution.

Just my 2 cents!

(I'm using PAKs also, but just for regrouping files, to not have the user installes thousands of files, and I'm letting them open also for modding community, nowadays it's very important thing to think about modding)
Logged

Aurora
Community Member
*
Posts: 36


WWW
« Reply #12 on: January 19, 2009, 04:50:47 PM »

This will be a online multiplayer game, so concealing certain parts, specially map files and such is VERY important to me, in the end it will help me limit some packets and such.

The reason why i cannot skip this now, is if content protection is never added, i made a game that cant be released.

I know that "hackers" can decrypt everything and such, but no reason to make it availible to everyone.
Logged

ASUS P5E AiLifestyle /w Intel Core 2 Quad Q9550 @ 3.6 Ghz
4GB Mushkin PC-8500, Asus Gforce Asus GTX295 1792MB, 1.95 TB HDD
28" ViewSonic VX2835wm 3ms on Windows Vista Home Premium x64.

Ninnea Online - http://www.Ninnea-Online.com (In progress)
Raine
Customers
Community Member
*****
Posts: 1212


« Reply #13 on: January 19, 2009, 05:53:14 PM »

I understand your concern, and it's not like we're suggesting to just open up your assets to everyone; it's perhaps just a honest reality check.

If you're going to release the game tomorrow, or in the next 30 days, then it's an important issue for you; otherwise I'd suggest focusing on other aspects on the game while you find what you need (and often it's a byproduct of "browsing while bored" when you less expect it Smiley ).

In any case, I think it's still a valid solution to just zip the package with a password. At least you have one degree of protection you can improve upon.

hth a bit
Logged

sybixsus
Customers
Community Member
*****
Posts: 1339


WWW
« Reply #14 on: January 19, 2009, 07:03:10 PM »

I know that "hackers" can decrypt everything and such, but no reason to make it availible to everyone.
Anyone who wants it will get it. There are simple freeware programs available which will dump the contents of VRam, including any models, textures and even shaders which happen to be there at the time. Hypnotron posted one recently on this forum, and there are others. There is no way to prevent this unless you're going to encrypt everything on the GPU and then decode it in a shader, and even then, the shader which decodes it will be available for anyone to grab.

If you spend more than ten minutes doing this, you're just costing yourself time you could usefully spend making the content you're protecting better. A password protected zip file is about as far as it's worth going.
Logged
Toaster
Community Member
*
Posts: 378


WWW
« Reply #15 on: January 20, 2009, 01:19:03 PM »

Even then most people these days don't even bother to zip or pack their files. It means faster load times which everyone loves. Grin Crysis had all their files zipped up but no password even and I dont think they really cared.
Logged

Visit my site at: Unknown Abstraction
Aurora
Community Member
*
Posts: 36


WWW
« Reply #16 on: January 21, 2009, 04:21:47 AM »

Even then most people these days don't even bother to zip or pack their files. It means faster load times which everyone loves. Grin Crysis had all their files zipped up but no password even and I dont think they really cared.

That might be right for million $ engines.

But there is a reason behind 99% of all games comes with one or another kind of asset protection, im sure they dont waste time on it for fun.
Logged

ASUS P5E AiLifestyle /w Intel Core 2 Quad Q9550 @ 3.6 Ghz
4GB Mushkin PC-8500, Asus Gforce Asus GTX295 1792MB, 1.95 TB HDD
28" ViewSonic VX2835wm 3ms on Windows Vista Home Premium x64.

Ninnea Online - http://www.Ninnea-Online.com (In progress)
Raine
Customers
Community Member
*****
Posts: 1212


« Reply #17 on: January 21, 2009, 07:02:19 AM »

I've been thinking about your problem. You might roll your own pak system quite easily. This is the file layout:

header:
format version
number of files

for each file:
  file path ("/data/map.dat")
  file offset
  file size

content:
  for each file:
    use a Zip library to obtain a zipped file (encrypted with a password) and dump it in this section with ascii encoding


quick example:

Code:
PAK1.0
2
data/map.dat          0           1024
data/map2.dat         1024        512
galeigfqw87egfrqlwfuiqgf79qgrfiubfelwgfqwefgqgflewgqaewfuhewfk
dbfwgefdlsgdlfgslgfugflsigflur4wgfiwgrfuwhlierfhlwefrlwuigflgw
sdgflageflagfilagfleiqgwifgqlegugqflegulqgfqulfuguqlfgqlgflqug
(etc...)

« Last Edit: January 21, 2009, 07:04:49 AM by Raine » Logged

AriusEso
Customers
Community Member
*****
Posts: 940

Esoteric


« Reply #18 on: January 21, 2009, 08:34:07 AM »

That might be right for million $ engines.

But there is a reason behind 99% of all games comes with one or another kind of asset protection, im sure they dont waste time on it for fun.

I don't think they waste much time on it at all. Lookit, even if people rip your media, the important part is geometry, right?

1: That's TVM/TVA - you know any importers for these formats?
2: Probably easier just to use GPU ripping software, as somebody mentioned earlier an you can't protect against this at all.
3: Map modification.. your maps should be your own custom format anyway unless you go along an XML or similar route.

People package their content data do so for two reason:

1: Keep things tidy.
2: Compression. I don't think CTVPackage has any compression, so that's a valid complaint.
Logged

-...-

Hawthorne
Customers
Community Member
*****
Posts: 275


« Reply #19 on: January 21, 2009, 08:44:25 AM »

I don't think they waste much time on it at all. Lookit, even if people rip your media, the important part is geometry, right?

1: That's TVM/TVA - you know any importers for these formats?
2: Probably easier just to use GPU ripping software, as somebody mentioned earlier an you can't protect against this at all.
3: Map modification.. your maps should be your own custom format anyway unless you go along an XML or similar route.

People package their content data do so for two reason:

1: Keep things tidy.
2: Compression. I don't think CTVPackage has any compression, so that's a valid complaint.

What he said.

-Pat
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks