Jump to content
  • Advertisement
Sign in to follow this  
Madprog

game files how to store?

This topic is 4630 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

i dont have a clue how to store the bitmaps or anyfile the game uses in format where the user cant see bitmaps sound files etc... any help is welcome

Share this post


Link to post
Share on other sites
Advertisement
The easiest way to handle it is to put them in a zip file, name it with a different extension like .dat and use something like PhysFS to read the zip.

Share this post


Link to post
Share on other sites
The simple solution is a packed file format. All you do is put the files together in one big file. You don't have to do any compression if you don't want, and until the user reverse engineers the file format or you provide an unpacking tool, they won't be able to get to the data. However it isn't extremely hard to reverse engineer an uncompressed packed file, so just how badly do you want to protect this data?

Share this post


Link to post
Share on other sites
SiCrane you can go eat a pig foot for beating me! But I guess a freely available library would also be rather easy.

Share this post


Link to post
Share on other sites
ok thanks for the help now how do i make this PhysFS work on my program what do i need to add so it will work?

Share this post


Link to post
Share on other sites
disregard the last post figured how to run the PhysFS on my program now only problem is I intend to use this for the bitmaps sounds files etc... how is it possible for me to feed the file i load with the PhysFS to the directX functions like D3DXCreateTextureFromFileEx()... and some direct sound stuff dont have a clue on this either

thanks for the replies

Share this post


Link to post
Share on other sites
Well instead of using D3DXCreateTextureFromFileEx(), you would use a function like D3DXCreateTextureFromFileInMemory(). Use PhysFS to read the file into a buffer in memory, and pass the buffer to D3DXCreateTextueFromFileInMemory().

Share this post


Link to post
Share on other sites
ok finally got the textures to load using the FileFromMemory call BUT.... did the same thing for the sound and although it "loads the sound succesfully" the sound doesnt play

im using dsutil.h so heres the code

//get the file
PHYSFS_file* myfile = PHYSFS_openRead("click.wav");
char *myBuf;
myBuf = new char[PHYSFS_fileLength(myfile)];
int length_read = PHYSFS_read (myfile, myBuf, 1, PHYSFS_fileLength(myfile));


//load the sounds
m_pSoundManager->CreateFromMemory( &m_pMenuSound, (BYTE*)myBuf,length_read, NULL, 0, GUID_NULL, 5 );

not gettin any erros just no sound at all

heres the parameters im supposed to feed

HRESULT CreateFromMemory( CSound** ppSound, BYTE* pbData, ULONG ulDataSize, LPWAVEFORMATEX pwfx, DWORD dwCreationFlags = 0, GUID guid3DAlgorithm = GUID_NULL, DWORD dwNumBuffers = 1 );

could it be i need to specify the LPWAVEFORMATEX...dunno how to get it

thanks for all your help

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!