Skip to main content
gamedev.net
🔒 Locked

resources

Started by athos_musketeer Dec 28, 2002 at 11:21 AM 1 replies 200+ views
Original Post
athos_musketeer
athos_musketeer
anyone knows a way to store te information of the game, such gfx and sound in a different format.. or put them all together in some kind of resource file? so the players can''t alterate them. thanks.
billybob
billybob
i''m working on that now, i''m making a package file class that will handle my files. its basically a header that starts with the number of files in the file. then there is a table of those files. each table entry has:

-name of the file
-offset of the file in the package(where to read from)
-size of the file
-and a 32bit ID number (but thats specific to my resource manager)

when i want to load something, i search the header array (its loaded into memory in the open package method of the package file class) for the filename. once i find it, i get the length and offset, go to that position, and read the length into a buffer in memory. then use the specific functions to load them, and delete the buffer in memory. so if its a texture, i use D3DXCreateTextureFromFileInMemory(...) and pass it the buffer. or if its a mesh, i use my .3ds loader on it. so far it can hold .wavs, .bmps, .3ds, .ogg, and more to come once i get support in my engine for them.

its definitley not encrypting or antyhing, but it stops the average joe from copying the content for whatever.
athos_musketeer
athos_musketeer
ok.. thats a great idea..
but how do i do to pass the info in the file to SDL?

maybe i ask in the SDL page.
thanks a lot

Topic Locked

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

Sign in to reply to this topic.