Jump to content
  • Advertisement
Sign in to follow this  
PezPersonne

How to protect *.bmp

This topic is 4761 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, In my game I use bitmap files for graphics texures. I would like to be able to prevent the users to modify them and change the extension of the files. How can i proceed ? Thank you

Share this post


Link to post
Share on other sites
Advertisement
Hmmm... What do you mean, prevent users from changing the extensions? While the files are on the user's disk, they can change them, edit them, delete them - whatever. The only thing you can do is fail to load your game if the BMP is changed in any way. Obviously you will not find it if the extension was changed.

If it's important you can pack everything into a single data file that will contain all your data. You can even pack it all into your EXE file if you want.

Share this post


Link to post
Share on other sites
Thank you DadleFish,

It's true that's difficult to protect all the data which are on a user station.

And I don't want to make a big exe file.

But sometimes, I see DX game without .bmp files and I was wondering how is it possible ?

Share this post


Link to post
Share on other sites
I second DadleFish, there is little point in hiding resources. If the application can access them, so can any determined user.

That being said, you can either create your own image format (maybe a wrapper for an existing format) or pack all the images in a custom resource file.

Share this post


Link to post
Share on other sites
Quote:
Original post by PezPersonne
But sometimes, I see DX game without .bmp files and I was wondering how is it possible ?


This can be done a number of ways. One is adding the ability to decode .zip format files to your program and simply changing the extension. Or any other archive format, including your own home brew type.

This kind of "protection" is usually fairly easy to work around, to the point where it shouldn't be considered protection at all (my 2¢).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster


BMP files (like the 24bit mode) have a fairly simple structure. The code to read them is available online (google it) and it would not be too hard to create a converter t6o read and write the pixel data as encrypted. The encryption doesnt need to be complicated, just enough to discourage most peaple from being able to steal your data. Some kind of cyclic pattern being XORed with the byte data would be fairly simple to impliment.

Share this post


Link to post
Share on other sites
I plan on using simple XOR with long string key encryption on text in my game files. The intent is not to make it unhackable, but to deter less skilled hackers from trying.

Share this post


Link to post
Share on other sites
If you want to stop people getting at your data that's a bit of work. On the other hand maybe you just want to stop people who are browsing through the folder from going "look a bitmap - what happens if I edit it?" and knackering their installation then any simple approach of renaming the extension or packing the files will do - anything so it doesn't show up in explorer as an image file.

Share this post


Link to post
Share on other sites
I believe the specification for .bmp (which you'll no doubt find with a quick search on the Web) includes a "reserved" section in the header. One option (not that I recommend it, I mention it merely as an option :-) would be to have a quick tool to "validate" a bitmap - it reads in the body of the file, generates some kind of checksum, XORs it with some value you come up with yourself, and stores it in the reserved field. At runtime, check this reserved field in the header against the same process done to the body. If they match, you can be fairly confident no-one else has fiddled with the bitmap.

I can understand your reasoning behind this as the first "mod" I ever did with games was to edit some Doom bitmaps, to draw some smiley faces on them. Not exactly Counter-Strike but I was proud! (In fact they were GIFs not BMPs and I had to de-WAD them to get to them using someone else's tool, but a simple checksum in the header would have stopped me dead in my tracks, lacking any knowledge of such things at that time).

That said, using raw bitmaps is rarely a good method for a game, hack-protected or not; but I suspect you will learn that for yourself in the fullness of time anyway.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!