mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-19 02:53:20 +00:00
Merge branch 'FileManagement' of http://git.magicalgirl.moe/STJr/SRB2Internal.git into FileManagement
# Conflicts: # src/w_wad.c
This commit is contained in:
commit
f22b16aa17
1 changed files with 49 additions and 43 deletions
12
src/w_wad.c
12
src/w_wad.c
|
@ -459,7 +459,6 @@ UINT16 W_LoadWadFile(const char *filename)
|
||||||
// Let's fill in the fields that we actually need.
|
// Let's fill in the fields that we actually need.
|
||||||
// (Declaring all those vars might not be the optimal way to do this, sorry.)
|
// (Declaring all those vars might not be the optimal way to do this, sorry.)
|
||||||
char *eName;
|
char *eName;
|
||||||
int namePos;
|
|
||||||
unsigned short int eNameLen = 8;
|
unsigned short int eNameLen = 8;
|
||||||
unsigned short int eXFieldLen = 0;
|
unsigned short int eXFieldLen = 0;
|
||||||
unsigned short int eCommentLen = 0;
|
unsigned short int eCommentLen = 0;
|
||||||
|
@ -484,6 +483,13 @@ UINT16 W_LoadWadFile(const char *filename)
|
||||||
|
|
||||||
eName = malloc(sizeof(char)*(eNameLen + 1));
|
eName = malloc(sizeof(char)*(eNameLen + 1));
|
||||||
fgets(eName, eNameLen + 1, handle);
|
fgets(eName, eNameLen + 1, handle);
|
||||||
|
if (0)//(eSize == 0) // Is this entry a folder?
|
||||||
|
{
|
||||||
|
CONS_Printf("Folder %s at %ld:\n", eName, ftell(handle));
|
||||||
|
}
|
||||||
|
else // If not, then it is a normal file. Let's arrange its lumpinfo structure then!
|
||||||
|
{
|
||||||
|
int namePos = eNameLen - 1;
|
||||||
CONS_Printf("File %s at: %ld\n", eName, ftell(handle));
|
CONS_Printf("File %s at: %ld\n", eName, ftell(handle));
|
||||||
if (numlumps == 0) // First lump? Let's allocate the first lumpinfo block.
|
if (numlumps == 0) // First lump? Let's allocate the first lumpinfo block.
|
||||||
lumpinfo = Z_Malloc(sizeof(*lumpinfo), PU_STATIC, NULL);
|
lumpinfo = Z_Malloc(sizeof(*lumpinfo), PU_STATIC, NULL);
|
||||||
|
@ -495,7 +501,6 @@ UINT16 W_LoadWadFile(const char *filename)
|
||||||
lumpinfo[numlumps].size = eSize;
|
lumpinfo[numlumps].size = eSize;
|
||||||
CONS_Printf("Address: %ld, Full: %ld, Comp: %ld\n", lumpinfo[numlumps].position, lumpinfo[numlumps].size, lumpinfo[numlumps].disksize);
|
CONS_Printf("Address: %ld, Full: %ld, Comp: %ld\n", lumpinfo[numlumps].position, lumpinfo[numlumps].size, lumpinfo[numlumps].disksize);
|
||||||
// We will trim the file's full name so that only the filename is left.
|
// We will trim the file's full name so that only the filename is left.
|
||||||
namePos = eNameLen - 1;
|
|
||||||
while(namePos--)
|
while(namePos--)
|
||||||
{
|
{
|
||||||
if(eName[namePos] == '/')
|
if(eName[namePos] == '/')
|
||||||
|
@ -530,6 +535,7 @@ UINT16 W_LoadWadFile(const char *filename)
|
||||||
}
|
}
|
||||||
fseek(handle, eXFieldLen + eCommentLen, SEEK_CUR); // We skip to where we expect the next central directory entry or end marker to be.
|
fseek(handle, eXFieldLen + eCommentLen, SEEK_CUR); // We skip to where we expect the next central directory entry or end marker to be.
|
||||||
numlumps++;
|
numlumps++;
|
||||||
|
}
|
||||||
free(eName);
|
free(eName);
|
||||||
}
|
}
|
||||||
// We found the central directory end signature?
|
// We found the central directory end signature?
|
||||||
|
@ -839,7 +845,7 @@ UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In a PK3 type of resource file, it looks for an entry with the specified full name.
|
// In a PK3 type of resource file, it looks for
|
||||||
// Returns lump position in PK3's lumpinfo, or INT16_MAX if not found.
|
// Returns lump position in PK3's lumpinfo, or INT16_MAX if not found.
|
||||||
UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump)
|
UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue