OOP wad file stuff

This commit is contained in:
Jonathan 2021-09-04 23:23:03 -04:00
parent 3b656e6ef1
commit 04ad8e2962
5 changed files with 227 additions and 220 deletions

View File

@ -22,19 +22,24 @@
#ifndef WAD_H #ifndef WAD_H
#define WAD_H #define WAD_H
#include <stdbool.h> #include <unordered_map>
#include <vector>
#include <list>
#ifdef __cplusplus // Texture data stored for quick searching
extern "C" { struct texture_t {
#endif char name[16];
int width, height;
};
typedef struct { // WAD Format
struct wadinfo_t {
char identification[4]; // should be WAD2 char identification[4]; // should be WAD2
int numlumps; int numlumps;
int infotableofs; int infotableofs;
} wadinfo_t; };
typedef struct { struct lumpinfo_t {
int filepos; int filepos;
int disksize; int disksize;
int size; // uncompressed int size; // uncompressed
@ -42,38 +47,56 @@ typedef struct {
char compression; char compression;
char pad1, pad2; char pad1, pad2;
char name[16]; // must be null terminated char name[16]; // must be null terminated
} lumpinfo_t; };
typedef struct texture_s { struct case_insensitive_hash {
char name[16]; std::size_t operator()(const std::string &s) const noexcept {
int width, height; std::size_t hash = 0x811c9dc5;
struct texture_s *next; constexpr std::size_t prime = 0x1000193;
} texture_t;
for (auto &c : s) {
hash ^= tolower(c);
hash *= prime;
}
return hash;
}
};
struct case_insensitive_equal {
bool operator()(const std::string &l, const std::string &r) const noexcept {
return Q_strcasecmp(l.c_str(), r.c_str()) == 0;
}
};
struct wad_t {
wadinfo_t header;
int version;
std::unordered_map<std::string, lumpinfo_t, case_insensitive_hash, case_insensitive_equal> lumps;
std::unordered_map<std::string, texture_t, case_insensitive_hash, case_insensitive_equal> textures;
FILE *file;
~wad_t() {
if (file) {
fclose(file);
}
}
};
// Q1 miptex format
#define MIPLEVELS 4 #define MIPLEVELS 4
typedef struct { struct dmiptex_t {
char name[16]; char name[16];
uint32_t width, height; uint32_t width, height;
uint32_t offsets[MIPLEVELS]; uint32_t offsets[MIPLEVELS];
} dmiptex_t; };
typedef struct wad_s { void WADList_Init(const char *wadstring);
wadinfo_t header; void WADList_Process();
int version;
lumpinfo_t *lumps;
FILE *file;
struct wad_s *next;
} wad_t;
wad_t *WADList_AddWad(const char *fpath, bool external, wad_t *current_wadlist);
wad_t *WADList_Init(const char *wadstring);
void WADList_Process(const wad_t *wadlist);
void WADList_Free(wad_t *wadlist);
const texture_t *WADList_GetTexture(const char *name); const texture_t *WADList_GetTexture(const char *name);
// for getting a texture width/height // for getting a texture width/height
#ifdef __cplusplus // FIXME: don't like global state like this :(
} extern std::list<wad_t> wadlist;
#endif
#endif /* WAD_H */ #endif /* WAD_H */

View File

@ -584,7 +584,6 @@ CreateHulls(void)
} }
} }
wad_t *wadlist = NULL;
static bool wadlist_tried_loading = false; static bool wadlist_tried_loading = false;
void void
@ -600,19 +599,18 @@ EnsureTexturesLoaded()
// Quake II doesn't use wads, .wal's are loaded from pak/loose files // Quake II doesn't use wads, .wal's are loaded from pak/loose files
if (!options.target_version->quake2) { if (!options.target_version->quake2) {
wadlist = NULL;
wadstring = ValueForKey(pWorldEnt(), "_wad"); wadstring = ValueForKey(pWorldEnt(), "_wad");
if (!wadstring[0]) if (!wadstring[0])
wadstring = ValueForKey(pWorldEnt(), "wad"); wadstring = ValueForKey(pWorldEnt(), "wad");
if (!wadstring[0]) if (!wadstring[0])
Message(msgWarning, warnNoWadKey); Message(msgWarning, warnNoWadKey);
else else
wadlist = WADList_Init(wadstring); WADList_Init(wadstring);
} else { } else {
wadstring = ""; wadstring = "";
} }
if (!wadlist) { if (!wadlist.size()) {
if (wadstring[0]) if (wadstring[0])
Message(msgWarning, warnNoValidWads); Message(msgWarning, warnNoValidWads);
/* Try the default wad name */ /* Try the default wad name */
@ -620,8 +618,8 @@ EnsureTexturesLoaded()
strcpy(defaultwad, options.szMapName); strcpy(defaultwad, options.szMapName);
StripExtension(defaultwad); StripExtension(defaultwad);
DefaultExtension(defaultwad, ".wad"); DefaultExtension(defaultwad, ".wad");
wadlist = WADList_Init(defaultwad); WADList_Init(defaultwad);
if (wadlist) if (wadlist.size())
Message(msgLiteral, "Using default WAD: %s\n", defaultwad); Message(msgLiteral, "Using default WAD: %s\n", defaultwad);
free(defaultwad); free(defaultwad);
} }
@ -668,11 +666,11 @@ ProcessFile(void)
CreateHulls(); CreateHulls();
WriteEntitiesToString(); WriteEntitiesToString();
WADList_Process(wadlist); WADList_Process();
BSPX_CreateBrushList(); BSPX_CreateBrushList();
FinishBSPFile(); FinishBSPFile();
WADList_Free(wadlist); wadlist.clear();
} }

View File

@ -25,12 +25,6 @@
#include <qbsp/qbsp.hh> #include <qbsp/qbsp.hh>
#include <qbsp/wad.hh> #include <qbsp/wad.hh>
static void WADList_LoadTextures(const wad_t *wadlist, dmiptexlump_t *lump);
static int WAD_LoadLump(const wad_t *wad, const char *name, uint8_t *dest);
static void WADList_AddAnimationFrames(const wad_t *wadlist);
static texture_t *textures;
uint8_t thepalette[768] = // Quake palette uint8_t thepalette[768] = // Quake palette
{ {
0,0,0,15,15,15,31,31,31,47,47,47,63,63,63,75,75,75,91,91,91,107,107,107,123,123,123,139,139,139,155,155,155,171,171,171,187,187,187,203,203,203,219,219,219,235,235,235,15,11,7,23,15,11,31,23,11,39,27,15,47,35,19,55,43,23,63,47,23,75,55,27,83,59,27,91,67,31,99,75,31,107,83,31,115,87,31,123,95,35,131,103,35,143,111,35,11,11,15,19,19,27,27,27,39,39,39,51,47,47,63,55,55,75,63,63,87,71,71,103,79,79,115,91,91,127,99,99, 0,0,0,15,15,15,31,31,31,47,47,47,63,63,63,75,75,75,91,91,91,107,107,107,123,123,123,139,139,139,155,155,155,171,171,171,187,187,187,203,203,203,219,219,219,235,235,235,15,11,7,23,15,11,31,23,11,39,27,15,47,35,19,55,43,23,63,47,23,75,55,27,83,59,27,91,67,31,99,75,31,107,83,31,115,87,31,123,95,35,131,103,35,143,111,35,11,11,15,19,19,27,27,27,39,39,39,51,47,47,63,55,55,75,63,63,87,71,71,103,79,79,115,91,91,127,99,99,
@ -42,101 +36,103 @@ uint8_t thepalette[768] = // Quake palette
}; };
static bool static bool
WAD_LoadInfo(wad_t *wad, bool external) WAD_LoadInfo(wad_t &wad, bool external)
{ {
wadinfo_t *hdr = &wad->header; wadinfo_t *hdr = &wad.header;
int i, len, lumpinfosize; int i, len;
dmiptex_t miptex; dmiptex_t miptex;
texture_t *tex;
external |= options.fNoTextures; external |= options.fNoTextures;
len = fread(hdr, 1, sizeof(wadinfo_t), wad->file); len = fread(hdr, 1, sizeof(wadinfo_t), wad.file);
if (len != sizeof(wadinfo_t)) if (len != sizeof(wadinfo_t))
return false; return false;
wad->version = 0; wad.version = 0;
if (!strncmp(hdr->identification, "WAD2", 4)) if (!strncmp(hdr->identification, "WAD2", 4))
wad->version = 2; wad.version = 2;
else if (!strncmp(hdr->identification, "WAD3", 4)) else if (!strncmp(hdr->identification, "WAD3", 4))
wad->version = 3; wad.version = 3;
if (!wad->version) if (!wad.version)
return false; return false;
lumpinfosize = sizeof(lumpinfo_t) * hdr->numlumps; fseek(wad.file, hdr->infotableofs, SEEK_SET);
fseek(wad->file, hdr->infotableofs, SEEK_SET); wad.lumps.reserve(wad.header.numlumps);
wad->lumps = (lumpinfo_t *)AllocMem(OTHER, lumpinfosize, true);
len = fread(wad->lumps, 1, lumpinfosize, wad->file);
if (len != lumpinfosize)
return false;
/* Get the dimensions and make a texture_t */ /* Get the dimensions and make a texture_t */
for (i = 0; i < wad->header.numlumps; i++) { for (i = 0; i < wad.header.numlumps; i++) {
fseek(wad->file, wad->lumps[i].filepos, SEEK_SET); lumpinfo_t lump;
len = fread(&miptex, 1, sizeof(miptex), wad->file);
len = fread(&lump, 1, sizeof(lump), wad.file);
if (len != sizeof(lump))
return false;
auto restore_pos = ftell(wad.file);
fseek(wad.file, lump.filepos, SEEK_SET);
len = fread(&miptex, 1, sizeof(miptex), wad.file);
if (len == sizeof(miptex)) if (len == sizeof(miptex))
{ {
int w = LittleLong(miptex.width); int w = LittleLong(miptex.width);
int h = LittleLong(miptex.height); int h = LittleLong(miptex.height);
wad->lumps[i].size = sizeof(miptex) + (w>>0)*(h>>0) + (w>>1)*(h>>1) + (w>>2)*(h>>2) + (w>>3)*(h>>3); lump.size = sizeof(miptex) + (w>>0)*(h>>0) + (w>>1)*(h>>1) + (w>>2)*(h>>2) + (w>>3)*(h>>3);
if (options.target_version == &bspver_hl) if (options.target_version == &bspver_hl)
wad->lumps[i].size += 2+3*256; //palette size+palette data lump.size += 2+3*256; //palette size+palette data
wad->lumps[i].size = (wad->lumps[i].size+3) & ~3; //keep things aligned if we can. lump.size = (lump.size+3) & ~3; //keep things aligned if we can.
tex = (texture_t *)AllocMem(OTHER, sizeof(texture_t), true); texture_t tex;
tex->next = textures; memcpy(tex.name, miptex.name, 16);
textures = tex; tex.name[15] = '\0';
memcpy(tex->name, miptex.name, 16); tex.width = miptex.width;
tex->name[15] = '\0'; tex.height = miptex.height;
tex->width = miptex.width; wad.textures.insert({ tex.name, tex });
tex->height = miptex.height;
//if we're not going to embed it into the bsp, set its size now so we know how much to actually store. //if we're not going to embed it into the bsp, set its size now so we know how much to actually store.
if (external) if (external)
wad->lumps[i].size = wad->lumps[i].disksize = sizeof(dmiptex_t); lump.size = lump.disksize = sizeof(dmiptex_t);
//printf("Created texture_t %s %d %d\n", tex->name, tex->width, tex->height); //printf("Created texture_t %s %d %d\n", tex->name, tex->width, tex->height);
} }
else else
wad->lumps[i].size = 0; lump.size = 0;
fseek(wad.file, restore_pos, SEEK_SET);
wad.lumps.insert({ lump.name, lump });
} }
return true; return true;
} }
wad_t *WADList_AddWad(const char *fpath, bool external, wad_t *current_wadlist) static void WADList_OpenWad(const char *fpath, bool external)
{ {
wad_t wad = {0}; wad_t wad;
wad.file = fopen(fpath, "rb"); wad.file = fopen(fpath, "rb");
if (wad.file) { if (wad.file) {
if (options.fVerbose) if (options.fVerbose)
Message(msgLiteral, "Opened WAD: %s\n", fpath); Message(msgLiteral, "Opened WAD: %s\n", fpath);
if (WAD_LoadInfo(&wad, external)) {
wad_t *newwad = (wad_t *)AllocMem(OTHER, sizeof(wad), true);
memcpy(newwad, &wad, sizeof(wad));
newwad->next = current_wadlist;
// FIXME: leaves file open? if (WAD_LoadInfo(wad, external)) {
// (currently needed so that mips can be loaded later, as needed) wadlist.push_front(wad);
wad.file = nullptr; // wadlist now owns this file handle
return;
}
return newwad;
} else {
Message(msgWarning, warnNotWad, fpath); Message(msgWarning, warnNotWad, fpath);
fclose(wad.file); fclose(wad.file);
} else {
// Message?
} }
}
return current_wadlist;
} }
wad_t * void WADList_Init(const char *wadstring)
WADList_Init(const char *wadstring)
{ {
if (!wadstring || !wadstring[0]) if (!wadstring || !wadstring[0])
return nullptr; return;
wad_t *wadlist = nullptr;
const int len = strlen(wadstring); const int len = strlen(wadstring);
const char *pos = wadstring; const char *pos = wadstring;
while (pos - wadstring < len) { while (pos - wadstring < len) {
@ -151,124 +147,52 @@ WADList_Init(const char *wadstring)
memcpy(&fpath[0], fname, fpathLen); memcpy(&fpath[0], fname, fpathLen);
if (options.wadPathsVec.empty() || IsAbsolutePath(fpath.c_str())) { if (options.wadPathsVec.empty() || IsAbsolutePath(fpath.c_str())) {
wadlist = WADList_AddWad(fpath.c_str(), false, wadlist); WADList_OpenWad(fpath.c_str(), false);
} else { } else {
for (const options_t::wadpath& wadpath : options.wadPathsVec) { for (const options_t::wadpath& wadpath : options.wadPathsVec) {
const std::string fullPath = wadpath.path + "/" + fpath; const std::string fullPath = wadpath.path + "/" + fpath;
wadlist = WADList_AddWad(fullPath.c_str(), wadpath.external, wadlist); WADList_OpenWad(fullPath.c_str(), wadpath.external);
} }
} }
pos++; pos++;
} }
return wadlist;
} }
static const lumpinfo_t *
void WADList_FindTexture(const char *name)
WADList_Free(wad_t *wadlist)
{ {
wad_t *wad, *next; for (auto &wad : wadlist) {
auto it = wad.lumps.find(name);
for (wad = wadlist; wad; wad = next) { if (it == wad.lumps.end()) {
next = wad->next; continue;
fclose(wad->file);
free(wad->lumps);
free(wad);
} }
}
static lumpinfo_t * return &it->second;
WADList_FindTexture(const wad_t *wadlist, const char *name) }
{
int i;
const wad_t *wad;
for (wad = wadlist; wad; wad = wad->next)
for (i = 0; i < wad->header.numlumps; i++)
if (!Q_strcasecmp(name, wad->lumps[i].name))
return &wad->lumps[i];
return NULL; return NULL;
} }
void
WADList_Process(const wad_t *wadlist)
{
int i;
lumpinfo_t *texture;
dmiptexlump_t *miptexlump;
WADList_AddAnimationFrames(wadlist);
/* Count space for miptex header/offsets */
size_t texdatasize = offsetof(dmiptexlump_t, dataofs[0]) + (map.nummiptex() * sizeof(uint32_t));
/* Count texture size. Slower, but saves memory. */
for (i = 0; i < map.nummiptex(); i++) {
texture = WADList_FindTexture(wadlist, map.texinfoTextureName(i).c_str());
if (texture) {
texdatasize += texture->size;
}
}
/* Default texture data to store in worldmodel */
map.exported_texdata = std::string(texdatasize, '\0');
miptexlump = (dmiptexlump_t *)map.exported_texdata.data();
miptexlump->nummiptex = map.nummiptex();
WADList_LoadTextures(wadlist, miptexlump);
/* Last pass, mark unfound textures as such */
for (i = 0; i < map.nummiptex(); i++) {
if (miptexlump->dataofs[i] == 0) {
miptexlump->dataofs[i] = -1;
Message(msgWarning, warnTextureNotFound, map.texinfoTextureName(i).c_str());
}
}
}
static void
WADList_LoadTextures(const wad_t *wadlist, dmiptexlump_t *lump)
{
int i, size;
uint8_t *data;
const wad_t *wad;
data = (uint8_t *)&lump->dataofs[map.nummiptex()];
for (i = 0; i < map.nummiptex(); i++) {
if (lump->dataofs[i])
continue;
size = 0;
for (wad = wadlist; wad; wad = wad->next) {
size = WAD_LoadLump(wad, map.texinfoTextureName(i).c_str(), data);
if (size)
break;
}
if (!size)
continue;
if (data + size - (uint8_t *)map.exported_texdata.data() > map.exported_texdata.size())
Error("Internal error: not enough texture memory allocated");
lump->dataofs[i] = data - (uint8_t *)lump;
data += size;
}
}
static int static int
WAD_LoadLump(const wad_t *wad, const char *name, uint8_t *dest) WAD_LoadLump(const wad_t &wad, const char *name, uint8_t *dest)
{ {
int i; int i;
int size; int size;
for (i = 0; i < wad->header.numlumps; i++) { auto it = wad.lumps.find(name);
if (!Q_strcasecmp(name, wad->lumps[i].name)) {
fseek(wad->file, wad->lumps[i].filepos, SEEK_SET); if (it == wad.lumps.end()) {
if (wad->lumps[i].disksize == sizeof(dmiptex_t)) return 0;
{ }
size = fread(dest, 1, sizeof(dmiptex_t), wad->file);
auto &lump = it->second;
fseek(wad.file, lump.filepos, SEEK_SET);
if (lump.disksize == sizeof(dmiptex_t)) {
size = fread(dest, 1, sizeof(dmiptex_t), wad.file);
if (size != sizeof(dmiptex_t)) if (size != sizeof(dmiptex_t))
Error("Failure reading from file"); Error("Failure reading from file");
for (i = 0; i < MIPLEVELS; i++) for (i = 0; i < MIPLEVELS; i++)
@ -276,12 +200,11 @@ WAD_LoadLump(const wad_t *wad, const char *name, uint8_t *dest)
return sizeof(dmiptex_t); return sizeof(dmiptex_t);
} }
if (wad->lumps[i].size != wad->lumps[i].disksize) if (lump.size != lump.disksize) {
{ logprint("Texture %s is %i bytes in wad, packed to %i bytes in bsp\n", name, lump.disksize, lump.size);
logprint("Texture %s is %i bytes in wad, packed to %i bytes in bsp\n", name, wad->lumps[i].disksize, wad->lumps[i].size); std::vector<uint8_t> data(lump.disksize);
std::vector<uint8_t> data(wad->lumps[i].disksize); size = fread(data.data(), 1, lump.disksize, wad.file);
size = fread(data.data(), 1, wad->lumps[i].disksize, wad->file); if (size != lump.disksize)
if (size != wad->lumps[i].disksize)
Error("Failure reading from file"); Error("Failure reading from file");
auto out = (dmiptex_t *)dest; auto out = (dmiptex_t *)dest;
auto in = (dmiptex_t *)data.data(); auto in = (dmiptex_t *)data.data();
@ -302,7 +225,7 @@ WAD_LoadLump(const wad_t *wad, const char *name, uint8_t *dest)
dest[palofs+1] = ((256>>8)&0xff); dest[palofs+1] = ((256>>8)&0xff);
//now the palette //now the palette
if (wad->version == 3) if (wad.version == 3)
memcpy(dest+palofs+2, data.data()+(in->offsets[3]+(in->width>>3)*(in->height>>3)+2), 3*256); memcpy(dest+palofs+2, data.data()+(in->offsets[3]+(in->width>>3)*(in->height>>3)+2), 3*256);
else else
memcpy(dest+palofs+2, thepalette, 3*256); //FIXME: quake palette or something. memcpy(dest+palofs+2, thepalette, 3*256); //FIXME: quake palette or something.
@ -310,19 +233,41 @@ WAD_LoadLump(const wad_t *wad, const char *name, uint8_t *dest)
} }
else else
{ {
size = fread(dest, 1, wad->lumps[i].disksize, wad->file); size = fread(dest, 1, lump.disksize, wad.file);
if (size != wad->lumps[i].disksize) if (size != lump.disksize)
Error("Failure reading from file"); Error("Failure reading from file");
} }
return wad->lumps[i].size; return lump.size;
}
}
return 0;
} }
static void static void
WADList_AddAnimationFrames(const wad_t *wadlist) WADList_LoadTextures(dmiptexlump_t *lump)
{
int i, size;
uint8_t *data;
data = (uint8_t *)&lump->dataofs[map.nummiptex()];
for (i = 0; i < map.nummiptex(); i++) {
if (lump->dataofs[i])
continue;
size = 0;
for (auto &wad : wadlist) {
size = WAD_LoadLump(wad, map.texinfoTextureName(i).c_str(), data);
if (size)
break;
}
if (!size)
continue;
if (data + size - (uint8_t *)map.exported_texdata.data() > map.exported_texdata.size())
Error("Internal error: not enough texture memory allocated");
lump->dataofs[i] = data - (uint8_t *)lump;
data += size;
}
}
static void
WADList_AddAnimationFrames()
{ {
int oldcount, i, j; int oldcount, i, j;
@ -337,7 +282,7 @@ WADList_AddAnimationFrames(const wad_t *wadlist)
/* Search for all animations (0-9) and alt-animations (A-J) */ /* Search for all animations (0-9) and alt-animations (A-J) */
for (j = 0; j < 20; j++) { for (j = 0; j < 20; j++) {
name[1] = (j < 10) ? '0' + j : 'a' + j - 10; name[1] = (j < 10) ? '0' + j : 'a' + j - 10;
if (WADList_FindTexture(wadlist, name.c_str())) if (WADList_FindTexture(name.c_str()))
FindMiptex(name.c_str()); FindMiptex(name.c_str());
} }
} }
@ -345,13 +290,55 @@ WADList_AddAnimationFrames(const wad_t *wadlist)
Message(msgStat, "%8d texture frames added", map.nummiptex() - oldcount); Message(msgStat, "%8d texture frames added", map.nummiptex() - oldcount);
} }
void
WADList_Process()
{
int i;
const lumpinfo_t *texture;
dmiptexlump_t *miptexlump;
WADList_AddAnimationFrames();
/* Count space for miptex header/offsets */
size_t texdatasize = offsetof(dmiptexlump_t, dataofs[0]) + (map.nummiptex() * sizeof(uint32_t));
/* Count texture size. Slower, but saves memory. */
for (i = 0; i < map.nummiptex(); i++) {
texture = WADList_FindTexture(map.texinfoTextureName(i).c_str());
if (texture) {
texdatasize += texture->size;
}
}
/* Default texture data to store in worldmodel */
map.exported_texdata = std::string(texdatasize, '\0');
miptexlump = (dmiptexlump_t *)map.exported_texdata.data();
miptexlump->nummiptex = map.nummiptex();
WADList_LoadTextures(miptexlump);
/* Last pass, mark unfound textures as such */
for (i = 0; i < map.nummiptex(); i++) {
if (miptexlump->dataofs[i] == 0) {
miptexlump->dataofs[i] = -1;
Message(msgWarning, warnTextureNotFound, map.texinfoTextureName(i).c_str());
}
}
}
const texture_t *WADList_GetTexture(const char *name) const texture_t *WADList_GetTexture(const char *name)
{ {
texture_t *tex; for (auto &wad : wadlist) {
for (tex = textures; tex; tex = tex->next) auto it = wad.textures.find(name);
{
if (!strcmp(name, tex->name)) if (it == wad.textures.end()) {
return tex; return nullptr;
} }
return NULL;
return &it->second;
}
return nullptr;
} }
std::list<wad_t> wadlist;

View File

@ -141,7 +141,7 @@ ExportMapTexinfo(int texinfonum)
} }
strcpy(dest->texture, map.texinfoTextureName(texinfonum).c_str()); strcpy(dest->texture, map.texinfoTextureName(texinfonum).c_str());
dest->flags = map.miptex[src->miptex].flags; //dest->flags = map.miptex[src->miptex].flags;
dest->value = map.miptex[src->miptex].value; dest->value = map.miptex[src->miptex].value;
src->outputnum = i; src->outputnum = i;

View File

@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <common/cmdlib.hh> #include <common/cmdlib.hh>
#include <common/mathlib.hh> #include <common/mathlib.hh>
//#include <common/scriplib.hh>
#include <common/polylib.hh> #include <common/polylib.hh>
#include <common/threads.hh> #include <common/threads.hh>
#include <common/bspfile.hh> #include <common/bspfile.hh>