Sign in to follow this  
Madprog

game files how to store?

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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this