Encrypt/Protect Images and External Files
Blitz3D Forums/Blitz3D Programming/Encrypt/Protect Images and External Files
| ||
Is there a way to make the external files such as images write proof? Once the game is ready to be published, I don't want people to change textures and images. Thanks! |
| ||
There's some stuff around the code-archives or I think maybe in the tools that deal with packaging the images along with the Executable, this seems like the best bet to me. Otherwise, you could perhaps make a note of the size of the files and check that on loading to ensure they match up? I'm sure there's methods of proper encryption and stuff, but it's beyond me and I'll leave that for someone else :D |
| ||
you can get packers that stick everything in the exe (i think incbin is a bmax only method) or you can convert bitmaps into data statements as an incude in the code althouh you might be stuck with 24bit map bmp size files compared to jpg and png compression (unless you do extra coding i guess) so yes you can if you feel you need to edit: i must be slow at typing today when i started there was only one post ;) |
| ||
hi, i join in this topic. :) i have the same question, but, if i have like 50mb of jpg files in my game... if i pack them in the .exe file. can the users experiment problems when they try to load an .exe that big? regards, Santiago |
| ||
I had issue with this specialy polylar is height map mod. making cheat for the MMO game :) anyway. herese mine way. 1) You must encrypt filename in the srouce file.. or else user may change em in your exe file. 2) Make sure you have a nice algorythm to check the loading files. before they load for real. 3) Use one of the packing tools free available. if you do above not to many will be able to get the game broke. i dint tell it was the fast or easy way :) |
| ||
I make my own file types for many things if I want the content to be protected... I even made my own file packer that packs all the game files in one ginormous media.lok file! since there are so many files packed in one file, it is almost impossible to figure out even without some random encryption that is also implemented (i should probably put it in the showcase but im too lazy to put it in there for now) anyway i sometimes use blitz media linker for random small things. however i like using my file packer :) it is messy but it works I recommend (if you have time) making your own stuff like file packers, high score keepers etc... |
| ||
Is there an example of how to make a file packer? |
| ||
well there's not an example really.. i just figured it out.. plus my 'file packer' compresses the files into a seperate file not the exe itself. I just used simple readint writeint commands to make it. hmmm ill put something similar in the codearchives some day :) if i ever get the time if you need to know how it works (like an outline of it) i can give you that |
| ||
Yeah! an outline would be a great a start! and much appreciated! |
| ||
ok sorry this is so vague but here it goes... i dont have the actual code with me right now sorry. I use a type to store all the files in as follows type names field path$ end type 1. This is the part of the program where you get the file path's and the destination file info from the user. I use winb3d because it is simple and efficient 2. after the user finishes entering everything, the program cycles through every type and copies each file into a single file with some extra formatting done (this is the vague part sorry) The code for this part would look similar to the following it is long but very heavily commented. to decode the file, simply undo what u did to write it ingame and rewrite each file in its original folder path then load the media via loadimage loadfont etc. immediately after you unpack it... people will be able to steal your media this way but they cannot modify them before the program loads them This is the code that encodes and compresses the files Type names Field path$ ;The path to the file used End Type Local destfile = WriteFile(destfilepath$ + ".lok") ;This line uses destfilepath, the file path the user entered earlier where the compacted file will be ;destfile is the handle for the destination file WriteInt(destfile,10506) ;This just writes a random number to the beginning of the file as a 'watermark' Local count = 0 ;This variable will be used to count the number of files being compressed For n.names = Each names ;Cycles through each name to count the number of files stored count = count + 1 Next WriteInt(destfile,count) ;This puts how many files are being compressed in the file For n.names = Each names tempfile = ReadFile(n\path$) ;This reads the files as they come through WriteString(destfile,n\path$) ;This writes the name of each file at the beginning of each file While Not Eof(tempfile) ;This transfers the data from the file selected to the compressed file WriteInt(destfile,ReadInt(tempfile)) Wend WriteInt(destfile,1234) ;This is the sequence that will serve as the markers between files WriteInt(destfile,9876) ;The probability that a file will contain these numbers in this order is extrememly low... if a file you are using does then WriteInt(destfile,101) ;Just change them :) WriteInt(destfile,10) WriteInt(destfile,55608) CloseFile(tempfile) Next CloseFile destfile the program above is not complete but is a code snippet i wrote out really quickly... dont run it! just read it and how it works the file format will now be as follows (in order) 10506 the number of files being compressed a name of a file all the data in that file 1234 the marker of a new file 9876 101 10 55608 a name of a file all the data in that file 1234 the marker of a new file 9876 101 10 55608 etc you get the point |
| ||
This is soo perfect, thanks a lot I definitely appreciate it! |
| ||
no problem.. tell me if there are any confusions? (i have too much free time) |
| ||
I have bought Molebox Pro from http://www.molebox.com/ for this. The advantage with molebox (pro) is that is packs and encrypts all your files and then modifies the actual .exe-file so that is replaces several system-calls to fopen(), fread() etc. This way you can actually have a real packed file and no temporary files written at all to the disk, but your .exe is modified to read the encrypted and packed data by itself instead of the usual files. It's a bit pricey (starts @ 59EUR and pro version is 99EUR) but does a good job as far as I've seen. |
| ||
Molebox is great. Another recommendation is you need better file protection. |