mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-20 01:11:18 +00:00
start working on file extraction
This commit is contained in:
parent
b01cda716f
commit
311811bd25
1 changed files with 15 additions and 0 deletions
|
@ -181,6 +181,10 @@ pack_add (pack_t *pack, const char *filename)
|
|||
|
||||
pf = &pack->files[pack->numfiles++];
|
||||
|
||||
if (filename[0] == '/') {
|
||||
fprintf (stderr, "removing leading /");
|
||||
filename++;
|
||||
}
|
||||
strncpy (pf->name, filename, sizeof (pf->name));
|
||||
pf->name[sizeof (pf->name) - 1] = 0;
|
||||
|
||||
|
@ -191,9 +195,20 @@ pack_add (pack_t *pack, const char *filename)
|
|||
fwrite (buffer, 1, bytes, pack->handle);
|
||||
pf->filelen += bytes;
|
||||
}
|
||||
fclose (file);
|
||||
if (pf->filelen & 3) {
|
||||
static char buf[4];
|
||||
fwrite (buf, 1, 4 - (pf->filelen & 3), pack->handle);
|
||||
}
|
||||
Hash_Add (pack->file_hash, pf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pack_extract (pack_t *pack, dpackfile_t *pf)
|
||||
{
|
||||
//const char *name = pf->name;
|
||||
|
||||
//fseek (pack->handle, pf->filepos, SEEK_SET);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue