game files how to store?

Started by
6 comments, last by Madprog 18 years, 5 months ago
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
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.
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?
SiCrane you can go eat a pig foot for beating me! But I guess a freely available library would also be rather easy.
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?
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
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().
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

This topic is closed to new replies.

Advertisement