how to extract all file in *.dat to disk
stonecold

if its possible to extract all file in *.dat to disk
???

LennyLen

Yes, use the "-e *" option of the dat tool, or use the grabber.

edit: the command will look like this: dat -e yourdat.dat *

stonecold

sorry,add that i mean in program

CursedTyrant
system("dat -e yourdat.dat *")

? :P

I know, there surely is a better way, but it should still work :P

Tobias Dammers
system("dat -e yourdat.dat *");

But what for?
A datafile is meant to be used like this:
1. Create the datafile with either grabber or dat.
2. Distribute the datafile along with your executable.
3a. In your code, load the datafile and use the resulting DATAFILE* pointer to access the data. load_datafile() produces allegro-useable data structures directly, there's no need to call load_bitmap() or any other loading function on them.
3b. Alternatively, you can treat the datafile as a sort of "magic" folder, and access files by the following filename convention:
yourdat.dat#FOO_BMP
For example, you could do:

BITMAP* my_bmp = load_bitmap("yourdat.dat#FOO_BMP", NULL);

For this to work, you DON'T need to load the entire datafile.

And please (re-)read the manual, section "datafile routines".

Thomas Fjellstrom
Tobias said:

BITMAP* my_bmp = load_bitmap("yourdat.dat#FOO_BMP", NULL);

Or even:

DATAFILE *dat_object = load_datafile_object("your.dat", "foo");
BITMAP *bmp = (BITMAP *)(dat_object->dat);

Which ever.

Kitty Cat
Quote:

Quote:

BITMAP* my_bmp = load_bitmap("yourdat.dat#FOO_BMP", NULL);

Or even:
DATAFILE *dat_object = load_datafile_object("your.dat", "foo");

The former needs the bitmap stored as a binary chunk. The latter needs to be stored as a bitmap object. Just an FYI.

stonecold

because i use audiere lib to play ogg
and i wanna packed ogg in DAT and use it
but i don't know any good method

Tobias Dammers

You may be better off using something like alogg, which integrates better with allegro. Otherwise, simply don't put ogg files into a datafile. It won't compress much anyway, and datafiles won't do much to protect your content, so there isn't really a great reason for putting an ogg file into a datafile.

CGamesPlay
Quote:

so there isn't really a great reason for putting an ogg file into a datafile.

... especially since your original question was how to get it out of the data file.

Tobias Dammers

Yes, that was the original question.
But it makes me wonder how the ogg file got into the datafile in the first place. Either the OP put it there himself, which makes my question very valid; or someone else did, in which case I'd suggest to just use grabber or dat.

Thread #590889. Printed from Allegro.cc