Skip to main content
GameDev.net gamedev.net
🔒 Locked

Loading images from zip files?

Started by somebodykulj Apr 10, 2008 at 7:58 AM 9 replies 3.1k views
Original Post
somebodykulj
somebodykulj
I want to protect my artwork by locking it up in a ZIP or some other archive and then read them in my game, how do i do this?
SiCrane
SiCrane
The easiest method would be to use an existing library like PhysFS.
somebodykulj
somebodykulj
I dont quite understand how it works... if i do this

PHYSFS_file* myfile = PHYSFS_openRead("myfile.txt");


can i pass myfle to SDL_LoadBMP(char* ...)???

What do i need to give my SDL_LoadBMP??
SiCrane
SiCrane
One method would be to use PHYSFSRWOPS_openRead() to open the file and IMG_Load_RW() to load the image from the SDL_RWops.
Trillian
Trillian
Quote:
Original post by somebodykulj
can i pass myfle to SDL_LoadBMP(char* ...)???


This won't be possible as SDL_LoadBMP is designed only to load files directly from the disk. You could load the file from your archive, write it to a temporary disk location and the use SDL_LoadBMP, but that'd be a bit expensive/dumb.

Anyways you can never really "protect" your artwork. It'd be very easy to reverse-engineer your executable (or hook physFX) to see which encrypting key you are using. Why are you afraid anyone would steal your assets? Its extremely unlikely to happen, and even if it would, how would that hurt you? In the most extreme case, you could always sue them.

Generally, asset protecting isn't worth the time, it is always possible to determine how a program decrypts them.
somebodykulj
somebodykulj
I want to protect the art no matter what i know it can be hacked but very few can do so. So haw can i load an image??? what should i do to make this work with SDL???
Quote:

One method would be to use PHYSFSRWOPS_openRead() to open the file and IMG_Load_RW() to load the image from the SDL_RWops.



i dont understand this?? can you give me some more detail?
SiCrane
SiCrane
Quote:
Original post by SiCrane
One method would be to use PHYSFSRWOPS_openRead() to open the file and IMG_Load_RW() to load the image from the SDL_RWops.


somebodykulj
somebodykulj
I dont understand this?

what is the SDL_RWops??? I'm sorry but i just dont get it?
Sneftel
Sneftel
Did you try searching Google for SDL_RWops?
GameCreator
GameCreator
If you're experimenting with libraries/engines, I'd suggest trying HGE. It supports password protected zips. However, unlike SDL, it is strictly for Windows.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.