The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Decrypting/Hiding image files in android game with C++
agakisiyev


Joined: 18 Jun 2015
Posts: 7
Guys, is there any easy way to decrypt (assuming that image files will be encrypted and shipped with game) image files in android game? (game is question/answer style, so i don't want anyone to reach my resources Smile )

Or alternatively, is there an easy way to hide my image files (most probably .png but can change if needed) from users?
Decrypting/Hiding image files in android game with C++
Bob Rubbens
Guest

Compile them as literal byte arrays in the executable, and use sdl rwops? Op 12 jul. 2015 2:14 PM schreef "agakisiyev":
Quote:
Guys, is there any easy way to decrypt (assuming that image files will be encrypted and shipped with game) image files in android game? (game is question/answer style, so i don't want anyone to reach my resources )

Or alternatively, is there an easy way to hide my image files (most probably .png but can change if needed) from users?


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Re: Decrypting/Hiding image files in android game with C++
agakisiyev


Joined: 18 Jun 2015
Posts: 7
Bob Rubbens wrote:
Compile them as literal byte arrays in the executable, and use sdl rwops? Op 12 jul. 2015 2:14 PM schreef "agakisiyev":
Quote:
Guys, is there any easy way to decrypt (assuming that image files will be encrypted and shipped with game) image files in android game? (game is question/answer style, so i don't want anyone to reach my resources )

Or alternatively, is there an easy way to hide my image files (most probably .png but can change if needed) from users?


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



I kinda get the idea, but I would be sure if there was an example, can you give an example (as a code snippet or sth) please? Smile
Decrypting/Hiding image files in android game with C++
Bob Rubbens
Guest

I never actually did this myself so I can't produce a code snippet in a few minutes. I can give you a few pointers however. First I would save the picture as a C source (you can do this in gimp) to get the image in a c file. Take a look at the data, but it's basically a struct with some info in it's members and one member containing a huge array. Then I would use RWopsFromMem (see the second post here:  http://www.gamedev.net/topic/454985-loading-sdl-surfaces-from-memory/) to convert the array data member to something sdl can work with, and then use sdl's rwops to surface functions (sdl has one that takes bmp's, so if you use png or something you'll have to use sdl_image) to get an actual surface.


If you have lots of images you might want to write something that converts them all to c files automatically. You can also use sdl for this: sdl can read the image, and then you write all the colors of all pixels to a file.


Hope you can use some of this. Good luck.


On 12 July 2015 at 14:29, agakisiyev wrote:
Quote:



Bob Rubbens wrote:

Compile them as literal byte arrays in the executable, and use sdl rwops? Op 12 jul. 2015 2:14 PM schreef "agakisiyev" <>:


Quote:

Guys, is there any easy way to decrypt (assuming that image files will be encrypted and shipped with game) image files in android game? (game is question/answer style, so i don't want anyone to reach my resources )

Or alternatively, is there an easy way to hide my image files (most probably .png but can change if needed) from users?


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org









I kinda get the idea, but I would be sure if there was an example, can you give an example (as a code snippet or sth) please?


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org