mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-09 23:10:49 +00:00
- added a directory list function to the file system.
- fixed lookup for resources by ID - it always picked the first candidate from the hash chain without checking the actual ID.
This commit is contained in:
parent
7d7507d453
commit
ddfb2223db
2 changed files with 16 additions and 23 deletions
|
@ -48,6 +48,7 @@
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "resourcefile.h"
|
#include "resourcefile.h"
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
|
#include "c_dispatch.h"
|
||||||
//#include "md5.h"
|
//#include "md5.h"
|
||||||
//#include "doomstat.h"
|
//#include "doomstat.h"
|
||||||
|
|
||||||
|
@ -322,6 +323,7 @@ int FileSystem::FindResource (int resid, const char *type, int filenum) const no
|
||||||
for (i = fli[int(resid) % NumEntries]; i != NULL_INDEX; i = nli[i])
|
for (i = fli[int(resid) % NumEntries]; i != NULL_INDEX; i = nli[i])
|
||||||
{
|
{
|
||||||
if (filenum > 0 && FileInfo[i].rfnum != filenum) continue;
|
if (filenum > 0 && FileInfo[i].rfnum != filenum) continue;
|
||||||
|
if (FileInfo[i].lump->ResourceId != resid) continue;
|
||||||
auto lump = FileInfo[i].lump;
|
auto lump = FileInfo[i].lump;
|
||||||
if (lump->LumpName[lookuptype] == lname) return i;
|
if (lump->LumpName[lookuptype] == lname) return i;
|
||||||
}
|
}
|
||||||
|
@ -1064,28 +1066,18 @@ static void PrintLastError ()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
CCMD(printfs)
|
||||||
void FileSystem::HashDump()
|
|
||||||
{
|
{
|
||||||
FILE* f = fopen("fs_hash.txt", "wb");
|
fileSystem.PrintDirectory();
|
||||||
for (int list = 0; list < 5; list++)
|
}
|
||||||
{
|
|
||||||
fprintf(f, "List %d\n------------\n", list);
|
void FileSystem::PrintDirectory()
|
||||||
auto fli = FirstFileIndex[list];
|
{
|
||||||
auto nli = NextFileIndex[list];
|
for (int i = 0; i < NumEntries; i++)
|
||||||
for (int hash = 0; hash < NumEntries; hash++)
|
{
|
||||||
{
|
auto lump = FileInfo[i].lump;
|
||||||
if (fli[hash] != NULL_INDEX)
|
auto f = GetFileContainer(i);
|
||||||
{
|
auto n = GetResourceFileFullName(f);
|
||||||
fprintf(f, "\tHash %d\n", hash);
|
Printf("%5d: %9d %64s %4s %3d %s\n", i, lump->LumpSize, lump->LumpName[0].GetChars(), lump->LumpName[4].GetChars(), lump->ResourceId, n);
|
||||||
for (uint32_t i = fli[hash]; i != NULL_INDEX; i = nli[i])
|
}
|
||||||
{
|
|
||||||
auto lump = FileInfo[i].lump;
|
|
||||||
fprintf(f, "\t\t%s (%d)\t%d, %d\n", lump->LumpName[list].GetChars(), lump->LumpName[list].GetIndex(), lump->Size(), i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
|
@ -148,6 +148,7 @@ public:
|
||||||
{
|
{
|
||||||
return FileInfo[lump].lump;
|
return FileInfo[lump].lump;
|
||||||
}
|
}
|
||||||
|
void PrintDirectory();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue