Those libraries are not GPLreckless wrote:btw source allready makes use of GPL code (libpng jpeg and zlib) so i think it should be ok
![Wink :wink:](./images/smilies/icon_wink.gif)
Those libraries are not GPLreckless wrote:btw source allready makes use of GPL code (libpng jpeg and zlib) so i think it should be ok
Even after disabling CPU optimizations, it's crashing on my Win7 64-bit i3 machine. Usual map load readout is per screenshot below, eXXXX/bXXXX. Normally even a large map loads quickly. The current CB version is stuck on e1/bXXXX (second screenshot) and "b" increments slowly up to around 2,000 and then locks up. Also, textures are not shown.reckless wrote:anyone had time to test it yet ?
Where's the source?reckless wrote:ill upload my source + built executables for testing (im kinda interrested in finding out if it crashes anywhere else) the source has a C::B workspace.
http://code.google.com/p/realm/download ... z&can=2&q=
Code: Select all
void TTextureWindow::ScanNewWalFromPak(bool prompt)
{
const char err_title[] = "BSP Scan Pak";
if (!set.Map_Read)
return;
map *m = map_i[set.curmap];
if (!m)
return;
char dirname[256] = "";
if (prompt)
{
char filename[256];
OPENFILENAME ofn;
memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.lStructSize = OPENFILENAMESTRUCTSIZE;
ofn.hwndOwner = frame->hwnd;
ofn.lpstrFilter = "Pak files (*.pak)\0*.pak\0";
ofn.lpstrDefExt = "pak";
ofn.lpstrFile = filename;
ofn.nMaxFile = 256;
ofn.lpstrTitle = "Select Quake 2 Pak0.Pak File";
ofn.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
if (!set.pakOk)
{
*filename = 0;
}
else
{
strncpy(filename, set.pak_file, sizeof(filename));
}
if(!GetOpenFileName(&ofn))
return;
STRNCPY(dirname,filename);
}
else
{
if (!set.pakOk)
return;
STRNCPY(dirname,set.pak_file);
}
// check that it's a .pak file...
if (!file_exists(dirname))
{
sprintf(dirname, "Pak file does not exist [%s]...", dirname);
MessageBox(hwnd, dirname, err_title, MB_OK | MB_ICONEXCLAMATION);
return;
}
FILE *f;
pakheader_t pakheader;
pakentry_t *pakentry;
int numentries;
int i;
f = fopen(dirname,"rb");
if (!f)
{
sprintf(dirname,"Unable to open pak file\n%s",dirname);
MessageBox(hwnd,dirname,err_title,MB_OK | MB_ICONEXCLAMATION);
return;
}
fread(&pakheader,sizeof(pakheader_t),1,f);
if (strnicmp((char *)pakheader.magic,"PACK",4))
{
fclose(f);
sprintf(dirname,"[%s] is not a valid pak file...",dirname);
MessageBox(hwnd,dirname,err_title,MB_OK | MB_ICONEXCLAMATION);
return;
}
numentries = pakheader.dirsize / (sizeof(pakentry_t));
fseek(f,pakheader.diroffset,SEEK_SET);
pakentry = new pakentry_t[numentries];
for (i=0; i<numentries; i++)
fread(&pakentry[i],sizeof(pakentry_t),1,f);
fclose(f);
pakentry_t *e;
textureEntry firstEntry;
memset(&firstEntry,0,sizeof(textureEntry));
char **EntryList;
int maxEntries = 64; // maximum texture dirs...
int EntrySize = 64;
int curEntries = 0;
EntryList = new char *[maxEntries];
memset(EntryList,0,maxEntries*sizeof(char *));
for (i = 0; i < maxEntries; i++)
{
EntryList[i] = new char[EntrySize];
memset(EntryList[i],0,EntrySize * sizeof(char));
}
int left, right, current;
int done, index;
int testVal;
char dir[256];
char *start;
int c = numentries;
int ct;
for (i= 0 ; i < c ; i++)
{
e = &pakentry[i];
start = (char *)e->filename;
if (strnicmp(start,"textures",8))
continue;
start += strlen("textures");
//verify dir separator
if(*start != '/' && *start != '\\')
continue;
start++;
STRNCPY(dir,start);
start = dir;
ct = 0;
while (*start && *start != '\\' && *start != '/' && ct++ <= 32)
start++;
if (ct >= 32) // problem, so skip...
continue;
//verify dir separator
if(*start != '/' && *start != '\\')
continue;
*start = 0;
left = 0; // first
right = curEntries; //last+1 // never gets tested...
done = 0;
index = -1;
current = (left+right)/2;
while (!done)
{
char *tP = EntryList[current];
testVal = strcmpi(dir,tP);
// check for exact match...
if (testVal == 0)
{
index = current;
break;
}
else if (testVal > 0)
{
left = current;
current = (left+right)/2;
}
else if (testVal < 0)
{
right = current;
current = (left+right)/2;
}
if ((right - left) <= 1)
{
if (!strcmpi(dir,EntryList[left]))
{
index = left;
}
done = 1;
}
}
if (index >= 0) // if found it, then skip
continue;
if (index == -1) // not found, just insert
{
if (curEntries == 0) // empty list, put in first slot
{
strcpy(EntryList[curEntries++],dir);
}
else
{
int slot = -1;
int w;
int tVal;
for (w = 0; w < curEntries; w++)
{
tVal = strcmpi(dir,EntryList[w]);
if (tVal < 0)
{
slot = w;
break;
}
}
if (slot == -1)
slot = curEntries; // put at end...
for (w = curEntries; w > slot; w--)
strcpy(EntryList[w], EntryList[w-1]);
strcpy(EntryList[slot],dir);
curEntries++;
}
}
}
if (curEntries <= 0)
{
sprintf(dirname,"No subdirectories in pak [%s]...",dirname);
MessageBox(hwnd, dirname, err_title, MB_OK | MB_ICONEXCLAMATION);
delete[] pakentry;
for (i = 0; i < maxEntries; i++)
delete[] EntryList[i];
delete[] EntryList;
return;
}
TScanTransferBuffer x;
x.Directory.Clear();
*x.caption = 0;
for (i = 0; i < curEntries; i++)
x.Directory.Add(EntryList[i]);
TScanDlg dialog(hwnd,&x);
int retval = dialog.Execute();
if (retval == IDOK)
{
strncpy(dir,x.selected,sizeof(dir));
texWad *Wad = QueryWadLoaded(dir); // scan through list!
// if found it, just change to it...
if (!Wad)
{
Wad = new texWad;
strncpy(Wad->currentWad,dir,sizeof(Wad->currentWad)); // may get overwritten anyway...
Wad->WadType = QUAKE_WAD;
Wad->bmpsCount = 0;
Wad->textures = NULL;
Wad->nextWad = firstWad;
firstWad = Wad;
currentWadPtr = Wad;
LoadPakDirectory(dir,dirname); // load it in...
}
m->Wads[m->numWads++] = Wad;
UnloadTextures();
SetUpMap(m);
ChangeToMap(m);
sprintf(dirname,"Directory [%s] scanned...",dir);
set.redrawxy = 1;
set.redrawedit = 1;
Show_Frame(dirname,true);
prevIndex = 0;
ResetDefaults();
RedrawContents();
}
delete[] pakentry;
for (i = 0; i < maxEntries; i++)
delete[] EntryList[i];
delete[] EntryList;
}
I'm loading this .map http://www.quaddicted.com/reviews/apsp2.htmlreckless wrote:can you provide me with a test map jeff ? also try and run the debug exe through gdb ill do the same.
it loads here and pretty fast to so im a bit stumped.