Sign in to follow this  
Yamian

GAHHH, ARCHIEVE/ENCRYPT FRUSTRATING!!!

Recommended Posts

Yamian    100
Gahhh, I've been trying to archieve/encrypt my agme files for a week now and don't think I've made any progress. So now I'm asking you people, who do u archieve/encrypt ur game files? Here is what I'm looking for... Archieve-put all my fiels into one Encrypt-Only my program and I may see the files Use-easy to integrate into my program!!! I've given up on wasting any time doing it as when it comes down to is, I'll only need it as a learning experience becasue I'm not really concerned about the rights of my blocky artwork, but I just want to learn as many professional aspects of Game Dev as possible. If someone has an exampel I can set up under 10 minutes, thena nd only then will I use it!

Share this post


Link to post
Share on other sites
Sneftel    1788
Encryption: Don't bother. Anything that your program can decrypt, an attacker can decrypt. See: SoftIce, w32dasm, the Church-Turing Thesis.

Archive: http://www.unrarlib.org/ is a good start; put your game files in a .rar archive (rename it from .rar to something else if you feel like being sneaky) and use this library to pull individual files out at runtime.

Share this post


Link to post
Share on other sites
Will F    1069
I agree with Sneftel that encryption is probably a waste of your time.

As for putting all your files into one, take a look at the article Resource Files Explained here at gamedev, hopefully it might be of some use to you.

Share this post


Link to post
Share on other sites
Yamian    100
Thank you so much! I had tried Zziplib, LZMA, Custom stuff, TAR, but never RAR. Thx a mil, I feel liek i've wasted the last week of my liek though, and a GUI based library in another post would still be good.

P.S. I don't think I have to worry attackers if I did encrypt.

Share this post


Link to post
Share on other sites
Yamian    100
This is exactly what I wanted, but I'm eggtin problems. Coudl someone who has used this library tell em what the problem is?


SDL_RWops *SDL_RWFromRAR(char *rarfilename, char *resourcename, char *password)
{
char *buffer;
unsigned long *filesize;

if(!urarlib_get(buffer, filesize, resourcename, rarfilename, password))
{
MessageBox(NULL, strcat("Unable to load ", rarfilename), "ERROR", MB_OK);
exit(1);
}

return SDL_RWFromMem(buffer, *filesize);
}



It compiles fine, but buffer always ends NULL, and the error is not returned.

Share this post


Link to post
Share on other sites
BradDaBug    913
At first glance it looks like you're using the function wrong. I'm looking at the samples included with the library and it looks like the first parameter is supposed to be a pointer to a pointer, and the second is supposed to be the address of an unsigned long, while you're just sending it a pointer to an unsigned long (there's a difference).

Edit: In other words, the function can't write to the pointer you're sending it, so it comes back exactly as it was when you sent it, pointing to NULL.

Share this post


Link to post
Share on other sites
BradDaBug    913

SDL_RWops *SDL_RWFromRAR(char *rarfilename, char *resourcename, char *password)
{
char *buffer;
unsigned long filesize;

if(!urarlib_get(&buffer, &filesize, resourcename, rarfilename, password))
{
MessageBox(NULL, strcat("Unable to load ", rarfilename), "ERROR", MB_OK);
exit(1);
}

return SDL_RWFromMem(buffer, *filesize);
}

Try that. Almost right out of the samples.

Share this post


Link to post
Share on other sites
Yamian    100
okay I fixed that by taking th * from filesize at the end and it compiles fin but I get the messagebox with the error. =(. IS theer somethign wrong with my rar file? does it have to be all the default settings when making te RAR, becasue I did the highest compressing possible.

Share this post


Link to post
Share on other sites
Yamian    100
No that's not it. Well currently the function is


SDL_RWops *SDL_RWFromRAR(char *rarfilename, char *resourcename, char *password)
{
char *buffer;
unsigned long filesize;

if(!urarlib_get(&buffer, &filesize, resourcename, rarfilename, password))
{
MessageBox(NULL, "Unable to load resource file", "ERROR", MB_OK);
exit(1);
}

return SDL_RWFromMem(buffer, filesize);
}



strcat wasn't working right fro some reason so I took that out

and I call it like so

g_music = Mix_LoadWAV_RW(SDL_RWFromRAR("media.rar", "music.wav", "password"), 0);

compiels fine but get teh MessageBox set to come up.

Share this post


Link to post
Share on other sites
BradDaBug    913
What version of WinRar are you using? It looks like 3.0 uses a little bit different algorithm and it won't work, so you'll have to use 2.x.

Share this post


Link to post
Share on other sites
Yamian    100
OMG IT WORKS! THIS IS WHAT I'VE BEEN TRYING TO DO FOR A WEEK NOW AND IT WORKS! Only problem is, urar_get was always returning 0 so no matetr what I got the Messagebox and the program closed, so maybe it did work with 3.30 and I never knew it. I'll try it with 3.30 again ebcasue that could encrypt the names too. and now I gotta make a loading screen

Share this post


Link to post
Share on other sites
Yamian    100
nope, 3.30 doesn't work. Now instead of checking it == 0, it checks for buffer == NULL, which does work if you rename or remove the file. Now I just need a loading screen =P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this