- added a FileReader wrapper for kopen4load.

Needed when transitioning the hightile loader to GZDoom's texture loader.
This commit is contained in:
Christoph Oelckers 2019-10-05 17:30:23 +02:00
parent 3fb5154dc9
commit bedfc262c4
3 changed files with 57 additions and 6 deletions

View file

@ -301,16 +301,15 @@ void scriptfile_preparse(scriptfile *sf, char *tx, int32_t flen)
scriptfile *scriptfile_fromfile(const char *fn)
{
buildvfs_kfd fp = kopen4load(fn, 0);
if (fp == buildvfs_kfd_invalid) return nullptr;
auto fr = kopenFileReader(fn, 0);
if (!fr.isOpen()) return nullptr;
uint32_t flen = kfilelength(fp);
uint32_t flen = fr.GetLength();
char * tx = (char *)Xmalloc(flen + 2);
scriptfile *sf = (scriptfile *)Xmalloc(sizeof(scriptfile));
kread(fp, tx, flen);
kclose(fp);
fr.Read(tx, flen);
tx[flen] = tx[flen+1] = 0;